From 472ade84c1c7de0cb7582c7342f83437f8d898c0 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Sat, 12 Jul 2014 07:23:09 +0000 Subject: [PATCH 1/1] Import cogl_1.18.2.orig.tar.xz [dgit import orig cogl_1.18.2.orig.tar.xz] --- ABOUT-NLS | 1068 + COPYING | 107 + ChangeLog | 20 + Makefile.am | 48 + Makefile.in | 1147 + NEWS | 1395 + README | 177 + README.in | 177 + aclocal.m4 | 1724 + build/Makefile-msvcproj.mak | 56 + build/Makefile.am | 1 + build/Makefile.in | 753 + build/autotools/Makefile.am.enums | 51 + build/autotools/Makefile.am.release | 163 + build/autotools/Makefile.am.silent | 19 + build/autotools/acglib.m4 | 131 + build/autotools/as-compiler-flag.m4 | 62 + build/autotools/as-glibconfig.m4 | 2141 ++ build/autotools/as-linguas.m4 | 24 + build/autotools/gettext.m4 | 381 + build/autotools/gtk-doc.m4 | 71 + build/autotools/iconv.m4 | 180 + build/autotools/intlmacosx.m4 | 51 + build/autotools/lib-ld.m4 | 110 + build/autotools/lib-link.m4 | 709 + build/autotools/lib-prefix.m4 | 185 + build/autotools/libtool.m4 | 7982 ++++ build/autotools/ltoptions.m4 | 384 + build/autotools/ltsugar.m4 | 123 + build/autotools/ltversion.m4 | 23 + build/autotools/lt~obsolete.m4 | 98 + build/autotools/nls.m4 | 31 + build/autotools/po.m4 | 449 + build/autotools/progtest.m4 | 92 + build/compile | 347 + build/config.guess | 1568 + build/config.rpath | 666 + build/config.sub | 1793 + build/depcomp | 791 + build/install-sh | 527 + build/ltmain.sh | 9655 +++++ build/missing | 215 + build/win32/Makefile.am | 3 + build/win32/Makefile.in | 752 + build/win32/gen-enums.bat | 6 + build/win32/vs10/Makefile.am | 34 + build/win32/vs10/Makefile.in | 605 + build/win32/vs10/README.txt | 89 + build/win32/vs10/cogl-build-defines.props | 59 + build/win32/vs10/cogl-crate.vcxproj | 176 + build/win32/vs10/cogl-crate.vcxproj.filters | 14 + build/win32/vs10/cogl-gen-srcs.props | 107 + build/win32/vs10/cogl-hello.vcxproj | 160 + build/win32/vs10/cogl-hello.vcxproj.filters | 14 + build/win32/vs10/cogl-info.vcxproj | 168 + build/win32/vs10/cogl-info.vcxproj.filters | 14 + build/win32/vs10/cogl-install.props | 241 + build/win32/vs10/cogl-msaa.vcxproj | 169 + build/win32/vs10/cogl-msaa.vcxproj.filters | 14 + build/win32/vs10/cogl-pango.vcxproj | 210 + build/win32/vs10/cogl-pango.vcxproj.filters | 23 + build/win32/vs10/cogl-pango.vcxproj.filtersin | 19 + build/win32/vs10/cogl-pango.vcxprojin | 206 + build/win32/vs10/cogl-path.vcxproj | 240 + build/win32/vs10/cogl-path.vcxproj.filters | 35 + build/win32/vs10/cogl-path.vcxproj.filtersin | 25 + build/win32/vs10/cogl-path.vcxprojin | 230 + build/win32/vs10/cogl-sdl2-hello.vcxproj | 173 + .../vs10/cogl-sdl2-hello.vcxproj.filters | 14 + build/win32/vs10/cogl-version-paths.props | 53 + build/win32/vs10/cogl.sln | 174 + build/win32/vs10/cogl.vcxproj | 639 + build/win32/vs10/cogl.vcxproj.filters | 143 + build/win32/vs10/cogl.vcxproj.filtersin | 41 + build/win32/vs10/cogl.vcxprojin | 537 + build/win32/vs10/install.vcxproj | 217 + .../win32/vs10/test-conformance-cogl.vcxproj | 231 + .../test-conformance-cogl.vcxproj.filters | 59 + .../test-conformance-cogl.vcxproj.filtersin | 13 + .../vs10/test-conformance-cogl.vcxprojin | 185 + build/win32/vs9/Makefile.am | 21 + build/win32/vs9/Makefile.in | 592 + build/win32/vs9/README.txt | 95 + build/win32/vs9/cogl-build-defines.vsprops | 53 + build/win32/vs9/cogl-crate.vcproj | 161 + build/win32/vs9/cogl-gen-srcs.vsprops | 102 + build/win32/vs9/cogl-hello.vcproj | 157 + build/win32/vs9/cogl-info.vcproj | 157 + build/win32/vs9/cogl-install.vsprops | 133 + build/win32/vs9/cogl-msaa.vcproj | 157 + build/win32/vs9/cogl-pango.vcproj | 212 + build/win32/vs9/cogl-pango.vcprojin | 208 + build/win32/vs9/cogl-path.vcproj | 277 + build/win32/vs9/cogl-path.vcprojin | 267 + build/win32/vs9/cogl-sdl2-hello.vcproj | 161 + build/win32/vs9/cogl-version-paths.vsprops | 53 + build/win32/vs9/cogl.sln | 208 + build/win32/vs9/cogl.vcproj | 800 + build/win32/vs9/cogl.vcprojin | 698 + build/win32/vs9/install.vcproj | 143 + build/win32/vs9/test-conformance-cogl.vcproj | 212 + .../win32/vs9/test-conformance-cogl.vcprojin | 166 + cogl-gles2/GLES2/gl2.h | 169 + cogl-gles2/GLES2/gl2ext.h | 1498 + cogl-gles2/GLES2/gl2platform.h | 28 + cogl-gles2/Makefile.am | 36 + cogl-gles2/Makefile.in | 875 + cogl-gles2/cogl-gles2-1.0.pc.in | 13 + cogl-gles2/cogl-gles2-2.0-experimental.pc.in | 13 + cogl-gles2/cogl-gles2-api.c | 1048 + cogl-gst/Makefile.am | 107 + cogl-gst/Makefile.in | 1055 + cogl-gst/cogl-gst-1.0.pc.in | 13 + cogl-gst/cogl-gst-2.0-experimental.pc.in | 13 + cogl-gst/cogl-gst-plugin.c | 57 + cogl-gst/cogl-gst-video-sink.c | 1743 + cogl-gst/cogl-gst-video-sink.h | 533 + cogl-gst/cogl-gst.h | 35 + cogl-gst/cogl-gst.pc.in | 13 + cogl-pango/Makefile.am | 144 + cogl-pango/Makefile.in | 1079 + cogl-pango/cogl-pango-1.0.pc.in | 13 + cogl-pango/cogl-pango-2.0-experimental.pc.in | 13 + cogl-pango/cogl-pango-display-list.c | 499 + cogl-pango/cogl-pango-display-list.h | 84 + cogl-pango/cogl-pango-fontmap.c | 180 + cogl-pango/cogl-pango-glyph-cache.c | 433 + cogl-pango/cogl-pango-glyph-cache.h | 100 + cogl-pango/cogl-pango-pipeline-cache.c | 242 + cogl-pango/cogl-pango-pipeline-cache.h | 72 + cogl-pango/cogl-pango-private.h | 65 + cogl-pango/cogl-pango-render.c | 929 + cogl-pango/cogl-pango.h | 298 + cogl-pango/cogl-pango.pc.in | 13 + cogl-pango/cogl-pango.rc | 30 + cogl-pango/cogl-pango.rc.in | 30 + cogl-pango/cogl-pango.symbols | 12 + cogl-path/Makefile.am | 122 + cogl-path/Makefile.in | 1208 + cogl-path/cogl-path-1.0.pc.in | 13 + cogl-path/cogl-path-2.0-experimental.pc.in | 13 + cogl-path/cogl-path-enum-types.c.in | 50 + cogl-path/cogl-path-enum-types.h.in | 25 + cogl-path/cogl-path-private.h | 126 + cogl-path/cogl-path-types.h | 85 + cogl-path/cogl-path.c | 1602 + cogl-path/cogl-path.h | 68 + cogl-path/cogl-path.pc.in | 13 + cogl-path/cogl-path.symbols | 59 + cogl-path/cogl1-path-functions.h | 467 + cogl-path/cogl1-path.c | 353 + cogl-path/cogl2-path-functions.h | 545 + cogl-path/tesselator/GL/glu.h | 47 + cogl-path/tesselator/README | 446 + cogl-path/tesselator/dict-list.h | 100 + cogl-path/tesselator/dict.c | 111 + cogl-path/tesselator/dict.h | 100 + cogl-path/tesselator/geom.c | 264 + cogl-path/tesselator/geom.h | 84 + cogl-path/tesselator/gluos.h | 1 + cogl-path/tesselator/memalloc.h | 49 + cogl-path/tesselator/mesh.c | 798 + cogl-path/tesselator/mesh.h | 266 + cogl-path/tesselator/normal.c | 257 + cogl-path/tesselator/normal.h | 45 + cogl-path/tesselator/priorityq-heap.c | 256 + cogl-path/tesselator/priorityq-heap.h | 107 + cogl-path/tesselator/priorityq-sort.h | 117 + cogl-path/tesselator/priorityq.c | 261 + cogl-path/tesselator/priorityq.h | 117 + cogl-path/tesselator/render.c | 502 + cogl-path/tesselator/render.h | 52 + cogl-path/tesselator/sweep.c | 1361 + cogl-path/tesselator/sweep.h | 77 + cogl-path/tesselator/tess.c | 632 + cogl-path/tesselator/tess.h | 165 + cogl-path/tesselator/tesselator.h | 122 + cogl-path/tesselator/tessmono.c | 201 + cogl-path/tesselator/tessmono.h | 71 + cogl/Makefile.am | 711 + cogl/Makefile.in | 3119 ++ cogl/cogl-1.0.pc.in | 13 + cogl/cogl-2.0-experimental.pc.in | 13 + cogl/cogl-atlas-texture-private.h | 81 + cogl/cogl-atlas-texture.c | 1047 + cogl/cogl-atlas-texture.h | 258 + cogl/cogl-atlas.c | 690 + cogl/cogl-atlas.h | 105 + cogl/cogl-attribute-buffer-private.h | 44 + cogl/cogl-attribute-buffer.c | 104 + cogl/cogl-attribute-buffer.h | 152 + cogl/cogl-attribute-private.h | 140 + cogl/cogl-attribute.c | 687 + cogl/cogl-attribute.h | 558 + cogl/cogl-bitmap-conversion.c | 748 + cogl/cogl-bitmap-packing.h | 767 + cogl/cogl-bitmap-pixbuf.c | 475 + cogl/cogl-bitmap-private.h | 213 + cogl/cogl-bitmap.c | 538 + cogl/cogl-bitmap.h | 336 + cogl/cogl-bitmask.c | 489 + cogl/cogl-bitmask.h | 312 + cogl/cogl-blend-string.c | 1003 + cogl/cogl-blend-string.h | 144 + cogl/cogl-blit.c | 438 + cogl/cogl-blit.h | 101 + cogl/cogl-boxed-value.c | 377 + cogl/cogl-boxed-value.h | 117 + cogl/cogl-buffer-private.h | 180 + cogl/cogl-buffer.c | 411 + cogl/cogl-buffer.h | 324 + cogl/cogl-clip-stack.c | 412 + cogl/cogl-clip-stack.h | 213 + cogl/cogl-closure-list-private.h | 118 + cogl/cogl-closure-list.c | 71 + cogl/cogl-color-private.h | 51 + cogl/cogl-color.c | 449 + cogl/cogl-color.h | 604 + cogl/cogl-config-private.h | 45 + cogl/cogl-config.c | 147 + cogl/cogl-context-private.h | 406 + cogl/cogl-context.c | 786 + cogl/cogl-context.h | 401 + cogl/cogl-debug-options.h | 199 + cogl/cogl-debug.c | 304 + cogl/cogl-debug.h | 126 + cogl/cogl-defines.h.in | 45 + cogl/cogl-defines.h.win32 | 77 + cogl/cogl-defines.h.win32.in | 77 + cogl/cogl-defines.h.win32_SDL | 78 + cogl/cogl-defines.h.win32_SDL.in | 78 + cogl/cogl-deprecated.h | 43 + cogl/cogl-depth-state-private.h | 38 + cogl/cogl-depth-state.c | 116 + cogl/cogl-depth-state.h | 270 + cogl/cogl-display-private.h | 58 + cogl/cogl-display.c | 182 + cogl/cogl-display.h | 234 + cogl/cogl-driver.h | 268 + cogl/cogl-egl-defines.h.in | 40 + cogl/cogl-egl-private.h | 40 + cogl/cogl-egl.h | 118 + cogl/cogl-enum-types.c.in | 50 + cogl/cogl-enum-types.h.in | 25 + cogl/cogl-error-private.h | 59 + cogl/cogl-error.c | 135 + cogl/cogl-error.h | 185 + cogl/cogl-euler.c | 198 + cogl/cogl-euler.h | 269 + cogl/cogl-feature-private.c | 234 + cogl/cogl-feature-private.h | 106 + cogl/cogl-fence-private.h | 66 + cogl/cogl-fence.c | 236 + cogl/cogl-fence.h | 143 + cogl/cogl-flags.h | 130 + cogl/cogl-frame-info-private.h | 50 + cogl/cogl-frame-info.c | 81 + cogl/cogl-frame-info.h | 148 + cogl/cogl-framebuffer-private.h | 510 + cogl/cogl-framebuffer.c | 2503 ++ cogl/cogl-framebuffer.h | 1818 + cogl/cogl-gl-header.h.in | 46 + cogl/cogl-gl-header.h.win32 | 48 + cogl/cogl-gles2-context-private.h | 201 + cogl/cogl-gles2-context.c | 1966 + cogl/cogl-gles2-types.h | 474 + cogl/cogl-gles2.h | 420 + cogl/cogl-glib-source.c | 195 + cogl/cogl-glib-source.h | 97 + cogl/cogl-glsl-shader-boilerplate.h | 86 + cogl/cogl-glsl-shader-private.h | 41 + cogl/cogl-glsl-shader.c | 192 + cogl/cogl-glx-display-private.h | 61 + cogl/cogl-glx-renderer-private.h | 108 + cogl/cogl-glx.h | 95 + cogl/cogl-gpu-info-private.h | 117 + cogl/cogl-gpu-info.c | 581 + cogl/cogl-gtype-private.h | 278 + cogl/cogl-gtype.c | 153 + cogl/cogl-i18n-private.h | 41 + cogl/cogl-index-buffer-private.h | 44 + cogl/cogl-index-buffer.c | 112 + cogl/cogl-index-buffer.h | 107 + cogl/cogl-indices-private.h | 60 + cogl/cogl-indices.c | 271 + cogl/cogl-indices.h | 165 + cogl/cogl-journal-private.h | 121 + cogl/cogl-journal.c | 1852 + cogl/cogl-kms-display.h | 119 + cogl/cogl-kms-renderer.h | 74 + cogl/cogl-list.c | 94 + cogl/cogl-list.h | 129 + cogl/cogl-macros.h | 273 + cogl/cogl-magazine-private.h | 81 + cogl/cogl-magazine.c | 84 + cogl/cogl-matrix-private.h | 58 + cogl/cogl-matrix-stack-private.h | 200 + cogl/cogl-matrix-stack.c | 1211 + cogl/cogl-matrix-stack.h | 645 + cogl/cogl-matrix.c | 2313 ++ cogl/cogl-matrix.h | 821 + cogl/cogl-memory-stack-private.h | 50 + cogl/cogl-memory-stack.c | 196 + cogl/cogl-meta-texture.c | 642 + cogl/cogl-meta-texture.h | 194 + cogl/cogl-node-private.h | 89 + cogl/cogl-node.c | 110 + cogl/cogl-object-private.h | 323 + cogl/cogl-object.c | 304 + cogl/cogl-object.h | 251 + cogl/cogl-offscreen.h | 172 + cogl/cogl-onscreen-private.h | 127 + cogl/cogl-onscreen-template-private.h | 45 + cogl/cogl-onscreen-template.c | 97 + cogl/cogl-onscreen-template.h | 125 + cogl/cogl-onscreen.c | 746 + cogl/cogl-onscreen.h | 1012 + cogl/cogl-output-private.h | 57 + cogl/cogl-output.c | 119 + cogl/cogl-output.h | 261 + cogl/cogl-pango.h | 40 + cogl/cogl-pipeline-cache.c | 216 + cogl/cogl-pipeline-cache.h | 93 + cogl/cogl-pipeline-debug.c | 301 + cogl/cogl-pipeline-hash-table.c | 233 + cogl/cogl-pipeline-hash-table.h | 81 + cogl/cogl-pipeline-layer-private.h | 390 + cogl/cogl-pipeline-layer-state-private.h | 141 + cogl/cogl-pipeline-layer-state.c | 1814 + cogl/cogl-pipeline-layer-state.h | 620 + cogl/cogl-pipeline-layer.c | 942 + cogl/cogl-pipeline-private.h | 998 + cogl/cogl-pipeline-snippet-private.h | 116 + cogl/cogl-pipeline-snippet.c | 286 + cogl/cogl-pipeline-state-private.h | 196 + cogl/cogl-pipeline-state.c | 2171 ++ cogl/cogl-pipeline-state.h | 980 + cogl/cogl-pipeline.c | 3174 ++ cogl/cogl-pipeline.h | 194 + cogl/cogl-pixel-buffer-private.h | 52 + cogl/cogl-pixel-buffer.c | 134 + cogl/cogl-pixel-buffer.h | 138 + cogl/cogl-point-in-poly-private.h | 46 + cogl/cogl-point-in-poly.c | 101 + cogl/cogl-poll-private.h | 77 + cogl/cogl-poll.c | 267 + cogl/cogl-poll.h | 200 + cogl/cogl-primitive-private.h | 73 + cogl/cogl-primitive-texture.c | 60 + cogl/cogl-primitive-texture.h | 111 + cogl/cogl-primitive.c | 645 + cogl/cogl-primitive.h | 942 + cogl/cogl-primitives-private.h | 67 + cogl/cogl-primitives.c | 1148 + cogl/cogl-primitives.h | 197 + cogl/cogl-private.h | 170 + cogl/cogl-profile.c | 126 + cogl/cogl-profile.h | 68 + cogl/cogl-quaternion-private.h | 44 + cogl/cogl-quaternion.c | 673 + cogl/cogl-quaternion.h | 564 + cogl/cogl-rectangle-map.c | 764 + cogl/cogl-rectangle-map.h | 84 + cogl/cogl-renderer-private.h | 132 + cogl/cogl-renderer.c | 869 + cogl/cogl-renderer.h | 446 + cogl/cogl-sampler-cache-private.h | 96 + cogl/cogl-sampler-cache.c | 371 + cogl/cogl-sdl.c | 111 + cogl/cogl-sdl.h | 248 + cogl/cogl-snippet-private.h | 77 + cogl/cogl-snippet.c | 187 + cogl/cogl-snippet.h | 866 + cogl/cogl-spans.c | 183 + cogl/cogl-spans.h | 81 + cogl/cogl-sub-texture-private.h | 62 + cogl/cogl-sub-texture.c | 480 + cogl/cogl-sub-texture.h | 136 + cogl/cogl-swap-chain-private.h | 45 + cogl/cogl-swap-chain.c | 76 + cogl/cogl-swap-chain.h | 71 + cogl/cogl-texture-2d-gl.h | 78 + cogl/cogl-texture-2d-private.h | 134 + cogl/cogl-texture-2d-sliced-private.h | 67 + cogl/cogl-texture-2d-sliced.c | 1546 + cogl/cogl-texture-2d-sliced.h | 301 + cogl/cogl-texture-2d.c | 695 + cogl/cogl-texture-2d.h | 234 + cogl/cogl-texture-3d-private.h | 66 + cogl/cogl-texture-3d.c | 761 + cogl/cogl-texture-3d.h | 204 + cogl/cogl-texture-driver.h | 206 + cogl/cogl-texture-private.h | 409 + cogl/cogl-texture-rectangle-private.h | 66 + cogl/cogl-texture-rectangle.c | 781 + cogl/cogl-texture-rectangle.h | 218 + cogl/cogl-texture.c | 1540 + cogl/cogl-texture.h | 524 + cogl/cogl-types.h | 925 + cogl/cogl-util.c | 286 + cogl/cogl-util.h | 305 + cogl/cogl-vector.c | 300 + cogl/cogl-vector.h | 356 + cogl/cogl-version.h | 348 + cogl/cogl-wayland-client.h | 64 + cogl/cogl-wayland-renderer.h | 105 + cogl/cogl-wayland-server.h | 163 + cogl/cogl-win32-renderer.c | 73 + cogl/cogl-win32-renderer.h | 123 + cogl/cogl-x11-renderer-private.h | 40 + cogl/cogl-xlib-private.h | 54 + cogl/cogl-xlib-renderer-private.h | 101 + cogl/cogl-xlib-renderer.c | 660 + cogl/cogl-xlib-renderer.h | 187 + cogl/cogl-xlib.c | 112 + cogl/cogl-xlib.h | 132 + cogl/cogl.c | 823 + cogl/cogl.h | 194 + cogl/cogl.rc | 30 + cogl/cogl.rc.in | 30 + cogl/cogl.symbols | 1108 + cogl/cogl1-context.h | 862 + cogl/cogl2-experimental.h | 37 + cogl/deprecated/cogl-auto-texture.c | 419 + cogl/deprecated/cogl-auto-texture.h | 221 + cogl/deprecated/cogl-clip-state.c | 138 + cogl/deprecated/cogl-clip-state.h | 266 + cogl/deprecated/cogl-clutter-xlib.h | 46 + cogl/deprecated/cogl-clutter.c | 113 + cogl/deprecated/cogl-clutter.h | 54 + cogl/deprecated/cogl-fixed.c | 1112 + cogl/deprecated/cogl-fixed.h | 811 + cogl/deprecated/cogl-framebuffer-deprecated.c | 295 + cogl/deprecated/cogl-framebuffer-deprecated.h | 264 + cogl/deprecated/cogl-material-compat.c | 461 + cogl/deprecated/cogl-material-compat.h | 1391 + cogl/deprecated/cogl-program-private.h | 88 + cogl/deprecated/cogl-program.c | 503 + cogl/deprecated/cogl-shader-private.h | 72 + cogl/deprecated/cogl-shader.c | 377 + cogl/deprecated/cogl-shader.h | 704 + cogl/deprecated/cogl-texture-deprecated.c | 85 + cogl/deprecated/cogl-texture-deprecated.h | 105 + cogl/deprecated/cogl-type-casts.h | 53 + cogl/deprecated/cogl-vertex-buffer-private.h | 165 + cogl/deprecated/cogl-vertex-buffer.c | 1795 + cogl/deprecated/cogl-vertex-buffer.h | 451 + cogl/driver/gl/cogl-attribute-gl-private.h | 53 + cogl/driver/gl/cogl-attribute-gl.c | 539 + cogl/driver/gl/cogl-buffer-gl-private.h | 74 + cogl/driver/gl/cogl-buffer-gl.c | 442 + cogl/driver/gl/cogl-clip-stack-gl-private.h | 45 + cogl/driver/gl/cogl-clip-stack-gl.c | 627 + cogl/driver/gl/cogl-framebuffer-gl-private.h | 102 + cogl/driver/gl/cogl-framebuffer-gl.c | 1573 + .../gl/cogl-pipeline-fragend-fixed-private.h | 42 + cogl/driver/gl/cogl-pipeline-fragend-fixed.c | 432 + .../gl/cogl-pipeline-fragend-glsl-private.h | 45 + cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 1149 + cogl/driver/gl/cogl-pipeline-opengl-private.h | 158 + cogl/driver/gl/cogl-pipeline-opengl.c | 1484 + .../gl/cogl-pipeline-progend-fixed-private.h | 42 + cogl/driver/gl/cogl-pipeline-progend-fixed.c | 112 + .../gl/cogl-pipeline-progend-glsl-private.h | 47 + cogl/driver/gl/cogl-pipeline-progend-glsl.c | 1074 + .../gl/cogl-pipeline-vertend-fixed-private.h | 42 + cogl/driver/gl/cogl-pipeline-vertend-fixed.c | 121 + .../gl/cogl-pipeline-vertend-glsl-private.h | 45 + cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 680 + cogl/driver/gl/cogl-texture-2d-gl-private.h | 119 + cogl/driver/gl/cogl-texture-2d-gl.c | 756 + cogl/driver/gl/cogl-texture-gl-private.h | 66 + cogl/driver/gl/cogl-texture-gl.c | 158 + cogl/driver/gl/cogl-util-gl-private.h | 93 + cogl/driver/gl/cogl-util-gl.c | 181 + cogl/driver/gl/gl/cogl-driver-gl.c | 699 + .../gl/cogl-pipeline-fragend-arbfp-private.h | 42 + .../gl/gl/cogl-pipeline-fragend-arbfp.c | 990 + ...ogl-pipeline-progend-fixed-arbfp-private.h | 42 + .../gl/gl/cogl-pipeline-progend-fixed-arbfp.c | 121 + cogl/driver/gl/gl/cogl-texture-driver-gl.c | 555 + cogl/driver/gl/gles/cogl-driver-gles.c | 476 + .../driver/gl/gles/cogl-texture-driver-gles.c | 652 + cogl/driver/nop/cogl-attribute-nop-private.h | 48 + cogl/driver/nop/cogl-attribute-nop.c | 49 + cogl/driver/nop/cogl-clip-stack-nop-private.h | 44 + cogl/driver/nop/cogl-clip-stack-nop.c | 43 + cogl/driver/nop/cogl-driver-nop.c | 86 + .../driver/nop/cogl-framebuffer-nop-private.h | 100 + cogl/driver/nop/cogl-framebuffer-nop.c | 121 + cogl/driver/nop/cogl-texture-2d-nop-private.h | 103 + cogl/driver/nop/cogl-texture-2d-nop.c | 132 + cogl/gl-prototypes/cogl-all-functions.h | 328 + cogl/gl-prototypes/cogl-core-functions.h | 198 + cogl/gl-prototypes/cogl-fixed-functions.h | 119 + cogl/gl-prototypes/cogl-gles1-functions.h | 43 + cogl/gl-prototypes/cogl-gles2-functions.h | 43 + cogl/gl-prototypes/cogl-glsl-functions.h | 286 + .../cogl-in-gles-core-functions.h | 148 + .../cogl-in-gles1-core-functions.h | 78 + .../cogl-in-gles2-core-functions.h | 186 + cogl/stb_image.c | 3892 ++ cogl/winsys/cogl-texture-pixmap-x11-private.h | 85 + cogl/winsys/cogl-texture-pixmap-x11.c | 1101 + cogl/winsys/cogl-texture-pixmap-x11.h | 238 + cogl/winsys/cogl-winsys-egl-android-private.h | 39 + cogl/winsys/cogl-winsys-egl-android.c | 253 + .../cogl-winsys-egl-feature-functions.h | 149 + cogl/winsys/cogl-winsys-egl-gdl-private.h | 39 + cogl/winsys/cogl-winsys-egl-gdl.c | 380 + cogl/winsys/cogl-winsys-egl-kms-private.h | 41 + cogl/winsys/cogl-winsys-egl-kms.c | 1261 + cogl/winsys/cogl-winsys-egl-null-private.h | 39 + cogl/winsys/cogl-winsys-egl-null.c | 246 + cogl/winsys/cogl-winsys-egl-private.h | 203 + cogl/winsys/cogl-winsys-egl-wayland-private.h | 39 + cogl/winsys/cogl-winsys-egl-wayland.c | 844 + cogl/winsys/cogl-winsys-egl-x11-private.h | 39 + cogl/winsys/cogl-winsys-egl-x11.c | 874 + cogl/winsys/cogl-winsys-egl.c | 1083 + .../cogl-winsys-glx-feature-functions.h | 209 + cogl/winsys/cogl-winsys-glx-private.h | 37 + cogl/winsys/cogl-winsys-glx.c | 2718 ++ cogl/winsys/cogl-winsys-private.h | 204 + cogl/winsys/cogl-winsys-sdl-private.h | 37 + cogl/winsys/cogl-winsys-sdl.c | 490 + cogl/winsys/cogl-winsys-sdl2.c | 638 + cogl/winsys/cogl-winsys-stub-private.h | 37 + cogl/winsys/cogl-winsys-stub.c | 197 + .../cogl-winsys-wgl-feature-functions.h | 44 + cogl/winsys/cogl-winsys-wgl-private.h | 37 + cogl/winsys/cogl-winsys-wgl.c | 993 + cogl/winsys/cogl-winsys.c | 52 + config-custom.h | 42 + config.h.in | 598 + config.h.win32 | 638 + config.h.win32.in | 638 + configure | 31884 ++++++++++++++++ configure.ac | 1572 + deps/Makefile.am | 5 + deps/Makefile.in | 752 + deps/glib/COPYING | 482 + deps/glib/Makefile.am | 75 + deps/glib/Makefile.in | 991 + deps/glib/README | 14 + deps/glib/galloca.h | 110 + deps/glib/garray.c | 1624 + deps/glib/garray.h | 181 + deps/glib/gatomic.c | 848 + deps/glib/gatomic.h | 217 + deps/glib/gbacktrace.h | 61 + deps/glib/gbitlock.c | 535 + deps/glib/gbitlock.h | 72 + deps/glib/gconvert.c | 31 + deps/glib/gconvert.h | 94 + deps/glib/gdataset.c | 1361 + deps/glib/gdataset.h | 122 + deps/glib/gdatasetprivate.h | 44 + deps/glib/gdebug.h | 59 + deps/glib/gerror.c | 711 + deps/glib/gerror.h | 107 + deps/glib/gfileutils.c | 2328 ++ deps/glib/gfileutils.h | 150 + deps/glib/ghash.c | 1575 + deps/glib/ghash.h | 168 + deps/glib/ghook.c | 636 + deps/glib/ghook.h | 181 + deps/glib/gi18n-lib.h | 38 + deps/glib/glib-object.h | 6 + deps/glib/glib.h | 29 + deps/glib/glib_trace.h | 43 + deps/glib/glibintl.h | 42 + deps/glib/glist.c | 1170 + deps/glib/glist.h | 122 + deps/glib/gmacros.h | 290 + deps/glib/gmain.c | 88 + deps/glib/gmain.h | 37 + deps/glib/gmem.c | 1397 + deps/glib/gmem.h | 309 + deps/glib/gmessages.c | 1084 + deps/glib/gmessages.h | 405 + deps/glib/gprintf.c | 340 + deps/glib/gprintf.h | 52 + deps/glib/gprintfint.h | 59 + deps/glib/gqsort.c | 300 + deps/glib/gqsort.h | 46 + deps/glib/gquark.h | 52 + deps/glib/gqueue.c | 1047 + deps/glib/gqueue.h | 150 + deps/glib/gslice.c | 1495 + deps/glib/gslice.h | 86 + deps/glib/gslist.c | 1082 + deps/glib/gslist.h | 116 + deps/glib/gstdio.c | 832 + deps/glib/gstdio.h | 149 + deps/glib/gstrfuncs.c | 3251 ++ deps/glib/gstrfuncs.h | 269 + deps/glib/gstring.c | 1448 + deps/glib/gstring.h | 186 + deps/glib/gtestutils.c | 516 + deps/glib/gtestutils.h | 161 + deps/glib/gthread.c | 2601 ++ deps/glib/gthread.h | 407 + deps/glib/gtypes.h | 461 + deps/glib/gunicode.h | 729 + deps/glib/gutils.c | 3872 ++ deps/glib/gutils.h | 528 + deps/gmodule/Makefile.am | 32 + deps/gmodule/Makefile.in | 766 + deps/gmodule/README | 4 + deps/gmodule/gmodule-dl.c | 168 + deps/gmodule/gmodule-dld.c | 163 + deps/gmodule/gmodule-dyld.c | 154 + deps/gmodule/gmodule-win32.c | 202 + deps/gmodule/gmodule.c | 582 + deps/gmodule/gmoduleconf.h.in | 54 + deps/gmodule/gmoduleconf.h.win32 | 44 + doc/CODING_STYLE | 50 + doc/Makefile.am | 9 + doc/Makefile.in | 753 + doc/reference/Makefile.am | 5 + doc/reference/Makefile.in | 752 + .../cogl-2.0-experimental/Makefile.am | 132 + .../cogl-2.0-experimental/Makefile.in | 969 + .../cogl-2.0-experimental/blend-strings.xml | 129 + .../cogl-2.0-experimental-docs.xml | 229 + .../cogl-2.0-experimental-docs.xml.in | 229 + .../cogl-2.0-experimental-overrides.txt | 0 .../cogl-2.0-experimental-sections.txt | 1058 + .../cogl-2.0-experimental/cogl_ortho.png | Bin 0 -> 12650 bytes .../fill-rule-even-odd.png | Bin 0 -> 3121 bytes .../fill-rule-non-zero.png | Bin 0 -> 3143 bytes .../cogl-2.0-experimental/html/ch01.html | 233 + .../cogl-2.0-experimental-2D-textures.html | 441 + ...-2.0-experimental-3-Component-Vectors.html | 798 + .../cogl-2.0-experimental-3D-textures.html | 332 + .../html/cogl-2.0-experimental-Bitmap.html | 598 + ...Buffer---Buffers-of-vertex-attributes.html | 209 + ...tal-CoglBuffer---The-Buffer-Interface.html | 604 + ...oglDisplay---Setup-a-display-pipeline.html | 334 + ...amebuffer---The-Framebuffer-Interface.html | 2967 ++ ...dexBuffer---Buffers-of-vertex-indices.html | 130 + ...---The-Onscreen-Framebuffer-Interface.html | 1305 + ...-a-template-for-onscreen-framebuffers.html | 94 + ...derer---Connect-to-a-backend-renderer.html | 916 + .../cogl-2.0-experimental-Color-Type.html | 1110 + .../cogl-2.0-experimental-Common-Types.html | 983 + .../cogl-2.0-experimental-Depth-State.html | 484 + ...l-2.0-experimental-Eulers-(Rotations).html | 388 + ...l-2.0-experimental-Exception-handling.html | 462 + ...ogl-2.0-experimental-GLES-2.0-context.html | 567 + ...perimental-GPU-synchronisation-fences.html | 203 + ....0-experimental-GType-Integration-API.html | 74 + ...experimental-High-Level-Meta-Textures.html | 278 + .../html/cogl-2.0-experimental-Indices.html | 285 + ...rimental-Low-level-primitive-textures.html | 150 + ....0-experimental-Main-loop-integration.html | 411 + .../html/cogl-2.0-experimental-Matrices.html | 1589 + .../cogl-2.0-experimental-Matrix-Stacks.html | 1141 + ...0-experimental-Offscreen-Framebuffers.html | 148 + ...cogl-2.0-experimental-Path-Primitives.html | 53 + .../html/cogl-2.0-experimental-Pipeline.html | 3052 ++ .../cogl-2.0-experimental-Primitives.html | 1828 + ...-experimental-Quaternions-(Rotations).html | 1136 + ...textures-(non-normalized-coordinates).html | 258 + .../cogl-2.0-experimental-Rectangles.html | 303 + ...cogl-2.0-experimental-SDL-Integration.html | 489 + ...cogl-2.0-experimental-Shader-snippets.html | 1033 + ...cogl-2.0-experimental-Sliced-Textures.html | 478 + .../cogl-2.0-experimental-Sub-Textures.html | 171 + ...2.0-experimental-The-Object-Interface.html | 332 + ....0-experimental-The-Texture-Interface.html | 902 + ....0-experimental-The-Top-Level-Context.html | 1561 + ...xperimental-Versioning-utility-macros.html | 620 + ...gl-2.0-experimental-Vertex-Attributes.html | 475 + ...-experimental-X11-Texture-From-Pixmap.html | 312 + .../html/cogl-2.0-experimental.devhelp2 | 869 + .../html/cogl-Blend-Strings.html | 143 + .../html/cogl-buffer-apis.html | 28 + .../html/cogl-buffer-layout-apis.html | 28 + .../html/cogl-context-apis.html | 28 + .../html/cogl-framebuffer-apis.html | 28 + .../html/cogl-general-apis.html | 28 + .../html/cogl-integration.html | 28 + .../html/cogl-meta-textures.html | 28 + .../html/cogl-pipeline-apis.html | 28 + .../html/cogl-primitive-apis.html | 28 + .../html/cogl-primitive-textures.html | 28 + .../html/cogl-textures.html | 28 + .../html/cogl-utilities.html | 28 + .../cogl-2.0-experimental/html/cogl_ortho.png | Bin 0 -> 12650 bytes .../html/coglglossary.html | 67 + .../html/fill-rule-even-odd.png | Bin 0 -> 3121 bytes .../html/fill-rule-non-zero.png | Bin 0 -> 3143 bytes .../cogl-2.0-experimental/html/home.png | Bin 0 -> 654 bytes .../cogl-2.0-experimental/html/index.html | 255 + .../cogl-2.0-experimental/html/index.sgml | 966 + .../cogl-2.0-experimental/html/ix01.html | 2517 ++ .../cogl-2.0-experimental/html/ix02.html | 193 + .../cogl-2.0-experimental/html/ix03.html | 47 + .../cogl-2.0-experimental/html/ix04.html | 234 + .../cogl-2.0-experimental/html/ix05.html | 108 + .../cogl-2.0-experimental/html/ix06.html | 252 + .../cogl-2.0-experimental/html/left.png | Bin 0 -> 459 bytes .../cogl-2.0-experimental/html/license.html | 58 + .../html/quad-indices-order.png | Bin 0 -> 2620 bytes .../html/quad-indices-triangles.png | Bin 0 -> 8018 bytes .../cogl-2.0-experimental/html/right.png | Bin 0 -> 472 bytes .../cogl-2.0-experimental/html/style.css | 266 + .../cogl-2.0-experimental/html/up.png | Bin 0 -> 406 bytes .../quad-indices-order.png | Bin 0 -> 2620 bytes .../quad-indices-triangles.png | Bin 0 -> 8018 bytes doc/reference/cogl-gst/Makefile.am | 106 + doc/reference/cogl-gst/Makefile.in | 942 + doc/reference/cogl-gst/cogl-gst-docs.xml | 105 + doc/reference/cogl-gst/cogl-gst-docs.xml.in | 105 + doc/reference/cogl-gst/cogl-gst-overrides.txt | 0 doc/reference/cogl-gst/cogl-gst-sections.txt | 33 + doc/reference/cogl-gst/cogl-gst.types | 2 + .../cogl-gst/html/CoglGstVideoSink.html | 723 + doc/reference/cogl-gst/html/ch01.html | 45 + .../cogl-gst/html/cogl-gst-general-apis.html | 28 + doc/reference/cogl-gst/html/cogl-gst.devhelp2 | 37 + doc/reference/cogl-gst/html/coglglossary.html | 45 + doc/reference/cogl-gst/html/home.png | Bin 0 -> 654 bytes doc/reference/cogl-gst/html/index.html | 64 + doc/reference/cogl-gst/html/index.sgml | 31 + doc/reference/cogl-gst/html/ix01.html | 111 + doc/reference/cogl-gst/html/left.png | Bin 0 -> 459 bytes doc/reference/cogl-gst/html/license.html | 58 + doc/reference/cogl-gst/html/right.png | Bin 0 -> 472 bytes doc/reference/cogl-gst/html/style.css | 266 + doc/reference/cogl-gst/html/up.png | Bin 0 -> 406 bytes doc/reference/cogl/Makefile.am | 152 + doc/reference/cogl/Makefile.in | 988 + doc/reference/cogl/blend-strings.xml | 129 + doc/reference/cogl/cogl-docs.xml | 212 + doc/reference/cogl/cogl-docs.xml.in | 212 + doc/reference/cogl/cogl-overrides.txt | 0 doc/reference/cogl/cogl-sections.txt | 715 + doc/reference/cogl/cogl_ortho.png | Bin 0 -> 12650 bytes doc/reference/cogl/fill-rule-even-odd.png | Bin 0 -> 3121 bytes doc/reference/cogl/fill-rule-non-zero.png | Bin 0 -> 3143 bytes doc/reference/cogl/html/ch01.html | 91 + doc/reference/cogl/html/ch02.html | 59 + doc/reference/cogl/html/ch03.html | 66 + doc/reference/cogl/html/cogl-3D-textures.html | 258 + doc/reference/cogl/html/cogl-Bitmaps.html | 224 + .../cogl/html/cogl-Blend-Strings.html | 143 + doc/reference/cogl/html/cogl-Buffers.html | 474 + .../cogl/html/cogl-Clipping-(Deprecated).html | 216 + doc/reference/cogl/html/cogl-Clipping.html | 176 + doc/reference/cogl/html/cogl-Color-Type.html | 1230 + .../cogl/html/cogl-Fixed-Point-API.html | 1331 + .../cogl/html/cogl-GType-Integration-API.html | 74 + .../html/cogl-General-API-(Deprecated).html | 284 + doc/reference/cogl/html/cogl-General-API.html | 2784 ++ .../html/cogl-Materials-(Deprecated).html | 157 + doc/reference/cogl/html/cogl-Materials.html | 2705 ++ doc/reference/cogl/html/cogl-Matrices.html | 1252 + .../cogl-Offscreen-Buffers-(Deprecated).html | 107 + .../cogl/html/cogl-Offscreen-Buffers.html | 504 + .../cogl/html/cogl-Path-Primitives.html | 53 + doc/reference/cogl/html/cogl-Primitives.html | 360 + .../html/cogl-Quaternions-(Rotations).html | 1081 + ...nd-Programmable-Pipeline-(Deprecated).html | 396 + ...ogl-Shaders-and-Programmable-Pipeline.html | 873 + .../cogl/html/cogl-Textures-(Deprecated).html | 104 + doc/reference/cogl/html/cogl-Textures.html | 956 + doc/reference/cogl/html/cogl-Vectors.html | 798 + .../cogl-Vertex-Buffers-(Deprecated).html | 104 + .../cogl/html/cogl-Vertex-Buffers.html | 821 + doc/reference/cogl/html/cogl.devhelp2 | 561 + doc/reference/cogl/html/cogl_ortho.png | Bin 0 -> 12650 bytes doc/reference/cogl/html/coglglossary.html | 59 + .../cogl/html/fill-rule-even-odd.png | Bin 0 -> 3121 bytes .../cogl/html/fill-rule-non-zero.png | Bin 0 -> 3143 bytes doc/reference/cogl/html/home.png | Bin 0 -> 654 bytes doc/reference/cogl/html/index.html | 158 + doc/reference/cogl/html/index.sgml | 617 + doc/reference/cogl/html/ix01.html | 1723 + doc/reference/cogl/html/ix02.html | 723 + doc/reference/cogl/html/ix03.html | 80 + doc/reference/cogl/html/ix04.html | 607 + doc/reference/cogl/html/ix05.html | 130 + doc/reference/cogl/html/ix06.html | 296 + doc/reference/cogl/html/ix07.html | 74 + doc/reference/cogl/html/ix08.html | 38 + doc/reference/cogl/html/left.png | Bin 0 -> 459 bytes doc/reference/cogl/html/license.html | 58 + .../cogl/html/quad-indices-order.png | Bin 0 -> 2620 bytes .../cogl/html/quad-indices-triangles.png | Bin 0 -> 8018 bytes doc/reference/cogl/html/right.png | Bin 0 -> 472 bytes doc/reference/cogl/html/style.css | 266 + doc/reference/cogl/html/up.png | Bin 0 -> 406 bytes doc/reference/cogl/quad-indices-order.png | Bin 0 -> 2620 bytes doc/reference/cogl/quad-indices-triangles.png | Bin 0 -> 8018 bytes examples/Makefile.am | 140 + examples/Makefile.in | 1153 + examples/android/hello/.gitignore | 7 + examples/android/hello/AndroidManifest.xml | 30 + examples/android/hello/build.xml | 84 + examples/android/hello/jni/Android.mk | 19 + examples/android/hello/jni/Application.mk | 1 + examples/android/hello/jni/main.c | 188 + examples/android/hello/res/values/strings.xml | 4 + examples/cogl-basic-video-player.c | 422 + examples/cogl-crate.c | 302 + examples/cogl-emscripten-hello.c | 149 + examples/cogl-gjs.js | 46 + examples/cogl-gles2-context.c | 138 + examples/cogl-gles2-gears.c | 825 + examples/cogl-hello.c | 123 + examples/cogl-info.c | 262 + examples/cogl-msaa.c | 114 + examples/cogl-point-sprites.c | 323 + examples/cogl-sdl-hello.c | 156 + examples/cogl-sdl2-hello.c | 169 + examples/cogl-x11-foreign.c | 203 + examples/cogl-x11-tfp.c | 255 + examples/cogland.c | 1224 + examples/crate.jpg | Bin 0 -> 171588 bytes examples/emscripten-example-js-library.js | 19 + examples/emscripten-example-js.h | 18 + gtk-doc.make | 276 + po/ChangeLog | 12 + po/Makefile.in.in | 429 + po/Makevars | 41 + po/POTFILES.in | 3 + po/Rules-quot | 47 + po/an.gmo | Bin 0 -> 8207 bytes po/an.po | 366 + po/ar.gmo | Bin 0 -> 940 bytes po/ar.po | 360 + po/as.gmo | Bin 0 -> 12555 bytes po/as.po | 364 + po/ast.gmo | Bin 0 -> 895 bytes po/ast.po | 360 + po/be.gmo | Bin 0 -> 10743 bytes po/be.po | 366 + po/bg.gmo | Bin 0 -> 12258 bytes po/bg.po | 392 + po/boldquot.sed | 10 + po/ca.gmo | Bin 0 -> 8454 bytes po/ca.po | 374 + po/ca@valencia.gmo | Bin 0 -> 8451 bytes po/ca@valencia.po | 374 + po/cogl.pot | 358 + po/cs.gmo | Bin 0 -> 8354 bytes po/cs.po | 370 + po/da.gmo | Bin 0 -> 7905 bytes po/da.po | 370 + po/de.gmo | Bin 0 -> 8328 bytes po/de.po | 385 + po/el.gmo | Bin 0 -> 10891 bytes po/el.po | 374 + po/en@boldquot.header | 25 + po/en@quot.header | 22 + po/en_CA.gmo | Bin 0 -> 755 bytes po/en_CA.po | 358 + po/en_GB.gmo | Bin 0 -> 7554 bytes po/en_GB.po | 364 + po/eo.gmo | Bin 0 -> 1293 bytes po/eo.po | 360 + po/es.gmo | Bin 0 -> 8402 bytes po/es.po | 372 + po/eu.gmo | Bin 0 -> 8181 bytes po/eu.po | 369 + po/fa.gmo | Bin 0 -> 930 bytes po/fa.po | 360 + po/fr.gmo | Bin 0 -> 8559 bytes po/fr.po | 375 + po/gl.gmo | Bin 0 -> 8374 bytes po/gl.po | 373 + po/he.gmo | Bin 0 -> 7665 bytes po/he.po | 366 + po/hi.gmo | Bin 0 -> 12229 bytes po/hi.po | 364 + po/hu.gmo | Bin 0 -> 8532 bytes po/hu.po | 371 + po/id.gmo | Bin 0 -> 8063 bytes po/id.po | 369 + po/insert-header.sin | 23 + po/it.gmo | Bin 0 -> 8078 bytes po/it.po | 367 + po/ja.gmo | Bin 0 -> 9662 bytes po/ja.po | 369 + po/km.gmo | Bin 0 -> 11794 bytes po/km.po | 368 + po/kn.gmo | Bin 0 -> 975 bytes po/kn.po | 359 + po/ko.gmo | Bin 0 -> 497 bytes po/ko.po | 358 + po/lt.gmo | Bin 0 -> 7977 bytes po/lt.po | 366 + po/lv.gmo | Bin 0 -> 8212 bytes po/lv.po | 367 + po/ml.gmo | Bin 0 -> 662 bytes po/ml.po | 358 + po/nb.gmo | Bin 0 -> 1403 bytes po/nb.po | 358 + po/nl.gmo | Bin 0 -> 759 bytes po/nl.po | 359 + po/or.gmo | Bin 0 -> 1015 bytes po/or.po | 359 + po/pa.gmo | Bin 0 -> 2935 bytes po/pa.po | 359 + po/pl.gmo | Bin 0 -> 8479 bytes po/pl.po | 375 + po/pt.gmo | Bin 0 -> 8184 bytes po/pt.po | 364 + po/pt_BR.gmo | Bin 0 -> 8501 bytes po/pt_BR.po | 374 + po/quot.sed | 6 + po/remove-potcdate.sin | 19 + po/ru.gmo | Bin 0 -> 10654 bytes po/ru.po | 368 + po/sk.gmo | Bin 0 -> 8625 bytes po/sk.po | 460 + po/sl.gmo | Bin 0 -> 8189 bytes po/sl.po | 371 + po/sr.gmo | Bin 0 -> 10452 bytes po/sr.po | 367 + po/sr@latin.gmo | Bin 0 -> 8104 bytes po/sr@latin.po | 367 + po/stamp-po | 1 + po/sv.gmo | Bin 0 -> 1729 bytes po/sv.po | 357 + po/ta.gmo | Bin 0 -> 13845 bytes po/ta.po | 368 + po/te.gmo | Bin 0 -> 12978 bytes po/te.po | 365 + po/th.gmo | Bin 0 -> 12168 bytes po/th.po | 362 + po/tr.gmo | Bin 0 -> 973 bytes po/tr.po | 359 + po/ug.gmo | Bin 0 -> 8611 bytes po/ug.po | 363 + po/uk.gmo | Bin 0 -> 10355 bytes po/uk.po | 366 + po/vi.gmo | Bin 0 -> 780 bytes po/vi.po | 358 + po/zh_CN.gmo | Bin 0 -> 7250 bytes po/zh_CN.po | 366 + po/zh_HK.gmo | Bin 0 -> 7213 bytes po/zh_HK.po | 360 + po/zh_TW.gmo | Bin 0 -> 7216 bytes po/zh_TW.po | 360 + test-fixtures/Makefile.am | 25 + test-fixtures/Makefile.in | 740 + test-fixtures/test-unit.h | 31 + test-fixtures/test-utils.c | 535 + test-fixtures/test-utils.h | 287 + tests/Makefile.am | 31 + tests/Makefile.in | 865 + tests/README | 63 + tests/config.env.in | 3 + tests/conform/Makefile.am | 230 + tests/conform/Makefile.in | 1821 + tests/conform/test-alpha-test.c | 73 + tests/conform/test-alpha-textures.c | 123 + tests/conform/test-atlas-migration.c | 145 + tests/conform/test-backface-culling.c | 311 + tests/conform/test-blend-strings.c | 430 + tests/conform/test-blend.c | 64 + tests/conform/test-color-hsl.c | 45 + tests/conform/test-color-mask.c | 110 + tests/conform/test-conform-main.c | 157 + tests/conform/test-copy-replace-texture.c | 120 + tests/conform/test-custom-attributes.c | 301 + tests/conform/test-depth-test.c | 301 + tests/conform/test-euler-quaternion.c | 81 + tests/conform/test-fence.c | 63 + tests/conform/test-framebuffer-get-bits.c | 40 + tests/conform/test-gles2-context.c | 962 + tests/conform/test-just-vertex-shader.c | 205 + tests/conform/test-layer-remove.c | 145 + tests/conform/test-map-buffer-range.c | 123 + tests/conform/test-no-gl-header.c | 16 + tests/conform/test-npot-texture.c | 170 + tests/conform/test-offscreen.c | 199 + tests/conform/test-path-clip.c | 68 + tests/conform/test-path.c | 215 + .../test-pipeline-cache-unrefs-texture.c | 91 + tests/conform/test-pipeline-shader-state.c | 93 + tests/conform/test-pipeline-uniforms.c | 415 + tests/conform/test-pipeline-user-matrix.c | 140 + tests/conform/test-pixel-buffer.c | 269 + tests/conform/test-point-size-attribute.c | 166 + tests/conform/test-point-size.c | 99 + tests/conform/test-point-sprite.c | 194 + tests/conform/test-premult.c | 301 + tests/conform/test-primitive-and-journal.c | 122 + tests/conform/test-primitive.c | 334 + tests/conform/test-read-texture-formats.c | 222 + tests/conform/test-snippets.c | 815 + tests/conform/test-sparse-pipeline.c | 62 + tests/conform/test-sub-texture.c | 325 + tests/conform/test-texture-3d.c | 274 + tests/conform/test-texture-get-set-data.c | 144 + tests/conform/test-texture-no-allocate.c | 80 + tests/conform/test-texture-rg.c | 74 + tests/conform/test-version.c | 85 + tests/conform/test-wrap-modes.c | 296 + tests/conform/test-wrap-rectangle-textures.c | 175 + tests/conform/test-write-texture-formats.c | 184 + tests/data/Makefile.am | 3 + tests/data/Makefile.in | 572 + tests/data/valgrind.suppressions | 173 + tests/micro-perf/Makefile.am | 28 + tests/micro-perf/Makefile.in | 756 + tests/micro-perf/test-journal.c | 190 + tests/run-tests.sh | 157 + tests/test-launcher.sh | 39 + tests/unit/Makefile.am | 96 + tests/unit/Makefile.in | 831 + tests/unit/test-unit-main.c | 45 + 1017 files changed, 388674 insertions(+) create mode 100644 ABOUT-NLS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README.in create mode 100644 aclocal.m4 create mode 100644 build/Makefile-msvcproj.mak create mode 100644 build/Makefile.am create mode 100644 build/Makefile.in create mode 100644 build/autotools/Makefile.am.enums create mode 100644 build/autotools/Makefile.am.release create mode 100644 build/autotools/Makefile.am.silent create mode 100644 build/autotools/acglib.m4 create mode 100644 build/autotools/as-compiler-flag.m4 create mode 100644 build/autotools/as-glibconfig.m4 create mode 100644 build/autotools/as-linguas.m4 create mode 100644 build/autotools/gettext.m4 create mode 100644 build/autotools/gtk-doc.m4 create mode 100644 build/autotools/iconv.m4 create mode 100644 build/autotools/intlmacosx.m4 create mode 100644 build/autotools/lib-ld.m4 create mode 100644 build/autotools/lib-link.m4 create mode 100644 build/autotools/lib-prefix.m4 create mode 100644 build/autotools/libtool.m4 create mode 100644 build/autotools/ltoptions.m4 create mode 100644 build/autotools/ltsugar.m4 create mode 100644 build/autotools/ltversion.m4 create mode 100644 build/autotools/lt~obsolete.m4 create mode 100644 build/autotools/nls.m4 create mode 100644 build/autotools/po.m4 create mode 100644 build/autotools/progtest.m4 create mode 100755 build/compile create mode 100755 build/config.guess create mode 100755 build/config.rpath create mode 100755 build/config.sub create mode 100755 build/depcomp create mode 100755 build/install-sh create mode 100644 build/ltmain.sh create mode 100755 build/missing create mode 100644 build/win32/Makefile.am create mode 100644 build/win32/Makefile.in create mode 100644 build/win32/gen-enums.bat create mode 100644 build/win32/vs10/Makefile.am create mode 100644 build/win32/vs10/Makefile.in create mode 100644 build/win32/vs10/README.txt create mode 100644 build/win32/vs10/cogl-build-defines.props create mode 100644 build/win32/vs10/cogl-crate.vcxproj create mode 100644 build/win32/vs10/cogl-crate.vcxproj.filters create mode 100644 build/win32/vs10/cogl-gen-srcs.props create mode 100644 build/win32/vs10/cogl-hello.vcxproj create mode 100644 build/win32/vs10/cogl-hello.vcxproj.filters create mode 100644 build/win32/vs10/cogl-info.vcxproj create mode 100644 build/win32/vs10/cogl-info.vcxproj.filters create mode 100644 build/win32/vs10/cogl-install.props create mode 100644 build/win32/vs10/cogl-msaa.vcxproj create mode 100644 build/win32/vs10/cogl-msaa.vcxproj.filters create mode 100644 build/win32/vs10/cogl-pango.vcxproj create mode 100644 build/win32/vs10/cogl-pango.vcxproj.filters create mode 100644 build/win32/vs10/cogl-pango.vcxproj.filtersin create mode 100644 build/win32/vs10/cogl-pango.vcxprojin create mode 100644 build/win32/vs10/cogl-path.vcxproj create mode 100644 build/win32/vs10/cogl-path.vcxproj.filters create mode 100644 build/win32/vs10/cogl-path.vcxproj.filtersin create mode 100644 build/win32/vs10/cogl-path.vcxprojin create mode 100644 build/win32/vs10/cogl-sdl2-hello.vcxproj create mode 100644 build/win32/vs10/cogl-sdl2-hello.vcxproj.filters create mode 100644 build/win32/vs10/cogl-version-paths.props create mode 100644 build/win32/vs10/cogl.sln create mode 100644 build/win32/vs10/cogl.vcxproj create mode 100644 build/win32/vs10/cogl.vcxproj.filters create mode 100644 build/win32/vs10/cogl.vcxproj.filtersin create mode 100644 build/win32/vs10/cogl.vcxprojin create mode 100644 build/win32/vs10/install.vcxproj create mode 100644 build/win32/vs10/test-conformance-cogl.vcxproj create mode 100644 build/win32/vs10/test-conformance-cogl.vcxproj.filters create mode 100644 build/win32/vs10/test-conformance-cogl.vcxproj.filtersin create mode 100644 build/win32/vs10/test-conformance-cogl.vcxprojin create mode 100644 build/win32/vs9/Makefile.am create mode 100644 build/win32/vs9/Makefile.in create mode 100644 build/win32/vs9/README.txt create mode 100644 build/win32/vs9/cogl-build-defines.vsprops create mode 100644 build/win32/vs9/cogl-crate.vcproj create mode 100644 build/win32/vs9/cogl-gen-srcs.vsprops create mode 100644 build/win32/vs9/cogl-hello.vcproj create mode 100644 build/win32/vs9/cogl-info.vcproj create mode 100644 build/win32/vs9/cogl-install.vsprops create mode 100644 build/win32/vs9/cogl-msaa.vcproj create mode 100644 build/win32/vs9/cogl-pango.vcproj create mode 100644 build/win32/vs9/cogl-pango.vcprojin create mode 100644 build/win32/vs9/cogl-path.vcproj create mode 100644 build/win32/vs9/cogl-path.vcprojin create mode 100644 build/win32/vs9/cogl-sdl2-hello.vcproj create mode 100644 build/win32/vs9/cogl-version-paths.vsprops create mode 100644 build/win32/vs9/cogl.sln create mode 100644 build/win32/vs9/cogl.vcproj create mode 100644 build/win32/vs9/cogl.vcprojin create mode 100644 build/win32/vs9/install.vcproj create mode 100644 build/win32/vs9/test-conformance-cogl.vcproj create mode 100644 build/win32/vs9/test-conformance-cogl.vcprojin create mode 100644 cogl-gles2/GLES2/gl2.h create mode 100644 cogl-gles2/GLES2/gl2ext.h create mode 100644 cogl-gles2/GLES2/gl2platform.h create mode 100644 cogl-gles2/Makefile.am create mode 100644 cogl-gles2/Makefile.in create mode 100644 cogl-gles2/cogl-gles2-1.0.pc.in create mode 100644 cogl-gles2/cogl-gles2-2.0-experimental.pc.in create mode 100644 cogl-gles2/cogl-gles2-api.c create mode 100644 cogl-gst/Makefile.am create mode 100644 cogl-gst/Makefile.in create mode 100644 cogl-gst/cogl-gst-1.0.pc.in create mode 100644 cogl-gst/cogl-gst-2.0-experimental.pc.in create mode 100644 cogl-gst/cogl-gst-plugin.c create mode 100644 cogl-gst/cogl-gst-video-sink.c create mode 100644 cogl-gst/cogl-gst-video-sink.h create mode 100644 cogl-gst/cogl-gst.h create mode 100644 cogl-gst/cogl-gst.pc.in create mode 100644 cogl-pango/Makefile.am create mode 100644 cogl-pango/Makefile.in create mode 100644 cogl-pango/cogl-pango-1.0.pc.in create mode 100644 cogl-pango/cogl-pango-2.0-experimental.pc.in create mode 100644 cogl-pango/cogl-pango-display-list.c create mode 100644 cogl-pango/cogl-pango-display-list.h create mode 100644 cogl-pango/cogl-pango-fontmap.c create mode 100644 cogl-pango/cogl-pango-glyph-cache.c create mode 100644 cogl-pango/cogl-pango-glyph-cache.h create mode 100644 cogl-pango/cogl-pango-pipeline-cache.c create mode 100644 cogl-pango/cogl-pango-pipeline-cache.h create mode 100644 cogl-pango/cogl-pango-private.h create mode 100644 cogl-pango/cogl-pango-render.c create mode 100644 cogl-pango/cogl-pango.h create mode 100644 cogl-pango/cogl-pango.pc.in create mode 100644 cogl-pango/cogl-pango.rc create mode 100644 cogl-pango/cogl-pango.rc.in create mode 100644 cogl-pango/cogl-pango.symbols create mode 100644 cogl-path/Makefile.am create mode 100644 cogl-path/Makefile.in create mode 100644 cogl-path/cogl-path-1.0.pc.in create mode 100644 cogl-path/cogl-path-2.0-experimental.pc.in create mode 100644 cogl-path/cogl-path-enum-types.c.in create mode 100644 cogl-path/cogl-path-enum-types.h.in create mode 100644 cogl-path/cogl-path-private.h create mode 100644 cogl-path/cogl-path-types.h create mode 100644 cogl-path/cogl-path.c create mode 100644 cogl-path/cogl-path.h create mode 100644 cogl-path/cogl-path.pc.in create mode 100644 cogl-path/cogl-path.symbols create mode 100644 cogl-path/cogl1-path-functions.h create mode 100644 cogl-path/cogl1-path.c create mode 100644 cogl-path/cogl2-path-functions.h create mode 100644 cogl-path/tesselator/GL/glu.h create mode 100644 cogl-path/tesselator/README create mode 100644 cogl-path/tesselator/dict-list.h create mode 100644 cogl-path/tesselator/dict.c create mode 100644 cogl-path/tesselator/dict.h create mode 100644 cogl-path/tesselator/geom.c create mode 100644 cogl-path/tesselator/geom.h create mode 100644 cogl-path/tesselator/gluos.h create mode 100644 cogl-path/tesselator/memalloc.h create mode 100644 cogl-path/tesselator/mesh.c create mode 100644 cogl-path/tesselator/mesh.h create mode 100644 cogl-path/tesselator/normal.c create mode 100644 cogl-path/tesselator/normal.h create mode 100644 cogl-path/tesselator/priorityq-heap.c create mode 100644 cogl-path/tesselator/priorityq-heap.h create mode 100644 cogl-path/tesselator/priorityq-sort.h create mode 100644 cogl-path/tesselator/priorityq.c create mode 100644 cogl-path/tesselator/priorityq.h create mode 100644 cogl-path/tesselator/render.c create mode 100644 cogl-path/tesselator/render.h create mode 100644 cogl-path/tesselator/sweep.c create mode 100644 cogl-path/tesselator/sweep.h create mode 100644 cogl-path/tesselator/tess.c create mode 100644 cogl-path/tesselator/tess.h create mode 100644 cogl-path/tesselator/tesselator.h create mode 100644 cogl-path/tesselator/tessmono.c create mode 100644 cogl-path/tesselator/tessmono.h create mode 100644 cogl/Makefile.am create mode 100644 cogl/Makefile.in create mode 100644 cogl/cogl-1.0.pc.in create mode 100644 cogl/cogl-2.0-experimental.pc.in create mode 100644 cogl/cogl-atlas-texture-private.h create mode 100644 cogl/cogl-atlas-texture.c create mode 100644 cogl/cogl-atlas-texture.h create mode 100644 cogl/cogl-atlas.c create mode 100644 cogl/cogl-atlas.h create mode 100644 cogl/cogl-attribute-buffer-private.h create mode 100644 cogl/cogl-attribute-buffer.c create mode 100644 cogl/cogl-attribute-buffer.h create mode 100644 cogl/cogl-attribute-private.h create mode 100644 cogl/cogl-attribute.c create mode 100644 cogl/cogl-attribute.h create mode 100644 cogl/cogl-bitmap-conversion.c create mode 100644 cogl/cogl-bitmap-packing.h create mode 100644 cogl/cogl-bitmap-pixbuf.c create mode 100644 cogl/cogl-bitmap-private.h create mode 100644 cogl/cogl-bitmap.c create mode 100644 cogl/cogl-bitmap.h create mode 100644 cogl/cogl-bitmask.c create mode 100644 cogl/cogl-bitmask.h create mode 100644 cogl/cogl-blend-string.c create mode 100644 cogl/cogl-blend-string.h create mode 100644 cogl/cogl-blit.c create mode 100644 cogl/cogl-blit.h create mode 100644 cogl/cogl-boxed-value.c create mode 100644 cogl/cogl-boxed-value.h create mode 100644 cogl/cogl-buffer-private.h create mode 100644 cogl/cogl-buffer.c create mode 100644 cogl/cogl-buffer.h create mode 100644 cogl/cogl-clip-stack.c create mode 100644 cogl/cogl-clip-stack.h create mode 100644 cogl/cogl-closure-list-private.h create mode 100644 cogl/cogl-closure-list.c create mode 100644 cogl/cogl-color-private.h create mode 100644 cogl/cogl-color.c create mode 100644 cogl/cogl-color.h create mode 100644 cogl/cogl-config-private.h create mode 100644 cogl/cogl-config.c create mode 100644 cogl/cogl-context-private.h create mode 100644 cogl/cogl-context.c create mode 100644 cogl/cogl-context.h create mode 100644 cogl/cogl-debug-options.h create mode 100644 cogl/cogl-debug.c create mode 100644 cogl/cogl-debug.h create mode 100644 cogl/cogl-defines.h.in create mode 100644 cogl/cogl-defines.h.win32 create mode 100644 cogl/cogl-defines.h.win32.in create mode 100644 cogl/cogl-defines.h.win32_SDL create mode 100644 cogl/cogl-defines.h.win32_SDL.in create mode 100644 cogl/cogl-deprecated.h create mode 100644 cogl/cogl-depth-state-private.h create mode 100644 cogl/cogl-depth-state.c create mode 100644 cogl/cogl-depth-state.h create mode 100644 cogl/cogl-display-private.h create mode 100644 cogl/cogl-display.c create mode 100644 cogl/cogl-display.h create mode 100644 cogl/cogl-driver.h create mode 100644 cogl/cogl-egl-defines.h.in create mode 100644 cogl/cogl-egl-private.h create mode 100644 cogl/cogl-egl.h create mode 100644 cogl/cogl-enum-types.c.in create mode 100644 cogl/cogl-enum-types.h.in create mode 100644 cogl/cogl-error-private.h create mode 100644 cogl/cogl-error.c create mode 100644 cogl/cogl-error.h create mode 100644 cogl/cogl-euler.c create mode 100644 cogl/cogl-euler.h create mode 100644 cogl/cogl-feature-private.c create mode 100644 cogl/cogl-feature-private.h create mode 100644 cogl/cogl-fence-private.h create mode 100644 cogl/cogl-fence.c create mode 100644 cogl/cogl-fence.h create mode 100644 cogl/cogl-flags.h create mode 100644 cogl/cogl-frame-info-private.h create mode 100644 cogl/cogl-frame-info.c create mode 100644 cogl/cogl-frame-info.h create mode 100644 cogl/cogl-framebuffer-private.h create mode 100644 cogl/cogl-framebuffer.c create mode 100644 cogl/cogl-framebuffer.h create mode 100644 cogl/cogl-gl-header.h.in create mode 100644 cogl/cogl-gl-header.h.win32 create mode 100644 cogl/cogl-gles2-context-private.h create mode 100644 cogl/cogl-gles2-context.c create mode 100644 cogl/cogl-gles2-types.h create mode 100644 cogl/cogl-gles2.h create mode 100644 cogl/cogl-glib-source.c create mode 100644 cogl/cogl-glib-source.h create mode 100644 cogl/cogl-glsl-shader-boilerplate.h create mode 100644 cogl/cogl-glsl-shader-private.h create mode 100644 cogl/cogl-glsl-shader.c create mode 100644 cogl/cogl-glx-display-private.h create mode 100644 cogl/cogl-glx-renderer-private.h create mode 100644 cogl/cogl-glx.h create mode 100644 cogl/cogl-gpu-info-private.h create mode 100644 cogl/cogl-gpu-info.c create mode 100644 cogl/cogl-gtype-private.h create mode 100644 cogl/cogl-gtype.c create mode 100644 cogl/cogl-i18n-private.h create mode 100644 cogl/cogl-index-buffer-private.h create mode 100644 cogl/cogl-index-buffer.c create mode 100644 cogl/cogl-index-buffer.h create mode 100644 cogl/cogl-indices-private.h create mode 100644 cogl/cogl-indices.c create mode 100644 cogl/cogl-indices.h create mode 100644 cogl/cogl-journal-private.h create mode 100644 cogl/cogl-journal.c create mode 100644 cogl/cogl-kms-display.h create mode 100644 cogl/cogl-kms-renderer.h create mode 100644 cogl/cogl-list.c create mode 100644 cogl/cogl-list.h create mode 100644 cogl/cogl-macros.h create mode 100644 cogl/cogl-magazine-private.h create mode 100644 cogl/cogl-magazine.c create mode 100644 cogl/cogl-matrix-private.h create mode 100644 cogl/cogl-matrix-stack-private.h create mode 100644 cogl/cogl-matrix-stack.c create mode 100644 cogl/cogl-matrix-stack.h create mode 100644 cogl/cogl-matrix.c create mode 100644 cogl/cogl-matrix.h create mode 100644 cogl/cogl-memory-stack-private.h create mode 100644 cogl/cogl-memory-stack.c create mode 100644 cogl/cogl-meta-texture.c create mode 100644 cogl/cogl-meta-texture.h create mode 100644 cogl/cogl-node-private.h create mode 100644 cogl/cogl-node.c create mode 100644 cogl/cogl-object-private.h create mode 100644 cogl/cogl-object.c create mode 100644 cogl/cogl-object.h create mode 100644 cogl/cogl-offscreen.h create mode 100644 cogl/cogl-onscreen-private.h create mode 100644 cogl/cogl-onscreen-template-private.h create mode 100644 cogl/cogl-onscreen-template.c create mode 100644 cogl/cogl-onscreen-template.h create mode 100644 cogl/cogl-onscreen.c create mode 100644 cogl/cogl-onscreen.h create mode 100644 cogl/cogl-output-private.h create mode 100644 cogl/cogl-output.c create mode 100644 cogl/cogl-output.h create mode 100644 cogl/cogl-pango.h create mode 100644 cogl/cogl-pipeline-cache.c create mode 100644 cogl/cogl-pipeline-cache.h create mode 100644 cogl/cogl-pipeline-debug.c create mode 100644 cogl/cogl-pipeline-hash-table.c create mode 100644 cogl/cogl-pipeline-hash-table.h create mode 100644 cogl/cogl-pipeline-layer-private.h create mode 100644 cogl/cogl-pipeline-layer-state-private.h create mode 100644 cogl/cogl-pipeline-layer-state.c create mode 100644 cogl/cogl-pipeline-layer-state.h create mode 100644 cogl/cogl-pipeline-layer.c create mode 100644 cogl/cogl-pipeline-private.h create mode 100644 cogl/cogl-pipeline-snippet-private.h create mode 100644 cogl/cogl-pipeline-snippet.c create mode 100644 cogl/cogl-pipeline-state-private.h create mode 100644 cogl/cogl-pipeline-state.c create mode 100644 cogl/cogl-pipeline-state.h create mode 100644 cogl/cogl-pipeline.c create mode 100644 cogl/cogl-pipeline.h create mode 100644 cogl/cogl-pixel-buffer-private.h create mode 100644 cogl/cogl-pixel-buffer.c create mode 100644 cogl/cogl-pixel-buffer.h create mode 100644 cogl/cogl-point-in-poly-private.h create mode 100644 cogl/cogl-point-in-poly.c create mode 100644 cogl/cogl-poll-private.h create mode 100644 cogl/cogl-poll.c create mode 100644 cogl/cogl-poll.h create mode 100644 cogl/cogl-primitive-private.h create mode 100644 cogl/cogl-primitive-texture.c create mode 100644 cogl/cogl-primitive-texture.h create mode 100644 cogl/cogl-primitive.c create mode 100644 cogl/cogl-primitive.h create mode 100644 cogl/cogl-primitives-private.h create mode 100644 cogl/cogl-primitives.c create mode 100644 cogl/cogl-primitives.h create mode 100644 cogl/cogl-private.h create mode 100644 cogl/cogl-profile.c create mode 100644 cogl/cogl-profile.h create mode 100644 cogl/cogl-quaternion-private.h create mode 100644 cogl/cogl-quaternion.c create mode 100644 cogl/cogl-quaternion.h create mode 100644 cogl/cogl-rectangle-map.c create mode 100644 cogl/cogl-rectangle-map.h create mode 100644 cogl/cogl-renderer-private.h create mode 100644 cogl/cogl-renderer.c create mode 100644 cogl/cogl-renderer.h create mode 100644 cogl/cogl-sampler-cache-private.h create mode 100644 cogl/cogl-sampler-cache.c create mode 100644 cogl/cogl-sdl.c create mode 100644 cogl/cogl-sdl.h create mode 100644 cogl/cogl-snippet-private.h create mode 100644 cogl/cogl-snippet.c create mode 100644 cogl/cogl-snippet.h create mode 100644 cogl/cogl-spans.c create mode 100644 cogl/cogl-spans.h create mode 100644 cogl/cogl-sub-texture-private.h create mode 100644 cogl/cogl-sub-texture.c create mode 100644 cogl/cogl-sub-texture.h create mode 100644 cogl/cogl-swap-chain-private.h create mode 100644 cogl/cogl-swap-chain.c create mode 100644 cogl/cogl-swap-chain.h create mode 100644 cogl/cogl-texture-2d-gl.h create mode 100644 cogl/cogl-texture-2d-private.h create mode 100644 cogl/cogl-texture-2d-sliced-private.h create mode 100644 cogl/cogl-texture-2d-sliced.c create mode 100644 cogl/cogl-texture-2d-sliced.h create mode 100644 cogl/cogl-texture-2d.c create mode 100644 cogl/cogl-texture-2d.h create mode 100644 cogl/cogl-texture-3d-private.h create mode 100644 cogl/cogl-texture-3d.c create mode 100644 cogl/cogl-texture-3d.h create mode 100644 cogl/cogl-texture-driver.h create mode 100644 cogl/cogl-texture-private.h create mode 100644 cogl/cogl-texture-rectangle-private.h create mode 100644 cogl/cogl-texture-rectangle.c create mode 100644 cogl/cogl-texture-rectangle.h create mode 100644 cogl/cogl-texture.c create mode 100644 cogl/cogl-texture.h create mode 100644 cogl/cogl-types.h create mode 100644 cogl/cogl-util.c create mode 100644 cogl/cogl-util.h create mode 100644 cogl/cogl-vector.c create mode 100644 cogl/cogl-vector.h create mode 100644 cogl/cogl-version.h create mode 100644 cogl/cogl-wayland-client.h create mode 100644 cogl/cogl-wayland-renderer.h create mode 100644 cogl/cogl-wayland-server.h create mode 100644 cogl/cogl-win32-renderer.c create mode 100644 cogl/cogl-win32-renderer.h create mode 100644 cogl/cogl-x11-renderer-private.h create mode 100644 cogl/cogl-xlib-private.h create mode 100644 cogl/cogl-xlib-renderer-private.h create mode 100644 cogl/cogl-xlib-renderer.c create mode 100644 cogl/cogl-xlib-renderer.h create mode 100644 cogl/cogl-xlib.c create mode 100644 cogl/cogl-xlib.h create mode 100644 cogl/cogl.c create mode 100644 cogl/cogl.h create mode 100644 cogl/cogl.rc create mode 100644 cogl/cogl.rc.in create mode 100644 cogl/cogl.symbols create mode 100644 cogl/cogl1-context.h create mode 100644 cogl/cogl2-experimental.h create mode 100644 cogl/deprecated/cogl-auto-texture.c create mode 100644 cogl/deprecated/cogl-auto-texture.h create mode 100644 cogl/deprecated/cogl-clip-state.c create mode 100644 cogl/deprecated/cogl-clip-state.h create mode 100644 cogl/deprecated/cogl-clutter-xlib.h create mode 100644 cogl/deprecated/cogl-clutter.c create mode 100644 cogl/deprecated/cogl-clutter.h create mode 100644 cogl/deprecated/cogl-fixed.c create mode 100644 cogl/deprecated/cogl-fixed.h create mode 100644 cogl/deprecated/cogl-framebuffer-deprecated.c create mode 100644 cogl/deprecated/cogl-framebuffer-deprecated.h create mode 100644 cogl/deprecated/cogl-material-compat.c create mode 100644 cogl/deprecated/cogl-material-compat.h create mode 100644 cogl/deprecated/cogl-program-private.h create mode 100644 cogl/deprecated/cogl-program.c create mode 100644 cogl/deprecated/cogl-shader-private.h create mode 100644 cogl/deprecated/cogl-shader.c create mode 100644 cogl/deprecated/cogl-shader.h create mode 100644 cogl/deprecated/cogl-texture-deprecated.c create mode 100644 cogl/deprecated/cogl-texture-deprecated.h create mode 100644 cogl/deprecated/cogl-type-casts.h create mode 100644 cogl/deprecated/cogl-vertex-buffer-private.h create mode 100644 cogl/deprecated/cogl-vertex-buffer.c create mode 100644 cogl/deprecated/cogl-vertex-buffer.h create mode 100644 cogl/driver/gl/cogl-attribute-gl-private.h create mode 100644 cogl/driver/gl/cogl-attribute-gl.c create mode 100644 cogl/driver/gl/cogl-buffer-gl-private.h create mode 100644 cogl/driver/gl/cogl-buffer-gl.c create mode 100644 cogl/driver/gl/cogl-clip-stack-gl-private.h create mode 100644 cogl/driver/gl/cogl-clip-stack-gl.c create mode 100644 cogl/driver/gl/cogl-framebuffer-gl-private.h create mode 100644 cogl/driver/gl/cogl-framebuffer-gl.c create mode 100644 cogl/driver/gl/cogl-pipeline-fragend-fixed-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-fragend-fixed.c create mode 100644 cogl/driver/gl/cogl-pipeline-fragend-glsl-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-fragend-glsl.c create mode 100644 cogl/driver/gl/cogl-pipeline-opengl-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-opengl.c create mode 100644 cogl/driver/gl/cogl-pipeline-progend-fixed-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-progend-fixed.c create mode 100644 cogl/driver/gl/cogl-pipeline-progend-glsl-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-progend-glsl.c create mode 100644 cogl/driver/gl/cogl-pipeline-vertend-fixed-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-vertend-fixed.c create mode 100644 cogl/driver/gl/cogl-pipeline-vertend-glsl-private.h create mode 100644 cogl/driver/gl/cogl-pipeline-vertend-glsl.c create mode 100644 cogl/driver/gl/cogl-texture-2d-gl-private.h create mode 100644 cogl/driver/gl/cogl-texture-2d-gl.c create mode 100644 cogl/driver/gl/cogl-texture-gl-private.h create mode 100644 cogl/driver/gl/cogl-texture-gl.c create mode 100644 cogl/driver/gl/cogl-util-gl-private.h create mode 100644 cogl/driver/gl/cogl-util-gl.c create mode 100644 cogl/driver/gl/gl/cogl-driver-gl.c create mode 100644 cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h create mode 100644 cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c create mode 100644 cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h create mode 100644 cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c create mode 100644 cogl/driver/gl/gl/cogl-texture-driver-gl.c create mode 100644 cogl/driver/gl/gles/cogl-driver-gles.c create mode 100644 cogl/driver/gl/gles/cogl-texture-driver-gles.c create mode 100644 cogl/driver/nop/cogl-attribute-nop-private.h create mode 100644 cogl/driver/nop/cogl-attribute-nop.c create mode 100644 cogl/driver/nop/cogl-clip-stack-nop-private.h create mode 100644 cogl/driver/nop/cogl-clip-stack-nop.c create mode 100644 cogl/driver/nop/cogl-driver-nop.c create mode 100644 cogl/driver/nop/cogl-framebuffer-nop-private.h create mode 100644 cogl/driver/nop/cogl-framebuffer-nop.c create mode 100644 cogl/driver/nop/cogl-texture-2d-nop-private.h create mode 100644 cogl/driver/nop/cogl-texture-2d-nop.c create mode 100644 cogl/gl-prototypes/cogl-all-functions.h create mode 100644 cogl/gl-prototypes/cogl-core-functions.h create mode 100644 cogl/gl-prototypes/cogl-fixed-functions.h create mode 100644 cogl/gl-prototypes/cogl-gles1-functions.h create mode 100644 cogl/gl-prototypes/cogl-gles2-functions.h create mode 100644 cogl/gl-prototypes/cogl-glsl-functions.h create mode 100644 cogl/gl-prototypes/cogl-in-gles-core-functions.h create mode 100644 cogl/gl-prototypes/cogl-in-gles1-core-functions.h create mode 100644 cogl/gl-prototypes/cogl-in-gles2-core-functions.h create mode 100644 cogl/stb_image.c create mode 100644 cogl/winsys/cogl-texture-pixmap-x11-private.h create mode 100644 cogl/winsys/cogl-texture-pixmap-x11.c create mode 100644 cogl/winsys/cogl-texture-pixmap-x11.h create mode 100644 cogl/winsys/cogl-winsys-egl-android-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-android.c create mode 100644 cogl/winsys/cogl-winsys-egl-feature-functions.h create mode 100644 cogl/winsys/cogl-winsys-egl-gdl-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-gdl.c create mode 100644 cogl/winsys/cogl-winsys-egl-kms-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-kms.c create mode 100644 cogl/winsys/cogl-winsys-egl-null-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-null.c create mode 100644 cogl/winsys/cogl-winsys-egl-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-wayland-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-wayland.c create mode 100644 cogl/winsys/cogl-winsys-egl-x11-private.h create mode 100644 cogl/winsys/cogl-winsys-egl-x11.c create mode 100644 cogl/winsys/cogl-winsys-egl.c create mode 100644 cogl/winsys/cogl-winsys-glx-feature-functions.h create mode 100644 cogl/winsys/cogl-winsys-glx-private.h create mode 100644 cogl/winsys/cogl-winsys-glx.c create mode 100644 cogl/winsys/cogl-winsys-private.h create mode 100644 cogl/winsys/cogl-winsys-sdl-private.h create mode 100644 cogl/winsys/cogl-winsys-sdl.c create mode 100644 cogl/winsys/cogl-winsys-sdl2.c create mode 100644 cogl/winsys/cogl-winsys-stub-private.h create mode 100644 cogl/winsys/cogl-winsys-stub.c create mode 100644 cogl/winsys/cogl-winsys-wgl-feature-functions.h create mode 100644 cogl/winsys/cogl-winsys-wgl-private.h create mode 100644 cogl/winsys/cogl-winsys-wgl.c create mode 100644 cogl/winsys/cogl-winsys.c create mode 100644 config-custom.h create mode 100644 config.h.in create mode 100644 config.h.win32 create mode 100644 config.h.win32.in create mode 100755 configure create mode 100644 configure.ac create mode 100644 deps/Makefile.am create mode 100644 deps/Makefile.in create mode 100644 deps/glib/COPYING create mode 100644 deps/glib/Makefile.am create mode 100644 deps/glib/Makefile.in create mode 100644 deps/glib/README create mode 100644 deps/glib/galloca.h create mode 100644 deps/glib/garray.c create mode 100644 deps/glib/garray.h create mode 100644 deps/glib/gatomic.c create mode 100644 deps/glib/gatomic.h create mode 100644 deps/glib/gbacktrace.h create mode 100644 deps/glib/gbitlock.c create mode 100644 deps/glib/gbitlock.h create mode 100644 deps/glib/gconvert.c create mode 100644 deps/glib/gconvert.h create mode 100644 deps/glib/gdataset.c create mode 100644 deps/glib/gdataset.h create mode 100644 deps/glib/gdatasetprivate.h create mode 100644 deps/glib/gdebug.h create mode 100644 deps/glib/gerror.c create mode 100644 deps/glib/gerror.h create mode 100644 deps/glib/gfileutils.c create mode 100644 deps/glib/gfileutils.h create mode 100644 deps/glib/ghash.c create mode 100644 deps/glib/ghash.h create mode 100644 deps/glib/ghook.c create mode 100644 deps/glib/ghook.h create mode 100644 deps/glib/gi18n-lib.h create mode 100644 deps/glib/glib-object.h create mode 100644 deps/glib/glib.h create mode 100644 deps/glib/glib_trace.h create mode 100644 deps/glib/glibintl.h create mode 100644 deps/glib/glist.c create mode 100644 deps/glib/glist.h create mode 100644 deps/glib/gmacros.h create mode 100644 deps/glib/gmain.c create mode 100644 deps/glib/gmain.h create mode 100644 deps/glib/gmem.c create mode 100644 deps/glib/gmem.h create mode 100644 deps/glib/gmessages.c create mode 100644 deps/glib/gmessages.h create mode 100644 deps/glib/gprintf.c create mode 100644 deps/glib/gprintf.h create mode 100644 deps/glib/gprintfint.h create mode 100644 deps/glib/gqsort.c create mode 100644 deps/glib/gqsort.h create mode 100644 deps/glib/gquark.h create mode 100644 deps/glib/gqueue.c create mode 100644 deps/glib/gqueue.h create mode 100644 deps/glib/gslice.c create mode 100644 deps/glib/gslice.h create mode 100644 deps/glib/gslist.c create mode 100644 deps/glib/gslist.h create mode 100644 deps/glib/gstdio.c create mode 100644 deps/glib/gstdio.h create mode 100644 deps/glib/gstrfuncs.c create mode 100644 deps/glib/gstrfuncs.h create mode 100644 deps/glib/gstring.c create mode 100644 deps/glib/gstring.h create mode 100644 deps/glib/gtestutils.c create mode 100644 deps/glib/gtestutils.h create mode 100644 deps/glib/gthread.c create mode 100644 deps/glib/gthread.h create mode 100644 deps/glib/gtypes.h create mode 100644 deps/glib/gunicode.h create mode 100644 deps/glib/gutils.c create mode 100644 deps/glib/gutils.h create mode 100644 deps/gmodule/Makefile.am create mode 100644 deps/gmodule/Makefile.in create mode 100644 deps/gmodule/README create mode 100644 deps/gmodule/gmodule-dl.c create mode 100644 deps/gmodule/gmodule-dld.c create mode 100644 deps/gmodule/gmodule-dyld.c create mode 100644 deps/gmodule/gmodule-win32.c create mode 100644 deps/gmodule/gmodule.c create mode 100644 deps/gmodule/gmoduleconf.h.in create mode 100644 deps/gmodule/gmoduleconf.h.win32 create mode 100644 doc/CODING_STYLE create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/reference/Makefile.am create mode 100644 doc/reference/Makefile.in create mode 100644 doc/reference/cogl-2.0-experimental/Makefile.am create mode 100644 doc/reference/cogl-2.0-experimental/Makefile.in create mode 100644 doc/reference/cogl-2.0-experimental/blend-strings.xml create mode 100644 doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml create mode 100644 doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml.in create mode 100644 doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-overrides.txt create mode 100644 doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt create mode 100644 doc/reference/cogl-2.0-experimental/cogl_ortho.png create mode 100644 doc/reference/cogl-2.0-experimental/fill-rule-even-odd.png create mode 100644 doc/reference/cogl-2.0-experimental/fill-rule-non-zero.png create mode 100644 doc/reference/cogl-2.0-experimental/html/ch01.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-2D-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3-Component-Vectors.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3D-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Bitmap.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglBuffer---The-Buffer-Interface.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglDisplay---Setup-a-display-pipeline.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglFramebuffer---The-Framebuffer-Interface.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreen---The-Onscreen-Framebuffer-Interface.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreenTemplate---Describe-a-template-for-onscreen-framebuffers.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglRenderer---Connect-to-a-backend-renderer.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Common-Types.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Depth-State.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Eulers-(Rotations).html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Exception-handling.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GLES-2.0-context.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GPU-synchronisation-fences.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GType-Integration-API.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-High-Level-Meta-Textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Indices.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Low-level-primitive-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integration.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrix-Stacks.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Path-Primitives.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Pipeline.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Primitives.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangles.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-SDL-Integration.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sliced-Textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sub-Textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Object-Interface.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Texture-Interface.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Top-Level-Context.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Versioning-utility-macros.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-X11-Texture-From-Pixmap.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental.devhelp2 create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-Blend-Strings.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-buffer-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-buffer-layout-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-context-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-framebuffer-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-general-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-integration.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-meta-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-pipeline-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-primitive-apis.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-primitive-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-textures.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl-utilities.html create mode 100644 doc/reference/cogl-2.0-experimental/html/cogl_ortho.png create mode 100644 doc/reference/cogl-2.0-experimental/html/coglglossary.html create mode 100644 doc/reference/cogl-2.0-experimental/html/fill-rule-even-odd.png create mode 100644 doc/reference/cogl-2.0-experimental/html/fill-rule-non-zero.png create mode 100644 doc/reference/cogl-2.0-experimental/html/home.png create mode 100644 doc/reference/cogl-2.0-experimental/html/index.html create mode 100644 doc/reference/cogl-2.0-experimental/html/index.sgml create mode 100644 doc/reference/cogl-2.0-experimental/html/ix01.html create mode 100644 doc/reference/cogl-2.0-experimental/html/ix02.html create mode 100644 doc/reference/cogl-2.0-experimental/html/ix03.html create mode 100644 doc/reference/cogl-2.0-experimental/html/ix04.html create mode 100644 doc/reference/cogl-2.0-experimental/html/ix05.html create mode 100644 doc/reference/cogl-2.0-experimental/html/ix06.html create mode 100644 doc/reference/cogl-2.0-experimental/html/left.png create mode 100644 doc/reference/cogl-2.0-experimental/html/license.html create mode 100644 doc/reference/cogl-2.0-experimental/html/quad-indices-order.png create mode 100644 doc/reference/cogl-2.0-experimental/html/quad-indices-triangles.png create mode 100644 doc/reference/cogl-2.0-experimental/html/right.png create mode 100644 doc/reference/cogl-2.0-experimental/html/style.css create mode 100644 doc/reference/cogl-2.0-experimental/html/up.png create mode 100644 doc/reference/cogl-2.0-experimental/quad-indices-order.png create mode 100644 doc/reference/cogl-2.0-experimental/quad-indices-triangles.png create mode 100644 doc/reference/cogl-gst/Makefile.am create mode 100644 doc/reference/cogl-gst/Makefile.in create mode 100644 doc/reference/cogl-gst/cogl-gst-docs.xml create mode 100644 doc/reference/cogl-gst/cogl-gst-docs.xml.in create mode 100644 doc/reference/cogl-gst/cogl-gst-overrides.txt create mode 100644 doc/reference/cogl-gst/cogl-gst-sections.txt create mode 100644 doc/reference/cogl-gst/cogl-gst.types create mode 100644 doc/reference/cogl-gst/html/CoglGstVideoSink.html create mode 100644 doc/reference/cogl-gst/html/ch01.html create mode 100644 doc/reference/cogl-gst/html/cogl-gst-general-apis.html create mode 100644 doc/reference/cogl-gst/html/cogl-gst.devhelp2 create mode 100644 doc/reference/cogl-gst/html/coglglossary.html create mode 100644 doc/reference/cogl-gst/html/home.png create mode 100644 doc/reference/cogl-gst/html/index.html create mode 100644 doc/reference/cogl-gst/html/index.sgml create mode 100644 doc/reference/cogl-gst/html/ix01.html create mode 100644 doc/reference/cogl-gst/html/left.png create mode 100644 doc/reference/cogl-gst/html/license.html create mode 100644 doc/reference/cogl-gst/html/right.png create mode 100644 doc/reference/cogl-gst/html/style.css create mode 100644 doc/reference/cogl-gst/html/up.png create mode 100644 doc/reference/cogl/Makefile.am create mode 100644 doc/reference/cogl/Makefile.in create mode 100644 doc/reference/cogl/blend-strings.xml create mode 100644 doc/reference/cogl/cogl-docs.xml create mode 100644 doc/reference/cogl/cogl-docs.xml.in create mode 100644 doc/reference/cogl/cogl-overrides.txt create mode 100644 doc/reference/cogl/cogl-sections.txt create mode 100644 doc/reference/cogl/cogl_ortho.png create mode 100644 doc/reference/cogl/fill-rule-even-odd.png create mode 100644 doc/reference/cogl/fill-rule-non-zero.png create mode 100644 doc/reference/cogl/html/ch01.html create mode 100644 doc/reference/cogl/html/ch02.html create mode 100644 doc/reference/cogl/html/ch03.html create mode 100644 doc/reference/cogl/html/cogl-3D-textures.html create mode 100644 doc/reference/cogl/html/cogl-Bitmaps.html create mode 100644 doc/reference/cogl/html/cogl-Blend-Strings.html create mode 100644 doc/reference/cogl/html/cogl-Buffers.html create mode 100644 doc/reference/cogl/html/cogl-Clipping-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Clipping.html create mode 100644 doc/reference/cogl/html/cogl-Color-Type.html create mode 100644 doc/reference/cogl/html/cogl-Fixed-Point-API.html create mode 100644 doc/reference/cogl/html/cogl-GType-Integration-API.html create mode 100644 doc/reference/cogl/html/cogl-General-API-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-General-API.html create mode 100644 doc/reference/cogl/html/cogl-Materials-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Materials.html create mode 100644 doc/reference/cogl/html/cogl-Matrices.html create mode 100644 doc/reference/cogl/html/cogl-Offscreen-Buffers-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Offscreen-Buffers.html create mode 100644 doc/reference/cogl/html/cogl-Path-Primitives.html create mode 100644 doc/reference/cogl/html/cogl-Primitives.html create mode 100644 doc/reference/cogl/html/cogl-Quaternions-(Rotations).html create mode 100644 doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline.html create mode 100644 doc/reference/cogl/html/cogl-Textures-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Textures.html create mode 100644 doc/reference/cogl/html/cogl-Vectors.html create mode 100644 doc/reference/cogl/html/cogl-Vertex-Buffers-(Deprecated).html create mode 100644 doc/reference/cogl/html/cogl-Vertex-Buffers.html create mode 100644 doc/reference/cogl/html/cogl.devhelp2 create mode 100644 doc/reference/cogl/html/cogl_ortho.png create mode 100644 doc/reference/cogl/html/coglglossary.html create mode 100644 doc/reference/cogl/html/fill-rule-even-odd.png create mode 100644 doc/reference/cogl/html/fill-rule-non-zero.png create mode 100644 doc/reference/cogl/html/home.png create mode 100644 doc/reference/cogl/html/index.html create mode 100644 doc/reference/cogl/html/index.sgml create mode 100644 doc/reference/cogl/html/ix01.html create mode 100644 doc/reference/cogl/html/ix02.html create mode 100644 doc/reference/cogl/html/ix03.html create mode 100644 doc/reference/cogl/html/ix04.html create mode 100644 doc/reference/cogl/html/ix05.html create mode 100644 doc/reference/cogl/html/ix06.html create mode 100644 doc/reference/cogl/html/ix07.html create mode 100644 doc/reference/cogl/html/ix08.html create mode 100644 doc/reference/cogl/html/left.png create mode 100644 doc/reference/cogl/html/license.html create mode 100644 doc/reference/cogl/html/quad-indices-order.png create mode 100644 doc/reference/cogl/html/quad-indices-triangles.png create mode 100644 doc/reference/cogl/html/right.png create mode 100644 doc/reference/cogl/html/style.css create mode 100644 doc/reference/cogl/html/up.png create mode 100644 doc/reference/cogl/quad-indices-order.png create mode 100644 doc/reference/cogl/quad-indices-triangles.png create mode 100644 examples/Makefile.am create mode 100644 examples/Makefile.in create mode 100644 examples/android/hello/.gitignore create mode 100644 examples/android/hello/AndroidManifest.xml create mode 100644 examples/android/hello/build.xml create mode 100644 examples/android/hello/jni/Android.mk create mode 100644 examples/android/hello/jni/Application.mk create mode 100644 examples/android/hello/jni/main.c create mode 100644 examples/android/hello/res/values/strings.xml create mode 100644 examples/cogl-basic-video-player.c create mode 100644 examples/cogl-crate.c create mode 100644 examples/cogl-emscripten-hello.c create mode 100644 examples/cogl-gjs.js create mode 100644 examples/cogl-gles2-context.c create mode 100644 examples/cogl-gles2-gears.c create mode 100644 examples/cogl-hello.c create mode 100644 examples/cogl-info.c create mode 100644 examples/cogl-msaa.c create mode 100644 examples/cogl-point-sprites.c create mode 100644 examples/cogl-sdl-hello.c create mode 100644 examples/cogl-sdl2-hello.c create mode 100644 examples/cogl-x11-foreign.c create mode 100644 examples/cogl-x11-tfp.c create mode 100644 examples/cogland.c create mode 100644 examples/crate.jpg create mode 100644 examples/emscripten-example-js-library.js create mode 100644 examples/emscripten-example-js.h create mode 100644 gtk-doc.make create mode 100644 po/ChangeLog create mode 100644 po/Makefile.in.in create mode 100644 po/Makevars create mode 100644 po/POTFILES.in create mode 100644 po/Rules-quot create mode 100644 po/an.gmo create mode 100644 po/an.po create mode 100644 po/ar.gmo create mode 100644 po/ar.po create mode 100644 po/as.gmo create mode 100644 po/as.po create mode 100644 po/ast.gmo create mode 100644 po/ast.po create mode 100644 po/be.gmo create mode 100644 po/be.po create mode 100644 po/bg.gmo create mode 100644 po/bg.po create mode 100644 po/boldquot.sed create mode 100644 po/ca.gmo create mode 100644 po/ca.po create mode 100644 po/ca@valencia.gmo create mode 100644 po/ca@valencia.po create mode 100644 po/cogl.pot create mode 100644 po/cs.gmo create mode 100644 po/cs.po create mode 100644 po/da.gmo create mode 100644 po/da.po create mode 100644 po/de.gmo create mode 100644 po/de.po create mode 100644 po/el.gmo create mode 100644 po/el.po create mode 100644 po/en@boldquot.header create mode 100644 po/en@quot.header create mode 100644 po/en_CA.gmo create mode 100644 po/en_CA.po create mode 100644 po/en_GB.gmo create mode 100644 po/en_GB.po create mode 100644 po/eo.gmo create mode 100644 po/eo.po create mode 100644 po/es.gmo create mode 100644 po/es.po create mode 100644 po/eu.gmo create mode 100644 po/eu.po create mode 100644 po/fa.gmo create mode 100644 po/fa.po create mode 100644 po/fr.gmo create mode 100644 po/fr.po create mode 100644 po/gl.gmo create mode 100644 po/gl.po create mode 100644 po/he.gmo create mode 100644 po/he.po create mode 100644 po/hi.gmo create mode 100644 po/hi.po create mode 100644 po/hu.gmo create mode 100644 po/hu.po create mode 100644 po/id.gmo create mode 100644 po/id.po create mode 100644 po/insert-header.sin create mode 100644 po/it.gmo create mode 100644 po/it.po create mode 100644 po/ja.gmo create mode 100644 po/ja.po create mode 100644 po/km.gmo create mode 100644 po/km.po create mode 100644 po/kn.gmo create mode 100644 po/kn.po create mode 100644 po/ko.gmo create mode 100644 po/ko.po create mode 100644 po/lt.gmo create mode 100644 po/lt.po create mode 100644 po/lv.gmo create mode 100644 po/lv.po create mode 100644 po/ml.gmo create mode 100644 po/ml.po create mode 100644 po/nb.gmo create mode 100644 po/nb.po create mode 100644 po/nl.gmo create mode 100644 po/nl.po create mode 100644 po/or.gmo create mode 100644 po/or.po create mode 100644 po/pa.gmo create mode 100644 po/pa.po create mode 100644 po/pl.gmo create mode 100644 po/pl.po create mode 100644 po/pt.gmo create mode 100644 po/pt.po create mode 100644 po/pt_BR.gmo create mode 100644 po/pt_BR.po create mode 100644 po/quot.sed create mode 100644 po/remove-potcdate.sin create mode 100644 po/ru.gmo create mode 100644 po/ru.po create mode 100644 po/sk.gmo create mode 100644 po/sk.po create mode 100644 po/sl.gmo create mode 100644 po/sl.po create mode 100644 po/sr.gmo create mode 100644 po/sr.po create mode 100644 po/sr@latin.gmo create mode 100644 po/sr@latin.po create mode 100644 po/stamp-po create mode 100644 po/sv.gmo create mode 100644 po/sv.po create mode 100644 po/ta.gmo create mode 100644 po/ta.po create mode 100644 po/te.gmo create mode 100644 po/te.po create mode 100644 po/th.gmo create mode 100644 po/th.po create mode 100644 po/tr.gmo create mode 100644 po/tr.po create mode 100644 po/ug.gmo create mode 100644 po/ug.po create mode 100644 po/uk.gmo create mode 100644 po/uk.po create mode 100644 po/vi.gmo create mode 100644 po/vi.po create mode 100644 po/zh_CN.gmo create mode 100644 po/zh_CN.po create mode 100644 po/zh_HK.gmo create mode 100644 po/zh_HK.po create mode 100644 po/zh_TW.gmo create mode 100644 po/zh_TW.po create mode 100644 test-fixtures/Makefile.am create mode 100644 test-fixtures/Makefile.in create mode 100644 test-fixtures/test-unit.h create mode 100644 test-fixtures/test-utils.c create mode 100644 test-fixtures/test-utils.h create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100644 tests/README create mode 100644 tests/config.env.in create mode 100644 tests/conform/Makefile.am create mode 100644 tests/conform/Makefile.in create mode 100644 tests/conform/test-alpha-test.c create mode 100644 tests/conform/test-alpha-textures.c create mode 100644 tests/conform/test-atlas-migration.c create mode 100644 tests/conform/test-backface-culling.c create mode 100644 tests/conform/test-blend-strings.c create mode 100644 tests/conform/test-blend.c create mode 100644 tests/conform/test-color-hsl.c create mode 100644 tests/conform/test-color-mask.c create mode 100644 tests/conform/test-conform-main.c create mode 100644 tests/conform/test-copy-replace-texture.c create mode 100644 tests/conform/test-custom-attributes.c create mode 100644 tests/conform/test-depth-test.c create mode 100644 tests/conform/test-euler-quaternion.c create mode 100644 tests/conform/test-fence.c create mode 100644 tests/conform/test-framebuffer-get-bits.c create mode 100644 tests/conform/test-gles2-context.c create mode 100644 tests/conform/test-just-vertex-shader.c create mode 100644 tests/conform/test-layer-remove.c create mode 100644 tests/conform/test-map-buffer-range.c create mode 100644 tests/conform/test-no-gl-header.c create mode 100644 tests/conform/test-npot-texture.c create mode 100644 tests/conform/test-offscreen.c create mode 100644 tests/conform/test-path-clip.c create mode 100644 tests/conform/test-path.c create mode 100644 tests/conform/test-pipeline-cache-unrefs-texture.c create mode 100644 tests/conform/test-pipeline-shader-state.c create mode 100644 tests/conform/test-pipeline-uniforms.c create mode 100644 tests/conform/test-pipeline-user-matrix.c create mode 100644 tests/conform/test-pixel-buffer.c create mode 100644 tests/conform/test-point-size-attribute.c create mode 100644 tests/conform/test-point-size.c create mode 100644 tests/conform/test-point-sprite.c create mode 100644 tests/conform/test-premult.c create mode 100644 tests/conform/test-primitive-and-journal.c create mode 100644 tests/conform/test-primitive.c create mode 100644 tests/conform/test-read-texture-formats.c create mode 100644 tests/conform/test-snippets.c create mode 100644 tests/conform/test-sparse-pipeline.c create mode 100644 tests/conform/test-sub-texture.c create mode 100644 tests/conform/test-texture-3d.c create mode 100644 tests/conform/test-texture-get-set-data.c create mode 100644 tests/conform/test-texture-no-allocate.c create mode 100644 tests/conform/test-texture-rg.c create mode 100644 tests/conform/test-version.c create mode 100644 tests/conform/test-wrap-modes.c create mode 100644 tests/conform/test-wrap-rectangle-textures.c create mode 100644 tests/conform/test-write-texture-formats.c create mode 100644 tests/data/Makefile.am create mode 100644 tests/data/Makefile.in create mode 100644 tests/data/valgrind.suppressions create mode 100644 tests/micro-perf/Makefile.am create mode 100644 tests/micro-perf/Makefile.in create mode 100644 tests/micro-perf/test-journal.c create mode 100755 tests/run-tests.sh create mode 100755 tests/test-launcher.sh create mode 100644 tests/unit/Makefile.am create mode 100644 tests/unit/Makefile.in create mode 100644 tests/unit/test-unit-main.c diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..83bc72e --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,1068 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. If you happen to have the `LC_ALL' or some other +`LC_xxx' environment variables set, you should unset them before +setting `LANG', otherwise the setting of `LANG' will not have the +desired effect. Here `LL' is an ISO 639 two-letter language code, and +`CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `coordinator@translationproject.org' to +reach the coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of November +2007. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + Compendium | [] [] [] [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] [] | + bash | [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] | + bison-runtime | [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + dialog | | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + fetchmail | [] [] () [] [] | + findutils | [] | + findutils_stable | [] [] [] | + flex | [] [] [] | + fslint | | + gas | | + gawk | [] [] [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gip | [] | + gliv | [] [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | [] [] () () [] | + gnuedu | | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | | + gramadoir | [] [] | + grep | [] [] | + gretl | () | + gsasl | | + gss | | + gst-plugins-bad | [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gst-plugins-ugly | [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | () | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] [] | + indent | [] [] [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] [] | + iso_639 | [] [] [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | [] [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | [] [] | + libidn | [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lprng | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] | + make | [] [] | + man-db | [] [] [] | + minicom | [] [] [] | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + popt | [] [] [] | + psmisc | [] | + pwdutils | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + shared-mime-info | [] [] [] [] () [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + skencil | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] | + texinfo | [] [] [] | + tin | () () | + tuxpaint | [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + util-linux-ng | [] [] [] [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 6 0 2 1 8 26 2 40 48 2 56 88 15 1 15 18 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + Compendium | [] [] [] [] [] | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] | + bfd | [] [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + dialog | [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + fetchmail | [] | + findutils | [] [] [] | + findutils_stable | [] [] [] [] | + flex | [] [] [] | + fslint | | + gas | [] [] | + gawk | [] [] [] [] () | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] | + gip | [] [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnuedu | [] | + gnulib | [] [] [] | + gnunet | | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] [] | + gpsdrive | [] | + gramadoir | [] [] | + grep | [] [] [] | + gretl | [] [] [] () | + gsasl | [] [] | + gss | [] [] | + gst-plugins-bad | [] [] [] [] | + gst-plugins-base | [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] [] [] | + keytouch-editor | [] | + keytouch-keyboa... | [] [] | + latrine | [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | [] [] [] | + libidn | [] [] | + lifelines | () | + lilypond | [] [] [] | + lingoteach | [] [] [] | + lprng | | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | [] | + minicom | [] [] [] [] | + nano | [] [] [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] | + pilot-qof | | + popt | [] [] [] [] | + psmisc | [] [] | + pwdutils | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | [] | + skencil | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + tin | [] () | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + util-linux-ng | [] [] [] [] [] [] [] | + vorbis-tools | | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 85 22 14 2 48 101 61 12 2 8 2 6 53 29 1 52 + + ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn + +--------------------------------------------------+ + Compendium | [] | + a2ps | () [] [] | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | [] | + cpplib | [] | + cryptonit | [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + fetchmail | [] [] | + findutils | [] | + findutils_stable | [] | + flex | [] [] | + fslint | | + gas | | + gawk | [] [] | + gcal | | + gcc | | + gettext-examples | [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] [] | + gnubiff | | + gnucash | () () () | + gnuedu | | + gnulib | [] [] | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] [] | + gpe-conf | [] [] [] | + gpe-contacts | [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] | + gphoto2 | [] [] | + gprof | [] | + gpsdrive | [] | + gramadoir | () | + grep | [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins-bad | [] | + gst-plugins-base | [] | + gst-plugins-good | [] | + gst-plugins-ugly | [] | + gstreamer | [] | + gtick | [] | + gtkam | [] [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] | + indent | [] [] | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] [] [] | + jpilot | () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | [] | + libidn | [] [] | + lifelines | [] | + lilypond | [] | + lingoteach | [] | + lprng | | + lynx | [] [] | + m4 | [] [] | + mailfromd | | + mailutils | | + make | [] [] [] | + man-db | | + minicom | [] | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + popt | [] [] [] | + psmisc | [] [] [] | + pwdutils | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + shared-mime-info | [] [] [] [] [] [] [] | + sharutils | [] [] | + shishi | | + skencil | | + solfege | () () | + soundtracker | | + sp | () | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] | + tin | | + tuxpaint | () [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + util-linux-ng | [] [] | + vorbis-tools | | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn + 51 2 25 3 2 0 6 0 2 2 20 0 11 1 103 6 + + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +--------------------------------------------------+ + Compendium | [] [] [] [] [] | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] [] | + bash | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + dialog | [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] | + findutils_stable | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] [] | + gcal | [] | + gcc | [] [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () [] | + gnucash | () [] | + gnuedu | | + gnulib | [] [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] | + gramadoir | [] [] | + grep | [] [] [] [] | + gretl | [] [] [] | + gsasl | [] [] [] | + gss | [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] | + gst-plugins-ugly | [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] | + gtkam | [] [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + herrie | [] [] [] | + hylafax | | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] [] | + libgpg-error | [] [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lprng | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] [] [] | + make | [] [] [] [] | + man-db | [] [] [] [] | + minicom | [] [] [] [] [] | + nano | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | | + popt | [] [] [] [] | + psmisc | [] [] | + pwdutils | [] [] | + qof | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + skencil | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + tin | () | + tuxpaint | [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + util-linux-ng | [] [] [] [] | + vorbis-tools | [] | + wastesedge | | + wdiff | [] [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 5 77 31 53 4 58 72 3 45 46 9 45 122 3 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + Compendium | [] [] [] [] | 19 + a2ps | [] [] [] | 19 + aegis | [] | 1 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 16 + bash | [] | 6 + bfd | | 2 + bibshelf | [] | 7 + binutils | [] [] [] [] | 9 + bison | [] [] [] [] | 20 + bison-runtime | [] [] [] [] | 18 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 5 + clisp | | 9 + console-tools | [] [] | 5 + coreutils | [] [] [] | 18 + cpio | [] [] [] [] | 11 + cpplib | [] [] [] [] [] | 12 + cryptonit | [] | 6 + dialog | [] [] [] | 9 + diffutils | [] [] [] [] [] | 29 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + fetchmail | [] [] | 12 + findutils | [] [] [] | 11 + findutils_stable | [] [] [] [] | 18 + flex | [] [] | 15 + fslint | [] | 2 + gas | [] | 3 + gawk | [] [] [] | 16 + gcal | [] | 5 + gcc | [] [] [] | 7 + gettext-examples | [] [] [] [] [] [] | 29 + gettext-runtime | [] [] [] [] [] [] | 28 + gettext-tools | [] [] [] [] [] | 20 + gip | [] [] | 13 + gliv | [] [] | 11 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 16 + gnubiff | [] | 2 + gnucash | () [] | 5 + gnuedu | [] | 2 + gnulib | [] | 10 + gnunet | | 0 + gnunet-gtk | [] [] | 3 + gnutls | | 4 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] [] | 7 + gpe-clock | [] [] [] [] | 21 + gpe-conf | [] [] [] | 16 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] [] | 22 + gpe-filemanager | [] [] | 7 + gpe-go | [] [] [] [] | 19 + gpe-login | [] [] [] [] [] | 21 + gpe-ownerinfo | [] [] [] [] | 21 + gpe-package | [] | 6 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] [] | 21 + gpe-taskmanager | [] [] [] [] | 21 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 21 + gpe-todo | [] [] | 8 + gphoto2 | [] [] [] [] | 21 + gprof | [] [] | 13 + gpsdrive | [] | 5 + gramadoir | [] | 7 + grep | [] | 12 + gretl | | 6 + gsasl | [] [] [] | 9 + gss | [] | 7 + gst-plugins-bad | [] [] [] | 13 + gst-plugins-base | [] [] | 11 + gst-plugins-good | [] [] [] [] [] | 16 + gst-plugins-ugly | [] [] [] | 13 + gstreamer | [] [] [] | 18 + gtick | [] [] | 7 + gtkam | [] | 16 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 27 + gutenprint | | 4 + hello | [] [] [] [] [] | 38 + herrie | [] [] | 8 + hylafax | | 0 + idutils | [] [] | 15 + indent | [] [] [] [] [] | 28 + iso_15924 | [] [] | 4 + iso_3166 | [] [] [] [] [] [] [] [] [] | 54 + iso_3166_2 | [] [] | 4 + iso_4217 | [] [] [] [] [] | 24 + iso_639 | [] [] [] [] [] | 26 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] [] | 13 + keytouch | [] | 8 + keytouch-editor | [] | 5 + keytouch-keyboa... | [] | 5 + latrine | [] [] | 5 + ld | [] [] [] [] | 10 + leafpad | [] [] [] [] [] | 24 + libc | [] [] [] | 19 + libexif | [] | 5 + libextractor | [] | 5 + libgpewidget | [] [] [] | 20 + libgpg-error | [] | 6 + libgphoto2 | [] [] | 9 + libgphoto2_port | [] [] [] | 11 + libgsasl | [] | 8 + libiconv | [] [] | 11 + libidn | [] [] | 11 + lifelines | | 4 + lilypond | [] | 6 + lingoteach | [] | 6 + lprng | [] | 2 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailfromd | [] [] | 3 + mailutils | [] [] | 8 + make | [] [] [] | 20 + man-db | [] | 9 + minicom | [] | 14 + nano | [] [] [] | 20 + opcodes | [] [] | 10 + parted | [] [] [] | 11 + pilot-qof | [] | 1 + popt | [] [] [] [] | 18 + psmisc | [] [] | 10 + pwdutils | [] | 3 + qof | [] | 4 + radius | [] [] | 7 + recode | [] [] [] | 25 + rpm | [] [] [] [] | 13 + screem | [] | 2 + scrollkeeper | [] [] [] [] | 26 + sed | [] [] [] [] | 23 + shared-mime-info | [] [] [] | 29 + sharutils | [] [] [] | 23 + shishi | [] | 3 + skencil | [] | 7 + solfege | [] | 3 + soundtracker | [] [] | 9 + sp | [] | 3 + system-tools-ba... | [] [] [] [] [] [] [] | 38 + tar | [] [] [] | 17 + texinfo | [] [] [] | 15 + tin | | 1 + tuxpaint | [] [] [] | 19 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] [] | 20 + util-linux-ng | [] [] [] | 20 + vorbis-tools | [] [] | 4 + wastesedge | | 1 + wdiff | [] [] | 23 + wget | [] [] [] | 20 + xchat | [] [] [] [] | 29 + xkeyboard-config | [] [] [] | 14 + xpad | [] [] [] | 15 + +---------------------------------------------------+ + 76 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + 163 domains 0 3 1 74 51 0 143 21 1 57 7 45 0 2036 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If November 2007 seems to be old, you may fetch a more recent copy +of this `ABOUT-NLS' file on most GNU archive sites. The most +up-to-date matrix with full percentage details can be found at +`http://translationproject.org/extra/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`coordinator@translationproject.org' to make the `.pot' files available +to the translation teams. + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..1a61f8e --- /dev/null +++ b/COPYING @@ -0,0 +1,107 @@ +Most of Cogl is licensed under the terms of the MIT license. + +A few exceptions are: +- We have a copy of the GLU tesselator in cogl-path/tesselator which + is licensed under the SGI Free Software License B, version 2.0 + + This license is essentially identical to the MIT license with + the option to refer to a web address for a copy of the notice + in documentation. +- cogl-point-in-poly.c is under a 3 clause BSD license +- stb_image.c is public domain. + +Please see individual files for details. + +deps/glib is licensed under the LGPL (please see individual files for +details and deps/glib/COPYING for a copy of the LGPL license) This +code is only referenced when building Cogl with the --standalone +configure option. + +-- +The MIT License + +Copyright (C) 2007,2008 OpenedHand +Copyright (C) 2009-2014 Intel Corporation. +Copyright (C) 2010,2012 Red Hat, Inc. +Copyright (C) 1999-2005 Brian Paul All Rights Reserved. +Copyright (C) 2011,2012 Collabora Ltd. +Copyright (c) 2008-2011 Kristian Høgsberg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +-- +SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + +Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice including the dates of first publication and +either this permission notice or a reference to +http://oss.sgi.com/projects/FreeB/ +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Except as contained in this notice, the name of Silicon Graphics, Inc. +shall not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization from +Silicon Graphics, Inc. + + +-- +The BSD license used in cogl-point-in-poly.c: + +Copyright (c) 1970-2003 Wm. Randolph Frianklin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimers. +2. Redistributions in binary form must reproduce the above + copyright notice in the documentation and/or other materials + provided with the distribution. +3. The name of W. Randolph Franklin may not be used to endorse or + promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..146a958 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,20 @@ +Cogl does not distribute a static Changelog with releases because we feel that +the Git log does a better job of tracking all the detailed source code changes +that are made to Cogl. + +If you just want a high level overview of what has changed between Cogl +releases then please see the NEWS file that we distribute. + +You can clone Cogl via Git using: + +$ git clone git://git.gnome.org/cogl.git + +You can see the log using: + +$ git log + +Or you can look at the log for a particular release by specifying +a release tag name like: + +$ git log 1.7.2 + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..a0c0c76 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,48 @@ +SUBDIRS = deps test-fixtures + +SUBDIRS += cogl + +if BUILD_COGL_PATH +SUBDIRS += cogl-path +endif + +if BUILD_COGL_PANGO +SUBDIRS += cogl-pango +endif + +if BUILD_COGL_GLES2 +SUBDIRS += cogl-gles2 +endif + +if BUILD_COGL_GST +SUBDIRS += cogl-gst +endif + +SUBDIRS += tests examples doc po build + +ACLOCAL_AMFLAGS = -I build/autotools ${ACLOCAL_FLAGS} + +EXTRA_DIST = \ + README.in \ + config-custom.h \ + config.h.win32 \ + config.h.win32.in + +# .changelog expects these to be initializes +CLEANFILES= +DISTCLEANFILES= + +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-gtk-doc \ + --enable-maintainer-flags \ + --enable-profile \ + --enable-gles1 \ + --enable-gles2 \ + --enable-gl \ + --enable-xlib-egl-platform \ + --enable-wayland-egl-platform \ + --enable-glx \ + --enable-wayland-egl-server \ + --enable-cogl-gst + +include $(top_srcdir)/build/autotools/Makefile.am.release diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..37ed5fe --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1147 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# To make real stable releases or devel snapshots, use either: +# make release-check +# or make release-publish +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_COGL_PATH_TRUE@am__append_1 = cogl-path +@BUILD_COGL_PANGO_TRUE@am__append_2 = cogl-pango +@BUILD_COGL_GLES2_TRUE@am__append_3 = cogl-gles2 +@BUILD_COGL_GST_TRUE@am__append_4 = cogl-gst +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.release \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.h.in $(srcdir)/README.in \ + $(srcdir)/config.h.win32.in ABOUT-NLS COPYING ChangeLog NEWS \ + README $(top_srcdir)/build/compile \ + $(top_srcdir)/build/config.guess \ + $(top_srcdir)/build/config.rpath \ + $(top_srcdir)/build/config.sub $(top_srcdir)/build/install-sh \ + $(top_srcdir)/build/ltmain.sh $(top_srcdir)/build/missing +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = README config.h.win32 +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = deps test-fixtures cogl cogl-path cogl-pango cogl-gles2 \ + cogl-gst tests examples doc po build +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.xz +DIST_TARGETS = dist-xz +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = deps test-fixtures cogl $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) tests examples doc po build +ACLOCAL_AMFLAGS = -I build/autotools ${ACLOCAL_FLAGS} +EXTRA_DIST = \ + README.in \ + config-custom.h \ + config.h.win32 \ + config.h.win32.in + + +# .changelog expects these to be initializes +CLEANFILES = +DISTCLEANFILES = +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-gtk-doc \ + --enable-maintainer-flags \ + --enable-profile \ + --enable-gles1 \ + --enable-gles2 \ + --enable-gl \ + --enable-xlib-egl-platform \ + --enable-wayland-egl-platform \ + --enable-glx \ + --enable-wayland-egl-server \ + --enable-cogl-gst + +TAR_OPTIONS = --owner=0 --group=0 +RELEASE_URL_BASE = http://download.gnome.org/sources/cogl +RELEASE_URL = $(RELEASE_URL_BASE)/$(COGL_1_MAJOR_VERSION).$(COGL_1_MINOR_VERSION) +RELEASE_ANNOUNCE_LIST = cogl@lists.freedesktop.org +RELEASE_ANNOUNCE_CC = gnome-announce-list@gnome.org clutter-announce@clutter-project.org +tar_file = $(distdir).tar.xz +sha256_file = $(distdir).sha256sum +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.release $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.release: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +README: $(top_builddir)/config.status $(srcdir)/README.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +config.h.win32: $(top_builddir)/config.status $(srcdir)/config.h.win32.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + + +$(sha256_file): $(tar_file) + $(AM_V_GEN)sha256sum $^ > $@ + +release-tag: + @if test "x$(COGL_RELEASE_STATUS)" = "xgit"; then \ + echo "Cannot tag a Git version; please, update the Cogl version" >&2; \ + else \ + if test -d "$(top_srcdir)/.git"; then \ + echo "Tagging release $(COGL_1_VERSION)..." ; \ + $(top_srcdir)/build/missing --run git tag \ + -s \ + -m "Cogl $(COGL_1_VERSION) ($(COGL_RELEASE_STATUS))" \ + $(COGL_1_VERSION) ; \ + else \ + echo A git checkout is required to tag a release >&2; \ + fi \ + fi + +release-check: release-verify-even-micro release-verify-news + TAR_OPTIONS="$(TAR_OPTIONS)" $(MAKE) $(AM_MAKEFLAGS) distcheck + +release-verify-news: + @echo -n "Checking that the NEWS file has been updated..." + @if ! grep -q "$(COGL_1_VERSION)" $(top_srcdir)/NEWS; then \ + (echo "Ouch." && \ + echo "The version in the NEWS file does not match $(COGL_1_VERSION)." && \ + echo "This probably means you haven't updated the NEWS file." && \ + false); else :; fi + @echo "Good." + +release-verify-even-micro: + @echo -n "Checking that $(VERSION) has an even micro component..." + @test "$(COGL_1_MICRO_VERSION)" = "`echo $(COGL_1_MICRO_VERSION)/2*2 | bc`" || \ + (echo "Ouch." && \ + echo "The version micro component '$(COGL_1_MICRO_VERSION)' is not an even number." && \ + echo "The version in configure.ac must be incremented before a new release." && \ + false) + @echo "Good." + +release-upload: $(sha256_file) + @echo "Uploading to master.gnome.org..." + @scp $(tar_file) master.gnome.org: + @echo "Running ftpadmin install..." + @ssh master.gnome.org ftpadmin install $(tar_file) + @mv -f $(sha256_file) $(top_builddir)/build/$(sha256_file) + @echo "Done." + +release-message: + @echo " Release URL: $(RELEASE_URL)/$(tar_file)" + @echo "Release checksum: $(RELEASE_URL)/$(sha256_file)" + @echo "Send an email to: $(RELEASE_ANNOUNCE_LIST)" + @echo " Cc: $(RELEASE_ANNOUNCE_CC)" + @echo " Subject: Release Cogl $(COGL_1_VERSION) ($(COGL_RELEASE_STATUS))" + @echo " Contents:" + @csplit -q --prefix=.README-section- $(top_builddir)/README '/^--$$/' '{*}' + @csplit -q --prefix=.NEWS-section- NEWS '/^Cogl/' '{*}' + @echo "--- CUT HERE ---" + @echo "Good news, everyone!" + @echo "" + @echo "A new Cogl $(COGL_RELEASE_STATUS) ($(COGL_1_VERSION)) is now available:" + @echo "" + @echo "LATEST NEWS" + @echo "-------------------------------------------------------------------------------" + @echo "" + @cat .NEWS-section-01 + @echo "FETCHING THE RELEASE" + @echo "-------------------------------------------------------------------------------" + @echo "" + @echo "Tarballs can be downloaded from:" + @echo "" + @echo " http://download.gnome.org/sources/cogl/1.$(COGL_1_MINOR_VERSION)/" + @echo "" + @echo "SHA256 Checksum:" + @echo "" + @cat $(top_builddir)/build/$(sha256_file) + @echo "" + @echo "Additionally, a git clone of the source tree:" + @echo " git clone git://git.gnome.org/cogl" + @echo "" + @echo "will include a signed $(COGL_1_VERSION) tag which points to a commit named:" + @echo " `git cat-file tag $(COGL_1_VERSION) | $(GREP) ^object | $(SED) -e 's,object ,,'`" + @echo "" + @echo "which can be verified with:" + @echo " git verify-tag $(COGL_1_VERSION)" + @echo "" + @echo "and can be checked out with a command such as:" + @echo " git checkout -b build $(COGL_1_VERSION)" + @echo "" + @tail -n +2 .README-section-01 + @echo "" + @tail -n +2 .README-section-02 + @echo "" + @echo "" + @echo "DOCUMENTATION" + @echo "-------------------------------------------------------------------------------" + @echo "" + @echo "The 1.x stable API is documented here:" + @echo " http://developer.gnome.org/cogl/stable/" + @echo "The 1.x development API is documented here:" + @echo " http://developer.gnome.org/cogl/1.$(COGL_1_MINOR_VERSION)" + @echo "The experimental 2.0 API is documented here:" + @echo " http://cogl3d.org/cogl2-reference/" + @echo "" + @echo "" + @echo "RELEASE NOTES" + @echo "-------------------------------------------------------------------------------" + @if test "x$(COGL_RELEASE_STATUS)" = "xsnapshot"; then \ + echo " - This is a development snapshot release so there are not API or ABI stability"; \ + echo " guarantees at this point for new APIs since the last stable release."; \ + echo ""; \ + fi + @echo " - This Cogl release exports a 1.x API (For third-party Clutter" + @echo " developers to write custom actors) and an experimental 2.0 API which" + @echo " allows standalone application development." + @echo "" + @echo " - Internally Clutter depends on the Cogl 2.0 experimental API so we maintain" + @echo " runtime compatibility between the 1.x API and experimental 2.0 APIs, which" + @echo " means developers can mix-and-match their use of the APIs in the same" + @echo " process. API selection is done per-file by including a line like: '#define" + @echo " COGL_ENABLE_EXPERIMENTAL_2_0_API' before including cogl.h or clutter.h." + @echo "" + @echo " - We recommend using the 2.0 API if you don't mind updating your code once in" + @echo " a while as this API evolves and stabilizes. We promise not to break the 2.0" + @echo " API during a 1.x stable cycle and hope that will encourage people to" + @echo " experiment with it and give critical feedback! For example after releasing" + @echo " 1.8, the 2.0 API will be stable for 1.8.1, 1.8.2, 1.8.3 etc, but may update" + @echo " for 1.9/1.10." + @echo "" + @echo " - Because we export the 1.x and 2.0 APIs from one libcogl.so the library" + @echo " versioning, and thus ABI, can only be considered as stable as our 2.0 API - " + @echo " i.e. during a stable release 1.x cycle." + @echo "" + @echo " - Please report bugs using the Cogl Bugzilla product, at:" + @echo " http://bugzilla.gnome.org/enter_bug.cgi?product=cogl" + @echo "--- CUT HERE ---" + +release-publish: release-check + $(MAKE) $(AM_MAKEFLAGS) release-tag + $(MAKE) $(AM_MAKEFLAGS) release-upload + $(MAKE) $(AM_MAKEFLAGS) release-message + +.PHONY: \ + release-check \ + release-message \ + release-publish \ + release-tag \ + release-upload \ + release-verify-even-micro + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0be6580 --- /dev/null +++ b/NEWS @@ -0,0 +1,1395 @@ +Cogl 1.18.2 2014-06-03 + + • List of changes since Cogl 1.18.0 + + » MSVC updates + » KMS improvements for use by GNOME Shell + » EGL backend improvement to avoid creating a dummy surface if + driver supports EGL_KHR_surfacless_context extension + » cogl-x11-tfp example fixes + + • Gnome Bugzilla bugs closed since 1.18.0: + + #728064 - New AtlasTextures should keep designated atlas alive + #728628 - Fails to link from C++ applications due to excessive + symbol mangling + #728978 - Don't set EGL_PLATFORM + #728979 - Call swap notify handler even when pageflip ioctl fails + #730536 - Add apis needed for mutters compositor bypass + +Many thanks to: + + Chun-wei Fan + Neil Roberts + Adel Gadllah + Kristian Høgsberg + Emanuele Aina + Felix Riemann + +Cogl 1.18.0 2014-03-21 + + • List of changes since Cogl 1.17.4 + + » The license has been changed to the MIT license. This is more + permissive than the previous LGPLv2 license and is still + compatible with the GPL and LGPL. For more background on why we + decided to make this change please see the following post on the + mailing list: + http://lists.freedesktop.org/archives/cogl/2013-December/001465.html + » GObject introspection support has been greatly improved. + » Add cogl_kms_renderer_set_kms_fd to make the KMS backend use a + non-default GPU. + » Fix a hang in the Wayland backend if it can't find some globals + that it needs. + » Add cogl_gst_video_sink_get_natural_size to query a suggested size + for a Cogl-GST sink + » Add API to query the EGL and GLX contexts. This is intended to be + used to make a shared GL context. + » Fix advertising the deprecated buffer age feature flag on EGL. + » Add a new non-deprecated feature flag for the buffer age. + » Fix a bug with allocating textures in Cogl-GST. + » Fix a bug with the cogl-basic-video-player example where it would + try to use non-existant mipmaps. + » Fix selecting the GL driver in the SDL2 winsys. + » Updates to the MSVC build files. + + • Gnome Bugzilla bugs closed since 1.17.4: + + #724992 - get the opengl context from cogl + +Many thanks to: + + Chun-wei Fan + Robert Bragg + Lionel Landwerlin + Jasper St. Pierre + Wylmer Wang + +Cogl 1.17.4 2014-02-20 + + • List of changes since Cogl 1.17.2 + + » cogl-gst now ensures that sampled video fragments are always + pre-multiplied with the alpha component. + » cogl-gst now has NV12 format support. + » The cogl-basic-video-player example can now be passed an + custom gstreamer pipeline description, as long as it contains + a coglsink element. + » The -experimental-2.0 pkg-config files now all depend on + cogl-2.0-experimental instead of cogl-1.0. + + • Gnome Bugzilla bugs closed since 1.17.2: + + #712832 - video-sink: Add NV12 shader support + #719741 - GLX winsys: fix feature handling for INTEL_swap_event + #722765 - Fix the exported symbols regular expression in cogl-path + #723530 - cogl-pipeline: SEGV in _cogl_pipeline_fragend_glsl_end + +Many thanks to: + + Neil Roberts + Lionel Landwerlin + Andreas Oberritter + Daniel Korostil + Emmanuele Bassi + Kjartan Maraas + Owen W. Taylor + +Cogl 1.17.2 2014-01-20 + + • List of changes since Cogl 1.16.0 + + » Textures are now allocated lazily. This means the textures can + optionally be configured with extra API before data is uploaded to + them. + » The internal format for textures has been replaced with a simpler + property to just set the number of components that will be + required when sampling. + » Depth writing can now be disabled per-framebuffer as well as on + the CoglPipeline. + » The interface typedefs such as CoglTexture, CoglFramebuffer and + CoglBitmap etc are now defined as void so that it is no longer + necessary to use type-cast macros when passing them to interface + methods. + » YV12/I420 support in cogl-gst is fixed. + » Added support for red-green 2-component textures. + » The cache of GLSL shaders is now garbage collected when it gets + too large. + » cogl_framebuffer_push_path_clip is fixed. + » cogl-path is now split out into a separate library. + » New function cogl_wayland_texture_set_region_from_shm_buffer to + update a texture from a Wayland SHM bufffer. + » The pkg-config files for cogl-gst and cogl-gles2 have new more + consistent names. + + • Gnome Bugzilla bugs closed since 1.16.0: + + #706808 - "Unable to locate required kms libraries" message is really + uninformative + #709827 - Add API to control per-FB depth writing + #710135 - Fix build on big endian + #710926 - Build fails without declaration of wl_resource + #712562 - Fixes for the journal + #712830 - Add COGL_PIXEL_FORMAT_U_V + #719546 - cogl-framebuffer: Fix a potential NULL pointer dereference + #719582 - cogl-framebuffer: Don't mark the clear clip dirty from the + journal + #720287 - cogl-path: Export cogl_clip_push_from_path + #721450 - Re-enable swap_region for mesa 10.1+ llvmpipe / swrast + +Many thanks to: + + Robert Bragg + Jasper St. Pierre + Adel Gadllah + Lionel Landwerlin + Chun-wei Fan + Colin Walters + Emilio Pozuelo Monfort + Hans Petter Jansson + +Cogl 1.16.0 2013-09-23 + + • List of changes since Cogl 1.15.10 + + » MSVC build updates + » Correctly mark CoglAtlasTexture api as public + » Lots of gtk-doc/introspection annotation fixes + + • Gnome Bugzilla bugs closed since 1.15.10: + + #704750 - egl: don't bind the wayland display if the extension is + not available + +Many thanks to: + + Lionel Landwerlin + Robert Bragg + Chun-wei Fan + Giovanni Campagna + Neil Roberts + +Cogl 1.15.10 2013-09-02 + + • List of changes since Cogl 1.15.8 + + » Added API to set the onscreen template on a CoglDisplay outside of + the constructor. + » Added public API to configure the layout of displays when using + the KMS winsys. + » Added a cogl_point_coord builtin variable for snippets which can + be used to render point sprites in more dynamic ways. + » cogl_texture_new_with_size now returns NULL on failure. This + behaviour was accidentally changed in 1.14.0. + » Fixed a problem with setting the precision specifiers on GLES2 + which was causing a lot of problems with the latest Mesa. + » Added a “webgl” driver to manage the differences in GLES2 when + compiling with emscripten. + » Fixed a bug with paths which was causing Clutter's texture-fbo + test to crash. + » Some issues with introspecting the cogl-pango API were fixed. + » Added an example using point sprites. + » Build fixes for building with MinGW32. + » Updates to the MSVC build files. + » Documentation fixes to the snippets API. + + • Gnome Bugzilla bugs closed since 1.15.8: + + #705837 - kms: add public API to override the default configuration + of outputs + +Many thanks to: + + Chun-wei Fan + Robert Bragg + Jasper St. Pierre + Damien Lespiau + Giovanni Campagna + +Cogl 1.15.8 2013-08-20 + + • List of changes since Cogl 1.15.6 + + Brown bag release to fix a problem with including cogl-path.h from + cogl.h that meant only code defining + COGL_ENABLE_EXPERIMENTAL_2_0_API would get access to the CoglPath + API. + + We now ignore whether COGL_ENABLE_EXPERIMENTAL_2_0_API is defined so + clutter which does define it will see the api and so will clutter + users that don't define it. + +Cogl 1.15.6 2013-08-19 + + • List of changes since Cogl 1.15.4 + + » Fixed runtime selection of egl-kms backend + » Split out the CoglPath api in-line with cogl master to reduce + divergence, but updated to not break the 1.x API/ABI + » Reverted the semantic change to cogl_offscreen_new_to_texture to + make it synchronously allocate as it did in cogl-1.14. A + replacement cogl_offscreen_new_with_texture api has been + introduced to support the asynchronous allocation behaviour + required to allow configuration of a framebuffer before + allocation. + » Fixed a problem with binding attribute locations with desktop GL + drivers, required to work with the latest Mesa. + » Some configure.ac documentation fixes + » In cogl-gst we make sure to only emit the "pipeline-ready" signal + once the new textures have actually been uploaded. + » Various MSVC build fixes + + Note: we took some care to try and avoid breaking the ABI and + chaning the soname relative to the last 1.15.4 snapshot. + + • Gnome Bugzilla bugs closed since 1.15.4: + + #703500 - 49 Conform Tests Regressed (FAIL) + #703174 - Crash when switching user with gnome 3.8 using nvidia drivers + #705836 - egl-kms: set the EGL_PLATFORM explicitly + #705591 - SIGSEGV in various conformance tests on wayland + +Many thanks to: + + Chun-wei Fan + Neil Roberts + Robert Bragg + Adel Gadllah + Fan Chun-wei + Giovanni Campagna + Lionel Landwerlin + +Cogl 1.15.4 2013-07-30 + + • List of changes since Cogl 1.15.2 + + » Added experimental API to directly expose atlas textures. + » Added new_from_file/data/bitmap APIs for sliced textures. + » Added new_from_file APIs for 2D textures. + » Added cogl_primitive_draw as a new name for the + cogl_framebuffer_draw_primitive function. + » Removed the attribute drawing APIs. Instead applications should + create a primitive and draw that. + » Fixed bug where Cogl would busy-wait with 100% CPU if the Wayland + compositor is closed. + » The COGL_FRAME_EVENT_SYNC events are now sent based on the frame + callback with the Wayland backend. + » New cogl_gst_video_sink_is_ready() function to determine whether a + Cogl-GST video sink is ready to have the pipeline queried. + » Fixed a potential bug with the blending enabled state when copying + a pipeline. + » Fixed detecting the Mesa vendor when GL 3 is used. + » Fixed a reference leak on the CoglRenderer. + » Fixes to the Visual Studio build files. + +Many thanks to: + + Robert Bragg + Chun-wei Fan + Damien Lespiau + +Cogl 1.15.2 2013-07-09 + + • List of changes since Cogl 1.14.0 + + » Lots of Wayland backend work, including updated compositor support + » Updated cogland, a simple example wayland compositor using Cogl + » Made the onscreen resize callback work the same as the frame callback + » New cogl_onscreen_swap_buffers_with_damage api + » New fence API + » New Emscripten support (only basic at the moment) + » Improved blend state tracking + » New cogl_onscreen_add_dirty_callback() api for window systems + that need to notify application of dirty/damaged regions that must + be redrawn by the application + » Started adding internal unit tests to complement the conformance + tests + » New support for per-vertex point sizes + » New cogl-gst sub-library added enabling gstreamer integration into + Cogl based applications. Notably the design is compatible with + applications adding custom shader snippets to a CoglPipeline that + handles video sampling so application will be able to chain + together shader based affects without requiring intermediate + renderers. + » Adds HSL color conversion apis + » The Conformance test suite can now be installed with a .test file + enabling them to be run by the gnome-desktop-testing-runner for example. + + • Bugzilla bugs closed since 1.14.0: + + #691752 - add fence/sync API + #696730 - Compile failure with 1.14.0 due to extra arg in bitmap functions + #697330 - Fails to build with the gold linker due to missing reference to libm + #699431 - [PATCH] xlib: Don't crash just because the display doesn't expose RANDR + #700088 - compile failure: 'wayland_surface' has incomplete type + #702570 - cogl 1.16: Regression with event propagation in champlain + #702942 - Install conformance tests + #702999 - undefined reference to `wl_buffer_is_shm' + #703553 - Add support for automake 1.14 + +Many thanks to: + + Neil Roberts + Robert Bragg + Andreas Oberritter + Chris Cummins + Damien Lespiau + Emanuele Aina + Plamena Manolova + Roy.Li + Adam Jackson + Daniel Stone + Inaki Larranaga Murgoitio + Lionel Landwerlin + Matthias Clasen + Milo Casagrande + Rico Tzschichholz + Yosef Or Boczko + +Cogl 1.14.0 2013-03-25 + + • List of changes since Cogl 1.13.4 + + » New snippet hook location for adding global definitions that can + be shared amongst other snippets. + » Fixed some cases where it's not possible to reference the builtin + cogl_sampler* uniforms from a snippet. + » Fixes for building on Visual Studio. + » Fixed a problem with the workaround for the viewport bug in Mesa + which could leave a broken scissor when switching between + different sized framebuffers. + » Fix some cases where the depth buffer wouldn't get cleared in + cogl_framebuffer_clear*. + » Fix for leaking pipelines and textures when a pipeline is copied + but all of its layer properties are replaced. + » Fix for interleaving snippets with different hook points. + » The Cogland example Wayland compositor has been updated to the + Wayland 1.0 API. + + • Bugzilla bugs closed since 1.13.4: + + #686770 - _cogl_bitmap_unbind: assertion failed: (bitmap->bound) + for gnome-shell on nexus 7 + #694537 - Fails to compile if the EGL stack doesn't implement + KHR_create_context + #694657 - cogl-buffer: Stop warning spam running in sw rendering + +Many thanks to: + + Chun-wei Fan + Robert Bragg + Gheyret Kenji + Ján Kyselica + Bastien Nocera + Duarte Loreto + Milo Casagrande + Pavol Klačanský + Plamena Manolova + Tomeu Vizoso + +Cogl 1.13.4 2013-02-21 + + • List of changes since Cogl 1.13.2 + + » New CoglOutput API to query information about displays. + » New API for querying frame timing information in a frame callback. + » New API for querying the buffer age of an onscreen framebuffer. + » Fixed building the GLES2 driver without the GL driver. + » Fixed X errors when Cogl is used after an onscreen is destroyed. + » Fixed API used by Clutter-GST to query the number of texture units. + » Fixed the soname for the libcogl-pango2 library + » Fixed building with MinGW32 + + • Bugzilla bugs closed since 1.13.2: + + #669122 - Clipped redraws and tearing + #692420 - Build fails on Mac OS Mountain Lion: + error: 'GL_NUM_EXTENSIONS' undeclared + #693360 - cogl-pango: Fix some doc/introspection comments + #693612 - cogl-pango: wrong rendering on the second line of an + underlined layout + #693696 - Fix startup with gnome-shell and cogl-1.14 + #693894 - COGL_TEST_ONSCREEN=0 results in onscreen conformance testing + #694164 - Don't use GL_MAP_INVALIDATE_RANGE_BIT on READ_BIT buffers + +Many thanks to: + + Robert Bragg + Owen W. Taylor + Jasper St. Pierre + Piotr Drąg + Adam Jackson + Adel Gadllah + Daniel Martinez + Gheyret Kenji + Jerome Glisse + +Cogl 1.13.2 2013-01-21 + + • List of changes since Cogl 1.12.2 + + » Adds support for texture based depth buffers + » Lots of internal re-working to enable non-GL based drivers + » Added a stub, NOP driver that can be useful for profiling + » cogl_texture_rectangle_new_from_foreign() make public + » cogl_debug_matrix_print() debug api added + » Added support for building Cogl without a Glib dependency + (we'd like to support Cogl with emscripten/NaCl with minimal + dependencies) + » Unified a lot of gles 2.0 and gl driver support + » Added OpenGL 3.1 core profile support + » Lots of gtk-doc annotation fixes + » cogl_buffer_map_range() api added + » Improved SDL 2 support + » Added cogl_sdl_onscreen_get_window() api + » Much improved out-of-memory error reporting + » Added support for constant attributes + » Lots of internal work to avoid referencing a global context + » Added a new CoglMatrixStack api + » Enabled lazy texture storage allocation + » Added cogl_texture_allocate() for optional explicit allocation + » Add cogl_texture_set_data() convenience api + » Various fixes for handling sliced texture + » Added cogl_framebuffer_get_depth_bits() api + + • Bugzilla bugs closed since Cogl 1.12.2 + + #685915 - Screenshot API is broken on big-endian + #690891 - Support Automake 1.13 + #691945 - _cogl_unpack_uint{8,16}_t + +Many thanks to: + + Damien Lespiau + Robert Bragg + Neil Roberts + Adel Gadllah + Rico Tzschichholz + +Cogl 1.12.2 2013-01-04 + + • List of changes since Cogl 1.12.0 + + » Lots of MSVC build updates + » Fix GL_ARB_shader_objects terminator mitigating potential crash + » Fix to only allow CoglGLES2 context creation with GLES2 driver + » Use right context when pushing a CoglGLES2 context to an onscreen + » Port to new Wayland 1.0 protocol + » Don't set SDL_GL_DOUBLEBUFFER when the swap chain has no pref + + • Bugzilla bugs closed since Cogl 1.12.0 + + #682071 - MSVC: Link to SDL when apps are built + #684917 - winsys-glx: Don'T attempt to query the vblank counter when + using indirect rendering + #689850 - [PATCH] Fix call to BlendFuncSeparate + +Many thanks to: + + Chun-wei Fan + Neil Roberts + Robert Bragg + Andika Triwidada + Adam Jackson + Alexander Shopov + Aurimas Černius + Ihar Hrachyshka + Marek Černocký + Milo Casagrande + Rafael Ferreira + Rob Bradford + RÅ«dolfs Mazurs + Tom Tryfonidis + Unticha Pramgoed + Мирослав Николић + +Cogl 1.12.0 2012-09-24 + + • List of changes since Cogl 1.11.4 + + » MSVC build updates to fix building with SDL support + » Lots of translation updates + + • List of bugs fixed since Cogl 1.11.6 + + #682071 - Fix Visual C++ build when using the SDL winsys + +Many thanks to: + + Dr.T.Vasudevan + Alexander Shopov + Ani Peter + Ask H. Larsen + Carles Ferrando + Chun-wei Fan + Gil Forcada + Mario Blättermann + Nishio Futoshi + Rajesh Ranjan + Robert Bragg + YunQiang Su + Yuri Myasoedov + +Cogl 1.11.6 2012-09-17 + + • List of changes since Cogl 1.11.4 + + » Support latest libgbm api + » Improve error handling for cogl_texture_2d_new_from_foreign + » Avoid referencing contexts internally so Android + applications can reliably destroy the resources of a context without + us needing to introduce api to break internal circular references. + » More work to reduce our dependence on a global context internally. + » Recognize the latest Mesa GL vendor strings and the "Software + Rasterizer" renderer string. + » Improved cogl-gles2 support by not depending on drivers allowing + multiple vertex shaders in one program which isn't actually meant + to be supported in GLES 2.0 anyway. (We were lucky before because + Mesa happened to allow this but it doesn't work with other vendor + drivers.) + + • List of bugs fixed since Cogl 1.11.4 + + #683414 - memory corruption when freeing layer cache + #683818 - Need to pick up new Mesa strings + #683083 - Fix textures[] index + +Many thanks to: + + Robert Bragg + Neil Roberts + Alban Browaeys + Alexander Larsson + Bruce Cowan + Daniel Stone + Gabor Kelemen + Ihar Hrachyshka + Marek Černocký + Piotr Drąg + +Cogl 1.11.4 2012-09-03 + + • List of changes since Cogl 1.11.2 + + » Fix the pkg-config requires for cogl-gles2 + » Fix where we install cogl-gles2 headers + » Updates for the MSVC build + » Fix texture sub-region uploads when we don't have + GL_EXT_unpack_subimage + » Update the KMS winsys backend to the latest libgbm api + » Fix a leak of primitive indices + » Added a UProf profiling timer around journal discard code + » Enabled UProf profiling support to test-journal + + • List of bugs fixed since Cogl 1.11.2 + + #682340 - Trivial build fix + +Many thanks to: + + Robert Bragg + Chun-wei Fan + Piotr Drąg + Tomeu Vizoso + A S Alam + Andika Triwidada + Aurimas Černius + Duarte Loreto + Fran Diéguez + Krishnababu Krothapalli + Neil Roberts + Nilamdyuti Goswami + Patrick Welche + Sjoerd Simons + Tom Tryfonidis + +Cogl 1.11.2 2012-08-14 + + • List of changes since Cogl 1.10.0 + + » Adds cogl_framebuffer_{fill,stroke}_path APIs consistent with + other Cogl drawing APIs that replace cogl_path_fill/stroke(). + » Switch from using glib types such as guint32/guint16/guint8 to + using equivalent stdint.h types. + » Adds a micro-benchmark for the journal + » Optimized the matrix stack so we can take immutable references + of a matrix stack for logging into the journal more efficiently + than having to copy large matrices for each journaled rectangle. + » Added COGL_VERSION_{MAJOR,MINOR,MICRO} macros and + COGL_VERSION_CHECK macros for applications to test what version + of Cogl they are compiled against. + » Allow creation of non power of two (npot) CoglTexture2D textures + with only basic npot support, not including repeating or mipmap + support. + » Enable use of the GL_STREAM_DRAW buffer update hint on GLES 2.0 + » Fix building Cogl with --disable-gl + » Added support for the WebOS version of SDL which supports access + to GLES 1.1 and GLES 2.0 + » Adds cogl_matrix_init_translation to provide a more efficient + way to initialize a matrix representing a translation without + need to multiply matrices. + » Various documentation fixes for CoglQuaternion and CoglEular + » Updates for the MSVC build + » Added GPU architecture detection capabilities so we can + differentiate drivers based on the hardware vendor, and the + actual architecture of the GPU, such as deferred vs immediate + mode. + » Fix framebuffer initialization to ensure swaps are throttled by + default. + » Fix flushing of the depth state for some cases. + » Ported test-atlas-migration to be a standalone Cogl test + » Added GLES 2.0 API integration support so that existing GLES 2.0 + based code can easily be integrated within Cogl based + applications. For example this is being used by webkit-clutter to + add WebGL support. + » Added an optional libcogl-gles2 sub-library that provides a full + GLES 2.0 api api to really lower the barrier as much as possible + for being able to integrate existing GLES 2.0 based code into + Cogl applications. + » Adds a Cogl GLES 2.0 Gears example application to test the GLES + 2.0 integration support. + » Fix a bug with disabling of Cogl's debugging features. + » Added api to directly convert a Eular to a Quaternion. + » Improve the wireframe debug option to work when a vertex shader + is in use. + » Added support for SDL2 which supports GLES 2.0 + » Support the original GLSL extensions which had some different + function names. + » Avoid using eglGetProcAddress for core symbols which isn't allowed + by the EGL spec and causes problems on Android. + » Adds cogl_android_bitmap_new_from_asset() API to load images from + Android assets. + » Adds support for resizable onscreen framebuffers. + » Avoids implicitly including the EGL headers when including cogl.h + » Adds cogl.conf and environment variables to allow disabling the + use of specific GL extensions; for example if the implementation + is known to be buggy on a given system. + + • List of bugs fixed since Cogl 1.10.0 + + #660617 - Porting of clutter tests + #672533 - Quartz image option causes compile error + #673137 - Grab the current window -> Screenshot is mirrored + #674208 - [PATCH] disable sub-buffer copies on software Mesa + #675119 - unable to build the latest version due to two bugs + #677078 - GLSL detection not working for Intel GMA3150 chipset + #678316 - remove unneeded check for libdrm + #680124 - Quartz Image option , memory not zeroed before loading? + #681285 - Support building with automake 1.12.x + +Many thanks to: + + Neil Roberts + Robert Bragg + Damien Lespiau + Chun-wei Fan + Tomeu Vizoso + Carles Ferrando + Chao-Hsiung Liao + Bruno Brouard + Christian Kirbach + Daniel Mustieles + Fran Diéguez + Gil Forcada + Marek Černocký + Matej Urbančič + Yaron Shahrabani + Мирослав Николић + Adel Gadllah + Alexander Shopov + Andika Triwidada + Antoine Jacoutot + Daniel Nylander + Gabor Kelemen + Hajime Taira + Ihar Hrachyshka + Jordi Serratosa + Kjartan Maraas + Krishnababu Krothapalli + Kristjan SCHMIDT + Luca Bruno + Mario Blättermann + Nilamdyuti Goswami + Rajesh Ranjan + Rico Tzschichholz + RÅ«dolfs Mazurs + Sasi Bhushan Boddepalli + Sjoerd Simons + Stef Walter + Tobias Endrigkeit + Yinghua Wang + fenghelong + Κωνσταντίνος Χόρτης + +Cogl 1.10.0 2012-03-20 + + • List of changes since Cogl 1.9.8 + + » Add cogl_framebuffer_draw_[*_]rectangle functions. These can be + used as a replacement for cogl_rectangle in the 2.0 API to avoid + the global framebuffer stack. + » Fixed flushing the point size with the GL driver when using GLSL. + » Added the missing cogl_is_onscreen and cogl_is_framebuffer functions. + » Added cogl_quaternion_init_from_quaternion and + cogl_quaternion_init_from_matrix to the public headers. + » Make cogl_has_feature available when only + COGL_ENABLE_EXPERIMENTAL_API is defined. + » Add cogl_framebuffer_read_pixels. This is a convenience wrapper + around cogl_framebuffer_read_pixels_into_bitmap to read directly + into an application's buffer. + » Added a public cogl_bitmap_new_for_data function. This can be used + for example to call cogl_framebuffer_read_pixels_into_bitmap to + read directly into an application's buffer with an unusual + rowstride. + » Visual Studio build fixes + » Translation updates + + • List of bugs fixed since Cogl 1.9.8 + + https://bugzilla.gnome.org: + + #669122 - Clipped redraws and tearing + #671984 - cogl glyph cache uses uninitialised variable. + #671985 - cogl matrix stack has a use after realloc + #672038 - Move the fallback define for GL_PACK_INVERT_MESA + #672174 - cogl_path_curve_to second parameter ignored + #672243 - Drive by leak fix when code spelunking + +Many thanks to: + + Chun-wei Fan + Robert Bragg + Dave Airlie + Matej Urbančič + Adam MatouÅ¡ek + Adel Gadllah + Alexander Shopov + Bruce Cowan + Daniel Nylander + Dénes Almási + Duarte Loreto + Enrico Nicoletto + Fran Diéguez + Khoem Sokhem + Nilamdyuti Goswami + Piotr Drąg + Ray Strode + Ryan Lortie + Yuri Myasoedov + 甘霖 + +Cogl 1.9.8 2012-03-05 + + • List of changes since Cogl 1.9.6 + + » Various Visual Studio build fixes + » Correctly check for GL_EXT_packed_depth_stencil and support using + GL_OES_packed_depth_stencil on GLES2 + » Correctly handle pre-multiplied alpha conversions when reading + back texture data. + » Added cogl_renderer_{get,set}_driver functions so the underlying + driver can be chosen programmatically. + » Revamped the conformance testing framework so that it + automatically runs every test against GLES2 as well as GL and also + against all of the pipeline backends and with npot textures + disabled. + » Add a conformance test for reading back an RGBA texture as + alpha-only + » Added support for converting between all of Cogl's supported pixel + formats including pre-multiplied alpha conversions. + » Added conformance tests for converting to and from all of the + supported formats. + » Added a public cogl_framebuffer_read_pixels_into_bitmap() + function which will effective read into a CoglPixelBuffer. + » CoglPixelBuffer was changed to no longer have associated width, + height and format information and instead we will rely on + CoglBitmap to track that informations. The relationship is + analogous how CoglAttributes relate to CoglAttributeBuffers + and means for example that a CoglPixelBuffer could now be used + to hold multiple images. + » Added public cogl_bitmap_get_{width,height,format,rowstride} api + » Added a public accessor for the underlying pixel buffer of a + CoglBitmap. + » Added various missing cast macros for some buffer objects. + » Ported the Clutter based test-pixel-buffer test to be standalone. + + • List of bugs fixed since Cogl 1.9.6 + + https://bugzilla.gnome.org: + + #666184 - framebuffer: Enable a single depth and stencil buffer for GLES + #670793 - Don't use cogl_get_draw_framebuffer when flushing pipeline state + #671016 - INVALID_ENUM errors in gnome-shell + +Many thanks to: + + Neil Roberts + Chun-wei Fan + Daniel Korostil + Martin Srebotnjak + Matej Urbančič + Matic GradiÅ¡er + Мирослав Николић + +Cogl 1.9.6 2012-02-21 + + • List of changes since Cogl 1.9.4 + + » New conformance tests or tests ported from Clutter: + test-offscreen + test-primitive + test-texture-3d + » New public experimental functions: + cogl_pipeline_get_layer_texture + cogl_primitive_copy + cogl_primitive_foreach_attribute + cogl_primitive_get_indices + cogl_pipeline_get_layer_{min,max}_filter + » Added cogl_kms_renderer_get_kms_fd to get the KMS file descriptor. + » Bug fixed in the KMS support where it would crash on cleanup if it + couldn't save the CRTC state. + » Bug fixed in the Wayland compositor support where it would leak + EGLImages when creating a texture from a buffer + » The swap_buffer callback in GLX is now delayed until + cogl_poll_dispatch is called so that apps can handle it more + predictably. + » Fixes for bugs with pipelines that are trying to use a layer with + a NULL texture. + » New cogl_framebuffer_* API for drawing directly to the framebuffer + without having to push the framebuffer. Ideally we want to move + towards this style of API in future with no global stacks. + » Most of the _EXP suffixes have been removed from the experimental + API symbols in the hope that the gtk-doc unstable annotation will + be enough to distinguish these. + » Add a COGL_DEBUG=winsys option + » CoglBuffer and CoglPrimitive now take an explicit CoglContext + argument in their constructor. We want to move towards getting rid + of the global context. + » Updates to the MSVC build support. + » Add cogl_pipeline_set_layer_null_texture(). This can be used for + base pipelines instead of having to create a dummy texture. + » Fix some bugs where Cogl was assuming there is a direct mapping + between the pipeline layer number and the GL texture unit number. + » In snippets, there are now always builtin sampler uniforms for + every layer of the pipeline. This makes it easier to write GLSL + that samples arbitrary units. + » The texture lookup snippet hook now gets passed the sampler for + the unit. The snippet can use this to sample the texture multiple + times. + » Some public constants for CoglPixelFormat have been removed + (COGL_UNPREMULT_MASK, COGL_UNORDERED_MASK and + COGL_PIXEL_FORMAT_{24,32}). + » 30-bit pixel formats added. + » COGL_DEBUG=wireframes now correctly renders primitives using + vertex shader snippets. + » cogl_framebuffer_swap_buffers and friends have been renamed to + cogl_onscreen_swap_buffers. + » If the experimental 2.0 API is requested, as far as possible the + headers for the 1.0 API are no longer included. Define + COGL_ENABLE_EXPERIMENTAL_API instead if you want to mix both APIs. + + • List of bugs fixed since Cogl 1.9.4 + + https://bugzilla.gnome.org: + + #660188 - Color corruption with software rendering at 30-bit color depth + #668385 - Missing G_END_DECLS in cogl-poll.h + #668856 - Do not look for GLES2-only GLSL prototypes on GL + #668913 - The journal for an offscreen doesn't get flushed when + cogl_texture_get_data is called + #669368 - Reading back texture fails with ‘Invalid operation’ + wrong image + #669785 - Build fixes for COGL master (1.9.x) + + • Note the following conformance tests are currently failing with + the GLES2 driver but they were also failing in 1.9.4: + test_cogl_depth_test, test_cogl_sub_texture, test_cogl_texture_3d + +Many thanks to: + + Robert Bragg + Chun-wei Fan + Damien Leone + Emmanuele Bassi + Jasper St. Pierre + Chao-Hsiung Liao + Gheyret Kenji + Ihar Hrachyshka + Kasia Bondarava + Kenneth Nielsen + Kjartan Maraas + Ryan Lortie + +Cogl 1.9.4 2012-01-16 + + • List of changes since Cogl 1.9.2 + + » Visual Studio 2008/2010 project files have landed and are being actively + maintained by Chun-wei Fan + » A basic KMS (Kernel Mode Setting) backend was added so we can run fullscreen + Cogl applications without X11 on Linux. + » EGL platforms can now be selected at runtime. Although we've had the ability + select backends at runtime for a while, up until now all EGL platforms were + part of one monolithic backend and were mutually exclusive so a platform + had to be chosen at build time. + » cogl_matrix_orthographic() was added as a replacement for cogl_matrix_ortho() + since the OpenGL style of arguments for cogl_matrix_ortho() wasn't consistent + with the rest of the Cogl API. + » Experimental cogl_framebuffer_ apis were added for manipulating the + per-framebuffer modelview matrix stack. The aim is for these to replace + apis like cogl_rotate/translate/scale because those apis aren't explicitly + related to a CoglContext which we'd like to avoid so we can remove the + need for a global CoglContext. + » Experimental cogl_framebuffer apis were added for manipulating the + per-framebuffer clip stacks. + » The internal _cogl_framebuffer_flush_state() function was optimized to do + a better job of bailing out when no framebuffer state has changed, and + when state has changed the cost should now scale by the number of changes + made instead of scaling by the total range of framebuffer state that Cogl + tracks. + » Internally we finally removed _cogl_enable() which won't mean much to most + people but makes the maintainers happy. This happened as part of a rework + for how attribute state is flushed when drawing which fixed some problems + with supporting custom attributes and should improve the performance of + flushing attributes too. + » We added an experimental CoglSnippets api aiming to greatly simplify how + developers can incorporate snippets of GLSL code into the pipeline. This is + a feature that has been on the drawing board for a long time so we're + really happy that it's finally here. + + *** We'd really love to see people start to play with the snippets API and + tell us how they get on. The plan is for this API to replace all need for + developers to use the CoglProgram and CoglShader apis which are rather poor + copies of the OpenGL APIs for using GLSL which don't map well to Cogl's + design. *** + + » We've updated Cogl's client side Wayland support + » We've updated Cogl's compositor side Wayland support, including updating the + example cogland compositor. + » We added an SDL window system backend for Cogl, which provides a simple, + portable way to play with Cogl as a standalone graphics API with basic + support for input events available from SDL. See examples/cogl-sdl-hello + to see how that works. + » We added mainloop integration support to Cogl. Since we want to have the + ability to use poll() to block for events from some drivers we have introduced + apis that all Cogl applications are required to use to integrate Cogl + into their mainloop. For applications using a glib mainloop we've provided + a GSource for convenience. + + • List of bugs fixed since Cogl 1.9.2 + + https://bugzilla.gnome.org: + + #650020 - Visual C++ 2008/2010 Project files to compile Cogl and Cogl-Pango + #665190 - The conformance test wrapper scripts don't return an exit code + #665604 - Cogl needs to bind the framebuffer before calling eglSwapBuffers + #665722 - Build Fixes for COGL master branch + #665723 - Conformance tests failed (snippets, pipeline_uniforms) + #667009 - Remove DRM vblank hack + +Many thanks to: + + Neil Roberts + Chun-wei Fan + Rob Bradford + Daniel Mustieles + Fran Diéguez + Aurimas Černius + Javier Jardón + Jorge González + Joshua Lock + Seong-ho, Cho + Tomeu Vizoso + Yinghua Wang + +Cogl 1.9.2 2011-11-23 + + • List of changes since Cogl 1.8.0 + + » Fix a crash while generating ARBfp code with layers containing a + NULL texture. + » Improvements to the mingw-fetch-dependencies script to work + without first needing to find a copy of config.guess. + » Translation updates. + » Ported more conformance tests from Clutter to be standalone Cogl tests. + » Adds experimental support for EXT_discard_framebuffer extension which + is important for good performance on PowerVR graphics hardware + » Adds experimental API to enable clipping to the silhouette of an arbitrary + 2D CoglPrimitive + » Make the CoglTexture2DSliced API directly available as experimental API + » Adds a new feature checking API that's not limited to just 32 features + and also must be passed a CoglContext pointer so it's clear at what point + the features can start to be queried. + » Adds an experimental CoglMetaTexture interface that gives one simple + api for mapping meta-textures that aren't directly understood by the GPU + (such as sliced textures, atlas textures, sub textures) into low level + textures. This interface also gives us a single place to handle repeat + mode fallbacks, supporting clamp-to-edge, repeat and mirrored repeat. + » Make the CoglTextureRectangle API directly available as experimental API + » Adds experimental support for multisampling, which is where the gpu + calculates multiple samples per pixel and the final pixel is a weighted + average of those samples. For example you can expect that multisampling + with 4 samples per pixel would give similar quality to rendering at double + the resolution and then scaling that image down with texture filtering, but + the GPU can often do some tricks such that multisampling is faster than + doing that manually (known as supersampling) + » Make the CoglSubTexture API directly available as experimental API + » Added an n_indices argument to cogl_primitive_set_indices to avoid needing + to always call cogl_primitive_set_n_vertices() after using the api and + to make it less error prone to use the api. + » Ship a standalone cogl-xlib.h that must be included manually for any xlib + specific api because the Xlib headers so many numerous badly namespaced + symbols that it's not desireable to include them unless absolutely + required. + » Updated the Wayland support to work with the latest upstream interfaces. + » Add experimental CoglPipeline API for controlling the backface culling. + » Added a cogl_matrix_transpose() function + » Add experimental support for setting uniforms on a CoglPipeline. This + is in preparation for being able to associate snippets of GLSL that hook + into specific parts of the pipeline. We plan to eventually deprecate + CoglProgram but even in the meantime we would also recommend setting + uniforms on the pipeline now instead of the program. + » Adds experimental cogl_framebuffer_finish() api for explicitly synchonizing + the GPU with the CPU. + + • List of bugs fixed since Cogl 1.8.0 + + https://bugzilla.gnome.org: + + #656755 - Install the examples + #658700 - Bind the locale domain so that gettext actually works + #660184 - Running an X client causes a segfault when using software + rendering + #660387 - test-color-mask fails due to uninitialized texture data + #660617 - Porting of clutter tests + #660986 - memory leak in CoglPipeline::layers_cache + #661019 - Indices don't seem to work + #661174 - Remove inclusion of Xlib headers from Cogl headers + #662184 - Pipeline shaders often fail to link on GLES2 because of different + n_tex_coord_attribs + #662542 - The ARBfp and GLSL pipeline backends sometimes don't flush + uniforms + #663578 - _COGL_RETURN_IF_FAIL sometimes doesn't use glib + #663628 - Make the pipeline backface culling experimental public + +Many thanks too: + Robert Bragg + Neil Roberts + Luca Bruno + Chun-wei Fan + Jorge González + Rob Bradford + Fran Diéguez + Rico Tzschichholz + Yaron Shahrabani + krishnababu k + Damien Leone + Daniel Martinez Cucalon + Daniel Mustieles + Flemming Christensen + Gabor Kelemen + Gil Forcada + Ivaylo Valkov + Jasper St. Pierre + Kjartan Maraas + Matej Urbančič + Muhammet Kara + Nguyễn Thái Ngọc Duy + Nilamdyuti Goswami + Seong-ho, Cho + Simos Xenitellis + Zan Dobersek + +Cogl 1.8.0 2011-09-19 + + • List of changes since Cogl 1.7.8 + + » Started porting Cogl conformance tests from Clutter to be standalone + Cogl tests including tests for depth-state and backface culling. + » Added a new color mask conformance test + » We no longer implicitly define COGL_ENABLE_EXPERIMENTAL_2_0_API in the + cogl-2.0-experimental.pc file cflags because the way pkgconfig works makes + it hard to then consume libraries depending on cogl-2.0-experimental.pc + with Clutter. + » Made progress re-factoring cogl-pipeline.c to be more maintainable by + starting to split the code up into more manageable pieces. + » We now bind the locale dir for the Cogl domain during init + » We now track backface culling state as part of CoglPipeline. + + • List of bugs fixed since Cogl 1.7.8 + + https://bugzilla.gnome.org: + + #656442 - README points to wrong bug product + #658092 - St ::hover transitions don't act as expected + #658333 - Typo in cogl/cogl-display.h + #658700 - Bind the locale domain so that gettext actually works + #659029 - Clipping problem + #659360 - Optimization in _cogl_winsys_onscreen_swap_region causes tearing + +Many thanks too: + Neil Roberts + Matej Urbančič + Abdalrahim G. Fakhouri + Adel Gadllah + Andika Triwidada + Arash Mousavi + Bruce Cowan + Chun-wei Fan + Duarte Loreto + Emmanuele Bassi + I Felix + Ihar Hrachyshka + Ioannis Zamboukas + Laura Balbastre + Luca Ferretti + Manoj Kumar Giri + Muhammet Kara + Rudolfs Mazurs + Tiffany Antopolski + Wolfgang Stöggl + Wouter Bolsterlee + Xandru Armesto + Yinghua Wang + Yuri Myasoedov + Мирослав Николић + +Cogl 1.7.8 2011-09-05 + + • List of changes since Cogl 1.7.6 + + » Getters for the display and renderer associated with context + » Getter for the number of supported texture units during fragment + processing. (ClutterGst needs to know this for example to know if GLSL + based YUV->RGB color space conversion can be used.) + » Optimizations for the GLSL codegen for fragment processing so we can + ignore redundant layers - if for example the "REPLACE" function is used + for layer N then computing anything for previous layers is redundant. Also + if texture combining needs to sample the same texture multiple times we + now re-use the same sample instead of repeating it. + » Optimize texture uploads to a texture atlas on GLES by avoiding lots of + redundant format conversions. + » Relax the requirement to need braces around blend factors when using the + CoglBlendString syntax. Braces are only needed for factors involving a + subtraction like "(1 - SRC_COLOR[A])" + » Adds API for querying the format of a CoglFramebuffer + + • List of bugs fixed since Cogl 1.7.6 + + https://bugzilla.gnome.org: + + #656426 - Improve the generated GLSL code + #656441 - Build failure in examples + #656587 - Outdated FSF Address in code files + #657347 - Retrieve the number of texture image units + #657840 - Atlas-ed bitmaps converted too many times + #656809 - cogl 1.7.6 doesn't compile on Fedora 16/17 + +Many thanks to: + Damien Lespiau + Neil Roberts + Emmanuele Bassi + +Cogl 1.7.6 2011-08-12 +=============================================================================== + + • List of changes since Cogl 1.7.4 + + » Add an experimental cogl_matrix_look_at function + » Fix flipping the y-coordinates for cogl_framebuffer_swap_region + » Automatically allocate framebuffers on first use + » Add experimental cogl_framebuffer_clear functions + » Add a function to get the context given a framebuffer + » Add support for a cogl.conf config file + » Fix using TEXTURE_n as the source for a layer combine + » Some fixes for the WGL backend + » Add experimental API to upload a texture subregion from a CoglBuffer + + • List of bugs fixed since Cogl 1.7.4 + + https://bugzilla.gnome.org: + + #655026 - cogl-pango should not link to systemwide libcogl during make + install + #655216 - egl: Guard the feature discovery of eglCreateImage() + #655228 - Bugs in cogl-quaternion library functions + cogl_quaternion_init_from_array and + cogl_quaternion_get_rotation_axis. + #655355 - Make Cogl master work on EGL/GDL again + #655400 - cogl-pipeline-fragend-arbfp: Initialise template_pipeline + #655412 - Don't use the 'NULL' GModule to resolve GL symbols + #655510 - Access Violation (a.k.a Segfault) in cogl/driver/gl/cogl-gl.c + #655556 - Memory leak in function cogl_polygon in cogl-primitives.c + #655723 - egl-gdl: Silence a gcc warning + #655724 - egl-gdl: Don't generate cogl-display.h + #656303 - Improve cogl-pango's journal usage + #655792 - android: Commit the build.xml file + #655791 - android: Update the hello example to the latest glib-android + API change + +Many thanks to: + Robert Bragg + Damien Lespiau + Chun-wei Fan + Alexandre Rostovtsev + Kirk A. Baker + Philip Withnall + Florian Renaut + +Cogl 1.7.4 2011-07-20 +=============================================================================== + + • List of changes since Cogl 1.7.2 + + » Optimize pipeline unparent operation using embedded lists instead + of using GList API. + » Remove the old matrix operation code we had before pulling in the + mesa based code, and flatten all our matrix utilities back into one + maintainable file. + » Expose cogl_framebuffer_get_red/green/blue/alpha bits to query + the precision for a framebuffer's color channels. + » Numerous reference manual updates + » Fix some memory leaks in CoglPipeline that weren't captured in + bugzilla. + » Fix some EGL winsys issues that weren't captured in bugzilla. + » Switch to dynamically loading libGL, libGLESv2 or libGLES[v1]_CM + at runtime so it's possible to distribute a libcogl that can choose + to work with any of these at runtime. This can simplify packaging + on distros that have numerous packages that provide a platform + specific GL/GLES driver and certainly helps during the development + process when evaluating the pros-and-cons of different drivers for + a given platform. + » Clean up lots of inconsistencies with platform specific APIs, so + we follow the naming convention of cogl__object_method. + » Remove cogl_set_default_context from experimental 2.0 api, since + we are aiming to remove the default context for 2.0 + » Ensure the experimental 2.0 reference manual gets a unique + DOC_MODULE name so that distro's trying to package cogl don't end + up installing the 1.x and 2.0 manuals to the same location + » Add a program cache for the GLSL backend, a bit like we have for + the ARBfp backend. This can be a big boost in performance for some + apps depending on your platform. + » Adds dither_enable getter and setter API for CoglFramebuffer so + that Clutter doesn't need to use the GL API directly when picking. + We need to get to the point where Clutter doesn't need to link + against libGL directly so Clutter can take advantage of runtime + driver selection by Cogl. + » Use MESA_pack_invert extension in cogl_read_pixels to avoid + needing to manually flip pixel data read in bottom-up order to a + top-down order. + » Fix the hello example to actually clear the framebuffer at the + start of the frame instead of unintentionally relying on the driver + to have cleared the framebuffer. + + • List of bugs fixed since Cogl 1.7.2 + + https://bugzilla.gnome.org: + + #652514 - CoglPipeline could embed the list nodes for the + children directly in the CoglPipeline struct + #654440 - _cogl_winsys_context_init crash + #654718 - clutter 1.6.16 compile issues + #654593 - dlopening an unversionaed Shared Object is illegal. + +Many thanks to: + Neil Roberts + Damien Lespiau + Emmanuele Bassi + Takeshi AIHANA + +Cogl 1.7.2 2011-07-01 +=============================================================================== + + • List of changes since Cogl 1.7.0 + + » Add an example program to draw a 3D crate + + » Add experimental API to get and set the viewport on a framebuffer + without going through the implicit context. + + » Add API to select the winsys backend without having to use an + environment variable. + + » Various documentation fixes. + + » Add winsys-specific typesafe APIs to replace the old + cogl_renderer_handle_native_event functions. + + » Rename platform-specific APIs so that we consistently have + cogl__symbol_name instead of cogl_symbol_name_. + + » Fixed building against GLES. + + • List of bugs fixed since Cogl 1.7.0 + + https://bugzilla.gnome.org: + + #652672 - Typo fix in cogl-framebuffer + #653615 - cogl_release_status='snapshot' breaks linking on 64-bit + systems due to namespace conflict with ltoptions.m4 + #653229 - pipeline: Don't regenerate shaders when not changing the + number of layers + #653231 - pipeline: Don't trigger a change when binding the invalid + texture target + +Many thanks to: + Robert Bragg + Adam Jackson + Emmanuele Bassi + +Cogl 1.7.0 2011-06-10 +=============================================================================== + + • List of changes since Clutter 1.6 + + » Cogl split out into a standalone project! + + » Added native winsys backends for GLX, WGL, EGL and Android (Quartz in + progress) + » Supported EGL platforms include: NULL, X11, GDL and Wayland + + » Adds renderer,display,onscreen-template and swap-chain APIs for + writing standalone apps using the experimental 2.0 API + + » Added convenience functions cogl_matrix_view_2d_in_frustum/perspective + for setting up a Clutter style view transform for a 2d coordinate system + inside a projective perspective. + + » Added an experimental Quaternion API + + » Added an experimental Euler API + + » Re-worked the CoglPipeline depth testing state API + + » Added EGL X11 texture-from-pixmap support. + + » Added a tiny Wayland compositor (without input support) under + examples/ + + » Optimizations: + » Optimise paths that are just a rectangle + » Journal: Use a pool of vertex-arrays to avoid allocation costs. + + • List of bugs fixed since Clutter 1.6 + + http://bugzilla.clutter-project.org: + #2538 - crash in gnome-shell + #2544 - Using vertex buffers causes memory corruption when you unref the CoglHandle + #2561 - Updates to COGL sources regarding non-standard code usage + #2588 - Assertion failure in _cogl_pipeline_set_layer_texture_target + #2594 - cogl-clip-state: Adapt to experimental cogl2 API. + #2620 - _cogl_offscreen_new_to_texture_full() leaks reference when failing + + https://bugzilla.gnome.org: + #641197 - mouse events at pixel row zero are ignored + #650966 - CoglPipeline doesn't support any layers on fixed function hardware + #650979 - cogl-pipeline-fragend-fixed: Fix enabling texture targets + #651256 - configure fails for the poor sods who use dash as sh + +Many thanks to: + + Neil Roberts + Emmanuele Bassi + Damien Lespiau + James Athey + Jasper St. Pierre + Piotr Drąg diff --git a/README b/README new file mode 100644 index 0000000..565c24c --- /dev/null +++ b/README @@ -0,0 +1,177 @@ +README for Cogl 1.18.2 +=============================================================================== + +Note: This file is delimited with -- markers so it is possible to split +sections out for other purposes, such as for release notes. + +-- +DESCRIPTION +------------------------------------------------------------------------------- + +Cogl is a small open source library for using 3D graphics hardware for +rendering. The API departs from the flat state machine style of OpenGL and is +designed to make it easy to write orthogonal components that can render without +stepping on each others toes. + +As well as aiming for a nice API, we think having a single library as opposed +to an API specification like OpenGL has a few advantages too; like being +able to paper over the inconsistencies/bugs of different OpenGL +implementations in a centralized place, not to mention the myriad of OpenGL +extensions. It also means we are in a better position to provide utility +APIs that help software developers since they only need to be implemented +once and there is no risk of inconsistency between implementations. + +Having other backends, besides OpenGL, such as drm, Gallium or D3D are +options we are interested in for the future. + +-- +REQUIREMENTS +------------------------------------------------------------------------------- + +Cogl currently only requires: + + • OpenGL ≥ 1.3 (or 1.2 + multitexturing), or OpenGL ES 2.0 (or 1.1) + • GLX, AGL, WGL or an EGL implementation + +Cogl also has optional dependencies: + + • GLib ≥ 2.32.0 + - for gtype integration + • GDK-Pixbuf ≥ 2.0 + - for image loading + • Cairo ≥ 1.10 + - for debugging texture atlasing (debug builds only) + +The optional Cogl Pango library requires: + • Cairo ≥ 1.10 + • PangoCairo ≥ 1.20 + +The optional Cogl GStreamer library requires: + + • GStreamer 1.0 + +On X11, Cogl depends on the following extensions + + • XComposite ≥ 0.4 + • XDamage + • XExt + • XFixes ≥ 3 + +For the Wayland backend, Cogl requires: + • Wayland ≥ 1.0.0 + +When running with OpenGL, Cogl requires at least version 1.3 +or 1.2 with the multitexturing extension. However to build Cogl +you will need the latest GL headers which can be obtained from: + + http://www.khronos.org + +If you are building the API reference you will also need: + + • GTK-Doc ≥ 1.13 + +If you are building the additional documentation you will also need: + + • xsltproc + • jw (optional, for generating PDFs) + +If you are building the Introspection data you will also need: + + • GObject-Introspection ≥ 0.9.5 + +GObject-Introspection is available from: + + git://git.gnome.org/gobject-introspection + +If you want support for profiling Cogl you will also need: + + • UProf ≥ 0.3 + +UProf is available from: + + git://github.com/rib/UProf.git + +-- +DOCUMENTATION +------------------------------------------------------------------------------- + +The 1.x stable API is documented here: + + http://developer.gnome.org/cogl/stable/ + +The 1.x development API is documented here: + + http://developer.gnome.org/cogl/1.18 + +The experimental 2.0 API is documented here: + + http://cogl3d.org/cogl2-reference/ + +-- +LICENSE +------------------------------------------------------------------------------- +Most of Cogl is licensed under the terms of the MIT license. There are +also some files under the SGI Free Software License B, version 2.0, +cogl-point-in-poly.c is under a 3 clause BSD license and stb_image.c +is public domain. Please see individual files for details. + +deps/glib is licensed under the LGPL (please see individual files for +details and deps/glib/COPYING for a copy of the LGPL license) This +code is only referenced when building Cogl with the --enable-standalone +configure option. + +-- +BUILDING AND INSTALLATION +------------------------------------------------------------------------------- + +Please refer to the INSTALL document. + +-- +BUGS +------------------------------------------------------------------------------- + +Please report bugs here: + + http://bugzilla.gnome.org/enter_bug.cgi?product=cogl + +You will need a Bugzilla account. + +Please include the following in bug reports: + + • what system you're running Cogl on; + • which version of Cogl you are using; + • which version of GLib and OpenGL (or OpenGL ES) you are using; + • which video card and which drivers you are using, including output of + glxinfo and xdpyinfo (if applicable); + • how to reproduce the bug. + +If you cannot reproduce the bug with one of the tests that come with +Cogl's source code, it can help a lot to include a small test case +displaying the bad behaviour. + +If the bug exposes a crash, the exact text printed out and a stack trace +obtained using gdb are greatly appreciated. + +-- +CONTRIBUTING +------------------------------------------------------------------------------- + +The CODING_STYLE file describes the coding style we use throughout Cogl, +please try your best to conform to this style because the consistency +really helps keep the code maintainable. + +We can accept contributions in several ways: + • Either as patches attached to bugs on bugzilla + - For this you may be interested in using git-bz. + + See http://git.fishsoup.net/man/git-bz.html for details + • You can email us patches + - For this we recommend using git-send-email + + • You can create a remote branch and ask us to pull from that for more + substantial changes. + - For this we recommend using github. + +Ideally standalone patches should be created using git format-patch since +that makes it easiest to import the patch with a commit message into a +git repository. diff --git a/README.in b/README.in new file mode 100644 index 0000000..5928570 --- /dev/null +++ b/README.in @@ -0,0 +1,177 @@ +README for Cogl @COGL_1_VERSION@ +=============================================================================== + +Note: This file is delimited with -- markers so it is possible to split +sections out for other purposes, such as for release notes. + +-- +DESCRIPTION +------------------------------------------------------------------------------- + +Cogl is a small open source library for using 3D graphics hardware for +rendering. The API departs from the flat state machine style of OpenGL and is +designed to make it easy to write orthogonal components that can render without +stepping on each others toes. + +As well as aiming for a nice API, we think having a single library as opposed +to an API specification like OpenGL has a few advantages too; like being +able to paper over the inconsistencies/bugs of different OpenGL +implementations in a centralized place, not to mention the myriad of OpenGL +extensions. It also means we are in a better position to provide utility +APIs that help software developers since they only need to be implemented +once and there is no risk of inconsistency between implementations. + +Having other backends, besides OpenGL, such as drm, Gallium or D3D are +options we are interested in for the future. + +-- +REQUIREMENTS +------------------------------------------------------------------------------- + +Cogl currently only requires: + + • OpenGL ≥ 1.3 (or 1.2 + multitexturing), or OpenGL ES 2.0 (or 1.1) + • GLX, AGL, WGL or an EGL implementation + +Cogl also has optional dependencies: + + • GLib ≥ @GLIB_REQ_VERSION@ + - for gtype integration + • GDK-Pixbuf ≥ @GDK_PIXBUF_REQ_VERSION@ + - for image loading + • Cairo ≥ @CAIRO_REQ_VERSION@ + - for debugging texture atlasing (debug builds only) + +The optional Cogl Pango library requires: + • Cairo ≥ @CAIRO_REQ_VERSION@ + • PangoCairo ≥ @PANGOCAIRO_REQ_VERSION@ + +The optional Cogl GStreamer library requires: + + • GStreamer 1.0 + +On X11, Cogl depends on the following extensions + + • XComposite ≥ @XCOMPOSITE_REQ_VERSION@ + • XDamage + • XExt + • XFixes ≥ @XFIXES_REQ_VERSION@ + +For the Wayland backend, Cogl requires: + • Wayland ≥ @WAYLAND_REQ_VERSION@ + +When running with OpenGL, Cogl requires at least version 1.3 +or 1.2 with the multitexturing extension. However to build Cogl +you will need the latest GL headers which can be obtained from: + + http://www.khronos.org + +If you are building the API reference you will also need: + + • GTK-Doc ≥ @GTK_DOC_REQ_VERSION@ + +If you are building the additional documentation you will also need: + + • xsltproc + • jw (optional, for generating PDFs) + +If you are building the Introspection data you will also need: + + • GObject-Introspection ≥ @GI_REQ_VERSION@ + +GObject-Introspection is available from: + + git://git.gnome.org/gobject-introspection + +If you want support for profiling Cogl you will also need: + + • UProf ≥ @UPROF_REQ_VERSION@ + +UProf is available from: + + git://github.com/rib/UProf.git + +-- +DOCUMENTATION +------------------------------------------------------------------------------- + +The 1.x stable API is documented here: + + http://developer.gnome.org/cogl/stable/ + +The 1.x development API is documented here: + + http://developer.gnome.org/cogl/1.@COGL_1_MINOR_VERSION@ + +The experimental 2.0 API is documented here: + + http://cogl3d.org/cogl2-reference/ + +-- +LICENSE +------------------------------------------------------------------------------- +Most of Cogl is licensed under the terms of the MIT license. There are +also some files under the SGI Free Software License B, version 2.0, +cogl-point-in-poly.c is under a 3 clause BSD license and stb_image.c +is public domain. Please see individual files for details. + +deps/glib is licensed under the LGPL (please see individual files for +details and deps/glib/COPYING for a copy of the LGPL license) This +code is only referenced when building Cogl with the --enable-standalone +configure option. + +-- +BUILDING AND INSTALLATION +------------------------------------------------------------------------------- + +Please refer to the INSTALL document. + +-- +BUGS +------------------------------------------------------------------------------- + +Please report bugs here: + + http://bugzilla.gnome.org/enter_bug.cgi?product=cogl + +You will need a Bugzilla account. + +Please include the following in bug reports: + + • what system you're running Cogl on; + • which version of Cogl you are using; + • which version of GLib and OpenGL (or OpenGL ES) you are using; + • which video card and which drivers you are using, including output of + glxinfo and xdpyinfo (if applicable); + • how to reproduce the bug. + +If you cannot reproduce the bug with one of the tests that come with +Cogl's source code, it can help a lot to include a small test case +displaying the bad behaviour. + +If the bug exposes a crash, the exact text printed out and a stack trace +obtained using gdb are greatly appreciated. + +-- +CONTRIBUTING +------------------------------------------------------------------------------- + +The CODING_STYLE file describes the coding style we use throughout Cogl, +please try your best to conform to this style because the consistency +really helps keep the code maintainable. + +We can accept contributions in several ways: + • Either as patches attached to bugs on bugzilla + - For this you may be interested in using git-bz. + + See http://git.fishsoup.net/man/git-bz.html for details + • You can email us patches + - For this we recommend using git-send-email + + • You can create a remote branch and ask us to pull from that for more + substantial changes. + - For this we recommend using github. + +Ideally standalone patches should be created using git format-patch since +that makes it easiest to import the patch with a commit message into a +git repository. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..482d0b4 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1724 @@ +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +# Copyright (C) 2002-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.14' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.14.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.14.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for 'mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl FIXME we are no longer going to remove this! adjust warning +dnl FIXME message accordingly. +AC_DIAGNOSE([obsolete], +[$0: this macro is deprecated, and will soon be removed. +You should use the Autoconf-provided 'AC][_PROG_MKDIR_P' macro instead, +and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.]) +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([build/autotools/acglib.m4]) +m4_include([build/autotools/as-compiler-flag.m4]) +m4_include([build/autotools/as-glibconfig.m4]) +m4_include([build/autotools/as-linguas.m4]) +m4_include([build/autotools/gettext.m4]) +m4_include([build/autotools/gtk-doc.m4]) +m4_include([build/autotools/iconv.m4]) +m4_include([build/autotools/intlmacosx.m4]) +m4_include([build/autotools/lib-ld.m4]) +m4_include([build/autotools/lib-link.m4]) +m4_include([build/autotools/lib-prefix.m4]) +m4_include([build/autotools/libtool.m4]) +m4_include([build/autotools/ltoptions.m4]) +m4_include([build/autotools/ltsugar.m4]) +m4_include([build/autotools/ltversion.m4]) +m4_include([build/autotools/lt~obsolete.m4]) +m4_include([build/autotools/nls.m4]) +m4_include([build/autotools/po.m4]) +m4_include([build/autotools/progtest.m4]) +# Configure paths for GLIB +# Owen Taylor 1997-2001 + +dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, +dnl gthread, or gio is specified in MODULES, pass to pkg-config +dnl +AC_DEFUN([AM_PATH_GLIB_2_0], +[dnl +dnl Get the cflags and libraries from pkg-config +dnl +AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], + , enable_glibtest=yes) + + pkg_config_args=glib-2.0 + for module in . $4 + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + gio*) + pkg_config_args="$pkg_config_args $module-2.0" + ;; + esac + done + + PKG_PROG_PKG_CONFIG([0.16]) + + no_glib="" + + if test "x$PKG_CONFIG" = x ; then + no_glib=yes + PKG_CONFIG=no + fi + + min_glib_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" +dnl +dnl Now check if the installed GLIB is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent) +dnl + rm -f conf.glibtest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + unsigned int major, minor, micro; + + fclose (fopen ("conf.glibtest", "w")); + + if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + GLIB_COMPILE_RESOURCES="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_GENMARSHAL) + AC_SUBST(GOBJECT_QUERY) + AC_SUBST(GLIB_MKENUMS) + AC_SUBST(GLIB_COMPILE_RESOURCES) + rm -f conf.glibtest +]) + +dnl -*- mode: autoconf -*- +dnl Copyright 2009 Johan Dahlin +dnl +dnl This file is free software; the author(s) gives unlimited +dnl permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl + +# serial 1 + +m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], +[ + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([LT_INIT],[$0])dnl setup libtool first + + dnl enable/disable introspection + m4_if([$2], [require], + [dnl + enable_introspection=yes + ],[dnl + AC_ARG_ENABLE(introspection, + AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], + [Enable introspection for this build]),, + [enable_introspection=auto]) + ])dnl + + AC_MSG_CHECKING([for gobject-introspection]) + + dnl presence/version checking + AS_CASE([$enable_introspection], + [no], [dnl + found_introspection="no (disabled, use --enable-introspection to enable)" + ],dnl + [yes],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0],, + AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], + found_introspection=yes, + AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) + ],dnl + [auto],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + dnl Canonicalize enable_introspection + enable_introspection=$found_introspection + ],dnl + [dnl + AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) + ])dnl + + AC_MSG_RESULT([$found_introspection]) + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + AC_SUBST(INTROSPECTION_SCANNER) + AC_SUBST(INTROSPECTION_COMPILER) + AC_SUBST(INTROSPECTION_GENERATE) + AC_SUBST(INTROSPECTION_GIRDIR) + AC_SUBST(INTROSPECTION_TYPELIBDIR) + AC_SUBST(INTROSPECTION_CFLAGS) + AC_SUBST(INTROSPECTION_LIBS) + AC_SUBST(INTROSPECTION_MAKEFILE) + + AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") +]) + + +dnl Usage: +dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) + +AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) +]) + +dnl Usage: +dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) + + +AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) +]) + diff --git a/build/Makefile-msvcproj.mak b/build/Makefile-msvcproj.mak new file mode 100644 index 0000000..6640a70 --- /dev/null +++ b/build/Makefile-msvcproj.mak @@ -0,0 +1,56 @@ +# Centralized autotools file +# To create the Visual C++ projects +# from the templates +# Author: Fan, Chun-wei +# August 30, 2012 + +# Required Items to call this: +# MSVC_PROJECT: name of project +# MSVC_PROJECT_SRCDIR: subdir of source tree where sources for this project is found +# MSVC_PROJECT_SRCS: source files to build +# MSVC_PROJECT_EXCLUDES: source files to exclude from MSVC_PROJECT_SRCS, use dummy if none, +# wildcards (*) are allowed, seperated by | +# DISTCLEANFILES: Define an empty one if not previously defined + +# Create the complete Visual C++ 2008/2010 project files + +$(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj: $(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin >$@ + rm $(MSVC_PROJECT).sourcefiles + +$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin >$@ + rm $(MSVC_PROJECT).vs10.sourcefiles + +$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' Source Files' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin >$@ + rm $(MSVC_PROJECT).vs10.sourcefiles.filters + +DISTCLEANFILES += \ + $(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj \ + $(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj \ + $(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters diff --git a/build/Makefile.am b/build/Makefile.am new file mode 100644 index 0000000..0f81afe --- /dev/null +++ b/build/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = win32 diff --git a/build/Makefile.in b/build/Makefile.in new file mode 100644 index 0000000..7e55010 --- /dev/null +++ b/build/Makefile.in @@ -0,0 +1,753 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = build +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am compile \ + config.guess config.rpath config.sub depcomp install-sh \ + missing ltmain.sh +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = win32 +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign build/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/build/autotools/Makefile.am.enums b/build/autotools/Makefile.am.enums new file mode 100644 index 0000000..d3dc742 --- /dev/null +++ b/build/autotools/Makefile.am.enums @@ -0,0 +1,51 @@ +# Rules for generating enumeration types using glib-mkenums +# +# Define: +# glib_enum_h = header template file +# glib_enum_c = source template file +# glib_enum_headers = list of headers to parse +# +# before including Makefile.am.enums. You will also need to have +# the following targets already defined: +# +# CLEANFILES +# DISTCLEANFILES +# BUILT_SOURCES +# EXTRA_DIST +# +# Author: Emmanuele Bassi + +# Basic sanity checks +$(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS)) + +$(if $(or $(glib_enum_h), \ + $(glib_enum_c)),, \ + $(error Need to define glib_enum_h and glib_enum_c)) + +$(if $(glib_enum_headers),,$(error Need to define glib_enum_headers)) + +enum_tmpl_h=$(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in)) +enum_tmpl_c=$(addprefix $(srcdir)/, $(glib_enum_c:.c=.c.in)) + +CLEANFILES += stamp-enum-types +DISTCLEANFILES += $(glib_enum_h) $(glib_enum_c) +BUILT_SOURCES += $(glib_enum_h) $(glib_enum_c) +EXTRA_DIST += $(enum_tmpl_h) $(enum_tmpl_c) + +stamp-enum-types: $(glib_enum_headers) $(enum_tmpl_h) + $(AM_V_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_h) \ + $(glib_enum_headers) > xgen-eh \ + && (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \ + && rm -f xgen-eh \ + && echo timestamp > $(@F) + +$(glib_enum_h): stamp-enum-types + @true + +$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(enum_tmpl_c) + $(AM_V_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_c) \ + $(glib_enum_headers) > xgen-ec \ + && cp -f xgen-ec $(glib_enum_c) \ + && rm -f xgen-ec diff --git a/build/autotools/Makefile.am.release b/build/autotools/Makefile.am.release new file mode 100644 index 0000000..bb3a8ef --- /dev/null +++ b/build/autotools/Makefile.am.release @@ -0,0 +1,163 @@ +# To make real stable releases or devel snapshots, use either: +# make release-check +# or make release-publish + +TAR_OPTIONS = --owner=0 --group=0 + +RELEASE_URL_BASE = http://download.gnome.org/sources/cogl +RELEASE_URL = $(RELEASE_URL_BASE)/$(COGL_1_MAJOR_VERSION).$(COGL_1_MINOR_VERSION) + +RELEASE_ANNOUNCE_LIST = cogl@lists.freedesktop.org +RELEASE_ANNOUNCE_CC = gnome-announce-list@gnome.org clutter-announce@clutter-project.org + +tar_file = $(distdir).tar.xz +sha256_file = $(distdir).sha256sum + +$(sha256_file): $(tar_file) + $(AM_V_GEN)sha256sum $^ > $@ + +release-tag: + @if test "x$(COGL_RELEASE_STATUS)" = "xgit"; then \ + echo "Cannot tag a Git version; please, update the Cogl version" >&2; \ + else \ + if test -d "$(top_srcdir)/.git"; then \ + echo "Tagging release $(COGL_1_VERSION)..." ; \ + $(top_srcdir)/build/missing --run git tag \ + -s \ + -m "Cogl $(COGL_1_VERSION) ($(COGL_RELEASE_STATUS))" \ + $(COGL_1_VERSION) ; \ + else \ + echo A git checkout is required to tag a release >&2; \ + fi \ + fi + +release-check: release-verify-even-micro release-verify-news + TAR_OPTIONS="$(TAR_OPTIONS)" $(MAKE) $(AM_MAKEFLAGS) distcheck + +release-verify-news: + @echo -n "Checking that the NEWS file has been updated..." + @if ! grep -q "$(COGL_1_VERSION)" $(top_srcdir)/NEWS; then \ + (echo "Ouch." && \ + echo "The version in the NEWS file does not match $(COGL_1_VERSION)." && \ + echo "This probably means you haven't updated the NEWS file." && \ + false); else :; fi + @echo "Good." + +release-verify-even-micro: + @echo -n "Checking that $(VERSION) has an even micro component..." + @test "$(COGL_1_MICRO_VERSION)" = "`echo $(COGL_1_MICRO_VERSION)/2*2 | bc`" || \ + (echo "Ouch." && \ + echo "The version micro component '$(COGL_1_MICRO_VERSION)' is not an even number." && \ + echo "The version in configure.ac must be incremented before a new release." && \ + false) + @echo "Good." + +release-upload: $(sha256_file) + @echo "Uploading to master.gnome.org..." + @scp $(tar_file) master.gnome.org: + @echo "Running ftpadmin install..." + @ssh master.gnome.org ftpadmin install $(tar_file) + @mv -f $(sha256_file) $(top_builddir)/build/$(sha256_file) + @echo "Done." + +release-message: + @echo " Release URL: $(RELEASE_URL)/$(tar_file)" + @echo "Release checksum: $(RELEASE_URL)/$(sha256_file)" + @echo "Send an email to: $(RELEASE_ANNOUNCE_LIST)" + @echo " Cc: $(RELEASE_ANNOUNCE_CC)" + @echo " Subject: Release Cogl $(COGL_1_VERSION) ($(COGL_RELEASE_STATUS))" + @echo " Contents:" + @csplit -q --prefix=.README-section- $(top_builddir)/README '/^--$$/' '{*}' + @csplit -q --prefix=.NEWS-section- NEWS '/^Cogl/' '{*}' + @echo "--- CUT HERE ---" + @echo "Good news, everyone!" + @echo "" + @echo "A new Cogl $(COGL_RELEASE_STATUS) ($(COGL_1_VERSION)) is now available:" + @echo "" + @echo "LATEST NEWS" + @echo "-------------------------------------------------------------------------------" + @echo "" + @cat .NEWS-section-01 + @echo "FETCHING THE RELEASE" + @echo "-------------------------------------------------------------------------------" + @echo "" + @echo "Tarballs can be downloaded from:" + @echo "" + @echo " http://download.gnome.org/sources/cogl/1.$(COGL_1_MINOR_VERSION)/" + @echo "" + @echo "SHA256 Checksum:" + @echo "" + @cat $(top_builddir)/build/$(sha256_file) + @echo "" + @echo "Additionally, a git clone of the source tree:" + @echo " git clone git://git.gnome.org/cogl" + @echo "" + @echo "will include a signed $(COGL_1_VERSION) tag which points to a commit named:" + @echo " `git cat-file tag $(COGL_1_VERSION) | $(GREP) ^object | $(SED) -e 's,object ,,'`" + @echo "" + @echo "which can be verified with:" + @echo " git verify-tag $(COGL_1_VERSION)" + @echo "" + @echo "and can be checked out with a command such as:" + @echo " git checkout -b build $(COGL_1_VERSION)" + @echo "" + @tail -n +2 .README-section-01 + @echo "" + @tail -n +2 .README-section-02 + @echo "" + @echo "" + @echo "DOCUMENTATION" + @echo "-------------------------------------------------------------------------------" + @echo "" + @echo "The 1.x stable API is documented here:" + @echo " http://developer.gnome.org/cogl/stable/" + @echo "The 1.x development API is documented here:" + @echo " http://developer.gnome.org/cogl/1.$(COGL_1_MINOR_VERSION)" + @echo "The experimental 2.0 API is documented here:" + @echo " http://cogl3d.org/cogl2-reference/" + @echo "" + @echo "" + @echo "RELEASE NOTES" + @echo "-------------------------------------------------------------------------------" + @if test "x$(COGL_RELEASE_STATUS)" = "xsnapshot"; then \ + echo " - This is a development snapshot release so there are not API or ABI stability"; \ + echo " guarantees at this point for new APIs since the last stable release."; \ + echo ""; \ + fi + @echo " - This Cogl release exports a 1.x API (For third-party Clutter" + @echo " developers to write custom actors) and an experimental 2.0 API which" + @echo " allows standalone application development." + @echo "" + @echo " - Internally Clutter depends on the Cogl 2.0 experimental API so we maintain" + @echo " runtime compatibility between the 1.x API and experimental 2.0 APIs, which" + @echo " means developers can mix-and-match their use of the APIs in the same" + @echo " process. API selection is done per-file by including a line like: '#define" + @echo " COGL_ENABLE_EXPERIMENTAL_2_0_API' before including cogl.h or clutter.h." + @echo "" + @echo " - We recommend using the 2.0 API if you don't mind updating your code once in" + @echo " a while as this API evolves and stabilizes. We promise not to break the 2.0" + @echo " API during a 1.x stable cycle and hope that will encourage people to" + @echo " experiment with it and give critical feedback! For example after releasing" + @echo " 1.8, the 2.0 API will be stable for 1.8.1, 1.8.2, 1.8.3 etc, but may update" + @echo " for 1.9/1.10." + @echo "" + @echo " - Because we export the 1.x and 2.0 APIs from one libcogl.so the library" + @echo " versioning, and thus ABI, can only be considered as stable as our 2.0 API - " + @echo " i.e. during a stable release 1.x cycle." + @echo "" + @echo " - Please report bugs using the Cogl Bugzilla product, at:" + @echo " http://bugzilla.gnome.org/enter_bug.cgi?product=cogl" + @echo "--- CUT HERE ---" + +release-publish: release-check + $(MAKE) $(AM_MAKEFLAGS) release-tag + $(MAKE) $(AM_MAKEFLAGS) release-upload + $(MAKE) $(AM_MAKEFLAGS) release-message + +.PHONY: \ + release-check \ + release-message \ + release-publish \ + release-tag \ + release-upload \ + release-verify-even-micro diff --git a/build/autotools/Makefile.am.silent b/build/autotools/Makefile.am.silent new file mode 100644 index 0000000..ca46592 --- /dev/null +++ b/build/autotools/Makefile.am.silent @@ -0,0 +1,19 @@ +# custom rules for quiet builds + +QUIET_GEN = $(AM_V_GEN) + +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; + +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; + +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; + +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; diff --git a/build/autotools/acglib.m4 b/build/autotools/acglib.m4 new file mode 100644 index 0000000..4778bfa --- /dev/null +++ b/build/autotools/acglib.m4 @@ -0,0 +1,131 @@ +## Portability defines that help interoperate with classic and modern autoconfs +ifdef([AC_TR_SH],[ +define([GLIB_TR_SH],[AC_TR_SH([$1])]) +define([GLIB_TR_CPP],[AC_TR_CPP([$1])]) +], [ +define([GLIB_TR_SH], + [patsubst(translit([[$1]], [*+], [pp]), [[^a-zA-Z0-9_]], [_])]) +define([GLIB_TR_CPP], + [patsubst(translit([[$1]], + [*abcdefghijklmnopqrstuvwxyz], + [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), + [[^A-Z0-9_]], [_])]) +]) + +# GLIB_AC_DIVERT_BEFORE_HELP(STUFF) +# --------------------------------- +# Put STUFF early enough so that they are available for $ac_help expansion. +# Handle both classic (<= v2.13) and modern autoconf +AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP], +[ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])], + [ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +$1 +AC_DIVERT_POP()])])]) + +dnl GLIB_IF_VAR_EQ (ENV_VAR, VALUE [, EQUALS_ACTION] [, ELSE_ACTION]) +AC_DEFUN([GLIB_IF_VAR_EQ],[ + case "$[$1]" in + "[$2]"[)] + [$3] + ;; + *[)] + [$4] + ;; + esac +]) +dnl GLIB_STR_CONTAINS (SRC_STRING, SUB_STRING [, CONTAINS_ACTION] [, ELSE_ACTION]) +AC_DEFUN([GLIB_STR_CONTAINS],[ + case "[$1]" in + *"[$2]"*[)] + [$3] + ;; + *[)] + [$4] + ;; + esac +]) +dnl GLIB_ADD_TO_VAR (ENV_VARIABLE, CHECK_STRING, ADD_STRING) +AC_DEFUN([GLIB_ADD_TO_VAR],[ + GLIB_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]") +]) + +# GLIB_SIZEOF (INCLUDES, TYPE, ALIAS) +# --------------------------------------------------------------- +# The definition here is based of that of AC_CHECK_SIZEOF +AC_DEFUN([GLIB_SIZEOF], +[AS_LITERAL_IF([$3], [], + [AC_FATAL([$0: requires literal arguments])])dnl +AC_CACHE_CHECK([size of $2], AS_TR_SH([glib_cv_sizeof_$3]), +[ # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + _AC_COMPUTE_INT([(long) (sizeof ($2))], + [AS_TR_SH([glib_cv_sizeof_$3])], + [AC_INCLUDES_DEFAULT([$1])], + [AC_MSG_ERROR([cannot compute sizeof ($2), 77])]) +])dnl +AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_sizeof_$3), $AS_TR_SH([glib_cv_sizeof_$3]), + [The size of $3, as computed by sizeof.]) +])# GLIB_SIZEOF + +dnl GLIB_BYTE_CONTENTS (INCLUDES, TYPE, ALIAS, N_BYTES, INITIALIZER) +AC_DEFUN([GLIB_BYTE_CONTENTS], +[pushdef([glib_ByteContents], GLIB_TR_SH([glib_cv_byte_contents_$3]))dnl +AC_CACHE_CHECK([byte contents of $5], glib_ByteContents, +[AC_TRY_RUN([#include +$1 +main() +{ + static $2 tv = $5; + char *p = (char*) &tv; + int i; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + for (i = 0; i < $4; i++) + fprintf(f, "%s%d", i?",":"", *(p++)); + fprintf(f, "\n"); + exit(0); +}], + [glib_ByteContents=`cat conftestval` dnl'' +], + [glib_ByteContents=no], + [glib_ByteContents=no])]) +AC_DEFINE_UNQUOTED(GLIB_TR_CPP(glib_byte_contents_$3), [$[]glib_ByteContents], + [Byte contents of $3]) +popdef([glib_ByteContents])dnl +]) + +# GLIB_CHECK_VALUE(SYMBOL, INCLUDES, ACTION-IF-FAIL) +# --------------------------------------------------------------- +AC_DEFUN([GLIB_CHECK_VALUE], +[AC_CACHE_CHECK([value of $1], AS_TR_SH([glib_cv_value_$1]), + [_AC_COMPUTE_INT([$1], AS_TR_SH([glib_cv_value_$1]), [$2], [$3])]) +])dnl + +# GLIB_CHECK_COMPILE_WARNINGS(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------- +# Try to compile PROGRAM, check for warnings +m4_define([GLIB_CHECK_COMPILE_WARNINGS], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f conftest.$ac_objext +glib_ac_compile_save="$ac_compile" +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext' +AS_IF([_AC_EVAL_STDERR($ac_compile) && + AC_TRY_COMMAND([(if test -s conftest.err; then false ; else true; fi)])], + [$2], + [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD +m4_ifvaln([$3],[$3])dnl]) +ac_compile="$glib_ac_compile_save" +rm -f conftest.$ac_objext conftest.err m4_ifval([$1], [conftest.$ac_ext])[]dnl +])# GLIB_CHECK_COMPILE_WARNINGS + +# GLIB_ASSERT_SET(VARIABLE) +# ------------------------- +AC_DEFUN([GLIB_ASSERT_SET], +[if test "x${$1+set}" != "xset" ; then + AC_MSG_ERROR($1 [must be set in cache file when cross-compiling.]) +fi +])dnl diff --git a/build/autotools/as-compiler-flag.m4 b/build/autotools/as-compiler-flag.m4 new file mode 100644 index 0000000..0f660cf --- /dev/null +++ b/build/autotools/as-compiler-flag.m4 @@ -0,0 +1,62 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef + +dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $ + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + m4_ifvaln([$2],[$2]) + true + else + m4_ifvaln([$3],[$3]) + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + +dnl AS_COMPILER_FLAGS(VAR, FLAGS) +dnl Tries to compile with the given CFLAGS. + +AC_DEFUN([AS_COMPILER_FLAGS], +[ + list=$2 + flags_supported="" + flags_unsupported="" + AC_MSG_CHECKING([for supported compiler flags]) + for each in $list + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $each" + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + flags_supported="$flags_supported $each" + else + flags_unsupported="$flags_unsupported $each" + fi + done + AC_MSG_RESULT([$flags_supported]) + if test "X$flags_unsupported" != X ; then + AC_MSG_WARN([unsupported compiler flags: $flags_unsupported]) + fi + $1="$$1 $flags_supported" +]) + diff --git a/build/autotools/as-glibconfig.m4 b/build/autotools/as-glibconfig.m4 new file mode 100644 index 0000000..75055b6 --- /dev/null +++ b/build/autotools/as-glibconfig.m4 @@ -0,0 +1,2141 @@ +dnl +dnl Test program for basic POSIX threads functionality +dnl +m4_define([glib_thread_test],[ +#include +int check_me = 0; +void* func(void* data) {check_me = 42; return &check_me;} +int main() + { pthread_t t; + void *ret; + pthread_create (&t, $1, func, 0); + pthread_join (t, &ret); + return (check_me != 42 || ret != &check_me); +}]) + +AC_DEFUN([AS_GLIBCONFIG], +[ + +m4_define([glib_major_version], [2]) +m4_define([glib_minor_version], [30]) +m4_define([glib_micro_version], [2]) +m4_define([glib_interface_age], [0]) +m4_define([glib_binary_age], + [m4_eval(100 * glib_minor_version + glib_micro_version)]) +m4_define([glib_version], + [glib_major_version.glib_minor_version.glib_micro_version]) + +GLIB_MAJOR_VERSION=glib_major_version +GLIB_MINOR_VERSION=glib_minor_version +GLIB_MICRO_VERSION=glib_micro_version +GLIB_INTERFACE_AGE=glib_interface_age +GLIB_BINARY_AGE=glib_binary_age +GLIB_VERSION=glib_version + +AC_SUBST(GLIB_MAJOR_VERSION) +AC_SUBST(GLIB_MINOR_VERSION) +AC_SUBST(GLIB_MICRO_VERSION) +AC_SUBST(GLIB_VERSION) +AC_SUBST(GLIB_INTERFACE_AGE) +AC_SUBST(GLIB_BINARY_AGE) + +AC_DEFINE(GLIB_INTERFACE_AGE, [glib_interface_age], + [Define to the GLIB interface age]) +AC_DEFINE(GLIB_BINARY_AGE, [glib_binary_age], + [Define to the GLIB binary age]) + +dnl Let's use the system printf unconditionally +enable_included_printf=no +AC_DEFINE(HAVE_GOOD_PRINTF,1,[define to use system printf]) + +dnl No support for static window libraries +glib_win32_static_compilation=no + +dnl that's the defaults in glib's configure (which provides a --with-threads +dnl option we don't expose here) +want_threads=yes + +AC_CANONICAL_HOST + +AC_MSG_CHECKING([for Win32]) +LIB_EXE_MACHINE_FLAG=X86 +case "$host" in + *-*-mingw*) + glib_native_win32=yes + glib_pid_type='void *' + glib_cv_stack_grows=no + # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf + # don't seem to be quite good enough, at least not in mingw-runtime-3.14. + # (Sorry, I don't know exactly what is the problem, but it is related to + # floating point formatting and decimal point vs. comma.) + # The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't + # rigorous enough to notice, though. + # So preset the autoconf cache variables. + ac_cv_func_vsnprintf_c99=no + ac_cv_func_snprintf_c99=no + case "$host" in + x86_64-*-*) + LIB_EXE_MACHINE_FLAG=X64 + ;; + esac + ;; + *) + glib_native_win32=no + glib_pid_type=int + ;; +esac +case $host in + *-*-linux*) + glib_os_linux=yes + ;; +esac + +AC_MSG_RESULT([$glib_native_win32]) + +AC_SUBST(LIB_EXE_MACHINE_FLAG) + +glib_have_carbon=no +AC_MSG_CHECKING([for Mac OS X Carbon support]) +AC_TRY_CPP([ +#include +#include +], glib_have_carbon=yes) + +AC_MSG_RESULT([$glib_have_carbon]) + +AC_CHECK_HEADERS([limits.h float.h values.h alloca.h sys/poll.h]) +AC_CHECK_FUNCS(atexit on_exit memmove) + +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(void *) +AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(__int64) + +if test x$ac_cv_sizeof_long = x8 || test x$ac_cv_sizeof_long_long = x8 || test x$ac_cv_sizeof___int64 = x8 ; then + : +else + AC_MSG_ERROR([ +*** GLib requires a 64 bit type. You might want to consider +*** using the GNU C compiler. +]) +fi + +if test x$glib_native_win32 != xyes && test x$ac_cv_sizeof_long_long = x8; then + # long long is a 64 bit integer. + AC_MSG_CHECKING(for format to printf and scanf a guint64) + AC_CACHE_VAL(glib_cv_long_long_format,[ + for format in ll q I64; do + AC_TRY_RUN([#include + int main() + { + long long b, a = -0x3AFAFAFAFAFAFAFALL; + char buffer[1000]; + sprintf (buffer, "%${format}u", a); + sscanf (buffer, "%${format}u", &b); + exit (b!=a); + } + ], + [glib_cv_long_long_format=${format} + break], + [],[:]) + done]) + if test -n "$glib_cv_long_long_format"; then + AC_MSG_RESULT(%${glib_cv_long_long_format}u) + AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long]) + if test x"$glib_cv_long_long_format" = xI64; then + AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64]) + fi + else + AC_MSG_RESULT(none) + fi +elif test x$ac_cv_sizeof___int64 = x8; then + # __int64 is a 64 bit integer. + AC_MSG_CHECKING(for format to printf and scanf a guint64) + # We know this is MSVCRT.DLL, and what the formats are + glib_cv_long_long_format=I64 + AC_MSG_RESULT(%${glib_cv_long_long_format}u) + AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long]) + AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing 64-bit integers with format I64]) +fi + +# check additional type sizes +AC_CHECK_SIZEOF(size_t) + +dnl Try to figure out whether gsize, gssize should be long or int +AC_MSG_CHECKING([for the appropriate definition for size_t]) + +case $ac_cv_sizeof_size_t in + $ac_cv_sizeof_short) + glib_size_type=short + ;; + $ac_cv_sizeof_int) + glib_size_type=int + ;; + $ac_cv_sizeof_long) + glib_size_type=long + ;; + $ac_cv_sizeof_long_long) + glib_size_type='long long' + ;; + $ac_cv_sizeof__int64) + glib_size_type='__int64' + ;; + *) AC_MSG_ERROR([No type matching size_t in size]) + ;; +esac + +dnl If int/long are the same size, we see which one produces +dnl warnings when used in the location as size_t. (This matters +dnl on AIX with xlc) +dnl +if test $ac_cv_sizeof_size_t = $ac_cv_sizeof_int && + test $ac_cv_sizeof_size_t = $ac_cv_sizeof_long ; then + GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[ +#if defined(_AIX) && !defined(__GNUC__) +#pragma options langlvl=stdc89 +#endif +#include +int main () +{ + size_t s = 1; + unsigned int *size_int = &s; + return (int)*size_int; +} + ]])],glib_size_type=int, + [GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[ +#if defined(_AIX) && !defined(__GNUC__) +#pragma options langlvl=stdc89 +#endif +#include +int main () +{ + size_t s = 1; + unsigned long *size_long = &s; + return (int)*size_long; +} + ]])],glib_size_type=long)]) +fi + +AC_MSG_RESULT(unsigned $glib_size_type) + +# Check for some functions +AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem) +AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid) +AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat) +# Check for high-resolution sleep functions +AC_CHECK_FUNCS(splice) + +# Check if bcopy can be used for overlapping copies, if memmove isn't found. +# The check is borrowed from the PERL Configure script. +if test "$ac_cv_func_memmove" != "yes"; then + AC_CACHE_CHECK(whether bcopy can handle overlapping copies, + glib_cv_working_bcopy,[AC_TRY_RUN([ + int main() { + char buf[128], abc[128], *b; + int len, off, align; + bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); + for (align = 7; align >= 0; align--) { + for (len = 36; len; len--) { + b = buf+align; bcopy(abc, b, len); + for (off = 1; off <= len; off++) { + bcopy(b, b+off, len); bcopy(b+off, b, len); + if (bcmp(b, abc, len)) return(1); + } + } + } + return(0); + }],glib_cv_working_bcopy=yes,glib_cv_working_bcopy=no)]) + + GLIB_ASSERT_SET(glib_cv_working_bcopy) + if test "$glib_cv_working_bcopy" = "yes"; then + AC_DEFINE(HAVE_WORKING_BCOPY,1,[Have a working bcopy]) + fi +fi + +# Check for sys_errlist +AC_MSG_CHECKING(for sys_errlist) +AC_TRY_LINK(, [ +extern char *sys_errlist[]; +extern int sys_nerr; +sys_errlist[sys_nerr-1][0] = 0; +], glib_ok=yes, glib_ok=no) +AC_MSG_RESULT($glib_ok) +if test "$glib_ok" = "no"; then + AC_DEFINE(NO_SYS_ERRLIST,1,[global 'sys_errlist' not found]) +fi + + +dnl va_copy checks +dnl we currently check for all three va_copy possibilities, so we get +dnl all results in config.log for bug reports. +AC_CACHE_CHECK([for an implementation of va_copy()],glib_cv_va_copy,[ + AC_LINK_IFELSE([AC_LANG_SOURCE([[#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + }]])], + [glib_cv_va_copy=yes], + [glib_cv_va_copy=no]) +]) +AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[ + AC_LINK_IFELSE([AC_LANG_SOURCE([[#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + __va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + }]])], + [glib_cv___va_copy=yes], + [glib_cv___va_copy=no]) +]) + +if test "x$glib_cv_va_copy" = "xyes"; then + g_va_copy_func=va_copy +else if test "x$glib_cv___va_copy" = "xyes"; then + g_va_copy_func=__va_copy +fi +fi + +if test -n "$g_va_copy_func"; then + AC_DEFINE_UNQUOTED(G_VA_COPY,$g_va_copy_func,[A 'va_copy' style function]) +fi + +AC_CACHE_CHECK([whether va_lists can be copied by value],glib_cv_va_val_copy,[ + AC_TRY_RUN([#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + args2 = args1; + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + }], + [glib_cv_va_val_copy=yes], + [glib_cv_va_val_copy=no], + [glib_cv_va_val_copy=yes]) +]) + +if test "x$glib_cv_va_val_copy" = "xno"; then + AC_DEFINE(G_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values]) +fi + +dnl *********************** +dnl *** g_module checks *** +dnl *********************** +G_MODULE_LIBS= +G_MODULE_LIBS_EXTRA= +G_MODULE_PLUGIN_LIBS= +if test x"$glib_native_win32" = xyes; then + dnl No use for this on Win32 + G_MODULE_LDFLAGS= +else + export SED + G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` +fi +dnl G_MODULE_IMPL= don't reset, so cmd-line can override +G_MODULE_NEED_USCORE=0 +G_MODULE_BROKEN_RTLD_GLOBAL=0 +G_MODULE_HAVE_DLERROR=0 +dnl *** force native WIN32 shared lib loader +if test -z "$G_MODULE_IMPL"; then + case "$host" in + *-*-mingw*|*-*-cygwin*) G_MODULE_IMPL=G_MODULE_IMPL_WIN32 ;; + esac +fi +dnl *** force native AIX library loader +dnl *** dlopen() filepath must be of the form /path/libname.a(libname.so) +if test -z "$G_MODULE_IMPL"; then + case "$host" in + *-*-aix*) G_MODULE_IMPL=G_MODULE_IMPL_AR ;; + esac +fi +dnl *** dlopen() and dlsym() in system libraries +if test -z "$G_MODULE_IMPL"; then + AC_CHECK_FUNC(dlopen, + [AC_CHECK_FUNC(dlsym, + [G_MODULE_IMPL=G_MODULE_IMPL_DL],[])], + []) +fi +dnl *** load_image (BeOS) +if test -z "$G_MODULE_IMPL" && test "x$glib_native_beos" = "xyes"; then + AC_CHECK_LIB(root, load_image, + [G_MODULE_LIBS="-lbe -lroot -lglib-2.0 " + G_MODULE_LIBS_EXTRA="-L\$(top_builddir_full)/.libs" + G_MODULE_PLUGIN_LIBS="-L\$(top_builddir_full)/gmodule/.libs -lgmodule" + G_MODULE_IMPL=G_MODULE_IMPL_BEOS], + []) +fi +dnl *** NSLinkModule (dyld) in system libraries (Darwin) +if test -z "$G_MODULE_IMPL"; then + AC_CHECK_FUNC(NSLinkModule, + [G_MODULE_IMPL=G_MODULE_IMPL_DYLD + G_MODULE_NEED_USCORE=1], + []) +fi +dnl *** dlopen() and dlsym() in libdl +if test -z "$G_MODULE_IMPL"; then + AC_CHECK_LIB(dl, dlopen, + [AC_CHECK_LIB(dl, dlsym, + [G_MODULE_LIBS=-ldl + G_MODULE_IMPL=G_MODULE_IMPL_DL],[])], + []) +fi +dnl *** shl_load() in libdld (HP-UX) +if test -z "$G_MODULE_IMPL"; then + AC_CHECK_LIB(dld, shl_load, + [G_MODULE_LIBS=-ldld + G_MODULE_IMPL=G_MODULE_IMPL_DLD], + []) +fi +dnl *** additional checks for G_MODULE_IMPL_DL +if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then + LIBS_orig="$LIBS" + LDFLAGS_orig="$LDFLAGS" + LIBS="$G_MODULE_LIBS $LIBS" + LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS" +dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness + echo "void glib_plugin_test(void) { }" > plugin.c + ${SHELL} ./libtool --mode=compile ${CC} -shared \ + -export-dynamic -o plugin.o plugin.c 2>&1 >/dev/null + AC_CACHE_CHECK([for RTLD_GLOBAL brokenness], + glib_cv_rtldglobal_broken,[ + AC_TRY_RUN([ +#include +#ifndef RTLD_GLOBAL +# define RTLD_GLOBAL 0 +#endif +#ifndef RTLD_LAZY +# define RTLD_LAZY 0 +#endif +int glib_plugin_test; +int main () { + void *handle, *global, *local; + global = &glib_plugin_test; + handle = dlopen ("./.libs/plugin.o", RTLD_GLOBAL | RTLD_LAZY); + if (!handle) return 0; + local = dlsym (handle, "glib_plugin_test"); + return global == local; +} ], + [glib_cv_rtldglobal_broken=no], + [glib_cv_rtldglobal_broken=yes], + [glib_cv_rtldglobal_broken=no]) + rm -f plugin.c plugin.o plugin.lo .libs/plugin.o + rmdir .libs 2>/dev/null + ]) + if test "x$glib_cv_rtldglobal_broken" = "xyes"; then + G_MODULE_BROKEN_RTLD_GLOBAL=1 + else + G_MODULE_BROKEN_RTLD_GLOBAL=0 + fi +dnl *** check whether we need preceeding underscores + AC_CACHE_CHECK([for preceeding underscore in symbols], + glib_cv_uscore,[ + AC_TRY_RUN([#include + int glib_underscore_test (void) { return 42; } + int main() { + void *f1 = (void*)0, *f2 = (void*)0, *handle; + handle = dlopen ((void*)0, 0); + if (handle) { + f1 = dlsym (handle, "glib_underscore_test"); + f2 = dlsym (handle, "_glib_underscore_test"); + } return (!f2 || f1); + }], + [glib_cv_uscore=yes], + [glib_cv_uscore=no], + []) + rm -f plugin.c plugin.$ac_objext plugin.lo + ]) + GLIB_ASSERT_SET(glib_cv_uscore) + if test "x$glib_cv_uscore" = "xyes"; then + G_MODULE_NEED_USCORE=1 + else + G_MODULE_NEED_USCORE=0 + fi + + LDFLAGS="$LDFLAGS_orig" +dnl *** check for having dlerror() + AC_CHECK_FUNC(dlerror, + [G_MODULE_HAVE_DLERROR=1], + [G_MODULE_HAVE_DLERROR=0]) + LIBS="$LIBS_orig" +fi +dnl *** done, have we got an implementation? +if test -z "$G_MODULE_IMPL"; then + G_MODULE_IMPL=0 + G_MODULE_SUPPORTED=false +else + G_MODULE_SUPPORTED=true +fi + +AC_MSG_CHECKING(for the suffix of module shared libraries) +export SED +shrext_cmds=`./libtool --config | grep '^shrext_cmds='` +eval $shrext_cmds +module=yes eval std_shrext=$shrext_cmds +# chop the initial dot +glib_gmodule_suffix=`echo $std_shrext | sed 's/^\.//'` +AC_MSG_RESULT(.$glib_gmodule_suffix) +# any reason it may fail? +if test "x$glib_gmodule_suffix" = x; then + AC_MSG_ERROR(Cannot determine shared library suffix from libtool) +fi + +AC_SUBST(G_MODULE_SUPPORTED) +AC_SUBST(G_MODULE_IMPL) +AC_SUBST(G_MODULE_LIBS) +AC_SUBST(G_MODULE_LIBS_EXTRA) +AC_SUBST(G_MODULE_PLUGIN_LIBS) +AC_SUBST(G_MODULE_LDFLAGS) +AC_SUBST(G_MODULE_HAVE_DLERROR) +AC_SUBST(G_MODULE_BROKEN_RTLD_GLOBAL) +AC_SUBST(G_MODULE_NEED_USCORE) +AC_SUBST(GLIB_DEBUG_FLAGS) + +dnl AC_C_INLINE is useless to us since it bails out too early, we need to +dnl truely know which ones of `inline', `__inline' and `__inline__' are +dnl actually supported. +AC_CACHE_CHECK([for __inline],glib_cv_has__inline,[ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + __inline int foo () { return 0; } + int main () { return foo (); } + ]])], + glib_cv_has__inline=yes + , + glib_cv_has__inline=no + ,) +]) +case x$glib_cv_has__inline in +xyes) AC_DEFINE(G_HAVE___INLINE,1,[Have __inline keyword]) +esac +AC_CACHE_CHECK([for __inline__],glib_cv_has__inline__,[ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + __inline__ int foo () { return 0; } + int main () { return foo (); } + ]])], + glib_cv_has__inline__=yes + , + glib_cv_has__inline__=no + ,) +]) +case x$glib_cv_has__inline__ in +xyes) AC_DEFINE(G_HAVE___INLINE__,1,[Have __inline__ keyword]) +esac +AC_CACHE_CHECK([for inline], glib_cv_hasinline,[ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #undef inline + inline int foo () { return 0; } + int main () { return foo (); } + ]])], + glib_cv_hasinline=yes + , + glib_cv_hasinline=no + ,) +]) +case x$glib_cv_hasinline in +xyes) AC_DEFINE(G_HAVE_INLINE,1,[Have inline keyword]) +esac + +# if we can use inline functions in headers +AC_MSG_CHECKING(if inline functions in headers work) +AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__) +# undef inline +# define inline __inline__ +#elif !defined (G_HAVE_INLINE) +# undef inline +# if defined (G_HAVE___INLINE__) +# define inline __inline__ +# elif defined (G_HAVE___INLINE) +# define inline __inline +# endif +#endif + +int glib_test_func2 (int); + +static inline int +glib_test_func1 (void) { + return glib_test_func2 (1); +} + +int +main (void) { + int i = 1; +}]])],[g_can_inline=yes],[g_can_inline=no]) +AC_MSG_RESULT($g_can_inline) + +# check for flavours of varargs macros +AC_MSG_CHECKING(for ISO C99 varargs macros in C) +AC_TRY_COMPILE([],[ +int a(int p1, int p2, int p3); +#define call_a(...) a(1,__VA_ARGS__) +call_a(2,3); +],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no) +AC_MSG_RESULT($g_have_iso_c_varargs) + +AC_MSG_CHECKING(for ISO C99 varargs macros in C++) +if test "$CXX" = ""; then +dnl No C++ compiler + g_have_iso_cxx_varargs=no +else + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([],[ +int a(int p1, int p2, int p3); +#define call_a(...) a(1,__VA_ARGS__) +call_a(2,3); +],g_have_iso_cxx_varargs=yes,g_have_iso_cxx_varargs=no) + AC_LANG_C +fi +AC_MSG_RESULT($g_have_iso_cxx_varargs) + +AC_MSG_CHECKING(for GNUC varargs macros) +AC_TRY_COMPILE([],[ +int a(int p1, int p2, int p3); +#define call_a(params...) a(1,params) +call_a(2,3); +],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no) +AC_MSG_RESULT($g_have_gnuc_varargs) + +AC_MSG_CHECKING([for EILSEQ]) +AC_TRY_COMPILE([ +#include +], +[ +int error = EILSEQ; +], have_eilseq=yes, have_eilseq=no); +AC_MSG_RESULT($have_eilseq) + +# check for GNUC visibility support +AC_MSG_CHECKING(for GNUC visibility attribute) +GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[ +void +__attribute__ ((visibility ("hidden"))) + f_hidden (void) +{ +} +void +__attribute__ ((visibility ("internal"))) + f_internal (void) +{ +} +void +__attribute__ ((visibility ("protected"))) + f_protected (void) +{ +} +void +__attribute__ ((visibility ("default"))) + f_default (void) +{ +} +int main (int argc, char **argv) +{ + f_hidden(); + f_internal(); + f_protected(); + f_default(); + return 0; +} +]])],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no) +AC_MSG_RESULT($g_have_gnuc_visibility) + +# check for bytesex stuff +AC_C_BIGENDIAN +if test x$ac_cv_c_bigendian = xuniversal ; then +AC_TRY_COMPILE([#include ], [#if __BYTE_ORDER == __BIG_ENDIAN +#else +#error Not a big endian. +#endif], + ac_cv_c_bigendian=yes + ,AC_TRY_COMPILE([#include ], [#if __BYTE_ORDER == __LITTLE_ENDIAN +#else +#error Not a little endian. +#endif], + ac_cv_c_bigendian=no + ,AC_MSG_WARN([Could not determine endianness.]))) +fi + + +# check for header files +AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h grp.h sys/param.h sys/poll.h sys/resource.h]) +AC_CHECK_HEADERS([sys/time.h sys/times.h sys/wait.h unistd.h values.h]) +AC_CHECK_HEADERS([sys/select.h sys/types.h stdint.h inttypes.h sched.h malloc.h]) +AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h]) +AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h]) +AC_CHECK_HEADERS([sys/uio.h sys/mkdev.h]) +AC_CHECK_HEADERS([linux/magic.h]) + +AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [], +[#if HAVE_SYS_PARAM_H + #include + #endif +]) + +# check for structure fields +AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include +#include +#include +#ifdef HAVE_SYS_STATFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif]) +# struct statvfs.f_basetype is available on Solaris but not for Linux. +AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [#include ]) +AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [#include ]) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[#include ]) + +dnl error and warning message +dnl ************************* + +THREAD_NO_IMPLEMENTATION="You do not have any known thread system on your + computer. GLib will not have a default thread implementation." + +FLAG_DOES_NOT_WORK="I can't find the MACRO to enable thread safety on your + platform (normally it's "_REENTRANT"). I'll not use any flag on + compilation now, but then your programs might not work. + Please provide information on how it is done on your system." + +LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation + " + +LIBS_NOT_FOUND_2=". Please choose another thread implementation or + provide information on your thread implementation. + You can also run 'configure --disable-threads' + to compile without thread support." + +FUNC_NO_GETPWUID_R="the 'g_get_(user_name|real_name|home_dir|tmp_dir)' + functions will not be MT-safe during their first call because + there is no working 'getpwuid_r' on your system." + +FUNC_NO_LOCALTIME_R="the 'g_date_set_time' function will not be MT-safe + because there is no 'localtime_r' on your system." + +POSIX_NO_YIELD="I can not find a yield functions for your platform. A rather + crude surrogate will be used. If you happen to know a + yield function for your system, please inform the GLib + developers." + +POSIX_NO_PRIORITIES="I can not find the minimal and maximal priorities for + threads on your system. Thus threads can only have the default + priority. If you happen to know these main/max + priorities, please inform the GLib developers." + +AIX_COMPILE_INFO="AIX's C compiler needs to be called by a different name, when + linking threaded applications. As GLib cannot do that + automatically, you will get an linkg error everytime you are + not using the right compiler. In that case you have to relink + with the right compiler. Ususally just '_r' is appended + to the compiler name." + +dnl determination of thread implementation +dnl *************************************** + +# have_threads=no means no thread support +# have_threads=none means no default thread implementation + +have_threads=no +if test "x$want_threads" = xyes || test "x$want_threads" = xposix \ + || test "x$want_threads" = xdce; then + # -D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE is for DG/UX + # -U_OSF_SOURCE is for Digital UNIX 4.0d + GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE" + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + if test "x$have_threads" = xno; then + AC_TRY_COMPILE([#include ], + [pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;], + have_threads=posix) + fi + if test "x$have_threads" = xno; then + AC_TRY_COMPILE([#include ], + [pthread_mutex_t m; + pthread_mutex_init (&m, pthread_mutexattr_default);], + have_threads=dce) + fi + # Tru64Unix requires -pthread to find pthread.h. See #103020 + CPPFLAGS="$CPPFLAGS -pthread" + if test "x$have_threads" = xno; then + AC_TRY_COMPILE([#include ], + [pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;], + have_threads=posix) + fi + CPPFLAGS="$glib_save_CPPFLAGS" +fi +if test "x$want_threads" = xyes || test "x$want_threads" = xwin32; then + case $host in + *-*-mingw*) + have_threads=win32 + ;; + esac +fi +if test "x$want_threads" = xnone; then + have_threads=none +fi + +AC_MSG_CHECKING(for thread implementation) + +if test "x$have_threads" = xno && test "x$want_threads" != xno; then + AC_MSG_RESULT(none available) + AC_MSG_WARN($THREAD_NO_IMPLEMENTATION) +else + AC_MSG_RESULT($have_threads) +fi + + +dnl determination of G_THREAD_CFLAGS +dnl ******************************** + +G_THREAD_LIBS= +G_THREAD_LIBS_EXTRA= +G_THREAD_CFLAGS= + +dnl +dnl Test program for sched_get_priority_min() +dnl +m4_define([glib_sched_priority_test],[ +#include +#include +int main() { + errno = 0; + return sched_get_priority_min(SCHED_OTHER)==-1 + && errno != 0; +}]) + +if test x"$have_threads" != xno; then + + if test x"$have_threads" = xposix; then + # First we test for posix, whether -pthread or -pthreads do the trick as + # both CPPFLAG and LIBS. + # One of them does for most gcc versions and some other platforms/compilers + # too and could be considered as the canonical way to go. + case $host in + *-*-cygwin*|*-*-darwin*) + # skip cygwin and darwin -pthread or -pthreads test + ;; + *-solaris*) + # These compiler/linker flags work with both Sun Studio and gcc + # Sun Studio expands -mt to -D_REENTRANT and -lthread + # gcc expands -pthreads to -D_REENTRANT -D_PTHREADS -lpthread + G_THREAD_CFLAGS="-D_REENTRANT -D_PTHREADS" + G_THREAD_LIBS="-lpthread -lthread" + ;; + *) + for flag in pthread pthreads mt; do + glib_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -$flag" + AC_TRY_RUN(glib_thread_test(0), + glib_flag_works=yes, + glib_flag_works=no, + [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_thread_test(0))], + glib_flag_works=yes, + glib_flag_works=no)]) + CFLAGS="$glib_save_CFLAGS" + if test $glib_flag_works = yes ; then + G_THREAD_CFLAGS=-$flag + G_THREAD_LIBS=-$flag + break; + fi + done + ;; + esac + fi + + if test x"$G_THREAD_CFLAGS" = x; then + + # The canonical -pthread[s] does not work. Try something different. + + case $host in + *-aix*) + if test x"$GCC" = xyes; then + # GCC 3.0 and above needs -pthread. + # Should be coverd by the case above. + # GCC 2.x and below needs -mthreads + G_THREAD_CFLAGS="-mthreads" + G_THREAD_LIBS=$G_THREAD_CFLAGS + else + # We are probably using the aix compiler. Normaly a + # program would have to be compiled with the _r variant + # of the corresponding compiler, but we as GLib cannot + # do that: but the good news is that for compiling the + # only difference is the added -D_THREAD_SAFE compile + # option. This is according to the "C for AIX User's + # Guide". + G_THREAD_CFLAGS="-D_THREAD_SAFE" + fi + ;; + *-dg-dgux*) # DG/UX + G_THREAD_CFLAGS="-D_REENTRANT -D_POSIX4A_DRAFT10_SOURCE" + ;; + *-osf*) + # So we are using dce threads. posix threads are already + # catched above. + G_THREAD_CFLAGS="-threads" + G_THREAD_LIBS=$G_THREAD_CFLAGS + ;; + *-sysv5uw7*) # UnixWare 7 + # We are not using gcc with -pthread. Catched above. + G_THREAD_CFLAGS="-Kthread" + G_THREAD_LIBS=$G_THREAD_CFLAGS + ;; + *-mingw*) + # No flag needed when using MSVCRT.DLL + G_THREAD_CFLAGS="" + ;; + *) + G_THREAD_CFLAGS="-D_REENTRANT" # good default guess otherwise + ;; + esac + + fi + + # if we are not finding the localtime_r function, then we probably are + # not using the proper multithread flag + + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS" + + # First we test, whether localtime_r is declared in time.h + # directly. Then we test whether a macro localtime_r exists, in + # which case localtime_r in the test program is replaced and thus + # if we still find localtime_r in the output, it is not defined as + # a macro. + + AC_EGREP_CPP([[^a-zA-Z1-9_]localtime_r[^a-zA-Z1-9_]], [#include ], , + [AC_EGREP_CPP([[^a-zA-Z1-9_]localtime_r[^a-zA-Z1-9_]], [#include + localtime_r(a,b)], + AC_MSG_WARN($FLAG_DOES_NOT_WORK))]) + + CPPFLAGS="$glib_save_CPPFLAGS" + + AC_MSG_CHECKING(thread related cflags) + AC_MSG_RESULT($G_THREAD_CFLAGS) + CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS" +fi + +dnl determination of G_THREAD_LIBS +dnl ****************************** + +mutex_has_default=no +case $have_threads in + posix|dce) + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + if test x"$G_THREAD_LIBS" = x; then + case $host in + *-aix*) + # We are not using gcc (would have set G_THREAD_LIBS) and thus + # probably using the aix compiler. + AC_MSG_WARN($AIX_COMPILE_INFO) + ;; + *) + G_THREAD_LIBS=error + glib_save_LIBS="$LIBS" + for thread_lib in "" pthread pthread32 pthreads thread dce; do + if test x"$thread_lib" = x; then + add_thread_lib="" + IN="" + else + add_thread_lib="-l$thread_lib" + IN=" in -l$thread_lib" + fi + if test x"$have_threads" = xposix; then + defattr=0 + else + defattr=pthread_attr_default + fi + + LIBS="$add_thread_lib $glib_save_LIBS" + + AC_MSG_CHECKING(for pthread_create/pthread_join$IN) + AC_TRY_RUN(glib_thread_test([$defattr]), + glib_result=yes, + glib_result=no, + [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_thread_test([$defattr]))], + glib_result=yes, + glib_result=no)]) + AC_MSG_RESULT($glib_result) + + if test "$glib_result" = "yes" ; then + G_THREAD_LIBS="$add_thread_lib" + break + fi + done + if test "x$G_THREAD_LIBS" = xerror; then + AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2) + fi + LIBS="$glib_save_LIBS" + ;; + esac + fi + + glib_save_LIBS="$LIBS" + for thread_lib in "" rt rte; do + if test x"$thread_lib" = x; then + add_thread_lib="" + IN="" + else + add_thread_lib="-l$thread_lib" + IN=" in -l$thread_lib" + fi + LIBS="$add_thread_lib $glib_save_LIBS" + + AC_MSG_CHECKING(for sched_get_priority_min$IN) + AC_TRY_RUN(glib_sched_priority_test, + glib_result=yes, + glib_result=no, + [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_sched_priority_test)], + glib_result=yes, + glib_result=no)]) + AC_MSG_RESULT($glib_result) + + if test "$glib_result" = "yes" ; then + G_THREAD_LIBS="$G_THREAD_LIBS $add_thread_lib" + posix_priority_min="sched_get_priority_min(SCHED_OTHER)" + posix_priority_max="sched_get_priority_max(SCHED_OTHER)" + break + fi + done + LIBS="$glib_save_LIBS" + mutex_has_default=yes + mutex_default_type='pthread_mutex_t' + mutex_default_init='PTHREAD_MUTEX_INITIALIZER' + mutex_header_file='pthread.h' + if test "x$have_threads" = "xposix"; then + g_threads_impl="POSIX" + else + g_threads_impl="DCE" + have_threads="posix" + fi + AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES) + CPPFLAGS="$glib_save_CPPFLAGS" + ;; + win32) + g_threads_impl="WIN32" + ;; + none|no) + g_threads_impl="NONE" + ;; + *) + g_threads_impl="NONE" + G_THREAD_LIBS=error + ;; +esac + +if test "x$G_THREAD_LIBS" = xerror; then + AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2) +fi + +AC_MSG_CHECKING(thread related libraries) +AC_MSG_RESULT($G_THREAD_LIBS) + +dnl check for mt safe function variants and some posix functions +dnl ************************************************************ + +if test x"$have_threads" != xno; then + glib_save_LIBS="$LIBS" + # we are not doing the following for now, as this might require glib + # to always be linked with the thread libs on some platforms. + # LIBS="$LIBS $G_THREAD_LIBS" + AC_CHECK_FUNCS(localtime_r gmtime_r) + if test "$ac_cv_header_pwd_h" = "yes"; then + AC_CACHE_CHECK([for posix getpwuid_r], + ac_cv_func_posix_getpwuid_r, + [AC_TRY_RUN([ +#include +#include +int main () { + char buffer[10000]; + struct passwd pwd, *pwptr = &pwd; + int error; + errno = 0; + error = getpwuid_r (0, &pwd, buffer, + sizeof (buffer), &pwptr); + return (error < 0 && errno == ENOSYS) + || error == ENOSYS; +} ], + [ac_cv_func_posix_getpwuid_r=yes], + [ac_cv_func_posix_getpwuid_r=no])]) + GLIB_ASSERT_SET(ac_cv_func_posix_getpwuid_r) + if test "$ac_cv_func_posix_getpwuid_r" = yes; then + AC_DEFINE(HAVE_POSIX_GETPWUID_R,1, + [Have POSIX function getpwuid_r]) + else + AC_CACHE_CHECK([for nonposix getpwuid_r], + ac_cv_func_nonposix_getpwuid_r, + [AC_TRY_LINK([#include ], + [char buffer[10000]; + struct passwd pwd; + getpwuid_r (0, &pwd, buffer, + sizeof (buffer));], + [ac_cv_func_nonposix_getpwuid_r=yes], + [ac_cv_func_nonposix_getpwuid_r=no])]) + GLIB_ASSERT_SET(ac_cv_func_nonposix_getpwuid_r) + if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then + AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1, + [Have non-POSIX function getpwuid_r]) + fi + fi + fi + if test "$ac_cv_header_grp_h" = "yes"; then + AC_CACHE_CHECK([for posix getgrgid_r], + ac_cv_func_posix_getgrgid_r, + [AC_TRY_RUN([ +#include +#include +int main () { + char buffer[10000]; + struct group grp, *grpptr = &grp; + int error; + errno = 0; + error = getgrgid_r (0, &grp, buffer, + sizeof (buffer), &grpptr); + return (error < 0 && errno == ENOSYS) + || error == ENOSYS; +} ], + [ac_cv_func_posix_getgrgid_r=yes], + [ac_cv_func_posix_getgrgid_r=no])]) + GLIB_ASSERT_SET(ac_cv_func_posix_getgrgid_r) + if test "$ac_cv_func_posix_getgrgid_r" = yes; then + AC_DEFINE(HAVE_POSIX_GETGRGID_R,1, + [Have POSIX function getgrgid_r]) + else + AC_CACHE_CHECK([for nonposix getgrgid_r], + ac_cv_func_nonposix_getgrgid_r, + [AC_TRY_LINK([#include ], + [char buffer[10000]; + struct group grp; + getgrgid_r (0, &grp, buffer, + sizeof (buffer));], + [ac_cv_func_nonposix_getgrgid_r=yes], + [ac_cv_func_nonposix_getgrgid_r=no])]) + GLIB_ASSERT_SET(ac_cv_func_nonposix_getgrgid_r) + if test "$ac_cv_func_nonposix_getgrgid_r" = yes; then + AC_DEFINE(HAVE_NONPOSIX_GETGRGID_R,1, + [Have non-POSIX function getgrgid_r]) + fi + fi + fi + LIBS="$G_THREAD_LIBS $LIBS" + if test x"$have_threads" = xposix; then + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + dnl we might grow sizeof(pthread_t) later on, so use a dummy name here + GLIB_SIZEOF([#include ], pthread_t, system_thread) + # This is not AC_CHECK_FUNC to also work with function + # name mangling in header files. + AC_MSG_CHECKING(for pthread_attr_setstacksize) + AC_TRY_LINK([#include ], + [pthread_attr_t t; pthread_attr_setstacksize(&t,0)], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE,1, + [Have function pthread_attr_setstacksize])], + [AC_MSG_RESULT(no)]) + AC_MSG_CHECKING(for minimal/maximal thread priority) + if test x"$posix_priority_min" = x; then + AC_EGREP_CPP(PX_PRIO_MIN,[#include + PX_PRIO_MIN],,[ + posix_priority_min=PX_PRIO_MIN + posix_priority_max=PX_PRIO_MAX]) + fi + if test x"$posix_priority_min" = x; then + # AIX + AC_EGREP_CPP(PTHREAD_PRIO_MIN,[#include + PTHREAD_PRIO_MIN],,[ + posix_priority_min=PTHREAD_PRIO_MIN + posix_priority_max=PTHREAD_PRIO_MAX]) + fi + if test x"$posix_priority_min" = x; then + AC_EGREP_CPP(PRI_OTHER_MIN,[#include + PRI_OTHER_MIN],,[ + posix_priority_min=PRI_OTHER_MIN + posix_priority_max=PRI_OTHER_MAX]) + fi + if test x"$posix_priority_min" = x; then + AC_MSG_RESULT(none found) + AC_MSG_WARN($POSIX_NO_PRIORITIES) + posix_priority_min=-1 + posix_priority_max=-1 + else + AC_MSG_RESULT($posix_priority_min/$posix_priority_max) + AC_MSG_CHECKING(for pthread_setschedparam) + AC_TRY_LINK([#include ], + [pthread_t t; pthread_setschedparam(t, 0, NULL)], + [AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(POSIX_MIN_PRIORITY,$posix_priority_min,[Minimum POSIX RT priority]) + AC_DEFINE_UNQUOTED(POSIX_MAX_PRIORITY,$posix_priority_max,[Maximum POSIX RT priority])], + [AC_MSG_RESULT(no) + AC_MSG_WARN($POSIX_NO_PRIORITIES)]) + fi + posix_yield_func=none + AC_MSG_CHECKING(for posix yield function) + for yield_func in sched_yield pthread_yield_np pthread_yield \ + thr_yield; do + AC_TRY_LINK([#include ], + [$yield_func()], + [posix_yield_func="$yield_func" + break]) + done + if test x"$posix_yield_func" = xnone; then + AC_MSG_RESULT(none found) + AC_MSG_WARN($POSIX_NO_YIELD) + posix_yield_func="g_usleep(1000)" + else + AC_MSG_RESULT($posix_yield_func) + posix_yield_func="$posix_yield_func()" + fi + AC_DEFINE_UNQUOTED(POSIX_YIELD_FUNC,$posix_yield_func,[The POSIX RT yield function]) + CPPFLAGS="$glib_save_CPPFLAGS" + + elif test x"$have_threads" = xwin32; then + # It's a pointer to a private struct + GLIB_SIZEOF(,struct _GThreadData *, system_thread) + fi + + LIBS="$glib_save_LIBS" + + # now spit out all the warnings. + if test "$ac_cv_func_posix_getpwuid_r" != "yes" && + test "$ac_cv_func_nonposix_getpwuid_r" != "yes"; then + AC_MSG_WARN($FUNC_NO_GETPWUID_R) + fi + if test "$ac_cv_func_localtime_r" != "yes"; then + AC_MSG_WARN($FUNC_NO_LOCALTIME_R) + fi +fi + +if test x"$glib_cv_sizeof_system_thread" = x; then + # use a pointer as a fallback. + GLIB_SIZEOF(,void *, system_thread) +fi + +# +# Hack to deal with: +# +# a) GCC < 3.3 for Linux doesn't include -lpthread when +# building shared libraries with linux. +# b) FreeBSD doesn't do this either. +# +case $host in + *-*-freebsd*|*-*-linux*) + G_THREAD_LIBS_FOR_GTHREAD="`echo $G_THREAD_LIBS | sed s/-pthread/-lpthread/`" + ;; + *-*-openbsd*) + LDFLAGS="$LDFLAGS -pthread" + ;; + *) + G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS" + ;; +esac + +AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c", + [Source file containing theread implementation]) +AC_SUBST(G_THREAD_CFLAGS) +AC_SUBST(G_THREAD_LIBS) +AC_SUBST(G_THREAD_LIBS_FOR_GTHREAD) +AC_SUBST(G_THREAD_LIBS_EXTRA) + +dnl ********************************************** +dnl *** GDefaultMutex setup and initialization *** +dnl ********************************************** +dnl +dnl if mutex_has_default = yes, we also got +dnl mutex_default_type, mutex_default_init and mutex_header_file +if test $mutex_has_default = yes ; then + glib_save_CPPFLAGS="$CPPFLAGS" + glib_save_LIBS="$LIBS" + LIBS="$G_THREAD_LIBS $LIBS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + GLIB_SIZEOF([#include <$mutex_header_file>], + $mutex_default_type, + gmutex) + GLIB_BYTE_CONTENTS([#include <$mutex_header_file>], + $mutex_default_type, + gmutex, + $glib_cv_sizeof_gmutex, + $mutex_default_init) + if test x"$glib_cv_byte_contents_gmutex" = xno; then + mutex_has_default=no + fi + CPPFLAGS="$glib_save_CPPFLAGS" + LIBS="$glib_save_LIBS" +fi + +dnl ************************ +dnl *** g_atomic_* tests *** +dnl ************************ + +AC_MSG_CHECKING([whether to use assembler code for atomic operations]) + case $host_cpu in + i386) + AC_MSG_RESULT([none]) + glib_memory_barrier_needed=no + ;; + i?86) + AC_MSG_RESULT([i486]) + AC_DEFINE_UNQUOTED(G_ATOMIC_I486, 1, + [i486 atomic implementation]) + glib_memory_barrier_needed=no + ;; + sparc*) + SPARCV9_WARNING="Try to rerun configure with CFLAGS='-mcpu=v9', + when you are using a sparc with v9 instruction set (most + sparcs nowadays). This will make the code for atomic + operations much faster. The resulting code will not run + on very old sparcs though." + + AC_LINK_IFELSE([AC_LANG_SOURCE([[ + main () + { + int tmp1, tmp2, tmp3; + __asm__ __volatile__("casx [%2], %0, %1" + : "=&r" (tmp1), "=&r" (tmp2) : "r" (&tmp3)); + }]])], + AC_MSG_RESULT([sparcv9]) + AC_DEFINE_UNQUOTED(G_ATOMIC_SPARCV9, 1, + [sparcv9 atomic implementation]), + AC_MSG_RESULT([no]) + AC_MSG_WARN([[$SPARCV9_WARNING]])) + glib_memory_barrier_needed=yes + ;; + alpha*) + AC_MSG_RESULT([alpha]) + AC_DEFINE_UNQUOTED(G_ATOMIC_ALPHA, 1, + [alpha atomic implementation]) + glib_memory_barrier_needed=yes + ;; + x86_64) + AC_MSG_RESULT([x86_64]) + AC_DEFINE_UNQUOTED(G_ATOMIC_X86_64, 1, + [x86_64 atomic implementation]) + glib_memory_barrier_needed=no + ;; + powerpc*) + AC_MSG_RESULT([powerpc]) + AC_DEFINE_UNQUOTED(G_ATOMIC_POWERPC, 1, + [powerpc atomic implementation]) + glib_memory_barrier_needed=yes + AC_MSG_CHECKING([whether asm supports numbered local labels]) + AC_TRY_COMPILE( + ,[ + __asm__ __volatile__ ("1: nop\n" + " bne- 1b") + ],[ + AC_DEFINE_UNQUOTED(ASM_NUMERIC_LABELS, 1, [define if asm blocks can use numeric local labels]) + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) + ;; + ia64) + AC_MSG_RESULT([ia64]) + AC_DEFINE_UNQUOTED(G_ATOMIC_IA64, 1, + [ia64 atomic implementation]) + glib_memory_barrier_needed=yes + ;; + s390|s390x) + AC_MSG_RESULT([s390]) + AC_DEFINE_UNQUOTED(G_ATOMIC_S390, 1, + [s390 atomic implementation]) + glib_memory_barrier_needed=no + ;; + arm*) + AC_MSG_RESULT([arm]) + AC_DEFINE_UNQUOTED(G_ATOMIC_ARM, 1, + [arm atomic implementation]) + glib_memory_barrier_needed=no + ;; + crisv32*|etraxfs*) + AC_MSG_RESULT([crisv32]) + AC_DEFINE_UNQUOTED(G_ATOMIC_CRISV32, 1, + [crisv32 atomic implementation]) + glib_memory_barrier_needed=no + ;; + cris*|etrax*) + AC_MSG_RESULT([cris]) + AC_DEFINE_UNQUOTED(G_ATOMIC_CRIS, 1, + [cris atomic implementation]) + glib_memory_barrier_needed=no + ;; + *) + AC_MSG_RESULT([none]) + glib_memory_barrier_needed=yes + ;; + esac + +glib_cv_gcc_has_builtin_atomic_operations=no +if test x"$GCC" = xyes; then + AC_MSG_CHECKING([whether GCC supports built-in atomic intrinsics]) + AC_TRY_LINK([], + [int i; + __sync_synchronize (); + __sync_bool_compare_and_swap (&i, 0, 1); + __sync_fetch_and_add (&i, 1); + ], + [glib_cv_gcc_has_builtin_atomic_operations=yes], + [glib_cv_gcc_has_builtin_atomic_operations=no]) + + AC_MSG_RESULT($glib_cv_gcc_has_builtin_atomic_operations) +fi + +AC_MSG_CHECKING([for Win32 atomic intrinsics]) +glib_cv_has_win32_atomic_operations=no +AC_TRY_LINK([], + [int i; _InterlockedExchangeAdd (&i, 0);], + [glib_cv_has_win32_atomic_operations=yes], + [glib_cv_has_win32_atomic_operations=no]) +AC_MSG_RESULT($glib_cv_has_win32_atomic_operations) +if test "x$glib_cv_has_win32_atomic_operations" = xyes; then + AC_DEFINE(HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS,1,[Have Win32 atomic intrinsics]) +fi + +dnl ************************ +dnl ** Check for futex(2) ** +dnl ************************ +AC_CACHE_CHECK(for futex(2) system call, + glib_cv_futex,AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +#include +#include +#include +],[ +int +main (void) +{ + /* it is not like this actually runs or anything... */ + syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT); + return 0; +} +])],glib_cv_futex=yes,glib_cv_futex=no)) +if test x"$glib_cv_futex" = xyes; then + AC_DEFINE(HAVE_FUTEX, 1, [we have the futex(2) system call]) +fi + +dnl this section will only be run if config.status is invoked with no +dnl arguments, or with "$1/glibconfig.h" as an argument. +AC_CONFIG_COMMANDS([$1/glibconfig.h], +[ + outfile=$1/glibconfig.h-tmp + cat > $outfile <<\_______EOF +/* glibconfig.h + * + * This is a generated file. Please modify 'configure.ac' + */ + +#ifndef __G_LIBCONFIG_H__ +#define __G_LIBCONFIG_H__ + +#include + +_______EOF + + if test x$glib_limits_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_float_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_values_h = xyes; then + echo '#include ' >> $outfile + fi + if test "$glib_header_alloca_h" = "yes"; then + echo '#define GLIB_HAVE_ALLOCA_H' >> $outfile + fi + if test x$glib_sys_poll_h = xyes; then + echo '#define GLIB_HAVE_SYS_POLL_H' >> $outfile + fi + if test x$glib_included_printf != xyes; then + echo " +/* Specifies that GLib's g_print*() functions wrap the + * system printf functions. This is useful to know, for example, + * when using glibc's register_printf_function(). + */" >> $outfile + echo '#define GLIB_USING_SYSTEM_PRINTF' >> $outfile + fi + + cat >> $outfile <<_______EOF + +G_BEGIN_DECLS + +#define G_MINFLOAT $glib_mf +#define G_MAXFLOAT $glib_Mf +#define G_MINDOUBLE $glib_md +#define G_MAXDOUBLE $glib_Md +#define G_MINSHORT $glib_ms +#define G_MAXSHORT $glib_Ms +#define G_MAXUSHORT $glib_Mus +#define G_MININT $glib_mi +#define G_MAXINT $glib_Mi +#define G_MAXUINT $glib_Mui +#define G_MINLONG $glib_ml +#define G_MAXLONG $glib_Ml +#define G_MAXULONG $glib_Mul + +_______EOF + + + ### this should always be true in a modern C/C++ compiler + cat >>$outfile <<_______EOF +typedef signed char gint8; +typedef unsigned char guint8; +_______EOF + + + if test -n "$gint16"; then + cat >>$outfile <<_______EOF +typedef signed $gint16 gint16; +typedef unsigned $gint16 guint16; +#define G_GINT16_MODIFIER $gint16_modifier +#define G_GINT16_FORMAT $gint16_format +#define G_GUINT16_FORMAT $guint16_format +_______EOF + fi + + + if test -n "$gint32"; then + cat >>$outfile <<_______EOF +typedef signed $gint32 gint32; +typedef unsigned $gint32 guint32; +#define G_GINT32_MODIFIER $gint32_modifier +#define G_GINT32_FORMAT $gint32_format +#define G_GUINT32_FORMAT $guint32_format +_______EOF + fi + + cat >>$outfile <<_______EOF +#define G_HAVE_GINT64 1 /* deprecated, always true */ + +${glib_extension}typedef signed $gint64 gint64; +${glib_extension}typedef unsigned $gint64 guint64; + +#define G_GINT64_CONSTANT(val) $gint64_constant +#define G_GUINT64_CONSTANT(val) $guint64_constant +_______EOF + + if test x$gint64_format != x ; then + cat >>$outfile <<_______EOF +#define G_GINT64_MODIFIER $gint64_modifier +#define G_GINT64_FORMAT $gint64_format +#define G_GUINT64_FORMAT $guint64_format +_______EOF + else + cat >>$outfile <<_______EOF +#undef G_GINT64_MODIFIER +#undef G_GINT64_FORMAT +#undef G_GUINT64_FORMAT +_______EOF + fi + + cat >>$outfile <<_______EOF + +#define GLIB_SIZEOF_VOID_P $glib_void_p +#define GLIB_SIZEOF_LONG $glib_long +#define GLIB_SIZEOF_SIZE_T $glib_size_t + +_______EOF + + cat >>$outfile <<_______EOF +typedef signed $glib_size_type_define gssize; +typedef unsigned $glib_size_type_define gsize; +#define G_GSIZE_MODIFIER $gsize_modifier +#define G_GSSIZE_FORMAT $gssize_format +#define G_GSIZE_FORMAT $gsize_format + +#define G_MAXSIZE G_MAXU$glib_msize_type +#define G_MINSSIZE G_MIN$glib_msize_type +#define G_MAXSSIZE G_MAX$glib_msize_type + +typedef gint64 goffset; +#define G_MINOFFSET G_MININT64 +#define G_MAXOFFSET G_MAXINT64 + +#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER +#define G_GOFFSET_FORMAT G_GINT64_FORMAT +#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val) + +_______EOF + + if test -z "$glib_unknown_void_p"; then + cat >>$outfile <<_______EOF + +#define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p)) +#define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p)) + +#define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i)) +#define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u)) + +typedef signed $glib_intptr_type_define gintptr; +typedef unsigned $glib_intptr_type_define guintptr; + +#define G_GINTPTR_MODIFIER $gintptr_modifier +#define G_GINTPTR_FORMAT $gintptr_format +#define G_GUINTPTR_FORMAT $guintptr_format +_______EOF + else + echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile + fi + + + + cat >>$outfile <<_______EOF +$glib_atexit +$glib_memmove +$glib_defines +$glib_os +$glib_static_compilation + +$glib_vacopy + +#ifdef __cplusplus +#define G_HAVE_INLINE 1 +#else /* !__cplusplus */ +$glib_inline +#endif /* !__cplusplus */ + +#ifdef __cplusplus +#define G_CAN_INLINE 1 +_______EOF + + if test x$g_can_inline = xyes ; then + cat >>$outfile <<_______EOF +#else /* !__cplusplus */ +#define G_CAN_INLINE 1 +_______EOF + fi + + cat >>$outfile <<_______EOF +#endif + +_______EOF + + if test x$g_have_iso_c_varargs = xyes ; then + cat >>$outfile <<_______EOF +#ifndef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif +_______EOF + fi + if test x$g_have_iso_cxx_varargs = xyes ; then + cat >>$outfile <<_______EOF +#ifdef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif +_______EOF + fi + if test x$g_have_gnuc_varargs = xyes ; then + cat >>$outfile <<_______EOF + +/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi + * is passed ISO vararg support is turned off, and there is no work + * around to turn it on, so we unconditionally turn it off. + */ +#if __GNUC__ == 2 && __GNUC_MINOR__ == 95 +# undef G_HAVE_ISO_VARARGS +#endif + +#define G_HAVE_GNUC_VARARGS 1 +_______EOF + fi + + echo >>$outfile + if test x$g_have_eilseq = xno; then + cat >>$outfile <<_______EOF +#ifndef EILSEQ +/* On some systems, like SunOS and NetBSD, EILSEQ is not defined. + * The correspondence between this and the corresponding definition + * in libiconv is essential. + */ +# define EILSEQ ENOENT +#endif +_______EOF + + fi + + if test x$g_have_gnuc_visibility = xyes; then + cat >>$outfile <<_______EOF +#define G_HAVE_GNUC_VISIBILITY 1 +_______EOF + fi + cat >>$outfile <<_______EOF +#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +#define G_GNUC_INTERNAL __hidden +#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#else +#define G_GNUC_INTERNAL +#endif +_______EOF + + + echo >>$outfile + if test x$g_mutex_has_default = xyes; then + cat >>$outfile <<_______EOF +$g_enable_threads_def G_THREADS_ENABLED +#define G_THREADS_IMPL_$g_threads_impl_def +typedef struct _GStaticMutex GStaticMutex; +struct _GStaticMutex +{ + struct _GMutex *runtime_mutex; + union { + char pad[[$g_mutex_sizeof]]; + double dummy_double; + void *dummy_pointer; + long dummy_long; + } static_mutex; +}; +#define G_STATIC_MUTEX_INIT { NULL, { { $g_mutex_contents} } } +#define g_static_mutex_get_mutex(mutex) \\ + (g_thread_use_default_impl ? ((GMutex*)(gpointer) ((mutex)->static_mutex.pad)) : \\ + g_static_mutex_get_mutex_impl_shortcut (&((mutex)->runtime_mutex))) +_______EOF + else + cat >>$outfile <<_______EOF +$g_enable_threads_def G_THREADS_ENABLED +#define G_THREADS_IMPL_$g_threads_impl_def +typedef struct _GMutex* GStaticMutex; +#define G_STATIC_MUTEX_INIT NULL +#define g_static_mutex_get_mutex(mutex) \\ + (g_static_mutex_get_mutex_impl_shortcut (mutex)) +_______EOF + fi + + cat >>$outfile <<_______EOF +/* This represents a system thread as used by the implementation. An + * alien implementaion, as loaded by g_thread_init can only count on + * "sizeof (gpointer)" bytes to store their info. We however need more + * for some of our native implementations. */ +typedef union _GSystemThread GSystemThread; +union _GSystemThread +{ + char data[[$g_system_thread_sizeof]]; + double dummy_double; + void *dummy_pointer; + long dummy_long; +}; +_______EOF + if test x"$g_memory_barrier_needed" != xno; then + echo >>$outfile + echo "#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1" >>$outfile + fi + if test x"$g_gcc_atomic_ops" != xno; then + echo >>$outfile + echo "#define G_ATOMIC_OP_USE_GCC_BUILTINS 1" >>$outfile + fi + echo >>$outfile + g_bit_sizes="16 32 64" + for bits in $g_bit_sizes; do + cat >>$outfile <<_______EOF +#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val)) +#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val)) +#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val)) +#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val)) +_______EOF + done + + cat >>$outfile <<_______EOF +#define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val)) +#define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val)) +#define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val)) +#define GULONG_TO_BE(val) ((gulong) GUINT${glongbits}_TO_BE (val)) +#define GINT_TO_LE(val) ((gint) GINT${gintbits}_TO_LE (val)) +#define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val)) +#define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val)) +#define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val)) +#define GSIZE_TO_LE(val) ((gsize) GUINT${gsizebits}_TO_LE (val)) +#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val)) +#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val)) +#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val)) +#define G_BYTE_ORDER $g_byte_order + +#define G_MODULE_SUFFIX "$g_module_suffix" + +/* A GPid is an abstraction for a process "handle". It is *not* an + * abstraction for a process identifier in general. GPid is used in + * GLib only for descendant processes spawned with the g_spawn* + * functions. On POSIX there is no "process handle" concept as such, + * but on Windows a GPid is a handle to a process, a kind of pointer, + * not a process identifier. + */ +typedef $g_pid_type GPid; + +G_END_DECLS + +#endif /* GLIBCONFIG_H */ +_______EOF + + + if cmp -s $outfile $1/glibconfig.h; then + AC_MSG_NOTICE([$1/glibconfig.h is unchanged]) + rm -f $outfile + else + mv $outfile $1/glibconfig.h + fi +],[ + +# Note that if two cases are the same, case goes with the first one. +# Note also that this is inside an AC_OUTPUT_COMMAND. We do not depend +# on variable expansion in case labels. Look at the generated config.status +# for a hint. + +if test "x${ac_cv_working_alloca_h+set}" = xset ; then + glib_header_alloca_h="$ac_cv_working_alloca_h" +else + glib_header_alloca_h="$ac_cv_header_alloca_h" +fi + +case xyes in +x$ac_cv_header_float_h) + glib_float_h=yes + glib_mf=FLT_MIN glib_Mf=FLT_MAX + glib_md=DBL_MIN glib_Md=DBL_MAX + ;; +x$ac_cv_header_values_h) + glib_values_h=yes + glib_mf=MINFLOAT glib_Mf=MAXFLOAT + glib_md=MINDOUBLE glib_Md=MAXDOUBLE + ;; +esac + +case xyes in +x$ac_cv_header_limits_h) + glib_limits_h=yes + glib_ms=SHRT_MIN glib_Ms=SHRT_MAX glib_Mus=USHRT_MAX + glib_mi=INT_MIN glib_Mi=INT_MAX glib_Mui=UINT_MAX + glib_ml=LONG_MIN glib_Ml=LONG_MAX glib_Mul=ULONG_MAX + ;; +x$ac_cv_header_values_h) + glib_values_h=yes + glib_ms=MINSHORT glib_Ms=MAXSHORT glib_Mus="(((gushort)G_MAXSHORT)*2+1)" + glib_mi=MININT glib_Mi=MAXINT glib_Mui="(((guint)G_MAXINT)*2+1)" + glib_ml=MINLONG glib_Ml=MAXLONG glib_Mul="(((gulong)G_MAXLONG)*2+1)" + ;; +esac + +if test x$ac_cv_header_sys_poll_h = xyes ; then + glib_sys_poll_h=yes +fi + +if test x$enable_included_printf = xyes ; then + glib_included_printf=yes +fi + +case x2 in +x$ac_cv_sizeof_short) + gint16=short + gint16_modifier='"h"' + gint16_format='"hi"' + guint16_format='"hu"' + ;; +x$ac_cv_sizeof_int) + gint16=int + gint16_modifier='""' + gint16_format='"i"' + guint16_format='"u"' + ;; +esac +case x4 in +x$ac_cv_sizeof_short) + gint32=short + gint32_modifier='"h"' + gint32_format='"hi"' + guint32_format='"hu"' + ;; +x$ac_cv_sizeof_int) + gint32=int + gint32_modifier='""' + gint32_format='"i"' + guint32_format='"u"' + ;; +x$ac_cv_sizeof_long) + gint32=long + gint32_modifier='"l"' + gint32_format='"li"' + guint32_format='"lu"' + ;; +esac +case x8 in +x$ac_cv_sizeof_int) + gint64=int + gint64_modifier='""' + gint64_format='"i"' + guint64_format='"u"' + glib_extension= + gint64_constant='(val)' + guint64_constant='(val)' + ;; +x$ac_cv_sizeof_long) + gint64=long + gint64_modifier='"l"' + gint64_format='"li"' + guint64_format='"lu"' + glib_extension= + gint64_constant='(val##L)' + guint64_constant='(val##UL)' + ;; +x$ac_cv_sizeof_long_long) + gint64='long long' + if test -n "$glib_cv_long_long_format"; then + gint64_modifier='"'$glib_cv_long_long_format'"' + gint64_format='"'$glib_cv_long_long_format'i"' + guint64_format='"'$glib_cv_long_long_format'u"' + fi + glib_extension='G_GNUC_EXTENSION ' + gint64_constant='(G_GNUC_EXTENSION (val##LL))' + guint64_constant='(G_GNUC_EXTENSION (val##ULL))' + ;; +x$ac_cv_sizeof___int64) + gint64='__int64' + if test -n "$glib_cv_long_long_format"; then + gint64_modifier='"'$glib_cv_long_long_format'"' + gint64_format='"'$glib_cv_long_long_format'i"' + guint64_format='"'$glib_cv_long_long_format'u"' + fi + glib_extension= + gint64_constant='(val##i64)' + guint64_constant='(val##ui64)' + ;; +esac +glib_size_t=$ac_cv_sizeof_size_t +glib_size_type_define="$glib_size_type" +glib_void_p=$ac_cv_sizeof_void_p +glib_long=$ac_cv_sizeof_long + +case "$glib_size_type" in +short) + gsize_modifier='"h"' + gsize_format='"hu"' + gssize_format='"hi"' + glib_msize_type='SHRT' + ;; +int) + gsize_modifier='""' + gsize_format='"u"' + gssize_format='"i"' + glib_msize_type='INT' + ;; +long) + gsize_modifier='"l"' + gsize_format='"lu"' + gssize_format='"li"' + glib_msize_type='LONG' + ;; +"long long"|__int64) + gsize_modifier='"I64"' + gsize_format='"I64u"' + gssize_format='"I64i"' + glib_msize_type='INT64' + ;; +esac + +gintbits=`expr $ac_cv_sizeof_int \* 8 2>/dev/null` +glongbits=`expr $ac_cv_sizeof_long \* 8 2>/dev/null` +gsizebits=`expr $ac_cv_sizeof_size_t \* 8 2>/dev/null` + +case x"$ac_cv_sizeof_void_p" in +x$ac_cv_sizeof_int) + glib_intptr_type_define=int + gintptr_modifier='""' + gintptr_format='"i"' + guintptr_format='"u"' + glib_gpi_cast='' + glib_gpui_cast='' + ;; +x$ac_cv_sizeof_long) + glib_intptr_type_define=long + gintptr_modifier='"l"' + gintptr_format='"li"' + guintptr_format='"lu"' + glib_gpi_cast='(glong)' + glib_gpui_cast='(gulong)' + ;; +x$ac_cv_sizeof_long_long) + glib_intptr_type_define='long long' + gintptr_modifier='"I64"' + gintptr_format='"I64i"' + guintptr_format='"I64u"' + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; +x$ac_cv_sizeof___int64) + glib_intptr_type_define=__int64 + gintptr_modifier='"I64"' + gintptr_format='"I64i"' + guintptr_format='"I64u"' + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; +*) + glib_unknown_void_p=yes + ;; +esac + + +case xyes in +x$ac_cv_func_atexit) + glib_atexit=" +#ifdef NeXT /* @#%@! NeXTStep */ +# define g_ATEXIT(proc) (!atexit (proc)) +#else +# define g_ATEXIT(proc) (atexit (proc)) +#endif" + ;; +x$ac_cv_func_on_exit) + glib_atexit=" +#define g_ATEXIT(proc) (on_exit ((void (*)(int, void*))(proc), NULL))" + ;; +esac + +case xyes in +x$ac_cv_func_memmove) + glib_memmove=' +#define g_memmove(dest,src,len) G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END' + ;; +x$glib_cv_working_bcopy) + glib_memmove=" +/* memmove isn't available, but bcopy can copy overlapping memory regions */ +#define g_memmove(d,s,n) G_STMT_START { bcopy ((s), (d), (n)); } G_STMT_END" + ;; +*) + glib_memmove=" +/* memmove isn't found and bcopy can't copy overlapping memory regions, + * so we have to roll our own copy routine. */ +void g_memmove (void* dest, const void * src, unsigned long len);" + ;; +esac + +glib_defines=" +#define GLIB_MAJOR_VERSION $GLIB_MAJOR_VERSION +#define GLIB_MINOR_VERSION $GLIB_MINOR_VERSION +#define GLIB_MICRO_VERSION $GLIB_MICRO_VERSION +" + +case xyes in +x$glib_cv_va_copy) glib_vacopy='#define G_VA_COPY va_copy' ;; +x$glib_cv___va_copy) glib_vacopy='#define G_VA_COPY __va_copy' ;; +*) glib_vacopy='' +esac + +if test x$glib_cv_va_val_copy = xno; then + glib_vacopy="\$glib_vacopy +#define G_VA_COPY_AS_ARRAY 1" +fi + +if test x$glib_cv_hasinline = xyes; then + glib_inline='#define G_HAVE_INLINE 1' +fi +if test x$glib_cv_has__inline = xyes; then + glib_inline="\$glib_inline +#define G_HAVE___INLINE 1" +fi +if test x$glib_cv_has__inline__ = xyes; then + glib_inline="\$glib_inline +#define G_HAVE___INLINE__ 1" +fi + +g_have_gnuc_varargs=$g_have_gnuc_varargs +g_have_iso_c_varargs=$g_have_iso_c_varargs +g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs + +g_can_inline=$g_can_inline +g_have_gnuc_visibility=$g_have_gnuc_visibility +g_have_sunstudio_visibility=$g_have_sunstudio_visibility + +if test x$ac_cv_c_bigendian = xyes; then + g_byte_order=G_BIG_ENDIAN + g_bs_native=BE + g_bs_alien=LE +else + g_byte_order=G_LITTLE_ENDIAN + g_bs_native=LE + g_bs_alien=BE +fi + +g_pollin=$glib_cv_value_POLLIN +g_pollout=$glib_cv_value_POLLOUT +g_pollpri=$glib_cv_value_POLLPRI +g_pollhup=$glib_cv_value_POLLHUP +g_pollerr=$glib_cv_value_POLLERR +g_pollnval=$glib_cv_value_POLLNVAL + +g_af_unix=$glib_cv_value_AF_UNIX +g_af_inet=$glib_cv_value_AF_INET +g_af_inet6=$glib_cv_value_AF_INET6 + +g_msg_peek=$glib_cv_value_MSG_PEEK +g_msg_oob=$glib_cv_value_MSG_OOB +g_msg_dontroute=$glib_cv_value_MSG_DONTROUTE + +g_have_eilseq=$have_eilseq + +case x$have_threads in +xno) g_enable_threads_def="#undef";; +*) g_enable_threads_def="#define";; +esac + +g_threads_impl_def=$g_threads_impl + +g_mutex_has_default="$mutex_has_default" +g_mutex_sizeof="$glib_cv_sizeof_gmutex" +g_system_thread_sizeof="$glib_cv_sizeof_system_thread" +g_mutex_contents="$glib_cv_byte_contents_gmutex" + +g_memory_barrier_needed="$glib_memory_barrier_needed" +g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations" + +g_module_suffix="$glib_gmodule_suffix" + +g_pid_type="$glib_pid_type" +case $host in + *-*-beos*) + glib_os="#define G_OS_BEOS" + ;; + *-*-cygwin*) + glib_os="#define G_OS_UNIX +#define G_PLATFORM_WIN32 +#define G_WITH_CYGWIN" + ;; + *-*-mingw*) + glib_os="#define G_OS_WIN32 +#define G_PLATFORM_WIN32" + ;; + *) + glib_os="#define G_OS_UNIX" + ;; +esac +glib_static_compilation="" +if test x$glib_win32_static_compilation = xyes; then + glib_static_compilation="#define GLIB_STATIC_COMPILATION 1 +#define GOBJECT_STATIC_COMPILATION 1" +fi +])dnl AC_CONFIG_COMMANDS + +])dnl AC_DEFUN diff --git a/build/autotools/as-linguas.m4 b/build/autotools/as-linguas.m4 new file mode 100644 index 0000000..92b28f7 --- /dev/null +++ b/build/autotools/as-linguas.m4 @@ -0,0 +1,24 @@ +# Set ALL_ALL_LINGUAS based on the .po files present. Optional argument is the +# name of the po directory. $podir/LINGUAS.ignore can be used to ignore a +# subset of the po files. + +AC_DEFUN([AS_ALL_LINGUAS], +[ + AC_MSG_CHECKING([for linguas]) + podir="m4_default([$1],[$srcdir/po])" + linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $[]1 }'` + if test -f "$podir/LINGUAS.ignore"; then + ALL_LINGUAS=""; + ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \ + -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`; + for lang in $linguas; do + if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then + ALL_LINGUAS="$ALL_LINGUAS $lang"; + fi; + done; + else + ALL_LINGUAS="$linguas"; + fi; + AC_SUBST([ALL_LINGUAS]) + AC_MSG_RESULT($ALL_LINGUAS) +]) diff --git a/build/autotools/gettext.m4 b/build/autotools/gettext.m4 new file mode 100644 index 0000000..c9ae1f7 --- /dev/null +++ b/build/autotools/gettext.m4 @@ -0,0 +1,381 @@ +# gettext.m4 serial 60 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2006. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define([gt_included_intl], + ifelse([$1], [external], + ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), + [yes])) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv. + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/build/autotools/gtk-doc.m4 b/build/autotools/gtk-doc.m4 new file mode 100644 index 0000000..ac2eccb --- /dev/null +++ b/build/autotools/gtk-doc.m4 @@ -0,0 +1,71 @@ +dnl -*- mode: autoconf -*- + +# serial 1 + +dnl Usage: +dnl GTK_DOC_CHECK([minimum-gtk-doc-version]) +AC_DEFUN([GTK_DOC_CHECK], +[ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + + dnl check for tools we added during development + AC_PATH_PROG([GTKDOC_CHECK],[gtkdoc-check]) + AC_PATH_PROGS([GTKDOC_REBASE],[gtkdoc-rebase],[true]) + AC_PATH_PROG([GTKDOC_MKPDF],[gtkdoc-mkpdf]) + + dnl for overriding the documentation installation directory + AC_ARG_WITH([html-dir], + AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),, + [with_html_dir='${datadir}/gtk-doc/html']) + HTML_DIR="$with_html_dir" + AC_SUBST([HTML_DIR]) + + dnl enable/disable documentation building + AC_ARG_ENABLE([gtk-doc], + AS_HELP_STRING([--enable-gtk-doc], + [use gtk-doc to build documentation [[default=no]]]),, + [enable_gtk_doc=no]) + + if test x$enable_gtk_doc = xyes; then + ifelse([$1],[], + [PKG_CHECK_EXISTS([gtk-doc],, + AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))], + [PKG_CHECK_EXISTS([gtk-doc >= $1],, + AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))]) + dnl don't check for glib if we build glib + if test "x$PACKAGE_NAME" != "xglib"; then + dnl don't fail if someone does not have glib + PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,[:]) + fi + fi + + AC_MSG_CHECKING([whether to build gtk-doc documentation]) + AC_MSG_RESULT($enable_gtk_doc) + + dnl enable/disable output formats + AC_ARG_ENABLE([gtk-doc-html], + AS_HELP_STRING([--enable-gtk-doc-html], + [build documentation in html format [[default=yes]]]),, + [enable_gtk_doc_html=yes]) + AC_ARG_ENABLE([gtk-doc-pdf], + AS_HELP_STRING([--enable-gtk-doc-pdf], + [build documentation in pdf format [[default=no]]]),, + [enable_gtk_doc_pdf=no]) + + if test -z "$GTKDOC_MKPDF"; then + enable_gtk_doc_pdf=no + fi + + if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 + fi + AC_SUBST([AM_DEFAULT_VERBOSITY]) + + AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes]) + AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes]) + AM_CONDITIONAL([GTK_DOC_BUILD_PDF], [test x$enable_gtk_doc_pdf = xyes]) + AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"]) + AM_CONDITIONAL([GTK_DOC_USE_REBASE], [test -n "$GTKDOC_REBASE"]) +]) diff --git a/build/autotools/iconv.m4 b/build/autotools/iconv.m4 new file mode 100644 index 0000000..66bc76f --- /dev/null +++ b/build/autotools/iconv.m4 @@ -0,0 +1,180 @@ +# iconv.m4 serial AM6 (gettext-0.17) +dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [ + dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/build/autotools/intlmacosx.m4 b/build/autotools/intlmacosx.m4 new file mode 100644 index 0000000..d3f0d90 --- /dev/null +++ b/build/autotools/intlmacosx.m4 @@ -0,0 +1,51 @@ +# intlmacosx.m4 serial 1 (gettext-0.17) +dnl Copyright (C) 2004-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in MacOS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + gt_cv_func_CFPreferencesCopyAppValue, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], + [CFPreferencesCopyAppValue(NULL, NULL)], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, + [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Check for API introduced in MacOS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, + [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) diff --git a/build/autotools/lib-ld.m4 b/build/autotools/lib-ld.m4 new file mode 100644 index 0000000..96c4e2c --- /dev/null +++ b/build/autotools/lib-ld.m4 @@ -0,0 +1,110 @@ +# lib-ld.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/build/autotools/lib-link.m4 b/build/autotools/lib-link.m4 new file mode 100644 index 0000000..e3d26fc --- /dev/null +++ b/build/autotools/lib-link.m4 @@ -0,0 +1,709 @@ +# lib-link.m4 serial 13 (gettext-0.17) +dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ(2.54) + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + LIB[]NAME[]_PREFIX= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl acl_libext, +dnl acl_shlibext, +dnl acl_hardcode_libdir_flag_spec, +dnl acl_hardcode_libdir_separator, +dnl acl_hardcode_direct, +dnl acl_hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + dnl Tell automake >= 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl Autoconf >= 2.61 supports dots in --with options. + define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix], +[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIB[]NAME[]_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/build/autotools/lib-prefix.m4 b/build/autotools/lib-prefix.m4 new file mode 100644 index 0000000..a8684e1 --- /dev/null +++ b/build/autotools/lib-prefix.m4 @@ -0,0 +1,185 @@ +# lib-prefix.m4 serial 5 (gettext-0.15) +dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing +dnl the basename of the libdir, either "lib" or "lib64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. The current + dnl practice is that on a system supporting 32-bit and 64-bit instruction + dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit + dnl libraries go under $prefix/lib. We determine the compiler's default + dnl mode by looking at the compiler's library search path. If at least + dnl of its elements ends in /lib64 or points to a directory whose absolute + dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the + dnl default, namely "lib". + acl_libdirstem=lib + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi +]) diff --git a/build/autotools/libtool.m4 b/build/autotools/libtool.m4 new file mode 100644 index 0000000..44e0ecf --- /dev/null +++ b/build/autotools/libtool.m4 @@ -0,0 +1,7982 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/build/autotools/ltoptions.m4 b/build/autotools/ltoptions.m4 new file mode 100644 index 0000000..5d9acd8 --- /dev/null +++ b/build/autotools/ltoptions.m4 @@ -0,0 +1,384 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/build/autotools/ltsugar.m4 b/build/autotools/ltsugar.m4 new file mode 100644 index 0000000..9000a05 --- /dev/null +++ b/build/autotools/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/build/autotools/ltversion.m4 b/build/autotools/ltversion.m4 new file mode 100644 index 0000000..07a8602 --- /dev/null +++ b/build/autotools/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/build/autotools/lt~obsolete.m4 b/build/autotools/lt~obsolete.m4 new file mode 100644 index 0000000..c573da9 --- /dev/null +++ b/build/autotools/lt~obsolete.m4 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/build/autotools/nls.m4 b/build/autotools/nls.m4 new file mode 100644 index 0000000..7967cc2 --- /dev/null +++ b/build/autotools/nls.m4 @@ -0,0 +1,31 @@ +# nls.m4 serial 3 (gettext-0.15) +dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) +]) diff --git a/build/autotools/po.m4 b/build/autotools/po.m4 new file mode 100644 index 0000000..0734762 --- /dev/null +++ b/build/autotools/po.m4 @@ -0,0 +1,449 @@ +# po.m4 serial 15 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.17]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ(2.50) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/build/compile b/build/compile new file mode 100755 index 0000000..531136b --- /dev/null +++ b/build/compile @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/build/config.guess b/build/config.guess new file mode 100755 index 0000000..9afd676 --- /dev/null +++ b/build/config.guess @@ -0,0 +1,1568 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-11-29' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build/config.rpath b/build/config.rpath new file mode 100755 index 0000000..c547c68 --- /dev/null +++ b/build/config.rpath @@ -0,0 +1,666 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2007 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + darwin*) + case $cc_basename in + xlc*) + wl='-Wl,' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + wl='-Wl,' + ;; + pgcc | pgf77 | pgf90) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we cannot use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if test "$GCC" = yes ; then + : + else + case $cc_basename in + xlc*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix4* | aix5*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + library_names_spec='$libname.a' + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd1*) + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + nto-qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 \ + | or1k | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or1k-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build/depcomp b/build/depcomp new file mode 100755 index 0000000..4ebd5b3 --- /dev/null +++ b/build/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2013-05-30.07; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/build/install-sh b/build/install-sh new file mode 100755 index 0000000..377bb86 --- /dev/null +++ b/build/install-sh @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/build/ltmain.sh b/build/ltmain.sh new file mode 100644 index 0000000..63ae69d --- /dev/null +++ b/build/ltmain.sh @@ -0,0 +1,9655 @@ + +# libtool (GNU libtool) 2.4.2 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.2 +TIMESTAMP="" +package_revision=1.3337 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/build/missing b/build/missing new file mode 100755 index 0000000..db98974 --- /dev/null +++ b/build/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2013-10-28.13; # UTC + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am new file mode 100644 index 0000000..b764e59 --- /dev/null +++ b/build/win32/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = vs9 vs10 + +EXTRA_DIST = *.bat diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in new file mode 100644 index 0000000..1b1c4ce --- /dev/null +++ b/build/win32/Makefile.in @@ -0,0 +1,752 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = build/win32 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = vs9 vs10 +EXTRA_DIST = *.bat +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/win32/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign build/win32/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/build/win32/gen-enums.bat b/build/win32/gen-enums.bat new file mode 100644 index 0000000..f250710 --- /dev/null +++ b/build/win32/gen-enums.bat @@ -0,0 +1,6 @@ +if exist ..\..\cogl\cogl-enum-types.h goto DONE_COGL_ENUMS_H +perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.h.in ../../cogl/deprecated/cogl-clip-state.h ../../cogl/deprecated/cogl-fixed.h ../../cogl/deprecated/cogl-material-compat.h ../../cogl/deprecated/cogl-vertex-buffer.h ../../cogl/deprecated/cogl-shader.h ../../cogl/deprecated/cogl-clutter.h ../../cogl/deprecated/cogl-type-casts.h ../../cogl/deprecated/cogl-framebuffer-deprecated.h ../../cogl/deprecated/cogl-texture-deprecated.h ../../cogl/deprecated/cogl-auto-texture.h ../../cogl/cogl1-context.h ../../cogl/cogl-bitmap.h ../../cogl/cogl-color.h ../../cogl/cogl-matrix.h ../../cogl/cogl-offscreen.h ../../cogl/cogl-primitives.h ../../cogl/cogl-texture.h ../../cogl/cogl-types.h ../../cogl/cogl.h ../../cogl/cogl-win32-renderer.h > ..\..\cogl\cogl-enum-types.h +:DONE_COGL_ENUMS_H +if exist ..\..\cogl\cogl-enum-types.c goto DONE_COGL_ENUMS_C +perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.c.in ../../cogl/deprecated/cogl-clip-state.h ../../cogl/deprecated/cogl-fixed.h ../../cogl/deprecated/cogl-material-compat.h ../../cogl/deprecated/cogl-vertex-buffer.h ../../cogl/deprecated/cogl-shader.h ../../cogl/deprecated/cogl-clutter.h ../../cogl/deprecated/cogl-type-casts.h ../../cogl/deprecated/cogl-framebuffer-deprecated.h ../../cogl/deprecated/cogl-texture-deprecated.h ../../cogl/deprecated/cogl-auto-texture.h ../../cogl/cogl1-context.h ../../cogl/cogl-bitmap.h ../../cogl/cogl-color.h ../../cogl/cogl-matrix.h ../../cogl/cogl-offscreen.h ../../cogl/cogl-primitives.h ../../cogl/cogl-texture.h ../../cogl/cogl-types.h ../../cogl/cogl.h ../../cogl/cogl-win32-renderer.h > ..\..\cogl\cogl-enum-types.c +:DONE_COGL_ENUMS_C diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am new file mode 100644 index 0000000..390a3f1 --- /dev/null +++ b/build/win32/vs10/Makefile.am @@ -0,0 +1,34 @@ +EXTRA_DIST = \ + cogl.sln \ + cogl-version-paths.props \ + cogl-build-defines.props \ + cogl-gen-srcs.props \ + cogl-install.props \ + cogl.vcxproj \ + cogl.vcxprojin \ + cogl.vcxproj.filters \ + cogl.vcxproj.filtersin \ + cogl-path.vcxproj \ + cogl-path.vcxprojin \ + cogl-path.vcxproj.filters \ + cogl-path.vcxproj.filtersin \ + cogl-pango.vcxproj \ + cogl-pango.vcxprojin \ + cogl-pango.vcxproj.filters \ + cogl-pango.vcxproj.filtersin \ + cogl-hello.vcxproj \ + cogl-hello.vcxproj.filters \ + cogl-sdl2-hello.vcxproj \ + cogl-sdl2-hello.vcxproj.filters \ + cogl-msaa.vcxproj \ + cogl-msaa.vcxproj.filters \ + cogl-info.vcxproj \ + cogl-info.vcxproj.filters \ + cogl-crate.vcxproj \ + cogl-crate.vcxproj.filters \ + test-conformance-cogl.vcxproj \ + test-conformance-cogl.vcxprojin \ + test-conformance-cogl.vcxproj.filters \ + test-conformance-cogl.vcxproj.filtersin \ + install.vcxproj \ + README.txt diff --git a/build/win32/vs10/Makefile.in b/build/win32/vs10/Makefile.in new file mode 100644 index 0000000..12af510 --- /dev/null +++ b/build/win32/vs10/Makefile.in @@ -0,0 +1,605 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = build/win32/vs10 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + cogl.sln \ + cogl-version-paths.props \ + cogl-build-defines.props \ + cogl-gen-srcs.props \ + cogl-install.props \ + cogl.vcxproj \ + cogl.vcxprojin \ + cogl.vcxproj.filters \ + cogl.vcxproj.filtersin \ + cogl-path.vcxproj \ + cogl-path.vcxprojin \ + cogl-path.vcxproj.filters \ + cogl-path.vcxproj.filtersin \ + cogl-pango.vcxproj \ + cogl-pango.vcxprojin \ + cogl-pango.vcxproj.filters \ + cogl-pango.vcxproj.filtersin \ + cogl-hello.vcxproj \ + cogl-hello.vcxproj.filters \ + cogl-sdl2-hello.vcxproj \ + cogl-sdl2-hello.vcxproj.filters \ + cogl-msaa.vcxproj \ + cogl-msaa.vcxproj.filters \ + cogl-info.vcxproj \ + cogl-info.vcxproj.filters \ + cogl-crate.vcxproj \ + cogl-crate.vcxproj.filters \ + test-conformance-cogl.vcxproj \ + test-conformance-cogl.vcxprojin \ + test-conformance-cogl.vcxproj.filters \ + test-conformance-cogl.vcxproj.filtersin \ + install.vcxproj \ + README.txt + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/win32/vs10/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign build/win32/vs10/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/build/win32/vs10/README.txt b/build/win32/vs10/README.txt new file mode 100644 index 0000000..13303df --- /dev/null +++ b/build/win32/vs10/README.txt @@ -0,0 +1,89 @@ +Note that all this is rather experimental. + +A more detailed description on using Visual C++ to compile COGL with +its dependencies can be found on the following GNOME Live! page: + +https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack + +Please do not attempt to compile Cogl in a path that contains spaces +to avoid potential problems during compilation, linking or usage. + +This VS10 solution and the projects it includes are intented to be used +in a Cogl source tree unpacked from a tarball. In a git checkout you +first need to use some Unix-like environment or manual work to expand +the files needed, like config.h.win32.in into config.h.win32 and the +.vcprojin files here into corresponding actual .vcproj files. + +You will need the parts from GNOME: GDK-Pixbuf, Pango* and GLib. +External dependencies are at least zlib, libpng, +gettext-runtime* and Cairo*, and glext.h from +http://www.opengl.org/registry/api/glext.h (which need to be in the GL folder +in your include directories or in \vs10\\include\GL). Please +note that although the Cogl source package does allow one to build Cogl without +a previously built and installed GLib, the Visual Studio projects only support +builds that does depend on GLib. + +Please see the README file in the root directory of this Cogl source package +for the versions of the dependencies required. See also +build/win32/vs10/README.txt in the GLib source package for details +where to unpack them. It is recommended that at least the dependencies +from GNOME are also built with VS10 to avoid crashes caused by mixing different +CRTs-please see also the build/win32/vs10/README.txt in those respective packages. + +If building the SDL2 winsys is desired (the *_SDL configs), you will also need the +SDL2 libraries from www.libsdl.org-building the SDL source package with Visual C++ 2010 +is recommended via CMake, but one may want to use the Visual C++ binary packages +from that website. Since Cogl-1.18.x, the Visual Studio Projects have been updated +to support the build of the SDL2 winsys in place of the original SDL-1.3 winsys +as SDL-2.x has been released for some time. Please note, as builds with the SDL2 +winsys includes the SDL2 headers, main() will be defined to SDL2's special main() +implementation on Windows, which will require linking to SDL2.lib and SDL2main.lib +for all apps that link to Cogl, unless SDL_MAIN_HANDLED is defined in your +"preprocessor definitions" options. + +The recommended build sequence of the dependencies are as follows (the non-GNOME +packages that are not downloaded as binaries from ftp://ftp.gnome.org have +makefiles and/or VS project files that can be used to compile with VS directly, +except the optional PCRE, which is built on VS using CMake; GLib has +VS10 project files in the latest stable versions, GDK-Pixbuf have VS10 project files +in the latest unstable version, and Pango should have VS10 project files +in the next unstable release): +-Unzip the binary packages for gettext-runtime, freetype, expat and fontconfig + downloaded from ftp://ftp.gnome.org* +-zlib +-libpng +-(optional for GLib) PCRE (8.12 or later, building PCRE using CMake is + recommended-please see build/win32/vs10/README.txt in the GLib source package) +-(for gdk-pixbuf, if GDI+ is not to be used) IJG JPEG or libjpeg-turbo +-(for gdk-pixbuf, if GDI+ is not to be used) jasper [JPEG-2000 library] +-(for gdk-pixbuf, if GDI+ is not to be used, requires zlib and IJG JPEG/libjpeg-turbo) + libtiff +-GLib +-Cairo +-Pango +-GDK-Pixbuf + +The "install" project will copy build results and headers into their +appropriate location under \vs10\. For instance, +built DLLs go into \vs10\\bin, built LIBs into +\vs10\\lib and Cogl headers into +\vs10\\include\Cogl-2.0. + +*There is no known official VS10 build support for fontconfig + (required for Pango and Pango at the moment-I will see whether this + requirement can be made optional for VS builds) + (along with freetype and expat) and gettext-runtime, so + please use the binaries from: + + ftp://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ (32 bit) + ftp://ftp.gnome.org/pub/GNOME/binaries/win64/dependencies/ (64 bit) + +Note: If you see C4819 warnings and you are compiling Cogl on a DBCS +(Chinese/Korean/Japanese) version of Windows, you may need to switch +to an English locale in Control Panel->Region and Languages->System-> +Change System Locale, reboot and rebuild to ensure Cogl and its +dependencies are built correctly. This is due to a bug in Visual C++ +running on DBCS locales. + +--Chun-wei Fan + (Adopted from the GTK+ Win32 VS README.txt file originally by Tor Lillqvist) diff --git a/build/win32/vs10/cogl-build-defines.props b/build/win32/vs10/cogl-build-defines.props new file mode 100644 index 0000000..eefe1a6 --- /dev/null +++ b/build/win32/vs10/cogl-build-defines.props @@ -0,0 +1,59 @@ + + + + + + + _WIN32_WINNT=0x0500;COGL_ENABLE_DEBUG + HAVE_CONFIG_H;COGL_COMPILATION;$(BaseBuildDefines) + $(LibBuildDefines);G_DISABLE_CHECKS;G_DISABLE_CAST_CHECKS + _DEBUG;$(LibBuildDefines);COGL_GL_DEBUG;COGL_OBJECT_DEBUG;COGL_HANDLE_DEBUG + G_LOG_DOMAIN="Cogl";COGL_HAS_WIN32_SUPPORT;COGL_BUILD_EXP;COGL_GL_LIBNAME="";COGL_LOCALEDIR="/some/random/dir" + G_LOG_DOMAIN="CoglPath" + G_LOG_DOMAIN="Cogl-Pango" + SDL_MAIN_HANDLED + + + <_PropertySheetDisplayName>coglbuilddefinesprops + $(SolutionDir)$(Configuration)\$(PlatformName)\bin\ + $(SolutionDir)$(Configuration)\$(PlatformName)\obj\$(ProjectName)\ + + + + ..\..\..;..\..\..\cogl;..\..\..\cogl\winsys;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;%(AdditionalIncludeDirectories) + G_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions) + msvc_recommended_pragmas.h;%(ForcedIncludeFiles) + %(DisableSpecificWarnings) + + + glib-2.0.lib;gobject-2.0.lib;%(AdditionalDependencies) + $(GlibEtcInstallRoot)\lib;%(AdditionalLibraryDirectories) + + + + + $(BaseBuildDefines) + + + $(LibBuildDefines) + + + $(ReleaseLibBuildDefines) + + + $(DebugLibBuildDefines) + + + $(CoglBuildDefines) + + + $(CoglPathBuildDefines) + + + $(CoglPangoBuildDefines) + + + $(CoglAppAvoidForcedSDLLinkingDefines) + + + diff --git a/build/win32/vs10/cogl-crate.vcxproj b/build/win32/vs10/cogl-crate.vcxproj new file mode 100644 index 0000000..d99a487 --- /dev/null +++ b/build/win32/vs10/cogl-crate.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF} + cogl-crate + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;COGL_EXAMPLES_DATA="../share/cogl-$(ApiVersion)/examples-data/";$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;COGL_EXAMPLES_DATA="../share/cogl-$(ApiVersion)/examples-data/";$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;COGL_EXAMPLES_DATA="../share/cogl-$(ApiVersion)/examples-data/";$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;COGL_EXAMPLES_DATA="../share/cogl-$(ApiVersion)/examples-data/";$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-crate.vcxproj.filters b/build/win32/vs10/cogl-crate.vcxproj.filters new file mode 100644 index 0000000..27b7062 --- /dev/null +++ b/build/win32/vs10/cogl-crate.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Sources + + + diff --git a/build/win32/vs10/cogl-gen-srcs.props b/build/win32/vs10/cogl-gen-srcs.props new file mode 100644 index 0000000..0ec0e63 --- /dev/null +++ b/build/win32/vs10/cogl-gen-srcs.props @@ -0,0 +1,107 @@ + + + + + + + +if exist ..\..\..\cogl\SDL_DEFINES goto DONE_COGL_DEFINES_H +if not exist ..\..\..\cogl\WGL_DEFINES goto DO_COGL_DEFINES_H +del ..\..\..\cogl\cogl-defines.h +del ..\..\..\cogl\WGL_DEFINES +:DO_COGL_DEFINES_H +copy ..\..\..\cogl\cogl-defines.h.win32_sdl ..\..\..\cogl\SDL_DEFINES +copy ..\..\..\cogl\SDL_DEFINES ..\..\..\cogl\cogl-defines.h +:DONE_COGL_DEFINES_H + + +if exist ..\..\..\cogl\WGL_DEFINES goto DONE_COGL_DEFINES_H +if not exist ..\..\..\cogl\SDL_DEFINES goto DO_COGL_DEFINES_H +del ..\..\..\cogl\cogl-defines.h +del ..\..\..\cogl\SDL_DEFINES +:DO_COGL_DEFINES_H +copy ..\..\..\cogl\cogl-defines.h.win32 ..\..\..\cogl\WGL_DEFINES +copy ..\..\..\cogl\WGL_DEFINES ..\..\..\cogl\cogl-defines.h +:DONE_COGL_DEFINES_H + + copy ..\..\..\config.h.win32 ..\..\..\config.h + copy ..\..\..\cogl\cogl-gl-header.h.win32 ..\..\..\cogl\cogl-gl-header.h + +cd ..\..\..\cogl-path +perl $(GlibEtcInstallRoot)\bin\glib-mkenums --template cogl-path-enum-types.h.in cogl-path-types.h cogl1-path-functions.h > cogl-path-enum-types.h +cd $(SolutionDir) + + +cd ..\..\..\cogl-path +perl $(GlibEtcInstallRoot)\bin\glib-mkenums --template cogl-path-enum-types.c.in cogl-path-types.h cogl1-path-functions.h > cogl-path-enum-types.c +cd $(SolutionDir) + + +cd ..\..\..\cogl +perl $(GlibEtcInstallRoot)\bin\glib-mkenums --template cogl-enum-types.h.in deprecated\cogl-clip-state.h deprecated\cogl-fixed.h deprecated\cogl-material-compat.h deprecated\cogl-vertex-buffer.h deprecated\cogl-shader.h deprecated\cogl-clutter.h deprecated\cogl-type-casts.h deprecated\cogl-framebuffer-deprecated.h deprecated\cogl-texture-deprecated.h deprecated\cogl-auto-texture.h cogl1-context.h cogl-bitmap.h cogl-color.h cogl-matrix.h cogl-offscreen.h cogl-primitives.h cogl-texture.h cogl-types.h cogl.h cogl-win32-renderer.h > cogl-enum-types.h +cd $(SolutionDir) + + +cd ..\..\..\cogl +perl $(GlibEtcInstallRoot)\bin\glib-mkenums --template cogl-enum-types.c.in deprecated\cogl-clip-state.h deprecated\cogl-fixed.h deprecated\cogl-material-compat.h deprecated\cogl-vertex-buffer.h deprecated\cogl-shader.h deprecated\cogl-clutter.h deprecated\cogl-type-casts.h deprecated\cogl-framebuffer-deprecated.h deprecated\cogl-texture-deprecated.h deprecated\cogl-auto-texture.h cogl1-context.h cogl-bitmap.h cogl-color.h cogl-matrix.h cogl-offscreen.h cogl-primitives.h cogl-texture.h cogl-types.h cogl.h cogl-win32-renderer.h > cogl-enum-types.c +cd $(SolutionDir) + + +echo EXPORTS > $(DefDir)\cogl.def +cl -EP -DCOGL_HAS_GTYPE_SUPPORT -DCOGL_HAS_WIN32_SUPPORT -DCOGL_HAS_GLIB_SUPPORT -DCOGL_ENABLE_EXPERIMENTAL_API ..\..\..\cogl\cogl.symbols >> $(DefDir)\cogl.def + + +echo EXPORTS > $(DefDir)\cogl.def +cl -EP -DCOGL_HAS_GTYPE_SUPPORT -DCOGL_HAS_WIN32_SUPPORT -DCOGL_HAS_GLIB_SUPPORT -DCOGL_HAS_SDL_SUPPORT -DCOGL_ENABLE_EXPERIMENTAL_API ..\..\..\cogl\cogl.symbols >> $(DefDir)\cogl.def + + +echo EXPORTS > $(DefDir)\cogl-path.def +cl -EP -DCOGL_HAS_GTYPE_SUPPORT ..\..\..\cogl-path\cogl-path.symbols >> $(DefDir)\cogl-path.def + + +echo EXPORTS > $(DefDir)\cogl-pango.def +cl -EP ..\..\..\cogl-pango\cogl-pango.symbols >> $(DefDir)\cogl-pango.def + + + + <_PropertySheetDisplayName>coglprops + + + + $(CopyConfigH) + + + $(CopyGLHeaderH) + + + $(CopyDefinesSDLH) + + + $(CopyDefinesH) + + + $(GenCoglPathEnumsH) + + + $(GenCoglPathEnumsC) + + + $(GenCoglEnumsH) + + + $(GenCoglEnumsC) + + + $(GenerateCoglDef) + + + $(GenerateCoglDef) + + + $(GenerateCoglPathDef) + + + $(GenerateCoglPangoDef) + + + diff --git a/build/win32/vs10/cogl-hello.vcxproj b/build/win32/vs10/cogl-hello.vcxproj new file mode 100644 index 0000000..a754c0d --- /dev/null +++ b/build/win32/vs10/cogl-hello.vcxproj @@ -0,0 +1,160 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F5A43C12-7032-428E-A56A-D294075FA493} + cogl-hello + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + true + Console + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-hello.vcxproj.filters b/build/win32/vs10/cogl-hello.vcxproj.filters new file mode 100644 index 0000000..26236c7 --- /dev/null +++ b/build/win32/vs10/cogl-hello.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Sources + + + diff --git a/build/win32/vs10/cogl-info.vcxproj b/build/win32/vs10/cogl-info.vcxproj new file mode 100644 index 0000000..45f75ff --- /dev/null +++ b/build/win32/vs10/cogl-info.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} + coglinfo + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-info.vcxproj.filters b/build/win32/vs10/cogl-info.vcxproj.filters new file mode 100644 index 0000000..c73fb10 --- /dev/null +++ b/build/win32/vs10/cogl-info.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Sources + + + diff --git a/build/win32/vs10/cogl-install.props b/build/win32/vs10/cogl-install.props new file mode 100644 index 0000000..b843f4e --- /dev/null +++ b/build/win32/vs10/cogl-install.props @@ -0,0 +1,241 @@ + + + + + + + $(SolutionDir)$(Configuration)\$(Platform)\bin + $(BinDir)\$(CoglDllPrefix)cogl(CoglDllSuffix).dll;$(BinDir)\$(CoglDllPrefix)cogl-path(CoglDllSuffix).dll;$(BinDir)\$(CoglDllPrefix)cogl-pango(CoglDllSuffix).dll + $(BinDir)\cogl-crate.exe;$(BinDir)\cogl-hello.exe;$(BinDir)\cogl-info.exe + $(BinDir)\cogl-sdl2-hello.exe + +mkdir $(CopyDir)\bin + +mkdir $(CopyDir)\lib + + +if "$(Configuration)" == "Release_SDL" goto DO_REL_BIN + +if "$(Configuration)" == "Debug_SDL" goto DO_DBG_BIN + + +copy $(BinDir)\*.dll $(CopyDir)\bin + +copy $(BinDir)\*-$(ApiVersion).lib $(CopyDir)\lib + +copy $(BinDir)\*.exe $(CopyDir)\bin + +goto DONE_BIN + + +:DO_REL_BIN + +copy Release\$(Platform)\bin\*.dll $(CopyDir)\bin + +copy Release\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib + +copy Release\$(Platform)\bin\*.exe $(CopyDir)\bin + +goto DONE_BIN + + +:DO_DBG_BIN + +copy Debug\$(Platform)\bin\*.dll $(CopyDir)\bin + +copy Debug\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib + +copy Debug\$(Platform)\bin\*.exe $(CopyDir)\bin + +goto DONE_BIN + +:DONE_BIN + + +$(CoglDoInstallBin) + +mkdir $(CopyDir)\share\cogl-$(ApiVersion)\examples-data + +copy ..\..\..\examples\*.jpg $(CopyDir)\share\cogl-$(ApiVersion)\examples-data + + +mkdir $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\cogl-object.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-atlas-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-attribute-buffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-bitmap.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-buffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-color.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-deprecated.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-depth-state.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-error.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-euler.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-fence.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-frame-info.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-glib-source.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-macros.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-vector.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-matrix.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-matrix-stack.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-offscreen.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-onscreen.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-output.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-primitives.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-primitive-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline-layer-state.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline-state.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pixel-buffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-poll.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-quaternion.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-snippet.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-2d.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-2d-gl.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-2d-sliced.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-sub-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-rectangle.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-meta-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-3d.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-types.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-index-buffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-indices.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-attribute.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-primitive.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-framebuffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-defines.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-enum-types.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-renderer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-swap-chain.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-onscreen-template.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-display.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-context.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-version.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl-win32-renderer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl1-context.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + +copy ..\..\..\cogl\cogl2-experimental.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + + +copy ..\..\..\cogl\deprecated\cogl-clip-state.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-fixed.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-material-compat.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-vertex-buffer.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-shader.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-clutter.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-type-casts.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-framebuffer-deprecated.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-texture-deprecated.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + +copy ..\..\..\cogl\deprecated\cogl-auto-texture.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl\deprecated + + +mkdir $(CopyDir)\include\cogl-$(ApiVersion)\cogl-pango + +copy ..\..\..\cogl-pango\cogl-pango.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-pango + + +mkdir $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + +copy ..\..\..\cogl-path\cogl-path.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + +copy ..\..\..\cogl-path\cogl-path-types.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + +copy ..\..\..\cogl-path\cogl1-path-functions.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + +copy ..\..\..\cogl-path\cogl2-path-functions.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + +copy ..\..\..\cogl-path\cogl-path-enum-types.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl-path + + copy ..\..\..\cogl\cogl-sdl.h $(CopyDir)\include\cogl-$(ApiVersion)\cogl + + + <_PropertySheetDisplayName>coglinstallprops + + + + $(BinDir) + + + $(InstalledDlls) + + + $(InstalledBins) + + + $(InstalledSDLBins) + + + $(CoglDoInstall) + + + $(CoglDoInstall) + + + $(CoglDoInstallSDL) + + + diff --git a/build/win32/vs10/cogl-msaa.vcxproj b/build/win32/vs10/cogl-msaa.vcxproj new file mode 100644 index 0000000..28de260 --- /dev/null +++ b/build/win32/vs10/cogl-msaa.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {44E864D4-8447-484D-9B16-D5405E0783CF} + coglmsaa + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-msaa.vcxproj.filters b/build/win32/vs10/cogl-msaa.vcxproj.filters new file mode 100644 index 0000000..db51fe2 --- /dev/null +++ b/build/win32/vs10/cogl-msaa.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Sources + + + diff --git a/build/win32/vs10/cogl-pango.vcxproj b/build/win32/vs10/cogl-pango.vcxproj new file mode 100644 index 0000000..067c664 --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj @@ -0,0 +1,210 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + coglpango + Win32Proj + + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + true + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + $(PreBuildCmd) + + + MaxSpeed + true + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + $(PreBuildCmd) + + + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + + + + + + + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-pango.vcxproj.filters b/build/win32/vs10/cogl-pango.vcxproj.filters new file mode 100644 index 0000000..22f2c30 --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj.filters @@ -0,0 +1,23 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + + Sources + Sources + Sources + Sources + Sources + + + Resource Files + + diff --git a/build/win32/vs10/cogl-pango.vcxproj.filtersin b/build/win32/vs10/cogl-pango.vcxproj.filtersin new file mode 100644 index 0000000..5f7ba5a --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj.filtersin @@ -0,0 +1,19 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + +#include "coglpango.vs10.sourcefiles.filters" + + + Resource Files + + diff --git a/build/win32/vs10/cogl-pango.vcxprojin b/build/win32/vs10/cogl-pango.vcxprojin new file mode 100644 index 0000000..4c48b4d --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxprojin @@ -0,0 +1,206 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + coglpango + Win32Proj + + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + true + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + $(PreBuildCmd) + + + MaxSpeed + true + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + $(PreBuildCmd) + + + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl-pango.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + +#include "coglpango.vs10.sourcefiles" + + + + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + Generating $(IntDir)\cogl-pango.def + $(GenerateCoglPangoDef) + $(IntDir)\cogl-pango.def;%(Outputs) + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-path.vcxproj b/build/win32/vs10/cogl-path.vcxproj new file mode 100644 index 0000000..e79b609 --- /dev/null +++ b/build/win32/vs10/cogl-path.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F3A80987-5411-43DB-A23B-06F2076E1207} + coglpath + Win32Proj + + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + MaxSpeed + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + + + + + + + + + + + + + + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + + + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + + + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-path.vcxproj.filters b/build/win32/vs10/cogl-path.vcxproj.filters new file mode 100644 index 0000000..c0285f9 --- /dev/null +++ b/build/win32/vs10/cogl-path.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {2b91c6a0-c3f8-47f5-8c21-0ba4481be079} + + + + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Source Files + Sources + + + Resource Files + Resource Files + Resource Files + + diff --git a/build/win32/vs10/cogl-path.vcxproj.filtersin b/build/win32/vs10/cogl-path.vcxproj.filtersin new file mode 100644 index 0000000..1c4a30f --- /dev/null +++ b/build/win32/vs10/cogl-path.vcxproj.filtersin @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {2b91c6a0-c3f8-47f5-8c21-0ba4481be079} + + + +#include "cogl-path.vs10.sourcefiles.filters" + Sources + + + Resource Files + Resource Files + Resource Files + + diff --git a/build/win32/vs10/cogl-path.vcxprojin b/build/win32/vs10/cogl-path.vcxprojin new file mode 100644 index 0000000..cb0aeab --- /dev/null +++ b/build/win32/vs10/cogl-path.vcxprojin @@ -0,0 +1,230 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F3A80987-5411-43DB-A23B-06F2076E1207} + coglpath + Win32Proj + + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + MaxSpeed + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + ..\..\..\cogl-path\tesselator;..\..\..\cogl\winsys;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglPathBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\$(ProjectName).def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + +#include "cogl-path.vs10.sourcefiles" + + + + + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.h + $(GenCoglPathEnumsH) + ..\..\..\cogl-path\cogl-path-enum-types.h;%(Outputs) + + + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + Generating ..\..\..\cogl-path\cogl-path-enum-types.c + $(GenCoglPathEnumsC) + ..\..\..\cogl-path\cogl-path-enum-types.c;%(Outputs) + + + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + Generating cogl-path.symbols... + $(GenerateCoglPathDef) + $(IntDir)\cogl-path.def;%(Outputs) + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-sdl2-hello.vcxproj b/build/win32/vs10/cogl-sdl2-hello.vcxproj new file mode 100644 index 0000000..874d43d --- /dev/null +++ b/build/win32/vs10/cogl-sdl2-hello.vcxproj @@ -0,0 +1,173 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0B5D144D-1872-42CD-8437-FFDCDD08C03E} + coglsdl2hello + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + SDL2.lib;SDL2main.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + SDL2.lib;SDL2main.lib;%(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + SDL2.lib;SDL2main.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + SDL2.lib;SDL2main.lib;%(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/cogl-sdl2-hello.vcxproj.filters b/build/win32/vs10/cogl-sdl2-hello.vcxproj.filters new file mode 100644 index 0000000..967dc65 --- /dev/null +++ b/build/win32/vs10/cogl-sdl2-hello.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Sources + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-version-paths.props b/build/win32/vs10/cogl-version-paths.props new file mode 100644 index 0000000..2979609 --- /dev/null +++ b/build/win32/vs10/cogl-version-paths.props @@ -0,0 +1,53 @@ + + + + 10 + $(SolutionDir)\..\..\..\..\vs$(VSVer)\$(Platform) + 1.0 + $(GlibEtcInstallRoot) + $(SolutionDir)$(Configuration)\$(PlatformName)\obj\$(ProjectName)\ + lib + -$(ApiVersion)-0 + + -1-vs$(VSVer) + + + $(CoglSeparateVSDllPrefix) + $(CoglSeparateVSDllSuffix) + + + <_PropertySheetDisplayName>coglversionpathsprops + + + + $(GlibEtcInstallRoot) + + + $(CopyDir) + + + $(DefDir) + + + $(ApiVersion) + + + $(CoglLibtoolCompatibleDllPrefix) + + + $(CoglLibtoolCompatibleDllSuffix) + + + $(CoglSeparateVSDllPrefix) + + + $(CoglSeparateVSDllSuffix) + + + $(CoglDllPrefix) + + + $(CoglDllSuffix) + + + diff --git a/build/win32/vs10/cogl.sln b/build/win32/vs10/cogl.sln new file mode 100644 index 0000000..693587e --- /dev/null +++ b/build/win32/vs10/cogl.sln @@ -0,0 +1,174 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl", "cogl.vcxproj", "{F3A80987-5411-43DB-A23B-06F2076E1206}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-path", "cogl-path.vcxproj", "{F3A80987-5411-43DB-A23B-06F2076E1207}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-pango", "cogl-pango.vcxproj", "{FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-hello", "cogl-hello.vcxproj", "{F5A43C12-7032-428E-A56A-D294075FA493}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-sdl2-hello", "cogl-sdl2-hello.vcxproj", "{0B5D144D-1872-42CD-8437-FFDCDD08C03E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-info", "cogl-info.vcxproj", "{CD17F5C8-C860-4A65-8209-4D0B093A3DA3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcxproj", "{35B2A4AC-7235-4FC7-995D-469D59195041}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-crate", "cogl-crate.vcxproj", "{DE1A2710-04BB-4C3D-90C1-B070E326B1CF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-conformance-cogl", "test-conformance-cogl.vcxproj", "{0F08F253-DE1A-40CB-A890-93AE3CA23ADE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug_SDL|Win32 = Debug_SDL|Win32 + Debug|x64 = Debug|x64 + Debug_SDL|x64 = Debug_SDL|x64 + Release|Win32 = Release|Win32 + Release_SDL|Win32 = Release_SDL|Win32 + Release|x64 = Release|x64 + Release_SDL|x64 = Release_SDL|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.Build.0 = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|Win32.ActiveCfg = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|Win32.Build.0 = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|x64.ActiveCfg = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|x64.Build.0 = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|Win32.ActiveCfg = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|Win32.Build.0 = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|x64.ActiveCfg = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|x64.Build.0 = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|x64.Build.0 = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|x64.Build.0 = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|Win32.Build.0 = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|x64.ActiveCfg = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|x64.Build.0 = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|Win32.ActiveCfg = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|Win32.Build.0 = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|x64.ActiveCfg = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|x64.Build.0 = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|x64.Build.0 = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|Win32.Build.0 = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|x64.ActiveCfg = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|x64.Build.0 = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|Win32.ActiveCfg = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|Win32.Build.0 = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|x64.ActiveCfg = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|x64.Build.0 = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|Win32.ActiveCfg = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|Win32.Build.0 = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|x64.ActiveCfg = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|x64.Build.0 = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|x64.Build.0 = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|Win32.Build.0 = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|x64.ActiveCfg = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|x64.Build.0 = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|x64.Build.0 = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|Win32.Build.0 = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|x64.ActiveCfg = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|x64.Build.0 = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|Win32.ActiveCfg = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|Win32.Build.0 = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|x64.ActiveCfg = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|x64.Build.0 = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|Win32.ActiveCfg = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|Win32.Build.0 = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|x64.ActiveCfg = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|x64.Build.0 = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|x64.Build.0 = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|Win32.Build.0 = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|x64.ActiveCfg = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|x64.Build.0 = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|Win32.ActiveCfg = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|Win32.Build.0 = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|x64.ActiveCfg = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|x64.Build.0 = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|Win32.ActiveCfg = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|Win32.Build.0 = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|x64.ActiveCfg = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|x64.Build.0 = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|x64.Build.0 = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|Win32.Build.0 = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|x64.ActiveCfg = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|x64.Build.0 = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|Win32.Build.0 = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|x64.ActiveCfg = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|x64.Build.0 = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|Win32.ActiveCfg = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|Win32.Build.0 = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|x64.ActiveCfg = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|x64.Build.0 = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|x64.Build.0 = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|Win32.Build.0 = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|x64.ActiveCfg = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|x64.Build.0 = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|Win32.ActiveCfg = Debug|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|Win32.Build.0 = Debug|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|x64.ActiveCfg = Debug|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|x64.Build.0 = Debug|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|Win32.ActiveCfg = Release|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|Win32.Build.0 = Release|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|x64.ActiveCfg = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|x64.Build.0 = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|Win32.ActiveCfg = Debug_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|Win32.Build.0 = Debug_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|x64.ActiveCfg = Debug_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|x64.Build.0 = Debug_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|Win32.ActiveCfg = Release_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|Win32.Build.0 = Release_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|x64.ActiveCfg = Release_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|x64.Build.0 = Release_SDL|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/win32/vs10/cogl.vcxproj b/build/win32/vs10/cogl.vcxproj new file mode 100644 index 0000000..1a9e4d1 --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj @@ -0,0 +1,639 @@ + + + + + Debug + Win32 + + + Debug_SDL + Win32 + + + Debug + x64 + + + Debug_SDL + x64 + + + Release + Win32 + + + Release_SDL + Win32 + + + Release + x64 + + + Release_SDL + x64 + + + + {F3A80987-5411-43DB-A23B-06F2076E1206} + cogl + Win32Proj + + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + Debug\$(Platform)\bin\ + true + true + Debug\$(Platform)\bin\ + false + false + Release\$(Platform)\bin\ + true + true + Release\$(Platform)\bin\ + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + MaxSpeed + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + MaxSpeed + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + + + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + true + true + true + true + + + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + + + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + + + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + + + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + + + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + + + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + + + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + + + + + + + + + diff --git a/build/win32/vs10/cogl.vcxproj.filters b/build/win32/vs10/cogl.vcxproj.filters new file mode 100644 index 0000000..a99b634 --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj.filters @@ -0,0 +1,143 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {43c6d046-ba3b-4ff2-b7e6-df455affa6bf} + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + + + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + + diff --git a/build/win32/vs10/cogl.vcxproj.filtersin b/build/win32/vs10/cogl.vcxproj.filtersin new file mode 100644 index 0000000..92d1198 --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj.filtersin @@ -0,0 +1,41 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {43c6d046-ba3b-4ff2-b7e6-df455affa6bf} + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + + Sources + Sources + Sources + Sources +#include "cogl.vs10.sourcefiles.filters" + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + Sources\Driver_GL + + + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + Resource Files + + diff --git a/build/win32/vs10/cogl.vcxprojin b/build/win32/vs10/cogl.vcxprojin new file mode 100644 index 0000000..02478ad --- /dev/null +++ b/build/win32/vs10/cogl.vcxprojin @@ -0,0 +1,537 @@ + + + + + Debug + Win32 + + + Debug_SDL + Win32 + + + Debug + x64 + + + Debug_SDL + x64 + + + Release + Win32 + + + Release_SDL + Win32 + + + Release + x64 + + + Release_SDL + x64 + + + + {F3A80987-5411-43DB-A23B-06F2076E1206} + cogl + Win32Proj + + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + true + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + DynamicLibrary + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + Debug\$(Platform)\bin\ + true + true + Debug\$(Platform)\bin\ + false + false + Release\$(Platform)\bin\ + true + true + Release\$(Platform)\bin\ + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX86 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + Disabled + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + MachineX64 + + + + + + + + MaxSpeed + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + MaxSpeed + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + + + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + + + ..\..\..\cogl\deprecated;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;..\..\..\cogl\driver\gl\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + SDL2.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + $(IntDir)\cogl.def + $(TargetDir)$(ProjectName)-$(ApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + true + true + true + true + + + true + true + true + true + + +#include "cogl.vs10.sourcefiles" + + + + + + + + + + + + + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + Copying config.h from config.h.win32... + $(CopyConfigH) + ..\..\..\config.h;%(Outputs) + + + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + Copying cogl-gl-header.h from cogl-gl-header.h.win32... + $(CopyGLHeaderH) + ..\..\..\cogl\cogl-gl-header.h;%(Outputs) + + + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32... + $(CopyDefinesH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\WGL_DEFINES;%(Outputs) + + + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + Copying cogl-defines.h from cogl-defines.h.win32_SDL... + $(CopyDefinesSDLH) + ..\..\..\cogl\cogl-defines.h;..\..\..\cogl\SDL_DEFINES;%(Outputs) + + + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglSDLDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + Generating $(IntDir)\cogl.def + $(GenerateCoglDef) + $(IntDir)\cogl.def;%(Outputs) + + + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.h + $(GenCoglEnumsH) + ..\..\..\cogl\cogl-enum-types.h;%(Outputs) + + + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + Generating ..\..\..\cogl\cogl-enum-types.c + $(GenCoglEnumsC) + ..\..\..\cogl\cogl-enum-types.c;%(Outputs) + + + + + + + + + diff --git a/build/win32/vs10/install.vcxproj b/build/win32/vs10/install.vcxproj new file mode 100644 index 0000000..a1fbd15 --- /dev/null +++ b/build/win32/vs10/install.vcxproj @@ -0,0 +1,217 @@ + + + + + Debug + Win32 + + + Debug_SDL + Win32 + + + Debug + x64 + + + Debug_SDL + x64 + + + Release + Win32 + + + Release_SDL + Win32 + + + Release + x64 + + + Release_SDL + x64 + + + + {35B2A4AC-7235-4FC7-995D-469D59195041} + install + + + + Utility + MultiByte + v100 + + + Utility + MultiByte + v100 + + + Utility + MultiByte + v100 + + + Utility + MultiByte + v100 + + + Utility + MultiByte + true + v100 + + + Utility + MultiByte + true + v100 + + + Utility + MultiByte + true + v100 + + + Utility + MultiByte + true + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + + + + + + + + + + + + + + + + + + + + + Installing Build Results... + $(CoglDoInstall) + $(InstalledDlls);$(InstalledBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall)$(CoglDoInstallSDL) + $(InstalledDlls);$(InstalledBins);$(InstalledSDLBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall) + $(InstalledDlls);$(InstalledBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall)$(CoglDoInstallSDL) + $(InstalledDlls);$(InstalledBins);$(InstalledSDLBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall) + $(InstalledDlls);$(InstalledBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall)$(CoglDoInstallSDL) + $(InstalledDlls);$(InstalledBins);$(InstalledSDLBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall) + $(InstalledDlls);$(InstalledBins);%(Outputs) + Installing Build Results... + $(CoglDoInstall)$(CoglDoInstallSDL) + $(InstalledDlls);$(InstalledBins);$(InstalledSDLBins);%(Outputs) + + + + + {0f08f253-de1a-40cb-a890-93ae3ca23ade} + false + + + {de1a2710-04bb-4c3d-90c1-b070e326b1cf} + false + + + {f5a43c12-7032-428e-a56a-d294075fa493} + false + + + {0b5d144d-1872-42cd-8437-ffdcdd08c03e} + false + + + {cd17f5c8-c860-4a65-8209-4d0b093a3da3} + false + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + {f3a80987-5411-43db-a23b-06f2076e1207} + false + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + diff --git a/build/win32/vs10/test-conformance-cogl.vcxproj b/build/win32/vs10/test-conformance-cogl.vcxproj new file mode 100644 index 0000000..5ea8136 --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj @@ -0,0 +1,231 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} + testconformancecogl + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + true + COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {ea036190-0950-4640-84f9-d459a33b33a8} + false + + + {f3a80987-5411-43db-a23b-06f2076e1207} + false + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + + + + diff --git a/build/win32/vs10/test-conformance-cogl.vcxproj.filters b/build/win32/vs10/test-conformance-cogl.vcxproj.filters new file mode 100644 index 0000000..2e3236c --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj.filters @@ -0,0 +1,59 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + Sources + + diff --git a/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin b/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin new file mode 100644 index 0000000..7d44a1f --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin @@ -0,0 +1,13 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + +#include "testconformance.vs10.sourcefiles.filters" + Sources + + diff --git a/build/win32/vs10/test-conformance-cogl.vcxprojin b/build/win32/vs10/test-conformance-cogl.vcxprojin new file mode 100644 index 0000000..a4aded6 --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxprojin @@ -0,0 +1,185 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} + testconformancecogl + Win32Proj + + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + Application + MultiByte + true + v100 + + + Application + MultiByte + v100 + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + true + COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + ..\..\..\test-fixtures;%(AdditionalIncludeDirectories) + COGL_ENABLE_EXPERIMENTAL_API;$(CoglAppAvoidForcedSDLLinkingDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + +#include "testconformance.vs10.sourcefiles" + + + + + {ea036190-0950-4640-84f9-d459a33b33a8} + false + + + {f3a80987-5411-43db-a23b-06f2076e1207} + false + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + + + + diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am new file mode 100644 index 0000000..a08a187 --- /dev/null +++ b/build/win32/vs9/Makefile.am @@ -0,0 +1,21 @@ +EXTRA_DIST = \ + cogl.sln \ + cogl-version-paths.vsprops \ + cogl-build-defines.vsprops \ + cogl-gen-srcs.vsprops \ + cogl-install.vsprops \ + cogl.vcproj \ + cogl.vcprojin \ + cogl-path.vcproj \ + cogl-path.vcprojin \ + cogl-pango.vcproj \ + cogl-pango.vcprojin \ + test-conformance-cogl.vcproj \ + test-conformance-cogl.vcprojin \ + cogl-hello.vcproj \ + cogl-sdl2-hello.vcproj \ + cogl-crate.vcproj \ + cogl-msaa.vcproj \ + cogl-info.vcproj \ + install.vcproj \ + README.txt diff --git a/build/win32/vs9/Makefile.in b/build/win32/vs9/Makefile.in new file mode 100644 index 0000000..39de368 --- /dev/null +++ b/build/win32/vs9/Makefile.in @@ -0,0 +1,592 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = build/win32/vs9 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + cogl.sln \ + cogl-version-paths.vsprops \ + cogl-build-defines.vsprops \ + cogl-gen-srcs.vsprops \ + cogl-install.vsprops \ + cogl.vcproj \ + cogl.vcprojin \ + cogl-path.vcproj \ + cogl-path.vcprojin \ + cogl-pango.vcproj \ + cogl-pango.vcprojin \ + test-conformance-cogl.vcproj \ + test-conformance-cogl.vcprojin \ + cogl-hello.vcproj \ + cogl-sdl2-hello.vcproj \ + cogl-crate.vcproj \ + cogl-msaa.vcproj \ + cogl-info.vcproj \ + install.vcproj \ + README.txt + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign build/win32/vs9/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign build/win32/vs9/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/build/win32/vs9/README.txt b/build/win32/vs9/README.txt new file mode 100644 index 0000000..f277f97 --- /dev/null +++ b/build/win32/vs9/README.txt @@ -0,0 +1,95 @@ +Note that all this is rather experimental. + +A more detailed description on using Visual C++ to compile COGL with +its dependencies can be found on the following GNOME Live! page: + +https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack + +Please do not attempt to compile Cogl in a path that contains spaces +to avoid potential problems during compilation, linking or usage. + +This VS9 solution and the projects it includes are intented to be used +in a Cogl source tree unpacked from a tarball. In a git checkout you +first need to use some Unix-like environment or manual work to expand +the files needed, like config.h.win32.in into config.h.win32 and the +.vcprojin files here into corresponding actual .vcproj files. + +You will need the parts from GNOME: GDK-Pixbuf, Pango* and GLib. +External dependencies are at least zlib, libpng, +gettext-runtime* and Cairo*, and glext.h from +http://www.opengl.org/registry/api/glext.h (which need to be in the GL folder +in your include directories or in \vs9\\include\GL). Please +note that although the Cogl source package does allow one to build Cogl without +a previously built and installed GLib, the Visual Studio projects only support +builds that does depend on GLib. + +As Cogl use C99 types in lieu of GLib types, a compatible implementation of +stdint.h for Visual C++ is required, such as the one from +http://code.google.com/p/msinttypes/, so one would need to download and extract +the .zip file from that website and extract stdint.h into +\vs9\\include or somewhere where it can be found +automatically found by the compiler. Note that Visual C++ 2010 and later +ships with stdint.h, so it is only required for Visual C++ 2008 builds. + +If building the SDL2 winsys is desired (the *_SDL configs), you will also need the +SDL2 libraries from www.libsdl.org-building the SDL source package with Visual C++ 2008 +is recommended via CMake, but one may want to use the Visual C++ binary packages +from that website. Since Cogl-1.18.x, the Visual Studio Projects have been updated +to support the build of the SDL2 winsys in place of the original SDL-1.3 winsys +as SDL-2.x has been released for some time. Please note, as builds with the SDL2 +winsys includes the SDL2 headers, main() will be defined to SDL2's special main() +implementation on Windows, which will require linking to SDL2.lib and SDL2main.lib +for all apps that link to Cogl, unless SDL_MAIN_HANDLED is defined in your +"preprocessor definitions" options. + +Please see the README file in the root directory of this Cogl source package +for the versions of the dependencies required. See also +build/win32/vs9/README.txt in the GLib source package for details +where to unpack them. It is recommended that at least the dependencies +from GNOME are also built with VS9 to avoid crashes caused by mixing different +CRTs-please see also the build/win32/vs9/README.txt in those respective packages. + +The recommended build sequence of the dependencies are as follows (the non-GNOME +packages that are not downloaded as binaries from ftp://ftp.gnome.org have +makefiles and/or VS project files that can be used to compile with VS directly, +except the optional PCRE, which is built on VS using CMake; GLib has +VS9 project files in the latest stable versions, GDK-Pixbuf have VS9 project files +in the latest unstable version, and Pango should have VS9 project files +in the next unstable release): +-Unzip the binary packages for gettext-runtime, freetype, expat and fontconfig + downloaded from ftp://ftp.gnome.org* +-zlib +-libpng +-(optional for GLib) PCRE (8.12 or later, building PCRE using CMake is + recommended-please see build/win32/vs9/README.txt in the GLib source package) +-(for gdk-pixbuf, if GDI+ is not to be used) IJG JPEG or libjpeg-turbo +-(for gdk-pixbuf, if GDI+ is not to be used) jasper [JPEG-2000 library] +-(for gdk-pixbuf, if GDI+ is not to be used, requires zlib and IJG JPEG/libjpeg-turbo) + libtiff +-GLib +-Cairo +-Pango +-GDK-Pixbuf + +The "install" project will copy build results and headers into their +appropriate location under \vs9\. For instance, +built DLLs go into \vs9\\bin, built LIBs into +\vs9\\lib and Cogl headers into +\vs9\\include\Cogl-2.0. + +*There is no known official VS9 build support for fontconfig + (along with freetype and expat) and gettext-runtime, so + please use the binaries from: + + ftp://ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/ (32 bit) + ftp://ftp.gnome.org/pub/GNOME/binaries/win64/dependencies/ (64 bit) + +Note: If you see C4819 errors and you are compiling Cogl on a DBCS +(Chinese/Korean/Japanese) version of Windows, you may need to switch +to an English locale in Control Panel->Region and Languages->System-> +Change System Locale, reboot and rebuild to ensure Cogl and its +dependencies are built correctly. This is due to a bug in Visual C++ +running on DBCS locales. + +--Chun-wei Fan + (Adopted from the GTK+ Win32 VS README.txt file originally by Tor Lillqvist) diff --git a/build/win32/vs9/cogl-build-defines.vsprops b/build/win32/vs9/cogl-build-defines.vsprops new file mode 100644 index 0000000..5fc6282 --- /dev/null +++ b/build/win32/vs9/cogl-build-defines.vsprops @@ -0,0 +1,53 @@ + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-crate.vcproj b/build/win32/vs9/cogl-crate.vcproj new file mode 100644 index 0000000..359289c --- /dev/null +++ b/build/win32/vs9/cogl-crate.vcproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-gen-srcs.vsprops b/build/win32/vs9/cogl-gen-srcs.vsprops new file mode 100644 index 0000000..cfd33a4 --- /dev/null +++ b/build/win32/vs9/cogl-gen-srcs.vsprops @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-hello.vcproj b/build/win32/vs9/cogl-hello.vcproj new file mode 100644 index 0000000..cd850a5 --- /dev/null +++ b/build/win32/vs9/cogl-hello.vcproj @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-info.vcproj b/build/win32/vs9/cogl-info.vcproj new file mode 100644 index 0000000..3c69e31 --- /dev/null +++ b/build/win32/vs9/cogl-info.vcproj @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-install.vsprops b/build/win32/vs9/cogl-install.vsprops new file mode 100644 index 0000000..292eb9b --- /dev/null +++ b/build/win32/vs9/cogl-install.vsprops @@ -0,0 +1,133 @@ + + + + + + diff --git a/build/win32/vs9/cogl-msaa.vcproj b/build/win32/vs9/cogl-msaa.vcproj new file mode 100644 index 0000000..d3fd6f1 --- /dev/null +++ b/build/win32/vs9/cogl-msaa.vcproj @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-pango.vcproj b/build/win32/vs9/cogl-pango.vcproj new file mode 100644 index 0000000..78cedaa --- /dev/null +++ b/build/win32/vs9/cogl-pango.vcproj @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-pango.vcprojin b/build/win32/vs9/cogl-pango.vcprojin new file mode 100644 index 0000000..99a53fd --- /dev/null +++ b/build/win32/vs9/cogl-pango.vcprojin @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "coglpango.sourcefiles" + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-path.vcproj b/build/win32/vs9/cogl-path.vcproj new file mode 100644 index 0000000..917860d --- /dev/null +++ b/build/win32/vs9/cogl-path.vcproj @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-path.vcprojin b/build/win32/vs9/cogl-path.vcprojin new file mode 100644 index 0000000..91e17d4 --- /dev/null +++ b/build/win32/vs9/cogl-path.vcprojin @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "cogl-path.sourcefiles" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-sdl2-hello.vcproj b/build/win32/vs9/cogl-sdl2-hello.vcproj new file mode 100644 index 0000000..822ce18 --- /dev/null +++ b/build/win32/vs9/cogl-sdl2-hello.vcproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-version-paths.vsprops b/build/win32/vs9/cogl-version-paths.vsprops new file mode 100644 index 0000000..af53ce7 --- /dev/null +++ b/build/win32/vs9/cogl-version-paths.vsprops @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl.sln b/build/win32/vs9/cogl.sln new file mode 100644 index 0000000..574dfea --- /dev/null +++ b/build/win32/vs9/cogl.sln @@ -0,0 +1,208 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl", "cogl.vcproj", "{F3A80987-5411-43DB-A23B-06F2076E1206}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-path", "cogl-path.vcproj", "{F3A80987-5411-43DB-A23B-06F2076E1207}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-pango", "cogl-pango.vcproj", "{FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-hello", "cogl-hello.vcproj", "{F5A43C12-7032-428E-A56A-D294075FA493}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-sdl2-hello", "cogl-sdl2-hello.vcproj", "{0B5D144D-1872-42CD-8437-FFDCDD08C03E}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-crate", "cogl-crate.vcproj", "{DE1A2710-04BB-4C3D-90C1-B070E326B1CF}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} = {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl-info", "cogl-info.vcproj", "{CD17F5C8-C860-4A65-8209-4D0B093A3DA3}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-conformance-cogl", "test-conformance-cogl.vcproj", "{0F08F253-DE1A-40CB-A890-93AE3CA23ADE}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} = {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + {F3A80987-5411-43DB-A23B-06F2076E1207} = {F3A80987-5411-43DB-A23B-06F2076E1207} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "install.vcproj", "{35B2A4AC-7235-4FC7-995D-469D59195041}" + ProjectSection(ProjectDependencies) = postProject + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} = {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + {F5A43C12-7032-428E-A56A-D294075FA493} = {F5A43C12-7032-428E-A56A-D294075FA493} + {0B5D144D-1872-42CD-8437-FFDCDD08C03E} = {0B5D144D-1872-42CD-8437-FFDCDD08C03E} + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} = {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + {F3A80987-5411-43DB-A23B-06F2076E1207} = {F3A80987-5411-43DB-A23B-06F2076E1207} + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF} = {DE1A2710-04BB-4C3D-90C1-B070E326B1CF} + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} = {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug_SDL|Win32 = Debug_SDL|Win32 + Debug|x64 = Debug|x64 + Debug_SDL|x64 = Debug_SDL|x64 + Release|Win32 = Release|Win32 + Release_SDL|Win32 = Release_SDL|Win32 + Release|x64 = Release|x64 + Release_SDL|x64 = Release_SDL|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.Build.0 = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|Win32.ActiveCfg = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|Win32.Build.0 = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|x64.ActiveCfg = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug_SDL|x64.Build.0 = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|Win32.ActiveCfg = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|Win32.Build.0 = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|x64.ActiveCfg = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release_SDL|x64.Build.0 = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release|x64.Build.0 = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Debug_SDL|x64.Build.0 = Debug|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|Win32.Build.0 = Release|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|x64.ActiveCfg = Release|x64 + {F3A80987-5411-43DB-A23B-06F2076E1207}.Release_SDL|x64.Build.0 = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|Win32.Build.0 = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|x64.ActiveCfg = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug|x64.Build.0 = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|Win32.ActiveCfg = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|Win32.Build.0 = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|x64.ActiveCfg = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release|x64.Build.0 = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Debug_SDL|x64.Build.0 = Debug|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|Win32.Build.0 = Release|Win32 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|x64.ActiveCfg = Release|x64 + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768}.Release_SDL|x64.Build.0 = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug_SDL|x64.Build.0 = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|Win32.Build.0 = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|x64.ActiveCfg = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release_SDL|x64.Build.0 = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|Win32.ActiveCfg = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|Win32.Build.0 = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|x64.ActiveCfg = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug|x64.Build.0 = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|Win32.ActiveCfg = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|Win32.Build.0 = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|x64.ActiveCfg = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release|x64.Build.0 = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Debug_SDL|x64.Build.0 = Debug|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|Win32.Build.0 = Release|Win32 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|x64.ActiveCfg = Release|x64 + {F5A43C12-7032-428E-A56A-D294075FA493}.Release_SDL|x64.Build.0 = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|Win32.ActiveCfg = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|Win32.Build.0 = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|x64.ActiveCfg = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug|x64.Build.0 = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|Win32.ActiveCfg = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|Win32.Build.0 = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|x64.ActiveCfg = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release|x64.Build.0 = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Debug_SDL|x64.Build.0 = Debug|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|Win32.Build.0 = Release|Win32 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|x64.ActiveCfg = Release|x64 + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3}.Release_SDL|x64.Build.0 = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|Win32.ActiveCfg = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|Win32.Build.0 = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|x64.ActiveCfg = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug|x64.Build.0 = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|Win32.ActiveCfg = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|Win32.Build.0 = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|x64.ActiveCfg = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release|x64.Build.0 = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Debug_SDL|x64.Build.0 = Debug|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|Win32.Build.0 = Release|Win32 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|x64.ActiveCfg = Release|x64 + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF}.Release_SDL|x64.Build.0 = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|Win32.Build.0 = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|x64.ActiveCfg = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug|x64.Build.0 = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|Win32.ActiveCfg = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|Win32.Build.0 = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|x64.ActiveCfg = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release|x64.Build.0 = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|Win32.ActiveCfg = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|Win32.Build.0 = Debug|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|x64.ActiveCfg = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Debug_SDL|x64.Build.0 = Debug|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|Win32.ActiveCfg = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|Win32.Build.0 = Release|Win32 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|x64.ActiveCfg = Release|x64 + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE}.Release_SDL|x64.Build.0 = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|Win32.ActiveCfg = Debug|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|Win32.Build.0 = Debug|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|x64.ActiveCfg = Debug|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug|x64.Build.0 = Debug|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|Win32.ActiveCfg = Release|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|Win32.Build.0 = Release|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|x64.ActiveCfg = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release|x64.Build.0 = Release|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|Win32.ActiveCfg = Debug_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|Win32.Build.0 = Debug_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|x64.ActiveCfg = Debug_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Debug_SDL|x64.Build.0 = Debug_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|Win32.ActiveCfg = Release_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|Win32.Build.0 = Release_SDL|Win32 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|x64.ActiveCfg = Release_SDL|x64 + {35B2A4AC-7235-4FC7-995D-469D59195041}.Release_SDL|x64.Build.0 = Release_SDL|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/win32/vs9/cogl.vcproj b/build/win32/vs9/cogl.vcproj new file mode 100644 index 0000000..651a4cc --- /dev/null +++ b/build/win32/vs9/cogl.vcproj @@ -0,0 +1,800 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl.vcprojin b/build/win32/vs9/cogl.vcprojin new file mode 100644 index 0000000..0d10f8d --- /dev/null +++ b/build/win32/vs9/cogl.vcprojin @@ -0,0 +1,698 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "cogl.sourcefiles" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/install.vcproj b/build/win32/vs9/install.vcproj new file mode 100644 index 0000000..58c8485 --- /dev/null +++ b/build/win32/vs9/install.vcproj @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/test-conformance-cogl.vcproj b/build/win32/vs9/test-conformance-cogl.vcproj new file mode 100644 index 0000000..23165c6 --- /dev/null +++ b/build/win32/vs9/test-conformance-cogl.vcproj @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/test-conformance-cogl.vcprojin b/build/win32/vs9/test-conformance-cogl.vcprojin new file mode 100644 index 0000000..c664217 --- /dev/null +++ b/build/win32/vs9/test-conformance-cogl.vcprojin @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "testconformance.sourcefiles" + + + + + + diff --git a/cogl-gles2/GLES2/gl2.h b/cogl-gles2/GLES2/gl2.h new file mode 100644 index 0000000..718fb3b --- /dev/null +++ b/cogl-gles2/GLES2/gl2.h @@ -0,0 +1,169 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + +/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2_h_ */ diff --git a/cogl-gles2/GLES2/gl2ext.h b/cogl-gles2/GLES2/gl2ext.h new file mode 100644 index 0000000..e4016a5 --- /dev/null +++ b/cogl-gles2/GLES2/gl2ext.h @@ -0,0 +1,1498 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + +/* $Revision: 16994 $ on $Date:: 2012-02-29 18:29:34 -0800 #$ */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +/* GLeglImageOES defined in GL_OES_EGL_image already. */ +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_float */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_texture_half_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +#endif + +/* GL_ANGLE_instanced_arrays */ +#ifndef GL_ANGLE_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif + +/* GL_ANGLE_translated_shader_source */ +#ifndef GL_ANGLE_translated_shader_source +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#endif + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif + +/*------------------------------------------------------------------------* + * ARM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif + +/* GL_ARM_rgba8 */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +/* GL_EXT_debug_marker */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 +#define GL_MAX_SAMPLES_EXT 0x9135 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#endif + +/* GL_EXT_shader_texture_lod */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +/* reuse GL_RGB16F_EXT */ +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#endif + +/*------------------------------------------------------------------------* + * DMP extension tokens + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_SHADER_BINARY_DMP 0x9250 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_READ_BUFFER_NV 0x0C02 +#endif + +/* GL_NV_read_buffer_front */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_compression_s3tc_update */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_npot_2D_mipmap */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +#endif + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_depth_texture */ +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fragment_precision_high */ +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif + +/* GL_OES_texture_float */ +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif + +/* GL_OES_texture_float_linear */ +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#endif + +/* GL_OES_texture_half_float_linear */ +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif + +/* GL_OES_texture_npot */ +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif + +/* GL_OES_vertex_half_float */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#endif + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ANGLE_instanced_arrays +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#endif + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif + +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#endif + +/*------------------------------------------------------------------------* + * ARM extension functions + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#endif + +/* GL_ARM_rgba8 */ +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +/* GL_EXT_debug_marker */ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +#endif +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + +/* GL_EXT_shader_texture_lod */ +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#endif + +/*------------------------------------------------------------------------* + * DMP extension functions + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); +#endif +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#endif + +/* GL_NV_read_buffer_front */ +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif + +/* GL_NV_read_depth */ +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif + +/* GL_NV_read_depth_stencil */ +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif + +/* GL_NV_read_stencil */ +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif + +/* GL_NV_texture_compression_s3tc_update */ +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif + +/* GL_NV_texture_npot_2D_mipmap */ +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#endif + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +#endif + +/* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */ diff --git a/cogl-gles2/GLES2/gl2platform.h b/cogl-gles2/GLES2/gl2platform.h new file mode 100644 index 0000000..8bc44b0 --- /dev/null +++ b/cogl-gles2/GLES2/gl2platform.h @@ -0,0 +1,28 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +#ifndef GL_APICALL +#define GL_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/cogl-gles2/Makefile.am b/cogl-gles2/Makefile.am new file mode 100644 index 0000000..72ec1ea --- /dev/null +++ b/cogl-gles2/Makefile.am @@ -0,0 +1,36 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +# preamble + +NULL = + +lib_LTLIBRARIES = libcogl-gles2.la + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir) + +if !USE_GLIB +AM_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) + +libcogl_gles2_la_SOURCES = cogl-gles2-api.c +libcogl_gles2_la_LDFLAGS = \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -export-dynamic \ + -export-symbols-regex "^gl*" + +coglgles2includedir = $(includedir)/cogl/cogl-gles2/GLES2 +coglgles2include_HEADERS = \ + GLES2/gl2.h \ + GLES2/gl2ext.h \ + GLES2/gl2platform.h + +pc_files = cogl-gles2-1.0.pc \ + cogl-gles2-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) diff --git a/cogl-gles2/Makefile.in b/cogl-gles2/Makefile.in new file mode 100644 index 0000000..4090b7c --- /dev/null +++ b/cogl-gles2/Makefile.in @@ -0,0 +1,875 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/cogl-gles2-1.0.pc.in \ + $(srcdir)/cogl-gles2-2.0-experimental.pc.in \ + $(top_srcdir)/build/depcomp $(coglgles2include_HEADERS) +@USE_GLIB_FALSE@am__append_1 = -I$(top_builddir)/deps/glib +subdir = cogl-gles2 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-gles2-1.0.pc cogl-gles2-2.0-experimental.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(coglgles2includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libcogl_gles2_la_LIBADD = +am_libcogl_gles2_la_OBJECTS = cogl-gles2-api.lo +libcogl_gles2_la_OBJECTS = $(am_libcogl_gles2_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcogl_gles2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libcogl_gles2_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcogl_gles2_la_SOURCES) +DIST_SOURCES = $(libcogl_gles2_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(pkgconfig_DATA) +HEADERS = $(coglgles2include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; + +# preamble +NULL = +lib_LTLIBRARIES = libcogl-gles2.la +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) $(am__append_1) +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_gles2_la_SOURCES = cogl-gles2-api.c +libcogl_gles2_la_LDFLAGS = \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -export-dynamic \ + -export-symbols-regex "^gl*" + +coglgles2includedir = $(includedir)/cogl/cogl-gles2/GLES2 +coglgles2include_HEADERS = \ + GLES2/gl2.h \ + GLES2/gl2ext.h \ + GLES2/gl2platform.h + +pc_files = cogl-gles2-1.0.pc \ + cogl-gles2-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cogl-gles2/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign cogl-gles2/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-gles2-1.0.pc: $(top_builddir)/config.status $(srcdir)/cogl-gles2-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-gles2-2.0-experimental.pc: $(top_builddir)/config.status $(srcdir)/cogl-gles2-2.0-experimental.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcogl-gles2.la: $(libcogl_gles2_la_OBJECTS) $(libcogl_gles2_la_DEPENDENCIES) $(EXTRA_libcogl_gles2_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcogl_gles2_la_LINK) -rpath $(libdir) $(libcogl_gles2_la_OBJECTS) $(libcogl_gles2_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gles2-api.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-coglgles2includeHEADERS: $(coglgles2include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(coglgles2include_HEADERS)'; test -n "$(coglgles2includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(coglgles2includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(coglgles2includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(coglgles2includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(coglgles2includedir)" || exit $$?; \ + done + +uninstall-coglgles2includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(coglgles2include_HEADERS)'; test -n "$(coglgles2includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(coglgles2includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(coglgles2includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-coglgles2includeHEADERS install-pkgconfigDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-coglgles2includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am \ + install-coglgles2includeHEADERS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am \ + uninstall-coglgles2includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-pkgconfigDATA + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cogl-gles2/cogl-gles2-1.0.pc.in b/cogl-gles2/cogl-gles2-1.0.pc.in new file mode 100644 index 0000000..698d05c --- /dev/null +++ b/cogl-gles2/cogl-gles2-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=1.0 +requires=@COGL_PKG_REQUIRES@ cogl-1.0 + +Name: Cogl +Description: An object oriented GL/GLES Abstraction/Utility Layer +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-gles2 +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-gles2/cogl-gles2-2.0-experimental.pc.in b/cogl-gles2/cogl-gles2-2.0-experimental.pc.in new file mode 100644 index 0000000..41199e9 --- /dev/null +++ b/cogl-gles2/cogl-gles2-2.0-experimental.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=cogl-2.0-experimental + +Name: CoglGLES2 +Description: Cogl OpenGL ES 2.0 frontend api +Version: @COGL_VERSION@ +Libs: -L${libdir} -lcogl-gles2 +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-gles2/cogl-gles2-api.c b/cogl-gles2/cogl-gles2-api.c new file mode 100644 index 0000000..22ab2b7 --- /dev/null +++ b/cogl-gles2/cogl-gles2-api.c @@ -0,0 +1,1048 @@ + +#include + +#include + +void +glBindTexture (GLenum target, GLuint texture) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBindTexture (target, texture); +} + +void +glBlendFunc (GLenum sfactor, GLenum dfactor) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBlendFunc (sfactor, dfactor); +} + +void +glClear (GLbitfield mask) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glClear (mask); +} + +void +glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glClearColor (red, green, blue, alpha); +} + +void +glClearStencil (GLint s) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glClearStencil (s); +} + +void +glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glColorMask (red, green, blue, alpha); +} + +void +glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCopyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, + height); +} + +void +glDeleteTextures (GLsizei n, const GLuint * textures) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteTextures (n, textures); +} + +void +glDepthFunc (GLenum func) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDepthFunc (func); +} + +void +glDepthMask (GLboolean flag) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDepthMask (flag); +} + +void +glDisable (GLenum cap) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDisable (cap); +} + +void +glDrawArrays (GLenum mode, GLint first, GLsizei count) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDrawArrays (mode, first, count); +} + +void +glDrawElements (GLenum mode, GLsizei count, GLenum type, + const GLvoid * indices) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDrawElements (mode, count, type, indices); +} + +void +glEnable (GLenum cap) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glEnable (cap); +} + +void +glFinish (void) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glFinish (); +} + +void +glFlush (void) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glFlush (); +} + +void +glFrontFace (GLenum mode) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glFrontFace (mode); +} + +void +glCullFace (GLenum mode) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCullFace (mode); +} + +void +glGenTextures (GLsizei n, GLuint * textures) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGenTextures (n, textures); +} + +GLenum +glGetError (void) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glGetError (); +} + +void +glGetIntegerv (GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetIntegerv (pname, params); +} + +void +glGetBooleanv (GLenum pname, GLboolean * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetBooleanv (pname, params); +} + +void +glGetFloatv (GLenum pname, GLfloat * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetFloatv (pname, params); +} + +const GLubyte * +glGetString (GLenum name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glGetString (name); +} + +void +glHint (GLenum target, GLenum mode) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glHint (target, mode); +} + +GLboolean +glIsTexture (GLuint texture) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsTexture (texture); +} + +void +glPixelStorei (GLenum pname, GLint param) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glPixelStorei (pname, param); +} + +void +glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, + GLenum type, GLvoid * pixels) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glReadPixels (x, y, width, height, format, type, pixels); +} + +void +glScissor (GLint x, GLint y, GLsizei width, GLsizei height) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glScissor (x, y, width, height); +} + +void +glStencilFunc (GLenum func, GLint ref, GLuint mask) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilFunc (func, ref, mask); +} + +void +glStencilMask (GLuint mask) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilMask (mask); +} + +void +glStencilOp (GLenum fail, GLenum zfail, GLenum zpass) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilOp (fail, zfail, zpass); +} + +void +glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, + GLsizei height, GLint border, GLenum format, GLenum type, + const GLvoid * pixels) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexImage2D (target, level, internalformat, width, height, border, + format, type, pixels); +} + +void +glTexParameterf (GLenum target, GLenum pname, GLfloat param) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexParameterf (target, pname, param); +} + +void +glTexParameterfv (GLenum target, GLenum pname, const GLfloat * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexParameterfv (target, pname, params); +} + +void +glTexParameteri (GLenum target, GLenum pname, GLint param) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexParameteri (target, pname, param); +} + +void +glTexParameteriv (GLenum target, GLenum pname, const GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexParameteriv (target, pname, params); +} + +void +glGetTexParameterfv (GLenum target, GLenum pname, GLfloat * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetTexParameterfv (target, pname, params); +} + +void +glGetTexParameteriv (GLenum target, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetTexParameteriv (target, pname, params); +} + +void +glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLenum type, + const GLvoid * pixels) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glTexSubImage2D (target, level, xoffset, yoffset, width, height, + format, type, pixels); +} + +void +glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, + GLint y, GLsizei width, GLsizei height, GLint border) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCopyTexImage2D (target, level, internalformat, + x, y, width, height, border); +} + +void +glViewport (GLint x, GLint y, GLsizei width, GLsizei height) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glViewport (x, y, width, height); +} + +GLboolean +glIsEnabled (GLenum cap) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsEnabled (cap); +} + +void +glLineWidth (GLfloat width) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glLineWidth (width); +} + +void +glPolygonOffset (GLfloat factor, GLfloat units) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glPolygonOffset (factor, units); +} + +void +glDepthRangef (GLfloat near_val, GLfloat far_val) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDepthRangef (near_val, far_val); +} + +void +glClearDepthf (GLclampf depth) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glClearDepthf (depth); +} + +void +glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, + GLsizei imageSize, const GLvoid * data) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCompressedTexImage2D (target, level, internalformat, width, + height, border, imageSize, data); +} + +void +glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid * data) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCompressedTexSubImage2D (target, level, + xoffset, yoffset, width, height, + format, imageSize, data); +} + +void +glSampleCoverage (GLclampf value, GLboolean invert) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glSampleCoverage (value, invert); +} + +void +glGetBufferParameteriv (GLenum target, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetBufferParameteriv (target, pname, params); +} + +void +glGenBuffers (GLsizei n, GLuint * buffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGenBuffers (n, buffers); +} + +void +glBindBuffer (GLenum target, GLuint buffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBindBuffer (target, buffer); +} + +void +glBufferData (GLenum target, GLsizeiptr size, const GLvoid * data, + GLenum usage) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBufferData (target, size, data, usage); +} + +void +glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, + const GLvoid * data) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBufferSubData (target, offset, size, data); +} + +void +glDeleteBuffers (GLsizei n, const GLuint * buffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteBuffers (n, buffers); +} + +GLboolean +glIsBuffer (GLuint buffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsBuffer (buffer); +} + +void +glActiveTexture (GLenum texture) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glActiveTexture (texture); +} + +void +glGenRenderbuffers (GLsizei n, GLuint * renderbuffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGenRenderbuffers (n, renderbuffers); +} + +void +glDeleteRenderbuffers (GLsizei n, const GLuint * renderbuffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteRenderbuffers (n, renderbuffers); +} + +void +glBindRenderbuffer (GLenum target, GLuint renderbuffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBindRenderbuffer (target, renderbuffer); +} + +void +glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, + GLsizei height) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glRenderbufferStorage (target, internalformat, width, height); +} + +void +glGenFramebuffers (GLsizei n, GLuint * framebuffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGenFramebuffers (n, framebuffers); +} + +void +glBindFramebuffer (GLenum target, GLuint framebuffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBindFramebuffer (target, framebuffer); +} + +void +glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, + GLuint texture, GLint level) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glFramebufferTexture2D (target, attachment, + textarget, texture, level); +} + +void +glFramebufferRenderbuffer (GLenum target, GLenum attachment, + GLenum renderbuffertarget, GLuint renderbuffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glFramebufferRenderbuffer (target, attachment, + renderbuffertarget, renderbuffer); +} + +GLboolean +glIsRenderbuffer (GLuint renderbuffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsRenderbuffer (renderbuffer); +} + +GLenum +glCheckFramebufferStatus (GLenum target) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glCheckFramebufferStatus (target); +} + +void +glDeleteFramebuffers (GLsizei n, const GLuint * framebuffers) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteFramebuffers (n, framebuffers); +} + +void +glGenerateMipmap (GLenum target) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGenerateMipmap (target); +} + +void +glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, + GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetFramebufferAttachmentParameteriv (target, + attachment, pname, params); +} + +void +glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetRenderbufferParameteriv (target, pname, params); +} + +GLboolean +glIsFramebuffer (GLuint framebuffer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsFramebuffer (framebuffer); +} + +void +glBlendEquation (GLenum mode) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBlendEquation (mode); +} + +void +glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBlendColor (red, green, blue, alpha); +} + +void +glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, + GLenum dstAlpha) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBlendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void +glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBlendEquationSeparate (modeRGB, modeAlpha); +} + +void +glReleaseShaderCompiler (void) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glReleaseShaderCompiler (); +} + +void +glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, + GLint * range, GLint * precision) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetShaderPrecisionFormat (shadertype, precisiontype, + range, precision); +} + +void +glShaderBinary (GLsizei n, const GLuint * shaders, GLenum binaryformat, + const GLvoid * binary, GLsizei length) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glShaderBinary (n, shaders, binaryformat, binary, length); +} + +void +glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilFuncSeparate (face, func, ref, mask); +} + +void +glStencilMaskSeparate (GLenum face, GLuint mask) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilMaskSeparate (face, mask); +} + +void +glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glStencilOpSeparate (face, fail, zfail, zpass); +} + +GLuint +glCreateProgram (void) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glCreateProgram (); +} + +GLuint +glCreateShader (GLenum shaderType) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glCreateShader (shaderType); +} + +void +glShaderSource (GLuint shader, GLsizei count, + const GLchar * const *string, const GLint * length) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glShaderSource (shader, count, string, length); +} + +void +glCompileShader (GLuint shader) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glCompileShader (shader); +} + +void +glDeleteShader (GLuint shader) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteShader (shader); +} + +void +glAttachShader (GLuint program, GLuint shader) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glAttachShader (program, shader); +} + +void +glLinkProgram (GLuint program) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glLinkProgram (program); +} + +void +glUseProgram (GLuint program) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUseProgram (program); +} + +GLint +glGetUniformLocation (GLuint program, const char *name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glGetUniformLocation (program, name); +} + +void +glDeleteProgram (GLuint program) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDeleteProgram (program); +} + +void +glGetShaderInfoLog (GLuint shader, GLsizei maxLength, GLsizei * length, + char *infoLog) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetShaderInfoLog (shader, maxLength, length, infoLog); +} + +void +glGetShaderiv (GLuint shader, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetShaderiv (shader, pname, params); +} + +void +glVertexAttribPointer (GLuint index, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, + const GLvoid * pointer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttribPointer (index, size, type, normalized, stride, + pointer); +} + +void +glEnableVertexAttribArray (GLuint index) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glEnableVertexAttribArray (index); +} + +void +glDisableVertexAttribArray (GLuint index) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDisableVertexAttribArray (index); +} + +void +glUniform1f (GLint location, GLfloat v0) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform1f (location, v0); +} + +void +glUniform2f (GLint location, GLfloat v0, GLfloat v1) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform2f (location, v0, v1); +} + +void +glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform3f (location, v0, v1, v2); +} + +void +glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform4f (location, v0, v1, v2, v3); +} + +void +glUniform1fv (GLint location, GLsizei count, const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform1fv (location, count, value); +} + +void +glUniform2fv (GLint location, GLsizei count, const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform2fv (location, count, value); +} + +void +glUniform3fv (GLint location, GLsizei count, const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform3fv (location, count, value); +} + +void +glUniform4fv (GLint location, GLsizei count, const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform4fv (location, count, value); +} + +void +glUniform1i (GLint location, GLint v0) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform1i (location, v0); +} + +void +glUniform2i (GLint location, GLint v0, GLint v1) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform2i (location, v0, v1); +} + +void +glUniform3i (GLint location, GLint v0, GLint v1, GLint v2) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform3i (location, v0, v1, v2); +} + +void +glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform4i (location, v0, v1, v2, v3); +} + +void +glUniform1iv (GLint location, GLsizei count, const GLint * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform1iv (location, count, value); +} + +void +glUniform2iv (GLint location, GLsizei count, const GLint * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform2iv (location, count, value); +} + +void +glUniform3iv (GLint location, GLsizei count, const GLint * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform3iv (location, count, value); +} + +void +glUniform4iv (GLint location, GLsizei count, const GLint * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniform4iv (location, count, value); +} + +void +glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniformMatrix2fv (location, count, transpose, value); +} + +void +glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniformMatrix3fv (location, count, transpose, value); +} + +void +glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glUniformMatrix4fv (location, count, transpose, value); +} + +void +glGetUniformfv (GLuint program, GLint location, GLfloat * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetUniformfv (program, location, params); +} + +void +glGetUniformiv (GLuint program, GLint location, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetUniformiv (program, location, params); +} + +void +glGetProgramiv (GLuint program, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetProgramiv (program, pname, params); +} + +void +glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei * length, + char *infoLog) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetProgramInfoLog (program, bufSize, length, infoLog); +} + +void +glVertexAttrib1f (GLuint indx, GLfloat x) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib1f (indx, x); +} + +void +glVertexAttrib1fv (GLuint indx, const GLfloat * values) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib1fv (indx, values); +} + +void +glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib2f (indx, x, y); +} + +void +glVertexAttrib2fv (GLuint indx, const GLfloat * values) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib2fv (indx, values); +} + +void +glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib3f (indx, x, y, z); +} + +void +glVertexAttrib3fv (GLuint indx, const GLfloat * values) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib3fv (indx, values); +} + +void +glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib4f (index, x, y, z, w); +} + +void +glVertexAttrib4fv (GLuint indx, const GLfloat * values) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glVertexAttrib4fv (indx, values); +} + +void +glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetVertexAttribfv (index, pname, params); +} + +void +glGetVertexAttribiv (GLuint index, GLenum pname, GLint * params) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetVertexAttribiv (index, pname, params); +} + +void +glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid ** pointer) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetVertexAttribPointerv (index, pname, pointer); +} + +GLint +glGetAttribLocation (GLuint program, const char *name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glGetAttribLocation (program, name); +} + +void +glBindAttribLocation (GLuint program, GLuint index, const GLchar * name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glBindAttribLocation (program, index, name); +} + +void +glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, + GLsizei * length, GLint * size, GLenum * type, + GLchar * name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetActiveAttrib (program, index, bufsize, length, size, type, + name); +} + +void +glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, + GLsizei * length, GLint * size, GLenum * type, + GLchar * name) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetActiveUniform (program, index, bufsize, length, size, type, + name); +} + +void +glDetachShader (GLuint program, GLuint shader) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glDetachShader (program, shader); +} + +void +glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei * count, + GLuint * shaders) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetAttachedShaders (program, maxcount, count, shaders); +} + +void +glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei * length, + GLchar * source) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glGetShaderSource (shader, bufsize, length, source); +} + +GLboolean +glIsShader (GLuint shader) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsShader (shader); +} + +GLboolean +glIsProgram (GLuint program) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + return vtable->glIsProgram (program); +} + +void +glValidateProgram (GLuint program) +{ + CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); + vtable->glValidateProgram (program); +} diff --git a/cogl-gst/Makefile.am b/cogl-gst/Makefile.am new file mode 100644 index 0000000..ba0c3d8 --- /dev/null +++ b/cogl-gst/Makefile.am @@ -0,0 +1,107 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +CLEANFILES = +DISTCLEANFILES = + +EXTRA_DIST = + +source_c = \ + cogl-gst-video-sink.c \ + $(NULL) + +source_h = \ + cogl-gst.h \ + cogl-gst-video-sink.h \ + $(NULL) + +lib_LTLIBRARIES = libcogl-gst.la + +libcogl_gst_la_SOURCES = $(source_c) $(source_h) +libcogl_gst_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_gst_la_LIBADD = $(top_builddir)/cogl/libcogl.la +libcogl_gst_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_gst_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^cogl_gst_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -rpath $(libdir) + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglGst\" \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_gstheadersdir = $(includedir)/cogl/cogl-gst +cogl_gstheaders_HEADERS = $(source_h) + +plugin_source_c = \ + $(srcdir)/cogl-gst-plugin.c \ + $(NULL) + +libgstcogl_la_SOURCES = \ + $(plugin_source_c) \ + $(NULL) + +plugin_LTLIBRARIES = libgstcogl.la + +libgstcogl_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libgstcogl_la_LIBADD = \ + $(top_builddir)/cogl/libcogl.la \ + $(builddir)/libcogl-gst.la +libgstcogl_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libgstcogl_la_LDFLAGS = \ + -avoid-version -no-undefined \ + $(NULL) + +pc_files = cogl-gst-1.0.pc \ + cogl-gst-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) + +EXTRA_DIST += cogl-gst.pc.in +DISTCLEANFILES += $(pc_files) + +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION +INTROSPECTION_COMPILER_ARGS=--includedir=$(top_builddir)/cogl + +CoglGst-2.0.gir: libcogl-gst.la Makefile + +CoglGst_2_0_gir_NAMESPACE = CoglGst +CoglGst_2_0_gir_VERSION = 2.0 +CoglGst_2_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-gst.la +CoglGst_2_0_gir_FILES = $(source_h) $(source_c) +CoglGst_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_GST_DEP_CFLAGS) +CoglGst_2_0_gir_INCLUDES = GObject-2.0 Gst-1.0 GstBase-1.0 +CoglGst_2_0_gir_EXPORT_PACKAGES = cogl-gst-2.0-experimental +CoglGst_2_0_gir_SCANNERFLAGS = \ + --warn-all \ + --identifier-prefix=CoglGst \ + --symbol-prefix=cogl_gst \ + --c-include='cogl-gst/cogl-gst.h' \ + --c-include="gst/gst.h" \ + --include-uninstalled=$(top_builddir)/cogl/Cogl-2.0.gir \ + --pkg gstreamer-1.0 \ + --add-init-section="gst_init(NULL, NULL);" + +INTROSPECTION_GIRS += CoglGst-2.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/cogl-gst/Makefile.in b/cogl-gst/Makefile.in new file mode 100644 index 0000000..b9b5bc8 --- /dev/null +++ b/cogl-gst/Makefile.in @@ -0,0 +1,1055 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/cogl-gst-1.0.pc.in \ + $(srcdir)/cogl-gst-2.0-experimental.pc.in \ + $(top_srcdir)/build/depcomp $(cogl_gstheaders_HEADERS) +@HAVE_INTROSPECTION_TRUE@am__append_1 = CoglGst-2.0.gir +@HAVE_INTROSPECTION_TRUE@am__append_2 = $(gir_DATA) $(typelib_DATA) +subdir = cogl-gst +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-gst-1.0.pc cogl-gst-2.0-experimental.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" \ + "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(cogl_gstheadersdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcogl_gst_la_DEPENDENCIES = $(top_builddir)/cogl/libcogl.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = libcogl_gst_la-cogl-gst-video-sink.lo $(am__objects_1) +am__objects_3 = $(am__objects_1) +am_libcogl_gst_la_OBJECTS = $(am__objects_2) $(am__objects_3) +libcogl_gst_la_OBJECTS = $(am_libcogl_gst_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcogl_gst_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libcogl_gst_la_CFLAGS) $(CFLAGS) $(libcogl_gst_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +libgstcogl_la_DEPENDENCIES = $(top_builddir)/cogl/libcogl.la \ + $(builddir)/libcogl-gst.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_4 = libgstcogl_la-cogl-gst-plugin.lo $(am__objects_1) +am_libgstcogl_la_OBJECTS = $(am__objects_4) $(am__objects_1) +libgstcogl_la_OBJECTS = $(am_libgstcogl_la_OBJECTS) +libgstcogl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libgstcogl_la_CFLAGS) \ + $(CFLAGS) $(libgstcogl_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcogl_gst_la_SOURCES) $(libgstcogl_la_SOURCES) +DIST_SOURCES = $(libcogl_gst_la_SOURCES) $(libgstcogl_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) +HEADERS = $(cogl_gstheaders_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +CLEANFILES = $(am__append_2) +DISTCLEANFILES = $(pc_files) +EXTRA_DIST = cogl-gst.pc.in +source_c = \ + cogl-gst-video-sink.c \ + $(NULL) + +source_h = \ + cogl-gst.h \ + cogl-gst-video-sink.h \ + $(NULL) + +lib_LTLIBRARIES = libcogl-gst.la +libcogl_gst_la_SOURCES = $(source_c) $(source_h) +libcogl_gst_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_gst_la_LIBADD = $(top_builddir)/cogl/libcogl.la \ + $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_gst_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^cogl_gst_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -rpath $(libdir) + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglGst\" \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_gstheadersdir = $(includedir)/cogl/cogl-gst +cogl_gstheaders_HEADERS = $(source_h) +plugin_source_c = \ + $(srcdir)/cogl-gst-plugin.c \ + $(NULL) + +libgstcogl_la_SOURCES = \ + $(plugin_source_c) \ + $(NULL) + +plugin_LTLIBRARIES = libgstcogl.la +libgstcogl_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libgstcogl_la_LIBADD = $(top_builddir)/cogl/libcogl.la \ + $(builddir)/libcogl-gst.la $(COGL_DEP_LIBS) \ + $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libgstcogl_la_LDFLAGS = \ + -avoid-version -no-undefined \ + $(NULL) + +pc_files = cogl-gst-1.0.pc \ + cogl-gst-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) +INTROSPECTION_GIRS = $(am__append_1) +@HAVE_INTROSPECTION_TRUE@INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/cogl +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_NAMESPACE = CoglGst +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_VERSION = 2.0 +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-gst.la +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_FILES = $(source_h) $(source_c) +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_GST_DEP_CFLAGS) +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_INCLUDES = GObject-2.0 Gst-1.0 GstBase-1.0 +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_EXPORT_PACKAGES = cogl-gst-2.0-experimental +@HAVE_INTROSPECTION_TRUE@CoglGst_2_0_gir_SCANNERFLAGS = \ +@HAVE_INTROSPECTION_TRUE@ --warn-all \ +@HAVE_INTROSPECTION_TRUE@ --identifier-prefix=CoglGst \ +@HAVE_INTROSPECTION_TRUE@ --symbol-prefix=cogl_gst \ +@HAVE_INTROSPECTION_TRUE@ --c-include='cogl-gst/cogl-gst.h' \ +@HAVE_INTROSPECTION_TRUE@ --c-include="gst/gst.h" \ +@HAVE_INTROSPECTION_TRUE@ --include-uninstalled=$(top_builddir)/cogl/Cogl-2.0.gir \ +@HAVE_INTROSPECTION_TRUE@ --pkg gstreamer-1.0 \ +@HAVE_INTROSPECTION_TRUE@ --add-init-section="gst_init(NULL, NULL);" + +@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 +@HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) +@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 +@HAVE_INTROSPECTION_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cogl-gst/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign cogl-gst/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-gst-1.0.pc: $(top_builddir)/config.status $(srcdir)/cogl-gst-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-gst-2.0-experimental.pc: $(top_builddir)/config.status $(srcdir)/cogl-gst-2.0-experimental.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcogl-gst.la: $(libcogl_gst_la_OBJECTS) $(libcogl_gst_la_DEPENDENCIES) $(EXTRA_libcogl_gst_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcogl_gst_la_LINK) -rpath $(libdir) $(libcogl_gst_la_OBJECTS) $(libcogl_gst_la_LIBADD) $(LIBS) + +libgstcogl.la: $(libgstcogl_la_OBJECTS) $(libgstcogl_la_DEPENDENCIES) $(EXTRA_libgstcogl_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgstcogl_la_LINK) -rpath $(plugindir) $(libgstcogl_la_OBJECTS) $(libgstcogl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_gst_la-cogl-gst-video-sink.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstcogl_la-cogl-gst-plugin.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcogl_gst_la-cogl-gst-video-sink.lo: cogl-gst-video-sink.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_gst_la_CFLAGS) $(CFLAGS) -MT libcogl_gst_la-cogl-gst-video-sink.lo -MD -MP -MF $(DEPDIR)/libcogl_gst_la-cogl-gst-video-sink.Tpo -c -o libcogl_gst_la-cogl-gst-video-sink.lo `test -f 'cogl-gst-video-sink.c' || echo '$(srcdir)/'`cogl-gst-video-sink.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_gst_la-cogl-gst-video-sink.Tpo $(DEPDIR)/libcogl_gst_la-cogl-gst-video-sink.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-gst-video-sink.c' object='libcogl_gst_la-cogl-gst-video-sink.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_gst_la_CFLAGS) $(CFLAGS) -c -o libcogl_gst_la-cogl-gst-video-sink.lo `test -f 'cogl-gst-video-sink.c' || echo '$(srcdir)/'`cogl-gst-video-sink.c + +libgstcogl_la-cogl-gst-plugin.lo: $(srcdir)/cogl-gst-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstcogl_la_CFLAGS) $(CFLAGS) -MT libgstcogl_la-cogl-gst-plugin.lo -MD -MP -MF $(DEPDIR)/libgstcogl_la-cogl-gst-plugin.Tpo -c -o libgstcogl_la-cogl-gst-plugin.lo `test -f '$(srcdir)/cogl-gst-plugin.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gst-plugin.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstcogl_la-cogl-gst-plugin.Tpo $(DEPDIR)/libgstcogl_la-cogl-gst-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-gst-plugin.c' object='libgstcogl_la-cogl-gst-plugin.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstcogl_la_CFLAGS) $(CFLAGS) -c -o libgstcogl_la-cogl-gst-plugin.lo `test -f '$(srcdir)/cogl-gst-plugin.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gst-plugin.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-girDATA: $(gir_DATA) + @$(NORMAL_INSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ + done + +uninstall-girDATA: + @$(NORMAL_UNINSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ + done + +uninstall-typelibDATA: + @$(NORMAL_UNINSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) +install-cogl_gstheadersHEADERS: $(cogl_gstheaders_HEADERS) + @$(NORMAL_INSTALL) + @list='$(cogl_gstheaders_HEADERS)'; test -n "$(cogl_gstheadersdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogl_gstheadersdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogl_gstheadersdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogl_gstheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogl_gstheadersdir)" || exit $$?; \ + done + +uninstall-cogl_gstheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(cogl_gstheaders_HEADERS)'; test -n "$(cogl_gstheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogl_gstheadersdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(cogl_gstheadersdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-pluginLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-cogl_gstheadersHEADERS install-girDATA \ + install-pkgconfigDATA install-pluginLTLIBRARIES \ + install-typelibDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-cogl_gstheadersHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-pluginLTLIBRARIES uninstall-typelibDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-pluginLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-cogl_gstheadersHEADERS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-girDATA install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-pluginLTLIBRARIES \ + install-ps install-ps-am install-strip install-typelibDATA \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am \ + uninstall-cogl_gstheadersHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-pluginLTLIBRARIES uninstall-typelibDATA + + +-include $(INTROSPECTION_MAKEFILE) + +@HAVE_INTROSPECTION_TRUE@CoglGst-2.0.gir: libcogl-gst.la Makefile + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cogl-gst/cogl-gst-1.0.pc.in b/cogl-gst/cogl-gst-1.0.pc.in new file mode 100644 index 0000000..b3189ca --- /dev/null +++ b/cogl-gst/cogl-gst-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=1.0 +requires=@COGL_PKG_REQUIRES@ cogl-1.0 + +Name: Cogl +Description: A GStreamer integration library for Cogl +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-gst +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-gst/cogl-gst-2.0-experimental.pc.in b/cogl-gst/cogl-gst-2.0-experimental.pc.in new file mode 100644 index 0000000..3a82751 --- /dev/null +++ b/cogl-gst/cogl-gst-2.0-experimental.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ cogl-2.0-experimental + +Name: Cogl +Description: A GStreamer integration library for Cogl +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-gst +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-gst/cogl-gst-plugin.c b/cogl-gst/cogl-gst-plugin.c new file mode 100644 index 0000000..20b1e59 --- /dev/null +++ b/cogl-gst/cogl-gst-plugin.c @@ -0,0 +1,57 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007, 2008 OpenedHand + * Copyright (C) 2009, 2010, 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-gst-video-sink.h" + +#define PACKAGE "CoglGst" + +static CoglBool +_plugin_init (GstPlugin *coglgstvideosink) +{ + return gst_element_register (coglgstvideosink, + "coglsink", + GST_RANK_PRIMARY, + COGL_GST_TYPE_VIDEO_SINK); +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + cogl, + "Sends video data from GStreamer to a Cogl pipeline", + _plugin_init, + COGL_VERSION_STRING, + "MIT/X11", + PACKAGE, + "http://cogl3d.org/") diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c new file mode 100644 index 0000000..eaa3e12 --- /dev/null +++ b/cogl-gst/cogl-gst-video-sink.c @@ -0,0 +1,1743 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007, 2008 OpenedHand + * Copyright (C) 2009, 2010, 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "cogl-gtype-private.h" + +/* We just need the public Cogl api for cogl-gst but we first need to + * undef COGL_COMPILATION to avoid getting an error that normally + * checks cogl.h isn't used internally. */ +#undef COGL_COMPILATION +#include + +#include "cogl-gst-video-sink.h" + +#define COGL_GST_DEFAULT_PRIORITY G_PRIORITY_HIGH_IDLE + +#define BASE_SINK_CAPS "{ AYUV," \ + "YV12," \ + "I420," \ + "RGBA," \ + "BGRA," \ + "RGB," \ + "BGR," \ + "NV12 }" + +#define SINK_CAPS GST_VIDEO_CAPS_MAKE (BASE_SINK_CAPS) + +#define COGL_GST_PARAM_STATIC \ + (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) + +#define COGL_GST_PARAM_READABLE \ + (G_PARAM_READABLE | COGL_GST_PARAM_STATIC) + +#define COGL_GST_PARAM_WRITABLE \ + (G_PARAM_WRITABLE | COGL_GST_PARAM_STATIC) + +#define COGL_GST_PARAM_READWRITE \ + (G_PARAM_READABLE | G_PARAM_WRITABLE | COGL_GST_PARAM_STATIC) + +static GstStaticPadTemplate sinktemplate_all = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SINK_CAPS)); + +G_DEFINE_TYPE (CoglGstVideoSink, cogl_gst_video_sink, GST_TYPE_BASE_SINK); + +enum +{ + PROP_0, + PROP_UPDATE_PRIORITY +}; + +enum +{ + PIPELINE_READY_SIGNAL, + NEW_FRAME_SIGNAL, + + LAST_SIGNAL +}; + +static guint video_sink_signals[LAST_SIGNAL] = { 0, }; + +typedef enum +{ + COGL_GST_NOFORMAT, + COGL_GST_RGB32, + COGL_GST_RGB24, + COGL_GST_AYUV, + COGL_GST_YV12, + COGL_GST_SURFACE, + COGL_GST_I420, + COGL_GST_NV12 +} CoglGstVideoFormat; + +typedef enum +{ + COGL_GST_RENDERER_NEEDS_GLSL = (1 << 0), + COGL_GST_RENDERER_NEEDS_TEXTURE_RG = (1 << 1) +} CoglGstRendererFlag; + +/* We want to cache the snippets instead of recreating a new one every + * time we initialise a pipeline so that if we end up recreating the + * same pipeline again then Cogl will be able to use the pipeline + * cache to avoid linking a redundant identical shader program */ +typedef struct +{ + CoglSnippet *vertex_snippet; + CoglSnippet *fragment_snippet; + CoglSnippet *default_sample_snippet; + int start_position; +} SnippetCacheEntry; + +typedef struct +{ + GQueue entries; +} SnippetCache; + +typedef struct _CoglGstSource +{ + GSource source; + CoglGstVideoSink *sink; + GMutex buffer_lock; + GstBuffer *buffer; + CoglBool has_new_caps; +} CoglGstSource; + +typedef void (CoglGstRendererPaint) (CoglGstVideoSink *); +typedef void (CoglGstRendererPostPaint) (CoglGstVideoSink *); + +typedef struct _CoglGstRenderer +{ + const char *name; + CoglGstVideoFormat format; + int flags; + GstStaticCaps caps; + int n_layers; + void (*setup_pipeline) (CoglGstVideoSink *sink, + CoglPipeline *pipeline); + CoglBool (*upload) (CoglGstVideoSink *sink, + GstBuffer *buffer); +} CoglGstRenderer; + +struct _CoglGstVideoSinkPrivate +{ + CoglContext *ctx; + CoglPipeline *pipeline; + CoglTexture *frame[3]; + CoglBool frame_dirty; + CoglGstVideoFormat format; + CoglBool bgr; + CoglGstSource *source; + GSList *renderers; + GstCaps *caps; + CoglGstRenderer *renderer; + GstFlowReturn flow_return; + int custom_start; + int free_layer; + CoglBool default_sample; + GstVideoInfo info; +}; + +/* GTypes */ + +static gpointer +cogl_gst_rectangle_copy (gpointer src) +{ + if (G_LIKELY (src)) + { + CoglGstRectangle *new = g_slice_new (CoglGstRectangle); + memcpy (new, src, sizeof (CoglGstRectangle)); + return new; + } + else + return NULL; +} + +static void +cogl_gst_rectangle_free (gpointer ptr) +{ + g_slice_free (CoglGstRectangle, ptr); +} + +COGL_GTYPE_DEFINE_BOXED (GstRectangle, + gst_rectangle, + cogl_gst_rectangle_copy, + cogl_gst_rectangle_free); + +/**/ + +static void +cogl_gst_source_finalize (GSource *source) +{ + CoglGstSource *gst_source = (CoglGstSource *) source; + + g_mutex_lock (&gst_source->buffer_lock); + if (gst_source->buffer) + gst_buffer_unref (gst_source->buffer); + gst_source->buffer = NULL; + g_mutex_unlock (&gst_source->buffer_lock); + g_mutex_clear (&gst_source->buffer_lock); +} + +int +cogl_gst_video_sink_get_free_layer (CoglGstVideoSink *sink) +{ + return sink->priv->free_layer; +} + +void +cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink, + CoglPipeline *pln) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + int i; + + for (i = 0; i < G_N_ELEMENTS (priv->frame); i++) + if (priv->frame[i] != NULL) + cogl_pipeline_set_layer_texture (pln, i + priv->custom_start, + priv->frame[i]); +} + +static CoglBool +cogl_gst_source_prepare (GSource *source, + int *timeout) +{ + CoglGstSource *gst_source = (CoglGstSource *) source; + + *timeout = -1; + + return gst_source->buffer != NULL; +} + +static CoglBool +cogl_gst_source_check (GSource *source) +{ + CoglGstSource *gst_source = (CoglGstSource *) source; + + return gst_source->buffer != NULL; +} + +static void +cogl_gst_video_sink_set_priority (CoglGstVideoSink *sink, + int priority) +{ + if (sink->priv->source) + g_source_set_priority ((GSource *) sink->priv->source, priority); +} + +static void +dirty_default_pipeline (CoglGstVideoSink *sink) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + + if (priv->pipeline) + { + cogl_object_unref (priv->pipeline); + priv->pipeline = NULL; + } +} + +void +cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink, + int first_layer) +{ + g_return_if_fail (COGL_GST_IS_VIDEO_SINK (sink)); + + if (first_layer != sink->priv->custom_start) + { + sink->priv->custom_start = first_layer; + dirty_default_pipeline (sink); + + if (sink->priv->renderer) + sink->priv->free_layer = (sink->priv->custom_start + + sink->priv->renderer->n_layers); + } +} + +void +cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink, + CoglBool default_sample) +{ + g_return_if_fail (COGL_GST_IS_VIDEO_SINK (sink)); + + if (default_sample != sink->priv->default_sample) + { + sink->priv->default_sample = default_sample; + dirty_default_pipeline (sink); + } +} + +void +cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + g_return_if_fail (COGL_GST_IS_VIDEO_SINK (sink)); + + if (sink->priv->renderer) + sink->priv->renderer->setup_pipeline (sink, pipeline); +} + +static SnippetCacheEntry * +get_cache_entry (CoglGstVideoSink *sink, + SnippetCache *cache) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + GList *l; + + for (l = cache->entries.head; l; l = l->next) + { + SnippetCacheEntry *entry = l->data; + + if (entry->start_position == priv->custom_start) + return entry; + } + + return NULL; +} + +static SnippetCacheEntry * +add_cache_entry (CoglGstVideoSink *sink, + SnippetCache *cache, + const char *decl) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + SnippetCacheEntry *entry = g_slice_new (SnippetCacheEntry); + char *default_source; + + entry->start_position = priv->custom_start; + + entry->vertex_snippet = + cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_GLOBALS, + decl, + NULL /* post */); + entry->fragment_snippet = + cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS, + decl, + NULL /* post */); + + default_source = + g_strdup_printf (" cogl_layer *= cogl_gst_sample_video%i " + "(cogl_tex_coord%i_in.st);\n", + priv->custom_start, + priv->custom_start); + entry->default_sample_snippet = + cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, + NULL, /* declarations */ + default_source); + g_free (default_source); + + g_queue_push_head (&cache->entries, entry); + + return entry; +} + +static void +setup_pipeline_from_cache_entry (CoglGstVideoSink *sink, + CoglPipeline *pipeline, + SnippetCacheEntry *cache_entry, + int n_layers) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + + if (cache_entry) + { + int i; + + /* The global sampling function gets added to both the fragment + * and vertex stages. The hope is that the GLSL compiler will + * easily remove the dead code if it's not actually used */ + cogl_pipeline_add_snippet (pipeline, cache_entry->vertex_snippet); + cogl_pipeline_add_snippet (pipeline, cache_entry->fragment_snippet); + + /* Set all of the layers to just directly copy from the previous + * layer so that it won't redundantly generate code to sample + * the intermediate textures */ + for (i = 0; i < n_layers; i++) + cogl_pipeline_set_layer_combine (pipeline, + priv->custom_start + i, + "RGBA=REPLACE(PREVIOUS)", + NULL); + + if (priv->default_sample) + cogl_pipeline_add_layer_snippet (pipeline, + priv->custom_start + n_layers - 1, + cache_entry->default_sample_snippet); + } + + priv->frame_dirty = TRUE; +} + +CoglPipeline * +cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt) +{ + CoglGstVideoSinkPrivate *priv; + + g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), NULL); + + priv = vt->priv; + + if (priv->pipeline == NULL) + { + priv->pipeline = cogl_pipeline_new (priv->ctx); + cogl_gst_video_sink_setup_pipeline (vt, priv->pipeline); + cogl_gst_video_sink_attach_frame (vt, priv->pipeline); + priv->frame_dirty = FALSE; + } + else if (priv->frame_dirty) + { + CoglPipeline *pipeline = cogl_pipeline_copy (priv->pipeline); + cogl_object_unref (priv->pipeline); + priv->pipeline = pipeline; + + cogl_gst_video_sink_attach_frame (vt, pipeline); + priv->frame_dirty = FALSE; + } + + return priv->pipeline; +} + +static void +clear_frame_textures (CoglGstVideoSink *sink) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + int i; + + for (i = 0; i < G_N_ELEMENTS (priv->frame); i++) + { + if (priv->frame[i] == NULL) + break; + else + cogl_object_unref (priv->frame[i]); + } + + memset (priv->frame, 0, sizeof (priv->frame)); + + priv->frame_dirty = TRUE; +} + +static inline CoglBool +is_pot (unsigned int number) +{ + /* Make sure there is only one bit set */ + return (number & (number - 1)) == 0; +} + +/* This first tries to upload the texture to a CoglTexture2D, but + * if that's not possible it falls back to a CoglTexture2DSliced. + * + * Auto-mipmapping of any uploaded texture is disabled + */ +static CoglTexture * +video_texture_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data) +{ + CoglBitmap *bitmap; + CoglTexture *tex; + CoglError *internal_error = NULL; + + bitmap = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + if ((is_pot (cogl_bitmap_get_width (bitmap)) && + is_pot (cogl_bitmap_get_height (bitmap))) || + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)) + { + tex = cogl_texture_2d_new_from_bitmap (bitmap); + + cogl_texture_set_premultiplied (tex, FALSE); + + if (!cogl_texture_allocate (tex, &internal_error)) + { + cogl_error_free (internal_error); + internal_error = NULL; + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + /* Otherwise create a sliced texture */ + tex = cogl_texture_2d_sliced_new_from_bitmap (bitmap, + -1); /* no maximum waste */ + + cogl_texture_set_premultiplied (tex, FALSE); + + cogl_texture_allocate (tex, NULL); + } + + cogl_object_unref (bitmap); + + return tex; +} + +static void +cogl_gst_rgb24_glsl_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + static SnippetCache snippet_cache; + SnippetCacheEntry *entry = get_cache_entry (sink, &snippet_cache); + + if (entry == NULL) + { + char *source; + + source = + g_strdup_printf ("vec4\n" + "cogl_gst_sample_video%i (vec2 UV)\n" + "{\n" + " return texture2D (cogl_sampler%i, UV);\n" + "}\n", + priv->custom_start, + priv->custom_start); + + entry = add_cache_entry (sink, &snippet_cache, source); + g_free (source); + } + + setup_pipeline_from_cache_entry (sink, pipeline, entry, 1); +} + +static void +cogl_gst_rgb24_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + setup_pipeline_from_cache_entry (sink, pipeline, NULL, 1); +} + +static CoglBool +cogl_gst_rgb24_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglPixelFormat format; + GstVideoFrame frame; + + if (priv->bgr) + format = COGL_PIXEL_FORMAT_BGR_888; + else + format = COGL_PIXEL_FORMAT_RGB_888; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = video_texture_new_from_data (priv->ctx, priv->info.width, + priv->info.height, + format, + priv->info.stride[0], + frame.data[0]); + + gst_video_frame_unmap (&frame); + + return TRUE; + +map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static CoglGstRenderer rgb24_glsl_renderer = +{ + "RGB 24", + COGL_GST_RGB24, + COGL_GST_RENDERER_NEEDS_GLSL, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGB, BGR }")), + 1, /* n_layers */ + cogl_gst_rgb24_glsl_setup_pipeline, + cogl_gst_rgb24_upload, +}; + +static CoglGstRenderer rgb24_renderer = +{ + "RGB 24", + COGL_GST_RGB24, + 0, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGB, BGR }")), + 1, /* n_layers */ + cogl_gst_rgb24_setup_pipeline, + cogl_gst_rgb24_upload, +}; + +static void +cogl_gst_rgb32_glsl_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + static SnippetCache snippet_cache; + SnippetCacheEntry *entry = get_cache_entry (sink, &snippet_cache); + + if (entry == NULL) + { + char *source; + + source = + g_strdup_printf ("vec4\n" + "cogl_gst_sample_video%i (vec2 UV)\n" + "{\n" + " vec4 color = texture2D (cogl_sampler%i, UV);\n" + /* Premultiply the color */ + " color.rgb *= color.a;\n" + " return color;\n" + "}\n", + priv->custom_start, + priv->custom_start); + + entry = add_cache_entry (sink, &snippet_cache, source); + g_free (source); + } + + setup_pipeline_from_cache_entry (sink, pipeline, entry, 1); +} + +static void +cogl_gst_rgb32_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + char *layer_combine; + + setup_pipeline_from_cache_entry (sink, pipeline, NULL, 1); + + /* Premultiply the texture using the a special layer combine */ + layer_combine = g_strdup_printf ("RGB=MODULATE(PREVIOUS, TEXTURE_%i[A])\n" + "A=REPLACE(PREVIOUS[A])", + priv->custom_start); + cogl_pipeline_set_layer_combine (pipeline, + priv->custom_start + 1, + layer_combine, + NULL); + g_free(layer_combine); +} + +static CoglBool +cogl_gst_rgb32_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglPixelFormat format; + GstVideoFrame frame; + + if (priv->bgr) + format = COGL_PIXEL_FORMAT_BGRA_8888; + else + format = COGL_PIXEL_FORMAT_RGBA_8888; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = video_texture_new_from_data (priv->ctx, priv->info.width, + priv->info.height, + format, + priv->info.stride[0], + frame.data[0]); + + gst_video_frame_unmap (&frame); + + return TRUE; + +map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static CoglGstRenderer rgb32_glsl_renderer = +{ + "RGB 32", + COGL_GST_RGB32, + COGL_GST_RENDERER_NEEDS_GLSL, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGBA, BGRA }")), + 1, /* n_layers */ + cogl_gst_rgb32_glsl_setup_pipeline, + cogl_gst_rgb32_upload, +}; + +static CoglGstRenderer rgb32_renderer = +{ + "RGB 32", + COGL_GST_RGB32, + 0, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGBA, BGRA }")), + 2, /* n_layers */ + cogl_gst_rgb32_setup_pipeline, + cogl_gst_rgb32_upload, +}; + +static CoglBool +cogl_gst_yv12_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglPixelFormat format = COGL_PIXEL_FORMAT_A_8; + GstVideoFrame frame; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 0), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 0), + format, + priv->info.stride[0], frame.data[0]); + + priv->frame[2] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 1), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 1), + format, + priv->info.stride[1], frame.data[1]); + + priv->frame[1] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 2), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 2), + format, + priv->info.stride[2], frame.data[2]); + + gst_video_frame_unmap (&frame); + + return TRUE; + +map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static CoglBool +cogl_gst_i420_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglPixelFormat format = COGL_PIXEL_FORMAT_A_8; + GstVideoFrame frame; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 0), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 0), + format, + priv->info.stride[0], frame.data[0]); + + priv->frame[1] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 1), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 1), + format, + priv->info.stride[1], frame.data[1]); + + priv->frame[2] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 2), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 2), + format, + priv->info.stride[2], frame.data[2]); + + gst_video_frame_unmap (&frame); + + return TRUE; + +map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static void +cogl_gst_yv12_glsl_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + static SnippetCache snippet_cache; + SnippetCacheEntry *entry; + + entry = get_cache_entry (sink, &snippet_cache); + + if (entry == NULL) + { + char *source; + + source = + g_strdup_printf ("vec4\n" + "cogl_gst_sample_video%i (vec2 UV)\n" + "{\n" + " float y = 1.1640625 * " + "(texture2D (cogl_sampler%i, UV).a - 0.0625);\n" + " float u = texture2D (cogl_sampler%i, UV).a - 0.5;\n" + " float v = texture2D (cogl_sampler%i, UV).a - 0.5;\n" + " vec4 color;\n" + " color.r = y + 1.59765625 * v;\n" + " color.g = y - 0.390625 * u - 0.8125 * v;\n" + " color.b = y + 2.015625 * u;\n" + " color.a = 1.0;\n" + " return color;\n" + "}\n", + priv->custom_start, + priv->custom_start, + priv->custom_start + 1, + priv->custom_start + 2); + + entry = add_cache_entry (sink, &snippet_cache, source); + g_free (source); + } + + setup_pipeline_from_cache_entry (sink, pipeline, entry, 3); +} + +static CoglGstRenderer yv12_glsl_renderer = +{ + "YV12 glsl", + COGL_GST_YV12, + COGL_GST_RENDERER_NEEDS_GLSL, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("YV12")), + 3, /* n_layers */ + cogl_gst_yv12_glsl_setup_pipeline, + cogl_gst_yv12_upload, +}; + +static CoglGstRenderer i420_glsl_renderer = +{ + "I420 glsl", + COGL_GST_I420, + COGL_GST_RENDERER_NEEDS_GLSL, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420")), + 3, /* n_layers */ + cogl_gst_yv12_glsl_setup_pipeline, + cogl_gst_i420_upload, +}; + +static void +cogl_gst_ayuv_glsl_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + static SnippetCache snippet_cache; + SnippetCacheEntry *entry; + + entry = get_cache_entry (sink, &snippet_cache); + + if (entry == NULL) + { + char *source; + + source + = g_strdup_printf ("vec4\n" + "cogl_gst_sample_video%i (vec2 UV)\n" + "{\n" + " vec4 color = texture2D (cogl_sampler%i, UV);\n" + " float y = 1.1640625 * (color.g - 0.0625);\n" + " float u = color.b - 0.5;\n" + " float v = color.a - 0.5;\n" + " color.a = color.r;\n" + " color.r = y + 1.59765625 * v;\n" + " color.g = y - 0.390625 * u - 0.8125 * v;\n" + " color.b = y + 2.015625 * u;\n" + /* Premultiply the color */ + " color.rgb *= color.a;\n" + " return color;\n" + "}\n", priv->custom_start, + priv->custom_start); + + entry = add_cache_entry (sink, &snippet_cache, source); + g_free (source); + } + + setup_pipeline_from_cache_entry (sink, pipeline, entry, 1); +} + +static CoglBool +cogl_gst_ayuv_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglPixelFormat format = COGL_PIXEL_FORMAT_RGBA_8888; + GstVideoFrame frame; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = video_texture_new_from_data (priv->ctx, priv->info.width, + priv->info.height, + format, + priv->info.stride[0], + frame.data[0]); + + gst_video_frame_unmap (&frame); + + return TRUE; + +map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static CoglGstRenderer ayuv_glsl_renderer = +{ + "AYUV glsl", + COGL_GST_AYUV, + COGL_GST_RENDERER_NEEDS_GLSL, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("AYUV")), + 1, /* n_layers */ + cogl_gst_ayuv_glsl_setup_pipeline, + cogl_gst_ayuv_upload, +}; + +static void +cogl_gst_nv12_glsl_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + static SnippetCache snippet_cache; + SnippetCacheEntry *entry; + + entry = get_cache_entry (sink, &snippet_cache); + + if (entry == NULL) + { + char *source; + + source = + g_strdup_printf ("vec4\n" + "cogl_gst_sample_video%i (vec2 UV)\n" + "{\n" + " vec4 color;\n" + " float y = 1.1640625 *\n" + " (texture2D (cogl_sampler%i, UV).a -\n" + " 0.0625);\n" + " vec2 uv = texture2D (cogl_sampler%i, UV).rg;\n" + " uv -= 0.5;\n" + " float u = uv.x;\n" + " float v = uv.y;\n" + " color.r = y + 1.59765625 * v;\n" + " color.g = y - 0.390625 * u - 0.8125 * v;\n" + " color.b = y + 2.015625 * u;\n" + " color.a = 1.0;\n" + " return color;\n" + "}\n", + priv->custom_start, + priv->custom_start, + priv->custom_start + 1); + + entry = add_cache_entry (sink, &snippet_cache, source); + g_free (source); + } + + setup_pipeline_from_cache_entry (sink, pipeline, entry, 2); +} + +static CoglBool +cogl_gst_nv12_upload (CoglGstVideoSink *sink, + GstBuffer *buffer) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + GstVideoFrame frame; + + if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ)) + goto map_fail; + + clear_frame_textures (sink); + + priv->frame[0] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 0), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 0), + COGL_PIXEL_FORMAT_A_8, + priv->info.stride[0], + frame.data[0]); + + priv->frame[1] = + video_texture_new_from_data (priv->ctx, + GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 1), + GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 1), + COGL_PIXEL_FORMAT_RG_88, + priv->info.stride[1], + frame.data[1]); + + gst_video_frame_unmap (&frame); + + return TRUE; + + map_fail: + { + GST_ERROR_OBJECT (sink, "Could not map incoming video frame"); + return FALSE; + } +} + +static CoglGstRenderer nv12_glsl_renderer = +{ + "NV12 glsl", + COGL_GST_NV12, + COGL_GST_RENDERER_NEEDS_GLSL | COGL_GST_RENDERER_NEEDS_TEXTURE_RG, + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:SystemMemory", + "NV12")), + 2, /* n_layers */ + cogl_gst_nv12_glsl_setup_pipeline, + cogl_gst_nv12_upload, +}; + +static GSList* +cogl_gst_build_renderers_list (CoglContext *ctx) +{ + GSList *list = NULL; + CoglGstRendererFlag flags = 0; + int i; + static CoglGstRenderer *const renderers[] = + { + /* These are in increasing order of priority so that the + * priv->renderers will be in decreasing order. That way the GLSL + * renderers will be preferred if they are available */ + &rgb24_renderer, + &rgb32_renderer, + &rgb24_glsl_renderer, + &rgb32_glsl_renderer, + &yv12_glsl_renderer, + &i420_glsl_renderer, + &ayuv_glsl_renderer, + &nv12_glsl_renderer, + NULL + }; + + if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL)) + flags |= COGL_GST_RENDERER_NEEDS_GLSL; + + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RG)) + flags |= COGL_GST_RENDERER_NEEDS_TEXTURE_RG; + + for (i = 0; renderers[i]; i++) + if ((renderers[i]->flags & flags) == renderers[i]->flags) + list = g_slist_prepend (list, renderers[i]); + + return list; +} + +static void +append_cap (gpointer data, + gpointer user_data) +{ + CoglGstRenderer *renderer = (CoglGstRenderer *) data; + GstCaps *caps = (GstCaps *) user_data; + GstCaps *writable_caps; + writable_caps = + gst_caps_make_writable (gst_static_caps_get (&renderer->caps)); + gst_caps_append (caps, writable_caps); +} + +static GstCaps * +cogl_gst_build_caps (GSList *renderers) +{ + GstCaps *caps; + + caps = gst_caps_new_empty (); + + g_slist_foreach (renderers, append_cap, caps); + + return caps; +} + +void +cogl_gst_video_sink_set_context (CoglGstVideoSink *vt, + CoglContext *ctx) +{ + CoglGstVideoSinkPrivate *priv = vt->priv; + + if (ctx) + ctx = cogl_object_ref (ctx); + + if (priv->ctx) + { + cogl_object_unref (priv->ctx); + g_slist_free (priv->renderers); + priv->renderers = NULL; + if (priv->caps) + { + gst_caps_unref (priv->caps); + priv->caps = NULL; + } + } + + if (ctx) + { + priv->ctx = ctx; + priv->renderers = cogl_gst_build_renderers_list (priv->ctx); + priv->caps = cogl_gst_build_caps (priv->renderers); + } +} + +static CoglGstRenderer * +cogl_gst_find_renderer_by_format (CoglGstVideoSink *sink, + CoglGstVideoFormat format) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglGstRenderer *renderer = NULL; + GSList *element; + + /* The renderers list is in decreasing order of priority so we'll + * pick the first one that matches */ + for (element = priv->renderers; element; element = g_slist_next (element)) + { + CoglGstRenderer *candidate = (CoglGstRenderer *) element->data; + if (candidate->format == format) + { + renderer = candidate; + break; + } + } + + return renderer; +} + +static GstCaps * +cogl_gst_video_sink_get_caps (GstBaseSink *bsink, + GstCaps *filter) +{ + CoglGstVideoSink *sink; + sink = COGL_GST_VIDEO_SINK (bsink); + + if (sink->priv->caps == NULL) + return NULL; + else + return gst_caps_ref (sink->priv->caps); +} + +static CoglBool +cogl_gst_video_sink_parse_caps (GstCaps *caps, + CoglGstVideoSink *sink, + CoglBool save) +{ + CoglGstVideoSinkPrivate *priv = sink->priv; + GstCaps *intersection; + GstVideoInfo vinfo; + CoglGstVideoFormat format; + CoglBool bgr = FALSE; + CoglGstRenderer *renderer; + + intersection = gst_caps_intersect (priv->caps, caps); + if (gst_caps_is_empty (intersection)) + goto no_intersection; + + gst_caps_unref (intersection); + + if (!gst_video_info_from_caps (&vinfo, caps)) + goto unknown_format; + + switch (vinfo.finfo->format) + { + case GST_VIDEO_FORMAT_YV12: + format = COGL_GST_YV12; + break; + case GST_VIDEO_FORMAT_I420: + format = COGL_GST_I420; + break; + case GST_VIDEO_FORMAT_AYUV: + format = COGL_GST_AYUV; + bgr = FALSE; + break; + case GST_VIDEO_FORMAT_NV12: + format = COGL_GST_NV12; + break; + case GST_VIDEO_FORMAT_RGB: + format = COGL_GST_RGB24; + bgr = FALSE; + break; + case GST_VIDEO_FORMAT_BGR: + format = COGL_GST_RGB24; + bgr = TRUE; + break; + case GST_VIDEO_FORMAT_RGBA: + format = COGL_GST_RGB32; + bgr = FALSE; + break; + case GST_VIDEO_FORMAT_BGRA: + format = COGL_GST_RGB32; + bgr = TRUE; + break; + default: + goto unhandled_format; + } + + renderer = cogl_gst_find_renderer_by_format (sink, format); + + if (G_UNLIKELY (renderer == NULL)) + goto no_suitable_renderer; + + GST_INFO_OBJECT (sink, "found the %s renderer", renderer->name); + + if (save) + { + priv->info = vinfo; + + priv->format = format; + priv->bgr = bgr; + + priv->renderer = renderer; + } + + return TRUE; + + +no_intersection: + { + GST_WARNING_OBJECT (sink, + "Incompatible caps, don't intersect with %" GST_PTR_FORMAT, priv->caps); + return FALSE; + } + +unknown_format: + { + GST_WARNING_OBJECT (sink, "Could not figure format of input caps"); + return FALSE; + } + +unhandled_format: + { + GST_ERROR_OBJECT (sink, "Provided caps aren't supported by clutter-gst"); + return FALSE; + } + +no_suitable_renderer: + { + GST_ERROR_OBJECT (sink, "could not find a suitable renderer"); + return FALSE; + } +} + +static CoglBool +cogl_gst_video_sink_set_caps (GstBaseSink *bsink, + GstCaps *caps) +{ + CoglGstVideoSink *sink; + CoglGstVideoSinkPrivate *priv; + + sink = COGL_GST_VIDEO_SINK (bsink); + priv = sink->priv; + + if (!cogl_gst_video_sink_parse_caps (caps, sink, FALSE)) + return FALSE; + + g_mutex_lock (&priv->source->buffer_lock); + priv->source->has_new_caps = TRUE; + g_mutex_unlock (&priv->source->buffer_lock); + + return TRUE; +} + +static CoglBool +cogl_gst_source_dispatch (GSource *source, + GSourceFunc callback, + void *user_data) +{ + CoglGstSource *gst_source= (CoglGstSource*) source; + CoglGstVideoSinkPrivate *priv = gst_source->sink->priv; + GstBuffer *buffer; + gboolean pipeline_ready = FALSE; + + g_mutex_lock (&gst_source->buffer_lock); + + if (G_UNLIKELY (gst_source->has_new_caps)) + { + GstCaps *caps = + gst_pad_get_current_caps (GST_BASE_SINK_PAD ((GST_BASE_SINK + (gst_source->sink)))); + + if (!cogl_gst_video_sink_parse_caps (caps, gst_source->sink, TRUE)) + goto negotiation_fail; + + gst_source->has_new_caps = FALSE; + priv->free_layer = priv->custom_start + priv->renderer->n_layers; + + dirty_default_pipeline (gst_source->sink); + + /* We are now in a state where we could generate the pipeline if + * the application requests it so we can emit the signal. + * However we'll actually generate the pipeline lazily only if + * the application actually asks for it. */ + pipeline_ready = TRUE; + } + + buffer = gst_source->buffer; + gst_source->buffer = NULL; + + g_mutex_unlock (&gst_source->buffer_lock); + + if (buffer) + { + if (!priv->renderer->upload (gst_source->sink, buffer)) + goto fail_upload; + + gst_buffer_unref (buffer); + } + else + GST_WARNING_OBJECT (gst_source->sink, "No buffers available for display"); + + if (G_UNLIKELY (pipeline_ready)) + g_signal_emit (gst_source->sink, + video_sink_signals[PIPELINE_READY_SIGNAL], + 0 /* detail */); + g_signal_emit (gst_source->sink, + video_sink_signals[NEW_FRAME_SIGNAL], 0, + NULL); + + return TRUE; + + +negotiation_fail: + { + GST_WARNING_OBJECT (gst_source->sink, + "Failed to handle caps. Stopping GSource"); + priv->flow_return = GST_FLOW_NOT_NEGOTIATED; + g_mutex_unlock (&gst_source->buffer_lock); + + return FALSE; + } + +fail_upload: + { + GST_WARNING_OBJECT (gst_source->sink, "Failed to upload buffer"); + priv->flow_return = GST_FLOW_ERROR; + gst_buffer_unref (buffer); + return FALSE; + } +} + +static GSourceFuncs gst_source_funcs = +{ + cogl_gst_source_prepare, + cogl_gst_source_check, + cogl_gst_source_dispatch, + cogl_gst_source_finalize +}; + +static CoglGstSource * +cogl_gst_source_new (CoglGstVideoSink *sink) +{ + GSource *source; + CoglGstSource *gst_source; + + source = g_source_new (&gst_source_funcs, sizeof (CoglGstSource)); + gst_source = (CoglGstSource *) source; + + g_source_set_can_recurse (source, TRUE); + g_source_set_priority (source, COGL_GST_DEFAULT_PRIORITY); + + gst_source->sink = sink; + g_mutex_init (&gst_source->buffer_lock); + gst_source->buffer = NULL; + + return gst_source; +} + +static void +cogl_gst_video_sink_init (CoglGstVideoSink *sink) +{ + CoglGstVideoSinkPrivate *priv; + + sink->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (sink, + COGL_GST_TYPE_VIDEO_SINK, + CoglGstVideoSinkPrivate); + priv->custom_start = 0; + priv->default_sample = TRUE; +} + +static GstFlowReturn +_cogl_gst_video_sink_render (GstBaseSink *bsink, + GstBuffer *buffer) +{ + CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (bsink); + CoglGstVideoSinkPrivate *priv = sink->priv; + CoglGstSource *gst_source = priv->source; + + g_mutex_lock (&gst_source->buffer_lock); + + if (G_UNLIKELY (priv->flow_return != GST_FLOW_OK)) + goto dispatch_flow_ret; + + if (gst_source->buffer) + gst_buffer_unref (gst_source->buffer); + + gst_source->buffer = gst_buffer_ref (buffer); + g_mutex_unlock (&gst_source->buffer_lock); + + g_main_context_wakeup (NULL); + + return GST_FLOW_OK; + + dispatch_flow_ret: + { + g_mutex_unlock (&gst_source->buffer_lock); + return priv->flow_return; + } +} + +static void +cogl_gst_video_sink_dispose (GObject *object) +{ + CoglGstVideoSink *self; + CoglGstVideoSinkPrivate *priv; + + self = COGL_GST_VIDEO_SINK (object); + priv = self->priv; + + clear_frame_textures (self); + + if (priv->pipeline) + { + cogl_object_unref (priv->pipeline); + priv->pipeline = NULL; + } + + if (priv->caps) + { + gst_caps_unref (priv->caps); + priv->caps = NULL; + } + + G_OBJECT_CLASS (cogl_gst_video_sink_parent_class)->dispose (object); +} + +static void +cogl_gst_video_sink_finalize (GObject *object) +{ + CoglGstVideoSink *self = COGL_GST_VIDEO_SINK (object); + + cogl_gst_video_sink_set_context (self, NULL); + + G_OBJECT_CLASS (cogl_gst_video_sink_parent_class)->finalize (object); +} + +static CoglBool +cogl_gst_video_sink_start (GstBaseSink *base_sink) +{ + CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (base_sink); + CoglGstVideoSinkPrivate *priv = sink->priv; + + priv->source = cogl_gst_source_new (sink); + g_source_attach ((GSource *) priv->source, NULL); + priv->flow_return = GST_FLOW_OK; + return TRUE; +} + +static void +cogl_gst_video_sink_set_property (GObject *object, + unsigned int prop_id, + const GValue *value, + GParamSpec *pspec) +{ + CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (object); + + switch (prop_id) + { + case PROP_UPDATE_PRIORITY: + cogl_gst_video_sink_set_priority (sink, g_value_get_int (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +cogl_gst_video_sink_get_property (GObject *object, + unsigned int prop_id, + GValue *value, + GParamSpec *pspec) +{ + CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (object); + CoglGstVideoSinkPrivate *priv = sink->priv; + + switch (prop_id) + { + case PROP_UPDATE_PRIORITY: + g_value_set_int (value, g_source_get_priority ((GSource *) priv->source)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static CoglBool +cogl_gst_video_sink_stop (GstBaseSink *base_sink) +{ + CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (base_sink); + CoglGstVideoSinkPrivate *priv = sink->priv; + + if (priv->source) + { + GSource *source = (GSource *) priv->source; + g_source_destroy (source); + g_source_unref (source); + priv->source = NULL; + } + + return TRUE; +} + +static void +cogl_gst_video_sink_class_init (CoglGstVideoSinkClass *klass) +{ + GObjectClass *go_class = G_OBJECT_CLASS (klass); + GstBaseSinkClass *gb_class = GST_BASE_SINK_CLASS (klass); + GstElementClass *ge_class = GST_ELEMENT_CLASS (klass); + GstPadTemplate *pad_template; + GParamSpec *pspec; + + g_type_class_add_private (klass, sizeof (CoglGstVideoSinkPrivate)); + go_class->set_property = cogl_gst_video_sink_set_property; + go_class->get_property = cogl_gst_video_sink_get_property; + go_class->dispose = cogl_gst_video_sink_dispose; + go_class->finalize = cogl_gst_video_sink_finalize; + + pad_template = gst_static_pad_template_get (&sinktemplate_all); + gst_element_class_add_pad_template (ge_class, pad_template); + + gst_element_class_set_metadata (ge_class, + "Cogl video sink", "Sink/Video", + "Sends video data from GStreamer to a " + "Cogl pipeline", + "Jonathan Matthew , " + "Matthew Allum , " + "Plamena Manolova " + ""); + + gb_class->render = _cogl_gst_video_sink_render; + gb_class->preroll = _cogl_gst_video_sink_render; + gb_class->start = cogl_gst_video_sink_start; + gb_class->stop = cogl_gst_video_sink_stop; + gb_class->set_caps = cogl_gst_video_sink_set_caps; + gb_class->get_caps = cogl_gst_video_sink_get_caps; + + pspec = g_param_spec_int ("update-priority", + "Update Priority", + "Priority of video updates in the thread", + -G_MAXINT, G_MAXINT, + COGL_GST_DEFAULT_PRIORITY, + COGL_GST_PARAM_READWRITE); + + g_object_class_install_property (go_class, PROP_UPDATE_PRIORITY, pspec); + + video_sink_signals[PIPELINE_READY_SIGNAL] = + g_signal_new ("pipeline-ready", + COGL_GST_TYPE_VIDEO_SINK, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CoglGstVideoSinkClass, pipeline_ready), + NULL, /* accumulator */ + NULL, /* accu_data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0 /* n_params */); + + video_sink_signals[NEW_FRAME_SIGNAL] = + g_signal_new ("new-frame", + COGL_GST_TYPE_VIDEO_SINK, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CoglGstVideoSinkClass, new_frame), + NULL, /* accumulator */ + NULL, /* accu_data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0 /* n_params */); +} + +CoglGstVideoSink * +cogl_gst_video_sink_new (CoglContext *ctx) +{ + CoglGstVideoSink *sink = g_object_new (COGL_GST_TYPE_VIDEO_SINK, NULL); + cogl_gst_video_sink_set_context (sink, ctx); + + return sink; +} + +float +cogl_gst_video_sink_get_aspect (CoglGstVideoSink *vt) +{ + GstVideoInfo *info; + + g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), 0.); + + info = &vt->priv->info; + return ((float)info->width * (float)info->par_n) / + ((float)info->height * (float)info->par_d); +} + +float +cogl_gst_video_sink_get_width_for_height (CoglGstVideoSink *vt, + float height) +{ + float aspect; + + g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), 0.); + + aspect = cogl_gst_video_sink_get_aspect (vt); + return height * aspect; +} + +float +cogl_gst_video_sink_get_height_for_width (CoglGstVideoSink *vt, + float width) +{ + float aspect; + + g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), 0.); + + aspect = cogl_gst_video_sink_get_aspect (vt); + return width / aspect; +} + +void +cogl_gst_video_sink_fit_size (CoglGstVideoSink *vt, + const CoglGstRectangle *available, + CoglGstRectangle *output) +{ + g_return_if_fail (COGL_GST_IS_VIDEO_SINK (vt)); + g_return_if_fail (available != NULL); + g_return_if_fail (output != NULL); + + if (available->height == 0.0f) + { + output->x = available->x; + output->y = available->y; + output->width = output->height = 0; + } + else + { + float available_aspect = available->width / available->height; + float video_aspect = cogl_gst_video_sink_get_aspect (vt); + + if (video_aspect > available_aspect) + { + output->width = available->width; + output->height = available->width / video_aspect; + output->x = available->x; + output->y = available->y + (available->height - output->height) / 2; + } + else + { + output->width = available->height * video_aspect; + output->height = available->height; + output->x = available->x + (available->width - output->width) / 2; + output->y = available->y; + } + } +} + +void +cogl_gst_video_sink_get_natural_size (CoglGstVideoSink *vt, + float *width, + float *height) +{ + GstVideoInfo *info; + + g_return_if_fail (COGL_GST_IS_VIDEO_SINK (vt)); + + info = &vt->priv->info; + + if (info->par_n > info->par_d) + { + /* To display the video at the right aspect ratio then in this + * case the pixels need to be stretched horizontally and so we + * use the unscaled height as our reference. + */ + + if (height) + *height = info->height; + if (width) + *width = cogl_gst_video_sink_get_width_for_height (vt, info->height); + } + else + { + if (width) + *width = info->width; + if (height) + *height = cogl_gst_video_sink_get_height_for_width (vt, info->width); + } +} + +float +cogl_gst_video_sink_get_natural_width (CoglGstVideoSink *vt) +{ + float width; + cogl_gst_video_sink_get_natural_size (vt, &width, NULL); + return width; +} + +float +cogl_gst_video_sink_get_natural_height (CoglGstVideoSink *vt) +{ + float height; + cogl_gst_video_sink_get_natural_size (vt, NULL, &height); + return height; +} + +CoglBool +cogl_gst_video_sink_is_ready (CoglGstVideoSink *sink) +{ + return !!sink->priv->renderer; +} diff --git a/cogl-gst/cogl-gst-video-sink.h b/cogl-gst/cogl-gst-video-sink.h new file mode 100644 index 0000000..12a6480 --- /dev/null +++ b/cogl-gst/cogl-gst-video-sink.h @@ -0,0 +1,533 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007, 2008 OpenedHand + * Copyright (C) 2009, 2010, 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_GST_VIDEO_SINK_H__ +#define __COGL_GST_VIDEO_SINK_H__ +#include +#include + +/* We just need the public Cogl api for cogl-gst but we first need to + * undef COGL_COMPILATION to avoid getting an error that normally + * checks cogl.h isn't used internally. */ +#ifdef COGL_COMPILATION +#undef COGL_COMPILATION +#endif + +#include + +#include + +/** + * SECTION:cogl-gst-video-sink + * @short_description: A video sink for integrating a GStreamer + * pipeline with a Cogl pipeline. + * + * #CoglGstVideoSink is a subclass of #GstBaseSink which can be used to + * create a #CoglPipeline for rendering the frames of the video. + * + * To create a basic video player, an application can create a + * #GstPipeline as normal using gst_pipeline_new() and set the + * sink on it to one created with cogl_gst_video_sink_new(). The + * application can then listen for the #CoglGstVideoSink::new-frame + * signal which will be emitted whenever there are new textures ready + * for rendering. For simple rendering, the application can just call + * cogl_gst_video_sink_get_pipeline() in the signal handler and use + * the returned pipeline to paint the new frame. + * + * An application is also free to do more advanced rendering by + * customizing the pipeline. In that case it should listen for the + * #CoglGstVideoSink::pipeline-ready signal which will be emitted as + * soon as the sink has determined enough information about the video + * to know how it should be rendered. In the handler for this signal, + * the application can either make modifications to a copy of the + * pipeline returned by cogl_gst_video_sink_get_pipeline() or it can + * create its own pipeline from scratch and ask the sink to configure + * it with cogl_gst_video_sink_setup_pipeline(). If a custom pipeline + * is created using one of these methods then the application should + * call cogl_gst_video_sink_attach_frame() on the pipeline before + * rendering in order to update the textures on the pipeline's layers. + * + * If the %COGL_FEATURE_ID_GLSL feature is available then the pipeline + * used by the sink will have a shader snippet with a function in it + * called cogl_gst_sample_video0 which takes a single vec2 argument. + * This can be used by custom snippets set the by the application to + * sample from the video. The vec2 argument represents the normalised + * coordinates within the video. The function returns a vec4 + * containing a pre-multiplied RGBA color of the pixel within the + * video. + * + * Since: 1.16 + */ + +G_BEGIN_DECLS + +#define COGL_GST_GTYPE_DECLARE_TYPE(name) \ + GType cogl_gst_ ## name ## _get_gtype (void) + + +#define COGL_GST_TYPE_VIDEO_SINK cogl_gst_video_sink_get_type() + +#define COGL_GST_VIDEO_SINK(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + COGL_GST_TYPE_VIDEO_SINK, CoglGstVideoSink)) + +#define COGL_GST_VIDEO_SINK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + COGL_GST_TYPE_VIDEO_SINK, CoglGstVideoSinkClass)) + +#define COGL_GST_IS_VIDEO_SINK(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + COGL_GST_TYPE_VIDEO_SINK)) + +#define COGL_GST_IS_VIDEO_SINK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + COGL_GST_TYPE_VIDEO_SINK)) + +#define COGL_GST_VIDEO_SINK_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + COGL_GST_TYPE_VIDEO_SINK, CoglGstVideoSinkClass)) + +typedef struct _CoglGstVideoSink CoglGstVideoSink; +typedef struct _CoglGstVideoSinkClass CoglGstVideoSinkClass; +typedef struct _CoglGstVideoSinkPrivate CoglGstVideoSinkPrivate; + +/** + * CoglGstVideoSink: + * + * The #CoglGstVideoSink structure contains only private data and + * should be accessed using the provided API. + * + * Since: 1.16 + */ +struct _CoglGstVideoSink +{ + /*< private >*/ + GstBaseSink parent; + CoglGstVideoSinkPrivate *priv; +}; + +/** + * CoglGstVideoSinkClass: + * @new_frame: handler for the #CoglGstVideoSink::new-frame signal + * @pipeline_ready: handler for the #CoglGstVideoSink::pipeline-ready signal + * + * Since: 1.16 + */ + +/** + * CoglGstVideoSink::new-frame: + * @sink: the #CoglGstVideoSink + * + * The sink will emit this signal whenever there are new textures + * available for a new frame of the video. After this signal is + * emitted, an application can call cogl_gst_video_sink_get_pipeline() + * to get a pipeline suitable for rendering the frame. If the + * application is using a custom pipeline it can alternatively call + * cogl_gst_video_sink_attach_frame() to attach the textures. + * + * Since: 1.16 + */ + +/** + * CoglGstVideoSink::pipeline-ready: + * @sink: the #CoglGstVideoSink + * + * The sink will emit this signal as soon as it has gathered enough + * information from the video to configure a pipeline. If the + * application wants to do some customized rendering, it can setup its + * pipeline after this signal is emitted. The application's pipeline + * will typically either be a copy of the one returned by + * cogl_gst_video_sink_get_pipeline() or it can be a completely custom + * pipeline which is setup using cogl_gst_video_sink_setup_pipeline(). + * + * Note that it is an error to call either of those functions before + * this signal is emitted. The #CoglGstVideoSink::new-frame signal + * will only be emitted after the pipeline is ready so the application + * could also create its pipeline in the handler for that. + * + * Since: 1.16 + */ + +struct _CoglGstVideoSinkClass +{ + /*< private >*/ + GstBaseSinkClass parent_class; + + /*< public >*/ + void (* new_frame) (CoglGstVideoSink *sink); + void (* pipeline_ready) (CoglGstVideoSink *sink); + + /*< private >*/ + void *_padding_dummy[8]; +}; + +GType +cogl_gst_video_sink_get_type (void) G_GNUC_CONST; + +/** + * cogl_gst_video_sink_new: + * @ctx: The #CoglContext + * + * Creates a new #CoglGstVideoSink which will create resources for use + * with the given context. + * + * Return value: (transfer full): a new #CoglGstVideoSink + * Since: 1.16 + */ +CoglGstVideoSink * +cogl_gst_video_sink_new (CoglContext *ctx); + +/** + * cogl_gst_video_sink_is_ready: + * @sink: The #CoglGstVideoSink + * + * Returns whether the pipeline is ready and so + * cogl_gst_video_sink_get_pipeline() and + * cogl_gst_video_sink_setup_pipeline() can be called without causing error. + * + * Note: Normally an application will wait until the + * #CoglGstVideoSink::pipeline-ready signal is emitted instead of + * polling the ready status with this api, but sometimes when a sink + * is passed between components that didn't have an opportunity to + * connect a signal handler this can be useful. + * + * Return value: %TRUE if the sink is ready, else %FALSE + * Since: 1.16 + */ +CoglBool +cogl_gst_video_sink_is_ready (CoglGstVideoSink *sink); + +/** + * cogl_gst_video_sink_get_pipeline: + * @vt: The #CoglGstVideoSink + * + * Returns a pipeline suitable for rendering the current frame of the + * given video sink. The pipeline will already have the textures for + * the frame attached. For simple rendering, an application will + * typically call this function immediately before it paints the + * video. It can then just paint a rectangle using the returned + * pipeline. + * + * An application is free to make a copy of this + * pipeline and modify it for custom rendering. + * + * Note: it is considered an error to call this function before the + * #CoglGstVideoSink::pipeline-ready signal is emitted. + * + * Return value: (transfer none): the pipeline for rendering the + * current frame + * Since: 1.16 + */ +CoglPipeline * +cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt); + +/** + * cogl_gst_video_sink_set_context: + * @vt: The #CoglGstVideoSink + * @ctx: The #CoglContext for the sink to use + * + * Sets the #CoglContext that the video sink should use for creating + * any resources. This function would normally only be used if the + * sink was constructed via gst_element_factory_make() instead of + * cogl_gst_video_sink_new(). + * + * Since: 1.16 + */ +void +cogl_gst_video_sink_set_context (CoglGstVideoSink *vt, + CoglContext *ctx); + +/** + * cogl_gst_video_sink_get_free_layer: + * @sink: The #CoglGstVideoSink + * + * This can be used when doing specialised rendering of the video by + * customizing the pipeline. #CoglGstVideoSink may use up to three + * private layers on the pipeline in order to attach the textures of + * the video frame. This function will return the index of the next + * available unused layer after the sink's internal layers. This can + * be used by the application to add additional layers, for example to + * blend in another color in the fragment processing. + * + * Return value: the index of the next available layer after the + * sink's internal layers. + * Since: 1.16 + */ +int +cogl_gst_video_sink_get_free_layer (CoglGstVideoSink *sink); + +/** + * cogl_gst_video_sink_attach_frame: + * @sink: The #CoglGstVideoSink + * @pln: A #CoglPipeline + * + * Updates the given pipeline with the textures for the current frame. + * This can be used if the application wants to customize the + * rendering using its own pipeline. Typically this would be called in + * response to the #CoglGstVideoSink::new-frame signal which is + * emitted whenever the new textures are available. The application + * would then make a copy of its template pipeline and call this to + * set the textures. + * + * Since: 1.16 + */ +void +cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink, + CoglPipeline *pln); + +/** + * cogl_gst_video_sink_set_first_layer: + * @sink: The #CoglGstVideoSink + * @first_layer: The new first layer + * + * Sets the index of the first layer that the sink will use for its + * rendering. This is useful if the application wants to have custom + * layers that appear before the layers added by the sink. In that + * case by default the sink's layers will be modulated with the result + * of the application's layers that come before @first_layer. + * + * Note that if this function is called then the name of the function + * to call in the shader snippets to sample the video will also + * change. For example, if @first_layer is three then the function + * will be cogl_gst_sample_video3. + * + * Since: 1.16 + */ +void +cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink, + int first_layer); + +/** + * cogl_gst_video_sink_set_default_sample: + * @sink: The #CoglGstVideoSink + * @default_sample: Whether to add the default sampling + * + * By default the pipeline generated by + * cogl_gst_video_sink_setup_pipeline() and + * cogl_gst_video_sink_get_pipeline() will have a layer with a shader + * snippet that automatically samples the video. If the application + * wants to sample the video in a completely custom way using its own + * shader snippet it can set @default_sample to %FALSE to avoid this + * default snippet being added. In that case the application's snippet + * can call cogl_gst_sample_video0 to sample the texture itself. + * + * Since: 1.16 + */ +void +cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink, + CoglBool default_sample); + +/** + * cogl_gst_video_sink_setup_pipeline: + * @sink: The #CoglGstVideoSink + * @pipeline: A #CoglPipeline + * + * Configures the given pipeline so that will be able to render the + * video for the @sink. This should only be used if the application + * wants to perform some custom rendering using its own pipeline. + * Typically an application will call this in response to the + * #CoglGstVideoSink::pipeline-ready signal. + * + * Note: it is considered an error to call this function before the + * #CoglGstVideoSink::pipeline-ready signal is emitted. + * + * Since: 1.16 + */ +void +cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink, + CoglPipeline *pipeline); + +/** + * cogl_gst_video_sink_get_aspect: + * @sink: A #CoglGstVideoSink + * + * Returns a width-for-height aspect ratio that lets you calculate a + * suitable width for displaying your video based on a given height by + * multiplying your chosen height by the returned aspect ratio. + * + * This aspect ratio is calculated based on the underlying size of the + * video buffers and the current pixel-aspect-ratio. + * + * Return value: a width-for-height aspect ratio + * + * Since: 1.16 + * Stability: unstable + */ +float +cogl_gst_video_sink_get_aspect (CoglGstVideoSink *sink); + +/** + * cogl_gst_video_sink_get_width_for_height: + * @sink: A #CoglGstVideoSink + * @height: A specific output @height + * + * Calculates a suitable output width for a specific output @height + * that will maintain the video's aspect ratio. + * + * Return value: An output width for the given output @height. + * + * Since: 1.16 + * Stability: unstable + */ +float +cogl_gst_video_sink_get_width_for_height (CoglGstVideoSink *sink, + float height); + +/** + * cogl_gst_video_sink_get_height_for_width: + * @sink: A #CoglGstVideoSink + * @width: A specific output @width + * + * Calculates a suitable output height for a specific output @width + * that will maintain the video's aspect ratio. + * + * Return value: An output height for the given output @width. + * + * Since: 1.16 + * Stability: unstable + */ +float +cogl_gst_video_sink_get_height_for_width (CoglGstVideoSink *sink, + float width); + +/** + * cogl_gst_video_sink_get_natural_size: + * @sink: A #CoglGstVideoSink + * @width: (out): return location for the video's natural width + * @height: (out): return location for the video's natural height + * + * Considering the real resolution of the video as well as the aspect + * ratio of pixel data that may need to be stretched when being displayed; + * this function calculates what the natural size of the underlying + * video source is. + * + * The natural size has the correct aspect ratio for displaying the + * video and is the minimum size where downscaling is not required. + * + * This natural size is calculated assuming that the video will + * be displayed on square pixels. + * + * Since: 1.18 + * Stability: unstable + */ +void +cogl_gst_video_sink_get_natural_size (CoglGstVideoSink *sink, + float *width, + float *height); + +/** + * cogl_gst_video_sink_get_natural_width: + * @sink: A #CoglGstVideoSink + * + * Considering the real resolution of the video as well as the aspect + * ratio of pixel data that may need to be stretched when being displayed; + * this function calculates what the natural size of the underlying + * video source is, and returns its width. + * + * The natural size has the correct aspect ratio for displaying the + * video and is the minimum size where downscaling is not required. + * + * This natural size is calculated assuming that the video will + * be displayed on square pixels. + * + * Return value: The video's natural width + * + * Since: 1.18 + * Stability: unstable + */ +float +cogl_gst_video_sink_get_natural_width (CoglGstVideoSink *sink); + +/** + * cogl_gst_video_sink_get_natural_height: + * @sink: A #CoglGstVideoSink + * + * Considering the real resolution of the video as well as the aspect + * ratio of pixel data that may need to be stretched when being displayed; + * this function calculates what the natural size of the underlying + * video source is, and returns its height. + * + * The natural size has the correct aspect ratio for displaying the + * video and is the minimum size where downscaling is not required. + * + * This natural size is calculated assuming that the video will + * be displayed on square pixels. + * + * Return value: The video's natural height + * + * Since: 1.18 + * Stability: unstable + */ +float +cogl_gst_video_sink_get_natural_height (CoglGstVideoSink *sink); + +/** + * CoglGstRectangle: + * @x: The X coordinate of the top left of the rectangle + * @y: The Y coordinate of the top left of the rectangle + * @width: The width of the rectangle + * @height: The height of the rectangle + * + * Describes a rectangle that can be used for video output. + */ +typedef struct _CoglGstRectangle +{ + float x; + float y; + float width; + float height; +} CoglGstRectangle; + +COGL_GST_GTYPE_DECLARE_TYPE (rectangle); + +/** + * cogl_gst_video_sink_fit_size: + * @sink: A #CoglGstVideoSink + * @available: (in): The space available for video output + * @output: (inout): The return location for the calculated output position + * + * Calculates a suitable @output rectangle that can fit inside the + * @available space while maintaining the aspect ratio of the current + * video. + * + * Applications would typically use this api for "letterboxing" by + * using this api to position a video inside a fixed screen space and + * filling the remaining space with black borders. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_gst_video_sink_fit_size (CoglGstVideoSink *sink, + const CoglGstRectangle *available, + CoglGstRectangle *output); + +G_END_DECLS + +#endif diff --git a/cogl-gst/cogl-gst.h b/cogl-gst/cogl-gst.h new file mode 100644 index 0000000..ea14865 --- /dev/null +++ b/cogl-gst/cogl-gst.h @@ -0,0 +1,35 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007, 2008 OpenedHand + * Copyright (C) 2009, 2010, 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_GST_H__ +#define __COGL_GST_H__ + +#include + +#endif diff --git a/cogl-gst/cogl-gst.pc.in b/cogl-gst/cogl-gst.pc.in new file mode 100644 index 0000000..f47e847 --- /dev/null +++ b/cogl-gst/cogl-gst.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ @COGL_GST_PKG_REQUIRES@ + +Name: Cogl +Description: A gstreamer integration library for Cogl +Version: @COGL_VERSION@ +Libs: -L${libdir} -lcogl-gst +Cflags: -I${includedir}/cogl -DCOGL_ENABLE_EXPERIMENTAL_2_0_API +Requires: ${requires} diff --git a/cogl-pango/Makefile.am b/cogl-pango/Makefile.am new file mode 100644 index 0000000..64d9771 --- /dev/null +++ b/cogl-pango/Makefile.am @@ -0,0 +1,144 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +CLEANFILES = +DISTCLEANFILES = + +EXTRA_DIST = + +source_c = \ + cogl-pango-display-list.c \ + cogl-pango-fontmap.c \ + cogl-pango-render.c \ + cogl-pango-glyph-cache.c \ + cogl-pango-pipeline-cache.c \ + $(NULL) + +source_h = cogl-pango.h + +source_h_priv = \ + cogl-pango-display-list.h \ + cogl-pango-private.h \ + cogl-pango-glyph-cache.h \ + cogl-pango-pipeline-cache.h \ + $(NULL) + +lib_LTLIBRARIES = libcogl-pango.la + +libcogl_pango_la_SOURCES = $(source_c) $(source_h) $(source_h_priv) +libcogl_pango_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_pango_la_LIBADD = $(top_builddir)/cogl/libcogl.la +libcogl_pango_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_PANGO_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_pango_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^cogl_pango_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglPango\" \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_pangoheadersdir = $(includedir)/cogl/cogl-pango +cogl_pangoheaders_HEADERS = $(source_h) + +pc_files = cogl-pango-1.0.pc \ + cogl-pango-$(COGL_API_VERSION)-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) + +EXTRA_DIST += cogl-pango.pc.in +DISTCLEANFILES += $(pc_files) + +dist-hook: ../build/win32/vs9/cogl-pango.vcproj ../build/win32/vs10/cogl-pango.vcxproj ../build/win32/vs10/cogl-pango.vcxproj.filters + +../build/win32/vs9/cogl-pango.vcproj: $(top_srcdir)/build/win32/vs9/cogl-pango.vcprojin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >coglpango.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/cogl-pango.vcprojin >$@ + rm coglpango.sourcefiles + +../build/win32/vs10/cogl-pango.vcxproj: $(top_srcdir)/build/win32/vs10/cogl-pango.vcxprojin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >coglpango.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl-pango.vcxprojin >$@ + rm coglpango.vs10.sourcefiles + +../build/win32/vs10/cogl-pango.vcxproj.filters: $(top_srcdir)/build/win32/vs10/cogl-pango.vcxproj.filtersin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >coglpango.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl-pango.vcxproj.filtersin >$@ + rm coglpango.vs10.sourcefiles.filters + +EXTRA_DIST += cogl-pango.symbols cogl-pango.rc.in cogl-pango.rc + +DISTCLEANFILES += ../build/win32/vs9/cogl-pango.vcproj ../build/win32/vs10/cogl-pango.vcxproj ../build/win32/vs10/cogl-pango.vcxproj.filters cogl-pango.rc + +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION +INTROSPECTION_COMPILER_ARGS=--includedir=$(top_builddir)/cogl + +CoglPango-1.0.gir: libcogl-pango.la Makefile + +CoglPango_1_0_gir_NAMESPACE = CoglPango +CoglPango_1_0_gir_VERSION = 1.0 +CoglPango_1_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-pango.la +CoglPango_1_0_gir_FILES = $(source_h) $(source_c) +CoglPango_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +CoglPango_1_0_gir_INCLUDES = Pango-1.0 PangoCairo-1.0 +CoglPango_1_0_gir_EXPORT_PACKAGES = cogl-pango-1.0 +CoglPango_1_0_gir_SCANNERFLAGS = \ + --warn-all \ + --identifier-prefix=CoglPango \ + --symbol-prefix=cogl_pango \ + --c-include='cogl-pango/cogl-pango.h' \ + --include-uninstalled=$(top_builddir)/cogl/Cogl-1.0.gir + +CoglPango-2.0.gir: libcogl-pango.la Makefile + +CoglPango_2_0_gir_NAMESPACE = CoglPango +CoglPango_2_0_gir_VERSION = 2.0 +CoglPango_2_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-pango.la +CoglPango_2_0_gir_FILES = $(source_h) $(source_c) +CoglPango_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +CoglPango_2_0_gir_INCLUDES = Pango-1.0 PangoCairo-1.0 +CoglPango_2_0_gir_EXPORT_PACKAGES = cogl-pango-2.0-experimental +CoglPango_2_0_gir_SCANNERFLAGS = \ + --warn-all \ + --identifier-prefix=CoglPango \ + --symbol-prefix=cogl_pango \ + --c-include='cogl-pango/cogl-pango.h' \ + --include-uninstalled=$(top_builddir)/cogl/Cogl-2.0.gir + +INTROSPECTION_GIRS += CoglPango-1.0.gir CoglPango-2.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/cogl-pango/Makefile.in b/cogl-pango/Makefile.in new file mode 100644 index 0000000..e17383e --- /dev/null +++ b/cogl-pango/Makefile.in @@ -0,0 +1,1079 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/cogl-pango-1.0.pc.in \ + $(srcdir)/cogl-pango-2.0-experimental.pc.in \ + $(srcdir)/cogl-pango.rc.in $(top_srcdir)/build/depcomp \ + $(cogl_pangoheaders_HEADERS) +@HAVE_INTROSPECTION_TRUE@am__append_1 = CoglPango-1.0.gir CoglPango-2.0.gir +@HAVE_INTROSPECTION_TRUE@am__append_2 = $(gir_DATA) $(typelib_DATA) +subdir = cogl-pango +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-pango-1.0.pc cogl-pango-2.0-experimental.pc \ + cogl-pango.rc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ + "$(DESTDIR)$(cogl_pangoheadersdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcogl_pango_la_DEPENDENCIES = $(top_builddir)/cogl/libcogl.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = libcogl_pango_la-cogl-pango-display-list.lo \ + libcogl_pango_la-cogl-pango-fontmap.lo \ + libcogl_pango_la-cogl-pango-render.lo \ + libcogl_pango_la-cogl-pango-glyph-cache.lo \ + libcogl_pango_la-cogl-pango-pipeline-cache.lo $(am__objects_1) +am__objects_3 = $(am__objects_1) +am_libcogl_pango_la_OBJECTS = $(am__objects_2) $(am__objects_1) \ + $(am__objects_3) +libcogl_pango_la_OBJECTS = $(am_libcogl_pango_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcogl_pango_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libcogl_pango_la_CFLAGS) $(CFLAGS) \ + $(libcogl_pango_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcogl_pango_la_SOURCES) +DIST_SOURCES = $(libcogl_pango_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) +HEADERS = $(cogl_pangoheaders_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +CLEANFILES = $(am__append_2) +DISTCLEANFILES = $(pc_files) ../build/win32/vs9/cogl-pango.vcproj \ + ../build/win32/vs10/cogl-pango.vcxproj \ + ../build/win32/vs10/cogl-pango.vcxproj.filters cogl-pango.rc +EXTRA_DIST = cogl-pango.pc.in cogl-pango.symbols cogl-pango.rc.in \ + cogl-pango.rc +source_c = \ + cogl-pango-display-list.c \ + cogl-pango-fontmap.c \ + cogl-pango-render.c \ + cogl-pango-glyph-cache.c \ + cogl-pango-pipeline-cache.c \ + $(NULL) + +source_h = cogl-pango.h +source_h_priv = \ + cogl-pango-display-list.h \ + cogl-pango-private.h \ + cogl-pango-glyph-cache.h \ + cogl-pango-pipeline-cache.h \ + $(NULL) + +lib_LTLIBRARIES = libcogl-pango.la +libcogl_pango_la_SOURCES = $(source_c) $(source_h) $(source_h_priv) +libcogl_pango_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_pango_la_LIBADD = $(top_builddir)/cogl/libcogl.la \ + $(COGL_DEP_LIBS) $(COGL_PANGO_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_pango_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^cogl_pango_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglPango\" \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_pangoheadersdir = $(includedir)/cogl/cogl-pango +cogl_pangoheaders_HEADERS = $(source_h) +pc_files = cogl-pango-1.0.pc \ + cogl-pango-$(COGL_API_VERSION)-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) +INTROSPECTION_GIRS = $(am__append_1) +@HAVE_INTROSPECTION_TRUE@INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/cogl +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_NAMESPACE = CoglPango +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_VERSION = 1.0 +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-pango.la +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_FILES = $(source_h) $(source_c) +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_INCLUDES = Pango-1.0 PangoCairo-1.0 +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_EXPORT_PACKAGES = cogl-pango-1.0 +@HAVE_INTROSPECTION_TRUE@CoglPango_1_0_gir_SCANNERFLAGS = \ +@HAVE_INTROSPECTION_TRUE@ --warn-all \ +@HAVE_INTROSPECTION_TRUE@ --identifier-prefix=CoglPango \ +@HAVE_INTROSPECTION_TRUE@ --symbol-prefix=cogl_pango \ +@HAVE_INTROSPECTION_TRUE@ --c-include='cogl-pango/cogl-pango.h' \ +@HAVE_INTROSPECTION_TRUE@ --include-uninstalled=$(top_builddir)/cogl/Cogl-1.0.gir + +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_NAMESPACE = CoglPango +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_VERSION = 2.0 +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-pango.la +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_FILES = $(source_h) $(source_c) +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_INCLUDES = Pango-1.0 PangoCairo-1.0 +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_EXPORT_PACKAGES = cogl-pango-2.0-experimental +@HAVE_INTROSPECTION_TRUE@CoglPango_2_0_gir_SCANNERFLAGS = \ +@HAVE_INTROSPECTION_TRUE@ --warn-all \ +@HAVE_INTROSPECTION_TRUE@ --identifier-prefix=CoglPango \ +@HAVE_INTROSPECTION_TRUE@ --symbol-prefix=cogl_pango \ +@HAVE_INTROSPECTION_TRUE@ --c-include='cogl-pango/cogl-pango.h' \ +@HAVE_INTROSPECTION_TRUE@ --include-uninstalled=$(top_builddir)/cogl/Cogl-2.0.gir + +@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 +@HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) +@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 +@HAVE_INTROSPECTION_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cogl-pango/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign cogl-pango/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-pango-1.0.pc: $(top_builddir)/config.status $(srcdir)/cogl-pango-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-pango-2.0-experimental.pc: $(top_builddir)/config.status $(srcdir)/cogl-pango-2.0-experimental.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-pango.rc: $(top_builddir)/config.status $(srcdir)/cogl-pango.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcogl-pango.la: $(libcogl_pango_la_OBJECTS) $(libcogl_pango_la_DEPENDENCIES) $(EXTRA_libcogl_pango_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcogl_pango_la_LINK) -rpath $(libdir) $(libcogl_pango_la_OBJECTS) $(libcogl_pango_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_pango_la-cogl-pango-display-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_pango_la-cogl-pango-fontmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_pango_la-cogl-pango-glyph-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_pango_la-cogl-pango-pipeline-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_pango_la-cogl-pango-render.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcogl_pango_la-cogl-pango-display-list.lo: cogl-pango-display-list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -MT libcogl_pango_la-cogl-pango-display-list.lo -MD -MP -MF $(DEPDIR)/libcogl_pango_la-cogl-pango-display-list.Tpo -c -o libcogl_pango_la-cogl-pango-display-list.lo `test -f 'cogl-pango-display-list.c' || echo '$(srcdir)/'`cogl-pango-display-list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_pango_la-cogl-pango-display-list.Tpo $(DEPDIR)/libcogl_pango_la-cogl-pango-display-list.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-pango-display-list.c' object='libcogl_pango_la-cogl-pango-display-list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -c -o libcogl_pango_la-cogl-pango-display-list.lo `test -f 'cogl-pango-display-list.c' || echo '$(srcdir)/'`cogl-pango-display-list.c + +libcogl_pango_la-cogl-pango-fontmap.lo: cogl-pango-fontmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -MT libcogl_pango_la-cogl-pango-fontmap.lo -MD -MP -MF $(DEPDIR)/libcogl_pango_la-cogl-pango-fontmap.Tpo -c -o libcogl_pango_la-cogl-pango-fontmap.lo `test -f 'cogl-pango-fontmap.c' || echo '$(srcdir)/'`cogl-pango-fontmap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_pango_la-cogl-pango-fontmap.Tpo $(DEPDIR)/libcogl_pango_la-cogl-pango-fontmap.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-pango-fontmap.c' object='libcogl_pango_la-cogl-pango-fontmap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -c -o libcogl_pango_la-cogl-pango-fontmap.lo `test -f 'cogl-pango-fontmap.c' || echo '$(srcdir)/'`cogl-pango-fontmap.c + +libcogl_pango_la-cogl-pango-render.lo: cogl-pango-render.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -MT libcogl_pango_la-cogl-pango-render.lo -MD -MP -MF $(DEPDIR)/libcogl_pango_la-cogl-pango-render.Tpo -c -o libcogl_pango_la-cogl-pango-render.lo `test -f 'cogl-pango-render.c' || echo '$(srcdir)/'`cogl-pango-render.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_pango_la-cogl-pango-render.Tpo $(DEPDIR)/libcogl_pango_la-cogl-pango-render.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-pango-render.c' object='libcogl_pango_la-cogl-pango-render.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -c -o libcogl_pango_la-cogl-pango-render.lo `test -f 'cogl-pango-render.c' || echo '$(srcdir)/'`cogl-pango-render.c + +libcogl_pango_la-cogl-pango-glyph-cache.lo: cogl-pango-glyph-cache.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -MT libcogl_pango_la-cogl-pango-glyph-cache.lo -MD -MP -MF $(DEPDIR)/libcogl_pango_la-cogl-pango-glyph-cache.Tpo -c -o libcogl_pango_la-cogl-pango-glyph-cache.lo `test -f 'cogl-pango-glyph-cache.c' || echo '$(srcdir)/'`cogl-pango-glyph-cache.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_pango_la-cogl-pango-glyph-cache.Tpo $(DEPDIR)/libcogl_pango_la-cogl-pango-glyph-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-pango-glyph-cache.c' object='libcogl_pango_la-cogl-pango-glyph-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -c -o libcogl_pango_la-cogl-pango-glyph-cache.lo `test -f 'cogl-pango-glyph-cache.c' || echo '$(srcdir)/'`cogl-pango-glyph-cache.c + +libcogl_pango_la-cogl-pango-pipeline-cache.lo: cogl-pango-pipeline-cache.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -MT libcogl_pango_la-cogl-pango-pipeline-cache.lo -MD -MP -MF $(DEPDIR)/libcogl_pango_la-cogl-pango-pipeline-cache.Tpo -c -o libcogl_pango_la-cogl-pango-pipeline-cache.lo `test -f 'cogl-pango-pipeline-cache.c' || echo '$(srcdir)/'`cogl-pango-pipeline-cache.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_pango_la-cogl-pango-pipeline-cache.Tpo $(DEPDIR)/libcogl_pango_la-cogl-pango-pipeline-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-pango-pipeline-cache.c' object='libcogl_pango_la-cogl-pango-pipeline-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_pango_la_CFLAGS) $(CFLAGS) -c -o libcogl_pango_la-cogl-pango-pipeline-cache.lo `test -f 'cogl-pango-pipeline-cache.c' || echo '$(srcdir)/'`cogl-pango-pipeline-cache.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-girDATA: $(gir_DATA) + @$(NORMAL_INSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ + done + +uninstall-girDATA: + @$(NORMAL_UNINSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ + done + +uninstall-typelibDATA: + @$(NORMAL_UNINSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) +install-cogl_pangoheadersHEADERS: $(cogl_pangoheaders_HEADERS) + @$(NORMAL_INSTALL) + @list='$(cogl_pangoheaders_HEADERS)'; test -n "$(cogl_pangoheadersdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogl_pangoheadersdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogl_pangoheadersdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogl_pangoheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogl_pangoheadersdir)" || exit $$?; \ + done + +uninstall-cogl_pangoheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(cogl_pangoheaders_HEADERS)'; test -n "$(cogl_pangoheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogl_pangoheadersdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(cogl_pangoheadersdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-cogl_pangoheadersHEADERS install-girDATA \ + install-pkgconfigDATA install-typelibDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-cogl_pangoheadersHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-typelibDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am dist-hook distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-cogl_pangoheadersHEADERS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-girDATA install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip install-typelibDATA installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-cogl_pangoheadersHEADERS \ + uninstall-girDATA uninstall-libLTLIBRARIES \ + uninstall-pkgconfigDATA uninstall-typelibDATA + + +dist-hook: ../build/win32/vs9/cogl-pango.vcproj ../build/win32/vs10/cogl-pango.vcxproj ../build/win32/vs10/cogl-pango.vcxproj.filters + +../build/win32/vs9/cogl-pango.vcproj: $(top_srcdir)/build/win32/vs9/cogl-pango.vcprojin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >coglpango.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/cogl-pango.vcprojin >$@ + rm coglpango.sourcefiles + +../build/win32/vs10/cogl-pango.vcxproj: $(top_srcdir)/build/win32/vs10/cogl-pango.vcxprojin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >coglpango.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl-pango.vcxprojin >$@ + rm coglpango.vs10.sourcefiles + +../build/win32/vs10/cogl-pango.vcxproj.filters: $(top_srcdir)/build/win32/vs10/cogl-pango.vcxproj.filtersin + for F in $(source_c); do \ + case $$F in \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >coglpango.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl-pango.vcxproj.filtersin >$@ + rm coglpango.vs10.sourcefiles.filters + +-include $(INTROSPECTION_MAKEFILE) + +@HAVE_INTROSPECTION_TRUE@CoglPango-1.0.gir: libcogl-pango.la Makefile + +@HAVE_INTROSPECTION_TRUE@CoglPango-2.0.gir: libcogl-pango.la Makefile + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cogl-pango/cogl-pango-1.0.pc.in b/cogl-pango/cogl-pango-1.0.pc.in new file mode 100644 index 0000000..e105de9 --- /dev/null +++ b/cogl-pango/cogl-pango-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=1.0 +requires=@COGL_PKG_REQUIRES@ cogl-1.0 + +Name: Cogl +Description: An object oriented GL/GLES Abstraction/Utility Layer +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-pango +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-pango/cogl-pango-2.0-experimental.pc.in b/cogl-pango/cogl-pango-2.0-experimental.pc.in new file mode 100644 index 0000000..98eb16a --- /dev/null +++ b/cogl-pango/cogl-pango-2.0-experimental.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ cogl-2.0-experimental + +Name: Cogl +Description: An object oriented GL/GLES Abstraction/Utility Layer +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcoglpango +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-pango/cogl-pango-display-list.c b/cogl-pango/cogl-pango-display-list.c new file mode 100644 index 0000000..6967ab0 --- /dev/null +++ b/cogl-pango/cogl-pango-display-list.c @@ -0,0 +1,499 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-pango-display-list.h" +#include "cogl-pango-pipeline-cache.h" +#include "cogl/cogl-context-private.h" + +typedef enum +{ + COGL_PANGO_DISPLAY_LIST_TEXTURE, + COGL_PANGO_DISPLAY_LIST_RECTANGLE, + COGL_PANGO_DISPLAY_LIST_TRAPEZOID +} CoglPangoDisplayListNodeType; + +typedef struct _CoglPangoDisplayListNode CoglPangoDisplayListNode; +typedef struct _CoglPangoDisplayListRectangle CoglPangoDisplayListRectangle; + +struct _CoglPangoDisplayList +{ + CoglBool color_override; + CoglColor color; + GSList *nodes; + GSList *last_node; + CoglPangoPipelineCache *pipeline_cache; +}; + +/* This matches the format expected by cogl_rectangles_with_texture_coords */ +struct _CoglPangoDisplayListRectangle +{ + float x_1, y_1, x_2, y_2; + float s_1, t_1, s_2, t_2; +}; + +struct _CoglPangoDisplayListNode +{ + CoglPangoDisplayListNodeType type; + + CoglBool color_override; + CoglColor color; + + CoglPipeline *pipeline; + + union + { + struct + { + /* The texture to render these coords from */ + CoglTexture *texture; + /* Array of rectangles in the format expected by + cogl_rectangles_with_texture_coords */ + GArray *rectangles; + /* A primitive representing those vertices */ + CoglPrimitive *primitive; + } texture; + + struct + { + float x_1, y_1; + float x_2, y_2; + } rectangle; + + struct + { + CoglPrimitive *primitive; + } trapezoid; + } d; +}; + +CoglPangoDisplayList * +_cogl_pango_display_list_new (CoglPangoPipelineCache *pipeline_cache) +{ + CoglPangoDisplayList *dl = g_slice_new0 (CoglPangoDisplayList); + + dl->pipeline_cache = pipeline_cache; + + return dl; +} + +static void +_cogl_pango_display_list_append_node (CoglPangoDisplayList *dl, + CoglPangoDisplayListNode *node) +{ + if (dl->last_node) + dl->last_node = dl->last_node->next = g_slist_prepend (NULL, node); + else + dl->last_node = dl->nodes = g_slist_prepend (NULL, node); +} + +void +_cogl_pango_display_list_set_color_override (CoglPangoDisplayList *dl, + const CoglColor *color) +{ + dl->color_override = TRUE; + dl->color = *color; +} + +void +_cogl_pango_display_list_remove_color_override (CoglPangoDisplayList *dl) +{ + dl->color_override = FALSE; +} + +void +_cogl_pango_display_list_add_texture (CoglPangoDisplayList *dl, + CoglTexture *texture, + float x_1, float y_1, + float x_2, float y_2, + float tx_1, float ty_1, + float tx_2, float ty_2) +{ + CoglPangoDisplayListNode *node; + CoglPangoDisplayListRectangle *rectangle; + + /* Add to the last node if it is a texture node with the same + target texture */ + if (dl->last_node + && (node = dl->last_node->data)->type == COGL_PANGO_DISPLAY_LIST_TEXTURE + && node->d.texture.texture == texture + && (dl->color_override + ? (node->color_override && cogl_color_equal (&dl->color, &node->color)) + : !node->color_override)) + { + /* Get rid of the vertex buffer so that it will be recreated */ + if (node->d.texture.primitive != NULL) + { + cogl_object_unref (node->d.texture.primitive); + node->d.texture.primitive = NULL; + } + } + else + { + /* Otherwise create a new node */ + node = g_slice_new (CoglPangoDisplayListNode); + + node->type = COGL_PANGO_DISPLAY_LIST_TEXTURE; + node->color_override = dl->color_override; + node->color = dl->color; + node->pipeline = NULL; + node->d.texture.texture = cogl_object_ref (texture); + node->d.texture.rectangles + = g_array_new (FALSE, FALSE, sizeof (CoglPangoDisplayListRectangle)); + node->d.texture.primitive = NULL; + + _cogl_pango_display_list_append_node (dl, node); + } + + g_array_set_size (node->d.texture.rectangles, + node->d.texture.rectangles->len + 1); + rectangle = &g_array_index (node->d.texture.rectangles, + CoglPangoDisplayListRectangle, + node->d.texture.rectangles->len - 1); + rectangle->x_1 = x_1; + rectangle->y_1 = y_1; + rectangle->x_2 = x_2; + rectangle->y_2 = y_2; + rectangle->s_1 = tx_1; + rectangle->t_1 = ty_1; + rectangle->s_2 = tx_2; + rectangle->t_2 = ty_2; +} + +void +_cogl_pango_display_list_add_rectangle (CoglPangoDisplayList *dl, + float x_1, float y_1, + float x_2, float y_2) +{ + CoglPangoDisplayListNode *node = g_slice_new (CoglPangoDisplayListNode); + + node->type = COGL_PANGO_DISPLAY_LIST_RECTANGLE; + node->color_override = dl->color_override; + node->color = dl->color; + node->d.rectangle.x_1 = x_1; + node->d.rectangle.y_1 = y_1; + node->d.rectangle.x_2 = x_2; + node->d.rectangle.y_2 = y_2; + node->pipeline = NULL; + + _cogl_pango_display_list_append_node (dl, node); +} + +void +_cogl_pango_display_list_add_trapezoid (CoglPangoDisplayList *dl, + float y_1, + float x_11, + float x_21, + float y_2, + float x_12, + float x_22) +{ + CoglContext *ctx = dl->pipeline_cache->ctx; + CoglPangoDisplayListNode *node = g_slice_new (CoglPangoDisplayListNode); + CoglVertexP2 vertices[4] = { + { x_11, y_1 }, + { x_12, y_2 }, + { x_22, y_2 }, + { x_21, y_1 } + }; + + node->type = COGL_PANGO_DISPLAY_LIST_TRAPEZOID; + node->color_override = dl->color_override; + node->color = dl->color; + node->pipeline = NULL; + + node->d.trapezoid.primitive = + cogl_primitive_new_p2 (ctx, + COGL_VERTICES_MODE_TRIANGLE_FAN, + 4, + vertices); + + _cogl_pango_display_list_append_node (dl, node); +} + +static void +emit_rectangles_through_journal (CoglFramebuffer *fb, + CoglPipeline *pipeline, + CoglPangoDisplayListNode *node) +{ + const float *rectangles = (const float *)node->d.texture.rectangles->data; + + cogl_framebuffer_draw_textured_rectangles (fb, + pipeline, + rectangles, + node->d.texture.rectangles->len); +} + +static void +emit_vertex_buffer_geometry (CoglFramebuffer *fb, + CoglPipeline *pipeline, + CoglPangoDisplayListNode *node) +{ + CoglContext *ctx = fb->context; + + /* It's expensive to go through the Cogl journal for large runs + * of text in part because the journal transforms the quads in software + * to avoid changing the modelview matrix. So for larger runs of text + * we load the vertices into a VBO, and this has the added advantage + * that if the text doesn't change from frame to frame the VBO can + * be re-used avoiding the repeated cost of validating the data and + * mapping it into the GPU... */ + + if (node->d.texture.primitive == NULL) + { + CoglAttributeBuffer *buffer; + CoglVertexP2T2 *verts, *v; + int n_verts; + CoglBool allocated = FALSE; + CoglAttribute *attributes[2]; + CoglPrimitive *prim; + int i; + + n_verts = node->d.texture.rectangles->len * 4; + + buffer + = cogl_attribute_buffer_new_with_size (ctx, + n_verts * + sizeof (CoglVertexP2T2)); + + if ((verts = cogl_buffer_map (COGL_BUFFER (buffer), + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD)) == NULL) + { + verts = g_new (CoglVertexP2T2, n_verts); + allocated = TRUE; + } + + v = verts; + + /* Copy the rectangles into the buffer and expand into four + vertices instead of just two */ + for (i = 0; i < node->d.texture.rectangles->len; i++) + { + const CoglPangoDisplayListRectangle *rectangle + = &g_array_index (node->d.texture.rectangles, + CoglPangoDisplayListRectangle, i); + + v->x = rectangle->x_1; + v->y = rectangle->y_1; + v->s = rectangle->s_1; + v->t = rectangle->t_1; + v++; + v->x = rectangle->x_1; + v->y = rectangle->y_2; + v->s = rectangle->s_1; + v->t = rectangle->t_2; + v++; + v->x = rectangle->x_2; + v->y = rectangle->y_2; + v->s = rectangle->s_2; + v->t = rectangle->t_2; + v++; + v->x = rectangle->x_2; + v->y = rectangle->y_1; + v->s = rectangle->s_2; + v->t = rectangle->t_1; + v++; + } + + if (allocated) + { + cogl_buffer_set_data (COGL_BUFFER (buffer), + 0, /* offset */ + verts, + sizeof (CoglVertexP2T2) * n_verts); + g_free (verts); + } + else + cogl_buffer_unmap (COGL_BUFFER (buffer)); + + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (CoglVertexP2T2), + G_STRUCT_OFFSET (CoglVertexP2T2, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (buffer, + "cogl_tex_coord0_in", + sizeof (CoglVertexP2T2), + G_STRUCT_OFFSET (CoglVertexP2T2, s), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + prim = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + n_verts, + attributes, + 2 /* n_attributes */); + +#ifdef CLUTTER_COGL_HAS_GL + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS)) + cogl_primitive_set_mode (prim, GL_QUADS); + else +#endif + { + /* GLES doesn't support GL_QUADS so instead we use a VBO + with indexed vertices to generate GL_TRIANGLES from the + quads */ + + CoglIndices *indices = + cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len); + + cogl_primitive_set_indices (prim, indices, + node->d.texture.rectangles->len * 6); + } + + node->d.texture.primitive = prim; + + cogl_object_unref (buffer); + cogl_object_unref (attributes[0]); + cogl_object_unref (attributes[1]); + } + + cogl_primitive_draw (node->d.texture.primitive, + fb, + pipeline); +} + +static void +_cogl_framebuffer_draw_display_list_texture (CoglFramebuffer *fb, + CoglPipeline *pipeline, + CoglPangoDisplayListNode *node) +{ + /* For small runs of text like icon labels, we can get better performance + * going through the Cogl journal since text may then be batched together + * with other geometry. */ + /* FIXME: 25 is a number I plucked out of thin air; it would be good + * to determine this empirically! */ + if (node->d.texture.rectangles->len < 25) + emit_rectangles_through_journal (fb, pipeline, node); + else + emit_vertex_buffer_geometry (fb, pipeline, node); +} + +void +_cogl_pango_display_list_render (CoglFramebuffer *fb, + CoglPangoDisplayList *dl, + const CoglColor *color) +{ + GSList *l; + + for (l = dl->nodes; l; l = l->next) + { + CoglPangoDisplayListNode *node = l->data; + CoglColor draw_color; + + if (node->pipeline == NULL) + { + if (node->type == COGL_PANGO_DISPLAY_LIST_TEXTURE) + node->pipeline = + _cogl_pango_pipeline_cache_get (dl->pipeline_cache, + node->d.texture.texture); + else + node->pipeline = + _cogl_pango_pipeline_cache_get (dl->pipeline_cache, + NULL); + } + + if (node->color_override) + /* Use the override color but preserve the alpha from the + draw color */ + cogl_color_init_from_4ub (&draw_color, + cogl_color_get_red_byte (&node->color), + cogl_color_get_green_byte (&node->color), + cogl_color_get_blue_byte (&node->color), + cogl_color_get_alpha_byte (color)); + else + draw_color = *color; + cogl_color_premultiply (&draw_color); + + cogl_pipeline_set_color (node->pipeline, &draw_color); + + switch (node->type) + { + case COGL_PANGO_DISPLAY_LIST_TEXTURE: + _cogl_framebuffer_draw_display_list_texture (fb, node->pipeline, node); + break; + + case COGL_PANGO_DISPLAY_LIST_RECTANGLE: + cogl_framebuffer_draw_rectangle (fb, + node->pipeline, + node->d.rectangle.x_1, + node->d.rectangle.y_1, + node->d.rectangle.x_2, + node->d.rectangle.y_2); + break; + + case COGL_PANGO_DISPLAY_LIST_TRAPEZOID: + cogl_framebuffer_draw_primitive (fb, node->pipeline, + node->d.trapezoid.primitive); + break; + } + } +} + +static void +_cogl_pango_display_list_node_free (CoglPangoDisplayListNode *node) +{ + if (node->type == COGL_PANGO_DISPLAY_LIST_TEXTURE) + { + g_array_free (node->d.texture.rectangles, TRUE); + if (node->d.texture.texture != NULL) + cogl_object_unref (node->d.texture.texture); + if (node->d.texture.primitive != NULL) + cogl_object_unref (node->d.texture.primitive); + } + else if (node->type == COGL_PANGO_DISPLAY_LIST_TRAPEZOID) + cogl_object_unref (node->d.trapezoid.primitive); + + if (node->pipeline) + cogl_object_unref (node->pipeline); + + g_slice_free (CoglPangoDisplayListNode, node); +} + +void +_cogl_pango_display_list_clear (CoglPangoDisplayList *dl) +{ + g_slist_foreach (dl->nodes, (GFunc) _cogl_pango_display_list_node_free, NULL); + g_slist_free (dl->nodes); + dl->nodes = NULL; + dl->last_node = NULL; +} + +void +_cogl_pango_display_list_free (CoglPangoDisplayList *dl) +{ + _cogl_pango_display_list_clear (dl); + g_slice_free (CoglPangoDisplayList, dl); +} diff --git a/cogl-pango/cogl-pango-display-list.h b/cogl-pango/cogl-pango-display-list.h new file mode 100644 index 0000000..5dbc074 --- /dev/null +++ b/cogl-pango/cogl-pango-display-list.h @@ -0,0 +1,84 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_PANGO_DISPLAY_LIST_H__ +#define __COGL_PANGO_DISPLAY_LIST_H__ + +#include +#include "cogl-pango-pipeline-cache.h" + +COGL_BEGIN_DECLS + +typedef struct _CoglPangoDisplayList CoglPangoDisplayList; + +CoglPangoDisplayList * +_cogl_pango_display_list_new (CoglPangoPipelineCache *); + +void +_cogl_pango_display_list_set_color_override (CoglPangoDisplayList *dl, + const CoglColor *color); + +void +_cogl_pango_display_list_remove_color_override (CoglPangoDisplayList *dl); + +void +_cogl_pango_display_list_add_texture (CoglPangoDisplayList *dl, + CoglTexture *texture, + float x_1, float y_1, + float x_2, float y_2, + float tx_1, float ty_1, + float tx_2, float ty_2); + +void +_cogl_pango_display_list_add_rectangle (CoglPangoDisplayList *dl, + float x_1, float y_1, + float x_2, float y_2); + +void +_cogl_pango_display_list_add_trapezoid (CoglPangoDisplayList *dl, + float y_1, + float x_11, + float x_21, + float y_2, + float x_12, + float x_22); + +void +_cogl_pango_display_list_render (CoglFramebuffer *framebuffer, + CoglPangoDisplayList *dl, + const CoglColor *color); + +void +_cogl_pango_display_list_clear (CoglPangoDisplayList *dl); + +void +_cogl_pango_display_list_free (CoglPangoDisplayList *dl); + +COGL_END_DECLS + +#endif /* __COGL_PANGO_DISPLAY_LIST_H__ */ diff --git a/cogl-pango/cogl-pango-fontmap.c b/cogl-pango/cogl-pango-fontmap.c new file mode 100644 index 0000000..7222238 --- /dev/null +++ b/cogl-pango/cogl-pango-fontmap.c @@ -0,0 +1,180 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * SECTION:cogl-pango + * @short_description: COGL-based text rendering using Pango + * + * FIXME + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* This is needed to get the Pango headers to export stuff needed to + subclass */ +#ifndef PANGO_ENABLE_BACKEND +#define PANGO_ENABLE_BACKEND 1 +#endif + +#include +#include +#include + +#include "cogl-pango.h" +#include "cogl-pango-private.h" +#include "cogl-util.h" +#include "cogl/cogl-context-private.h" + +static GQuark cogl_pango_font_map_get_priv_key (void) G_GNUC_CONST; + +typedef struct _CoglPangoFontMapPriv +{ + CoglContext *ctx; + PangoRenderer *renderer; +} CoglPangoFontMapPriv; + +static void +free_priv (gpointer data) +{ + CoglPangoFontMapPriv *priv = data; + + cogl_object_unref (priv->ctx); + cogl_object_unref (priv->renderer); + + g_free (priv); +} + +PangoFontMap * +cogl_pango_font_map_new (void) +{ + PangoFontMap *fm = pango_cairo_font_map_new (); + CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1); + + _COGL_GET_CONTEXT (context, NULL); + + priv->ctx = cogl_object_ref (context); + + /* XXX: The public pango api doesn't let us sub-class + * PangoCairoFontMap so we attach our own private data using qdata + * for now. */ + g_object_set_qdata_full (G_OBJECT (fm), + cogl_pango_font_map_get_priv_key (), + priv, + free_priv); + + return fm; +} + +PangoContext * +cogl_pango_font_map_create_context (CoglPangoFontMap *fm) +{ + _COGL_RETURN_VAL_IF_FAIL (COGL_PANGO_IS_FONT_MAP (fm), NULL); + + /* We can just directly use the pango context from the Cairo font + map */ + return pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fm)); +} + +static CoglPangoFontMapPriv * +_cogl_pango_font_map_get_priv (CoglPangoFontMap *fm) +{ + return g_object_get_qdata (G_OBJECT (fm), + cogl_pango_font_map_get_priv_key ()); +} + +PangoRenderer * +_cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm) +{ + CoglPangoFontMapPriv *priv = _cogl_pango_font_map_get_priv (fm); + if (G_UNLIKELY (!priv->renderer)) + priv->renderer = _cogl_pango_renderer_new (priv->ctx); + return priv->renderer; +} + +PangoRenderer * +cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm) +{ + return _cogl_pango_font_map_get_renderer (fm); +} + +CoglContext * +_cogl_pango_font_map_get_cogl_context (CoglPangoFontMap *fm) +{ + CoglPangoFontMapPriv *priv = _cogl_pango_font_map_get_priv (fm); + return priv->ctx; +} + +void +cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map, + double dpi) +{ + _COGL_RETURN_IF_FAIL (COGL_PANGO_IS_FONT_MAP (font_map)); + + pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi); +} + +void +cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *fm) +{ + PangoRenderer *renderer = _cogl_pango_font_map_get_renderer (fm); + + _cogl_pango_renderer_clear_glyph_cache (COGL_PANGO_RENDERER (renderer)); +} + +void +cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *fm, + CoglBool value) +{ + PangoRenderer *renderer = _cogl_pango_font_map_get_renderer (fm); + + _cogl_pango_renderer_set_use_mipmapping (COGL_PANGO_RENDERER (renderer), + value); +} + +CoglBool +cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *fm) +{ + PangoRenderer *renderer = _cogl_pango_font_map_get_renderer (fm); + + return + _cogl_pango_renderer_get_use_mipmapping (COGL_PANGO_RENDERER (renderer)); +} + +static GQuark +cogl_pango_font_map_get_priv_key (void) +{ + static GQuark priv_key = 0; + + if (G_UNLIKELY (priv_key == 0)) + priv_key = g_quark_from_static_string ("CoglPangoFontMap"); + + return priv_key; +} diff --git a/cogl-pango/cogl-pango-glyph-cache.c b/cogl-pango/cogl-pango-glyph-cache.c new file mode 100644 index 0000000..093404f --- /dev/null +++ b/cogl-pango/cogl-pango-glyph-cache.c @@ -0,0 +1,433 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-pango-glyph-cache.h" +#include "cogl-pango-private.h" +#include "cogl/cogl-atlas.h" +#include "cogl/cogl-atlas-texture-private.h" + +typedef struct _CoglPangoGlyphCacheKey CoglPangoGlyphCacheKey; + +struct _CoglPangoGlyphCache +{ + CoglContext *ctx; + + /* Hash table to quickly check whether a particular glyph in a + particular font is already cached */ + GHashTable *hash_table; + + /* List of CoglAtlases */ + GSList *atlases; + + /* List of callbacks to invoke when an atlas is reorganized */ + GHookList reorganize_callbacks; + + /* TRUE if we've ever stored a texture in the global atlas. This is + used to make sure we only register one callback to listen for + global atlas reorganizations */ + CoglBool using_global_atlas; + + /* True if some of the glyphs are dirty. This is used as an + optimization in _cogl_pango_glyph_cache_set_dirty_glyphs to avoid + iterating the hash table if we know none of them are dirty */ + CoglBool has_dirty_glyphs; + + /* Whether mipmapping is being used for this cache. This only + affects whether we decide to put the glyph in the global atlas */ + CoglBool use_mipmapping; +}; + +struct _CoglPangoGlyphCacheKey +{ + PangoFont *font; + PangoGlyph glyph; +}; + +static void +cogl_pango_glyph_cache_value_free (CoglPangoGlyphCacheValue *value) +{ + if (value->texture) + cogl_object_unref (value->texture); + g_slice_free (CoglPangoGlyphCacheValue, value); +} + +static void +cogl_pango_glyph_cache_key_free (CoglPangoGlyphCacheKey *key) +{ + g_object_unref (key->font); + g_slice_free (CoglPangoGlyphCacheKey, key); +} + +static unsigned int +cogl_pango_glyph_cache_hash_func (const void *key) +{ + const CoglPangoGlyphCacheKey *cache_key + = (const CoglPangoGlyphCacheKey *) key; + + /* Generate a number affected by both the font and the glyph + number. We can safely directly compare the pointers because the + key holds a reference to the font so it is not possible that a + different font will have the same memory address */ + return GPOINTER_TO_UINT (cache_key->font) ^ cache_key->glyph; +} + +static CoglBool +cogl_pango_glyph_cache_equal_func (const void *a, const void *b) +{ + const CoglPangoGlyphCacheKey *key_a + = (const CoglPangoGlyphCacheKey *) a; + const CoglPangoGlyphCacheKey *key_b + = (const CoglPangoGlyphCacheKey *) b; + + /* We can safely directly compare the pointers for the fonts because + the key holds a reference to the font so it is not possible that + a different font will have the same memory address */ + return key_a->font == key_b->font + && key_a->glyph == key_b->glyph; +} + +CoglPangoGlyphCache * +cogl_pango_glyph_cache_new (CoglContext *ctx, + CoglBool use_mipmapping) +{ + CoglPangoGlyphCache *cache; + + cache = g_malloc (sizeof (CoglPangoGlyphCache)); + + /* Note: as a rule we don't take references to a CoglContext + * internally since */ + cache->ctx = ctx; + + cache->hash_table = g_hash_table_new_full + (cogl_pango_glyph_cache_hash_func, + cogl_pango_glyph_cache_equal_func, + (GDestroyNotify) cogl_pango_glyph_cache_key_free, + (GDestroyNotify) cogl_pango_glyph_cache_value_free); + + cache->atlases = NULL; + g_hook_list_init (&cache->reorganize_callbacks, sizeof (GHook)); + + cache->has_dirty_glyphs = FALSE; + + cache->using_global_atlas = FALSE; + + cache->use_mipmapping = use_mipmapping; + + return cache; +} + +static void +cogl_pango_glyph_cache_reorganize_cb (void *user_data) +{ + CoglPangoGlyphCache *cache = user_data; + + g_hook_list_invoke (&cache->reorganize_callbacks, FALSE); +} + +void +cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache) +{ + g_slist_foreach (cache->atlases, (GFunc) cogl_object_unref, NULL); + g_slist_free (cache->atlases); + cache->atlases = NULL; + cache->has_dirty_glyphs = FALSE; + + g_hash_table_remove_all (cache->hash_table); +} + +void +cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache) +{ + if (cache->using_global_atlas) + { + _cogl_atlas_texture_remove_reorganize_callback ( + cache->ctx, + cogl_pango_glyph_cache_reorganize_cb, cache); + } + + cogl_pango_glyph_cache_clear (cache); + + g_hash_table_unref (cache->hash_table); + + g_hook_list_clear (&cache->reorganize_callbacks); + + g_free (cache); +} + +static void +cogl_pango_glyph_cache_update_position_cb (void *user_data, + CoglTexture *new_texture, + const CoglRectangleMapEntry *rect) +{ + CoglPangoGlyphCacheValue *value = user_data; + float tex_width, tex_height; + + if (value->texture) + cogl_object_unref (value->texture); + value->texture = cogl_object_ref (new_texture); + + tex_width = cogl_texture_get_width (new_texture); + tex_height = cogl_texture_get_height (new_texture); + + value->tx1 = rect->x / tex_width; + value->ty1 = rect->y / tex_height; + value->tx2 = (rect->x + value->draw_width) / tex_width; + value->ty2 = (rect->y + value->draw_height) / tex_height; + + value->tx_pixel = rect->x; + value->ty_pixel = rect->y; + + /* The glyph has changed position so it will need to be redrawn */ + value->dirty = TRUE; +} + +static CoglBool +cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache, + PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value) +{ + CoglAtlasTexture *texture; + CoglError *ignore_error = NULL; + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS)) + return FALSE; + + /* If the cache is using mipmapping then we can't use the global + atlas because it would just get migrated back out */ + if (cache->use_mipmapping) + return FALSE; + + texture = cogl_atlas_texture_new_with_size (cache->ctx, + value->draw_width, + value->draw_height); + if (!cogl_texture_allocate (COGL_TEXTURE (texture), &ignore_error)) + { + cogl_error_free (ignore_error); + return FALSE; + } + + value->texture = COGL_TEXTURE (texture); + value->tx1 = 0; + value->ty1 = 0; + value->tx2 = 1; + value->ty2 = 1; + value->tx_pixel = 0; + value->ty_pixel = 0; + + /* The first time we store a texture in the global atlas we'll + register for notifications when the global atlas is reorganized + so we can forward the notification on as a glyph + reorganization */ + if (!cache->using_global_atlas) + { + _cogl_atlas_texture_add_reorganize_callback + (cache->ctx, + cogl_pango_glyph_cache_reorganize_cb, cache); + cache->using_global_atlas = TRUE; + } + + return TRUE; +} + +static CoglBool +cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache, + PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value) +{ + CoglAtlas *atlas = NULL; + GSList *l; + + /* Look for an atlas that can reserve the space */ + for (l = cache->atlases; l; l = l->next) + if (_cogl_atlas_reserve_space (l->data, + value->draw_width + 1, + value->draw_height + 1, + value)) + { + atlas = l->data; + break; + } + + /* If we couldn't find one then start a new atlas */ + if (atlas == NULL) + { + atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_A_8, + COGL_ATLAS_CLEAR_TEXTURE | + COGL_ATLAS_DISABLE_MIGRATION, + cogl_pango_glyph_cache_update_position_cb); + COGL_NOTE (ATLAS, "Created new atlas for glyphs: %p", atlas); + /* If we still can't reserve space then something has gone + seriously wrong so we'll just give up */ + if (!_cogl_atlas_reserve_space (atlas, + value->draw_width + 1, + value->draw_height + 1, + value)) + { + cogl_object_unref (atlas); + return FALSE; + } + + _cogl_atlas_add_reorganize_callback + (atlas, cogl_pango_glyph_cache_reorganize_cb, NULL, cache); + + cache->atlases = g_slist_prepend (cache->atlases, atlas); + } + + return TRUE; +} + +CoglPangoGlyphCacheValue * +cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache, + CoglBool create, + PangoFont *font, + PangoGlyph glyph) +{ + CoglPangoGlyphCacheKey lookup_key; + CoglPangoGlyphCacheValue *value; + + lookup_key.font = font; + lookup_key.glyph = glyph; + + value = g_hash_table_lookup (cache->hash_table, &lookup_key); + + if (create && value == NULL) + { + CoglPangoGlyphCacheKey *key; + PangoRectangle ink_rect; + + value = g_slice_new (CoglPangoGlyphCacheValue); + value->texture = NULL; + + pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL); + pango_extents_to_pixels (&ink_rect, NULL); + + value->draw_x = ink_rect.x; + value->draw_y = ink_rect.y; + value->draw_width = ink_rect.width; + value->draw_height = ink_rect.height; + + /* If the glyph is zero-sized then we don't need to reserve any + space for it and we can just avoid painting anything */ + if (ink_rect.width < 1 || ink_rect.height < 1) + value->dirty = FALSE; + else + { + /* Try adding the glyph to the global atlas... */ + if (!cogl_pango_glyph_cache_add_to_global_atlas (cache, + font, + glyph, + value) && + /* If it fails try the local atlas */ + !cogl_pango_glyph_cache_add_to_local_atlas (cache, + font, + glyph, + value)) + { + cogl_pango_glyph_cache_value_free (value); + return NULL; + } + + value->dirty = TRUE; + cache->has_dirty_glyphs = TRUE; + } + + key = g_slice_new (CoglPangoGlyphCacheKey); + key->font = g_object_ref (font); + key->glyph = glyph; + + g_hash_table_insert (cache->hash_table, key, value); + } + + return value; +} + +static void +_cogl_pango_glyph_cache_set_dirty_glyphs_cb (void *key_ptr, + void *value_ptr, + void *user_data) +{ + CoglPangoGlyphCacheKey *key = key_ptr; + CoglPangoGlyphCacheValue *value = value_ptr; + CoglPangoGlyphCacheDirtyFunc func = user_data; + + if (value->dirty) + { + func (key->font, key->glyph, value); + + value->dirty = FALSE; + } +} + +void +_cogl_pango_glyph_cache_set_dirty_glyphs (CoglPangoGlyphCache *cache, + CoglPangoGlyphCacheDirtyFunc func) +{ + /* If we know that there are no dirty glyphs then we can shortcut + out early */ + if (!cache->has_dirty_glyphs) + return; + + g_hash_table_foreach (cache->hash_table, + _cogl_pango_glyph_cache_set_dirty_glyphs_cb, + func); + + cache->has_dirty_glyphs = FALSE; +} + +void +_cogl_pango_glyph_cache_add_reorganize_callback (CoglPangoGlyphCache *cache, + GHookFunc func, + void *user_data) +{ + GHook *hook = g_hook_alloc (&cache->reorganize_callbacks); + hook->func = func; + hook->data = user_data; + g_hook_prepend (&cache->reorganize_callbacks, hook); +} + +void +_cogl_pango_glyph_cache_remove_reorganize_callback (CoglPangoGlyphCache *cache, + GHookFunc func, + void *user_data) +{ + GHook *hook = g_hook_find_func_data (&cache->reorganize_callbacks, + FALSE, + func, + user_data); + + if (hook) + g_hook_destroy_link (&cache->reorganize_callbacks, hook); +} diff --git a/cogl-pango/cogl-pango-glyph-cache.h b/cogl-pango/cogl-pango-glyph-cache.h new file mode 100644 index 0000000..ca33203 --- /dev/null +++ b/cogl-pango/cogl-pango-glyph-cache.h @@ -0,0 +1,100 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_PANGO_GLYPH_CACHE_H__ +#define __COGL_PANGO_GLYPH_CACHE_H__ + +#include +#include + +#include "cogl/cogl-texture.h" + +COGL_BEGIN_DECLS + +typedef struct _CoglPangoGlyphCache CoglPangoGlyphCache; +typedef struct _CoglPangoGlyphCacheValue CoglPangoGlyphCacheValue; + +struct _CoglPangoGlyphCacheValue +{ + CoglTexture *texture; + + float tx1; + float ty1; + float tx2; + float ty2; + + int tx_pixel; + int ty_pixel; + + int draw_x; + int draw_y; + int draw_width; + int draw_height; + + /* This will be set to TRUE when the glyph atlas is reorganized + which means the glyph will need to be redrawn */ + CoglBool dirty; +}; + +typedef void (* CoglPangoGlyphCacheDirtyFunc) (PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value); + +CoglPangoGlyphCache * +cogl_pango_glyph_cache_new (CoglContext *ctx, + CoglBool use_mipmapping); + +void +cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache); + +CoglPangoGlyphCacheValue * +cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache, + CoglBool create, + PangoFont *font, + PangoGlyph glyph); + +void +cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache); + +void +_cogl_pango_glyph_cache_add_reorganize_callback (CoglPangoGlyphCache *cache, + GHookFunc func, + void *user_data); + +void +_cogl_pango_glyph_cache_remove_reorganize_callback (CoglPangoGlyphCache *cache, + GHookFunc func, + void *user_data); + +void +_cogl_pango_glyph_cache_set_dirty_glyphs (CoglPangoGlyphCache *cache, + CoglPangoGlyphCacheDirtyFunc func); + +COGL_END_DECLS + +#endif /* __COGL_PANGO_GLYPH_CACHE_H__ */ diff --git a/cogl-pango/cogl-pango-pipeline-cache.c b/cogl-pango/cogl-pango-pipeline-cache.c new file mode 100644 index 0000000..625a8fa --- /dev/null +++ b/cogl-pango/cogl-pango-pipeline-cache.c @@ -0,0 +1,242 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "cogl-pango-pipeline-cache.h" + +#include "cogl/cogl-context-private.h" +#include "cogl/cogl-texture-private.h" + +typedef struct _CoglPangoPipelineCacheEntry CoglPangoPipelineCacheEntry; + +struct _CoglPangoPipelineCacheEntry +{ + /* This will take a reference or it can be NULL to represent the + pipeline used to render colors */ + CoglTexture *texture; + + /* This will only take a weak reference */ + CoglPipeline *pipeline; +}; + +static void +_cogl_pango_pipeline_cache_key_destroy (void *data) +{ + if (data) + cogl_object_unref (data); +} + +static void +_cogl_pango_pipeline_cache_value_destroy (void *data) +{ + CoglPangoPipelineCacheEntry *cache_entry = data; + + if (cache_entry->texture) + cogl_object_unref (cache_entry->texture); + + /* We don't need to unref the pipeline because it only takes a weak + reference */ + + g_slice_free (CoglPangoPipelineCacheEntry, cache_entry); +} + +CoglPangoPipelineCache * +_cogl_pango_pipeline_cache_new (CoglContext *ctx, + CoglBool use_mipmapping) +{ + CoglPangoPipelineCache *cache = g_new (CoglPangoPipelineCache, 1); + + cache->ctx = cogl_object_ref (ctx); + + /* The key is the pipeline pointer. A reference is taken when the + pipeline is used as a key so we should unref it again in the + destroy function */ + cache->hash_table = + g_hash_table_new_full (g_direct_hash, + g_direct_equal, + _cogl_pango_pipeline_cache_key_destroy, + _cogl_pango_pipeline_cache_value_destroy); + + cache->base_texture_rgba_pipeline = NULL; + cache->base_texture_alpha_pipeline = NULL; + + cache->use_mipmapping = use_mipmapping; + + return cache; +} + +static CoglPipeline * +get_base_texture_rgba_pipeline (CoglPangoPipelineCache *cache) +{ + if (cache->base_texture_rgba_pipeline == NULL) + { + CoglPipeline *pipeline; + + pipeline = cache->base_texture_rgba_pipeline = + cogl_pipeline_new (cache->ctx); + + cogl_pipeline_set_layer_wrap_mode (pipeline, 0, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE); + + if (cache->use_mipmapping) + cogl_pipeline_set_layer_filters + (pipeline, 0, + COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR, + COGL_PIPELINE_FILTER_LINEAR); + } + + return cache->base_texture_rgba_pipeline; +} + +static CoglPipeline * +get_base_texture_alpha_pipeline (CoglPangoPipelineCache *cache) +{ + if (cache->base_texture_alpha_pipeline == NULL) + { + CoglPipeline *pipeline; + + pipeline = cogl_pipeline_copy (get_base_texture_rgba_pipeline (cache)); + cache->base_texture_alpha_pipeline = pipeline; + + /* The default combine mode of materials is to modulate (A x B) + * the texture RGBA channels with the RGBA channels of the + * previous layer (which in our case is just the font color) + * + * Since the RGB for an alpha texture is defined as 0, this gives us: + * + * result.rgb = color.rgb * 0 + * result.a = color.a * texture.a + * + * What we want is premultiplied rgba values: + * + * result.rgba = color.rgb * texture.a + * result.a = color.a * texture.a + */ + cogl_pipeline_set_layer_combine (pipeline, 0, /* layer */ + "RGBA = MODULATE (PREVIOUS, TEXTURE[A])", + NULL); + } + + return cache->base_texture_alpha_pipeline; +} + +typedef struct +{ + CoglPangoPipelineCache *cache; + CoglTexture *texture; +} PipelineDestroyNotifyData; + +static void +pipeline_destroy_notify_cb (void *user_data) +{ + PipelineDestroyNotifyData *data = user_data; + + g_hash_table_remove (data->cache->hash_table, data->texture); + g_slice_free (PipelineDestroyNotifyData, data); +} + +CoglPipeline * +_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache, + CoglTexture *texture) +{ + CoglPangoPipelineCacheEntry *entry; + PipelineDestroyNotifyData *destroy_data; + static CoglUserDataKey pipeline_destroy_notify_key; + + /* Look for an existing entry */ + entry = g_hash_table_lookup (cache->hash_table, texture); + + if (entry) + return cogl_object_ref (entry->pipeline); + + /* No existing pipeline was found so let's create another */ + entry = g_slice_new (CoglPangoPipelineCacheEntry); + + if (texture) + { + CoglPipeline *base; + + entry->texture = cogl_object_ref (texture); + + if (_cogl_texture_get_format (entry->texture) == COGL_PIXEL_FORMAT_A_8) + base = get_base_texture_alpha_pipeline (cache); + else + base = get_base_texture_rgba_pipeline (cache); + + entry->pipeline = cogl_pipeline_copy (base); + + cogl_pipeline_set_layer_texture (entry->pipeline, 0 /* layer */, texture); + } + else + { + entry->texture = NULL; + entry->pipeline = cogl_pipeline_new (cache->ctx); + } + + /* Add a weak reference to the pipeline so we can remove it from the + hash table when it is destroyed */ + destroy_data = g_slice_new (PipelineDestroyNotifyData); + destroy_data->cache = cache; + destroy_data->texture = texture; + cogl_object_set_user_data (COGL_OBJECT (entry->pipeline), + &pipeline_destroy_notify_key, + destroy_data, + pipeline_destroy_notify_cb); + + g_hash_table_insert (cache->hash_table, + texture ? cogl_object_ref (texture) : NULL, + entry); + + /* This doesn't take a reference on the pipeline so that it will use + the newly created reference */ + return entry->pipeline; +} + +void +_cogl_pango_pipeline_cache_free (CoglPangoPipelineCache *cache) +{ + if (cache->base_texture_rgba_pipeline) + cogl_object_unref (cache->base_texture_rgba_pipeline); + if (cache->base_texture_alpha_pipeline) + cogl_object_unref (cache->base_texture_alpha_pipeline); + + g_hash_table_destroy (cache->hash_table); + + cogl_object_unref (cache->ctx); + + g_free (cache); +} diff --git a/cogl-pango/cogl-pango-pipeline-cache.h b/cogl-pango/cogl-pango-pipeline-cache.h new file mode 100644 index 0000000..c8abe2c --- /dev/null +++ b/cogl-pango/cogl-pango-pipeline-cache.h @@ -0,0 +1,72 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PANGO_PIPELINE_CACHE_H__ +#define __COGL_PANGO_PIPELINE_CACHE_H__ + +#include + +#include "cogl/cogl-context-private.h" + +COGL_BEGIN_DECLS + +typedef struct _CoglPangoPipelineCache +{ + CoglContext *ctx; + + GHashTable *hash_table; + + CoglPipeline *base_texture_alpha_pipeline; + CoglPipeline *base_texture_rgba_pipeline; + + CoglBool use_mipmapping; +} CoglPangoPipelineCache; + + +CoglPangoPipelineCache * +_cogl_pango_pipeline_cache_new (CoglContext *ctx, + CoglBool use_mipmapping); + +/* Returns a pipeline that can be used to render glyphs in the given + texture. The pipeline has a new reference so it is up to the caller + to unref it */ +CoglPipeline * +_cogl_pango_pipeline_cache_get (CoglPangoPipelineCache *cache, + CoglTexture *texture); + +void +_cogl_pango_pipeline_cache_free (CoglPangoPipelineCache *cache); + +COGL_END_DECLS + +#endif /* __COGL_PANGO_PIPELINE_CACHE_H__ */ diff --git a/cogl-pango/cogl-pango-private.h b/cogl-pango/cogl-pango-private.h new file mode 100644 index 0000000..e0d1f51 --- /dev/null +++ b/cogl-pango/cogl-pango-private.h @@ -0,0 +1,65 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + * Robert Bragg + * Matthew Allum + */ + +#ifndef __COGL_PANGO_PRIVATE_H__ +#define __COGL_PANGO_PRIVATE_H__ + +#include "cogl-pango.h" + +COGL_BEGIN_DECLS + +PangoRenderer * +_cogl_pango_renderer_new (CoglContext *context); + +void +_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer); + +void +_cogl_pango_renderer_set_use_mipmapping (CoglPangoRenderer *renderer, + CoglBool value); +CoglBool +_cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer); + + + +CoglContext * +_cogl_pango_font_map_get_cogl_context (CoglPangoFontMap *fm); + +PangoRenderer * +_cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm); + +COGL_END_DECLS + +#endif /* __COGL_PANGO_PRIVATE_H__ */ diff --git a/cogl-pango/cogl-pango-render.c b/cogl-pango/cogl-pango-render.c new file mode 100644 index 0000000..a8855ea --- /dev/null +++ b/cogl-pango/cogl-pango-render.c @@ -0,0 +1,929 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + * Robert Bragg + * Matthew Allum + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef PANGO_ENABLE_BACKEND +#define PANGO_ENABLE_BACKEND 1 +#endif + +#include +#include +#include +#include + +#include "cogl/cogl-debug.h" +#include "cogl/cogl-context-private.h" +#include "cogl/cogl-texture-private.h" +#include "cogl-pango-private.h" +#include "cogl-pango-glyph-cache.h" +#include "cogl-pango-display-list.h" + +enum +{ + PROP_0, + + PROP_COGL_CONTEXT, + PROP_LAST +}; + +typedef struct +{ + CoglPangoGlyphCache *glyph_cache; + CoglPangoPipelineCache *pipeline_cache; +} CoglPangoRendererCaches; + +struct _CoglPangoRenderer +{ + PangoRenderer parent_instance; + + CoglContext *ctx; + + /* Two caches of glyphs as textures and their corresponding pipeline + caches, one with mipmapped textures and one without */ + CoglPangoRendererCaches no_mipmap_caches; + CoglPangoRendererCaches mipmap_caches; + + CoglBool use_mipmapping; + + /* The current display list that is being built */ + CoglPangoDisplayList *display_list; +}; + +struct _CoglPangoRendererClass +{ + PangoRendererClass class_instance; +}; + +typedef struct _CoglPangoLayoutQdata CoglPangoLayoutQdata; + +/* An instance of this struct gets attached to each PangoLayout to + cache the VBO and to detect changes to the layout */ +struct _CoglPangoLayoutQdata +{ + CoglPangoRenderer *renderer; + /* The cache of the geometry for the layout */ + CoglPangoDisplayList *display_list; + /* A reference to the first line of the layout. This is just used to + detect changes */ + PangoLayoutLine *first_line; + /* Whether mipmapping was previously used to render this layout. We + need to regenerate the display list if the mipmapping value is + changed because it will be using a different set of textures */ + CoglBool mipmapping_used; +}; + +static void +_cogl_pango_ensure_glyph_cache_for_layout_line (PangoLayoutLine *line); + +typedef struct +{ + CoglPangoDisplayList *display_list; + float x1, y1, x2, y2; +} CoglPangoRendererSliceCbData; + +PangoRenderer * +_cogl_pango_renderer_new (CoglContext *context) +{ + return PANGO_RENDERER (g_object_new (COGL_PANGO_TYPE_RENDERER, + "context", context, NULL)); +} + +static void +cogl_pango_renderer_slice_cb (CoglTexture *texture, + const float *slice_coords, + const float *virtual_coords, + void *user_data) +{ + CoglPangoRendererSliceCbData *data = user_data; + + /* Note: this assumes that there is only one slice containing the + whole texture and it doesn't attempt to split up the vertex + coordinates based on the virtual_coords */ + + _cogl_pango_display_list_add_texture (data->display_list, + texture, + data->x1, + data->y1, + data->x2, + data->y2, + slice_coords[0], + slice_coords[1], + slice_coords[2], + slice_coords[3]); +} + +static void +cogl_pango_renderer_draw_glyph (CoglPangoRenderer *priv, + CoglPangoGlyphCacheValue *cache_value, + float x1, + float y1) +{ + CoglPangoRendererSliceCbData data; + + _COGL_RETURN_IF_FAIL (priv->display_list != NULL); + + data.display_list = priv->display_list; + data.x1 = x1; + data.y1 = y1; + data.x2 = x1 + (float) cache_value->draw_width; + data.y2 = y1 + (float) cache_value->draw_height; + + /* We iterate the internal sub textures of the texture so that we + can get a pointer to the base texture even if the texture is in + the global atlas. That way the display list can recognise that + the neighbouring glyphs are coming from the same atlas and bundle + them together into a single VBO */ + + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (cache_value->texture), + cache_value->tx1, + cache_value->ty1, + cache_value->tx2, + cache_value->ty2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + cogl_pango_renderer_slice_cb, + &data); +} + +static void cogl_pango_renderer_dispose (GObject *object); +static void cogl_pango_renderer_finalize (GObject *object); +static void cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer, + PangoFont *font, + PangoGlyphString *glyphs, + int x, + int y); +static void cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer, + PangoRenderPart part, + int x, + int y, + int width, + int height); +static void cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer, + PangoRenderPart part, + double y1, + double x11, + double x21, + double y2, + double x12, + double x22); + +G_DEFINE_TYPE (CoglPangoRenderer, cogl_pango_renderer, PANGO_TYPE_RENDERER); + +static void +cogl_pango_renderer_init (CoglPangoRenderer *priv) +{ +} + +static void +_cogl_pango_renderer_constructed (GObject *gobject) +{ + CoglPangoRenderer *renderer = COGL_PANGO_RENDERER (gobject); + CoglContext *ctx = renderer->ctx; + + renderer->no_mipmap_caches.pipeline_cache = + _cogl_pango_pipeline_cache_new (ctx, FALSE); + renderer->mipmap_caches.pipeline_cache = + _cogl_pango_pipeline_cache_new (ctx, TRUE); + + renderer->no_mipmap_caches.glyph_cache = + cogl_pango_glyph_cache_new (ctx, FALSE); + renderer->mipmap_caches.glyph_cache = + cogl_pango_glyph_cache_new (ctx, TRUE); + + _cogl_pango_renderer_set_use_mipmapping (renderer, FALSE); + + if (G_OBJECT_CLASS (cogl_pango_renderer_parent_class)->constructed) + G_OBJECT_CLASS (cogl_pango_renderer_parent_class)->constructed (gobject); +} + +static void +cogl_pango_renderer_set_property (GObject *object, + unsigned int prop_id, + const GValue *value, + GParamSpec *pspec) +{ + CoglPangoRenderer *renderer = COGL_PANGO_RENDERER (object); + + switch (prop_id) + { + case PROP_COGL_CONTEXT: + renderer->ctx = g_value_get_pointer (value); + cogl_object_ref (renderer->ctx); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +cogl_pango_renderer_class_init (CoglPangoRendererClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass); + GParamSpec *pspec; + + object_class->set_property = cogl_pango_renderer_set_property; + object_class->constructed = _cogl_pango_renderer_constructed; + object_class->dispose = cogl_pango_renderer_dispose; + object_class->finalize = cogl_pango_renderer_finalize; + + pspec = g_param_spec_pointer ("context", + "Context", + "The Cogl Context", + G_PARAM_WRITABLE | + G_PARAM_STATIC_STRINGS | + G_PARAM_CONSTRUCT_ONLY); + + g_object_class_install_property (object_class, PROP_COGL_CONTEXT, pspec); + + renderer_class->draw_glyphs = cogl_pango_renderer_draw_glyphs; + renderer_class->draw_rectangle = cogl_pango_renderer_draw_rectangle; + renderer_class->draw_trapezoid = cogl_pango_renderer_draw_trapezoid; +} + +static void +cogl_pango_renderer_dispose (GObject *object) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (object); + + if (priv->ctx) + { + cogl_object_unref (priv->ctx); + priv->ctx = NULL; + } +} + +static void +cogl_pango_renderer_finalize (GObject *object) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (object); + + cogl_pango_glyph_cache_free (priv->no_mipmap_caches.glyph_cache); + cogl_pango_glyph_cache_free (priv->mipmap_caches.glyph_cache); + + _cogl_pango_pipeline_cache_free (priv->no_mipmap_caches.pipeline_cache); + _cogl_pango_pipeline_cache_free (priv->mipmap_caches.pipeline_cache); + + G_OBJECT_CLASS (cogl_pango_renderer_parent_class)->finalize (object); +} + +static CoglPangoRenderer * +cogl_pango_get_renderer_from_context (PangoContext *context) +{ + PangoFontMap *font_map; + CoglPangoFontMap *cogl_font_map; + PangoRenderer *renderer; + + font_map = pango_context_get_font_map (context); + g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (font_map), NULL); + + cogl_font_map = COGL_PANGO_FONT_MAP (font_map); + + renderer = _cogl_pango_font_map_get_renderer (cogl_font_map); + + g_return_val_if_fail (COGL_PANGO_IS_RENDERER (renderer), NULL); + + return COGL_PANGO_RENDERER (renderer); +} + +static GQuark +cogl_pango_layout_get_qdata_key (void) +{ + static GQuark key = 0; + + if (G_UNLIKELY (key == 0)) + key = g_quark_from_static_string ("CoglPangoDisplayList"); + + return key; +} + +static void +cogl_pango_layout_qdata_forget_display_list (CoglPangoLayoutQdata *qdata) +{ + if (qdata->display_list) + { + CoglPangoRendererCaches *caches = qdata->mipmapping_used ? + &qdata->renderer->mipmap_caches : + &qdata->renderer->no_mipmap_caches; + + _cogl_pango_glyph_cache_remove_reorganize_callback + (caches->glyph_cache, + (GHookFunc) cogl_pango_layout_qdata_forget_display_list, + qdata); + + _cogl_pango_display_list_free (qdata->display_list); + + qdata->display_list = NULL; + } +} + +static void +cogl_pango_render_qdata_destroy (CoglPangoLayoutQdata *qdata) +{ + cogl_pango_layout_qdata_forget_display_list (qdata); + if (qdata->first_line) + pango_layout_line_unref (qdata->first_line); + g_slice_free (CoglPangoLayoutQdata, qdata); +} + +void +cogl_pango_show_layout (CoglFramebuffer *fb, + PangoLayout *layout, + float x, + float y, + const CoglColor *color) +{ + PangoContext *context; + CoglPangoRenderer *priv; + CoglPangoLayoutQdata *qdata; + + context = pango_layout_get_context (layout); + priv = cogl_pango_get_renderer_from_context (context); + if (G_UNLIKELY (!priv)) + return; + + qdata = g_object_get_qdata (G_OBJECT (layout), + cogl_pango_layout_get_qdata_key ()); + + if (qdata == NULL) + { + qdata = g_slice_new0 (CoglPangoLayoutQdata); + qdata->renderer = priv; + g_object_set_qdata_full (G_OBJECT (layout), + cogl_pango_layout_get_qdata_key (), + qdata, + (GDestroyNotify) + cogl_pango_render_qdata_destroy); + } + + /* Check if the layout has changed since the last build of the + display list. This trick was suggested by Behdad Esfahbod here: + http://mail.gnome.org/archives/gtk-i18n-list/2009-May/msg00019.html */ + if (qdata->display_list && + ((qdata->first_line && + qdata->first_line->layout != layout) || + qdata->mipmapping_used != priv->use_mipmapping)) + cogl_pango_layout_qdata_forget_display_list (qdata); + + if (qdata->display_list == NULL) + { + CoglPangoRendererCaches *caches = priv->use_mipmapping ? + &priv->mipmap_caches : + &priv->no_mipmap_caches; + + cogl_pango_ensure_glyph_cache_for_layout (layout); + + qdata->display_list = + _cogl_pango_display_list_new (caches->pipeline_cache); + + /* Register for notification of when the glyph cache changes so + we can rebuild the display list */ + _cogl_pango_glyph_cache_add_reorganize_callback + (caches->glyph_cache, + (GHookFunc) cogl_pango_layout_qdata_forget_display_list, + qdata); + + priv->display_list = qdata->display_list; + pango_renderer_draw_layout (PANGO_RENDERER (priv), layout, 0, 0); + priv->display_list = NULL; + + qdata->mipmapping_used = priv->use_mipmapping; + } + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, x, y, 0); + + _cogl_pango_display_list_render (fb, + qdata->display_list, + color); + + cogl_framebuffer_pop_matrix (fb); + + /* Keep a reference to the first line of the layout so we can detect + changes */ + if (qdata->first_line) + { + pango_layout_line_unref (qdata->first_line); + qdata->first_line = NULL; + } + if (pango_layout_get_line_count (layout) > 0) + { + qdata->first_line = pango_layout_get_line (layout, 0); + pango_layout_line_ref (qdata->first_line); + } +} + +void +cogl_pango_render_layout_subpixel (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags) +{ + cogl_pango_show_layout (cogl_get_draw_framebuffer (), + layout, + x / (float) PANGO_SCALE, + y / (float) PANGO_SCALE, + color); +} + +void +cogl_pango_render_layout (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags) +{ + cogl_pango_render_layout_subpixel (layout, + x * PANGO_SCALE, + y * PANGO_SCALE, + color, + flags); +} + +void +cogl_pango_show_layout_line (CoglFramebuffer *fb, + PangoLayoutLine *line, + float x, + float y, + const CoglColor *color) +{ + PangoContext *context; + CoglPangoRenderer *priv; + CoglPangoRendererCaches *caches; + int pango_x = x * PANGO_SCALE; + int pango_y = y * PANGO_SCALE; + + context = pango_layout_get_context (line->layout); + priv = cogl_pango_get_renderer_from_context (context); + if (G_UNLIKELY (!priv)) + return; + + caches = (priv->use_mipmapping ? + &priv->mipmap_caches : + &priv->no_mipmap_caches); + + priv->display_list = _cogl_pango_display_list_new (caches->pipeline_cache); + + _cogl_pango_ensure_glyph_cache_for_layout_line (line); + + pango_renderer_draw_layout_line (PANGO_RENDERER (priv), line, + pango_x, pango_y); + + _cogl_pango_display_list_render (fb, + priv->display_list, + color); + + _cogl_pango_display_list_free (priv->display_list); + priv->display_list = NULL; +} + +void +cogl_pango_render_layout_line (PangoLayoutLine *line, + int x, + int y, + const CoglColor *color) +{ + cogl_pango_show_layout_line (cogl_get_draw_framebuffer (), + line, + x / (float) PANGO_SCALE, + y / (float) PANGO_SCALE, + color); +} + +void +_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer) +{ + cogl_pango_glyph_cache_clear (renderer->mipmap_caches.glyph_cache); + cogl_pango_glyph_cache_clear (renderer->no_mipmap_caches.glyph_cache); +} + +void +_cogl_pango_renderer_set_use_mipmapping (CoglPangoRenderer *renderer, + CoglBool value) +{ + renderer->use_mipmapping = value; +} + +CoglBool +_cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer) +{ + return renderer->use_mipmapping; +} + +static CoglPangoGlyphCacheValue * +cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer, + CoglBool create, + PangoFont *font, + PangoGlyph glyph) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); + CoglPangoRendererCaches *caches = (priv->use_mipmapping ? + &priv->mipmap_caches : + &priv->no_mipmap_caches); + + return cogl_pango_glyph_cache_lookup (caches->glyph_cache, + create, font, glyph); +} + +static void +cogl_pango_renderer_set_dirty_glyph (PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value) +{ + cairo_surface_t *surface; + cairo_t *cr; + cairo_scaled_font_t *scaled_font; + cairo_glyph_t cairo_glyph; + cairo_format_t format_cairo; + CoglPixelFormat format_cogl; + + COGL_NOTE (PANGO, "redrawing glyph %i", glyph); + + /* Glyphs that don't take up any space will end up without a + texture. These should never become dirty so they shouldn't end up + here */ + _COGL_RETURN_IF_FAIL (value->texture != NULL); + + if (_cogl_texture_get_format (value->texture) == COGL_PIXEL_FORMAT_A_8) + { + format_cairo = CAIRO_FORMAT_A8; + format_cogl = COGL_PIXEL_FORMAT_A_8; + } + else + { + format_cairo = CAIRO_FORMAT_ARGB32; + + /* Cairo stores the data in native byte order as ARGB but Cogl's + pixel formats specify the actual byte order. Therefore we + need to use a different format depending on the + architecture */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + format_cogl = COGL_PIXEL_FORMAT_BGRA_8888_PRE; +#else + format_cogl = COGL_PIXEL_FORMAT_ARGB_8888_PRE; +#endif + } + + surface = cairo_image_surface_create (format_cairo, + value->draw_width, + value->draw_height); + cr = cairo_create (surface); + + scaled_font = pango_cairo_font_get_scaled_font (PANGO_CAIRO_FONT (font)); + cairo_set_scaled_font (cr, scaled_font); + + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); + + cairo_glyph.x = -value->draw_x; + cairo_glyph.y = -value->draw_y; + /* The PangoCairo glyph numbers directly map to Cairo glyph + numbers */ + cairo_glyph.index = glyph; + cairo_show_glyphs (cr, &cairo_glyph, 1); + + cairo_destroy (cr); + cairo_surface_flush (surface); + + /* Copy the glyph to the texture */ + cogl_texture_set_region (value->texture, + 0, /* src_x */ + 0, /* src_y */ + value->tx_pixel, /* dst_x */ + value->ty_pixel, /* dst_y */ + value->draw_width, /* dst_width */ + value->draw_height, /* dst_height */ + value->draw_width, /* width */ + value->draw_height, /* height */ + format_cogl, + cairo_image_surface_get_stride (surface), + cairo_image_surface_get_data (surface)); + + cairo_surface_destroy (surface); +} + +static void +_cogl_pango_ensure_glyph_cache_for_layout_line_internal (PangoLayoutLine *line) +{ + PangoContext *context; + PangoRenderer *renderer; + GSList *l; + + context = pango_layout_get_context (line->layout); + renderer = + PANGO_RENDERER (cogl_pango_get_renderer_from_context (context)); + + for (l = line->runs; l; l = l->next) + { + PangoLayoutRun *run = l->data; + PangoGlyphString *glyphs = run->glyphs; + int i; + + for (i = 0; i < glyphs->num_glyphs; i++) + { + PangoGlyphInfo *gi = &glyphs->glyphs[i]; + + /* If the glyph isn't cached then this will reserve + space for it now. We won't actually draw the glyph + yet because reserving space could cause all of the + other glyphs to be moved so we might as well redraw + them all later once we know that the position is + settled */ + cogl_pango_renderer_get_cached_glyph (renderer, TRUE, + run->item->analysis.font, + gi->glyph); + } + } +} + +static void +_cogl_pango_set_dirty_glyphs (CoglPangoRenderer *priv) +{ + _cogl_pango_glyph_cache_set_dirty_glyphs + (priv->mipmap_caches.glyph_cache, cogl_pango_renderer_set_dirty_glyph); + _cogl_pango_glyph_cache_set_dirty_glyphs + (priv->no_mipmap_caches.glyph_cache, cogl_pango_renderer_set_dirty_glyph); +} + +static void +_cogl_pango_ensure_glyph_cache_for_layout_line (PangoLayoutLine *line) +{ + PangoContext *context; + CoglPangoRenderer *priv; + + context = pango_layout_get_context (line->layout); + priv = cogl_pango_get_renderer_from_context (context); + + _cogl_pango_ensure_glyph_cache_for_layout_line_internal (line); + + /* Now that we know all of the positions are settled we'll fill in + any dirty glyphs */ + _cogl_pango_set_dirty_glyphs (priv); +} + +void +cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout) +{ + PangoContext *context; + CoglPangoRenderer *priv; + PangoLayoutIter *iter; + + context = pango_layout_get_context (layout); + priv = cogl_pango_get_renderer_from_context (context); + + _COGL_RETURN_IF_FAIL (PANGO_IS_LAYOUT (layout)); + + if ((iter = pango_layout_get_iter (layout)) == NULL) + return; + + do + { + PangoLayoutLine *line; + + line = pango_layout_iter_get_line_readonly (iter); + + _cogl_pango_ensure_glyph_cache_for_layout_line_internal (line); + } + while (pango_layout_iter_next_line (iter)); + + pango_layout_iter_free (iter); + + /* Now that we know all of the positions are settled we'll fill in + any dirty glyphs */ + _cogl_pango_set_dirty_glyphs (priv); +} + +static void +cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer, + PangoRenderPart part) +{ + PangoColor *pango_color = pango_renderer_get_color (renderer, part); + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); + + if (pango_color) + { + CoglColor color; + + cogl_color_init_from_4ub (&color, + pango_color->red >> 8, + pango_color->green >> 8, + pango_color->blue >> 8, + 0xff); + + _cogl_pango_display_list_set_color_override (priv->display_list, &color); + } + else + _cogl_pango_display_list_remove_color_override (priv->display_list); +} + +static void +cogl_pango_renderer_draw_box (PangoRenderer *renderer, + int x, + int y, + int width, + int height) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); + + _COGL_RETURN_IF_FAIL (priv->display_list != NULL); + + _cogl_pango_display_list_add_rectangle (priv->display_list, + x, + y - height, + x + width, + y); +} + +static void +cogl_pango_renderer_get_device_units (PangoRenderer *renderer, + int xin, + int yin, + float *xout, + float *yout) +{ + const PangoMatrix *matrix; + + if ((matrix = pango_renderer_get_matrix (renderer))) + { + /* Convert user-space coords to device coords */ + *xout = ((xin * matrix->xx + yin * matrix->xy) + / PANGO_SCALE + matrix->x0); + *yout = ((yin * matrix->yy + xin * matrix->yx) + / PANGO_SCALE + matrix->y0); + } + else + { + *xout = PANGO_PIXELS (xin); + *yout = PANGO_PIXELS (yin); + } +} + +static void +cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer, + PangoRenderPart part, + int x, + int y, + int width, + int height) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); + float x1, x2, y1, y2; + + _COGL_RETURN_IF_FAIL (priv->display_list != NULL); + + cogl_pango_renderer_set_color_for_part (renderer, part); + + cogl_pango_renderer_get_device_units (renderer, + x, y, + &x1, &y1); + cogl_pango_renderer_get_device_units (renderer, + x + width, y + height, + &x2, &y2); + + _cogl_pango_display_list_add_rectangle (priv->display_list, + x1, y1, x2, y2); +} + +static void +cogl_pango_renderer_draw_trapezoid (PangoRenderer *renderer, + PangoRenderPart part, + double y1, + double x11, + double x21, + double y2, + double x12, + double x22) +{ + CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer); + + _COGL_RETURN_IF_FAIL (priv->display_list != NULL); + + cogl_pango_renderer_set_color_for_part (renderer, part); + + _cogl_pango_display_list_add_trapezoid (priv->display_list, + y1, + x11, + x21, + y2, + x12, + x22); +} + +static void +cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer, + PangoFont *font, + PangoGlyphString *glyphs, + int xi, + int yi) +{ + CoglPangoRenderer *priv = (CoglPangoRenderer *) renderer; + CoglPangoGlyphCacheValue *cache_value; + int i; + + cogl_pango_renderer_set_color_for_part (renderer, + PANGO_RENDER_PART_FOREGROUND); + + for (i = 0; i < glyphs->num_glyphs; i++) + { + PangoGlyphInfo *gi = glyphs->glyphs + i; + float x, y; + + cogl_pango_renderer_get_device_units (renderer, + xi + gi->geometry.x_offset, + yi + gi->geometry.y_offset, + &x, &y); + + if ((gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)) + { + if (font == NULL) + { + cogl_pango_renderer_draw_box (renderer, + x, + y, + PANGO_UNKNOWN_GLYPH_WIDTH, + PANGO_UNKNOWN_GLYPH_HEIGHT); + } + else + { + PangoRectangle ink_rect; + + pango_font_get_glyph_extents (font, gi->glyph, &ink_rect, NULL); + pango_extents_to_pixels (&ink_rect, NULL); + + cogl_pango_renderer_draw_box (renderer, + x + ink_rect.x, + y + ink_rect.y + ink_rect.height, + ink_rect.width, + ink_rect.height); + } + } + else + { + /* Get the texture containing the glyph */ + cache_value = + cogl_pango_renderer_get_cached_glyph (renderer, + FALSE, + font, + gi->glyph); + + /* cogl_pango_ensure_glyph_cache_for_layout should always be + called before rendering a layout so we should never have + a dirty glyph here */ + g_assert (cache_value == NULL || !cache_value->dirty); + + if (cache_value == NULL) + { + cogl_pango_renderer_draw_box (renderer, + x, + y, + PANGO_UNKNOWN_GLYPH_WIDTH, + PANGO_UNKNOWN_GLYPH_HEIGHT); + } + else if (cache_value->texture) + { + x += (float)(cache_value->draw_x); + y += (float)(cache_value->draw_y); + + cogl_pango_renderer_draw_glyph (priv, cache_value, x, y); + } + } + + xi += gi->geometry.width; + } +} diff --git a/cogl-pango/cogl-pango.h b/cogl-pango/cogl-pango.h new file mode 100644 index 0000000..8712849 --- /dev/null +++ b/cogl-pango/cogl-pango.h @@ -0,0 +1,298 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008 OpenedHand + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + * Robert Bragg + * Matthew Allum + */ + +#ifndef __COGL_PANGO_H__ +#define __COGL_PANGO_H__ + +#include +#include +#include + +/* XXX: Currently this header may be included both as an internal + * header (within the cogl-pango implementation) and as a public + * header. + * + * Since should not be included for internal use we + * determine the current context and switch between including cogl.h + * or specific internal cogl headers here... + */ +#ifndef COGL_COMPILATION +#include +#else +#include "cogl/cogl-context.h" +#endif + +COGL_BEGIN_DECLS + +/* It's too difficult to actually subclass the pango cairo font + * map. Instead we just make a fake set of macros that actually just + * directly use the original type + */ +#define COGL_PANGO_TYPE_FONT_MAP PANGO_TYPE_CAIRO_FONT_MAP +#define COGL_PANGO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_FONT_MAP, CoglPangoFontMap)) +#define COGL_PANGO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_FONT_MAP)) + +typedef PangoCairoFontMap CoglPangoFontMap; + +/** + * cogl_pango_font_map_new: + * + * Creates a new font map. + * + * Return value: (transfer full): the newly created #PangoFontMap + * + * Since: 1.14 + */ +PangoFontMap * +cogl_pango_font_map_new (void); + +/** + * cogl_pango_font_map_create_context: + * @font_map: a #CoglPangoFontMap + * + * Create a #PangoContext for the given @font_map. + * + * Returns: (transfer full): the newly created context: free with g_object_unref(). + */ +PangoContext * +cogl_pango_font_map_create_context (CoglPangoFontMap *font_map); + +/** + * cogl_pango_font_map_set_resolution: + * @font_map: a #CoglPangoFontMap + * @dpi: The resolution in "dots per inch". (Physical inches aren't + * actually involved; the terminology is conventional.) + * + * Sets the resolution for the @font_map. This is a scale factor + * between points specified in a #PangoFontDescription and Cogl units. + * The default value is %96, meaning that a 10 point font will be 13 + * units high. (10 * 96. / 72. = 13.3). + * + * Since: 1.14 + */ +void +cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map, + double dpi); + +/** + * cogl_pango_font_map_clear_glyph_cache: + * @font_map: a #CoglPangoFontMap + * + * Clears the glyph cache for @font_map. + * + * Since: 1.0 + */ +void +cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map); + +/** + * cogl_pango_ensure_glyph_cache_for_layout: + * @layout: A #PangoLayout + * + * This updates any internal glyph cache textures as necessary to be + * able to render the given @layout. + * + * This api should be used to avoid mid-scene modifications of + * glyph-cache textures which can lead to undefined rendering results. + * + * Since: 1.0 + */ +void +cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout); + +/** + * cogl_pango_font_map_set_use_mipmapping: + * @font_map: a #CoglPangoFontMap + * @value: %TRUE to enable the use of mipmapping + * + * Sets whether the renderer for the passed font map should use + * mipmapping when rendering a #PangoLayout. + * + * Since: 1.0 + */ +void +cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map, + CoglBool value); + +/** + * cogl_pango_font_map_get_use_mipmapping: + * @font_map: a #CoglPangoFontMap + * + * Retrieves whether the #CoglPangoRenderer used by @font_map will use + * mipmapping when rendering the glyphs. + * + * Return value: %TRUE if mipmapping is used, %FALSE otherwise. + * + * Since: 1.0 + */ +CoglBool +cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map); + +/** + * cogl_pango_font_map_get_renderer: + * @font_map: a #CoglPangoFontMap + * + * Retrieves the #CoglPangoRenderer for the passed @font_map. + * + * Return value: (transfer none): a #PangoRenderer + * + * Since: 1.0 + */ +PangoRenderer * +cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map); + +/** + * cogl_pango_show_layout: + * @framebuffer: A #CoglFramebuffer to draw too. + * @layout: a #PangoLayout + * @x: X coordinate to render the layout at + * @y: Y coordinate to render the layout at + * @color: color to use when rendering the layout + * + * Draws a solidly coloured @layout on the given @framebuffer at (@x, + * @y) within the @framebuffer's current model-view coordinate + * space. + * + * Since: 1.14 + */ +void +cogl_pango_show_layout (CoglFramebuffer *framebuffer, + PangoLayout *layout, + float x, + float y, + const CoglColor *color); + +/** + * cogl_pango_show_layout_line: + * @framebuffer: A #CoglFramebuffer to draw too. + * @line: a #PangoLayoutLine + * @x: X coordinate to render the line at + * @y: Y coordinate to render the line at + * @color: color to use when rendering the line + * + * Draws a solidly coloured @line on the given @framebuffer at (@x, + * @y) within the @framebuffer's current model-view coordinate + * space. + * + * Since: 1.14 + */ +void +cogl_pango_show_layout_line (CoglFramebuffer *framebuffer, + PangoLayoutLine *line, + float x, + float y, + const CoglColor *color); + + +#define COGL_PANGO_TYPE_RENDERER (cogl_pango_renderer_get_type ()) +#define COGL_PANGO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRenderer)) +#define COGL_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass)) +#define COGL_PANGO_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_RENDERER)) +#define COGL_PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COGL_PANGO_TYPE_RENDERER)) +#define COGL_PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass)) + +/* opaque types */ +typedef struct _CoglPangoRenderer CoglPangoRenderer; +typedef struct _CoglPangoRendererClass CoglPangoRendererClass; + +GType cogl_pango_renderer_get_type (void) G_GNUC_CONST; + +/** + * cogl_pango_render_layout_subpixel: + * @layout: a #PangoLayout + * @x: X coordinate (in Pango units) to render the layout at + * @y: Y coordinate (in Pango units) to render the layout at + * @color: color to use when rendering the layout + * @flags: + * + * Draws a solidly coloured @layout on the given @framebuffer at (@x, + * @y) within the @framebuffer's current model-view coordinate + * space. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pango_show_layout() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pango_show_layout) +void +cogl_pango_render_layout_subpixel (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags); + +/** + * cogl_pango_render_layout: + * @layout: a #PangoLayout + * @x: X coordinate to render the layout at + * @y: Y coordinate to render the layout at + * @color: color to use when rendering the layout + * @flags: + * + * Draws a solidly coloured @layout on the given @framebuffer at (@x, + * @y) within the @framebuffer's current model-view coordinate + * space. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pango_show_layout() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pango_show_layout) +void +cogl_pango_render_layout (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags); + +/** + * cogl_pango_render_layout_line: + * @line: a #PangoLayoutLine + * @x: X coordinate to render the line at + * @y: Y coordinate to render the line at + * @color: color to use when rendering the line + * + * Renders @line at the given coordinates using the given color. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pango_show_layout() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pango_show_layout_line) +void +cogl_pango_render_layout_line (PangoLayoutLine *line, + int x, + int y, + const CoglColor *color); + +COGL_END_DECLS + +#endif /* __COGL_PANGO_H__ */ diff --git a/cogl-pango/cogl-pango.pc.in b/cogl-pango/cogl-pango.pc.in new file mode 100644 index 0000000..4db8f34 --- /dev/null +++ b/cogl-pango/cogl-pango.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ @COGL_PANGO_PKG_REQUIRES@ + +Name: Cogl +Description: An pango integration library for Cogl +Version: @COGL_VERSION@ +Libs: -L${libdir} -lcogl-pango +Cflags: -I${includedir}/cogl -DCOGL_ENABLE_EXPERIMENTAL_2_0_API +Requires: ${requires} diff --git a/cogl-pango/cogl-pango.rc b/cogl-pango/cogl-pango.rc new file mode 100644 index 0000000..3af6a3d --- /dev/null +++ b/cogl-pango/cogl-pango.rc @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,18,2,0 + PRODUCTVERSION 1,18,2,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Intel Corporation" + VALUE "FileDescription", "cogl-pango" + VALUE "FileVersion", "1.18.2.0" + VALUE "InternalName", "libcogl-pango-1.0-2" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-pango-1.0-2.dll" + VALUE "ProductName", "cogl-pango" + VALUE "ProductVersion", "1.18.2" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/cogl-pango/cogl-pango.rc.in b/cogl-pango/cogl-pango.rc.in new file mode 100644 index 0000000..ab8ff2d --- /dev/null +++ b/cogl-pango/cogl-pango.rc.in @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,@COGL_1_MINOR_VERSION@,@COGL_1_MICRO_VERSION@,0 + PRODUCTVERSION 1,@COGL_1_MINOR_VERSION@,@COGL_1_MICRO_VERSION@,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Intel Corporation" + VALUE "FileDescription", "cogl-pango" + VALUE "FileVersion", "@COGL_1_VERSION@.0" + VALUE "InternalName", "libcogl-pango-1.0-@COGL_LT_AGE@" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-pango-1.0-@COGL_LT_AGE@.dll" + VALUE "ProductName", "cogl-pango" + VALUE "ProductVersion", "@COGL_1_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/cogl-pango/cogl-pango.symbols b/cogl-pango/cogl-pango.symbols new file mode 100644 index 0000000..b86c956 --- /dev/null +++ b/cogl-pango/cogl-pango.symbols @@ -0,0 +1,12 @@ +cogl_pango_ensure_glyph_cache_for_layout +cogl_pango_font_map_clear_glyph_cache +cogl_pango_font_map_create_context +cogl_pango_font_map_get_renderer +cogl_pango_font_map_get_use_mipmapping +cogl_pango_font_map_new +cogl_pango_font_map_set_resolution +cogl_pango_font_map_set_use_mipmapping +cogl_pango_renderer_get_type +cogl_pango_render_layout +cogl_pango_render_layout_line +cogl_pango_render_layout_subpixel diff --git a/cogl-path/Makefile.am b/cogl-path/Makefile.am new file mode 100644 index 0000000..b6b7d39 --- /dev/null +++ b/cogl-path/Makefile.am @@ -0,0 +1,122 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +BUILT_SOURCES = + +CLEANFILES = +DISTCLEANFILES = + +EXTRA_DIST = + +# tesselator sources +cogl_tesselator_sources = \ + $(srcdir)/tesselator/dict-list.h \ + $(srcdir)/tesselator/dict.c \ + $(srcdir)/tesselator/dict.h \ + $(srcdir)/tesselator/geom.c \ + $(srcdir)/tesselator/geom.h \ + $(srcdir)/tesselator/gluos.h \ + $(srcdir)/tesselator/memalloc.h \ + $(srcdir)/tesselator/mesh.c \ + $(srcdir)/tesselator/mesh.h \ + $(srcdir)/tesselator/normal.c \ + $(srcdir)/tesselator/normal.h \ + $(srcdir)/tesselator/priorityq-heap.h \ + $(srcdir)/tesselator/priorityq-sort.h \ + $(srcdir)/tesselator/priorityq.c \ + $(srcdir)/tesselator/priorityq.h \ + $(srcdir)/tesselator/render.c \ + $(srcdir)/tesselator/render.h \ + $(srcdir)/tesselator/sweep.c \ + $(srcdir)/tesselator/sweep.h \ + $(srcdir)/tesselator/tess.c \ + $(srcdir)/tesselator/tess.h \ + $(srcdir)/tesselator/tesselator.h \ + $(srcdir)/tesselator/tessmono.c \ + $(srcdir)/tesselator/tessmono.h \ + $(srcdir)/tesselator/GL/glu.h \ + $(NULL) + +source_c = \ + $(cogl_tesselator_sources) \ + cogl-path-private.h \ + cogl1-path.c \ + cogl-path.c \ + $(NULL) + +EXTRA_DIST += \ + $(srcdir)/tesselator/README \ + $(srcdir)/tesselator/priorityq-heap.c \ + $(srcdir)/cogl-path.symbols \ + $(NULL) + +source_1_x_h = \ + $(srcdir)/cogl-path-types.h \ + $(srcdir)/cogl1-path-functions.h \ + $(NULL) + +source_h = \ + cogl-path.h \ + $(source_1_x_h) \ + cogl2-path-functions.h \ + $(NULL) + +if USE_GLIB +# glib-mkenums rules +glib_enum_h = cogl-path-enum-types.h +glib_enum_c = cogl-path-enum-types.c +glib_enum_headers = $(source_1_x_h) +include $(top_srcdir)/build/autotools/Makefile.am.enums +endif + +lib_LTLIBRARIES = libcogl-path.la + +libcogl_path_la_SOURCES = $(source_c) $(source_h) +nodist_libcogl_path_la_SOURCES = $(BUILT_SOURCES) +libcogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_path_la_LIBADD = $(top_builddir)/cogl/libcogl.la +libcogl_path_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_path_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^(cogl|cogl2)_(framebuffer|path|is|clip|[sg]et)_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -rpath $(libdir) + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglPath\" \ + -I$(srcdir)/tesselator \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_pathheadersdir = $(includedir)/cogl/cogl-path +cogl_pathheaders_HEADERS = $(source_h) +if USE_GLIB +nodist_cogl_pathheaders_HEADERS = cogl-path-enum-types.h +endif + +pc_files = cogl-path-1.0.pc \ + cogl-path-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) + +EXTRA_DIST += cogl-path.pc.in +DISTCLEANFILES += $(pc_files) + +dist-hook: \ + $(top_builddir)/build/win32/vs9/cogl-path.vcproj \ + $(top_builddir)/build/win32/vs10/cogl-path.vcxproj \ + $(top_builddir)/build/win32/vs10/cogl-path.vcxproj.filters + +MSVC_PROJECT = cogl-path +MSVC_PROJECT_SRCDIR = cogl-path +MSVC_PROJECT_SRCS = $(source_c) +MSVC_PROJECT_EXCLUDES = dummy + +include $(top_srcdir)/build/Makefile-msvcproj.mak diff --git a/cogl-path/Makefile.in b/cogl-path/Makefile.in new file mode 100644 index 0000000..2ce1645 --- /dev/null +++ b/cogl-path/Makefile.in @@ -0,0 +1,1208 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + +# Rules for generating enumeration types using glib-mkenums +# +# Define: +# glib_enum_h = header template file +# glib_enum_c = source template file +# glib_enum_headers = list of headers to parse +# +# before including Makefile.am.enums. You will also need to have +# the following targets already defined: +# +# CLEANFILES +# DISTCLEANFILES +# BUILT_SOURCES +# EXTRA_DIST +# +# Author: Emmanuele Bassi + +# Centralized autotools file +# To create the Visual C++ projects +# from the templates +# Author: Fan, Chun-wei +# August 30, 2012 + +# Required Items to call this: +# MSVC_PROJECT: name of project +# MSVC_PROJECT_SRCDIR: subdir of source tree where sources for this project is found +# MSVC_PROJECT_SRCS: source files to build +# MSVC_PROJECT_EXCLUDES: source files to exclude from MSVC_PROJECT_SRCS, use dummy if none, +# wildcards (*) are allowed, seperated by | +# DISTCLEANFILES: Define an empty one if not previously defined + +# Create the complete Visual C++ 2008/2010 project files + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(top_srcdir)/build/autotools/Makefile.am.enums \ + $(top_srcdir)/build/Makefile-msvcproj.mak \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/cogl-path-1.0.pc.in \ + $(srcdir)/cogl-path-2.0-experimental.pc.in \ + $(top_srcdir)/build/depcomp $(cogl_pathheaders_HEADERS) +@USE_GLIB_TRUE@am__append_1 = stamp-enum-types +@USE_GLIB_TRUE@am__append_2 = $(glib_enum_h) $(glib_enum_c) +@USE_GLIB_TRUE@am__append_3 = $(glib_enum_h) $(glib_enum_c) +@USE_GLIB_TRUE@am__append_4 = $(enum_tmpl_h) $(enum_tmpl_c) +subdir = cogl-path +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-path-1.0.pc cogl-path-2.0-experimental.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ + "$(DESTDIR)$(cogl_pathheadersdir)" \ + "$(DESTDIR)$(cogl_pathheadersdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcogl_path_la_DEPENDENCIES = $(top_builddir)/cogl/libcogl.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = libcogl_path_la-dict.lo libcogl_path_la-geom.lo \ + libcogl_path_la-mesh.lo libcogl_path_la-normal.lo \ + libcogl_path_la-priorityq.lo libcogl_path_la-render.lo \ + libcogl_path_la-sweep.lo libcogl_path_la-tess.lo \ + libcogl_path_la-tessmono.lo $(am__objects_1) +am__objects_3 = $(am__objects_2) libcogl_path_la-cogl1-path.lo \ + libcogl_path_la-cogl-path.lo $(am__objects_1) +am__objects_4 = $(am__objects_1) +am__objects_5 = $(am__objects_4) $(am__objects_1) +am_libcogl_path_la_OBJECTS = $(am__objects_3) $(am__objects_5) +@USE_GLIB_TRUE@am__objects_6 = \ +@USE_GLIB_TRUE@ libcogl_path_la-cogl-path-enum-types.lo +@USE_GLIB_TRUE@am__objects_7 = $(am__objects_1) $(am__objects_6) +am__objects_8 = $(am__objects_7) +nodist_libcogl_path_la_OBJECTS = $(am__objects_8) +libcogl_path_la_OBJECTS = $(am_libcogl_path_la_OBJECTS) \ + $(nodist_libcogl_path_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcogl_path_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libcogl_path_la_CFLAGS) $(CFLAGS) $(libcogl_path_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcogl_path_la_SOURCES) $(nodist_libcogl_path_la_SOURCES) +DIST_SOURCES = $(libcogl_path_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(pkgconfig_DATA) +HEADERS = $(cogl_pathheaders_HEADERS) \ + $(nodist_cogl_pathheaders_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +BUILT_SOURCES = $(am__append_3) +CLEANFILES = $(am__append_1) +DISTCLEANFILES = $(am__append_2) $(pc_files) \ + $(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj \ + $(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj \ + $(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters +EXTRA_DIST = $(srcdir)/tesselator/README \ + $(srcdir)/tesselator/priorityq-heap.c \ + $(srcdir)/cogl-path.symbols $(NULL) $(am__append_4) \ + cogl-path.pc.in + +# tesselator sources +cogl_tesselator_sources = \ + $(srcdir)/tesselator/dict-list.h \ + $(srcdir)/tesselator/dict.c \ + $(srcdir)/tesselator/dict.h \ + $(srcdir)/tesselator/geom.c \ + $(srcdir)/tesselator/geom.h \ + $(srcdir)/tesselator/gluos.h \ + $(srcdir)/tesselator/memalloc.h \ + $(srcdir)/tesselator/mesh.c \ + $(srcdir)/tesselator/mesh.h \ + $(srcdir)/tesselator/normal.c \ + $(srcdir)/tesselator/normal.h \ + $(srcdir)/tesselator/priorityq-heap.h \ + $(srcdir)/tesselator/priorityq-sort.h \ + $(srcdir)/tesselator/priorityq.c \ + $(srcdir)/tesselator/priorityq.h \ + $(srcdir)/tesselator/render.c \ + $(srcdir)/tesselator/render.h \ + $(srcdir)/tesselator/sweep.c \ + $(srcdir)/tesselator/sweep.h \ + $(srcdir)/tesselator/tess.c \ + $(srcdir)/tesselator/tess.h \ + $(srcdir)/tesselator/tesselator.h \ + $(srcdir)/tesselator/tessmono.c \ + $(srcdir)/tesselator/tessmono.h \ + $(srcdir)/tesselator/GL/glu.h \ + $(NULL) + +source_c = \ + $(cogl_tesselator_sources) \ + cogl-path-private.h \ + cogl1-path.c \ + cogl-path.c \ + $(NULL) + +source_1_x_h = \ + $(srcdir)/cogl-path-types.h \ + $(srcdir)/cogl1-path-functions.h \ + $(NULL) + +source_h = \ + cogl-path.h \ + $(source_1_x_h) \ + cogl2-path-functions.h \ + $(NULL) + + +# glib-mkenums rules +@USE_GLIB_TRUE@glib_enum_h = cogl-path-enum-types.h +@USE_GLIB_TRUE@glib_enum_c = cogl-path-enum-types.c +@USE_GLIB_TRUE@glib_enum_headers = $(source_1_x_h) +@USE_GLIB_TRUE@enum_tmpl_h = $(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in)) +@USE_GLIB_TRUE@enum_tmpl_c = $(addprefix $(srcdir)/, $(glib_enum_c:.c=.c.in)) +lib_LTLIBRARIES = libcogl-path.la +libcogl_path_la_SOURCES = $(source_c) $(source_h) +nodist_libcogl_path_la_SOURCES = $(BUILT_SOURCES) +libcogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) +libcogl_path_la_LIBADD = $(top_builddir)/cogl/libcogl.la \ + $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +libcogl_path_la_LDFLAGS = \ + -export-dynamic \ + -export-symbols-regex "^(cogl|cogl2)_(framebuffer|path|is|clip|[sg]et)_.*" \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -rpath $(libdir) + +AM_CPPFLAGS = \ + -DCOGL_COMPILATION \ + -DG_LOG_DOMAIN=\"CoglPath\" \ + -I$(srcdir)/tesselator \ + -I$(top_srcdir)/cogl \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/cogl/winsys \ + -I$(top_srcdir) \ + -I$(top_builddir) + +cogl_pathheadersdir = $(includedir)/cogl/cogl-path +cogl_pathheaders_HEADERS = $(source_h) +@USE_GLIB_TRUE@nodist_cogl_pathheaders_HEADERS = cogl-path-enum-types.h +pc_files = cogl-path-1.0.pc \ + cogl-path-2.0-experimental.pc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) +MSVC_PROJECT = cogl-path +MSVC_PROJECT_SRCDIR = cogl-path +MSVC_PROJECT_SRCS = $(source_c) +MSVC_PROJECT_EXCLUDES = dummy +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(top_srcdir)/build/autotools/Makefile.am.enums $(top_srcdir)/build/Makefile-msvcproj.mak $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cogl-path/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign cogl-path/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent $(top_srcdir)/build/autotools/Makefile.am.enums $(top_srcdir)/build/Makefile-msvcproj.mak: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-path-1.0.pc: $(top_builddir)/config.status $(srcdir)/cogl-path-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-path-2.0-experimental.pc: $(top_builddir)/config.status $(srcdir)/cogl-path-2.0-experimental.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcogl-path.la: $(libcogl_path_la_OBJECTS) $(libcogl_path_la_DEPENDENCIES) $(EXTRA_libcogl_path_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcogl_path_la_LINK) -rpath $(libdir) $(libcogl_path_la_OBJECTS) $(libcogl_path_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-cogl-path-enum-types.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-cogl-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-cogl1-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-dict.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-geom.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-mesh.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-normal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-priorityq.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-sweep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-tess.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcogl_path_la-tessmono.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libcogl_path_la-dict.lo: $(srcdir)/tesselator/dict.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-dict.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-dict.Tpo -c -o libcogl_path_la-dict.lo `test -f '$(srcdir)/tesselator/dict.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/dict.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-dict.Tpo $(DEPDIR)/libcogl_path_la-dict.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/dict.c' object='libcogl_path_la-dict.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-dict.lo `test -f '$(srcdir)/tesselator/dict.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/dict.c + +libcogl_path_la-geom.lo: $(srcdir)/tesselator/geom.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-geom.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-geom.Tpo -c -o libcogl_path_la-geom.lo `test -f '$(srcdir)/tesselator/geom.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/geom.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-geom.Tpo $(DEPDIR)/libcogl_path_la-geom.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/geom.c' object='libcogl_path_la-geom.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-geom.lo `test -f '$(srcdir)/tesselator/geom.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/geom.c + +libcogl_path_la-mesh.lo: $(srcdir)/tesselator/mesh.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-mesh.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-mesh.Tpo -c -o libcogl_path_la-mesh.lo `test -f '$(srcdir)/tesselator/mesh.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/mesh.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-mesh.Tpo $(DEPDIR)/libcogl_path_la-mesh.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/mesh.c' object='libcogl_path_la-mesh.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-mesh.lo `test -f '$(srcdir)/tesselator/mesh.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/mesh.c + +libcogl_path_la-normal.lo: $(srcdir)/tesselator/normal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-normal.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-normal.Tpo -c -o libcogl_path_la-normal.lo `test -f '$(srcdir)/tesselator/normal.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/normal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-normal.Tpo $(DEPDIR)/libcogl_path_la-normal.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/normal.c' object='libcogl_path_la-normal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-normal.lo `test -f '$(srcdir)/tesselator/normal.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/normal.c + +libcogl_path_la-priorityq.lo: $(srcdir)/tesselator/priorityq.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-priorityq.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-priorityq.Tpo -c -o libcogl_path_la-priorityq.lo `test -f '$(srcdir)/tesselator/priorityq.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/priorityq.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-priorityq.Tpo $(DEPDIR)/libcogl_path_la-priorityq.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/priorityq.c' object='libcogl_path_la-priorityq.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-priorityq.lo `test -f '$(srcdir)/tesselator/priorityq.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/priorityq.c + +libcogl_path_la-render.lo: $(srcdir)/tesselator/render.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-render.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-render.Tpo -c -o libcogl_path_la-render.lo `test -f '$(srcdir)/tesselator/render.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/render.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-render.Tpo $(DEPDIR)/libcogl_path_la-render.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/render.c' object='libcogl_path_la-render.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-render.lo `test -f '$(srcdir)/tesselator/render.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/render.c + +libcogl_path_la-sweep.lo: $(srcdir)/tesselator/sweep.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-sweep.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-sweep.Tpo -c -o libcogl_path_la-sweep.lo `test -f '$(srcdir)/tesselator/sweep.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/sweep.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-sweep.Tpo $(DEPDIR)/libcogl_path_la-sweep.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/sweep.c' object='libcogl_path_la-sweep.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-sweep.lo `test -f '$(srcdir)/tesselator/sweep.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/sweep.c + +libcogl_path_la-tess.lo: $(srcdir)/tesselator/tess.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-tess.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-tess.Tpo -c -o libcogl_path_la-tess.lo `test -f '$(srcdir)/tesselator/tess.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tess.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-tess.Tpo $(DEPDIR)/libcogl_path_la-tess.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/tess.c' object='libcogl_path_la-tess.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-tess.lo `test -f '$(srcdir)/tesselator/tess.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tess.c + +libcogl_path_la-tessmono.lo: $(srcdir)/tesselator/tessmono.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-tessmono.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-tessmono.Tpo -c -o libcogl_path_la-tessmono.lo `test -f '$(srcdir)/tesselator/tessmono.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tessmono.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-tessmono.Tpo $(DEPDIR)/libcogl_path_la-tessmono.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/tesselator/tessmono.c' object='libcogl_path_la-tessmono.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-tessmono.lo `test -f '$(srcdir)/tesselator/tessmono.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tessmono.c + +libcogl_path_la-cogl1-path.lo: cogl1-path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-cogl1-path.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-cogl1-path.Tpo -c -o libcogl_path_la-cogl1-path.lo `test -f 'cogl1-path.c' || echo '$(srcdir)/'`cogl1-path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-cogl1-path.Tpo $(DEPDIR)/libcogl_path_la-cogl1-path.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl1-path.c' object='libcogl_path_la-cogl1-path.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-cogl1-path.lo `test -f 'cogl1-path.c' || echo '$(srcdir)/'`cogl1-path.c + +libcogl_path_la-cogl-path.lo: cogl-path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-cogl-path.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-cogl-path.Tpo -c -o libcogl_path_la-cogl-path.lo `test -f 'cogl-path.c' || echo '$(srcdir)/'`cogl-path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-cogl-path.Tpo $(DEPDIR)/libcogl_path_la-cogl-path.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-path.c' object='libcogl_path_la-cogl-path.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-cogl-path.lo `test -f 'cogl-path.c' || echo '$(srcdir)/'`cogl-path.c + +libcogl_path_la-cogl-path-enum-types.lo: cogl-path-enum-types.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -MT libcogl_path_la-cogl-path-enum-types.lo -MD -MP -MF $(DEPDIR)/libcogl_path_la-cogl-path-enum-types.Tpo -c -o libcogl_path_la-cogl-path-enum-types.lo `test -f 'cogl-path-enum-types.c' || echo '$(srcdir)/'`cogl-path-enum-types.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcogl_path_la-cogl-path-enum-types.Tpo $(DEPDIR)/libcogl_path_la-cogl-path-enum-types.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-path-enum-types.c' object='libcogl_path_la-cogl-path-enum-types.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcogl_path_la_CFLAGS) $(CFLAGS) -c -o libcogl_path_la-cogl-path-enum-types.lo `test -f 'cogl-path-enum-types.c' || echo '$(srcdir)/'`cogl-path-enum-types.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-cogl_pathheadersHEADERS: $(cogl_pathheaders_HEADERS) + @$(NORMAL_INSTALL) + @list='$(cogl_pathheaders_HEADERS)'; test -n "$(cogl_pathheadersdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogl_pathheadersdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogl_pathheadersdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogl_pathheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogl_pathheadersdir)" || exit $$?; \ + done + +uninstall-cogl_pathheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(cogl_pathheaders_HEADERS)'; test -n "$(cogl_pathheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogl_pathheadersdir)'; $(am__uninstall_files_from_dir) +install-nodist_cogl_pathheadersHEADERS: $(nodist_cogl_pathheaders_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nodist_cogl_pathheaders_HEADERS)'; test -n "$(cogl_pathheadersdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogl_pathheadersdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogl_pathheadersdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogl_pathheadersdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogl_pathheadersdir)" || exit $$?; \ + done + +uninstall-nodist_cogl_pathheadersHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_cogl_pathheaders_HEADERS)'; test -n "$(cogl_pathheadersdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogl_pathheadersdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(cogl_pathheadersdir)" "$(DESTDIR)$(cogl_pathheadersdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-cogl_pathheadersHEADERS \ + install-nodist_cogl_pathheadersHEADERS install-pkgconfigDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-cogl_pathheadersHEADERS \ + uninstall-libLTLIBRARIES \ + uninstall-nodist_cogl_pathheadersHEADERS \ + uninstall-pkgconfigDATA + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am dist-hook distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-cogl_pathheadersHEADERS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man \ + install-nodist_cogl_pathheadersHEADERS install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-cogl_pathheadersHEADERS uninstall-libLTLIBRARIES \ + uninstall-nodist_cogl_pathheadersHEADERS \ + uninstall-pkgconfigDATA + + +# Basic sanity checks +@USE_GLIB_TRUE@$(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS)) + +@USE_GLIB_TRUE@$(if $(or $(glib_enum_h), \ +@USE_GLIB_TRUE@ $(glib_enum_c)),, \ +@USE_GLIB_TRUE@ $(error Need to define glib_enum_h and glib_enum_c)) + +@USE_GLIB_TRUE@$(if $(glib_enum_headers),,$(error Need to define glib_enum_headers)) + +@USE_GLIB_TRUE@stamp-enum-types: $(glib_enum_headers) $(enum_tmpl_h) +@USE_GLIB_TRUE@ $(AM_V_GEN)$(GLIB_MKENUMS) \ +@USE_GLIB_TRUE@ --template $(enum_tmpl_h) \ +@USE_GLIB_TRUE@ $(glib_enum_headers) > xgen-eh \ +@USE_GLIB_TRUE@ && (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \ +@USE_GLIB_TRUE@ && rm -f xgen-eh \ +@USE_GLIB_TRUE@ && echo timestamp > $(@F) + +@USE_GLIB_TRUE@$(glib_enum_h): stamp-enum-types +@USE_GLIB_TRUE@ @true + +@USE_GLIB_TRUE@$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(enum_tmpl_c) +@USE_GLIB_TRUE@ $(AM_V_GEN)$(GLIB_MKENUMS) \ +@USE_GLIB_TRUE@ --template $(enum_tmpl_c) \ +@USE_GLIB_TRUE@ $(glib_enum_headers) > xgen-ec \ +@USE_GLIB_TRUE@ && cp -f xgen-ec $(glib_enum_c) \ +@USE_GLIB_TRUE@ && rm -f xgen-ec + +dist-hook: \ + $(top_builddir)/build/win32/vs9/cogl-path.vcproj \ + $(top_builddir)/build/win32/vs10/cogl-path.vcxproj \ + $(top_builddir)/build/win32/vs10/cogl-path.vcxproj.filters + +$(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj: $(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin >$@ + rm $(MSVC_PROJECT).sourcefiles + +$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin >$@ + rm $(MSVC_PROJECT).vs10.sourcefiles + +$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin + for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \ + case $$F in \ + $(MSVC_PROJECT_EXCLUDES)) \ + ;; \ + *.c) echo ' Source Files' \ + ;; \ + esac; \ + done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin >$@ + rm $(MSVC_PROJECT).vs10.sourcefiles.filters + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cogl-path/cogl-path-1.0.pc.in b/cogl-path/cogl-path-1.0.pc.in new file mode 100644 index 0000000..9cb7c97 --- /dev/null +++ b/cogl-path/cogl-path-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=1.0 +requires=@COGL_PKG_REQUIRES@ cogl-1.0 + +Name: Cogl +Description: A 2D path drawing library for Cogl +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-path +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-path/cogl-path-2.0-experimental.pc.in b/cogl-path/cogl-path-2.0-experimental.pc.in new file mode 100644 index 0000000..8ce25ec --- /dev/null +++ b/cogl-path/cogl-path-2.0-experimental.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ cogl-2.0-experimental + +Name: Cogl +Description: A 2D path drawing library for Cogl +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl-path +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-path/cogl-path-enum-types.c.in b/cogl-path/cogl-path-enum-types.c.in new file mode 100644 index 0000000..5474607 --- /dev/null +++ b/cogl-path/cogl-path-enum-types.c.in @@ -0,0 +1,50 @@ +/*** BEGIN file-header ***/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* We need to undefine this so that we will be sure to include + * cogl-path.h instead of cogl2-path.h when we include the framebuffer + * header. Otherwise it will include both headers and it won't + * compile. */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API + +#include "cogl-path-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_enum_type_id__volatile = 0; + + if (g_once_init_enter (&g_enum_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_enum_type_id; + + g_enum_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + + g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); + } + + return g_enum_type_id__volatile; +} +/*** END value-tail ***/ diff --git a/cogl-path/cogl-path-enum-types.h.in b/cogl-path/cogl-path-enum-types.h.in new file mode 100644 index 0000000..071686a --- /dev/null +++ b/cogl-path/cogl-path-enum-types.h.in @@ -0,0 +1,25 @@ +/*** BEGIN file-header ***/ +#ifndef __COGL_PATH_ENUM_TYPES_H__ +#define __COGL_PATH_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __COGL_PATH_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define COGL_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ diff --git a/cogl-path/cogl-path-private.h b/cogl-path/cogl-path-private.h new file mode 100644 index 0000000..078e58f --- /dev/null +++ b/cogl-path/cogl-path-private.h @@ -0,0 +1,126 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PATH_PRIVATE_H +#define __COGL_PATH_PRIVATE_H + +#include "cogl-object.h" +#include "cogl-attribute-private.h" + +typedef struct _floatVec2 +{ + float x; + float y; +} floatVec2; + +typedef struct _CoglPathNode +{ + float x; + float y; + unsigned int path_size; +} CoglPathNode; + +typedef struct _CoglBezQuad +{ + floatVec2 p1; + floatVec2 p2; + floatVec2 p3; +} CoglBezQuad; + +typedef struct _CoglBezCubic +{ + floatVec2 p1; + floatVec2 p2; + floatVec2 p3; + floatVec2 p4; +} CoglBezCubic; + +typedef struct _CoglPathData CoglPathData; + +struct _CoglPath +{ + CoglObject _parent; + + CoglPathData *data; +}; + +#define COGL_PATH_N_ATTRIBUTES 2 + +struct _CoglPathData +{ + unsigned int ref_count; + + CoglContext *context; + + CoglPathFillRule fill_rule; + + GArray *path_nodes; + + floatVec2 path_start; + floatVec2 path_pen; + unsigned int last_path; + floatVec2 path_nodes_min; + floatVec2 path_nodes_max; + + CoglAttributeBuffer *fill_attribute_buffer; + CoglIndices *fill_vbo_indices; + unsigned int fill_vbo_n_indices; + CoglAttribute *fill_attributes[COGL_PATH_N_ATTRIBUTES + 1]; + CoglPrimitive *fill_primitive; + + CoglAttributeBuffer *stroke_attribute_buffer; + CoglAttribute **stroke_attributes; + unsigned int stroke_n_attributes; + + /* This is used as an optimisation for when the path contains a + single contour specified using cogl2_path_rectangle. Cogl is more + optimised to handle rectangles than paths so we can detect this + case and divert to the journal or a rectangle clip. If it is TRUE + then the entire path can be described by calling + _cogl_path_get_bounds */ + CoglBool is_rectangle; +}; + +void +_cogl_add_path_to_stencil_buffer (CoglPath *path, + CoglBool merge, + CoglBool need_clear); + +void +_cogl_path_get_bounds (CoglPath *path, + float *min_x, + float *min_y, + float *max_x, + float *max_y); + +CoglBool +_cogl_path_is_rectangle (CoglPath *path); + +#endif /* __COGL_PATH_PRIVATE_H */ diff --git a/cogl-path/cogl-path-types.h b/cogl-path/cogl-path-types.h new file mode 100644 index 0000000..53c06ee --- /dev/null +++ b/cogl-path/cogl-path-types.h @@ -0,0 +1,85 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PATH_TYPES_H__ +#define __COGL_PATH_TYPES_H__ + +#include + +COGL_BEGIN_DECLS + +typedef struct _CoglPath CoglPath; + +/** + * CoglPathFillRule: + * @COGL_PATH_FILL_RULE_NON_ZERO: Each time the line crosses an edge of + * the path from left to right one is added to a counter and each time + * it crosses from right to left the counter is decremented. If the + * counter is non-zero then the point will be filled. See . + * @COGL_PATH_FILL_RULE_EVEN_ODD: If the line crosses an edge of the + * path an odd number of times then the point will filled, otherwise + * it won't. See . + * + * #CoglPathFillRule is used to determine how a path is filled. There + * are two options - 'non-zero' and 'even-odd'. To work out whether any + * point will be filled imagine drawing an infinetely long line in any + * direction from that point. The number of times and the direction + * that the edges of the path crosses this line determines whether the + * line is filled as described below. Any open sub paths are treated + * as if there was an extra line joining the first point and the last + * point. + * + * The default fill rule when creating a path is %COGL_PATH_FILL_RULE_EVEN_ODD. + * + *
+ * Example of filling various paths using the non-zero rule + * + *
+ * + *
+ * Example of filling various paths using the even-odd rule + * + *
+ * + * Since: 1.4 + */ +typedef enum { + COGL_PATH_FILL_RULE_NON_ZERO, + COGL_PATH_FILL_RULE_EVEN_ODD +} CoglPathFillRule; + +COGL_END_DECLS + +#endif /* __COGL_PATH_TYPES_H__ */ diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c new file mode 100644 index 0000000..2b4b3c6 --- /dev/null +++ b/cogl-path/cogl-path.c @@ -0,0 +1,1602 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Ivan Leben + * Øyvind Kolås + * Neil Roberts + * Robert Bragg + */ + +#include "config.h" + +#include "cogl-util.h" +#include "cogl-object.h" +#include "cogl-context-private.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-primitive-private.h" +#include "cogl-texture-private.h" +#include "cogl-primitives-private.h" +#include "cogl-private.h" +#include "cogl-attribute-private.h" +#include "cogl1-context.h" +#include "tesselator/tesselator.h" + +#include "cogl-path/cogl-path.h" +#include "cogl-path-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +#define _COGL_MAX_BEZ_RECURSE_DEPTH 16 + +static void _cogl_path_free (CoglPath *path); + +static void _cogl_path_build_fill_attribute_buffer (CoglPath *path); +static CoglPrimitive *_cogl_path_get_fill_primitive (CoglPath *path); +static void _cogl_path_build_stroke_attribute_buffer (CoglPath *path); + +COGL_OBJECT_DEFINE (Path, path); +COGL_GTYPE_DEFINE_CLASS (Path, path); + +static void +_cogl_path_data_clear_vbos (CoglPathData *data) +{ + int i; + + if (data->fill_attribute_buffer) + { + cogl_object_unref (data->fill_attribute_buffer); + cogl_object_unref (data->fill_vbo_indices); + + for (i = 0; i < COGL_PATH_N_ATTRIBUTES; i++) + cogl_object_unref (data->fill_attributes[i]); + + data->fill_attribute_buffer = NULL; + } + + if (data->fill_primitive) + { + cogl_object_unref (data->fill_primitive); + data->fill_primitive = NULL; + } + + if (data->stroke_attribute_buffer) + { + cogl_object_unref (data->stroke_attribute_buffer); + + for (i = 0; i < data->stroke_n_attributes; i++) + cogl_object_unref (data->stroke_attributes[i]); + + g_free (data->stroke_attributes); + + data->stroke_attribute_buffer = NULL; + } +} + +static void +_cogl_path_data_unref (CoglPathData *data) +{ + if (--data->ref_count <= 0) + { + _cogl_path_data_clear_vbos (data); + + g_array_free (data->path_nodes, TRUE); + + g_slice_free (CoglPathData, data); + } +} + +static void +_cogl_path_modify (CoglPath *path) +{ + /* This needs to be called whenever the path is about to be modified + to implement copy-on-write semantics */ + + /* If there is more than one path using the data then we need to + copy the data instead */ + if (path->data->ref_count != 1) + { + CoglPathData *old_data = path->data; + + path->data = g_slice_dup (CoglPathData, old_data); + path->data->path_nodes = g_array_new (FALSE, FALSE, + sizeof (CoglPathNode)); + g_array_append_vals (path->data->path_nodes, + old_data->path_nodes->data, + old_data->path_nodes->len); + + path->data->fill_attribute_buffer = NULL; + path->data->fill_primitive = NULL; + path->data->stroke_attribute_buffer = NULL; + path->data->ref_count = 1; + + _cogl_path_data_unref (old_data); + } + else + /* The path is altered so the vbos will now be invalid */ + _cogl_path_data_clear_vbos (path->data); +} + +void +cogl2_path_set_fill_rule (CoglPath *path, + CoglPathFillRule fill_rule) +{ + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + if (path->data->fill_rule != fill_rule) + { + _cogl_path_modify (path); + + path->data->fill_rule = fill_rule; + } +} + +CoglPathFillRule +cogl2_path_get_fill_rule (CoglPath *path) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO); + + return path->data->fill_rule; +} + +static void +_cogl_path_add_node (CoglPath *path, + CoglBool new_sub_path, + float x, + float y) +{ + CoglPathNode new_node; + CoglPathData *data; + + _cogl_path_modify (path); + + data = path->data; + + new_node.x = x; + new_node.y = y; + new_node.path_size = 0; + + if (new_sub_path || data->path_nodes->len == 0) + data->last_path = data->path_nodes->len; + + g_array_append_val (data->path_nodes, new_node); + + g_array_index (data->path_nodes, CoglPathNode, data->last_path).path_size++; + + if (data->path_nodes->len == 1) + { + data->path_nodes_min.x = data->path_nodes_max.x = x; + data->path_nodes_min.y = data->path_nodes_max.y = y; + } + else + { + if (x < data->path_nodes_min.x) + data->path_nodes_min.x = x; + if (x > data->path_nodes_max.x) + data->path_nodes_max.x = x; + if (y < data->path_nodes_min.y) + data->path_nodes_min.y = y; + if (y > data->path_nodes_max.y) + data->path_nodes_max.y = y; + } + + /* Once the path nodes have been modified then we'll assume it's no + longer a rectangle. cogl2_path_rectangle will set this back to + TRUE if this has been called from there */ + data->is_rectangle = FALSE; +} + +static void +_cogl_path_stroke_nodes (CoglPath *path, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline) +{ + CoglPathData *data; + CoglPipeline *copy = NULL; + unsigned int path_start; + int path_num = 0; + CoglPathNode *node; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer)); + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + data = path->data; + + if (data->path_nodes->len == 0) + return; + + if (cogl_pipeline_get_n_layers (pipeline) != 0) + { + copy = cogl_pipeline_copy (pipeline); + _cogl_pipeline_prune_to_n_layers (copy, 0); + pipeline = copy; + } + + _cogl_path_build_stroke_attribute_buffer (path); + + for (path_start = 0; + path_start < data->path_nodes->len; + path_start += node->path_size) + { + CoglPrimitive *primitive; + + node = &g_array_index (data->path_nodes, CoglPathNode, path_start); + + primitive = + cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP, + node->path_size, + &data->stroke_attributes[path_num], + 1); + cogl_primitive_draw (primitive, framebuffer, pipeline); + cogl_object_unref (primitive); + + path_num++; + } + + if (copy) + cogl_object_unref (copy); +} + +void +_cogl_path_get_bounds (CoglPath *path, + float *min_x, + float *min_y, + float *max_x, + float *max_y) +{ + CoglPathData *data = path->data; + + if (data->path_nodes->len == 0) + { + *min_x = 0.0f; + *min_y = 0.0f; + *max_x = 0.0f; + *max_y = 0.0f; + } + else + { + *min_x = data->path_nodes_min.x; + *min_y = data->path_nodes_min.y; + *max_x = data->path_nodes_max.x; + *max_y = data->path_nodes_max.y; + } +} + +static void +_cogl_path_fill_nodes_with_clipped_rectangle (CoglPath *path, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline) +{ + /* We need at least three stencil bits to combine clips */ + if (_cogl_framebuffer_get_stencil_bits (framebuffer) >= 3) + { + static CoglBool seen_warning = FALSE; + + if (!seen_warning) + { + g_warning ("Paths can not be filled using materials with " + "sliced textures unless there is a stencil " + "buffer"); + seen_warning = TRUE; + } + } + + cogl_framebuffer_push_path_clip (framebuffer, path); + cogl_framebuffer_draw_rectangle (framebuffer, + pipeline, + path->data->path_nodes_min.x, + path->data->path_nodes_min.y, + path->data->path_nodes_max.x, + path->data->path_nodes_max.y); + cogl_framebuffer_pop_clip (framebuffer); +} + +static CoglBool +validate_layer_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglBool *needs_fallback = user_data; + CoglTexture *texture = _cogl_pipeline_layer_get_texture (layer); + + /* If any of the layers of the current pipeline contain sliced + * textures or textures with waste then it won't work to draw the + * path directly. Instead we fallback to pushing the path as a clip + * on the clip-stack and drawing the path's bounding rectangle + * instead. + */ + + if (texture != NULL && (cogl_texture_is_sliced (texture) || + !_cogl_texture_can_hardware_repeat (texture))) + *needs_fallback = TRUE; + + return !*needs_fallback; +} + +static void +_cogl_path_fill_nodes (CoglPath *path, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags) +{ + if (path->data->path_nodes->len == 0) + return; + + /* If the path is a simple rectangle then we can divert to using + cogl_framebuffer_draw_rectangle which should be faster because it + can go through the journal instead of uploading the geometry just + for two triangles */ + if (path->data->is_rectangle && flags == 0) + { + float x_1, y_1, x_2, y_2; + + _cogl_path_get_bounds (path, &x_1, &y_1, &x_2, &y_2); + cogl_framebuffer_draw_rectangle (framebuffer, + pipeline, + x_1, y_1, + x_2, y_2); + } + else + { + CoglBool needs_fallback = FALSE; + CoglPrimitive *primitive; + + _cogl_pipeline_foreach_layer_internal (pipeline, + validate_layer_cb, + &needs_fallback); + if (needs_fallback) + { + _cogl_path_fill_nodes_with_clipped_rectangle (path, + framebuffer, + pipeline); + return; + } + + primitive = _cogl_path_get_fill_primitive (path); + + _cogl_primitive_draw (primitive, framebuffer, pipeline, flags); + } +} + +/* TODO: Update to the protoype used in the Cogl master branch. + * This is experimental API but not in sync with the cogl_path_fill() + * api in Cogl master which takes explicit framebuffer and pipeline + * arguments */ +void +cogl2_path_fill (CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_fill_nodes (path, + cogl_get_draw_framebuffer (), + cogl_get_source (), + 0 /* flags */); +} + +/* TODO: Update to the protoype used in the Cogl master branch. + * This is experimental API but not in sync with the cogl_path_fill() + * api in Cogl master which takes explicit framebuffer and pipeline + * arguments */ +void +cogl2_path_stroke (CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + if (path->data->path_nodes->len == 0) + return; + + _cogl_path_stroke_nodes (path, + cogl_get_draw_framebuffer (), + cogl_get_source ()); +} + +void +cogl2_path_move_to (CoglPath *path, + float x, + float y) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_add_node (path, TRUE, x, y); + + data = path->data; + + data->path_start.x = x; + data->path_start.y = y; + + data->path_pen = data->path_start; +} + +void +cogl2_path_rel_move_to (CoglPath *path, + float x, + float y) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + data = path->data; + + cogl2_path_move_to (path, + data->path_pen.x + x, + data->path_pen.y + y); +} + +void +cogl2_path_line_to (CoglPath *path, + float x, + float y) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_add_node (path, FALSE, x, y); + + data = path->data; + + data->path_pen.x = x; + data->path_pen.y = y; +} + +void +cogl2_path_rel_line_to (CoglPath *path, + float x, + float y) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + data = path->data; + + cogl2_path_line_to (path, + data->path_pen.x + x, + data->path_pen.y + y); +} + +void +cogl2_path_close (CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_add_node (path, FALSE, path->data->path_start.x, + path->data->path_start.y); + + path->data->path_pen = path->data->path_start; +} + +void +cogl2_path_line (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2) +{ + cogl2_path_move_to (path, x_1, y_1); + cogl2_path_line_to (path, x_2, y_2); +} + +void +cogl2_path_polyline (CoglPath *path, + const float *coords, + int num_points) +{ + int c = 0; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + cogl2_path_move_to (path, coords[0], coords[1]); + + for (c = 1; c < num_points; ++c) + cogl2_path_line_to (path, coords[2*c], coords[2*c+1]); +} + +void +cogl2_path_polygon (CoglPath *path, + const float *coords, + int num_points) +{ + cogl2_path_polyline (path, coords, num_points); + cogl2_path_close (path); +} + +void +cogl2_path_rectangle (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglBool is_rectangle; + + /* If the path was previously empty and the rectangle isn't mirrored + then we'll record that this is a simple rectangle path so that we + can optimise it */ + is_rectangle = (path->data->path_nodes->len == 0 && + x_2 >= x_1 && + y_2 >= y_1); + + cogl2_path_move_to (path, x_1, y_1); + cogl2_path_line_to (path, x_2, y_1); + cogl2_path_line_to (path, x_2, y_2); + cogl2_path_line_to (path, x_1, y_2); + cogl2_path_close (path); + + path->data->is_rectangle = is_rectangle; +} + +CoglBool +_cogl_path_is_rectangle (CoglPath *path) +{ + return path->data->is_rectangle; +} + +static void +_cogl_path_arc (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2, + float angle_step, + unsigned int move_first) +{ + float a = 0x0; + float cosa = 0x0; + float sina = 0x0; + float px = 0x0; + float py = 0x0; + + /* Fix invalid angles */ + + if (angle_1 == angle_2 || angle_step == 0x0) + return; + + if (angle_step < 0x0) + angle_step = -angle_step; + + /* Walk the arc by given step */ + + a = angle_1; + while (a != angle_2) + { + cosa = cosf (a * (G_PI/180.0)); + sina = sinf (a * (G_PI/180.0)); + + px = center_x + (cosa * radius_x); + py = center_y + (sina * radius_y); + + if (a == angle_1 && move_first) + cogl2_path_move_to (path, px, py); + else + cogl2_path_line_to (path, px, py); + + if (G_LIKELY (angle_2 > angle_1)) + { + a += angle_step; + if (a > angle_2) + a = angle_2; + } + else + { + a -= angle_step; + if (a < angle_2) + a = angle_2; + } + } + + /* Make sure the final point is drawn */ + + cosa = cosf (angle_2 * (G_PI/180.0)); + sina = sinf (angle_2 * (G_PI/180.0)); + + px = center_x + (cosa * radius_x); + py = center_y + (sina * radius_y); + + cogl2_path_line_to (path, px, py); +} + +void +cogl2_path_arc (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2) +{ + float angle_step = 10; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + /* it is documented that a move to is needed to create a freestanding + * arc + */ + _cogl_path_arc (path, + center_x, center_y, + radius_x, radius_y, + angle_1, angle_2, + angle_step, 0 /* no move */); +} + + +static void +_cogl_path_rel_arc (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2, + float angle_step) +{ + CoglPathData *data; + + data = path->data; + + _cogl_path_arc (path, + data->path_pen.x + center_x, + data->path_pen.y + center_y, + radius_x, radius_y, + angle_1, angle_2, + angle_step, 0 /* no move */); +} + +void +cogl2_path_ellipse (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y) +{ + float angle_step = 10; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + /* FIXME: if shows to be slow might be optimized + * by mirroring just a quarter of it */ + + _cogl_path_arc (path, + center_x, center_y, + radius_x, radius_y, + 0, 360, + angle_step, 1 /* move first */); + + cogl2_path_close (path); +} + +void +cogl2_path_round_rectangle (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float radius, + float arc_step) +{ + float inner_width = x_2 - x_1 - radius * 2; + float inner_height = y_2 - y_1 - radius * 2; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + cogl2_path_move_to (path, x_1, y_1 + radius); + _cogl_path_rel_arc (path, + radius, 0, + radius, radius, + 180, + 270, + arc_step); + + cogl2_path_line_to (path, + path->data->path_pen.x + inner_width, + path->data->path_pen.y); + _cogl_path_rel_arc (path, + 0, radius, + radius, radius, + -90, + 0, + arc_step); + + cogl2_path_line_to (path, + path->data->path_pen.x, + path->data->path_pen.y + inner_height); + + _cogl_path_rel_arc (path, + -radius, 0, + radius, radius, + 0, + 90, + arc_step); + + cogl2_path_line_to (path, + path->data->path_pen.x - inner_width, + path->data->path_pen.y); + _cogl_path_rel_arc (path, + 0, -radius, + radius, radius, + 90, + 180, + arc_step); + + cogl2_path_close (path); +} + +static void +_cogl_path_bezier3_sub (CoglPath *path, + CoglBezCubic *cubic) +{ + CoglBezCubic cubics[_COGL_MAX_BEZ_RECURSE_DEPTH]; + CoglBezCubic *cleft; + CoglBezCubic *cright; + CoglBezCubic *c; + floatVec2 dif1; + floatVec2 dif2; + floatVec2 mm; + floatVec2 c1; + floatVec2 c2; + floatVec2 c3; + floatVec2 c4; + floatVec2 c5; + int cindex; + + /* Put first curve on stack */ + cubics[0] = *cubic; + cindex = 0; + + while (cindex >= 0) + { + c = &cubics[cindex]; + + + /* Calculate distance of control points from their + * counterparts on the line between end points */ + dif1.x = (c->p2.x * 3) - (c->p1.x * 2) - c->p4.x; + dif1.y = (c->p2.y * 3) - (c->p1.y * 2) - c->p4.y; + dif2.x = (c->p3.x * 3) - (c->p4.x * 2) - c->p1.x; + dif2.y = (c->p3.y * 3) - (c->p4.y * 2) - c->p1.y; + + if (dif1.x < 0) + dif1.x = -dif1.x; + if (dif1.y < 0) + dif1.y = -dif1.y; + if (dif2.x < 0) + dif2.x = -dif2.x; + if (dif2.y < 0) + dif2.y = -dif2.y; + + + /* Pick the greatest of two distances */ + if (dif1.x < dif2.x) dif1.x = dif2.x; + if (dif1.y < dif2.y) dif1.y = dif2.y; + + /* Cancel if the curve is flat enough */ + if (dif1.x + dif1.y <= 1.0 || + cindex == _COGL_MAX_BEZ_RECURSE_DEPTH-1) + { + /* Add subdivision point (skip last) */ + if (cindex == 0) + return; + + _cogl_path_add_node (path, FALSE, c->p4.x, c->p4.y); + + --cindex; + + continue; + } + + /* Left recursion goes on top of stack! */ + cright = c; cleft = &cubics[++cindex]; + + /* Subdivide into 2 sub-curves */ + c1.x = ((c->p1.x + c->p2.x) / 2); + c1.y = ((c->p1.y + c->p2.y) / 2); + mm.x = ((c->p2.x + c->p3.x) / 2); + mm.y = ((c->p2.y + c->p3.y) / 2); + c5.x = ((c->p3.x + c->p4.x) / 2); + c5.y = ((c->p3.y + c->p4.y) / 2); + + c2.x = ((c1.x + mm.x) / 2); + c2.y = ((c1.y + mm.y) / 2); + c4.x = ((mm.x + c5.x) / 2); + c4.y = ((mm.y + c5.y) / 2); + + c3.x = ((c2.x + c4.x) / 2); + c3.y = ((c2.y + c4.y) / 2); + + /* Add left recursion to stack */ + cleft->p1 = c->p1; + cleft->p2 = c1; + cleft->p3 = c2; + cleft->p4 = c3; + + /* Add right recursion to stack */ + cright->p1 = c3; + cright->p2 = c4; + cright->p3 = c5; + cright->p4 = c->p4; + } +} + +void +cogl2_path_curve_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3) +{ + CoglBezCubic cubic; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + /* Prepare cubic curve */ + cubic.p1 = path->data->path_pen; + cubic.p2.x = x_1; + cubic.p2.y = y_1; + cubic.p3.x = x_2; + cubic.p3.y = y_2; + cubic.p4.x = x_3; + cubic.p4.y = y_3; + + /* Run subdivision */ + _cogl_path_bezier3_sub (path, &cubic); + + /* Add last point */ + _cogl_path_add_node (path, FALSE, cubic.p4.x, cubic.p4.y); + path->data->path_pen = cubic.p4; +} + +void +cogl2_path_rel_curve_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + data = path->data; + + cogl2_path_curve_to (path, + data->path_pen.x + x_1, + data->path_pen.y + y_1, + data->path_pen.x + x_2, + data->path_pen.y + y_2, + data->path_pen.x + x_3, + data->path_pen.y + y_3); +} + +CoglPath * +cogl2_path_new (void) +{ + CoglPath *path; + CoglPathData *data; + + _COGL_GET_CONTEXT (ctx, NULL); + + path = g_slice_new (CoglPath); + data = path->data = g_slice_new (CoglPathData); + + data->ref_count = 1; + data->context = ctx; + data->fill_rule = COGL_PATH_FILL_RULE_EVEN_ODD; + data->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode)); + data->last_path = 0; + data->fill_attribute_buffer = NULL; + data->stroke_attribute_buffer = NULL; + data->fill_primitive = NULL; + data->is_rectangle = FALSE; + + return _cogl_path_object_new (path); +} + +CoglPath * +cogl_path_copy (CoglPath *old_path) +{ + CoglPath *new_path; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_path (old_path), NULL); + + new_path = g_slice_new (CoglPath); + new_path->data = old_path->data; + new_path->data->ref_count++; + + return _cogl_path_object_new (new_path); +} + +static void +_cogl_path_free (CoglPath *path) +{ + _cogl_path_data_unref (path->data); + g_slice_free (CoglPath, path); +} + +/* If second order beziers were needed the following code could + * be re-enabled: + */ +#if 0 + +static void +_cogl_path_bezier2_sub (CoglPath *path, + CoglBezQuad *quad) +{ + CoglBezQuad quads[_COGL_MAX_BEZ_RECURSE_DEPTH]; + CoglBezQuad *qleft; + CoglBezQuad *qright; + CoglBezQuad *q; + floatVec2 mid; + floatVec2 dif; + floatVec2 c1; + floatVec2 c2; + floatVec2 c3; + int qindex; + + /* Put first curve on stack */ + quads[0] = *quad; + qindex = 0; + + /* While stack is not empty */ + while (qindex >= 0) + { + + q = &quads[qindex]; + + /* Calculate distance of control point from its + * counterpart on the line between end points */ + mid.x = ((q->p1.x + q->p3.x) / 2); + mid.y = ((q->p1.y + q->p3.y) / 2); + dif.x = (q->p2.x - mid.x); + dif.y = (q->p2.y - mid.y); + if (dif.x < 0) dif.x = -dif.x; + if (dif.y < 0) dif.y = -dif.y; + + /* Cancel if the curve is flat enough */ + if (dif.x + dif.y <= 1.0 || + qindex == _COGL_MAX_BEZ_RECURSE_DEPTH - 1) + { + /* Add subdivision point (skip last) */ + if (qindex == 0) return; + _cogl_path_add_node (path, FALSE, q->p3.x, q->p3.y); + --qindex; continue; + } + + /* Left recursion goes on top of stack! */ + qright = q; qleft = &quads[++qindex]; + + /* Subdivide into 2 sub-curves */ + c1.x = ((q->p1.x + q->p2.x) / 2); + c1.y = ((q->p1.y + q->p2.y) / 2); + c3.x = ((q->p2.x + q->p3.x) / 2); + c3.y = ((q->p2.y + q->p3.y) / 2); + c2.x = ((c1.x + c3.x) / 2); + c2.y = ((c1.y + c3.y) / 2); + + /* Add left recursion onto stack */ + qleft->p1 = q->p1; + qleft->p2 = c1; + qleft->p3 = c2; + + /* Add right recursion onto stack */ + qright->p1 = c2; + qright->p2 = c3; + qright->p3 = q->p3; + } +} + +void +cogl_path_curve2_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglBezQuad quad; + + /* Prepare quadratic curve */ + quad.p1 = path->data->path_pen; + quad.p2.x = x_1; + quad.p2.y = y_1; + quad.p3.x = x_2; + quad.p3.y = y_2; + + /* Run subdivision */ + _cogl_path_bezier2_sub (&quad); + + /* Add last point */ + _cogl_path_add_node (FALSE, quad.p3.x, quad.p3.y); + path->data->path_pen = quad.p3; +} + +void +cogl_rel_curve2_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglPathData *data; + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + data = path->data; + + cogl_path_curve2_to (data->path_pen.x + x_1, + data->path_pen.y + y_1, + data->path_pen.x + x_2, + data->path_pen.y + y_2); +} + +#endif + +typedef struct _CoglPathTesselator CoglPathTesselator; +typedef struct _CoglPathTesselatorVertex CoglPathTesselatorVertex; + +struct _CoglPathTesselator +{ + GLUtesselator *glu_tess; + GLenum primitive_type; + int vertex_number; + /* Array of CoglPathTesselatorVertex. This needs to grow when the + combine callback is called */ + GArray *vertices; + /* Array of integers for the indices into the vertices array. Each + element will either be uint8_t, uint16_t or uint32_t depending on + the number of vertices */ + GArray *indices; + CoglIndicesType indices_type; + /* Indices used to split fans and strips */ + int index_a, index_b; +}; + +struct _CoglPathTesselatorVertex +{ + float x, y, s, t; +}; + +static void +_cogl_path_tesselator_begin (GLenum type, + CoglPathTesselator *tess) +{ + g_assert (type == GL_TRIANGLES || + type == GL_TRIANGLE_FAN || + type == GL_TRIANGLE_STRIP); + + tess->primitive_type = type; + tess->vertex_number = 0; +} + +static CoglIndicesType +_cogl_path_tesselator_get_indices_type_for_size (int n_vertices) +{ + if (n_vertices <= 256) + return COGL_INDICES_TYPE_UNSIGNED_BYTE; + else if (n_vertices <= 65536) + return COGL_INDICES_TYPE_UNSIGNED_SHORT; + else + return COGL_INDICES_TYPE_UNSIGNED_INT; +} + +static void +_cogl_path_tesselator_allocate_indices_array (CoglPathTesselator *tess) +{ + switch (tess->indices_type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + tess->indices = g_array_new (FALSE, FALSE, sizeof (uint8_t)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + tess->indices = g_array_new (FALSE, FALSE, sizeof (uint16_t)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_INT: + tess->indices = g_array_new (FALSE, FALSE, sizeof (uint32_t)); + break; + } +} + +static void +_cogl_path_tesselator_add_index (CoglPathTesselator *tess, int vertex_index) +{ + switch (tess->indices_type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + { + uint8_t val = vertex_index; + g_array_append_val (tess->indices, val); + } + break; + + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + { + uint16_t val = vertex_index; + g_array_append_val (tess->indices, val); + } + break; + + case COGL_INDICES_TYPE_UNSIGNED_INT: + { + uint32_t val = vertex_index; + g_array_append_val (tess->indices, val); + } + break; + } +} + +static void +_cogl_path_tesselator_vertex (void *vertex_data, + CoglPathTesselator *tess) +{ + int vertex_index; + + vertex_index = GPOINTER_TO_INT (vertex_data); + + /* This tries to convert all of the primitives into GL_TRIANGLES + with indices to share vertices */ + switch (tess->primitive_type) + { + case GL_TRIANGLES: + /* Directly use the vertex */ + _cogl_path_tesselator_add_index (tess, vertex_index); + break; + + case GL_TRIANGLE_FAN: + if (tess->vertex_number == 0) + tess->index_a = vertex_index; + else if (tess->vertex_number == 1) + tess->index_b = vertex_index; + else + { + /* Create a triangle with the first vertex, the previous + vertex and this vertex */ + _cogl_path_tesselator_add_index (tess, tess->index_a); + _cogl_path_tesselator_add_index (tess, tess->index_b); + _cogl_path_tesselator_add_index (tess, vertex_index); + /* Next time we will use this vertex as the previous + vertex */ + tess->index_b = vertex_index; + } + break; + + case GL_TRIANGLE_STRIP: + if (tess->vertex_number == 0) + tess->index_a = vertex_index; + else if (tess->vertex_number == 1) + tess->index_b = vertex_index; + else + { + _cogl_path_tesselator_add_index (tess, tess->index_a); + _cogl_path_tesselator_add_index (tess, tess->index_b); + _cogl_path_tesselator_add_index (tess, vertex_index); + if (tess->vertex_number & 1) + tess->index_b = vertex_index; + else + tess->index_a = vertex_index; + } + break; + + default: + g_assert_not_reached (); + } + + tess->vertex_number++; +} + +static void +_cogl_path_tesselator_end (CoglPathTesselator *tess) +{ + tess->primitive_type = GL_FALSE; +} + +static void +_cogl_path_tesselator_combine (double coords[3], + void *vertex_data[4], + float weight[4], + void **out_data, + CoglPathTesselator *tess) +{ + CoglPathTesselatorVertex *vertex; + CoglIndicesType new_indices_type; + int i; + + /* Add a new vertex to the array */ + g_array_set_size (tess->vertices, tess->vertices->len + 1); + vertex = &g_array_index (tess->vertices, + CoglPathTesselatorVertex, + tess->vertices->len - 1); + /* The data is just the index to the vertex */ + *out_data = GINT_TO_POINTER (tess->vertices->len - 1); + /* Set the coordinates of the new vertex */ + vertex->x = coords[0]; + vertex->y = coords[1]; + /* Generate the texture coordinates as the weighted average of the + four incoming coordinates */ + vertex->s = 0.0f; + vertex->t = 0.0f; + for (i = 0; i < 4; i++) + { + CoglPathTesselatorVertex *old_vertex = + &g_array_index (tess->vertices, CoglPathTesselatorVertex, + GPOINTER_TO_INT (vertex_data[i])); + vertex->s += old_vertex->s * weight[i]; + vertex->t += old_vertex->t * weight[i]; + } + + /* Check if we've reached the limit for the data type of our indices */ + new_indices_type = + _cogl_path_tesselator_get_indices_type_for_size (tess->vertices->len); + if (new_indices_type != tess->indices_type) + { + CoglIndicesType old_indices_type = new_indices_type; + GArray *old_vertices = tess->indices; + + /* Copy the indices to an array of the new type */ + tess->indices_type = new_indices_type; + _cogl_path_tesselator_allocate_indices_array (tess); + + switch (old_indices_type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + for (i = 0; i < old_vertices->len; i++) + _cogl_path_tesselator_add_index (tess, + g_array_index (old_vertices, + uint8_t, i)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + for (i = 0; i < old_vertices->len; i++) + _cogl_path_tesselator_add_index (tess, + g_array_index (old_vertices, + uint16_t, i)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_INT: + for (i = 0; i < old_vertices->len; i++) + _cogl_path_tesselator_add_index (tess, + g_array_index (old_vertices, + uint32_t, i)); + break; + } + + g_array_free (old_vertices, TRUE); + } +} + +static void +_cogl_path_build_fill_attribute_buffer (CoglPath *path) +{ + CoglPathTesselator tess; + unsigned int path_start = 0; + CoglPathData *data = path->data; + int i; + + /* If we've already got a vbo then we don't need to do anything */ + if (data->fill_attribute_buffer) + return; + + tess.primitive_type = FALSE; + + /* Generate a vertex for each point on the path */ + tess.vertices = g_array_new (FALSE, FALSE, sizeof (CoglPathTesselatorVertex)); + g_array_set_size (tess.vertices, data->path_nodes->len); + for (i = 0; i < data->path_nodes->len; i++) + { + CoglPathNode *node = + &g_array_index (data->path_nodes, CoglPathNode, i); + CoglPathTesselatorVertex *vertex = + &g_array_index (tess.vertices, CoglPathTesselatorVertex, i); + + vertex->x = node->x; + vertex->y = node->y; + + /* Add texture coordinates so that a texture would be drawn to + fit the bounding box of the path and then cropped by the + path */ + if (data->path_nodes_min.x == data->path_nodes_max.x) + vertex->s = 0.0f; + else + vertex->s = ((node->x - data->path_nodes_min.x) + / (data->path_nodes_max.x - data->path_nodes_min.x)); + if (data->path_nodes_min.y == data->path_nodes_max.y) + vertex->t = 0.0f; + else + vertex->t = ((node->y - data->path_nodes_min.y) + / (data->path_nodes_max.y - data->path_nodes_min.y)); + } + + tess.indices_type = + _cogl_path_tesselator_get_indices_type_for_size (data->path_nodes->len); + _cogl_path_tesselator_allocate_indices_array (&tess); + + tess.glu_tess = gluNewTess (); + + if (data->fill_rule == COGL_PATH_FILL_RULE_EVEN_ODD) + gluTessProperty (tess.glu_tess, GLU_TESS_WINDING_RULE, + GLU_TESS_WINDING_ODD); + else + gluTessProperty (tess.glu_tess, GLU_TESS_WINDING_RULE, + GLU_TESS_WINDING_NONZERO); + + /* All vertices are on the xy-plane */ + gluTessNormal (tess.glu_tess, 0.0, 0.0, 1.0); + + gluTessCallback (tess.glu_tess, GLU_TESS_BEGIN_DATA, + _cogl_path_tesselator_begin); + gluTessCallback (tess.glu_tess, GLU_TESS_VERTEX_DATA, + _cogl_path_tesselator_vertex); + gluTessCallback (tess.glu_tess, GLU_TESS_END_DATA, + _cogl_path_tesselator_end); + gluTessCallback (tess.glu_tess, GLU_TESS_COMBINE_DATA, + _cogl_path_tesselator_combine); + + gluTessBeginPolygon (tess.glu_tess, &tess); + + while (path_start < data->path_nodes->len) + { + CoglPathNode *node = + &g_array_index (data->path_nodes, CoglPathNode, path_start); + + gluTessBeginContour (tess.glu_tess); + + for (i = 0; i < node->path_size; i++) + { + double vertex[3] = { node[i].x, node[i].y, 0.0 }; + gluTessVertex (tess.glu_tess, vertex, + GINT_TO_POINTER (i + path_start)); + } + + gluTessEndContour (tess.glu_tess); + + path_start += node->path_size; + } + + gluTessEndPolygon (tess.glu_tess); + + gluDeleteTess (tess.glu_tess); + + data->fill_attribute_buffer = + cogl_attribute_buffer_new (data->context, + sizeof (CoglPathTesselatorVertex) * + tess.vertices->len, + tess.vertices->data); + g_array_free (tess.vertices, TRUE); + + data->fill_attributes[0] = + cogl_attribute_new (data->fill_attribute_buffer, + "cogl_position_in", + sizeof (CoglPathTesselatorVertex), + G_STRUCT_OFFSET (CoglPathTesselatorVertex, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + data->fill_attributes[1] = + cogl_attribute_new (data->fill_attribute_buffer, + "cogl_tex_coord0_in", + sizeof (CoglPathTesselatorVertex), + G_STRUCT_OFFSET (CoglPathTesselatorVertex, s), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + data->fill_vbo_indices = cogl_indices_new (data->context, + tess.indices_type, + tess.indices->data, + tess.indices->len); + data->fill_vbo_n_indices = tess.indices->len; + g_array_free (tess.indices, TRUE); +} + +static CoglPrimitive * +_cogl_path_get_fill_primitive (CoglPath *path) +{ + if (path->data->fill_primitive) + return path->data->fill_primitive; + + _cogl_path_build_fill_attribute_buffer (path); + + path->data->fill_primitive = + cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + path->data->fill_vbo_n_indices, + path->data->fill_attributes, + COGL_PATH_N_ATTRIBUTES); + cogl_primitive_set_indices (path->data->fill_primitive, + path->data->fill_vbo_indices, + path->data->fill_vbo_n_indices); + + return path->data->fill_primitive; +} + +static CoglClipStack * +_cogl_clip_stack_push_from_path (CoglClipStack *stack, + CoglPath *path, + CoglMatrixEntry *modelview_entry, + CoglMatrixEntry *projection_entry, + const float *viewport) +{ + float x_1, y_1, x_2, y_2; + + _cogl_path_get_bounds (path, &x_1, &y_1, &x_2, &y_2); + + /* If the path is a simple rectangle then we can divert to pushing a + rectangle clip instead which usually won't involve the stencil + buffer */ + if (_cogl_path_is_rectangle (path)) + return _cogl_clip_stack_push_rectangle (stack, + x_1, y_1, + x_2, y_2, + modelview_entry, + projection_entry, + viewport); + else + { + CoglPrimitive *primitive = _cogl_path_get_fill_primitive (path); + + return _cogl_clip_stack_push_primitive (stack, + primitive, + x_1, y_1, x_2, y_2, + modelview_entry, + projection_entry, + viewport); + } +} + +void +cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer, + CoglPath *path) +{ + CoglMatrixEntry *modelview_entry = + _cogl_framebuffer_get_modelview_entry (framebuffer); + CoglMatrixEntry *projection_entry = + _cogl_framebuffer_get_projection_entry (framebuffer); + /* XXX: It would be nicer if we stored the private viewport as a + * vec4 so we could avoid this redundant copy. */ + float viewport[] = { + framebuffer->viewport_x, + framebuffer->viewport_y, + framebuffer->viewport_width, + framebuffer->viewport_height + }; + + framebuffer->clip_stack = + _cogl_clip_stack_push_from_path (framebuffer->clip_stack, + path, + modelview_entry, + projection_entry, + viewport); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +/* XXX: deprecated */ +void +cogl_clip_push_from_path (CoglPath *path) +{ + cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path); +} + +static void +_cogl_path_build_stroke_attribute_buffer (CoglPath *path) +{ + CoglPathData *data = path->data; + CoglBuffer *buffer; + unsigned int n_attributes = 0; + unsigned int path_start; + CoglPathNode *node; + floatVec2 *buffer_p; + unsigned int i; + + /* If we've already got a cached vbo then we don't need to do anything */ + if (data->stroke_attribute_buffer) + return; + + data->stroke_attribute_buffer = + cogl_attribute_buffer_new_with_size (data->context, + data->path_nodes->len * + sizeof (floatVec2)); + + buffer = COGL_BUFFER (data->stroke_attribute_buffer); + buffer_p = _cogl_buffer_map_for_fill_or_fallback (buffer); + + /* Copy the vertices in and count the number of sub paths. Each sub + path will form a separate attribute so we can paint the disjoint + line strips */ + for (path_start = 0; + path_start < data->path_nodes->len; + path_start += node->path_size) + { + node = &g_array_index (data->path_nodes, CoglPathNode, path_start); + + for (i = 0; i < node->path_size; i++) + { + buffer_p[path_start + i].x = node[i].x; + buffer_p[path_start + i].y = node[i].y; + } + + n_attributes++; + } + + _cogl_buffer_unmap_for_fill_or_fallback (buffer); + + data->stroke_attributes = g_new (CoglAttribute *, n_attributes); + + /* Now we can loop the sub paths again to create the attributes */ + for (i = 0, path_start = 0; + path_start < data->path_nodes->len; + i++, path_start += node->path_size) + { + node = &g_array_index (data->path_nodes, CoglPathNode, path_start); + + data->stroke_attributes[i] = + cogl_attribute_new (data->stroke_attribute_buffer, + "cogl_position_in", + sizeof (floatVec2), + path_start * sizeof (floatVec2), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + } + + data->stroke_n_attributes = n_attributes; +} + +/* XXX: deprecated */ +void +cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer)); + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_fill_nodes (path, framebuffer, pipeline, 0 /* flags */); +} + +/* XXX: deprecated */ +void +cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (framebuffer)); + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + _cogl_path_stroke_nodes (path, framebuffer, pipeline); +} diff --git a/cogl-path/cogl-path.h b/cogl-path/cogl-path.h new file mode 100644 index 0000000..4991bbe --- /dev/null +++ b/cogl-path/cogl-path.h @@ -0,0 +1,68 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PATH_H__ +#define __COGL_PATH_H__ + +/** + * SECTION:cogl-paths + * @short_description: Functions for constructing and drawing 2D paths. + * + * There are two levels on which drawing with cogl-paths can be used. + * The highest level functions construct various simple primitive + * shapes to be either filled or stroked. Using a lower-level set of + * functions more complex and arbitrary paths can be constructed by + * concatenating straight line, bezier curve and arc segments. + * + * When constructing arbitrary paths, the current pen location is + * initialized using the move_to command. The subsequent path segments + * implicitly use the last pen location as their first vertex and move + * the pen location to the last vertex they produce at the end. Also + * there are special versions of functions that allow specifying the + * vertices of the path segments relative to the last pen location + * rather then in the absolute coordinates. + */ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +#include + +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#else +#include +#endif + +#endif /* __COGL_PATH_H__ */ + diff --git a/cogl-path/cogl-path.pc.in b/cogl-path/cogl-path.pc.in new file mode 100644 index 0000000..d8b3beb --- /dev/null +++ b/cogl-path/cogl-path.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ + +Name: Cogl +Description: A 2D path drawing library for Cogl +Version: @COGL_VERSION@ +Libs: -L${libdir} -lcogl-path +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl-path/cogl-path.symbols b/cogl-path/cogl-path.symbols new file mode 100644 index 0000000..b643ec0 --- /dev/null +++ b/cogl-path/cogl-path.symbols @@ -0,0 +1,59 @@ +/* cogl1-path-functions.h */ +cogl_clip_push_from_path +cogl_clip_push_from_path_preserve +cogl_get_path +cogl_is_path +cogl_path_arc +cogl_path_close +cogl_path_copy +cogl_path_curve_to +cogl_path_ellipse +cogl_path_fill +cogl_path_fill_preserve +cogl_path_get_fill_rule +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_path_get_gtype +#endif +cogl_path_line +cogl_path_line_to +cogl_path_move_to +cogl_path_new +cogl_path_polygon +cogl_path_polyline +cogl_path_rectangle +cogl_path_rel_curve_to +cogl_path_rel_line_to +cogl_path_rel_move_to +cogl_path_round_rectangle +cogl_path_set_fill_rule +cogl_path_stroke +cogl_path_stroke_preserve +cogl_set_path + +/* cogl2-path-functions.h */ +cogl_framebuffer_fill_path +cogl_framebuffer_push_path_clip +cogl_framebuffer_stroke_path +cogl2_clip_push_from_path +cogl2_path_arc +cogl2_path_close +cogl2_path_curve_to +cogl2_path_ellipse +cogl2_path_fill +cogl2_path_get_fill_rule +cogl2_path_line +cogl2_path_line_to +cogl2_path_move_to +cogl2_path_new +cogl2_path_polygon +cogl2_path_polyline +cogl2_path_rectangle +cogl2_path_rel_curve_to +cogl2_path_rel_line_to +cogl2_path_rel_move_to +cogl2_path_round_rectangle +cogl2_path_set_fill_rule +cogl2_path_stroke + +/* cogl-path-enums.h-contents may change as header is generated */ +cogl_path_fill_rule_get_type diff --git a/cogl-path/cogl1-path-functions.h b/cogl-path/cogl1-path-functions.h new file mode 100644 index 0000000..18315ab --- /dev/null +++ b/cogl-path/cogl1-path-functions.h @@ -0,0 +1,467 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PATH_FUNCTIONS_H__ +#define __COGL_PATH_FUNCTIONS_H__ + +/* The functions are declared separately because cogl-path.c needs to + get the function declarations from the old 1.0 API without + colliding with the enum declarations from the 2.0 API */ + +#include + +COGL_BEGIN_DECLS + +/** + * cogl_is_path: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing path object. + * + * Return value: %TRUE if the handle references a #CoglPath, + * %FALSE otherwise + */ +CoglBool +cogl_is_path (CoglHandle handle); + +/** + * cogl_path_set_fill_rule: + * @fill_rule: The new fill rule. + * + * Sets the fill rule of the current path to @fill_rule. This will + * affect how the path is filled when cogl_path_fill() is later + * called. Note that the fill rule state is attached to the path so + * calling cogl_get_path() will preserve the fill rule and calling + * cogl_path_new() will reset the fill rule back to the default. + * + * Since: 1.4 + */ +void +cogl_path_set_fill_rule (CoglPathFillRule fill_rule); + +/** + * cogl_path_get_fill_rule: + * + * Retrieves the fill rule set using cogl_path_set_fill_rule(). + * + * Return value: the fill rule that is used for the current path. + * + * Since: 1.4 + */ +CoglPathFillRule +cogl_path_get_fill_rule (void); + +/** + * cogl_path_fill: + * + * Fills the interior of the constructed shape using the current + * drawing color. The current path is then cleared. To use the path + * again, call cogl_path_fill_preserve() instead. + * + * The interior of the shape is determined using the fill rule of the + * path. See %CoglPathFillRule for details. + **/ +void +cogl_path_fill (void); + +/** + * cogl_path_fill_preserve: + * + * Fills the interior of the constructed shape using the current + * drawing color and preserves the path to be used again. See + * cogl_path_fill() for a description what is considered the interior + * of the shape. + * + * Since: 1.0 + **/ +void +cogl_path_fill_preserve (void); + +/** + * cogl_path_stroke: + * + * Strokes the constructed shape using the current drawing color and a + * width of 1 pixel (regardless of the current transformation + * matrix). To current path is then cleared. To use the path again, + * call cogl_path_stroke_preserve() instead. + **/ +void +cogl_path_stroke (void); + +/** + * cogl_path_stroke_preserve: + * + * Strokes the constructed shape using the current drawing color and + * preserves the path to be used again. + * + * Since: 1.0 + **/ +void +cogl_path_stroke_preserve (void); + +/** + * cogl_path_new: + * + * Clears the current path and starts a new one. Creating a new path + * also resets the fill rule to the default which is + * %COGL_PATH_FILL_RULE_EVEN_ODD. + * + * Since: 1.0 + */ +void +cogl_path_new (void); + +/** + * cogl_path_move_to: + * @x: X coordinate of the pen location to move to. + * @y: Y coordinate of the pen location to move to. + * + * Moves the pen to the given location. If there is an existing path + * this will start a new disjoint subpath. + **/ +void +cogl_path_move_to (float x, + float y); + + +/** + * cogl_path_rel_move_to: + * @x: X offset from the current pen location to move the pen to. + * @y: Y offset from the current pen location to move the pen to. + * + * Moves the pen to the given offset relative to the current pen + * location. If there is an existing path this will start a new + * disjoint subpath. + **/ +void +cogl_path_rel_move_to (float x, + float y); + +/** + * cogl_path_line_to: + * @x: X coordinate of the end line vertex + * @y: Y coordinate of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates. + **/ +void +cogl_path_line_to (float x, + float y); + +/** + * cogl_path_rel_line_to: + * @x: X offset from the current pen location of the end line vertex + * @y: Y offset from the current pen location of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates relative to the current pen location. + **/ +void +cogl_path_rel_line_to (float x, + float y); + + +/** + * cogl_path_arc: + * @center_x: X coordinate of the elliptical arc center + * @center_y: Y coordinate of the elliptical arc center + * @radius_x: X radius of the elliptical arc + * @radius_y: Y radius of the elliptical arc + * @angle_1: Angle in degrees at which the arc begin + * @angle_2: Angle in degrees at which the arc ends + * + * Adds an elliptical arc segment to the current path. A straight line + * segment will link the current pen location with the first vertex + * of the arc. If you perform a move_to to the arcs start just before + * drawing it you create a free standing arc. + * + * The angles are measured in degrees where 0° is in the direction of + * the positive X axis and 90° is in the direction of the positive Y + * axis. The angle of the arc begins at @angle_1 and heads towards + * @angle_2 (so if @angle_2 is less than @angle_1 it will decrease, + * otherwise it will increase). + **/ +void +cogl_path_arc (float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2); + +/** + * cogl_path_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. + **/ +void +cogl_path_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +/** + * cogl_path_rel_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. The given coordinates are relative to the + * current pen location. + */ +void +cogl_path_rel_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +/** + * cogl_path_close: + * + * Closes the path being constructed by adding a straight line segment + * to it that ends at the first vertex of the path. + **/ +void +cogl_path_close (void); + +/** + * cogl_path_line: + * @x_1: X coordinate of the start line vertex + * @y_1: Y coordinate of the start line vertex + * @x_2: X coordinate of the end line vertex + * @y_2: Y coordinate of the end line vertex + * + * Constructs a straight line shape starting and ending at the given + * coordinates. If there is an existing path this will start a new + * disjoint sub-path. + **/ +void +cogl_path_line (float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_path_polyline: + * @coords: (in) (array) (transfer none): A pointer to the first element of an + * array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a series of straight line segments, starting from the + * first given vertex coordinate. If there is an existing path this + * will start a new disjoint sub-path. Each subsequent segment starts + * where the previous one ended and ends at the next given vertex + * coordinate. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. (num_points - 1) segments will + * be constructed. + **/ +void +cogl_path_polyline (const float *coords, + int num_points); + + +/** + * cogl_path_polygon: + * @coords: (in) (array) (transfer none): A pointer to the first element of + * an array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a polygonal shape of the given number of vertices. If + * there is an existing path this will start a new disjoint sub-path. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. + **/ +void +cogl_path_polygon (const float *coords, + int num_points); + + +/** + * cogl_path_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * + * Constructs a rectangular shape at the given coordinates. If there + * is an existing path this will start a new disjoint sub-path. + **/ +void +cogl_path_rectangle (float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_path_ellipse: + * @center_x: X coordinate of the ellipse center + * @center_y: Y coordinate of the ellipse center + * @radius_x: X radius of the ellipse + * @radius_y: Y radius of the ellipse + * + * Constructs an ellipse shape. If there is an existing path this will + * start a new disjoint sub-path. + **/ +void +cogl_path_ellipse (float center_x, + float center_y, + float radius_x, + float radius_y); + +/** + * cogl_path_round_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * @radius: Radius of the corner arcs. + * @arc_step: Angle increment resolution for subdivision of + * the corner arcs. + * + * Constructs a rectangular shape with rounded corners. If there is an + * existing path this will start a new disjoint sub-path. + **/ +void +cogl_path_round_rectangle (float x_1, + float y_1, + float x_2, + float y_2, + float radius, + float arc_step); + +/** + * cogl_get_path: (skip) + * + * Gets a pointer to the current path. The path can later be used + * again by calling cogl_path_set(). Note that the path isn't copied + * so if you later call any functions to add to the path it will + * affect the returned object too. No reference is taken on the path + * so if you want to retain it you should take your own reference with + * cogl_object_ref(). + * + * Return value: a pointer to the current path. + * + * Since: 1.4 + */ +CoglPath * +cogl_get_path (void); + +/** + * cogl_set_path: (skip) + * @path: A #CoglPath object + * + * Replaces the current path with @path. A reference is taken on the + * object so if you no longer need the path you should unref with + * cogl_object_unref(). + * + * Since: 1.4 + */ +void +cogl_set_path (CoglPath *path); + +/** + * cogl_path_copy: (skip) + * @path: A #CoglPath object + * + * Returns a new copy of the path in @path. The new path has a + * reference count of 1 so you should unref it with + * cogl_object_unref() if you no longer need it. + * + * Internally the path will share the data until one of the paths is + * modified so copying paths should be relatively cheap. + * + * Return value: (transfer full): a copy of the path in @path. + */ +CoglPath * +cogl_path_copy (CoglPath *path); + +/** + * cogl_clip_push_from_path_preserve: + * + * Sets a new clipping area using the current path. The current path + * is then cleared. The clipping area is intersected with the previous + * clipping area. To restore the previous clipping area, call + * cogl_clip_pop(). + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_path_clip) +void +cogl_clip_push_from_path_preserve (void); + +/** + * cogl_clip_push_from_path: + * + * Sets a new clipping area using the current path. The current path + * is then cleared. The clipping area is intersected with the previous + * clipping area. To restore the previous clipping area, call + * cogl_clip_pop(). + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_path_clip) +void +cogl_clip_push_from_path (void); + +COGL_END_DECLS + +#endif /* __COGL_PATH_FUNCTIONS_H__ */ + diff --git a/cogl-path/cogl1-path.c b/cogl-path/cogl1-path.c new file mode 100644 index 0000000..b2c5923 --- /dev/null +++ b/cogl-path/cogl1-path.c @@ -0,0 +1,353 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-object.h" +#include "cogl-context-private.h" + +#include "cogl-path-types.h" + +#include "cogl2-path-functions.h" + +#undef cogl_path_set_fill_rule +#undef cogl_path_get_fill_rule +#undef cogl_path_fill +#undef cogl_path_fill_preserve +#undef cogl_path_stroke +#undef cogl_path_stroke_preserve +#undef cogl_path_move_to +#undef cogl_path_rel_move_to +#undef cogl_path_line_to +#undef cogl_path_rel_line_to +#undef cogl_path_close +#undef cogl_path_new +#undef cogl_path_line +#undef cogl_path_polyline +#undef cogl_path_polygon +#undef cogl_path_rectangle +#undef cogl_path_arc +#undef cogl_path_ellipse +#undef cogl_path_round_rectangle +#undef cogl_path_curve_to +#undef cogl_path_rel_curve_to +#undef cogl_clip_push_from_path + +#include "cogl1-path-functions.h" + +#include +#include + +static void +ensure_current_path (CoglContext *ctx) +{ + if (ctx->current_path == NULL) + ctx->current_path = cogl2_path_new (); +} + +static CoglPath * +get_current_path (CoglContext *ctx) +{ + ensure_current_path (ctx); + return ctx->current_path; +} + +void +cogl_path_set_fill_rule (CoglPathFillRule fill_rule) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_set_fill_rule (get_current_path (ctx), fill_rule); +} + +CoglPathFillRule +cogl_path_get_fill_rule (void) +{ + _COGL_GET_CONTEXT (ctx, COGL_PATH_FILL_RULE_EVEN_ODD); + + return cogl2_path_get_fill_rule (get_current_path (ctx)); +} + +void +cogl_path_fill (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_fill (get_current_path (ctx)); + + if (ctx->current_path) + cogl_object_unref (ctx->current_path); + ctx->current_path = cogl2_path_new (); +} + +void +cogl_path_fill_preserve (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_fill (get_current_path (ctx)); +} + +void +cogl_path_stroke (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_stroke (get_current_path (ctx)); + + if (ctx->current_path) + cogl_object_unref (ctx->current_path); + ctx->current_path = cogl2_path_new (); +} + +void +cogl_path_stroke_preserve (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_stroke (get_current_path (ctx)); +} + +void +cogl_path_move_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_move_to (get_current_path (ctx), x, y); +} + +void +cogl_path_rel_move_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rel_move_to (get_current_path (ctx), x, y); +} + +void +cogl_path_line_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_line_to (get_current_path (ctx), x, y); +} + +void +cogl_path_rel_line_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rel_line_to (get_current_path (ctx), x, y); +} + +void +cogl_path_close (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_close (get_current_path (ctx)); +} + +void +cogl_path_new (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->current_path) + cogl_object_unref (ctx->current_path); + ctx->current_path = cogl2_path_new (); +} + +void +cogl_path_line (float x_1, + float y_1, + float x_2, + float y_2) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_line (get_current_path (ctx), x_1, y_1, x_2, y_2); +} + +void +cogl_path_polyline (const float *coords, + int num_points) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_polyline (get_current_path (ctx), coords, num_points); +} + +void +cogl_path_polygon (const float *coords, + int num_points) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_polygon (get_current_path (ctx), coords, num_points); +} + +void +cogl_path_rectangle (float x_1, + float y_1, + float x_2, + float y_2) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rectangle (get_current_path (ctx), x_1, y_1, x_2, y_2); +} + +void +cogl_path_arc (float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_arc (get_current_path (ctx), + center_x, + center_y, + radius_x, + radius_y, + angle_1, + angle_2); +} + +void +cogl_path_ellipse (float center_x, + float center_y, + float radius_x, + float radius_y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_ellipse (get_current_path (ctx), + center_x, + center_y, + radius_x, + radius_y); +} + +void +cogl_path_round_rectangle (float x_1, + float y_1, + float x_2, + float y_2, + float radius, + float arc_step) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_round_rectangle (get_current_path (ctx), + x_1, y_1, x_2, y_2, radius, arc_step); +} + +void +cogl_path_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_curve_to (get_current_path (ctx), + x_1, y_1, x_2, y_2, x_3, y_3); +} + +void +cogl_path_rel_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rel_curve_to (get_current_path (ctx), + x_1, y_1, x_2, y_2, x_3, y_3); +} + +CoglPath * +cogl_get_path (void) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + return get_current_path (ctx); +} + +void +cogl_set_path (CoglPath *path) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + /* Reference the new object first in case it is the same as the old + object */ + cogl_object_ref (path); + if (ctx->current_path) + cogl_object_unref (ctx->current_path); + ctx->current_path = path; +} + +void +cogl_clip_push_from_path_preserve (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), + get_current_path (ctx)); +} + +void +cogl_clip_push_from_path (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl_clip_push_from_path_preserve (); + + if (ctx->current_path) + cogl_object_unref (ctx->current_path); + ctx->current_path = cogl2_path_new (); +} diff --git a/cogl-path/cogl2-path-functions.h b/cogl-path/cogl2-path-functions.h new file mode 100644 index 0000000..72c1fc8 --- /dev/null +++ b/cogl-path/cogl2-path-functions.h @@ -0,0 +1,545 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL2_PATH_FUNCTIONS_H__ +#define __COGL2_PATH_FUNCTIONS_H__ + +#include +#ifdef COGL_COMPILATION +#include "cogl-context.h" +#else +#include +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_path_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_path_get_gtype (void); +#endif + +#define cogl_path_new cogl2_path_new +/** + * cogl_path_new: + * + * Creates a new, empty path object. The default fill rule is + * %COGL_PATH_FILL_RULE_EVEN_ODD. + * + * Return value: A pointer to a newly allocated #CoglPath, which can + * be freed using cogl_object_unref(). + * + * Since: 2.0 + */ +CoglPath * +cogl_path_new (void); + +/** + * cogl_path_copy: + * @path: A #CoglPath object + * + * Returns a new copy of the path in @path. The new path has a + * reference count of 1 so you should unref it with + * cogl_object_unref() if you no longer need it. + * + * Internally the path will share the data until one of the paths is + * modified so copying paths should be relatively cheap. + * + * Return value: (transfer full): a copy of the path in @path. + * + * Since: 2.0 + */ +CoglPath * +cogl_path_copy (CoglPath *path); + +/** + * cogl_is_path: + * @object: A #CoglObject + * + * Gets whether the given object references an existing path object. + * + * Return value: %TRUE if the object references a #CoglPath, + * %FALSE otherwise. + * + * Since: 2.0 + */ +CoglBool +cogl_is_path (void *object); + +#define cogl_path_move_to cogl2_path_move_to +/** + * cogl_path_move_to: + * @x: X coordinate of the pen location to move to. + * @y: Y coordinate of the pen location to move to. + * + * Moves the pen to the given location. If there is an existing path + * this will start a new disjoint subpath. + * + * Since: 2.0 + */ +void +cogl_path_move_to (CoglPath *path, + float x, + float y); + +#define cogl_path_rel_move_to cogl2_path_rel_move_to +/** + * cogl_path_rel_move_to: + * @x: X offset from the current pen location to move the pen to. + * @y: Y offset from the current pen location to move the pen to. + * + * Moves the pen to the given offset relative to the current pen + * location. If there is an existing path this will start a new + * disjoint subpath. + * + * Since: 2.0 + */ +void +cogl_path_rel_move_to (CoglPath *path, + float x, + float y); + +#define cogl_path_line_to cogl2_path_line_to +/** + * cogl_path_line_to: + * @x: X coordinate of the end line vertex + * @y: Y coordinate of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates. + * + * Since: 2.0 + */ +void +cogl_path_line_to (CoglPath *path, + float x, + float y); + +#define cogl_path_rel_line_to cogl2_path_rel_line_to +/** + * cogl_path_rel_line_to: + * @x: X offset from the current pen location of the end line vertex + * @y: Y offset from the current pen location of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates relative to the current pen location. + * + * Since: 2.0 + */ +void +cogl_path_rel_line_to (CoglPath *path, + float x, + float y); + +#define cogl_path_arc cogl2_path_arc +/** + * cogl_path_arc: + * @center_x: X coordinate of the elliptical arc center + * @center_y: Y coordinate of the elliptical arc center + * @radius_x: X radius of the elliptical arc + * @radius_y: Y radius of the elliptical arc + * @angle_1: Angle in degrees at which the arc begin + * @angle_2: Angle in degrees at which the arc ends + * + * Adds an elliptical arc segment to the current path. A straight line + * segment will link the current pen location with the first vertex + * of the arc. If you perform a move_to to the arcs start just before + * drawing it you create a free standing arc. + * + * The angles are measured in degrees where 0° is in the direction of + * the positive X axis and 90° is in the direction of the positive Y + * axis. The angle of the arc begins at @angle_1 and heads towards + * @angle_2 (so if @angle_2 is less than @angle_1 it will decrease, + * otherwise it will increase). + * + * Since: 2.0 + */ +void +cogl_path_arc (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2); + +#define cogl_path_curve_to cogl2_path_curve_to +/** + * cogl_path_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. + * + * Since: 2.0 + */ +void +cogl_path_curve_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +#define cogl_path_rel_curve_to cogl2_path_rel_curve_to +/** + * cogl_path_rel_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. The given coordinates are relative to the + * current pen location. + * + * Since: 2.0 + */ +void +cogl_path_rel_curve_to (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +#define cogl_path_close cogl2_path_close +/** + * cogl_path_close: + * + * Closes the path being constructed by adding a straight line segment + * to it that ends at the first vertex of the path. + * + * Since: 2.0 + */ +void +cogl_path_close (CoglPath *path); + +#define cogl_path_line cogl2_path_line +/** + * cogl_path_line: + * @x_1: X coordinate of the start line vertex + * @y_1: Y coordinate of the start line vertex + * @x_2: X coordinate of the end line vertex + * @y_2: Y coordinate of the end line vertex + * + * Constructs a straight line shape starting and ending at the given + * coordinates. If there is an existing path this will start a new + * disjoint sub-path. + * + * Since: 2.0 + */ +void +cogl_path_line (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2); + +#define cogl_path_polyline cogl2_path_polyline +/** + * cogl_path_polyline: + * @coords: (in) (array) (transfer none): A pointer to the first element of an + * array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a series of straight line segments, starting from the + * first given vertex coordinate. If there is an existing path this + * will start a new disjoint sub-path. Each subsequent segment starts + * where the previous one ended and ends at the next given vertex + * coordinate. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. (num_points - 1) segments will + * be constructed. + * + * Since: 2.0 + */ +void +cogl_path_polyline (CoglPath *path, + const float *coords, + int num_points); + +#define cogl_path_polygon cogl2_path_polygon +/** + * cogl_path_polygon: + * @coords: (in) (array) (transfer none): A pointer to the first element of + * an array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a polygonal shape of the given number of vertices. If + * there is an existing path this will start a new disjoint sub-path. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. + * + * Since: 2.0 + */ +void +cogl_path_polygon (CoglPath *path, + const float *coords, + int num_points); + +#define cogl_path_rectangle cogl2_path_rectangle +/** + * cogl_path_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * + * Constructs a rectangular shape at the given coordinates. If there + * is an existing path this will start a new disjoint sub-path. + * + * Since: 2.0 + */ +void +cogl_path_rectangle (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2); + +#define cogl_path_ellipse cogl2_path_ellipse +/** + * cogl_path_ellipse: + * @center_x: X coordinate of the ellipse center + * @center_y: Y coordinate of the ellipse center + * @radius_x: X radius of the ellipse + * @radius_y: Y radius of the ellipse + * + * Constructs an ellipse shape. If there is an existing path this will + * start a new disjoint sub-path. + * + * Since: 2.0 + */ +void +cogl_path_ellipse (CoglPath *path, + float center_x, + float center_y, + float radius_x, + float radius_y); + +#define cogl_path_round_rectangle cogl2_path_round_rectangle +/** + * cogl_path_round_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * @radius: Radius of the corner arcs. + * @arc_step: Angle increment resolution for subdivision of + * the corner arcs. + * + * Constructs a rectangular shape with rounded corners. If there is an + * existing path this will start a new disjoint sub-path. + * + * Since: 2.0 + */ +void +cogl_path_round_rectangle (CoglPath *path, + float x_1, + float y_1, + float x_2, + float y_2, + float radius, + float arc_step); + +#define cogl_path_set_fill_rule cogl2_path_set_fill_rule +/** + * cogl_path_set_fill_rule: + * @fill_rule: The new fill rule. + * + * Sets the fill rule of the current path to @fill_rule. This will + * affect how the path is filled when cogl_path_fill() is later + * called. Note that the fill rule state is attached to the path so + * calling cogl_get_path() will preserve the fill rule and calling + * cogl_path_new() will reset the fill rule back to the default. + * + * Since: 2.0 + */ +void +cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule); + +#define cogl_path_get_fill_rule cogl2_path_get_fill_rule +/** + * cogl_path_get_fill_rule: + * + * Retrieves the fill rule set using cogl_path_set_fill_rule(). + * + * Return value: the fill rule that is used for the current path. + * + * Since: 2.0 + */ +CoglPathFillRule +cogl_path_get_fill_rule (CoglPath *path); + +#define cogl_path_fill cogl2_path_fill +/** + * cogl_path_fill: + * + * Fills the interior of the constructed shape using the current + * drawing color. + * + * The interior of the shape is determined using the fill rule of the + * path. See %CoglPathFillRule for details. + * + * The result of referencing sliced textures in your current + * pipeline when filling a path are undefined. You should pass + * the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will + * use while filling a path. + * + * Since: 2.0 + */ +void +cogl_path_fill (CoglPath *path); + +/** + * cogl_framebuffer_fill_path: + * @framebuffer: A #CoglFramebuffer + * @pipeline: A #CoglPipeline to render with + * @path: The #CoglPath to fill + * + * Fills the interior of the path using the fragment operations + * defined by the pipeline. + * + * The interior of the shape is determined using the fill rule of the + * path. See %CoglPathFillRule for details. + * + * The result of referencing sliced textures in your current + * pipeline when filling a path are undefined. You should pass + * the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will + * use while filling a path. + * + * Stability: unstable + * Deprecated: 1.16: Use cogl_path_fill() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_path_fill) +void +cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPath *path); + +#define cogl_path_stroke cogl2_path_stroke +/** + * cogl_path_stroke: + * + * Strokes the constructed shape using the current drawing color and a + * width of 1 pixel (regardless of the current transformation + * matrix). + * + * Since: 2.0 + */ +void +cogl_path_stroke (CoglPath *path); + +/** + * cogl_framebuffer_stroke_path: + * @framebuffer: A #CoglFramebuffer + * @pipeline: A #CoglPipeline to render with + * @path: The #CoglPath to stroke + * + * Strokes the edge of the path using the fragment operations defined + * by the pipeline. The stroke line will have a width of 1 pixel + * regardless of the current transformation matrix. + * + * Stability: unstable + * Deprecated: 1.16: Use cogl_path_stroke() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_path_stroke) +void +cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPath *path); + +/** + * cogl_framebuffer_push_path_clip: + * @framebuffer: A #CoglFramebuffer pointer + * @path: The path to clip with. + * + * Sets a new clipping area using the silhouette of the specified, + * filled @path. The clipping area is intersected with the previous + * clipping area. To restore the previous clipping area, call + * cogl_framebuffer_pop_clip(). + * + * Since: 1.0 + * Stability: unstable + */ +void +cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer, + CoglPath *path); + +#define cogl_clip_push_from_path cogl2_clip_push_from_path +/** + * cogl_clip_push_from_path: + * @path: The path to clip with. + * + * Sets a new clipping area using the silhouette of the specified, + * filled @path. The clipping area is intersected with the previous + * clipping area. To restore the previous clipping area, call + * call cogl_clip_pop(). + * + * Since: 1.8 + * Stability: Unstable + * Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_path_clip) +void +cogl_clip_push_from_path (CoglPath *path); + +COGL_END_DECLS + +#endif /* __COGL2_PATH_FUNCTIONS_H__ */ + diff --git a/cogl-path/tesselator/GL/glu.h b/cogl-path/tesselator/GL/glu.h new file mode 100644 index 0000000..18c4024 --- /dev/null +++ b/cogl-path/tesselator/GL/glu.h @@ -0,0 +1,47 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* This is just a wrapper to use our simplified version of glu.h so + that the tesselator code can still #include */ + +#include "../tesselator.h" + +/* These aren't defined on GLES and we don't really want the + tesselator code to use them but we're also trying to avoid + modifying the C files so we just force them to be empty here */ + +#undef GLAPI +#define GLAPI + +#undef GLAPIENTRY +#define GLAPIENTRY + +/* GLES doesn't define a GLdouble type so lets just force it to a + regular double */ +#define GLdouble double diff --git a/cogl-path/tesselator/README b/cogl-path/tesselator/README new file mode 100644 index 0000000..66a6011 --- /dev/null +++ b/cogl-path/tesselator/README @@ -0,0 +1,446 @@ +/* +*/ + +General Polygon Tesselation +--------------------------- + + This note describes a tesselator for polygons consisting of one or + more closed contours. It is backward-compatible with the current + OpenGL Utilities tesselator, and is intended to replace it. Here is + a summary of the major differences: + + - input contours can be intersecting, self-intersecting, or degenerate. + + - supports a choice of several winding rules for determining which parts + of the polygon are on the "interior". This makes it possible to do + CSG operations on polygons. + + - boundary extraction: instead of tesselating the polygon, returns a + set of closed contours which separate the interior from the exterior. + + - returns the output as a small number of triangle fans and strips, + rather than a list of independent triangles (when possible). + + - output is available as an explicit mesh (a quad-edge structure), + in addition to the normal callback interface. + + - the algorithm used is extremely robust. + + +The interface +------------- + + The tesselator state is maintained in a "tesselator object". + These are allocated and destroyed using + + GLUtesselator *gluNewTess( void ); + void gluDeleteTess( GLUtesselator *tess ); + + Several tesselator objects may be used simultaneously. + + Inputs + ------ + + The input contours are specified with the following routines: + + void gluTessBeginPolygon( GLUtesselator *tess ); + void gluTessBeginContour( GLUtesselator *tess ); + void gluTessVertex( GLUtesselator *tess, GLUcoord coords[3], void *data ); + void gluTessEndContour( GLUtesselator *tess ); + void gluTessEndPolygon( GLUtesselator *tess ); + + Within each BeginPolygon/EndPolygon pair, there can be zero or more + calls to BeginContour/EndContour. Within each contour, there are zero + or more calls to gluTessVertex(). The vertices specify a closed + contour (the last vertex of each contour is automatically linked to + the first). + + "coords" give the coordinates of the vertex in 3-space. For useful + results, all vertices should lie in some plane, since the vertices + are projected onto a plane before tesselation. "data" is a pointer + to a user-defined vertex structure, which typically contains other + information such as color, texture coordinates, normal, etc. It is + used to refer to the vertex during rendering. + + The library can be compiled in single- or double-precision; the type + GLUcoord represents either "float" or "double" accordingly. The GLU + version will be available in double-precision only. Compile with + GLU_TESS_API_FLOAT defined to get the single-precision version. + + When EndPolygon is called, the tesselation algorithm determines + which regions are interior to the given contours, according to one + of several "winding rules" described below. The interior regions + are then tesselated, and the output is provided as callbacks. + + + Rendering Callbacks + ------------------- + + Callbacks are specified by the client using + + void gluTessCallback( GLUtesselator *tess, GLenum which, void (*fn)()); + + If "fn" is NULL, any previously defined callback is discarded. + + The callbacks used to provide output are: /* which == */ + + void begin( GLenum type ); /* GLU_TESS_BEGIN */ + void edgeFlag( GLboolean flag ); /* GLU_TESS_EDGE_FLAG */ + void vertex( void *data ); /* GLU_TESS_VERTEX */ + void end( void ); /* GLU_TESS_END */ + + Any of the callbacks may be left undefined; if so, the corresponding + information will not be supplied during rendering. + + The "begin" callback indicates the start of a primitive; type is one + of GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES (but see the + notes on "boundary extraction" below). + + It is followed by any number of "vertex" callbacks, which supply the + vertices in the same order as expected by the corresponding glBegin() + call. After the last vertex of a given primitive, there is a callback + to "end". + + If the "edgeFlag" callback is provided, no triangle fans or strips + will be used. When edgeFlag is called, if "flag" is GL_TRUE then each + vertex which follows begins an edge which lies on the polygon boundary + (ie. an edge which separates an interior region from an exterior one). + If "flag" is GL_FALSE, each vertex which follows begins an edge which lies + in the polygon interior. "edgeFlag" will be called before the first + call to "vertex". + + Other Callbacks + --------------- + + void mesh( GLUmesh *mesh ); /* GLU_TESS_MESH */ + + - Returns an explicit mesh, represented using the quad-edge structure + (Guibas/Stolfi '85). Other implementations of this interface might + use a different mesh structure, so this is available only only as an + SGI extension. When the mesh is no longer needed, it should be freed + using + + void gluDeleteMesh( GLUmesh *mesh ); + + There is a brief description of this data structure in the include + file "mesh.h". For the full details, see L. Guibas and J. Stolfi, + Primitives for the manipulation of general subdivisions and the + computation of Voronoi diagrams, ACM Transactions on Graphics, + 4(2):74-123, April 1985. For an introduction, see the course notes + for CS348a, "Mathematical Foundations of Computer Graphics", + available at the Stanford bookstore (and taught during the fall + quarter). + + void error( GLenum errno ); /* GLU_TESS_ERROR */ + + - errno is one of GLU_TESS_MISSING_BEGIN_POLYGON, + GLU_TESS_MISSING_END_POLYGON, + GLU_TESS_MISSING_BEGIN_CONTOUR, + GLU_TESS_MISSING_END_CONTOUR, + GLU_TESS_COORD_TOO_LARGE, + GLU_TESS_NEED_COMBINE_CALLBACK + + The first four are obvious. The interface recovers from these + errors by inserting the missing call(s). + + GLU_TESS_COORD_TOO_LARGE says that some vertex coordinate exceeded + the predefined constant GLU_TESS_MAX_COORD in absolute value, and + that the value has been clamped. (Coordinate values must be small + enough so that two can be multiplied together without overflow.) + + GLU_TESS_NEED_COMBINE_CALLBACK says that the algorithm detected an + intersection between two edges in the input data, and the "combine" + callback (below) was not provided. No output will be generated. + + + void combine( GLUcoord coords[3], void *data[4], /* GLU_TESS_COMBINE */ + GLUcoord weight[4], void **outData ); + + - When the algorithm detects an intersection, or wishes to merge + features, it needs to create a new vertex. The vertex is defined + as a linear combination of up to 4 existing vertices, referenced + by data[0..3]. The coefficients of the linear combination are + given by weight[0..3]; these weights always sum to 1.0. All vertex + pointers are valid even when some of the weights are zero. + "coords" gives the location of the new vertex. + + The user must allocate another vertex, interpolate parameters + using "data" and "weights", and return the new vertex pointer in + "outData". This handle is supplied during rendering callbacks. + For example, if the polygon lies in an arbitrary plane in 3-space, + and we associate a color with each vertex, the combine callback might + look like this: + + void myCombine( GLUcoord coords[3], VERTEX *d[4], + GLUcoord w[4], VERTEX **dataOut ) + { + VERTEX *new = new_vertex(); + + new->x = coords[0]; + new->y = coords[1]; + new->z = coords[2]; + new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r; + new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g; + new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b; + new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a; + *dataOut = new; + } + + If the algorithm detects an intersection, then the "combine" callback + must be defined, and must write a non-NULL pointer into "dataOut". + Otherwise the GLU_TESS_NEED_COMBINE_CALLBACK error occurs, and no + output is generated. This is the only error that can occur during + tesselation and rendering. + + + Control over Tesselation + ------------------------ + + void gluTessProperty( GLUtesselator *tess, GLenum which, GLUcoord value ); + + Properties defined: + + - GLU_TESS_WINDING_RULE. Possible values: + + GLU_TESS_WINDING_ODD + GLU_TESS_WINDING_NONZERO + GLU_TESS_WINDING_POSITIVE + GLU_TESS_WINDING_NEGATIVE + GLU_TESS_WINDING_ABS_GEQ_TWO + + The input contours parition the plane into regions. A winding + rule determines which of these regions are inside the polygon. + + For a single contour C, the winding number of a point x is simply + the signed number of revolutions we make around x as we travel + once around C (where CCW is positive). When there are several + contours, the individual winding numbers are summed. This + procedure associates a signed integer value with each point x in + the plane. Note that the winding number is the same for all + points in a single region. + + The winding rule classifies a region as "inside" if its winding + number belongs to the chosen category (odd, nonzero, positive, + negative, or absolute value of at least two). The current GLU + tesselator implements the "odd" rule. The "nonzero" rule is another + common way to define the interior. The other three rules are + useful for polygon CSG operations (see below). + + - GLU_TESS_BOUNDARY_ONLY. Values: TRUE (non-zero) or FALSE (zero). + + If TRUE, returns a set of closed contours which separate the + polygon interior and exterior (rather than a tesselation). + Exterior contours are oriented CCW with respect to the normal, + interior contours are oriented CW. The GLU_TESS_BEGIN callback + uses the type GL_LINE_LOOP for each contour. + + - GLU_TESS_TOLERANCE. Value: a real number between 0.0 and 1.0. + + This specifies a tolerance for merging features to reduce the size + of the output. For example, two vertices which are very close to + each other might be replaced by a single vertex. The tolerance + is multiplied by the largest coordinate magnitude of any input vertex; + this specifies the maximum distance that any feature can move as the + result of a single merge operation. If a single feature takes part + in several merge operations, the total distance moved could be larger. + + Feature merging is completely optional; the tolerance is only a hint. + The implementation is free to merge in some cases and not in others, + or to never merge features at all. The default tolerance is zero. + + The current implementation merges vertices only if they are exactly + coincident, regardless of the current tolerance. A vertex is + spliced into an edge only if the implementation is unable to + distinguish which side of the edge the vertex lies on. + Two edges are merged only when both endpoints are identical. + + + void gluTessNormal( GLUtesselator *tess, + GLUcoord x, GLUcoord y, GLUcoord z ) + + - Lets the user supply the polygon normal, if known. All input data + is projected into a plane perpendicular to the normal before + tesselation. All output triangles are oriented CCW with + respect to the normal (CW orientation can be obtained by + reversing the sign of the supplied normal). For example, if + you know that all polygons lie in the x-y plane, call + "gluTessNormal(tess, 0.0, 0.0, 1.0)" before rendering any polygons. + + - If the supplied normal is (0,0,0) (the default value), the + normal is determined as follows. The direction of the normal, + up to its sign, is found by fitting a plane to the vertices, + without regard to how the vertices are connected. It is + expected that the input data lies approximately in plane; + otherwise projection perpendicular to the computed normal may + substantially change the geometry. The sign of the normal is + chosen so that the sum of the signed areas of all input contours + is non-negative (where a CCW contour has positive area). + + - The supplied normal persists until it is changed by another + call to gluTessNormal. + + + Backward compatibility with the GLU tesselator + ---------------------------------------------- + + The preferred interface is the one described above. The following + routines are obsolete, and are provided only for backward compatibility: + + typedef GLUtesselator GLUtriangulatorObj; /* obsolete name */ + + void gluBeginPolygon( GLUtesselator *tess ); + void gluNextContour( GLUtesselator *tess, GLenum type ); + void gluEndPolygon( GLUtesselator *tess ); + + "type" is one of GLU_EXTERIOR, GLU_INTERIOR, GLU_CCW, GLU_CW, or + GLU_UNKNOWN. It is ignored by the current GLU tesselator. + + GLU_BEGIN, GLU_VERTEX, GLU_END, GLU_ERROR, and GLU_EDGE_FLAG are defined + as synonyms for GLU_TESS_BEGIN, GLU_TESS_VERTEX, GLU_TESS_END, + GLU_TESS_ERROR, and GLU_TESS_EDGE_FLAG. + + +Polygon CSG operations +---------------------- + + The features of the tesselator make it easy to find the union, difference, + or intersection of several polygons. + + First, assume that each polygon is defined so that the winding number + is 0 for each exterior region, and 1 for each interior region. Under + this model, CCW contours define the outer boundary of the polygon, and + CW contours define holes. Contours may be nested, but a nested + contour must be oriented oppositely from the contour that contains it. + + If the original polygons do not satisfy this description, they can be + converted to this form by first running the tesselator with the + GLU_TESS_BOUNDARY_ONLY property turned on. This returns a list of + contours satisfying the restriction above. By allocating two + tesselator objects, the callbacks from one tesselator can be fed + directly to the input of another. + + Given two or more polygons of the form above, CSG operations can be + implemented as follows: + + Union + Draw all the input contours as a single polygon. The winding number + of each resulting region is the number of original polygons + which cover it. The union can be extracted using the + GLU_TESS_WINDING_NONZERO or GLU_TESS_WINDING_POSITIVE winding rules. + Note that with the nonzero rule, we would get the same result if + all contour orientations were reversed. + + Intersection (two polygons at a time only) + Draw a single polygon using the contours from both input polygons. + Extract the result using GLU_TESS_WINDING_ABS_GEQ_TWO. (Since this + winding rule looks at the absolute value, reversing all contour + orientations does not change the result.) + + Difference + + Suppose we want to compute A \ (B union C union D). Draw a single + polygon consisting of the unmodified contours from A, followed by + the contours of B,C,D with the vertex order reversed (this changes + the winding number of the interior regions to -1). To extract the + result, use the GLU_TESS_WINDING_POSITIVE rule. + + If B,C,D are the result of a GLU_TESS_BOUNDARY_ONLY call, an + alternative to reversing the vertex order is to reverse the sign of + the supplied normal. For example in the x-y plane, call + gluTessNormal( tess, 0.0, 0.0, -1.0 ). + + +Performance +----------- + + The tesselator is not intended for immediate-mode rendering; when + possible the output should be cached in a user structure or display + list. General polygon tesselation is an inherently difficult problem, + especially given the goal of extreme robustness. + + The implementation makes an effort to output a small number of fans + and strips; this should improve the rendering performance when the + output is used in a display list. + + Single-contour input polygons are first tested to see whether they can + be rendered as a triangle fan with respect to the first vertex (to + avoid running the full decomposition algorithm on convex polygons). + Non-convex polygons may be rendered by this "fast path" as well, if + the algorithm gets lucky in its choice of a starting vertex. + + For best performance follow these guidelines: + + - supply the polygon normal, if available, using gluTessNormal(). + This represents about 10% of the computation time. For example, + if all polygons lie in the x-y plane, use gluTessNormal(tess,0,0,1). + + - render many polygons using the same tesselator object, rather than + allocating a new tesselator for each one. (In a multi-threaded, + multi-processor environment you may get better performance using + several tesselators.) + + +Comparison with the GLU tesselator +---------------------------------- + + On polygons which make it through the "fast path", the tesselator is + 3 to 5 times faster than the GLU tesselator. + + On polygons which don't make it through the fast path (but which don't + have self-intersections or degeneracies), it is about 2 times slower. + + On polygons with self-intersections or degeneraces, there is nothing + to compare against. + + The new tesselator generates many more fans and strips, reducing the + number of vertices that need to be sent to the hardware. + + Key to the statistics: + + vert number of input vertices on all contours + cntr number of input contours + tri number of triangles in all output primitives + strip number of triangle strips + fan number of triangle fans + ind number of independent triangles + ms number of milliseconds for tesselation + (on a 150MHz R4400 Indy) + + Convex polygon examples: + +New: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.0459 ms +Old: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.149 ms +New: 4 vert, 1 cntr, 2 tri, 0 strip, 1 fan, 0 ind, 0.0459 ms +Old: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.161 ms +New: 36 vert, 1 cntr, 34 tri, 0 strip, 1 fan, 0 ind, 0.153 ms +Old: 36 vert, 1 cntr, 34 tri, 0 strip, 0 fan, 34 ind, 0.621 ms + + Concave single-contour polygons: + +New: 5 vert, 1 cntr, 3 tri, 0 strip, 1 fan, 0 ind, 0.052 ms +Old: 5 vert, 1 cntr, 3 tri, 0 strip, 0 fan, 3 ind, 0.252 ms +New: 19 vert, 1 cntr, 17 tri, 2 strip, 2 fan, 1 ind, 0.911 ms +Old: 19 vert, 1 cntr, 17 tri, 0 strip, 0 fan, 17 ind, 0.529 ms +New: 151 vert, 1 cntr, 149 tri, 13 strip, 18 fan, 3 ind, 6.82 ms +Old: 151 vert, 1 cntr, 149 tri, 0 strip, 3 fan, 143 ind, 2.7 ms +New: 574 vert, 1 cntr, 572 tri, 59 strip, 54 fan, 11 ind, 26.6 ms +Old: 574 vert, 1 cntr, 572 tri, 0 strip, 31 fan, 499 ind, 12.4 ms + + Multiple contours, but no intersections: + +New: 7 vert, 2 cntr, 7 tri, 1 strip, 0 fan, 0 ind, 0.527 ms +Old: 7 vert, 2 cntr, 7 tri, 0 strip, 0 fan, 7 ind, 0.274 ms +New: 81 vert, 6 cntr, 89 tri, 9 strip, 7 fan, 6 ind, 3.88 ms +Old: 81 vert, 6 cntr, 89 tri, 0 strip, 13 fan, 61 ind, 2.2 ms +New: 391 vert, 19 cntr, 413 tri, 37 strip, 32 fan, 26 ind, 20.2 ms +Old: 391 vert, 19 cntr, 413 tri, 0 strip, 25 fan, 363 ind, 8.68 ms + + Self-intersecting and degenerate examples: + +Bowtie: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.483 ms +Star: 5 vert, 1 cntr, 5 tri, 0 strip, 0 fan, 5 ind, 0.91 ms +Random: 24 vert, 7 cntr, 46 tri, 2 strip, 12 fan, 7 ind, 5.32 ms +Font: 333 vert, 2 cntr, 331 tri, 32 strip, 16 fan, 3 ind, 14.1 ms +: 167 vert, 35 cntr, 254 tri, 8 strip, 56 fan, 52 ind, 46.3 ms +: 78 vert, 1 cntr, 2675 tri, 148 strip, 207 fan, 180 ind, 243 ms +: 12480 vert, 2 cntr, 12478 tri, 736 strip,1275 fan, 5 ind, 1010 ms diff --git a/cogl-path/tesselator/dict-list.h b/cogl-path/tesselator/dict-list.h new file mode 100644 index 0000000..11331a7 --- /dev/null +++ b/cogl-path/tesselator/dict-list.h @@ -0,0 +1,100 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __dict_list_h_ +#define __dict_list_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define DictKey DictListKey +#define Dict DictList +#define DictNode DictListNode + +#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq) +#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict) + +#define dictSearch(dict,key) __gl_dictListSearch(dict,key) +#define dictInsert(dict,key) __gl_dictListInsert(dict,key) +#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key) +#define dictDelete(dict,node) __gl_dictListDelete(dict,node) + +#define dictKey(n) __gl_dictListKey(n) +#define dictSucc(n) __gl_dictListSucc(n) +#define dictPred(n) __gl_dictListPred(n) +#define dictMin(d) __gl_dictListMin(d) +#define dictMax(d) __gl_dictListMax(d) + + + +typedef void *DictKey; +typedef struct Dict Dict; +typedef struct DictNode DictNode; + +Dict *dictNewDict( + void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ); + +void dictDeleteDict( Dict *dict ); + +/* Search returns the node with the smallest key greater than or equal + * to the given key. If there is no such key, returns a node whose + * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc. + */ +DictNode *dictSearch( Dict *dict, DictKey key ); +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ); +void dictDelete( Dict *dict, DictNode *node ); + +#define __gl_dictListKey(n) ((n)->key) +#define __gl_dictListSucc(n) ((n)->next) +#define __gl_dictListPred(n) ((n)->prev) +#define __gl_dictListMin(d) ((d)->head.next) +#define __gl_dictListMax(d) ((d)->head.prev) +#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k))) + + +/*** Private data structures ***/ + +struct DictNode { + DictKey key; + DictNode *next; + DictNode *prev; +}; + +struct Dict { + DictNode head; + void *frame; + int (*leq)(void *frame, DictKey key1, DictKey key2); +}; + +#endif diff --git a/cogl-path/tesselator/dict.c b/cogl-path/tesselator/dict.c new file mode 100644 index 0000000..49d4f75 --- /dev/null +++ b/cogl-path/tesselator/dict.c @@ -0,0 +1,111 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include +#include "dict-list.h" +#include "memalloc.h" + +/* really __gl_dictListNewDict */ +Dict *dictNewDict( void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ) +{ + Dict *dict = (Dict *) memAlloc( sizeof( Dict )); + DictNode *head; + + if (dict == NULL) return NULL; + + head = &dict->head; + + head->key = NULL; + head->next = head; + head->prev = head; + + dict->frame = frame; + dict->leq = leq; + + return dict; +} + +/* really __gl_dictListDeleteDict */ +void dictDeleteDict( Dict *dict ) +{ + DictNode *node, *next; + + for( node = dict->head.next; node != &dict->head; node = next ) { + next = node->next; + memFree( node ); + } + memFree( dict ); +} + +/* really __gl_dictListInsertBefore */ +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ) +{ + DictNode *newNode; + + do { + node = node->prev; + } while( node->key != NULL && ! (*dict->leq)(dict->frame, node->key, key)); + + newNode = (DictNode *) memAlloc( sizeof( DictNode )); + if (newNode == NULL) return NULL; + + newNode->key = key; + newNode->next = node->next; + node->next->prev = newNode; + newNode->prev = node; + node->next = newNode; + + return newNode; +} + +/* really __gl_dictListDelete */ +void dictDelete( Dict *dict, DictNode *node ) /*ARGSUSED*/ +{ + node->next->prev = node->prev; + node->prev->next = node->next; + memFree( node ); +} + +/* really __gl_dictListSearch */ +DictNode *dictSearch( Dict *dict, DictKey key ) +{ + DictNode *node = &dict->head; + + do { + node = node->next; + } while( node->key != NULL && ! (*dict->leq)(dict->frame, key, node->key)); + + return node; +} diff --git a/cogl-path/tesselator/dict.h b/cogl-path/tesselator/dict.h new file mode 100644 index 0000000..11331a7 --- /dev/null +++ b/cogl-path/tesselator/dict.h @@ -0,0 +1,100 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __dict_list_h_ +#define __dict_list_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define DictKey DictListKey +#define Dict DictList +#define DictNode DictListNode + +#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq) +#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict) + +#define dictSearch(dict,key) __gl_dictListSearch(dict,key) +#define dictInsert(dict,key) __gl_dictListInsert(dict,key) +#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key) +#define dictDelete(dict,node) __gl_dictListDelete(dict,node) + +#define dictKey(n) __gl_dictListKey(n) +#define dictSucc(n) __gl_dictListSucc(n) +#define dictPred(n) __gl_dictListPred(n) +#define dictMin(d) __gl_dictListMin(d) +#define dictMax(d) __gl_dictListMax(d) + + + +typedef void *DictKey; +typedef struct Dict Dict; +typedef struct DictNode DictNode; + +Dict *dictNewDict( + void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ); + +void dictDeleteDict( Dict *dict ); + +/* Search returns the node with the smallest key greater than or equal + * to the given key. If there is no such key, returns a node whose + * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc. + */ +DictNode *dictSearch( Dict *dict, DictKey key ); +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ); +void dictDelete( Dict *dict, DictNode *node ); + +#define __gl_dictListKey(n) ((n)->key) +#define __gl_dictListSucc(n) ((n)->next) +#define __gl_dictListPred(n) ((n)->prev) +#define __gl_dictListMin(d) ((d)->head.next) +#define __gl_dictListMax(d) ((d)->head.prev) +#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k))) + + +/*** Private data structures ***/ + +struct DictNode { + DictKey key; + DictNode *next; + DictNode *prev; +}; + +struct Dict { + DictNode head; + void *frame; + int (*leq)(void *frame, DictKey key1, DictKey key2); +}; + +#endif diff --git a/cogl-path/tesselator/geom.c b/cogl-path/tesselator/geom.c new file mode 100644 index 0000000..35b36a3 --- /dev/null +++ b/cogl-path/tesselator/geom.c @@ -0,0 +1,264 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include "mesh.h" +#include "geom.h" + +int __gl_vertLeq( GLUvertex *u, GLUvertex *v ) +{ + /* Returns TRUE if u is lexicographically <= v. */ + + return VertLeq( u, v ); +} + +GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->t = 0 and + * let r be the negated result (this evaluates (uw)(v->s)), then + * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). + */ + GLdouble gapL, gapR; + + assert( VertLeq( u, v ) && VertLeq( v, w )); + + gapL = v->s - u->s; + gapR = w->s - v->s; + + if( gapL + gapR > 0 ) { + if( gapL < gapR ) { + return (v->t - u->t) + (u->t - w->t) * (gapL / (gapL + gapR)); + } else { + return (v->t - w->t) + (w->t - u->t) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; +} + +GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Returns a number whose sign matches EdgeEval(u,v,w) but which + * is cheaper to evaluate. Returns > 0, == 0 , or < 0 + * as v is above, on, or below the edge uw. + */ + GLdouble gapL, gapR; + + assert( VertLeq( u, v ) && VertLeq( v, w )); + + gapL = v->s - u->s; + gapR = w->s - v->s; + + if( gapL + gapR > 0 ) { + return (v->t - w->t) * gapL + (v->t - u->t) * gapR; + } + /* vertical line */ + return 0; +} + + +/*********************************************************************** + * Define versions of EdgeSign, EdgeEval with s and t transposed. + */ + +GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->s = 0 and + * let r be the negated result (this evaluates (uw)(v->t)), then + * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s). + */ + GLdouble gapL, gapR; + + assert( TransLeq( u, v ) && TransLeq( v, w )); + + gapL = v->t - u->t; + gapR = w->t - v->t; + + if( gapL + gapR > 0 ) { + if( gapL < gapR ) { + return (v->s - u->s) + (u->s - w->s) * (gapL / (gapL + gapR)); + } else { + return (v->s - w->s) + (w->s - u->s) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; +} + +GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Returns a number whose sign matches TransEval(u,v,w) but which + * is cheaper to evaluate. Returns > 0, == 0 , or < 0 + * as v is above, on, or below the edge uw. + */ + GLdouble gapL, gapR; + + assert( TransLeq( u, v ) && TransLeq( v, w )); + + gapL = v->t - u->t; + gapR = w->t - v->t; + + if( gapL + gapR > 0 ) { + return (v->s - w->s) * gapL + (v->s - u->s) * gapR; + } + /* vertical line */ + return 0; +} + + +int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* For almost-degenerate situations, the results are not reliable. + * Unless the floating-point arithmetic can be performed without + * rounding errors, *any* implementation will give incorrect results + * on some degenerate inputs, so the client must have some way to + * handle this situation. + */ + return (u->s*(v->t - w->t) + v->s*(w->t - u->t) + w->s*(u->t - v->t)) >= 0; +} + +/* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b), + * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces + * this in the rare case that one argument is slightly negative. + * The implementation is extremely stable numerically. + * In particular it guarantees that the result r satisfies + * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate + * even when a and b differ greatly in magnitude. + */ +#define RealInterpolate(a,x,b,y) \ + (a = (a < 0) ? 0 : a, b = (b < 0) ? 0 : b, \ + ((a <= b) ? ((b == 0) ? ((x+y) / 2) \ + : (x + (y-x) * (a/(a+b)))) \ + : (y + (x-y) * (b/(a+b))))) + +#ifndef FOR_TRITE_TEST_PROGRAM +#define Interpolate(a,x,b,y) RealInterpolate(a,x,b,y) +#else + +/* Claim: the ONLY property the sweep algorithm relies on is that + * MIN(x,y) <= r <= MAX(x,y). This is a nasty way to test that. + */ +#include +extern int RandomInterpolate; + +GLdouble Interpolate( GLdouble a, GLdouble x, GLdouble b, GLdouble y) +{ +printf("*********************%d\n",RandomInterpolate); + if( RandomInterpolate ) { + a = 1.2 * drand48() - 0.1; + a = (a < 0) ? 0 : ((a > 1) ? 1 : a); + b = 1.0 - a; + } + return RealInterpolate(a,x,b,y); +} + +#endif + +#define Swap(a,b) do { GLUvertex *t = a; a = b; b = t; } while (0) + +void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, + GLUvertex *o2, GLUvertex *d2, + GLUvertex *v ) +/* Given edges (o1,d1) and (o2,d2), compute their point of intersection. + * The computed point is guaranteed to lie in the intersection of the + * bounding rectangles defined by each edge. + */ +{ + GLdouble z1, z2; + + /* This is certainly not the most efficient way to find the intersection + * of two line segments, but it is very numerically stable. + * + * Strategy: find the two middle vertices in the VertLeq ordering, + * and interpolate the intersection s-value from these. Then repeat + * using the TransLeq ordering to find the intersection t-value. + */ + + if( ! VertLeq( o1, d1 )) { Swap( o1, d1 ); } + if( ! VertLeq( o2, d2 )) { Swap( o2, d2 ); } + if( ! VertLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + + if( ! VertLeq( o2, d1 )) { + /* Technically, no intersection -- do our best */ + v->s = (o2->s + d1->s) / 2; + } else if( VertLeq( d1, d2 )) { + /* Interpolate between o2 and d1 */ + z1 = EdgeEval( o1, o2, d1 ); + z2 = EdgeEval( o2, d1, d2 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->s = Interpolate( z1, o2->s, z2, d1->s ); + } else { + /* Interpolate between o2 and d2 */ + z1 = EdgeSign( o1, o2, d1 ); + z2 = -EdgeSign( o1, d2, d1 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->s = Interpolate( z1, o2->s, z2, d2->s ); + } + + /* Now repeat the process for t */ + + if( ! TransLeq( o1, d1 )) { Swap( o1, d1 ); } + if( ! TransLeq( o2, d2 )) { Swap( o2, d2 ); } + if( ! TransLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + + if( ! TransLeq( o2, d1 )) { + /* Technically, no intersection -- do our best */ + v->t = (o2->t + d1->t) / 2; + } else if( TransLeq( d1, d2 )) { + /* Interpolate between o2 and d1 */ + z1 = TransEval( o1, o2, d1 ); + z2 = TransEval( o2, d1, d2 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->t = Interpolate( z1, o2->t, z2, d1->t ); + } else { + /* Interpolate between o2 and d2 */ + z1 = TransSign( o1, o2, d1 ); + z2 = -TransSign( o1, d2, d1 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->t = Interpolate( z1, o2->t, z2, d2->t ); + } +} diff --git a/cogl-path/tesselator/geom.h b/cogl-path/tesselator/geom.h new file mode 100644 index 0000000..5cb76c7 --- /dev/null +++ b/cogl-path/tesselator/geom.h @@ -0,0 +1,84 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __geom_h_ +#define __geom_h_ + +#include "mesh.h" + +#ifdef NO_BRANCH_CONDITIONS +/* MIPS architecture has special instructions to evaluate boolean + * conditions -- more efficient than branching, IF you can get the + * compiler to generate the right instructions (SGI compiler doesn't) + */ +#define VertEq(u,v) (((u)->s == (v)->s) & ((u)->t == (v)->t)) +#define VertLeq(u,v) (((u)->s < (v)->s) | \ + ((u)->s == (v)->s & (u)->t <= (v)->t)) +#else +#define VertEq(u,v) ((u)->s == (v)->s && (u)->t == (v)->t) +#define VertLeq(u,v) (((u)->s < (v)->s) || \ + ((u)->s == (v)->s && (u)->t <= (v)->t)) +#endif + +#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w) +#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w) + +/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ + +#define TransLeq(u,v) (((u)->t < (v)->t) || \ + ((u)->t == (v)->t && (u)->s <= (v)->s)) +#define TransEval(u,v,w) __gl_transEval(u,v,w) +#define TransSign(u,v,w) __gl_transSign(u,v,w) + + +#define EdgeGoesLeft(e) VertLeq( (e)->Dst, (e)->Org ) +#define EdgeGoesRight(e) VertLeq( (e)->Org, (e)->Dst ) + +#undef ABS +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t)) + +#define VertCCW(u,v,w) __gl_vertCCW(u,v,w) + +int __gl_vertLeq( GLUvertex *u, GLUvertex *v ); +GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, + GLUvertex *o2, GLUvertex *d2, + GLUvertex *v ); + +#endif diff --git a/cogl-path/tesselator/gluos.h b/cogl-path/tesselator/gluos.h new file mode 100644 index 0000000..d6c3ae9 --- /dev/null +++ b/cogl-path/tesselator/gluos.h @@ -0,0 +1 @@ +/* This is a stub header to avoid having to change tess.c */ diff --git a/cogl-path/tesselator/memalloc.h b/cogl-path/tesselator/memalloc.h new file mode 100644 index 0000000..a094b6c --- /dev/null +++ b/cogl-path/tesselator/memalloc.h @@ -0,0 +1,49 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is a simple replacement for memalloc from the SGI tesselator + code to force it to use glib's allocation instead */ + +#ifndef __MEMALLOC_H__ +#define __MEMALLOC_H__ + +#include + +#define memRealloc g_realloc +#define memAlloc g_malloc +#define memFree g_free +#define memInit(x) 1 + +/* tess.c defines TRUE and FALSE itself unconditionally so we need to + undefine it from the glib headers */ +#undef TRUE +#undef FALSE + +#endif /* __MEMALLOC_H__ */ diff --git a/cogl-path/tesselator/mesh.c b/cogl-path/tesselator/mesh.c new file mode 100644 index 0000000..36cb3a7 --- /dev/null +++ b/cogl-path/tesselator/mesh.c @@ -0,0 +1,798 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include "mesh.h" +#include "memalloc.h" + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +static GLUvertex *allocVertex() +{ + return (GLUvertex *)memAlloc( sizeof( GLUvertex )); +} + +static GLUface *allocFace() +{ + return (GLUface *)memAlloc( sizeof( GLUface )); +} + +/************************ Utility Routines ************************/ + +/* Allocate and free half-edges in pairs for efficiency. + * The *only* place that should use this fact is allocation/free. + */ +typedef struct { GLUhalfEdge e, eSym; } EdgePair; + +/* MakeEdge creates a new pair of half-edges which form their own loop. + * No vertex or face structures are allocated, but these must be assigned + * before the current edge operation is completed. + */ +static GLUhalfEdge *MakeEdge( GLUhalfEdge *eNext ) +{ + GLUhalfEdge *e; + GLUhalfEdge *eSym; + GLUhalfEdge *ePrev; + EdgePair *pair = (EdgePair *)memAlloc( sizeof( EdgePair )); + if (pair == NULL) return NULL; + + e = &pair->e; + eSym = &pair->eSym; + + /* Make sure eNext points to the first edge of the edge pair */ + if( eNext->Sym < eNext ) { eNext = eNext->Sym; } + + /* Insert in circular doubly-linked list before eNext. + * Note that the prev pointer is stored in Sym->next. + */ + ePrev = eNext->Sym->next; + eSym->next = ePrev; + ePrev->Sym->next = e; + e->next = eNext; + eNext->Sym->next = eSym; + + e->Sym = eSym; + e->Onext = e; + e->Lnext = eSym; + e->Org = NULL; + e->Lface = NULL; + e->winding = 0; + e->activeRegion = NULL; + + eSym->Sym = e; + eSym->Onext = eSym; + eSym->Lnext = e; + eSym->Org = NULL; + eSym->Lface = NULL; + eSym->winding = 0; + eSym->activeRegion = NULL; + + return e; +} + +/* Splice( a, b ) is best described by the Guibas/Stolfi paper or the + * CS348a notes (see mesh.h). Basically it modifies the mesh so that + * a->Onext and b->Onext are exchanged. This can have various effects + * depending on whether a and b belong to different face or vertex rings. + * For more explanation see __gl_meshSplice() below. + */ +static void Splice( GLUhalfEdge *a, GLUhalfEdge *b ) +{ + GLUhalfEdge *aOnext = a->Onext; + GLUhalfEdge *bOnext = b->Onext; + + aOnext->Sym->Lnext = b; + bOnext->Sym->Lnext = a; + a->Onext = bOnext; + b->Onext = aOnext; +} + +/* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the + * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives + * a place to insert the new vertex in the global vertex list. We insert + * the new vertex *before* vNext so that algorithms which walk the vertex + * list will not see the newly created vertices. + */ +static void MakeVertex( GLUvertex *newVertex, + GLUhalfEdge *eOrig, GLUvertex *vNext ) +{ + GLUhalfEdge *e; + GLUvertex *vPrev; + GLUvertex *vNew = newVertex; + + assert(vNew != NULL); + + /* insert in circular doubly-linked list before vNext */ + vPrev = vNext->prev; + vNew->prev = vPrev; + vPrev->next = vNew; + vNew->next = vNext; + vNext->prev = vNew; + + vNew->anEdge = eOrig; + vNew->data = NULL; + /* leave coords, s, t undefined */ + + /* fix other edges on this vertex loop */ + e = eOrig; + do { + e->Org = vNew; + e = e->Onext; + } while( e != eOrig ); +} + +/* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left + * face of all edges in the face loop to which eOrig belongs. "fNext" gives + * a place to insert the new face in the global face list. We insert + * the new face *before* fNext so that algorithms which walk the face + * list will not see the newly created faces. + */ +static void MakeFace( GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext ) +{ + GLUhalfEdge *e; + GLUface *fPrev; + GLUface *fNew = newFace; + + assert(fNew != NULL); + + /* insert in circular doubly-linked list before fNext */ + fPrev = fNext->prev; + fNew->prev = fPrev; + fPrev->next = fNew; + fNew->next = fNext; + fNext->prev = fNew; + + fNew->anEdge = eOrig; + fNew->data = NULL; + fNew->trail = NULL; + fNew->marked = FALSE; + + /* The new face is marked "inside" if the old one was. This is a + * convenience for the common case where a face has been split in two. + */ + fNew->inside = fNext->inside; + + /* fix other edges on this face loop */ + e = eOrig; + do { + e->Lface = fNew; + e = e->Lnext; + } while( e != eOrig ); +} + +/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym), + * and removes from the global edge list. + */ +static void KillEdge( GLUhalfEdge *eDel ) +{ + GLUhalfEdge *ePrev, *eNext; + + /* Half-edges are allocated in pairs, see EdgePair above */ + if( eDel->Sym < eDel ) { eDel = eDel->Sym; } + + /* delete from circular doubly-linked list */ + eNext = eDel->next; + ePrev = eDel->Sym->next; + eNext->Sym->next = ePrev; + ePrev->Sym->next = eNext; + + memFree( eDel ); +} + + +/* KillVertex( vDel ) destroys a vertex and removes it from the global + * vertex list. It updates the vertex loop to point to a given new vertex. + */ +static void KillVertex( GLUvertex *vDel, GLUvertex *newOrg ) +{ + GLUhalfEdge *e, *eStart = vDel->anEdge; + GLUvertex *vPrev, *vNext; + + /* change the origin of all affected edges */ + e = eStart; + do { + e->Org = newOrg; + e = e->Onext; + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + vPrev = vDel->prev; + vNext = vDel->next; + vNext->prev = vPrev; + vPrev->next = vNext; + + memFree( vDel ); +} + +/* KillFace( fDel ) destroys a face and removes it from the global face + * list. It updates the face loop to point to a given new face. + */ +static void KillFace( GLUface *fDel, GLUface *newLface ) +{ + GLUhalfEdge *e, *eStart = fDel->anEdge; + GLUface *fPrev, *fNext; + + /* change the left face of all affected edges */ + e = eStart; + do { + e->Lface = newLface; + e = e->Lnext; + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + fPrev = fDel->prev; + fNext = fDel->next; + fNext->prev = fPrev; + fPrev->next = fNext; + + memFree( fDel ); +} + + +/****************** Basic Edge Operations **********************/ + +/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). + * The loop consists of the two new half-edges. + */ +GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ) +{ + GLUvertex *newVertex1= allocVertex(); + GLUvertex *newVertex2= allocVertex(); + GLUface *newFace= allocFace(); + GLUhalfEdge *e; + + /* if any one is null then all get freed */ + if (newVertex1 == NULL || newVertex2 == NULL || newFace == NULL) { + if (newVertex1 != NULL) memFree(newVertex1); + if (newVertex2 != NULL) memFree(newVertex2); + if (newFace != NULL) memFree(newFace); + return NULL; + } + + e = MakeEdge( &mesh->eHead ); + if (e == NULL) { + memFree(newVertex1); + memFree(newVertex2); + memFree(newFace); + return NULL; + } + + MakeVertex( newVertex1, e, &mesh->vHead ); + MakeVertex( newVertex2, e->Sym, &mesh->vHead ); + MakeFace( newFace, e, &mesh->fHead ); + return e; +} + + +/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the + * mesh connectivity and topology. It changes the mesh so that + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) + * where OLD(...) means the value before the meshSplice operation. + * + * This can have two effects on the vertex structure: + * - if eOrg->Org != eDst->Org, the two vertices are merged together + * - if eOrg->Org == eDst->Org, the origin is split into two vertices + * In both cases, eDst->Org is changed and eOrg->Org is untouched. + * + * Similarly (and independently) for the face structure, + * - if eOrg->Lface == eDst->Lface, one loop is split into two + * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one + * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. + * + * Some special cases: + * If eDst == eOrg, the operation has no effect. + * If eDst == eOrg->Lnext, the new face will have a single edge. + * If eDst == eOrg->Lprev, the old face will have a single edge. + * If eDst == eOrg->Onext, the new vertex will have a single edge. + * If eDst == eOrg->Oprev, the old vertex will have a single edge. + */ +int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ) +{ + int joiningLoops = FALSE; + int joiningVertices = FALSE; + + if( eOrg == eDst ) return 1; + + if( eDst->Org != eOrg->Org ) { + /* We are merging two disjoint vertices -- destroy eDst->Org */ + joiningVertices = TRUE; + KillVertex( eDst->Org, eOrg->Org ); + } + if( eDst->Lface != eOrg->Lface ) { + /* We are connecting two disjoint loops -- destroy eDst->Lface */ + joiningLoops = TRUE; + KillFace( eDst->Lface, eOrg->Lface ); + } + + /* Change the edge structure */ + Splice( eDst, eOrg ); + + if( ! joiningVertices ) { + GLUvertex *newVertex= allocVertex(); + if (newVertex == NULL) return 0; + + /* We split one vertex into two -- the new vertex is eDst->Org. + * Make sure the old vertex points to a valid half-edge. + */ + MakeVertex( newVertex, eDst, eOrg->Org ); + eOrg->Org->anEdge = eOrg; + } + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return 0; + + /* We split one loop into two -- the new loop is eDst->Lface. + * Make sure the old face points to a valid half-edge. + */ + MakeFace( newFace, eDst, eOrg->Lface ); + eOrg->Lface->anEdge = eOrg; + } + + return 1; +} + + +/* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: + * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop + * eDel->Lface is deleted. Otherwise, we are splitting one loop into two; + * the newly created loop will contain eDel->Dst. If the deletion of eDel + * would create isolated vertices, those are deleted as well. + * + * This function could be implemented as two calls to __gl_meshSplice + * plus a few calls to memFree, but this would allocate and delete + * unnecessary vertices and faces. + */ +int __gl_meshDelete( GLUhalfEdge *eDel ) +{ + GLUhalfEdge *eDelSym = eDel->Sym; + int joiningLoops = FALSE; + + /* First step: disconnect the origin vertex eDel->Org. We make all + * changes to get a consistent mesh in this "intermediate" state. + */ + if( eDel->Lface != eDel->Rface ) { + /* We are joining two loops into one -- remove the left face */ + joiningLoops = TRUE; + KillFace( eDel->Lface, eDel->Rface ); + } + + if( eDel->Onext == eDel ) { + KillVertex( eDel->Org, NULL ); + } else { + /* Make sure that eDel->Org and eDel->Rface point to valid half-edges */ + eDel->Rface->anEdge = eDel->Oprev; + eDel->Org->anEdge = eDel->Onext; + + Splice( eDel, eDel->Oprev ); + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return 0; + + /* We are splitting one loop into two -- create a new loop for eDel. */ + MakeFace( newFace, eDel, eDel->Lface ); + } + } + + /* Claim: the mesh is now in a consistent state, except that eDel->Org + * may have been deleted. Now we disconnect eDel->Dst. + */ + if( eDelSym->Onext == eDelSym ) { + KillVertex( eDelSym->Org, NULL ); + KillFace( eDelSym->Lface, NULL ); + } else { + /* Make sure that eDel->Dst and eDel->Lface point to valid half-edges */ + eDel->Lface->anEdge = eDelSym->Oprev; + eDelSym->Org->anEdge = eDelSym->Onext; + Splice( eDelSym, eDelSym->Oprev ); + } + + /* Any isolated vertices or faces have already been freed. */ + KillEdge( eDel ); + + return 1; +} + + +/******************** Other Edge Operations **********************/ + +/* All these routines can be implemented with the basic edge + * operations above. They are provided for convenience and efficiency. + */ + + +/* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that + * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex. + * eOrg and eNew will have the same left face. + */ +GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg ) +{ + GLUhalfEdge *eNewSym; + GLUhalfEdge *eNew = MakeEdge( eOrg ); + if (eNew == NULL) return NULL; + + eNewSym = eNew->Sym; + + /* Connect the new edge appropriately */ + Splice( eNew, eOrg->Lnext ); + + /* Set the vertex and face information */ + eNew->Org = eOrg->Dst; + { + GLUvertex *newVertex= allocVertex(); + if (newVertex == NULL) return NULL; + + MakeVertex( newVertex, eNewSym, eNew->Org ); + } + eNew->Lface = eNewSym->Lface = eOrg->Lface; + + return eNew; +} + + +/* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, + * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org. + * eOrg and eNew will have the same left face. + */ +GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg ) +{ + GLUhalfEdge *eNew; + GLUhalfEdge *tempHalfEdge= __gl_meshAddEdgeVertex( eOrg ); + if (tempHalfEdge == NULL) return NULL; + + eNew = tempHalfEdge->Sym; + + /* Disconnect eOrg from eOrg->Dst and connect it to eNew->Org */ + Splice( eOrg->Sym, eOrg->Sym->Oprev ); + Splice( eOrg->Sym, eNew ); + + /* Set the vertex and face information */ + eOrg->Dst = eNew->Org; + eNew->Dst->anEdge = eNew->Sym; /* may have pointed to eOrg->Sym */ + eNew->Rface = eOrg->Rface; + eNew->winding = eOrg->winding; /* copy old winding information */ + eNew->Sym->winding = eOrg->Sym->winding; + + return eNew; +} + + +/* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst + * to eDst->Org, and returns the corresponding half-edge eNew. + * If eOrg->Lface == eDst->Lface, this splits one loop into two, + * and the newly created loop is eNew->Lface. Otherwise, two disjoint + * loops are merged into one, and the loop eDst->Lface is destroyed. + * + * If (eOrg == eDst), the new face will have only two edges. + * If (eOrg->Lnext == eDst), the old face is reduced to a single edge. + * If (eOrg->Lnext->Lnext == eDst), the old face is reduced to two edges. + */ +GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ) +{ + GLUhalfEdge *eNewSym; + int joiningLoops = FALSE; + GLUhalfEdge *eNew = MakeEdge( eOrg ); + if (eNew == NULL) return NULL; + + eNewSym = eNew->Sym; + + if( eDst->Lface != eOrg->Lface ) { + /* We are connecting two disjoint loops -- destroy eDst->Lface */ + joiningLoops = TRUE; + KillFace( eDst->Lface, eOrg->Lface ); + } + + /* Connect the new edge appropriately */ + Splice( eNew, eOrg->Lnext ); + Splice( eNewSym, eDst ); + + /* Set the vertex and face information */ + eNew->Org = eOrg->Dst; + eNewSym->Org = eDst->Org; + eNew->Lface = eNewSym->Lface = eOrg->Lface; + + /* Make sure the old face points to a valid half-edge */ + eOrg->Lface->anEdge = eNewSym; + + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return NULL; + + /* We split one loop into two -- the new loop is eNew->Lface */ + MakeFace( newFace, eNew, eOrg->Lface ); + } + return eNew; +} + + +/******************** Other Operations **********************/ + +/* __gl_meshZapFace( fZap ) destroys a face and removes it from the + * global face list. All edges of fZap will have a NULL pointer as their + * left face. Any edges which also have a NULL pointer as their right face + * are deleted entirely (along with any isolated vertices this produces). + * An entire mesh can be deleted by zapping its faces, one at a time, + * in any order. Zapped faces cannot be used in further mesh operations! + */ +void __gl_meshZapFace( GLUface *fZap ) +{ + GLUhalfEdge *eStart = fZap->anEdge; + GLUhalfEdge *e, *eNext, *eSym; + GLUface *fPrev, *fNext; + + /* walk around face, deleting edges whose right face is also NULL */ + eNext = eStart->Lnext; + do { + e = eNext; + eNext = e->Lnext; + + e->Lface = NULL; + if( e->Rface == NULL ) { + /* delete the edge -- see __gl_MeshDelete above */ + + if( e->Onext == e ) { + KillVertex( e->Org, NULL ); + } else { + /* Make sure that e->Org points to a valid half-edge */ + e->Org->anEdge = e->Onext; + Splice( e, e->Oprev ); + } + eSym = e->Sym; + if( eSym->Onext == eSym ) { + KillVertex( eSym->Org, NULL ); + } else { + /* Make sure that eSym->Org points to a valid half-edge */ + eSym->Org->anEdge = eSym->Onext; + Splice( eSym, eSym->Oprev ); + } + KillEdge( e ); + } + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + fPrev = fZap->prev; + fNext = fZap->next; + fNext->prev = fPrev; + fPrev->next = fNext; + + memFree( fZap ); +} + + +/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices, + * and no loops (what we usually call a "face"). + */ +GLUmesh *__gl_meshNewMesh( void ) +{ + GLUvertex *v; + GLUface *f; + GLUhalfEdge *e; + GLUhalfEdge *eSym; + GLUmesh *mesh = (GLUmesh *)memAlloc( sizeof( GLUmesh )); + if (mesh == NULL) { + return NULL; + } + + v = &mesh->vHead; + f = &mesh->fHead; + e = &mesh->eHead; + eSym = &mesh->eHeadSym; + + v->next = v->prev = v; + v->anEdge = NULL; + v->data = NULL; + + f->next = f->prev = f; + f->anEdge = NULL; + f->data = NULL; + f->trail = NULL; + f->marked = FALSE; + f->inside = FALSE; + + e->next = e; + e->Sym = eSym; + e->Onext = NULL; + e->Lnext = NULL; + e->Org = NULL; + e->Lface = NULL; + e->winding = 0; + e->activeRegion = NULL; + + eSym->next = eSym; + eSym->Sym = e; + eSym->Onext = NULL; + eSym->Lnext = NULL; + eSym->Org = NULL; + eSym->Lface = NULL; + eSym->winding = 0; + eSym->activeRegion = NULL; + + return mesh; +} + + +/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in + * both meshes, and returns the new mesh (the old meshes are destroyed). + */ +GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 ) +{ + GLUface *f1 = &mesh1->fHead; + GLUvertex *v1 = &mesh1->vHead; + GLUhalfEdge *e1 = &mesh1->eHead; + GLUface *f2 = &mesh2->fHead; + GLUvertex *v2 = &mesh2->vHead; + GLUhalfEdge *e2 = &mesh2->eHead; + + /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ + if( f2->next != f2 ) { + f1->prev->next = f2->next; + f2->next->prev = f1->prev; + f2->prev->next = f1; + f1->prev = f2->prev; + } + + if( v2->next != v2 ) { + v1->prev->next = v2->next; + v2->next->prev = v1->prev; + v2->prev->next = v1; + v1->prev = v2->prev; + } + + if( e2->next != e2 ) { + e1->Sym->next->Sym->next = e2->next; + e2->next->Sym->next = e1->Sym->next; + e2->Sym->next->Sym->next = e1; + e1->Sym->next = e2->Sym->next; + } + + memFree( mesh2 ); + return mesh1; +} + + +#ifdef DELETE_BY_ZAPPING + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ +void __gl_meshDeleteMesh( GLUmesh *mesh ) +{ + GLUface *fHead = &mesh->fHead; + + while( fHead->next != fHead ) { + __gl_meshZapFace( fHead->next ); + } + assert( mesh->vHead.next == &mesh->vHead ); + + memFree( mesh ); +} + +#else + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ +void __gl_meshDeleteMesh( GLUmesh *mesh ) +{ + GLUface *f, *fNext; + GLUvertex *v, *vNext; + GLUhalfEdge *e, *eNext; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) { + fNext = f->next; + memFree( f ); + } + + for( v = mesh->vHead.next; v != &mesh->vHead; v = vNext ) { + vNext = v->next; + memFree( v ); + } + + for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) { + /* One call frees both e and e->Sym (see EdgePair above) */ + eNext = e->next; + memFree( e ); + } + + memFree( mesh ); +} + +#endif + +#ifndef NDEBUG + +/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. + */ +void __gl_meshCheckMesh( GLUmesh *mesh ) +{ + GLUface *fHead = &mesh->fHead; + GLUvertex *vHead = &mesh->vHead; + GLUhalfEdge *eHead = &mesh->eHead; + GLUface *f, *fPrev; + GLUvertex *v, *vPrev; + GLUhalfEdge *e, *ePrev; + + fPrev = fHead; + for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) { + assert( f->prev == fPrev ); + e = f->anEdge; + do { + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + assert( e->Lface == f ); + e = e->Lnext; + } while( e != f->anEdge ); + } + assert( f->prev == fPrev && f->anEdge == NULL && f->data == NULL ); + + vPrev = vHead; + for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) { + assert( v->prev == vPrev ); + e = v->anEdge; + do { + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + assert( e->Org == v ); + e = e->Onext; + } while( e != v->anEdge ); + } + assert( v->prev == vPrev && v->anEdge == NULL && v->data == NULL ); + + ePrev = eHead; + for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) { + assert( e->Sym->next == ePrev->Sym ); + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Org != NULL ); + assert( e->Dst != NULL ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + } + assert( e->Sym->next == ePrev->Sym + && e->Sym == &mesh->eHeadSym + && e->Sym->Sym == e + && e->Org == NULL && e->Dst == NULL + && e->Lface == NULL && e->Rface == NULL ); +} + +#endif diff --git a/cogl-path/tesselator/mesh.h b/cogl-path/tesselator/mesh.h new file mode 100644 index 0000000..690c5f2 --- /dev/null +++ b/cogl-path/tesselator/mesh.h @@ -0,0 +1,266 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __mesh_h_ +#define __mesh_h_ + +#include + +typedef struct GLUmesh GLUmesh; + +typedef struct GLUvertex GLUvertex; +typedef struct GLUface GLUface; +typedef struct GLUhalfEdge GLUhalfEdge; + +typedef struct ActiveRegion ActiveRegion; /* Internal data */ + +/* The mesh structure is similar in spirit, notation, and operations + * to the "quad-edge" structure (see L. Guibas and J. Stolfi, Primitives + * for the manipulation of general subdivisions and the computation of + * Voronoi diagrams, ACM Transactions on Graphics, 4(2):74-123, April 1985). + * For a simplified description, see the course notes for CS348a, + * "Mathematical Foundations of Computer Graphics", available at the + * Stanford bookstore (and taught during the fall quarter). + * The implementation also borrows a tiny subset of the graph-based approach + * use in Mantyla's Geometric Work Bench (see M. Mantyla, An Introduction + * to Sold Modeling, Computer Science Press, Rockville, Maryland, 1988). + * + * The fundamental data structure is the "half-edge". Two half-edges + * go together to make an edge, but they point in opposite directions. + * Each half-edge has a pointer to its mate (the "symmetric" half-edge Sym), + * its origin vertex (Org), the face on its left side (Lface), and the + * adjacent half-edges in the CCW direction around the origin vertex + * (Onext) and around the left face (Lnext). There is also a "next" + * pointer for the global edge list (see below). + * + * The notation used for mesh navigation: + * Sym = the mate of a half-edge (same edge, but opposite direction) + * Onext = edge CCW around origin vertex (keep same origin) + * Dnext = edge CCW around destination vertex (keep same dest) + * Lnext = edge CCW around left face (dest becomes new origin) + * Rnext = edge CCW around right face (origin becomes new dest) + * + * "prev" means to substitute CW for CCW in the definitions above. + * + * The mesh keeps global lists of all vertices, faces, and edges, + * stored as doubly-linked circular lists with a dummy header node. + * The mesh stores pointers to these dummy headers (vHead, fHead, eHead). + * + * The circular edge list is special; since half-edges always occur + * in pairs (e and e->Sym), each half-edge stores a pointer in only + * one direction. Starting at eHead and following the e->next pointers + * will visit each *edge* once (ie. e or e->Sym, but not both). + * e->Sym stores a pointer in the opposite direction, thus it is + * always true that e->Sym->next->Sym->next == e. + * + * Each vertex has a pointer to next and previous vertices in the + * circular list, and a pointer to a half-edge with this vertex as + * the origin (NULL if this is the dummy header). There is also a + * field "data" for client data. + * + * Each face has a pointer to the next and previous faces in the + * circular list, and a pointer to a half-edge with this face as + * the left face (NULL if this is the dummy header). There is also + * a field "data" for client data. + * + * Note that what we call a "face" is really a loop; faces may consist + * of more than one loop (ie. not simply connected), but there is no + * record of this in the data structure. The mesh may consist of + * several disconnected regions, so it may not be possible to visit + * the entire mesh by starting at a half-edge and traversing the edge + * structure. + * + * The mesh does NOT support isolated vertices; a vertex is deleted along + * with its last edge. Similarly when two faces are merged, one of the + * faces is deleted (see __gl_meshDelete below). For mesh operations, + * all face (loop) and vertex pointers must not be NULL. However, once + * mesh manipulation is finished, __gl_MeshZapFace can be used to delete + * faces of the mesh, one at a time. All external faces can be "zapped" + * before the mesh is returned to the client; then a NULL face indicates + * a region which is not part of the output polygon. + */ + +struct GLUvertex { + GLUvertex *next; /* next vertex (never NULL) */ + GLUvertex *prev; /* previous vertex (never NULL) */ + GLUhalfEdge *anEdge; /* a half-edge with this origin */ + void *data; /* client's data */ + + /* Internal data (keep hidden) */ + GLdouble coords[3]; /* vertex location in 3D */ + GLdouble s, t; /* projection onto the sweep plane */ + long pqHandle; /* to allow deletion from priority queue */ +}; + +struct GLUface { + GLUface *next; /* next face (never NULL) */ + GLUface *prev; /* previous face (never NULL) */ + GLUhalfEdge *anEdge; /* a half edge with this left face */ + void *data; /* room for client's data */ + + /* Internal data (keep hidden) */ + GLUface *trail; /* "stack" for conversion to strips */ + GLboolean marked; /* flag for conversion to strips */ + GLboolean inside; /* this face is in the polygon interior */ +}; + +struct GLUhalfEdge { + GLUhalfEdge *next; /* doubly-linked list (prev==Sym->next) */ + GLUhalfEdge *Sym; /* same edge, opposite direction */ + GLUhalfEdge *Onext; /* next edge CCW around origin */ + GLUhalfEdge *Lnext; /* next edge CCW around left face */ + GLUvertex *Org; /* origin vertex (Overtex too long) */ + GLUface *Lface; /* left face */ + + /* Internal data (keep hidden) */ + ActiveRegion *activeRegion; /* a region with this upper edge (sweep.c) */ + int winding; /* change in winding number when crossing + from the right face to the left face */ +}; + +#define Rface Sym->Lface +#define Dst Sym->Org + +#define Oprev Sym->Lnext +#define Lprev Onext->Sym +#define Dprev Lnext->Sym +#define Rprev Sym->Onext +#define Dnext Rprev->Sym /* 3 pointers */ +#define Rnext Oprev->Sym /* 3 pointers */ + + +struct GLUmesh { + GLUvertex vHead; /* dummy header for vertex list */ + GLUface fHead; /* dummy header for face list */ + GLUhalfEdge eHead; /* dummy header for edge list */ + GLUhalfEdge eHeadSym; /* and its symmetric counterpart */ +}; + +/* The mesh operations below have three motivations: completeness, + * convenience, and efficiency. The basic mesh operations are MakeEdge, + * Splice, and Delete. All the other edge operations can be implemented + * in terms of these. The other operations are provided for convenience + * and/or efficiency. + * + * When a face is split or a vertex is added, they are inserted into the + * global list *before* the existing vertex or face (ie. e->Org or e->Lface). + * This makes it easier to process all vertices or faces in the global lists + * without worrying about processing the same data twice. As a convenience, + * when a face is split, the "inside" flag is copied from the old face. + * Other internal data (v->data, v->activeRegion, f->data, f->marked, + * f->trail, e->winding) is set to zero. + * + * ********************** Basic Edge Operations ************************** + * + * __gl_meshMakeEdge( mesh ) creates one edge, two vertices, and a loop. + * The loop (face) consists of the two new half-edges. + * + * __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the + * mesh connectivity and topology. It changes the mesh so that + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) + * where OLD(...) means the value before the meshSplice operation. + * + * This can have two effects on the vertex structure: + * - if eOrg->Org != eDst->Org, the two vertices are merged together + * - if eOrg->Org == eDst->Org, the origin is split into two vertices + * In both cases, eDst->Org is changed and eOrg->Org is untouched. + * + * Similarly (and independently) for the face structure, + * - if eOrg->Lface == eDst->Lface, one loop is split into two + * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one + * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. + * + * __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: + * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop + * eDel->Lface is deleted. Otherwise, we are splitting one loop into two; + * the newly created loop will contain eDel->Dst. If the deletion of eDel + * would create isolated vertices, those are deleted as well. + * + * ********************** Other Edge Operations ************************** + * + * __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that + * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex. + * eOrg and eNew will have the same left face. + * + * __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, + * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org. + * eOrg and eNew will have the same left face. + * + * __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst + * to eDst->Org, and returns the corresponding half-edge eNew. + * If eOrg->Lface == eDst->Lface, this splits one loop into two, + * and the newly created loop is eNew->Lface. Otherwise, two disjoint + * loops are merged into one, and the loop eDst->Lface is destroyed. + * + * ************************ Other Operations ***************************** + * + * __gl_meshNewMesh() creates a new mesh with no edges, no vertices, + * and no loops (what we usually call a "face"). + * + * __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in + * both meshes, and returns the new mesh (the old meshes are destroyed). + * + * __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + * + * __gl_meshZapFace( fZap ) destroys a face and removes it from the + * global face list. All edges of fZap will have a NULL pointer as their + * left face. Any edges which also have a NULL pointer as their right face + * are deleted entirely (along with any isolated vertices this produces). + * An entire mesh can be deleted by zapping its faces, one at a time, + * in any order. Zapped faces cannot be used in further mesh operations! + * + * __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. + */ + +GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ); +int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ); +int __gl_meshDelete( GLUhalfEdge *eDel ); + +GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg ); +GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg ); +GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ); + +GLUmesh *__gl_meshNewMesh( void ); +GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 ); +void __gl_meshDeleteMesh( GLUmesh *mesh ); +void __gl_meshZapFace( GLUface *fZap ); + +#ifdef NDEBUG +#define __gl_meshCheckMesh( mesh ) +#else +void __gl_meshCheckMesh( GLUmesh *mesh ); +#endif + +#endif diff --git a/cogl-path/tesselator/normal.c b/cogl-path/tesselator/normal.c new file mode 100644 index 0000000..9a3bd43 --- /dev/null +++ b/cogl-path/tesselator/normal.c @@ -0,0 +1,257 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include "mesh.h" +#include "tess.h" +#include "normal.h" +#include +#include + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2]) + +#if 0 +static void Normalize( GLdouble v[3] ) +{ + GLdouble len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; + + assert( len > 0 ); + len = sqrt( len ); + v[0] /= len; + v[1] /= len; + v[2] /= len; +} +#endif + +#undef ABS +#define ABS(x) ((x) < 0 ? -(x) : (x)) + +static int LongAxis( GLdouble v[3] ) +{ + int i = 0; + + if( ABS(v[1]) > ABS(v[0]) ) { i = 1; } + if( ABS(v[2]) > ABS(v[i]) ) { i = 2; } + return i; +} + +static void ComputeNormal( GLUtesselator *tess, GLdouble norm[3] ) +{ + GLUvertex *v, *v1, *v2; + GLdouble c, tLen2, maxLen2; + GLdouble maxVal[3], minVal[3], d1[3], d2[3], tNorm[3]; + GLUvertex *maxVert[3], *minVert[3]; + GLUvertex *vHead = &tess->mesh->vHead; + int i; + + maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU_TESS_MAX_COORD; + minVal[0] = minVal[1] = minVal[2] = 2 * GLU_TESS_MAX_COORD; + + for( v = vHead->next; v != vHead; v = v->next ) { + for( i = 0; i < 3; ++i ) { + c = v->coords[i]; + if( c < minVal[i] ) { minVal[i] = c; minVert[i] = v; } + if( c > maxVal[i] ) { maxVal[i] = c; maxVert[i] = v; } + } + } + + /* Find two vertices separated by at least 1/sqrt(3) of the maximum + * distance between any two vertices + */ + i = 0; + if( maxVal[1] - minVal[1] > maxVal[0] - minVal[0] ) { i = 1; } + if( maxVal[2] - minVal[2] > maxVal[i] - minVal[i] ) { i = 2; } + if( minVal[i] >= maxVal[i] ) { + /* All vertices are the same -- normal doesn't matter */ + norm[0] = 0; norm[1] = 0; norm[2] = 1; + return; + } + + /* Look for a third vertex which forms the triangle with maximum area + * (Length of normal == twice the triangle area) + */ + maxLen2 = 0; + v1 = minVert[i]; + v2 = maxVert[i]; + d1[0] = v1->coords[0] - v2->coords[0]; + d1[1] = v1->coords[1] - v2->coords[1]; + d1[2] = v1->coords[2] - v2->coords[2]; + for( v = vHead->next; v != vHead; v = v->next ) { + d2[0] = v->coords[0] - v2->coords[0]; + d2[1] = v->coords[1] - v2->coords[1]; + d2[2] = v->coords[2] - v2->coords[2]; + tNorm[0] = d1[1]*d2[2] - d1[2]*d2[1]; + tNorm[1] = d1[2]*d2[0] - d1[0]*d2[2]; + tNorm[2] = d1[0]*d2[1] - d1[1]*d2[0]; + tLen2 = tNorm[0]*tNorm[0] + tNorm[1]*tNorm[1] + tNorm[2]*tNorm[2]; + if( tLen2 > maxLen2 ) { + maxLen2 = tLen2; + norm[0] = tNorm[0]; + norm[1] = tNorm[1]; + norm[2] = tNorm[2]; + } + } + + if( maxLen2 <= 0 ) { + /* All points lie on a single line -- any decent normal will do */ + norm[0] = norm[1] = norm[2] = 0; + norm[LongAxis(d1)] = 1; + } +} + + +static void CheckOrientation( GLUtesselator *tess ) +{ + GLdouble area; + GLUface *f, *fHead = &tess->mesh->fHead; + GLUvertex *v, *vHead = &tess->mesh->vHead; + GLUhalfEdge *e; + + /* When we compute the normal automatically, we choose the orientation + * so that the sum of the signed areas of all contours is non-negative. + */ + area = 0; + for( f = fHead->next; f != fHead; f = f->next ) { + e = f->anEdge; + if( e->winding <= 0 ) continue; + do { + area += (e->Org->s - e->Dst->s) * (e->Org->t + e->Dst->t); + e = e->Lnext; + } while( e != f->anEdge ); + } + if( area < 0 ) { + /* Reverse the orientation by flipping all the t-coordinates */ + for( v = vHead->next; v != vHead; v = v->next ) { + v->t = - v->t; + } + tess->tUnit[0] = - tess->tUnit[0]; + tess->tUnit[1] = - tess->tUnit[1]; + tess->tUnit[2] = - tess->tUnit[2]; + } +} + +#ifdef FOR_TRITE_TEST_PROGRAM +#include +extern int RandomSweep; +#define S_UNIT_X (RandomSweep ? (2*drand48()-1) : 1.0) +#define S_UNIT_Y (RandomSweep ? (2*drand48()-1) : 0.0) +#else +#if defined(SLANTED_SWEEP) +/* The "feature merging" is not intended to be complete. There are + * special cases where edges are nearly parallel to the sweep line + * which are not implemented. The algorithm should still behave + * robustly (ie. produce a reasonable tesselation) in the presence + * of such edges, however it may miss features which could have been + * merged. We could minimize this effect by choosing the sweep line + * direction to be something unusual (ie. not parallel to one of the + * coordinate axes). + */ +#define S_UNIT_X 0.50941539564955385 /* Pre-normalized */ +#define S_UNIT_Y 0.86052074622010633 +#else +#define S_UNIT_X 1.0 +#define S_UNIT_Y 0.0 +#endif +#endif + +/* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ +void __gl_projectPolygon( GLUtesselator *tess ) +{ + GLUvertex *v, *vHead = &tess->mesh->vHead; + GLdouble norm[3]; + GLdouble *sUnit, *tUnit; + int i, computedNormal = FALSE; + + norm[0] = tess->normal[0]; + norm[1] = tess->normal[1]; + norm[2] = tess->normal[2]; + if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) { + ComputeNormal( tess, norm ); + computedNormal = TRUE; + } + sUnit = tess->sUnit; + tUnit = tess->tUnit; + i = LongAxis( norm ); + +#if defined(FOR_TRITE_TEST_PROGRAM) || defined(TRUE_PROJECT) + /* Choose the initial sUnit vector to be approximately perpendicular + * to the normal. + */ + Normalize( norm ); + + sUnit[i] = 0; + sUnit[(i+1)%3] = S_UNIT_X; + sUnit[(i+2)%3] = S_UNIT_Y; + + /* Now make it exactly perpendicular */ + w = Dot( sUnit, norm ); + sUnit[0] -= w * norm[0]; + sUnit[1] -= w * norm[1]; + sUnit[2] -= w * norm[2]; + Normalize( sUnit ); + + /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */ + tUnit[0] = norm[1]*sUnit[2] - norm[2]*sUnit[1]; + tUnit[1] = norm[2]*sUnit[0] - norm[0]*sUnit[2]; + tUnit[2] = norm[0]*sUnit[1] - norm[1]*sUnit[0]; + Normalize( tUnit ); +#else + /* Project perpendicular to a coordinate axis -- better numerically */ + sUnit[i] = 0; + sUnit[(i+1)%3] = S_UNIT_X; + sUnit[(i+2)%3] = S_UNIT_Y; + + tUnit[i] = 0; + tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; + tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; +#endif + + /* Project the vertices onto the sweep plane */ + for( v = vHead->next; v != vHead; v = v->next ) { + v->s = Dot( v->coords, sUnit ); + v->t = Dot( v->coords, tUnit ); + } + if( computedNormal ) { + CheckOrientation( tess ); + } +} diff --git a/cogl-path/tesselator/normal.h b/cogl-path/tesselator/normal.h new file mode 100644 index 0000000..c376ca4 --- /dev/null +++ b/cogl-path/tesselator/normal.h @@ -0,0 +1,45 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __normal_h_ +#define __normal_h_ + +#include "tess.h" + +/* __gl_projectPolygon( tess ) determines the polygon normal + * and project vertices onto the plane of the polygon. + */ +void __gl_projectPolygon( GLUtesselator *tess ); + +#endif diff --git a/cogl-path/tesselator/priorityq-heap.c b/cogl-path/tesselator/priorityq-heap.c new file mode 100644 index 0000000..52698b5 --- /dev/null +++ b/cogl-path/tesselator/priorityq-heap.c @@ -0,0 +1,256 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include +#include +#include "priorityq-heap.h" +#include "memalloc.h" + +#define INIT_SIZE 32 + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#ifdef FOR_TRITE_TEST_PROGRAM +#define LEQ(x,y) (*pq->leq)(x,y) +#else +/* Violates modularity, but a little faster */ +#include "geom.h" +#define LEQ(x,y) VertLeq((GLUvertex *)x, (GLUvertex *)y) +#endif + +/* really __gl_pqHeapNewPriorityQ */ +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ) +{ + PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ )); + if (pq == NULL) return NULL; + + pq->size = 0; + pq->max = INIT_SIZE; + pq->nodes = (PQnode *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->nodes[0]) ); + if (pq->nodes == NULL) { + memFree(pq); + return NULL; + } + + pq->handles = (PQhandleElem *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->handles[0]) ); + if (pq->handles == NULL) { + memFree(pq->nodes); + memFree(pq); + return NULL; + } + + pq->initialized = FALSE; + pq->freeList = 0; + pq->leq = leq; + + pq->nodes[1].handle = 1; /* so that Minimum() returns NULL */ + pq->handles[1].key = NULL; + return pq; +} + +/* really __gl_pqHeapDeletePriorityQ */ +void pqDeletePriorityQ( PriorityQ *pq ) +{ + memFree( pq->handles ); + memFree( pq->nodes ); + memFree( pq ); +} + + +static void FloatDown( PriorityQ *pq, long curr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hCurr, hChild; + long child; + + hCurr = n[curr].handle; + for( ;; ) { + child = curr << 1; + if( child < pq->size && LEQ( h[n[child+1].handle].key, + h[n[child].handle].key )) { + ++child; + } + + assert(child <= pq->max); + + hChild = n[child].handle; + if( child > pq->size || LEQ( h[hCurr].key, h[hChild].key )) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hChild; + h[hChild].node = curr; + curr = child; + } +} + + +static void FloatUp( PriorityQ *pq, long curr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hCurr, hParent; + long parent; + + hCurr = n[curr].handle; + for( ;; ) { + parent = curr >> 1; + hParent = n[parent].handle; + if( parent == 0 || LEQ( h[hParent].key, h[hCurr].key )) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hParent; + h[hParent].node = curr; + curr = parent; + } +} + +/* really __gl_pqHeapInit */ +void pqInit( PriorityQ *pq ) +{ + long i; + + /* This method of building a heap is O(n), rather than O(n lg n). */ + + for( i = pq->size; i >= 1; --i ) { + FloatDown( pq, i ); + } + pq->initialized = TRUE; +} + +/* really __gl_pqHeapInsert */ +/* returns LONG_MAX iff out of memory */ +PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) +{ + long curr; + PQhandle free_handle; + + curr = ++ pq->size; + if( (curr*2) > pq->max ) { + PQnode *saveNodes= pq->nodes; + PQhandleElem *saveHandles= pq->handles; + + /* If the heap overflows, double its size. */ + pq->max <<= 1; + pq->nodes = (PQnode *)memRealloc( pq->nodes, + (size_t) + ((pq->max + 1) * sizeof( pq->nodes[0] ))); + if (pq->nodes == NULL) { + pq->nodes = saveNodes; /* restore ptr to free upon return */ + return LONG_MAX; + } + pq->handles = (PQhandleElem *)memRealloc( pq->handles, + (size_t) + ((pq->max + 1) * + sizeof( pq->handles[0] ))); + if (pq->handles == NULL) { + pq->handles = saveHandles; /* restore ptr to free upon return */ + return LONG_MAX; + } + } + + if( pq->freeList == 0 ) { + free_handle = curr; + } else { + free_handle = pq->freeList; + pq->freeList = pq->handles[free_handle].node; + } + + pq->nodes[curr].handle = free_handle; + pq->handles[free_handle].node = curr; + pq->handles[free_handle].key = keyNew; + + if( pq->initialized ) { + FloatUp( pq, curr ); + } + assert(free_handle != LONG_MAX); + return free_handle; +} + +/* really __gl_pqHeapExtractMin */ +PQkey pqExtractMin( PriorityQ *pq ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hMin = n[1].handle; + PQkey min = h[hMin].key; + + if( pq->size > 0 ) { + n[1].handle = n[pq->size].handle; + h[n[1].handle].node = 1; + + h[hMin].key = NULL; + h[hMin].node = pq->freeList; + pq->freeList = hMin; + + if( -- pq->size > 0 ) { + FloatDown( pq, 1 ); + } + } + return min; +} + +/* really __gl_pqHeapDelete */ +void pqDelete( PriorityQ *pq, PQhandle hCurr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + long curr; + + assert( hCurr >= 1 && hCurr <= pq->max && h[hCurr].key != NULL ); + + curr = h[hCurr].node; + n[curr].handle = n[pq->size].handle; + h[n[curr].handle].node = curr; + + if( curr <= -- pq->size ) { + if( curr <= 1 || LEQ( h[n[curr>>1].handle].key, h[n[curr].handle].key )) { + FloatDown( pq, curr ); + } else { + FloatUp( pq, curr ); + } + } + h[hCurr].key = NULL; + h[hCurr].node = pq->freeList; + pq->freeList = hCurr; +} diff --git a/cogl-path/tesselator/priorityq-heap.h b/cogl-path/tesselator/priorityq-heap.h new file mode 100644 index 0000000..dc9aaef --- /dev/null +++ b/cogl-path/tesselator/priorityq-heap.h @@ -0,0 +1,107 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_heap_h_ +#define __priorityq_heap_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQHeapKey +#define PQhandle PQHeapHandle +#define PriorityQ PriorityQHeap + +#define pqNewPriorityQ(leq) __gl_pqHeapNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqHeapDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqHeapInit(pq) +#define pqInsert(pq,key) __gl_pqHeapInsert(pq,key) +#define pqMinimum(pq) __gl_pqHeapMinimum(pq) +#define pqExtractMin(pq) __gl_pqHeapExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqHeapDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqHeapIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef void *PQkey; +typedef long PQhandle; +typedef struct PriorityQ PriorityQ; + +typedef struct { PQhandle handle; } PQnode; +typedef struct { PQkey key; PQhandle node; } PQhandleElem; + +struct PriorityQ { + PQnode *nodes; + PQhandleElem *handles; + long size, max; + PQhandle freeList; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +void pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + + +#define __gl_pqHeapMinimum(pq) ((pq)->handles[(pq)->nodes[1].handle].key) +#define __gl_pqHeapIsEmpty(pq) ((pq)->size == 0) + +#endif diff --git a/cogl-path/tesselator/priorityq-sort.h b/cogl-path/tesselator/priorityq-sort.h new file mode 100644 index 0000000..746cf5f --- /dev/null +++ b/cogl-path/tesselator/priorityq-sort.h @@ -0,0 +1,117 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_sort_h_ +#define __priorityq_sort_h_ + +#include "priorityq-heap.h" + +#undef PQkey +#undef PQhandle +#undef PriorityQ +#undef pqNewPriorityQ +#undef pqDeletePriorityQ +#undef pqInit +#undef pqInsert +#undef pqMinimum +#undef pqExtractMin +#undef pqDelete +#undef pqIsEmpty + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQSortKey +#define PQhandle PQSortHandle +#define PriorityQ PriorityQSort + +#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqSortInit(pq) +#define pqInsert(pq,key) __gl_pqSortInsert(pq,key) +#define pqMinimum(pq) __gl_pqSortMinimum(pq) +#define pqExtractMin(pq) __gl_pqSortExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef PQHeapKey PQkey; +typedef PQHeapHandle PQhandle; +typedef struct PriorityQ PriorityQ; + +struct PriorityQ { + PriorityQHeap *heap; + PQkey *keys; + PQkey **order; + PQhandle size, max; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +int pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + +PQkey pqMinimum( PriorityQ *pq ); +int pqIsEmpty( PriorityQ *pq ); + +#endif diff --git a/cogl-path/tesselator/priorityq.c b/cogl-path/tesselator/priorityq.c new file mode 100644 index 0000000..db7cd59 --- /dev/null +++ b/cogl-path/tesselator/priorityq.c @@ -0,0 +1,261 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include /* LONG_MAX */ +#include "memalloc.h" + +/* Include all the code for the regular heap-based queue here. */ + +#include "priorityq-heap.c" + +/* Now redefine all the function names to map to their "Sort" versions. */ + +#include "priorityq-sort.h" + +/* really __gl_pqSortNewPriorityQ */ +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ) +{ + PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ )); + if (pq == NULL) return NULL; + + pq->heap = __gl_pqHeapNewPriorityQ( leq ); + if (pq->heap == NULL) { + memFree(pq); + return NULL; + } + + pq->keys = (PQHeapKey *)memAlloc( INIT_SIZE * sizeof(pq->keys[0]) ); + if (pq->keys == NULL) { + __gl_pqHeapDeletePriorityQ(pq->heap); + memFree(pq); + return NULL; + } + + pq->order = NULL; + pq->size = 0; + pq->max = INIT_SIZE; + pq->initialized = FALSE; + pq->leq = leq; + return pq; +} + +/* really __gl_pqSortDeletePriorityQ */ +void pqDeletePriorityQ( PriorityQ *pq ) +{ + assert(pq != NULL); + if (pq->heap != NULL) __gl_pqHeapDeletePriorityQ( pq->heap ); + if (pq->order != NULL) memFree( pq->order ); + if (pq->keys != NULL) memFree( pq->keys ); + memFree( pq ); +} + + +#define LT(x,y) (! LEQ(y,x)) +#define GT(x,y) (! LEQ(x,y)) +#define Swap(a,b) do{PQkey *tmp = *a; *a = *b; *b = tmp;}while(0) + +/* really __gl_pqSortInit */ +int pqInit( PriorityQ *pq ) +{ + PQkey **p, **r, **i, **j, *piv; + struct { PQkey **p, **r; } Stack[50], *top = Stack; + unsigned long seed = 2016473283; + + /* Create an array of indirect pointers to the keys, so that we + * the handles we have returned are still valid. + */ +/* + pq->order = (PQHeapKey **)memAlloc( (size_t) + (pq->size * sizeof(pq->order[0])) ); +*/ + pq->order = (PQHeapKey **)memAlloc( (size_t) + ((pq->size+1) * sizeof(pq->order[0])) ); +/* the previous line is a patch to compensate for the fact that IBM */ +/* machines return a null on a malloc of zero bytes (unlike SGI), */ +/* so we have to put in this defense to guard against a memory */ +/* fault four lines down. from fossum@austin.ibm.com. */ + if (pq->order == NULL) return 0; + + p = pq->order; + r = p + pq->size - 1; + for( piv = pq->keys, i = p; i <= r; ++piv, ++i ) { + *i = piv; + } + + /* Sort the indirect pointers in descending order, + * using randomized Quicksort + */ + top->p = p; top->r = r; ++top; + while( --top >= Stack ) { + p = top->p; + r = top->r; + while( r > p + 10 ) { + seed = seed * 1539415821 + 1; + i = p + seed % (r - p + 1); + piv = *i; + *i = *p; + *p = piv; + i = p - 1; + j = r + 1; + do { + do { ++i; } while( GT( **i, *piv )); + do { --j; } while( LT( **j, *piv )); + Swap( i, j ); + } while( i < j ); + Swap( i, j ); /* Undo last swap */ + if( i - p < r - j ) { + top->p = j+1; top->r = r; ++top; + r = i-1; + } else { + top->p = p; top->r = i-1; ++top; + p = j+1; + } + } + /* Insertion sort small lists */ + for( i = p+1; i <= r; ++i ) { + piv = *i; + for( j = i; j > p && LT( **(j-1), *piv ); --j ) { + *j = *(j-1); + } + *j = piv; + } + } + pq->max = pq->size; + pq->initialized = TRUE; + __gl_pqHeapInit( pq->heap ); /* always succeeds */ + +#ifndef NDEBUG + p = pq->order; + r = p + pq->size - 1; + for( i = p; i < r; ++i ) { + assert( LEQ( **(i+1), **i )); + } +#endif + + return 1; +} + +/* really __gl_pqSortInsert */ +/* returns LONG_MAX iff out of memory */ +PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) +{ + long curr; + + if( pq->initialized ) { + return __gl_pqHeapInsert( pq->heap, keyNew ); + } + curr = pq->size; + if( ++ pq->size >= pq->max ) { + PQkey *saveKey= pq->keys; + + /* If the heap overflows, double its size. */ + pq->max <<= 1; + pq->keys = (PQHeapKey *)memRealloc( pq->keys, + (size_t) + (pq->max * sizeof( pq->keys[0] ))); + if (pq->keys == NULL) { + pq->keys = saveKey; /* restore ptr to free upon return */ + return LONG_MAX; + } + } + assert(curr != LONG_MAX); + pq->keys[curr] = keyNew; + + /* Negative handles index the sorted array. */ + return -(curr+1); +} + +/* really __gl_pqSortExtractMin */ +PQkey pqExtractMin( PriorityQ *pq ) +{ + PQkey sortMin, heapMin; + + if( pq->size == 0 ) { + return __gl_pqHeapExtractMin( pq->heap ); + } + sortMin = *(pq->order[pq->size-1]); + if( ! __gl_pqHeapIsEmpty( pq->heap )) { + heapMin = __gl_pqHeapMinimum( pq->heap ); + if( LEQ( heapMin, sortMin )) { + return __gl_pqHeapExtractMin( pq->heap ); + } + } + do { + -- pq->size; + } while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ); + return sortMin; +} + +/* really __gl_pqSortMinimum */ +PQkey pqMinimum( PriorityQ *pq ) +{ + PQkey sortMin, heapMin; + + if( pq->size == 0 ) { + return __gl_pqHeapMinimum( pq->heap ); + } + sortMin = *(pq->order[pq->size-1]); + if( ! __gl_pqHeapIsEmpty( pq->heap )) { + heapMin = __gl_pqHeapMinimum( pq->heap ); + if( LEQ( heapMin, sortMin )) { + return heapMin; + } + } + return sortMin; +} + +/* really __gl_pqSortIsEmpty */ +int pqIsEmpty( PriorityQ *pq ) +{ + return (pq->size == 0) && __gl_pqHeapIsEmpty( pq->heap ); +} + +/* really __gl_pqSortDelete */ +void pqDelete( PriorityQ *pq, PQhandle curr ) +{ + if( curr >= 0 ) { + __gl_pqHeapDelete( pq->heap, curr ); + return; + } + curr = -(curr+1); + assert( curr < pq->max && pq->keys[curr] != NULL ); + + pq->keys[curr] = NULL; + while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ) { + -- pq->size; + } +} diff --git a/cogl-path/tesselator/priorityq.h b/cogl-path/tesselator/priorityq.h new file mode 100644 index 0000000..746cf5f --- /dev/null +++ b/cogl-path/tesselator/priorityq.h @@ -0,0 +1,117 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_sort_h_ +#define __priorityq_sort_h_ + +#include "priorityq-heap.h" + +#undef PQkey +#undef PQhandle +#undef PriorityQ +#undef pqNewPriorityQ +#undef pqDeletePriorityQ +#undef pqInit +#undef pqInsert +#undef pqMinimum +#undef pqExtractMin +#undef pqDelete +#undef pqIsEmpty + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQSortKey +#define PQhandle PQSortHandle +#define PriorityQ PriorityQSort + +#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqSortInit(pq) +#define pqInsert(pq,key) __gl_pqSortInsert(pq,key) +#define pqMinimum(pq) __gl_pqSortMinimum(pq) +#define pqExtractMin(pq) __gl_pqSortExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef PQHeapKey PQkey; +typedef PQHeapHandle PQhandle; +typedef struct PriorityQ PriorityQ; + +struct PriorityQ { + PriorityQHeap *heap; + PQkey *keys; + PQkey **order; + PQhandle size, max; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +int pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + +PQkey pqMinimum( PriorityQ *pq ); +int pqIsEmpty( PriorityQ *pq ); + +#endif diff --git a/cogl-path/tesselator/render.c b/cogl-path/tesselator/render.c new file mode 100644 index 0000000..bca836f --- /dev/null +++ b/cogl-path/tesselator/render.c @@ -0,0 +1,502 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include "mesh.h" +#include "tess.h" +#include "render.h" + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +/* This structure remembers the information we need about a primitive + * to be able to render it later, once we have determined which + * primitive is able to use the most triangles. + */ +struct FaceCount { + long size; /* number of triangles used */ + GLUhalfEdge *eStart; /* edge where this primitive starts */ + void (*render)(GLUtesselator *, GLUhalfEdge *, long); + /* routine to render this primitive */ +}; + +static struct FaceCount MaximumFan( GLUhalfEdge *eOrig ); +static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig ); + +static void RenderFan( GLUtesselator *tess, GLUhalfEdge *eStart, long size ); +static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *eStart, long size ); +static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *eStart, + long size ); + +static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ); +static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *head ); + + + +/************************ Strips and Fans decomposition ******************/ + +/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle + * fans, strips, and separate triangles. A substantial effort is made + * to use as few rendering primitives as possible (ie. to make the fans + * and strips as large as possible). + * + * The rendering output is provided as callbacks (see the api). + */ +void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh ) +{ + GLUface *f; + + /* Make a list of separate triangles so we can render them all at once */ + tess->lonelyTriList = NULL; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + f->marked = FALSE; + } + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + + /* We examine all faces in an arbitrary order. Whenever we find + * an unprocessed face F, we output a group of faces including F + * whose size is maximum. + */ + if( f->inside && ! f->marked ) { + RenderMaximumFaceGroup( tess, f ); + assert( f->marked ); + } + } + if( tess->lonelyTriList != NULL ) { + RenderLonelyTriangles( tess, tess->lonelyTriList ); + tess->lonelyTriList = NULL; + } +} + + +static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ) +{ + /* We want to find the largest triangle fan or strip of unmarked faces + * which includes the given face fOrig. There are 3 possible fans + * passing through fOrig (one centered at each vertex), and 3 possible + * strips (one for each CCW permutation of the vertices). Our strategy + * is to try all of these, and take the primitive which uses the most + * triangles (a greedy approach). + */ + GLUhalfEdge *e = fOrig->anEdge; + struct FaceCount max, newFace; + + max.size = 1; + max.eStart = e; + max.render = &RenderTriangle; + + if( ! tess->flagBoundary ) { + newFace = MaximumFan( e ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumFan( e->Lnext ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumFan( e->Lprev ); if( newFace.size > max.size ) { max = newFace; } + + newFace = MaximumStrip( e ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumStrip( e->Lnext ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumStrip( e->Lprev ); if( newFace.size > max.size ) { max = newFace; } + } + (*(max.render))( tess, max.eStart, max.size ); +} + + +/* Macros which keep track of faces we have marked temporarily, and allow + * us to backtrack when necessary. With triangle fans, this is not + * really necessary, since the only awkward case is a loop of triangles + * around a single origin vertex. However with strips the situation is + * more complicated, and we need a general tracking method like the + * one here. + */ +#define Marked(f) (! (f)->inside || (f)->marked) + +#define AddToTrail(f,t) ((f)->trail = (t), (t) = (f), (f)->marked = TRUE) + +#define FreeTrail(t) do { \ + while( (t) != NULL ) { \ + (t)->marked = FALSE; t = (t)->trail; \ + } \ + } while(0) /* absorb trailing semicolon */ + + + +static struct FaceCount MaximumFan( GLUhalfEdge *eOrig ) +{ + /* eOrig->Lface is the face we want to render. We want to find the size + * of a maximal fan around eOrig->Org. To do this we just walk around + * the origin vertex as far as possible in both directions. + */ + struct FaceCount newFace = { 0, NULL, &RenderFan }; + GLUface *trail = NULL; + GLUhalfEdge *e; + + for( e = eOrig; ! Marked( e->Lface ); e = e->Onext ) { + AddToTrail( e->Lface, trail ); + ++newFace.size; + } + for( e = eOrig; ! Marked( e->Rface ); e = e->Oprev ) { + AddToTrail( e->Rface, trail ); + ++newFace.size; + } + newFace.eStart = e; + /*LINTED*/ + FreeTrail( trail ); + return newFace; +} + + +#define IsEven(n) (((n) & 1) == 0) + +static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig ) +{ + /* Here we are looking for a maximal strip that contains the vertices + * eOrig->Org, eOrig->Dst, eOrig->Lnext->Dst (in that order or the + * reverse, such that all triangles are oriented CCW). + * + * Again we walk forward and backward as far as possible. However for + * strips there is a twist: to get CCW orientations, there must be + * an *even* number of triangles in the strip on one side of eOrig. + * We walk the strip starting on a side with an even number of triangles; + * if both side have an odd number, we are forced to shorten one side. + */ + struct FaceCount newFace = { 0, NULL, &RenderStrip }; + long headSize = 0, tailSize = 0; + GLUface *trail = NULL; + GLUhalfEdge *e, *eTail, *eHead; + + for( e = eOrig; ! Marked( e->Lface ); ++tailSize, e = e->Onext ) { + AddToTrail( e->Lface, trail ); + ++tailSize; + e = e->Dprev; + if( Marked( e->Lface )) break; + AddToTrail( e->Lface, trail ); + } + eTail = e; + + for( e = eOrig; ! Marked( e->Rface ); ++headSize, e = e->Dnext ) { + AddToTrail( e->Rface, trail ); + ++headSize; + e = e->Oprev; + if( Marked( e->Rface )) break; + AddToTrail( e->Rface, trail ); + } + eHead = e; + + newFace.size = tailSize + headSize; + if( IsEven( tailSize )) { + newFace.eStart = eTail->Sym; + } else if( IsEven( headSize )) { + newFace.eStart = eHead; + } else { + /* Both sides have odd length, we must shorten one of them. In fact, + * we must start from eHead to guarantee inclusion of eOrig->Lface. + */ + --newFace.size; + newFace.eStart = eHead->Onext; + } + /*LINTED*/ + FreeTrail( trail ); + return newFace; +} + + +static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Just add the triangle to a triangle list, so we can render all + * the separate triangles at once. + */ + assert( size == 1 ); + AddToTrail( e->Lface, tess->lonelyTriList ); +} + + +static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *f ) +{ + /* Now we render all the separate triangles which could not be + * grouped into a triangle fan or strip. + */ + GLUhalfEdge *e; + int newState; + int edgeState = -1; /* force edge state output for first vertex */ + + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLES ); + + for( ; f != NULL; f = f->trail ) { + /* Loop once for each edge (there will always be 3 edges) */ + + e = f->anEdge; + do { + if( tess->flagBoundary ) { + /* Set the "edge state" to TRUE just before we output the + * first vertex of each edge on the polygon boundary. + */ + newState = ! e->Rface->inside; + if( edgeState != newState ) { + edgeState = newState; + CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA( edgeState ); + } + } + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + + e = e->Lnext; + } while( e != f->anEdge ); + } + CALL_END_OR_END_DATA(); +} + + +static void RenderFan( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Render as many CCW triangles as possible in a fan starting from + * edge "e". The fan *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_FAN ); + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + + while( ! Marked( e->Lface )) { + e->Lface->marked = TRUE; + --size; + e = e->Onext; + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + } + + assert( size == 0 ); + CALL_END_OR_END_DATA(); +} + + +static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Render as many CCW triangles as possible in a strip starting from + * edge "e". The strip *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_STRIP ); + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + + while( ! Marked( e->Lface )) { + e->Lface->marked = TRUE; + --size; + e = e->Dprev; + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + if( Marked( e->Lface )) break; + + e->Lface->marked = TRUE; + --size; + e = e->Onext; + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + } + + assert( size == 0 ); + CALL_END_OR_END_DATA(); +} + + +/************************ Boundary contour decomposition ******************/ + +/* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one + * contour for each face marked "inside". The rendering output is + * provided as callbacks (see the api). + */ +void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh ) +{ + GLUface *f; + GLUhalfEdge *e; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + if( f->inside ) { + CALL_BEGIN_OR_BEGIN_DATA( GL_LINE_LOOP ); + e = f->anEdge; + do { + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + e = e->Lnext; + } while( e != f->anEdge ); + CALL_END_OR_END_DATA(); + } + } +} + + +/************************ Quick-and-dirty decomposition ******************/ + +#define SIGN_INCONSISTENT 2 + +static int ComputeNormal( GLUtesselator *tess, GLdouble norm[3], int check ) +/* + * If check==FALSE, we compute the polygon normal and place it in norm[]. + * If check==TRUE, we check that each triangle in the fan from v0 has a + * consistent orientation with respect to norm[]. If triangles are + * consistently oriented CCW, return 1; if CW, return -1; if all triangles + * are degenerate return 0; otherwise (no consistent orientation) return + * SIGN_INCONSISTENT. + */ +{ + CachedVertex *v0 = tess->cache; + CachedVertex *vn = v0 + tess->cacheCount; + CachedVertex *vc; + GLdouble dot, xc, yc, zc, xp, yp, zp, n[3]; + int sign = 0; + + /* Find the polygon normal. It is important to get a reasonable + * normal even when the polygon is self-intersecting (eg. a bowtie). + * Otherwise, the computed normal could be very tiny, but perpendicular + * to the true plane of the polygon due to numerical noise. Then all + * the triangles would appear to be degenerate and we would incorrectly + * decompose the polygon as a fan (or simply not render it at all). + * + * We use a sum-of-triangles normal algorithm rather than the more + * efficient sum-of-trapezoids method (used in CheckOrientation() + * in normal.c). This lets us explicitly reverse the signed area + * of some triangles to get a reasonable normal in the self-intersecting + * case. + */ + if( ! check ) { + norm[0] = norm[1] = norm[2] = 0.0; + } + + vc = v0 + 1; + xc = vc->coords[0] - v0->coords[0]; + yc = vc->coords[1] - v0->coords[1]; + zc = vc->coords[2] - v0->coords[2]; + while( ++vc < vn ) { + xp = xc; yp = yc; zp = zc; + xc = vc->coords[0] - v0->coords[0]; + yc = vc->coords[1] - v0->coords[1]; + zc = vc->coords[2] - v0->coords[2]; + + /* Compute (vp - v0) cross (vc - v0) */ + n[0] = yp*zc - zp*yc; + n[1] = zp*xc - xp*zc; + n[2] = xp*yc - yp*xc; + + dot = n[0]*norm[0] + n[1]*norm[1] + n[2]*norm[2]; + if( ! check ) { + /* Reverse the contribution of back-facing triangles to get + * a reasonable normal for self-intersecting polygons (see above) + */ + if( dot >= 0 ) { + norm[0] += n[0]; norm[1] += n[1]; norm[2] += n[2]; + } else { + norm[0] -= n[0]; norm[1] -= n[1]; norm[2] -= n[2]; + } + } else if( dot != 0 ) { + /* Check the new orientation for consistency with previous triangles */ + if( dot > 0 ) { + if( sign < 0 ) return SIGN_INCONSISTENT; + sign = 1; + } else { + if( sign > 0 ) return SIGN_INCONSISTENT; + sign = -1; + } + } + } + return sign; +} + +/* __gl_renderCache( tess ) takes a single contour and tries to render it + * as a triangle fan. This handles convex polygons, as well as some + * non-convex polygons if we get lucky. + * + * Returns TRUE if the polygon was successfully rendered. The rendering + * output is provided as callbacks (see the api). + */ +GLboolean __gl_renderCache( GLUtesselator *tess ) +{ + CachedVertex *v0 = tess->cache; + CachedVertex *vn = v0 + tess->cacheCount; + CachedVertex *vc; + GLdouble norm[3]; + int sign; + + if( tess->cacheCount < 3 ) { + /* Degenerate contour -- no output */ + return TRUE; + } + + norm[0] = tess->normal[0]; + norm[1] = tess->normal[1]; + norm[2] = tess->normal[2]; + if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) { + ComputeNormal( tess, norm, FALSE ); + } + + sign = ComputeNormal( tess, norm, TRUE ); + if( sign == SIGN_INCONSISTENT ) { + /* Fan triangles did not have a consistent orientation */ + return FALSE; + } + if( sign == 0 ) { + /* All triangles were degenerate */ + return TRUE; + } + + /* Make sure we do the right thing for each winding rule */ + switch( tess->windingRule ) { + case GLU_TESS_WINDING_ODD: + case GLU_TESS_WINDING_NONZERO: + break; + case GLU_TESS_WINDING_POSITIVE: + if( sign < 0 ) return TRUE; + break; + case GLU_TESS_WINDING_NEGATIVE: + if( sign > 0 ) return TRUE; + break; + case GLU_TESS_WINDING_ABS_GEQ_TWO: + return TRUE; + } + + CALL_BEGIN_OR_BEGIN_DATA( tess->boundaryOnly ? GL_LINE_LOOP + : (tess->cacheCount > 3) ? GL_TRIANGLE_FAN + : GL_TRIANGLES ); + + CALL_VERTEX_OR_VERTEX_DATA( v0->data ); + if( sign > 0 ) { + for( vc = v0+1; vc < vn; ++vc ) { + CALL_VERTEX_OR_VERTEX_DATA( vc->data ); + } + } else { + for( vc = vn-1; vc > v0; --vc ) { + CALL_VERTEX_OR_VERTEX_DATA( vc->data ); + } + } + CALL_END_OR_END_DATA(); + return TRUE; +} diff --git a/cogl-path/tesselator/render.h b/cogl-path/tesselator/render.h new file mode 100644 index 0000000..a298c9a --- /dev/null +++ b/cogl-path/tesselator/render.h @@ -0,0 +1,52 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __render_h_ +#define __render_h_ + +#include "mesh.h" + +/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle + * fans, strips, and separate triangles. A substantial effort is made + * to use as few rendering primitives as possible (ie. to make the fans + * and strips as large as possible). + * + * The rendering output is provided as callbacks (see the api). + */ +void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh ); +void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh ); + +GLboolean __gl_renderCache( GLUtesselator *tess ); + +#endif diff --git a/cogl-path/tesselator/sweep.c b/cogl-path/tesselator/sweep.c new file mode 100644 index 0000000..eca828f --- /dev/null +++ b/cogl-path/tesselator/sweep.c @@ -0,0 +1,1361 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include /* longjmp */ +#include /* LONG_MAX */ + +#include "mesh.h" +#include "geom.h" +#include "tess.h" +#include "dict.h" +#include "priorityq.h" +#include "memalloc.h" +#include "sweep.h" + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#ifdef FOR_TRITE_TEST_PROGRAM +extern void DebugEvent( GLUtesselator *tess ); +#else +#define DebugEvent( tess ) +#endif + +/* + * Invariants for the Edge Dictionary. + * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) + * at any valid location of the sweep event + * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 + * share a common endpoint + * - for each e, e->Dst has been processed, but not e->Org + * - each edge e satisfies VertLeq(e->Dst,event) && VertLeq(event,e->Org) + * where "event" is the current sweep line event. + * - no edge e has zero length + * + * Invariants for the Mesh (the processed portion). + * - the portion of the mesh left of the sweep line is a planar graph, + * ie. there is *some* way to embed it in the plane + * - no processed edge has zero length + * - no two processed vertices have identical coordinates + * - each "inside" region is monotone, ie. can be broken into two chains + * of monotonically increasing vertices according to VertLeq(v1,v2) + * - a non-invariant: these chains may intersect (very slightly) + * + * Invariants for the Sweep. + * - if none of the edges incident to the event vertex have an activeRegion + * (ie. none of these edges are in the edge dictionary), then the vertex + * has only right-going edges. + * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced + * by ConnectRightVertex), then it is the only right-going edge from + * its associated vertex. (This says that these edges exist only + * when it is necessary.) + */ + +#undef MAX +#undef MIN +#define MAX(x,y) ((x) >= (y) ? (x) : (y)) +#define MIN(x,y) ((x) <= (y) ? (x) : (y)) + +/* When we merge two edges into one, we need to compute the combined + * winding of the new edge. + */ +#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \ + eDst->Sym->winding += eSrc->Sym->winding) + +static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ); +static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ); +static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp ); + +static int EdgeLeq( GLUtesselator *tess, ActiveRegion *reg1, + ActiveRegion *reg2 ) +/* + * Both edges must be directed from right to left (this is the canonical + * direction for the upper edge of each region). + * + * The strategy is to evaluate a "t" value for each edge at the + * current sweep line position, given by tess->event. The calculations + * are designed to be very stable, but of course they are not perfect. + * + * Special case: if both edge destinations are at the sweep event, + * we sort the edges by slope (they would otherwise compare equally). + */ +{ + GLUvertex *event = tess->event; + GLUhalfEdge *e1, *e2; + GLdouble t1, t2; + + e1 = reg1->eUp; + e2 = reg2->eUp; + + if( e1->Dst == event ) { + if( e2->Dst == event ) { + /* Two edges right of the sweep line which meet at the sweep event. + * Sort them by slope. + */ + if( VertLeq( e1->Org, e2->Org )) { + return EdgeSign( e2->Dst, e1->Org, e2->Org ) <= 0; + } + return EdgeSign( e1->Dst, e2->Org, e1->Org ) >= 0; + } + return EdgeSign( e2->Dst, event, e2->Org ) <= 0; + } + if( e2->Dst == event ) { + return EdgeSign( e1->Dst, event, e1->Org ) >= 0; + } + + /* General case - compute signed distance *from* e1, e2 to event */ + t1 = EdgeEval( e1->Dst, event, e1->Org ); + t2 = EdgeEval( e2->Dst, event, e2->Org ); + return (t1 >= t2); +} + + +static void DeleteRegion( GLUtesselator *tess, ActiveRegion *reg ) +{ + if( reg->fixUpperEdge ) { + /* It was created with zero winding number, so it better be + * deleted with zero winding number (ie. it better not get merged + * with a real edge). + */ + assert( reg->eUp->winding == 0 ); + } + reg->eUp->activeRegion = NULL; + dictDelete( tess->dict, reg->nodeUp ); /* __gl_dictListDelete */ + memFree( reg ); +} + + +static int FixUpperEdge( ActiveRegion *reg, GLUhalfEdge *newEdge ) +/* + * Replace an upper edge which needs fixing (see ConnectRightVertex). + */ +{ + assert( reg->fixUpperEdge ); + if ( !__gl_meshDelete( reg->eUp ) ) return 0; + reg->fixUpperEdge = FALSE; + reg->eUp = newEdge; + newEdge->activeRegion = reg; + + return 1; +} + +static ActiveRegion *TopLeftRegion( ActiveRegion *reg ) +{ + GLUvertex *org = reg->eUp->Org; + GLUhalfEdge *e; + + /* Find the region above the uppermost edge with the same origin */ + do { + reg = RegionAbove( reg ); + } while( reg->eUp->Org == org ); + + /* If the edge above was a temporary edge introduced by ConnectRightVertex, + * now is the time to fix it. + */ + if( reg->fixUpperEdge ) { + e = __gl_meshConnect( RegionBelow(reg)->eUp->Sym, reg->eUp->Lnext ); + if (e == NULL) return NULL; + if ( !FixUpperEdge( reg, e ) ) return NULL; + reg = RegionAbove( reg ); + } + return reg; +} + +static ActiveRegion *TopRightRegion( ActiveRegion *reg ) +{ + GLUvertex *dst = reg->eUp->Dst; + + /* Find the region above the uppermost edge with the same destination */ + do { + reg = RegionAbove( reg ); + } while( reg->eUp->Dst == dst ); + return reg; +} + +static ActiveRegion *AddRegionBelow( GLUtesselator *tess, + ActiveRegion *regAbove, + GLUhalfEdge *eNewUp ) +/* + * Add a new active region to the sweep line, *somewhere* below "regAbove" + * (according to where the new edge belongs in the sweep-line dictionary). + * The upper edge of the new region will be "eNewUp". + * Winding number and "inside" flag are not updated. + */ +{ + ActiveRegion *regNew = (ActiveRegion *)memAlloc( sizeof( ActiveRegion )); + if (regNew == NULL) longjmp(tess->env,1); + + regNew->eUp = eNewUp; + /* __gl_dictListInsertBefore */ + regNew->nodeUp = dictInsertBefore( tess->dict, regAbove->nodeUp, regNew ); + if (regNew->nodeUp == NULL) longjmp(tess->env,1); + regNew->fixUpperEdge = FALSE; + regNew->sentinel = FALSE; + regNew->dirty = FALSE; + + eNewUp->activeRegion = regNew; + return regNew; +} + +static GLboolean IsWindingInside( GLUtesselator *tess, int n ) +{ + switch( tess->windingRule ) { + case GLU_TESS_WINDING_ODD: + return (n & 1); + case GLU_TESS_WINDING_NONZERO: + return (n != 0); + case GLU_TESS_WINDING_POSITIVE: + return (n > 0); + case GLU_TESS_WINDING_NEGATIVE: + return (n < 0); + case GLU_TESS_WINDING_ABS_GEQ_TWO: + return (n >= 2) || (n <= -2); + } + /*LINTED*/ + assert( FALSE ); + /*NOTREACHED*/ + return GL_FALSE; /* avoid compiler complaints */ +} + + +static void ComputeWinding( GLUtesselator *tess, ActiveRegion *reg ) +{ + reg->windingNumber = RegionAbove(reg)->windingNumber + reg->eUp->winding; + reg->inside = IsWindingInside( tess, reg->windingNumber ); +} + + +static void FinishRegion( GLUtesselator *tess, ActiveRegion *reg ) +/* + * Delete a region from the sweep line. This happens when the upper + * and lower chains of a region meet (at a vertex on the sweep line). + * The "inside" flag is copied to the appropriate mesh face (we could + * not do this before -- since the structure of the mesh is always + * changing, this face may not have even existed until now). + */ +{ + GLUhalfEdge *e = reg->eUp; + GLUface *f = e->Lface; + + f->inside = reg->inside; + f->anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ + DeleteRegion( tess, reg ); +} + + +static GLUhalfEdge *FinishLeftRegions( GLUtesselator *tess, + ActiveRegion *regFirst, ActiveRegion *regLast ) +/* + * We are given a vertex with one or more left-going edges. All affected + * edges should be in the edge dictionary. Starting at regFirst->eUp, + * we walk down deleting all regions where both edges have the same + * origin vOrg. At the same time we copy the "inside" flag from the + * active region to the face, since at this point each face will belong + * to at most one region (this was not necessarily true until this point + * in the sweep). The walk stops at the region above regLast; if regLast + * is NULL we walk as far as possible. At the same time we relink the + * mesh if necessary, so that the ordering of edges around vOrg is the + * same as in the dictionary. + */ +{ + ActiveRegion *reg, *regPrev; + GLUhalfEdge *e, *ePrev; + + regPrev = regFirst; + ePrev = regFirst->eUp; + while( regPrev != regLast ) { + regPrev->fixUpperEdge = FALSE; /* placement was OK */ + reg = RegionBelow( regPrev ); + e = reg->eUp; + if( e->Org != ePrev->Org ) { + if( ! reg->fixUpperEdge ) { + /* Remove the last left-going edge. Even though there are no further + * edges in the dictionary with this origin, there may be further + * such edges in the mesh (if we are adding left edges to a vertex + * that has already been processed). Thus it is important to call + * FinishRegion rather than just DeleteRegion. + */ + FinishRegion( tess, regPrev ); + break; + } + /* If the edge below was a temporary edge introduced by + * ConnectRightVertex, now is the time to fix it. + */ + e = __gl_meshConnect( ePrev->Lprev, e->Sym ); + if (e == NULL) longjmp(tess->env,1); + if ( !FixUpperEdge( reg, e ) ) longjmp(tess->env,1); + } + + /* Relink edges so that ePrev->Onext == e */ + if( ePrev->Onext != e ) { + if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( ePrev, e ) ) longjmp(tess->env,1); + } + FinishRegion( tess, regPrev ); /* may change reg->eUp */ + ePrev = reg->eUp; + regPrev = reg; + } + return ePrev; +} + + +static void AddRightEdges( GLUtesselator *tess, ActiveRegion *regUp, + GLUhalfEdge *eFirst, GLUhalfEdge *eLast, GLUhalfEdge *eTopLeft, + GLboolean cleanUp ) +/* + * Purpose: insert right-going edges into the edge dictionary, and update + * winding numbers and mesh connectivity appropriately. All right-going + * edges share a common origin vOrg. Edges are inserted CCW starting at + * eFirst; the last edge inserted is eLast->Oprev. If vOrg has any + * left-going edges already processed, then eTopLeft must be the edge + * such that an imaginary upward vertical segment from vOrg would be + * contained between eTopLeft->Oprev and eTopLeft; otherwise eTopLeft + * should be NULL. + */ +{ + ActiveRegion *reg, *regPrev; + GLUhalfEdge *e, *ePrev; + int firstTime = TRUE; + + /* Insert the new right-going edges in the dictionary */ + e = eFirst; + do { + assert( VertLeq( e->Org, e->Dst )); + AddRegionBelow( tess, regUp, e->Sym ); + e = e->Onext; + } while ( e != eLast ); + + /* Walk *all* right-going edges from e->Org, in the dictionary order, + * updating the winding numbers of each region, and re-linking the mesh + * edges to match the dictionary ordering (if necessary). + */ + if( eTopLeft == NULL ) { + eTopLeft = RegionBelow( regUp )->eUp->Rprev; + } + regPrev = regUp; + ePrev = eTopLeft; + for( ;; ) { + reg = RegionBelow( regPrev ); + e = reg->eUp->Sym; + if( e->Org != ePrev->Org ) break; + + if( e->Onext != ePrev ) { + /* Unlink e from its current position, and relink below ePrev */ + if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( ePrev->Oprev, e ) ) longjmp(tess->env,1); + } + /* Compute the winding number and "inside" flag for the new regions */ + reg->windingNumber = regPrev->windingNumber - e->winding; + reg->inside = IsWindingInside( tess, reg->windingNumber ); + + /* Check for two outgoing edges with same slope -- process these + * before any intersection tests (see example in __gl_computeInterior). + */ + regPrev->dirty = TRUE; + if( ! firstTime && CheckForRightSplice( tess, regPrev )) { + AddWinding( e, ePrev ); + DeleteRegion( tess, regPrev ); + if ( !__gl_meshDelete( ePrev ) ) longjmp(tess->env,1); + } + firstTime = FALSE; + regPrev = reg; + ePrev = e; + } + regPrev->dirty = TRUE; + assert( regPrev->windingNumber - e->winding == reg->windingNumber ); + + if( cleanUp ) { + /* Check for intersections between newly adjacent edges. */ + WalkDirtyRegions( tess, regPrev ); + } +} + + +static void CallCombine( GLUtesselator *tess, GLUvertex *isect, + void *data[4], GLfloat weights[4], int needed ) +{ + GLdouble coords[3]; + + /* Copy coord data in case the callback changes it. */ + coords[0] = isect->coords[0]; + coords[1] = isect->coords[1]; + coords[2] = isect->coords[2]; + + isect->data = NULL; + CALL_COMBINE_OR_COMBINE_DATA( coords, data, weights, &isect->data ); + if( isect->data == NULL ) { + if( ! needed ) { + isect->data = data[0]; + } else if( ! tess->fatalError ) { + /* The only way fatal error is when two edges are found to intersect, + * but the user has not provided the callback necessary to handle + * generated intersection points. + */ + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_NEED_COMBINE_CALLBACK ); + tess->fatalError = TRUE; + } + } +} + +static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1, + GLUhalfEdge *e2 ) +/* + * Two vertices with idential coordinates are combined into one. + * e1->Org is kept, while e2->Org is discarded. + */ +{ + void *data[4] = { NULL, NULL, NULL, NULL }; + GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 }; + + data[0] = e1->Org->data; + data[1] = e2->Org->data; + CallCombine( tess, e1->Org, data, weights, FALSE ); + if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1); +} + +static void VertexWeights( GLUvertex *isect, GLUvertex *org, GLUvertex *dst, + GLfloat *weights ) +/* + * Find some weights which describe how the intersection vertex is + * a linear combination of "org" and "dest". Each of the two edges + * which generated "isect" is allocated 50% of the weight; each edge + * splits the weight between its org and dst according to the + * relative distance to "isect". + */ +{ + GLdouble t1 = VertL1dist( org, isect ); + GLdouble t2 = VertL1dist( dst, isect ); + + weights[0] = 0.5 * t2 / (t1 + t2); + weights[1] = 0.5 * t1 / (t1 + t2); + isect->coords[0] += weights[0]*org->coords[0] + weights[1]*dst->coords[0]; + isect->coords[1] += weights[0]*org->coords[1] + weights[1]*dst->coords[1]; + isect->coords[2] += weights[0]*org->coords[2] + weights[1]*dst->coords[2]; +} + + +static void GetIntersectData( GLUtesselator *tess, GLUvertex *isect, + GLUvertex *orgUp, GLUvertex *dstUp, + GLUvertex *orgLo, GLUvertex *dstLo ) +/* + * We've computed a new intersection point, now we need a "data" pointer + * from the user so that we can refer to this new vertex in the + * rendering callbacks. + */ +{ + void *data[4]; + GLfloat weights[4]; + + data[0] = orgUp->data; + data[1] = dstUp->data; + data[2] = orgLo->data; + data[3] = dstLo->data; + + isect->coords[0] = isect->coords[1] = isect->coords[2] = 0; + VertexWeights( isect, orgUp, dstUp, &weights[0] ); + VertexWeights( isect, orgLo, dstLo, &weights[2] ); + + CallCombine( tess, isect, data, weights, TRUE ); +} + +static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp->Org is above eLo, or eLo->Org is below eUp (depending on which + * origin is leftmost). + * + * The main purpose is to splice right-going edges with the same + * dest vertex and nearly identical slopes (ie. we can't distinguish + * the slopes numerically). However the splicing can also help us + * to recover from numerical errors. For example, suppose at one + * point we checked eUp and eLo, and decided that eUp->Org is barely + * above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * our test so that now eUp->Org is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants. + * + * One possibility is to check these edges for intersection again + * (ie. CheckForIntersect). This is what we do if possible. However + * CheckForIntersect requires that tess->event lies between eUp and eLo, + * so that it has something to fall back on when the intersection + * calculation gives us an unusable answer. So, for those cases where + * we can't check for intersection, this routine fixes the problem + * by just splicing the offending vertex into the other edge. + * This is a guaranteed solution, no matter how degenerate things get. + * Basically this is a combinatorial solution to a numerical problem. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + + if( VertLeq( eUp->Org, eLo->Org )) { + if( EdgeSign( eLo->Dst, eUp->Org, eLo->Org ) > 0 ) return FALSE; + + /* eUp->Org appears to be below eLo */ + if( ! VertEq( eUp->Org, eLo->Org )) { + /* Splice eUp->Org into eLo */ + if ( __gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp, eLo->Oprev ) ) longjmp(tess->env,1); + regUp->dirty = regLo->dirty = TRUE; + + } else if( eUp->Org != eLo->Org ) { + /* merge the two vertices, discarding eUp->Org */ + pqDelete( tess->pq, eUp->Org->pqHandle ); /* __gl_pqSortDelete */ + SpliceMergeVertices( tess, eLo->Oprev, eUp ); + } + } else { + if( EdgeSign( eUp->Dst, eLo->Org, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Org appears to be above eUp, so splice eLo->Org into eUp */ + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1); + } + return TRUE; +} + +static int CheckForLeftSplice( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp->Dst is above eLo, or eLo->Dst is below eUp (depending on which + * destination is rightmost). + * + * Theoretically, this should always be true. However, splitting an edge + * into two pieces can change the results of previous tests. For example, + * suppose at one point we checked eUp and eLo, and decided that eUp->Dst + * is barely above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * the test so that now eUp->Dst is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants + * (otherwise new edges might get inserted in the wrong place in the + * dictionary, and bad stuff will happen). + * + * We fix the problem by just splicing the offending vertex into the + * other edge. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + GLUhalfEdge *e; + + assert( ! VertEq( eUp->Dst, eLo->Dst )); + + if( VertLeq( eUp->Dst, eLo->Dst )) { + if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Dst is above eUp, so splice eLo->Dst into eUp */ + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + e = __gl_meshSplitEdge( eUp ); + if (e == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Sym, e ) ) longjmp(tess->env,1); + e->Lface->inside = regUp->inside; + } else { + if( EdgeSign( eLo->Dst, eUp->Dst, eLo->Org ) > 0 ) return FALSE; + + /* eUp->Dst is below eLo, so splice eUp->Dst into eLo */ + regUp->dirty = regLo->dirty = TRUE; + e = __gl_meshSplitEdge( eLo ); + if (e == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1); + e->Rface->inside = regUp->inside; + } + return TRUE; +} + + +static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edges of the given region to see if + * they intersect. If so, create the intersection and add it + * to the data structures. + * + * Returns TRUE if adding the new intersection resulted in a recursive + * call to AddRightEdges(); in this case all "dirty" regions have been + * checked for intersections, and possibly regUp has been deleted. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + GLUvertex *orgUp = eUp->Org; + GLUvertex *orgLo = eLo->Org; + GLUvertex *dstUp = eUp->Dst; + GLUvertex *dstLo = eLo->Dst; + GLdouble tMinUp, tMaxLo; + GLUvertex isect, *orgMin; + GLUhalfEdge *e; + + assert( ! VertEq( dstLo, dstUp )); + assert( EdgeSign( dstUp, tess->event, orgUp ) <= 0 ); + assert( EdgeSign( dstLo, tess->event, orgLo ) >= 0 ); + assert( orgUp != tess->event && orgLo != tess->event ); + assert( ! regUp->fixUpperEdge && ! regLo->fixUpperEdge ); + + if( orgUp == orgLo ) return FALSE; /* right endpoints are the same */ + + tMinUp = MIN( orgUp->t, dstUp->t ); + tMaxLo = MAX( orgLo->t, dstLo->t ); + if( tMinUp > tMaxLo ) return FALSE; /* t ranges do not overlap */ + + if( VertLeq( orgUp, orgLo )) { + if( EdgeSign( dstLo, orgUp, orgLo ) > 0 ) return FALSE; + } else { + if( EdgeSign( dstUp, orgLo, orgUp ) < 0 ) return FALSE; + } + + /* At this point the edges intersect, at least marginally */ + DebugEvent( tess ); + + __gl_edgeIntersect( dstUp, orgUp, dstLo, orgLo, &isect ); + /* The following properties are guaranteed: */ + assert( MIN( orgUp->t, dstUp->t ) <= isect.t ); + assert( isect.t <= MAX( orgLo->t, dstLo->t )); + assert( MIN( dstLo->s, dstUp->s ) <= isect.s ); + assert( isect.s <= MAX( orgLo->s, orgUp->s )); + + if( VertLeq( &isect, tess->event )) { + /* The intersection point lies slightly to the left of the sweep line, + * so move it until it''s slightly to the right of the sweep line. + * (If we had perfect numerical precision, this would never happen + * in the first place). The easiest and safest thing to do is + * replace the intersection by tess->event. + */ + isect.s = tess->event->s; + isect.t = tess->event->t; + } + /* Similarly, if the computed intersection lies to the right of the + * rightmost origin (which should rarely happen), it can cause + * unbelievable inefficiency on sufficiently degenerate inputs. + * (If you have the test program, try running test54.d with the + * "X zoom" option turned on). + */ + orgMin = VertLeq( orgUp, orgLo ) ? orgUp : orgLo; + if( VertLeq( orgMin, &isect )) { + isect.s = orgMin->s; + isect.t = orgMin->t; + } + + if( VertEq( &isect, orgUp ) || VertEq( &isect, orgLo )) { + /* Easy case -- intersection at one of the right endpoints */ + (void) CheckForRightSplice( tess, regUp ); + return FALSE; + } + + if( (! VertEq( dstUp, tess->event ) + && EdgeSign( dstUp, tess->event, &isect ) >= 0) + || (! VertEq( dstLo, tess->event ) + && EdgeSign( dstLo, tess->event, &isect ) <= 0 )) + { + /* Very unusual -- the new upper or lower edge would pass on the + * wrong side of the sweep event, or through it. This can happen + * due to very small numerical errors in the intersection calculation. + */ + if( dstLo == tess->event ) { + /* Splice dstLo into eUp, and process the new region(s) */ + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Sym, eUp ) ) longjmp(tess->env,1); + regUp = TopLeftRegion( regUp ); + if (regUp == NULL) longjmp(tess->env,1); + eUp = RegionBelow(regUp)->eUp; + FinishLeftRegions( tess, RegionBelow(regUp), regLo ); + AddRightEdges( tess, regUp, eUp->Oprev, eUp, eUp, TRUE ); + return TRUE; + } + if( dstUp == tess->event ) { + /* Splice dstUp into eLo, and process the new region(s) */ + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1); + regLo = regUp; + regUp = TopRightRegion( regUp ); + e = RegionBelow(regUp)->eUp->Rprev; + regLo->eUp = eLo->Oprev; + eLo = FinishLeftRegions( tess, regLo, NULL ); + AddRightEdges( tess, regUp, eLo->Onext, eUp->Rprev, e, TRUE ); + return TRUE; + } + /* Special case: called from ConnectRightVertex. If either + * edge passes on the wrong side of tess->event, split it + * (and wait for ConnectRightVertex to splice it appropriately). + */ + if( EdgeSign( dstUp, tess->event, &isect ) >= 0 ) { + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + eUp->Org->s = tess->event->s; + eUp->Org->t = tess->event->t; + } + if( EdgeSign( dstLo, tess->event, &isect ) <= 0 ) { + regUp->dirty = regLo->dirty = TRUE; + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + eLo->Org->s = tess->event->s; + eLo->Org->t = tess->event->t; + } + /* leave the rest for ConnectRightVertex */ + return FALSE; + } + + /* General case -- split both edges, splice into new vertex. + * When we do the splice operation, the order of the arguments is + * arbitrary as far as correctness goes. However, when the operation + * creates a new face, the work done is proportional to the size of + * the new face. We expect the faces in the processed part of + * the mesh (ie. eUp->Lface) to be smaller than the faces in the + * unprocessed original contours (which will be eLo->Oprev->Lface). + */ + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1); + eUp->Org->s = isect.s; + eUp->Org->t = isect.t; + eUp->Org->pqHandle = pqInsert( tess->pq, eUp->Org ); /* __gl_pqSortInsert */ + if (eUp->Org->pqHandle == LONG_MAX) { + pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */ + tess->pq = NULL; + longjmp(tess->env,1); + } + GetIntersectData( tess, eUp->Org, orgUp, dstUp, orgLo, dstLo ); + RegionAbove(regUp)->dirty = regUp->dirty = regLo->dirty = TRUE; + return FALSE; +} + +static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * When the upper or lower edge of any region changes, the region is + * marked "dirty". This routine walks through all the dirty regions + * and makes sure that the dictionary invariants are satisfied + * (see the comments at the beginning of this file). Of course + * new dirty regions can be created as we make changes to restore + * the invariants. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp, *eLo; + + for( ;; ) { + /* Find the lowest dirty region (we walk from the bottom up). */ + while( regLo->dirty ) { + regUp = regLo; + regLo = RegionBelow(regLo); + } + if( ! regUp->dirty ) { + regLo = regUp; + regUp = RegionAbove( regUp ); + if( regUp == NULL || ! regUp->dirty ) { + /* We've walked all the dirty regions */ + return; + } + } + regUp->dirty = FALSE; + eUp = regUp->eUp; + eLo = regLo->eUp; + + if( eUp->Dst != eLo->Dst ) { + /* Check that the edge ordering is obeyed at the Dst vertices. */ + if( CheckForLeftSplice( tess, regUp )) { + + /* If the upper or lower edge was marked fixUpperEdge, then + * we no longer need it (since these edges are needed only for + * vertices which otherwise have no right-going edges). + */ + if( regLo->fixUpperEdge ) { + DeleteRegion( tess, regLo ); + if ( !__gl_meshDelete( eLo ) ) longjmp(tess->env,1); + regLo = RegionBelow( regUp ); + eLo = regLo->eUp; + } else if( regUp->fixUpperEdge ) { + DeleteRegion( tess, regUp ); + if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1); + regUp = RegionAbove( regLo ); + eUp = regUp->eUp; + } + } + } + if( eUp->Org != eLo->Org ) { + if( eUp->Dst != eLo->Dst + && ! regUp->fixUpperEdge && ! regLo->fixUpperEdge + && (eUp->Dst == tess->event || eLo->Dst == tess->event) ) + { + /* When all else fails in CheckForIntersect(), it uses tess->event + * as the intersection location. To make this possible, it requires + * that tess->event lie between the upper and lower edges, and also + * that neither of these is marked fixUpperEdge (since in the worst + * case it might splice one of these edges into tess->event, and + * violate the invariant that fixable edges are the only right-going + * edge from their associated vertex). + */ + if( CheckForIntersect( tess, regUp )) { + /* WalkDirtyRegions() was called recursively; we're done */ + return; + } + } else { + /* Even though we can't use CheckForIntersect(), the Org vertices + * may violate the dictionary edge ordering. Check and correct this. + */ + (void) CheckForRightSplice( tess, regUp ); + } + } + if( eUp->Org == eLo->Org && eUp->Dst == eLo->Dst ) { + /* A degenerate loop consisting of only two edges -- delete it. */ + AddWinding( eLo, eUp ); + DeleteRegion( tess, regUp ); + if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1); + regUp = RegionAbove( regLo ); + } + } +} + + +static void ConnectRightVertex( GLUtesselator *tess, ActiveRegion *regUp, + GLUhalfEdge *eBottomLeft ) +/* + * Purpose: connect a "right" vertex vEvent (one where all edges go left) + * to the unprocessed portion of the mesh. Since there are no right-going + * edges, two regions (one above vEvent and one below) are being merged + * into one. "regUp" is the upper of these two regions. + * + * There are two reasons for doing this (adding a right-going edge): + * - if the two regions being merged are "inside", we must add an edge + * to keep them separated (the combined region would not be monotone). + * - in any case, we must leave some record of vEvent in the dictionary, + * so that we can merge vEvent with features that we have not seen yet. + * For example, maybe there is a vertical edge which passes just to + * the right of vEvent; we would like to splice vEvent into this edge. + * + * However, we don't want to connect vEvent to just any vertex. We don''t + * want the new edge to cross any other edges; otherwise we will create + * intersection vertices even when the input data had no self-intersections. + * (This is a bad thing; if the user's input data has no intersections, + * we don't want to generate any false intersections ourselves.) + * + * Our eventual goal is to connect vEvent to the leftmost unprocessed + * vertex of the combined region (the union of regUp and regLo). + * But because of unseen vertices with all right-going edges, and also + * new vertices which may be created by edge intersections, we don''t + * know where that leftmost unprocessed vertex is. In the meantime, we + * connect vEvent to the closest vertex of either chain, and mark the region + * as "fixUpperEdge". This flag says to delete and reconnect this edge + * to the next processed vertex on the boundary of the combined region. + * Quite possibly the vertex we connected to will turn out to be the + * closest one, in which case we won''t need to make any changes. + */ +{ + GLUhalfEdge *eNew; + GLUhalfEdge *eTopLeft = eBottomLeft->Onext; + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + int degenerate = FALSE; + + if( eUp->Dst != eLo->Dst ) { + (void) CheckForIntersect( tess, regUp ); + } + + /* Possible new degeneracies: upper or lower edge of regUp may pass + * through vEvent, or may coincide with new intersection vertex + */ + if( VertEq( eUp->Org, tess->event )) { + if ( !__gl_meshSplice( eTopLeft->Oprev, eUp ) ) longjmp(tess->env,1); + regUp = TopLeftRegion( regUp ); + if (regUp == NULL) longjmp(tess->env,1); + eTopLeft = RegionBelow( regUp )->eUp; + FinishLeftRegions( tess, RegionBelow(regUp), regLo ); + degenerate = TRUE; + } + if( VertEq( eLo->Org, tess->event )) { + if ( !__gl_meshSplice( eBottomLeft, eLo->Oprev ) ) longjmp(tess->env,1); + eBottomLeft = FinishLeftRegions( tess, regLo, NULL ); + degenerate = TRUE; + } + if( degenerate ) { + AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE ); + return; + } + + /* Non-degenerate situation -- need to add a temporary, fixable edge. + * Connect to the closer of eLo->Org, eUp->Org. + */ + if( VertLeq( eLo->Org, eUp->Org )) { + eNew = eLo->Oprev; + } else { + eNew = eUp; + } + eNew = __gl_meshConnect( eBottomLeft->Lprev, eNew ); + if (eNew == NULL) longjmp(tess->env,1); + + /* Prevent cleanup, otherwise eNew might disappear before we've even + * had a chance to mark it as a temporary edge. + */ + AddRightEdges( tess, regUp, eNew, eNew->Onext, eNew->Onext, FALSE ); + eNew->Sym->activeRegion->fixUpperEdge = TRUE; + WalkDirtyRegions( tess, regUp ); +} + +/* Because vertices at exactly the same location are merged together + * before we process the sweep event, some degenerate cases can't occur. + * However if someone eventually makes the modifications required to + * merge features which are close together, the cases below marked + * TOLERANCE_NONZERO will be useful. They were debugged before the + * code to merge identical vertices in the main loop was added. + */ +#define TOLERANCE_NONZERO FALSE + +static void ConnectLeftDegenerate( GLUtesselator *tess, + ActiveRegion *regUp, GLUvertex *vEvent ) +/* + * The event vertex lies exacty on an already-processed edge or vertex. + * Adding the new vertex involves splicing it into the already-processed + * part of the mesh. + */ +{ + GLUhalfEdge *e, *eTopLeft, *eTopRight, *eLast; + ActiveRegion *reg; + + e = regUp->eUp; + if( VertEq( e->Org, vEvent )) { + /* e->Org is an unprocessed vertex - just combine them, and wait + * for e->Org to be pulled from the queue + */ + assert( TOLERANCE_NONZERO ); + SpliceMergeVertices( tess, e, vEvent->anEdge ); + return; + } + + if( ! VertEq( e->Dst, vEvent )) { + /* General case -- splice vEvent into edge e which passes through it */ + if (__gl_meshSplitEdge( e->Sym ) == NULL) longjmp(tess->env,1); + if( regUp->fixUpperEdge ) { + /* This edge was fixable -- delete unused portion of original edge */ + if ( !__gl_meshDelete( e->Onext ) ) longjmp(tess->env,1); + regUp->fixUpperEdge = FALSE; + } + if ( !__gl_meshSplice( vEvent->anEdge, e ) ) longjmp(tess->env,1); + SweepEvent( tess, vEvent ); /* recurse */ + return; + } + + /* vEvent coincides with e->Dst, which has already been processed. + * Splice in the additional right-going edges. + */ + assert( TOLERANCE_NONZERO ); + regUp = TopRightRegion( regUp ); + reg = RegionBelow( regUp ); + eTopRight = reg->eUp->Sym; + eTopLeft = eLast = eTopRight->Onext; + if( reg->fixUpperEdge ) { + /* Here e->Dst has only a single fixable edge going right. + * We can delete it since now we have some real right-going edges. + */ + assert( eTopLeft != eTopRight ); /* there are some left edges too */ + DeleteRegion( tess, reg ); + if ( !__gl_meshDelete( eTopRight ) ) longjmp(tess->env,1); + eTopRight = eTopLeft->Oprev; + } + if ( !__gl_meshSplice( vEvent->anEdge, eTopRight ) ) longjmp(tess->env,1); + if( ! EdgeGoesLeft( eTopLeft )) { + /* e->Dst had no left-going edges -- indicate this to AddRightEdges() */ + eTopLeft = NULL; + } + AddRightEdges( tess, regUp, eTopRight->Onext, eLast, eTopLeft, TRUE ); +} + + +static void ConnectLeftVertex( GLUtesselator *tess, GLUvertex *vEvent ) +/* + * Purpose: connect a "left" vertex (one where both edges go right) + * to the processed portion of the mesh. Let R be the active region + * containing vEvent, and let U and L be the upper and lower edge + * chains of R. There are two possibilities: + * + * - the normal case: split R into two regions, by connecting vEvent to + * the rightmost vertex of U or L lying to the left of the sweep line + * + * - the degenerate case: if vEvent is close enough to U or L, we + * merge vEvent into that edge chain. The subcases are: + * - merging with the rightmost vertex of U or L + * - merging with the active edge of U or L + * - merging with an already-processed portion of U or L + */ +{ + ActiveRegion *regUp, *regLo, *reg; + GLUhalfEdge *eUp, *eLo, *eNew; + ActiveRegion tmp; + + /* assert( vEvent->anEdge->Onext->Onext == vEvent->anEdge ); */ + + /* Get a pointer to the active region containing vEvent */ + tmp.eUp = vEvent->anEdge->Sym; + /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */ + regUp = (ActiveRegion *)dictKey( dictSearch( tess->dict, &tmp )); + regLo = RegionBelow( regUp ); + eUp = regUp->eUp; + eLo = regLo->eUp; + + /* Try merging with U or L first */ + if( EdgeSign( eUp->Dst, vEvent, eUp->Org ) == 0 ) { + ConnectLeftDegenerate( tess, regUp, vEvent ); + return; + } + + /* Connect vEvent to rightmost processed vertex of either chain. + * e->Dst is the vertex that we will connect to vEvent. + */ + reg = VertLeq( eLo->Dst, eUp->Dst ) ? regUp : regLo; + + if( regUp->inside || reg->fixUpperEdge) { + if( reg == regUp ) { + eNew = __gl_meshConnect( vEvent->anEdge->Sym, eUp->Lnext ); + if (eNew == NULL) longjmp(tess->env,1); + } else { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( eLo->Dnext, vEvent->anEdge); + if (tempHalfEdge == NULL) longjmp(tess->env,1); + + eNew = tempHalfEdge->Sym; + } + if( reg->fixUpperEdge ) { + if ( !FixUpperEdge( reg, eNew ) ) longjmp(tess->env,1); + } else { + ComputeWinding( tess, AddRegionBelow( tess, regUp, eNew )); + } + SweepEvent( tess, vEvent ); + } else { + /* The new vertex is in a region which does not belong to the polygon. + * We don''t need to connect this vertex to the rest of the mesh. + */ + AddRightEdges( tess, regUp, vEvent->anEdge, vEvent->anEdge, NULL, TRUE ); + } +} + + +static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ) +/* + * Does everything necessary when the sweep line crosses a vertex. + * Updates the mesh and the edge dictionary. + */ +{ + ActiveRegion *regUp, *reg; + GLUhalfEdge *e, *eTopLeft, *eBottomLeft; + + tess->event = vEvent; /* for access in EdgeLeq() */ + DebugEvent( tess ); + + /* Check if this vertex is the right endpoint of an edge that is + * already in the dictionary. In this case we don't need to waste + * time searching for the location to insert new edges. + */ + e = vEvent->anEdge; + while( e->activeRegion == NULL ) { + e = e->Onext; + if( e == vEvent->anEdge ) { + /* All edges go right -- not incident to any processed edges */ + ConnectLeftVertex( tess, vEvent ); + return; + } + } + + /* Processing consists of two phases: first we "finish" all the + * active regions where both the upper and lower edges terminate + * at vEvent (ie. vEvent is closing off these regions). + * We mark these faces "inside" or "outside" the polygon according + * to their winding number, and delete the edges from the dictionary. + * This takes care of all the left-going edges from vEvent. + */ + regUp = TopLeftRegion( e->activeRegion ); + if (regUp == NULL) longjmp(tess->env,1); + reg = RegionBelow( regUp ); + eTopLeft = reg->eUp; + eBottomLeft = FinishLeftRegions( tess, reg, NULL ); + + /* Next we process all the right-going edges from vEvent. This + * involves adding the edges to the dictionary, and creating the + * associated "active regions" which record information about the + * regions between adjacent dictionary edges. + */ + if( eBottomLeft->Onext == eTopLeft ) { + /* No right-going edges -- add a temporary "fixable" edge */ + ConnectRightVertex( tess, regUp, eBottomLeft ); + } else { + AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE ); + } +} + + +/* Make the sentinel coordinates big enough that they will never be + * merged with real input features. (Even with the largest possible + * input contour and the maximum tolerance of 1.0, no merging will be + * done with coordinates larger than 3 * GLU_TESS_MAX_COORD). + */ +#define SENTINEL_COORD (4 * GLU_TESS_MAX_COORD) + +static void AddSentinel( GLUtesselator *tess, GLdouble t ) +/* + * We add two sentinel edges above and below all other edges, + * to avoid special cases at the top and bottom. + */ +{ + GLUhalfEdge *e; + ActiveRegion *reg = (ActiveRegion *)memAlloc( sizeof( ActiveRegion )); + if (reg == NULL) longjmp(tess->env,1); + + e = __gl_meshMakeEdge( tess->mesh ); + if (e == NULL) longjmp(tess->env,1); + + e->Org->s = SENTINEL_COORD; + e->Org->t = t; + e->Dst->s = -SENTINEL_COORD; + e->Dst->t = t; + tess->event = e->Dst; /* initialize it */ + + reg->eUp = e; + reg->windingNumber = 0; + reg->inside = FALSE; + reg->fixUpperEdge = FALSE; + reg->sentinel = TRUE; + reg->dirty = FALSE; + reg->nodeUp = dictInsert( tess->dict, reg ); /* __gl_dictListInsertBefore */ + if (reg->nodeUp == NULL) longjmp(tess->env,1); +} + + +static void InitEdgeDict( GLUtesselator *tess ) +/* + * We maintain an ordering of edge intersections with the sweep line. + * This order is maintained in a dynamic dictionary. + */ +{ + /* __gl_dictListNewDict */ + tess->dict = dictNewDict( tess, (int (*)(void *, DictKey, DictKey)) EdgeLeq ); + if (tess->dict == NULL) longjmp(tess->env,1); + + AddSentinel( tess, -SENTINEL_COORD ); + AddSentinel( tess, SENTINEL_COORD ); +} + + +static void DoneEdgeDict( GLUtesselator *tess ) +{ + ActiveRegion *reg; +#ifndef NDEBUG + int fixedEdges = 0; +#endif + + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) { + /* + * At the end of all processing, the dictionary should contain + * only the two sentinel edges, plus at most one "fixable" edge + * created by ConnectRightVertex(). + */ + if( ! reg->sentinel ) { + assert( reg->fixUpperEdge ); + assert( ++fixedEdges == 1 ); + } + assert( reg->windingNumber == 0 ); + DeleteRegion( tess, reg ); +/* __gl_meshDelete( reg->eUp );*/ + } + dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */ +} + + +static void RemoveDegenerateEdges( GLUtesselator *tess ) +/* + * Remove zero-length edges, and contours with fewer than 3 vertices. + */ +{ + GLUhalfEdge *e, *eNext, *eLnext; + GLUhalfEdge *eHead = &tess->mesh->eHead; + + /*LINTED*/ + for( e = eHead->next; e != eHead; e = eNext ) { + eNext = e->next; + eLnext = e->Lnext; + + if( VertEq( e->Org, e->Dst ) && e->Lnext->Lnext != e ) { + /* Zero-length edge, contour has at least 3 edges */ + + SpliceMergeVertices( tess, eLnext, e ); /* deletes e->Org */ + if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); /* e is a self-loop */ + e = eLnext; + eLnext = e->Lnext; + } + if( eLnext->Lnext == e ) { + /* Degenerate contour (one or two edges) */ + + if( eLnext != e ) { + if( eLnext == eNext || eLnext == eNext->Sym ) { eNext = eNext->next; } + if ( !__gl_meshDelete( eLnext ) ) longjmp(tess->env,1); + } + if( e == eNext || e == eNext->Sym ) { eNext = eNext->next; } + if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); + } + } +} + +static int InitPriorityQ( GLUtesselator *tess ) +/* + * Insert all vertices into the priority queue which determines the + * order in which vertices cross the sweep line. + */ +{ + PriorityQ *pq; + GLUvertex *v, *vHead; + + /* __gl_pqSortNewPriorityQ */ + pq = tess->pq = pqNewPriorityQ( (int (*)(PQkey, PQkey)) __gl_vertLeq ); + if (pq == NULL) return 0; + + vHead = &tess->mesh->vHead; + for( v = vHead->next; v != vHead; v = v->next ) { + v->pqHandle = pqInsert( pq, v ); /* __gl_pqSortInsert */ + if (v->pqHandle == LONG_MAX) break; + } + if (v != vHead || !pqInit( pq ) ) { /* __gl_pqSortInit */ + pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */ + tess->pq = NULL; + return 0; + } + + return 1; +} + + +static void DonePriorityQ( GLUtesselator *tess ) +{ + pqDeletePriorityQ( tess->pq ); /* __gl_pqSortDeletePriorityQ */ +} + + +static int RemoveDegenerateFaces( GLUmesh *mesh ) +/* + * Delete any degenerate faces with only two edges. WalkDirtyRegions() + * will catch almost all of these, but it won't catch degenerate faces + * produced by splice operations on already-processed edges. + * The two places this can happen are in FinishLeftRegions(), when + * we splice in a "temporary" edge produced by ConnectRightVertex(), + * and in CheckForLeftSplice(), where we splice already-processed + * edges to ensure that our dictionary invariants are not violated + * by numerical errors. + * + * In both these cases it is *very* dangerous to delete the offending + * edge at the time, since one of the routines further up the stack + * will sometimes be keeping a pointer to that edge. + */ +{ + GLUface *f, *fNext; + GLUhalfEdge *e; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) { + fNext = f->next; + e = f->anEdge; + assert( e->Lnext != e ); + + if( e->Lnext->Lnext == e ) { + /* A face with only two edges */ + AddWinding( e->Onext, e ); + if ( !__gl_meshDelete( e ) ) return 0; + } + } + return 1; +} + +int __gl_computeInterior( GLUtesselator *tess ) +/* + * __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ +{ + GLUvertex *v, *vNext; + + tess->fatalError = FALSE; + + /* Each vertex defines an event for our sweep line. Start by inserting + * all the vertices in a priority queue. Events are processed in + * lexicographic order, ie. + * + * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) + */ + RemoveDegenerateEdges( tess ); + if ( !InitPriorityQ( tess ) ) return 0; /* if error */ + InitEdgeDict( tess ); + + /* __gl_pqSortExtractMin */ + while( (v = (GLUvertex *)pqExtractMin( tess->pq )) != NULL ) { + for( ;; ) { + vNext = (GLUvertex *)pqMinimum( tess->pq ); /* __gl_pqSortMinimum */ + if( vNext == NULL || ! VertEq( vNext, v )) break; + + /* Merge together all vertices at exactly the same location. + * This is more efficient than processing them one at a time, + * simplifies the code (see ConnectLeftDegenerate), and is also + * important for correct handling of certain degenerate cases. + * For example, suppose there are two identical edges A and B + * that belong to different contours (so without this code they would + * be processed by separate sweep events). Suppose another edge C + * crosses A and B from above. When A is processed, we split it + * at its intersection point with C. However this also splits C, + * so when we insert B we may compute a slightly different + * intersection point. This might leave two edges with a small + * gap between them. This kind of error is especially obvious + * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY). + */ + vNext = (GLUvertex *)pqExtractMin( tess->pq ); /* __gl_pqSortExtractMin*/ + SpliceMergeVertices( tess, v->anEdge, vNext->anEdge ); + } + SweepEvent( tess, v ); + } + + /* Set tess->event for debugging purposes */ + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + tess->event = ((ActiveRegion *) dictKey( dictMin( tess->dict )))->eUp->Org; + DebugEvent( tess ); + DoneEdgeDict( tess ); + DonePriorityQ( tess ); + + if ( !RemoveDegenerateFaces( tess->mesh ) ) return 0; + __gl_meshCheckMesh( tess->mesh ); + + return 1; +} diff --git a/cogl-path/tesselator/sweep.h b/cogl-path/tesselator/sweep.h new file mode 100644 index 0000000..feb68b0 --- /dev/null +++ b/cogl-path/tesselator/sweep.h @@ -0,0 +1,77 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __sweep_h_ +#define __sweep_h_ + +#include "mesh.h" + +/* __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ +int __gl_computeInterior( GLUtesselator *tess ); + + +/* The following is here *only* for access by debugging routines */ + +#include "dict.h" + +/* For each pair of adjacent edges crossing the sweep line, there is + * an ActiveRegion to represent the region between them. The active + * regions are kept in sorted order in a dynamic dictionary. As the + * sweep line crosses each vertex, we update the affected regions. + */ + +struct ActiveRegion { + GLUhalfEdge *eUp; /* upper edge, directed right to left */ + DictNode *nodeUp; /* dictionary node corresponding to eUp */ + int windingNumber; /* used to determine which regions are + * inside the polygon */ + GLboolean inside; /* is this region inside the polygon? */ + GLboolean sentinel; /* marks fake edges at t = +/-infinity */ + GLboolean dirty; /* marks regions where the upper or lower + * edge has changed, but we haven't checked + * whether they intersect yet */ + GLboolean fixUpperEdge; /* marks temporary edges introduced when + * we process a "right vertex" (one without + * any edges leaving to the right) */ +}; + +#define RegionBelow(r) ((ActiveRegion *) dictKey(dictPred((r)->nodeUp))) +#define RegionAbove(r) ((ActiveRegion *) dictKey(dictSucc((r)->nodeUp))) + +#endif diff --git a/cogl-path/tesselator/tess.c b/cogl-path/tesselator/tess.c new file mode 100644 index 0000000..4a0e8de --- /dev/null +++ b/cogl-path/tesselator/tess.c @@ -0,0 +1,632 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include +#include "memalloc.h" +#include "tess.h" +#include "mesh.h" +#include "normal.h" +#include "sweep.h" +#include "tessmono.h" +#include "render.h" + +#define GLU_TESS_DEFAULT_TOLERANCE 0.0 +#define GLU_TESS_MESH 100112 /* void (*)(GLUmesh *mesh) */ + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +/*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {} +/*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {} +/*ARGSUSED*/ static void GLAPIENTRY noVertex( void *data ) {} +/*ARGSUSED*/ static void GLAPIENTRY noEnd( void ) {} +/*ARGSUSED*/ static void GLAPIENTRY noError( GLenum errnum ) {} +/*ARGSUSED*/ static void GLAPIENTRY noCombine( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **dataOut ) {} +/*ARGSUSED*/ static void GLAPIENTRY noMesh( GLUmesh *mesh ) {} + + +/*ARGSUSED*/ void GLAPIENTRY __gl_noBeginData( GLenum type, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noVertexData( void *data, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noEndData( void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noErrorData( GLenum errnum, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **outData, + void *polygonData ) {} + +/* Half-edges are allocated in pairs (see mesh.c) */ +typedef struct { GLUhalfEdge e, eSym; } EdgePair; + +#undef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ + MAX(sizeof(GLUvertex),sizeof(GLUface)))) + + +GLUtesselator * GLAPIENTRY +gluNewTess( void ) +{ + GLUtesselator *tess; + + /* Only initialize fields which can be changed by the api. Other fields + * are initialized where they are used. + */ + + if (memInit( MAX_FAST_ALLOC ) == 0) { + return 0; /* out of memory */ + } + tess = (GLUtesselator *)memAlloc( sizeof( GLUtesselator )); + if (tess == NULL) { + return 0; /* out of memory */ + } + + tess->state = T_DORMANT; + + tess->normal[0] = 0; + tess->normal[1] = 0; + tess->normal[2] = 0; + + tess->relTolerance = GLU_TESS_DEFAULT_TOLERANCE; + tess->windingRule = GLU_TESS_WINDING_ODD; + tess->flagBoundary = FALSE; + tess->boundaryOnly = FALSE; + + tess->callBegin = &noBegin; + tess->callEdgeFlag = &noEdgeFlag; + tess->callVertex = &noVertex; + tess->callEnd = &noEnd; + + tess->callError = &noError; + tess->callCombine = &noCombine; + tess->callMesh = &noMesh; + + tess->callBeginData= &__gl_noBeginData; + tess->callEdgeFlagData= &__gl_noEdgeFlagData; + tess->callVertexData= &__gl_noVertexData; + tess->callEndData= &__gl_noEndData; + tess->callErrorData= &__gl_noErrorData; + tess->callCombineData= &__gl_noCombineData; + + tess->polygonData= NULL; + + return tess; +} + +static void MakeDormant( GLUtesselator *tess ) +{ + /* Return the tessellator to its original dormant state. */ + + if( tess->mesh != NULL ) { + __gl_meshDeleteMesh( tess->mesh ); + } + tess->state = T_DORMANT; + tess->lastEdge = NULL; + tess->mesh = NULL; +} + +#define RequireState( tess, s ) if( tess->state != s ) GotoState(tess,s) + +static void GotoState( GLUtesselator *tess, enum TessState newState ) +{ + while( tess->state != newState ) { + /* We change the current state one level at a time, to get to + * the desired state. + */ + if( tess->state < newState ) { + switch( tess->state ) { + case T_DORMANT: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_POLYGON ); + gluTessBeginPolygon( tess, NULL ); + break; + case T_IN_POLYGON: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_CONTOUR ); + gluTessBeginContour( tess ); + break; + default: + ; + } + } else { + switch( tess->state ) { + case T_IN_CONTOUR: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_CONTOUR ); + gluTessEndContour( tess ); + break; + case T_IN_POLYGON: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_POLYGON ); + /* gluTessEndPolygon( tess ) is too much work! */ + MakeDormant( tess ); + break; + default: + ; + } + } + } +} + + +void GLAPIENTRY +gluDeleteTess( GLUtesselator *tess ) +{ + RequireState( tess, T_DORMANT ); + memFree( tess ); +} + + +void GLAPIENTRY +gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) +{ + GLenum windingRule; + + switch( which ) { + case GLU_TESS_TOLERANCE: + if( value < 0.0 || value > 1.0 ) break; + tess->relTolerance = value; + return; + + case GLU_TESS_WINDING_RULE: + windingRule = (GLenum) value; + if( windingRule != value ) break; /* not an integer */ + + switch( windingRule ) { + case GLU_TESS_WINDING_ODD: + case GLU_TESS_WINDING_NONZERO: + case GLU_TESS_WINDING_POSITIVE: + case GLU_TESS_WINDING_NEGATIVE: + case GLU_TESS_WINDING_ABS_GEQ_TWO: + tess->windingRule = windingRule; + return; + default: + break; + } + + case GLU_TESS_BOUNDARY_ONLY: + tess->boundaryOnly = (value != 0); + return; + + default: + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + return; + } + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_VALUE ); +} + +/* Returns tessellator property */ +void GLAPIENTRY +gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) +{ + switch (which) { + case GLU_TESS_TOLERANCE: + /* tolerance should be in range [0..1] */ + assert(0.0 <= tess->relTolerance && tess->relTolerance <= 1.0); + *value= tess->relTolerance; + break; + case GLU_TESS_WINDING_RULE: + assert(tess->windingRule == GLU_TESS_WINDING_ODD || + tess->windingRule == GLU_TESS_WINDING_NONZERO || + tess->windingRule == GLU_TESS_WINDING_POSITIVE || + tess->windingRule == GLU_TESS_WINDING_NEGATIVE || + tess->windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO); + *value= tess->windingRule; + break; + case GLU_TESS_BOUNDARY_ONLY: + assert(tess->boundaryOnly == TRUE || tess->boundaryOnly == FALSE); + *value= tess->boundaryOnly; + break; + default: + *value= 0.0; + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + break; + } +} /* gluGetTessProperty() */ + +void GLAPIENTRY +gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) +{ + tess->normal[0] = x; + tess->normal[1] = y; + tess->normal[2] = z; +} + +void GLAPIENTRY +gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) +{ + switch( which ) { + case GLU_TESS_BEGIN: + tess->callBegin = (fn == NULL) ? &noBegin : (void (GLAPIENTRY *)(GLenum)) fn; + return; + case GLU_TESS_BEGIN_DATA: + tess->callBeginData = (fn == NULL) ? + &__gl_noBeginData : (void (GLAPIENTRY *)(GLenum, void *)) fn; + return; + case GLU_TESS_EDGE_FLAG: + tess->callEdgeFlag = (fn == NULL) ? &noEdgeFlag : + (void (GLAPIENTRY *)(GLboolean)) fn; + /* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + tess->flagBoundary = (fn != NULL); + return; + case GLU_TESS_EDGE_FLAG_DATA: + tess->callEdgeFlagData= (fn == NULL) ? + &__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn; + /* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + tess->flagBoundary = (fn != NULL); + return; + case GLU_TESS_VERTEX: + tess->callVertex = (fn == NULL) ? &noVertex : + (void (GLAPIENTRY *)(void *)) fn; + return; + case GLU_TESS_VERTEX_DATA: + tess->callVertexData = (fn == NULL) ? + &__gl_noVertexData : (void (GLAPIENTRY *)(void *, void *)) fn; + return; + case GLU_TESS_END: + tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPIENTRY *)(void)) fn; + return; + case GLU_TESS_END_DATA: + tess->callEndData = (fn == NULL) ? &__gl_noEndData : + (void (GLAPIENTRY *)(void *)) fn; + return; + case GLU_TESS_ERROR: + tess->callError = (fn == NULL) ? &noError : (void (GLAPIENTRY *)(GLenum)) fn; + return; + case GLU_TESS_ERROR_DATA: + tess->callErrorData = (fn == NULL) ? + &__gl_noErrorData : (void (GLAPIENTRY *)(GLenum, void *)) fn; + return; + case GLU_TESS_COMBINE: + tess->callCombine = (fn == NULL) ? &noCombine : + (void (GLAPIENTRY *)(GLdouble [3],void *[4], GLfloat [4], void ** )) fn; + return; + case GLU_TESS_COMBINE_DATA: + tess->callCombineData = (fn == NULL) ? &__gl_noCombineData : + (void (GLAPIENTRY *)(GLdouble [3], + void *[4], + GLfloat [4], + void **, + void *)) fn; + return; + case GLU_TESS_MESH: + tess->callMesh = (fn == NULL) ? &noMesh : (void (GLAPIENTRY *)(GLUmesh *)) fn; + return; + default: + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + return; + } +} + +static int AddVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + GLUhalfEdge *e; + + e = tess->lastEdge; + if( e == NULL ) { + /* Make a self-loop (one vertex, one edge). */ + + e = __gl_meshMakeEdge( tess->mesh ); + if (e == NULL) return 0; + if ( !__gl_meshSplice( e, e->Sym ) ) return 0; + } else { + /* Create a new vertex and edge which immediately follow e + * in the ordering around the left face. + */ + if (__gl_meshSplitEdge( e ) == NULL) return 0; + e = e->Lnext; + } + + /* The new vertex is now e->Org. */ + e->Org->data = data; + e->Org->coords[0] = coords[0]; + e->Org->coords[1] = coords[1]; + e->Org->coords[2] = coords[2]; + + /* The winding of an edge says how the winding number changes as we + * cross from the edge''s right face to its left face. We add the + * vertices in such an order that a CCW contour will add +1 to + * the winding number of the region inside the contour. + */ + e->winding = 1; + e->Sym->winding = -1; + + tess->lastEdge = e; + + return 1; +} + + +static void CacheVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + CachedVertex *v = &tess->cache[tess->cacheCount]; + + v->data = data; + v->coords[0] = coords[0]; + v->coords[1] = coords[1]; + v->coords[2] = coords[2]; + ++tess->cacheCount; +} + + +static int EmptyCache( GLUtesselator *tess ) +{ + CachedVertex *v = tess->cache; + CachedVertex *vLast; + + tess->mesh = __gl_meshNewMesh(); + if (tess->mesh == NULL) return 0; + + for( vLast = v + tess->cacheCount; v < vLast; ++v ) { + if ( !AddVertex( tess, v->coords, v->data ) ) return 0; + } + tess->cacheCount = 0; + tess->emptyCache = FALSE; + + return 1; +} + + +void GLAPIENTRY +gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + int i, tooLarge = FALSE; + GLdouble x, clamped[3]; + + RequireState( tess, T_IN_CONTOUR ); + + if( tess->emptyCache ) { + if ( !EmptyCache( tess ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + tess->lastEdge = NULL; + } + for( i = 0; i < 3; ++i ) { + x = coords[i]; + if( x < - GLU_TESS_MAX_COORD ) { + x = - GLU_TESS_MAX_COORD; + tooLarge = TRUE; + } + if( x > GLU_TESS_MAX_COORD ) { + x = GLU_TESS_MAX_COORD; + tooLarge = TRUE; + } + clamped[i] = x; + } + if( tooLarge ) { + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_COORD_TOO_LARGE ); + } + + if( tess->mesh == NULL ) { + if( tess->cacheCount < TESS_MAX_CACHE ) { + CacheVertex( tess, clamped, data ); + return; + } + if ( !EmptyCache( tess ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + } + if ( !AddVertex( tess, clamped, data ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + } +} + + +void GLAPIENTRY +gluTessBeginPolygon( GLUtesselator *tess, void *data ) +{ + RequireState( tess, T_DORMANT ); + + tess->state = T_IN_POLYGON; + tess->cacheCount = 0; + tess->emptyCache = FALSE; + tess->mesh = NULL; + + tess->polygonData= data; +} + + +void GLAPIENTRY +gluTessBeginContour( GLUtesselator *tess ) +{ + RequireState( tess, T_IN_POLYGON ); + + tess->state = T_IN_CONTOUR; + tess->lastEdge = NULL; + if( tess->cacheCount > 0 ) { + /* Just set a flag so we don't get confused by empty contours + * -- these can be generated accidentally with the obsolete + * NextContour() interface. + */ + tess->emptyCache = TRUE; + } +} + + +void GLAPIENTRY +gluTessEndContour( GLUtesselator *tess ) +{ + RequireState( tess, T_IN_CONTOUR ); + tess->state = T_IN_POLYGON; +} + +void GLAPIENTRY +gluTessEndPolygon( GLUtesselator *tess ) +{ + GLUmesh *mesh; + + if (setjmp(tess->env) != 0) { + /* come back here if out of memory */ + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + + RequireState( tess, T_IN_POLYGON ); + tess->state = T_DORMANT; + + if( tess->mesh == NULL ) { + if( ! tess->flagBoundary && tess->callMesh == &noMesh ) { + + /* Try some special code to make the easy cases go quickly + * (eg. convex polygons). This code does NOT handle multiple contours, + * intersections, edge flags, and of course it does not generate + * an explicit mesh either. + */ + if( __gl_renderCache( tess )) { + tess->polygonData= NULL; + return; + } + } + if ( !EmptyCache( tess ) ) longjmp(tess->env,1); /* could've used a label*/ + } + + /* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ + __gl_projectPolygon( tess ); + + /* __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ + if ( !__gl_computeInterior( tess ) ) { + longjmp(tess->env,1); /* could've used a label */ + } + + mesh = tess->mesh; + if( ! tess->fatalError ) { + int rc = 1; + + /* If the user wants only the boundary contours, we throw away all edges + * except those which separate the interior from the exterior. + * Otherwise we tessellate all the regions marked "inside". + */ + if( tess->boundaryOnly ) { + rc = __gl_meshSetWindingNumber( mesh, 1, TRUE ); + } else { + rc = __gl_meshTessellateInterior( mesh ); + } + if (rc == 0) longjmp(tess->env,1); /* could've used a label */ + + __gl_meshCheckMesh( mesh ); + + if( tess->callBegin != &noBegin || tess->callEnd != &noEnd + || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag + || tess->callBeginData != &__gl_noBeginData + || tess->callEndData != &__gl_noEndData + || tess->callVertexData != &__gl_noVertexData + || tess->callEdgeFlagData != &__gl_noEdgeFlagData ) + { + if( tess->boundaryOnly ) { + __gl_renderBoundary( tess, mesh ); /* output boundary contours */ + } else { + __gl_renderMesh( tess, mesh ); /* output strips and fans */ + } + } + if( tess->callMesh != &noMesh ) { + + /* Throw away the exterior faces, so that all faces are interior. + * This way the user doesn't have to check the "inside" flag, + * and we don't need to even reveal its existence. It also leaves + * the freedom for an implementation to not generate the exterior + * faces in the first place. + */ + __gl_meshDiscardExterior( mesh ); + (*tess->callMesh)( mesh ); /* user wants the mesh itself */ + tess->mesh = NULL; + tess->polygonData= NULL; + return; + } + } + __gl_meshDeleteMesh( mesh ); + tess->polygonData= NULL; + tess->mesh = NULL; +} + + +/*XXXblythe unused function*/ +#if 0 +void GLAPIENTRY +gluDeleteMesh( GLUmesh *mesh ) +{ + __gl_meshDeleteMesh( mesh ); +} +#endif + + + +/*******************************************************/ + +/* Obsolete calls -- for backward compatibility */ + +void GLAPIENTRY +gluBeginPolygon( GLUtesselator *tess ) +{ + gluTessBeginPolygon( tess, NULL ); + gluTessBeginContour( tess ); +} + + +/*ARGSUSED*/ +void GLAPIENTRY +gluNextContour( GLUtesselator *tess, GLenum type ) +{ + gluTessEndContour( tess ); + gluTessBeginContour( tess ); +} + + +void GLAPIENTRY +gluEndPolygon( GLUtesselator *tess ) +{ + gluTessEndContour( tess ); + gluTessEndPolygon( tess ); +} diff --git a/cogl-path/tesselator/tess.h b/cogl-path/tesselator/tess.h new file mode 100644 index 0000000..1624960 --- /dev/null +++ b/cogl-path/tesselator/tess.h @@ -0,0 +1,165 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __tess_h_ +#define __tess_h_ + +#include +#include +#include "mesh.h" +#include "dict.h" +#include "priorityq.h" + +/* The begin/end calls must be properly nested. We keep track of + * the current state to enforce the ordering. + */ +enum TessState { T_DORMANT, T_IN_POLYGON, T_IN_CONTOUR }; + +/* We cache vertex data for single-contour polygons so that we can + * try a quick-and-dirty decomposition first. + */ +#define TESS_MAX_CACHE 100 + +typedef struct CachedVertex { + GLdouble coords[3]; + void *data; +} CachedVertex; + +struct GLUtesselator { + + /*** state needed for collecting the input data ***/ + + enum TessState state; /* what begin/end calls have we seen? */ + + GLUhalfEdge *lastEdge; /* lastEdge->Org is the most recent vertex */ + GLUmesh *mesh; /* stores the input contours, and eventually + the tessellation itself */ + + void (GLAPIENTRY *callError)( GLenum errnum ); + + /*** state needed for projecting onto the sweep plane ***/ + + GLdouble normal[3]; /* user-specified normal (if provided) */ + GLdouble sUnit[3]; /* unit vector in s-direction (debugging) */ + GLdouble tUnit[3]; /* unit vector in t-direction (debugging) */ + + /*** state needed for the line sweep ***/ + + GLdouble relTolerance; /* tolerance for merging features */ + GLenum windingRule; /* rule for determining polygon interior */ + GLboolean fatalError; /* fatal error: needed combine callback */ + + Dict *dict; /* edge dictionary for sweep line */ + PriorityQ *pq; /* priority queue of vertex events */ + GLUvertex *event; /* current sweep event being processed */ + + void (GLAPIENTRY *callCombine)( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData ); + + /*** state needed for rendering callbacks (see render.c) ***/ + + GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ + GLboolean boundaryOnly; /* Extract contours, not triangles */ + GLUface *lonelyTriList; + /* list of triangles which could not be rendered as strips or fans */ + + void (GLAPIENTRY *callBegin)( GLenum type ); + void (GLAPIENTRY *callEdgeFlag)( GLboolean boundaryEdge ); + void (GLAPIENTRY *callVertex)( void *data ); + void (GLAPIENTRY *callEnd)( void ); + void (GLAPIENTRY *callMesh)( GLUmesh *mesh ); + + + /*** state needed to cache single-contour polygons for renderCache() */ + + GLboolean emptyCache; /* empty cache on next vertex() call */ + int cacheCount; /* number of cached vertices */ + CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data */ + + /*** rendering callbacks that also pass polygon data ***/ + void (GLAPIENTRY *callBeginData)( GLenum type, void *polygonData ); + void (GLAPIENTRY *callEdgeFlagData)( GLboolean boundaryEdge, + void *polygonData ); + void (GLAPIENTRY *callVertexData)( void *data, void *polygonData ); + void (GLAPIENTRY *callEndData)( void *polygonData ); + void (GLAPIENTRY *callErrorData)( GLenum errnum, void *polygonData ); + void (GLAPIENTRY *callCombineData)( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData, + void *polygonData ); + + jmp_buf env; /* place to jump to when memAllocs fail */ + + void *polygonData; /* client data for current polygon */ +}; + +void GLAPIENTRY __gl_noBeginData( GLenum type, void *polygonData ); +void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData ); +void GLAPIENTRY __gl_noVertexData( void *data, void *polygonData ); +void GLAPIENTRY __gl_noEndData( void *polygonData ); +void GLAPIENTRY __gl_noErrorData( GLenum errnum, void *polygonData ); +void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData, + void *polygonData ); + +#define CALL_BEGIN_OR_BEGIN_DATA(a) \ + if (tess->callBeginData != &__gl_noBeginData) \ + (*tess->callBeginData)((a),tess->polygonData); \ + else (*tess->callBegin)((a)); + +#define CALL_VERTEX_OR_VERTEX_DATA(a) \ + if (tess->callVertexData != &__gl_noVertexData) \ + (*tess->callVertexData)((a),tess->polygonData); \ + else (*tess->callVertex)((a)); + +#define CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA(a) \ + if (tess->callEdgeFlagData != &__gl_noEdgeFlagData) \ + (*tess->callEdgeFlagData)((a),tess->polygonData); \ + else (*tess->callEdgeFlag)((a)); + +#define CALL_END_OR_END_DATA() \ + if (tess->callEndData != &__gl_noEndData) \ + (*tess->callEndData)(tess->polygonData); \ + else (*tess->callEnd)(); + +#define CALL_COMBINE_OR_COMBINE_DATA(a,b,c,d) \ + if (tess->callCombineData != &__gl_noCombineData) \ + (*tess->callCombineData)((a),(b),(c),(d),tess->polygonData); \ + else (*tess->callCombine)((a),(b),(c),(d)); + +#define CALL_ERROR_OR_ERROR_DATA(a) \ + if (tess->callErrorData != &__gl_noErrorData) \ + (*tess->callErrorData)((a),tess->polygonData); \ + else (*tess->callError)((a)); + +#endif diff --git a/cogl-path/tesselator/tesselator.h b/cogl-path/tesselator/tesselator.h new file mode 100644 index 0000000..5b651be --- /dev/null +++ b/cogl-path/tesselator/tesselator.h @@ -0,0 +1,122 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (C) 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#ifndef __TESSELATOR_H__ +#define __TESSELATOR_H__ + +/* This just includes the defines needed by the tesselator code */ + +#include "cogl/cogl-defines.h" +#include "cogl/cogl-gl-header.h" + +typedef struct GLUtesselator GLUtesselator; + +#define GLU_TESS_MAX_COORD 1.0e150 + +void gluBeginPolygon (GLUtesselator* tess); +void gluDeleteTess (GLUtesselator* tess); +void gluEndPolygon (GLUtesselator* tess); + +typedef void (_GLUfuncptr)(); + +void gluGetTessProperty (GLUtesselator* tess, GLenum which, double* data); + +GLUtesselator *gluNewTess (void); +void gluNextContour (GLUtesselator* tess, GLenum type); + +void gluTessBeginContour (GLUtesselator* tess); +void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); +void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); +void gluTessEndContour (GLUtesselator* tess); +void gluTessEndPolygon (GLUtesselator* tess); +void gluTessNormal (GLUtesselator* tess, double valueX, double valueY, double valueZ); +void gluTessProperty (GLUtesselator* tess, GLenum which, double data); +void gluTessVertex (GLUtesselator* tess, double *location, GLvoid* data); + +/* ErrorCode */ +#define GLU_INVALID_ENUM 100900 +#define GLU_INVALID_VALUE 100901 +#define GLU_OUT_OF_MEMORY 100902 + +/* TessCallback */ +#define GLU_TESS_BEGIN 100100 +#define GLU_BEGIN 100100 +#define GLU_TESS_VERTEX 100101 +#define GLU_VERTEX 100101 +#define GLU_TESS_END 100102 +#define GLU_END 100102 +#define GLU_TESS_ERROR 100103 +#define GLU_TESS_EDGE_FLAG 100104 +#define GLU_EDGE_FLAG 100104 +#define GLU_TESS_COMBINE 100105 +#define GLU_TESS_BEGIN_DATA 100106 +#define GLU_TESS_VERTEX_DATA 100107 +#define GLU_TESS_END_DATA 100108 +#define GLU_TESS_ERROR_DATA 100109 +#define GLU_TESS_EDGE_FLAG_DATA 100110 +#define GLU_TESS_COMBINE_DATA 100111 + +/* TessContour */ +#define GLU_CW 100120 +#define GLU_CCW 100121 +#define GLU_INTERIOR 100122 +#define GLU_EXTERIOR 100123 +#define GLU_UNKNOWN 100124 + +/* TessProperty */ +#define GLU_TESS_WINDING_RULE 100140 +#define GLU_TESS_BOUNDARY_ONLY 100141 +#define GLU_TESS_TOLERANCE 100142 + +/* TessError */ +#define GLU_TESS_ERROR1 100151 +#define GLU_TESS_ERROR2 100152 +#define GLU_TESS_ERROR3 100153 +#define GLU_TESS_ERROR4 100154 +#define GLU_TESS_ERROR5 100155 +#define GLU_TESS_ERROR6 100156 +#define GLU_TESS_ERROR7 100157 +#define GLU_TESS_ERROR8 100158 +#define GLU_TESS_MISSING_BEGIN_POLYGON 100151 +#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152 +#define GLU_TESS_MISSING_END_POLYGON 100153 +#define GLU_TESS_MISSING_END_CONTOUR 100154 +#define GLU_TESS_COORD_TOO_LARGE 100155 +#define GLU_TESS_NEED_COMBINE_CALLBACK 100156 + +/* TessWinding */ +#define GLU_TESS_WINDING_ODD 100130 +#define GLU_TESS_WINDING_NONZERO 100131 +#define GLU_TESS_WINDING_POSITIVE 100132 +#define GLU_TESS_WINDING_NEGATIVE 100133 +#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134 + +#endif /* __TESSELATOR_H__ */ diff --git a/cogl-path/tesselator/tessmono.c b/cogl-path/tesselator/tessmono.c new file mode 100644 index 0000000..4d08440 --- /dev/null +++ b/cogl-path/tesselator/tessmono.c @@ -0,0 +1,201 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include "geom.h" +#include "mesh.h" +#include "tessmono.h" +#include + +#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \ + eDst->Sym->winding += eSrc->Sym->winding) + +/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region + * (what else would it do??) The region must consist of a single + * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this + * case means that any vertical line intersects the interior of the + * region in a single interval. + * + * Tessellation consists of adding interior edges (actually pairs of + * half-edges), to split the region into non-overlapping triangles. + * + * The basic idea is explained in Preparata and Shamos (which I don''t + * have handy right now), although their implementation is more + * complicated than this one. The are two edge chains, an upper chain + * and a lower chain. We process all vertices from both chains in order, + * from right to left. + * + * The algorithm ensures that the following invariant holds after each + * vertex is processed: the untessellated region consists of two + * chains, where one chain (say the upper) is a single edge, and + * the other chain is concave. The left vertex of the single edge + * is always to the left of all vertices in the concave chain. + * + * Each step consists of adding the rightmost unprocessed vertex to one + * of the two chains, and forming a fan of triangles from the rightmost + * of two chain endpoints. Determining whether we can add each triangle + * to the fan is a simple orientation test. By making the fan as large + * as possible, we restore the invariant (check it yourself). + */ +int __gl_meshTessellateMonoRegion( GLUface *face ) +{ + GLUhalfEdge *up, *lo; + + /* All edges are oriented CCW around the boundary of the region. + * First, find the half-edge whose origin vertex is rightmost. + * Since the sweep goes from left to right, face->anEdge should + * be close to the edge we want. + */ + up = face->anEdge; + assert( up->Lnext != up && up->Lnext->Lnext != up ); + + for( ; VertLeq( up->Dst, up->Org ); up = up->Lprev ) + ; + for( ; VertLeq( up->Org, up->Dst ); up = up->Lnext ) + ; + lo = up->Lprev; + + while( up->Lnext != lo ) { + if( VertLeq( up->Dst, lo->Org )) { + /* up->Dst is on the left. It is safe to form triangles from lo->Org. + * The EdgeGoesLeft test guarantees progress even when some triangles + * are CW, given that the upper and lower chains are truly monotone. + */ + while( lo->Lnext != up && (EdgeGoesLeft( lo->Lnext ) + || EdgeSign( lo->Org, lo->Dst, lo->Lnext->Dst ) <= 0 )) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo ); + if (tempHalfEdge == NULL) return 0; + lo = tempHalfEdge->Sym; + } + lo = lo->Lprev; + } else { + /* lo->Org is on the left. We can make CCW triangles from up->Dst. */ + while( lo->Lnext != up && (EdgeGoesRight( up->Lprev ) + || EdgeSign( up->Dst, up->Org, up->Lprev->Org ) >= 0 )) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( up, up->Lprev ); + if (tempHalfEdge == NULL) return 0; + up = tempHalfEdge->Sym; + } + up = up->Lnext; + } + } + + /* Now lo->Org == up->Dst == the leftmost vertex. The remaining region + * can be tessellated in a fan from this leftmost vertex. + */ + assert( lo->Lnext != up ); + while( lo->Lnext->Lnext != up ) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo ); + if (tempHalfEdge == NULL) return 0; + lo = tempHalfEdge->Sym; + } + + return 1; +} + + +/* __gl_meshTessellateInterior( mesh ) tessellates each region of + * the mesh which is marked "inside" the polygon. Each such region + * must be monotone. + */ +int __gl_meshTessellateInterior( GLUmesh *mesh ) +{ + GLUface *f, *next; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { + /* Make sure we don''t try to tessellate the new triangles. */ + next = f->next; + if( f->inside ) { + if ( !__gl_meshTessellateMonoRegion( f ) ) return 0; + } + } + + return 1; +} + + +/* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces + * which are not marked "inside" the polygon. Since further mesh operations + * on NULL faces are not allowed, the main purpose is to clean up the + * mesh so that exterior loops are not represented in the data structure. + */ +void __gl_meshDiscardExterior( GLUmesh *mesh ) +{ + GLUface *f, *next; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { + /* Since f will be destroyed, save its next pointer. */ + next = f->next; + if( ! f->inside ) { + __gl_meshZapFace( f ); + } + } +} + +#define MARKED_FOR_DELETION 0x7fffffff + +/* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the + * winding numbers on all edges so that regions marked "inside" the + * polygon have a winding number of "value", and regions outside + * have a winding number of 0. + * + * If keepOnlyBoundary is TRUE, it also deletes all edges which do not + * separate an interior region from an exterior one. + */ +int __gl_meshSetWindingNumber( GLUmesh *mesh, int value, + GLboolean keepOnlyBoundary ) +{ + GLUhalfEdge *e, *eNext; + + for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) { + eNext = e->next; + if( e->Rface->inside != e->Lface->inside ) { + + /* This is a boundary edge (one side is interior, one is exterior). */ + e->winding = (e->Lface->inside) ? value : -value; + } else { + + /* Both regions are interior, or both are exterior. */ + if( ! keepOnlyBoundary ) { + e->winding = 0; + } else { + if ( !__gl_meshDelete( e ) ) return 0; + } + } + } + return 1; +} diff --git a/cogl-path/tesselator/tessmono.h b/cogl-path/tesselator/tessmono.h new file mode 100644 index 0000000..8ee1b2f --- /dev/null +++ b/cogl-path/tesselator/tessmono.h @@ -0,0 +1,71 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __tessmono_h_ +#define __tessmono_h_ + +/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region + * (what else would it do??) The region must consist of a single + * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this + * case means that any vertical line intersects the interior of the + * region in a single interval. + * + * Tessellation consists of adding interior edges (actually pairs of + * half-edges), to split the region into non-overlapping triangles. + * + * __gl_meshTessellateInterior( mesh ) tessellates each region of + * the mesh which is marked "inside" the polygon. Each such region + * must be monotone. + * + * __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces + * which are not marked "inside" the polygon. Since further mesh operations + * on NULL faces are not allowed, the main purpose is to clean up the + * mesh so that exterior loops are not represented in the data structure. + * + * __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the + * winding numbers on all edges so that regions marked "inside" the + * polygon have a winding number of "value", and regions outside + * have a winding number of 0. + * + * If keepOnlyBoundary is TRUE, it also deletes all edges which do not + * separate an interior region from an exterior one. + */ + +int __gl_meshTessellateMonoRegion( GLUface *face ); +int __gl_meshTessellateInterior( GLUmesh *mesh ); +void __gl_meshDiscardExterior( GLUmesh *mesh ); +int __gl_meshSetWindingNumber( GLUmesh *mesh, int value, + GLboolean keepOnlyBoundary ); + +#endif diff --git a/cogl/Makefile.am b/cogl/Makefile.am new file mode 100644 index 0000000..62d3762 --- /dev/null +++ b/cogl/Makefile.am @@ -0,0 +1,711 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +# preamble + +NULL = + +SUBDIRS = + +BUILT_SOURCES = + +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = + +noinst_LTLIBRARIES = +lib_LTLIBRARIES = + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -I$(srcdir)/deprecated \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/gl \ + -I$(srcdir)/driver/gl/gl \ + -I$(srcdir)/driver/gl/gles \ + $(NULL) + +if !USE_GLIB + AM_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +AM_CPPFLAGS += \ + -DG_LOG_DOMAIN=\"Cogl\" \ + -DCOGL_COMPILATION \ + -DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \ + -DCOGL_GLES1_LIBNAME=\"$(COGL_GLES1_LIBNAME)\" \ + -DCOGL_GLES2_LIBNAME=\"$(COGL_GLES2_LIBNAME)\" \ + -DCOGL_LOCALEDIR=\""$(localedir)"\" \ + $(NULL) + +if HAVE_COGL_DEFAULT_DRIVER +AM_CPPFLAGS += \ + -DCOGL_DEFAULT_DRIVER=\"$(COGL_DEFAULT_DRIVER)\" +endif + + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) + +BUILT_SOURCES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h +DISTCLEANFILES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h +EXTRA_DIST += cogl-defines.h.in cogl-egl-defines.h.in cogl-gl-header.h.in + +# Note: The cogl-1.0/cogl-gl-1.0 files are essentially for +# compatability only. I'm not really sure who could possibly be using +# them so we may decide to remove them entirely at some point. +pc_files = \ + cogl-1.0.pc \ + cogl-gl-1.0.pc + +pc_files += cogl-$(COGL_API_VERSION)-experimental.pc + +cogl-gl-1.0.pc: cogl-1.0.pc + $(QUIET_GEN)cp -f $< $(@F) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) + +EXTRA_DIST += cogl-1.0.pc.in cogl-$(COGL_API_VERSION)-experimental.pc.in +DISTCLEANFILES += $(pc_files) + +cogl_deprecated_h = \ + $(srcdir)/deprecated/cogl-clip-state.h \ + $(srcdir)/deprecated/cogl-fixed.h \ + $(srcdir)/deprecated/cogl-material-compat.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.h \ + $(srcdir)/deprecated/cogl-shader.h \ + $(srcdir)/deprecated/cogl-clutter.h \ + $(srcdir)/deprecated/cogl-type-casts.h \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.h \ + $(srcdir)/deprecated/cogl-texture-deprecated.h \ + $(srcdir)/deprecated/cogl-auto-texture.h \ + $(NULL) + +# public 1.x api headers +cogl_1_public_h = \ + $(cogl_deprecated_h) \ + $(srcdir)/cogl1-context.h \ + $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-offscreen.h \ + $(srcdir)/cogl-primitives.h \ + $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h \ + $(srcdir)/cogl.h \ + $(NULL) + +# experimental 2.0 api headers +# Note: we don't run glib-mkenums over these headers +cogl_experimental_h = \ + $(srcdir)/cogl-object.h \ + $(srcdir)/cogl-renderer.h \ + $(srcdir)/cogl-swap-chain.h \ + $(srcdir)/cogl-onscreen-template.h \ + $(srcdir)/cogl-display.h \ + $(srcdir)/cogl-context.h \ + $(srcdir)/cogl-pipeline.h \ + $(srcdir)/cogl-pipeline-state.h \ + $(srcdir)/cogl-pipeline-layer-state.h \ + $(srcdir)/cogl-snippet.h \ + $(srcdir)/cogl-gles2.h \ + $(srcdir)/cogl-gles2-types.h \ + $(srcdir)/cogl-index-buffer.h \ + $(srcdir)/cogl-attribute-buffer.h \ + $(srcdir)/cogl-indices.h \ + $(srcdir)/cogl-attribute.h \ + $(srcdir)/cogl-primitive.h \ + $(srcdir)/cogl-framebuffer.h \ + $(srcdir)/cogl-onscreen.h \ + $(srcdir)/cogl-frame-info.h \ + $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h \ + $(srcdir)/cogl-output.h \ + $(srcdir)/cogl-quaternion.h \ + $(srcdir)/cogl-matrix-stack.h \ + $(srcdir)/cogl-poll.h \ + $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h \ + $(srcdir)/cogl-texture-2d-gl.h \ + $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h \ + $(srcdir)/cogl-atlas-texture.h \ + $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-primitive-texture.h \ + $(srcdir)/cogl-depth-state.h \ + $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h \ + $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl-macros.h \ + $(srcdir)/cogl-fence.h \ + $(srcdir)/cogl-version.h \ + $(srcdir)/cogl-error.h \ + $(NULL) + +cogl_additional_experimental_h = \ + $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h \ + $(srcdir)/cogl-gtype-private.h \ + $(NULL) + +cogl_nodist_experimental_h = \ + $(NULL) + +# nop driver +cogl_driver_sources = \ + $(srcdir)/driver/nop/cogl-driver-nop.c \ + $(srcdir)/driver/nop/cogl-framebuffer-nop-private.h \ + $(srcdir)/driver/nop/cogl-framebuffer-nop.c \ + $(srcdir)/driver/nop/cogl-attribute-nop-private.h \ + $(srcdir)/driver/nop/cogl-attribute-nop.c \ + $(srcdir)/driver/nop/cogl-clip-stack-nop-private.h \ + $(srcdir)/driver/nop/cogl-clip-stack-nop.c \ + $(srcdir)/driver/nop/cogl-texture-2d-nop-private.h \ + $(srcdir)/driver/nop/cogl-texture-2d-nop.c \ + $(NULL) + +# gl driver sources +cogl_gl_prototypes_h = \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ + $(NULL) + +cogl_driver_sources += \ + $(srcdir)/driver/gl/cogl-util-gl-private.h \ + $(srcdir)/driver/gl/cogl-util-gl.c \ + $(srcdir)/driver/gl/cogl-framebuffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-framebuffer-gl.c \ + $(srcdir)/driver/gl/cogl-texture-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-gl.c \ + $(srcdir)/driver/gl/cogl-texture-2d-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-2d-gl.c \ + $(srcdir)/driver/gl/cogl-attribute-gl-private.h \ + $(srcdir)/driver/gl/cogl-attribute-gl.c \ + $(srcdir)/driver/gl/cogl-clip-stack-gl-private.h \ + $(srcdir)/driver/gl/cogl-clip-stack-gl.c \ + $(srcdir)/driver/gl/cogl-buffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-buffer-gl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl-private.h \ + $(NULL) + +if COGL_DRIVER_GL_SUPPORTED +cogl_driver_sources += \ + $(srcdir)/driver/gl/gl/cogl-driver-gl.c \ + $(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c \ + $(NULL) +endif + +if COGL_DRIVER_GLES_SUPPORTED +cogl_driver_sources += \ + $(srcdir)/driver/gl/gles/cogl-driver-gles.c \ + $(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c \ + $(NULL) +endif + +# winsys sources, common to all backends +cogl_winsys_common_sources = \ + $(srcdir)/winsys/cogl-winsys-private.h \ + $(srcdir)/winsys/cogl-winsys.c \ + $(NULL) + +# sources +cogl_sources_c = \ + $(cogl_driver_sources) \ + $(cogl_winsys_common_sources) \ + $(srcdir)/cogl-private.h \ + $(srcdir)/cogl-i18n-private.h \ + $(srcdir)/cogl-debug.h \ + $(srcdir)/cogl-debug-options.h \ + $(srcdir)/cogl-gpu-info.c \ + $(srcdir)/cogl-gpu-info-private.h \ + $(srcdir)/cogl-context-private.h \ + $(srcdir)/cogl-context.c \ + $(srcdir)/cogl-renderer-private.h \ + $(srcdir)/cogl-renderer.h \ + $(srcdir)/cogl-renderer.c \ + $(srcdir)/cogl-swap-chain-private.h \ + $(srcdir)/cogl-swap-chain.h \ + $(srcdir)/cogl-swap-chain.c \ + $(srcdir)/cogl-onscreen-template-private.h \ + $(srcdir)/cogl-onscreen-template.h \ + $(srcdir)/cogl-onscreen-template.c \ + $(srcdir)/cogl-display-private.h \ + $(srcdir)/cogl-display.h \ + $(srcdir)/cogl-display.c \ + $(srcdir)/cogl-driver.h \ + $(srcdir)/cogl.c \ + $(srcdir)/cogl-object-private.h \ + $(srcdir)/cogl-object.h \ + $(srcdir)/cogl-object.c \ + $(srcdir)/cogl-util.h \ + $(srcdir)/cogl-util.c \ + $(srcdir)/cogl-bitmap-private.h \ + $(srcdir)/cogl-bitmap.c \ + $(srcdir)/cogl-bitmap-conversion.c \ + $(srcdir)/cogl-bitmap-packing.h \ + $(srcdir)/cogl-primitives-private.h \ + $(srcdir)/cogl-primitives.h \ + $(srcdir)/cogl-primitives.c \ + $(srcdir)/cogl-bitmap-pixbuf.c \ + $(srcdir)/cogl-clip-stack.h \ + $(srcdir)/cogl-clip-stack.c \ + $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c \ + $(srcdir)/cogl-color-private.h \ + $(srcdir)/cogl-color.c \ + $(srcdir)/cogl-buffer-private.h \ + $(srcdir)/cogl-buffer.c \ + $(srcdir)/cogl-pixel-buffer-private.h \ + $(srcdir)/cogl-pixel-buffer.c \ + $(srcdir)/cogl-index-buffer-private.h \ + $(srcdir)/cogl-index-buffer.c \ + $(srcdir)/cogl-attribute-buffer-private.h \ + $(srcdir)/cogl-attribute-buffer.c \ + $(srcdir)/cogl-indices-private.h \ + $(srcdir)/cogl-indices.c \ + $(srcdir)/cogl-attribute-private.h \ + $(srcdir)/cogl-attribute.c \ + $(srcdir)/cogl-primitive-private.h \ + $(srcdir)/cogl-primitive.c \ + $(srcdir)/cogl-matrix.c \ + $(srcdir)/cogl-vector.c \ + $(srcdir)/cogl-euler.c \ + $(srcdir)/cogl-quaternion-private.h \ + $(srcdir)/cogl-quaternion.c \ + $(srcdir)/cogl-matrix-private.h \ + $(srcdir)/cogl-matrix-stack.c \ + $(srcdir)/cogl-matrix-stack-private.h \ + $(srcdir)/cogl-depth-state.c \ + $(srcdir)/cogl-depth-state-private.h \ + $(srcdir)/cogl-node.c \ + $(srcdir)/cogl-node-private.h \ + $(srcdir)/cogl-pipeline.c \ + $(srcdir)/cogl-pipeline-private.h \ + $(srcdir)/cogl-pipeline-layer.c \ + $(srcdir)/cogl-pipeline-layer-private.h \ + $(srcdir)/cogl-pipeline-state.c \ + $(srcdir)/cogl-pipeline-layer-state-private.h \ + $(srcdir)/cogl-pipeline-layer-state.c \ + $(srcdir)/cogl-pipeline-state-private.h \ + $(srcdir)/cogl-pipeline-debug.c \ + $(srcdir)/cogl-glsl-shader.c \ + $(srcdir)/cogl-glsl-shader-private.h \ + $(srcdir)/cogl-glsl-shader-boilerplate.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-pipeline-hash-table.h \ + $(srcdir)/cogl-pipeline-hash-table.c \ + $(srcdir)/cogl-sampler-cache.c \ + $(srcdir)/cogl-sampler-cache-private.h \ + $(srcdir)/cogl-blend-string.c \ + $(srcdir)/cogl-blend-string.h \ + $(srcdir)/cogl-debug.c \ + $(srcdir)/cogl-sub-texture-private.h \ + $(srcdir)/cogl-texture-private.h \ + $(srcdir)/cogl-texture-2d-private.h \ + $(srcdir)/cogl-texture-2d-sliced-private.h \ + $(srcdir)/cogl-texture-3d-private.h \ + $(srcdir)/cogl-texture-driver.h \ + $(srcdir)/cogl-sub-texture.c \ + $(srcdir)/cogl-texture.c \ + $(srcdir)/cogl-texture-2d.c \ + $(srcdir)/cogl-texture-2d-sliced.c \ + $(srcdir)/cogl-texture-3d.c \ + $(srcdir)/cogl-texture-rectangle-private.h \ + $(srcdir)/cogl-texture-rectangle.c \ + $(srcdir)/cogl-rectangle-map.h \ + $(srcdir)/cogl-rectangle-map.c \ + $(srcdir)/cogl-atlas.h \ + $(srcdir)/cogl-atlas.c \ + $(srcdir)/cogl-atlas-texture-private.h \ + $(srcdir)/cogl-atlas-texture.c \ + $(srcdir)/cogl-meta-texture.c \ + $(srcdir)/cogl-primitive-texture.c \ + $(srcdir)/cogl-blit.h \ + $(srcdir)/cogl-blit.c \ + $(srcdir)/cogl-spans.h \ + $(srcdir)/cogl-spans.c \ + $(srcdir)/cogl-journal-private.h \ + $(srcdir)/cogl-journal.c \ + $(srcdir)/cogl-frame-info-private.h \ + $(srcdir)/cogl-frame-info.c \ + $(srcdir)/cogl-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c \ + $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c \ + $(srcdir)/cogl-output-private.h \ + $(srcdir)/cogl-output.c \ + $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c \ + $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h \ + $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-gtype.c \ + $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c \ + $(srcdir)/cogl-list.c \ + $(srcdir)/cogl-list.h \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/winsys/cogl-winsys-stub.c \ + $(srcdir)/cogl-config-private.h \ + $(srcdir)/cogl-config.c \ + $(srcdir)/cogl-boxed-value.h \ + $(srcdir)/cogl-boxed-value.c \ + $(srcdir)/cogl-snippet-private.h \ + $(srcdir)/cogl-snippet.c \ + $(srcdir)/cogl-poll-private.h \ + $(srcdir)/cogl-poll.c \ + $(srcdir)/gl-prototypes/cogl-all-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles1-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles1-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-fixed-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ + $(srcdir)/cogl-memory-stack-private.h \ + $(srcdir)/cogl-memory-stack.c \ + $(srcdir)/cogl-magazine-private.h \ + $(srcdir)/cogl-magazine.c \ + $(srcdir)/cogl-gles2-context-private.h \ + $(srcdir)/cogl-gles2-context.c \ + $(srcdir)/cogl-error-private.h \ + $(srcdir)/cogl-error.c \ + $(srcdir)/cogl-closure-list-private.h \ + $(srcdir)/cogl-closure-list.c \ + $(srcdir)/cogl-fence.c \ + $(srcdir)/cogl-fence-private.h \ + $(srcdir)/deprecated/cogl-clip-state.c \ + $(srcdir)/deprecated/cogl-fixed.c \ + $(srcdir)/deprecated/cogl-vertex-buffer-private.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.c \ + $(srcdir)/deprecated/cogl-material-compat.c \ + $(srcdir)/deprecated/cogl-program.c \ + $(srcdir)/deprecated/cogl-program-private.h \ + $(srcdir)/deprecated/cogl-auto-texture.c \ + $(srcdir)/deprecated/cogl-shader-private.h \ + $(srcdir)/deprecated/cogl-shader.c \ + $(srcdir)/deprecated/cogl-clutter.c \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.c \ + $(srcdir)/deprecated/cogl-texture-deprecated.c \ + $(NULL) + +if USE_GLIB +cogl_experimental_h += \ + $(srcdir)/cogl-glib-source.h +cogl_sources_c += \ + $(srcdir)/cogl-glib-source.c +endif + +if SUPPORT_XLIB +cogl_deprecated_h += \ + $(srcdir)/deprecated/cogl-clutter-xlib.h +cogl_1_public_h += \ + $(srcdir)/cogl-xlib-renderer.h + +cogl_experimental_h += \ + $(srcdir)/winsys/cogl-texture-pixmap-x11.h \ + $(srcdir)/cogl-xlib.h + +cogl_sources_c += \ + $(srcdir)/cogl-x11-renderer-private.h \ + $(srcdir)/cogl-xlib-renderer-private.h \ + $(srcdir)/cogl-xlib-renderer.c \ + $(srcdir)/cogl-xlib.c \ + $(srcdir)/cogl-xlib-private.h \ + $(srcdir)/winsys/cogl-texture-pixmap-x11.c \ + $(srcdir)/winsys/cogl-texture-pixmap-x11-private.h +endif +if SUPPORT_GLX +cogl_experimental_h += $(srcdir)/cogl-glx.h +cogl_sources_c += \ + $(srcdir)/cogl-glx-renderer-private.h \ + $(srcdir)/cogl-glx-display-private.h \ + $(srcdir)/winsys/cogl-winsys-glx-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-glx-private.h \ + $(srcdir)/winsys/cogl-winsys-glx.c +endif +if SUPPORT_WGL +cogl_experimental_h += \ + $(srcdir)/cogl-win32-renderer.h + +cogl_sources_c += \ + $(srcdir)/cogl-win32-renderer.c \ + $(srcdir)/winsys/cogl-winsys-wgl-private.h \ + $(srcdir)/winsys/cogl-winsys-wgl.c \ + $(srcdir)/winsys/cogl-winsys-wgl-feature-functions.h +endif +if SUPPORT_WAYLAND_EGL_SERVER +cogl_experimental_h += \ + $(srcdir)/cogl-wayland-server.h +endif +if SUPPORT_EGL_PLATFORM_WAYLAND +cogl_experimental_h += \ + $(srcdir)/cogl-wayland-renderer.h \ + $(srcdir)/cogl-wayland-client.h +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-wayland.c \ + $(srcdir)/winsys/cogl-winsys-egl-wayland-private.h +endif +if SUPPORT_EGL_PLATFORM_KMS +cogl_experimental_h += \ + $(srcdir)/cogl-kms-renderer.h \ + $(srcdir)/cogl-kms-display.h +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-kms.c \ + $(srcdir)/winsys/cogl-winsys-egl-kms-private.h +endif +if SUPPORT_EGL_PLATFORM_XLIB +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-x11.c \ + $(srcdir)/winsys/cogl-winsys-egl-x11-private.h +endif +if SUPPORT_EGL_PLATFORM_POWERVR_NULL +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-null.c \ + $(srcdir)/winsys/cogl-winsys-egl-null-private.h +endif +if SUPPORT_EGL_PLATFORM_GDL +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-gdl.c \ + $(srcdir)/winsys/cogl-winsys-egl-gdl-private.h +endif +if SUPPORT_EGL_PLATFORM_ANDROID +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-egl-android.c \ + $(srcdir)/winsys/cogl-winsys-egl-android-private.h +endif +if SUPPORT_EGL +cogl_experimental_h += \ + $(srcdir)/cogl-egl.h +cogl_nodist_experimental_h += \ + $(builddir)/cogl-egl-defines.h + +cogl_sources_c += \ + $(srcdir)/cogl-egl-private.h \ + $(srcdir)/winsys/cogl-winsys-egl.c \ + $(srcdir)/winsys/cogl-winsys-egl-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-egl-private.h +endif +if SUPPORT_SDL +cogl_experimental_h += $(srcdir)/cogl-sdl.h +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-sdl-private.h \ + $(srcdir)/winsys/cogl-winsys-sdl.c \ + $(srcdir)/cogl-sdl.c +endif +if SUPPORT_SDL2 +cogl_experimental_h += $(srcdir)/cogl-sdl.h +cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-sdl-private.h \ + $(srcdir)/winsys/cogl-winsys-sdl2.c \ + $(srcdir)/cogl-sdl.c +endif + +EXTRA_DIST += stb_image.c + +# glib-mkenums rules +glib_enum_h = cogl-enum-types.h +glib_enum_c = cogl-enum-types.c +glib_enum_headers = $(cogl_1_public_h) +include $(top_srcdir)/build/autotools/Makefile.am.enums + +lib_LTLIBRARIES += libcogl.la + +libcogl_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +if !USE_GLIB +libcogl_la_LIBADD += $(top_builddir)/deps/glib/libglib.la +libcogl_la_LIBADD += $(top_builddir)/deps/gmodule/libgmodule.la +endif +if UNIT_TESTS +libcogl_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la +endif +# XXX: The aim is to eventually get rid of all private API exports +# for cogl-pango. +libcogl_la_LDFLAGS = \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -export-dynamic \ + -export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_get_format|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|_cogl_primitive_draw|test_|unit_test_).*" + +libcogl_la_SOURCES = $(cogl_sources_c) +nodist_libcogl_la_SOURCES = $(BUILT_SOURCES) + +# Cogl installed headers +cogl_headers = \ + $(cogl_1_public_h) \ + $(srcdir)/cogl-deprecated.h \ + $(srcdir)/cogl-pango.h \ + $(NULL) + +cogldeprecatedincludedir = $(includedir)/cogl/cogl/deprecated +cogldeprecatedinclude_HEADERS = $(cogl_deprecated_h) + +coglincludedir = $(includedir)/cogl/cogl +coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h) +nodist_coglinclude_HEADERS = $(cogl_nodist_experimental_h) cogl-defines.h cogl-enum-types.h + +cogl_proto_includedir = $(includedir)/cogl/cogl/gl-prototypes +cogl_proto_include_HEADERS = $(cogl_gl_prototypes_h) + +dist-hook: ../build/win32/vs9/cogl.vcproj ../build/win32/vs10/cogl.vcxproj ../build/win32/vs10/cogl.vcxproj.filters ../build/win32/gen-enums.bat + +# I know those filters below don't look nice, but this is to ensure the right files are in the Project files only *once* +../build/win32/vs9/cogl.vcproj: $(top_srcdir)/build/win32/vs9/cogl.vcprojin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >cogl.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/cogl.vcprojin >$@ + rm cogl.sourcefiles + +../build/win32/vs10/cogl.vcxproj: $(top_srcdir)/build/win32/vs10/cogl.vcxprojin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >cogl.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl.vcxprojin >$@ + rm cogl.vs10.sourcefiles + +../build/win32/vs10/cogl.vcxproj.filters: $(top_srcdir)/build/win32/vs10/cogl.vcxproj.filtersin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >cogl.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl.vcxproj.filtersin >$@ + rm cogl.vs10.sourcefiles.filters + +cogl.vsenums_h: + echo 'perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.h.in ' >vsenums_h.temp1 + for F in `echo $(cogl_1_public_h) $(srcdir)/cogl-win32-renderer.h`; do \ + case $$F in \ + *xlib*.h|*wayland*.h) ;; \ + *.h) echo '../../cogl'$$F' ' \ + ;; \ + esac; \ + done >>vsenums_h.temp1 + cat vsenums_h.temp1 | sed 's_/cogl./_/cogl/_' >vsenums_h.temp + cat vsenums_h.temp | tr -d '\n' >>$@ + echo '> ..\..\cogl\cogl-enum-types.h' >>$@ + rm vsenums_h.temp1 + rm vsenums_h.temp + +cogl.vsenums_c: + echo 'perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.c.in ' >vsenums_c.temp1 + for F in `echo $(cogl_1_public_h) $(srcdir)/cogl-win32-renderer.h`; do \ + case $$F in \ + *xlib*.h|*wayland*.h) ;; \ + *.h) echo '../../cogl'$$F' ' \ + ;; \ + esac; \ + done >>vsenums_c.temp1 + cat vsenums_c.temp1 | sed 's_/cogl./_/cogl/_' >vsenums_c.temp + cat vsenums_c.temp | tr -d '\n' >>$@ + echo '> ..\..\cogl\cogl-enum-types.c' >>$@ + rm vsenums_c.temp1 + rm vsenums_c.temp + +../build/win32/gen-enums.bat: cogl.vsenums_h cogl.vsenums_c + echo 'if exist ..\..\cogl\cogl-enum-types.h goto DONE_COGL_ENUMS_H' >$@ + cat cogl.vsenums_h >>$@ + echo ':DONE_COGL_ENUMS_H' >>$@ + echo 'if exist ..\..\cogl\cogl-enum-types.c goto DONE_COGL_ENUMS_C' >>$@ + cat cogl.vsenums_c >>$@ + echo ':DONE_COGL_ENUMS_C' >>$@ + rm cogl.vsenums_h + rm cogl.vsenums_c + +EXTRA_DIST += \ + cogl-defines.h.win32.in \ + cogl-defines.h.win32 \ + cogl-defines.h.win32_SDL.in \ + cogl-defines.h.win32_SDL \ + cogl-gl-header.h.win32 \ + cogl.symbols \ + cogl.rc.in \ + cogl.rc + +DISTCLEANFILES += ../build/win32/vs9/cogl.vcproj ../build/win32/vs10/cogl.vcxproj ../build/win32/vs10/cogl.vcxproj.filters ../build/win32/gen-enums.bat cogl.rc + +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION +Cogl-1.0.gir: libcogl.la Makefile + +Cogl_1_0_gir_NAMESPACE = Cogl +Cogl_1_0_gir_VERSION = 1.0 +Cogl_1_0_gir_LIBS = libcogl.la +if UNIT_TESTS +Cogl_1_0_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la +endif +Cogl_1_0_gir_FILES = $(cogl_1_public_h) cogl-enum-types.h + +Cogl-2.0.gir: libcogl.la Makefile + +Cogl_2_0_gir_NAMESPACE = Cogl +Cogl_2_0_gir_VERSION = 2.0 +Cogl_2_0_gir_LIBS = libcogl.la +if UNIT_TESTS +Cogl_2_0_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la +endif +Cogl_2_0_gir_FILES = $(cogl_experimental_h) $(cogl_additional_experimental_h) cogl-enum-types.h + +Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -D__COGL_EGL_H_INSIDE__ -D__COGL_GLX_H_INSIDE__ -DCOGL_GIR_SCANNING +Cogl_1_0_gir_INCLUDES = GL-1.0 GObject-2.0 +Cogl_1_0_gir_EXPORT_PACKAGES = cogl-1.0 +Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' + +Cogl_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -DCOGL_ENABLE_EXPERIMENTAL_API=1 -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -DCOGL_GIR_SCANNING +Cogl_2_0_gir_INCLUDES = GL-1.0 GObject-2.0 +Cogl_2_0_gir_EXPORT_PACKAGES = cogl-2.0-experimental +Cogl_2_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' --symbol-prefix=cogl --symbol-prefix=cogl2 + +INTROSPECTION_GIRS += Cogl-1.0.gir Cogl-2.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/cogl/Makefile.in b/cogl/Makefile.in new file mode 100644 index 0000000..9268eb7 --- /dev/null +++ b/cogl/Makefile.in @@ -0,0 +1,3119 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + +# Rules for generating enumeration types using glib-mkenums +# +# Define: +# glib_enum_h = header template file +# glib_enum_c = source template file +# glib_enum_headers = list of headers to parse +# +# before including Makefile.am.enums. You will also need to have +# the following targets already defined: +# +# CLEANFILES +# DISTCLEANFILES +# BUILT_SOURCES +# EXTRA_DIST +# +# Author: Emmanuele Bassi + + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(top_srcdir)/build/autotools/Makefile.am.enums \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/cogl-1.0.pc.in $(srcdir)/cogl-2.0-experimental.pc.in \ + $(srcdir)/cogl-defines.h.in $(srcdir)/cogl-defines.h.win32.in \ + $(srcdir)/cogl-defines.h.win32_SDL.in \ + $(srcdir)/cogl-gl-header.h.in $(srcdir)/cogl-egl-defines.h.in \ + $(srcdir)/cogl.rc.in $(top_srcdir)/build/depcomp \ + $(cogl_proto_include_HEADERS) \ + $(am__cogldeprecatedinclude_HEADERS_DIST) \ + $(am__coglinclude_HEADERS_DIST) +@HAVE_COGL_DEFAULT_DRIVER_TRUE@am__append_1 = \ +@HAVE_COGL_DEFAULT_DRIVER_TRUE@ -DCOGL_DEFAULT_DRIVER=\"$(COGL_DEFAULT_DRIVER)\" + +@COGL_DRIVER_GL_SUPPORTED_TRUE@am__append_2 = \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(srcdir)/driver/gl/gl/cogl-driver-gl.c \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(NULL) + +@COGL_DRIVER_GLES_SUPPORTED_TRUE@am__append_3 = \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(srcdir)/driver/gl/gles/cogl-driver-gles.c \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(NULL) + +@USE_GLIB_TRUE@am__append_4 = \ +@USE_GLIB_TRUE@ $(srcdir)/cogl-glib-source.h + +@USE_GLIB_TRUE@am__append_5 = \ +@USE_GLIB_TRUE@ $(srcdir)/cogl-glib-source.c + +@SUPPORT_XLIB_TRUE@am__append_6 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/deprecated/cogl-clutter-xlib.h + +@SUPPORT_XLIB_TRUE@am__append_7 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib-renderer.h + +@SUPPORT_XLIB_TRUE@am__append_8 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/winsys/cogl-texture-pixmap-x11.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib.h + +@SUPPORT_XLIB_TRUE@am__append_9 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-x11-renderer-private.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib-renderer-private.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib-renderer.c \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib.c \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib-private.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/winsys/cogl-texture-pixmap-x11.c \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/winsys/cogl-texture-pixmap-x11-private.h + +@SUPPORT_GLX_TRUE@am__append_10 = $(srcdir)/cogl-glx.h +@SUPPORT_GLX_TRUE@am__append_11 = \ +@SUPPORT_GLX_TRUE@ $(srcdir)/cogl-glx-renderer-private.h \ +@SUPPORT_GLX_TRUE@ $(srcdir)/cogl-glx-display-private.h \ +@SUPPORT_GLX_TRUE@ $(srcdir)/winsys/cogl-winsys-glx-feature-functions.h \ +@SUPPORT_GLX_TRUE@ $(srcdir)/winsys/cogl-winsys-glx-private.h \ +@SUPPORT_GLX_TRUE@ $(srcdir)/winsys/cogl-winsys-glx.c + +@SUPPORT_WGL_TRUE@am__append_12 = \ +@SUPPORT_WGL_TRUE@ $(srcdir)/cogl-win32-renderer.h + +@SUPPORT_WGL_TRUE@am__append_13 = \ +@SUPPORT_WGL_TRUE@ $(srcdir)/cogl-win32-renderer.c \ +@SUPPORT_WGL_TRUE@ $(srcdir)/winsys/cogl-winsys-wgl-private.h \ +@SUPPORT_WGL_TRUE@ $(srcdir)/winsys/cogl-winsys-wgl.c \ +@SUPPORT_WGL_TRUE@ $(srcdir)/winsys/cogl-winsys-wgl-feature-functions.h + +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@am__append_14 = \ +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@ $(srcdir)/cogl-wayland-server.h + +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@am__append_15 = \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ $(srcdir)/cogl-wayland-renderer.h \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ $(srcdir)/cogl-wayland-client.h + +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@am__append_16 = \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-wayland.c \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-wayland-private.h + +@SUPPORT_EGL_PLATFORM_KMS_TRUE@am__append_17 = \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ $(srcdir)/cogl-kms-renderer.h \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ $(srcdir)/cogl-kms-display.h + +@SUPPORT_EGL_PLATFORM_KMS_TRUE@am__append_18 = \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-kms.c \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-kms-private.h + +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@am__append_19 = \ +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-x11.c \ +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-x11-private.h + +@SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE@am__append_20 = \ +@SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-null.c \ +@SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-null-private.h + +@SUPPORT_EGL_PLATFORM_GDL_TRUE@am__append_21 = \ +@SUPPORT_EGL_PLATFORM_GDL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-gdl.c \ +@SUPPORT_EGL_PLATFORM_GDL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-gdl-private.h + +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@am__append_22 = \ +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-android.c \ +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-android-private.h + +@SUPPORT_EGL_TRUE@am__append_23 = \ +@SUPPORT_EGL_TRUE@ $(srcdir)/cogl-egl.h + +@SUPPORT_EGL_TRUE@am__append_24 = \ +@SUPPORT_EGL_TRUE@ $(builddir)/cogl-egl-defines.h + +@SUPPORT_EGL_TRUE@am__append_25 = \ +@SUPPORT_EGL_TRUE@ $(srcdir)/cogl-egl-private.h \ +@SUPPORT_EGL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl.c \ +@SUPPORT_EGL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-feature-functions.h \ +@SUPPORT_EGL_TRUE@ $(srcdir)/winsys/cogl-winsys-egl-private.h + +@SUPPORT_SDL_TRUE@am__append_26 = $(srcdir)/cogl-sdl.h +@SUPPORT_SDL_TRUE@am__append_27 = \ +@SUPPORT_SDL_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl-private.h \ +@SUPPORT_SDL_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl.c \ +@SUPPORT_SDL_TRUE@ $(srcdir)/cogl-sdl.c + +@SUPPORT_SDL2_TRUE@am__append_28 = $(srcdir)/cogl-sdl.h +@SUPPORT_SDL2_TRUE@am__append_29 = \ +@SUPPORT_SDL2_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl-private.h \ +@SUPPORT_SDL2_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl2.c \ +@SUPPORT_SDL2_TRUE@ $(srcdir)/cogl-sdl.c + +@USE_GLIB_FALSE@am__append_30 = $(top_builddir)/deps/glib/libglib.la \ +@USE_GLIB_FALSE@ $(top_builddir)/deps/gmodule/libgmodule.la +@UNIT_TESTS_TRUE@am__append_31 = $(top_builddir)/test-fixtures/libtest-fixtures.la +@HAVE_INTROSPECTION_TRUE@@UNIT_TESTS_TRUE@am__append_32 = $(top_builddir)/test-fixtures/libtest-fixtures.la +@HAVE_INTROSPECTION_TRUE@@UNIT_TESTS_TRUE@am__append_33 = $(top_builddir)/test-fixtures/libtest-fixtures.la +@HAVE_INTROSPECTION_TRUE@am__append_34 = Cogl-1.0.gir Cogl-2.0.gir +@HAVE_INTROSPECTION_TRUE@am__append_35 = $(gir_DATA) $(typelib_DATA) +subdir = cogl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-1.0.pc cogl-2.0-experimental.pc \ + cogl-defines.h cogl-defines.h.win32 cogl-defines.h.win32_SDL \ + cogl-gl-header.h cogl-egl-defines.h cogl.rc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ + "$(DESTDIR)$(cogl_proto_includedir)" \ + "$(DESTDIR)$(cogldeprecatedincludedir)" \ + "$(DESTDIR)$(coglincludedir)" "$(DESTDIR)$(coglincludedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcogl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__append_30) $(am__append_31) +am__libcogl_la_SOURCES_DIST = $(srcdir)/driver/nop/cogl-driver-nop.c \ + $(srcdir)/driver/nop/cogl-framebuffer-nop-private.h \ + $(srcdir)/driver/nop/cogl-framebuffer-nop.c \ + $(srcdir)/driver/nop/cogl-attribute-nop-private.h \ + $(srcdir)/driver/nop/cogl-attribute-nop.c \ + $(srcdir)/driver/nop/cogl-clip-stack-nop-private.h \ + $(srcdir)/driver/nop/cogl-clip-stack-nop.c \ + $(srcdir)/driver/nop/cogl-texture-2d-nop-private.h \ + $(srcdir)/driver/nop/cogl-texture-2d-nop.c \ + $(srcdir)/driver/gl/cogl-util-gl-private.h \ + $(srcdir)/driver/gl/cogl-util-gl.c \ + $(srcdir)/driver/gl/cogl-framebuffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-framebuffer-gl.c \ + $(srcdir)/driver/gl/cogl-texture-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-gl.c \ + $(srcdir)/driver/gl/cogl-texture-2d-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-2d-gl.c \ + $(srcdir)/driver/gl/cogl-attribute-gl-private.h \ + $(srcdir)/driver/gl/cogl-attribute-gl.c \ + $(srcdir)/driver/gl/cogl-clip-stack-gl-private.h \ + $(srcdir)/driver/gl/cogl-clip-stack-gl.c \ + $(srcdir)/driver/gl/cogl-buffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-buffer-gl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl-private.h \ + $(srcdir)/driver/gl/gl/cogl-driver-gl.c \ + $(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c \ + $(srcdir)/driver/gl/gles/cogl-driver-gles.c \ + $(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c \ + $(srcdir)/winsys/cogl-winsys-private.h \ + $(srcdir)/winsys/cogl-winsys.c $(srcdir)/cogl-private.h \ + $(srcdir)/cogl-i18n-private.h $(srcdir)/cogl-debug.h \ + $(srcdir)/cogl-debug-options.h $(srcdir)/cogl-gpu-info.c \ + $(srcdir)/cogl-gpu-info-private.h \ + $(srcdir)/cogl-context-private.h $(srcdir)/cogl-context.c \ + $(srcdir)/cogl-renderer-private.h $(srcdir)/cogl-renderer.h \ + $(srcdir)/cogl-renderer.c $(srcdir)/cogl-swap-chain-private.h \ + $(srcdir)/cogl-swap-chain.h $(srcdir)/cogl-swap-chain.c \ + $(srcdir)/cogl-onscreen-template-private.h \ + $(srcdir)/cogl-onscreen-template.h \ + $(srcdir)/cogl-onscreen-template.c \ + $(srcdir)/cogl-display-private.h $(srcdir)/cogl-display.h \ + $(srcdir)/cogl-display.c $(srcdir)/cogl-driver.h \ + $(srcdir)/cogl.c $(srcdir)/cogl-object-private.h \ + $(srcdir)/cogl-object.h $(srcdir)/cogl-object.c \ + $(srcdir)/cogl-util.h $(srcdir)/cogl-util.c \ + $(srcdir)/cogl-bitmap-private.h $(srcdir)/cogl-bitmap.c \ + $(srcdir)/cogl-bitmap-conversion.c \ + $(srcdir)/cogl-bitmap-packing.h \ + $(srcdir)/cogl-primitives-private.h \ + $(srcdir)/cogl-primitives.h $(srcdir)/cogl-primitives.c \ + $(srcdir)/cogl-bitmap-pixbuf.c $(srcdir)/cogl-clip-stack.h \ + $(srcdir)/cogl-clip-stack.c $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c \ + $(srcdir)/cogl-color-private.h $(srcdir)/cogl-color.c \ + $(srcdir)/cogl-buffer-private.h $(srcdir)/cogl-buffer.c \ + $(srcdir)/cogl-pixel-buffer-private.h \ + $(srcdir)/cogl-pixel-buffer.c \ + $(srcdir)/cogl-index-buffer-private.h \ + $(srcdir)/cogl-index-buffer.c \ + $(srcdir)/cogl-attribute-buffer-private.h \ + $(srcdir)/cogl-attribute-buffer.c \ + $(srcdir)/cogl-indices-private.h $(srcdir)/cogl-indices.c \ + $(srcdir)/cogl-attribute-private.h $(srcdir)/cogl-attribute.c \ + $(srcdir)/cogl-primitive-private.h $(srcdir)/cogl-primitive.c \ + $(srcdir)/cogl-matrix.c $(srcdir)/cogl-vector.c \ + $(srcdir)/cogl-euler.c $(srcdir)/cogl-quaternion-private.h \ + $(srcdir)/cogl-quaternion.c $(srcdir)/cogl-matrix-private.h \ + $(srcdir)/cogl-matrix-stack.c \ + $(srcdir)/cogl-matrix-stack-private.h \ + $(srcdir)/cogl-depth-state.c \ + $(srcdir)/cogl-depth-state-private.h $(srcdir)/cogl-node.c \ + $(srcdir)/cogl-node-private.h $(srcdir)/cogl-pipeline.c \ + $(srcdir)/cogl-pipeline-private.h \ + $(srcdir)/cogl-pipeline-layer.c \ + $(srcdir)/cogl-pipeline-layer-private.h \ + $(srcdir)/cogl-pipeline-state.c \ + $(srcdir)/cogl-pipeline-layer-state-private.h \ + $(srcdir)/cogl-pipeline-layer-state.c \ + $(srcdir)/cogl-pipeline-state-private.h \ + $(srcdir)/cogl-pipeline-debug.c $(srcdir)/cogl-glsl-shader.c \ + $(srcdir)/cogl-glsl-shader-private.h \ + $(srcdir)/cogl-glsl-shader-boilerplate.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-pipeline-hash-table.h \ + $(srcdir)/cogl-pipeline-hash-table.c \ + $(srcdir)/cogl-sampler-cache.c \ + $(srcdir)/cogl-sampler-cache-private.h \ + $(srcdir)/cogl-blend-string.c $(srcdir)/cogl-blend-string.h \ + $(srcdir)/cogl-debug.c $(srcdir)/cogl-sub-texture-private.h \ + $(srcdir)/cogl-texture-private.h \ + $(srcdir)/cogl-texture-2d-private.h \ + $(srcdir)/cogl-texture-2d-sliced-private.h \ + $(srcdir)/cogl-texture-3d-private.h \ + $(srcdir)/cogl-texture-driver.h $(srcdir)/cogl-sub-texture.c \ + $(srcdir)/cogl-texture.c $(srcdir)/cogl-texture-2d.c \ + $(srcdir)/cogl-texture-2d-sliced.c $(srcdir)/cogl-texture-3d.c \ + $(srcdir)/cogl-texture-rectangle-private.h \ + $(srcdir)/cogl-texture-rectangle.c \ + $(srcdir)/cogl-rectangle-map.h $(srcdir)/cogl-rectangle-map.c \ + $(srcdir)/cogl-atlas.h $(srcdir)/cogl-atlas.c \ + $(srcdir)/cogl-atlas-texture-private.h \ + $(srcdir)/cogl-atlas-texture.c $(srcdir)/cogl-meta-texture.c \ + $(srcdir)/cogl-primitive-texture.c $(srcdir)/cogl-blit.h \ + $(srcdir)/cogl-blit.c $(srcdir)/cogl-spans.h \ + $(srcdir)/cogl-spans.c $(srcdir)/cogl-journal-private.h \ + $(srcdir)/cogl-journal.c $(srcdir)/cogl-frame-info-private.h \ + $(srcdir)/cogl-frame-info.c \ + $(srcdir)/cogl-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c $(srcdir)/cogl-output-private.h \ + $(srcdir)/cogl-output.c $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-gtype.c $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c $(srcdir)/cogl-list.c \ + $(srcdir)/cogl-list.h \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/winsys/cogl-winsys-stub.c \ + $(srcdir)/cogl-config-private.h $(srcdir)/cogl-config.c \ + $(srcdir)/cogl-boxed-value.h $(srcdir)/cogl-boxed-value.c \ + $(srcdir)/cogl-snippet-private.h $(srcdir)/cogl-snippet.c \ + $(srcdir)/cogl-poll-private.h $(srcdir)/cogl-poll.c \ + $(srcdir)/gl-prototypes/cogl-all-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles1-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles1-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-fixed-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ + $(srcdir)/cogl-memory-stack-private.h \ + $(srcdir)/cogl-memory-stack.c \ + $(srcdir)/cogl-magazine-private.h $(srcdir)/cogl-magazine.c \ + $(srcdir)/cogl-gles2-context-private.h \ + $(srcdir)/cogl-gles2-context.c $(srcdir)/cogl-error-private.h \ + $(srcdir)/cogl-error.c $(srcdir)/cogl-closure-list-private.h \ + $(srcdir)/cogl-closure-list.c $(srcdir)/cogl-fence.c \ + $(srcdir)/cogl-fence-private.h \ + $(srcdir)/deprecated/cogl-clip-state.c \ + $(srcdir)/deprecated/cogl-fixed.c \ + $(srcdir)/deprecated/cogl-vertex-buffer-private.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.c \ + $(srcdir)/deprecated/cogl-material-compat.c \ + $(srcdir)/deprecated/cogl-program.c \ + $(srcdir)/deprecated/cogl-program-private.h \ + $(srcdir)/deprecated/cogl-auto-texture.c \ + $(srcdir)/deprecated/cogl-shader-private.h \ + $(srcdir)/deprecated/cogl-shader.c \ + $(srcdir)/deprecated/cogl-clutter.c \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.c \ + $(srcdir)/deprecated/cogl-texture-deprecated.c \ + $(srcdir)/cogl-glib-source.c \ + $(srcdir)/cogl-x11-renderer-private.h \ + $(srcdir)/cogl-xlib-renderer-private.h \ + $(srcdir)/cogl-xlib-renderer.c $(srcdir)/cogl-xlib.c \ + $(srcdir)/cogl-xlib-private.h \ + $(srcdir)/winsys/cogl-texture-pixmap-x11.c \ + $(srcdir)/winsys/cogl-texture-pixmap-x11-private.h \ + $(srcdir)/cogl-glx-renderer-private.h \ + $(srcdir)/cogl-glx-display-private.h \ + $(srcdir)/winsys/cogl-winsys-glx-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-glx-private.h \ + $(srcdir)/winsys/cogl-winsys-glx.c \ + $(srcdir)/cogl-win32-renderer.c \ + $(srcdir)/winsys/cogl-winsys-wgl-private.h \ + $(srcdir)/winsys/cogl-winsys-wgl.c \ + $(srcdir)/winsys/cogl-winsys-wgl-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-egl-wayland.c \ + $(srcdir)/winsys/cogl-winsys-egl-wayland-private.h \ + $(srcdir)/winsys/cogl-winsys-egl-kms.c \ + $(srcdir)/winsys/cogl-winsys-egl-kms-private.h \ + $(srcdir)/winsys/cogl-winsys-egl-x11.c \ + $(srcdir)/winsys/cogl-winsys-egl-x11-private.h \ + $(srcdir)/winsys/cogl-winsys-egl-null.c \ + $(srcdir)/winsys/cogl-winsys-egl-null-private.h \ + $(srcdir)/winsys/cogl-winsys-egl-gdl.c \ + $(srcdir)/winsys/cogl-winsys-egl-gdl-private.h \ + $(srcdir)/winsys/cogl-winsys-egl-android.c \ + $(srcdir)/winsys/cogl-winsys-egl-android-private.h \ + $(srcdir)/cogl-egl-private.h \ + $(srcdir)/winsys/cogl-winsys-egl.c \ + $(srcdir)/winsys/cogl-winsys-egl-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-egl-private.h \ + $(srcdir)/winsys/cogl-winsys-sdl-private.h \ + $(srcdir)/winsys/cogl-winsys-sdl.c $(srcdir)/cogl-sdl.c \ + $(srcdir)/winsys/cogl-winsys-sdl2.c +am__objects_1 = +@COGL_DRIVER_GL_SUPPORTED_TRUE@am__objects_2 = cogl-driver-gl.lo \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ cogl-texture-driver-gl.lo \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(am__objects_1) +@COGL_DRIVER_GLES_SUPPORTED_TRUE@am__objects_3 = cogl-driver-gles.lo \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ cogl-texture-driver-gles.lo \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(am__objects_1) +am__objects_4 = cogl-driver-nop.lo cogl-framebuffer-nop.lo \ + cogl-attribute-nop.lo cogl-clip-stack-nop.lo \ + cogl-texture-2d-nop.lo $(am__objects_1) cogl-util-gl.lo \ + cogl-framebuffer-gl.lo cogl-texture-gl.lo \ + cogl-texture-2d-gl.lo cogl-attribute-gl.lo \ + cogl-clip-stack-gl.lo cogl-buffer-gl.lo \ + cogl-pipeline-opengl.lo cogl-pipeline-fragend-glsl.lo \ + cogl-pipeline-fragend-arbfp.lo \ + cogl-pipeline-progend-fixed-arbfp.lo \ + cogl-pipeline-fragend-fixed.lo cogl-pipeline-vertend-glsl.lo \ + cogl-pipeline-vertend-fixed.lo cogl-pipeline-progend-fixed.lo \ + cogl-pipeline-progend-glsl.lo $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) +am__objects_5 = cogl-winsys.lo $(am__objects_1) +@USE_GLIB_TRUE@am__objects_6 = cogl-glib-source.lo +@SUPPORT_XLIB_TRUE@am__objects_7 = cogl-xlib-renderer.lo cogl-xlib.lo \ +@SUPPORT_XLIB_TRUE@ cogl-texture-pixmap-x11.lo +@SUPPORT_GLX_TRUE@am__objects_8 = cogl-winsys-glx.lo +@SUPPORT_WGL_TRUE@am__objects_9 = cogl-win32-renderer.lo \ +@SUPPORT_WGL_TRUE@ cogl-winsys-wgl.lo +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@am__objects_10 = \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ cogl-winsys-egl-wayland.lo +@SUPPORT_EGL_PLATFORM_KMS_TRUE@am__objects_11 = \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ cogl-winsys-egl-kms.lo +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@am__objects_12 = \ +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@ cogl-winsys-egl-x11.lo +@SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE@am__objects_13 = cogl-winsys-egl-null.lo +@SUPPORT_EGL_PLATFORM_GDL_TRUE@am__objects_14 = \ +@SUPPORT_EGL_PLATFORM_GDL_TRUE@ cogl-winsys-egl-gdl.lo +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@am__objects_15 = \ +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@ cogl-winsys-egl-android.lo +@SUPPORT_EGL_TRUE@am__objects_16 = cogl-winsys-egl.lo +@SUPPORT_SDL_TRUE@am__objects_17 = cogl-winsys-sdl.lo cogl-sdl.lo +@SUPPORT_SDL2_TRUE@am__objects_18 = cogl-winsys-sdl2.lo cogl-sdl.lo +am__objects_19 = $(am__objects_4) $(am__objects_5) cogl-gpu-info.lo \ + cogl-context.lo cogl-renderer.lo cogl-swap-chain.lo \ + cogl-onscreen-template.lo cogl-display.lo cogl.lo \ + cogl-object.lo cogl-util.lo cogl-bitmap.lo \ + cogl-bitmap-conversion.lo cogl-primitives.lo \ + cogl-bitmap-pixbuf.lo cogl-clip-stack.lo \ + cogl-feature-private.lo cogl-color.lo cogl-buffer.lo \ + cogl-pixel-buffer.lo cogl-index-buffer.lo \ + cogl-attribute-buffer.lo cogl-indices.lo cogl-attribute.lo \ + cogl-primitive.lo cogl-matrix.lo cogl-vector.lo cogl-euler.lo \ + cogl-quaternion.lo cogl-matrix-stack.lo cogl-depth-state.lo \ + cogl-node.lo cogl-pipeline.lo cogl-pipeline-layer.lo \ + cogl-pipeline-state.lo cogl-pipeline-layer-state.lo \ + cogl-pipeline-debug.lo cogl-glsl-shader.lo \ + cogl-pipeline-snippet.lo cogl-pipeline-cache.lo \ + cogl-pipeline-hash-table.lo cogl-sampler-cache.lo \ + cogl-blend-string.lo cogl-debug.lo cogl-sub-texture.lo \ + cogl-texture.lo cogl-texture-2d.lo cogl-texture-2d-sliced.lo \ + cogl-texture-3d.lo cogl-texture-rectangle.lo \ + cogl-rectangle-map.lo cogl-atlas.lo cogl-atlas-texture.lo \ + cogl-meta-texture.lo cogl-primitive-texture.lo cogl-blit.lo \ + cogl-spans.lo cogl-journal.lo cogl-frame-info.lo \ + cogl-framebuffer.lo cogl-onscreen.lo cogl-output.lo \ + cogl-profile.lo cogl-bitmask.lo cogl-gtype.lo \ + cogl-point-in-poly.lo cogl-list.lo cogl-winsys-stub.lo \ + cogl-config.lo cogl-boxed-value.lo cogl-snippet.lo \ + cogl-poll.lo cogl-memory-stack.lo cogl-magazine.lo \ + cogl-gles2-context.lo cogl-error.lo cogl-closure-list.lo \ + cogl-fence.lo cogl-clip-state.lo cogl-fixed.lo \ + cogl-vertex-buffer.lo cogl-material-compat.lo cogl-program.lo \ + cogl-auto-texture.lo cogl-shader.lo cogl-clutter.lo \ + cogl-framebuffer-deprecated.lo cogl-texture-deprecated.lo \ + $(am__objects_1) $(am__objects_6) $(am__objects_7) \ + $(am__objects_8) $(am__objects_9) $(am__objects_10) \ + $(am__objects_11) $(am__objects_12) $(am__objects_13) \ + $(am__objects_14) $(am__objects_15) $(am__objects_16) \ + $(am__objects_17) $(am__objects_18) +am_libcogl_la_OBJECTS = $(am__objects_19) +am__objects_20 = cogl-enum-types.lo +am__objects_21 = $(am__objects_1) $(am__objects_20) +nodist_libcogl_la_OBJECTS = $(am__objects_21) +libcogl_la_OBJECTS = $(am_libcogl_la_OBJECTS) \ + $(nodist_libcogl_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libcogl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libcogl_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcogl_la_SOURCES) $(nodist_libcogl_la_SOURCES) +DIST_SOURCES = $(am__libcogl_la_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) +am__cogldeprecatedinclude_HEADERS_DIST = \ + $(srcdir)/deprecated/cogl-clip-state.h \ + $(srcdir)/deprecated/cogl-fixed.h \ + $(srcdir)/deprecated/cogl-material-compat.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.h \ + $(srcdir)/deprecated/cogl-shader.h \ + $(srcdir)/deprecated/cogl-clutter.h \ + $(srcdir)/deprecated/cogl-type-casts.h \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.h \ + $(srcdir)/deprecated/cogl-texture-deprecated.h \ + $(srcdir)/deprecated/cogl-auto-texture.h \ + $(srcdir)/deprecated/cogl-clutter-xlib.h +am__coglinclude_HEADERS_DIST = $(srcdir)/deprecated/cogl-clip-state.h \ + $(srcdir)/deprecated/cogl-fixed.h \ + $(srcdir)/deprecated/cogl-material-compat.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.h \ + $(srcdir)/deprecated/cogl-shader.h \ + $(srcdir)/deprecated/cogl-clutter.h \ + $(srcdir)/deprecated/cogl-type-casts.h \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.h \ + $(srcdir)/deprecated/cogl-texture-deprecated.h \ + $(srcdir)/deprecated/cogl-auto-texture.h \ + $(srcdir)/deprecated/cogl-clutter-xlib.h \ + $(srcdir)/cogl1-context.h $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-offscreen.h $(srcdir)/cogl-primitives.h \ + $(srcdir)/cogl-texture.h $(srcdir)/cogl-types.h \ + $(srcdir)/cogl.h $(srcdir)/cogl-xlib-renderer.h \ + $(srcdir)/cogl-deprecated.h $(srcdir)/cogl-pango.h \ + $(srcdir)/cogl-object.h $(srcdir)/cogl-renderer.h \ + $(srcdir)/cogl-swap-chain.h $(srcdir)/cogl-onscreen-template.h \ + $(srcdir)/cogl-display.h $(srcdir)/cogl-context.h \ + $(srcdir)/cogl-pipeline.h $(srcdir)/cogl-pipeline-state.h \ + $(srcdir)/cogl-pipeline-layer-state.h $(srcdir)/cogl-snippet.h \ + $(srcdir)/cogl-gles2.h $(srcdir)/cogl-gles2-types.h \ + $(srcdir)/cogl-index-buffer.h \ + $(srcdir)/cogl-attribute-buffer.h $(srcdir)/cogl-indices.h \ + $(srcdir)/cogl-attribute.h $(srcdir)/cogl-primitive.h \ + $(srcdir)/cogl-framebuffer.h $(srcdir)/cogl-onscreen.h \ + $(srcdir)/cogl-frame-info.h $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h $(srcdir)/cogl-output.h \ + $(srcdir)/cogl-quaternion.h $(srcdir)/cogl-matrix-stack.h \ + $(srcdir)/cogl-poll.h $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h $(srcdir)/cogl-texture-2d-gl.h \ + $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h $(srcdir)/cogl-atlas-texture.h \ + $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-primitive-texture.h \ + $(srcdir)/cogl-depth-state.h $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl-macros.h $(srcdir)/cogl-fence.h \ + $(srcdir)/cogl-version.h $(srcdir)/cogl-error.h \ + $(srcdir)/cogl-glib-source.h \ + $(srcdir)/winsys/cogl-texture-pixmap-x11.h \ + $(srcdir)/cogl-xlib.h $(srcdir)/cogl-glx.h \ + $(srcdir)/cogl-win32-renderer.h \ + $(srcdir)/cogl-wayland-server.h \ + $(srcdir)/cogl-wayland-renderer.h \ + $(srcdir)/cogl-wayland-client.h $(srcdir)/cogl-kms-renderer.h \ + $(srcdir)/cogl-kms-display.h $(srcdir)/cogl-egl.h \ + $(srcdir)/cogl-sdl.h +HEADERS = $(cogl_proto_include_HEADERS) \ + $(cogldeprecatedinclude_HEADERS) $(coglinclude_HEADERS) \ + $(nodist_coglinclude_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; + +# preamble +NULL = +SUBDIRS = +BUILT_SOURCES = cogl-defines.h cogl-egl-defines.h cogl-gl-header.h \ + $(glib_enum_h) $(glib_enum_c) +EXTRA_DIST = cogl-defines.h.in cogl-egl-defines.h.in \ + cogl-gl-header.h.in cogl-1.0.pc.in \ + cogl-$(COGL_API_VERSION)-experimental.pc.in stb_image.c \ + $(enum_tmpl_h) $(enum_tmpl_c) cogl-defines.h.win32.in \ + cogl-defines.h.win32 cogl-defines.h.win32_SDL.in \ + cogl-defines.h.win32_SDL cogl-gl-header.h.win32 cogl.symbols \ + cogl.rc.in cogl.rc +CLEANFILES = stamp-enum-types $(am__append_35) +DISTCLEANFILES = cogl-defines.h cogl-egl-defines.h cogl-gl-header.h \ + $(pc_files) $(glib_enum_h) $(glib_enum_c) \ + ../build/win32/vs9/cogl.vcproj \ + ../build/win32/vs10/cogl.vcxproj \ + ../build/win32/vs10/cogl.vcxproj.filters \ + ../build/win32/gen-enums.bat cogl.rc +noinst_LTLIBRARIES = +lib_LTLIBRARIES = libcogl.la +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)/deprecated \ + -I$(srcdir)/winsys -I$(srcdir)/driver/gl \ + -I$(srcdir)/driver/gl/gl -I$(srcdir)/driver/gl/gles $(NULL) \ + -DG_LOG_DOMAIN=\"Cogl\" -DCOGL_COMPILATION \ + -DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \ + -DCOGL_GLES1_LIBNAME=\"$(COGL_GLES1_LIBNAME)\" \ + -DCOGL_GLES2_LIBNAME=\"$(COGL_GLES2_LIBNAME)\" \ + -DCOGL_LOCALEDIR=\""$(localedir)"\" $(NULL) $(am__append_1) +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) + +# Note: The cogl-1.0/cogl-gl-1.0 files are essentially for +# compatability only. I'm not really sure who could possibly be using +# them so we may decide to remove them entirely at some point. +pc_files = cogl-1.0.pc cogl-gl-1.0.pc \ + cogl-$(COGL_API_VERSION)-experimental.pc +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = $(pc_files) +cogl_deprecated_h = $(srcdir)/deprecated/cogl-clip-state.h \ + $(srcdir)/deprecated/cogl-fixed.h \ + $(srcdir)/deprecated/cogl-material-compat.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.h \ + $(srcdir)/deprecated/cogl-shader.h \ + $(srcdir)/deprecated/cogl-clutter.h \ + $(srcdir)/deprecated/cogl-type-casts.h \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.h \ + $(srcdir)/deprecated/cogl-texture-deprecated.h \ + $(srcdir)/deprecated/cogl-auto-texture.h $(NULL) \ + $(am__append_6) + +# public 1.x api headers +cogl_1_public_h = $(cogl_deprecated_h) $(srcdir)/cogl1-context.h \ + $(srcdir)/cogl-bitmap.h $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-matrix.h $(srcdir)/cogl-offscreen.h \ + $(srcdir)/cogl-primitives.h $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h $(srcdir)/cogl.h $(NULL) \ + $(am__append_7) + +# experimental 2.0 api headers +# Note: we don't run glib-mkenums over these headers +cogl_experimental_h = $(srcdir)/cogl-object.h \ + $(srcdir)/cogl-renderer.h $(srcdir)/cogl-swap-chain.h \ + $(srcdir)/cogl-onscreen-template.h $(srcdir)/cogl-display.h \ + $(srcdir)/cogl-context.h $(srcdir)/cogl-pipeline.h \ + $(srcdir)/cogl-pipeline-state.h \ + $(srcdir)/cogl-pipeline-layer-state.h $(srcdir)/cogl-snippet.h \ + $(srcdir)/cogl-gles2.h $(srcdir)/cogl-gles2-types.h \ + $(srcdir)/cogl-index-buffer.h \ + $(srcdir)/cogl-attribute-buffer.h $(srcdir)/cogl-indices.h \ + $(srcdir)/cogl-attribute.h $(srcdir)/cogl-primitive.h \ + $(srcdir)/cogl-framebuffer.h $(srcdir)/cogl-onscreen.h \ + $(srcdir)/cogl-frame-info.h $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h $(srcdir)/cogl-output.h \ + $(srcdir)/cogl-quaternion.h $(srcdir)/cogl-matrix-stack.h \ + $(srcdir)/cogl-poll.h $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h $(srcdir)/cogl-texture-2d-gl.h \ + $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h $(srcdir)/cogl-atlas-texture.h \ + $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-primitive-texture.h \ + $(srcdir)/cogl-depth-state.h $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl-macros.h $(srcdir)/cogl-fence.h \ + $(srcdir)/cogl-version.h $(srcdir)/cogl-error.h $(NULL) \ + $(am__append_4) $(am__append_8) $(am__append_10) \ + $(am__append_12) $(am__append_14) $(am__append_15) \ + $(am__append_17) $(am__append_23) $(am__append_26) \ + $(am__append_28) +cogl_additional_experimental_h = \ + $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h \ + $(srcdir)/cogl-gtype-private.h \ + $(NULL) + +cogl_nodist_experimental_h = $(NULL) $(am__append_24) + +# nop driver +cogl_driver_sources = $(srcdir)/driver/nop/cogl-driver-nop.c \ + $(srcdir)/driver/nop/cogl-framebuffer-nop-private.h \ + $(srcdir)/driver/nop/cogl-framebuffer-nop.c \ + $(srcdir)/driver/nop/cogl-attribute-nop-private.h \ + $(srcdir)/driver/nop/cogl-attribute-nop.c \ + $(srcdir)/driver/nop/cogl-clip-stack-nop-private.h \ + $(srcdir)/driver/nop/cogl-clip-stack-nop.c \ + $(srcdir)/driver/nop/cogl-texture-2d-nop-private.h \ + $(srcdir)/driver/nop/cogl-texture-2d-nop.c $(NULL) \ + $(srcdir)/driver/gl/cogl-util-gl-private.h \ + $(srcdir)/driver/gl/cogl-util-gl.c \ + $(srcdir)/driver/gl/cogl-framebuffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-framebuffer-gl.c \ + $(srcdir)/driver/gl/cogl-texture-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-gl.c \ + $(srcdir)/driver/gl/cogl-texture-2d-gl-private.h \ + $(srcdir)/driver/gl/cogl-texture-2d-gl.c \ + $(srcdir)/driver/gl/cogl-attribute-gl-private.h \ + $(srcdir)/driver/gl/cogl-attribute-gl.c \ + $(srcdir)/driver/gl/cogl-clip-stack-gl-private.h \ + $(srcdir)/driver/gl/cogl-clip-stack-gl.c \ + $(srcdir)/driver/gl/cogl-buffer-gl-private.h \ + $(srcdir)/driver/gl/cogl-buffer-gl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl.c \ + $(srcdir)/driver/gl/cogl-pipeline-opengl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c \ + $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c \ + $(srcdir)/driver/gl/cogl-pipeline-progend-glsl-private.h \ + $(NULL) $(am__append_2) $(am__append_3) + +# gl driver sources +cogl_gl_prototypes_h = \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ + $(NULL) + + +# winsys sources, common to all backends +cogl_winsys_common_sources = \ + $(srcdir)/winsys/cogl-winsys-private.h \ + $(srcdir)/winsys/cogl-winsys.c \ + $(NULL) + + +# sources +cogl_sources_c = $(cogl_driver_sources) $(cogl_winsys_common_sources) \ + $(srcdir)/cogl-private.h $(srcdir)/cogl-i18n-private.h \ + $(srcdir)/cogl-debug.h $(srcdir)/cogl-debug-options.h \ + $(srcdir)/cogl-gpu-info.c $(srcdir)/cogl-gpu-info-private.h \ + $(srcdir)/cogl-context-private.h $(srcdir)/cogl-context.c \ + $(srcdir)/cogl-renderer-private.h $(srcdir)/cogl-renderer.h \ + $(srcdir)/cogl-renderer.c $(srcdir)/cogl-swap-chain-private.h \ + $(srcdir)/cogl-swap-chain.h $(srcdir)/cogl-swap-chain.c \ + $(srcdir)/cogl-onscreen-template-private.h \ + $(srcdir)/cogl-onscreen-template.h \ + $(srcdir)/cogl-onscreen-template.c \ + $(srcdir)/cogl-display-private.h $(srcdir)/cogl-display.h \ + $(srcdir)/cogl-display.c $(srcdir)/cogl-driver.h \ + $(srcdir)/cogl.c $(srcdir)/cogl-object-private.h \ + $(srcdir)/cogl-object.h $(srcdir)/cogl-object.c \ + $(srcdir)/cogl-util.h $(srcdir)/cogl-util.c \ + $(srcdir)/cogl-bitmap-private.h $(srcdir)/cogl-bitmap.c \ + $(srcdir)/cogl-bitmap-conversion.c \ + $(srcdir)/cogl-bitmap-packing.h \ + $(srcdir)/cogl-primitives-private.h \ + $(srcdir)/cogl-primitives.h $(srcdir)/cogl-primitives.c \ + $(srcdir)/cogl-bitmap-pixbuf.c $(srcdir)/cogl-clip-stack.h \ + $(srcdir)/cogl-clip-stack.c $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c \ + $(srcdir)/cogl-color-private.h $(srcdir)/cogl-color.c \ + $(srcdir)/cogl-buffer-private.h $(srcdir)/cogl-buffer.c \ + $(srcdir)/cogl-pixel-buffer-private.h \ + $(srcdir)/cogl-pixel-buffer.c \ + $(srcdir)/cogl-index-buffer-private.h \ + $(srcdir)/cogl-index-buffer.c \ + $(srcdir)/cogl-attribute-buffer-private.h \ + $(srcdir)/cogl-attribute-buffer.c \ + $(srcdir)/cogl-indices-private.h $(srcdir)/cogl-indices.c \ + $(srcdir)/cogl-attribute-private.h $(srcdir)/cogl-attribute.c \ + $(srcdir)/cogl-primitive-private.h $(srcdir)/cogl-primitive.c \ + $(srcdir)/cogl-matrix.c $(srcdir)/cogl-vector.c \ + $(srcdir)/cogl-euler.c $(srcdir)/cogl-quaternion-private.h \ + $(srcdir)/cogl-quaternion.c $(srcdir)/cogl-matrix-private.h \ + $(srcdir)/cogl-matrix-stack.c \ + $(srcdir)/cogl-matrix-stack-private.h \ + $(srcdir)/cogl-depth-state.c \ + $(srcdir)/cogl-depth-state-private.h $(srcdir)/cogl-node.c \ + $(srcdir)/cogl-node-private.h $(srcdir)/cogl-pipeline.c \ + $(srcdir)/cogl-pipeline-private.h \ + $(srcdir)/cogl-pipeline-layer.c \ + $(srcdir)/cogl-pipeline-layer-private.h \ + $(srcdir)/cogl-pipeline-state.c \ + $(srcdir)/cogl-pipeline-layer-state-private.h \ + $(srcdir)/cogl-pipeline-layer-state.c \ + $(srcdir)/cogl-pipeline-state-private.h \ + $(srcdir)/cogl-pipeline-debug.c $(srcdir)/cogl-glsl-shader.c \ + $(srcdir)/cogl-glsl-shader-private.h \ + $(srcdir)/cogl-glsl-shader-boilerplate.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-pipeline-hash-table.h \ + $(srcdir)/cogl-pipeline-hash-table.c \ + $(srcdir)/cogl-sampler-cache.c \ + $(srcdir)/cogl-sampler-cache-private.h \ + $(srcdir)/cogl-blend-string.c $(srcdir)/cogl-blend-string.h \ + $(srcdir)/cogl-debug.c $(srcdir)/cogl-sub-texture-private.h \ + $(srcdir)/cogl-texture-private.h \ + $(srcdir)/cogl-texture-2d-private.h \ + $(srcdir)/cogl-texture-2d-sliced-private.h \ + $(srcdir)/cogl-texture-3d-private.h \ + $(srcdir)/cogl-texture-driver.h $(srcdir)/cogl-sub-texture.c \ + $(srcdir)/cogl-texture.c $(srcdir)/cogl-texture-2d.c \ + $(srcdir)/cogl-texture-2d-sliced.c $(srcdir)/cogl-texture-3d.c \ + $(srcdir)/cogl-texture-rectangle-private.h \ + $(srcdir)/cogl-texture-rectangle.c \ + $(srcdir)/cogl-rectangle-map.h $(srcdir)/cogl-rectangle-map.c \ + $(srcdir)/cogl-atlas.h $(srcdir)/cogl-atlas.c \ + $(srcdir)/cogl-atlas-texture-private.h \ + $(srcdir)/cogl-atlas-texture.c $(srcdir)/cogl-meta-texture.c \ + $(srcdir)/cogl-primitive-texture.c $(srcdir)/cogl-blit.h \ + $(srcdir)/cogl-blit.c $(srcdir)/cogl-spans.h \ + $(srcdir)/cogl-spans.c $(srcdir)/cogl-journal-private.h \ + $(srcdir)/cogl-journal.c $(srcdir)/cogl-frame-info-private.h \ + $(srcdir)/cogl-frame-info.c \ + $(srcdir)/cogl-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c $(srcdir)/cogl-output-private.h \ + $(srcdir)/cogl-output.c $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-gtype.c $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c $(srcdir)/cogl-list.c \ + $(srcdir)/cogl-list.h \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/winsys/cogl-winsys-stub.c \ + $(srcdir)/cogl-config-private.h $(srcdir)/cogl-config.c \ + $(srcdir)/cogl-boxed-value.h $(srcdir)/cogl-boxed-value.c \ + $(srcdir)/cogl-snippet-private.h $(srcdir)/cogl-snippet.c \ + $(srcdir)/cogl-poll-private.h $(srcdir)/cogl-poll.c \ + $(srcdir)/gl-prototypes/cogl-all-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles1-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles1-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-fixed-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ + $(srcdir)/cogl-memory-stack-private.h \ + $(srcdir)/cogl-memory-stack.c \ + $(srcdir)/cogl-magazine-private.h $(srcdir)/cogl-magazine.c \ + $(srcdir)/cogl-gles2-context-private.h \ + $(srcdir)/cogl-gles2-context.c $(srcdir)/cogl-error-private.h \ + $(srcdir)/cogl-error.c $(srcdir)/cogl-closure-list-private.h \ + $(srcdir)/cogl-closure-list.c $(srcdir)/cogl-fence.c \ + $(srcdir)/cogl-fence-private.h \ + $(srcdir)/deprecated/cogl-clip-state.c \ + $(srcdir)/deprecated/cogl-fixed.c \ + $(srcdir)/deprecated/cogl-vertex-buffer-private.h \ + $(srcdir)/deprecated/cogl-vertex-buffer.c \ + $(srcdir)/deprecated/cogl-material-compat.c \ + $(srcdir)/deprecated/cogl-program.c \ + $(srcdir)/deprecated/cogl-program-private.h \ + $(srcdir)/deprecated/cogl-auto-texture.c \ + $(srcdir)/deprecated/cogl-shader-private.h \ + $(srcdir)/deprecated/cogl-shader.c \ + $(srcdir)/deprecated/cogl-clutter.c \ + $(srcdir)/deprecated/cogl-framebuffer-deprecated.c \ + $(srcdir)/deprecated/cogl-texture-deprecated.c $(NULL) \ + $(am__append_5) $(am__append_9) $(am__append_11) \ + $(am__append_13) $(am__append_16) $(am__append_18) \ + $(am__append_19) $(am__append_20) $(am__append_21) \ + $(am__append_22) $(am__append_25) $(am__append_27) \ + $(am__append_29) + +# glib-mkenums rules +glib_enum_h = cogl-enum-types.h +glib_enum_c = cogl-enum-types.c +glib_enum_headers = $(cogl_1_public_h) +enum_tmpl_h = $(addprefix $(srcdir)/, $(glib_enum_h:.h=.h.in)) +enum_tmpl_c = $(addprefix $(srcdir)/, $(glib_enum_c:.c=.c.in)) +libcogl_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) \ + $(am__append_30) $(am__append_31) +# XXX: The aim is to eventually get rid of all private API exports +# for cogl-pango. +libcogl_la_LDFLAGS = \ + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ + -export-dynamic \ + -export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_get_format|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|_cogl_primitive_draw|test_|unit_test_).*" + +libcogl_la_SOURCES = $(cogl_sources_c) +nodist_libcogl_la_SOURCES = $(BUILT_SOURCES) + +# Cogl installed headers +cogl_headers = \ + $(cogl_1_public_h) \ + $(srcdir)/cogl-deprecated.h \ + $(srcdir)/cogl-pango.h \ + $(NULL) + +cogldeprecatedincludedir = $(includedir)/cogl/cogl/deprecated +cogldeprecatedinclude_HEADERS = $(cogl_deprecated_h) +coglincludedir = $(includedir)/cogl/cogl +coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h) +nodist_coglinclude_HEADERS = $(cogl_nodist_experimental_h) cogl-defines.h cogl-enum-types.h +cogl_proto_includedir = $(includedir)/cogl/cogl/gl-prototypes +cogl_proto_include_HEADERS = $(cogl_gl_prototypes_h) +INTROSPECTION_GIRS = $(am__append_34) +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_NAMESPACE = Cogl +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_VERSION = 1.0 +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_LIBS = libcogl.la \ +@HAVE_INTROSPECTION_TRUE@ $(am__append_32) +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_FILES = $(cogl_1_public_h) cogl-enum-types.h +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_NAMESPACE = Cogl +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_VERSION = 2.0 +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_LIBS = libcogl.la \ +@HAVE_INTROSPECTION_TRUE@ $(am__append_33) +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_FILES = $(cogl_experimental_h) $(cogl_additional_experimental_h) cogl-enum-types.h +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -D__COGL_EGL_H_INSIDE__ -D__COGL_GLX_H_INSIDE__ -DCOGL_GIR_SCANNING +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_INCLUDES = GL-1.0 GObject-2.0 +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_EXPORT_PACKAGES = cogl-1.0 +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -DCOGL_ENABLE_EXPERIMENTAL_API=1 -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -DCOGL_GIR_SCANNING +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_INCLUDES = GL-1.0 GObject-2.0 +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_EXPORT_PACKAGES = cogl-2.0-experimental +@HAVE_INTROSPECTION_TRUE@Cogl_2_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' --symbol-prefix=cogl --symbol-prefix=cogl2 +@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 +@HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) +@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 +@HAVE_INTROSPECTION_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(top_srcdir)/build/autotools/Makefile.am.enums $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cogl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign cogl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent $(top_srcdir)/build/autotools/Makefile.am.enums: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-1.0.pc: $(top_builddir)/config.status $(srcdir)/cogl-1.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-2.0-experimental.pc: $(top_builddir)/config.status $(srcdir)/cogl-2.0-experimental.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-defines.h: $(top_builddir)/config.status $(srcdir)/cogl-defines.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-defines.h.win32: $(top_builddir)/config.status $(srcdir)/cogl-defines.h.win32.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-defines.h.win32_SDL: $(top_builddir)/config.status $(srcdir)/cogl-defines.h.win32_SDL.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-gl-header.h: $(top_builddir)/config.status $(srcdir)/cogl-gl-header.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl-egl-defines.h: $(top_builddir)/config.status $(srcdir)/cogl-egl-defines.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +cogl.rc: $(top_builddir)/config.status $(srcdir)/cogl.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcogl.la: $(libcogl_la_OBJECTS) $(libcogl_la_DEPENDENCIES) $(EXTRA_libcogl_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcogl_la_LINK) -rpath $(libdir) $(libcogl_la_OBJECTS) $(libcogl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-atlas-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-atlas.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-attribute-buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-attribute-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-attribute-nop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-attribute.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-auto-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-bitmap-conversion.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-bitmap-pixbuf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-bitmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-bitmask.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-blend-string.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-blit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-boxed-value.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-buffer-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-clip-stack-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-clip-stack-nop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-clip-stack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-clip-state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-closure-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-clutter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-color.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-config.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-depth-state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-display.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-driver-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-driver-gles.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-driver-nop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-enum-types.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-euler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-feature-private.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-fence.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-frame-info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-framebuffer-deprecated.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-framebuffer-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-framebuffer-nop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-framebuffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gles2-context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-glib-source.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-glsl-shader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gpu-info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gtype.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-index-buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-indices.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-journal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-magazine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-material-compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-matrix-stack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-matrix.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-memory-stack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-meta-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-node.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-object.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-onscreen-template.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-onscreen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-output.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-fragend-arbfp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-fragend-fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-fragend-glsl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-hash-table.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-layer-state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-layer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-opengl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-progend-fixed-arbfp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-progend-fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-progend-glsl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-snippet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-vertend-fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline-vertend-glsl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pipeline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-pixel-buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-point-in-poly.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-poll.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-primitive-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-primitive.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-primitives.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-profile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-program.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-quaternion.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-rectangle-map.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-renderer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-sampler-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-sdl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-shader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-snippet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-spans.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-sub-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-swap-chain.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-2d-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-2d-nop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-2d-sliced.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-2d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-3d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-deprecated.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-driver-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-driver-gles.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-pixmap-x11.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture-rectangle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-texture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-util-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-vector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-vertex-buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-win32-renderer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-android.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-gdl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-kms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-null.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-wayland.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl-x11.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-egl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-glx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-sdl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-sdl2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-stub.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys-wgl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-winsys.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-xlib-renderer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-xlib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +cogl-driver-nop.lo: $(srcdir)/driver/nop/cogl-driver-nop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-driver-nop.lo -MD -MP -MF $(DEPDIR)/cogl-driver-nop.Tpo -c -o cogl-driver-nop.lo `test -f '$(srcdir)/driver/nop/cogl-driver-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-driver-nop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-driver-nop.Tpo $(DEPDIR)/cogl-driver-nop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/nop/cogl-driver-nop.c' object='cogl-driver-nop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-driver-nop.lo `test -f '$(srcdir)/driver/nop/cogl-driver-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-driver-nop.c + +cogl-framebuffer-nop.lo: $(srcdir)/driver/nop/cogl-framebuffer-nop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-framebuffer-nop.lo -MD -MP -MF $(DEPDIR)/cogl-framebuffer-nop.Tpo -c -o cogl-framebuffer-nop.lo `test -f '$(srcdir)/driver/nop/cogl-framebuffer-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-framebuffer-nop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-framebuffer-nop.Tpo $(DEPDIR)/cogl-framebuffer-nop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/nop/cogl-framebuffer-nop.c' object='cogl-framebuffer-nop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-framebuffer-nop.lo `test -f '$(srcdir)/driver/nop/cogl-framebuffer-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-framebuffer-nop.c + +cogl-attribute-nop.lo: $(srcdir)/driver/nop/cogl-attribute-nop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-attribute-nop.lo -MD -MP -MF $(DEPDIR)/cogl-attribute-nop.Tpo -c -o cogl-attribute-nop.lo `test -f '$(srcdir)/driver/nop/cogl-attribute-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-attribute-nop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-attribute-nop.Tpo $(DEPDIR)/cogl-attribute-nop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/nop/cogl-attribute-nop.c' object='cogl-attribute-nop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-attribute-nop.lo `test -f '$(srcdir)/driver/nop/cogl-attribute-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-attribute-nop.c + +cogl-clip-stack-nop.lo: $(srcdir)/driver/nop/cogl-clip-stack-nop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-clip-stack-nop.lo -MD -MP -MF $(DEPDIR)/cogl-clip-stack-nop.Tpo -c -o cogl-clip-stack-nop.lo `test -f '$(srcdir)/driver/nop/cogl-clip-stack-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-clip-stack-nop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clip-stack-nop.Tpo $(DEPDIR)/cogl-clip-stack-nop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/nop/cogl-clip-stack-nop.c' object='cogl-clip-stack-nop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-clip-stack-nop.lo `test -f '$(srcdir)/driver/nop/cogl-clip-stack-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-clip-stack-nop.c + +cogl-texture-2d-nop.lo: $(srcdir)/driver/nop/cogl-texture-2d-nop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-2d-nop.lo -MD -MP -MF $(DEPDIR)/cogl-texture-2d-nop.Tpo -c -o cogl-texture-2d-nop.lo `test -f '$(srcdir)/driver/nop/cogl-texture-2d-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-texture-2d-nop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-2d-nop.Tpo $(DEPDIR)/cogl-texture-2d-nop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/nop/cogl-texture-2d-nop.c' object='cogl-texture-2d-nop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-2d-nop.lo `test -f '$(srcdir)/driver/nop/cogl-texture-2d-nop.c' || echo '$(srcdir)/'`$(srcdir)/driver/nop/cogl-texture-2d-nop.c + +cogl-util-gl.lo: $(srcdir)/driver/gl/cogl-util-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-util-gl.lo -MD -MP -MF $(DEPDIR)/cogl-util-gl.Tpo -c -o cogl-util-gl.lo `test -f '$(srcdir)/driver/gl/cogl-util-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-util-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-util-gl.Tpo $(DEPDIR)/cogl-util-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-util-gl.c' object='cogl-util-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-util-gl.lo `test -f '$(srcdir)/driver/gl/cogl-util-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-util-gl.c + +cogl-framebuffer-gl.lo: $(srcdir)/driver/gl/cogl-framebuffer-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-framebuffer-gl.lo -MD -MP -MF $(DEPDIR)/cogl-framebuffer-gl.Tpo -c -o cogl-framebuffer-gl.lo `test -f '$(srcdir)/driver/gl/cogl-framebuffer-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-framebuffer-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-framebuffer-gl.Tpo $(DEPDIR)/cogl-framebuffer-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-framebuffer-gl.c' object='cogl-framebuffer-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-framebuffer-gl.lo `test -f '$(srcdir)/driver/gl/cogl-framebuffer-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-framebuffer-gl.c + +cogl-texture-gl.lo: $(srcdir)/driver/gl/cogl-texture-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-gl.lo -MD -MP -MF $(DEPDIR)/cogl-texture-gl.Tpo -c -o cogl-texture-gl.lo `test -f '$(srcdir)/driver/gl/cogl-texture-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-texture-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-gl.Tpo $(DEPDIR)/cogl-texture-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-texture-gl.c' object='cogl-texture-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-gl.lo `test -f '$(srcdir)/driver/gl/cogl-texture-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-texture-gl.c + +cogl-texture-2d-gl.lo: $(srcdir)/driver/gl/cogl-texture-2d-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-2d-gl.lo -MD -MP -MF $(DEPDIR)/cogl-texture-2d-gl.Tpo -c -o cogl-texture-2d-gl.lo `test -f '$(srcdir)/driver/gl/cogl-texture-2d-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-texture-2d-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-2d-gl.Tpo $(DEPDIR)/cogl-texture-2d-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-texture-2d-gl.c' object='cogl-texture-2d-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-2d-gl.lo `test -f '$(srcdir)/driver/gl/cogl-texture-2d-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-texture-2d-gl.c + +cogl-attribute-gl.lo: $(srcdir)/driver/gl/cogl-attribute-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-attribute-gl.lo -MD -MP -MF $(DEPDIR)/cogl-attribute-gl.Tpo -c -o cogl-attribute-gl.lo `test -f '$(srcdir)/driver/gl/cogl-attribute-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-attribute-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-attribute-gl.Tpo $(DEPDIR)/cogl-attribute-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-attribute-gl.c' object='cogl-attribute-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-attribute-gl.lo `test -f '$(srcdir)/driver/gl/cogl-attribute-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-attribute-gl.c + +cogl-clip-stack-gl.lo: $(srcdir)/driver/gl/cogl-clip-stack-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-clip-stack-gl.lo -MD -MP -MF $(DEPDIR)/cogl-clip-stack-gl.Tpo -c -o cogl-clip-stack-gl.lo `test -f '$(srcdir)/driver/gl/cogl-clip-stack-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-clip-stack-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clip-stack-gl.Tpo $(DEPDIR)/cogl-clip-stack-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-clip-stack-gl.c' object='cogl-clip-stack-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-clip-stack-gl.lo `test -f '$(srcdir)/driver/gl/cogl-clip-stack-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-clip-stack-gl.c + +cogl-buffer-gl.lo: $(srcdir)/driver/gl/cogl-buffer-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-buffer-gl.lo -MD -MP -MF $(DEPDIR)/cogl-buffer-gl.Tpo -c -o cogl-buffer-gl.lo `test -f '$(srcdir)/driver/gl/cogl-buffer-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-buffer-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-buffer-gl.Tpo $(DEPDIR)/cogl-buffer-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-buffer-gl.c' object='cogl-buffer-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-buffer-gl.lo `test -f '$(srcdir)/driver/gl/cogl-buffer-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-buffer-gl.c + +cogl-pipeline-opengl.lo: $(srcdir)/driver/gl/cogl-pipeline-opengl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-opengl.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-opengl.Tpo -c -o cogl-pipeline-opengl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-opengl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-opengl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-opengl.Tpo $(DEPDIR)/cogl-pipeline-opengl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-opengl.c' object='cogl-pipeline-opengl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-opengl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-opengl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-opengl.c + +cogl-pipeline-fragend-glsl.lo: $(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-fragend-glsl.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-fragend-glsl.Tpo -c -o cogl-pipeline-fragend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-fragend-glsl.Tpo $(DEPDIR)/cogl-pipeline-fragend-glsl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c' object='cogl-pipeline-fragend-glsl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-fragend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-fragend-glsl.c + +cogl-pipeline-fragend-arbfp.lo: $(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-fragend-arbfp.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-fragend-arbfp.Tpo -c -o cogl-pipeline-fragend-arbfp.lo `test -f '$(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-fragend-arbfp.Tpo $(DEPDIR)/cogl-pipeline-fragend-arbfp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c' object='cogl-pipeline-fragend-arbfp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-fragend-arbfp.lo `test -f '$(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-pipeline-fragend-arbfp.c + +cogl-pipeline-progend-fixed-arbfp.lo: $(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-progend-fixed-arbfp.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-progend-fixed-arbfp.Tpo -c -o cogl-pipeline-progend-fixed-arbfp.lo `test -f '$(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-progend-fixed-arbfp.Tpo $(DEPDIR)/cogl-pipeline-progend-fixed-arbfp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c' object='cogl-pipeline-progend-fixed-arbfp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-progend-fixed-arbfp.lo `test -f '$(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c + +cogl-pipeline-fragend-fixed.lo: $(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-fragend-fixed.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-fragend-fixed.Tpo -c -o cogl-pipeline-fragend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-fragend-fixed.Tpo $(DEPDIR)/cogl-pipeline-fragend-fixed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c' object='cogl-pipeline-fragend-fixed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-fragend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-fragend-fixed.c + +cogl-pipeline-vertend-glsl.lo: $(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-vertend-glsl.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-vertend-glsl.Tpo -c -o cogl-pipeline-vertend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-vertend-glsl.Tpo $(DEPDIR)/cogl-pipeline-vertend-glsl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c' object='cogl-pipeline-vertend-glsl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-vertend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-vertend-glsl.c + +cogl-pipeline-vertend-fixed.lo: $(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-vertend-fixed.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-vertend-fixed.Tpo -c -o cogl-pipeline-vertend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-vertend-fixed.Tpo $(DEPDIR)/cogl-pipeline-vertend-fixed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c' object='cogl-pipeline-vertend-fixed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-vertend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-vertend-fixed.c + +cogl-pipeline-progend-fixed.lo: $(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-progend-fixed.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-progend-fixed.Tpo -c -o cogl-pipeline-progend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-progend-fixed.Tpo $(DEPDIR)/cogl-pipeline-progend-fixed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c' object='cogl-pipeline-progend-fixed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-progend-fixed.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-progend-fixed.c + +cogl-pipeline-progend-glsl.lo: $(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-progend-glsl.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-progend-glsl.Tpo -c -o cogl-pipeline-progend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-progend-glsl.Tpo $(DEPDIR)/cogl-pipeline-progend-glsl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c' object='cogl-pipeline-progend-glsl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-progend-glsl.lo `test -f '$(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-pipeline-progend-glsl.c + +cogl-driver-gl.lo: $(srcdir)/driver/gl/gl/cogl-driver-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-driver-gl.lo -MD -MP -MF $(DEPDIR)/cogl-driver-gl.Tpo -c -o cogl-driver-gl.lo `test -f '$(srcdir)/driver/gl/gl/cogl-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-driver-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-driver-gl.Tpo $(DEPDIR)/cogl-driver-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gl/cogl-driver-gl.c' object='cogl-driver-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-driver-gl.lo `test -f '$(srcdir)/driver/gl/gl/cogl-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-driver-gl.c + +cogl-texture-driver-gl.lo: $(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-driver-gl.lo -MD -MP -MF $(DEPDIR)/cogl-texture-driver-gl.Tpo -c -o cogl-texture-driver-gl.lo `test -f '$(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-driver-gl.Tpo $(DEPDIR)/cogl-texture-driver-gl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c' object='cogl-texture-driver-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-driver-gl.lo `test -f '$(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gl/cogl-texture-driver-gl.c + +cogl-driver-gles.lo: $(srcdir)/driver/gl/gles/cogl-driver-gles.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-driver-gles.lo -MD -MP -MF $(DEPDIR)/cogl-driver-gles.Tpo -c -o cogl-driver-gles.lo `test -f '$(srcdir)/driver/gl/gles/cogl-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gles/cogl-driver-gles.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-driver-gles.Tpo $(DEPDIR)/cogl-driver-gles.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gles/cogl-driver-gles.c' object='cogl-driver-gles.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-driver-gles.lo `test -f '$(srcdir)/driver/gl/gles/cogl-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gles/cogl-driver-gles.c + +cogl-texture-driver-gles.lo: $(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-driver-gles.lo -MD -MP -MF $(DEPDIR)/cogl-texture-driver-gles.Tpo -c -o cogl-texture-driver-gles.lo `test -f '$(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-driver-gles.Tpo $(DEPDIR)/cogl-texture-driver-gles.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c' object='cogl-texture-driver-gles.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-driver-gles.lo `test -f '$(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/gles/cogl-texture-driver-gles.c + +cogl-winsys.lo: $(srcdir)/winsys/cogl-winsys.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys.lo -MD -MP -MF $(DEPDIR)/cogl-winsys.Tpo -c -o cogl-winsys.lo `test -f '$(srcdir)/winsys/cogl-winsys.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys.Tpo $(DEPDIR)/cogl-winsys.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys.c' object='cogl-winsys.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys.lo `test -f '$(srcdir)/winsys/cogl-winsys.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys.c + +cogl-gpu-info.lo: $(srcdir)/cogl-gpu-info.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-gpu-info.lo -MD -MP -MF $(DEPDIR)/cogl-gpu-info.Tpo -c -o cogl-gpu-info.lo `test -f '$(srcdir)/cogl-gpu-info.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gpu-info.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-gpu-info.Tpo $(DEPDIR)/cogl-gpu-info.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-gpu-info.c' object='cogl-gpu-info.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-gpu-info.lo `test -f '$(srcdir)/cogl-gpu-info.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gpu-info.c + +cogl-context.lo: $(srcdir)/cogl-context.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-context.lo -MD -MP -MF $(DEPDIR)/cogl-context.Tpo -c -o cogl-context.lo `test -f '$(srcdir)/cogl-context.c' || echo '$(srcdir)/'`$(srcdir)/cogl-context.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-context.Tpo $(DEPDIR)/cogl-context.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-context.c' object='cogl-context.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-context.lo `test -f '$(srcdir)/cogl-context.c' || echo '$(srcdir)/'`$(srcdir)/cogl-context.c + +cogl-renderer.lo: $(srcdir)/cogl-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-renderer.lo -MD -MP -MF $(DEPDIR)/cogl-renderer.Tpo -c -o cogl-renderer.lo `test -f '$(srcdir)/cogl-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-renderer.Tpo $(DEPDIR)/cogl-renderer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-renderer.c' object='cogl-renderer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-renderer.lo `test -f '$(srcdir)/cogl-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-renderer.c + +cogl-swap-chain.lo: $(srcdir)/cogl-swap-chain.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-swap-chain.lo -MD -MP -MF $(DEPDIR)/cogl-swap-chain.Tpo -c -o cogl-swap-chain.lo `test -f '$(srcdir)/cogl-swap-chain.c' || echo '$(srcdir)/'`$(srcdir)/cogl-swap-chain.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-swap-chain.Tpo $(DEPDIR)/cogl-swap-chain.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-swap-chain.c' object='cogl-swap-chain.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-swap-chain.lo `test -f '$(srcdir)/cogl-swap-chain.c' || echo '$(srcdir)/'`$(srcdir)/cogl-swap-chain.c + +cogl-onscreen-template.lo: $(srcdir)/cogl-onscreen-template.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-onscreen-template.lo -MD -MP -MF $(DEPDIR)/cogl-onscreen-template.Tpo -c -o cogl-onscreen-template.lo `test -f '$(srcdir)/cogl-onscreen-template.c' || echo '$(srcdir)/'`$(srcdir)/cogl-onscreen-template.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-onscreen-template.Tpo $(DEPDIR)/cogl-onscreen-template.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-onscreen-template.c' object='cogl-onscreen-template.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-onscreen-template.lo `test -f '$(srcdir)/cogl-onscreen-template.c' || echo '$(srcdir)/'`$(srcdir)/cogl-onscreen-template.c + +cogl-display.lo: $(srcdir)/cogl-display.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-display.lo -MD -MP -MF $(DEPDIR)/cogl-display.Tpo -c -o cogl-display.lo `test -f '$(srcdir)/cogl-display.c' || echo '$(srcdir)/'`$(srcdir)/cogl-display.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-display.Tpo $(DEPDIR)/cogl-display.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-display.c' object='cogl-display.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-display.lo `test -f '$(srcdir)/cogl-display.c' || echo '$(srcdir)/'`$(srcdir)/cogl-display.c + +cogl.lo: $(srcdir)/cogl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl.lo -MD -MP -MF $(DEPDIR)/cogl.Tpo -c -o cogl.lo `test -f '$(srcdir)/cogl.c' || echo '$(srcdir)/'`$(srcdir)/cogl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl.Tpo $(DEPDIR)/cogl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl.c' object='cogl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl.lo `test -f '$(srcdir)/cogl.c' || echo '$(srcdir)/'`$(srcdir)/cogl.c + +cogl-object.lo: $(srcdir)/cogl-object.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-object.lo -MD -MP -MF $(DEPDIR)/cogl-object.Tpo -c -o cogl-object.lo `test -f '$(srcdir)/cogl-object.c' || echo '$(srcdir)/'`$(srcdir)/cogl-object.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-object.Tpo $(DEPDIR)/cogl-object.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-object.c' object='cogl-object.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-object.lo `test -f '$(srcdir)/cogl-object.c' || echo '$(srcdir)/'`$(srcdir)/cogl-object.c + +cogl-util.lo: $(srcdir)/cogl-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-util.lo -MD -MP -MF $(DEPDIR)/cogl-util.Tpo -c -o cogl-util.lo `test -f '$(srcdir)/cogl-util.c' || echo '$(srcdir)/'`$(srcdir)/cogl-util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-util.Tpo $(DEPDIR)/cogl-util.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-util.c' object='cogl-util.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-util.lo `test -f '$(srcdir)/cogl-util.c' || echo '$(srcdir)/'`$(srcdir)/cogl-util.c + +cogl-bitmap.lo: $(srcdir)/cogl-bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-bitmap.lo -MD -MP -MF $(DEPDIR)/cogl-bitmap.Tpo -c -o cogl-bitmap.lo `test -f '$(srcdir)/cogl-bitmap.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-bitmap.Tpo $(DEPDIR)/cogl-bitmap.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-bitmap.c' object='cogl-bitmap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-bitmap.lo `test -f '$(srcdir)/cogl-bitmap.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap.c + +cogl-bitmap-conversion.lo: $(srcdir)/cogl-bitmap-conversion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-bitmap-conversion.lo -MD -MP -MF $(DEPDIR)/cogl-bitmap-conversion.Tpo -c -o cogl-bitmap-conversion.lo `test -f '$(srcdir)/cogl-bitmap-conversion.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap-conversion.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-bitmap-conversion.Tpo $(DEPDIR)/cogl-bitmap-conversion.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-bitmap-conversion.c' object='cogl-bitmap-conversion.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-bitmap-conversion.lo `test -f '$(srcdir)/cogl-bitmap-conversion.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap-conversion.c + +cogl-primitives.lo: $(srcdir)/cogl-primitives.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-primitives.lo -MD -MP -MF $(DEPDIR)/cogl-primitives.Tpo -c -o cogl-primitives.lo `test -f '$(srcdir)/cogl-primitives.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitives.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-primitives.Tpo $(DEPDIR)/cogl-primitives.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-primitives.c' object='cogl-primitives.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-primitives.lo `test -f '$(srcdir)/cogl-primitives.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitives.c + +cogl-bitmap-pixbuf.lo: $(srcdir)/cogl-bitmap-pixbuf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-bitmap-pixbuf.lo -MD -MP -MF $(DEPDIR)/cogl-bitmap-pixbuf.Tpo -c -o cogl-bitmap-pixbuf.lo `test -f '$(srcdir)/cogl-bitmap-pixbuf.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap-pixbuf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-bitmap-pixbuf.Tpo $(DEPDIR)/cogl-bitmap-pixbuf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-bitmap-pixbuf.c' object='cogl-bitmap-pixbuf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-bitmap-pixbuf.lo `test -f '$(srcdir)/cogl-bitmap-pixbuf.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmap-pixbuf.c + +cogl-clip-stack.lo: $(srcdir)/cogl-clip-stack.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-clip-stack.lo -MD -MP -MF $(DEPDIR)/cogl-clip-stack.Tpo -c -o cogl-clip-stack.lo `test -f '$(srcdir)/cogl-clip-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clip-stack.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clip-stack.Tpo $(DEPDIR)/cogl-clip-stack.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-clip-stack.c' object='cogl-clip-stack.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-clip-stack.lo `test -f '$(srcdir)/cogl-clip-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clip-stack.c + +cogl-feature-private.lo: $(srcdir)/cogl-feature-private.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-feature-private.lo -MD -MP -MF $(DEPDIR)/cogl-feature-private.Tpo -c -o cogl-feature-private.lo `test -f '$(srcdir)/cogl-feature-private.c' || echo '$(srcdir)/'`$(srcdir)/cogl-feature-private.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-feature-private.Tpo $(DEPDIR)/cogl-feature-private.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-feature-private.c' object='cogl-feature-private.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-feature-private.lo `test -f '$(srcdir)/cogl-feature-private.c' || echo '$(srcdir)/'`$(srcdir)/cogl-feature-private.c + +cogl-color.lo: $(srcdir)/cogl-color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-color.lo -MD -MP -MF $(DEPDIR)/cogl-color.Tpo -c -o cogl-color.lo `test -f '$(srcdir)/cogl-color.c' || echo '$(srcdir)/'`$(srcdir)/cogl-color.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-color.Tpo $(DEPDIR)/cogl-color.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-color.c' object='cogl-color.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-color.lo `test -f '$(srcdir)/cogl-color.c' || echo '$(srcdir)/'`$(srcdir)/cogl-color.c + +cogl-buffer.lo: $(srcdir)/cogl-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-buffer.lo -MD -MP -MF $(DEPDIR)/cogl-buffer.Tpo -c -o cogl-buffer.lo `test -f '$(srcdir)/cogl-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-buffer.Tpo $(DEPDIR)/cogl-buffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-buffer.c' object='cogl-buffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-buffer.lo `test -f '$(srcdir)/cogl-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-buffer.c + +cogl-pixel-buffer.lo: $(srcdir)/cogl-pixel-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pixel-buffer.lo -MD -MP -MF $(DEPDIR)/cogl-pixel-buffer.Tpo -c -o cogl-pixel-buffer.lo `test -f '$(srcdir)/cogl-pixel-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pixel-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pixel-buffer.Tpo $(DEPDIR)/cogl-pixel-buffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pixel-buffer.c' object='cogl-pixel-buffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pixel-buffer.lo `test -f '$(srcdir)/cogl-pixel-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pixel-buffer.c + +cogl-index-buffer.lo: $(srcdir)/cogl-index-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-index-buffer.lo -MD -MP -MF $(DEPDIR)/cogl-index-buffer.Tpo -c -o cogl-index-buffer.lo `test -f '$(srcdir)/cogl-index-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-index-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-index-buffer.Tpo $(DEPDIR)/cogl-index-buffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-index-buffer.c' object='cogl-index-buffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-index-buffer.lo `test -f '$(srcdir)/cogl-index-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-index-buffer.c + +cogl-attribute-buffer.lo: $(srcdir)/cogl-attribute-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-attribute-buffer.lo -MD -MP -MF $(DEPDIR)/cogl-attribute-buffer.Tpo -c -o cogl-attribute-buffer.lo `test -f '$(srcdir)/cogl-attribute-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-attribute-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-attribute-buffer.Tpo $(DEPDIR)/cogl-attribute-buffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-attribute-buffer.c' object='cogl-attribute-buffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-attribute-buffer.lo `test -f '$(srcdir)/cogl-attribute-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-attribute-buffer.c + +cogl-indices.lo: $(srcdir)/cogl-indices.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-indices.lo -MD -MP -MF $(DEPDIR)/cogl-indices.Tpo -c -o cogl-indices.lo `test -f '$(srcdir)/cogl-indices.c' || echo '$(srcdir)/'`$(srcdir)/cogl-indices.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-indices.Tpo $(DEPDIR)/cogl-indices.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-indices.c' object='cogl-indices.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-indices.lo `test -f '$(srcdir)/cogl-indices.c' || echo '$(srcdir)/'`$(srcdir)/cogl-indices.c + +cogl-attribute.lo: $(srcdir)/cogl-attribute.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-attribute.lo -MD -MP -MF $(DEPDIR)/cogl-attribute.Tpo -c -o cogl-attribute.lo `test -f '$(srcdir)/cogl-attribute.c' || echo '$(srcdir)/'`$(srcdir)/cogl-attribute.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-attribute.Tpo $(DEPDIR)/cogl-attribute.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-attribute.c' object='cogl-attribute.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-attribute.lo `test -f '$(srcdir)/cogl-attribute.c' || echo '$(srcdir)/'`$(srcdir)/cogl-attribute.c + +cogl-primitive.lo: $(srcdir)/cogl-primitive.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-primitive.lo -MD -MP -MF $(DEPDIR)/cogl-primitive.Tpo -c -o cogl-primitive.lo `test -f '$(srcdir)/cogl-primitive.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitive.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-primitive.Tpo $(DEPDIR)/cogl-primitive.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-primitive.c' object='cogl-primitive.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-primitive.lo `test -f '$(srcdir)/cogl-primitive.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitive.c + +cogl-matrix.lo: $(srcdir)/cogl-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-matrix.lo -MD -MP -MF $(DEPDIR)/cogl-matrix.Tpo -c -o cogl-matrix.lo `test -f '$(srcdir)/cogl-matrix.c' || echo '$(srcdir)/'`$(srcdir)/cogl-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-matrix.Tpo $(DEPDIR)/cogl-matrix.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-matrix.c' object='cogl-matrix.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-matrix.lo `test -f '$(srcdir)/cogl-matrix.c' || echo '$(srcdir)/'`$(srcdir)/cogl-matrix.c + +cogl-vector.lo: $(srcdir)/cogl-vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-vector.lo -MD -MP -MF $(DEPDIR)/cogl-vector.Tpo -c -o cogl-vector.lo `test -f '$(srcdir)/cogl-vector.c' || echo '$(srcdir)/'`$(srcdir)/cogl-vector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-vector.Tpo $(DEPDIR)/cogl-vector.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-vector.c' object='cogl-vector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-vector.lo `test -f '$(srcdir)/cogl-vector.c' || echo '$(srcdir)/'`$(srcdir)/cogl-vector.c + +cogl-euler.lo: $(srcdir)/cogl-euler.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-euler.lo -MD -MP -MF $(DEPDIR)/cogl-euler.Tpo -c -o cogl-euler.lo `test -f '$(srcdir)/cogl-euler.c' || echo '$(srcdir)/'`$(srcdir)/cogl-euler.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-euler.Tpo $(DEPDIR)/cogl-euler.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-euler.c' object='cogl-euler.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-euler.lo `test -f '$(srcdir)/cogl-euler.c' || echo '$(srcdir)/'`$(srcdir)/cogl-euler.c + +cogl-quaternion.lo: $(srcdir)/cogl-quaternion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-quaternion.lo -MD -MP -MF $(DEPDIR)/cogl-quaternion.Tpo -c -o cogl-quaternion.lo `test -f '$(srcdir)/cogl-quaternion.c' || echo '$(srcdir)/'`$(srcdir)/cogl-quaternion.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-quaternion.Tpo $(DEPDIR)/cogl-quaternion.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-quaternion.c' object='cogl-quaternion.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-quaternion.lo `test -f '$(srcdir)/cogl-quaternion.c' || echo '$(srcdir)/'`$(srcdir)/cogl-quaternion.c + +cogl-matrix-stack.lo: $(srcdir)/cogl-matrix-stack.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-matrix-stack.lo -MD -MP -MF $(DEPDIR)/cogl-matrix-stack.Tpo -c -o cogl-matrix-stack.lo `test -f '$(srcdir)/cogl-matrix-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-matrix-stack.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-matrix-stack.Tpo $(DEPDIR)/cogl-matrix-stack.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-matrix-stack.c' object='cogl-matrix-stack.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-matrix-stack.lo `test -f '$(srcdir)/cogl-matrix-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-matrix-stack.c + +cogl-depth-state.lo: $(srcdir)/cogl-depth-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-depth-state.lo -MD -MP -MF $(DEPDIR)/cogl-depth-state.Tpo -c -o cogl-depth-state.lo `test -f '$(srcdir)/cogl-depth-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-depth-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-depth-state.Tpo $(DEPDIR)/cogl-depth-state.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-depth-state.c' object='cogl-depth-state.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-depth-state.lo `test -f '$(srcdir)/cogl-depth-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-depth-state.c + +cogl-node.lo: $(srcdir)/cogl-node.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-node.lo -MD -MP -MF $(DEPDIR)/cogl-node.Tpo -c -o cogl-node.lo `test -f '$(srcdir)/cogl-node.c' || echo '$(srcdir)/'`$(srcdir)/cogl-node.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-node.Tpo $(DEPDIR)/cogl-node.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-node.c' object='cogl-node.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-node.lo `test -f '$(srcdir)/cogl-node.c' || echo '$(srcdir)/'`$(srcdir)/cogl-node.c + +cogl-pipeline.lo: $(srcdir)/cogl-pipeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline.Tpo -c -o cogl-pipeline.lo `test -f '$(srcdir)/cogl-pipeline.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline.Tpo $(DEPDIR)/cogl-pipeline.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline.c' object='cogl-pipeline.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline.lo `test -f '$(srcdir)/cogl-pipeline.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline.c + +cogl-pipeline-layer.lo: $(srcdir)/cogl-pipeline-layer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-layer.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-layer.Tpo -c -o cogl-pipeline-layer.lo `test -f '$(srcdir)/cogl-pipeline-layer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-layer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-layer.Tpo $(DEPDIR)/cogl-pipeline-layer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-layer.c' object='cogl-pipeline-layer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-layer.lo `test -f '$(srcdir)/cogl-pipeline-layer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-layer.c + +cogl-pipeline-state.lo: $(srcdir)/cogl-pipeline-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-state.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-state.Tpo -c -o cogl-pipeline-state.lo `test -f '$(srcdir)/cogl-pipeline-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-state.Tpo $(DEPDIR)/cogl-pipeline-state.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-state.c' object='cogl-pipeline-state.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-state.lo `test -f '$(srcdir)/cogl-pipeline-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-state.c + +cogl-pipeline-layer-state.lo: $(srcdir)/cogl-pipeline-layer-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-layer-state.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-layer-state.Tpo -c -o cogl-pipeline-layer-state.lo `test -f '$(srcdir)/cogl-pipeline-layer-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-layer-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-layer-state.Tpo $(DEPDIR)/cogl-pipeline-layer-state.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-layer-state.c' object='cogl-pipeline-layer-state.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-layer-state.lo `test -f '$(srcdir)/cogl-pipeline-layer-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-layer-state.c + +cogl-pipeline-debug.lo: $(srcdir)/cogl-pipeline-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-debug.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-debug.Tpo -c -o cogl-pipeline-debug.lo `test -f '$(srcdir)/cogl-pipeline-debug.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-debug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-debug.Tpo $(DEPDIR)/cogl-pipeline-debug.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-debug.c' object='cogl-pipeline-debug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-debug.lo `test -f '$(srcdir)/cogl-pipeline-debug.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-debug.c + +cogl-glsl-shader.lo: $(srcdir)/cogl-glsl-shader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-glsl-shader.lo -MD -MP -MF $(DEPDIR)/cogl-glsl-shader.Tpo -c -o cogl-glsl-shader.lo `test -f '$(srcdir)/cogl-glsl-shader.c' || echo '$(srcdir)/'`$(srcdir)/cogl-glsl-shader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-glsl-shader.Tpo $(DEPDIR)/cogl-glsl-shader.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-glsl-shader.c' object='cogl-glsl-shader.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-glsl-shader.lo `test -f '$(srcdir)/cogl-glsl-shader.c' || echo '$(srcdir)/'`$(srcdir)/cogl-glsl-shader.c + +cogl-pipeline-snippet.lo: $(srcdir)/cogl-pipeline-snippet.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-snippet.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-snippet.Tpo -c -o cogl-pipeline-snippet.lo `test -f '$(srcdir)/cogl-pipeline-snippet.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-snippet.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-snippet.Tpo $(DEPDIR)/cogl-pipeline-snippet.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-snippet.c' object='cogl-pipeline-snippet.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-snippet.lo `test -f '$(srcdir)/cogl-pipeline-snippet.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-snippet.c + +cogl-pipeline-cache.lo: $(srcdir)/cogl-pipeline-cache.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-cache.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-cache.Tpo -c -o cogl-pipeline-cache.lo `test -f '$(srcdir)/cogl-pipeline-cache.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-cache.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-cache.Tpo $(DEPDIR)/cogl-pipeline-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-cache.c' object='cogl-pipeline-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-cache.lo `test -f '$(srcdir)/cogl-pipeline-cache.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-cache.c + +cogl-pipeline-hash-table.lo: $(srcdir)/cogl-pipeline-hash-table.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-pipeline-hash-table.lo -MD -MP -MF $(DEPDIR)/cogl-pipeline-hash-table.Tpo -c -o cogl-pipeline-hash-table.lo `test -f '$(srcdir)/cogl-pipeline-hash-table.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-hash-table.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-hash-table.Tpo $(DEPDIR)/cogl-pipeline-hash-table.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-pipeline-hash-table.c' object='cogl-pipeline-hash-table.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-pipeline-hash-table.lo `test -f '$(srcdir)/cogl-pipeline-hash-table.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-hash-table.c + +cogl-sampler-cache.lo: $(srcdir)/cogl-sampler-cache.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-sampler-cache.lo -MD -MP -MF $(DEPDIR)/cogl-sampler-cache.Tpo -c -o cogl-sampler-cache.lo `test -f '$(srcdir)/cogl-sampler-cache.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sampler-cache.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-sampler-cache.Tpo $(DEPDIR)/cogl-sampler-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-sampler-cache.c' object='cogl-sampler-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-sampler-cache.lo `test -f '$(srcdir)/cogl-sampler-cache.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sampler-cache.c + +cogl-blend-string.lo: $(srcdir)/cogl-blend-string.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-blend-string.lo -MD -MP -MF $(DEPDIR)/cogl-blend-string.Tpo -c -o cogl-blend-string.lo `test -f '$(srcdir)/cogl-blend-string.c' || echo '$(srcdir)/'`$(srcdir)/cogl-blend-string.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-blend-string.Tpo $(DEPDIR)/cogl-blend-string.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-blend-string.c' object='cogl-blend-string.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-blend-string.lo `test -f '$(srcdir)/cogl-blend-string.c' || echo '$(srcdir)/'`$(srcdir)/cogl-blend-string.c + +cogl-debug.lo: $(srcdir)/cogl-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-debug.lo -MD -MP -MF $(DEPDIR)/cogl-debug.Tpo -c -o cogl-debug.lo `test -f '$(srcdir)/cogl-debug.c' || echo '$(srcdir)/'`$(srcdir)/cogl-debug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-debug.Tpo $(DEPDIR)/cogl-debug.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-debug.c' object='cogl-debug.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-debug.lo `test -f '$(srcdir)/cogl-debug.c' || echo '$(srcdir)/'`$(srcdir)/cogl-debug.c + +cogl-sub-texture.lo: $(srcdir)/cogl-sub-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-sub-texture.lo -MD -MP -MF $(DEPDIR)/cogl-sub-texture.Tpo -c -o cogl-sub-texture.lo `test -f '$(srcdir)/cogl-sub-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sub-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-sub-texture.Tpo $(DEPDIR)/cogl-sub-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-sub-texture.c' object='cogl-sub-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-sub-texture.lo `test -f '$(srcdir)/cogl-sub-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sub-texture.c + +cogl-texture.lo: $(srcdir)/cogl-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture.lo -MD -MP -MF $(DEPDIR)/cogl-texture.Tpo -c -o cogl-texture.lo `test -f '$(srcdir)/cogl-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture.Tpo $(DEPDIR)/cogl-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-texture.c' object='cogl-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture.lo `test -f '$(srcdir)/cogl-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture.c + +cogl-texture-2d.lo: $(srcdir)/cogl-texture-2d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-2d.lo -MD -MP -MF $(DEPDIR)/cogl-texture-2d.Tpo -c -o cogl-texture-2d.lo `test -f '$(srcdir)/cogl-texture-2d.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-2d.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-2d.Tpo $(DEPDIR)/cogl-texture-2d.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-texture-2d.c' object='cogl-texture-2d.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-2d.lo `test -f '$(srcdir)/cogl-texture-2d.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-2d.c + +cogl-texture-2d-sliced.lo: $(srcdir)/cogl-texture-2d-sliced.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-2d-sliced.lo -MD -MP -MF $(DEPDIR)/cogl-texture-2d-sliced.Tpo -c -o cogl-texture-2d-sliced.lo `test -f '$(srcdir)/cogl-texture-2d-sliced.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-2d-sliced.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-2d-sliced.Tpo $(DEPDIR)/cogl-texture-2d-sliced.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-texture-2d-sliced.c' object='cogl-texture-2d-sliced.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-2d-sliced.lo `test -f '$(srcdir)/cogl-texture-2d-sliced.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-2d-sliced.c + +cogl-texture-3d.lo: $(srcdir)/cogl-texture-3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-3d.lo -MD -MP -MF $(DEPDIR)/cogl-texture-3d.Tpo -c -o cogl-texture-3d.lo `test -f '$(srcdir)/cogl-texture-3d.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-3d.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-3d.Tpo $(DEPDIR)/cogl-texture-3d.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-texture-3d.c' object='cogl-texture-3d.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-3d.lo `test -f '$(srcdir)/cogl-texture-3d.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-3d.c + +cogl-texture-rectangle.lo: $(srcdir)/cogl-texture-rectangle.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-rectangle.lo -MD -MP -MF $(DEPDIR)/cogl-texture-rectangle.Tpo -c -o cogl-texture-rectangle.lo `test -f '$(srcdir)/cogl-texture-rectangle.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-rectangle.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-rectangle.Tpo $(DEPDIR)/cogl-texture-rectangle.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-texture-rectangle.c' object='cogl-texture-rectangle.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-rectangle.lo `test -f '$(srcdir)/cogl-texture-rectangle.c' || echo '$(srcdir)/'`$(srcdir)/cogl-texture-rectangle.c + +cogl-rectangle-map.lo: $(srcdir)/cogl-rectangle-map.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-rectangle-map.lo -MD -MP -MF $(DEPDIR)/cogl-rectangle-map.Tpo -c -o cogl-rectangle-map.lo `test -f '$(srcdir)/cogl-rectangle-map.c' || echo '$(srcdir)/'`$(srcdir)/cogl-rectangle-map.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-rectangle-map.Tpo $(DEPDIR)/cogl-rectangle-map.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-rectangle-map.c' object='cogl-rectangle-map.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-rectangle-map.lo `test -f '$(srcdir)/cogl-rectangle-map.c' || echo '$(srcdir)/'`$(srcdir)/cogl-rectangle-map.c + +cogl-atlas.lo: $(srcdir)/cogl-atlas.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-atlas.lo -MD -MP -MF $(DEPDIR)/cogl-atlas.Tpo -c -o cogl-atlas.lo `test -f '$(srcdir)/cogl-atlas.c' || echo '$(srcdir)/'`$(srcdir)/cogl-atlas.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-atlas.Tpo $(DEPDIR)/cogl-atlas.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-atlas.c' object='cogl-atlas.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-atlas.lo `test -f '$(srcdir)/cogl-atlas.c' || echo '$(srcdir)/'`$(srcdir)/cogl-atlas.c + +cogl-atlas-texture.lo: $(srcdir)/cogl-atlas-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-atlas-texture.lo -MD -MP -MF $(DEPDIR)/cogl-atlas-texture.Tpo -c -o cogl-atlas-texture.lo `test -f '$(srcdir)/cogl-atlas-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-atlas-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-atlas-texture.Tpo $(DEPDIR)/cogl-atlas-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-atlas-texture.c' object='cogl-atlas-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-atlas-texture.lo `test -f '$(srcdir)/cogl-atlas-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-atlas-texture.c + +cogl-meta-texture.lo: $(srcdir)/cogl-meta-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-meta-texture.lo -MD -MP -MF $(DEPDIR)/cogl-meta-texture.Tpo -c -o cogl-meta-texture.lo `test -f '$(srcdir)/cogl-meta-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-meta-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-meta-texture.Tpo $(DEPDIR)/cogl-meta-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-meta-texture.c' object='cogl-meta-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-meta-texture.lo `test -f '$(srcdir)/cogl-meta-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-meta-texture.c + +cogl-primitive-texture.lo: $(srcdir)/cogl-primitive-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-primitive-texture.lo -MD -MP -MF $(DEPDIR)/cogl-primitive-texture.Tpo -c -o cogl-primitive-texture.lo `test -f '$(srcdir)/cogl-primitive-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitive-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-primitive-texture.Tpo $(DEPDIR)/cogl-primitive-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-primitive-texture.c' object='cogl-primitive-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-primitive-texture.lo `test -f '$(srcdir)/cogl-primitive-texture.c' || echo '$(srcdir)/'`$(srcdir)/cogl-primitive-texture.c + +cogl-blit.lo: $(srcdir)/cogl-blit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-blit.lo -MD -MP -MF $(DEPDIR)/cogl-blit.Tpo -c -o cogl-blit.lo `test -f '$(srcdir)/cogl-blit.c' || echo '$(srcdir)/'`$(srcdir)/cogl-blit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-blit.Tpo $(DEPDIR)/cogl-blit.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-blit.c' object='cogl-blit.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-blit.lo `test -f '$(srcdir)/cogl-blit.c' || echo '$(srcdir)/'`$(srcdir)/cogl-blit.c + +cogl-spans.lo: $(srcdir)/cogl-spans.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-spans.lo -MD -MP -MF $(DEPDIR)/cogl-spans.Tpo -c -o cogl-spans.lo `test -f '$(srcdir)/cogl-spans.c' || echo '$(srcdir)/'`$(srcdir)/cogl-spans.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-spans.Tpo $(DEPDIR)/cogl-spans.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-spans.c' object='cogl-spans.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-spans.lo `test -f '$(srcdir)/cogl-spans.c' || echo '$(srcdir)/'`$(srcdir)/cogl-spans.c + +cogl-journal.lo: $(srcdir)/cogl-journal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-journal.lo -MD -MP -MF $(DEPDIR)/cogl-journal.Tpo -c -o cogl-journal.lo `test -f '$(srcdir)/cogl-journal.c' || echo '$(srcdir)/'`$(srcdir)/cogl-journal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-journal.Tpo $(DEPDIR)/cogl-journal.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-journal.c' object='cogl-journal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-journal.lo `test -f '$(srcdir)/cogl-journal.c' || echo '$(srcdir)/'`$(srcdir)/cogl-journal.c + +cogl-frame-info.lo: $(srcdir)/cogl-frame-info.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-frame-info.lo -MD -MP -MF $(DEPDIR)/cogl-frame-info.Tpo -c -o cogl-frame-info.lo `test -f '$(srcdir)/cogl-frame-info.c' || echo '$(srcdir)/'`$(srcdir)/cogl-frame-info.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-frame-info.Tpo $(DEPDIR)/cogl-frame-info.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-frame-info.c' object='cogl-frame-info.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-frame-info.lo `test -f '$(srcdir)/cogl-frame-info.c' || echo '$(srcdir)/'`$(srcdir)/cogl-frame-info.c + +cogl-framebuffer.lo: $(srcdir)/cogl-framebuffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-framebuffer.lo -MD -MP -MF $(DEPDIR)/cogl-framebuffer.Tpo -c -o cogl-framebuffer.lo `test -f '$(srcdir)/cogl-framebuffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-framebuffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-framebuffer.Tpo $(DEPDIR)/cogl-framebuffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-framebuffer.c' object='cogl-framebuffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-framebuffer.lo `test -f '$(srcdir)/cogl-framebuffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-framebuffer.c + +cogl-onscreen.lo: $(srcdir)/cogl-onscreen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-onscreen.lo -MD -MP -MF $(DEPDIR)/cogl-onscreen.Tpo -c -o cogl-onscreen.lo `test -f '$(srcdir)/cogl-onscreen.c' || echo '$(srcdir)/'`$(srcdir)/cogl-onscreen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-onscreen.Tpo $(DEPDIR)/cogl-onscreen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-onscreen.c' object='cogl-onscreen.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-onscreen.lo `test -f '$(srcdir)/cogl-onscreen.c' || echo '$(srcdir)/'`$(srcdir)/cogl-onscreen.c + +cogl-output.lo: $(srcdir)/cogl-output.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-output.lo -MD -MP -MF $(DEPDIR)/cogl-output.Tpo -c -o cogl-output.lo `test -f '$(srcdir)/cogl-output.c' || echo '$(srcdir)/'`$(srcdir)/cogl-output.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-output.Tpo $(DEPDIR)/cogl-output.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-output.c' object='cogl-output.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-output.lo `test -f '$(srcdir)/cogl-output.c' || echo '$(srcdir)/'`$(srcdir)/cogl-output.c + +cogl-profile.lo: $(srcdir)/cogl-profile.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-profile.lo -MD -MP -MF $(DEPDIR)/cogl-profile.Tpo -c -o cogl-profile.lo `test -f '$(srcdir)/cogl-profile.c' || echo '$(srcdir)/'`$(srcdir)/cogl-profile.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-profile.Tpo $(DEPDIR)/cogl-profile.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-profile.c' object='cogl-profile.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-profile.lo `test -f '$(srcdir)/cogl-profile.c' || echo '$(srcdir)/'`$(srcdir)/cogl-profile.c + +cogl-bitmask.lo: $(srcdir)/cogl-bitmask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-bitmask.lo -MD -MP -MF $(DEPDIR)/cogl-bitmask.Tpo -c -o cogl-bitmask.lo `test -f '$(srcdir)/cogl-bitmask.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmask.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-bitmask.Tpo $(DEPDIR)/cogl-bitmask.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-bitmask.c' object='cogl-bitmask.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-bitmask.lo `test -f '$(srcdir)/cogl-bitmask.c' || echo '$(srcdir)/'`$(srcdir)/cogl-bitmask.c + +cogl-gtype.lo: $(srcdir)/cogl-gtype.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-gtype.lo -MD -MP -MF $(DEPDIR)/cogl-gtype.Tpo -c -o cogl-gtype.lo `test -f '$(srcdir)/cogl-gtype.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gtype.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-gtype.Tpo $(DEPDIR)/cogl-gtype.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-gtype.c' object='cogl-gtype.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-gtype.lo `test -f '$(srcdir)/cogl-gtype.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gtype.c + +cogl-point-in-poly.lo: $(srcdir)/cogl-point-in-poly.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-point-in-poly.lo -MD -MP -MF $(DEPDIR)/cogl-point-in-poly.Tpo -c -o cogl-point-in-poly.lo `test -f '$(srcdir)/cogl-point-in-poly.c' || echo '$(srcdir)/'`$(srcdir)/cogl-point-in-poly.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-point-in-poly.Tpo $(DEPDIR)/cogl-point-in-poly.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-point-in-poly.c' object='cogl-point-in-poly.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-point-in-poly.lo `test -f '$(srcdir)/cogl-point-in-poly.c' || echo '$(srcdir)/'`$(srcdir)/cogl-point-in-poly.c + +cogl-list.lo: $(srcdir)/cogl-list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-list.lo -MD -MP -MF $(DEPDIR)/cogl-list.Tpo -c -o cogl-list.lo `test -f '$(srcdir)/cogl-list.c' || echo '$(srcdir)/'`$(srcdir)/cogl-list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-list.Tpo $(DEPDIR)/cogl-list.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-list.c' object='cogl-list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-list.lo `test -f '$(srcdir)/cogl-list.c' || echo '$(srcdir)/'`$(srcdir)/cogl-list.c + +cogl-winsys-stub.lo: $(srcdir)/winsys/cogl-winsys-stub.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-stub.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-stub.Tpo -c -o cogl-winsys-stub.lo `test -f '$(srcdir)/winsys/cogl-winsys-stub.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-stub.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-stub.Tpo $(DEPDIR)/cogl-winsys-stub.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-stub.c' object='cogl-winsys-stub.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-stub.lo `test -f '$(srcdir)/winsys/cogl-winsys-stub.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-stub.c + +cogl-config.lo: $(srcdir)/cogl-config.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-config.lo -MD -MP -MF $(DEPDIR)/cogl-config.Tpo -c -o cogl-config.lo `test -f '$(srcdir)/cogl-config.c' || echo '$(srcdir)/'`$(srcdir)/cogl-config.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-config.Tpo $(DEPDIR)/cogl-config.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-config.c' object='cogl-config.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-config.lo `test -f '$(srcdir)/cogl-config.c' || echo '$(srcdir)/'`$(srcdir)/cogl-config.c + +cogl-boxed-value.lo: $(srcdir)/cogl-boxed-value.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-boxed-value.lo -MD -MP -MF $(DEPDIR)/cogl-boxed-value.Tpo -c -o cogl-boxed-value.lo `test -f '$(srcdir)/cogl-boxed-value.c' || echo '$(srcdir)/'`$(srcdir)/cogl-boxed-value.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-boxed-value.Tpo $(DEPDIR)/cogl-boxed-value.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-boxed-value.c' object='cogl-boxed-value.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-boxed-value.lo `test -f '$(srcdir)/cogl-boxed-value.c' || echo '$(srcdir)/'`$(srcdir)/cogl-boxed-value.c + +cogl-snippet.lo: $(srcdir)/cogl-snippet.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-snippet.lo -MD -MP -MF $(DEPDIR)/cogl-snippet.Tpo -c -o cogl-snippet.lo `test -f '$(srcdir)/cogl-snippet.c' || echo '$(srcdir)/'`$(srcdir)/cogl-snippet.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-snippet.Tpo $(DEPDIR)/cogl-snippet.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-snippet.c' object='cogl-snippet.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-snippet.lo `test -f '$(srcdir)/cogl-snippet.c' || echo '$(srcdir)/'`$(srcdir)/cogl-snippet.c + +cogl-poll.lo: $(srcdir)/cogl-poll.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-poll.lo -MD -MP -MF $(DEPDIR)/cogl-poll.Tpo -c -o cogl-poll.lo `test -f '$(srcdir)/cogl-poll.c' || echo '$(srcdir)/'`$(srcdir)/cogl-poll.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-poll.Tpo $(DEPDIR)/cogl-poll.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-poll.c' object='cogl-poll.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-poll.lo `test -f '$(srcdir)/cogl-poll.c' || echo '$(srcdir)/'`$(srcdir)/cogl-poll.c + +cogl-memory-stack.lo: $(srcdir)/cogl-memory-stack.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-memory-stack.lo -MD -MP -MF $(DEPDIR)/cogl-memory-stack.Tpo -c -o cogl-memory-stack.lo `test -f '$(srcdir)/cogl-memory-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-memory-stack.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-memory-stack.Tpo $(DEPDIR)/cogl-memory-stack.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-memory-stack.c' object='cogl-memory-stack.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-memory-stack.lo `test -f '$(srcdir)/cogl-memory-stack.c' || echo '$(srcdir)/'`$(srcdir)/cogl-memory-stack.c + +cogl-magazine.lo: $(srcdir)/cogl-magazine.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-magazine.lo -MD -MP -MF $(DEPDIR)/cogl-magazine.Tpo -c -o cogl-magazine.lo `test -f '$(srcdir)/cogl-magazine.c' || echo '$(srcdir)/'`$(srcdir)/cogl-magazine.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-magazine.Tpo $(DEPDIR)/cogl-magazine.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-magazine.c' object='cogl-magazine.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-magazine.lo `test -f '$(srcdir)/cogl-magazine.c' || echo '$(srcdir)/'`$(srcdir)/cogl-magazine.c + +cogl-gles2-context.lo: $(srcdir)/cogl-gles2-context.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-gles2-context.lo -MD -MP -MF $(DEPDIR)/cogl-gles2-context.Tpo -c -o cogl-gles2-context.lo `test -f '$(srcdir)/cogl-gles2-context.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gles2-context.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-gles2-context.Tpo $(DEPDIR)/cogl-gles2-context.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-gles2-context.c' object='cogl-gles2-context.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-gles2-context.lo `test -f '$(srcdir)/cogl-gles2-context.c' || echo '$(srcdir)/'`$(srcdir)/cogl-gles2-context.c + +cogl-error.lo: $(srcdir)/cogl-error.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-error.lo -MD -MP -MF $(DEPDIR)/cogl-error.Tpo -c -o cogl-error.lo `test -f '$(srcdir)/cogl-error.c' || echo '$(srcdir)/'`$(srcdir)/cogl-error.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-error.Tpo $(DEPDIR)/cogl-error.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-error.c' object='cogl-error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-error.lo `test -f '$(srcdir)/cogl-error.c' || echo '$(srcdir)/'`$(srcdir)/cogl-error.c + +cogl-closure-list.lo: $(srcdir)/cogl-closure-list.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-closure-list.lo -MD -MP -MF $(DEPDIR)/cogl-closure-list.Tpo -c -o cogl-closure-list.lo `test -f '$(srcdir)/cogl-closure-list.c' || echo '$(srcdir)/'`$(srcdir)/cogl-closure-list.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-closure-list.Tpo $(DEPDIR)/cogl-closure-list.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-closure-list.c' object='cogl-closure-list.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-closure-list.lo `test -f '$(srcdir)/cogl-closure-list.c' || echo '$(srcdir)/'`$(srcdir)/cogl-closure-list.c + +cogl-fence.lo: $(srcdir)/cogl-fence.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-fence.lo -MD -MP -MF $(DEPDIR)/cogl-fence.Tpo -c -o cogl-fence.lo `test -f '$(srcdir)/cogl-fence.c' || echo '$(srcdir)/'`$(srcdir)/cogl-fence.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-fence.Tpo $(DEPDIR)/cogl-fence.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-fence.c' object='cogl-fence.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-fence.lo `test -f '$(srcdir)/cogl-fence.c' || echo '$(srcdir)/'`$(srcdir)/cogl-fence.c + +cogl-clip-state.lo: $(srcdir)/deprecated/cogl-clip-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-clip-state.lo -MD -MP -MF $(DEPDIR)/cogl-clip-state.Tpo -c -o cogl-clip-state.lo `test -f '$(srcdir)/deprecated/cogl-clip-state.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-clip-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clip-state.Tpo $(DEPDIR)/cogl-clip-state.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-clip-state.c' object='cogl-clip-state.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-clip-state.lo `test -f '$(srcdir)/deprecated/cogl-clip-state.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-clip-state.c + +cogl-fixed.lo: $(srcdir)/deprecated/cogl-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-fixed.lo -MD -MP -MF $(DEPDIR)/cogl-fixed.Tpo -c -o cogl-fixed.lo `test -f '$(srcdir)/deprecated/cogl-fixed.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-fixed.Tpo $(DEPDIR)/cogl-fixed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-fixed.c' object='cogl-fixed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-fixed.lo `test -f '$(srcdir)/deprecated/cogl-fixed.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-fixed.c + +cogl-vertex-buffer.lo: $(srcdir)/deprecated/cogl-vertex-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-vertex-buffer.lo -MD -MP -MF $(DEPDIR)/cogl-vertex-buffer.Tpo -c -o cogl-vertex-buffer.lo `test -f '$(srcdir)/deprecated/cogl-vertex-buffer.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-vertex-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-vertex-buffer.Tpo $(DEPDIR)/cogl-vertex-buffer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-vertex-buffer.c' object='cogl-vertex-buffer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-vertex-buffer.lo `test -f '$(srcdir)/deprecated/cogl-vertex-buffer.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-vertex-buffer.c + +cogl-material-compat.lo: $(srcdir)/deprecated/cogl-material-compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-material-compat.lo -MD -MP -MF $(DEPDIR)/cogl-material-compat.Tpo -c -o cogl-material-compat.lo `test -f '$(srcdir)/deprecated/cogl-material-compat.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-material-compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-material-compat.Tpo $(DEPDIR)/cogl-material-compat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-material-compat.c' object='cogl-material-compat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-material-compat.lo `test -f '$(srcdir)/deprecated/cogl-material-compat.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-material-compat.c + +cogl-program.lo: $(srcdir)/deprecated/cogl-program.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-program.lo -MD -MP -MF $(DEPDIR)/cogl-program.Tpo -c -o cogl-program.lo `test -f '$(srcdir)/deprecated/cogl-program.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-program.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-program.Tpo $(DEPDIR)/cogl-program.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-program.c' object='cogl-program.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-program.lo `test -f '$(srcdir)/deprecated/cogl-program.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-program.c + +cogl-auto-texture.lo: $(srcdir)/deprecated/cogl-auto-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-auto-texture.lo -MD -MP -MF $(DEPDIR)/cogl-auto-texture.Tpo -c -o cogl-auto-texture.lo `test -f '$(srcdir)/deprecated/cogl-auto-texture.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-auto-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-auto-texture.Tpo $(DEPDIR)/cogl-auto-texture.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-auto-texture.c' object='cogl-auto-texture.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-auto-texture.lo `test -f '$(srcdir)/deprecated/cogl-auto-texture.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-auto-texture.c + +cogl-shader.lo: $(srcdir)/deprecated/cogl-shader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-shader.lo -MD -MP -MF $(DEPDIR)/cogl-shader.Tpo -c -o cogl-shader.lo `test -f '$(srcdir)/deprecated/cogl-shader.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-shader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-shader.Tpo $(DEPDIR)/cogl-shader.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-shader.c' object='cogl-shader.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-shader.lo `test -f '$(srcdir)/deprecated/cogl-shader.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-shader.c + +cogl-clutter.lo: $(srcdir)/deprecated/cogl-clutter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-clutter.lo -MD -MP -MF $(DEPDIR)/cogl-clutter.Tpo -c -o cogl-clutter.lo `test -f '$(srcdir)/deprecated/cogl-clutter.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-clutter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clutter.Tpo $(DEPDIR)/cogl-clutter.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-clutter.c' object='cogl-clutter.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-clutter.lo `test -f '$(srcdir)/deprecated/cogl-clutter.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-clutter.c + +cogl-framebuffer-deprecated.lo: $(srcdir)/deprecated/cogl-framebuffer-deprecated.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-framebuffer-deprecated.lo -MD -MP -MF $(DEPDIR)/cogl-framebuffer-deprecated.Tpo -c -o cogl-framebuffer-deprecated.lo `test -f '$(srcdir)/deprecated/cogl-framebuffer-deprecated.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-framebuffer-deprecated.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-framebuffer-deprecated.Tpo $(DEPDIR)/cogl-framebuffer-deprecated.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-framebuffer-deprecated.c' object='cogl-framebuffer-deprecated.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-framebuffer-deprecated.lo `test -f '$(srcdir)/deprecated/cogl-framebuffer-deprecated.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-framebuffer-deprecated.c + +cogl-texture-deprecated.lo: $(srcdir)/deprecated/cogl-texture-deprecated.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-deprecated.lo -MD -MP -MF $(DEPDIR)/cogl-texture-deprecated.Tpo -c -o cogl-texture-deprecated.lo `test -f '$(srcdir)/deprecated/cogl-texture-deprecated.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-texture-deprecated.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-deprecated.Tpo $(DEPDIR)/cogl-texture-deprecated.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/deprecated/cogl-texture-deprecated.c' object='cogl-texture-deprecated.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-deprecated.lo `test -f '$(srcdir)/deprecated/cogl-texture-deprecated.c' || echo '$(srcdir)/'`$(srcdir)/deprecated/cogl-texture-deprecated.c + +cogl-glib-source.lo: $(srcdir)/cogl-glib-source.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-glib-source.lo -MD -MP -MF $(DEPDIR)/cogl-glib-source.Tpo -c -o cogl-glib-source.lo `test -f '$(srcdir)/cogl-glib-source.c' || echo '$(srcdir)/'`$(srcdir)/cogl-glib-source.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-glib-source.Tpo $(DEPDIR)/cogl-glib-source.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-glib-source.c' object='cogl-glib-source.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-glib-source.lo `test -f '$(srcdir)/cogl-glib-source.c' || echo '$(srcdir)/'`$(srcdir)/cogl-glib-source.c + +cogl-xlib-renderer.lo: $(srcdir)/cogl-xlib-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-xlib-renderer.lo -MD -MP -MF $(DEPDIR)/cogl-xlib-renderer.Tpo -c -o cogl-xlib-renderer.lo `test -f '$(srcdir)/cogl-xlib-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-xlib-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-xlib-renderer.Tpo $(DEPDIR)/cogl-xlib-renderer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-xlib-renderer.c' object='cogl-xlib-renderer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-xlib-renderer.lo `test -f '$(srcdir)/cogl-xlib-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-xlib-renderer.c + +cogl-xlib.lo: $(srcdir)/cogl-xlib.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-xlib.lo -MD -MP -MF $(DEPDIR)/cogl-xlib.Tpo -c -o cogl-xlib.lo `test -f '$(srcdir)/cogl-xlib.c' || echo '$(srcdir)/'`$(srcdir)/cogl-xlib.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-xlib.Tpo $(DEPDIR)/cogl-xlib.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-xlib.c' object='cogl-xlib.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-xlib.lo `test -f '$(srcdir)/cogl-xlib.c' || echo '$(srcdir)/'`$(srcdir)/cogl-xlib.c + +cogl-texture-pixmap-x11.lo: $(srcdir)/winsys/cogl-texture-pixmap-x11.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-texture-pixmap-x11.lo -MD -MP -MF $(DEPDIR)/cogl-texture-pixmap-x11.Tpo -c -o cogl-texture-pixmap-x11.lo `test -f '$(srcdir)/winsys/cogl-texture-pixmap-x11.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-texture-pixmap-x11.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-texture-pixmap-x11.Tpo $(DEPDIR)/cogl-texture-pixmap-x11.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-texture-pixmap-x11.c' object='cogl-texture-pixmap-x11.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-texture-pixmap-x11.lo `test -f '$(srcdir)/winsys/cogl-texture-pixmap-x11.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-texture-pixmap-x11.c + +cogl-winsys-glx.lo: $(srcdir)/winsys/cogl-winsys-glx.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-glx.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-glx.Tpo -c -o cogl-winsys-glx.lo `test -f '$(srcdir)/winsys/cogl-winsys-glx.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-glx.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-glx.Tpo $(DEPDIR)/cogl-winsys-glx.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-glx.c' object='cogl-winsys-glx.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-glx.lo `test -f '$(srcdir)/winsys/cogl-winsys-glx.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-glx.c + +cogl-win32-renderer.lo: $(srcdir)/cogl-win32-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-win32-renderer.lo -MD -MP -MF $(DEPDIR)/cogl-win32-renderer.Tpo -c -o cogl-win32-renderer.lo `test -f '$(srcdir)/cogl-win32-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-win32-renderer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-win32-renderer.Tpo $(DEPDIR)/cogl-win32-renderer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-win32-renderer.c' object='cogl-win32-renderer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-win32-renderer.lo `test -f '$(srcdir)/cogl-win32-renderer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-win32-renderer.c + +cogl-winsys-wgl.lo: $(srcdir)/winsys/cogl-winsys-wgl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-wgl.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-wgl.Tpo -c -o cogl-winsys-wgl.lo `test -f '$(srcdir)/winsys/cogl-winsys-wgl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-wgl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-wgl.Tpo $(DEPDIR)/cogl-winsys-wgl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-wgl.c' object='cogl-winsys-wgl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-wgl.lo `test -f '$(srcdir)/winsys/cogl-winsys-wgl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-wgl.c + +cogl-winsys-egl-wayland.lo: $(srcdir)/winsys/cogl-winsys-egl-wayland.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-wayland.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-wayland.Tpo -c -o cogl-winsys-egl-wayland.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-wayland.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-wayland.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-wayland.Tpo $(DEPDIR)/cogl-winsys-egl-wayland.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-wayland.c' object='cogl-winsys-egl-wayland.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-wayland.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-wayland.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-wayland.c + +cogl-winsys-egl-kms.lo: $(srcdir)/winsys/cogl-winsys-egl-kms.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-kms.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-kms.Tpo -c -o cogl-winsys-egl-kms.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-kms.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-kms.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-kms.Tpo $(DEPDIR)/cogl-winsys-egl-kms.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-kms.c' object='cogl-winsys-egl-kms.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-kms.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-kms.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-kms.c + +cogl-winsys-egl-x11.lo: $(srcdir)/winsys/cogl-winsys-egl-x11.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-x11.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-x11.Tpo -c -o cogl-winsys-egl-x11.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-x11.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-x11.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-x11.Tpo $(DEPDIR)/cogl-winsys-egl-x11.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-x11.c' object='cogl-winsys-egl-x11.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-x11.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-x11.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-x11.c + +cogl-winsys-egl-null.lo: $(srcdir)/winsys/cogl-winsys-egl-null.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-null.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-null.Tpo -c -o cogl-winsys-egl-null.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-null.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-null.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-null.Tpo $(DEPDIR)/cogl-winsys-egl-null.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-null.c' object='cogl-winsys-egl-null.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-null.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-null.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-null.c + +cogl-winsys-egl-gdl.lo: $(srcdir)/winsys/cogl-winsys-egl-gdl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-gdl.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-gdl.Tpo -c -o cogl-winsys-egl-gdl.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-gdl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-gdl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-gdl.Tpo $(DEPDIR)/cogl-winsys-egl-gdl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-gdl.c' object='cogl-winsys-egl-gdl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-gdl.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-gdl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-gdl.c + +cogl-winsys-egl-android.lo: $(srcdir)/winsys/cogl-winsys-egl-android.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl-android.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl-android.Tpo -c -o cogl-winsys-egl-android.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-android.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-android.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl-android.Tpo $(DEPDIR)/cogl-winsys-egl-android.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl-android.c' object='cogl-winsys-egl-android.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl-android.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl-android.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl-android.c + +cogl-winsys-egl.lo: $(srcdir)/winsys/cogl-winsys-egl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-egl.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-egl.Tpo -c -o cogl-winsys-egl.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-egl.Tpo $(DEPDIR)/cogl-winsys-egl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-egl.c' object='cogl-winsys-egl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-egl.lo `test -f '$(srcdir)/winsys/cogl-winsys-egl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-egl.c + +cogl-winsys-sdl.lo: $(srcdir)/winsys/cogl-winsys-sdl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-sdl.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-sdl.Tpo -c -o cogl-winsys-sdl.lo `test -f '$(srcdir)/winsys/cogl-winsys-sdl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-sdl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-sdl.Tpo $(DEPDIR)/cogl-winsys-sdl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-sdl.c' object='cogl-winsys-sdl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-sdl.lo `test -f '$(srcdir)/winsys/cogl-winsys-sdl.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-sdl.c + +cogl-sdl.lo: $(srcdir)/cogl-sdl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-sdl.lo -MD -MP -MF $(DEPDIR)/cogl-sdl.Tpo -c -o cogl-sdl.lo `test -f '$(srcdir)/cogl-sdl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sdl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-sdl.Tpo $(DEPDIR)/cogl-sdl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/cogl-sdl.c' object='cogl-sdl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-sdl.lo `test -f '$(srcdir)/cogl-sdl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-sdl.c + +cogl-winsys-sdl2.lo: $(srcdir)/winsys/cogl-winsys-sdl2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cogl-winsys-sdl2.lo -MD -MP -MF $(DEPDIR)/cogl-winsys-sdl2.Tpo -c -o cogl-winsys-sdl2.lo `test -f '$(srcdir)/winsys/cogl-winsys-sdl2.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-sdl2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-winsys-sdl2.Tpo $(DEPDIR)/cogl-winsys-sdl2.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/winsys/cogl-winsys-sdl2.c' object='cogl-winsys-sdl2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl-winsys-sdl2.lo `test -f '$(srcdir)/winsys/cogl-winsys-sdl2.c' || echo '$(srcdir)/'`$(srcdir)/winsys/cogl-winsys-sdl2.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-girDATA: $(gir_DATA) + @$(NORMAL_INSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ + done + +uninstall-girDATA: + @$(NORMAL_UNINSTALL) + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ + done + +uninstall-typelibDATA: + @$(NORMAL_UNINSTALL) + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) +install-cogl_proto_includeHEADERS: $(cogl_proto_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(cogl_proto_include_HEADERS)'; test -n "$(cogl_proto_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogl_proto_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogl_proto_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogl_proto_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogl_proto_includedir)" || exit $$?; \ + done + +uninstall-cogl_proto_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(cogl_proto_include_HEADERS)'; test -n "$(cogl_proto_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogl_proto_includedir)'; $(am__uninstall_files_from_dir) +install-cogldeprecatedincludeHEADERS: $(cogldeprecatedinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(cogldeprecatedinclude_HEADERS)'; test -n "$(cogldeprecatedincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cogldeprecatedincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cogldeprecatedincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(cogldeprecatedincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(cogldeprecatedincludedir)" || exit $$?; \ + done + +uninstall-cogldeprecatedincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(cogldeprecatedinclude_HEADERS)'; test -n "$(cogldeprecatedincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(cogldeprecatedincludedir)'; $(am__uninstall_files_from_dir) +install-coglincludeHEADERS: $(coglinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(coglincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(coglincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(coglincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(coglincludedir)" || exit $$?; \ + done + +uninstall-coglincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(coglincludedir)'; $(am__uninstall_files_from_dir) +install-nodist_coglincludeHEADERS: $(nodist_coglinclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nodist_coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(coglincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(coglincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(coglincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(coglincludedir)" || exit $$?; \ + done + +uninstall-nodist_coglincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(coglincludedir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(cogl_proto_includedir)" "$(DESTDIR)$(cogldeprecatedincludedir)" "$(DESTDIR)$(coglincludedir)" "$(DESTDIR)$(coglincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-cogl_proto_includeHEADERS \ + install-cogldeprecatedincludeHEADERS \ + install-coglincludeHEADERS install-girDATA \ + install-nodist_coglincludeHEADERS install-pkgconfigDATA \ + install-typelibDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-cogl_proto_includeHEADERS \ + uninstall-cogldeprecatedincludeHEADERS \ + uninstall-coglincludeHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-nodist_coglincludeHEADERS \ + uninstall-pkgconfigDATA uninstall-typelibDATA + +.MAKE: $(am__recursive_targets) all check install install-am \ + install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am dist-hook distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-cogl_proto_includeHEADERS \ + install-cogldeprecatedincludeHEADERS \ + install-coglincludeHEADERS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-girDATA install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-nodist_coglincludeHEADERS install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + install-typelibDATA installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-cogl_proto_includeHEADERS \ + uninstall-cogldeprecatedincludeHEADERS \ + uninstall-coglincludeHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-nodist_coglincludeHEADERS \ + uninstall-pkgconfigDATA uninstall-typelibDATA + + +@USE_GLIB_FALSE@ AM_CPPFLAGS += -I$(top_builddir)/deps/glib + +cogl-gl-1.0.pc: cogl-1.0.pc + $(QUIET_GEN)cp -f $< $(@F) + +# Basic sanity checks +$(if $(GLIB_MKENUMS),,$(error Need to define GLIB_MKENUMS)) + +$(if $(or $(glib_enum_h), \ + $(glib_enum_c)),, \ + $(error Need to define glib_enum_h and glib_enum_c)) + +$(if $(glib_enum_headers),,$(error Need to define glib_enum_headers)) + +stamp-enum-types: $(glib_enum_headers) $(enum_tmpl_h) + $(AM_V_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_h) \ + $(glib_enum_headers) > xgen-eh \ + && (cmp -s xgen-eh $(glib_enum_h) || cp -f xgen-eh $(glib_enum_h)) \ + && rm -f xgen-eh \ + && echo timestamp > $(@F) + +$(glib_enum_h): stamp-enum-types + @true + +$(glib_enum_c): $(glib_enum_headers) $(glib_enum_h) $(enum_tmpl_c) + $(AM_V_GEN)$(GLIB_MKENUMS) \ + --template $(enum_tmpl_c) \ + $(glib_enum_headers) > xgen-ec \ + && cp -f xgen-ec $(glib_enum_c) \ + && rm -f xgen-ec + +dist-hook: ../build/win32/vs9/cogl.vcproj ../build/win32/vs10/cogl.vcxproj ../build/win32/vs10/cogl.vcxproj.filters ../build/win32/gen-enums.bat + +# I know those filters below don't look nice, but this is to ensure the right files are in the Project files only *once* +../build/win32/vs9/cogl.vcproj: $(top_srcdir)/build/win32/vs9/cogl.vcprojin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >cogl.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/cogl.vcprojin >$@ + rm cogl.sourcefiles + +../build/win32/vs10/cogl.vcxproj: $(top_srcdir)/build/win32/vs10/cogl.vcxprojin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >cogl.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl.vcxprojin >$@ + rm cogl.vs10.sourcefiles + +../build/win32/vs10/cogl.vcxproj.filters: $(top_srcdir)/build/win32/vs10/cogl.vcxproj.filtersin + for F in `echo $(cogl_sources_c) $(BUILT_SOURCES) | tr '/' '\\'`; do \ + case $$F in \ + *-egl.c|*-egl-*.c|*-glx.c|*-xlib*.c|*-x11.c|*.wgl.c|*-gl.c|*-gles.c|*-kms.c|*-sdl.c|*.h) ;; \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >cogl.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/cogl.vcxproj.filtersin >$@ + rm cogl.vs10.sourcefiles.filters + +cogl.vsenums_h: + echo 'perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.h.in ' >vsenums_h.temp1 + for F in `echo $(cogl_1_public_h) $(srcdir)/cogl-win32-renderer.h`; do \ + case $$F in \ + *xlib*.h|*wayland*.h) ;; \ + *.h) echo '../../cogl'$$F' ' \ + ;; \ + esac; \ + done >>vsenums_h.temp1 + cat vsenums_h.temp1 | sed 's_/cogl./_/cogl/_' >vsenums_h.temp + cat vsenums_h.temp | tr -d '\n' >>$@ + echo '> ..\..\cogl\cogl-enum-types.h' >>$@ + rm vsenums_h.temp1 + rm vsenums_h.temp + +cogl.vsenums_c: + echo 'perl %1\bin\glib-mkenums --template ../../cogl/cogl-enum-types.c.in ' >vsenums_c.temp1 + for F in `echo $(cogl_1_public_h) $(srcdir)/cogl-win32-renderer.h`; do \ + case $$F in \ + *xlib*.h|*wayland*.h) ;; \ + *.h) echo '../../cogl'$$F' ' \ + ;; \ + esac; \ + done >>vsenums_c.temp1 + cat vsenums_c.temp1 | sed 's_/cogl./_/cogl/_' >vsenums_c.temp + cat vsenums_c.temp | tr -d '\n' >>$@ + echo '> ..\..\cogl\cogl-enum-types.c' >>$@ + rm vsenums_c.temp1 + rm vsenums_c.temp + +../build/win32/gen-enums.bat: cogl.vsenums_h cogl.vsenums_c + echo 'if exist ..\..\cogl\cogl-enum-types.h goto DONE_COGL_ENUMS_H' >$@ + cat cogl.vsenums_h >>$@ + echo ':DONE_COGL_ENUMS_H' >>$@ + echo 'if exist ..\..\cogl\cogl-enum-types.c goto DONE_COGL_ENUMS_C' >>$@ + cat cogl.vsenums_c >>$@ + echo ':DONE_COGL_ENUMS_C' >>$@ + rm cogl.vsenums_h + rm cogl.vsenums_c + +-include $(INTROSPECTION_MAKEFILE) + +@HAVE_INTROSPECTION_TRUE@Cogl-1.0.gir: libcogl.la Makefile + +@HAVE_INTROSPECTION_TRUE@Cogl-2.0.gir: libcogl.la Makefile + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cogl/cogl-1.0.pc.in b/cogl/cogl-1.0.pc.in new file mode 100644 index 0000000..cb1cdb5 --- /dev/null +++ b/cogl/cogl-1.0.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=1.0 +requires=@COGL_PKG_REQUIRES@ + +Name: Cogl +Description: An object oriented GL/GLES Abstraction/Utility Layer +Version: @COGL_1_VERSION@ +Libs: -L${libdir} -lcogl +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl/cogl-2.0-experimental.pc.in b/cogl/cogl-2.0-experimental.pc.in new file mode 100644 index 0000000..93eaf31 --- /dev/null +++ b/cogl/cogl-2.0-experimental.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +apiversion=@COGL_API_VERSION@ +requires=@COGL_PKG_REQUIRES@ + +Name: Cogl +Description: An object oriented GL/GLES Abstraction/Utility Layer +Version: @COGL_VERSION@ +Libs: -L${libdir} -lcogl +Cflags: -I${includedir}/cogl +Requires: ${requires} diff --git a/cogl/cogl-atlas-texture-private.h b/cogl/cogl-atlas-texture-private.h new file mode 100644 index 0000000..ba83bf9 --- /dev/null +++ b/cogl/cogl-atlas-texture-private.h @@ -0,0 +1,81 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef _COGL_ATLAS_TEXTURE_PRIVATE_H_ +#define _COGL_ATLAS_TEXTURE_PRIVATE_H_ + +#include "cogl-object-private.h" +#include "cogl-texture-private.h" +#include "cogl-rectangle-map.h" +#include "cogl-atlas.h" +#include "cogl-atlas-texture.h" + +struct _CoglAtlasTexture +{ + CoglTexture _parent; + + /* The format that the texture is in. This isn't necessarily the + same format as the atlas texture because we can store + pre-multiplied and non-pre-multiplied textures together */ + CoglPixelFormat internal_format; + + /* The rectangle that was used to add this texture to the + atlas. This includes the 1-pixel border */ + CoglRectangleMapEntry rectangle; + + /* The atlas that this texture is in. If the texture is no longer in + an atlas then this will be NULL. A reference is taken on the + atlas by the texture (but not vice versa so there is no cycle) */ + CoglAtlas *atlas; + + /* Either a CoglSubTexture representing the atlas region for easy + * rendering or if the texture has been migrated out of the atlas it + * may be some other texture type such as CoglTexture2D */ + CoglTexture *sub_texture; +}; + +CoglAtlasTexture * +_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, + CoglBool can_convert_in_place); + +void +_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx, + GHookFunc callback, + void *user_data); + +void +_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx, + GHookFunc callback, + void *user_data); + +CoglBool +_cogl_is_atlas_texture (void *object); + +#endif /* _COGL_ATLAS_TEXTURE_PRIVATE_H_ */ diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c new file mode 100644 index 0000000..1c8b569 --- /dev/null +++ b/cogl/cogl-atlas-texture.c @@ -0,0 +1,1047 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-atlas-texture-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-sub-texture-private.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-texture-driver.h" +#include "cogl-rectangle-map.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-atlas.h" +#include "cogl1-context.h" +#include "cogl-sub-texture.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-gtype-private.h" + +#include + +static void _cogl_atlas_texture_free (CoglAtlasTexture *sub_tex); + +COGL_TEXTURE_DEFINE (AtlasTexture, atlas_texture); +COGL_GTYPE_DEFINE_CLASS (AtlasTexture, atlas_texture); + +static const CoglTextureVtable cogl_atlas_texture_vtable; + +static CoglSubTexture * +_cogl_atlas_texture_create_sub_texture (CoglTexture *full_texture, + const CoglRectangleMapEntry *rectangle) +{ + CoglContext *ctx = full_texture->context; + /* Create a subtexture for the given rectangle not including the + 1-pixel border */ + return cogl_sub_texture_new (ctx, + full_texture, + rectangle->x + 1, + rectangle->y + 1, + rectangle->width - 2, + rectangle->height - 2); +} + +static void +_cogl_atlas_texture_update_position_cb (void *user_data, + CoglTexture *new_texture, + const CoglRectangleMapEntry *rectangle) +{ + CoglAtlasTexture *atlas_tex = user_data; + + /* Update the sub texture */ + if (atlas_tex->sub_texture) + cogl_object_unref (atlas_tex->sub_texture); + atlas_tex->sub_texture = COGL_TEXTURE ( + _cogl_atlas_texture_create_sub_texture (new_texture, rectangle)); + + /* Update the position */ + atlas_tex->rectangle = *rectangle; +} + +static void +_cogl_atlas_texture_pre_reorganize_foreach_cb + (const CoglRectangleMapEntry *entry, + void *rectangle_data, + void *user_data) +{ + CoglAtlasTexture *atlas_tex = rectangle_data; + + /* Keep a reference to the texture because we don't want it to be + destroyed during the reorganization */ + cogl_object_ref (atlas_tex); + + /* Notify cogl-pipeline.c that the texture's underlying GL texture + * storage is changing so it knows it may need to bind a new texture + * if the CoglTexture is reused with the same texture unit. */ + _cogl_pipeline_texture_storage_change_notify (COGL_TEXTURE (atlas_tex)); +} + +static void +_cogl_atlas_texture_pre_reorganize_cb (void *data) +{ + CoglAtlas *atlas = data; + + /* We don't know if any journal entries currently depend on OpenGL + * texture coordinates that would be invalidated by reorganizing + * this atlas so we flush all journals before migrating. + * + * We are assuming that texture atlas migration never happens + * during a flush so we don't have to consider recursion here. + */ + cogl_flush (); + + if (atlas->map) + _cogl_rectangle_map_foreach (atlas->map, + _cogl_atlas_texture_pre_reorganize_foreach_cb, + NULL); +} + +typedef struct +{ + CoglAtlasTexture **textures; + /* Number of textures found so far */ + unsigned int n_textures; +} CoglAtlasTextureGetRectanglesData; + +static void +_cogl_atlas_texture_get_rectangles_cb (const CoglRectangleMapEntry *entry, + void *rectangle_data, + void *user_data) +{ + CoglAtlasTextureGetRectanglesData *data = user_data; + + data->textures[data->n_textures++] = rectangle_data; +} + +static void +_cogl_atlas_texture_post_reorganize_cb (void *user_data) +{ + CoglAtlas *atlas = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (atlas->map) + { + CoglAtlasTextureGetRectanglesData data; + unsigned int i; + + data.textures = g_new (CoglAtlasTexture *, + _cogl_rectangle_map_get_n_rectangles (atlas->map)); + data.n_textures = 0; + + /* We need to remove all of the references that we took during + the preorganize callback. We have to get a separate array of + the textures because CoglRectangleMap doesn't support + removing rectangles during iteration */ + _cogl_rectangle_map_foreach (atlas->map, + _cogl_atlas_texture_get_rectangles_cb, + &data); + + for (i = 0; i < data.n_textures; i++) + { + /* Ignore textures that don't have an atlas yet. This will + happen when a new texture is added because we allocate + the structure for the texture so that it can get stored + in the atlas but it isn't a valid object yet */ + if (data.textures[i]->atlas) + cogl_object_unref (data.textures[i]); + } + + g_free (data.textures); + } + + /* Notify any listeners that an atlas has changed */ + g_hook_list_invoke (&ctx->atlas_reorganize_callbacks, FALSE); +} + +static void +_cogl_atlas_texture_atlas_destroyed_cb (void *user_data) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Remove the atlas from the global list */ + ctx->atlases = g_slist_remove (ctx->atlases, user_data); +} + +static CoglAtlas * +_cogl_atlas_texture_create_atlas (CoglContext *ctx) +{ + static CoglUserDataKey atlas_private_key; + + CoglAtlas *atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_RGBA_8888, + 0, + _cogl_atlas_texture_update_position_cb); + + _cogl_atlas_add_reorganize_callback (atlas, + _cogl_atlas_texture_pre_reorganize_cb, + _cogl_atlas_texture_post_reorganize_cb, + atlas); + + ctx->atlases = g_slist_prepend (ctx->atlases, atlas); + + /* Set some data on the atlas so we can get notification when it is + destroyed in order to remove it from the list. ctx->atlases + effectively holds a weak reference. We don't need a strong + reference because the atlas textures take a reference on the + atlas so it will stay alive */ + cogl_object_set_user_data (COGL_OBJECT (atlas), &atlas_private_key, atlas, + _cogl_atlas_texture_atlas_destroyed_cb); + + return atlas; +} + +static void +_cogl_atlas_texture_foreach_sub_texture_in_region ( + CoglTexture *tex, + float virtual_tx_1, + float virtual_ty_1, + float virtual_tx_2, + float virtual_ty_2, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglMetaTexture *meta_texture = COGL_META_TEXTURE (atlas_tex->sub_texture); + + /* Forward on to the sub texture */ + cogl_meta_texture_foreach_in_region (meta_texture, + virtual_tx_1, + virtual_ty_1, + virtual_tx_2, + virtual_ty_2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + callback, + user_data); +} + +static void +_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (atlas_tex->sub_texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); +} + +static void +_cogl_atlas_texture_remove_from_atlas (CoglAtlasTexture *atlas_tex) +{ + if (atlas_tex->atlas) + { + _cogl_atlas_remove (atlas_tex->atlas, + &atlas_tex->rectangle); + + cogl_object_unref (atlas_tex->atlas); + atlas_tex->atlas = NULL; + } +} + +static void +_cogl_atlas_texture_free (CoglAtlasTexture *atlas_tex) +{ + _cogl_atlas_texture_remove_from_atlas (atlas_tex); + + if (atlas_tex->sub_texture) + cogl_object_unref (atlas_tex->sub_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (atlas_tex)); +} + +static int +_cogl_atlas_texture_get_max_waste (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return cogl_texture_get_max_waste (atlas_tex->sub_texture); +} + +static CoglBool +_cogl_atlas_texture_is_sliced (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return cogl_texture_is_sliced (atlas_tex->sub_texture); +} + +static CoglBool +_cogl_atlas_texture_can_hardware_repeat (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return _cogl_texture_can_hardware_repeat (atlas_tex->sub_texture); +} + +static void +_cogl_atlas_texture_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + _cogl_texture_transform_coords_to_gl (atlas_tex->sub_texture, s, t); +} + +static CoglTransformResult +_cogl_atlas_texture_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return _cogl_texture_transform_quad_coords_to_gl (atlas_tex->sub_texture, + coords); +} + +static CoglBool +_cogl_atlas_texture_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return cogl_texture_get_gl_texture (atlas_tex->sub_texture, + out_gl_handle, + out_gl_target); +} + +static void +_cogl_atlas_texture_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + _cogl_texture_gl_flush_legacy_texobj_filters (atlas_tex->sub_texture, + min_filter, mag_filter); +} + +static void +_cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex) +{ + CoglTexture *standalone_tex; + + /* Make sure this texture is not in the atlas */ + if (!atlas_tex->atlas) + return; + + COGL_NOTE (ATLAS, "Migrating texture out of the atlas"); + + /* We don't know if any journal entries currently depend on + * OpenGL texture coordinates that would be invalidated by + * migrating textures in this atlas so we flush all journals + * before migrating. + * + * We are assuming that texture atlas migration never happens + * during a flush so we don't have to consider recursion here. + */ + cogl_flush (); + + standalone_tex = + _cogl_atlas_copy_rectangle (atlas_tex->atlas, + atlas_tex->rectangle.x + 1, + atlas_tex->rectangle.y + 1, + atlas_tex->rectangle.width - 2, + atlas_tex->rectangle.height - 2, + atlas_tex->internal_format); + /* Note: we simply silently ignore failures to migrate a texture + * out (most likely due to lack of memory) and hope for the + * best. + * + * Maybe we should find a way to report the problem back to the + * app. + */ + if (!standalone_tex) + return; + + /* Notify cogl-pipeline.c that the texture's underlying GL texture + * storage is changing so it knows it may need to bind a new texture + * if the CoglTexture is reused with the same texture unit. */ + _cogl_pipeline_texture_storage_change_notify (COGL_TEXTURE (atlas_tex)); + + /* We need to unref the sub texture after doing the copy because + the copy can involve rendering which might cause the texture + to be used if it is used from a layer that is left in a + texture unit */ + cogl_object_unref (atlas_tex->sub_texture); + atlas_tex->sub_texture = standalone_tex; + + _cogl_atlas_texture_remove_from_atlas (atlas_tex); +} + +static void +_cogl_atlas_texture_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + if ((flags & COGL_TEXTURE_NEEDS_MIPMAP)) + /* Mipmaps do not work well with the current atlas so instead + we'll just migrate the texture out and use a regular texture */ + _cogl_atlas_texture_migrate_out_of_atlas (atlas_tex); + + /* Forward on to the sub texture */ + _cogl_texture_pre_paint (atlas_tex->sub_texture, flags); +} + +static void +_cogl_atlas_texture_ensure_non_quad_rendering (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Sub textures can't support non-quad rendering so we'll just + migrate the texture out */ + _cogl_atlas_texture_migrate_out_of_atlas (atlas_tex); + + /* Forward on to the sub texture */ + _cogl_texture_ensure_non_quad_rendering (atlas_tex->sub_texture); +} + +static CoglBool +_cogl_atlas_texture_set_region_with_border (CoglAtlasTexture *atlas_tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + CoglBitmap *bmp, + CoglError **error) +{ + CoglAtlas *atlas = atlas_tex->atlas; + + /* Copy the central data */ + if (!_cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + dst_width, + dst_height, + bmp, + dst_x + atlas_tex->rectangle.x + 1, + dst_y + atlas_tex->rectangle.y + 1, + 0, /* level 0 */ + error)) + return FALSE; + + /* Update the left edge pixels */ + if (dst_x == 0 && + !_cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + 1, dst_height, + bmp, + atlas_tex->rectangle.x, + dst_y + atlas_tex->rectangle.y + 1, + 0, /* level 0 */ + error)) + return FALSE; + /* Update the right edge pixels */ + if (dst_x + dst_width == atlas_tex->rectangle.width - 2 && + !_cogl_texture_set_region_from_bitmap (atlas->texture, + src_x + dst_width - 1, src_y, + 1, dst_height, + bmp, + atlas_tex->rectangle.x + + atlas_tex->rectangle.width - 1, + dst_y + atlas_tex->rectangle.y + 1, + 0, /* level 0 */ + error)) + return FALSE; + /* Update the top edge pixels */ + if (dst_y == 0 && + !_cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + dst_width, 1, + bmp, + dst_x + atlas_tex->rectangle.x + 1, + atlas_tex->rectangle.y, + 0, /* level 0 */ + error)) + return FALSE; + /* Update the bottom edge pixels */ + if (dst_y + dst_height == atlas_tex->rectangle.height - 2 && + !_cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y + dst_height - 1, + dst_width, 1, + bmp, + dst_x + atlas_tex->rectangle.x + 1, + atlas_tex->rectangle.y + + atlas_tex->rectangle.height - 1, + 0, /* level 0 */ + error)) + return FALSE; + + return TRUE; +} + +static CoglBitmap * +_cogl_atlas_texture_convert_bitmap_for_upload (CoglAtlasTexture *atlas_tex, + CoglBitmap *bmp, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error) +{ + CoglBitmap *upload_bmp; + CoglBitmap *override_bmp; + + /* We'll prepare to upload using the format of the actual texture of + the atlas texture instead of the format reported by + _cogl_texture_get_format which would be the original internal + format specified when the texture was created. However we'll + preserve the premult status of the internal format because the + images are all stored in the original premult format of the + orignal format so we do need to trigger the conversion */ + + internal_format = (COGL_PIXEL_FORMAT_RGBA_8888 | + (internal_format & COGL_PREMULT_BIT)); + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return NULL; + + /* We'll create another bitmap which uses the same data but + overrides the format to remove the premult flag so that uploads + to the atlas texture won't trigger the conversion again */ + + override_bmp = + _cogl_bitmap_new_shared (upload_bmp, + cogl_bitmap_get_format (upload_bmp) & + ~COGL_PREMULT_BIT, + cogl_bitmap_get_width (upload_bmp), + cogl_bitmap_get_height (upload_bmp), + cogl_bitmap_get_rowstride (upload_bmp)); + + cogl_object_unref (upload_bmp); + + return override_bmp; +} + +static CoglBool +_cogl_atlas_texture_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + if (level != 0 && atlas_tex->atlas) + _cogl_atlas_texture_migrate_out_of_atlas (atlas_tex); + + /* If the texture is in the atlas then we need to copy the edge + pixels to the border */ + if (atlas_tex->atlas) + { + CoglBool ret; + CoglBitmap *upload_bmp = + _cogl_atlas_texture_convert_bitmap_for_upload (atlas_tex, + bmp, + atlas_tex->internal_format, + FALSE, /* can't convert + in place */ + error); + if (!upload_bmp) + return FALSE; + + /* Upload the data ignoring the premult bit */ + ret = _cogl_atlas_texture_set_region_with_border (atlas_tex, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + upload_bmp, + error); + + cogl_object_unref (upload_bmp); + + return ret; + } + else + /* Otherwise we can just forward on to the sub texture */ + return _cogl_texture_set_region_from_bitmap (atlas_tex->sub_texture, + src_x, src_y, + dst_width, dst_height, + bmp, + dst_x, dst_y, + level, + error); +} + +static CoglPixelFormat +_cogl_atlas_texture_get_format (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* We don't want to forward this on the sub-texture because it isn't + the necessarily the same format. This will happen if the texture + isn't pre-multiplied */ + return atlas_tex->internal_format; +} + +static GLenum +_cogl_atlas_texture_get_gl_format (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return _cogl_texture_gl_get_format (atlas_tex->sub_texture); +} + +static CoglBool +_cogl_atlas_texture_can_use_format (CoglPixelFormat format) +{ + /* We don't care about the ordering or the premult status and we can + accept RGBA or RGB textures. Although we could also accept + luminance and alpha only textures or 16-bit formats it seems that + if the application is explicitly using these formats then they've + got a reason to want the lower memory requirements so putting + them in the atlas might not be a good idea */ + format &= ~(COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT); + return (format == COGL_PIXEL_FORMAT_RGB_888 || + format == COGL_PIXEL_FORMAT_RGBA_8888); +} + +static CoglAtlasTexture * +_cogl_atlas_texture_create_base (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + CoglTextureLoader *loader) +{ + CoglAtlasTexture *atlas_tex; + + COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height); + + /* We need to allocate the texture now because we need the pointer + to set as the data for the rectangle in the atlas */ + atlas_tex = g_new0 (CoglAtlasTexture, 1); + /* Mark it as having no atlas so we don't try to unref it in + _cogl_atlas_texture_post_reorganize_cb */ + atlas_tex->atlas = NULL; + + _cogl_texture_init (COGL_TEXTURE (atlas_tex), + ctx, + width, height, + internal_format, + loader, + &cogl_atlas_texture_vtable); + + atlas_tex->sub_texture = NULL; + + atlas_tex->atlas = NULL; + + return _cogl_atlas_texture_object_new (atlas_tex); +} + +CoglAtlasTexture * +cogl_atlas_texture_new_with_size (CoglContext *ctx, + int width, + int height) +{ + CoglTextureLoader *loader; + + /* We can't atlas zero-sized textures because it breaks the atlas + * data structure */ + _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; + loader->src.sized.width = width; + loader->src.sized.height = height; + + return _cogl_atlas_texture_create_base (ctx, width, height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + loader); +} + +static CoglBool +allocate_space (CoglAtlasTexture *atlas_tex, + int width, + int height, + CoglPixelFormat internal_format, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (atlas_tex); + CoglContext *ctx = tex->context; + CoglAtlas *atlas; + GSList *l; + + /* If the texture is in a strange format then we won't use it */ + if (!_cogl_atlas_texture_can_use_format (internal_format)) + { + COGL_NOTE (ATLAS, "Texture can not be added because the " + "format is unsupported"); + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_FORMAT, + "Texture format unsuitable for atlasing"); + return FALSE; + } + + /* If we can't use FBOs then it will be too slow to migrate textures + and we shouldn't use the atlas */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Atlasing disabled because migrations " + "would be too slow"); + return FALSE; + } + + /* Look for an existing atlas that can hold the texture */ + for (l = ctx->atlases; l; l = l->next) + { + /* We need to take a reference on the atlas before trying to + * reserve space because in some circumstances atlas migration + * can cause the atlas to be freed */ + atlas = cogl_object_ref (l->data); + /* Try to make some space in the atlas for the texture */ + if (_cogl_atlas_reserve_space (atlas, + /* Add two pixels for the border */ + width + 2, height + 2, + atlas_tex)) + { + /* keep the atlas reference */ + break; + } + else + { + cogl_object_unref (atlas); + } + } + + /* If we couldn't find a suitable atlas then start another */ + if (l == NULL) + { + atlas = _cogl_atlas_texture_create_atlas (ctx); + COGL_NOTE (ATLAS, "Created new atlas for textures: %p", atlas); + if (!_cogl_atlas_reserve_space (atlas, + /* Add two pixels for the border */ + width + 2, height + 2, + atlas_tex)) + { + /* Ok, this means we really can't add it to the atlas */ + cogl_object_unref (atlas); + + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY, + "Not enough memory to atlas texture"); + return FALSE; + } + } + + atlas_tex->internal_format = internal_format; + + atlas_tex->atlas = atlas; + + return TRUE; +} + +static CoglBool +allocate_with_size (CoglAtlasTexture *atlas_tex, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (atlas_tex); + CoglPixelFormat internal_format = + _cogl_texture_determine_internal_format (tex, COGL_PIXEL_FORMAT_ANY); + + if (allocate_space (atlas_tex, + loader->src.sized.width, + loader->src.sized.height, + internal_format, + error)) + { + _cogl_texture_set_allocated (COGL_TEXTURE (atlas_tex), + internal_format, + loader->src.sized.width, + loader->src.sized.height); + return TRUE; + } + else + return FALSE; +} + +static CoglBool +allocate_from_bitmap (CoglAtlasTexture *atlas_tex, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (atlas_tex); + CoglBitmap *bmp = loader->src.bitmap.bitmap; + CoglPixelFormat bmp_format = cogl_bitmap_get_format (bmp); + int width = cogl_bitmap_get_width (bmp); + int height = cogl_bitmap_get_height (bmp); + CoglBool can_convert_in_place = loader->src.bitmap.can_convert_in_place; + CoglPixelFormat internal_format; + CoglBitmap *upload_bmp; + + _COGL_RETURN_VAL_IF_FAIL (atlas_tex->atlas == NULL, FALSE); + + internal_format = _cogl_texture_determine_internal_format (tex, bmp_format); + + upload_bmp = + _cogl_atlas_texture_convert_bitmap_for_upload (atlas_tex, + bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return FALSE; + + if (!allocate_space (atlas_tex, + width, + height, + internal_format, + error)) + { + cogl_object_unref (upload_bmp); + return FALSE; + } + + /* Defer to set_region so that we can share the code for copying the + edge pixels to the border. */ + if (!_cogl_atlas_texture_set_region_with_border (atlas_tex, + 0, /* src_x */ + 0, /* src_y */ + 0, /* dst_x */ + 0, /* dst_y */ + width, /* dst_width */ + height, /* dst_height */ + upload_bmp, + error)) + { + _cogl_atlas_texture_remove_from_atlas (atlas_tex); + cogl_object_unref (upload_bmp); + return FALSE; + } + + cogl_object_unref (upload_bmp); + + _cogl_texture_set_allocated (tex, internal_format, width, height); + + return TRUE; +} + +static CoglBool +_cogl_atlas_texture_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + CoglTextureLoader *loader = tex->loader; + + _COGL_RETURN_VAL_IF_FAIL (loader, FALSE); + + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + return allocate_with_size (atlas_tex, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + return allocate_from_bitmap (atlas_tex, loader, error); + default: + break; + } + + g_return_val_if_reached (FALSE); +} + +CoglAtlasTexture * +_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, + CoglBool can_convert_in_place) +{ + CoglTextureLoader *loader; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; + loader->src.bitmap.bitmap = cogl_object_ref (bmp); + loader->src.bitmap.can_convert_in_place = can_convert_in_place; + + return _cogl_atlas_texture_create_base (_cogl_bitmap_get_context (bmp), + cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + cogl_bitmap_get_format (bmp), + loader); +} + +CoglAtlasTexture * +cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp) +{ + return _cogl_atlas_texture_new_from_bitmap (bmp, FALSE); +} + +CoglAtlasTexture * +cogl_atlas_texture_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error) +{ + CoglBitmap *bmp; + CoglAtlasTexture *atlas_tex; + + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + /* Wrap the data into a bitmap */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + atlas_tex = cogl_atlas_texture_new_from_bitmap (bmp); + + cogl_object_unref (bmp); + + if (atlas_tex && + !cogl_texture_allocate (COGL_TEXTURE (atlas_tex), error)) + { + cogl_object_unref (atlas_tex); + return NULL; + } + + return atlas_tex; +} + +CoglAtlasTexture * +cogl_atlas_texture_new_from_file (CoglContext *ctx, + const char *filename, + CoglError **error) +{ + CoglBitmap *bmp; + CoglAtlasTexture *atlas_tex = NULL; + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + bmp = cogl_bitmap_new_from_file (filename, error); + if (bmp == NULL) + return NULL; + + atlas_tex = _cogl_atlas_texture_new_from_bitmap (bmp, + TRUE); /* convert in-place */ + + cogl_object_unref (bmp); + + return atlas_tex; +} + +void +_cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx, + GHookFunc callback, + void *user_data) +{ + GHook *hook = g_hook_alloc (&ctx->atlas_reorganize_callbacks); + hook->func = callback; + hook->data = user_data; + g_hook_prepend (&ctx->atlas_reorganize_callbacks, hook); +} + +void +_cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx, + GHookFunc callback, + void *user_data) +{ + GHook *hook = g_hook_find_func_data (&ctx->atlas_reorganize_callbacks, + FALSE, + callback, + user_data); + + if (hook) + g_hook_destroy_link (&ctx->atlas_reorganize_callbacks, hook); +} + +static CoglTextureType +_cogl_atlas_texture_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_2D; +} + +static const CoglTextureVtable +cogl_atlas_texture_vtable = + { + FALSE, /* not primitive */ + _cogl_atlas_texture_allocate, + _cogl_atlas_texture_set_region, + NULL, /* get_data */ + _cogl_atlas_texture_foreach_sub_texture_in_region, + _cogl_atlas_texture_get_max_waste, + _cogl_atlas_texture_is_sliced, + _cogl_atlas_texture_can_hardware_repeat, + _cogl_atlas_texture_transform_coords_to_gl, + _cogl_atlas_texture_transform_quad_coords_to_gl, + _cogl_atlas_texture_get_gl_texture, + _cogl_atlas_texture_gl_flush_legacy_texobj_filters, + _cogl_atlas_texture_pre_paint, + _cogl_atlas_texture_ensure_non_quad_rendering, + _cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes, + _cogl_atlas_texture_get_format, + _cogl_atlas_texture_get_gl_format, + _cogl_atlas_texture_get_type, + NULL, /* is_foreign */ + NULL /* set_auto_mipmap */ + }; diff --git a/cogl/cogl-atlas-texture.h b/cogl/cogl-atlas-texture.h new file mode 100644 index 0000000..79c15b9 --- /dev/null +++ b/cogl/cogl-atlas-texture.h @@ -0,0 +1,258 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef _COGL_ATLAS_TEXTURE_H_ +#define _COGL_ATLAS_TEXTURE_H_ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-atlas-texture + * @short_description: Functions for managing textures in Cogl's global + * set of texture atlases + * + * A texture atlas is a texture that contains many smaller images that + * an application is interested in. These are packed together as a way + * of optimizing drawing with those images by avoiding the costs of + * repeatedly telling the hardware to change what texture it should + * sample from. This can enable more geometry to be batched together + * into few draw calls. + * + * Each #CoglContext has an shared, pool of texture atlases that are + * are managed by Cogl. + * + * This api lets applications upload texture data into one of Cogl's + * shared texture atlases using a high-level #CoglAtlasTexture which + * represents a sub-region of one of these atlases. + * + * A #CoglAtlasTexture is a high-level meta texture which has + * some limitations to be aware of. Please see the documentation for + * #CoglMetaTexture for more details. + */ + + +typedef struct _CoglAtlasTexture CoglAtlasTexture; +#define COGL_ATLAS_TEXTURE(tex) ((CoglAtlasTexture *) tex) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_atlas_texture_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_atlas_texture_get_gtype (void); +#endif + +/** + * cogl_atlas_texture_new_with_size: + * @ctx: A #CoglContext + * @width: The width of your atlased texture. + * @height: The height of your atlased texture. + * + * Creates a #CoglAtlasTexture with a given @width and @height. A + * #CoglAtlasTexture represents a sub-region within one of Cogl's + * shared texture atlases. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or let Cogl automatically allocate + * storage lazily. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Allocate call can fail if Cogl considers the internal + * format to be incompatible with the format of its internal + * atlases. + * + * The returned #CoglAtlasTexture is a high-level meta-texture + * with some limitations. See the documentation for #CoglMetaTexture + * for more details. + * + * Returns: (transfer full): A new #CoglAtlasTexture object. + * Since: 1.16 + * Stability: unstable + */ +CoglAtlasTexture * +cogl_atlas_texture_new_with_size (CoglContext *ctx, + int width, + int height); + +/** + * cogl_atlas_texture_new_from_file: + * @ctx: A #CoglContext + * @filename: the file to load + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a #CoglAtlasTexture from an image file. A #CoglAtlasTexture + * represents a sub-region within one of Cogl's shared texture + * atlases. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or let Cogl automatically allocate + * storage lazily. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Allocate call can fail if Cogl considers the internal + * format to be incompatible with the format of its internal + * atlases. + * + * The returned #CoglAtlasTexture is a high-level meta-texture + * with some limitations. See the documentation for #CoglMetaTexture + * for more details. + * + * Return value: (transfer full): A new #CoglAtlasTexture object or + * %NULL on failure and @error will be updated. + * Since: 1.16 + * Stability: unstable + */ +CoglAtlasTexture * +cogl_atlas_texture_new_from_file (CoglContext *ctx, + const char *filename, + CoglError **error); + +/** + * cogl_atlas_texture_new_from_data: + * @ctx: A #CoglContext + * @width: width of texture in pixels + * @height: height of texture in pixels + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @rowstride: the memory offset in bytes between the start of each + * row in @data. A value of 0 will make Cogl automatically + * calculate @rowstride from @width and @format. + * @data: pointer to the memory region where the source buffer resides + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a new #CoglAtlasTexture texture based on data residing in + * memory. A #CoglAtlasTexture represents a sub-region within one of + * Cogl's shared texture atlases. + * + * This api will always immediately allocate GPU memory for the + * texture and upload the given data so that the @data pointer does + * not need to remain valid once this function returns. This means it + * is not possible to configure the texture before it is allocated. If + * you do need to configure the texture before allocation (to specify + * constraints on the internal format for example) then you can + * instead create a #CoglBitmap for your data and use + * cogl_atlas_texture_new_from_bitmap() or use + * cogl_atlas_texture_new_with_size() and then upload data using + * cogl_texture_set_data() + * + * Allocate call can fail if Cogl considers the internal + * format to be incompatible with the format of its internal + * atlases. + * + * The returned #CoglAtlasTexture is a high-level + * meta-texture with some limitations. See the documentation for + * #CoglMetaTexture for more details. + * + * Return value: (transfer full): A new #CoglAtlasTexture object or + * %NULL on failure and @error will be updated. + * Since: 1.16 + * Stability: unstable + */ +CoglAtlasTexture * +cogl_atlas_texture_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error); + +/** + * cogl_atlas_texture_new_from_bitmap: + * @bitmap: A #CoglBitmap + * + * Creates a new #CoglAtlasTexture texture based on data residing in a + * @bitmap. A #CoglAtlasTexture represents a sub-region within one of + * Cogl's shared texture atlases. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is being used and can optimize how it is allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Allocate call can fail if Cogl considers the internal + * format to be incompatible with the format of its internal + * atlases. + * + * The returned #CoglAtlasTexture is a high-level meta-texture + * with some limitations. See the documentation for #CoglMetaTexture + * for more details. + * + * Returns: (transfer full): A new #CoglAtlasTexture object. + * Since: 1.16 + * Stability: unstable + */ +CoglAtlasTexture * +cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp); + +/** + * cogl_is_atlas_texture: + * @object: a #CoglObject + * + * Checks whether the given object references a #CoglAtlasTexture + * + * Return value: %TRUE if the passed object represents an atlas + * texture and %FALSE otherwise + * + * Since: 1.16 + * Stability: Unstable + */ +CoglBool +cogl_is_atlas_texture (void *object); + +COGL_END_DECLS + +#endif /* _COGL_ATLAS_TEXTURE_H_ */ diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c new file mode 100644 index 0000000..b7e5679 --- /dev/null +++ b/cogl/cogl-atlas.c @@ -0,0 +1,690 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-atlas.h" +#include "cogl-rectangle-map.h" +#include "cogl-context-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-2d-sliced.h" +#include "cogl-texture-driver.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-debug.h" +#include "cogl-framebuffer-private.h" +#include "cogl-blit.h" +#include "cogl-private.h" + +#include + +static void _cogl_atlas_free (CoglAtlas *atlas); + +COGL_OBJECT_INTERNAL_DEFINE (Atlas, atlas); + +CoglAtlas * +_cogl_atlas_new (CoglPixelFormat texture_format, + CoglAtlasFlags flags, + CoglAtlasUpdatePositionCallback update_position_cb) +{ + CoglAtlas *atlas = g_new (CoglAtlas, 1); + + atlas->update_position_cb = update_position_cb; + atlas->map = NULL; + atlas->texture = NULL; + atlas->flags = flags; + atlas->texture_format = texture_format; + g_hook_list_init (&atlas->pre_reorganize_callbacks, sizeof (GHook)); + g_hook_list_init (&atlas->post_reorganize_callbacks, sizeof (GHook)); + + return _cogl_atlas_object_new (atlas); +} + +static void +_cogl_atlas_free (CoglAtlas *atlas) +{ + COGL_NOTE (ATLAS, "%p: Atlas destroyed", atlas); + + if (atlas->texture) + cogl_object_unref (atlas->texture); + if (atlas->map) + _cogl_rectangle_map_free (atlas->map); + + g_hook_list_clear (&atlas->pre_reorganize_callbacks); + g_hook_list_clear (&atlas->post_reorganize_callbacks); + + g_free (atlas); +} + +typedef struct _CoglAtlasRepositionData +{ + /* The current user data for this texture */ + void *user_data; + /* The old and new positions of the texture */ + CoglRectangleMapEntry old_position; + CoglRectangleMapEntry new_position; +} CoglAtlasRepositionData; + +static void +_cogl_atlas_migrate (CoglAtlas *atlas, + unsigned int n_textures, + CoglAtlasRepositionData *textures, + CoglTexture *old_texture, + CoglTexture *new_texture, + void *skip_user_data) +{ + unsigned int i; + CoglBlitData blit_data; + + /* If the 'disable migrate' flag is set then we won't actually copy + the textures to their new location. Instead we'll just invoke the + callback to update the position */ + if ((atlas->flags & COGL_ATLAS_DISABLE_MIGRATION)) + for (i = 0; i < n_textures; i++) + /* Update the texture position */ + atlas->update_position_cb (textures[i].user_data, + new_texture, + &textures[i].new_position); + else + { + _cogl_blit_begin (&blit_data, new_texture, old_texture); + + for (i = 0; i < n_textures; i++) + { + /* Skip the texture that is being added because it doesn't contain + any data yet */ + if (textures[i].user_data != skip_user_data) + _cogl_blit (&blit_data, + textures[i].old_position.x, + textures[i].old_position.y, + textures[i].new_position.x, + textures[i].new_position.y, + textures[i].new_position.width, + textures[i].new_position.height); + + /* Update the texture position */ + atlas->update_position_cb (textures[i].user_data, + new_texture, + &textures[i].new_position); + } + + _cogl_blit_end (&blit_data); + } +} + +typedef struct _CoglAtlasGetRectanglesData +{ + CoglAtlasRepositionData *textures; + /* Number of textures found so far */ + unsigned int n_textures; +} CoglAtlasGetRectanglesData; + +static void +_cogl_atlas_get_rectangles_cb (const CoglRectangleMapEntry *rectangle, + void *rect_data, + void *user_data) +{ + CoglAtlasGetRectanglesData *data = user_data; + + data->textures[data->n_textures].old_position = *rectangle; + data->textures[data->n_textures++].user_data = rect_data; +} + +static void +_cogl_atlas_get_next_size (unsigned int *map_width, + unsigned int *map_height) +{ + /* Double the size of the texture by increasing whichever dimension + is smaller */ + if (*map_width < *map_height) + *map_width <<= 1; + else + *map_height <<= 1; +} + +static void +_cogl_atlas_get_initial_size (CoglPixelFormat format, + unsigned int *map_width, + unsigned int *map_height) +{ + unsigned int size; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + &gl_intformat, + &gl_format, + &gl_type); + + /* At least on Intel hardware, the texture size will be rounded up + to at least 1MB so we might as well try to aim for that as an + initial minimum size. If the format is only 1 byte per pixel we + can use 1024x1024, otherwise we'll assume it will take 4 bytes + per pixel and use 512x512. */ + if (_cogl_pixel_format_get_bytes_per_pixel (format) == 1) + size = 1024; + else + size = 512; + + /* Some platforms might not support this large size so we'll + decrease the size until it can */ + while (size > 1 && + !ctx->texture_driver->size_supported (ctx, + GL_TEXTURE_2D, + gl_intformat, + gl_format, + gl_type, + size, size)) + size >>= 1; + + *map_width = size; + *map_height = size; +} + +static CoglRectangleMap * +_cogl_atlas_create_map (CoglPixelFormat format, + unsigned int map_width, + unsigned int map_height, + unsigned int n_textures, + CoglAtlasRepositionData *textures) +{ + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, NULL); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + &gl_intformat, + &gl_format, + &gl_type); + + /* Keep trying increasingly larger atlases until we can fit all of + the textures */ + while (ctx->texture_driver->size_supported (ctx, + GL_TEXTURE_2D, + gl_intformat, + gl_format, + gl_type, + map_width, map_height)) + { + CoglRectangleMap *new_atlas = _cogl_rectangle_map_new (map_width, + map_height, + NULL); + unsigned int i; + + COGL_NOTE (ATLAS, "Trying to resize the atlas to %ux%u", + map_width, map_height); + + /* Add all of the textures and keep track of the new position */ + for (i = 0; i < n_textures; i++) + if (!_cogl_rectangle_map_add (new_atlas, + textures[i].old_position.width, + textures[i].old_position.height, + textures[i].user_data, + &textures[i].new_position)) + break; + + /* If the atlas can contain all of the textures then we have a + winner */ + if (i >= n_textures) + return new_atlas; + else + COGL_NOTE (ATLAS, "Atlas size abandoned after trying " + "%u out of %u textures", + i, n_textures); + + _cogl_rectangle_map_free (new_atlas); + _cogl_atlas_get_next_size (&map_width, &map_height); + } + + /* If we get here then there's no atlas that can accommodate all of + the rectangles */ + + return NULL; +} + +static CoglTexture2D * +_cogl_atlas_create_texture (CoglAtlas *atlas, + int width, + int height) +{ + CoglTexture2D *tex; + CoglError *ignore_error = NULL; + + _COGL_GET_CONTEXT (ctx, NULL); + + if ((atlas->flags & COGL_ATLAS_CLEAR_TEXTURE)) + { + uint8_t *clear_data; + CoglBitmap *clear_bmp; + int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format); + + /* Create a buffer of zeroes to initially clear the texture */ + clear_data = g_malloc0 (width * height * bpp); + clear_bmp = cogl_bitmap_new_for_data (ctx, + width, + height, + atlas->texture_format, + width * bpp, + clear_data); + + tex = cogl_texture_2d_new_from_bitmap (clear_bmp); + + _cogl_texture_set_internal_format (COGL_TEXTURE (tex), + atlas->texture_format); + + if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error)) + { + cogl_error_free (ignore_error); + cogl_object_unref (tex); + tex = NULL; + } + + cogl_object_unref (clear_bmp); + + g_free (clear_data); + } + else + { + tex = cogl_texture_2d_new_with_size (ctx, width, height); + + _cogl_texture_set_internal_format (COGL_TEXTURE (tex), + atlas->texture_format); + + if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error)) + { + cogl_error_free (ignore_error); + cogl_object_unref (tex); + tex = NULL; + } + } + + return tex; +} + +static int +_cogl_atlas_compare_size_cb (const void *a, + const void *b) +{ + const CoglAtlasRepositionData *ta = a; + const CoglAtlasRepositionData *tb = b; + unsigned int a_size, b_size; + + a_size = ta->old_position.width * ta->old_position.height; + b_size = tb->old_position.width * tb->old_position.height; + + return a_size < b_size ? 1 : a_size > b_size ? -1 : 0; +} + +static void +_cogl_atlas_notify_pre_reorganize (CoglAtlas *atlas) +{ + g_hook_list_invoke (&atlas->pre_reorganize_callbacks, FALSE); +} + +static void +_cogl_atlas_notify_post_reorganize (CoglAtlas *atlas) +{ + g_hook_list_invoke (&atlas->post_reorganize_callbacks, FALSE); +} + +CoglBool +_cogl_atlas_reserve_space (CoglAtlas *atlas, + unsigned int width, + unsigned int height, + void *user_data) +{ + CoglAtlasGetRectanglesData data; + CoglRectangleMap *new_map; + CoglTexture2D *new_tex; + unsigned int map_width, map_height; + CoglBool ret; + CoglRectangleMapEntry new_position; + + /* Check if we can fit the rectangle into the existing map */ + if (atlas->map && + _cogl_rectangle_map_add (atlas->map, width, height, + user_data, + &new_position)) + { + COGL_NOTE (ATLAS, "%p: Atlas is %ix%i, has %i textures and is %i%% waste", + atlas, + _cogl_rectangle_map_get_width (atlas->map), + _cogl_rectangle_map_get_height (atlas->map), + _cogl_rectangle_map_get_n_rectangles (atlas->map), + /* waste as a percentage */ + _cogl_rectangle_map_get_remaining_space (atlas->map) * + 100 / (_cogl_rectangle_map_get_width (atlas->map) * + _cogl_rectangle_map_get_height (atlas->map))); + + atlas->update_position_cb (user_data, + atlas->texture, + &new_position); + + return TRUE; + } + + /* If we make it here then we need to reorganize the atlas. First + we'll notify any users of the atlas that this is going to happen + so that for example in CoglAtlasTexture it can notify that the + storage has changed and cause a flush */ + _cogl_atlas_notify_pre_reorganize (atlas); + + /* Get an array of all the textures currently in the atlas. */ + data.n_textures = 0; + if (atlas->map == NULL) + data.textures = g_malloc (sizeof (CoglAtlasRepositionData)); + else + { + unsigned int n_rectangles = + _cogl_rectangle_map_get_n_rectangles (atlas->map); + data.textures = g_malloc (sizeof (CoglAtlasRepositionData) * + (n_rectangles + 1)); + _cogl_rectangle_map_foreach (atlas->map, + _cogl_atlas_get_rectangles_cb, + &data); + } + + /* Add the new rectangle as a dummy texture so that it can be + positioned with the rest */ + data.textures[data.n_textures].old_position.x = 0; + data.textures[data.n_textures].old_position.y = 0; + data.textures[data.n_textures].old_position.width = width; + data.textures[data.n_textures].old_position.height = height; + data.textures[data.n_textures++].user_data = user_data; + + /* The atlasing algorithm works a lot better if the rectangles are + added in decreasing order of size so we'll first sort the + array */ + qsort (data.textures, data.n_textures, + sizeof (CoglAtlasRepositionData), + _cogl_atlas_compare_size_cb); + + /* Try to create a new atlas that can contain all of the textures */ + if (atlas->map) + { + map_width = _cogl_rectangle_map_get_width (atlas->map); + map_height = _cogl_rectangle_map_get_height (atlas->map); + + /* If there is enough space in for the new rectangle in the + existing atlas with at least 6% waste we'll start with the + same size, otherwise we'll immediately double it */ + if ((map_width * map_height - + _cogl_rectangle_map_get_remaining_space (atlas->map) + + width * height) * 53 / 50 > + map_width * map_height) + _cogl_atlas_get_next_size (&map_width, &map_height); + } + else + _cogl_atlas_get_initial_size (atlas->texture_format, + &map_width, &map_height); + + new_map = _cogl_atlas_create_map (atlas->texture_format, + map_width, map_height, + data.n_textures, data.textures); + + /* If we can't create a map with the texture then give up */ + if (new_map == NULL) + { + COGL_NOTE (ATLAS, "%p: Could not fit texture in the atlas", atlas); + ret = FALSE; + } + /* We need to migrate the existing textures into a new texture */ + else if ((new_tex = _cogl_atlas_create_texture + (atlas, + _cogl_rectangle_map_get_width (new_map), + _cogl_rectangle_map_get_height (new_map))) == NULL) + { + COGL_NOTE (ATLAS, "%p: Could not create a CoglTexture2D", atlas); + _cogl_rectangle_map_free (new_map); + ret = FALSE; + } + else + { + int waste; + + COGL_NOTE (ATLAS, + "%p: Atlas %s with size %ix%i", + atlas, + atlas->map == NULL || + _cogl_rectangle_map_get_width (atlas->map) != + _cogl_rectangle_map_get_width (new_map) || + _cogl_rectangle_map_get_height (atlas->map) != + _cogl_rectangle_map_get_height (new_map) ? + "resized" : "reorganized", + _cogl_rectangle_map_get_width (new_map), + _cogl_rectangle_map_get_height (new_map)); + + if (atlas->map) + { + /* Move all the textures to the right position in the new + texture. This will also update the texture's rectangle */ + _cogl_atlas_migrate (atlas, + data.n_textures, + data.textures, + atlas->texture, + COGL_TEXTURE (new_tex), + user_data); + _cogl_rectangle_map_free (atlas->map); + cogl_object_unref (atlas->texture); + } + else + /* We know there's only one texture so we can just directly + update the rectangle from its new position */ + atlas->update_position_cb (data.textures[0].user_data, + COGL_TEXTURE (new_tex), + &data.textures[0].new_position); + + atlas->map = new_map; + atlas->texture = COGL_TEXTURE (new_tex); + + waste = (_cogl_rectangle_map_get_remaining_space (atlas->map) * + 100 / (_cogl_rectangle_map_get_width (atlas->map) * + _cogl_rectangle_map_get_height (atlas->map))); + + COGL_NOTE (ATLAS, "%p: Atlas is %ix%i, has %i textures and is %i%% waste", + atlas, + _cogl_rectangle_map_get_width (atlas->map), + _cogl_rectangle_map_get_height (atlas->map), + _cogl_rectangle_map_get_n_rectangles (atlas->map), + waste); + + ret = TRUE; + } + + g_free (data.textures); + + _cogl_atlas_notify_post_reorganize (atlas); + + return ret; +} + +void +_cogl_atlas_remove (CoglAtlas *atlas, + const CoglRectangleMapEntry *rectangle) +{ + _cogl_rectangle_map_remove (atlas->map, rectangle); + + COGL_NOTE (ATLAS, "%p: Removed rectangle sized %ix%i", + atlas, + rectangle->width, + rectangle->height); + COGL_NOTE (ATLAS, "%p: Atlas is %ix%i, has %i textures and is %i%% waste", + atlas, + _cogl_rectangle_map_get_width (atlas->map), + _cogl_rectangle_map_get_height (atlas->map), + _cogl_rectangle_map_get_n_rectangles (atlas->map), + _cogl_rectangle_map_get_remaining_space (atlas->map) * + 100 / (_cogl_rectangle_map_get_width (atlas->map) * + _cogl_rectangle_map_get_height (atlas->map))); +}; + +static CoglTexture * +create_migration_texture (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + CoglError *skip_error = NULL; + + if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) || + (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + /* First try creating a fast-path non-sliced texture */ + tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, + width, height)); + + _cogl_texture_set_internal_format (tex, internal_format); + + /* TODO: instead of allocating storage here it would be better + * if we had some api that let us just check that the size is + * supported by the hardware so storage could be allocated + * lazily when uploading data. */ + if (!cogl_texture_allocate (tex, &skip_error)) + { + cogl_error_free (skip_error); + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + CoglTexture2DSliced *tex_2ds = + cogl_texture_2d_sliced_new_with_size (ctx, + width, + height, + COGL_TEXTURE_MAX_WASTE); + + _cogl_texture_set_internal_format (COGL_TEXTURE (tex_2ds), + internal_format); + + tex = COGL_TEXTURE (tex_2ds); + } + + return tex; +} + +CoglTexture * +_cogl_atlas_copy_rectangle (CoglAtlas *atlas, + int x, + int y, + int width, + int height, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + CoglBlitData blit_data; + CoglError *ignore_error = NULL; + + _COGL_GET_CONTEXT (ctx, NULL); + + /* Create a new texture at the right size */ + tex = create_migration_texture (ctx, width, height, internal_format); + if (!cogl_texture_allocate (tex, &ignore_error)) + { + cogl_error_free (ignore_error); + cogl_object_unref (tex); + return NULL; + } + + /* Blit the data out of the atlas to the new texture. If FBOs + aren't available this will end up having to copy the entire + atlas texture */ + _cogl_blit_begin (&blit_data, tex, atlas->texture); + _cogl_blit (&blit_data, + x, y, + 0, 0, + width, height); + _cogl_blit_end (&blit_data); + + return tex; +} + +void +_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas, + GHookFunc pre_callback, + GHookFunc post_callback, + void *user_data) +{ + if (pre_callback) + { + GHook *hook = g_hook_alloc (&atlas->post_reorganize_callbacks); + hook->func = pre_callback; + hook->data = user_data; + g_hook_prepend (&atlas->pre_reorganize_callbacks, hook); + } + if (post_callback) + { + GHook *hook = g_hook_alloc (&atlas->pre_reorganize_callbacks); + hook->func = post_callback; + hook->data = user_data; + g_hook_prepend (&atlas->post_reorganize_callbacks, hook); + } +} + +void +_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas, + GHookFunc pre_callback, + GHookFunc post_callback, + void *user_data) +{ + if (pre_callback) + { + GHook *hook = g_hook_find_func_data (&atlas->pre_reorganize_callbacks, + FALSE, + pre_callback, + user_data); + if (hook) + g_hook_destroy_link (&atlas->pre_reorganize_callbacks, hook); + } + if (post_callback) + { + GHook *hook = g_hook_find_func_data (&atlas->post_reorganize_callbacks, + FALSE, + post_callback, + user_data); + if (hook) + g_hook_destroy_link (&atlas->post_reorganize_callbacks, hook); + } +} diff --git a/cogl/cogl-atlas.h b/cogl/cogl-atlas.h new file mode 100644 index 0000000..e9b3fb0 --- /dev/null +++ b/cogl/cogl-atlas.h @@ -0,0 +1,105 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_ATLAS_H +#define __COGL_ATLAS_H + +#include "cogl-rectangle-map.h" +#include "cogl-object-private.h" +#include "cogl-texture.h" + +typedef void +(* CoglAtlasUpdatePositionCallback) (void *user_data, + CoglTexture *new_texture, + const CoglRectangleMapEntry *rect); + +typedef enum +{ + COGL_ATLAS_CLEAR_TEXTURE = (1 << 0), + COGL_ATLAS_DISABLE_MIGRATION = (1 << 1) +} CoglAtlasFlags; + +typedef struct _CoglAtlas CoglAtlas; + +#define COGL_ATLAS(object) ((CoglAtlas *) object) + +struct _CoglAtlas +{ + CoglObject _parent; + + CoglRectangleMap *map; + + CoglTexture *texture; + CoglPixelFormat texture_format; + CoglAtlasFlags flags; + + CoglAtlasUpdatePositionCallback update_position_cb; + + GHookList pre_reorganize_callbacks; + GHookList post_reorganize_callbacks; +}; + +CoglAtlas * +_cogl_atlas_new (CoglPixelFormat texture_format, + CoglAtlasFlags flags, + CoglAtlasUpdatePositionCallback update_position_cb); + +CoglBool +_cogl_atlas_reserve_space (CoglAtlas *atlas, + unsigned int width, + unsigned int height, + void *user_data); + +void +_cogl_atlas_remove (CoglAtlas *atlas, + const CoglRectangleMapEntry *rectangle); + +CoglTexture * +_cogl_atlas_copy_rectangle (CoglAtlas *atlas, + int x, + int y, + int width, + int height, + CoglPixelFormat format); + +void +_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas, + GHookFunc pre_callback, + GHookFunc post_callback, + void *user_data); + +void +_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas, + GHookFunc pre_callback, + GHookFunc post_callback, + void *user_data); + +CoglBool +_cogl_is_atlas (void *object); + +#endif /* __COGL_ATLAS_H */ diff --git a/cogl/cogl-attribute-buffer-private.h b/cogl/cogl-attribute-buffer-private.h new file mode 100644 index 0000000..c5e8a27 --- /dev/null +++ b/cogl/cogl-attribute-buffer-private.h @@ -0,0 +1,44 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_ATTRIBUTE_BUFFER_PRIVATE_H +#define __COGL_ATTRIBUTE_BUFFER_PRIVATE_H + +#include "cogl-buffer-private.h" + +struct _CoglAttributeBuffer +{ + CoglBuffer _parent; +}; + +#endif /* __COGL_ATTRIBUTE_BUFFER_PRIVATE_H */ diff --git a/cogl/cogl-attribute-buffer.c b/cogl/cogl-attribute-buffer.c new file mode 100644 index 0000000..8d92d29 --- /dev/null +++ b/cogl/cogl-attribute-buffer.c @@ -0,0 +1,104 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object-private.h" +#include "cogl-attribute-buffer.h" +#include "cogl-attribute-buffer-private.h" +#include "cogl-context-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_attribute_buffer_free (CoglAttributeBuffer *array); + +COGL_BUFFER_DEFINE (AttributeBuffer, attribute_buffer); +COGL_GTYPE_DEFINE_CLASS (AttributeBuffer, attribute_buffer); + +CoglAttributeBuffer * +cogl_attribute_buffer_new_with_size (CoglContext *context, + size_t bytes) +{ + CoglAttributeBuffer *buffer = g_slice_new (CoglAttributeBuffer); + + /* parent's constructor */ + _cogl_buffer_initialize (COGL_BUFFER (buffer), + context, + bytes, + COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER, + COGL_BUFFER_USAGE_HINT_ATTRIBUTE_BUFFER, + COGL_BUFFER_UPDATE_HINT_STATIC); + + return _cogl_attribute_buffer_object_new (buffer); +} + +CoglAttributeBuffer * +cogl_attribute_buffer_new (CoglContext *context, + size_t bytes, + const void *data) +{ + CoglAttributeBuffer *buffer; + + buffer = cogl_attribute_buffer_new_with_size (context, bytes); + + /* Note: to keep the common cases simple this API doesn't throw + * CoglErrors, so developers can assume this function never returns + * NULL and we will simply abort on error. + * + * Developers wanting to catch errors can use + * cogl_attribute_buffer_new_with_size() and catch errors when later + * calling cogl_buffer_set_data() or cogl_buffer_map(). + */ + + /* XXX: NB: for Cogl 2.0 we don't allow NULL data here but we can't + * break the api for 1.x and so we keep the check for now. */ + if (data) + _cogl_buffer_set_data (COGL_BUFFER (buffer), + 0, + data, + bytes, + NULL); + + return buffer; +} + +static void +_cogl_attribute_buffer_free (CoglAttributeBuffer *array) +{ + /* parent's destructor */ + _cogl_buffer_fini (COGL_BUFFER (array)); + + g_slice_free (CoglAttributeBuffer, array); +} + diff --git a/cogl/cogl-attribute-buffer.h b/cogl/cogl-attribute-buffer.h new file mode 100644 index 0000000..189d81e --- /dev/null +++ b/cogl/cogl-attribute-buffer.h @@ -0,0 +1,152 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ATTRIBUTE_BUFFER_H__ +#define __COGL_ATTRIBUTE_BUFFER_H__ + +/* We forward declare the CoglAttributeBuffer type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglAttributeBuffer CoglAttributeBuffer; + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-attribute-buffer + * @short_description: Functions for creating and manipulating attribute + * buffers + * + * FIXME + */ + +#define COGL_ATTRIBUTE_BUFFER(buffer) ((CoglAttributeBuffer *)(buffer)) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_attribute_buffer_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_attribute_buffer_get_gtype (void); +#endif + +/** + * cogl_attribute_buffer_new_with_size: + * @context: A #CoglContext + * @bytes: The number of bytes to allocate for vertex attribute data. + * + * Describes a new #CoglAttributeBuffer of @size bytes to contain + * arrays of vertex attribute data. Afterwards data can be set using + * cogl_buffer_set_data() or by mapping it into the application's + * address space using cogl_buffer_map(). + * + * The underlying storage of this buffer isn't allocated by this + * function so that you have an opportunity to use the + * cogl_buffer_set_update_hint() and cogl_buffer_set_usage_hint() + * functions which may influence how the storage is allocated. The + * storage will be allocated once you upload data to the buffer. + * + * Note: You can assume this function always succeeds and won't return + * %NULL + * + * Return value: (transfer full): A newly allocated #CoglAttributeBuffer. Never %NULL. + * + * Stability: Unstable + */ +CoglAttributeBuffer * +cogl_attribute_buffer_new_with_size (CoglContext *context, + size_t bytes); + +/** + * cogl_attribute_buffer_new: + * @context: A #CoglContext + * @bytes: The number of bytes to allocate for vertex attribute data. + * @data: (array length=bytes): An optional pointer to vertex data to + * upload immediately. + * + * Describes a new #CoglAttributeBuffer of @size bytes to contain + * arrays of vertex attribute data and also uploads @size bytes read + * from @data to the new buffer. + * + * You should never pass a %NULL data pointer. + * + * This function does not report out-of-memory errors back to + * the caller by returning %NULL and so you can assume this function + * always succeeds. + * + * In the unlikely case that there is an out of memory problem + * then Cogl will abort the application with a message. If your + * application needs to gracefully handle out-of-memory errors then + * you can use cogl_attribute_buffer_new_with_size() and then + * explicitly catch errors with cogl_buffer_set_data() or + * cogl_buffer_map(). + * + * Return value: (transfer full): A newly allocated #CoglAttributeBuffer (never %NULL) + * + * Since: 1.4 + * Stability: Unstable + */ +CoglAttributeBuffer * +cogl_attribute_buffer_new (CoglContext *context, + size_t bytes, + const void *data); + +/** + * cogl_is_attribute_buffer: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglAttributeBuffer. + * + * Returns: %TRUE if @object references a #CoglAttributeBuffer, + * %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_is_attribute_buffer (void *object); + +COGL_END_DECLS + +#endif /* __COGL_ATTRIBUTE_BUFFER_H__ */ + diff --git a/cogl/cogl-attribute-private.h b/cogl/cogl-attribute-private.h new file mode 100644 index 0000000..aac4a88 --- /dev/null +++ b/cogl/cogl-attribute-private.h @@ -0,0 +1,140 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_ATTRIBUTE_PRIVATE_H +#define __COGL_ATTRIBUTE_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-attribute.h" +#include "cogl-framebuffer.h" +#include "cogl-pipeline-private.h" +#include "cogl-boxed-value.h" + +typedef enum +{ + COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY, + COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY, + COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY, + COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY, + COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY, + COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY +} CoglAttributeNameID; + +typedef struct _CoglAttributeNameState +{ + char *name; + CoglAttributeNameID name_id; + int name_index; + CoglBool normalized_default; + int layer_number; +} CoglAttributeNameState; + +struct _CoglAttribute +{ + CoglObject _parent; + + const CoglAttributeNameState *name_state; + CoglBool normalized; + + CoglBool is_buffered; + + union { + struct { + CoglAttributeBuffer *attribute_buffer; + size_t stride; + size_t offset; + int n_components; + CoglAttributeType type; + } buffered; + struct { + CoglContext *context; + CoglBoxedValue boxed; + } constant; + } d; + + int immutable_ref; +}; + +typedef enum +{ + COGL_DRAW_SKIP_JOURNAL_FLUSH = 1 << 0, + COGL_DRAW_SKIP_PIPELINE_VALIDATION = 1 << 1, + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH = 1 << 2, + COGL_DRAW_SKIP_LEGACY_STATE = 1 << 3, + /* By default the vertex attribute drawing code will assume that if + there is a color attribute array enabled then we can't determine + if the colors will be opaque so we need to enabling + blending. However when drawing from the journal we know what the + contents of the color array is so we can override this by passing + this flag. */ + COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE = 1 << 4, + /* This forcibly disables the debug option to divert all drawing to + * wireframes */ + COGL_DRAW_SKIP_DEBUG_WIREFRAME = 1 << 5 +} CoglDrawFlags; + +/* During CoglContext initialization we register the "cogl_color_in" + * attribute name so it gets a global name_index of 0. We need to know + * the name_index for "cogl_color_in" in + * _cogl_pipeline_flush_gl_state() */ +#define COGL_ATTRIBUTE_COLOR_NAME_INDEX 0 + +CoglAttributeNameState * +_cogl_attribute_register_attribute_name (CoglContext *context, + const char *name); + +CoglAttribute * +_cogl_attribute_immutable_ref (CoglAttribute *attribute); + +void +_cogl_attribute_immutable_unref (CoglAttribute *attribute); + +typedef struct +{ + int unit; + CoglPipelineFlushOptions options; + uint32_t fallback_layers; +} CoglFlushLayerState; + +void +_cogl_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes); + +int +_cogl_attribute_get_n_components (CoglAttribute *attribute); + +#endif /* __COGL_ATTRIBUTE_PRIVATE_H */ + diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c new file mode 100644 index 0000000..bcfbf78 --- /dev/null +++ b/cogl/cogl-attribute.c @@ -0,0 +1,687 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-journal-private.h" +#include "cogl-attribute.h" +#include "cogl-attribute-private.h" +#include "cogl-pipeline.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-texture-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-indices-private.h" +#ifdef COGL_PIPELINE_PROGEND_GLSL +#include "cogl-pipeline-progend-glsl-private.h" +#endif +#include "cogl-private.h" +#include "cogl-gtype-private.h" + +#include +#include +#include + +/* This isn't defined in the GLES headers */ +#ifndef GL_UNSIGNED_INT +#define GL_UNSIGNED_INT 0x1405 +#endif + +static void _cogl_attribute_free (CoglAttribute *attribute); + +COGL_OBJECT_DEFINE (Attribute, attribute); +COGL_GTYPE_DEFINE_CLASS (Attribute, attribute); + +static CoglBool +validate_cogl_attribute_name (const char *name, + char **real_attribute_name, + CoglAttributeNameID *name_id, + CoglBool *normalized, + int *layer_number) +{ + name = name + 5; /* skip "cogl_" */ + + *normalized = FALSE; + *layer_number = 0; + + if (strcmp (name, "position_in") == 0) + *name_id = COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY; + else if (strcmp (name, "color_in") == 0) + { + *name_id = COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY; + *normalized = TRUE; + } + else if (strcmp (name, "tex_coord_in") == 0) + { + *real_attribute_name = "cogl_tex_coord0_in"; + *name_id = COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY; + } + else if (strncmp (name, "tex_coord", strlen ("tex_coord")) == 0) + { + char *endptr; + *layer_number = strtoul (name + 9, &endptr, 10); + if (strcmp (endptr, "_in") != 0) + { + g_warning ("Texture coordinate attributes should either be named " + "\"cogl_tex_coord_in\" or named with a texture unit index " + "like \"cogl_tex_coord2_in\"\n"); + return FALSE; + } + *name_id = COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY; + } + else if (strcmp (name, "normal_in") == 0) + { + *name_id = COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY; + *normalized = TRUE; + } + else if (strcmp (name, "point_size_in") == 0) + *name_id = COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY; + else + { + g_warning ("Unknown cogl_* attribute name cogl_%s\n", name); + return FALSE; + } + + return TRUE; +} + +CoglAttributeNameState * +_cogl_attribute_register_attribute_name (CoglContext *context, + const char *name) +{ + CoglAttributeNameState *name_state = g_new (CoglAttributeNameState, 1); + int name_index = context->n_attribute_names++; + char *name_copy = g_strdup (name); + + name_state->name = NULL; + name_state->name_index = name_index; + if (strncmp (name, "cogl_", 5) == 0) + { + if (!validate_cogl_attribute_name (name, + &name_state->name, + &name_state->name_id, + &name_state->normalized_default, + &name_state->layer_number)) + goto error; + } + else + { + name_state->name_id = COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY; + name_state->normalized_default = FALSE; + name_state->layer_number = 0; + } + + if (name_state->name == NULL) + name_state->name = name_copy; + + g_hash_table_insert (context->attribute_name_states_hash, + name_copy, name_state); + + if (G_UNLIKELY (context->attribute_name_index_map == NULL)) + context->attribute_name_index_map = + g_array_new (FALSE, FALSE, sizeof (void *)); + + g_array_set_size (context->attribute_name_index_map, name_index + 1); + + g_array_index (context->attribute_name_index_map, + CoglAttributeNameState *, name_index) = name_state; + + return name_state; + +error: + g_free (name_state); + return NULL; +} + +static CoglBool +validate_n_components (const CoglAttributeNameState *name_state, + int n_components) +{ + switch (name_state->name_id) + { + case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY: + if (G_UNLIKELY (n_components == 1)) + { + g_critical ("glVertexPointer doesn't allow 1 component vertex " + "positions so we currently only support \"cogl_vertex\" " + "attributes where n_components == 2, 3 or 4"); + return FALSE; + } + break; + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: + if (G_UNLIKELY (n_components != 3 && n_components != 4)) + { + g_critical ("glColorPointer expects 3 or 4 component colors so we " + "currently only support \"cogl_color\" attributes where " + "n_components == 3 or 4"); + return FALSE; + } + break; + case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY: + break; + case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY: + if (G_UNLIKELY (n_components != 3)) + { + g_critical ("glNormalPointer expects 3 component normals so we " + "currently only support \"cogl_normal\" attributes " + "where n_components == 3"); + return FALSE; + } + break; + case COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY: + if (G_UNLIKELY (n_components != 1)) + { + g_critical ("The point size attribute can only have one " + "component"); + return FALSE; + } + break; + case COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY: + return TRUE; + } + + return TRUE; +} + +CoglAttribute * +cogl_attribute_new (CoglAttributeBuffer *attribute_buffer, + const char *name, + size_t stride, + size_t offset, + int n_components, + CoglAttributeType type) +{ + CoglAttribute *attribute = g_slice_new (CoglAttribute); + CoglBuffer *buffer = COGL_BUFFER (attribute_buffer); + CoglContext *ctx = buffer->context; + + attribute->is_buffered = TRUE; + + attribute->name_state = + g_hash_table_lookup (ctx->attribute_name_states_hash, name); + if (!attribute->name_state) + { + CoglAttributeNameState *name_state = + _cogl_attribute_register_attribute_name (ctx, name); + if (!name_state) + goto error; + attribute->name_state = name_state; + } + + attribute->d.buffered.attribute_buffer = cogl_object_ref (attribute_buffer); + attribute->d.buffered.stride = stride; + attribute->d.buffered.offset = offset; + attribute->d.buffered.n_components = n_components; + attribute->d.buffered.type = type; + + attribute->immutable_ref = 0; + + if (attribute->name_state->name_id != COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY) + { + if (!validate_n_components (attribute->name_state, n_components)) + return NULL; + attribute->normalized = + attribute->name_state->normalized_default; + } + else + attribute->normalized = FALSE; + + return _cogl_attribute_object_new (attribute); + +error: + _cogl_attribute_free (attribute); + return NULL; +} + +static CoglAttribute * +_cogl_attribute_new_const (CoglContext *context, + const char *name, + int n_components, + int n_columns, + CoglBool transpose, + const float *value) +{ + CoglAttribute *attribute = g_slice_new (CoglAttribute); + + attribute->name_state = + g_hash_table_lookup (context->attribute_name_states_hash, name); + if (!attribute->name_state) + { + CoglAttributeNameState *name_state = + _cogl_attribute_register_attribute_name (context, name); + if (!name_state) + goto error; + attribute->name_state = name_state; + } + + if (!validate_n_components (attribute->name_state, n_components)) + goto error; + + attribute->is_buffered = FALSE; + attribute->normalized = FALSE; + + attribute->d.constant.context = cogl_object_ref (context); + + attribute->d.constant.boxed.v.array = NULL; + + if (n_columns == 1) + { + _cogl_boxed_value_set_float (&attribute->d.constant.boxed, + n_components, + 1, + value); + } + else + { + /* FIXME: Up until GL[ES] 3 only square matrices were supported + * and we don't currently expose non-square matrices in Cogl. + */ + _COGL_RETURN_VAL_IF_FAIL (n_columns == n_components, NULL); + _cogl_boxed_value_set_matrix (&attribute->d.constant.boxed, + n_columns, + 1, + transpose, + value); + } + + return _cogl_attribute_object_new (attribute); + +error: + _cogl_attribute_free (attribute); + return NULL; +} + +CoglAttribute * +cogl_attribute_new_const_1f (CoglContext *context, + const char *name, + float value) +{ + return _cogl_attribute_new_const (context, + name, + 1, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + &value); +} + +CoglAttribute * +cogl_attribute_new_const_2fv (CoglContext *context, + const char *name, + const float *value) +{ + return _cogl_attribute_new_const (context, + name, + 2, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + value); +} + +CoglAttribute * +cogl_attribute_new_const_3fv (CoglContext *context, + const char *name, + const float *value) +{ + return _cogl_attribute_new_const (context, + name, + 3, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + value); +} + +CoglAttribute * +cogl_attribute_new_const_4fv (CoglContext *context, + const char *name, + const float *value) +{ + return _cogl_attribute_new_const (context, + name, + 4, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + value); +} + +CoglAttribute * +cogl_attribute_new_const_2f (CoglContext *context, + const char *name, + float component0, + float component1) +{ + float vec2[2] = { component0, component1 }; + return _cogl_attribute_new_const (context, + name, + 2, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + vec2); +} + +CoglAttribute * +cogl_attribute_new_const_3f (CoglContext *context, + const char *name, + float component0, + float component1, + float component2) +{ + float vec3[3] = { component0, component1, component2 }; + return _cogl_attribute_new_const (context, + name, + 3, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + vec3); +} + +CoglAttribute * +cogl_attribute_new_const_4f (CoglContext *context, + const char *name, + float component0, + float component1, + float component2, + float component3) +{ + float vec4[4] = { component0, component1, component2, component3 }; + return _cogl_attribute_new_const (context, + name, + 4, /* n_components */ + 1, /* 1 column vector */ + FALSE, /* no transpose */ + vec4); +} + +CoglAttribute * +cogl_attribute_new_const_2x2fv (CoglContext *context, + const char *name, + const float *matrix2x2, + CoglBool transpose) +{ + return _cogl_attribute_new_const (context, + name, + 2, /* n_components */ + 2, /* 2 column vector */ + FALSE, /* no transpose */ + matrix2x2); +} + +CoglAttribute * +cogl_attribute_new_const_3x3fv (CoglContext *context, + const char *name, + const float *matrix3x3, + CoglBool transpose) +{ + return _cogl_attribute_new_const (context, + name, + 3, /* n_components */ + 3, /* 3 column vector */ + FALSE, /* no transpose */ + matrix3x3); +} + +CoglAttribute * +cogl_attribute_new_const_4x4fv (CoglContext *context, + const char *name, + const float *matrix4x4, + CoglBool transpose) +{ + return _cogl_attribute_new_const (context, + name, + 4, /* n_components */ + 4, /* 4 column vector */ + FALSE, /* no transpose */ + matrix4x4); +} + +CoglBool +cogl_attribute_get_normalized (CoglAttribute *attribute) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), FALSE); + + return attribute->normalized; +} + +static void +warn_about_midscene_changes (void) +{ + static CoglBool seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of attributes has " + "undefined results\n"); + seen = TRUE; + } +} + +void +cogl_attribute_set_normalized (CoglAttribute *attribute, + CoglBool normalized) +{ + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute)); + + if (G_UNLIKELY (attribute->immutable_ref)) + warn_about_midscene_changes (); + + attribute->normalized = normalized; +} + +CoglAttributeBuffer * +cogl_attribute_get_buffer (CoglAttribute *attribute) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); + _COGL_RETURN_VAL_IF_FAIL (attribute->is_buffered, NULL); + + return attribute->d.buffered.attribute_buffer; +} + +void +cogl_attribute_set_buffer (CoglAttribute *attribute, + CoglAttributeBuffer *attribute_buffer) +{ + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute)); + _COGL_RETURN_IF_FAIL (attribute->is_buffered); + + if (G_UNLIKELY (attribute->immutable_ref)) + warn_about_midscene_changes (); + + cogl_object_ref (attribute_buffer); + + cogl_object_unref (attribute->d.buffered.attribute_buffer); + attribute->d.buffered.attribute_buffer = attribute_buffer; +} + +CoglAttribute * +_cogl_attribute_immutable_ref (CoglAttribute *attribute) +{ + CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); + + attribute->immutable_ref++; + _cogl_buffer_immutable_ref (buffer); + return attribute; +} + +void +_cogl_attribute_immutable_unref (CoglAttribute *attribute) +{ + CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer); + + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute)); + _COGL_RETURN_IF_FAIL (attribute->immutable_ref > 0); + + attribute->immutable_ref--; + _cogl_buffer_immutable_unref (buffer); +} + +static void +_cogl_attribute_free (CoglAttribute *attribute) +{ + if (attribute->is_buffered) + cogl_object_unref (attribute->d.buffered.attribute_buffer); + else + _cogl_boxed_value_destroy (&attribute->d.constant.boxed); + + g_slice_free (CoglAttribute, attribute); +} + +static CoglBool +validate_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + CoglTexture *texture = + cogl_pipeline_get_layer_texture (pipeline, layer_index); + CoglFlushLayerState *state = user_data; + CoglBool status = TRUE; + + /* invalid textures will be handled correctly in + * _cogl_pipeline_flush_layers_gl_state */ + if (texture == NULL) + goto validated; + + _cogl_texture_flush_journal_rendering (texture); + + /* Give the texture a chance to know that we're rendering + non-quad shaped primitives. If the texture is in an atlas it + will be migrated */ + _cogl_texture_ensure_non_quad_rendering (texture); + + /* We need to ensure the mipmaps are ready before deciding + * anything else about the texture because the texture storate + * could completely change if it needs to be migrated out of the + * atlas and will affect how we validate the layer. + */ + _cogl_pipeline_pre_paint_for_layer (pipeline, layer_index); + + if (!_cogl_texture_can_hardware_repeat (texture)) + { + g_warning ("Disabling layer %d of the current source material, " + "because texturing with the vertex buffer API is not " + "currently supported using sliced textures, or textures " + "with waste\n", layer_index); + + /* XXX: maybe we can add a mechanism for users to forcibly use + * textures with waste where it would be their responsability to use + * texture coords in the range [0,1] such that sampling outside isn't + * required. We can then use a texture matrix (or a modification of + * the users own matrix) to map 1 to the edge of the texture data. + * + * Potentially, given the same guarantee as above we could also + * support a single sliced layer too. We would have to redraw the + * vertices once for each layer, each time with a fiddled texture + * matrix. + */ + state->fallback_layers |= (1 << state->unit); + state->options.flags |= COGL_PIPELINE_FLUSH_FALLBACK_MASK; + } + +validated: + state->unit++; + return status; +} + +void +_cogl_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes) +{ + CoglContext *ctx = framebuffer->context; + CoglFlushLayerState layers_state; + CoglPipeline *copy = NULL; + + if (!(flags & COGL_DRAW_SKIP_JOURNAL_FLUSH)) + _cogl_journal_flush (framebuffer->journal); + + layers_state.unit = 0; + layers_state.options.flags = 0; + layers_state.fallback_layers = 0; + + if (!(flags & COGL_DRAW_SKIP_PIPELINE_VALIDATION)) + cogl_pipeline_foreach_layer (pipeline, + validate_layer_cb, + &layers_state); + + /* NB: _cogl_framebuffer_flush_state may disrupt various state (such + * as the pipeline state) when flushing the clip stack, so should + * always be done first when preparing to draw. We need to do this + * before setting up the array pointers because setting up the clip + * stack can cause some drawing which would change the array + * pointers. */ + if (!(flags & COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH)) + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_ALL); + + /* In cogl_read_pixels we have a fast-path when reading a single + * pixel and the scene is just comprised of simple rectangles still + * in the journal. For this optimization to work we need to track + * when the framebuffer really does get drawn to. */ + _cogl_framebuffer_mark_mid_scene (framebuffer); + _cogl_framebuffer_mark_clear_clip_dirty (framebuffer); + + if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) && + G_UNLIKELY (ctx->legacy_state_set) && + _cogl_get_enable_legacy_state ()) + { + copy = cogl_pipeline_copy (pipeline); + pipeline = copy; + _cogl_pipeline_apply_legacy_state (pipeline); + } + + ctx->driver_vtable->flush_attributes_state (framebuffer, + pipeline, + &layers_state, + flags, + attributes, + n_attributes); + + if (copy) + cogl_object_unref (copy); +} + +int +_cogl_attribute_get_n_components (CoglAttribute *attribute) +{ + if (attribute->is_buffered) + return attribute->d.buffered.n_components; + else + return attribute->d.constant.boxed.size; +} diff --git a/cogl/cogl-attribute.h b/cogl/cogl-attribute.h new file mode 100644 index 0000000..736b0c6 --- /dev/null +++ b/cogl/cogl-attribute.h @@ -0,0 +1,558 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ATTRIBUTE_H__ +#define __COGL_ATTRIBUTE_H__ + +/* We forward declare the CoglAttribute type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglAttribute CoglAttribute; + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-attribute + * @short_description: Functions for declaring and drawing vertex + * attributes + * + * FIXME + */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_attribute_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_attribute_get_gtype (void); +#endif + +/** + * cogl_attribute_new: (constructor) + * @attribute_buffer: The #CoglAttributeBuffer containing the actual + * attribute data + * @name: The name of the attribute (used to reference it from GLSL) + * @stride: The number of bytes to jump to get to the next attribute + * value for the next vertex. (Usually + * sizeof (MyVertex)) + * @offset: The byte offset from the start of @attribute_buffer for + * the first attribute value. (Usually + * offsetof (MyVertex, component0) + * @components: The number of components (e.g. 4 for an rgba color or + * 3 for and (x,y,z) position) + * @type: FIXME + * + * Describes the layout for a list of vertex attribute values (For + * example, a list of texture coordinates or colors). + * + * The @name is used to access the attribute inside a GLSL vertex + * shader and there are some special names you should use if they are + * applicable: + * + * "cogl_position_in" (used for vertex positions) + * "cogl_color_in" (used for vertex colors) + * "cogl_tex_coord0_in", "cogl_tex_coord1", ... + * (used for vertex texture coordinates) + * "cogl_normal_in" (used for vertex normals) + * "cogl_point_size_in" (used to set the size of points + * per-vertex. Note this can only be used if + * %COGL_FEATURE_ID_POINT_SIZE_ATTRIBUTE is advertised and + * cogl_pipeline_set_per_vertex_point_size() is called on the pipeline. + * + * + * + * The attribute values corresponding to different vertices can either + * be tightly packed or interleaved with other attribute values. For + * example it's common to define a structure for a single vertex like: + * |[ + * typedef struct + * { + * float x, y, z; /* position attribute */ + * float s, t; /* texture coordinate attribute */ + * } MyVertex; + * ]| + * + * And then create an array of vertex data something like: + * |[ + * MyVertex vertices[100] = { .... } + * ]| + * + * In this case, to describe either the position or texture coordinate + * attribute you have to move sizeof (MyVertex) bytes to + * move from one vertex to the next. This is called the attribute + * @stride. If you weren't interleving attributes and you instead had + * a packed array of float x, y pairs then the attribute stride would + * be (2 * sizeof (float)). So the @stride is the number of + * bytes to move to find the attribute value of the next vertex. + * + * Normally a list of attributes starts at the beginning of an array. + * So for the MyVertex example above the @offset is the + * offset inside the MyVertex structure to the first + * component of the attribute. For the texture coordinate attribute + * the offset would be offsetof (MyVertex, s) or instead of + * using the offsetof macro you could use sizeof (float) * + * 3. If you've divided your @array into blocks of non-interleved + * attributes then you will need to calculate the @offset as the number of + * bytes in blocks preceding the attribute you're describing. + * + * An attribute often has more than one component. For example a color + * is often comprised of 4 red, green, blue and alpha @components, and a + * position may be comprised of 2 x and y @components. You should aim + * to keep the number of components to a minimum as more components + * means more data needs to be mapped into the GPU which can be a + * bottlneck when dealing with a large number of vertices. + * + * Finally you need to specify the component data type. Here you + * should aim to use the smallest type that meets your precision + * requirements. Again the larger the type then more data needs to be + * mapped into the GPU which can be a bottlneck when dealing with + * a large number of vertices. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * describing the layout for a list of attribute values + * stored in @array. + * + * Since: 1.4 + * Stability: Unstable + */ +/* XXX: look for a precedent to see if the stride/offset args should + * have a different order. */ +CoglAttribute * +cogl_attribute_new (CoglAttributeBuffer *attribute_buffer, + const char *name, + size_t stride, + size_t offset, + int components, + CoglAttributeType type); + +/** + * cogl_attribute_new_const_1f: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @value: The constant value for the attribute + * + * Creates a new, single component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constant @value is a single precision floating point scalar + * which should have a corresponding declaration in GLSL code like: + * + * [| + * attribute float name; + * |] + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant @value. + */ +CoglAttribute * +cogl_attribute_new_const_1f (CoglContext *context, + const char *name, + float value); + +/** + * cogl_attribute_new_const_2f: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @component0: The first component of a 2 component vector + * @component1: The second component of a 2 component vector + * + * Creates a new, 2 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (@component0, @component1) represent a 2 component + * float vector which should have a corresponding declaration in GLSL + * code like: + * + * [| + * attribute vec2 name; + * |] + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_2f (CoglContext *context, + const char *name, + float component0, + float component1); + +/** + * cogl_attribute_new_const_3f: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @component0: The first component of a 3 component vector + * @component1: The second component of a 3 component vector + * @component2: The third component of a 3 component vector + * + * Creates a new, 3 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (@component0, @component1, @component2) represent a 3 + * component float vector which should have a corresponding + * declaration in GLSL code like: + * + * [| + * attribute vec3 name; + * |] + * + * unless the built in name "cogl_normal_in" is being used where no + * explicit GLSL declaration need be made. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_3f (CoglContext *context, + const char *name, + float component0, + float component1, + float component2); + +/** + * cogl_attribute_new_const_4f: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @component0: The first component of a 4 component vector + * @component1: The second component of a 4 component vector + * @component2: The third component of a 4 component vector + * @component3: The fourth component of a 4 component vector + * + * Creates a new, 4 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (@component0, @component1, @component2, @constant3) + * represent a 4 component float vector which should have a + * corresponding declaration in GLSL code like: + * + * [| + * attribute vec4 name; + * |] + * + * unless one of the built in names "cogl_color_in", + * "cogl_tex_coord0_in or "cogl_tex_coord1_in" etc is being used where + * no explicit GLSL declaration need be made. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_4f (CoglContext *context, + const char *name, + float component0, + float component1, + float component2, + float component3); + +/** + * cogl_attribute_new_const_2fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @value: A pointer to a 2 component float vector + * + * Creates a new, 2 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (value[0], value[1]) represent a 2 component float + * vector which should have a corresponding declaration in GLSL code + * like: + * + * [| + * attribute vec2 name; + * |] + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_2fv (CoglContext *context, + const char *name, + const float *value); + +/** + * cogl_attribute_new_const_3fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @value: A pointer to a 3 component float vector + * + * Creates a new, 3 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (value[0], value[1], value[2]) represent a 3 + * component float vector which should have a corresponding + * declaration in GLSL code like: + * + * [| + * attribute vec3 name; + * |] + * + * unless the built in name "cogl_normal_in" is being used where no + * explicit GLSL declaration need be made. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_3fv (CoglContext *context, + const char *name, + const float *value); + +/** + * cogl_attribute_new_const_4fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @value: A pointer to a 4 component float vector + * + * Creates a new, 4 component, attribute whose value remains + * constant across all the vertices of a primitive without needing to + * duplicate the value for each vertex. + * + * The constants (value[0], value[1], value[2], value[3]) represent a + * 4 component float vector which should have a corresponding + * declaration in GLSL code like: + * + * [| + * attribute vec4 name; + * |] + * + * unless one of the built in names "cogl_color_in", + * "cogl_tex_coord0_in or "cogl_tex_coord1_in" etc is being used where + * no explicit GLSL declaration need be made. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant vector. + */ +CoglAttribute * +cogl_attribute_new_const_4fv (CoglContext *context, + const char *name, + const float *value); + +/** + * cogl_attribute_new_const_2x2fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @matrix2x2: A pointer to a 2 by 2 matrix + * @transpose: Whether the matrix should be transposed on upload or + * not + * + * Creates a new matrix attribute whose value remains constant + * across all the vertices of a primitive without needing to duplicate + * the value for each vertex. + * + * @matrix2x2 represent a square 2 by 2 matrix specified in + * column-major order (each pair of consecutive numbers represents a + * column) which should have a corresponding declaration in GLSL code + * like: + * + * [| + * attribute mat2 name; + * |] + * + * If @transpose is %TRUE then all matrix components are rotated + * around the diagonal of the matrix such that the first column + * becomes the first row and the second column becomes the second row. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant matrix. + */ +CoglAttribute * +cogl_attribute_new_const_2x2fv (CoglContext *context, + const char *name, + const float *matrix2x2, + CoglBool transpose); + +/** + * cogl_attribute_new_const_3x3fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @matrix3x3: A pointer to a 3 by 3 matrix + * @transpose: Whether the matrix should be transposed on upload or + * not + * + * Creates a new matrix attribute whose value remains constant + * across all the vertices of a primitive without needing to duplicate + * the value for each vertex. + * + * @matrix3x3 represent a square 3 by 3 matrix specified in + * column-major order (each triple of consecutive numbers represents a + * column) which should have a corresponding declaration in GLSL code + * like: + * + * [| + * attribute mat3 name; + * |] + * + * If @transpose is %TRUE then all matrix components are rotated + * around the diagonal of the matrix such that the first column + * becomes the first row and the second column becomes the second row + * etc. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant matrix. + */ +CoglAttribute * +cogl_attribute_new_const_3x3fv (CoglContext *context, + const char *name, + const float *matrix3x3, + CoglBool transpose); + +/** + * cogl_attribute_new_const_4x4fv: + * @context: A #CoglContext + * @name: The name of the attribute (used to reference it from GLSL) + * @matrix4x4: A pointer to a 4 by 4 matrix + * @transpose: Whether the matrix should be transposed on upload or + * not + * + * Creates a new matrix attribute whose value remains constant + * across all the vertices of a primitive without needing to duplicate + * the value for each vertex. + * + * @matrix4x4 represent a square 4 by 4 matrix specified in + * column-major order (each 4-tuple of consecutive numbers represents a + * column) which should have a corresponding declaration in GLSL code + * like: + * + * [| + * attribute mat4 name; + * |] + * + * If @transpose is %TRUE then all matrix components are rotated + * around the diagonal of the matrix such that the first column + * becomes the first row and the second column becomes the second row + * etc. + * + * Return value: (transfer full): A newly allocated #CoglAttribute + * representing the given constant matrix. + */ +CoglAttribute * +cogl_attribute_new_const_4x4fv (CoglContext *context, + const char *name, + const float *matrix4x4, + CoglBool transpose); + +/** + * cogl_attribute_set_normalized: + * @attribute: A #CoglAttribute + * @normalized: The new value for the normalized property. + * + * Sets whether fixed point attribute types are mapped to the range + * 0→1. For example when this property is TRUE and a + * %COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE type is used then the value 255 + * will be mapped to 1.0. + * + * The default value of this property depends on the name of the + * attribute. For the builtin properties cogl_color_in and + * cogl_normal_in it will default to TRUE and for all other names it + * will default to FALSE. + * + * Stability: unstable + * Since: 1.10 + */ +void +cogl_attribute_set_normalized (CoglAttribute *attribute, + CoglBool normalized); + +/** + * cogl_attribute_get_normalized: + * @attribute: A #CoglAttribute + * + * Return value: the value of the normalized property set with + * cogl_attribute_set_normalized(). + * + * Stability: unstable + * Since: 1.10 + */ +CoglBool +cogl_attribute_get_normalized (CoglAttribute *attribute); + +/** + * cogl_attribute_get_buffer: + * @attribute: A #CoglAttribute + * + * Return value: (transfer none): the #CoglAttributeBuffer that was + * set with cogl_attribute_set_buffer() or cogl_attribute_new(). + * + * Stability: unstable + * Since: 1.10 + */ +CoglAttributeBuffer * +cogl_attribute_get_buffer (CoglAttribute *attribute); + +/** + * cogl_attribute_set_buffer: + * @attribute: A #CoglAttribute + * @attribute_buffer: A #CoglAttributeBuffer + * + * Sets a new #CoglAttributeBuffer for the attribute. + * + * Stability: unstable + * Since: 1.10 + */ +void +cogl_attribute_set_buffer (CoglAttribute *attribute, + CoglAttributeBuffer *attribute_buffer); + +/** + * cogl_is_attribute: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglAttribute. + * + * Return value: %TRUE if the @object references a #CoglAttribute, + * %FALSE otherwise + */ +CoglBool +cogl_is_attribute (void *object); + +COGL_END_DECLS + +#endif /* __COGL_ATTRIBUTE_H__ */ + diff --git a/cogl/cogl-bitmap-conversion.c b/cogl/cogl-bitmap-conversion.c new file mode 100644 index 0000000..67168e7 --- /dev/null +++ b/cogl/cogl-bitmap-conversion.c @@ -0,0 +1,748 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-bitmap-private.h" +#include "cogl-context-private.h" +#include "cogl-texture-private.h" + +#include + +#define component_type uint8_t +#define component_size 8 +/* We want to specially optimise the packing when we are converting + to/from an 8-bit type so that it won't do anything. That way for + example if we are just doing a swizzle conversion then the inner + loop for the conversion will be really simple */ +#define UNPACK_BYTE(b) (b) +#define PACK_BYTE(b) (b) +#include "cogl-bitmap-packing.h" +#undef PACK_BYTE +#undef UNPACK_BYTE +#undef component_type +#undef component_size + +#define component_type uint16_t +#define component_size 16 +#define UNPACK_BYTE(b) (((b) * 65535 + 127) / 255) +#define PACK_BYTE(b) (((b) * 255 + 32767) / 65535) +#include "cogl-bitmap-packing.h" +#undef PACK_BYTE +#undef UNPACK_BYTE +#undef component_type +#undef component_size + +/* (Un)Premultiplication */ + +inline static void +_cogl_unpremult_alpha_0 (uint8_t *dst) +{ + dst[0] = 0; + dst[1] = 0; + dst[2] = 0; + dst[3] = 0; +} + +inline static void +_cogl_unpremult_alpha_last (uint8_t *dst) +{ + uint8_t alpha = dst[3]; + + dst[0] = (dst[0] * 255) / alpha; + dst[1] = (dst[1] * 255) / alpha; + dst[2] = (dst[2] * 255) / alpha; +} + +inline static void +_cogl_unpremult_alpha_first (uint8_t *dst) +{ + uint8_t alpha = dst[0]; + + dst[1] = (dst[1] * 255) / alpha; + dst[2] = (dst[2] * 255) / alpha; + dst[3] = (dst[3] * 255) / alpha; +} + +/* No division form of floor((c*a + 128)/255) (I first encountered + * this in the RENDER implementation in the X server.) Being exact + * is important for a == 255 - we want to get exactly c. + */ +#define MULT(d,a,t) \ + G_STMT_START { \ + t = d * a + 128; \ + d = ((t >> 8) + t) >> 8; \ + } G_STMT_END + +inline static void +_cogl_premult_alpha_last (uint8_t *dst) +{ + uint8_t alpha = dst[3]; + /* Using a separate temporary per component has given slightly better + * code generation with GCC in the past; it shouldn't do any worse in + * any case. + */ + unsigned int t1, t2, t3; + MULT(dst[0], alpha, t1); + MULT(dst[1], alpha, t2); + MULT(dst[2], alpha, t3); +} + +inline static void +_cogl_premult_alpha_first (uint8_t *dst) +{ + uint8_t alpha = dst[0]; + unsigned int t1, t2, t3; + + MULT(dst[1], alpha, t1); + MULT(dst[2], alpha, t2); + MULT(dst[3], alpha, t3); +} + +#undef MULT + +/* Use the SSE optimized version to premult four pixels at once when + it is available. The same assembler code works for x86 and x86-64 + because it doesn't refer to any non-SSE registers directly */ +#if defined(__SSE2__) && defined(__GNUC__) \ + && (defined(__x86_64) || defined(__i386)) +#define COGL_USE_PREMULT_SSE2 +#endif + +#ifdef COGL_USE_PREMULT_SSE2 + +inline static void +_cogl_premult_alpha_last_four_pixels_sse2 (uint8_t *p) +{ + /* 8 copies of 128 used below */ + static const int16_t eight_halves[8] __attribute__ ((aligned (16))) = + { 128, 128, 128, 128, 128, 128, 128, 128 }; + /* Mask of the rgb components of the four pixels */ + static const int8_t just_rgb[16] __attribute__ ((aligned (16))) = + { 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, + 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00 }; + /* Each SSE register only holds two pixels because we need to work + with 16-bit intermediate values. We still do four pixels by + interleaving two registers in the hope that it will pipeline + better */ + asm (/* Load eight_halves into xmm5 for later */ + "movdqa (%1), %%xmm5\n" + /* Clear xmm3 */ + "pxor %%xmm3, %%xmm3\n" + /* Load two pixels from p into the low half of xmm0 */ + "movlps (%0), %%xmm0\n" + /* Load the next set of two pixels from p into the low half of xmm1 */ + "movlps 8(%0), %%xmm1\n" + /* Unpack 8 bytes from the low quad-words in each register to 8 + 16-bit values */ + "punpcklbw %%xmm3, %%xmm0\n" + "punpcklbw %%xmm3, %%xmm1\n" + /* Copy alpha values of the first pixel in xmm0 to all + components of the first pixel in xmm2 */ + "pshuflw $255, %%xmm0, %%xmm2\n" + /* same for xmm1 and xmm3 */ + "pshuflw $255, %%xmm1, %%xmm3\n" + /* The above also copies the second pixel directly so we now + want to replace the RGB components with copies of the alpha + components */ + "pshufhw $255, %%xmm2, %%xmm2\n" + "pshufhw $255, %%xmm3, %%xmm3\n" + /* Multiply the rgb components by the alpha */ + "pmullw %%xmm2, %%xmm0\n" + "pmullw %%xmm3, %%xmm1\n" + /* Add 128 to each component */ + "paddw %%xmm5, %%xmm0\n" + "paddw %%xmm5, %%xmm1\n" + /* Copy the results to temporary registers xmm4 and xmm5 */ + "movdqa %%xmm0, %%xmm4\n" + "movdqa %%xmm1, %%xmm5\n" + /* Divide the results by 256 */ + "psrlw $8, %%xmm0\n" + "psrlw $8, %%xmm1\n" + /* Add the temporaries back in */ + "paddw %%xmm4, %%xmm0\n" + "paddw %%xmm5, %%xmm1\n" + /* Divide again */ + "psrlw $8, %%xmm0\n" + "psrlw $8, %%xmm1\n" + /* Pack the results back as bytes */ + "packuswb %%xmm1, %%xmm0\n" + /* Load just_rgb into xmm3 for later */ + "movdqa (%2), %%xmm3\n" + /* Reload all four pixels into xmm2 */ + "movups (%0), %%xmm2\n" + /* Mask out the alpha from the results */ + "andps %%xmm3, %%xmm0\n" + /* Mask out the RGB from the original four pixels */ + "andnps %%xmm2, %%xmm3\n" + /* Combine the two to get the right alpha values */ + "orps %%xmm3, %%xmm0\n" + /* Write to memory */ + "movdqu %%xmm0, (%0)\n" + : /* no outputs */ + : "r" (p), "r" (eight_halves), "r" (just_rgb) + : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); +} + +#endif /* COGL_USE_PREMULT_SSE2 */ + +static void +_cogl_bitmap_premult_unpacked_span_8 (uint8_t *data, + int width) +{ +#ifdef COGL_USE_PREMULT_SSE2 + + /* Process 4 pixels at a time */ + while (width >= 4) + { + _cogl_premult_alpha_last_four_pixels_sse2 (data); + data += 4 * 4; + width -= 4; + } + + /* If there are any pixels left we will fall through and + handle them below */ + +#endif /* COGL_USE_PREMULT_SSE2 */ + + while (width-- > 0) + { + _cogl_premult_alpha_last (data); + data += 4; + } +} + +static void +_cogl_bitmap_unpremult_unpacked_span_8 (uint8_t *data, + int width) +{ + int x; + + for (x = 0; x < width; x++) + { + if (data[3] == 0) + _cogl_unpremult_alpha_0 (data); + else + _cogl_unpremult_alpha_last (data); + data += 4; + } +} + +static void +_cogl_bitmap_unpremult_unpacked_span_16 (uint16_t *data, + int width) +{ + while (width-- > 0) + { + uint16_t alpha = data[3]; + + if (alpha == 0) + memset (data, 0, sizeof (uint16_t) * 3); + else + { + data[0] = (data[0] * 65535) / alpha; + data[1] = (data[1] * 65535) / alpha; + data[2] = (data[2] * 65535) / alpha; + } + } +} + +static void +_cogl_bitmap_premult_unpacked_span_16 (uint16_t *data, + int width) +{ + while (width-- > 0) + { + uint16_t alpha = data[3]; + + data[0] = (data[0] * alpha) / 65535; + data[1] = (data[1] * alpha) / 65535; + data[2] = (data[2] * alpha) / 65535; + } +} + +static CoglBool +_cogl_bitmap_can_fast_premult (CoglPixelFormat format) +{ + switch (format & ~COGL_PREMULT_BIT) + { + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ABGR_8888: + return TRUE; + + default: + return FALSE; + } +} + +static CoglBool +_cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format) +{ + /* If the format is using more than 8 bits per component then we'll + unpack into a 16-bit per component buffer instead of 8-bit so we + won't lose as much precision. If we ever add support for formats + with more than 16 bits for at least one of the components then we + should probably do something else here, maybe convert to + floats */ + switch (format) + { + case COGL_PIXEL_FORMAT_DEPTH_16: + case COGL_PIXEL_FORMAT_DEPTH_32: + case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: + case COGL_PIXEL_FORMAT_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + + case COGL_PIXEL_FORMAT_A_8: + case COGL_PIXEL_FORMAT_RG_88: + case COGL_PIXEL_FORMAT_RGB_565: + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_G_8: + case COGL_PIXEL_FORMAT_RGB_888: + case COGL_PIXEL_FORMAT_BGR_888: + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + return FALSE; + + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + return TRUE; + } + + g_assert_not_reached (); +} + +CoglBool +_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp, + CoglBitmap *dst_bmp, + CoglError **error) +{ + uint8_t *src_data; + uint8_t *dst_data; + uint8_t *src; + uint8_t *dst; + void *tmp_row; + int src_rowstride; + int dst_rowstride; + int y; + int width, height; + CoglPixelFormat src_format; + CoglPixelFormat dst_format; + CoglBool use_16; + CoglBool need_premult; + + src_format = cogl_bitmap_get_format (src_bmp); + src_rowstride = cogl_bitmap_get_rowstride (src_bmp); + dst_format = cogl_bitmap_get_format (dst_bmp); + dst_rowstride = cogl_bitmap_get_rowstride (dst_bmp); + width = cogl_bitmap_get_width (src_bmp); + height = cogl_bitmap_get_height (src_bmp); + + _COGL_RETURN_VAL_IF_FAIL (width == cogl_bitmap_get_width (dst_bmp), FALSE); + _COGL_RETURN_VAL_IF_FAIL (height == cogl_bitmap_get_height (dst_bmp), FALSE); + + need_premult + = ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) && + src_format != COGL_PIXEL_FORMAT_A_8 && + dst_format != COGL_PIXEL_FORMAT_A_8 && + (src_format & dst_format & COGL_A_BIT)); + + /* If the base format is the same then we can just copy the bitmap + instead */ + if ((src_format & ~COGL_PREMULT_BIT) == (dst_format & ~COGL_PREMULT_BIT) && + (!need_premult || _cogl_bitmap_can_fast_premult (dst_format))) + { + if (!_cogl_bitmap_copy_subregion (src_bmp, dst_bmp, + 0, 0, /* src_x / src_y */ + 0, 0, /* dst_x / dst_y */ + width, height, + error)) + return FALSE; + + if (need_premult) + { + if ((dst_format & COGL_PREMULT_BIT)) + { + if (!_cogl_bitmap_premult (dst_bmp, error)) + return FALSE; + } + else + { + if (!_cogl_bitmap_unpremult (dst_bmp, error)) + return FALSE; + } + } + + return TRUE; + } + + src_data = _cogl_bitmap_map (src_bmp, COGL_BUFFER_ACCESS_READ, 0, error); + if (src_data == NULL) + return FALSE; + dst_data = _cogl_bitmap_map (dst_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + error); + if (dst_data == NULL) + { + _cogl_bitmap_unmap (src_bmp); + return FALSE; + } + + use_16 = _cogl_bitmap_needs_short_temp_buffer (dst_format); + + /* Allocate a buffer to hold a temporary RGBA row */ + tmp_row = g_malloc (width * + (use_16 ? sizeof (uint16_t) : sizeof (uint8_t)) * 4); + + /* FIXME: Optimize */ + for (y = 0; y < height; y++) + { + src = src_data + y * src_rowstride; + dst = dst_data + y * dst_rowstride; + + if (use_16) + _cogl_unpack_16 (src_format, src, tmp_row, width); + else + _cogl_unpack_8 (src_format, src, tmp_row, width); + + /* Handle premultiplication */ + if (need_premult) + { + if (dst_format & COGL_PREMULT_BIT) + { + if (use_16) + _cogl_bitmap_premult_unpacked_span_16 (tmp_row, width); + else + _cogl_bitmap_premult_unpacked_span_8 (tmp_row, width); + } + else + { + if (use_16) + _cogl_bitmap_unpremult_unpacked_span_16 (tmp_row, width); + else + _cogl_bitmap_unpremult_unpacked_span_8 (tmp_row, width); + } + } + + if (use_16) + _cogl_pack_16 (dst_format, tmp_row, dst, width); + else + _cogl_pack_8 (dst_format, tmp_row, dst, width); + } + + _cogl_bitmap_unmap (src_bmp); + _cogl_bitmap_unmap (dst_bmp); + + g_free (tmp_row); + + return TRUE; +} + +CoglBitmap * +_cogl_bitmap_convert (CoglBitmap *src_bmp, + CoglPixelFormat dst_format, + CoglError **error) +{ + CoglBitmap *dst_bmp; + int width, height; + + _COGL_GET_CONTEXT (ctx, NULL); + + width = cogl_bitmap_get_width (src_bmp); + height = cogl_bitmap_get_height (src_bmp); + + dst_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + dst_format, + error); + if (!dst_bmp) + return NULL; + + if (!_cogl_bitmap_convert_into_bitmap (src_bmp, dst_bmp, error)) + { + cogl_object_unref (dst_bmp); + return NULL; + } + + return dst_bmp; +} + +static CoglBool +driver_can_convert (CoglContext *ctx, + CoglPixelFormat src_format, + CoglPixelFormat internal_format) +{ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_FORMAT_CONVERSION)) + return FALSE; + + if (src_format == internal_format) + return TRUE; + + /* If the driver doesn't natively support alpha textures then it + * won't work correctly to convert to/from component-alpha + * textures */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) && + (src_format == COGL_PIXEL_FORMAT_A_8 || + internal_format == COGL_PIXEL_FORMAT_A_8)) + return FALSE; + + /* Same for red-green textures. If red-green textures aren't + * supported then the internal format should never be RG_88 but we + * should still be able to convert from an RG source image */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RG) && + src_format == COGL_PIXEL_FORMAT_RG_88) + return FALSE; + + return TRUE; +} + +CoglBitmap * +_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error) +{ + CoglContext *ctx = _cogl_bitmap_get_context (src_bmp); + CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); + CoglBitmap *dst_bmp; + + _COGL_RETURN_VAL_IF_FAIL (internal_format != COGL_PIXEL_FORMAT_ANY, NULL); + + /* OpenGL supports specifying a different format for the internal + format when uploading texture data. We should use this to convert + formats because it is likely to be faster and support more types + than the Cogl bitmap code. However under GLES the internal format + must be the same as the bitmap format and it only supports a + limited number of formats so we must convert using the Cogl + bitmap code instead */ + + if (driver_can_convert (ctx, src_format, internal_format)) + { + /* If the source format does not have the same premult flag as the + internal_format then we need to copy and convert it */ + if (_cogl_texture_needs_premult_conversion (src_format, + internal_format)) + { + if (can_convert_in_place) + { + if (_cogl_bitmap_convert_premult_status (src_bmp, + (src_format ^ + COGL_PREMULT_BIT), + error)) + { + dst_bmp = cogl_object_ref (src_bmp); + } + else + return NULL; + } + else + { + dst_bmp = _cogl_bitmap_convert (src_bmp, + src_format ^ COGL_PREMULT_BIT, + error); + if (dst_bmp == NULL) + return NULL; + } + } + else + dst_bmp = cogl_object_ref (src_bmp); + } + else + { + CoglPixelFormat closest_format; + + closest_format = + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + NULL, /* ignore gl intformat */ + NULL, /* ignore gl format */ + NULL); /* ignore gl type */ + + if (closest_format != src_format) + dst_bmp = _cogl_bitmap_convert (src_bmp, closest_format, error); + else + dst_bmp = cogl_object_ref (src_bmp); + } + + return dst_bmp; +} + +CoglBool +_cogl_bitmap_unpremult (CoglBitmap *bmp, + CoglError **error) +{ + uint8_t *p, *data; + uint16_t *tmp_row; + int x,y; + CoglPixelFormat format; + int width, height; + int rowstride; + + format = cogl_bitmap_get_format (bmp); + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); + + if ((data = _cogl_bitmap_map (bmp, + COGL_BUFFER_ACCESS_READ | + COGL_BUFFER_ACCESS_WRITE, + 0, + error)) == NULL) + return FALSE; + + /* If we can't directly unpremult the data inline then we'll + allocate a temporary row and unpack the data. This assumes if we + can fast premult then we can also fast unpremult */ + if (_cogl_bitmap_can_fast_premult (format)) + tmp_row = NULL; + else + tmp_row = g_malloc (sizeof (uint16_t) * 4 * width); + + for (y = 0; y < height; y++) + { + p = (uint8_t*) data + y * rowstride; + + if (tmp_row) + { + _cogl_unpack_16 (format, p, tmp_row, width); + _cogl_bitmap_unpremult_unpacked_span_16 (tmp_row, width); + _cogl_pack_16 (format, tmp_row, p, width); + } + else + { + if (format & COGL_AFIRST_BIT) + { + for (x = 0; x < width; x++) + { + if (p[0] == 0) + _cogl_unpremult_alpha_0 (p); + else + _cogl_unpremult_alpha_first (p); + p += 4; + } + } + else + _cogl_bitmap_unpremult_unpacked_span_8 (p, width); + } + } + + g_free (tmp_row); + + _cogl_bitmap_unmap (bmp); + + _cogl_bitmap_set_format (bmp, format & ~COGL_PREMULT_BIT); + + return TRUE; +} + +CoglBool +_cogl_bitmap_premult (CoglBitmap *bmp, + CoglError **error) +{ + uint8_t *p, *data; + uint16_t *tmp_row; + int x,y; + CoglPixelFormat format; + int width, height; + int rowstride; + + format = cogl_bitmap_get_format (bmp); + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); + + if ((data = _cogl_bitmap_map (bmp, + COGL_BUFFER_ACCESS_READ | + COGL_BUFFER_ACCESS_WRITE, + 0, + error)) == NULL) + return FALSE; + + /* If we can't directly premult the data inline then we'll allocate + a temporary row and unpack the data. */ + if (_cogl_bitmap_can_fast_premult (format)) + tmp_row = NULL; + else + tmp_row = g_malloc (sizeof (uint16_t) * 4 * width); + + for (y = 0; y < height; y++) + { + p = (uint8_t*) data + y * rowstride; + + if (tmp_row) + { + _cogl_unpack_16 (format, p, tmp_row, width); + _cogl_bitmap_premult_unpacked_span_16 (tmp_row, width); + _cogl_pack_16 (format, tmp_row, p, width); + } + else + { + if (format & COGL_AFIRST_BIT) + { + for (x = 0; x < width; x++) + { + _cogl_premult_alpha_first (p); + p += 4; + } + } + else + _cogl_bitmap_premult_unpacked_span_8 (p, width); + } + } + + g_free (tmp_row); + + _cogl_bitmap_unmap (bmp); + + _cogl_bitmap_set_format (bmp, format | COGL_PREMULT_BIT); + + return TRUE; +} diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h new file mode 100644 index 0000000..1b8e140 --- /dev/null +++ b/cogl/cogl-bitmap-packing.h @@ -0,0 +1,767 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This file is included multiple times with different definitions for + the component_type type (either uint8_t or uint16_t). The code ends + up exactly the same for both but we only want to end up hitting the + 16-bit path when one of the types in the conversion is > 8 bits per + component. */ + +/* Unpacking to RGBA */ + +#define UNPACK_1(b) ((b) * ((1 << (sizeof (component_type) * 8)) - 1)) +#define UNPACK_2(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \ + 1) / 3) +#define UNPACK_4(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \ + 7) / 15) +#define UNPACK_5(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \ + 15) / 31) +#define UNPACK_6(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \ + 31) / 63) +#define UNPACK_10(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \ + 511) / 1023) + +inline static void +G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = 0; + dst[1] = 0; + dst[2] = 0; + dst[3] = UNPACK_BYTE (*src); + dst += 4; + src++; + } +} + +inline static void +G_PASTE (_cogl_unpack_g_8_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + /* FIXME: I'm not sure if this is right. It looks like Nvidia and + Mesa handle luminance textures differently. Maybe we should + consider just removing luminance textures for Cogl 2.0 because + they have been removed in GL 3.0 */ + while (width-- > 0) + { + component_type v = UNPACK_BYTE (src[0]); + dst[0] = v; + dst[1] = v; + dst[2] = v; + dst[3] = UNPACK_BYTE (255); + dst += 4; + src++; + } +} + +inline static void +G_PASTE (_cogl_unpack_rg_88_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[0]); + dst[1] = UNPACK_BYTE (src[1]); + dst[2] = 0; + dst[3] = UNPACK_BYTE (255); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgb_888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[0]); + dst[1] = UNPACK_BYTE (src[1]); + dst[2] = UNPACK_BYTE (src[2]); + dst[3] = UNPACK_BYTE (255); + dst += 4; + src += 3; + } +} + +inline static void +G_PASTE (_cogl_unpack_bgr_888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[2]); + dst[1] = UNPACK_BYTE (src[1]); + dst[2] = UNPACK_BYTE (src[0]); + dst[3] = UNPACK_BYTE (255); + dst += 4; + src += 3; + } +} + +inline static void +G_PASTE (_cogl_unpack_bgra_8888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[2]); + dst[1] = UNPACK_BYTE (src[1]); + dst[2] = UNPACK_BYTE (src[0]); + dst[3] = UNPACK_BYTE (src[3]); + dst += 4; + src += 4; + } +} + +inline static void +G_PASTE (_cogl_unpack_argb_8888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[1]); + dst[1] = UNPACK_BYTE (src[2]); + dst[2] = UNPACK_BYTE (src[3]); + dst[3] = UNPACK_BYTE (src[0]); + dst += 4; + src += 4; + } +} + +inline static void +G_PASTE (_cogl_unpack_abgr_8888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[3]); + dst[1] = UNPACK_BYTE (src[2]); + dst[2] = UNPACK_BYTE (src[1]); + dst[3] = UNPACK_BYTE (src[0]); + dst += 4; + src += 4; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgba_8888_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = UNPACK_BYTE (src[0]); + dst[1] = UNPACK_BYTE (src[1]); + dst[2] = UNPACK_BYTE (src[2]); + dst[3] = UNPACK_BYTE (src[3]); + dst += 4; + src += 4; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgb_565_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint16_t v = *(const uint16_t *) src; + + dst[0] = UNPACK_5 (v >> 11); + dst[1] = UNPACK_6 ((v >> 5) & 63); + dst[2] = UNPACK_5 (v & 31); + dst[3] = UNPACK_BYTE (255); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgba_4444_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint16_t v = *(const uint16_t *) src; + + dst[0] = UNPACK_4 (v >> 12); + dst[1] = UNPACK_4 ((v >> 8) & 15); + dst[2] = UNPACK_4 ((v >> 4) & 15); + dst[3] = UNPACK_4 (v & 15); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgba_5551_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint16_t v = *(const uint16_t *) src; + + dst[0] = UNPACK_5 (v >> 11); + dst[1] = UNPACK_5 ((v >> 6) & 31); + dst[2] = UNPACK_5 ((v >> 1) & 31); + dst[3] = UNPACK_1 (v & 1); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_rgba_1010102_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint32_t v = *(const uint32_t *) src; + + dst[0] = UNPACK_10 (v >> 22); + dst[1] = UNPACK_10 ((v >> 12) & 1023); + dst[2] = UNPACK_10 ((v >> 2) & 1023); + dst[3] = UNPACK_2 (v & 3); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint32_t v = *(const uint32_t *) src; + + dst[2] = UNPACK_10 (v >> 22); + dst[1] = UNPACK_10 ((v >> 12) & 1023); + dst[0] = UNPACK_10 ((v >> 2) & 1023); + dst[3] = UNPACK_2 (v & 3); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_argb_2101010_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint32_t v = *(const uint32_t *) src; + + dst[3] = UNPACK_2 (v >> 30); + dst[0] = UNPACK_10 ((v >> 20) & 1023); + dst[1] = UNPACK_10 ((v >> 10) & 1023); + dst[2] = UNPACK_10 (v & 1023); + dst += 4; + src += 2; + } +} + +inline static void +G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (const uint8_t *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + uint32_t v = *(const uint32_t *) src; + + dst[3] = UNPACK_2 (v >> 30); + dst[2] = UNPACK_10 ((v >> 20) & 1023); + dst[1] = UNPACK_10 ((v >> 10) & 1023); + dst[0] = UNPACK_10 (v & 1023); + dst += 4; + src += 2; + } +} + +#undef UNPACK_1 +#undef UNPACK_2 +#undef UNPACK_4 +#undef UNPACK_5 +#undef UNPACK_6 +#undef UNPACK_10 + +inline static void +G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format, + const uint8_t *src, + component_type *dst, + int width) +{ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_G_8: + G_PASTE (_cogl_unpack_g_8_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RG_88: + G_PASTE (_cogl_unpack_rg_88_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_888: + G_PASTE (_cogl_unpack_rgb_888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGR_888: + G_PASTE (_cogl_unpack_bgr_888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + G_PASTE (_cogl_unpack_rgba_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + G_PASTE (_cogl_unpack_bgra_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + G_PASTE (_cogl_unpack_argb_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + G_PASTE (_cogl_unpack_abgr_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_565: + G_PASTE (_cogl_unpack_rgb_565_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + G_PASTE (_cogl_unpack_rgba_4444_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + G_PASTE (_cogl_unpack_rgba_5551_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + G_PASTE (_cogl_unpack_rgba_1010102_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + G_PASTE (_cogl_unpack_argb_2101010_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_DEPTH_16: + case COGL_PIXEL_FORMAT_DEPTH_32: + case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: + case COGL_PIXEL_FORMAT_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + } +} + +/* Packing from RGBA */ + +/* Pack and round to nearest */ +#define PACK_SIZE(b, max) \ + (((b) * (max) + (1 << (sizeof (component_type) * 8 - 1)) - 1) / \ + ((1 << (sizeof (component_type) * 8)) - 1)) + +#define PACK_1(b) PACK_SIZE (b, 1) +#define PACK_2(b) PACK_SIZE (b, 3) +#define PACK_4(b) PACK_SIZE (b, 15) +#define PACK_5(b) PACK_SIZE (b, 31) +#define PACK_6(b) PACK_SIZE (b, 63) +#define PACK_10(b) PACK_SIZE (b, 1023) + +inline static void +G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + *dst = PACK_BYTE (src[3]); + src += 4; + dst++; + } +} + +inline static void +G_PASTE (_cogl_pack_g_8_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + /* FIXME: I'm not sure if this is right. It looks like Nvidia and + Mesa handle luminance textures differently. Maybe we should + consider just removing luminance textures for Cogl 2.0 because + they have been removed in GL 3.0 */ + while (width-- > 0) + { + component_type v = (src[0] + src[1] + src[2]) / 3; + *dst = PACK_BYTE (v); + src += 4; + dst++; + } +} + +inline static void +G_PASTE (_cogl_pack_rg_88_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = PACK_BYTE (src[0]); + dst[1] = PACK_BYTE (src[1]); + src += 4; + dst += 2; + } +} + +inline static void +G_PASTE (_cogl_pack_rgb_888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = PACK_BYTE (src[0]); + dst[1] = PACK_BYTE (src[1]); + dst[2] = PACK_BYTE (src[2]); + src += 4; + dst += 3; + } +} + +inline static void +G_PASTE (_cogl_pack_bgr_888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[2] = PACK_BYTE (src[0]); + dst[1] = PACK_BYTE (src[1]); + dst[0] = PACK_BYTE (src[2]); + src += 4; + dst += 3; + } +} + +inline static void +G_PASTE (_cogl_pack_bgra_8888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[2] = PACK_BYTE (src[0]); + dst[1] = PACK_BYTE (src[1]); + dst[0] = PACK_BYTE (src[2]); + dst[3] = PACK_BYTE (src[3]); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_argb_8888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[1] = PACK_BYTE (src[0]); + dst[2] = PACK_BYTE (src[1]); + dst[3] = PACK_BYTE (src[2]); + dst[0] = PACK_BYTE (src[3]); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_abgr_8888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[3] = PACK_BYTE (src[0]); + dst[2] = PACK_BYTE (src[1]); + dst[1] = PACK_BYTE (src[2]); + dst[0] = PACK_BYTE (src[3]); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_rgba_8888_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + dst[0] = PACK_BYTE (src[0]); + dst[1] = PACK_BYTE (src[1]); + dst[2] = PACK_BYTE (src[2]); + dst[3] = PACK_BYTE (src[3]); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_rgb_565_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint16_t *v = (uint16_t *) dst; + + *v = ((PACK_5 (src[0]) << 11) | + (PACK_6 (src[1]) << 5) | + PACK_5 (src[2])); + src += 4; + dst += 2; + } +} + +inline static void +G_PASTE (_cogl_pack_rgba_4444_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint16_t *v = (uint16_t *) dst; + + *v = ((PACK_4 (src[0]) << 12) | + (PACK_4 (src[1]) << 8) | + (PACK_4 (src[2]) << 4) | + PACK_4 (src[3])); + src += 4; + dst += 2; + } +} + +inline static void +G_PASTE (_cogl_pack_rgba_5551_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint16_t *v = (uint16_t *) dst; + + *v = ((PACK_5 (src[0]) << 11) | + (PACK_5 (src[1]) << 6) | + (PACK_5 (src[2]) << 1) | + PACK_1 (src[3])); + src += 4; + dst += 2; + } +} + +inline static void +G_PASTE (_cogl_pack_rgba_1010102_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint32_t *v = (uint32_t *) dst; + + *v = ((PACK_10 (src[0]) << 22) | + (PACK_10 (src[1]) << 12) | + (PACK_10 (src[2]) << 2) | + PACK_2 (src[3])); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_bgra_1010102_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint32_t *v = (uint32_t *) dst; + + *v = ((PACK_10 (src[2]) << 22) | + (PACK_10 (src[1]) << 12) | + (PACK_10 (src[0]) << 2) | + PACK_2 (src[3])); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_argb_2101010_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint32_t *v = (uint32_t *) dst; + + *v = ((PACK_2 (src[3]) << 30) | + (PACK_10 (src[0]) << 20) | + (PACK_10 (src[1]) << 10) | + PACK_10 (src[2])); + src += 4; + dst += 4; + } +} + +inline static void +G_PASTE (_cogl_pack_abgr_2101010_, component_size) (const component_type *src, + uint8_t *dst, + int width) +{ + while (width-- > 0) + { + uint32_t *v = (uint32_t *) dst; + + *v = ((PACK_2 (src[3]) << 30) | + (PACK_10 (src[2]) << 20) | + (PACK_10 (src[1]) << 10) | + PACK_10 (src[0])); + src += 4; + dst += 4; + } +} + +#undef PACK_SIZE +#undef PACK_1 +#undef PACK_2 +#undef PACK_4 +#undef PACK_5 +#undef PACK_6 +#undef PACK_10 + +inline static void +G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format, + const component_type *src, + uint8_t *dst, + int width) +{ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_G_8: + G_PASTE (_cogl_pack_g_8_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RG_88: + G_PASTE (_cogl_pack_rg_88_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_888: + G_PASTE (_cogl_pack_rgb_888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGR_888: + G_PASTE (_cogl_pack_bgr_888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + G_PASTE (_cogl_pack_rgba_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + G_PASTE (_cogl_pack_bgra_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + G_PASTE (_cogl_pack_argb_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + G_PASTE (_cogl_pack_abgr_8888_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_565: + G_PASTE (_cogl_pack_rgb_565_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + G_PASTE (_cogl_pack_rgba_4444_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + G_PASTE (_cogl_pack_rgba_5551_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + G_PASTE (_cogl_pack_rgba_1010102_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + G_PASTE (_cogl_pack_bgra_1010102_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + G_PASTE (_cogl_pack_argb_2101010_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_DEPTH_16: + case COGL_PIXEL_FORMAT_DEPTH_32: + case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: + case COGL_PIXEL_FORMAT_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + } +} diff --git a/cogl/cogl-bitmap-pixbuf.c b/cogl/cogl-bitmap-pixbuf.c new file mode 100644 index 0000000..c1e99db --- /dev/null +++ b/cogl/cogl-bitmap-pixbuf.c @@ -0,0 +1,475 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-bitmap-private.h" +#include "cogl-context-private.h" +#include "cogl-private.h" +#include "cogl-error-private.h" + +#include + +#ifdef USE_QUARTZ +#include +#elif defined(USE_GDKPIXBUF) +#include +#endif + +#ifdef USE_QUARTZ + +CoglBool +_cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height) +{ + if (width) + *width = 0; + + if (height) + *height = 0; + + return TRUE; +} + +/* the error does not contain the filename as the caller already has it */ +CoglBitmap * +_cogl_bitmap_from_file (CoglContext *ctx, + const char *filename, + CoglError **error) +{ + CFURLRef url; + CGImageSourceRef image_source; + CGImageRef image; + int save_errno; + CFStringRef type; + size_t width, height, rowstride; + uint8_t *out_data; + CGColorSpaceRef color_space; + CGContextRef bitmap_context; + CoglBitmap *bmp; + + url = CFURLCreateFromFileSystemRepresentation (NULL, + (guchar *) filename, + strlen (filename), + false); + image_source = CGImageSourceCreateWithURL (url, NULL); + save_errno = errno; + CFRelease (url); + + if (image_source == NULL) + { + /* doesn't exist, not readable, etc. */ + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_FAILED, + g_strerror (save_errno)); + return NULL; + } + + /* Unknown images would be cleanly caught as zero width/height below, but try + * to provide better error message + */ + type = CGImageSourceGetType (image_source); + if (type == NULL) + { + CFRelease (image_source); + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_UNKNOWN_TYPE, + "Unknown image type"); + return NULL; + } + + CFRelease (type); + + image = CGImageSourceCreateImageAtIndex (image_source, 0, NULL); + CFRelease (image_source); + + width = CGImageGetWidth (image); + height = CGImageGetHeight (image); + if (width == 0 || height == 0) + { + /* incomplete or corrupt */ + CFRelease (image); + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_CORRUPT_IMAGE, + "Image has zero width or height"); + return NULL; + } + + /* allocate buffer big enough to hold pixel data */ + bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + COGL_PIXEL_FORMAT_ARGB_8888, + error); + if (bmp == NULL) + { + CFRelease (image); + return NULL; + } + rowstride = cogl_bitmap_get_rowstride (bmp); + out_data = _cogl_bitmap_map (bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + error); + if (out_data == NULL) + { + cogl_object_unref (bmp); + CFRelease (image); + return NULL; + } + + /* render to buffer */ + color_space = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB); + bitmap_context = CGBitmapContextCreate (out_data, + width, height, 8, + rowstride, color_space, + kCGImageAlphaPremultipliedFirst); + CGColorSpaceRelease (color_space); + + CGContextSetBlendMode (bitmap_context, kCGBlendModeCopy); + + { + const CGRect rect = {{0, 0}, {width, height}}; + + CGContextDrawImage (bitmap_context, rect, image); + } + + CGImageRelease (image); + CGContextRelease (bitmap_context); + + _cogl_bitmap_unmap (bmp); + + /* store bitmap info */ + return bmp; +} + +#elif defined(USE_GDKPIXBUF) + +CoglBool +_cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height) +{ + _COGL_RETURN_VAL_IF_FAIL (filename != NULL, FALSE); + + if (gdk_pixbuf_get_file_info (filename, width, height) != NULL) + return TRUE; + + return FALSE; +} + +CoglBitmap * +_cogl_bitmap_from_file (CoglContext *ctx, + const char *filename, + CoglError **error) +{ + static CoglUserDataKey pixbuf_key; + GdkPixbuf *pixbuf; + CoglBool has_alpha; + GdkColorspace color_space; + CoglPixelFormat pixel_format; + int width; + int height; + int rowstride; + int bits_per_sample; + int n_channels; + CoglBitmap *bmp; + GError *glib_error = NULL; + + /* Load from file using GdkPixbuf */ + pixbuf = gdk_pixbuf_new_from_file (filename, &glib_error); + if (pixbuf == NULL) + { + _cogl_propagate_gerror (error, glib_error); + return FALSE; + } + + /* Get pixbuf properties */ + has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); + color_space = gdk_pixbuf_get_colorspace (pixbuf); + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + rowstride = gdk_pixbuf_get_rowstride (pixbuf); + bits_per_sample = gdk_pixbuf_get_bits_per_sample (pixbuf); + n_channels = gdk_pixbuf_get_n_channels (pixbuf); + + /* According to current docs this should be true and so + * the translation to cogl pixel format below valid */ + g_assert (bits_per_sample == 8); + + if (has_alpha) + g_assert (n_channels == 4); + else + g_assert (n_channels == 3); + + /* Translate to cogl pixel format */ + switch (color_space) + { + case GDK_COLORSPACE_RGB: + /* The only format supported by GdkPixbuf so far */ + pixel_format = has_alpha ? + COGL_PIXEL_FORMAT_RGBA_8888 : + COGL_PIXEL_FORMAT_RGB_888; + break; + + default: + /* Ouch, spec changed! */ + g_object_unref (pixbuf); + return FALSE; + } + + /* We just use the data directly from the pixbuf so that we don't + have to copy to a seperate buffer. Note that Cogl is expected not + to read past the end of bpp*width on the last row even if the + rowstride is much larger so we don't need to worry about + GdkPixbuf's semantics that it may under-allocate the buffer. */ + bmp = cogl_bitmap_new_for_data (ctx, + width, + height, + pixel_format, + rowstride, + gdk_pixbuf_get_pixels (pixbuf)); + + cogl_object_set_user_data (COGL_OBJECT (bmp), + &pixbuf_key, + pixbuf, + g_object_unref); + + return bmp; +} + +#else + +#include "stb_image.c" + +CoglBool +_cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height) +{ + if (width) + *width = 0; + + if (height) + *height = 0; + + return TRUE; +} + +/* stb_image.c supports an STBI_grey_alpha format which we don't have + * a corresponding CoglPixelFormat for so as a special case we + * convert this to rgba8888. + * + * If we have a use case where this is an important format to consider + * then it could be worth adding a corresponding CoglPixelFormat + * instead. + */ +static uint8_t * +convert_ra_88_to_rgba_8888 (uint8_t *pixels, + int width, + int height) +{ + int x, y; + uint8_t *buf; + size_t in_stride = width * 2; + size_t out_stride = width * 4; + + buf = malloc (width * height * 4); + if (buf) + return NULL; + + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + { + uint8_t *src = pixels + in_stride * y + 2 * x; + uint8_t *dst = buf + out_stride * y + 4 * x; + + dst[0] = src[0]; + dst[1] = src[0]; + dst[2] = src[0]; + dst[3] = src[1]; + } + + return buf; +} + +static CoglBitmap * +_cogl_bitmap_new_from_stb_pixels (CoglContext *ctx, + uint8_t *pixels, + int stb_pixel_format, + int width, + int height, + CoglError **error) +{ + static CoglUserDataKey bitmap_data_key; + CoglBitmap *bmp; + CoglPixelFormat cogl_format; + size_t stride; + + if (pixels == NULL) + { + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_FAILED, + "Failed to load image with stb image library"); + return NULL; + } + + switch (stb_pixel_format) + { + case STBI_grey: + cogl_format = COGL_PIXEL_FORMAT_A_8; + break; + case STBI_grey_alpha: + { + uint8_t *tmp = pixels; + + pixels = convert_ra_88_to_rgba_8888 (pixels, width, height); + free (tmp); + + if (!pixels) + { + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_FAILED, + "Failed to alloc memory to convert " + "gray_alpha to rgba8888"); + return NULL; + } + + cogl_format = COGL_PIXEL_FORMAT_RGBA_8888; + break; + } + case STBI_rgb: + cogl_format = COGL_PIXEL_FORMAT_RGB_888; + break; + case STBI_rgb_alpha: + cogl_format = COGL_PIXEL_FORMAT_RGBA_8888; + break; + + default: + g_warn_if_reached (); + return NULL; + } + + stride = width * _cogl_pixel_format_get_bytes_per_pixel (cogl_format); + + /* Store bitmap info */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + cogl_format, + stride, + pixels); + + /* Register a destroy function so the pixel data will be freed + automatically when the bitmap object is destroyed */ + cogl_object_set_user_data (COGL_OBJECT (bmp), &bitmap_data_key, pixels, free); + + return bmp; +} + +CoglBitmap * +_cogl_bitmap_from_file (CoglContext *ctx, + const char *filename, + CoglError **error) +{ + int stb_pixel_format; + int width; + int height; + uint8_t *pixels; + + pixels = stbi_load (filename, + &width, &height, &stb_pixel_format, + STBI_default); + + return _cogl_bitmap_new_from_stb_pixels (ctx, pixels, stb_pixel_format, + width, height, + error); +} + +#ifdef COGL_HAS_ANDROID_SUPPORT +CoglBitmap * +_cogl_android_bitmap_new_from_asset (CoglContext *ctx, + AAssetManager *manager, + const char *filename, + CoglError **error) +{ + AAsset *asset; + const void *data; + off_t len; + int stb_pixel_format; + int width; + int height; + uint8_t *pixels; + CoglBitmap *bmp; + + asset = AAssetManager_open (manager, filename, AASSET_MODE_BUFFER); + if (!asset) + { + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_FAILED, + "Failed to open asset"); + return NULL; + } + + data = AAsset_getBuffer (asset); + if (!data) + { + _cogl_set_error_literal (error, + COGL_BITMAP_ERROR, + COGL_BITMAP_ERROR_FAILED, + "Failed to ::getBuffer from asset"); + return NULL; + } + + len = AAsset_getLength (asset); + + pixels = stbi_load_from_memory (data, len, + &width, &height, + &stb_pixel_format, STBI_default); + + bmp = _cogl_bitmap_new_from_stb_pixels (ctx, pixels, stb_pixel_format, + width, height, + error); + + AAsset_close (asset); + + return bmp; +} +#endif + +#endif diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h new file mode 100644 index 0000000..8b29433 --- /dev/null +++ b/cogl/cogl-bitmap-private.h @@ -0,0 +1,213 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007 OpenedHand + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_BITMAP_H +#define __COGL_BITMAP_H + +#include + +#include "cogl-object-private.h" +#include "cogl-buffer.h" +#include "cogl-bitmap.h" + +#ifdef COGL_HAS_ANDROID_SUPPORT +#include +#endif + +struct _CoglBitmap +{ + CoglObject _parent; + + /* Pointer back to the context that this bitmap was created with */ + CoglContext *context; + + CoglPixelFormat format; + int width; + int height; + int rowstride; + + uint8_t *data; + + CoglBool mapped; + CoglBool bound; + + /* If this is non-null then 'data' is ignored and instead it is + fetched from this shared bitmap. */ + CoglBitmap *shared_bmp; + + /* If this is non-null then 'data' is treated as an offset into the + buffer and map will divert to mapping the buffer */ + CoglBuffer *buffer; +}; + + +/* + * _cogl_bitmap_new_with_malloc_buffer: + * @context: A #CoglContext + * @width: width of the bitmap in pixels + * @height: height of the bitmap in pixels + * @format: the format of the pixels the array will store + * @error: A #CoglError for catching exceptional errors or %NULL + * + * This is equivalent to cogl_bitmap_new_with_size() except that it + * allocated the buffer using g_malloc() instead of creating a + * #CoglPixelBuffer. The buffer will be automatically destroyed when + * the bitmap is freed. + * + * Return value: a #CoglPixelBuffer representing the newly created array + * + * Since: 1.10 + * Stability: Unstable + */ +CoglBitmap * +_cogl_bitmap_new_with_malloc_buffer (CoglContext *context, + unsigned int width, + unsigned int height, + CoglPixelFormat format, + CoglError **error); + +/* The idea of this function is that it will create a bitmap that + shares the actual data with another bitmap. This is needed for the + atlas texture backend because it needs upload a bitmap to a sub + texture but override the format so that it ignores the premult + flag. */ +CoglBitmap * +_cogl_bitmap_new_shared (CoglBitmap *shared_bmp, + CoglPixelFormat format, + int width, + int height, + int rowstride); + +CoglBitmap * +_cogl_bitmap_convert (CoglBitmap *bmp, + CoglPixelFormat dst_format, + CoglError **error); + +CoglBitmap * +_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error); + +CoglBool +_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp, + CoglBitmap *dst_bmp, + CoglError **error); + +CoglBitmap * +_cogl_bitmap_from_file (CoglContext *ctx, + const char *filename, + CoglError **error); + +#ifdef COGL_HAS_ANDROID_SUPPORT +CoglBitmap * +_cogl_android_bitmap_new_from_asset (CoglContext *ctx, + AAssetManager *manager, + const char *filename, + CoglError **error); +#endif + +CoglBool +_cogl_bitmap_unpremult (CoglBitmap *dst_bmp, + CoglError **error); + +CoglBool +_cogl_bitmap_premult (CoglBitmap *dst_bmp, + CoglError **error); + +CoglBool +_cogl_bitmap_convert_premult_status (CoglBitmap *bmp, + CoglPixelFormat dst_format, + CoglError **error); + +CoglBool +_cogl_bitmap_copy_subregion (CoglBitmap *src, + CoglBitmap *dst, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglError **error); + +/* Creates a deep copy of the source bitmap */ +CoglBitmap * +_cogl_bitmap_copy (CoglBitmap *src_bmp, + CoglError **error); + +CoglBool +_cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height); + +void +_cogl_bitmap_set_format (CoglBitmap *bitmap, + CoglPixelFormat format); + +/* Maps the bitmap so that the pixels can be accessed directly or if + the bitmap is just a memory bitmap then it just returns the pointer + to memory. Note that the bitmap isn't guaranteed to allocated to + the full size of rowstride*height so it is not safe to read up to + the rowstride of the last row. This will be the case if the user + uploads data using gdk_pixbuf_new_subpixbuf with a sub region + containing the last row of the pixbuf because in that case the + rowstride can be much larger than the width of the image */ +uint8_t * +_cogl_bitmap_map (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + +void +_cogl_bitmap_unmap (CoglBitmap *bitmap); + +/* These two are replacements for map and unmap that should used when + * the pointer is going to be passed to GL for pixel packing or + * unpacking. The address might not be valid for reading if the bitmap + * was created with new_from_buffer but it will however be good to + * pass to glTexImage2D for example. The access should be READ for + * unpacking and WRITE for packing. It can not be both + * + * TODO: split this bind/unbind functions out into a GL specific file + */ +uint8_t * +_cogl_bitmap_gl_bind (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + +void +_cogl_bitmap_gl_unbind (CoglBitmap *bitmap); + +CoglContext * +_cogl_bitmap_get_context (CoglBitmap *bitmap); + +#endif /* __COGL_BITMAP_H */ diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c new file mode 100644 index 0000000..5b2aa8e --- /dev/null +++ b/cogl/cogl-bitmap.c @@ -0,0 +1,538 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-debug.h" +#include "cogl-private.h" +#include "cogl-bitmap-private.h" +#include "cogl-buffer-private.h" +#include "cogl-pixel-buffer.h" +#include "cogl-context-private.h" +#include "cogl-buffer-gl-private.h" +#include "cogl-error-private.h" +#include "cogl-gtype-private.h" + +#include + +static void _cogl_bitmap_free (CoglBitmap *bmp); + +COGL_OBJECT_DEFINE (Bitmap, bitmap); +COGL_GTYPE_DEFINE_CLASS (Bitmap, bitmap); + +static void +_cogl_bitmap_free (CoglBitmap *bmp) +{ + g_assert (!bmp->mapped); + g_assert (!bmp->bound); + + if (bmp->shared_bmp) + cogl_object_unref (bmp->shared_bmp); + + if (bmp->buffer) + cogl_object_unref (bmp->buffer); + + g_slice_free (CoglBitmap, bmp); +} + +CoglBool +_cogl_bitmap_convert_premult_status (CoglBitmap *bmp, + CoglPixelFormat dst_format, + CoglError **error) +{ + /* Do we need to unpremultiply? */ + if ((bmp->format & COGL_PREMULT_BIT) > 0 && + (dst_format & COGL_PREMULT_BIT) == 0 && + COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (dst_format)) + return _cogl_bitmap_unpremult (bmp, error); + + /* Do we need to premultiply? */ + if ((bmp->format & COGL_PREMULT_BIT) == 0 && + COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (bmp->format) && + (dst_format & COGL_PREMULT_BIT) > 0) + /* Try premultiplying using imaging library */ + return _cogl_bitmap_premult (bmp, error); + + return TRUE; +} + +CoglBitmap * +_cogl_bitmap_copy (CoglBitmap *src_bmp, + CoglError **error) +{ + CoglBitmap *dst_bmp; + CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); + int width = cogl_bitmap_get_width (src_bmp); + int height = cogl_bitmap_get_height (src_bmp); + + dst_bmp = + _cogl_bitmap_new_with_malloc_buffer (src_bmp->context, + width, height, + src_format, + error); + if (!dst_bmp) + return NULL; + + if (!_cogl_bitmap_copy_subregion (src_bmp, + dst_bmp, + 0, 0, /* src_x/y */ + 0, 0, /* dst_x/y */ + width, height, + error)) + { + cogl_object_unref (dst_bmp); + return NULL; + } + + return dst_bmp; +} + +CoglBool +_cogl_bitmap_copy_subregion (CoglBitmap *src, + CoglBitmap *dst, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglError **error) +{ + uint8_t *srcdata; + uint8_t *dstdata; + int bpp; + int line; + CoglBool succeeded = FALSE; + + /* Intended only for fast copies when format is equal! */ + _COGL_RETURN_VAL_IF_FAIL ((src->format & ~COGL_PREMULT_BIT) == + (dst->format & ~COGL_PREMULT_BIT), + FALSE); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format); + + if ((srcdata = _cogl_bitmap_map (src, COGL_BUFFER_ACCESS_READ, 0, error))) + { + if ((dstdata = + _cogl_bitmap_map (dst, COGL_BUFFER_ACCESS_WRITE, 0, error))) + { + srcdata += src_y * src->rowstride + src_x * bpp; + dstdata += dst_y * dst->rowstride + dst_x * bpp; + + for (line = 0; line < height; ++line) + { + memcpy (dstdata, srcdata, width * bpp); + srcdata += src->rowstride; + dstdata += dst->rowstride; + } + + succeeded = TRUE; + + _cogl_bitmap_unmap (dst); + } + + _cogl_bitmap_unmap (src); + } + + return succeeded; +} + +CoglBool +cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height) +{ + return _cogl_bitmap_get_size_from_file (filename, width, height); +} + +CoglBitmap * +cogl_bitmap_new_for_data (CoglContext *context, + int width, + int height, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + CoglBitmap *bmp; + + g_return_val_if_fail (cogl_is_context (context), NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + bmp = g_slice_new (CoglBitmap); + bmp->context = context; + bmp->format = format; + bmp->width = width; + bmp->height = height; + bmp->rowstride = rowstride; + bmp->data = data; + bmp->mapped = FALSE; + bmp->bound = FALSE; + bmp->shared_bmp = NULL; + bmp->buffer = NULL; + + return _cogl_bitmap_object_new (bmp); +} + +CoglBitmap * +_cogl_bitmap_new_with_malloc_buffer (CoglContext *context, + unsigned int width, + unsigned int height, + CoglPixelFormat format, + CoglError **error) +{ + static CoglUserDataKey bitmap_free_key; + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + int rowstride = ((width * bpp) + 3) & ~3; + uint8_t *data = g_try_malloc (rowstride * height); + CoglBitmap *bitmap; + + if (!data) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY, + "Failed to allocate memory for bitmap"); + return NULL; + } + + bitmap = cogl_bitmap_new_for_data (context, + width, height, + format, + rowstride, + data); + cogl_object_set_user_data (COGL_OBJECT (bitmap), + &bitmap_free_key, + data, + g_free); + + return bitmap; +} + +CoglBitmap * +_cogl_bitmap_new_shared (CoglBitmap *shared_bmp, + CoglPixelFormat format, + int width, + int height, + int rowstride) +{ + CoglBitmap *bmp; + + bmp = cogl_bitmap_new_for_data (shared_bmp->context, + width, height, + format, + rowstride, + NULL /* data */); + + bmp->shared_bmp = cogl_object_ref (shared_bmp); + + return bmp; +} + +CoglBitmap * +cogl_bitmap_new_from_file (const char *filename, + CoglError **error) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (filename != NULL, NULL); + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + return _cogl_bitmap_from_file (ctx, filename, error); +} + +CoglBitmap * +cogl_bitmap_new_from_buffer (CoglBuffer *buffer, + CoglPixelFormat format, + int width, + int height, + int rowstride, + int offset) +{ + CoglBitmap *bmp; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); + + bmp = cogl_bitmap_new_for_data (buffer->context, + width, height, + format, + rowstride, + NULL /* data */); + + bmp->buffer = cogl_object_ref (buffer); + bmp->data = GINT_TO_POINTER (offset); + + return bmp; +} + +CoglBitmap * +cogl_bitmap_new_with_size (CoglContext *context, + unsigned int width, + unsigned int height, + CoglPixelFormat format) +{ + CoglPixelBuffer *pixel_buffer; + CoglBitmap *bitmap; + unsigned int rowstride; + + /* creating a buffer to store "any" format does not make sense */ + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + + /* for now we fallback to cogl_pixel_buffer_new, later, we could ask + * libdrm a tiled buffer for instance */ + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + pixel_buffer = + cogl_pixel_buffer_new (context, + height * rowstride, + NULL); /* data */ + + _COGL_RETURN_VAL_IF_FAIL (pixel_buffer != NULL, NULL); + + bitmap = cogl_bitmap_new_from_buffer (COGL_BUFFER (pixel_buffer), + format, + width, height, + rowstride, + 0 /* offset */); + + cogl_object_unref (pixel_buffer); + + return bitmap; +} + +#ifdef COGL_HAS_ANDROID_SUPPORT +CoglBitmap * +cogl_android_bitmap_new_from_asset (CoglContext *ctx, + AAssetManager *manager, + const char *filename, + CoglError **error) +{ + _COGL_RETURN_VAL_IF_FAIL (ctx != NULL, NULL); + _COGL_RETURN_VAL_IF_FAIL (manager != NULL, NULL); + _COGL_RETURN_VAL_IF_FAIL (filename != NULL, NULL); + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + return _cogl_android_bitmap_new_from_asset (ctx, manager, filename, error); +} +#endif + +CoglPixelFormat +cogl_bitmap_get_format (CoglBitmap *bitmap) +{ + return bitmap->format; +} + +void +_cogl_bitmap_set_format (CoglBitmap *bitmap, + CoglPixelFormat format) +{ + bitmap->format = format; +} + +int +cogl_bitmap_get_width (CoglBitmap *bitmap) +{ + return bitmap->width; +} + +int +cogl_bitmap_get_height (CoglBitmap *bitmap) +{ + return bitmap->height; +} + +int +cogl_bitmap_get_rowstride (CoglBitmap *bitmap) +{ + return bitmap->rowstride; +} + +CoglPixelBuffer * +cogl_bitmap_get_buffer (CoglBitmap *bitmap) +{ + while (bitmap->shared_bmp) + bitmap = bitmap->shared_bmp; + + return COGL_PIXEL_BUFFER (bitmap->buffer); +} + +uint32_t +cogl_bitmap_error_quark (void) +{ + return g_quark_from_static_string ("cogl-bitmap-error-quark"); +} + +uint8_t * +_cogl_bitmap_map (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + return _cogl_bitmap_map (bitmap->shared_bmp, access, hints, error); + + g_assert (!bitmap->mapped); + + if (bitmap->buffer) + { + uint8_t *data = _cogl_buffer_map (bitmap->buffer, + access, + hints, + error); + + COGL_NOTE (BITMAP, "A pixel array is being mapped from a bitmap. This " + "usually means that some conversion on the pixel array is " + "needed so a sub-optimal format is being used."); + + if (data) + { + bitmap->mapped = TRUE; + + return data + GPOINTER_TO_INT (bitmap->data); + } + else + return NULL; + } + else + { + bitmap->mapped = TRUE; + + return bitmap->data; + } +} + +void +_cogl_bitmap_unmap (CoglBitmap *bitmap) +{ + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + { + _cogl_bitmap_unmap (bitmap->shared_bmp); + return; + } + + g_assert (bitmap->mapped); + bitmap->mapped = FALSE; + + if (bitmap->buffer) + cogl_buffer_unmap (bitmap->buffer); +} + +uint8_t * +_cogl_bitmap_gl_bind (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + uint8_t *ptr; + CoglError *internal_error = NULL; + + g_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ | + COGL_BUFFER_ACCESS_WRITE), + NULL); + + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + return _cogl_bitmap_gl_bind (bitmap->shared_bmp, access, hints, error); + + _COGL_RETURN_VAL_IF_FAIL (!bitmap->bound, NULL); + + /* If the bitmap wasn't created from a buffer then the + implementation of bind is the same as map */ + if (bitmap->buffer == NULL) + { + uint8_t *data = _cogl_bitmap_map (bitmap, access, hints, error); + if (data) + bitmap->bound = TRUE; + return data; + } + + if (access == COGL_BUFFER_ACCESS_READ) + ptr = _cogl_buffer_gl_bind (bitmap->buffer, + COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK, + &internal_error); + else if (access == COGL_BUFFER_ACCESS_WRITE) + ptr = _cogl_buffer_gl_bind (bitmap->buffer, + COGL_BUFFER_BIND_TARGET_PIXEL_PACK, + &internal_error); + else + { + ptr = NULL; + g_assert_not_reached (); + return NULL; + } + + /* NB: _cogl_buffer_gl_bind() may return NULL in non-error + * conditions so we have to explicitly check internal_error to see + * if an exception was thrown */ + if (internal_error) + { + _cogl_propagate_error (error, internal_error); + return NULL; + } + + bitmap->bound = TRUE; + + /* The data pointer actually stores the offset */ + return ptr + GPOINTER_TO_INT (bitmap->data); +} + +void +_cogl_bitmap_gl_unbind (CoglBitmap *bitmap) +{ + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + { + _cogl_bitmap_gl_unbind (bitmap->shared_bmp); + return; + } + + g_assert (bitmap->bound); + bitmap->bound = FALSE; + + /* If the bitmap wasn't created from a pixel array then the + implementation of unbind is the same as unmap */ + if (bitmap->buffer) + _cogl_buffer_gl_unbind (bitmap->buffer); + else + _cogl_bitmap_unmap (bitmap); +} + +CoglContext * +_cogl_bitmap_get_context (CoglBitmap *bitmap) +{ + return bitmap->context; +} diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h new file mode 100644 index 0000000..13b5cd2 --- /dev/null +++ b/cogl/cogl-bitmap.h @@ -0,0 +1,336 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_BITMAP_H__ +#define __COGL_BITMAP_H__ + +/* XXX: We forward declare CoglBitmap here to allow for circular + * dependencies between some headers */ +typedef struct _CoglBitmap CoglBitmap; + +#include +#include +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +#ifdef COGL_HAS_ANDROID_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_bitmap_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_bitmap_get_gtype (void); +#endif + +/** + * SECTION:cogl-bitmap + * @short_description: Functions for loading images + * + * Cogl allows loading image data into memory as CoglBitmaps without + * loading them immediately into GPU textures. + * + * #CoglBitmap is available since Cogl 1.0 + */ + + +/** + * cogl_bitmap_new_from_file: + * @filename: the file to load. + * @error: a #CoglError or %NULL. + * + * Loads an image file from disk. This function can be safely called from + * within a thread. + * + * Return value: (transfer full): a #CoglBitmap to the new loaded + * image data, or %NULL if loading the image failed. + * + * Since: 1.0 + */ +CoglBitmap * +cogl_bitmap_new_from_file (const char *filename, + CoglError **error); + +#ifdef COGL_HAS_ANDROID_SUPPORT +/** + * cogl_android_bitmap_new_from_asset: + * @context: A #CoglContext + * @manager: An Android Asset Manager. + * @filename: The file name for the asset + * @error: A return location for a CoglError exception. + * + * Loads an Android asset into a newly allocated #CoglBitmap. + * + * Return value: (transfer full): A newly allocated #CoglBitmap + * holding the image data of the specified asset. + * + * Since: 2.0 + */ +CoglBitmap * +cogl_android_bitmap_new_from_asset (CoglContext *context, + AAssetManager *manager, + const char *filename, + CoglError **error); +#endif + +#if defined (COGL_ENABLE_EXPERIMENTAL_API) + +/** + * cogl_bitmap_new_from_buffer: + * @buffer: A #CoglBuffer containing image data + * @format: The #CoglPixelFormat defining the format of the image data + * in the given @buffer. + * @width: The width of the image data in the given @buffer. + * @height: The height of the image data in the given @buffer. + * @rowstride: The rowstride in bytes of the image data in the given @buffer. + * @offset: The offset into the given @buffer to the first pixel that + * should be considered part of the #CoglBitmap. + * + * Wraps some image data that has been uploaded into a #CoglBuffer as + * a #CoglBitmap. The data is not copied in this process. + * + * Return value: (transfer full): a #CoglBitmap encapsulating the given @buffer. + * + * Since: 1.8 + * Stability: unstable + */ +CoglBitmap * +cogl_bitmap_new_from_buffer (CoglBuffer *buffer, + CoglPixelFormat format, + int width, + int height, + int rowstride, + int offset); + +/** + * cogl_bitmap_new_with_size: + * @context: A #CoglContext + * @width: width of the bitmap in pixels + * @height: height of the bitmap in pixels + * @format: the format of the pixels the array will store + * + * Creates a new #CoglBitmap with the given width, height and format. + * The initial contents of the bitmap are undefined. + * + * The data for the bitmap will be stored in a newly created + * #CoglPixelBuffer. You can get a pointer to the pixel buffer using + * cogl_bitmap_get_buffer(). The #CoglBuffer API can then be + * used to fill the bitmap with data. + * + * Cogl will try its best to provide a hardware array you can + * map, write into and effectively do a zero copy upload when creating + * a texture from it with cogl_texture_new_from_bitmap(). For various + * reasons, such arrays are likely to have a stride larger than width + * * bytes_per_pixel. The user must take the stride into account when + * writing into it. The stride can be retrieved with + * cogl_bitmap_get_rowstride(). + * + * Return value: (transfer full): a #CoglPixelBuffer representing the + * newly created array or %NULL on failure + * + * Since: 1.10 + * Stability: Unstable + */ +CoglBitmap * +cogl_bitmap_new_with_size (CoglContext *context, + unsigned int width, + unsigned int height, + CoglPixelFormat format); + +/** + * cogl_bitmap_new_for_data: + * @context: A #CoglContext + * @width: The width of the bitmap. + * @height: The height of the bitmap. + * @format: The format of the pixel data. + * @rowstride: The rowstride of the bitmap (the number of bytes from + * the start of one row of the bitmap to the next). + * @data: A pointer to the data. The bitmap will take ownership of this data. + * + * Creates a bitmap using some existing data. The data is not copied + * so the application must keep the buffer alive for the lifetime of + * the #CoglBitmap. This can be used for example with + * cogl_framebuffer_read_pixels_into_bitmap() to read data directly + * into an application buffer with the specified rowstride. + * + * Return value: (transfer full): A new #CoglBitmap. + * Since: 1.10 + * Stability: unstable + */ +CoglBitmap * +cogl_bitmap_new_for_data (CoglContext *context, + int width, + int height, + CoglPixelFormat format, + int rowstride, + uint8_t *data); + +/** + * cogl_bitmap_get_format: + * @bitmap: A #CoglBitmap + * + * Return value: the #CoglPixelFormat that the data for the bitmap is in. + * Since: 1.10 + * Stability: unstable + */ +CoglPixelFormat +cogl_bitmap_get_format (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_width: + * @bitmap: A #CoglBitmap + * + * Return value: the width of the bitmap + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_width (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_height: + * @bitmap: A #CoglBitmap + * + * Return value: the height of the bitmap + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_height (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_rowstride: + * @bitmap: A #CoglBitmap + * + * Return value: the rowstride of the bitmap. This is the number of + * bytes between the address of start of one row to the address of the + * next row in the image. + * Since: 1.10 + * Stability: unstable + */ +int +cogl_bitmap_get_rowstride (CoglBitmap *bitmap); + +/** + * cogl_bitmap_get_buffer: + * @bitmap: A #CoglBitmap + * + * Return value: (transfer none): the #CoglPixelBuffer that this + * buffer uses for storage. Note that if the bitmap was created with + * cogl_bitmap_new_from_file() then it will not actually be using a + * pixel buffer and this function will return %NULL. + * Stability: unstable + * Since: 1.10 + */ +CoglPixelBuffer * +cogl_bitmap_get_buffer (CoglBitmap *bitmap); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +/** + * cogl_bitmap_get_size_from_file: + * @filename: the file to check + * @width: (out): return location for the bitmap width, or %NULL + * @height: (out): return location for the bitmap height, or %NULL + * + * Parses an image file enough to extract the width and height + * of the bitmap. + * + * Return value: %TRUE if the image was successfully parsed + * + * Since: 1.0 + */ +CoglBool +cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height); + +/** + * cogl_is_bitmap: + * @object: a #CoglObject pointer + * + * Checks whether @object is a #CoglBitmap + * + * Return value: %TRUE if the passed @object represents a bitmap, + * and %FALSE otherwise + * + * Since: 1.0 + */ +CoglBool +cogl_is_bitmap (void *object); + +/** + * COGL_BITMAP_ERROR: + * + * #CoglError domain for bitmap errors. + * + * Since: 1.4 + */ +#define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ()) + +/** + * CoglBitmapError: + * @COGL_BITMAP_ERROR_FAILED: Generic failure code, something went + * wrong. + * @COGL_BITMAP_ERROR_UNKNOWN_TYPE: Unknown image type. + * @COGL_BITMAP_ERROR_CORRUPT_IMAGE: An image file was broken somehow. + * + * Error codes that can be thrown when performing bitmap + * operations. Note that gdk_pixbuf_new_from_file() can also throw + * errors directly from the underlying image loading library. For + * example, if GdkPixbuf is used then errors #GdkPixbufErrors + * will be used directly. + * + * Since: 1.4 + */ +typedef enum { + COGL_BITMAP_ERROR_FAILED, + COGL_BITMAP_ERROR_UNKNOWN_TYPE, + COGL_BITMAP_ERROR_CORRUPT_IMAGE +} CoglBitmapError; + +uint32_t cogl_bitmap_error_quark (void); + +COGL_END_DECLS + +#endif /* __COGL_BITMAP_H__ */ diff --git a/cogl/cogl-bitmask.c b/cogl/cogl-bitmask.c new file mode 100644 index 0000000..7034bc9 --- /dev/null +++ b/cogl/cogl-bitmask.c @@ -0,0 +1,489 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#include "config.h" + +#include +#include + +#include + +#include "cogl-bitmask.h" +#include "cogl-util.h" +#include "cogl-flags.h" + +/* This code assumes that we can cast an unsigned long to a pointer + and back without losing any data */ +_COGL_STATIC_ASSERT (sizeof (unsigned long) <= sizeof (void *), + "This toolchain breaks Cogl's assumption that it can " + "safely cast an unsigned long to a pointer without " + "loosing data"); + +#define ARRAY_INDEX(bit_num) \ + ((bit_num) / (sizeof (unsigned long) * 8)) +#define BIT_INDEX(bit_num) \ + ((bit_num) & (sizeof (unsigned long) * 8 - 1)) +#define BIT_MASK(bit_num) \ + (1UL << BIT_INDEX (bit_num)) + +CoglBool +_cogl_bitmask_get_from_array (const CoglBitmask *bitmask, + unsigned int bit_num) +{ + GArray *array = (GArray *) *bitmask; + + /* If the index is off the end of the array then assume the bit is + not set */ + if (bit_num >= sizeof (unsigned long) * 8 * array->len) + return FALSE; + else + return !!(g_array_index (array, unsigned long, ARRAY_INDEX (bit_num)) & + BIT_MASK (bit_num)); +} + +static void +_cogl_bitmask_convert_to_array (CoglBitmask *bitmask) +{ + GArray *array; + /* Fetch the old values */ + unsigned long old_values = _cogl_bitmask_to_bits (bitmask); + + array = g_array_new (FALSE, /* not zero-terminated */ + TRUE, /* do clear new entries */ + sizeof (unsigned long)); + /* Copy the old values back in */ + g_array_append_val (array, old_values); + + *bitmask = (struct _CoglBitmaskImaginaryType *) array; +} + +void +_cogl_bitmask_set_in_array (CoglBitmask *bitmask, + unsigned int bit_num, + CoglBool value) +{ + GArray *array; + unsigned int array_index; + unsigned long new_value_mask; + + /* If the bitmask is not already an array then we need to allocate one */ + if (!_cogl_bitmask_has_array (bitmask)) + _cogl_bitmask_convert_to_array (bitmask); + + array = (GArray *) *bitmask; + + array_index = ARRAY_INDEX (bit_num); + /* Grow the array if necessary. This will clear the new data */ + if (array_index >= array->len) + g_array_set_size (array, array_index + 1); + + new_value_mask = BIT_MASK (bit_num); + + if (value) + g_array_index (array, unsigned long, array_index) |= new_value_mask; + else + g_array_index (array, unsigned long, array_index) &= ~new_value_mask; +} + +void +_cogl_bitmask_set_bits (CoglBitmask *dst, + const CoglBitmask *src) +{ + if (_cogl_bitmask_has_array (src)) + { + GArray *src_array, *dst_array; + int i; + + if (!_cogl_bitmask_has_array (dst)) + _cogl_bitmask_convert_to_array (dst); + + dst_array = (GArray *) *dst; + src_array = (GArray *) *src; + + if (dst_array->len < src_array->len) + g_array_set_size (dst_array, src_array->len); + + for (i = 0; i < src_array->len; i++) + g_array_index (dst_array, unsigned long, i) |= + g_array_index (src_array, unsigned long, i); + } + else if (_cogl_bitmask_has_array (dst)) + { + GArray *dst_array; + + dst_array = (GArray *) *dst; + + g_array_index (dst_array, unsigned long, 0) |= + _cogl_bitmask_to_bits (src); + } + else + *dst = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (dst) | + _cogl_bitmask_to_bits (src)); +} + +void +_cogl_bitmask_set_range_in_array (CoglBitmask *bitmask, + unsigned int n_bits, + CoglBool value) +{ + GArray *array; + unsigned int array_index, bit_index; + + if (n_bits == 0) + return; + + /* If the bitmask is not already an array then we need to allocate one */ + if (!_cogl_bitmask_has_array (bitmask)) + _cogl_bitmask_convert_to_array (bitmask); + + array = (GArray *) *bitmask; + + /* Get the array index of the top most value that will be touched */ + array_index = ARRAY_INDEX (n_bits - 1); + /* Get the bit index of the top most value */ + bit_index = BIT_INDEX (n_bits - 1); + /* Grow the array if necessary. This will clear the new data */ + if (array_index >= array->len) + g_array_set_size (array, array_index + 1); + + if (value) + { + /* Set the bits that are touching this index */ + g_array_index (array, unsigned long, array_index) |= + ~0UL >> (sizeof (unsigned long) * 8 - 1 - bit_index); + + /* Set all of the bits in any lesser indices */ + memset (array->data, 0xff, sizeof (unsigned long) * array_index); + } + else + { + /* Clear the bits that are touching this index */ + g_array_index (array, unsigned long, array_index) &= ~1UL << bit_index; + + /* Clear all of the bits in any lesser indices */ + memset (array->data, 0x00, sizeof (unsigned long) * array_index); + } +} + +void +_cogl_bitmask_xor_bits (CoglBitmask *dst, + const CoglBitmask *src) +{ + if (_cogl_bitmask_has_array (src)) + { + GArray *src_array, *dst_array; + int i; + + if (!_cogl_bitmask_has_array (dst)) + _cogl_bitmask_convert_to_array (dst); + + dst_array = (GArray *) *dst; + src_array = (GArray *) *src; + + if (dst_array->len < src_array->len) + g_array_set_size (dst_array, src_array->len); + + for (i = 0; i < src_array->len; i++) + g_array_index (dst_array, unsigned long, i) ^= + g_array_index (src_array, unsigned long, i); + } + else if (_cogl_bitmask_has_array (dst)) + { + GArray *dst_array; + + dst_array = (GArray *) *dst; + + g_array_index (dst_array, unsigned long, 0) ^= + _cogl_bitmask_to_bits (src); + } + else + *dst = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (dst) ^ + _cogl_bitmask_to_bits (src)); +} + +void +_cogl_bitmask_clear_all_in_array (CoglBitmask *bitmask) +{ + GArray *array = (GArray *) *bitmask; + + memset (array->data, 0, sizeof (unsigned long) * array->len); +} + +void +_cogl_bitmask_foreach (const CoglBitmask *bitmask, + CoglBitmaskForeachFunc func, + void *user_data) +{ + if (_cogl_bitmask_has_array (bitmask)) + { + GArray *array = (GArray *) *bitmask; + const unsigned long *values = &g_array_index (array, unsigned long, 0); + int bit_num; + + COGL_FLAGS_FOREACH_START (values, array->len, bit_num) + { + if (!func (bit_num, user_data)) + return; + } + COGL_FLAGS_FOREACH_END; + } + else + { + unsigned long mask = _cogl_bitmask_to_bits (bitmask); + int bit_num; + + COGL_FLAGS_FOREACH_START (&mask, 1, bit_num) + { + if (!func (bit_num, user_data)) + return; + } + COGL_FLAGS_FOREACH_END; + } +} + +void +_cogl_bitmask_set_flags_array (const CoglBitmask *bitmask, + unsigned long *flags) +{ + const GArray *array = (const GArray *) *bitmask; + int i; + + for (i = 0; i < array->len; i++) + flags[i] |= g_array_index (array, unsigned long, i); +} + +int +_cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask) +{ + const GArray *array = (const GArray *) *bitmask; + int pop = 0; + int i; + + for (i = 0; i < array->len; i++) + pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + + return pop; +} + +int +_cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask, + int upto) +{ + const GArray *array = (const GArray *) *bitmask; + + if (upto >= array->len * sizeof (unsigned long) * 8) + return _cogl_bitmask_popcount_in_array (bitmask); + else + { + unsigned long top_mask; + int array_index = ARRAY_INDEX (upto); + int bit_index = BIT_INDEX (upto); + int pop = 0; + int i; + + for (i = 0; i < array_index; i++) + pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + + top_mask = g_array_index (array, unsigned long, array_index); + + return pop + _cogl_util_popcountl (top_mask & ((1UL << bit_index) - 1)); + } +} + +typedef struct +{ + int n_bits; + int *bits; +} CheckData; + +static CoglBool +check_bit (int bit_num, void *user_data) +{ + CheckData *data = user_data; + int i; + + for (i = 0; i < data->n_bits; i++) + if (data->bits[i] == bit_num) + { + data->bits[i] = -1; + return TRUE; + } + + g_assert_not_reached (); + + return TRUE; +} + +static void +verify_bits (const CoglBitmask *bitmask, + ...) +{ + CheckData data; + va_list ap, ap_copy; + int i; + + va_start (ap, bitmask); + G_VA_COPY (ap_copy, ap); + + for (data.n_bits = 0; va_arg (ap, int) != -1; data.n_bits++); + + data.bits = alloca (data.n_bits * (sizeof (int))); + + G_VA_COPY (ap, ap_copy); + + for (i = 0; i < data.n_bits; i++) + data.bits[i] = va_arg (ap, int); + + _cogl_bitmask_foreach (bitmask, check_bit, &data); + + for (i = 0; i < data.n_bits; i++) + g_assert_cmpint (data.bits[i], ==, -1); + + g_assert_cmpint (_cogl_bitmask_popcount (bitmask), ==, data.n_bits); + + for (i = 0; i < 1024; i++) + { + int upto_popcount = 0; + int j; + + G_VA_COPY (ap, ap_copy); + + for (j = 0; j < data.n_bits; j++) + if (va_arg (ap, int) < i) + upto_popcount++; + + g_assert_cmpint (_cogl_bitmask_popcount_upto (bitmask, i), + ==, + upto_popcount); + + G_VA_COPY (ap, ap_copy); + + for (j = 0; j < data.n_bits; j++) + if (va_arg (ap, int) == i) + break; + + g_assert_cmpint (_cogl_bitmask_get (bitmask, i), ==, (j < data.n_bits)); + } +} + +UNIT_TEST (check_bitmask_api, + 0 /* no requirements */, + 0 /* no failure cases */) +{ + CoglBitmask bitmask; + CoglBitmask other_bitmask; + /* A dummy bit to make it use arrays sometimes */ + int dummy_bit; + int i; + + for (dummy_bit = -1; dummy_bit < 256; dummy_bit += 40) + { + _cogl_bitmask_init (&bitmask); + _cogl_bitmask_init (&other_bitmask); + + if (dummy_bit != -1) + _cogl_bitmask_set (&bitmask, dummy_bit, TRUE); + + verify_bits (&bitmask, dummy_bit, -1); + + _cogl_bitmask_set (&bitmask, 1, TRUE); + _cogl_bitmask_set (&bitmask, 4, TRUE); + _cogl_bitmask_set (&bitmask, 5, TRUE); + + verify_bits (&bitmask, 1, 4, 5, dummy_bit, -1); + + _cogl_bitmask_set (&bitmask, 4, FALSE); + + verify_bits (&bitmask, 1, 5, dummy_bit, -1); + + _cogl_bitmask_clear_all (&bitmask); + + verify_bits (&bitmask, -1); + + if (dummy_bit != -1) + _cogl_bitmask_set (&bitmask, dummy_bit, TRUE); + + verify_bits (&bitmask, dummy_bit, -1); + + _cogl_bitmask_set (&bitmask, 1, TRUE); + _cogl_bitmask_set (&bitmask, 4, TRUE); + _cogl_bitmask_set (&bitmask, 5, TRUE); + _cogl_bitmask_set (&other_bitmask, 5, TRUE); + _cogl_bitmask_set (&other_bitmask, 6, TRUE); + + _cogl_bitmask_set_bits (&bitmask, &other_bitmask); + + verify_bits (&bitmask, 1, 4, 5, 6, dummy_bit, -1); + verify_bits (&other_bitmask, 5, 6, -1); + + _cogl_bitmask_set (&bitmask, 6, FALSE); + + verify_bits (&bitmask, 1, 4, 5, dummy_bit, -1); + + _cogl_bitmask_xor_bits (&bitmask, &other_bitmask); + + verify_bits (&bitmask, 1, 4, 6, dummy_bit, -1); + verify_bits (&other_bitmask, 5, 6, -1); + + _cogl_bitmask_set_range (&bitmask, 5, TRUE); + + verify_bits (&bitmask, 0, 1, 2, 3, 4, 6, dummy_bit, -1); + + _cogl_bitmask_set_range (&bitmask, 4, FALSE); + + verify_bits (&bitmask, 4, 6, dummy_bit, -1); + + _cogl_bitmask_destroy (&other_bitmask); + _cogl_bitmask_destroy (&bitmask); + } + + /* Extra tests for really long bitmasks */ + _cogl_bitmask_init (&bitmask); + _cogl_bitmask_set_range (&bitmask, 400, TRUE); + _cogl_bitmask_init (&other_bitmask); + _cogl_bitmask_set (&other_bitmask, 5, TRUE); + _cogl_bitmask_xor_bits (&bitmask, &other_bitmask); + + for (i = 0; i < 1024; i++) + g_assert_cmpint (_cogl_bitmask_get (&bitmask, i), + ==, + (i == 5 ? FALSE : + i < 400 ? TRUE : + FALSE)); + + _cogl_bitmask_set_range (&other_bitmask, 500, TRUE); + _cogl_bitmask_set_bits (&bitmask, &other_bitmask); + + for (i = 0; i < 1024; i++) + g_assert_cmpint (_cogl_bitmask_get (&bitmask, i), ==, (i < 500)); +} diff --git a/cogl/cogl-bitmask.h b/cogl/cogl-bitmask.h new file mode 100644 index 0000000..e0db3df --- /dev/null +++ b/cogl/cogl-bitmask.h @@ -0,0 +1,312 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_BITMASK_H +#define __COGL_BITMASK_H + +#include +#include "cogl-util.h" + +COGL_BEGIN_DECLS + +/* + * CoglBitmask implements a growable array of bits. A CoglBitmask can + * be allocated on the stack but it must be initialised with + * _cogl_bitmask_init() before use and then destroyed with + * _cogl_bitmask_destroy(). A CoglBitmask will try to avoid allocating + * any memory unless more than the number of bits in a long - 1 bits + * are needed. + * + * Internally a CoglBitmask is a pointer. If the least significant bit + * of the pointer is 1 then the rest of the bits are directly used as + * part of the bitmask, otherwise it is a pointer to a GArray of + * unsigned ints. This relies on the fact the g_malloc will return a + * pointer aligned to at least two bytes (so that the least + * significant bit of the address is always 0). It also assumes that + * the size of a pointer is always greater than or equal to the size + * of a long (although there is a compile time assert to verify this). + * + * If the maximum possible bit number in the set is known at compile + * time, it may make more sense to use the macros in cogl-flags.h + * instead of this type. + */ + +typedef struct _CoglBitmaskImaginaryType *CoglBitmask; + +/* These are internal helper macros */ +#define _cogl_bitmask_to_number(bitmask) \ + ((unsigned long) (*bitmask)) +#define _cogl_bitmask_to_bits(bitmask) \ + (_cogl_bitmask_to_number (bitmask) >> 1UL) +/* The least significant bit is set to mark that no array has been + allocated yet */ +#define _cogl_bitmask_from_bits(bits) \ + ((void *) ((((unsigned long) (bits)) << 1UL) | 1UL)) + +/* Internal helper macro to determine whether this bitmask has a + GArray allocated or whether the pointer is just used directly */ +#define _cogl_bitmask_has_array(bitmask) \ + (!(_cogl_bitmask_to_number (bitmask) & 1UL)) + +/* Number of bits we can use before needing to allocate an array */ +#define COGL_BITMASK_MAX_DIRECT_BITS (sizeof (unsigned long) * 8 - 1) + +/* + * _cogl_bitmask_init: + * @bitmask: A pointer to a bitmask + * + * Initialises the cogl bitmask. This must be called before any other + * bitmask functions are called. Initially all of the values are + * zero + */ +#define _cogl_bitmask_init(bitmask) \ + G_STMT_START { *(bitmask) = _cogl_bitmask_from_bits (0); } G_STMT_END + +CoglBool +_cogl_bitmask_get_from_array (const CoglBitmask *bitmask, + unsigned int bit_num); + +void +_cogl_bitmask_set_in_array (CoglBitmask *bitmask, + unsigned int bit_num, + CoglBool value); + +void +_cogl_bitmask_set_range_in_array (CoglBitmask *bitmask, + unsigned int n_bits, + CoglBool value); + +void +_cogl_bitmask_clear_all_in_array (CoglBitmask *bitmask); + +void +_cogl_bitmask_set_flags_array (const CoglBitmask *bitmask, + unsigned long *flags); + +int +_cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask); + +int +_cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask, + int upto); + +/* + * cogl_bitmask_set_bits: + * @dst: The bitmask to modify + * @src: The bitmask to copy bits from + * + * This makes sure that all of the bits that are set in @src are also + * set in @dst. Any unset bits in @src are left alone in @dst. + */ +void +_cogl_bitmask_set_bits (CoglBitmask *dst, + const CoglBitmask *src); + +/* + * cogl_bitmask_xor_bits: + * @dst: The bitmask to modify + * @src: The bitmask to copy bits from + * + * For every bit that is set in src, the corresponding bit in dst is + * inverted. + */ +void +_cogl_bitmask_xor_bits (CoglBitmask *dst, + const CoglBitmask *src); + +/* The foreach function can return FALSE to stop iteration */ +typedef CoglBool (* CoglBitmaskForeachFunc) (int bit_num, void *user_data); + +/* + * cogl_bitmask_foreach: + * @bitmask: A pointer to a bitmask + * @func: A callback function + * @user_data: A pointer to pass to the callback + * + * This calls @func for each bit that is set in @bitmask. + */ +void +_cogl_bitmask_foreach (const CoglBitmask *bitmask, + CoglBitmaskForeachFunc func, + void *user_data); + +/* + * _cogl_bitmask_get: + * @bitmask: A pointer to a bitmask + * @bit_num: A bit number + * + * Return value: whether bit number @bit_num is set in @bitmask + */ +static inline CoglBool +_cogl_bitmask_get (const CoglBitmask *bitmask, unsigned int bit_num) +{ + if (_cogl_bitmask_has_array (bitmask)) + return _cogl_bitmask_get_from_array (bitmask, bit_num); + else if (bit_num >= COGL_BITMASK_MAX_DIRECT_BITS) + return FALSE; + else + return !!(_cogl_bitmask_to_bits (bitmask) & (1UL << bit_num)); +} + +/* + * _cogl_bitmask_set: + * @bitmask: A pointer to a bitmask + * @bit_num: A bit number + * @value: The new value + * + * Sets or resets a bit number @bit_num in @bitmask according to @value. + */ +static inline void +_cogl_bitmask_set (CoglBitmask *bitmask, unsigned int bit_num, CoglBool value) +{ + if (_cogl_bitmask_has_array (bitmask) || + bit_num >= COGL_BITMASK_MAX_DIRECT_BITS) + _cogl_bitmask_set_in_array (bitmask, bit_num, value); + else if (value) + *bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) | + (1UL << bit_num)); + else + *bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) & + ~(1UL << bit_num)); +} + +/* + * _cogl_bitmask_set_range: + * @bitmask: A pointer to a bitmask + * @n_bits: The number of bits to set + * @value: The value to set + * + * Sets the first @n_bits in @bitmask to @value. + */ +static inline void +_cogl_bitmask_set_range (CoglBitmask *bitmask, + unsigned int n_bits, + CoglBool value) +{ + if (_cogl_bitmask_has_array (bitmask) || + n_bits > COGL_BITMASK_MAX_DIRECT_BITS) + _cogl_bitmask_set_range_in_array (bitmask, n_bits, value); + else if (value) + *bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) | + ~(~0UL << n_bits)); + else + *bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) & + (~0UL << n_bits)); +} + +/* + * _cogl_bitmask_destroy: + * @bitmask: A pointer to a bitmask + * + * Destroys any resources allocated by the bitmask + */ +static inline void +_cogl_bitmask_destroy (CoglBitmask *bitmask) +{ + if (_cogl_bitmask_has_array (bitmask)) + g_array_free ((GArray *) *bitmask, TRUE); +} + +/* + * _cogl_bitmask_clear_all: + * @bitmask: A pointer to a bitmask + * + * Clears all the bits in a bitmask without destroying any resources. + */ +static inline void +_cogl_bitmask_clear_all (CoglBitmask *bitmask) +{ + if (_cogl_bitmask_has_array (bitmask)) + _cogl_bitmask_clear_all_in_array (bitmask); + else + *bitmask = _cogl_bitmask_from_bits (0); +} + +/* + * _cogl_bitmask_set_flags: + * @bitmask: A pointer to a bitmask + * @flags: An array of flags + * + * Bitwise or's the bits from @bitmask into the flags array (see + * cogl-flags) pointed to by @flags. + */ +static inline void +_cogl_bitmask_set_flags (const CoglBitmask *bitmask, + unsigned long *flags) +{ + if (_cogl_bitmask_has_array (bitmask)) + _cogl_bitmask_set_flags_array (bitmask, flags); + else + flags[0] |= _cogl_bitmask_to_bits (bitmask); +} + +/* + * _cogl_bitmask_popcount: + * @bitmask: A pointer to a bitmask + * + * Counts the number of bits that are set in the bitmask. + * + * Return value: the number of bits set in @bitmask. + */ +static inline int +_cogl_bitmask_popcount (const CoglBitmask *bitmask) +{ + return (_cogl_bitmask_has_array (bitmask) ? + _cogl_bitmask_popcount_in_array (bitmask) : + _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask))); +} + +/* + * _cogl_bitmask_popcount: + * @Bitmask: A pointer to a bitmask + * @upto: The maximum bit index to consider + * + * Counts the number of bits that are set and have an index which is + * less than @upto. + * + * Return value: the number of bits set in @bitmask that are less than @upto. + */ +static inline int +_cogl_bitmask_popcount_upto (const CoglBitmask *bitmask, + int upto) +{ + if (_cogl_bitmask_has_array (bitmask)) + return _cogl_bitmask_popcount_upto_in_array (bitmask, upto); + else if (upto >= COGL_BITMASK_MAX_DIRECT_BITS) + return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask)); + else + return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask) & + ((1UL << upto) - 1)); +} + +COGL_END_DECLS + +#endif /* __COGL_BITMASK_H */ diff --git a/cogl/cogl-blend-string.c b/cogl/cogl-blend-string.c new file mode 100644 index 0000000..16cb3ab --- /dev/null +++ b/cogl/cogl-blend-string.c @@ -0,0 +1,1003 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-context-private.h" +#include "cogl-debug.h" +#include "cogl-blend-string.h" +#include "cogl-error-private.h" + +typedef enum _ParserState +{ + PARSER_STATE_EXPECT_DEST_CHANNELS, + PARSER_STATE_SCRAPING_DEST_CHANNELS, + PARSER_STATE_EXPECT_FUNCTION_NAME, + PARSER_STATE_SCRAPING_FUNCTION_NAME, + PARSER_STATE_EXPECT_ARG_START, + PARSER_STATE_EXPECT_STATEMENT_END +} ParserState; + +typedef enum _ParserArgState +{ + PARSER_ARG_STATE_START, + PARSER_ARG_STATE_EXPECT_MINUS, + PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME, + PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME, + PARSER_ARG_STATE_MAYBE_COLOR_MASK, + PARSER_ARG_STATE_SCRAPING_MASK, + PARSER_ARG_STATE_MAYBE_MULT, + PARSER_ARG_STATE_EXPECT_OPEN_PAREN, + PARSER_ARG_STATE_EXPECT_FACTOR, + PARSER_ARG_STATE_MAYBE_SRC_ALPHA_SATURATE, + PARSER_ARG_STATE_MAYBE_MINUS, + PARSER_ARG_STATE_EXPECT_CLOSE_PAREN, + PARSER_ARG_STATE_EXPECT_END +} ParserArgState; + + +#define DEFINE_COLOR_SOURCE(NAME, NAME_LEN) \ + {/*.type = */COGL_BLEND_STRING_COLOR_SOURCE_ ## NAME, \ + /*.name = */#NAME, \ + /*.name_len = */NAME_LEN} + +static CoglBlendStringColorSourceInfo blending_color_sources[] = { + DEFINE_COLOR_SOURCE (SRC_COLOR, 9), + DEFINE_COLOR_SOURCE (DST_COLOR, 9), + DEFINE_COLOR_SOURCE (CONSTANT, 8) +}; + +static CoglBlendStringColorSourceInfo tex_combine_color_sources[] = { + DEFINE_COLOR_SOURCE (TEXTURE, 7), + /* DEFINE_COLOR_SOURCE (TEXTURE_N, *) - handled manually */ + DEFINE_COLOR_SOURCE (PRIMARY, 7), + DEFINE_COLOR_SOURCE (CONSTANT, 8), + DEFINE_COLOR_SOURCE (PREVIOUS, 8) +}; + +static CoglBlendStringColorSourceInfo tex_combine_texture_n_color_source = { + /*.type = */COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N, + /*.name = */"TEXTURE_N", + /*.name_len = */0 +}; + +#undef DEFINE_COLOR_SOURCE + +#define DEFINE_FUNCTION(NAME, NAME_LEN, ARGC) \ + { /*.type = */COGL_BLEND_STRING_FUNCTION_ ## NAME, \ + /*.name = */#NAME, \ + /*.name_len = */NAME_LEN, \ + /*.argc = */ARGC } + +/* NB: These must be sorted so any name that's a subset of another + * comes later than the longer name. */ +static CoglBlendStringFunctionInfo tex_combine_functions[] = { + DEFINE_FUNCTION (REPLACE, 7, 1), + DEFINE_FUNCTION (MODULATE, 8, 2), + DEFINE_FUNCTION (ADD_SIGNED, 10, 2), + DEFINE_FUNCTION (ADD, 3, 2), + DEFINE_FUNCTION (INTERPOLATE, 11, 3), + DEFINE_FUNCTION (SUBTRACT, 8, 2), + DEFINE_FUNCTION (DOT3_RGBA, 9, 2), + DEFINE_FUNCTION (DOT3_RGB, 8, 2) +}; + +static CoglBlendStringFunctionInfo blend_functions[] = { + DEFINE_FUNCTION (ADD, 3, 2) +}; + +#undef DEFINE_FUNCTION + +uint32_t +cogl_blend_string_error_quark (void) +{ + return g_quark_from_static_string ("cogl-blend-string-error-quark"); +} + +void +_cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement, + CoglBlendStringStatement *rgb, + CoglBlendStringStatement *a) +{ + int i; + + memcpy (rgb, statement, sizeof (CoglBlendStringStatement)); + memcpy (a, statement, sizeof (CoglBlendStringStatement)); + + rgb->mask = COGL_BLEND_STRING_CHANNEL_MASK_RGB; + a->mask = COGL_BLEND_STRING_CHANNEL_MASK_ALPHA; + + for (i = 0; i < statement->function->argc; i++) + { + CoglBlendStringArgument *arg = &statement->args[i]; + CoglBlendStringArgument *rgb_arg = &rgb->args[i]; + CoglBlendStringArgument *a_arg = &a->args[i]; + + if (arg->source.mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA) + { + rgb_arg->source.mask = COGL_BLEND_STRING_CHANNEL_MASK_RGB; + a_arg->source.mask = COGL_BLEND_STRING_CHANNEL_MASK_ALPHA; + } + + if (arg->factor.is_color && + arg->factor.source.mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA) + { + rgb_arg->factor.source.mask = COGL_BLEND_STRING_CHANNEL_MASK_RGB; + a_arg->factor.source.mask = COGL_BLEND_STRING_CHANNEL_MASK_ALPHA; + } + } +} + +static CoglBool +validate_tex_combine_statements (CoglBlendStringStatement *statements, + int n_statements, + CoglError **error) +{ + int i, j; + const char *error_string; + CoglBlendStringError detail = COGL_BLEND_STRING_ERROR_INVALID_ERROR; + + for (i = 0; i < n_statements; i++) + { + for (j = 0; j < statements[i].function->argc; j++) + { + CoglBlendStringArgument *arg = &statements[i].args[j]; + if (arg->source.is_zero) + { + error_string = "You can't use the constant '0' as a texture " + "combine argument"; + goto error; + } + if (!arg->factor.is_one) + { + error_string = "Argument factors are only relevant to blending " + "not texture combining"; + goto error; + } + } + } + + return TRUE; + +error: + _cogl_set_error (error, + COGL_BLEND_STRING_ERROR, + detail, + "Invalid texture combine string: %s", + error_string); + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + g_debug ("Invalid texture combine string: %s", + error_string); + } + return FALSE; +} + +static CoglBool +validate_blend_statements (CoglBlendStringStatement *statements, + int n_statements, + CoglError **error) +{ + int i, j; + const char *error_string; + CoglBlendStringError detail = COGL_BLEND_STRING_ERROR_INVALID_ERROR; + + _COGL_GET_CONTEXT (ctx, 0); + + if (n_statements == 2 && + !ctx->glBlendEquationSeparate && + statements[0].function->type != statements[1].function->type) + { + error_string = "Separate blend functions for the RGB an A " + "channels isn't supported by the driver"; + detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR; + goto error; + } + + for (i = 0; i < n_statements; i++) + for (j = 0; j < statements[i].function->argc; j++) + { + CoglBlendStringArgument *arg = &statements[i].args[j]; + + if (arg->source.is_zero) + continue; + + if ((j == 0 && + arg->source.info->type != + COGL_BLEND_STRING_COLOR_SOURCE_SRC_COLOR) + || (j == 1 && + arg->source.info->type != + COGL_BLEND_STRING_COLOR_SOURCE_DST_COLOR)) + { + error_string = "For blending you must always use SRC_COLOR " + "for arg0 and DST_COLOR for arg1"; + goto error; + } + + if (!_cogl_has_private_feature (ctx, + COGL_PRIVATE_FEATURE_BLEND_CONSTANT) && + arg->factor.is_color && + (arg->factor.source.info->type == + COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT)) + { + error_string = "Driver doesn't support constant blend factors"; + detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR; + goto error; + } + } + + return TRUE; + +error: + _cogl_set_error (error, + COGL_BLEND_STRING_ERROR, + detail, + "Invalid blend string: %s", + error_string); + return FALSE; +} + +static CoglBool +validate_statements_for_context (CoglBlendStringStatement *statements, + int n_statements, + CoglBlendStringContext context, + CoglError **error) +{ + const char *error_string; + + if (n_statements == 1) + { + if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + { + error_string = "You need to also give a blend statement for the RGB" + "channels"; + goto error; + } + else if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGB) + { + error_string = "You need to also give a blend statement for the " + "Alpha channel"; + goto error; + } + } + + if (context == COGL_BLEND_STRING_CONTEXT_BLENDING) + return validate_blend_statements (statements, n_statements, error); + else + return validate_tex_combine_statements (statements, n_statements, error); + +error: + _cogl_set_error (error, + COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_INVALID_ERROR, + "Invalid %s string: %s", + context == COGL_BLEND_STRING_CONTEXT_BLENDING ? + "blend" : "texture combine", + error_string); + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + g_debug ("Invalid %s string: %s", + context == COGL_BLEND_STRING_CONTEXT_BLENDING ? + "blend" : "texture combine", + error_string); + } + + return FALSE; +} + +static void +print_argument (CoglBlendStringArgument *arg) +{ + const char *mask_names[] = { + "RGB", + "A", + "RGBA" + }; + + g_print (" Arg:\n"); + g_print (" is zero = %s\n", arg->source.is_zero ? "yes" : "no"); + if (!arg->source.is_zero) + { + g_print (" color source = %s\n", arg->source.info->name); + g_print (" one minus = %s\n", arg->source.one_minus ? "yes" : "no"); + g_print (" mask = %s\n", mask_names[arg->source.mask]); + g_print (" texture = %d\n", arg->source.texture); + g_print ("\n"); + g_print (" factor is_one = %s\n", arg->factor.is_one ? "yes" : "no"); + g_print (" factor is_src_alpha_saturate = %s\n", + arg->factor.is_src_alpha_saturate ? "yes" : "no"); + g_print (" factor is_color = %s\n", arg->factor.is_color ? "yes" : "no"); + if (arg->factor.is_color) + { + g_print (" factor color:is zero = %s\n", + arg->factor.source.is_zero ? "yes" : "no"); + g_print (" factor color:color source = %s\n", + arg->factor.source.info->name); + g_print (" factor color:one minus = %s\n", + arg->factor.source.one_minus ? "yes" : "no"); + g_print (" factor color:mask = %s\n", + mask_names[arg->factor.source.mask]); + g_print (" factor color:texture = %d\n", + arg->factor.source.texture); + } + } +} + +static void +print_statement (int num, CoglBlendStringStatement *statement) +{ + const char *mask_names[] = { + "RGB", + "A", + "RGBA" + }; + int i; + g_print ("Statement %d:\n", num); + g_print (" Destination channel mask = %s\n", + mask_names[statement->mask]); + g_print (" Function = %s\n", statement->function->name); + for (i = 0; i < statement->function->argc; i++) + print_argument (&statement->args[i]); +} + +static const CoglBlendStringFunctionInfo * +get_function_info (const char *mark, + const char *p, + CoglBlendStringContext context) +{ + size_t len = p - mark; + CoglBlendStringFunctionInfo *functions; + size_t array_len; + int i; + + if (context == COGL_BLEND_STRING_CONTEXT_BLENDING) + { + functions = blend_functions; + array_len = G_N_ELEMENTS (blend_functions); + } + else + { + functions = tex_combine_functions; + array_len = G_N_ELEMENTS (tex_combine_functions); + } + + for (i = 0; i < array_len; i++) + { + if (len >= functions[i].name_len + && strncmp (mark, functions[i].name, functions[i].name_len) == 0) + return &functions[i]; + } + return NULL; +} + +static const CoglBlendStringColorSourceInfo * +get_color_src_info (const char *mark, + const char *p, + CoglBlendStringContext context) +{ + size_t len = p - mark; + CoglBlendStringColorSourceInfo *sources; + size_t array_len; + int i; + + if (context == COGL_BLEND_STRING_CONTEXT_BLENDING) + { + sources = blending_color_sources; + array_len = G_N_ELEMENTS (blending_color_sources); + } + else + { + sources = tex_combine_color_sources; + array_len = G_N_ELEMENTS (tex_combine_color_sources); + } + + if (len >= 8 && + strncmp (mark, "TEXTURE_", 8) == 0 && + g_ascii_isdigit (mark[8])) + { + return &tex_combine_texture_n_color_source; + } + + for (i = 0; i < array_len; i++) + { + if (len >= sources[i].name_len + && strncmp (mark, sources[i].name, sources[i].name_len) == 0) + return &sources[i]; + } + + return NULL; +} + +static CoglBool +is_symbol_char (const char c) +{ + return (g_ascii_isalpha (c) || c == '_') ? TRUE : FALSE; +} + +static CoglBool +is_alphanum_char (const char c) +{ + return (g_ascii_isalnum (c) || c == '_') ? TRUE : FALSE; +} + +static CoglBool +parse_argument (const char *string, /* original user string */ + const char **ret_p, /* start of argument IN:OUT */ + const CoglBlendStringStatement *statement, + int current_arg, + CoglBlendStringArgument *arg, /* OUT */ + CoglBlendStringContext context, + CoglError **error) +{ + const char *p = *ret_p; + const char *mark = NULL; + const char *error_string = NULL; + ParserArgState state = PARSER_ARG_STATE_START; + CoglBool parsing_factor = FALSE; + CoglBool implicit_factor_brace; + + arg->source.is_zero = FALSE; + arg->source.info = NULL; + arg->source.texture = 0; + arg->source.one_minus = FALSE; + arg->source.mask = statement->mask; + + arg->factor.is_one = FALSE; + arg->factor.is_color = FALSE; + arg->factor.is_src_alpha_saturate = FALSE; + + arg->factor.source.is_zero = FALSE; + arg->factor.source.info = NULL; + arg->factor.source.texture = 0; + arg->factor.source.one_minus = FALSE; + arg->factor.source.mask = statement->mask; + + do + { + if (g_ascii_isspace (*p)) + continue; + + if (*p == '\0') + { + error_string = "Unexpected end of string while parsing argument"; + goto error; + } + + switch (state) + { + case PARSER_ARG_STATE_START: + if (*p == '1') + state = PARSER_ARG_STATE_EXPECT_MINUS; + else if (*p == '0') + { + arg->source.is_zero = TRUE; + state = PARSER_ARG_STATE_EXPECT_END; + } + else + { + p--; /* backtrack */ + state = PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME; + } + continue; + + case PARSER_ARG_STATE_EXPECT_MINUS: + if (*p != '-') + { + error_string = "expected a '-' following the 1"; + goto error; + } + arg->source.one_minus = TRUE; + state = PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME; + continue; + + case PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME: + if (!is_symbol_char (*p)) + { + error_string = "expected a color source name"; + goto error; + } + state = PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME; + mark = p; + if (parsing_factor) + arg->factor.is_color = TRUE; + + /* fall through */ + case PARSER_ARG_STATE_SCRAPING_COLOR_SRC_NAME: + if (!is_symbol_char (*p)) + { + CoglBlendStringColorSource *source = + parsing_factor ? &arg->factor.source : &arg->source; + source->info = get_color_src_info (mark, p, context); + if (!source->info) + { + error_string = "Unknown color source name"; + goto error; + } + if (source->info->type == + COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N) + { + char *endp; + source->texture = + strtoul (&mark[strlen ("TEXTURE_")], &endp, 10); + if (mark == endp) + { + error_string = "invalid texture number given with " + "TEXTURE_N color source"; + goto error; + } + p = endp; + } + state = PARSER_ARG_STATE_MAYBE_COLOR_MASK; + } + else + continue; + + /* fall through */ + case PARSER_ARG_STATE_MAYBE_COLOR_MASK: + if (*p != '[') + { + p--; /* backtrack */ + if (!parsing_factor) + state = PARSER_ARG_STATE_MAYBE_MULT; + else + state = PARSER_ARG_STATE_EXPECT_END; + continue; + } + state = PARSER_ARG_STATE_SCRAPING_MASK; + mark = p; + + /* fall through */ + case PARSER_ARG_STATE_SCRAPING_MASK: + if (*p == ']') + { + size_t len = p - mark; + CoglBlendStringColorSource *source = + parsing_factor ? &arg->factor.source : &arg->source; + + if (len == 5 && strncmp (mark, "[RGBA", len) == 0) + { + if (statement->mask != COGL_BLEND_STRING_CHANNEL_MASK_RGBA) + { + error_string = "You can't use an RGBA color mask if the " + "statement hasn't also got an RGBA= mask"; + goto error; + } + source->mask = COGL_BLEND_STRING_CHANNEL_MASK_RGBA; + } + else if (len == 4 && strncmp (mark, "[RGB", len) == 0) + source->mask = COGL_BLEND_STRING_CHANNEL_MASK_RGB; + else if (len == 2 && strncmp (mark, "[A", len) == 0) + source->mask = COGL_BLEND_STRING_CHANNEL_MASK_ALPHA; + else + { + error_string = "Expected a channel mask of [RGBA]" + "[RGB] or [A]"; + goto error; + } + if (parsing_factor) + state = PARSER_ARG_STATE_EXPECT_CLOSE_PAREN; + else + state = PARSER_ARG_STATE_MAYBE_MULT; + } + continue; + + case PARSER_ARG_STATE_EXPECT_OPEN_PAREN: + if (*p != '(') + { + if (is_alphanum_char (*p)) + { + p--; /* compensate for implicit brace and ensure this + * char gets considered part of the blend factor */ + implicit_factor_brace = TRUE; + } + else + { + error_string = "Expected '(' around blend factor or alpha " + "numeric character for blend factor name"; + goto error; + } + } + else + implicit_factor_brace = FALSE; + parsing_factor = TRUE; + state = PARSER_ARG_STATE_EXPECT_FACTOR; + continue; + + case PARSER_ARG_STATE_EXPECT_FACTOR: + if (*p == '1') + state = PARSER_ARG_STATE_MAYBE_MINUS; + else if (*p == '0') + { + arg->source.is_zero = TRUE; + state = PARSER_ARG_STATE_EXPECT_CLOSE_PAREN; + } + else + { + state = PARSER_ARG_STATE_MAYBE_SRC_ALPHA_SATURATE; + mark = p; + } + continue; + + case PARSER_ARG_STATE_MAYBE_SRC_ALPHA_SATURATE: + if (!is_symbol_char (*p)) + { + size_t len = p - mark; + if (len >= strlen ("SRC_ALPHA_SATURATE") && + strncmp (mark, "SRC_ALPHA_SATURATE", len) == 0) + { + arg->factor.is_src_alpha_saturate = TRUE; + state = PARSER_ARG_STATE_EXPECT_CLOSE_PAREN; + } + else + { + state = PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME; + p = mark - 1; /* backtrack */ + } + } + continue; + + case PARSER_ARG_STATE_MAYBE_MINUS: + if (*p == '-') + { + if (implicit_factor_brace) + { + error_string = "Expected ( ) braces around blend factor with " + "a subtraction"; + goto error; + } + arg->factor.source.one_minus = TRUE; + state = PARSER_ARG_STATE_EXPECT_COLOR_SRC_NAME; + } + else + { + arg->factor.is_one = TRUE; + state = PARSER_ARG_STATE_EXPECT_CLOSE_PAREN; + } + continue; + + case PARSER_ARG_STATE_EXPECT_CLOSE_PAREN: + if (implicit_factor_brace) + { + p--; + state = PARSER_ARG_STATE_EXPECT_END; + continue; + } + if (*p != ')') + { + error_string = "Expected closing parenthesis after blend factor"; + goto error; + } + state = PARSER_ARG_STATE_EXPECT_END; + continue; + + case PARSER_ARG_STATE_MAYBE_MULT: + if (*p == '*') + { + state = PARSER_ARG_STATE_EXPECT_OPEN_PAREN; + continue; + } + arg->factor.is_one = TRUE; + state = PARSER_ARG_STATE_EXPECT_END; + + /* fall through */ + case PARSER_ARG_STATE_EXPECT_END: + if (*p != ',' && *p != ')') + { + error_string = "expected , or )"; + goto error; + } + + *ret_p = p - 1; + return TRUE; + } + } + while (p++); + +error: + { + int offset = p - string; + _cogl_set_error (error, + COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, + "Syntax error for argument %d at offset %d: %s", + current_arg, + offset, + error_string); + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + g_debug ("Syntax error for argument %d at offset %d: %s", + current_arg, offset, error_string); + } + return FALSE; + } +} + +int +_cogl_blend_string_compile (const char *string, + CoglBlendStringContext context, + CoglBlendStringStatement *statements, + CoglError **error) +{ + const char *p = string; + const char *mark = NULL; + const char *error_string; + ParserState state = PARSER_STATE_EXPECT_DEST_CHANNELS; + CoglBlendStringStatement *statement = statements; + int current_statement = 0; + int current_arg = 0; + int remaining_argc = 0; + +#if 0 + COGL_DEBUG_SET_FLAG (COGL_DEBUG_BLEND_STRINGS); +#endif + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + COGL_NOTE (BLEND_STRINGS, "Compiling %s string:\n%s\n", + context == COGL_BLEND_STRING_CONTEXT_BLENDING ? + "blend" : "texture combine", + string); + } + + do + { + if (g_ascii_isspace (*p)) + continue; + + if (*p == '\0') + { + switch (state) + { + case PARSER_STATE_EXPECT_DEST_CHANNELS: + if (current_statement != 0) + goto finished; + error_string = "Empty statement"; + goto error; + case PARSER_STATE_SCRAPING_DEST_CHANNELS: + error_string = "Expected an '=' following the destination " + "channel mask"; + goto error; + case PARSER_STATE_EXPECT_FUNCTION_NAME: + error_string = "Expected a function name"; + goto error; + case PARSER_STATE_SCRAPING_FUNCTION_NAME: + error_string = "Expected parenthesis after the function name"; + goto error; + case PARSER_STATE_EXPECT_ARG_START: + error_string = "Expected to find the start of an argument"; + goto error; + case PARSER_STATE_EXPECT_STATEMENT_END: + error_string = "Expected closing parenthesis for statement"; + goto error; + } + } + + switch (state) + { + case PARSER_STATE_EXPECT_DEST_CHANNELS: + mark = p; + state = PARSER_STATE_SCRAPING_DEST_CHANNELS; + + /* fall through */ + case PARSER_STATE_SCRAPING_DEST_CHANNELS: + if (*p != '=') + continue; + if (strncmp (mark, "RGBA", 4) == 0) + statement->mask = COGL_BLEND_STRING_CHANNEL_MASK_RGBA; + else if (strncmp (mark, "RGB", 3) == 0) + statement->mask = COGL_BLEND_STRING_CHANNEL_MASK_RGB; + else if (strncmp (mark, "A", 1) == 0) + statement->mask = COGL_BLEND_STRING_CHANNEL_MASK_ALPHA; + else + { + error_string = "Unknown destination channel mask; " + "expected RGBA=, RGB= or A="; + goto error; + } + state = PARSER_STATE_EXPECT_FUNCTION_NAME; + continue; + + case PARSER_STATE_EXPECT_FUNCTION_NAME: + mark = p; + state = PARSER_STATE_SCRAPING_FUNCTION_NAME; + + /* fall through */ + case PARSER_STATE_SCRAPING_FUNCTION_NAME: + if (*p != '(') + { + if (!is_alphanum_char (*p)) + { + error_string = "non alpha numeric character in function" + "name"; + goto error; + } + continue; + } + statement->function = get_function_info (mark, p, context); + if (!statement->function) + { + error_string = "Unknown function name"; + goto error; + } + remaining_argc = statement->function->argc; + current_arg = 0; + state = PARSER_STATE_EXPECT_ARG_START; + + /* fall through */ + case PARSER_STATE_EXPECT_ARG_START: + if (*p != '(' && *p != ',') + continue; + if (remaining_argc) + { + p++; /* parse_argument expects to see the first char of the arg */ + if (!parse_argument (string, &p, statement, + current_arg, &statement->args[current_arg], + context, error)) + return 0; + current_arg++; + remaining_argc--; + } + if (!remaining_argc) + state = PARSER_STATE_EXPECT_STATEMENT_END; + continue; + + case PARSER_STATE_EXPECT_STATEMENT_END: + if (*p != ')') + { + error_string = "Expected end of statement"; + goto error; + } + state = PARSER_STATE_EXPECT_DEST_CHANNELS; + if (current_statement++ == 1) + goto finished; + statement = &statements[current_statement]; + } + } + while (p++); + +finished: + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + if (current_statement > 0) + print_statement (0, &statements[0]); + if (current_statement > 1) + print_statement (1, &statements[1]); + } + + if (!validate_statements_for_context (statements, + current_statement, + context, + error)) + return 0; + + return current_statement; + +error: + { + int offset = p - string; + _cogl_set_error (error, + COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_PARSE_ERROR, + "Syntax error at offset %d: %s", + offset, + error_string); + + if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) + { + g_debug ("Syntax error at offset %d: %s", + offset, error_string); + } + return 0; + } +} + +/* + * INTERNAL TESTING CODE ... + */ + +struct _TestString +{ + const char *string; + CoglBlendStringContext context; +}; + +/* FIXME: this should probably be moved to a unit test */ +int +_cogl_blend_string_test (void); + +int +_cogl_blend_string_test (void) +{ + struct _TestString strings[] = { + {" A = MODULATE ( TEXTURE[RGB], PREVIOUS[A], PREVIOUS[A] ) ", + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE }, + {" RGB = MODULATE ( TEXTURE[RGB], PREVIOUS[A] ) ", + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE }, + {"A=ADD(TEXTURE[A],PREVIOUS[RGB])", + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE }, + {"A=ADD(TEXTURE[A],PREVIOUS[RGB])", + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE }, + + {"RGBA = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))", + COGL_BLEND_STRING_CONTEXT_BLENDING }, + {"RGB = ADD(SRC_COLOR, DST_COLOR*(0))", + COGL_BLEND_STRING_CONTEXT_BLENDING }, + {"RGB = ADD(SRC_COLOR, 0)", + COGL_BLEND_STRING_CONTEXT_BLENDING }, + {"RGB = ADD()", + COGL_BLEND_STRING_CONTEXT_BLENDING }, + {"RGB = ADD(SRC_COLOR, 0, DST_COLOR)", + COGL_BLEND_STRING_CONTEXT_BLENDING }, + {NULL} + }; + int i; + + CoglError *error = NULL; + for (i = 0; strings[i].string; i++) + { + CoglBlendStringStatement statements[2]; + int count = _cogl_blend_string_compile (strings[i].string, + strings[i].context, + statements, + &error); + if (!count) + { + g_print ("Failed to parse string:\n%s\n%s\n", + strings[i].string, + error->message); + cogl_error_free (error); + error = NULL; + continue; + } + g_print ("Original:\n"); + g_print ("%s\n", strings[i].string); + if (count > 0) + print_statement (0, &statements[0]); + if (count > 1) + print_statement (1, &statements[1]); + } + + return 0; +} + diff --git a/cogl/cogl-blend-string.h b/cogl/cogl-blend-string.h new file mode 100644 index 0000000..355338c --- /dev/null +++ b/cogl/cogl-blend-string.h @@ -0,0 +1,144 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef COGL_BLEND_STRING_H +#define COGL_BLEND_STRING_H + +#include +#include + +typedef enum _CoglBlendStringContext +{ + COGL_BLEND_STRING_CONTEXT_BLENDING, + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE +} CoglBlendStringContext; + +/* NB: debug stringify code will get upset if these + * are re-ordered */ +typedef enum _CoglBlendStringChannelMask +{ + COGL_BLEND_STRING_CHANNEL_MASK_RGB, + COGL_BLEND_STRING_CHANNEL_MASK_ALPHA, + COGL_BLEND_STRING_CHANNEL_MASK_RGBA +} CoglBlendStringChannelMask; + +typedef enum _CoglBlendStringColorSourceType +{ + /* blending */ + COGL_BLEND_STRING_COLOR_SOURCE_SRC_COLOR, + COGL_BLEND_STRING_COLOR_SOURCE_DST_COLOR, + + /* shared */ + COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT, + + /* texture combining */ + COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE, + COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N, + COGL_BLEND_STRING_COLOR_SOURCE_PRIMARY, + COGL_BLEND_STRING_COLOR_SOURCE_PREVIOUS +} CoglBlendStringColorSourceType; + +typedef struct _CoglBlendStringColorSourceInfo +{ + CoglBlendStringColorSourceType type; + const char *name; + size_t name_len; +} CoglBlendStringColorSourceInfo; + +typedef struct _CoglBlendStringColorSource +{ + CoglBool is_zero; + const CoglBlendStringColorSourceInfo *info; + int texture; /* for the TEXTURE_N color source */ + CoglBool one_minus; + CoglBlendStringChannelMask mask; +} CoglBlendStringColorSource; + +typedef struct _CoglBlendStringFactor +{ + CoglBool is_one; + CoglBool is_src_alpha_saturate; + CoglBool is_color; + CoglBlendStringColorSource source; +} CoglBlendStringFactor; + +typedef struct _CoglBlendStringArgument +{ + CoglBlendStringColorSource source; + CoglBlendStringFactor factor; +} CoglBlendStringArgument; + +typedef enum _CoglBlendStringFunctionType +{ + /* shared */ + COGL_BLEND_STRING_FUNCTION_ADD, + + /* texture combine only */ + COGL_BLEND_STRING_FUNCTION_REPLACE, + COGL_BLEND_STRING_FUNCTION_MODULATE, + COGL_BLEND_STRING_FUNCTION_ADD_SIGNED, + COGL_BLEND_STRING_FUNCTION_INTERPOLATE, + COGL_BLEND_STRING_FUNCTION_SUBTRACT, + COGL_BLEND_STRING_FUNCTION_DOT3_RGB, + COGL_BLEND_STRING_FUNCTION_DOT3_RGBA +} CoglBlendStringFunctionType; + +typedef struct _CoglBlendStringFunctionInfo +{ + enum _CoglBlendStringFunctionType type; + const char *name; + size_t name_len; + int argc; +} CoglBlendStringFunctionInfo; + +typedef struct _CoglBlendStringStatement +{ + CoglBlendStringChannelMask mask; + const CoglBlendStringFunctionInfo *function; + CoglBlendStringArgument args[3]; +} CoglBlendStringStatement; + + +CoglBool +_cogl_blend_string_compile (const char *string, + CoglBlendStringContext context, + CoglBlendStringStatement *statements, + CoglError **error); + +void +_cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement, + CoglBlendStringStatement *rgb, + CoglBlendStringStatement *a); + +#endif /* COGL_BLEND_STRING_H */ + diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c new file mode 100644 index 0000000..a6d60ef --- /dev/null +++ b/cogl/cogl-blit.c @@ -0,0 +1,438 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-blit.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-private.h" +#include "cogl1-context.h" + +static const CoglBlitMode *_cogl_blit_default_mode = NULL; + +static CoglBool +_cogl_blit_texture_render_begin (CoglBlitData *data) +{ + CoglContext *ctx = data->src_tex->context; + CoglOffscreen *offscreen; + CoglFramebuffer *fb; + CoglPipeline *pipeline; + unsigned int dst_width, dst_height; + CoglError *ignore_error = NULL; + + offscreen = _cogl_offscreen_new_with_texture_full + (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + fb = COGL_FRAMEBUFFER (offscreen); + if (!cogl_framebuffer_allocate (fb, &ignore_error)) + { + cogl_error_free (ignore_error); + cogl_object_unref (fb); + return FALSE; + } + + data->dest_fb = fb; + + dst_width = cogl_texture_get_width (data->dst_tex); + dst_height = cogl_texture_get_height (data->dst_tex); + + /* Set up an orthographic projection so we can use pixel + coordinates to render to the texture */ + cogl_framebuffer_orthographic (fb, + 0, 0, dst_width, dst_height, + -1 /* near */, 1 /* far */); + + /* We cache a pipeline used for migrating on to the context so + that it doesn't have to continuously regenerate a shader + program */ + if (ctx->blit_texture_pipeline == NULL) + { + ctx->blit_texture_pipeline = cogl_pipeline_new (ctx); + + cogl_pipeline_set_layer_filters (ctx->blit_texture_pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + /* Disable blending by just directly taking the contents of the + source texture */ + cogl_pipeline_set_blend (ctx->blit_texture_pipeline, + "RGBA = ADD(SRC_COLOR, 0)", + NULL); + } + + pipeline = ctx->blit_texture_pipeline; + + cogl_pipeline_set_layer_texture (pipeline, 0, data->src_tex); + + data->pipeline = pipeline; + + return TRUE; +} + +static void +_cogl_blit_texture_render_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + cogl_framebuffer_draw_textured_rectangle (data->dest_fb, + data->pipeline, + dst_x, dst_y, + dst_x + width, + dst_y + height, + src_x / (float) data->src_width, + src_y / (float) data->src_height, + (src_x + width) / + (float) data->src_width, + (src_y + height) / + (float) data->src_height); +} + +static void +_cogl_blit_texture_render_end (CoglBlitData *data) +{ + CoglContext *ctx = data->src_tex->context; + + /* Attach the target texture to the texture render pipeline so that + we don't keep a reference to the source texture forever. This is + assuming that the destination texture will live for a long time + which is currently the case when cogl_blit_* is used from the + atlas code. It may be better in future to keep around a set of + dummy 1x1 textures for each texture target that we could bind + instead. This would also be useful when using a pipeline as a + hash table key such as for the ARBfp program cache. */ + cogl_pipeline_set_layer_texture (ctx->blit_texture_pipeline, 0, + data->dst_tex); + + cogl_object_unref (data->dest_fb); +} + +static CoglBool +_cogl_blit_framebuffer_begin (CoglBlitData *data) +{ + CoglContext *ctx = data->src_tex->context; + CoglOffscreen *dst_offscreen = NULL, *src_offscreen = NULL; + CoglFramebuffer *dst_fb, *src_fb; + CoglError *ignore_error = NULL; + + /* We can only blit between FBOs if both textures are the same + format and the blit framebuffer extension is supported */ + if ((_cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) != + (_cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) || + !_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)) + return FALSE; + + dst_offscreen = _cogl_offscreen_new_with_texture_full + (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + dst_fb = COGL_FRAMEBUFFER (dst_offscreen); + if (!cogl_framebuffer_allocate (dst_fb, &ignore_error)) + { + cogl_error_free (ignore_error); + goto error; + } + + src_offscreen= _cogl_offscreen_new_with_texture_full + (data->src_tex, + COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, + 0 /* level */); + + src_fb = COGL_FRAMEBUFFER (src_offscreen); + if (!cogl_framebuffer_allocate (src_fb, &ignore_error)) + { + cogl_error_free (ignore_error); + goto error; + } + + data->src_fb = src_fb; + data->dest_fb = dst_fb; + + return TRUE; + +error: + + if (dst_offscreen) + cogl_object_unref (dst_offscreen); + if (src_offscreen) + cogl_object_unref (src_offscreen); + + return FALSE; +} + +static void +_cogl_blit_framebuffer_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + _cogl_blit_framebuffer (data->src_fb, + data->dest_fb, + src_x, src_y, + dst_x, dst_y, + width, height); +} + +static void +_cogl_blit_framebuffer_end (CoglBlitData *data) +{ + cogl_object_unref (data->src_fb); + cogl_object_unref (data->dest_fb); +} + +static CoglBool +_cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data) +{ + CoglOffscreen *offscreen; + CoglFramebuffer *fb; + CoglError *ignore_error = NULL; + + /* This will only work if the target texture is a CoglTexture2D */ + if (!cogl_is_texture_2d (data->dst_tex)) + return FALSE; + + offscreen = _cogl_offscreen_new_with_texture_full + (data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + fb = COGL_FRAMEBUFFER (offscreen); + if (!cogl_framebuffer_allocate (fb, &ignore_error)) + { + cogl_error_free (ignore_error); + cogl_object_unref (fb); + return FALSE; + } + + data->src_fb = fb; + + return TRUE; +} + +static void +_cogl_blit_copy_tex_sub_image_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + _cogl_texture_2d_copy_from_framebuffer (COGL_TEXTURE_2D (data->dst_tex), + src_x, src_y, + width, height, + data->src_fb, + dst_x, dst_y, + 0); /* level */ +} + +static void +_cogl_blit_copy_tex_sub_image_end (CoglBlitData *data) +{ + cogl_object_unref (data->src_fb); +} + +static CoglBool +_cogl_blit_get_tex_data_begin (CoglBlitData *data) +{ + data->format = _cogl_texture_get_format (data->src_tex); + data->bpp = _cogl_pixel_format_get_bytes_per_pixel (data->format); + + data->image_data = g_malloc (data->bpp * data->src_width * + data->src_height); + cogl_texture_get_data (data->src_tex, data->format, + data->src_width * data->bpp, data->image_data); + + return TRUE; +} + +static void +_cogl_blit_get_tex_data_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + CoglError *ignore = NULL; + int rowstride = data->src_width * data->bpp; + int offset = rowstride * src_y + src_x * data->bpp; + + _cogl_texture_set_region (data->dst_tex, + width, height, + data->format, + rowstride, + data->image_data + offset, + dst_x, dst_y, + 0, /* level */ + &ignore); + /* TODO: support chaining up errors during the blit */ +} + +static void +_cogl_blit_get_tex_data_end (CoglBlitData *data) +{ + g_free (data->image_data); +} + +/* These should be specified in order of preference */ +static const CoglBlitMode +_cogl_blit_modes[] = + { + { + "texture-render", + _cogl_blit_texture_render_begin, + _cogl_blit_texture_render_blit, + _cogl_blit_texture_render_end + }, + { + "framebuffer", + _cogl_blit_framebuffer_begin, + _cogl_blit_framebuffer_blit, + _cogl_blit_framebuffer_end + }, + { + "copy-tex-sub-image", + _cogl_blit_copy_tex_sub_image_begin, + _cogl_blit_copy_tex_sub_image_blit, + _cogl_blit_copy_tex_sub_image_end + }, + { + "get-tex-data", + _cogl_blit_get_tex_data_begin, + _cogl_blit_get_tex_data_blit, + _cogl_blit_get_tex_data_end + } + }; + +void +_cogl_blit_begin (CoglBlitData *data, + CoglTexture *dst_tex, + CoglTexture *src_tex) +{ + int i; + + if (_cogl_blit_default_mode == NULL) + { + const char *default_mode_string; + + /* Allow the default to be specified with an environment + variable. For the time being these functions are only used + when blitting between atlas textures so the environment + variable is named to be specific to the atlas code. If we + want to use the code in other places we should create another + environment variable for each specific use case */ + if ((default_mode_string = g_getenv ("COGL_ATLAS_DEFAULT_BLIT_MODE"))) + { + for (i = 0; i < G_N_ELEMENTS (_cogl_blit_modes); i++) + if (!strcmp (_cogl_blit_modes[i].name, default_mode_string)) + { + _cogl_blit_default_mode = _cogl_blit_modes + i; + break; + } + + if (i >= G_N_ELEMENTS (_cogl_blit_modes)) + { + g_warning ("Unknown blit mode %s", default_mode_string); + _cogl_blit_default_mode = _cogl_blit_modes; + } + } + else + /* Default to the first blit mode */ + _cogl_blit_default_mode = _cogl_blit_modes; + } + + memset (data, 0, sizeof (CoglBlitData)); + + data->dst_tex = dst_tex; + data->src_tex = src_tex; + + data->src_width = cogl_texture_get_width (src_tex); + data->src_height = cogl_texture_get_height (src_tex); + + /* Try the default blit mode first */ + if (!_cogl_blit_default_mode->begin_func (data)) + { + COGL_NOTE (ATLAS, "Failed to set up blit mode %s", + _cogl_blit_default_mode->name); + + /* Try all of the other modes in order */ + for (i = 0; i < G_N_ELEMENTS (_cogl_blit_modes); i++) + if (_cogl_blit_modes + i != _cogl_blit_default_mode && + _cogl_blit_modes[i].begin_func (data)) + { + /* Use this mode as the default from now on */ + _cogl_blit_default_mode = _cogl_blit_modes + i; + break; + } + else + COGL_NOTE (ATLAS, + "Failed to set up blit mode %s", + _cogl_blit_modes[i].name); + + /* The last blit mode can't fail so this should never happen */ + _COGL_RETURN_IF_FAIL (i < G_N_ELEMENTS (_cogl_blit_modes)); + } + + data->blit_mode = _cogl_blit_default_mode; + + COGL_NOTE (ATLAS, "Setup blit using %s", _cogl_blit_default_mode->name); +} + +void +_cogl_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + data->blit_mode->blit_func (data, src_x, src_y, dst_x, dst_y, width, height); +} + +void +_cogl_blit_end (CoglBlitData *data) +{ + data->blit_mode->end_func (data); +} diff --git a/cogl/cogl-blit.h b/cogl/cogl-blit.h new file mode 100644 index 0000000..f4e25e7 --- /dev/null +++ b/cogl/cogl-blit.h @@ -0,0 +1,101 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_BLIT_H +#define __COGL_BLIT_H + +#include +#include "cogl-object-private.h" +#include "cogl-texture.h" +#include "cogl-framebuffer.h" + +/* This structures and functions are used when a series of blits needs + to be performed between two textures. In this case there are + multiple methods we can use, most of which involve transferring + between an FBO bound to the texture. */ + +typedef struct _CoglBlitData CoglBlitData; + +typedef CoglBool (* CoglBlitBeginFunc) (CoglBlitData *data); +typedef void (* CoglBlitEndFunc) (CoglBlitData *data); + +typedef void (* CoglBlitFunc) (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); + +typedef struct +{ + const char *name; + CoglBlitBeginFunc begin_func; + CoglBlitFunc blit_func; + CoglBlitEndFunc end_func; +} CoglBlitMode; + +struct _CoglBlitData +{ + CoglTexture *src_tex, *dst_tex; + + unsigned int src_width; + unsigned int src_height; + + const CoglBlitMode *blit_mode; + + /* If we're not using an FBO then we g_malloc a buffer and copy the + complete texture data in */ + unsigned char *image_data; + CoglPixelFormat format; + + int bpp; + + CoglFramebuffer *src_fb; + CoglFramebuffer *dest_fb; + CoglPipeline *pipeline; +}; + +void +_cogl_blit_begin (CoglBlitData *data, + CoglTexture *dst_tex, + CoglTexture *src_tex); + +void +_cogl_blit (CoglBlitData *data, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); + +void +_cogl_blit_end (CoglBlitData *data); + +#endif /* __COGL_BLIT_H */ diff --git a/cogl/cogl-boxed-value.c b/cogl/cogl-boxed-value.c new file mode 100644 index 0000000..bf6a979 --- /dev/null +++ b/cogl/cogl-boxed-value.c @@ -0,0 +1,377 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-boxed-value.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" + +CoglBool +_cogl_boxed_value_equal (const CoglBoxedValue *bva, + const CoglBoxedValue *bvb) +{ + const void *pa, *pb; + + if (bva->type != bvb->type) + return FALSE; + + switch (bva->type) + { + case COGL_BOXED_NONE: + return TRUE; + + case COGL_BOXED_INT: + if (bva->size != bvb->size || bva->count != bvb->count) + return FALSE; + + if (bva->count == 1) + { + pa = bva->v.int_value; + pb = bvb->v.int_value; + } + else + { + pa = bva->v.int_array; + pb = bvb->v.int_array; + } + + return !memcmp (pa, pb, sizeof (int) * bva->size * bva->count); + + case COGL_BOXED_FLOAT: + if (bva->size != bvb->size || bva->count != bvb->count) + return FALSE; + + if (bva->count == 1) + { + pa = bva->v.float_value; + pb = bvb->v.float_value; + } + else + { + pa = bva->v.float_array; + pb = bvb->v.float_array; + } + + return !memcmp (pa, pb, sizeof (float) * bva->size * bva->count); + + case COGL_BOXED_MATRIX: + if (bva->size != bvb->size || + bva->count != bvb->count) + return FALSE; + + if (bva->count == 1) + { + pa = bva->v.matrix; + pb = bvb->v.matrix; + } + else + { + pa = bva->v.array; + pb = bvb->v.array; + } + + return !memcmp (pa, pb, + sizeof (float) * bva->size * bva->size * bva->count); + } + + g_warn_if_reached (); + + return FALSE; +} + +static void +_cogl_boxed_value_tranpose (float *dst, + int size, + const float *src) +{ + int y, x; + + /* If the value is transposed we'll just transpose it now as it + * is copied into the boxed value instead of passing TRUE to + * glUniformMatrix because that is not supported on GLES and it + * doesn't seem like the GL driver would be able to do anything + * much smarter than this anyway */ + + for (y = 0; y < size; y++) + for (x = 0; x < size; x++) + *(dst++) = src[y + x * size]; +} + +static void +_cogl_boxed_value_set_x (CoglBoxedValue *bv, + int size, + int count, + CoglBoxedType type, + size_t value_size, + const void *value, + CoglBool transpose) +{ + if (count == 1) + { + if (bv->count > 1) + g_free (bv->v.array); + + if (transpose) + _cogl_boxed_value_tranpose (bv->v.float_value, + size, + value); + else + memcpy (bv->v.float_value, value, value_size); + } + else + { + if (bv->count > 1) + { + if (bv->count != count || + bv->size != size || + bv->type != type) + { + g_free (bv->v.array); + bv->v.array = g_malloc (count * value_size); + } + } + else + bv->v.array = g_malloc (count * value_size); + + if (transpose) + { + int value_num; + + for (value_num = 0; value_num < count; value_num++) + _cogl_boxed_value_tranpose (bv->v.float_array + + value_num * size * size, + size, + (const float *) value + + value_num * size * size); + } + else + memcpy (bv->v.array, value, count * value_size); + } + + bv->type = type; + bv->size = size; + bv->count = count; +} + +void +_cogl_boxed_value_set_1f (CoglBoxedValue *bv, + float value) +{ + _cogl_boxed_value_set_x (bv, + 1, 1, COGL_BOXED_FLOAT, + sizeof (float), &value, FALSE); +} + +void +_cogl_boxed_value_set_1i (CoglBoxedValue *bv, + int value) +{ + _cogl_boxed_value_set_x (bv, + 1, 1, COGL_BOXED_INT, + sizeof (int), &value, FALSE); +} + +void +_cogl_boxed_value_set_float (CoglBoxedValue *bv, + int n_components, + int count, + const float *value) +{ + _cogl_boxed_value_set_x (bv, + n_components, count, + COGL_BOXED_FLOAT, + sizeof (float) * n_components, value, FALSE); +} + +void +_cogl_boxed_value_set_int (CoglBoxedValue *bv, + int n_components, + int count, + const int *value) +{ + _cogl_boxed_value_set_x (bv, + n_components, count, + COGL_BOXED_INT, + sizeof (int) * n_components, value, FALSE); +} + +void +_cogl_boxed_value_set_matrix (CoglBoxedValue *bv, + int dimensions, + int count, + CoglBool transpose, + const float *value) +{ + _cogl_boxed_value_set_x (bv, + dimensions, count, + COGL_BOXED_MATRIX, + sizeof (float) * dimensions * dimensions, + value, + transpose); +} + +void +_cogl_boxed_value_copy (CoglBoxedValue *dst, + const CoglBoxedValue *src) +{ + *dst = *src; + + if (src->count > 1) + { + switch (src->type) + { + case COGL_BOXED_NONE: + break; + + case COGL_BOXED_INT: + dst->v.int_array = g_memdup (src->v.int_array, + src->size * src->count * sizeof (int)); + break; + + case COGL_BOXED_FLOAT: + dst->v.float_array = g_memdup (src->v.float_array, + src->size * + src->count * + sizeof (float)); + break; + + case COGL_BOXED_MATRIX: + dst->v.float_array = g_memdup (src->v.float_array, + src->size * src->size * + src->count * sizeof (float)); + break; + } + } +} + +void +_cogl_boxed_value_destroy (CoglBoxedValue *bv) +{ + if (bv->count > 1) + g_free (bv->v.array); +} + +void +_cogl_boxed_value_set_uniform (CoglContext *ctx, + GLint location, + const CoglBoxedValue *value) +{ + switch (value->type) + { + case COGL_BOXED_NONE: + break; + + case COGL_BOXED_INT: + { + const int *ptr; + + if (value->count == 1) + ptr = value->v.int_value; + else + ptr = value->v.int_array; + + switch (value->size) + { + case 1: + GE( ctx, glUniform1iv (location, value->count, ptr) ); + break; + case 2: + GE( ctx, glUniform2iv (location, value->count, ptr) ); + break; + case 3: + GE( ctx, glUniform3iv (location, value->count, ptr) ); + break; + case 4: + GE( ctx, glUniform4iv (location, value->count, ptr) ); + break; + } + } + break; + + case COGL_BOXED_FLOAT: + { + const float *ptr; + + if (value->count == 1) + ptr = value->v.float_value; + else + ptr = value->v.float_array; + + switch (value->size) + { + case 1: + GE( ctx, glUniform1fv (location, value->count, ptr) ); + break; + case 2: + GE( ctx, glUniform2fv (location, value->count, ptr) ); + break; + case 3: + GE( ctx, glUniform3fv (location, value->count, ptr) ); + break; + case 4: + GE( ctx, glUniform4fv (location, value->count, ptr) ); + break; + } + } + break; + + case COGL_BOXED_MATRIX: + { + const float *ptr; + + if (value->count == 1) + ptr = value->v.matrix; + else + ptr = value->v.float_array; + + switch (value->size) + { + case 2: + GE( ctx, glUniformMatrix2fv (location, value->count, + FALSE, ptr) ); + break; + case 3: + GE( ctx, glUniformMatrix3fv (location, value->count, + FALSE, ptr) ); + break; + case 4: + GE( ctx, glUniformMatrix4fv (location, value->count, + FALSE, ptr) ); + break; + } + } + break; + } +} diff --git a/cogl/cogl-boxed-value.h b/cogl/cogl-boxed-value.h new file mode 100644 index 0000000..c8eda44 --- /dev/null +++ b/cogl/cogl-boxed-value.h @@ -0,0 +1,117 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_BOXED_VALUE_H +#define __COGL_BOXED_VALUE_H + +#include + +#include "cogl-context.h" + +typedef enum { + COGL_BOXED_NONE, + COGL_BOXED_INT, + COGL_BOXED_FLOAT, + COGL_BOXED_MATRIX +} CoglBoxedType; + +typedef struct _CoglBoxedValue +{ + CoglBoxedType type; + int size, count; + + union { + float float_value[4]; + int int_value[4]; + float matrix[16]; + float *float_array; + int *int_array; + void *array; + } v; +} CoglBoxedValue; + +#define _cogl_boxed_value_init(bv) \ + G_STMT_START { \ + CoglBoxedValue *_bv = (bv); \ + _bv->type = COGL_BOXED_NONE; \ + _bv->count = 1; \ + } G_STMT_END + +CoglBool +_cogl_boxed_value_equal (const CoglBoxedValue *bva, + const CoglBoxedValue *bvb); + +void +_cogl_boxed_value_set_1f (CoglBoxedValue *bv, + float value); + +void +_cogl_boxed_value_set_1i (CoglBoxedValue *bv, + int value); + +void +_cogl_boxed_value_set_float (CoglBoxedValue *bv, + int n_components, + int count, + const float *value); + +void +_cogl_boxed_value_set_int (CoglBoxedValue *bv, + int n_components, + int count, + const int *value); + +void +_cogl_boxed_value_set_matrix (CoglBoxedValue *bv, + int dimensions, + int count, + CoglBool transpose, + const float *value); + +/* + * _cogl_boxed_value_copy: + * @dst: The destination boxed value + * @src: The source boxed value + * + * This copies @src to @dst. It is assumed that @dst is initialised. + */ +void +_cogl_boxed_value_copy (CoglBoxedValue *dst, + const CoglBoxedValue *src); + +void +_cogl_boxed_value_destroy (CoglBoxedValue *bv); + +void +_cogl_boxed_value_set_uniform (CoglContext *ctx, + int location, + const CoglBoxedValue *value); + +#endif /* __COGL_BOXED_VALUE_H */ diff --git a/cogl/cogl-buffer-private.h b/cogl/cogl-buffer-private.h new file mode 100644 index 0000000..eab81fd --- /dev/null +++ b/cogl/cogl-buffer-private.h @@ -0,0 +1,180 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#ifndef __COGL_BUFFER_PRIVATE_H__ +#define __COGL_BUFFER_PRIVATE_H__ + +#include + +#include "cogl-object-private.h" +#include "cogl-buffer.h" +#include "cogl-context.h" +#include "cogl-gl-header.h" + +COGL_BEGIN_DECLS + +typedef struct _CoglBufferVtable CoglBufferVtable; + +struct _CoglBufferVtable +{ + void * (* map_range) (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + + void (* unmap) (CoglBuffer *buffer); + + CoglBool (* set_data) (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size, + CoglError **error); +}; + +typedef enum _CoglBufferFlags +{ + COGL_BUFFER_FLAG_NONE = 0, + COGL_BUFFER_FLAG_BUFFER_OBJECT = 1UL << 0, /* real openGL buffer object */ + COGL_BUFFER_FLAG_MAPPED = 1UL << 1, + COGL_BUFFER_FLAG_MAPPED_FALLBACK = 1UL << 2 +} CoglBufferFlags; + +typedef enum { + COGL_BUFFER_USAGE_HINT_TEXTURE, + COGL_BUFFER_USAGE_HINT_ATTRIBUTE_BUFFER, + COGL_BUFFER_USAGE_HINT_INDEX_BUFFER +} CoglBufferUsageHint; + +typedef enum { + COGL_BUFFER_BIND_TARGET_PIXEL_PACK, + COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK, + COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER, + COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, + + COGL_BUFFER_BIND_TARGET_COUNT +} CoglBufferBindTarget; + +struct _CoglBuffer +{ + CoglObject _parent; + + CoglContext *context; + + CoglBufferVtable vtable; + + CoglBufferBindTarget last_target; + + CoglBufferFlags flags; + + GLuint gl_handle; /* OpenGL handle */ + unsigned int size; /* size of the buffer, in bytes */ + CoglBufferUsageHint usage_hint; + CoglBufferUpdateHint update_hint; + + /* points to the mapped memory when the CoglBuffer is a VBO, PBO, + * ... or points to allocated memory in the fallback paths */ + uint8_t *data; + + int immutable_ref; + + unsigned int store_created:1; +}; + +/* This is used to register a type to the list of handle types that + will be considered a texture in cogl_is_texture() */ +void +_cogl_buffer_register_buffer_type (const CoglObjectClass *klass); + +#define COGL_BUFFER_DEFINE(TypeName, type_name) \ + COGL_OBJECT_DEFINE_WITH_CODE \ + (TypeName, type_name, \ + _cogl_buffer_register_buffer_type (&_cogl_##type_name##_class)) + +void +_cogl_buffer_initialize (CoglBuffer *buffer, + CoglContext *context, + size_t size, + CoglBufferBindTarget default_target, + CoglBufferUsageHint usage_hint, + CoglBufferUpdateHint update_hint); + +void +_cogl_buffer_fini (CoglBuffer *buffer); + +CoglBufferUsageHint +_cogl_buffer_get_usage_hint (CoglBuffer *buffer); + +GLenum +_cogl_buffer_access_to_gl_enum (CoglBufferAccess access); + +CoglBuffer * +_cogl_buffer_immutable_ref (CoglBuffer *buffer); + +void +_cogl_buffer_immutable_unref (CoglBuffer *buffer); + +CoglBool +_cogl_buffer_set_data (CoglBuffer *buffer, + size_t offset, + const void *data, + size_t size, + CoglError **error); + +void * +_cogl_buffer_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + +/* This is a wrapper around cogl_buffer_map_range for internal use + when we want to map the buffer for write only to replace the entire + contents. If the map fails then it will fallback to writing to a + temporary buffer. When _cogl_buffer_unmap_for_fill_or_fallback is + called the temporary buffer will be copied into the array. Note + that these calls share a global array so they can not be nested. */ +void * +_cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer, + size_t offset, + size_t size); +void * +_cogl_buffer_map_for_fill_or_fallback (CoglBuffer *buffer); + +void +_cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer); + +COGL_END_DECLS + +#endif /* __COGL_BUFFER_PRIVATE_H__ */ diff --git a/cogl/cogl-buffer.c b/cogl/cogl-buffer.c new file mode 100644 index 0000000..ede46cc --- /dev/null +++ b/cogl/cogl-buffer.c @@ -0,0 +1,411 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +/* For an overview of the functionality implemented here, please see + * cogl-buffer.h, which contains the gtk-doc section overview for the + * Pixel Buffers API. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-pixel-buffer-private.h" + +/* XXX: + * The CoglObject macros don't support any form of inheritance, so for + * now we implement the CoglObject support for the CoglBuffer + * abstract class manually. + */ + +static GSList *_cogl_buffer_types; + +void +_cogl_buffer_register_buffer_type (const CoglObjectClass *klass) +{ + _cogl_buffer_types = g_slist_prepend (_cogl_buffer_types, (void *) klass); +} + +CoglBool +cogl_is_buffer (void *object) +{ + const CoglObject *obj = object; + GSList *l; + + if (object == NULL) + return FALSE; + + for (l = _cogl_buffer_types; l; l = l->next) + if (l->data == obj->klass) + return TRUE; + + return FALSE; +} + +/* + * Fallback path, buffer->data points to a malloc'ed buffer. + */ + +static void * +malloc_map_range (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + buffer->flags |= COGL_BUFFER_FLAG_MAPPED; + return buffer->data + offset; +} + +static void +malloc_unmap (CoglBuffer *buffer) +{ + buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED; +} + +static CoglBool +malloc_set_data (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size, + CoglError **error) +{ + memcpy (buffer->data + offset, data, size); + return TRUE; +} + +void +_cogl_buffer_initialize (CoglBuffer *buffer, + CoglContext *ctx, + size_t size, + CoglBufferBindTarget default_target, + CoglBufferUsageHint usage_hint, + CoglBufferUpdateHint update_hint) +{ + CoglBool use_malloc = FALSE; + + buffer->context = ctx; + buffer->flags = COGL_BUFFER_FLAG_NONE; + buffer->store_created = FALSE; + buffer->size = size; + buffer->last_target = default_target; + buffer->usage_hint = usage_hint; + buffer->update_hint = update_hint; + buffer->data = NULL; + buffer->immutable_ref = 0; + + if (default_target == COGL_BUFFER_BIND_TARGET_PIXEL_PACK || + default_target == COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK) + { + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_PBOS)) + use_malloc = TRUE; + } + else if (default_target == COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER || + default_target == COGL_BUFFER_BIND_TARGET_INDEX_BUFFER) + { + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_VBOS)) + use_malloc = TRUE; + } + + if (use_malloc) + { + buffer->vtable.map_range = malloc_map_range; + buffer->vtable.unmap = malloc_unmap; + buffer->vtable.set_data = malloc_set_data; + + buffer->data = g_malloc (size); + } + else + { + buffer->vtable.map_range = ctx->driver_vtable->buffer_map_range; + buffer->vtable.unmap = ctx->driver_vtable->buffer_unmap; + buffer->vtable.set_data = ctx->driver_vtable->buffer_set_data; + + ctx->driver_vtable->buffer_create (buffer); + + buffer->flags |= COGL_BUFFER_FLAG_BUFFER_OBJECT; + } +} + +void +_cogl_buffer_fini (CoglBuffer *buffer) +{ + _COGL_RETURN_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED)); + _COGL_RETURN_IF_FAIL (buffer->immutable_ref == 0); + + if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) + buffer->context->driver_vtable->buffer_destroy (buffer); + else + g_free (buffer->data); +} + +unsigned int +cogl_buffer_get_size (CoglBuffer *buffer) +{ + if (!cogl_is_buffer (buffer)) + return 0; + + return COGL_BUFFER (buffer)->size; +} + +void +cogl_buffer_set_update_hint (CoglBuffer *buffer, + CoglBufferUpdateHint hint) +{ + if (!cogl_is_buffer (buffer)) + return; + + if (G_UNLIKELY (hint > COGL_BUFFER_UPDATE_HINT_STREAM)) + hint = COGL_BUFFER_UPDATE_HINT_STATIC; + + buffer->update_hint = hint; +} + +CoglBufferUpdateHint +cogl_buffer_get_update_hint (CoglBuffer *buffer) +{ + if (!cogl_is_buffer (buffer)) + return FALSE; + + return buffer->update_hint; +} + +static void +warn_about_midscene_changes (void) +{ + static CoglBool seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of buffers has " + "undefined results\n"); + seen = TRUE; + } +} + +void * +_cogl_buffer_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); + + return cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, error); +} + +void * +cogl_buffer_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints) +{ + CoglError *ignore_error = NULL; + void *ptr = + cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, + &ignore_error); + if (!ptr) + cogl_error_free (ignore_error); + return ptr; +} + +void * +cogl_buffer_map_range (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); + _COGL_RETURN_VAL_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL); + + if (G_UNLIKELY (buffer->immutable_ref)) + warn_about_midscene_changes (); + + buffer->data = buffer->vtable.map_range (buffer, + offset, + size, + access, + hints, + error); + + return buffer->data; +} + +void +cogl_buffer_unmap (CoglBuffer *buffer) +{ + if (!cogl_is_buffer (buffer)) + return; + + if (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED)) + return; + + buffer->vtable.unmap (buffer); +} + +void * +_cogl_buffer_map_for_fill_or_fallback (CoglBuffer *buffer) +{ + return _cogl_buffer_map_range_for_fill_or_fallback (buffer, 0, buffer->size); +} + +void * +_cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer, + size_t offset, + size_t size) +{ + CoglContext *ctx = buffer->context; + void *ret; + CoglError *ignore_error = NULL; + + _COGL_RETURN_VAL_IF_FAIL (!ctx->buffer_map_fallback_in_use, NULL); + + ctx->buffer_map_fallback_in_use = TRUE; + + ret = cogl_buffer_map_range (buffer, + offset, + size, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + &ignore_error); + + if (ret) + return ret; + + cogl_error_free (ignore_error); + + /* If the map fails then we'll use a temporary buffer to fill + the data and then upload it using cogl_buffer_set_data when + the buffer is unmapped. The temporary buffer is shared to + avoid reallocating it every time */ + g_byte_array_set_size (ctx->buffer_map_fallback_array, size); + ctx->buffer_map_fallback_offset = offset; + + buffer->flags |= COGL_BUFFER_FLAG_MAPPED_FALLBACK; + + return ctx->buffer_map_fallback_array->data; +} + +void +_cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer) +{ + CoglContext *ctx = buffer->context; + + _COGL_RETURN_IF_FAIL (ctx->buffer_map_fallback_in_use); + + ctx->buffer_map_fallback_in_use = FALSE; + + if ((buffer->flags & COGL_BUFFER_FLAG_MAPPED_FALLBACK)) + { + /* Note: don't try to catch OOM errors here since the use cases + * we currently have for this api (the journal and path stroke + * tesselator) don't have anything particularly sensible they + * can do in response to a failure anyway so it seems better to + * simply abort instead. + * + * If we find this is a problem for real world applications + * then in the path tesselation case we could potentially add an + * explicit cogl_path_tesselate_stroke() api that can throw an + * error for the app to cache. For the journal we could + * potentially flush the journal in smaller batches so we use + * smaller buffers, though that would probably not help for + * deferred renderers. + */ + _cogl_buffer_set_data (buffer, + ctx->buffer_map_fallback_offset, + ctx->buffer_map_fallback_array->data, + ctx->buffer_map_fallback_array->len, + NULL); + buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED_FALLBACK; + } + else + cogl_buffer_unmap (buffer); +} + +CoglBool +_cogl_buffer_set_data (CoglBuffer *buffer, + size_t offset, + const void *data, + size_t size, + CoglError **error) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE); + _COGL_RETURN_VAL_IF_FAIL ((offset + size) <= buffer->size, FALSE); + + if (G_UNLIKELY (buffer->immutable_ref)) + warn_about_midscene_changes (); + + return buffer->vtable.set_data (buffer, offset, data, size, error); +} + +CoglBool +cogl_buffer_set_data (CoglBuffer *buffer, + size_t offset, + const void *data, + size_t size) +{ + CoglError *ignore_error = NULL; + CoglBool status = + _cogl_buffer_set_data (buffer, offset, data, size, &ignore_error); + if (!status) + cogl_error_free (ignore_error); + return status; +} + +CoglBuffer * +_cogl_buffer_immutable_ref (CoglBuffer *buffer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); + + buffer->immutable_ref++; + return buffer; +} + +void +_cogl_buffer_immutable_unref (CoglBuffer *buffer) +{ + _COGL_RETURN_IF_FAIL (cogl_is_buffer (buffer)); + _COGL_RETURN_IF_FAIL (buffer->immutable_ref > 0); + + buffer->immutable_ref--; +} + diff --git a/cogl/cogl-buffer.h b/cogl/cogl-buffer.h new file mode 100644 index 0000000..235e941 --- /dev/null +++ b/cogl/cogl-buffer.h @@ -0,0 +1,324 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C)2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_BUFFER_H__ +#define __COGL_BUFFER_H__ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-buffer + * @short_description: Common buffer functions, including data upload APIs + * @stability: unstable + * + * The CoglBuffer API provides a common interface to manipulate + * buffers that have been allocated either via cogl_pixel_buffer_new() + * or cogl_attribute_buffer_new(). The API allows you to upload data + * to these buffers and define usage hints that help Cogl manage your + * buffer optimally. + * + * Data can either be uploaded by supplying a pointer and size so Cogl + * can copy your data, or you can mmap() a CoglBuffer and then you can + * copy data to the buffer directly. + * + * One of the most common uses for CoglBuffers is to upload texture + * data asynchronously since the ability to mmap the buffers into + * the CPU makes it possible for another thread to handle the IO + * of loading an image file and unpacking it into the mapped buffer + * without blocking other Cogl operations. + */ + +#ifdef __COGL_H_INSIDE__ +/* For the public C api we typedef interface types as void to avoid needing + * lots of casting in code and instead we will rely on runtime type checking + * for these objects. */ +typedef void CoglBuffer; +#else +typedef struct _CoglBuffer CoglBuffer; +#define COGL_BUFFER(buffer) ((CoglBuffer *)(buffer)) +#endif + +#define COGL_BUFFER_ERROR (_cogl_buffer_error_domain ()) + +/** + * CoglBufferError: + * @COGL_BUFFER_ERROR_MAP: A buffer could not be mapped either + * because the feature isn't supported or because a system + * limitation was hit. + * + * Error enumeration for #CoglBuffer + * + * Stability: unstable + */ +typedef enum { /*< prefix=COGL_BUFFER_ERROR >*/ + COGL_BUFFER_ERROR_MAP, +} CoglBufferError; + +uint32_t +_cogl_buffer_error_domain (void); + +/** + * cogl_is_buffer: + * @object: a buffer object + * + * Checks whether @buffer is a buffer object. + * + * Return value: %TRUE if the handle is a CoglBuffer, and %FALSE otherwise + * + * Since: 1.2 + * Stability: unstable + */ +CoglBool +cogl_is_buffer (void *object); + +/** + * cogl_buffer_get_size: + * @buffer: a buffer object + * + * Retrieves the size of buffer + * + * Return value: the size of the buffer in bytes + * + * Since: 1.2 + * Stability: unstable + */ +unsigned int +cogl_buffer_get_size (CoglBuffer *buffer); + +/** + * CoglBufferUpdateHint: + * @COGL_BUFFER_UPDATE_HINT_STATIC: the buffer will not change over time + * @COGL_BUFFER_UPDATE_HINT_DYNAMIC: the buffer will change from time to time + * @COGL_BUFFER_UPDATE_HINT_STREAM: the buffer will be used once or a couple of + * times + * + * The update hint on a buffer allows the user to give some detail on how often + * the buffer data is going to be updated. + * + * Since: 1.2 + * Stability: unstable + */ +typedef enum { /*< prefix=COGL_BUFFER_UPDATE_HINT >*/ + COGL_BUFFER_UPDATE_HINT_STATIC, + COGL_BUFFER_UPDATE_HINT_DYNAMIC, + COGL_BUFFER_UPDATE_HINT_STREAM +} CoglBufferUpdateHint; + +/** + * cogl_buffer_set_update_hint: + * @buffer: a buffer object + * @hint: the new hint + * + * Sets the update hint on a buffer. See #CoglBufferUpdateHint for a description + * of the available hints. + * + * Since: 1.2 + * Stability: unstable + */ +void +cogl_buffer_set_update_hint (CoglBuffer *buffer, + CoglBufferUpdateHint hint); + +/** + * cogl_buffer_get_update_hint: + * @buffer: a buffer object + * + * Retrieves the update hints set using cogl_buffer_set_update_hint() + * + * Return value: the #CoglBufferUpdateHint currently used by the buffer + * + * Since: 1.2 + * Stability: unstable + */ +CoglBufferUpdateHint +cogl_buffer_get_update_hint (CoglBuffer *buffer); + +/** + * CoglBufferAccess: + * @COGL_BUFFER_ACCESS_READ: the buffer will be read + * @COGL_BUFFER_ACCESS_WRITE: the buffer will written to + * @COGL_BUFFER_ACCESS_READ_WRITE: the buffer will be used for both reading and + * writing + * + * The access hints for cogl_buffer_set_update_hint() + * + * Since: 1.2 + * Stability: unstable + */ +typedef enum { /*< prefix=COGL_BUFFER_ACCESS >*/ + COGL_BUFFER_ACCESS_READ = 1 << 0, + COGL_BUFFER_ACCESS_WRITE = 1 << 1, + COGL_BUFFER_ACCESS_READ_WRITE = COGL_BUFFER_ACCESS_READ | COGL_BUFFER_ACCESS_WRITE +} CoglBufferAccess; + + +/** + * CoglBufferMapHint: + * @COGL_BUFFER_MAP_HINT_DISCARD: Tells Cogl that you plan to replace + * all the buffer's contents. When this flag is used to map a + * buffer, the entire contents of the buffer become undefined, even + * if only a subregion of the buffer is mapped. + * @COGL_BUFFER_MAP_HINT_DISCARD_RANGE: Tells Cogl that you plan to + * replace all the contents of the mapped region. The contents of + * the region specified are undefined after this flag is used to + * map a buffer. + * + * Hints to Cogl about how you are planning to modify the data once it + * is mapped. + * + * Since: 1.4 + * Stability: unstable + */ +typedef enum { /*< prefix=COGL_BUFFER_MAP_HINT >*/ + COGL_BUFFER_MAP_HINT_DISCARD = 1 << 0, + COGL_BUFFER_MAP_HINT_DISCARD_RANGE = 1 << 1 +} CoglBufferMapHint; + +/** + * cogl_buffer_map: + * @buffer: a buffer object + * @access: how the mapped buffer will be used by the application + * @hints: A mask of #CoglBufferMapHints that tell Cogl how + * the data will be modified once mapped. + * + * Maps the buffer into the application address space for direct + * access. This is equivalent to calling cogl_buffer_map_range() with + * zero as the offset and the size of the entire buffer as the size. + * + * It is strongly recommended that you pass + * %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace + * all the buffer's data. This way if the buffer is currently being + * used by the GPU then the driver won't have to stall the CPU and + * wait for the hardware to finish because it can instead allocate a + * new buffer to map. + * + * The behaviour is undefined if you access the buffer in a way + * conflicting with the @access mask you pass. It is also an error to + * release your last reference while the buffer is mapped. + * + * Return value: (transfer none): A pointer to the mapped memory or + * %NULL is the call fails + * + * Since: 1.2 + * Stability: unstable + */ +void * +cogl_buffer_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints); + +/** + * cogl_buffer_map_range: + * @buffer: a buffer object + * @offset: Offset within the buffer to start the mapping + * @size: The size of data to map + * @access: how the mapped buffer will be used by the application + * @hints: A mask of #CoglBufferMapHints that tell Cogl how + * the data will be modified once mapped. + * @error: A #CoglError for catching exceptional errors + * + * Maps a sub-region of the buffer into the application's address space + * for direct access. + * + * It is strongly recommended that you pass + * %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace + * all the buffer's data. This way if the buffer is currently being + * used by the GPU then the driver won't have to stall the CPU and + * wait for the hardware to finish because it can instead allocate a + * new buffer to map. You can pass + * %COGL_BUFFER_MAP_HINT_DISCARD_RANGE instead if you want the + * regions outside of the mapping to be retained. + * + * The behaviour is undefined if you access the buffer in a way + * conflicting with the @access mask you pass. It is also an error to + * release your last reference while the buffer is mapped. + * + * Return value: (transfer none): A pointer to the mapped memory or + * %NULL is the call fails + * + * Since: 2.0 + * Stability: unstable + */ +void * +cogl_buffer_map_range (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + +/** + * cogl_buffer_unmap: + * @buffer: a buffer object + * + * Unmaps a buffer previously mapped by cogl_buffer_map(). + * + * Since: 1.2 + * Stability: unstable + */ +void +cogl_buffer_unmap (CoglBuffer *buffer); + +/** + * cogl_buffer_set_data: + * @buffer: a buffer object + * @offset: destination offset (in bytes) in the buffer + * @data: a pointer to the data to be copied into the buffer + * @size: number of bytes to copy + * + * Updates part of the buffer with new data from @data. Where to put this new + * data is controlled by @offset and @offset + @data should be less than the + * buffer size. + * + * Return value: %TRUE is the operation succeeded, %FALSE otherwise + * + * Since: 1.2 + * Stability: unstable + */ +CoglBool +cogl_buffer_set_data (CoglBuffer *buffer, + size_t offset, + const void *data, + size_t size); + +COGL_END_DECLS + +#endif /* __COGL_BUFFER_H__ */ diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c new file mode 100644 index 0000000..b0e5b0d --- /dev/null +++ b/cogl/cogl-clip-stack.c @@ -0,0 +1,412 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-clip-stack.h" +#include "cogl-primitives.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-journal-private.h" +#include "cogl-util.h" +#include "cogl-matrix-private.h" +#include "cogl-primitives-private.h" +#include "cogl-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-attribute-private.h" +#include "cogl-primitive-private.h" +#include "cogl1-context.h" +#include "cogl-offscreen.h" +#include "cogl-matrix-stack.h" + + + +static void * +_cogl_clip_stack_push_entry (CoglClipStack *clip_stack, + size_t size, + CoglClipStackType type) +{ + CoglClipStack *entry = g_slice_alloc (size); + + /* The new entry starts with a ref count of 1 because the stack + holds a reference to it as it is the top entry */ + entry->ref_count = 1; + entry->type = type; + entry->parent = clip_stack; + + /* We don't need to take a reference to the parent from the entry + because the we are stealing the ref in the new stack top */ + + return entry; +} + +static void +get_transformed_corners (float x_1, + float y_1, + float x_2, + float y_2, + CoglMatrix *modelview, + CoglMatrix *projection, + const float *viewport, + float *transformed_corners) +{ + int i; + + transformed_corners[0] = x_1; + transformed_corners[1] = y_1; + transformed_corners[2] = x_2; + transformed_corners[3] = y_1; + transformed_corners[4] = x_2; + transformed_corners[5] = y_2; + transformed_corners[6] = x_1; + transformed_corners[7] = y_2; + + + /* Project the coordinates to window space coordinates */ + for (i = 0; i < 4; i++) + { + float *v = transformed_corners + i * 2; + _cogl_transform_point (modelview, projection, viewport, v, v + 1); + } +} + +/* Sets the window-space bounds of the entry based on the projected + coordinates of the given rectangle */ +static void +_cogl_clip_stack_entry_set_bounds (CoglClipStack *entry, + float *transformed_corners) +{ + float min_x = G_MAXFLOAT, min_y = G_MAXFLOAT; + float max_x = -G_MAXFLOAT, max_y = -G_MAXFLOAT; + int i; + + for (i = 0; i < 4; i++) + { + float *v = transformed_corners + i * 2; + + if (v[0] > max_x) + max_x = v[0]; + if (v[0] < min_x) + min_x = v[0]; + if (v[1] > max_y) + max_y = v[1]; + if (v[1] < min_y) + min_y = v[1]; + } + + entry->bounds_x0 = floorf (min_x); + entry->bounds_x1 = ceilf (max_x); + entry->bounds_y0 = floorf (min_y); + entry->bounds_y1 = ceilf (max_y); +} + +CoglClipStack * +_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack, + int x_offset, + int y_offset, + int width, + int height) +{ + CoglClipStack *entry; + + entry = _cogl_clip_stack_push_entry (stack, + sizeof (CoglClipStackWindowRect), + COGL_CLIP_STACK_WINDOW_RECT); + + entry->bounds_x0 = x_offset; + entry->bounds_x1 = x_offset + width; + entry->bounds_y0 = y_offset; + entry->bounds_y1 = y_offset + height; + + return entry; +} + +CoglClipStack * +_cogl_clip_stack_push_rectangle (CoglClipStack *stack, + float x_1, + float y_1, + float x_2, + float y_2, + CoglMatrixEntry *modelview_entry, + CoglMatrixEntry *projection_entry, + const float *viewport) +{ + CoglClipStackRect *entry; + CoglMatrix modelview; + CoglMatrix projection; + CoglMatrix modelview_projection; + + /* Corners of the given rectangle in an clockwise order: + * (0, 1) (2, 3) + * + * + * + * (6, 7) (4, 5) + */ + float rect[] = { + x_1, y_1, + x_2, y_1, + x_2, y_2, + x_1, y_2 + }; + + /* Make a new entry */ + entry = _cogl_clip_stack_push_entry (stack, + sizeof (CoglClipStackRect), + COGL_CLIP_STACK_RECT); + + entry->x0 = x_1; + entry->y0 = y_1; + entry->x1 = x_2; + entry->y1 = y_2; + + entry->matrix_entry = cogl_matrix_entry_ref (modelview_entry); + + cogl_matrix_entry_get (modelview_entry, &modelview); + cogl_matrix_entry_get (projection_entry, &projection); + + cogl_matrix_multiply (&modelview_projection, + &projection, + &modelview); + + /* Technically we could avoid the viewport transform at this point + * if we want to make this a bit faster. */ + _cogl_transform_point (&modelview, &projection, viewport, &rect[0], &rect[1]); + _cogl_transform_point (&modelview, &projection, viewport, &rect[2], &rect[3]); + _cogl_transform_point (&modelview, &projection, viewport, &rect[4], &rect[5]); + _cogl_transform_point (&modelview, &projection, viewport, &rect[6], &rect[7]); + + /* If the fully transformed rectangle isn't still axis aligned we + * can't handle it using a scissor. + * + * We don't use an epsilon here since we only really aim to catch + * simple cases where the transform doesn't leave the rectangle screen + * aligned and don't mind some false positives. + */ + if (rect[0] != rect[6] || + rect[1] != rect[3] || + rect[2] != rect[4] || + rect[7] != rect[5]) + { + entry->can_be_scissor = FALSE; + + _cogl_clip_stack_entry_set_bounds ((CoglClipStack *) entry, + rect); + } + else + { + CoglClipStack *base_entry = (CoglClipStack *) entry; + x_1 = rect[0]; + y_1 = rect[1]; + x_2 = rect[4]; + y_2 = rect[5]; + + /* Consider that the modelview matrix may flip the rectangle + * along the x or y axis... */ +#define SWAP(A,B) do { float tmp = B; B = A; A = tmp; } while (0) + if (x_1 > x_2) + SWAP (x_1, x_2); + if (y_1 > y_2) + SWAP (y_1, y_2); +#undef SWAP + + base_entry->bounds_x0 = COGL_UTIL_NEARBYINT (x_1); + base_entry->bounds_y0 = COGL_UTIL_NEARBYINT (y_1); + base_entry->bounds_x1 = COGL_UTIL_NEARBYINT (x_2); + base_entry->bounds_y1 = COGL_UTIL_NEARBYINT (y_2); + entry->can_be_scissor = TRUE; + } + + return (CoglClipStack *) entry; +} + +CoglClipStack * +_cogl_clip_stack_push_primitive (CoglClipStack *stack, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + CoglMatrixEntry *modelview_entry, + CoglMatrixEntry *projection_entry, + const float *viewport) +{ + CoglClipStackPrimitive *entry; + CoglMatrix modelview; + CoglMatrix projection; + float transformed_corners[8]; + + entry = _cogl_clip_stack_push_entry (stack, + sizeof (CoglClipStackPrimitive), + COGL_CLIP_STACK_PRIMITIVE); + + entry->primitive = cogl_object_ref (primitive); + + entry->matrix_entry = cogl_matrix_entry_ref (modelview_entry); + + entry->bounds_x1 = bounds_x1; + entry->bounds_y1 = bounds_y1; + entry->bounds_x2 = bounds_x2; + entry->bounds_y2 = bounds_y2; + + cogl_matrix_entry_get (modelview_entry, &modelview); + cogl_matrix_entry_get (projection_entry, &projection); + + get_transformed_corners (bounds_x1, bounds_y1, bounds_x2, bounds_y2, + &modelview, + &projection, + viewport, + transformed_corners); + + /* NB: this is referring to the bounds in window coordinates as opposed + * to the bounds above in primitive local coordinates. */ + _cogl_clip_stack_entry_set_bounds ((CoglClipStack *) entry, + transformed_corners); + + return (CoglClipStack *) entry; +} + +CoglClipStack * +_cogl_clip_stack_ref (CoglClipStack *entry) +{ + /* A NULL pointer is considered a valid stack so we should accept + that as an argument */ + if (entry) + entry->ref_count++; + + return entry; +} + +void +_cogl_clip_stack_unref (CoglClipStack *entry) +{ + /* Unref all of the entries until we hit the root of the list or the + entry still has a remaining reference */ + while (entry && --entry->ref_count <= 0) + { + CoglClipStack *parent = entry->parent; + + switch (entry->type) + { + case COGL_CLIP_STACK_RECT: + { + CoglClipStackRect *rect = (CoglClipStackRect *) entry; + cogl_matrix_entry_unref (rect->matrix_entry); + g_slice_free1 (sizeof (CoglClipStackRect), entry); + break; + } + case COGL_CLIP_STACK_WINDOW_RECT: + g_slice_free1 (sizeof (CoglClipStackWindowRect), entry); + break; + case COGL_CLIP_STACK_PRIMITIVE: + { + CoglClipStackPrimitive *primitive_entry = + (CoglClipStackPrimitive *) entry; + cogl_matrix_entry_unref (primitive_entry->matrix_entry); + cogl_object_unref (primitive_entry->primitive); + g_slice_free1 (sizeof (CoglClipStackPrimitive), entry); + break; + } + default: + g_assert_not_reached (); + } + + entry = parent; + } +} + +CoglClipStack * +_cogl_clip_stack_pop (CoglClipStack *stack) +{ + CoglClipStack *new_top; + + _COGL_RETURN_VAL_IF_FAIL (stack != NULL, NULL); + + /* To pop we are moving the top of the stack to the old top's parent + node. The stack always needs to have a reference to the top entry + so we must take a reference to the new top. The stack would have + previously had a reference to the old top so we need to decrease + the ref count on that. We need to ref the new head first in case + this stack was the only thing referencing the old top. In that + case the call to _cogl_clip_stack_entry_unref will unref the + parent. */ + new_top = stack->parent; + + _cogl_clip_stack_ref (new_top); + + _cogl_clip_stack_unref (stack); + + return new_top; +} + +void +_cogl_clip_stack_get_bounds (CoglClipStack *stack, + int *scissor_x0, + int *scissor_y0, + int *scissor_x1, + int *scissor_y1) +{ + CoglClipStack *entry; + + *scissor_x0 = 0; + *scissor_y0 = 0; + *scissor_x1 = G_MAXINT; + *scissor_y1 = G_MAXINT; + + for (entry = stack; entry; entry = entry->parent) + { + /* Get the intersection of the current scissor and the bounding + box of this clip */ + _cogl_util_scissor_intersect (entry->bounds_x0, + entry->bounds_y0, + entry->bounds_x1, + entry->bounds_y1, + scissor_x0, + scissor_y0, + scissor_x1, + scissor_y1); + } +} + +void +_cogl_clip_stack_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + ctx->driver_vtable->clip_stack_flush (stack, framebuffer); +} diff --git a/cogl/cogl-clip-stack.h b/cogl/cogl-clip-stack.h new file mode 100644 index 0000000..56bc3f8 --- /dev/null +++ b/cogl/cogl-clip-stack.h @@ -0,0 +1,213 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_CLIP_STACK_H +#define __COGL_CLIP_STACK_H + +#include "cogl-matrix.h" +#include "cogl-primitive.h" +#include "cogl-framebuffer.h" +#include "cogl-matrix-stack.h" + +/* The clip stack works like a GSList where only a pointer to the top + of the stack is stored. The empty clip stack is represented simply + by the NULL pointer. When an entry is added to or removed from the + stack the new top of the stack is returned. When an entry is pushed + a new clip stack entry is created which effectively takes ownership + of the reference on the old entry. Therefore unrefing the top entry + effectively loses ownership of all entries in the stack */ + +typedef struct _CoglClipStack CoglClipStack; +typedef struct _CoglClipStackRect CoglClipStackRect; +typedef struct _CoglClipStackWindowRect CoglClipStackWindowRect; +typedef struct _CoglClipStackPrimitive CoglClipStackPrimitive; + +typedef enum + { + COGL_CLIP_STACK_RECT, + COGL_CLIP_STACK_WINDOW_RECT, + COGL_CLIP_STACK_PRIMITIVE + } CoglClipStackType; + +/* A clip stack consists a list of entries. Each entry has a reference + * count and a link to its parent node. The child takes a reference on + * the parent and the CoglClipStack holds a reference to the top of + * the stack. There are no links back from the parent to the + * children. This allows stacks that have common ancestry to share the + * entries. + * + * For example, the following sequence of operations would generate + * the tree below: + * + * CoglClipStack *stack_a = NULL; + * stack_a = _cogl_clip_stack_push_rectangle (stack_a, ...); + * stack_a = _cogl_clip_stack_push_rectangle (stack_a, ...); + * stack_a = _cogl_clip_stack_push_primitive (stack_a, ...); + * CoglClipStack *stack_b = NULL; + * stack_b = cogl_clip_stack_push_window_rectangle (stack_b, ...); + * + * stack_a + * \ holds a ref to + * +-----------+ + * | prim node | + * |ref count 1| + * +-----------+ + * \ + * +-----------+ +-----------+ + * both tops hold | rect node | | rect node | + * a ref to the |ref count 2|--|ref count 1| + * same rect node +-----------+ +-----------+ + * / + * +-----------+ + * | win. rect | + * |ref count 1| + * +-----------+ + * / holds a ref to + * stack_b + * + */ + +struct _CoglClipStack +{ + /* This will be null if there is no parent. If it is not null then + this node must be holding a reference to the parent */ + CoglClipStack *parent; + + CoglClipStackType type; + + /* All clip entries have a window-space bounding box which we can + use to calculate a scissor. The scissor limits the clip so that + we don't need to do a full stencil clear if the stencil buffer is + needed. This is stored in Cogl's coordinate space (ie, 0,0 is the + top left) */ + int bounds_x0; + int bounds_y0; + int bounds_x1; + int bounds_y1; + + unsigned int ref_count; +}; + +struct _CoglClipStackRect +{ + CoglClipStack _parent_data; + + /* The rectangle for this clip */ + float x0; + float y0; + float x1; + float y1; + + /* The matrix that was current when the clip was set */ + CoglMatrixEntry *matrix_entry; + + /* If this is true then the clip for this rectangle is entirely + described by the scissor bounds. This implies that the rectangle + is screen aligned and we don't need to use the stencil buffer to + set the clip. We keep the entry as a rect entry rather than a + window rect entry so that it will be easier to detect if the + modelview matrix is that same as when a rectangle is added to the + journal. In that case we can use the original clip coordinates + and modify the rectangle instead. */ + CoglBool can_be_scissor; +}; + +struct _CoglClipStackWindowRect +{ + CoglClipStack _parent_data; + + /* The window rect clip doesn't need any specific data because it + just adds to the scissor clip */ +}; + +struct _CoglClipStackPrimitive +{ + CoglClipStack _parent_data; + + /* The matrix that was current when the clip was set */ + CoglMatrixEntry *matrix_entry; + + CoglPrimitive *primitive; + + float bounds_x1; + float bounds_y1; + float bounds_x2; + float bounds_y2; +}; + +CoglClipStack * +_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack, + int x_offset, + int y_offset, + int width, + int height); + +CoglClipStack * +_cogl_clip_stack_push_rectangle (CoglClipStack *stack, + float x_1, + float y_1, + float x_2, + float y_2, + CoglMatrixEntry *modelview_entry, + CoglMatrixEntry *projection_entry, + const float *viewport); + +CoglClipStack * +_cogl_clip_stack_push_primitive (CoglClipStack *stack, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + CoglMatrixEntry *modelview_entry, + CoglMatrixEntry *projection_entry, + const float *viewport); + +CoglClipStack * +_cogl_clip_stack_pop (CoglClipStack *stack); + +void +_cogl_clip_stack_get_bounds (CoglClipStack *stack, + int *scissor_x0, + int *scissor_y0, + int *scissor_x1, + int *scissor_y1); + +void +_cogl_clip_stack_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer); + +CoglClipStack * +_cogl_clip_stack_ref (CoglClipStack *stack); + +void +_cogl_clip_stack_unref (CoglClipStack *stack); + +#endif /* __COGL_CLIP_STACK_H */ diff --git a/cogl/cogl-closure-list-private.h b/cogl/cogl-closure-list-private.h new file mode 100644 index 0000000..5446cb2 --- /dev/null +++ b/cogl/cogl-closure-list-private.h @@ -0,0 +1,118 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _COGL_CLOSURE_LIST_PRIVATE_H_ +#define _COGL_CLOSURE_LIST_PRIVATE_H_ + +#include "cogl-object.h" +#include "cogl-list.h" + +/* + * This implements a list of callbacks that can be used a bit like + * signals in GObject, but that don't have any marshalling overhead. + * + * The idea is that any Cogl code that wants to provide a callback + * point will provide api to add a callback for that particular point. + * The function can take a function pointer with the correct + * signature. Internally the Cogl code can use _cogl_closure_list_add, + * _cogl_closure_disconnect and _cogl_closure_list_disconnect_all + * + * In the future we could consider exposing the CoglClosure type which + * would allow applications to use _cogl_closure_disconnect() directly + * so we don't need to expose new disconnect apis for each callback + * point. + */ + +typedef struct _CoglClosure +{ + CoglList link; + + void *function; + void *user_data; + CoglUserDataDestroyCallback destroy_cb; +} CoglClosure; + +/* + * _cogl_closure_disconnect: + * @closure: A closure connected to a Cogl closure list + * + * Removes the given closure from the callback list it is connected to + * and destroys it. If the closure was created with a destroy function + * then it will be invoked. */ +void +_cogl_closure_disconnect (CoglClosure *closure); + +void +_cogl_closure_list_disconnect_all (CoglList *list); + +CoglClosure * +_cogl_closure_list_add (CoglList *list, + void *function, + void *user_data, + CoglUserDataDestroyCallback destroy_cb); + +/* + * _cogl_closure_list_invoke: + * @list: A pointer to a CoglList containing CoglClosures + * @cb_type: The name of a typedef for the closure callback function signature + * @...: The the arguments to pass to the callback + * + * A convenience macro to invoke a closure list with a variable number + * of arguments that will be passed to the closure callback functions. + * + * Note that the arguments will be evaluated multiple times so it is + * not safe to pass expressions that have side-effects. + * + * Note also that this function ignores the return value from the + * callbacks. If you want to handle the return value you should + * manually iterate the list and invoke the callbacks yourself. + */ +#define _cogl_closure_list_invoke(list, cb_type, ...) \ + G_STMT_START { \ + CoglClosure *_c, *_tmp; \ + \ + _cogl_list_for_each_safe (_c, _tmp, (list), link) \ + { \ + cb_type _cb = _c->function; \ + _cb (__VA_ARGS__, _c->user_data); \ + } \ + } G_STMT_END + +#define _cogl_closure_list_invoke_no_args(list) \ + G_STMT_START { \ + CoglClosure *_c, *_tmp; \ + \ + _cogl_list_for_each_safe (_c, _tmp, (list), link) \ + { \ + void (*_cb)(void *) = _c->function; \ + _cb (_c->user_data); \ + } \ + } G_STMT_END + +#endif /* _COGL_CLOSURE_LIST_PRIVATE_H_ */ diff --git a/cogl/cogl-closure-list.c b/cogl/cogl-closure-list.c new file mode 100644 index 0000000..eb8cadd --- /dev/null +++ b/cogl/cogl-closure-list.c @@ -0,0 +1,71 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include + +#include "cogl-closure-list-private.h" + +void +_cogl_closure_disconnect (CoglClosure *closure) +{ + _cogl_list_remove (&closure->link); + + if (closure->destroy_cb) + closure->destroy_cb (closure->user_data); + + g_slice_free (CoglClosure, closure); +} + +void +_cogl_closure_list_disconnect_all (CoglList *list) +{ + CoglClosure *closure, *next; + + _cogl_list_for_each_safe (closure, next, list, link) + _cogl_closure_disconnect (closure); +} + +CoglClosure * +_cogl_closure_list_add (CoglList *list, + void *function, + void *user_data, + CoglUserDataDestroyCallback destroy_cb) +{ + CoglClosure *closure = g_slice_new (CoglClosure); + + closure->function = function; + closure->user_data = user_data; + closure->destroy_cb = destroy_cb; + + _cogl_list_insert (list, &closure->link); + + return closure; +} diff --git a/cogl/cogl-color-private.h b/cogl/cogl-color-private.h new file mode 100644 index 0000000..bb1a58e --- /dev/null +++ b/cogl/cogl-color-private.h @@ -0,0 +1,51 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_COLOR_PRIVATE_PRIVATE_H +#define __COGL_COLOR_PRIVATE_PRIVATE_H + +#include "cogl-color.h" + +#include + +/* cogl-pipeline.c wants to be able to hash CoglColor data so it needs + * the exact data size to be able to avoid reading the padding bytes. + */ +#define _COGL_COLOR_DATA_SIZE 4 + +void +_cogl_color_get_rgba_4ubv (const CoglColor *color, + uint8_t *dest); + +#endif /* __COGL_COLOR_PRIVATE_PRIVATE_H */ + diff --git a/cogl/cogl-color.c b/cogl/cogl-color.c new file mode 100644 index 0000000..02e501d --- /dev/null +++ b/cogl/cogl-color.c @@ -0,0 +1,449 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-color.h" +#include "cogl-fixed.h" +#include "cogl-color-private.h" +#include "cogl-gtype-private.h" + +COGL_GTYPE_DEFINE_BOXED (Color, color, cogl_color_copy, cogl_color_free); + +CoglColor * +cogl_color_new (void) +{ + return g_slice_new (CoglColor); +} + +CoglColor * +cogl_color_copy (const CoglColor *color) +{ + if (G_LIKELY (color)) + return g_slice_dup (CoglColor, color); + + return NULL; +} + +void +cogl_color_free (CoglColor *color) +{ + if (G_LIKELY (color)) + g_slice_free (CoglColor, color); +} + +void +cogl_color_init_from_4ub (CoglColor *color, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha) +{ + _COGL_RETURN_IF_FAIL (color != NULL); + + color->red = red; + color->green = green; + color->blue = blue; + color->alpha = alpha; +} + +/* XXX: deprecated, use cogl_color_init_from_4ub */ +void +cogl_color_set_from_4ub (CoglColor *dest, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha) +{ + cogl_color_init_from_4ub (dest, red, green, blue, alpha); +} + +void +cogl_color_init_from_4f (CoglColor *color, + float red, + float green, + float blue, + float alpha) +{ + _COGL_RETURN_IF_FAIL (color != NULL); + + color->red = (red * 255); + color->green = (green * 255); + color->blue = (blue * 255); + color->alpha = (alpha * 255); +} + +/* XXX: deprecated, use cogl_color_init_from_4f */ +void +cogl_color_set_from_4f (CoglColor *color, + float red, + float green, + float blue, + float alpha) +{ + cogl_color_init_from_4f (color, red, green, blue, alpha); +} + +void +cogl_color_init_from_4fv (CoglColor *color, + const float *color_array) +{ + _COGL_RETURN_IF_FAIL (color != NULL); + + color->red = (color_array[0] * 255); + color->green = (color_array[1] * 255); + color->blue = (color_array[2] * 255); + color->alpha = (color_array[3] * 255); +} + +unsigned char +cogl_color_get_red_byte (const CoglColor *color) +{ + return color->red; +} + +float +cogl_color_get_red_float (const CoglColor *color) +{ + return (float) color->red / 255.0; +} + +float +cogl_color_get_red (const CoglColor *color) +{ + return ((float) color->red / 255.0); +} + +unsigned char +cogl_color_get_green_byte (const CoglColor *color) +{ + return color->green; +} + +float +cogl_color_get_green_float (const CoglColor *color) +{ + return (float) color->green / 255.0; +} + +float +cogl_color_get_green (const CoglColor *color) +{ + return ((float) color->green / 255.0); +} + +unsigned char +cogl_color_get_blue_byte (const CoglColor *color) +{ + return color->blue; +} + +float +cogl_color_get_blue_float (const CoglColor *color) +{ + return (float) color->blue / 255.0; +} + +float +cogl_color_get_blue (const CoglColor *color) +{ + return ((float) color->blue / 255.0); +} + +unsigned char +cogl_color_get_alpha_byte (const CoglColor *color) +{ + return color->alpha; +} + +float +cogl_color_get_alpha_float (const CoglColor *color) +{ + return (float) color->alpha / 255.0; +} + +float +cogl_color_get_alpha (const CoglColor *color) +{ + return ((float) color->alpha / 255.0); +} + +void +cogl_color_set_red_byte (CoglColor *color, + unsigned char red) +{ + color->red = red; +} + +void +cogl_color_set_red_float (CoglColor *color, + float red) +{ + color->red = red * 255.0; +} + +void +cogl_color_set_red (CoglColor *color, + float red) +{ + color->red = red * 255.0; +} + +void +cogl_color_set_green_byte (CoglColor *color, + unsigned char green) +{ + color->green = green; +} + +void +cogl_color_set_green_float (CoglColor *color, + float green) +{ + color->green = green * 255.0; +} + +void +cogl_color_set_green (CoglColor *color, + float green) +{ + color->green = green * 255.0; +} + +void +cogl_color_set_blue_byte (CoglColor *color, + unsigned char blue) +{ + color->blue = blue; +} + +void +cogl_color_set_blue_float (CoglColor *color, + float blue) +{ + color->blue = blue * 255.0; +} + +void +cogl_color_set_blue (CoglColor *color, + float blue) +{ + color->blue = blue * 255.0; +} + +void +cogl_color_set_alpha_byte (CoglColor *color, + unsigned char alpha) +{ + color->alpha = alpha; +} + +void +cogl_color_set_alpha_float (CoglColor *color, + float alpha) +{ + color->alpha = alpha * 255.0; +} + +void +cogl_color_set_alpha (CoglColor *color, + float alpha) +{ + color->alpha = alpha * 255.0; +} + +void +cogl_color_premultiply (CoglColor *color) +{ + color->red = (color->red * color->alpha + 128) / 255; + color->green = (color->green * color->alpha + 128) / 255; + color->blue = (color->blue * color->alpha + 128) / 255; +} + +void +cogl_color_unpremultiply (CoglColor *color) +{ + if (color->alpha != 0) + { + color->red = (color->red * 255) / color->alpha; + color->green = (color->green * 255) / color->alpha; + color->blue = (color->blue * 255) / color->alpha; + } +} + +CoglBool +cogl_color_equal (const void *v1, const void *v2) +{ + const uint32_t *c1 = v1, *c2 = v2; + + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + /* XXX: We don't compare the padding */ + return *c1 == *c2 ? TRUE : FALSE; +} + +void +_cogl_color_get_rgba_4ubv (const CoglColor *color, + uint8_t *dest) +{ + memcpy (dest, color, 4); +} + +void +cogl_color_to_hsl (const CoglColor *color, + float *hue, + float *saturation, + float *luminance) +{ + float red, green, blue; + float min, max, delta; + float h, l, s; + + red = color->red / 255.0; + green = color->green / 255.0; + blue = color->blue / 255.0; + + if (red > green) + { + if (red > blue) + max = red; + else + max = blue; + + if (green < blue) + min = green; + else + min = blue; + } + else + { + if (green > blue) + max = green; + else + max = blue; + + if (red < blue) + min = red; + else + min = blue; + } + + l = (max + min) / 2; + s = 0; + h = 0; + + if (max != min) + { + if (l <= 0.5) + s = (max - min) / (max + min); + else + s = (max - min) / (2.0 - max - min); + + delta = max - min; + + if (red == max) + h = (green - blue) / delta; + else if (green == max) + h = 2.0 + (blue - red) / delta; + else if (blue == max) + h = 4.0 + (red - green) / delta; + + h *= 60; + + if (h < 0) + h += 360.0; + } + + if (hue) + *hue = h; + + if (luminance) + *luminance = l; + + if (saturation) + *saturation = s; +} + +void +cogl_color_init_from_hsl (CoglColor *color, + float hue, + float saturation, + float luminance) +{ + float tmp1, tmp2; + float tmp3[3]; + float clr[3]; + int i; + + hue /= 360.0; + + if (saturation == 0) + { + cogl_color_init_from_4f (color, luminance, luminance, luminance, 1.0f); + return; + } + + if (luminance <= 0.5) + tmp2 = luminance * (1.0 + saturation); + else + tmp2 = luminance + saturation - (luminance * saturation); + + tmp1 = 2.0 * luminance - tmp2; + + tmp3[0] = hue + 1.0 / 3.0; + tmp3[1] = hue; + tmp3[2] = hue - 1.0 / 3.0; + + for (i = 0; i < 3; i++) + { + if (tmp3[i] < 0) + tmp3[i] += 1.0; + + if (tmp3[i] > 1) + tmp3[i] -= 1.0; + + if (6.0 * tmp3[i] < 1.0) + clr[i] = tmp1 + (tmp2 - tmp1) * tmp3[i] * 6.0; + else if (2.0 * tmp3[i] < 1.0) + clr[i] = tmp2; + else if (3.0 * tmp3[i] < 2.0) + clr[i] = (tmp1 + (tmp2 - tmp1) * ((2.0 / 3.0) - tmp3[i]) * 6.0); + else + clr[i] = tmp1; + } + + cogl_color_init_from_4f (color, clr[0], clr[1], clr[2], 1.0f); +} diff --git a/cogl/cogl-color.h b/cogl/cogl-color.h new file mode 100644 index 0000000..bdb0bfa --- /dev/null +++ b/cogl/cogl-color.h @@ -0,0 +1,604 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_COLOR_H__ +#define __COGL_COLOR_H__ + +/** + * SECTION:cogl-color + * @short_description: A generic color definition + * + * #CoglColor is a simple structure holding the definition of a color such + * that it can be efficiently used by GL + * + * Since: 1.0 + */ + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_color_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_color_get_gtype (void); +#endif + +/** + * cogl_color_new: + * + * Creates a new (empty) color + * + * Return value: a newly-allocated #CoglColor. Use cogl_color_free() + * to free the allocated resources + * + * Since: 1.0 + */ +CoglColor * +cogl_color_new (void); + +/** + * cogl_color_copy: + * @color: the color to copy + * + * Creates a copy of @color + * + * Return value: a newly-allocated #CoglColor. Use cogl_color_free() + * to free the allocate resources + * + * Since: 1.0 + */ +CoglColor * +cogl_color_copy (const CoglColor *color); + +/** + * cogl_color_free: + * @color: the color to free + * + * Frees the resources allocated by cogl_color_new() and cogl_color_copy() + * + * Since: 1.0 + */ +void +cogl_color_free (CoglColor *color); + +/** + * cogl_color_init_from_4ub: + * @color: A pointer to a #CoglColor to initialize + * @red: value of the red channel, between 0 and 255 + * @green: value of the green channel, between 0 and 255 + * @blue: value of the blue channel, between 0 and 255 + * @alpha: value of the alpha channel, between 0 and 255 + * + * Sets the values of the passed channels into a #CoglColor. + * + * Since: 1.4 + */ +void +cogl_color_init_from_4ub (CoglColor *color, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha); + +/** + * cogl_color_set_from_4ub: + * @color: A pointer to a #CoglColor to initialize + * @red: value of the red channel, between 0 and 255 + * @green: value of the green channel, between 0 and 255 + * @blue: value of the blue channel, between 0 and 255 + * @alpha: value of the alpha channel, between 0 and 255 + * + * Sets the values of the passed channels into a #CoglColor. + * + * Since: 1.0 + * Deprecated: 1.4: Use cogl_color_init_from_4ub instead. + */ +COGL_DEPRECATED_IN_1_4_FOR (cogl_color_init_from_4ub) +void +cogl_color_set_from_4ub (CoglColor *color, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha); + +/** + * cogl_color_init_from_4f: + * @color: A pointer to a #CoglColor to initialize + * @red: value of the red channel, between 0 and 1.0 + * @green: value of the green channel, between 0 and 1.0 + * @blue: value of the blue channel, between 0 and 1.0 + * @alpha: value of the alpha channel, between 0 and 1.0 + * + * Sets the values of the passed channels into a #CoglColor + * + * Since: 1.4 + */ +void +cogl_color_init_from_4f (CoglColor *color, + float red, + float green, + float blue, + float alpha); + +/** + * cogl_color_set_from_4f: + * @color: A pointer to a #CoglColor to initialize + * @red: value of the red channel, between 0 and %1.0 + * @green: value of the green channel, between 0 and %1.0 + * @blue: value of the blue channel, between 0 and %1.0 + * @alpha: value of the alpha channel, between 0 and %1.0 + * + * Sets the values of the passed channels into a #CoglColor + * + * Since: 1.0 + * Deprecated: 1.4: Use cogl_color_init_from_4f instead. + */ +COGL_DEPRECATED_IN_1_4_FOR (cogl_color_init_from_4f) +void +cogl_color_set_from_4f (CoglColor *color, + float red, + float green, + float blue, + float alpha); + +/** + * cogl_color_init_from_4fv: + * @color: A pointer to a #CoglColor to initialize + * @color_array: a pointer to an array of 4 float color components + * + * Sets the values of the passed channels into a #CoglColor + * + * Since: 1.4 + */ +void +cogl_color_init_from_4fv (CoglColor *color, + const float *color_array); + +/** + * cogl_color_get_red_byte: + * @color: a #CoglColor + * + * Retrieves the red channel of @color as a byte value + * between 0 and 255 + * + * Return value: the red channel of the passed color + * + * Since: 1.0 + */ +unsigned char +cogl_color_get_red_byte (const CoglColor *color); + +/** + * cogl_color_get_green_byte: + * @color: a #CoglColor + * + * Retrieves the green channel of @color as a byte value + * between 0 and 255 + * + * Return value: the green channel of the passed color + * + * Since: 1.0 + */ +unsigned char +cogl_color_get_green_byte (const CoglColor *color); + +/** + * cogl_color_get_blue_byte: + * @color: a #CoglColor + * + * Retrieves the blue channel of @color as a byte value + * between 0 and 255 + * + * Return value: the blue channel of the passed color + * + * Since: 1.0 + */ +unsigned char +cogl_color_get_blue_byte (const CoglColor *color); + +/** + * cogl_color_get_alpha_byte: + * @color: a #CoglColor + * + * Retrieves the alpha channel of @color as a byte value + * between 0 and 255 + * + * Return value: the alpha channel of the passed color + * + * Since: 1.0 + */ +unsigned char +cogl_color_get_alpha_byte (const CoglColor *color); + +/** + * cogl_color_get_red_float: + * @color: a #CoglColor + * + * Retrieves the red channel of @color as a floating point + * value between 0.0 and 1.0 + * + * Return value: the red channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_red_float (const CoglColor *color); + +/** + * cogl_color_get_green_float: + * @color: a #CoglColor + * + * Retrieves the green channel of @color as a floating point + * value between 0.0 and 1.0 + * + * Return value: the green channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_green_float (const CoglColor *color); + +/** + * cogl_color_get_blue_float: + * @color: a #CoglColor + * + * Retrieves the blue channel of @color as a floating point + * value between 0.0 and 1.0 + * + * Return value: the blue channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_blue_float (const CoglColor *color); + +/** + * cogl_color_get_alpha_float: + * @color: a #CoglColor + * + * Retrieves the alpha channel of @color as a floating point + * value between 0.0 and 1.0 + * + * Return value: the alpha channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_alpha_float (const CoglColor *color); + +/** + * cogl_color_get_red: + * @color: a #CoglColor + * + * Retrieves the red channel of @color as a fixed point + * value between 0 and 1.0. + * + * Return value: the red channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_red (const CoglColor *color); + +/** + * cogl_color_get_green: + * @color: a #CoglColor + * + * Retrieves the green channel of @color as a fixed point + * value between 0 and 1.0. + * + * Return value: the green channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_green (const CoglColor *color); + +/** + * cogl_color_get_blue: + * @color: a #CoglColor + * + * Retrieves the blue channel of @color as a fixed point + * value between 0 and 1.0. + * + * Return value: the blue channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_blue (const CoglColor *color); + +/** + * cogl_color_get_alpha: + * @color: a #CoglColor + * + * Retrieves the alpha channel of @color as a fixed point + * value between 0 and 1.0. + * + * Return value: the alpha channel of the passed color + * + * Since: 1.0 + */ +float +cogl_color_get_alpha (const CoglColor *color); + +/** + * cogl_color_set_red_byte: + * @color: a #CoglColor + * @red: a byte value between 0 and 255 + * + * Sets the red channel of @color to @red. + * + * Since: 1.4 + */ +void +cogl_color_set_red_byte (CoglColor *color, + unsigned char red); + +/** + * cogl_color_set_green_byte: + * @color: a #CoglColor + * @green: a byte value between 0 and 255 + * + * Sets the green channel of @color to @green. + * + * Since: 1.4 + */ +void +cogl_color_set_green_byte (CoglColor *color, + unsigned char green); + +/** + * cogl_color_set_blue_byte: + * @color: a #CoglColor + * @blue: a byte value between 0 and 255 + * + * Sets the blue channel of @color to @blue. + * + * Since: 1.4 + */ +void +cogl_color_set_blue_byte (CoglColor *color, + unsigned char blue); + +/** + * cogl_color_set_alpha_byte: + * @color: a #CoglColor + * @alpha: a byte value between 0 and 255 + * + * Sets the alpha channel of @color to @alpha. + * + * Since: 1.4 + */ +void +cogl_color_set_alpha_byte (CoglColor *color, + unsigned char alpha); + +/** + * cogl_color_set_red_float: + * @color: a #CoglColor + * @red: a float value between 0.0f and 1.0f + * + * Sets the red channel of @color to @red. + * + * since: 1.4 + */ +void +cogl_color_set_red_float (CoglColor *color, + float red); + +/** + * cogl_color_set_green_float: + * @color: a #CoglColor + * @green: a float value between 0.0f and 1.0f + * + * Sets the green channel of @color to @green. + * + * since: 1.4 + */ +void +cogl_color_set_green_float (CoglColor *color, + float green); + +/** + * cogl_color_set_blue_float: + * @color: a #CoglColor + * @blue: a float value between 0.0f and 1.0f + * + * Sets the blue channel of @color to @blue. + * + * since: 1.4 + */ +void +cogl_color_set_blue_float (CoglColor *color, + float blue); + +/** + * cogl_color_set_alpha_float: + * @color: a #CoglColor + * @alpha: a float value between 0.0f and 1.0f + * + * Sets the alpha channel of @color to @alpha. + * + * since: 1.4 + */ +void +cogl_color_set_alpha_float (CoglColor *color, + float alpha); + +/** + * cogl_color_set_red: + * @color: a #CoglColor + * @red: a float value between 0.0f and 1.0f + * + * Sets the red channel of @color to @red. + * + * Since: 1.4 + */ +void +cogl_color_set_red (CoglColor *color, + float red); + +/** + * cogl_color_set_green: + * @color: a #CoglColor + * @green: a float value between 0.0f and 1.0f + * + * Sets the green channel of @color to @green. + * + * Since: 1.4 + */ +void +cogl_color_set_green (CoglColor *color, + float green); + +/** + * cogl_color_set_blue: + * @color: a #CoglColor + * @blue: a float value between 0.0f and 1.0f + * + * Sets the blue channel of @color to @blue. + * + * Since: 1.4 + */ +void +cogl_color_set_blue (CoglColor *color, + float blue); + +/** + * cogl_color_set_alpha: + * @color: a #CoglColor + * @alpha: a float value between 0.0f and 1.0f + * + * Sets the alpha channel of @color to @alpha. + * + * Since: 1.4 + */ +void +cogl_color_set_alpha (CoglColor *color, + float alpha); + +/** + * cogl_color_premultiply: + * @color: the color to premultiply + * + * Converts a non-premultiplied color to a pre-multiplied color. For + * example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied + * and (0.5, 0, 0, 0.5) when premultiplied. + * + * Since: 1.0 + */ +void +cogl_color_premultiply (CoglColor *color); + +/** + * cogl_color_unpremultiply: + * @color: the color to unpremultiply + * + * Converts a pre-multiplied color to a non-premultiplied color. For + * example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied + * and (1.0, 0, 0, 0.5) when non-premultiplied. + * + * Since: 1.4 + */ +void +cogl_color_unpremultiply (CoglColor *color); + +/** + * cogl_color_equal: + * @v1: a #CoglColor + * @v2: a #CoglColor + * + * Compares two #CoglColors and checks if they are the same. + * + * This function can be passed to g_hash_table_new() as the @key_equal_func + * parameter, when using #CoglColors as keys in a #GHashTable. + * + * Return value: %TRUE if the two colors are the same. + * + * Since: 1.0 + */ +CoglBool +cogl_color_equal (const void *v1, const void *v2); + +/** + * cogl_color_to_hsl: + * @color: a #CoglColor + * @hue: (out): return location for the hue value or %NULL + * @saturation: (out): return location for the saturation value or %NULL + * @luminance: (out): return location for the luminance value or %NULL + * + * Converts @color to the HLS format. + * + * The @hue value is in the 0 .. 360 range. The @luminance and + * @saturation values are in the 0 .. 1 range. + * + * Since: 1.16 + */ +void +cogl_color_to_hsl (const CoglColor *color, + float *hue, + float *saturation, + float *luminance); + +/** + * cogl_color_init_from_hsl: + * @color: (out): return location for a #CoglColor + * @hue: hue value, in the 0 .. 360 range + * @saturation: saturation value, in the 0 .. 1 range + * @luminance: luminance value, in the 0 .. 1 range + * + * Converts a color expressed in HLS (hue, luminance and saturation) + * values into a #CoglColor. + * + * Since: 1.16 + */ +void +cogl_color_init_from_hsl (CoglColor *color, + float hue, + float saturation, + float luminance); + +COGL_END_DECLS + +#endif /* __COGL_COLOR_H__ */ diff --git a/cogl/cogl-config-private.h b/cogl/cogl-config-private.h new file mode 100644 index 0000000..93ff943 --- /dev/null +++ b/cogl/cogl-config-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_CONFIG_PRIVATE_H +#define __COGL_CONFIG_PRIVATE_H + +void +_cogl_config_read (void); + +extern char *_cogl_config_driver; +extern char *_cogl_config_renderer; +extern char *_cogl_config_disable_gl_extensions; +extern char *_cogl_config_override_gl_version; + +#endif /* __COGL_CONFIG_PRIVATE_H */ diff --git a/cogl/cogl-config.c b/cogl/cogl-config.c new file mode 100644 index 0000000..6c960d4 --- /dev/null +++ b/cogl/cogl-config.c @@ -0,0 +1,147 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-config-private.h" + +#include + +char *_cogl_config_driver; +char *_cogl_config_renderer; +char *_cogl_config_disable_gl_extensions; +char *_cogl_config_override_gl_version; + +#ifndef COGL_HAS_GLIB_SUPPORT + +void +_cogl_config_read (void) +{ + +} + +#else /* COGL_HAS_GLIB_SUPPORT */ + +/* Array of config options that just set a global string */ +static const struct +{ + const char *conf_name; + char **variable; +} cogl_config_string_options[] = + { + { "COGL_DRIVER", &_cogl_config_driver }, + { "COGL_RENDERER", &_cogl_config_renderer }, + { "COGL_DISABLE_GL_EXTENSIONS", &_cogl_config_disable_gl_extensions }, + { "COGL_OVERRIDE_GL_VERSION", &_cogl_config_override_gl_version } + }; + +static void +_cogl_config_process (GKeyFile *key_file) +{ + char *value; + int i; + + value = g_key_file_get_string (key_file, "global", "COGL_DEBUG", NULL); + if (value) + { + _cogl_parse_debug_string (value, + TRUE /* enable the flags */, + TRUE /* ignore help option */); + g_free (value); + } + + value = g_key_file_get_string (key_file, "global", "COGL_NO_DEBUG", NULL); + if (value) + { + _cogl_parse_debug_string (value, + FALSE /* disable the flags */, + TRUE /* ignore help option */); + g_free (value); + } + + for (i = 0; i < G_N_ELEMENTS (cogl_config_string_options); i++) + { + const char *conf_name = cogl_config_string_options[i].conf_name; + char **variable = cogl_config_string_options[i].variable; + + value = g_key_file_get_string (key_file, "global", conf_name, NULL); + if (value) + { + g_free (*variable); + *variable = value; + } + } +} + +void +_cogl_config_read (void) +{ + GKeyFile *key_file = g_key_file_new (); + const char * const *system_dirs = g_get_system_config_dirs (); + char *filename; + CoglBool status = FALSE; + int i; + + for (i = 0; system_dirs[i]; i++) + { + filename = g_build_filename (system_dirs[i], "cogl", "cogl.conf", NULL); + status = g_key_file_load_from_file (key_file, + filename, + 0, + NULL); + g_free (filename); + if (status) + { + _cogl_config_process (key_file); + g_key_file_free (key_file); + key_file = g_key_file_new (); + break; + } + } + + filename = g_build_filename (g_get_user_config_dir (), "cogl", "cogl.conf", NULL); + status = g_key_file_load_from_file (key_file, + filename, + 0, + NULL); + g_free (filename); + + if (status) + _cogl_config_process (key_file); + + g_key_file_free (key_file); +} + +#endif /* COGL_HAS_GLIB_SUPPORT */ diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h new file mode 100644 index 0000000..1000ee5 --- /dev/null +++ b/cogl/cogl-context-private.h @@ -0,0 +1,406 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_CONTEXT_PRIVATE_H +#define __COGL_CONTEXT_PRIVATE_H + +#include "cogl-context.h" +#include "cogl-winsys-private.h" +#include "cogl-flags.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include "cogl-xlib-private.h" +#endif + +#include "cogl-display-private.h" +#include "cogl-primitives.h" +#include "cogl-clip-stack.h" +#include "cogl-matrix-stack.h" +#include "cogl-pipeline-private.h" +#include "cogl-buffer-private.h" +#include "cogl-bitmask.h" +#include "cogl-atlas.h" +#include "cogl-driver.h" +#include "cogl-texture-driver.h" +#include "cogl-pipeline-cache.h" +#include "cogl-texture-2d.h" +#include "cogl-texture-3d.h" +#include "cogl-texture-rectangle.h" +#include "cogl-sampler-cache-private.h" +#include "cogl-gpu-info-private.h" +#include "cogl-gl-header.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-fence-private.h" +#include "cogl-poll-private.h" +#include "cogl-path/cogl-path-types.h" +#include "cogl-private.h" + +typedef struct +{ + GLfloat v[3]; + GLfloat t[2]; + GLubyte c[4]; +} CoglTextureGLVertex; + +struct _CoglContext +{ + CoglObject _parent; + + CoglDisplay *display; + + CoglDriver driver; + + /* Information about the GPU and driver which we can use to + determine certain workarounds */ + CoglGpuInfo gpu; + + /* vtables for the driver functions */ + const CoglDriverVtable *driver_vtable; + const CoglTextureDriver *texture_driver; + + int glsl_major; + int glsl_minor; + + /* This is the GLSL version that we will claim that snippets are + * written against using the #version pragma. This will be the + * largest version that is less than or equal to the version + * provided by the driver without massively altering the syntax. Eg, + * we wouldn't use version 1.3 even if it is available because that + * removes the ‘attribute’ and ‘varying’ keywords. */ + int glsl_version_to_use; + + /* Features cache */ + unsigned long features[COGL_FLAGS_N_LONGS_FOR_SIZE (_COGL_N_FEATURE_IDS)]; + CoglFeatureFlags feature_flags; /* legacy/deprecated feature flags */ + unsigned long private_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)]; + + CoglBool needs_viewport_scissor_workaround; + CoglFramebuffer *viewport_scissor_workaround_framebuffer; + + CoglPipeline *default_pipeline; + CoglPipelineLayer *default_layer_0; + CoglPipelineLayer *default_layer_n; + CoglPipelineLayer *dummy_layer_dependant; + + GHashTable *attribute_name_states_hash; + GArray *attribute_name_index_map; + int n_attribute_names; + + CoglBitmask enabled_builtin_attributes; + CoglBitmask enabled_texcoord_attributes; + CoglBitmask enabled_custom_attributes; + + /* These are temporary bitmasks that are used when disabling + * builtin,texcoord and custom attribute arrays. They are here just + * to avoid allocating new ones each time */ + CoglBitmask enable_builtin_attributes_tmp; + CoglBitmask enable_texcoord_attributes_tmp; + CoglBitmask enable_custom_attributes_tmp; + CoglBitmask changed_bits_tmp; + + CoglBool legacy_backface_culling_enabled; + + /* A few handy matrix constants */ + CoglMatrix identity_matrix; + CoglMatrix y_flip_matrix; + + /* Value that was last used when calling glMatrixMode to avoid + calling it multiple times */ + CoglMatrixMode flushed_matrix_mode; + + /* The matrix stack entries that should be flushed during the next + * pipeline state flush */ + CoglMatrixEntry *current_projection_entry; + CoglMatrixEntry *current_modelview_entry; + + CoglMatrixEntry identity_entry; + + /* A cache of the last (immutable) matrix stack entries that were + * flushed to the GL matrix builtins */ + CoglMatrixEntryCache builtin_flushed_projection; + CoglMatrixEntryCache builtin_flushed_modelview; + + GArray *texture_units; + int active_texture_unit; + + CoglPipelineFogState legacy_fog_state; + + /* Pipelines */ + CoglPipeline *opaque_color_pipeline; /* used for set_source_color */ + CoglPipeline *blended_color_pipeline; /* used for set_source_color */ + CoglPipeline *texture_pipeline; /* used for set_source_texture */ + GString *codegen_header_buffer; + GString *codegen_source_buffer; + GString *codegen_boilerplate_buffer; + GList *source_stack; + + int legacy_state_set; + + CoglPipelineCache *pipeline_cache; + + /* Textures */ + CoglTexture2D *default_gl_texture_2d_tex; + CoglTexture3D *default_gl_texture_3d_tex; + CoglTextureRectangle *default_gl_texture_rect_tex; + + /* Central list of all framebuffers so all journals can be flushed + * at any time. */ + GList *framebuffers; + + /* Global journal buffers */ + GArray *journal_flush_attributes_array; + GArray *journal_clip_bounds; + + GArray *polygon_vertices; + + /* Some simple caching, to minimize state changes... */ + CoglPipeline *current_pipeline; + unsigned long current_pipeline_changes_since_flush; + CoglBool current_pipeline_with_color_attrib; + CoglBool current_pipeline_unknown_color_alpha; + unsigned long current_pipeline_age; + + CoglBool gl_blend_enable_cache; + + CoglBool depth_test_enabled_cache; + CoglDepthTestFunction depth_test_function_cache; + CoglBool depth_writing_enabled_cache; + float depth_range_near_cache; + float depth_range_far_cache; + + CoglBool legacy_depth_test_enabled; + + CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT]; + + /* Framebuffers */ + GSList *framebuffer_stack; + CoglFramebuffer *window_buffer; + unsigned long current_draw_buffer_state_flushed; + unsigned long current_draw_buffer_changes; + CoglFramebuffer *current_draw_buffer; + CoglFramebuffer *current_read_buffer; + + gboolean have_last_offscreen_allocate_flags; + CoglOffscreenAllocateFlags last_offscreen_allocate_flags; + + GHashTable *swap_callback_closures; + int next_swap_callback_id; + + CoglList onscreen_events_queue; + CoglList onscreen_dirty_queue; + CoglClosure *onscreen_dispatch_idle; + + CoglGLES2Context *current_gles2_context; + GQueue gles2_context_stack; + + /* This becomes TRUE the first time the context is bound to an + * onscreen buffer. This is used by cogl-framebuffer-gl to determine + * when to initialise the glDrawBuffer state */ + CoglBool was_bound_to_onscreen; + + /* Primitives */ + CoglPath *current_path; + CoglPipeline *stencil_pipeline; + + /* Pre-generated VBOs containing indices to generate GL_TRIANGLES + out of a vertex array of quads */ + CoglIndices *quad_buffer_indices_byte; + unsigned int quad_buffer_indices_len; + CoglIndices *quad_buffer_indices; + + CoglIndices *rectangle_byte_indices; + CoglIndices *rectangle_short_indices; + int rectangle_short_indices_len; + + CoglBool in_begin_gl_block; + + CoglPipeline *texture_download_pipeline; + CoglPipeline *blit_texture_pipeline; + + GSList *atlases; + GHookList atlas_reorganize_callbacks; + + /* This debugging variable is used to pick a colour for visually + displaying the quad batches. It needs to be global so that it can + be reset by cogl_clear. It needs to be reset to increase the + chances of getting the same colour during an animation */ + uint8_t journal_rectangles_color; + + /* Cached values for GL_MAX_TEXTURE_[IMAGE_]UNITS to avoid calling + glGetInteger too often */ + GLint max_texture_units; + GLint max_texture_image_units; + GLint max_activateable_texture_units; + + /* Fragment processing programs */ + CoglHandle current_program; + + CoglPipelineProgramType current_fragment_program_type; + CoglPipelineProgramType current_vertex_program_type; + GLuint current_gl_program; + + CoglBool current_gl_dither_enabled; + CoglColorMask current_gl_color_mask; + + /* Clipping */ + /* TRUE if we have a valid clipping stack flushed. In that case + current_clip_stack will describe what the current state is. If + this is FALSE then the current clip stack is completely unknown + so it will need to be reflushed. In that case current_clip_stack + doesn't need to be a valid pointer. We can't just use NULL in + current_clip_stack to mark a dirty state because NULL is a valid + stack (meaning no clipping) */ + CoglBool current_clip_stack_valid; + /* The clip state that was flushed. This isn't intended to be used + as a stack to push and pop new entries. Instead the current stack + that the user wants is part of the framebuffer state. This is + just used to record the flush state so we can avoid flushing the + same state multiple times. When the clip state is flushed this + will hold a reference */ + CoglClipStack *current_clip_stack; + /* Whether the stencil buffer was used as part of the current clip + state. If TRUE then any further use of the stencil buffer (such + as for drawing paths) would need to be merged with the existing + stencil buffer */ + CoglBool current_clip_stack_uses_stencil; + + /* This is used as a temporary buffer to fill a CoglBuffer when + cogl_buffer_map fails and we only want to map to fill it with new + data */ + GByteArray *buffer_map_fallback_array; + CoglBool buffer_map_fallback_in_use; + size_t buffer_map_fallback_offset; + + CoglWinsysRectangleState rectangle_state; + + CoglSamplerCache *sampler_cache; + + /* FIXME: remove these when we remove the last xlib based clutter + * backend. they should be tracked as part of the renderer but e.g. + * the eglx backend doesn't yet have a corresponding Cogl winsys + * and so we wont have a renderer in that case. */ +#ifdef COGL_HAS_XLIB_SUPPORT + int damage_base; + /* List of callback functions that will be given every Xlib event */ + GSList *event_filters; + /* Current top of the XError trap state stack. The actual memory for + these is expected to be allocated on the stack by the caller */ + CoglXlibTrapState *trap_state; +#endif + + unsigned long winsys_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_WINSYS_FEATURE_N_FEATURES)]; + void *winsys; + + /* Array of names of uniforms. These are used like quarks to give a + unique number to each uniform name except that we ensure that + they increase sequentially so that we can use the id as an index + into a bitfield representing the uniforms that a pipeline + overrides from its parent. */ + GPtrArray *uniform_names; + /* A hash table to quickly get an index given an existing name. The + name strings are owned by the uniform_names array. The values are + the uniform location cast to a pointer. */ + GHashTable *uniform_name_hash; + int n_uniform_names; + + CoglPollSource *fences_poll_source; + CoglList fences; + + /* This defines a list of function pointers that Cogl uses from + either GL or GLES. All functions are accessed indirectly through + these pointers rather than linking to them directly */ +#ifndef APIENTRY +#define APIENTRY +#endif + +#define COGL_EXT_BEGIN(name, \ + min_gl_major, min_gl_minor, \ + gles_availability, \ + extension_suffixes, extension_names) +#define COGL_EXT_FUNCTION(ret, name, args) \ + ret (APIENTRY * name) args; +#define COGL_EXT_END() + +#include "gl-prototypes/cogl-all-functions.h" + +#undef COGL_EXT_BEGIN +#undef COGL_EXT_FUNCTION +#undef COGL_EXT_END +}; + +CoglContext * +_cogl_context_get_default (); + +const CoglWinsysVtable * +_cogl_context_get_winsys (CoglContext *context); + +/* Query the GL extensions and lookup the corresponding function + * pointers. Theoretically the list of extensions can change for + * different GL contexts so it is the winsys backend's responsiblity + * to know when to re-query the GL extensions. The backend should also + * check whether the GL context is supported by Cogl. If not it should + * return FALSE and set @error */ +CoglBool +_cogl_context_update_features (CoglContext *context, + CoglError **error); + +/* Obtains the context and returns retval if NULL */ +#define _COGL_GET_CONTEXT(ctxvar, retval) \ +CoglContext *ctxvar = _cogl_context_get_default (); \ +if (ctxvar == NULL) return retval; + +#define NO_RETVAL + +void +_cogl_context_set_current_projection_entry (CoglContext *context, + CoglMatrixEntry *entry); + +void +_cogl_context_set_current_modelview_entry (CoglContext *context, + CoglMatrixEntry *entry); + +/* + * _cogl_context_get_gl_extensions: + * @context: A CoglContext + * + * Return value: a NULL-terminated array of strings representing the + * supported extensions by the current driver. This array is owned + * by the caller and should be freed with g_strfreev(). + */ +char ** +_cogl_context_get_gl_extensions (CoglContext *context); + +const char * +_cogl_context_get_gl_version (CoglContext *context); + +#endif /* __COGL_CONTEXT_PRIVATE_H */ diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c new file mode 100644 index 0000000..a7eed29 --- /dev/null +++ b/cogl/cogl-context.c @@ -0,0 +1,786 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object.h" +#include "cogl-private.h" +#include "cogl-winsys-private.h" +#include "winsys/cogl-winsys-stub-private.h" +#include "cogl-profile.h" +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-journal-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-3d-private.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-attribute-private.h" +#include "cogl1-context.h" +#include "cogl-gpu-info-private.h" +#include "cogl-config-private.h" +#include "cogl-error-private.h" +#include "cogl-gtype-private.h" + +#include "cogl/deprecated/cogl-framebuffer-deprecated.h" + +#include +#include + +#ifdef HAVE_COGL_GL +#include "cogl-pipeline-fragend-arbfp-private.h" +#endif + +/* These aren't defined in the GLES headers */ +#ifndef GL_POINT_SPRITE +#define GL_POINT_SPRITE 0x8861 +#endif + +#ifndef GL_NUM_EXTENSIONS +#define GL_NUM_EXTENSIONS 0x821D +#endif + +static void _cogl_context_free (CoglContext *context); + +COGL_OBJECT_DEFINE (Context, context); +COGL_GTYPE_DEFINE_CLASS (Context, context); + +extern void +_cogl_create_context_driver (CoglContext *context); + +static CoglContext *_cogl_context = NULL; + +static void +_cogl_init_feature_overrides (CoglContext *ctx) +{ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS))) + COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_VBOS, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS))) + COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP))) + { + ctx->feature_flags &= ~COGL_FEATURE_SHADERS_ARBFP; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_ARBFP, FALSE); + } + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL))) + { + ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, FALSE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, + FALSE); + } + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_NPOT_TEXTURES))) + { + ctx->feature_flags &= ~(COGL_FEATURE_TEXTURE_NPOT | + COGL_FEATURE_TEXTURE_NPOT_BASIC | + COGL_FEATURE_TEXTURE_NPOT_MIPMAP | + COGL_FEATURE_TEXTURE_NPOT_REPEAT); + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT, FALSE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, FALSE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, FALSE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, FALSE); + } +} + +const CoglWinsysVtable * +_cogl_context_get_winsys (CoglContext *context) +{ + return context->display->renderer->winsys_vtable; +} + +/* For reference: There was some deliberation over whether to have a + * constructor that could throw an exception but looking at standard + * practices with several high level OO languages including python, C++, + * C# Java and Ruby they all support exceptions in constructors and the + * general consensus appears to be that throwing an exception is neater + * than successfully constructing with an internal error status that + * would then have to be explicitly checked via some form of ::is_ok() + * method. + */ +CoglContext * +cogl_context_new (CoglDisplay *display, + CoglError **error) +{ + CoglContext *context; + uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff }; + CoglBitmap *white_pixel_bitmap; + const CoglWinsysVtable *winsys; + int i; + CoglError *internal_error = NULL; + + _cogl_init (); + +#ifdef COGL_ENABLE_PROFILE + /* We need to be absolutely sure that uprof has been initialized + * before calling _cogl_uprof_init. uprof_init (NULL, NULL) + * will be a NOP if it has been initialized but it will also + * mean subsequent parsing of the UProf GOptionGroup will have no + * affect. + * + * Sadly GOptionGroup based library initialization is extremely + * fragile by design because GOptionGroups have no notion of + * dependencies and so the order things are initialized isn't + * currently under tight control. + */ + uprof_init (NULL, NULL); + _cogl_uprof_init (); +#endif + + /* Allocate context memory */ + context = g_malloc0 (sizeof (CoglContext)); + + /* Convert the context into an object immediately in case any of the + code below wants to verify that the context pointer is a valid + object */ + _cogl_context_object_new (context); + + /* XXX: Gross hack! + * Currently everything in Cogl just assumes there is a default + * context which it can access via _COGL_GET_CONTEXT() including + * code used to construct a CoglContext. Until all of that code + * has been updated to take an explicit context argument we have + * to immediately make our pointer the default context. + */ + _cogl_context = context; + + /* Init default values */ + memset (context->features, 0, sizeof (context->features)); + context->feature_flags = 0; + memset (context->private_features, 0, sizeof (context->private_features)); + + context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_UNKNOWN; + + memset (context->winsys_features, 0, sizeof (context->winsys_features)); + + if (!display) + { + CoglRenderer *renderer = cogl_renderer_new (); + if (!cogl_renderer_connect (renderer, error)) + { + g_free (context); + return NULL; + } + + display = cogl_display_new (renderer, NULL); + cogl_object_unref(renderer); + } + else + cogl_object_ref (display); + + if (!cogl_display_setup (display, error)) + { + cogl_object_unref (display); + g_free (context); + return NULL; + } + + context->display = display; + + /* This is duplicated data, but it's much more convenient to have + the driver attached to the context and the value is accessed a + lot throughout Cogl */ + context->driver = display->renderer->driver; + + /* Again this is duplicated data, but it convenient to be able + * access these from the context. */ + context->driver_vtable = display->renderer->driver_vtable; + context->texture_driver = display->renderer->texture_driver; + + for (i = 0; i < G_N_ELEMENTS (context->private_features); i++) + context->private_features[i] |= display->renderer->private_features[i]; + + winsys = _cogl_context_get_winsys (context); + if (!winsys->context_init (context, error)) + { + cogl_object_unref (display); + g_free (context); + return NULL; + } + + context->attribute_name_states_hash = + g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + context->attribute_name_index_map = NULL; + context->n_attribute_names = 0; + + /* The "cogl_color_in" attribute needs a deterministic name_index + * so we make sure it's the first attribute name we register */ + _cogl_attribute_register_attribute_name (context, "cogl_color_in"); + + + context->uniform_names = + g_ptr_array_new_with_free_func ((GDestroyNotify) g_free); + context->uniform_name_hash = g_hash_table_new (g_str_hash, g_str_equal); + context->n_uniform_names = 0; + + /* Initialise the driver specific state */ + _cogl_init_feature_overrides (context); + + /* XXX: ONGOING BUG: Intel viewport scissor + * + * Intel gen6 drivers don't currently correctly handle offset + * viewports, since primitives aren't clipped within the bounds of + * the viewport. To workaround this we push our own clip for the + * viewport that will use scissoring to ensure we clip as expected. + * + * TODO: file a bug upstream! + */ + if (context->gpu.driver_package == COGL_GPU_INFO_DRIVER_PACKAGE_MESA && + context->gpu.architecture == COGL_GPU_INFO_ARCHITECTURE_SANDYBRIDGE && + !getenv ("COGL_DISABLE_INTEL_VIEWPORT_SCISSORT_WORKAROUND")) + context->needs_viewport_scissor_workaround = TRUE; + else + context->needs_viewport_scissor_workaround = FALSE; + + context->sampler_cache = _cogl_sampler_cache_new (context); + + _cogl_pipeline_init_default_pipeline (); + _cogl_pipeline_init_default_layers (); + _cogl_pipeline_init_state_hash_functions (); + _cogl_pipeline_init_layer_state_hash_functions (); + + context->current_clip_stack_valid = FALSE; + context->current_clip_stack = NULL; + + context->legacy_backface_culling_enabled = FALSE; + + cogl_matrix_init_identity (&context->identity_matrix); + cogl_matrix_init_identity (&context->y_flip_matrix); + cogl_matrix_scale (&context->y_flip_matrix, 1, -1, 1); + + context->flushed_matrix_mode = COGL_MATRIX_MODELVIEW; + + context->texture_units = + g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit)); + + if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ANY_GL)) + { + /* See cogl-pipeline.c for more details about why we leave texture unit 1 + * active by default... */ + context->active_texture_unit = 1; + GE (context, glActiveTexture (GL_TEXTURE1)); + } + + context->legacy_fog_state.enabled = FALSE; + + context->opaque_color_pipeline = cogl_pipeline_new (context); + context->blended_color_pipeline = cogl_pipeline_new (context); + context->texture_pipeline = cogl_pipeline_new (context); + context->codegen_header_buffer = g_string_new (""); + context->codegen_source_buffer = g_string_new (""); + context->codegen_boilerplate_buffer = g_string_new (""); + context->source_stack = NULL; + + context->legacy_state_set = 0; + + context->default_gl_texture_2d_tex = NULL; + context->default_gl_texture_3d_tex = NULL; + context->default_gl_texture_rect_tex = NULL; + + context->framebuffers = NULL; + context->current_draw_buffer = NULL; + context->current_read_buffer = NULL; + context->current_draw_buffer_state_flushed = 0; + context->current_draw_buffer_changes = COGL_FRAMEBUFFER_STATE_ALL; + + context->swap_callback_closures = + g_hash_table_new (g_direct_hash, g_direct_equal); + + _cogl_list_init (&context->onscreen_events_queue); + _cogl_list_init (&context->onscreen_dirty_queue); + + g_queue_init (&context->gles2_context_stack); + + context->journal_flush_attributes_array = + g_array_new (TRUE, FALSE, sizeof (CoglAttribute *)); + context->journal_clip_bounds = NULL; + + context->polygon_vertices = g_array_new (FALSE, FALSE, sizeof (float)); + + context->current_pipeline = NULL; + context->current_pipeline_changes_since_flush = 0; + context->current_pipeline_with_color_attrib = FALSE; + + _cogl_bitmask_init (&context->enabled_builtin_attributes); + _cogl_bitmask_init (&context->enable_builtin_attributes_tmp); + _cogl_bitmask_init (&context->enabled_texcoord_attributes); + _cogl_bitmask_init (&context->enable_texcoord_attributes_tmp); + _cogl_bitmask_init (&context->enabled_custom_attributes); + _cogl_bitmask_init (&context->enable_custom_attributes_tmp); + _cogl_bitmask_init (&context->changed_bits_tmp); + + context->max_texture_units = -1; + context->max_activateable_texture_units = -1; + + context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED; + context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED; + context->current_gl_program = 0; + + context->current_gl_dither_enabled = TRUE; + context->current_gl_color_mask = COGL_COLOR_MASK_ALL; + + context->gl_blend_enable_cache = FALSE; + + context->depth_test_enabled_cache = FALSE; + context->depth_test_function_cache = COGL_DEPTH_TEST_FUNCTION_LESS; + context->depth_writing_enabled_cache = TRUE; + context->depth_range_near_cache = 0; + context->depth_range_far_cache = 1; + + context->legacy_depth_test_enabled = FALSE; + + context->pipeline_cache = _cogl_pipeline_cache_new (); + + for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++) + context->current_buffer[i] = NULL; + + context->window_buffer = NULL; + context->framebuffer_stack = _cogl_create_framebuffer_stack (); + + /* XXX: In this case the Clutter backend is still responsible for + * the OpenGL binding API and for creating onscreen framebuffers and + * so we have to add a dummy framebuffer to represent the backend + * owned window... */ + if (_cogl_context_get_winsys (context) == _cogl_winsys_stub_get_vtable ()) + { + CoglOnscreen *window = _cogl_onscreen_new (); + cogl_set_framebuffer (COGL_FRAMEBUFFER (window)); + cogl_object_unref (COGL_FRAMEBUFFER (window)); + } + + context->current_path = NULL; + context->stencil_pipeline = cogl_pipeline_new (context); + + context->in_begin_gl_block = FALSE; + + context->quad_buffer_indices_byte = NULL; + context->quad_buffer_indices = NULL; + context->quad_buffer_indices_len = 0; + + context->rectangle_byte_indices = NULL; + context->rectangle_short_indices = NULL; + context->rectangle_short_indices_len = 0; + + context->texture_download_pipeline = NULL; + context->blit_texture_pipeline = NULL; + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST)) + /* The default for GL_ALPHA_TEST is to always pass which is equivalent to + * the test being disabled therefore we assume that for all drivers there + * will be no performance impact if we always leave the test enabled which + * makes things a bit simpler for us. Under GLES2 the alpha test is + * implemented in the fragment shader so there is no enable for it + */ + GE (context, glEnable (GL_ALPHA_TEST)); +#endif + +#if defined (HAVE_COGL_GL) + if ((context->driver == COGL_DRIVER_GL3)) + { + GLuint vertex_array; + + /* In a forward compatible context, GL 3 doesn't support rendering + * using the default vertex array object. Cogl doesn't use vertex + * array objects yet so for now we just create a dummy array + * object that we will use as our own default object. Eventually + * it could be good to attach the vertex array objects to + * CoglPrimitives */ + context->glGenVertexArrays (1, &vertex_array); + context->glBindVertexArray (vertex_array); + } +#endif + + context->current_modelview_entry = NULL; + context->current_projection_entry = NULL; + _cogl_matrix_entry_identity_init (&context->identity_entry); + _cogl_matrix_entry_cache_init (&context->builtin_flushed_projection); + _cogl_matrix_entry_cache_init (&context->builtin_flushed_modelview); + + /* Create default textures used for fall backs */ + context->default_gl_texture_2d_tex = + cogl_texture_2d_new_from_data (context, + 1, 1, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 0, /* rowstride */ + white_pixel, + NULL); /* abort on error */ + + /* If 3D or rectangle textures aren't supported then these will + * return errors that we can simply ignore. */ + internal_error = NULL; + context->default_gl_texture_3d_tex = + cogl_texture_3d_new_from_data (context, + 1, 1, 1, /* width, height, depth */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 0, /* rowstride */ + 0, /* image stride */ + white_pixel, + &internal_error); + if (internal_error) + cogl_error_free (internal_error); + + /* TODO: add cogl_texture_rectangle_new_from_data() */ + white_pixel_bitmap = + cogl_bitmap_new_for_data (context, + 1, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + white_pixel); + + internal_error = NULL; + context->default_gl_texture_rect_tex = + cogl_texture_rectangle_new_from_bitmap (white_pixel_bitmap); + + /* XXX: we need to allocate the texture now because the white_pixel + * data is on the stack */ + cogl_texture_allocate (COGL_TEXTURE (context->default_gl_texture_rect_tex), + &internal_error); + if (internal_error) + cogl_error_free (internal_error); + + cogl_object_unref (white_pixel_bitmap); + + cogl_push_source (context->opaque_color_pipeline); + + context->atlases = NULL; + g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook)); + + context->buffer_map_fallback_array = g_byte_array_new (); + context->buffer_map_fallback_in_use = FALSE; + + /* As far as I can tell, GL_POINT_SPRITE doesn't have any effect + unless GL_COORD_REPLACE is enabled for an individual layer. + Therefore it seems like it should be ok to just leave it enabled + all the time instead of having to have a set property on each + pipeline to track whether any layers have point sprite coords + enabled. We don't need to do this for GL3 or GLES2 because point + sprites are handled using a builtin varying in the shader. */ + if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_GL_FIXED) && + cogl_has_feature (context, COGL_FEATURE_ID_POINT_SPRITE)) + GE (context, glEnable (GL_POINT_SPRITE)); + + _cogl_list_init (&context->fences); + + return context; +} + +static void +_cogl_context_free (CoglContext *context) +{ + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + + winsys->context_deinit (context); + + _cogl_free_framebuffer_stack (context->framebuffer_stack); + + if (context->current_path) + cogl_handle_unref (context->current_path); + + if (context->default_gl_texture_2d_tex) + cogl_object_unref (context->default_gl_texture_2d_tex); + if (context->default_gl_texture_3d_tex) + cogl_object_unref (context->default_gl_texture_3d_tex); + if (context->default_gl_texture_rect_tex) + cogl_object_unref (context->default_gl_texture_rect_tex); + + if (context->opaque_color_pipeline) + cogl_object_unref (context->opaque_color_pipeline); + if (context->blended_color_pipeline) + cogl_object_unref (context->blended_color_pipeline); + if (context->texture_pipeline) + cogl_object_unref (context->texture_pipeline); + + if (context->blit_texture_pipeline) + cogl_object_unref (context->blit_texture_pipeline); + + if (context->swap_callback_closures) + g_hash_table_destroy (context->swap_callback_closures); + + g_warn_if_fail (context->gles2_context_stack.length == 0); + + if (context->journal_flush_attributes_array) + g_array_free (context->journal_flush_attributes_array, TRUE); + if (context->journal_clip_bounds) + g_array_free (context->journal_clip_bounds, TRUE); + + if (context->polygon_vertices) + g_array_free (context->polygon_vertices, TRUE); + + if (context->quad_buffer_indices_byte) + cogl_object_unref (context->quad_buffer_indices_byte); + if (context->quad_buffer_indices) + cogl_object_unref (context->quad_buffer_indices); + + if (context->rectangle_byte_indices) + cogl_object_unref (context->rectangle_byte_indices); + if (context->rectangle_short_indices) + cogl_object_unref (context->rectangle_short_indices); + + if (context->default_pipeline) + cogl_object_unref (context->default_pipeline); + + if (context->dummy_layer_dependant) + cogl_object_unref (context->dummy_layer_dependant); + if (context->default_layer_n) + cogl_object_unref (context->default_layer_n); + if (context->default_layer_0) + cogl_object_unref (context->default_layer_0); + + if (context->current_clip_stack_valid) + _cogl_clip_stack_unref (context->current_clip_stack); + + g_slist_free (context->atlases); + g_hook_list_clear (&context->atlas_reorganize_callbacks); + + _cogl_bitmask_destroy (&context->enabled_builtin_attributes); + _cogl_bitmask_destroy (&context->enable_builtin_attributes_tmp); + _cogl_bitmask_destroy (&context->enabled_texcoord_attributes); + _cogl_bitmask_destroy (&context->enable_texcoord_attributes_tmp); + _cogl_bitmask_destroy (&context->enabled_custom_attributes); + _cogl_bitmask_destroy (&context->enable_custom_attributes_tmp); + _cogl_bitmask_destroy (&context->changed_bits_tmp); + + if (context->current_modelview_entry) + cogl_matrix_entry_unref (context->current_modelview_entry); + if (context->current_projection_entry) + cogl_matrix_entry_unref (context->current_projection_entry); + _cogl_matrix_entry_cache_destroy (&context->builtin_flushed_projection); + _cogl_matrix_entry_cache_destroy (&context->builtin_flushed_modelview); + + _cogl_pipeline_cache_free (context->pipeline_cache); + + _cogl_sampler_cache_free (context->sampler_cache); + + _cogl_destroy_texture_units (); + + g_ptr_array_free (context->uniform_names, TRUE); + g_hash_table_destroy (context->uniform_name_hash); + + g_hash_table_destroy (context->attribute_name_states_hash); + g_array_free (context->attribute_name_index_map, TRUE); + + g_byte_array_free (context->buffer_map_fallback_array, TRUE); + + cogl_object_unref (context->display); + + g_free (context); +} + +CoglContext * +_cogl_context_get_default (void) +{ + CoglError *error = NULL; + /* Create if doesn't exist yet */ + if (_cogl_context == NULL) + { + _cogl_context = cogl_context_new (NULL, &error); + if (!_cogl_context) + { + g_warning ("Failed to create default context: %s", + error->message); + cogl_error_free (error); + } + } + + return _cogl_context; +} + +CoglDisplay * +cogl_context_get_display (CoglContext *context) +{ + return context->display; +} + +CoglRenderer * +cogl_context_get_renderer (CoglContext *context) +{ + return context->display->renderer; +} + +CoglBool +_cogl_context_update_features (CoglContext *context, + CoglError **error) +{ + return context->driver_vtable->update_features (context, error); +} + +void +_cogl_context_set_current_projection_entry (CoglContext *context, + CoglMatrixEntry *entry) +{ + cogl_matrix_entry_ref (entry); + if (context->current_projection_entry) + cogl_matrix_entry_unref (context->current_projection_entry); + context->current_projection_entry = entry; +} + +void +_cogl_context_set_current_modelview_entry (CoglContext *context, + CoglMatrixEntry *entry) +{ + cogl_matrix_entry_ref (entry); + if (context->current_modelview_entry) + cogl_matrix_entry_unref (context->current_modelview_entry); + context->current_modelview_entry = entry; +} + +char ** +_cogl_context_get_gl_extensions (CoglContext *context) +{ + const char *env_disabled_extensions; + char **ret; + + /* In GL 3, querying GL_EXTENSIONS is deprecated so we have to build + * the array using glGetStringi instead */ +#ifdef HAVE_COGL_GL + if (context->driver == COGL_DRIVER_GL3) + { + int num_extensions, i; + + context->glGetIntegerv (GL_NUM_EXTENSIONS, &num_extensions); + + ret = g_malloc (sizeof (char *) * (num_extensions + 1)); + + for (i = 0; i < num_extensions; i++) + { + const char *ext = + (const char *) context->glGetStringi (GL_EXTENSIONS, i); + ret[i] = g_strdup (ext); + } + + ret[num_extensions] = NULL; + } + else +#endif + { + const char *all_extensions = + (const char *) context->glGetString (GL_EXTENSIONS); + + ret = g_strsplit (all_extensions, " ", 0 /* max tokens */); + } + + if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS")) + || _cogl_config_disable_gl_extensions) + { + char **split_env_disabled_extensions; + char **split_conf_disabled_extensions; + char **src, **dst; + + if (env_disabled_extensions) + split_env_disabled_extensions = + g_strsplit (env_disabled_extensions, + ",", + 0 /* no max tokens */); + else + split_env_disabled_extensions = NULL; + + if (_cogl_config_disable_gl_extensions) + split_conf_disabled_extensions = + g_strsplit (_cogl_config_disable_gl_extensions, + ",", + 0 /* no max tokens */); + else + split_conf_disabled_extensions = NULL; + + for (dst = ret, src = ret; + *src; + src++) + { + char **d; + + if (split_env_disabled_extensions) + for (d = split_env_disabled_extensions; *d; d++) + if (!strcmp (*src, *d)) + goto disabled; + if (split_conf_disabled_extensions) + for (d = split_conf_disabled_extensions; *d; d++) + if (!strcmp (*src, *d)) + goto disabled; + + *(dst++) = *src; + continue; + + disabled: + g_free (*src); + continue; + } + + *dst = NULL; + + if (split_env_disabled_extensions) + g_strfreev (split_env_disabled_extensions); + if (split_conf_disabled_extensions) + g_strfreev (split_conf_disabled_extensions); + } + + return ret; +} + +const char * +_cogl_context_get_gl_version (CoglContext *context) +{ + const char *version_override; + + if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION"))) + return version_override; + else if (_cogl_config_override_gl_version) + return _cogl_config_override_gl_version; + else + return (const char *) context->glGetString (GL_VERSION); + +} + +int64_t +cogl_get_clock_time (CoglContext *context) +{ + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + + if (winsys->context_get_clock_time) + return winsys->context_get_clock_time (context); + else + return 0; +} diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h new file mode 100644 index 0000000..07badeb --- /dev/null +++ b/cogl/cogl-context.h @@ -0,0 +1,401 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CONTEXT_H__ +#define __COGL_CONTEXT_H__ + +/* We forward declare the CoglContext type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglContext CoglContext; + +#include +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-context + * @short_description: The top level application context. + * + * A #CoglContext is the top most sandbox of Cogl state for an + * application or toolkit. Its main purpose is to act as a sandbox + * for the memory management of state objects. Normally an application + * will only create a single context since there is no way to share + * resources between contexts. + * + * For those familiar with OpenGL or perhaps Cairo it should be + * understood that unlike these APIs a Cogl context isn't a rendering + * context as such. In other words Cogl doesn't aim to provide a state + * machine style model for configuring rendering parameters. Most + * rendering state in Cogl is directly associated with user managed + * objects called pipelines and geometry is drawn with a specific + * pipeline object to a framebuffer object and those 3 things fully + * define the state for drawing. This is an important part of Cogl's + * design since it helps you write orthogonal rendering components + * that can all access the same GPU without having to worry about + * what state other components have left you with. + * + * Cogl does not maintain internal references to the context for + * resources that depend on the context so applications. This is to + * help applications control the lifetime a context without us needing to + * introduce special api to handle the breakup of internal circular + * references due to internal resources and caches associated with the + * context. + * + * One a context has been destroyed then all directly or indirectly + * dependant resources will be in an inconsistent state and should not + * be manipulated or queried in any way. + * + * For applications that rely on the operating system to clean up + * resources this policy shouldn't affect them, but for applications + * that need to carefully destroy and re-create Cogl contexts multiple + * times throughout their lifetime (such as Android applications) they + * should be careful to destroy all context dependant resources, such as + * framebuffers or textures etc before unrefing and destroying the + * context. + */ + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +#define COGL_CONTEXT(OBJECT) ((CoglContext *)OBJECT) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_context_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_context_get_gtype (void); +#endif + +/** + * cogl_context_new: (constructor) + * @display: (allow-none): A #CoglDisplay pointer + * @error: A CoglError return location. + * + * Creates a new #CoglContext which acts as an application sandbox + * for any state objects that are allocated. + * + * Return value: (transfer full): A newly allocated #CoglContext + * Since: 1.8 + * Stability: unstable + */ +CoglContext * +cogl_context_new (CoglDisplay *display, + CoglError **error); + +/** + * cogl_context_get_display: + * @context: A #CoglContext pointer + * + * Retrieves the #CoglDisplay that is internally associated with the + * given @context. This will return the same #CoglDisplay that was + * passed to cogl_context_new() or if %NULL was passed to + * cogl_context_new() then this function returns a pointer to the + * display that was automatically setup internally. + * + * Return value: (transfer none): The #CoglDisplay associated with the + * given @context. + * Since: 1.8 + * Stability: unstable + */ +CoglDisplay * +cogl_context_get_display (CoglContext *context); + +/** + * cogl_context_get_renderer: + * @context: A #CoglContext pointer + * + * Retrieves the #CoglRenderer that is internally associated with the + * given @context. This will return the same #CoglRenderer that was + * passed to cogl_display_new() or if %NULL was passed to + * cogl_display_new() or cogl_context_new() then this function returns + * a pointer to the renderer that was automatically connected + * internally. + * + * Return value: (transfer none): The #CoglRenderer associated with the + * given @context. + * Since: 1.16 + * Stability: unstable + */ +CoglRenderer * +cogl_context_get_renderer (CoglContext *context); + +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT +/** + * cogl_android_set_native_window: + * @window: A native Android window + * + * Allows Android applications to inform Cogl of the native window + * that they have been given which Cogl can render too. On Android + * this API must be used before creating a #CoglRenderer, #CoglDisplay + * and #CoglContext. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_android_set_native_window (ANativeWindow *window); +#endif + +/** + * cogl_is_context: + * @object: An object or %NULL + * + * Gets whether the given object references an existing context object. + * + * Return value: %TRUE if the @object references a #CoglContext, + * %FALSE otherwise + * + * Since: 1.10 + * Stability: Unstable + */ +CoglBool +cogl_is_context (void *object); + +#endif /* COGL_ENABLE_EXPERIMENTAL_2_0_API */ + +/* XXX: not guarded by the EXPERIMENTAL_API defines to avoid + * upsetting glib-mkenums, but this can still be considered implicitly + * experimental since it's only useable with experimental API... */ +/** + * CoglFeatureID: + * @COGL_FEATURE_ID_TEXTURE_NPOT_BASIC: The hardware supports non power + * of two textures, but you also need to check the + * %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT + * features to know if the hardware supports npot texture mipmaps + * or repeat modes other than + * %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively. + * @COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in + * conjuntion with non power of two textures. + * @COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT: Repeat modes other than + * %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the + * hardware. + * @COGL_FEATURE_ID_TEXTURE_NPOT: Non power of two textures are supported + * by the hardware. This is a equivalent to the + * %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP + * and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined. + * @COGL_FEATURE_ID_TEXTURE_RECTANGLE: Support for rectangular + * textures with non-normalized texture coordinates. + * @COGL_FEATURE_ID_TEXTURE_RG: Support for + * %COGL_TEXTURE_COMPONENTS_RG as the internal components of a + * texture. + * @COGL_FEATURE_ID_TEXTURE_3D: 3D texture support + * @COGL_FEATURE_ID_OFFSCREEN: Offscreen rendering support + * @COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE: Multisample support for + * offscreen framebuffers + * @COGL_FEATURE_ID_ONSCREEN_MULTIPLE: Multiple onscreen framebuffers + * supported. + * @COGL_FEATURE_ID_GLSL: GLSL support + * @COGL_FEATURE_ID_ARBFP: ARBFP support + * @COGL_FEATURE_ID_UNSIGNED_INT_INDICES: Set if + * %COGL_INDICES_TYPE_UNSIGNED_INT is supported in + * cogl_indices_new(). + * @COGL_FEATURE_ID_DEPTH_RANGE: cogl_pipeline_set_depth_range() support + * @COGL_FEATURE_ID_POINT_SPRITE: Whether + * cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported. + * @COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE: Whether cogl_point_size_in + * can be used as an attribute to set a per-vertex point size. + * @COGL_FEATURE_ID_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is + * supported with CoglBufferAccess including read support. + * @COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE: Whether cogl_buffer_map() is + * supported with CoglBufferAccess including write support. + * @COGL_FEATURE_ID_MIRRORED_REPEAT: Whether + * %COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported. + * @COGL_FEATURE_ID_SWAP_BUFFERS_EVENT: + * Available if the window system supports reporting an event + * for swap buffer completions. + * @COGL_FEATURE_ID_BUFFER_AGE: Available if the age of #CoglOnscreen back + * buffers are tracked and so cogl_onscreen_get_buffer_age() can be + * expected to return age values other than 0. + * @COGL_FEATURE_ID_GLES2_CONTEXT: Whether creating new GLES2 contexts is + * suported. + * @COGL_FEATURE_ID_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering + * the depth buffer to a texture. + * @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation + * time stamps will be recorded in #CoglFrameInfo objects. + * + * All the capabilities that can vary between different GPUs supported + * by Cogl. Applications that depend on any of these features should explicitly + * check for them using cogl_has_feature() or cogl_has_features(). + * + * Since: 1.10 + */ +typedef enum _CoglFeatureID +{ + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1, + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, + COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, + COGL_FEATURE_ID_TEXTURE_NPOT, + COGL_FEATURE_ID_TEXTURE_RECTANGLE, + COGL_FEATURE_ID_TEXTURE_3D, + COGL_FEATURE_ID_GLSL, + COGL_FEATURE_ID_ARBFP, + COGL_FEATURE_ID_OFFSCREEN, + COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE, + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, + COGL_FEATURE_ID_UNSIGNED_INT_INDICES, + COGL_FEATURE_ID_DEPTH_RANGE, + COGL_FEATURE_ID_POINT_SPRITE, + COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, + COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, + COGL_FEATURE_ID_MIRRORED_REPEAT, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, + COGL_FEATURE_ID_GLES2_CONTEXT, + COGL_FEATURE_ID_DEPTH_TEXTURE, + COGL_FEATURE_ID_PRESENTATION_TIME, + COGL_FEATURE_ID_FENCE, + COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, + COGL_FEATURE_ID_TEXTURE_RG, + COGL_FEATURE_ID_BUFFER_AGE, + + /*< private >*/ + _COGL_N_FEATURE_IDS /*< skip >*/ +} CoglFeatureID; + + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * cogl_has_feature: + * @context: A #CoglContext pointer + * @feature: A #CoglFeatureID + * + * Checks if a given @feature is currently available + * + * Cogl does not aim to be a lowest common denominator API, it aims to + * expose all the interesting features of GPUs to application which + * means applications have some responsibility to explicitly check + * that certain features are available before depending on them. + * + * Returns: %TRUE if the @feature is currently supported or %FALSE if + * not. + * + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_has_feature (CoglContext *context, CoglFeatureID feature); + +/** + * cogl_has_features: + * @context: A #CoglContext pointer + * @...: A 0 terminated list of CoglFeatureIDs + * + * Checks if a list of features are all currently available. + * + * This checks all of the listed features using cogl_has_feature() and + * returns %TRUE if all the features are available or %FALSE + * otherwise. + * + * Return value: %TRUE if all the features are available, %FALSE + * otherwise. + * + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_has_features (CoglContext *context, ...); + +/** + * CoglFeatureCallback: + * @feature: A single feature currently supported by Cogl + * @user_data: A private pointer passed to cogl_foreach_feature(). + * + * A callback used with cogl_foreach_feature() for enumerating all + * context level features supported by Cogl. + * + * Since: 0.10 + * Stability: unstable + */ +typedef void (*CoglFeatureCallback) (CoglFeatureID feature, void *user_data); + +/** + * cogl_foreach_feature: + * @context: A #CoglContext pointer + * @callback: (scope call): A #CoglFeatureCallback called for each + * supported feature + * @user_data: (closure): Private data to pass to the callback + * + * Iterates through all the context level features currently supported + * for a given @context and for each feature @callback is called. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_foreach_feature (CoglContext *context, + CoglFeatureCallback callback, + void *user_data); + +/** + * cogl_get_clock_time: + * @context: a #CoglContext pointer + * + * Returns the current time value from Cogl's internal clock. This + * clock is used for measuring times such as the presentation time + * in a #CoglFrameInfo. + * + * This method is meant for converting timestamps retrieved from Cogl + * to other time systems, and is not meant to be used as a standalone + * timing system. For that reason, if this function is called without + * having retrieved a valid (non-zero) timestamp from Cogl first, it + * may return 0 to indicate that Cogl has no active internal clock. + * + * Return value: the time value for the Cogl clock, in nanoseconds + * from an arbitrary point in time, or 0 if Cogl doesn't have an + * active internal clock. + * Since: 1.14 + * Stability: unstable + */ +int64_t +cogl_get_clock_time (CoglContext *context); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +#endif /* __COGL_CONTEXT_H__ */ + diff --git a/cogl/cogl-debug-options.h b/cogl/cogl-debug-options.h new file mode 100644 index 0000000..0f3b307 --- /dev/null +++ b/cogl/cogl-debug-options.h @@ -0,0 +1,199 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +OPT (OBJECT, + N_("Cogl Tracing"), + "ref-counts", + N_("CoglObject references"), + N_("Debug ref counting issues for CoglObjects")) +OPT (SLICING, + N_("Cogl Tracing"), + "slicing", + N_("Trace Texture Slicing"), + N_("debug the creation of texture slices")) +OPT (ATLAS, + N_("Cogl Tracing"), + "atlas", + N_("Trace Atlas Textures"), + N_("Debug texture atlas management")) +OPT (BLEND_STRINGS, + N_("Cogl Tracing"), + "blend-strings", + N_("Trace Blend Strings"), + N_("Debug CoglBlendString parsing")) +OPT (JOURNAL, + N_("Cogl Tracing"), + "journal", + N_("Trace Journal"), + N_("View all the geometry passing through the journal")) +OPT (BATCHING, + N_("Cogl Tracing"), + "batching", + N_("Trace Batching"), + N_("Show how geometry is being batched in the journal")) +OPT (MATRICES, + N_("Cogl Tracing"), + "matrices", + N_("Trace matrices"), + N_("Trace all matrix manipulation")) +/* XXX we should replace the "draw" option its very hand wavy... */ +OPT (DRAW, + N_("Cogl Tracing"), + "draw", + N_("Trace Misc Drawing"), + N_("Trace some misc drawing operations")) +OPT (PANGO, + N_("Cogl Tracing"), + "pango", + N_("Trace Pango Renderer"), + N_("Trace the Cogl Pango renderer")) +OPT (TEXTURE_PIXMAP, + N_("Cogl Tracing"), + "texture-pixmap", + N_("Trace CoglTexturePixmap backend"), + N_("Trace the Cogl texture pixmap backend")) +OPT (RECTANGLES, + N_("Visualize"), + "rectangles", + N_("Outline rectangles"), + N_("Add wire outlines for all rectangular geometry")) +OPT (WIREFRAME, + N_("Visualize"), + "wireframe", + N_("Show wireframes"), + N_("Add wire outlines for all geometry")) +OPT (DISABLE_BATCHING, + N_("Root Cause"), + "disable-batching", + N_("Disable Journal batching"), + N_("Disable batching of geometry in the Cogl Journal.")) +OPT (DISABLE_VBOS, + N_("Root Cause"), + "disable-vbos", + N_("Disable GL Vertex Buffers"), + N_("Disable use of OpenGL vertex buffer objects")) +OPT (DISABLE_PBOS, + N_("Root Cause"), + "disable-pbos", + N_("Disable GL Pixel Buffers"), + N_("Disable use of OpenGL pixel buffer objects")) +OPT (DISABLE_SOFTWARE_TRANSFORM, + N_("Root Cause"), + "disable-software-transform", + N_("Disable software rect transform"), + N_("Use the GPU to transform rectangular geometry")) +OPT (DUMP_ATLAS_IMAGE, + N_("Cogl Specialist"), + "dump-atlas-image", + N_("Dump atlas images"), + N_("Dump texture atlas changes to an image file")) +OPT (DISABLE_ATLAS, + N_("Root Cause"), + "disable-atlas", + N_("Disable texture atlasing"), + N_("Disable use of texture atlasing")) +OPT (DISABLE_SHARED_ATLAS, + N_("Root Cause"), + "disable-shared-atlas", + N_("Disable sharing the texture atlas between text and images"), + N_("When this is set the glyph cache will always use a separate texture " + "for its atlas. Otherwise it will try to share the atlas with images.")) +OPT (DISABLE_TEXTURING, + N_("Root Cause"), + "disable-texturing", + N_("Disable texturing"), + N_("Disable texturing any primitives")) +OPT (DISABLE_ARBFP, + N_("Root Cause"), + "disable-arbfp", + N_("Disable arbfp"), + N_("Disable use of ARB fragment programs")) +OPT (DISABLE_FIXED, + N_("Root Cause"), + "disable-fixed", + N_("Disable fixed"), + N_("Disable use of the fixed function pipeline backend")) +OPT (DISABLE_GLSL, + N_("Root Cause"), + "disable-glsl", + N_("Disable GLSL"), + N_("Disable use of GLSL")) +OPT (DISABLE_BLENDING, + N_("Root Cause"), + "disable-blending", + N_("Disable blending"), + N_("Disable use of blending")) +OPT (DISABLE_NPOT_TEXTURES, + N_("Root Cause"), + "disable-npot-textures", + N_("Disable non-power-of-two textures"), + N_("Makes Cogl think that the GL driver doesn't support NPOT textures " + "so that it will create sliced textures or textures with waste instead.")) +OPT (DISABLE_SOFTWARE_CLIP, + N_("Root Cause"), + "disable-software-clip", + N_("Disable software clipping"), + N_("Disables Cogl's attempts to clip some rectangles in software.")) +OPT (SHOW_SOURCE, + N_("Cogl Tracing"), + "show-source", + N_("Show source"), + N_("Show generated ARBfp/GLSL source code")) +OPT (OPENGL, + N_("Cogl Tracing"), + "opengl", + N_("Trace some OpenGL"), + N_("Traces some select OpenGL calls")) +OPT (OFFSCREEN, + N_("Cogl Tracing"), + "offscreen", + N_("Trace offscreen support"), + N_("Debug offscreen support")) +OPT (DISABLE_BLENDING, + N_("Root Cause"), + "disable-program-caches", + N_("Disable program caches"), + N_("Disable fallback caches for arbfp and glsl programs")) +OPT (DISABLE_FAST_READ_PIXEL, + N_("Root Cause"), + "disable-fast-read-pixel", + N_("Disable read pixel optimization"), + N_("Disable optimization for reading 1px for simple " + "scenes of opaque rectangles")) +OPT (CLIPPING, + N_("Cogl Tracing"), + "clipping", + N_("Trace clipping"), + N_("Logs information about how Cogl is implementing clipping")) +OPT (PERFORMANCE, + N_("Cogl Tracing"), + "performance", + N_("Trace performance concerns"), + N_("Tries to highlight sub-optimal Cogl usage.")) diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c new file mode 100644 index 0000000..446313c --- /dev/null +++ b/cogl/cogl-debug.c @@ -0,0 +1,304 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-i18n-private.h" +#include "cogl-private.h" +#include "cogl-debug.h" +#include "cogl1-context.h" + +/* XXX: If you add a debug option, please also add an option + * definition to cogl-debug-options.h. This will enable us - for + * example - to emit a "help" description for the option. + */ + +/* NB: Only these options get enabled if COGL_DEBUG=all is + * used since they don't affect the behaviour of Cogl they + * simply print out verbose information */ +static const GDebugKey cogl_log_debug_keys[] = { + { "object", COGL_DEBUG_OBJECT }, + { "slicing", COGL_DEBUG_SLICING }, + { "atlas", COGL_DEBUG_ATLAS }, + { "blend-strings", COGL_DEBUG_BLEND_STRINGS }, + { "journal", COGL_DEBUG_JOURNAL }, + { "batching", COGL_DEBUG_BATCHING }, + { "matrices", COGL_DEBUG_MATRICES }, + { "draw", COGL_DEBUG_DRAW }, + { "opengl", COGL_DEBUG_OPENGL }, + { "pango", COGL_DEBUG_PANGO }, + { "show-source", COGL_DEBUG_SHOW_SOURCE}, + { "offscreen", COGL_DEBUG_OFFSCREEN }, + { "texture-pixmap", COGL_DEBUG_TEXTURE_PIXMAP }, + { "bitmap", COGL_DEBUG_BITMAP }, + { "clipping", COGL_DEBUG_CLIPPING }, + { "winsys", COGL_DEBUG_WINSYS }, + { "performance", COGL_DEBUG_PERFORMANCE } +}; +static const int n_cogl_log_debug_keys = + G_N_ELEMENTS (cogl_log_debug_keys); + +static const GDebugKey cogl_behavioural_debug_keys[] = { + { "rectangles", COGL_DEBUG_RECTANGLES }, + { "disable-batching", COGL_DEBUG_DISABLE_BATCHING }, + { "disable-vbos", COGL_DEBUG_DISABLE_VBOS }, + { "disable-pbos", COGL_DEBUG_DISABLE_PBOS }, + { "disable-software-transform", COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM }, + { "dump-atlas-image", COGL_DEBUG_DUMP_ATLAS_IMAGE }, + { "disable-atlas", COGL_DEBUG_DISABLE_ATLAS }, + { "disable-shared-atlas", COGL_DEBUG_DISABLE_SHARED_ATLAS }, + { "disable-texturing", COGL_DEBUG_DISABLE_TEXTURING}, + { "disable-arbfp", COGL_DEBUG_DISABLE_ARBFP}, + { "disable-fixed", COGL_DEBUG_DISABLE_FIXED}, + { "disable-glsl", COGL_DEBUG_DISABLE_GLSL}, + { "disable-blending", COGL_DEBUG_DISABLE_BLENDING}, + { "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES}, + { "wireframe", COGL_DEBUG_WIREFRAME}, + { "disable-software-clip", COGL_DEBUG_DISABLE_SOFTWARE_CLIP}, + { "disable-program-caches", COGL_DEBUG_DISABLE_PROGRAM_CACHES}, + { "disable-fast-read-pixel", COGL_DEBUG_DISABLE_FAST_READ_PIXEL} +}; +static const int n_cogl_behavioural_debug_keys = + G_N_ELEMENTS (cogl_behavioural_debug_keys); + +unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS]; +GHashTable *_cogl_debug_instances; + +static void +_cogl_parse_debug_string_for_keys (const char *value, + CoglBool enable, + const GDebugKey *keys, + unsigned int nkeys) +{ + int long_num, key_num; + + /* g_parse_debug_string expects the value field in GDebugKey to be a + mask in an unsigned int but the flags are stored in an array of + multiple longs so we need to build a separate array for each + possible unsigned int */ + + for (long_num = 0; long_num < COGL_DEBUG_N_LONGS; long_num++) + { + int int_num; + + for (int_num = 0; + int_num < sizeof (unsigned long) / sizeof (unsigned int); + int_num++) + { + GDebugKey keys_for_int[sizeof (unsigned int) * 8]; + int nkeys_for_int = 0; + + for (key_num = 0; key_num < nkeys; key_num++) + { + int long_index = COGL_FLAGS_GET_INDEX (keys[key_num].value); + int int_index = (keys[key_num].value % + (sizeof (unsigned long) * 8) / + (sizeof (unsigned int) * 8)); + + if (long_index == long_num && int_index == int_num) + { + keys_for_int[nkeys_for_int] = keys[key_num]; + keys_for_int[nkeys_for_int].value = + COGL_FLAGS_GET_MASK (keys[key_num].value) >> + (int_num * sizeof (unsigned int) * 8); + nkeys_for_int++; + } + } + + if (nkeys_for_int > 0) + { + unsigned long mask = + ((unsigned long) g_parse_debug_string (value, + keys_for_int, + nkeys_for_int)) << + (int_num * sizeof (unsigned int) * 8); + + if (enable) + _cogl_debug_flags[long_num] |= mask; + else + _cogl_debug_flags[long_num] &= ~mask; + } + } + } +} + +void +_cogl_parse_debug_string (const char *value, + CoglBool enable, + CoglBool ignore_help) +{ + if (ignore_help && strcmp (value, "help") == 0) + return; + + /* We don't want to let g_parse_debug_string handle "all" because + * literally enabling all the debug options wouldn't be useful to + * anyone; instead the all option enables all non behavioural + * options. + */ + if (strcmp (value, "all") == 0 || + strcmp (value, "verbose") == 0) + { + int i; + for (i = 0; i < n_cogl_log_debug_keys; i++) + if (enable) + COGL_DEBUG_SET_FLAG (cogl_log_debug_keys[i].value); + else + COGL_DEBUG_CLEAR_FLAG (cogl_log_debug_keys[i].value); + } + else if (g_ascii_strcasecmp (value, "help") == 0) + { + g_printerr ("\n\n%28s\n", _("Supported debug values:")); +#define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \ + g_printerr ("%28s %s\n", NAME ":", g_dgettext (GETTEXT_PACKAGE, \ + DESCRIPTION)); +#include "cogl-debug-options.h" + g_printerr ("\n%28s\n", _("Special debug values:")); + OPT (IGNORED, "ignored", "all", "ignored", \ + N_("Enables all non-behavioural debug options")); + OPT (IGNORED, "ignored", "verbose", "ignored", \ + N_("Enables all non-behavioural debug options")); +#undef OPT + + g_printerr ("\n" + "%28s\n" + " COGL_DISABLE_GL_EXTENSIONS: %s\n" + " COGL_OVERRIDE_GL_VERSION: %s\n", + _("Additional environment variables:"), + _("Comma-separated list of GL extensions to pretend are " + "disabled"), + _("Override the GL version that Cogl will assume the driver " + "supports")); + exit (1); + } + else + { + _cogl_parse_debug_string_for_keys (value, + enable, + cogl_log_debug_keys, + n_cogl_log_debug_keys); + _cogl_parse_debug_string_for_keys (value, + enable, + cogl_behavioural_debug_keys, + n_cogl_behavioural_debug_keys); + } +} + +#ifdef COGL_ENABLE_DEBUG +static CoglBool +cogl_arg_debug_cb (const char *key, + const char *value, + void *user_data) +{ + _cogl_parse_debug_string (value, + TRUE /* enable the flags */, + FALSE /* don't ignore help */); + return TRUE; +} + +static CoglBool +cogl_arg_no_debug_cb (const char *key, + const char *value, + void *user_data) +{ + _cogl_parse_debug_string (value, + FALSE, /* disable the flags */ + TRUE /* ignore help */); + return TRUE; +} +#endif /* COGL_ENABLE_DEBUG */ + +static GOptionEntry cogl_args[] = { +#ifdef COGL_ENABLE_DEBUG + { "cogl-debug", 0, 0, G_OPTION_ARG_CALLBACK, cogl_arg_debug_cb, + N_("Cogl debugging flags to set"), "FLAGS" }, + { "cogl-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, cogl_arg_no_debug_cb, + N_("Cogl debugging flags to unset"), "FLAGS" }, +#endif /* COGL_ENABLE_DEBUG */ + { NULL, }, +}; + +void +_cogl_debug_check_environment (void) +{ + const char *env_string; + + env_string = g_getenv ("COGL_DEBUG"); + if (env_string != NULL) + { + _cogl_parse_debug_string (env_string, + TRUE /* enable the flags */, + FALSE /* don't ignore help */); + env_string = NULL; + } + + env_string = g_getenv ("COGL_NO_DEBUG"); + if (env_string != NULL) + { + _cogl_parse_debug_string (env_string, + FALSE /* disable the flags */, + FALSE /* don't ignore help */); + env_string = NULL; + } +} + +static CoglBool +pre_parse_hook (GOptionContext *context, + GOptionGroup *group, + void *data, + GError **error) +{ + _cogl_init (); + + return TRUE; +} + +/* XXX: GOption based library initialization is not reliable because the + * GOption API has no way to represent dependencies between libraries. + */ +GOptionGroup * +cogl_get_option_group (void) +{ + GOptionGroup *group; + + group = g_option_group_new ("cogl", + _("Cogl Options"), + _("Show Cogl options"), + NULL, NULL); + + g_option_group_set_parse_hooks (group, pre_parse_hook, NULL); + g_option_group_add_entries (group, cogl_args); + g_option_group_set_translation_domain (group, GETTEXT_PACKAGE); + + return group; +} diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h new file mode 100644 index 0000000..91a49e1 --- /dev/null +++ b/cogl/cogl-debug.h @@ -0,0 +1,126 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_DEBUG_H__ +#define __COGL_DEBUG_H__ + +#include "cogl-profile.h" +#include "cogl-flags.h" +#include "cogl-util.h" + +#include + +COGL_BEGIN_DECLS + +typedef enum { + COGL_DEBUG_SLICING, + COGL_DEBUG_OFFSCREEN, + COGL_DEBUG_DRAW, + COGL_DEBUG_PANGO, + COGL_DEBUG_RECTANGLES, + COGL_DEBUG_OBJECT, + COGL_DEBUG_BLEND_STRINGS, + COGL_DEBUG_DISABLE_BATCHING, + COGL_DEBUG_DISABLE_VBOS, + COGL_DEBUG_DISABLE_PBOS, + COGL_DEBUG_JOURNAL, + COGL_DEBUG_BATCHING, + COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM, + COGL_DEBUG_MATRICES, + COGL_DEBUG_ATLAS, + COGL_DEBUG_DUMP_ATLAS_IMAGE, + COGL_DEBUG_DISABLE_ATLAS, + COGL_DEBUG_DISABLE_SHARED_ATLAS, + COGL_DEBUG_OPENGL, + COGL_DEBUG_DISABLE_TEXTURING, + COGL_DEBUG_DISABLE_ARBFP, + COGL_DEBUG_DISABLE_FIXED, + COGL_DEBUG_DISABLE_GLSL, + COGL_DEBUG_SHOW_SOURCE, + COGL_DEBUG_DISABLE_BLENDING, + COGL_DEBUG_TEXTURE_PIXMAP, + COGL_DEBUG_BITMAP, + COGL_DEBUG_DISABLE_NPOT_TEXTURES, + COGL_DEBUG_WIREFRAME, + COGL_DEBUG_DISABLE_SOFTWARE_CLIP, + COGL_DEBUG_DISABLE_PROGRAM_CACHES, + COGL_DEBUG_DISABLE_FAST_READ_PIXEL, + COGL_DEBUG_CLIPPING, + COGL_DEBUG_WINSYS, + COGL_DEBUG_PERFORMANCE, + + COGL_DEBUG_N_FLAGS +} CoglDebugFlags; + +extern GHashTable *_cogl_debug_instances; +#define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS) + +/* _cogl_debug_flags currently needs to exported outside of the shared + library for cogl-pango. The special COGL_EXPORT macro is needed to + get this to work when building with MSVC */ +COGL_EXPORT extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS]; + +#define COGL_DEBUG_ENABLED(flag) \ + COGL_FLAGS_GET (_cogl_debug_flags, flag) + +#define COGL_DEBUG_SET_FLAG(flag) \ + COGL_FLAGS_SET (_cogl_debug_flags, flag, TRUE) + +#define COGL_DEBUG_CLEAR_FLAG(flag) \ + COGL_FLAGS_SET (_cogl_debug_flags, flag, FALSE) + +#ifdef __GNUC__ +#define COGL_NOTE(type,x,a...) G_STMT_START { \ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \ + _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & " x, ##a); \ + } } G_STMT_END + +#else +#define COGL_NOTE(type,...) G_STMT_START { \ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \ + char *_fmt = g_strdup_printf (__VA_ARGS__); \ + _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & %s", _fmt);\ + g_free (_fmt); \ + } } G_STMT_END + +#endif /* __GNUC__ */ + +void +_cogl_debug_check_environment (void); + +void +_cogl_parse_debug_string (const char *value, + CoglBool enable, + CoglBool ignore_help); + +COGL_END_DECLS + +#endif /* __COGL_DEBUG_H__ */ + diff --git a/cogl/cogl-defines.h.in b/cogl/cogl-defines.h.in new file mode 100644 index 0000000..eb3ad92 --- /dev/null +++ b/cogl/cogl-defines.h.in @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +@COGL_DEFINES@ + +#define COGL_VERSION_MAJOR_INTERNAL 1 +#define COGL_VERSION_MINOR_INTERNAL @COGL_1_MINOR_VERSION@ +#define COGL_VERSION_MICRO_INTERNAL @COGL_1_MICRO_VERSION@ +#define COGL_VERSION_STRING_INTERNAL "@COGL_1_VERSION@" + +#endif diff --git a/cogl/cogl-defines.h.win32 b/cogl/cogl-defines.h.win32 new file mode 100644 index 0000000..08c957f --- /dev/null +++ b/cogl/cogl-defines.h.win32 @@ -0,0 +1,77 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_GTYPE_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_SUPPORT 1 +#define COGL_HAS_COGL_PATH_SUPPORT 1 +#define COGL_HAS_GL 1 +#define CLUTTER_COGL_HAS_GL 1 + +#ifdef COGL_HAS_EGL_SUPPORT +#ifdef COGL_HAS_GLES1 +#include +#include +#else +#include +#endif +#endif + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#define COGL_SYSDEF_POLLIN 1 +#define COGL_SYSDEF_POLLPRI 2 +#define COGL_SYSDEF_POLLOUT 4 +#define COGL_SYSDEF_POLLERR 8 +#define COGL_SYSDEF_POLLHUP 16 +#define COGL_SYSDEF_POLLNVAL 32 + +#define COGL_VERSION_MAJOR_INTERNAL 2 +#define COGL_VERSION_MINOR_INTERNAL 0 +#define COGL_VERSION_MICRO_INTERNAL 0 +#define COGL_VERSION_STRING_INTERNAL "2.0.0" + +G_END_DECLS + +#endif diff --git a/cogl/cogl-defines.h.win32.in b/cogl/cogl-defines.h.win32.in new file mode 100644 index 0000000..b484fd2 --- /dev/null +++ b/cogl/cogl-defines.h.win32.in @@ -0,0 +1,77 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_GTYPE_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_SUPPORT 1 +#define COGL_HAS_COGL_PATH_SUPPORT 1 +#define COGL_HAS_GL 1 +#define CLUTTER_COGL_HAS_GL 1 + +#ifdef COGL_HAS_EGL_SUPPORT +#ifdef COGL_HAS_GLES1 +#include +#include +#else +#include +#endif +#endif + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#define COGL_SYSDEF_POLLIN 1 +#define COGL_SYSDEF_POLLPRI 2 +#define COGL_SYSDEF_POLLOUT 4 +#define COGL_SYSDEF_POLLERR 8 +#define COGL_SYSDEF_POLLHUP 16 +#define COGL_SYSDEF_POLLNVAL 32 + +#define COGL_VERSION_MAJOR_INTERNAL @COGL_MAJOR_VERSION@ +#define COGL_VERSION_MINOR_INTERNAL @COGL_MINOR_VERSION@ +#define COGL_VERSION_MICRO_INTERNAL @COGL_MICRO_VERSION@ +#define COGL_VERSION_STRING_INTERNAL "@COGL_VERSION@" + +G_END_DECLS + +#endif diff --git a/cogl/cogl-defines.h.win32_SDL b/cogl/cogl-defines.h.win32_SDL new file mode 100644 index 0000000..0217f11 --- /dev/null +++ b/cogl/cogl-defines.h.win32_SDL @@ -0,0 +1,78 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_GTYPE_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_SUPPORT 1 +#define COGL_HAS_SDL_SUPPORT 1 +#define COGL_HAS_COGL_PATH_SUPPORT 1 +#define COGL_HAS_GL 1 +#define CLUTTER_COGL_HAS_GL 1 + +#ifdef COGL_HAS_EGL_SUPPORT +#ifdef COGL_HAS_GLES1 +#include +#include +#else +#include +#endif +#endif + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#define COGL_SYSDEF_POLLIN 1 +#define COGL_SYSDEF_POLLPRI 2 +#define COGL_SYSDEF_POLLOUT 4 +#define COGL_SYSDEF_POLLERR 8 +#define COGL_SYSDEF_POLLHUP 16 +#define COGL_SYSDEF_POLLNVAL 32 + +#define COGL_VERSION_MAJOR_INTERNAL 2 +#define COGL_VERSION_MINOR_INTERNAL 0 +#define COGL_VERSION_MICRO_INTERNAL 0 +#define COGL_VERSION_STRING_INTERNAL "2.0.0" + +G_END_DECLS + +#endif diff --git a/cogl/cogl-defines.h.win32_SDL.in b/cogl/cogl-defines.h.win32_SDL.in new file mode 100644 index 0000000..acd246b --- /dev/null +++ b/cogl/cogl-defines.h.win32_SDL.in @@ -0,0 +1,78 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_GTYPE_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_SUPPORT 1 +#define COGL_HAS_SDL_SUPPORT 1 +#define COGL_HAS_COGL_PATH_SUPPORT 1 +#define COGL_HAS_GL 1 +#define CLUTTER_COGL_HAS_GL 1 + +#ifdef COGL_HAS_EGL_SUPPORT +#ifdef COGL_HAS_GLES1 +#include +#include +#else +#include +#endif +#endif + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#define COGL_SYSDEF_POLLIN 1 +#define COGL_SYSDEF_POLLPRI 2 +#define COGL_SYSDEF_POLLOUT 4 +#define COGL_SYSDEF_POLLERR 8 +#define COGL_SYSDEF_POLLHUP 16 +#define COGL_SYSDEF_POLLNVAL 32 + +#define COGL_VERSION_MAJOR_INTERNAL @COGL_MAJOR_VERSION@ +#define COGL_VERSION_MINOR_INTERNAL @COGL_MINOR_VERSION@ +#define COGL_VERSION_MICRO_INTERNAL @COGL_MICRO_VERSION@ +#define COGL_VERSION_STRING_INTERNAL "@COGL_VERSION@" + +G_END_DECLS + +#endif diff --git a/cogl/cogl-deprecated.h b/cogl/cogl-deprecated.h new file mode 100644 index 0000000..ca56fa1 --- /dev/null +++ b/cogl/cogl-deprecated.h @@ -0,0 +1,43 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef COGL_DEPRECATED_H + +#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color +#define cogl_enable_depth_test cogl_enable_depth_test_RENAMED_TO_cogl_set_depth_test_enabled +#define cogl_enable_backface_culling cogl_enable_backface_culling_RENAMED_TO_cogl_set_backface_culling_enabled + +#define cogl_texture_rectangle cogl_texture_rectangle_REPLACE_BY_cogl_set_source_texture_AND_cogl_rectangle_with_texture_coords + +#define cogl_texture_multiple_rectangles cogl_texture_multiple_rectangles_REPLACED_BY_cogl_set_source_texture_AND_cogl_rectangles_with_texture_coords + +#define cogl_texture_polygon cogl_texture_polygon_REPLACED_BY_cogl_set_source_texture_AND_cogl_polygon + +#endif diff --git a/cogl/cogl-depth-state-private.h b/cogl/cogl-depth-state-private.h new file mode 100644 index 0000000..6c14bb9 --- /dev/null +++ b/cogl/cogl-depth-state-private.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_DEPTH_STATE_PRIVATE_H +#define __COGL_DEPTH_STATE_PRIVATE_H + + +#define COGL_DEPTH_STATE_MAGIC 0xDEADBEEF + +#endif /* __COGL_DEPTH_STATE_PRIVATE_H */ diff --git a/cogl/cogl-depth-state.c b/cogl/cogl-depth-state.c new file mode 100644 index 0000000..5ea0aab --- /dev/null +++ b/cogl/cogl-depth-state.c @@ -0,0 +1,116 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-depth-state-private.h" +#include "cogl-depth-state.h" + +void +cogl_depth_state_init (CoglDepthState *state) +{ + state->magic = COGL_DEPTH_STATE_MAGIC; + + /* The same as the GL defaults */ + state->test_enabled = FALSE; + state->write_enabled = TRUE; + state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS; + state->range_near = 0; + state->range_far = 1; +} + +void +cogl_depth_state_set_test_enabled (CoglDepthState *state, + CoglBool enabled) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->test_enabled = enabled; +} + +CoglBool +cogl_depth_state_get_test_enabled (CoglDepthState *state) +{ + _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); + return state->test_enabled; +} + +void +cogl_depth_state_set_write_enabled (CoglDepthState *state, + CoglBool enabled) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->write_enabled = enabled; +} + +CoglBool +cogl_depth_state_get_write_enabled (CoglDepthState *state) +{ + _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); + return state->write_enabled; +} + +void +cogl_depth_state_set_test_function (CoglDepthState *state, + CoglDepthTestFunction function) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->test_function = function; +} + +CoglDepthTestFunction +cogl_depth_state_get_test_function (CoglDepthState *state) +{ + _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); + return state->test_function; +} + +void +cogl_depth_state_set_range (CoglDepthState *state, + float near, + float far) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->range_near = near; + state->range_far = far; +} + +void +cogl_depth_state_get_range (CoglDepthState *state, + float *near_out, + float *far_out) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + *near_out = state->range_near; + *far_out = state->range_far; +} diff --git a/cogl/cogl-depth-state.h b/cogl/cogl-depth-state.h new file mode 100644 index 0000000..581b961 --- /dev/null +++ b/cogl/cogl-depth-state.h @@ -0,0 +1,270 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEPTH_STATE_H__ +#define __COGL_DEPTH_STATE_H__ + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-depth-state + * @short_description: Functions for describing the depth testing + * state of your GPU. + */ + +/** + * CoglDepthState: + * + * Since: 2.0 + */ +typedef struct { + /*< private >*/ + uint32_t COGL_PRIVATE (magic); + + CoglBool COGL_PRIVATE (test_enabled); + CoglDepthTestFunction COGL_PRIVATE (test_function); + CoglBool COGL_PRIVATE (write_enabled); + float COGL_PRIVATE (range_near); + float COGL_PRIVATE (range_far); + + uint32_t COGL_PRIVATE (padding0); + uint32_t COGL_PRIVATE (padding1); + uint32_t COGL_PRIVATE (padding2); + uint32_t COGL_PRIVATE (padding3); + uint32_t COGL_PRIVATE (padding4); + uint32_t COGL_PRIVATE (padding5); + uint32_t COGL_PRIVATE (padding6); + uint32_t COGL_PRIVATE (padding7); + uint32_t COGL_PRIVATE (padding8); + uint32_t COGL_PRIVATE (padding9); +} CoglDepthState; + +/** + * cogl_depth_state_init: + * @state: A #CoglDepthState struct + * + * Initializes the members of @state to their default values. + * + * You should never pass an un initialized #CoglDepthState structure + * to cogl_pipeline_set_depth_state(). + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_init (CoglDepthState *state); + +/** + * cogl_depth_state_set_test_enabled: + * @state: A #CoglDepthState struct + * @enable: The enable state you want + * + * Enables or disables depth testing according to the value of + * @enable. + * + * If depth testing is enable then the #CoglDepthTestFunction set + * using cogl_depth_state_set_test_function() us used to evaluate + * the depth value of incoming fragments against the corresponding + * value stored in the current depth buffer, and if the test passes + * then the fragments depth value is used to update the depth buffer. + * (unless you have disabled depth writing via + * cogl_depth_state_set_write_enabled()) + * + * By default depth testing is disabled. + * + * NB: this won't directly affect the state of the GPU. You have + * to then set the state on a #CoglPipeline using + * cogl_pipeline_set_depth_state() + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_set_test_enabled (CoglDepthState *state, + CoglBool enable); + +/** + * cogl_depth_state_get_test_enabled: + * @state: A #CoglDepthState struct + * + * Gets the current depth test enabled state as previously set by + * cogl_depth_state_set_test_enabled(). + * + * Returns: The pipeline's current depth test enabled state. + * Since: 2.0 + * Stability: Unstable + */ +CoglBool +cogl_depth_state_get_test_enabled (CoglDepthState *state); + +/** + * cogl_depth_state_set_write_enabled: + * @state: A #CoglDepthState struct + * @enable: The enable state you want + * + * Enables or disables depth buffer writing according to the value of + * @enable. Normally when depth testing is enabled and the comparison + * between a fragment's depth value and the corresponding depth buffer + * value passes then the fragment's depth is written to the depth + * buffer unless writing is disabled here. + * + * By default depth writing is enabled + * + * NB: this won't directly affect the state of the GPU. You have + * to then set the state on a #CoglPipeline using + * cogl_pipeline_set_depth_state() + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_set_write_enabled (CoglDepthState *state, + CoglBool enable); + +/** + * cogl_depth_state_get_write_enabled: + * @state: A #CoglDepthState struct + * + * Gets the depth writing enable state as set by the corresponding + * cogl_depth_state_set_write_enabled(). + * + * Returns: The current depth writing enable state + * Since: 2.0 + * Stability: Unstable + */ +CoglBool +cogl_depth_state_get_write_enabled (CoglDepthState *state); + +/** + * cogl_depth_state_set_test_function: + * @state: A #CoglDepthState struct + * @function: The #CoglDepthTestFunction to set + * + * Sets the #CoglDepthTestFunction used to compare the depth value of + * an incoming fragment against the corresponding value in the current + * depth buffer. + * + * By default the depth test function is %COGL_DEPTH_TEST_FUNCTION_LESS + * + * NB: this won't directly affect the state of the GPU. You have + * to then set the state on a #CoglPipeline using + * cogl_pipeline_set_depth_state() + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_set_test_function (CoglDepthState *state, + CoglDepthTestFunction function); + +/** + * cogl_depth_state_get_test_function: + * @state: A #CoglDepthState struct + * + * Gets the current depth test enable state as previously set via + * cogl_depth_state_set_test_enabled(). + * + * Returns: The current depth test enable state. + * Since: 2.0 + * Stability: Unstable + */ +CoglDepthTestFunction +cogl_depth_state_get_test_function (CoglDepthState *state); + +/** + * cogl_depth_state_set_range: + * @state: A #CoglDepthState object + * @near_val: The near component of the desired depth range which will be + * clamped to the range [0, 1] + * @far_val: The far component of the desired depth range which will be + * clamped to the range [0, 1] + * + * Sets the range to map depth values in normalized device coordinates + * to before writing out to a depth buffer. + * + * After your geometry has be transformed, clipped and had perspective + * division applied placing it in normalized device + * coordinates all depth values between the near and far z clipping + * planes are in the range -1 to 1. Before writing any depth value to + * the depth buffer though the value is mapped into the range [0, 1]. + * + * With this function you can change the range which depth values are + * mapped too although the range must still lye within the range [0, + * 1]. + * + * If your driver does not support this feature (for example you are + * using GLES 1 drivers) then if you don't use the default range + * values you will get an error reported when calling + * cogl_pipeline_set_depth_state (). You can check ahead of time for + * the %COGL_FEATURE_ID_DEPTH_RANGE feature with + * cogl_has_feature() to know if this function will succeed. + * + * By default normalized device coordinate depth values are mapped to + * the full range of depth buffer values, [0, 1]. + * + * NB: this won't directly affect the state of the GPU. You have + * to then set the state on a #CoglPipeline using + * cogl_pipeline_set_depth_state(). + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_set_range (CoglDepthState *state, + float near_val, + float far_val); + +/** + * cogl_depth_state_get_range: + * @state: A #CoglDepthState object + * @near_val: A pointer to store the near component of the depth range + * @far_val: A pointer to store the far component of the depth range + * + * Gets the current range to which normalized depth values are mapped + * before writing to the depth buffer. This corresponds to the range + * set with cogl_depth_state_set_range(). + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_get_range (CoglDepthState *state, + float *near_val, + float *far_val); + +COGL_END_DECLS + +#endif /* __COGL_DEPTH_STATE_H__ */ diff --git a/cogl/cogl-display-private.h b/cogl/cogl-display-private.h new file mode 100644 index 0000000..db72984 --- /dev/null +++ b/cogl/cogl-display-private.h @@ -0,0 +1,58 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_DISPLAY_PRIVATE_H +#define __COGL_DISPLAY_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-display.h" +#include "cogl-renderer.h" +#include "cogl-onscreen-template.h" + +struct _CoglDisplay +{ + CoglObject _parent; + + CoglBool setup; + CoglRenderer *renderer; + CoglOnscreenTemplate *onscreen_template; + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT + struct wl_display *wayland_compositor_display; +#endif + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + gdl_plane_id_t gdl_plane; +#endif + + void *winsys; +}; + +#endif /* __COGL_DISPLAY_PRIVATE_H */ diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c new file mode 100644 index 0000000..ced922f --- /dev/null +++ b/cogl/cogl-display.c @@ -0,0 +1,182 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-object.h" + +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-winsys-private.h" +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +#include "cogl-wayland-server.h" +#endif +#include "cogl-gtype-private.h" + +static void _cogl_display_free (CoglDisplay *display); + +COGL_OBJECT_DEFINE (Display, display); +COGL_GTYPE_DEFINE_CLASS (Display, display); + +static const CoglWinsysVtable * +_cogl_display_get_winsys (CoglDisplay *display) +{ + return display->renderer->winsys_vtable; +} + +static void +_cogl_display_free (CoglDisplay *display) +{ + const CoglWinsysVtable *winsys; + + if (display->setup) + { + winsys = _cogl_display_get_winsys (display); + winsys->display_destroy (display); + display->setup = FALSE; + } + + if (display->renderer) + { + cogl_object_unref (display->renderer); + display->renderer = NULL; + } + + if (display->onscreen_template) + { + cogl_object_unref (display->onscreen_template); + display->onscreen_template = NULL; + } + + g_slice_free (CoglDisplay, display); +} + +CoglDisplay * +cogl_display_new (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template) +{ + CoglDisplay *display = g_slice_new0 (CoglDisplay); + CoglError *error = NULL; + + _cogl_init (); + + display->renderer = renderer; + if (renderer) + cogl_object_ref (renderer); + else + display->renderer = cogl_renderer_new (); + + if (!cogl_renderer_connect (display->renderer, &error)) + g_error ("Failed to connect to renderer: %s\n", error->message); + + display->setup = FALSE; + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + display->gdl_plane = GDL_PLANE_ID_UPP_C; +#endif + + display = _cogl_display_object_new (display); + + cogl_display_set_onscreen_template (display, onscreen_template); + + return display; +} + +CoglRenderer * +cogl_display_get_renderer (CoglDisplay *display) +{ + return display->renderer; +} + +void +cogl_display_set_onscreen_template (CoglDisplay *display, + CoglOnscreenTemplate *onscreen_template) +{ + _COGL_RETURN_IF_FAIL (display->setup == FALSE); + + if (onscreen_template) + cogl_object_ref (onscreen_template); + + if (display->onscreen_template) + cogl_object_unref (display->onscreen_template); + + display->onscreen_template = onscreen_template; + + /* NB: we want to maintain the invariable that there is always an + * onscreen template associated with a CoglDisplay... */ + if (!onscreen_template) + display->onscreen_template = cogl_onscreen_template_new (NULL); +} + +CoglBool +cogl_display_setup (CoglDisplay *display, + CoglError **error) +{ + const CoglWinsysVtable *winsys; + + if (display->setup) + return TRUE; + + winsys = _cogl_display_get_winsys (display); + if (!winsys->display_setup (display, error)) + return FALSE; + + display->setup = TRUE; + + return TRUE; +} + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +void +cogl_gdl_display_set_plane (CoglDisplay *display, + gdl_plane_id_t plane) +{ + _COGL_RETURN_IF_FAIL (display->setup == FALSE); + + display->gdl_plane = plane; +} +#endif + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +void +cogl_wayland_display_set_compositor_display (CoglDisplay *display, + struct wl_display *wayland_display) +{ + _COGL_RETURN_IF_FAIL (display->setup == FALSE); + + display->wayland_compositor_display = wayland_display; +} +#endif diff --git a/cogl/cogl-display.h b/cogl/cogl-display.h new file mode 100644 index 0000000..ae3f3c9 --- /dev/null +++ b/cogl/cogl-display.h @@ -0,0 +1,234 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DISPLAY_H__ +#define __COGL_DISPLAY_H__ + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +#include +#endif + +/** + * SECTION:cogl-display + * @short_description: Common aspects of a display pipeline + * + * The basic intention for this object is to let the application + * configure common display preferences before creating a context, and + * there are a few different aspects to this... + * + * Firstly there are options directly relating to the physical display + * pipeline that is currently being used including the digital to + * analogue conversion hardware and the screens the user sees. + * + * Another aspect is that display options may constrain or affect how + * onscreen framebuffers should later be configured. The original + * rationale for the display object in fact was to let us handle GLX + * and EGLs requirements that framebuffers must be "compatible" with + * the config associated with the current context meaning we have to + * force the user to describe how they would like to create their + * onscreen windows before we can choose a suitable fbconfig and + * create a GLContext. + */ + +typedef struct _CoglDisplay CoglDisplay; + +#define COGL_DISPLAY(OBJECT) ((CoglDisplay *)OBJECT) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_display_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_display_get_gtype (void); +#endif + +/** + * cogl_display_new: + * @renderer: A #CoglRenderer + * @onscreen_template: A #CoglOnscreenTemplate + * + * Explicitly allocates a new #CoglDisplay object to encapsulate the + * common state of the display pipeline that applies to the whole + * application. + * + * Many applications don't need to explicitly use + * cogl_display_new() and can just jump straight to cogl_context_new() + * and pass a %NULL display argument so Cogl will automatically + * connect and setup a renderer and display. + * + * A @display can only be made for a specific choice of renderer which + * is why this takes the @renderer argument. + * + * A common use for explicitly allocating a display object is to + * define a template for allocating onscreen framebuffers which is + * what the @onscreen_template argument is for, or alternatively + * you can use cogl_display_set_onscreen_template(). + * + * When a display is first allocated via cogl_display_new() it is in a + * mutable configuration mode. It's designed this way so we can + * extend the apis available for configuring a display without + * requiring huge numbers of constructor arguments. + * + * When you have finished configuring a display object you can + * optionally call cogl_display_setup() to explicitly apply the + * configuration and check for errors. Alternaitvely you can pass the + * display to cogl_context_new() and Cogl will implicitly apply your + * configuration but if there are errors then the application will + * abort with a message. For simple applications with no fallback + * options then relying on the implicit setup can be fine. + * + * Return value: (transfer full): A newly allocated #CoglDisplay + * object in a mutable configuration mode. + * Since: 1.10 + * Stability: unstable + */ +CoglDisplay * +cogl_display_new (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template); + +/** + * cogl_display_get_renderer: + * @display: a #CoglDisplay + * + * Queries the #CoglRenderer associated with the given @display. + * + * Return value: (transfer none): The associated #CoglRenderer + * + * Since: 1.10 + * Stability: unstable + */ +CoglRenderer * +cogl_display_get_renderer (CoglDisplay *display); + +/** + * cogl_display_set_onscreen_template: + * @display: a #CoglDisplay + * @onscreen_template: A template for creating #CoglOnscreen framebuffers + * + * Specifies a template for creating #CoglOnscreen framebuffers. + * + * Depending on the system, the constraints for creating #CoglOnscreen + * framebuffers need to be known before setting up a #CoglDisplay because the + * final setup of the display may constrain how onscreen framebuffers may be + * allocated. If Cogl knows how an application wants to allocate onscreen + * framebuffers then it can try to make sure to setup the display accordingly. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_display_set_onscreen_template (CoglDisplay *display, + CoglOnscreenTemplate *onscreen_template); + +/** + * cogl_display_setup: + * @display: a #CoglDisplay + * @error: return location for a #CoglError + * + * Explicitly sets up the given @display object. Use of this api is + * optional since Cogl will internally setup the display if not done + * explicitly. + * + * When a display is first allocated via cogl_display_new() it is in a + * mutable configuration mode. This allows us to extend the apis + * available for configuring a display without requiring huge numbers + * of constructor arguments. + * + * Its possible to request a configuration that might not be + * supportable on the current system and so this api provides a means + * to apply the configuration explicitly but if it fails then an + * exception will be returned so you can handle the error gracefully + * and perhaps fall back to an alternative configuration. + * + * If you instead rely on Cogl implicitly calling cogl_display_setup() + * for you then if there is an error with the configuration you won't + * get an opportunity to handle that and the application may abort + * with a message. For simple applications that don't have any + * fallback options this behaviour may be fine. + * + * Return value: Returns %TRUE if there was no error, else it returns + * %FALSE and returns an exception via @error. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_display_setup (CoglDisplay *display, + CoglError **error); + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +/** + * cogl_gdl_display_set_plane: + * @display: a #CoglDisplay + * @plane: the GDL plane id + * + * Request that Cogl output to a specific GDL overlay @plane. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_gdl_display_set_plane (CoglDisplay *display, + gdl_plane_id_t plane); +#endif + +/** + * cogl_is_display: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglDisplay. + * + * Return value: %TRUE if the object references a #CoglDisplay + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_display (void *object); + +COGL_END_DECLS + +#endif /* __COGL_DISPLAY_H__ */ + diff --git a/cogl/cogl-driver.h b/cogl/cogl-driver.h new file mode 100644 index 0000000..648228c --- /dev/null +++ b/cogl/cogl-driver.h @@ -0,0 +1,268 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_DRIVER_H +#define __COGL_DRIVER_H + +#include "cogl-context.h" +#include "cogl-offscreen.h" +#include "cogl-framebuffer-private.h" +#include "cogl-attribute-private.h" + +typedef struct _CoglDriverVtable CoglDriverVtable; + +struct _CoglDriverVtable +{ + /* TODO: factor this out since this is OpenGL specific and + * so can be ignored by non-OpenGL drivers. */ + CoglBool + (* pixel_format_from_gl_internal) (CoglContext *context, + GLenum gl_int_format, + CoglPixelFormat *out_format); + + /* TODO: factor this out since this is OpenGL specific and + * so can be ignored by non-OpenGL drivers. */ + CoglPixelFormat + (* pixel_format_to_gl) (CoglContext *context, + CoglPixelFormat format, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype); + + CoglBool + (* update_features) (CoglContext *context, + CoglError **error); + + CoglBool + (* offscreen_allocate) (CoglOffscreen *offscreen, + CoglError **error); + + void + (* offscreen_free) (CoglOffscreen *offscreen); + + void + (* framebuffer_flush_state) (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state); + + void + (* framebuffer_clear) (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha); + + void + (* framebuffer_query_bits) (CoglFramebuffer *framebuffer, + CoglFramebufferBits *bits); + + void + (* framebuffer_finish) (CoglFramebuffer *framebuffer); + + void + (* framebuffer_discard_buffers) (CoglFramebuffer *framebuffer, + unsigned long buffers); + + void + (* framebuffer_draw_attributes) (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + + void + (* framebuffer_draw_indexed_attributes) (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + + CoglBool + (* framebuffer_read_pixels_into_bitmap) (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error); + + /* Destroys any driver specific resources associated with the given + * 2D texture. */ + void + (* texture_2d_free) (CoglTexture2D *tex_2d); + + /* Returns TRUE if the driver can support creating a 2D texture with + * the given geometry and specified internal format. + */ + CoglBool + (* texture_2d_can_create) (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format); + + /* Initializes driver private state before allocating any specific + * storage for a 2D texture, where base texture and texture 2D + * members will already be initialized before passing control to + * the driver. + */ + void + (* texture_2d_init) (CoglTexture2D *tex_2d); + + /* Allocates (uninitialized) storage for the given texture according + * to the configured size and format of the texture */ + CoglBool + (* texture_2d_allocate) (CoglTexture *tex, + CoglError **error); + + /* Initialize the specified region of storage of the given texture + * with the contents of the specified framebuffer region + */ + void + (* texture_2d_copy_from_framebuffer) (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level); + + /* If the given texture has a corresponding OpenGL texture handle + * then return that. + * + * This is optional + */ + unsigned int + (* texture_2d_get_gl_handle) (CoglTexture2D *tex_2d); + + /* Update all mipmap levels > 0 */ + void + (* texture_2d_generate_mipmap) (CoglTexture2D *tex_2d); + + /* Initialize the specified region of storage of the given texture + * with the contents of the specified bitmap region + * + * Since this may need to create the underlying storage first + * it may throw a NO_MEMORY error. + */ + CoglBool + (* texture_2d_copy_from_bitmap) (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bitmap, + int dst_x, + int dst_y, + int level, + CoglError **error); + + /* Reads back the full contents of the given texture and write it to + * @data in the given @format and with the given @rowstride. + * + * This is optional + */ + void + (* texture_2d_get_data) (CoglTexture2D *tex_2d, + CoglPixelFormat format, + int rowstride, + uint8_t *data); + + /* Prepares for drawing by flushing the journal, framebuffer state, + * pipeline state and attribute state. + */ + void + (* flush_attributes_state) (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglFlushLayerState *layer_state, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes); + + /* Flushes the clip stack to the GPU using a combination of the + * stencil buffer, scissor and clip plane state. + */ + void + (* clip_stack_flush) (CoglClipStack *stack, CoglFramebuffer *framebuffer); + + /* Enables the driver to create some meta data to represent a buffer + * but with no corresponding storage allocated yet. + */ + void + (* buffer_create) (CoglBuffer *buffer); + + void + (* buffer_destroy) (CoglBuffer *buffer); + + /* Maps a buffer into the CPU */ + void * + (* buffer_map_range) (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + + /* Unmaps a buffer */ + void + (* buffer_unmap) (CoglBuffer *buffer); + + /* Uploads data to the buffer without needing to map it necessarily + */ + CoglBool + (* buffer_set_data) (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size, + CoglError **error); +}; + +#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ()) + +typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/ + COGL_DRIVER_ERROR_UNKNOWN_VERSION, + COGL_DRIVER_ERROR_INVALID_VERSION, + COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND, + COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY +} CoglDriverError; + +uint32_t +_cogl_driver_error_quark (void); + +#endif /* __COGL_DRIVER_H */ + diff --git a/cogl/cogl-egl-defines.h.in b/cogl/cogl-egl-defines.h.in new file mode 100644 index 0000000..648a62d --- /dev/null +++ b/cogl/cogl-egl-defines.h.in @@ -0,0 +1,40 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_EGL_DEFINES_H__ +#define __COGL_EGL_DEFINES_H__ + +#ifdef COGL_HAS_EGL_SUPPORT + +@COGL_EGL_INCLUDES@ + +#endif /* COGL_HAS_EGL_SUPPORT */ + +#endif diff --git a/cogl/cogl-egl-private.h b/cogl/cogl-egl-private.h new file mode 100644 index 0000000..c4b0dfe --- /dev/null +++ b/cogl/cogl-egl-private.h @@ -0,0 +1,40 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_EGL_PRIVATE_H__ +#define __COGL_EGL_PRIVATE_H__ + +#include "cogl-egl-defines.h" + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#endif /* __COGL_EGL_PRIVATE_H__ */ diff --git a/cogl/cogl-egl.h b/cogl/cogl-egl.h new file mode 100644 index 0000000..cea7b10 --- /dev/null +++ b/cogl/cogl-egl.h @@ -0,0 +1,118 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_EGL_H__ +#define __COGL_EGL_H__ + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_EGL_H_INSIDE__ */ +#ifndef __COGL_EGL_H_INSIDE__ +#define __COGL_EGL_H_INSIDE__ +#endif + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + + +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_egl_context_get_egl_display: + * @context: A #CoglContext pointer + * + * If you have done a runtime check to determine that Cogl is using + * EGL internally then this API can be used to retrieve the EGLDisplay + * handle that was setup internally. The result is undefined if Cogl + * is not using EGL. + * + * Note: The current window system backend can be checked using + * cogl_renderer_get_winsys_id(). + * + * Return value: The internally setup EGLDisplay handle. + * Since: 1.8 + * Stability: unstable + */ +EGLDisplay +cogl_egl_context_get_egl_display (CoglContext *context); + +/** + * cogl_egl_context_get_egl_context: + * @context: A #CoglContext pointer + * + * If you have done a runtime check to determine that Cogl is using + * EGL internally then this API can be used to retrieve the EGLContext + * handle that was setup internally. The result is undefined if Cogl + * is not using EGL. + * + * Note: The current window system backend can be checked using + * cogl_renderer_get_winsys_id(). + * + * Return value: The internally setup EGLDisplay handle. + * Since: 1.18 + * Stability: unstable + */ +EGLContext +cogl_egl_context_get_egl_context (CoglContext *context); + + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_EGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_EGL_H__ */ diff --git a/cogl/cogl-enum-types.c.in b/cogl/cogl-enum-types.c.in new file mode 100644 index 0000000..a08711b --- /dev/null +++ b/cogl/cogl-enum-types.c.in @@ -0,0 +1,50 @@ +/*** BEGIN file-header ***/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* We need to undefine this so that we will be sure to include + * cogl-path.h instead of cogl2-path.h when we include the framebuffer + * header. Otherwise it will include both headers and it won't + * compile. */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API + +#include "cogl-enum-types.h" +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +#include "@filename@" + +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_enum_type_id__volatile = 0; + + if (g_once_init_enter (&g_enum_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_enum_type_id; + + g_enum_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + + g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); + } + + return g_enum_type_id__volatile; +} +/*** END value-tail ***/ diff --git a/cogl/cogl-enum-types.h.in b/cogl/cogl-enum-types.h.in new file mode 100644 index 0000000..14bfccc --- /dev/null +++ b/cogl/cogl-enum-types.h.in @@ -0,0 +1,25 @@ +/*** BEGIN file-header ***/ +#ifndef __COGL_ENUM_TYPES_H__ +#define __COGL_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __COGL_ENUM_TYPES_H__ */ +/*** END file-tail ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define COGL_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) + +/*** END value-header ***/ diff --git a/cogl/cogl-error-private.h b/cogl/cogl-error-private.h new file mode 100644 index 0000000..d96779f --- /dev/null +++ b/cogl/cogl-error-private.h @@ -0,0 +1,59 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_ERROR_PRIVATE_H__ +#define __COGL_ERROR_PRIVATE_H__ + +#include "cogl-error.h" + +void +_cogl_set_error (CoglError **error, + uint32_t domain, + int code, + const char *format, + ...) G_GNUC_PRINTF (4, 5); + +void +_cogl_set_error_literal (CoglError **error, + uint32_t domain, + int code, + const char *message); + +void +_cogl_propagate_error (CoglError **dest, + CoglError *src); + +#ifdef COGL_HAS_GLIB_SUPPORT +void +_cogl_propagate_gerror (CoglError **dest, + GError *src); +#endif /* COGL_HAS_GLIB_SUPPORT */ + +#define _cogl_clear_error(X) g_clear_error ((GError **)X) + +#endif /* __COGL_ERROR_PRIVATE_H__ */ diff --git a/cogl/cogl-error.c b/cogl/cogl-error.c new file mode 100644 index 0000000..d83afc3 --- /dev/null +++ b/cogl/cogl-error.c @@ -0,0 +1,135 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-types.h" +#include "cogl-util.h" +#include "cogl-error-private.h" + +#include + +void +cogl_error_free (CoglError *error) +{ + g_error_free ((GError *)error); +} + +CoglError * +cogl_error_copy (CoglError *error) +{ + return (CoglError *)g_error_copy ((GError *)error); +} + +CoglBool +cogl_error_matches (CoglError *error, + uint32_t domain, + int code) +{ + return g_error_matches ((GError *)error, domain, code); +} + +#define ERROR_OVERWRITTEN_WARNING \ + "CoglError set over the top of a previous CoglError or " \ + "uninitialized memory.\nThis indicates a bug in someone's " \ + "code. You must ensure an error is NULL before it's set.\n" \ + "The overwriting error message was: %s" + +void +_cogl_set_error (CoglError **error, + uint32_t domain, + int code, + const char *format, + ...) +{ + GError *new; + + va_list args; + + va_start (args, format); + + if (error == NULL) + { + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); + va_end (args); + return; + } + + new = g_error_new_valist (domain, code, format, args); + va_end (args); + + if (*error == NULL) + *error = (CoglError *)new; + else + g_warning (ERROR_OVERWRITTEN_WARNING, new->message); +} + +void +_cogl_set_error_literal (CoglError **error, + uint32_t domain, + int code, + const char *message) +{ + _cogl_set_error (error, domain, code, "%s", message); +} + +void +_cogl_propagate_error (CoglError **dest, + CoglError *src) +{ + _COGL_RETURN_IF_FAIL (src != NULL); + + if (dest == NULL) + { + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message); + cogl_error_free (src); + } + else if (*dest) + g_warning (ERROR_OVERWRITTEN_WARNING, src->message); + else + *dest = src; +} + +/* This function is only used from the gdk-pixbuf image backend so it + * should only be called if we are using the system GLib. It would be + * difficult to get this to work without the system glib because we + * would need to somehow call the same g_error_free function that + * gdk-pixbuf is using */ +#ifdef COGL_HAS_GLIB_SUPPORT +void +_cogl_propagate_gerror (CoglError **dest, + GError *src) +{ + _cogl_propagate_error (dest, (CoglError *) src); +} +#endif /* COGL_HAS_GLIB_SUPPORT */ diff --git a/cogl/cogl-error.h b/cogl/cogl-error.h new file mode 100644 index 0000000..8682d0e --- /dev/null +++ b/cogl/cogl-error.h @@ -0,0 +1,185 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ERROR_H__ +#define __COGL_ERROR_H__ + +#include "cogl-types.h" + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-error + * @short_description: A way for Cogl to throw exceptions + * + * As a general rule Cogl shields non-recoverable errors from + * developers, such as most heap allocation failures (unless for + * exceptionally large resources which we might reasonably expect to + * fail) and this reduces the burden on developers. + * + * There are some Cogl apis though that can fail for exceptional + * reasons that can also potentially be recovered from at runtime + * and for these apis we use a standard convention for reporting + * runtime recoverable errors. + * + * As an example if we look at the cogl_context_new() api which + * takes an error argument: + * |[ + * CoglContext * + * cogl_context_new (CoglDisplay *display, CoglError **error); + * ]| + * + * A caller interested in catching any runtime error when creating a + * new #CoglContext would pass the address of a #CoglError pointer + * that has first been initialized to %NULL as follows: + * + * |[ + * CoglError *error = NULL; + * CoglContext *context; + * + * context = cogl_context_new (NULL, &error); + * ]| + * + * The return status should usually be enough to determine if there + * was an error set (in this example we can check if context == %NULL) + * but if it's not possible to tell from the function's return status + * you can instead look directly at the error pointer which you + * initialized to %NULL. In this example we now check the error, + * report any error to the user, free the error and then simply + * abort without attempting to recover. + * + * |[ + * if (context == NULL) + * { + * fprintf (stderr, "Failed to create a Cogl context: %s\n", + * error->message); + * cogl_error_free (error); + * abort (); + * } + * ]| + * + * All Cogl APIs that accept an error argument can also be passed a + * %NULL pointer. In this case if an exceptional error condition is hit + * then Cogl will simply log the error message and abort the + * application. This can be compared to language execeptions where the + * developer has not attempted to catch the exception. This means the + * above example is essentially redundant because it's what Cogl would + * have done automatically and so, similarly, if your application has + * no way to recover from a particular error you might just as well + * pass a %NULL #CoglError pointer to save a bit of typing. + * + * If you are used to using the GLib API you will probably + * recognize that #CoglError is just like a #GError. In fact if Cogl + * has been built with --enable-glib then it is safe to cast a + * #CoglError to a #GError. + * + * An important detail to be aware of if you are used to using + * GLib's GError API is that Cogl deviates from the GLib GError + * conventions in one noteable way which is that a %NULL error pointer + * does not mean you want to ignore the details of an error, it means + * you are not trying to catch any exceptional errors the function might + * throw which will result in the program aborting with a log message + * if an error is thrown. + */ + +#ifdef COGL_HAS_GLIB_SUPPORT +#define CoglError GError +#else +/** + * CoglError: + * @domain: A high-level domain identifier for the error + * @code: A specific error code within a specified domain + * @message: A human readable error message + */ +typedef struct _CoglError { + uint32_t domain; + int code; + char *message; +} CoglError; +#endif /* COGL_HAS_GLIB_SUPPORT */ + +/** + * cogl_error_free: + * @error: A #CoglError thrown by the Cogl api + * + * Frees a #CoglError and associated resources. + */ +void +cogl_error_free (CoglError *error); + +/** + * cogl_error_copy: + * @error: A #CoglError thrown by the Cogl api + * + * Makes a copy of @error which can later be freed using + * cogl_error_free(). + * + * Return value: A newly allocated #CoglError initialized to match the + * contents of @error. + */ +CoglError * +cogl_error_copy (CoglError *error); + +/** + * cogl_error_matches: + * @error: A #CoglError thrown by the Cogl api or %NULL + * @domain: The error domain + * @code: The error code + * + * Returns %TRUE if error matches @domain and @code, %FALSE otherwise. + * In particular, when error is %NULL, FALSE will be returned. + * + * Return value: whether the @error corresponds to the given @domain + * and @code. + */ +CoglBool +cogl_error_matches (CoglError *error, + uint32_t domain, + int code); + +/** + * COGL_GLIB_ERROR: + * @COGL_ERROR: A #CoglError thrown by the Cogl api or %NULL + * + * Simply casts a #CoglError to a #CoglError + * + * If Cogl is built with GLib support then it can safely be assumed + * that a CoglError is a GError and can be used directly with the + * GError api. + */ +#ifdef COGL_HAS_GLIB_SUPPORT +#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR) +#endif + +COGL_END_DECLS + +#endif /* __COGL_ERROR_H__ */ diff --git a/cogl/cogl-euler.c b/cogl/cogl-euler.c new file mode 100644 index 0000000..f877bbc --- /dev/null +++ b/cogl/cogl-euler.c @@ -0,0 +1,198 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "cogl-gtype-private.h" + +#include +#include + +COGL_GTYPE_DEFINE_BOXED (Euler, euler, + cogl_euler_copy, + cogl_euler_free); + +void +cogl_euler_init (CoglEuler *euler, + float heading, + float pitch, + float roll) +{ + euler->heading = heading; + euler->pitch = pitch; + euler->roll = roll; +} + +void +cogl_euler_init_from_matrix (CoglEuler *euler, + const CoglMatrix *matrix) +{ + /* + * Extracting a canonical Euler angle from a matrix: + * (where it is assumed the matrix contains no scaling, mirroring or + * skewing) + * + * A Euler angle is a combination of three rotations around mutually + * perpendicular axis. For this algorithm they are: + * + * Heading: A rotation about the Y axis by an angle H: + * | cosH 0 sinH| + * | 0 1 0| + * |-sinH 0 cosH| + * + * Pitch: A rotation around the X axis by an angle P: + * |1 0 0| + * |0 cosP -sinP| + * |0 sinP cosP| + * + * Roll: A rotation about the Z axis by an angle R: + * |cosR -sinR 0| + * |sinR cosR 0| + * | 0 0 1| + * + * When multiplied as matrices this gives: + * | cosHcosR+sinHsinPsinR sinRcosP -sinHcosR+cosHsinPsinR| + * M = |-cosHsinR+sinHsinPcosR cosRcosP sinRsinH+cosHsinPcosB| + * | sinHcosP -sinP cosHcosP | + * + * Given that there are an infinite number of ways to represent + * a given orientation, the "canonical" Euler angle is any such that: + * -180 < H < 180, + * -180 < R < 180 and + * -90 < P < 90 + * + * M[3][2] = -sinP lets us immediately solve for P = asin(-M[3][2]) + * (Note: asin has a range of +-90) + * This gives cosP + * This means we can use M[3][1] to calculate sinH: + * sinH = M[3][1]/cosP + * And use M[3][3] to calculate cosH: + * cosH = M[3][3]/cosP + * This lets us calculate H = atan2(sinH,cosH), but we optimise this: + * 1st note: atan2(x, y) does: atan(x/y) and uses the sign of x and y to + * determine the quadrant of the final angle. + * 2nd note: we know cosP is > 0 (ignoring cosP == 0) + * Therefore H = atan2((M[3][1]/cosP) / (M[3][3]/cosP)) can be simplified + * by skipping the division by cosP since it won't change the x/y ratio + * nor will it change their sign. This gives: + * H = atan2(M[3][1], M[3][3]) + * R is computed in the same way as H from M[1][2] and M[2][2] so: + * R = atan2(M[1][2], M[2][2]) + * Note: If cosP were == 0 then H and R could not be calculated as above + * because all the necessary matrix values would == 0. In other words we are + * pitched vertically and so H and R would now effectively rotate around the + * same axis - known as "Gimbal lock". In this situation we will set all the + * rotation on H and set R = 0. + * So with P = R = 0 we have cosP = 0, sinR = 0 and cosR = 1 + * We can substitute those into the above equation for M giving: + * | cosH 0 -sinH| + * |sinHsinP 0 cosHsinP| + * | 0 -sinP 0| + * And calculate H as atan2 (-M[3][2], M[1][1]) + */ + + float sinP; + float H; /* heading */ + float P; /* pitch */ + float R; /* roll */ + + /* NB: CoglMatrix provides struct members named according to the + * [row][column] indexed. So matrix->zx is row 3 column 1. */ + sinP = -matrix->zy; + + /* Determine the Pitch, avoiding domain errors with asin () which + * might occur due to previous imprecision in manipulating the + * matrix. */ + if (sinP <= -1.0f) + P = -G_PI_2; + else if (sinP >= 1.0f) + P = G_PI_2; + else + P = asinf (sinP); + + /* If P is too close to 0 then we have hit Gimbal lock */ + if (sinP > 0.999f) + { + H = atan2f (-matrix->zy, matrix->xx); + R = 0; + } + else + { + H = atan2f (matrix->zx, matrix->zz); + R = atan2f (matrix->xy, matrix->yy); + } + + euler->heading = H; + euler->pitch = P; + euler->roll = R; +} + +CoglBool +cogl_euler_equal (const void *v1, const void *v2) +{ + const CoglEuler *a = v1; + const CoglEuler *b = v2; + + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + if (v1 == v2) + return TRUE; + + return (a->heading == b->heading && + a->pitch == b->pitch && + a->roll == b->roll); +} + +CoglEuler * +cogl_euler_copy (const CoglEuler *src) +{ + if (G_LIKELY (src)) + { + CoglEuler *new = g_slice_new (CoglEuler); + memcpy (new, src, sizeof (float) * 3); + return new; + } + else + return NULL; +} + +void +cogl_euler_free (CoglEuler *euler) +{ + g_slice_free (CoglEuler, euler); +} + diff --git a/cogl/cogl-euler.h b/cogl/cogl-euler.h new file mode 100644 index 0000000..4ccbb2a --- /dev/null +++ b/cogl/cogl-euler.h @@ -0,0 +1,269 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_EULER_H +#define __COGL_EULER_H + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-euler + * @short_description: Functions for initializing and manipulating + * euler angles. + * + * Euler angles are a simple representation of a 3 dimensional + * rotation; comprised of 3 ordered heading, pitch and roll rotations. + * An important thing to understand is that the axis of rotation + * belong to the object being rotated and so they also rotate as each + * of the heading, pitch and roll rotations are applied. + * + * One way to consider euler angles is to imagine controlling an + * aeroplane, where you first choose a heading (Such as flying south + * east), then you set the pitch (such as 30 degrees to take off) and + * then you might set a roll, by dipping the left, wing as you prepare + * to turn. + * + * They have some advantages and limitations that it helps to be + * aware of: + * + * Advantages: + * + * + * Easy to understand and use, compared to quaternions and matrices, + * so may be a good choice for a user interface. + * + * + * Efficient storage, needing only 3 components any rotation can be + * represented. + * Actually the #CoglEuler type isn't optimized for size because + * we may cache the equivalent #CoglQuaternion along with a euler + * rotation, but it would be trivial for an application to track the + * components of euler rotations in a packed float array if optimizing + * for size was important. The values could be passed to Cogl only when + * manipulation is necessary. + * + * + * + * Disadvantages: + * + * + * Aliasing: it's possible to represent some rotations with multiple + * different heading, pitch and roll rotations. + * + * + * They can suffer from a problem called Gimbal Lock. A good + * explanation of this can be seen on wikipedia here: + * http://en.wikipedia.org/wiki/Gimbal_lock but basically two + * of the axis of rotation may become aligned and so you loose a + * degree of freedom. For example a pitch of +-90° would mean that + * heading and bank rotate around the same axis. + * + * + * If you use euler angles to orient something in 3D space and try to + * transition between orientations by interpolating the component + * angles you probably wont get the transitions you expect as they may + * not follow the shortest path between the two orientations. + * + * + * There's no standard to what order the component axis rotations are + * applied. The most common convention seems to be what we do in Cogl + * with heading (y-axis), pitch (x-axis) and then roll (z-axis), but + * other software might apply x-axis, y-axis then z-axis or any other + * order so you need to consider this if you are accepting euler + * rotations from some other software. Other software may also use + * slightly different aeronautical terms, such as "yaw" instead of + * "heading" or "bank" instead of "roll". + * + * + * + * To minimize the aliasing issue we may refer to "Canonical Euler" + * angles where heading and roll are restricted to +- 180° and pitch is + * restricted to +- 90°. If pitch is +- 90° bank is set to 0°. + * + * Quaternions don't suffer from Gimbal Lock and they can be nicely + * interpolated between, their disadvantage is that they don't have an + * intuitive representation. + * + * A common practice is to accept angles in the intuitive Euler form + * and convert them to quaternions internally to avoid Gimbal Lock and + * handle interpolations. See cogl_quaternion_init_from_euler(). + */ + +/** + * CoglEuler: + * @heading: Angle to rotate around an object's y axis + * @pitch: Angle to rotate around an object's x axis + * @roll: Angle to rotate around an object's z axis + * + * Represents an ordered rotation first of @heading degrees around an + * object's y axis, then @pitch degrees around an object's x axis and + * finally @roll degrees around an object's z axis. + * + * It's important to understand the that axis are associated + * with the object being rotated, so the axis also rotate in sequence + * with the rotations being applied. + * + * The members of a #CoglEuler can be initialized, for example, with + * cogl_euler_init() and cogl_euler_init_from_quaternion (). + * + * You may also want to look at cogl_quaternion_init_from_euler() if + * you want to do interpolation between 3d rotations. + * + * Since: 2.0 + */ +struct _CoglEuler +{ + /*< public > */ + float heading; + float pitch; + float roll; + + /*< private > */ + /* May cached a quaternion here in the future */ + float padding0; + float padding1; + float padding2; + float padding3; + float padding4; +}; +COGL_STRUCT_SIZE_ASSERT (CoglEuler, 32); + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_euler_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_euler_get_gtype (void); +#endif + +/** + * cogl_euler_init: + * @euler: The #CoglEuler angle to initialize + * @heading: Angle to rotate around an object's y axis + * @pitch: Angle to rotate around an object's x axis + * @roll: Angle to rotate around an object's z axis + * + * Initializes @euler to represent a rotation of @x_angle degrees + * around the x axis, then @y_angle degrees around the y_axis and + * @z_angle degrees around the z axis. + * + * Since: 2.0 + */ +void +cogl_euler_init (CoglEuler *euler, + float heading, + float pitch, + float roll); + +/** + * cogl_euler_init_from_matrix: + * @euler: The #CoglEuler angle to initialize + * @matrix: A #CoglMatrix containing a rotation, but no scaling, + * mirroring or skewing. + * + * Extracts a euler rotation from the given @matrix and + * initializses @euler with the component x, y and z rotation angles. + */ +void +cogl_euler_init_from_matrix (CoglEuler *euler, + const CoglMatrix *matrix); + +/** + * cogl_euler_init_from_quaternion: + * @euler: The #CoglEuler angle to initialize + * @quaternion: A #CoglEuler with the rotation to initialize with + * + * Initializes a @euler rotation with the equivalent rotation + * represented by the given @quaternion. + */ +void +cogl_euler_init_from_quaternion (CoglEuler *euler, + const CoglQuaternion *quaternion); + +/** + * cogl_euler_equal: + * @v1: The first euler angle to compare + * @v2: The second euler angle to compare + * + * Compares the two given euler angles @v1 and @v1 and it they are + * equal returns %TRUE else %FALSE. + * + * This function only checks that all three components rotations + * are numerically equal, it does not consider that some rotations + * can be represented with different component rotations + * + * Returns: %TRUE if @v1 and @v2 are equal else %FALSE. + * Since: 2.0 + */ +CoglBool +cogl_euler_equal (const void *v1, const void *v2); + +/** + * cogl_euler_copy: + * @src: A #CoglEuler to copy + * + * Allocates a new #CoglEuler and initilizes it with the component + * angles of @src. The newly allocated euler should be freed using + * cogl_euler_free(). + * + * Returns: A newly allocated #CoglEuler + * Since: 2.0 + */ +CoglEuler * +cogl_euler_copy (const CoglEuler *src); + +/** + * cogl_euler_free: + * @euler: A #CoglEuler allocated via cogl_euler_copy() + * + * Frees a #CoglEuler that was previously allocated using + * cogl_euler_copy(). + * + * Since: 2.0 + */ +void +cogl_euler_free (CoglEuler *euler); + +COGL_END_DECLS + +#endif /* __COGL_EULER_H */ + diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c new file mode 100644 index 0000000..7c160c3 --- /dev/null +++ b/cogl/cogl-feature-private.c @@ -0,0 +1,234 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" + +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" +#include "cogl-private.h" + +CoglBool +_cogl_feature_check (CoglRenderer *renderer, + const char *driver_prefix, + const CoglFeatureData *data, + int gl_major, + int gl_minor, + CoglDriver driver, + char * const *extensions, + void *function_table) + +{ + const char *suffix = NULL; + int func_num; + CoglExtGlesAvailability gles_availability = 0; + CoglBool in_core; + + switch (driver) + { + case COGL_DRIVER_GLES1: + gles_availability = COGL_EXT_IN_GLES; + break; + case COGL_DRIVER_GLES2: + gles_availability = COGL_EXT_IN_GLES2; + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0)) + gles_availability |= COGL_EXT_IN_GLES3; + break; + case COGL_DRIVER_ANY: + g_assert_not_reached (); + case COGL_DRIVER_WEBGL: + /* FIXME: WebGL should probably have its own COGL_EXT_IN_WEBGL flag */ + break; + case COGL_DRIVER_NOP: + case COGL_DRIVER_GL: + case COGL_DRIVER_GL3: + break; + } + + /* First check whether the functions should be directly provided by + GL */ + if (((driver == COGL_DRIVER_GL || + driver == COGL_DRIVER_GL3) && + COGL_CHECK_GL_VERSION (gl_major, gl_minor, + data->min_gl_major, data->min_gl_minor)) || + (data->gles_availability & gles_availability)) + { + suffix = ""; + in_core = TRUE; + } + else + { + /* Otherwise try all of the extensions */ + const char *namespace, *namespace_suffix; + unsigned int namespace_len; + + for (namespace = data->namespaces; + *namespace; + namespace += strlen (namespace) + 1) + { + const char *extension; + GString *full_extension_name = g_string_new (""); + + /* If the namespace part contains a ':' then the suffix for + the function names is different from the name space */ + if ((namespace_suffix = strchr (namespace, ':'))) + { + namespace_len = namespace_suffix - namespace; + namespace_suffix++; + } + else + { + namespace_len = strlen (namespace); + namespace_suffix = namespace; + } + + for (extension = data->extension_names; + *extension; + extension += strlen (extension) + 1) + { + g_string_assign (full_extension_name, driver_prefix); + g_string_append_c (full_extension_name, '_'); + g_string_append_len (full_extension_name, + namespace, namespace_len); + g_string_append_c (full_extension_name, '_'); + g_string_append (full_extension_name, extension); + if (_cogl_check_extension (full_extension_name->str, + extensions)) + break; + } + + g_string_free (full_extension_name, TRUE); + + /* If we found an extension with this namespace then use it + as the suffix */ + if (*extension) + { + suffix = namespace_suffix; + break; + } + } + + in_core = FALSE; + } + + /* If we couldn't find anything that provides the functions then + give up */ + if (suffix == NULL) + goto error; + + /* Try to get all of the entry points */ + for (func_num = 0; data->functions[func_num].name; func_num++) + { + void *func; + char *full_function_name; + + full_function_name = g_strconcat (data->functions[func_num].name, + suffix, NULL); + func = _cogl_renderer_get_proc_address (renderer, + full_function_name, + in_core); + g_free (full_function_name); + + if (func == NULL) + goto error; + + /* Set the function pointer in the context */ + *(void **) ((uint8_t *) function_table + + data->functions[func_num].pointer_offset) = func; + } + + return TRUE; + + /* If the extension isn't found or one of the functions wasn't found + * then set all of the functions pointers to NULL so Cogl can safely + * do feature testing by just looking at the function pointers */ +error: + for (func_num = 0; data->functions[func_num].name; func_num++) + *(void **) ((uint8_t *) function_table + + data->functions[func_num].pointer_offset) = NULL; + + return FALSE; +} + +/* Define a set of arrays containing the functions required from GL + for each feature */ +#define COGL_EXT_BEGIN(name, \ + min_gl_major, min_gl_minor, \ + gles_availability, \ + namespaces, extension_names) \ + static const CoglFeatureFunction cogl_ext_ ## name ## _funcs[] = { +#define COGL_EXT_FUNCTION(ret, name, args) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglContext, name) }, +#define COGL_EXT_END() \ + { NULL, 0 }, \ + }; +#include "gl-prototypes/cogl-all-functions.h" + +/* Define an array of features */ +#undef COGL_EXT_BEGIN +#define COGL_EXT_BEGIN(name, \ + min_gl_major, min_gl_minor, \ + gles_availability, \ + namespaces, extension_names) \ + { min_gl_major, min_gl_minor, gles_availability, namespaces, \ + extension_names, 0, 0, 0, \ + cogl_ext_ ## name ## _funcs }, +#undef COGL_EXT_FUNCTION +#define COGL_EXT_FUNCTION(ret, name, args) +#undef COGL_EXT_END +#define COGL_EXT_END() + +static const CoglFeatureData +cogl_feature_ext_functions_data[] = + { +#include "gl-prototypes/cogl-all-functions.h" + }; + +void +_cogl_feature_check_ext_functions (CoglContext *context, + int gl_major, + int gl_minor, + char * const *gl_extensions) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (cogl_feature_ext_functions_data); i++) + _cogl_feature_check (context->display->renderer, + "GL", cogl_feature_ext_functions_data + i, + gl_major, gl_minor, context->driver, + gl_extensions, + context); +} diff --git a/cogl/cogl-feature-private.h b/cogl/cogl-feature-private.h new file mode 100644 index 0000000..a342d23 --- /dev/null +++ b/cogl/cogl-feature-private.h @@ -0,0 +1,106 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_FEATURE_PRIVATE_H +#define __COGL_FEATURE_PRIVATE_H + +#include + + +#define COGL_CHECK_GL_VERSION(driver_major, driver_minor, \ + target_major, target_minor) \ + ((driver_major) > (target_major) || \ + ((driver_major) == (target_major) && (driver_minor) >= (target_minor))) + +typedef enum +{ + COGL_EXT_IN_GLES = (1 << 0), + COGL_EXT_IN_GLES2 = (1 << 1), + COGL_EXT_IN_GLES3 = (1 << 2) +} CoglExtGlesAvailability; + +typedef struct _CoglFeatureFunction CoglFeatureFunction; + +struct _CoglFeatureFunction +{ + /* The name of the function without the "EXT" or "ARB" suffix */ + const char *name; + /* The offset in the context of where to store the function pointer */ + unsigned int pointer_offset; +}; + +typedef struct _CoglFeatureData CoglFeatureData; + +struct _CoglFeatureData +{ + /* A minimum GL version which the functions should be defined in + without needing an extension. Set to 255,255 if it's only + provided in an extension */ + int min_gl_major, min_gl_minor; + /* Flags specifying which versions of GLES the feature is available + in core in */ + CoglExtGlesAvailability gles_availability; + /* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */ + const char *namespaces; + /* \0 separated list of required extension names without the GL_EXT + or GL_ARB prefix. Any of the extensions must be available for the + feature to be considered available. If the suffix for an + extension is different from the namespace, you can specify it + with a ':' after the namespace */ + const char *extension_names; + /* A set of feature flags to enable if the extension is available */ + CoglFeatureFlags feature_flags; + /* A set of private feature flags to enable if the extension is + * available */ + int feature_flags_private; + /* An optional corresponding winsys feature. */ + CoglWinsysFeature winsys_feature; + /* A list of functions required for this feature. Terminated with a + NULL name */ + const CoglFeatureFunction *functions; +}; + +CoglBool +_cogl_feature_check (CoglRenderer *renderer, + const char *driver_prefix, + const CoglFeatureData *data, + int gl_major, + int gl_minor, + CoglDriver driver, + char * const *extensions, + void *function_table); + +void +_cogl_feature_check_ext_functions (CoglContext *context, + int gl_major, + int gl_minor, + char * const *gl_extensions); + +#endif /* __COGL_FEATURE_PRIVATE_H */ diff --git a/cogl/cogl-fence-private.h b/cogl/cogl-fence-private.h new file mode 100644 index 0000000..abbf51f --- /dev/null +++ b/cogl/cogl-fence-private.h @@ -0,0 +1,66 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Collabora Ltd. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_FENCE_PRIVATE_H__ +#define __COGL_FENCE_PRIVATE_H__ + +#include "cogl-fence.h" +#include "cogl-list.h" +#include "cogl-winsys-private.h" + +typedef enum +{ + FENCE_TYPE_PENDING, +#ifdef GL_ARB_sync + FENCE_TYPE_GL_ARB, +#endif + FENCE_TYPE_WINSYS, + FENCE_TYPE_ERROR +} CoglFenceType; + +struct _CoglFenceClosure +{ + CoglList link; + CoglFramebuffer *framebuffer; + + CoglFenceType type; + void *fence_obj; + + CoglFenceCallback callback; + void *user_data; +}; + +void +_cogl_fence_submit (CoglFenceClosure *fence); + +void +_cogl_fence_cancel_fences_for_framebuffer (CoglFramebuffer *framebuffer); + +#endif /* __COGL_FENCE_PRIVATE_H__ */ diff --git a/cogl/cogl-fence.c b/cogl/cogl-fence.c new file mode 100644 index 0000000..05c91ff --- /dev/null +++ b/cogl/cogl-fence.c @@ -0,0 +1,236 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Collabora Ltd. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-fence.h" +#include "cogl-fence-private.h" +#include "cogl-context-private.h" +#include "cogl-winsys-private.h" + +#define FENCE_CHECK_TIMEOUT 5000 /* microseconds */ + +void * +cogl_fence_closure_get_user_data (CoglFenceClosure *closure) +{ + return closure->user_data; +} + +static void +_cogl_fence_check (CoglFenceClosure *fence) +{ + CoglContext *context = fence->framebuffer->context; + + if (fence->type == FENCE_TYPE_WINSYS) + { + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + CoglBool ret; + + ret = winsys->fence_is_complete (context, fence->fence_obj); + if (!ret) + return; + } +#ifdef GL_ARB_sync + else if (fence->type == FENCE_TYPE_GL_ARB) + { + GLenum arb; + + arb = context->glClientWaitSync (fence->fence_obj, + GL_SYNC_FLUSH_COMMANDS_BIT, + 0); + if (arb != GL_ALREADY_SIGNALED && arb != GL_CONDITION_SATISFIED) + return; + } +#endif + + fence->callback (NULL, /* dummy CoglFence object */ + fence->user_data); + cogl_framebuffer_cancel_fence_callback (fence->framebuffer, fence); +} + +static void +_cogl_fence_poll_dispatch (void *source, int revents) +{ + CoglContext *context = source; + CoglFenceClosure *fence, *tmp; + + _cogl_list_for_each_safe (fence, tmp, &context->fences, link) + _cogl_fence_check (fence); +} + +static int64_t +_cogl_fence_poll_prepare (void *source) +{ + CoglContext *context = source; + GList *l; + + /* If there are any pending fences in any of the journals then we + * need to flush the journal otherwise the fence will never be + * hit and the main loop might block forever */ + for (l = context->framebuffers; l; l = l->next) + { + CoglFramebuffer *fb = l->data; + + if (!_cogl_list_empty (&fb->journal->pending_fences)) + _cogl_framebuffer_flush_journal (fb); + } + + if (!_cogl_list_empty (&context->fences)) + return FENCE_CHECK_TIMEOUT; + else + return -1; +} + +void +_cogl_fence_submit (CoglFenceClosure *fence) +{ + CoglContext *context = fence->framebuffer->context; + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + + fence->type = FENCE_TYPE_ERROR; + + if (winsys->fence_add) + { + fence->fence_obj = winsys->fence_add (context); + if (fence->fence_obj) + { + fence->type = FENCE_TYPE_WINSYS; + goto done; + } + } + +#ifdef GL_ARB_sync + if (context->glFenceSync) + { + fence->fence_obj = context->glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, + 0); + if (fence->fence_obj) + { + fence->type = FENCE_TYPE_GL_ARB; + goto done; + } + } +#endif + + done: + _cogl_list_insert (context->fences.prev, &fence->link); + + if (!context->fences_poll_source) + { + context->fences_poll_source = + _cogl_poll_renderer_add_source (context->display->renderer, + _cogl_fence_poll_prepare, + _cogl_fence_poll_dispatch, + context); + } +} + +CoglFenceClosure * +cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer, + CoglFenceCallback callback, + void *user_data) +{ + CoglContext *context = framebuffer->context; + CoglJournal *journal = framebuffer->journal; + CoglFenceClosure *fence; + + if (!COGL_FLAGS_GET (context->features, COGL_FEATURE_ID_FENCE)) + return NULL; + + fence = g_slice_new (CoglFenceClosure); + fence->framebuffer = framebuffer; + fence->callback = callback; + fence->user_data = user_data; + fence->fence_obj = NULL; + + if (journal->entries->len) + { + _cogl_list_insert (journal->pending_fences.prev, &fence->link); + fence->type = FENCE_TYPE_PENDING; + } + else + _cogl_fence_submit (fence); + + return fence; +} + +void +cogl_framebuffer_cancel_fence_callback (CoglFramebuffer *framebuffer, + CoglFenceClosure *fence) +{ + CoglContext *context = framebuffer->context; + + if (fence->type == FENCE_TYPE_PENDING) + { + _cogl_list_remove (&fence->link); + } + else + { + _cogl_list_remove (&fence->link); + + if (fence->type == FENCE_TYPE_WINSYS) + { + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + + winsys->fence_destroy (context, fence->fence_obj); + } +#ifdef GL_ARB_sync + else if (fence->type == FENCE_TYPE_GL_ARB) + { + context->glDeleteSync (fence->fence_obj); + } +#endif + } + + g_slice_free (CoglFenceClosure, fence); +} + +void +_cogl_fence_cancel_fences_for_framebuffer (CoglFramebuffer *framebuffer) +{ + CoglJournal *journal = framebuffer->journal; + CoglContext *context = framebuffer->context; + CoglFenceClosure *fence, *tmp; + + while (!_cogl_list_empty (&journal->pending_fences)) + { + fence = _cogl_container_of (journal->pending_fences.next, + CoglFenceClosure, + link); + cogl_framebuffer_cancel_fence_callback (framebuffer, fence); + } + + _cogl_list_for_each_safe (fence, tmp, &context->fences, link) + { + if (fence->framebuffer == framebuffer) + cogl_framebuffer_cancel_fence_callback (framebuffer, fence); + } +} diff --git a/cogl/cogl-fence.h b/cogl/cogl-fence.h new file mode 100644 index 0000000..e268f8f --- /dev/null +++ b/cogl/cogl-fence.h @@ -0,0 +1,143 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Collabora Ltd. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_FENCE_H__ +#define __COGL_FENCE_H__ + +#include +#include + +/** + * SECTION:cogl-fence + * @short_description: Functions for notification of command completion + * + * Cogl allows notification of GPU command completion; users may mark + * points in the GPU command stream and receive notification when the GPU + * has executed to that point. + */ + +/** + * CoglFence: + * + * An opaque object representing a fence. This type is currently + * unused but in the future may be used to pass extra information + * about the fence completion. + * + * Since: 2.0 + * Stability: Unstable + */ +typedef struct _CoglFence CoglFence; + +/** + * CoglFenceCallback: + * @fence: Unused. In the future this parameter may be used to pass + * extra information about the fence completion but for now it + * should be ignored. + * @user_data: The private data passed to cogl_framebuffer_add_fence_callback() + * + * The callback prototype used with + * cogl_framebuffer_add_fence_callback() for notification of GPU + * command completion. + * + * Since: 2.0 + * Stability: Unstable + */ +typedef void (* CoglFenceCallback) (CoglFence *fence, + void *user_data); + +/** + * CoglFenceClosure: + * + * An opaque type representing one future callback to be made when the + * GPU command stream has passed a certain point. + * + * Since: 2.0 + * Stability: Unstable + */ +typedef struct _CoglFenceClosure CoglFenceClosure; + +/** + * cogl_frame_closure_get_user_data: + * @closure: A #CoglFenceClosure returned from cogl_framebuffer_add_fence() + * + * Returns the user_data submitted to cogl_framebuffer_add_fence() which + * returned a given #CoglFenceClosure. + * + * Since: 2.0 + * Stability: Unstable + */ +void * +cogl_fence_closure_get_user_data (CoglFenceClosure *closure); + +/** + * cogl_framebuffer_add_fence_callback: + * @framebuffer: The #CoglFramebuffer the commands have been submitted to + * @callback: (scope notified): A #CoglFenceCallback to be called when + * all commands submitted to Cogl have been executed + * @user_data: (closure): Private data that will be passed to the callback + * + * Calls the provided callback when all previously-submitted commands have + * been executed by the GPU. + * + * Returns non-NULL if the fence succeeded, or %NULL if it was unable to + * be inserted and the callback will never be called. The user does not + * need to free the closure; it will be freed automatically when the + * callback is called, or cancelled. + * + * Since: 2.0 + * Stability: Unstable + */ +CoglFenceClosure * +cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer, + CoglFenceCallback callback, + void *user_data); + +/** + * cogl_framebuffer_cancel_fence_callback: + * @framebuffer: The #CoglFramebuffer the commands were submitted to + * @closure: The #CoglFenceClosure returned from + * cogl_framebuffer_add_fence_callback() + * + * Removes a fence previously submitted with + * cogl_framebuffer_add_fence_callback(); the callback will not be + * called. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_framebuffer_cancel_fence_callback (CoglFramebuffer *framebuffer, + CoglFenceClosure *closure); + +#endif /* __COGL_FENCE_H__ */ diff --git a/cogl/cogl-flags.h b/cogl/cogl-flags.h new file mode 100644 index 0000000..33633f0 --- /dev/null +++ b/cogl/cogl-flags.h @@ -0,0 +1,130 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_FLAGS_H +#define __COGL_FLAGS_H + +#include + +#include "cogl-util.h" + +COGL_BEGIN_DECLS + +/* These are macros used to implement a fixed-size array of bits. This + should be used instead of CoglBitmask when the maximum bit number + that will be set is known at compile time, for example when setting + for recording a set of known available features */ + +/* The bits are stored in an array of unsigned longs. To use these + macros, you would typically have an enum defining the available + bits with an extra last enum to define the maximum value. Then to + store the flags you would declare an array of unsigned longs sized + using COGL_FLAGS_N_LONGS_FOR_SIZE, eg: + + typedef enum { FEATURE_A, FEATURE_B, FEATURE_C, N_FEATURES } Features; + + unsigned long feature_flags[COGL_FLAGS_N_LONGS_FOR_SIZE (N_FEATURES)]; +*/ + +#define COGL_FLAGS_N_LONGS_FOR_SIZE(size) \ + (((size) + \ + (sizeof (unsigned long) * 8 - 1)) \ + / (sizeof (unsigned long) * 8)) + +/* @flag is expected to be constant so these should result in a + constant expression. This means that setting a flag is equivalent + to just setting in a bit in a global variable at a known + location */ +#define COGL_FLAGS_GET_INDEX(flag) \ + ((flag) / (sizeof (unsigned long) * 8)) +#define COGL_FLAGS_GET_MASK(flag) \ + (1UL << ((unsigned long) (flag) & \ + (sizeof (unsigned long) * 8 - 1))) + +#define COGL_FLAGS_GET(array, flag) \ + (!!((array)[COGL_FLAGS_GET_INDEX (flag)] & \ + COGL_FLAGS_GET_MASK (flag))) + +/* The expectation here is that @value will be constant so the if + statement will be optimised out */ +#define COGL_FLAGS_SET(array, flag, value) \ + G_STMT_START { \ + if (value) \ + ((array)[COGL_FLAGS_GET_INDEX (flag)] |= \ + COGL_FLAGS_GET_MASK (flag)); \ + else \ + ((array)[COGL_FLAGS_GET_INDEX (flag)] &= \ + ~COGL_FLAGS_GET_MASK (flag)); \ + } G_STMT_END + +/* Macros to help iterate an array of flags. It should be used like + * this: + * + * int n_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (...); + * unsigned long flags[n_longs]; + * int bit_num; + * + * COGL_FLAGS_FOREACH_START (flags, n_longs, bit_num) + * { + * do_something_with_the_bit (bit_num); + * } + * COGL_FLAGS_FOREACH_END; + */ +#define COGL_FLAGS_FOREACH_START(array, n_longs, bit) \ + G_STMT_START { \ + const unsigned long *_p = (array); \ + int _n_longs = (n_longs); \ + int _i; \ + \ + for (_i = 0; _i < _n_longs; _i++) \ + { \ + unsigned long _mask = *(_p++); \ + \ + (bit) = _i * sizeof (unsigned long) * 8 - 1; \ + \ + while (_mask) \ + { \ + int _next_bit = _cogl_util_ffsl (_mask); \ + (bit) += _next_bit; \ + /* This odd two-part shift is to avoid */ \ + /* shifting by sizeof (long)*8 which has */ \ + /* undefined results according to the */ \ + /* C spec (and seems to be a no-op in */ \ + /* practice) */ \ + _mask = (_mask >> (_next_bit - 1)) >> 1; \ + +#define COGL_FLAGS_FOREACH_END \ + } } } G_STMT_END + +COGL_END_DECLS + +#endif /* __COGL_FLAGS_H */ + diff --git a/cogl/cogl-frame-info-private.h b/cogl/cogl-frame-info-private.h new file mode 100644 index 0000000..32f5ba8 --- /dev/null +++ b/cogl/cogl-frame-info-private.h @@ -0,0 +1,50 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_FRAME_INFO_PRIVATE_H +#define __COGL_FRAME_INFO_PRIVATE_H + +#include "cogl-frame-info.h" +#include "cogl-object-private.h" + +struct _CoglFrameInfo +{ + CoglObject _parent; + + int64_t frame_counter; + int64_t presentation_time; + float refresh_rate; + + CoglOutput *output; +}; + +CoglFrameInfo *_cogl_frame_info_new (void); + +#endif /* __COGL_FRAME_INFO_PRIVATE_H */ diff --git a/cogl/cogl-frame-info.c b/cogl/cogl-frame-info.c new file mode 100644 index 0000000..2114a64 --- /dev/null +++ b/cogl/cogl-frame-info.c @@ -0,0 +1,81 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-frame-info-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_frame_info_free (CoglFrameInfo *info); + +COGL_OBJECT_DEFINE (FrameInfo, frame_info); +COGL_GTYPE_DEFINE_CLASS (FrameInfo, frame_info); + +CoglFrameInfo * +_cogl_frame_info_new (void) +{ + CoglFrameInfo *info; + + info = g_slice_new0 (CoglFrameInfo); + + return _cogl_frame_info_object_new (info); +} + +static void +_cogl_frame_info_free (CoglFrameInfo *info) +{ + g_slice_free (CoglFrameInfo, info); +} + +int64_t +cogl_frame_info_get_frame_counter (CoglFrameInfo *info) +{ + return info->frame_counter; +} + +int64_t +cogl_frame_info_get_presentation_time (CoglFrameInfo *info) +{ + return info->presentation_time; +} + +float +cogl_frame_info_get_refresh_rate (CoglFrameInfo *info) +{ + return info->refresh_rate; +} + +CoglOutput * +cogl_frame_info_get_output (CoglFrameInfo *info) +{ + return info->output; +} diff --git a/cogl/cogl-frame-info.h b/cogl/cogl-frame-info.h new file mode 100644 index 0000000..7304c53 --- /dev/null +++ b/cogl/cogl-frame-info.h @@ -0,0 +1,148 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Owen Taylor + */ +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_FRAME_INFO_H +#define __COGL_FRAME_INFO_H + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif +#include + +G_BEGIN_DECLS + +typedef struct _CoglFrameInfo CoglFrameInfo; +#define COGL_FRAME_INFO(X) ((CoglFrameInfo *)(X)) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_frame_info_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_frame_info_get_gtype (void); +#endif + +/** + * cogl_is_frame_info: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglFrameInfo. + * + * Return value: %TRUE if the object references a #CoglFrameInfo + * and %FALSE otherwise. + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_is_frame_info (void *object); + +/** + * cogl_frame_info_get_frame_counter: + * @info: a #CoglFrameInfo object + * + * Gets the frame counter for the #CoglOnscreen that corresponds + * to this frame. + * + * Return value: The frame counter value + * Since: 1.14 + * Stability: unstable + */ +int64_t cogl_frame_info_get_frame_counter (CoglFrameInfo *info); + +/** + * cogl_frame_info_get_presentation_time: + * @info: a #CoglFrameInfo object + * + * Gets the presentation time for the frame. This is the time at which + * the frame became visible to the user. + * + * The presentation time measured in nanoseconds is based on a + * monotonic time source. The time source is not necessarily + * correlated with system/wall clock time and may represent the time + * elapsed since some undefined system event such as when the system + * last booted. + * + * Linux kernel version less that 3.8 can result in + * non-monotonic timestamps being reported when using a drm based + * OpenGL driver. Also some buggy Mesa drivers up to 9.0.1 may also + * incorrectly report non-monotonic timestamps. + * + * Return value: the presentation time for the frame + * Since: 1.14 + * Stability: unstable + */ +int64_t cogl_frame_info_get_presentation_time (CoglFrameInfo *info); + +/** + * cogl_frame_info_get_refresh_rate: + * @info: a #CoglFrameInfo object + * + * Gets the refresh rate in Hertz for the output that the frame was on + * at the time the frame was presented. + * + * Some platforms can't associate a #CoglOutput with a + * #CoglFrameInfo object but are able to report a refresh rate via + * this api. Therefore if you need this information then this api is + * more reliable than using cogl_frame_info_get_output() followed by + * cogl_output_get_refresh_rate(). + * + * Return value: the refresh rate in Hertz + * Since: 1.14 + * Stability: unstable + */ +float cogl_frame_info_get_refresh_rate (CoglFrameInfo *info); + +/** + * cogl_frame_info_get_output: + * @info: a #CoglFrameInfo object + * + * Gets the #CoglOutput that the swapped frame was presented to. + * + * Return value: (transfer none): The #CoglOutput that the frame was + * presented to, or %NULL if this could not be determined. + * Since: 1.14 + * Stability: unstable + */ +CoglOutput * +cogl_frame_info_get_output (CoglFrameInfo *info); + +G_END_DECLS + +#endif /* __COGL_FRAME_INFO_H */ diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h new file mode 100644 index 0000000..4891d53 --- /dev/null +++ b/cogl/cogl-framebuffer-private.h @@ -0,0 +1,510 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_FRAMEBUFFER_PRIVATE_H +#define __COGL_FRAMEBUFFER_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-matrix-stack-private.h" +#include "cogl-journal-private.h" +#include "cogl-winsys-private.h" +#include "cogl-attribute-private.h" +#include "cogl-offscreen.h" +#include "cogl-gl-header.h" +#include "cogl-clip-stack.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include +#endif + +#ifdef COGL_HAS_GLX_SUPPORT +#include +#include +#endif + +typedef enum _CoglFramebufferType { + COGL_FRAMEBUFFER_TYPE_ONSCREEN, + COGL_FRAMEBUFFER_TYPE_OFFSCREEN +} CoglFramebufferType; + +typedef struct +{ + CoglSwapChain *swap_chain; + CoglBool need_stencil; + int samples_per_pixel; + CoglBool swap_throttled; + CoglBool depth_texture_enabled; +} CoglFramebufferConfig; + +/* Flags to pass to _cogl_offscreen_new_with_texture_full */ +typedef enum +{ + COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1 +} CoglOffscreenFlags; + +/* XXX: The order of these indices determines the order they are + * flushed. + * + * Flushing clip state may trash the modelview and projection matrices + * so we must do it before flushing the matrices. + */ +typedef enum _CoglFramebufferStateIndex +{ + COGL_FRAMEBUFFER_STATE_INDEX_BIND = 0, + COGL_FRAMEBUFFER_STATE_INDEX_VIEWPORT = 1, + COGL_FRAMEBUFFER_STATE_INDEX_CLIP = 2, + COGL_FRAMEBUFFER_STATE_INDEX_DITHER = 3, + COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW = 4, + COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION = 5, + COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK = 6, + COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING = 7, + COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE = 8, + COGL_FRAMEBUFFER_STATE_INDEX_MAX = 9 +} CoglFramebufferStateIndex; + +typedef enum _CoglFramebufferState +{ + COGL_FRAMEBUFFER_STATE_BIND = 1<<0, + COGL_FRAMEBUFFER_STATE_VIEWPORT = 1<<1, + COGL_FRAMEBUFFER_STATE_CLIP = 1<<2, + COGL_FRAMEBUFFER_STATE_DITHER = 1<<3, + COGL_FRAMEBUFFER_STATE_MODELVIEW = 1<<4, + COGL_FRAMEBUFFER_STATE_PROJECTION = 1<<5, + COGL_FRAMEBUFFER_STATE_COLOR_MASK = 1<<6, + COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING = 1<<7, + COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<8 +} CoglFramebufferState; + +#define COGL_FRAMEBUFFER_STATE_ALL ((1<config to configure if we want a depth or stencil buffer so + * we can get rid of these flags */ + CoglOffscreenFlags create_flags; +}; + +void +_cogl_framebuffer_init (CoglFramebuffer *framebuffer, + CoglContext *ctx, + CoglFramebufferType type, + int width, + int height); + +/* XXX: For a public api we might instead want a way to explicitly + * set the _premult status of a framebuffer or what components we + * care about instead of exposing the CoglPixelFormat + * internal_format. + * + * The current use case for this api is where we create an offscreen + * framebuffer for a shared atlas texture that has a format of + * RGBA_8888 disregarding the premultiplied alpha status for + * individual atlased textures or whether the alpha component is being + * discarded. We want to overried the internal_format that will be + * derived from the texture. + */ +void +_cogl_framebuffer_set_internal_format (CoglFramebuffer *framebuffer, + CoglPixelFormat internal_format); + +void _cogl_framebuffer_free (CoglFramebuffer *framebuffer); + +const CoglWinsysVtable * +_cogl_framebuffer_get_winsys (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_clear_without_flush4f (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha); + +void +_cogl_framebuffer_mark_clear_clip_dirty (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_mark_mid_scene (CoglFramebuffer *framebuffer); + +/* + * _cogl_framebuffer_get_clip_stack: + * @framebuffer: A #CoglFramebuffer + * + * Gets a pointer to the current clip stack. This can be used to later + * return to the same clip stack state with + * _cogl_framebuffer_set_clip_stack(). A reference is not taken on the + * stack so if you want to keep it you should call + * _cogl_clip_stack_ref(). + * + * Return value: a pointer to the @framebuffer clip stack. + */ +CoglClipStack * +_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer); + +/* + * _cogl_framebuffer_set_clip_stack: + * @framebuffer: A #CoglFramebuffer + * @stack: a pointer to the replacement clip stack + * + * Replaces the @framebuffer clip stack with @stack. + */ +void +_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer, + CoglClipStack *stack); + +CoglMatrixStack * +_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer); + +CoglMatrixStack * +_cogl_framebuffer_get_projection_stack (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer, + CoglFramebuffer *dependency); + +void +_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state); + +CoglFramebuffer * +_cogl_get_read_framebuffer (void); + +GSList * +_cogl_create_framebuffer_stack (void); + +void +_cogl_free_framebuffer_stack (GSList *stack); + +/* + * _cogl_offscreen_new_with_texture_full: + * @texture: A #CoglTexture pointer + * @create_flags: Flags specifying how to create the FBO + * @level: The mipmap level within the texture to target + * + * Creates a new offscreen buffer which will target the given + * texture. By default the buffer will have a depth and stencil + * buffer. This can be disabled by passing + * %COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL in @create_flags. + * + * Return value: the new CoglOffscreen object. + */ +CoglOffscreen * +_cogl_offscreen_new_with_texture_full (CoglTexture *texture, + CoglOffscreenFlags create_flags, + int level); + +/* + * _cogl_push_framebuffers: + * @draw_buffer: A pointer to the buffer used for drawing + * @read_buffer: A pointer to the buffer used for reading back pixels + * + * Redirects drawing and reading to the specified framebuffers as in + * cogl_push_framebuffer() except that it allows the draw and read + * buffer to be different. The buffers are pushed as a pair so that + * they can later both be restored with a single call to + * cogl_pop_framebuffer(). + */ +void +_cogl_push_framebuffers (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer); + +/* + * _cogl_blit_framebuffer: + * @src: The source #CoglFramebuffer + * @dest: The destination #CoglFramebuffer + * @src_x: Source x position + * @src_y: Source y position + * @dst_x: Destination x position + * @dst_y: Destination y position + * @width: Width of region to copy + * @height: Height of region to copy + * + * This blits a region of the color buffer of the current draw buffer + * to the current read buffer. The draw and read buffers can be set up + * using _cogl_push_framebuffers(). This function should only be + * called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is + * advertised. The two buffers must both be offscreen and have the + * same format. + * + * Note that this function differs a lot from the glBlitFramebuffer + * function provided by the GL_EXT_framebuffer_blit extension. Notably + * it doesn't support having different sizes for the source and + * destination rectangle. This isn't supported by the corresponding + * GL_ANGLE_framebuffer_blit extension on GLES2.0 and it doesn't seem + * like a particularly useful feature. If the application wanted to + * scale the results it may make more sense to draw a primitive + * instead. + * + * We can only really support blitting between two offscreen buffers + * for this function on GLES2.0. This is because we effectively render + * upside down to offscreen buffers to maintain Cogl's representation + * of the texture coordinate system where 0,0 is the top left of the + * texture. If we were to blit from an offscreen to an onscreen buffer + * then we would need to mirror the blit along the x-axis but the GLES + * extension does not support this. + * + * The GL function is documented to be affected by the scissor. This + * function therefore ensure that an empty clip stack is flushed + * before performing the blit which means the scissor is effectively + * ignored. + * + * The function also doesn't support specifying the buffers to copy + * and instead only the color buffer is copied. When copying the depth + * or stencil buffers the extension on GLES2.0 only supports copying + * the full buffer which would be awkward to document with this + * API. If we wanted to support that feature it may be better to have + * a separate function to copy the entire buffer for a given mask. + */ +void +_cogl_blit_framebuffer (CoglFramebuffer *src, + CoglFramebuffer *dest, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); + +void +_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_save_clip_stack (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_restore_clip_stack (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_unref (CoglFramebuffer *framebuffer); + +/* This can be called directly by the CoglJournal to draw attributes + * skipping the implicit journal flush, the framebuffer flush and + * pipeline validation. */ +void +_cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +void +_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +gboolean +_cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx, + CoglTexture *texture, + int texture_level, + int texture_level_width, + int texture_level_height, + CoglTexture *depth_texture, + CoglFramebufferConfig *config, + CoglOffscreenAllocateFlags flags, + CoglGLFramebuffer *gl_framebuffer); + +unsigned long +_cogl_framebuffer_compare (CoglFramebuffer *a, + CoglFramebuffer *b, + unsigned long state); + +static inline CoglMatrixEntry * +_cogl_framebuffer_get_modelview_entry (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + return modelview_stack->last_entry; +} + +static inline CoglMatrixEntry * +_cogl_framebuffer_get_projection_entry (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + return projection_stack->last_entry; +} + +CoglBool +_cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error); + +/* + * _cogl_framebuffer_get_stencil_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of stencil bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 2.0 + * Stability: unstable + */ +int +_cogl_framebuffer_get_stencil_bits (CoglFramebuffer *framebuffer); + +#endif /* __COGL_FRAMEBUFFER_PRIVATE_H */ diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c new file mode 100644 index 0000000..135b873 --- /dev/null +++ b/cogl/cogl-framebuffer.c @@ -0,0 +1,2503 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-debug.h" +#include "cogl-context-private.h" +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-object-private.h" +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-clip-stack.h" +#include "cogl-journal-private.h" +#include "cogl-winsys-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-matrix-private.h" +#include "cogl-primitive-private.h" +#include "cogl-offscreen.h" +#include "cogl1-context.h" +#include "cogl-private.h" +#include "cogl-primitives-private.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-gtype-private.h" + +extern CoglObjectClass _cogl_onscreen_class; + +#ifdef COGL_ENABLE_DEBUG +static CoglUserDataKey wire_pipeline_key; +#endif + +static void _cogl_offscreen_free (CoglOffscreen *offscreen); + +COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Offscreen, offscreen, + _cogl_offscreen_class.virt_unref = + _cogl_framebuffer_unref); +COGL_GTYPE_DEFINE_CLASS (Offscreen, offscreen); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen); +COGL_GTYPE_DEFINE_INTERFACE (Framebuffer, framebuffer); + +/* XXX: + * The CoglObject macros don't support any form of inheritance, so for + * now we implement the CoglObject support for the CoglFramebuffer + * abstract class manually. + */ + +uint32_t +cogl_framebuffer_error_quark (void) +{ + return g_quark_from_static_string ("cogl-framebuffer-error-quark"); +} + +CoglBool +cogl_is_framebuffer (void *object) +{ + CoglObject *obj = object; + + if (obj == NULL) + return FALSE; + + return (obj->klass == &_cogl_onscreen_class || + obj->klass == &_cogl_offscreen_class); +} + +void +_cogl_framebuffer_init (CoglFramebuffer *framebuffer, + CoglContext *ctx, + CoglFramebufferType type, + int width, + int height) +{ + framebuffer->context = ctx; + + framebuffer->type = type; + framebuffer->width = width; + framebuffer->height = height; + framebuffer->internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + framebuffer->viewport_x = 0; + framebuffer->viewport_y = 0; + framebuffer->viewport_width = width; + framebuffer->viewport_height = height; + framebuffer->viewport_age = 0; + framebuffer->viewport_age_for_scissor_workaround = -1; + framebuffer->dither_enabled = TRUE; + framebuffer->depth_writing_enabled = TRUE; + + framebuffer->modelview_stack = cogl_matrix_stack_new (ctx); + framebuffer->projection_stack = cogl_matrix_stack_new (ctx); + + framebuffer->dirty_bitmasks = TRUE; + + framebuffer->color_mask = COGL_COLOR_MASK_ALL; + + framebuffer->samples_per_pixel = 0; + + framebuffer->clip_stack = NULL; + + framebuffer->journal = _cogl_journal_new (framebuffer); + + /* Ensure we know the framebuffer->clear_color* members can't be + * referenced for our fast-path read-pixel optimization (see + * _cogl_journal_try_read_pixel()) until some region of the + * framebuffer is initialized. + */ + framebuffer->clear_clip_dirty = TRUE; + + /* XXX: We have to maintain a central list of all framebuffers + * because at times we need to be able to flush all known journals. + * + * Examples where we need to flush all journals are: + * - because journal entries can reference OpenGL texture + * coordinates that may not survive texture-atlas reorganization + * so we need the ability to flush those entries. + * - because although we generally advise against modifying + * pipelines after construction we have to handle that possibility + * and since pipelines may be referenced in journal entries we + * need to be able to flush them before allowing the pipelines to + * be changed. + * + * Note we don't maintain a list of journals and associate + * framebuffers with journals by e.g. having a journal->framebuffer + * reference since that would introduce a circular reference. + * + * Note: As a future change to try and remove the need to index all + * journals it might be possible to defer resolving of OpenGL + * texture coordinates for rectangle primitives until we come to + * flush a journal. This would mean for instance that a single + * rectangle entry in a journal could later be expanded into + * multiple quad primitives to handle sliced textures but would mean + * we don't have to worry about retaining references to OpenGL + * texture coordinates that may later become invalid. + */ + ctx->framebuffers = g_list_prepend (ctx->framebuffers, framebuffer); +} + +void +_cogl_framebuffer_set_internal_format (CoglFramebuffer *framebuffer, + CoglPixelFormat internal_format) +{ + framebuffer->internal_format = internal_format; +} + +void +_cogl_framebuffer_free (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + _cogl_fence_cancel_fences_for_framebuffer (framebuffer); + + _cogl_clip_stack_unref (framebuffer->clip_stack); + + cogl_object_unref (framebuffer->modelview_stack); + framebuffer->modelview_stack = NULL; + + cogl_object_unref (framebuffer->projection_stack); + framebuffer->projection_stack = NULL; + + cogl_object_unref (framebuffer->journal); + + if (ctx->viewport_scissor_workaround_framebuffer == framebuffer) + ctx->viewport_scissor_workaround_framebuffer = NULL; + + ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer); + + if (ctx->current_draw_buffer == framebuffer) + ctx->current_draw_buffer = NULL; + if (ctx->current_read_buffer == framebuffer) + ctx->current_read_buffer = NULL; +} + +const CoglWinsysVtable * +_cogl_framebuffer_get_winsys (CoglFramebuffer *framebuffer) +{ + return framebuffer->context->display->renderer->winsys_vtable; +} + +/* This version of cogl_clear can be used internally as an alternative + * to avoid flushing the journal or the framebuffer state. This is + * needed when doing operations that may be called whiling flushing + * the journal */ +void +_cogl_framebuffer_clear_without_flush4f (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha) +{ + CoglContext *ctx = framebuffer->context; + + if (!buffers) + { + static CoglBool shown = FALSE; + + if (!shown) + { + g_warning ("You should specify at least one auxiliary buffer " + "when calling cogl_framebuffer_clear"); + } + + return; + } + + ctx->driver_vtable->framebuffer_clear (framebuffer, + buffers, + red, green, blue, alpha); +} + +void +_cogl_framebuffer_mark_clear_clip_dirty (CoglFramebuffer *framebuffer) +{ + framebuffer->clear_clip_dirty = TRUE; +} + +void +_cogl_framebuffer_mark_mid_scene (CoglFramebuffer *framebuffer) +{ + framebuffer->mid_scene = TRUE; +} + +void +cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha) +{ + CoglContext *ctx = framebuffer->context; + CoglClipStack *clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer); + int scissor_x0; + int scissor_y0; + int scissor_x1; + int scissor_y1; + CoglBool saved_viewport_scissor_workaround; + + _cogl_clip_stack_get_bounds (clip_stack, + &scissor_x0, &scissor_y0, + &scissor_x1, &scissor_y1); + + /* NB: the previous clear could have had an arbitrary clip. + * NB: everything for the last frame might still be in the journal + * but we can't assume anything about how each entry was + * clipped. + * NB: Clutter will scissor its pick renders which would mean all + * journal entries have a common ClipStack entry, but without + * a layering violation Cogl has to explicitly walk the journal + * entries to determine if this is the case. + * NB: We have a software only read-pixel optimization in the + * journal that determines the color at a given framebuffer + * coordinate for simple scenes without rendering with the GPU. + * When Clutter is hitting this fast-path we can expect to + * receive calls to clear the framebuffer with an un-flushed + * journal. + * NB: To fully support software based picking for Clutter we + * need to be able to reliably detect when the contents of a + * journal can be discarded and when we can skip the call to + * glClear because it matches the previous clear request. + */ + + /* Note: we don't check for the stencil buffer being cleared here + * since there isn't any public cogl api to manipulate the stencil + * buffer. + * + * Note: we check for an exact clip match here because + * 1) a smaller clip could mean existing journal entries may + * need to contribute to regions outside the new clear-clip + * 2) a larger clip would mean we need to issue a real + * glClear and we only care about cases avoiding a + * glClear. + * + * Note: Comparing without an epsilon is considered + * appropriate here. + */ + if (buffers & COGL_BUFFER_BIT_COLOR && + buffers & COGL_BUFFER_BIT_DEPTH && + !framebuffer->clear_clip_dirty && + framebuffer->clear_color_red == red && + framebuffer->clear_color_green == green && + framebuffer->clear_color_blue == blue && + framebuffer->clear_color_alpha == alpha && + scissor_x0 == framebuffer->clear_clip_x0 && + scissor_y0 == framebuffer->clear_clip_y0 && + scissor_x1 == framebuffer->clear_clip_x1 && + scissor_y1 == framebuffer->clear_clip_y1) + { + /* NB: We only have to consider the clip state of journal + * entries if the current clear is clipped since otherwise we + * know every pixel of the framebuffer is affected by the clear + * and so all journal entries become redundant and can simply be + * discarded. + */ + if (clip_stack) + { + /* + * Note: the function for checking the journal entries is + * quite strict. It avoids detailed checking of all entry + * clip_stacks by only checking the details of the first + * entry and then it only verifies that the remaining + * entries share the same clip_stack ancestry. This means + * it's possible for some false negatives here but that will + * just result in us falling back to a real clear. + */ + if (_cogl_journal_all_entries_within_bounds (framebuffer->journal, + scissor_x0, scissor_y0, + scissor_x1, scissor_y1)) + { + _cogl_journal_discard (framebuffer->journal); + goto cleared; + } + } + else + { + _cogl_journal_discard (framebuffer->journal); + goto cleared; + } + } + + COGL_NOTE (DRAW, "Clear begin"); + + _cogl_framebuffer_flush_journal (framebuffer); + + /* XXX: ONGOING BUG: Intel viewport scissor + * + * The semantics of cogl_framebuffer_clear() are that it should not + * be affected by the current viewport and so if we are currently + * applying a workaround for viewport scissoring we need to + * temporarily disable the workaround before clearing so any + * special scissoring for the workaround will be removed first. + * + * Note: we only need to disable the workaround if the current + * viewport doesn't match the framebuffer's size since otherwise + * the workaround wont affect clearing anyway. + */ + if (ctx->needs_viewport_scissor_workaround && + (framebuffer->viewport_x != 0 || + framebuffer->viewport_y != 0 || + framebuffer->viewport_width != framebuffer->width || + framebuffer->viewport_height != framebuffer->height)) + { + saved_viewport_scissor_workaround = TRUE; + ctx->needs_viewport_scissor_workaround = FALSE; + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + } + else + saved_viewport_scissor_workaround = FALSE; + + /* NB: _cogl_framebuffer_flush_state may disrupt various state (such + * as the pipeline state) when flushing the clip stack, so should + * always be done first when preparing to draw. */ + _cogl_framebuffer_flush_state (framebuffer, framebuffer, + COGL_FRAMEBUFFER_STATE_ALL); + + _cogl_framebuffer_clear_without_flush4f (framebuffer, buffers, + red, green, blue, alpha); + + /* XXX: ONGOING BUG: Intel viewport scissor + * + * See comment about temporarily disabling this workaround above + */ + if (saved_viewport_scissor_workaround) + { + ctx->needs_viewport_scissor_workaround = TRUE; + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + } + + /* This is a debugging variable used to visually display the quad + * batches from the journal. It is reset here to increase the + * chances of getting the same colours for each frame during an + * animation */ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)) && + buffers & COGL_BUFFER_BIT_COLOR) + { + framebuffer->context->journal_rectangles_color = 1; + } + + COGL_NOTE (DRAW, "Clear end"); + +cleared: + + _cogl_framebuffer_mark_mid_scene (framebuffer); + _cogl_framebuffer_mark_clear_clip_dirty (framebuffer); + + if (buffers & COGL_BUFFER_BIT_COLOR && buffers & COGL_BUFFER_BIT_DEPTH) + { + /* For our fast-path for reading back a single pixel of simple + * scenes where the whole frame is in the journal we need to + * track the cleared color of the framebuffer in case the point + * read doesn't intersect any of the journal rectangles. */ + framebuffer->clear_clip_dirty = FALSE; + framebuffer->clear_color_red = red; + framebuffer->clear_color_green = green; + framebuffer->clear_color_blue = blue; + framebuffer->clear_color_alpha = alpha; + + /* NB: A clear may be scissored so we need to track the extents + * that the clear is applicable too... */ + if (clip_stack) + { + _cogl_clip_stack_get_bounds (clip_stack, + &framebuffer->clear_clip_x0, + &framebuffer->clear_clip_y0, + &framebuffer->clear_clip_x1, + &framebuffer->clear_clip_y1); + } + else + { + /* FIXME: set degenerate clip */ + } + } +} + +/* Note: the 'buffers' and 'color' arguments were switched around on + * purpose compared to the original cogl_clear API since it was odd + * that you would be expected to specify a color before even + * necessarily choosing to clear the color buffer. + */ +void +cogl_framebuffer_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + const CoglColor *color) +{ + cogl_framebuffer_clear4f (framebuffer, buffers, + cogl_color_get_red_float (color), + cogl_color_get_green_float (color), + cogl_color_get_blue_float (color), + cogl_color_get_alpha_float (color)); +} + +/* We will lazily allocate framebuffers if necessary when querying + * their size/viewport but note we need to be careful in the case of + * onscreen framebuffers that are instantiated with an initial request + * size that we don't trigger an allocation when this is queried since + * that would lead to a recursion when the winsys backend queries this + * requested size during allocation. */ +static void +ensure_size_initialized (CoglFramebuffer *framebuffer) +{ + /* In the case of offscreen framebuffers backed by a texture then + * until that texture has been allocated we might not know the size + * of the framebuffer */ + if (framebuffer->width < 0) + { + /* Currently we assume the size is always initialized for + * onscreen framebuffers. */ + _COGL_RETURN_IF_FAIL (cogl_is_offscreen (framebuffer)); + + /* We also assume the size would have been initialized if the + * framebuffer were allocated. */ + _COGL_RETURN_IF_FAIL (!framebuffer->allocated); + + cogl_framebuffer_allocate (framebuffer, NULL); + } +} + +int +cogl_framebuffer_get_width (CoglFramebuffer *framebuffer) +{ + ensure_size_initialized (framebuffer); + return framebuffer->width; +} + +int +cogl_framebuffer_get_height (CoglFramebuffer *framebuffer) +{ + ensure_size_initialized (framebuffer); + return framebuffer->height; +} + +CoglClipStack * +_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer) +{ + return framebuffer->clip_stack; +} + +void +_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer, + CoglClipStack *stack) +{ + _cogl_clip_stack_ref (stack); + _cogl_clip_stack_unref (framebuffer->clip_stack); + framebuffer->clip_stack = stack; +} + +void +cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, + float x, + float y, + float width, + float height) +{ + CoglContext *context = framebuffer->context; + + _COGL_RETURN_IF_FAIL (width > 0 && height > 0); + + if (framebuffer->viewport_x == x && + framebuffer->viewport_y == y && + framebuffer->viewport_width == width && + framebuffer->viewport_height == height) + return; + + _cogl_framebuffer_flush_journal (framebuffer); + + framebuffer->viewport_x = x; + framebuffer->viewport_y = y; + framebuffer->viewport_width = width; + framebuffer->viewport_height = height; + framebuffer->viewport_age++; + + if (context->current_draw_buffer == framebuffer) + { + context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_VIEWPORT; + + if (context->needs_viewport_scissor_workaround) + context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + } +} + +float +cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer) +{ + return framebuffer->viewport_x; +} + +float +cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer) +{ + return framebuffer->viewport_y; +} + +float +cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer) +{ + ensure_size_initialized (framebuffer); + return framebuffer->viewport_width; +} + +float +cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer) +{ + ensure_size_initialized (framebuffer); + return framebuffer->viewport_height; +} + +void +cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer, + float *viewport) +{ + ensure_size_initialized (framebuffer); + + viewport[0] = framebuffer->viewport_x; + viewport[1] = framebuffer->viewport_y; + viewport[2] = framebuffer->viewport_width; + viewport[3] = framebuffer->viewport_height; +} + +CoglMatrixStack * +_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer) +{ + return framebuffer->modelview_stack; +} + +CoglMatrixStack * +_cogl_framebuffer_get_projection_stack (CoglFramebuffer *framebuffer) +{ + return framebuffer->projection_stack; +} + +void +_cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer, + CoglFramebuffer *dependency) +{ + GList *l; + + for (l = framebuffer->deps; l; l = l->next) + { + CoglFramebuffer *existing_dep = l->data; + if (existing_dep == dependency) + return; + } + + /* TODO: generalize the primed-array type structure we e.g. use for + * cogl_object_set_user_data or for pipeline children as a way to + * avoid quite a lot of mid-scene micro allocations here... */ + framebuffer->deps = + g_list_prepend (framebuffer->deps, cogl_object_ref (dependency)); +} + +void +_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer) +{ + GList *l; + for (l = framebuffer->deps; l; l = l->next) + cogl_object_unref (l->data); + g_list_free (framebuffer->deps); + framebuffer->deps = NULL; +} + +void +_cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer) +{ + _cogl_journal_flush (framebuffer->journal); +} + +void +_cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer) +{ + GList *l; + for (l = framebuffer->deps; l; l = l->next) + _cogl_framebuffer_flush_journal (l->data); + _cogl_framebuffer_remove_all_dependencies (framebuffer); +} + +CoglOffscreen * +_cogl_offscreen_new_with_texture_full (CoglTexture *texture, + CoglOffscreenFlags create_flags, + int level) +{ + CoglContext *ctx = texture->context; + CoglOffscreen *offscreen; + CoglFramebuffer *fb; + CoglOffscreen *ret; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_texture (texture), NULL); + + offscreen = g_new0 (CoglOffscreen, 1); + offscreen->texture = cogl_object_ref (texture); + offscreen->texture_level = level; + offscreen->create_flags = create_flags; + + fb = COGL_FRAMEBUFFER (offscreen); + + /* NB: we can't assume we can query the texture's width yet, since + * it might not have been allocated yet and for example if the + * texture is being loaded from a file then the file might not + * have been read yet. */ + + _cogl_framebuffer_init (fb, + ctx, + COGL_FRAMEBUFFER_TYPE_OFFSCREEN, + -1, /* unknown width, until allocation */ + -1); /* unknown height until allocation */ + + ret = _cogl_offscreen_object_new (offscreen); + + _cogl_texture_associate_framebuffer (texture, fb); + + return ret; +} + +/* XXX: deprecated api */ +CoglOffscreen * +cogl_offscreen_new_to_texture (CoglTexture *texture) +{ + CoglOffscreen *ret = _cogl_offscreen_new_with_texture_full (texture, 0, 0); + CoglError *error = NULL; + + if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (ret), &error)) + { + cogl_object_unref (ret); + cogl_error_free (error); + ret = NULL; + } + + return ret; +} + +CoglOffscreen * +cogl_offscreen_new_with_texture (CoglTexture *texture) +{ + return _cogl_offscreen_new_with_texture_full (texture, 0, 0); +} + +static void +_cogl_offscreen_free (CoglOffscreen *offscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen); + CoglContext *ctx = framebuffer->context; + + ctx->driver_vtable->offscreen_free (offscreen); + + /* Chain up to parent */ + _cogl_framebuffer_free (framebuffer); + + if (offscreen->texture != NULL) + cogl_object_unref (offscreen->texture); + + if (offscreen->depth_texture != NULL) + cogl_object_unref (offscreen->depth_texture); + + g_free (offscreen); +} + +CoglBool +cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, + CoglError **error) +{ + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + CoglContext *ctx = framebuffer->context; + + if (framebuffer->allocated) + return TRUE; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + if (framebuffer->config.depth_texture_enabled) + { + _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Can't allocate onscreen framebuffer with a " + "texture based depth buffer"); + return FALSE; + } + + if (!winsys->onscreen_init (onscreen, error)) + return FALSE; + + /* If the winsys doesn't support dirty events then we'll report + * one on allocation so that if the application only paints in + * response to dirty events then it will at least paint once to + * start */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_DIRTY_EVENTS)) + _cogl_onscreen_queue_full_dirty (onscreen); + } + else + { + CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer); + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + _cogl_set_error (error, COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Offscreen framebuffers not supported by system"); + return FALSE; + } + + if (!cogl_texture_allocate (offscreen->texture, error)) + return FALSE; + + /* NB: it's only after allocating the texture that we will + * determine whether a texture needs slicing... */ + if (cogl_texture_is_sliced (offscreen->texture)) + { + _cogl_set_error (error, COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Can't create offscreen framebuffer from " + "sliced texture"); + return FALSE; + } + + /* Now that the texture has been allocated we can determine a + * size for the framebuffer... */ + framebuffer->width = cogl_texture_get_width (offscreen->texture); + framebuffer->height = cogl_texture_get_height (offscreen->texture); + framebuffer->viewport_width = framebuffer->width; + framebuffer->viewport_height = framebuffer->height; + + /* Forward the texture format as the internal format of the + * framebuffer */ + framebuffer->internal_format = + _cogl_texture_get_format (offscreen->texture); + + if (!ctx->driver_vtable->offscreen_allocate (offscreen, error)) + return FALSE; + } + + framebuffer->allocated = TRUE; + + return TRUE; +} + +static unsigned long +_cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + if (a->viewport_x != b->viewport_x || + a->viewport_y != b->viewport_y || + a->viewport_width != b->viewport_width || + a->viewport_height != b->viewport_height || + /* NB: we render upside down to offscreen framebuffers and that + * can affect how we setup the GL viewport... */ + a->type != b->type) + { + unsigned long differences = COGL_FRAMEBUFFER_STATE_VIEWPORT; + CoglContext *context = a->context; + + /* XXX: ONGOING BUG: Intel viewport scissor + * + * Intel gen6 drivers don't currently correctly handle offset + * viewports, since primitives aren't clipped within the bounds of + * the viewport. To workaround this we push our own clip for the + * viewport that will use scissoring to ensure we clip as expected. + * + * This workaround implies that a change in viewport state is + * effectively also a change in the clipping state. + * + * TODO: file a bug upstream! + */ + if (G_UNLIKELY (context->needs_viewport_scissor_workaround)) + differences |= COGL_FRAMEBUFFER_STATE_CLIP; + + return differences; + } + else + return 0; +} + +static unsigned long +_cogl_framebuffer_compare_clip_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + if (a->clip_stack != b->clip_stack) + return COGL_FRAMEBUFFER_STATE_CLIP; + else + return 0; +} + +static unsigned long +_cogl_framebuffer_compare_dither_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + return a->dither_enabled != b->dither_enabled ? + COGL_FRAMEBUFFER_STATE_DITHER : 0; +} + +static unsigned long +_cogl_framebuffer_compare_modelview_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + /* We always want to flush the modelview state. All this does is set + the current modelview stack on the context to the framebuffer's + stack. */ + return COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +static unsigned long +_cogl_framebuffer_compare_projection_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + /* We always want to flush the projection state. All this does is + set the current projection stack on the context to the + framebuffer's stack. */ + return COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +static unsigned long +_cogl_framebuffer_compare_color_mask_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + if (cogl_framebuffer_get_color_mask (a) != + cogl_framebuffer_get_color_mask (b)) + return COGL_FRAMEBUFFER_STATE_COLOR_MASK; + else + return 0; +} + +static unsigned long +_cogl_framebuffer_compare_front_face_winding_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + if (a->type != b->type) + return COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING; + else + return 0; +} + +static unsigned long +_cogl_framebuffer_compare_depth_write_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + return a->depth_writing_enabled != b->depth_writing_enabled ? + COGL_FRAMEBUFFER_STATE_DEPTH_WRITE : 0; +} + +unsigned long +_cogl_framebuffer_compare (CoglFramebuffer *a, + CoglFramebuffer *b, + unsigned long state) +{ + unsigned long differences = 0; + int bit; + + if (state & COGL_FRAMEBUFFER_STATE_BIND) + { + differences |= COGL_FRAMEBUFFER_STATE_BIND; + state &= ~COGL_FRAMEBUFFER_STATE_BIND; + } + + COGL_FLAGS_FOREACH_START (&state, 1, bit) + { + /* XXX: We considered having an array of callbacks for each state index + * that we'd call here but decided that this way the compiler is more + * likely going to be able to in-line the comparison functions and use + * the index to jump straight to the required code. */ + switch (bit) + { + case COGL_FRAMEBUFFER_STATE_INDEX_VIEWPORT: + differences |= + _cogl_framebuffer_compare_viewport_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_CLIP: + differences |= _cogl_framebuffer_compare_clip_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_DITHER: + differences |= _cogl_framebuffer_compare_dither_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW: + differences |= + _cogl_framebuffer_compare_modelview_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION: + differences |= + _cogl_framebuffer_compare_projection_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK: + differences |= + _cogl_framebuffer_compare_color_mask_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING: + differences |= + _cogl_framebuffer_compare_front_face_winding_state (a, b); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE: + differences |= + _cogl_framebuffer_compare_depth_write_state (a, b); + break; + default: + g_warn_if_reached (); + } + } + COGL_FLAGS_FOREACH_END; + + return differences; +} + +void +_cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state) +{ + CoglContext *ctx = draw_buffer->context; + + ctx->driver_vtable->framebuffer_flush_state (draw_buffer, + read_buffer, + state); +} + +int +cogl_framebuffer_get_red_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.red; +} + +int +cogl_framebuffer_get_green_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.green; +} + +int +cogl_framebuffer_get_blue_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.blue; +} + +int +cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.alpha; +} + +int +cogl_framebuffer_get_depth_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.depth; +} + +int +_cogl_framebuffer_get_stencil_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + CoglFramebufferBits bits; + + ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits); + + return bits.stencil; +} + +CoglColorMask +cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer) +{ + return framebuffer->color_mask; +} + +void +cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer, + CoglColorMask color_mask) +{ + if (framebuffer->color_mask == color_mask) + return; + + /* XXX: Currently color mask changes don't go through the journal */ + _cogl_framebuffer_flush_journal (framebuffer); + + framebuffer->color_mask = color_mask; + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_COLOR_MASK; +} + +CoglBool +cogl_framebuffer_get_depth_write_enabled (CoglFramebuffer *framebuffer) +{ + return framebuffer->depth_writing_enabled; +} + +void +cogl_framebuffer_set_depth_write_enabled (CoglFramebuffer *framebuffer, + CoglBool depth_write_enabled) +{ + if (framebuffer->depth_writing_enabled == depth_write_enabled) + return; + + /* XXX: Currently depth write changes don't go through the journal */ + _cogl_framebuffer_flush_journal (framebuffer); + + framebuffer->depth_writing_enabled = depth_write_enabled; + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_DEPTH_WRITE; +} + +CoglBool +cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer) +{ + return framebuffer->dither_enabled; +} + +void +cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer, + CoglBool dither_enabled) +{ + if (framebuffer->dither_enabled == dither_enabled) + return; + + cogl_flush (); /* Currently dithering changes aren't tracked in the journal */ + framebuffer->dither_enabled = dither_enabled; + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_DITHER; +} + +void +cogl_framebuffer_set_depth_texture_enabled (CoglFramebuffer *framebuffer, + CoglBool enabled) +{ + _COGL_RETURN_IF_FAIL (!framebuffer->allocated); + + framebuffer->config.depth_texture_enabled = enabled; +} + +CoglBool +cogl_framebuffer_get_depth_texture_enabled (CoglFramebuffer *framebuffer) +{ + return framebuffer->config.depth_texture_enabled; +} + +CoglTexture * +cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer) +{ + /* lazily allocate the framebuffer... */ + if (!cogl_framebuffer_allocate (framebuffer, NULL)) + return NULL; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_offscreen (framebuffer), NULL); + return COGL_OFFSCREEN(framebuffer)->depth_texture; +} + +int +cogl_framebuffer_get_samples_per_pixel (CoglFramebuffer *framebuffer) +{ + if (framebuffer->allocated) + return framebuffer->samples_per_pixel; + else + return framebuffer->config.samples_per_pixel; +} + +void +cogl_framebuffer_set_samples_per_pixel (CoglFramebuffer *framebuffer, + int samples_per_pixel) +{ + _COGL_RETURN_IF_FAIL (!framebuffer->allocated); + + framebuffer->config.samples_per_pixel = samples_per_pixel; +} + +void +cogl_framebuffer_resolve_samples (CoglFramebuffer *framebuffer) +{ + cogl_framebuffer_resolve_samples_region (framebuffer, + 0, 0, + framebuffer->width, + framebuffer->height); + + /* TODO: Make this happen implicitly when the resolve texture next gets used + * as a source, either via cogl_texture_get_data(), via cogl_read_pixels() or + * if used as a source for rendering. We would also implicitly resolve if + * necessary before freeing a CoglFramebuffer. + * + * This API should still be kept but it is optional, only necessary + * if the user wants to explicitly control when the resolve happens e.g. + * to ensure it's done in advance of it being used as a source. + * + * Every texture should have a CoglFramebuffer *needs_resolve member + * internally. When the texture gets validated before being used as a source + * we should first check the needs_resolve pointer and if set we'll + * automatically call cogl_framebuffer_resolve_samples (). + * + * Calling cogl_framebuffer_resolve_samples() or + * cogl_framebuffer_resolve_samples_region() should reset the textures + * needs_resolve pointer to NULL. + * + * Rendering anything to a framebuffer will cause the corresponding + * texture's ->needs_resolve pointer to be set. + * + * XXX: Note: we only need to address this TODO item when adding support for + * EXT_framebuffer_multisample because currently we only support hardware + * that resolves implicitly anyway. + */ +} + +void +cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height) +{ + /* NOP for now since we don't support EXT_framebuffer_multisample yet which + * requires an explicit resolve. */ +} + +CoglContext * +cogl_framebuffer_get_context (CoglFramebuffer *framebuffer) +{ + _COGL_RETURN_VAL_IF_FAIL (framebuffer != NULL, NULL); + + return framebuffer->context; +} + +static CoglBool +_cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap) +{ + CoglBool found_intersection; + CoglPixelFormat format; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FAST_READ_PIXEL))) + return FALSE; + + if (source != COGL_READ_PIXELS_COLOR_BUFFER) + return FALSE; + + format = cogl_bitmap_get_format (bitmap); + + if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE && + format != COGL_PIXEL_FORMAT_RGBA_8888) + return FALSE; + + if (!_cogl_journal_try_read_pixel (framebuffer->journal, + x, y, bitmap, + &found_intersection)) + return FALSE; + + /* If we can't determine the color from the primitives in the + * journal then see if we can use the last recorded clear color + */ + + /* If _cogl_journal_try_read_pixel() failed even though there was an + * intersection of the given point with a primitive in the journal + * then we can't fallback to the framebuffer's last clear color... + * */ + if (found_intersection) + return TRUE; + + /* If the framebuffer has been rendered too since it was last + * cleared then we can't return the last known clear color. */ + if (framebuffer->clear_clip_dirty) + return FALSE; + + if (x >= framebuffer->clear_clip_x0 && + x < framebuffer->clear_clip_x1 && + y >= framebuffer->clear_clip_y0 && + y < framebuffer->clear_clip_y1) + { + uint8_t *pixel; + CoglError *ignore_error = NULL; + + /* we currently only care about cases where the premultiplied or + * unpremultipled colors are equivalent... */ + if (framebuffer->clear_color_alpha != 1.0) + return FALSE; + + pixel = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + &ignore_error); + if (pixel == NULL) + { + cogl_error_free (ignore_error); + return FALSE; + } + + pixel[0] = framebuffer->clear_color_red * 255.0; + pixel[1] = framebuffer->clear_color_green * 255.0; + pixel[2] = framebuffer->clear_color_blue * 255.0; + pixel[3] = framebuffer->clear_color_alpha * 255.0; + + _cogl_bitmap_unmap (bitmap); + + return TRUE; + } + + return FALSE; +} + +CoglBool +_cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error) +{ + CoglContext *ctx; + int width; + int height; + + _COGL_RETURN_VAL_IF_FAIL (source & COGL_READ_PIXELS_COLOR_BUFFER, FALSE); + _COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE); + + if (!cogl_framebuffer_allocate (framebuffer, error)) + return FALSE; + + width = cogl_bitmap_get_width (bitmap); + height = cogl_bitmap_get_height (bitmap); + + if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty) + { + /* If everything drawn so far for this frame is still in the + * Journal then if all of the rectangles only have a flat + * opaque color we have a fast-path for reading a single pixel + * that avoids the relatively high cost of flushing primitives + * to be drawn on the GPU (considering how simple the geometry + * is in this case) and then blocking on the long GPU pipelines + * for the result. + */ + if (_cogl_framebuffer_try_fast_read_pixel (framebuffer, + x, y, source, bitmap)) + return TRUE; + } + + ctx = cogl_framebuffer_get_context (framebuffer); + + /* make sure any batched primitives get emitted to the driver + * before issuing our read pixels... + */ + _cogl_framebuffer_flush_journal (framebuffer); + + return ctx->driver_vtable->framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, + source, + bitmap, + error); +} + +CoglBool +cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap) +{ + CoglError *ignore_error = NULL; + CoglBool status = + _cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, source, bitmap, + &ignore_error); + if (!status) + cogl_error_free (ignore_error); + return status; +} + +CoglBool +cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height, + CoglPixelFormat format, + uint8_t *pixels) +{ + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + CoglBitmap *bitmap; + CoglBool ret; + + bitmap = cogl_bitmap_new_for_data (framebuffer->context, + width, height, + format, + bpp * width, /* rowstride */ + pixels); + + /* Note: we don't try and catch errors here since we created the + * bitmap storage up-front and can assume we wont hit an + * out-of-memory error which should be the only exception + * this api throws. + */ + ret = _cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, + COGL_READ_PIXELS_COLOR_BUFFER, + bitmap, + NULL); + cogl_object_unref (bitmap); + + return ret; +} + +void +_cogl_blit_framebuffer (CoglFramebuffer *src, + CoglFramebuffer *dest, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + CoglContext *ctx = src->context; + + _COGL_RETURN_IF_FAIL (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)); + + /* We can only support blitting between offscreen buffers because + otherwise we would need to mirror the image and GLES2.0 doesn't + support this */ + _COGL_RETURN_IF_FAIL (cogl_is_offscreen (src)); + _COGL_RETURN_IF_FAIL (cogl_is_offscreen (dest)); + /* The buffers must be the same format */ + _COGL_RETURN_IF_FAIL (src->internal_format == dest->internal_format); + + /* Make sure the current framebuffers are bound. We explicitly avoid + flushing the clip state so we can bind our own empty state */ + _cogl_framebuffer_flush_state (dest, + src, + COGL_FRAMEBUFFER_STATE_ALL & + ~COGL_FRAMEBUFFER_STATE_CLIP); + + /* Flush any empty clip stack because glBlitFramebuffer is affected + by the scissor and we want to hide this feature for the Cogl API + because it's not obvious to an app how the clip state will affect + the scissor */ + _cogl_clip_stack_flush (NULL, dest); + + /* XXX: Because we are manually flushing clip state here we need to + * make sure that the clip state gets updated the next time we flush + * framebuffer state by marking the current framebuffer's clip state + * as changed */ + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + + ctx->glBlitFramebuffer (src_x, src_y, + src_x + width, src_y + height, + dst_x, dst_y, + dst_x + width, dst_y + height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); +} + +void +cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers) +{ + CoglContext *ctx = framebuffer->context; + + _COGL_RETURN_IF_FAIL (buffers & COGL_BUFFER_BIT_COLOR); + + ctx->driver_vtable->framebuffer_discard_buffers (framebuffer, buffers); +} + +void +cogl_framebuffer_finish (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + _cogl_framebuffer_flush_journal (framebuffer); + + ctx->driver_vtable->framebuffer_finish (framebuffer); +} + +void +cogl_framebuffer_push_matrix (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_push (modelview_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_pop_matrix (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_pop (modelview_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_identity_matrix (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_load_identity (modelview_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_scale (CoglFramebuffer *framebuffer, + float x, + float y, + float z) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_scale (modelview_stack, x, y, z); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_translate (CoglFramebuffer *framebuffer, + float x, + float y, + float z) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_translate (modelview_stack, x, y, z); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_rotate (CoglFramebuffer *framebuffer, + float angle, + float x, + float y, + float z) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_rotate (modelview_stack, angle, x, y, z); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_rotate_quaternion (CoglFramebuffer *framebuffer, + const CoglQuaternion *quaternion) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_rotate_quaternion (modelview_stack, quaternion); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_rotate_euler (CoglFramebuffer *framebuffer, + const CoglEuler *euler) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_rotate_euler (modelview_stack, euler); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_transform (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_multiply (modelview_stack, matrix); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; +} + +void +cogl_framebuffer_perspective (CoglFramebuffer *framebuffer, + float fov_y, + float aspect, + float z_near, + float z_far) +{ + float ymax = z_near * tanf (fov_y * G_PI / 360.0); + + cogl_framebuffer_frustum (framebuffer, + -ymax * aspect, /* left */ + ymax * aspect, /* right */ + -ymax, /* bottom */ + ymax, /* top */ + z_near, + z_far); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +void +cogl_framebuffer_frustum (CoglFramebuffer *framebuffer, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + + /* XXX: The projection matrix isn't currently tracked in the journal + * so we need to flush all journaled primitives first... */ + _cogl_framebuffer_flush_journal (framebuffer); + + cogl_matrix_stack_load_identity (projection_stack); + + cogl_matrix_stack_frustum (projection_stack, + left, + right, + bottom, + top, + z_near, + z_far); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +void +cogl_framebuffer_orthographic (CoglFramebuffer *framebuffer, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far) +{ + CoglMatrix ortho; + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + + /* XXX: The projection matrix isn't currently tracked in the journal + * so we need to flush all journaled primitives first... */ + _cogl_framebuffer_flush_journal (framebuffer); + + cogl_matrix_init_identity (&ortho); + cogl_matrix_orthographic (&ortho, x_1, y_1, x_2, y_2, near, far); + cogl_matrix_stack_set (projection_stack, &ortho); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +void +_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + cogl_matrix_stack_push (projection_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +void +_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + cogl_matrix_stack_pop (projection_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; +} + +void +cogl_framebuffer_get_modelview_matrix (CoglFramebuffer *framebuffer, + CoglMatrix *matrix) +{ + CoglMatrixEntry *modelview_entry = + _cogl_framebuffer_get_modelview_entry (framebuffer); + cogl_matrix_entry_get (modelview_entry, matrix); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_set_modelview_matrix (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + cogl_matrix_stack_set (modelview_stack, matrix); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_MODELVIEW; + + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_get_projection_matrix (CoglFramebuffer *framebuffer, + CoglMatrix *matrix) +{ + CoglMatrixEntry *projection_entry = + _cogl_framebuffer_get_projection_entry (framebuffer); + cogl_matrix_entry_get (projection_entry, matrix); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_set_projection_matrix (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + + /* XXX: The projection matrix isn't currently tracked in the journal + * so we need to flush all journaled primitives first... */ + _cogl_framebuffer_flush_journal (framebuffer); + + cogl_matrix_stack_set (projection_stack, matrix); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_PROJECTION; + + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_push_scissor_clip (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height) +{ + framebuffer->clip_stack = + _cogl_clip_stack_push_window_rectangle (framebuffer->clip_stack, + x, y, width, height); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +cogl_framebuffer_push_rectangle_clip (CoglFramebuffer *framebuffer, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglMatrixEntry *modelview_entry = + _cogl_framebuffer_get_modelview_entry (framebuffer); + CoglMatrixEntry *projection_entry = + _cogl_framebuffer_get_projection_entry (framebuffer); + /* XXX: It would be nicer if we stored the private viewport as a + * vec4 so we could avoid this redundant copy. */ + float viewport[] = { + framebuffer->viewport_x, + framebuffer->viewport_y, + framebuffer->viewport_width, + framebuffer->viewport_height + }; + + framebuffer->clip_stack = + _cogl_clip_stack_push_rectangle (framebuffer->clip_stack, + x_1, y_1, x_2, y_2, + modelview_entry, + projection_entry, + viewport); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2) +{ + CoglMatrixEntry *modelview_entry = + _cogl_framebuffer_get_modelview_entry (framebuffer); + CoglMatrixEntry *projection_entry = + _cogl_framebuffer_get_projection_entry (framebuffer); + /* XXX: It would be nicer if we stored the private viewport as a + * vec4 so we could avoid this redundant copy. */ + float viewport[] = { + framebuffer->viewport_x, + framebuffer->viewport_y, + framebuffer->viewport_width, + framebuffer->viewport_height + }; + + framebuffer->clip_stack = + _cogl_clip_stack_push_primitive (framebuffer->clip_stack, + primitive, + bounds_x1, bounds_y1, + bounds_x2, bounds_y2, + modelview_entry, + projection_entry, + viewport); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +cogl_framebuffer_pop_clip (CoglFramebuffer *framebuffer) +{ + framebuffer->clip_stack = _cogl_clip_stack_pop (framebuffer->clip_stack); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +_cogl_framebuffer_unref (CoglFramebuffer *framebuffer) +{ + /* The journal holds a reference to the framebuffer whenever it is + non-empty. Therefore if the journal is non-empty and we will have + exactly one reference then we know the journal is the only thing + keeping the framebuffer alive. In that case we want to flush the + journal and let the framebuffer die. It is fine at this point if + flushing the journal causes something else to take a reference to + it and it comes back to life */ + if (framebuffer->journal->entries->len > 0) + { + unsigned int ref_count = ((CoglObject *) framebuffer)->ref_count; + + /* There should be at least two references - the one we are + about to drop and the one held by the journal */ + if (ref_count < 2) + g_warning ("Inconsistent ref count on a framebuffer with journal " + "entries."); + + if (ref_count == 2) + _cogl_framebuffer_flush_journal (framebuffer); + } + + /* Chain-up */ + _cogl_object_default_unref (framebuffer); +} + +#ifdef COGL_ENABLE_DEBUG +static int +get_index (void *indices, + CoglIndicesType type, + int _index) +{ + if (!indices) + return _index; + + switch (type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + return ((uint8_t *)indices)[_index]; + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + return ((uint16_t *)indices)[_index]; + case COGL_INDICES_TYPE_UNSIGNED_INT: + return ((uint32_t *)indices)[_index]; + } + + g_return_val_if_reached (0); +} + +static void +add_line (uint32_t *line_indices, + int base, + void *user_indices, + CoglIndicesType user_indices_type, + int index0, + int index1, + int *pos) +{ + index0 = get_index (user_indices, user_indices_type, index0); + index1 = get_index (user_indices, user_indices_type, index1); + + line_indices[(*pos)++] = base + index0; + line_indices[(*pos)++] = base + index1; +} + +static int +get_line_count (CoglVerticesMode mode, int n_vertices) +{ + if (mode == COGL_VERTICES_MODE_TRIANGLES && + (n_vertices % 3) == 0) + { + return n_vertices; + } + else if (mode == COGL_VERTICES_MODE_TRIANGLE_FAN && + n_vertices >= 3) + { + return 2 * n_vertices - 3; + } + else if (mode == COGL_VERTICES_MODE_TRIANGLE_STRIP && + n_vertices >= 3) + { + return 2 * n_vertices - 3; + } + /* In the journal we are a bit sneaky and actually use GL_QUADS + * which isn't actually a valid CoglVerticesMode! */ +#ifdef HAVE_COGL_GL + else if (mode == GL_QUADS && (n_vertices % 4) == 0) + { + return n_vertices; + } +#endif + + g_return_val_if_reached (0); +} + +static CoglIndices * +get_wire_line_indices (CoglContext *ctx, + CoglVerticesMode mode, + int first_vertex, + int n_vertices_in, + CoglIndices *user_indices, + int *n_indices) +{ + int n_lines; + uint32_t *line_indices; + CoglIndexBuffer *index_buffer; + void *indices; + CoglIndicesType indices_type; + int base = first_vertex; + int pos; + int i; + CoglIndices *ret; + + if (user_indices) + { + index_buffer = cogl_indices_get_buffer (user_indices); + indices = _cogl_buffer_map (COGL_BUFFER (index_buffer), + COGL_BUFFER_ACCESS_READ, 0, + NULL); + indices_type = cogl_indices_get_type (user_indices); + } + else + { + index_buffer = NULL; + indices = NULL; + indices_type = COGL_INDICES_TYPE_UNSIGNED_BYTE; + } + + n_lines = get_line_count (mode, n_vertices_in); + + /* Note: we are using COGL_INDICES_TYPE_UNSIGNED_INT so 4 bytes per index. */ + line_indices = g_malloc (4 * n_lines * 2); + + pos = 0; + + if (mode == COGL_VERTICES_MODE_TRIANGLES && + (n_vertices_in % 3) == 0) + { + for (i = 0; i < n_vertices_in; i += 3) + { + add_line (line_indices, base, indices, indices_type, i, i+1, &pos); + add_line (line_indices, base, indices, indices_type, i+1, i+2, &pos); + add_line (line_indices, base, indices, indices_type, i+2, i, &pos); + } + } + else if (mode == COGL_VERTICES_MODE_TRIANGLE_FAN && + n_vertices_in >= 3) + { + add_line (line_indices, base, indices, indices_type, 0, 1, &pos); + add_line (line_indices, base, indices, indices_type, 1, 2, &pos); + add_line (line_indices, base, indices, indices_type, 0, 2, &pos); + + for (i = 3; i < n_vertices_in; i++) + { + add_line (line_indices, base, indices, indices_type, i - 1, i, &pos); + add_line (line_indices, base, indices, indices_type, 0, i, &pos); + } + } + else if (mode == COGL_VERTICES_MODE_TRIANGLE_STRIP && + n_vertices_in >= 3) + { + add_line (line_indices, base, indices, indices_type, 0, 1, &pos); + add_line (line_indices, base, indices, indices_type, 1, 2, &pos); + add_line (line_indices, base, indices, indices_type, 0, 2, &pos); + + for (i = 3; i < n_vertices_in; i++) + { + add_line (line_indices, base, indices, indices_type, i - 1, i, &pos); + add_line (line_indices, base, indices, indices_type, i - 2, i, &pos); + } + } + /* In the journal we are a bit sneaky and actually use GL_QUADS + * which isn't actually a valid CoglVerticesMode! */ +#ifdef HAVE_COGL_GL + else if (mode == GL_QUADS && (n_vertices_in % 4) == 0) + { + for (i = 0; i < n_vertices_in; i += 4) + { + add_line (line_indices, + base, indices, indices_type, i, i + 1, &pos); + add_line (line_indices, + base, indices, indices_type, i + 1, i + 2, &pos); + add_line (line_indices, + base, indices, indices_type, i + 2, i + 3, &pos); + add_line (line_indices, + base, indices, indices_type, i + 3, i, &pos); + } + } +#endif + + if (user_indices) + cogl_buffer_unmap (COGL_BUFFER (index_buffer)); + + *n_indices = n_lines * 2; + + ret = cogl_indices_new (ctx, + COGL_INDICES_TYPE_UNSIGNED_INT, + line_indices, + *n_indices); + + g_free (line_indices); + + return ret; +} + +static CoglBool +remove_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + cogl_pipeline_remove_layer (pipeline, layer_index); + return TRUE; +} + +static void +pipeline_destroyed_cb (CoglPipeline *weak_pipeline, void *user_data) +{ + CoglPipeline *original_pipeline = user_data; + + /* XXX: I think we probably need to provide a custom unref function for + * CoglPipeline because it's possible that we will reach this callback + * because original_pipeline is being freed which means cogl_object_unref + * will have already freed any associated user data. + * + * Setting more user data here will *probably* succeed but that may allocate + * a new user-data array which could be leaked. + * + * Potentially we could have a _cogl_object_free_user_data function so + * that a custom unref function could be written that can destroy weak + * pipeline children before removing user data. + */ + cogl_object_set_user_data (COGL_OBJECT (original_pipeline), + &wire_pipeline_key, NULL, NULL); + + cogl_object_unref (weak_pipeline); +} + +static void +draw_wireframe (CoglContext *ctx, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglIndices *indices, + CoglDrawFlags flags) +{ + CoglIndices *wire_indices; + CoglPipeline *wire_pipeline; + int n_indices; + + wire_indices = get_wire_line_indices (ctx, + mode, + first_vertex, + n_vertices, + indices, + &n_indices); + + wire_pipeline = cogl_object_get_user_data (COGL_OBJECT (pipeline), + &wire_pipeline_key); + + if (!wire_pipeline) + { + wire_pipeline = + _cogl_pipeline_weak_copy (pipeline, pipeline_destroyed_cb, NULL); + + cogl_object_set_user_data (COGL_OBJECT (pipeline), + &wire_pipeline_key, wire_pipeline, + NULL); + + /* If we have glsl then the pipeline may have an associated + * vertex program and since we'd like to see the results of the + * vertex program in the wireframe we just add a final clobber + * of the wire color leaving the rest of the state untouched. */ + if (cogl_has_feature (framebuffer->context, COGL_FEATURE_ID_GLSL)) + { + static CoglSnippet *snippet = NULL; + + /* The snippet is cached so that it will reuse the program + * from the pipeline cache if possible */ + if (snippet == NULL) + { + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, + NULL); + cogl_snippet_set_replace (snippet, + "cogl_color_out = " + "vec4 (0.0, 1.0, 0.0, 1.0);\n"); + } + + cogl_pipeline_add_snippet (wire_pipeline, snippet); + } + else + { + cogl_pipeline_foreach_layer (wire_pipeline, remove_layer_cb, NULL); + cogl_pipeline_set_color4f (wire_pipeline, 0, 1, 0, 1); + } + } + + /* temporarily disable the wireframe to avoid recursion! */ + flags |= COGL_DRAW_SKIP_DEBUG_WIREFRAME; + _cogl_framebuffer_draw_indexed_attributes ( + framebuffer, + wire_pipeline, + COGL_VERTICES_MODE_LINES, + 0, + n_indices, + wire_indices, + attributes, + n_attributes, + flags); + COGL_DEBUG_SET_FLAG (COGL_DEBUG_WIREFRAME); + + cogl_object_unref (wire_indices); +} +#endif + +/* This can be called directly by the CoglJournal to draw attributes + * skipping the implicit journal flush, the framebuffer flush and + * pipeline validation. */ +void +_cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ +#ifdef COGL_ENABLE_DEBUG + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) && + (flags & COGL_DRAW_SKIP_DEBUG_WIREFRAME) == 0) && + mode != COGL_VERTICES_MODE_LINES && + mode != COGL_VERTICES_MODE_LINE_LOOP && + mode != COGL_VERTICES_MODE_LINE_STRIP) + draw_wireframe (framebuffer->context, + framebuffer, pipeline, + mode, first_vertex, n_vertices, + attributes, n_attributes, NULL, + flags); + else +#endif + { + CoglContext *ctx = framebuffer->context; + + ctx->driver_vtable->framebuffer_draw_attributes (framebuffer, + pipeline, + mode, + first_vertex, + n_vertices, + attributes, + n_attributes, + flags); + } +} + +/* XXX: deprecated */ +void +cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes) +{ + _cogl_framebuffer_draw_attributes (framebuffer, + pipeline, + mode, + first_vertex, + n_vertices, + attributes, n_attributes, + COGL_DRAW_SKIP_LEGACY_STATE); +} + +/* XXX: deprecated */ +void +cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + ...) +{ + va_list ap; + int n_attributes; + CoglAttribute *attribute; + CoglAttribute **attributes; + int i; + + va_start (ap, n_vertices); + for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++) + ; + va_end (ap); + + attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); + + va_start (ap, n_vertices); + for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++) + attributes[i] = attribute; + va_end (ap); + + _cogl_framebuffer_draw_attributes (framebuffer, + pipeline, + mode, first_vertex, n_vertices, + attributes, n_attributes, + COGL_DRAW_SKIP_LEGACY_STATE); +} + +void +_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ +#ifdef COGL_ENABLE_DEBUG + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) && + (flags & COGL_DRAW_SKIP_DEBUG_WIREFRAME) == 0) && + mode != COGL_VERTICES_MODE_LINES && + mode != COGL_VERTICES_MODE_LINE_LOOP && + mode != COGL_VERTICES_MODE_LINE_STRIP) + draw_wireframe (framebuffer->context, + framebuffer, pipeline, + mode, first_vertex, n_vertices, + attributes, n_attributes, indices, + flags); + else +#endif + { + CoglContext *ctx = framebuffer->context; + + ctx->driver_vtable->framebuffer_draw_indexed_attributes (framebuffer, + pipeline, + mode, + first_vertex, + n_vertices, + indices, + attributes, + n_attributes, + flags); + } +} + +/* XXX: deprecated */ +void +cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes) +{ + _cogl_framebuffer_draw_indexed_attributes (framebuffer, + pipeline, + mode, first_vertex, + n_vertices, indices, + attributes, n_attributes, + COGL_DRAW_SKIP_LEGACY_STATE); +} + +/* XXX: deprecated */ +void +cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + ...) + +{ + va_list ap; + int n_attributes; + CoglAttribute **attributes; + int i; + CoglAttribute *attribute; + + va_start (ap, indices); + for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++) + ; + va_end (ap); + + attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); + + va_start (ap, indices); + for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++) + attributes[i] = attribute; + va_end (ap); + + _cogl_framebuffer_draw_indexed_attributes (framebuffer, + pipeline, + mode, + first_vertex, + n_vertices, + indices, + attributes, + n_attributes, + COGL_DRAW_SKIP_LEGACY_STATE); +} + +void +cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPrimitive *primitive) +{ + _cogl_primitive_draw (primitive, framebuffer, pipeline, + COGL_DRAW_SKIP_LEGACY_STATE); +} + +void +cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the _*_rectangle* APIs normalize their input into an array of + * _CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_framebuffer_draw_multitextured_rectangles. + */ + + rect.position = position; + rect.tex_coords = NULL; + rect.tex_coords_len = 0; + + _cogl_framebuffer_draw_multitextured_rectangles (framebuffer, + pipeline, + &rect, + 1, + TRUE); +} + +void +cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2, + float s_1, + float t_1, + float s_2, + float t_2) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + const float tex_coords[4] = {s_1, t_1, s_2, t_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the _*_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_framebuffer_draw_multitextured_rectangles. + */ + + rect.position = position; + rect.tex_coords = tex_coords; + rect.tex_coords_len = 4; + + _cogl_framebuffer_draw_multitextured_rectangles (framebuffer, + pipeline, + &rect, + 1, + TRUE); +} + +void +cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2, + const float *tex_coords, + int tex_coords_len) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the _*_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_framebuffer_draw_multitextured_rectangles. + */ + + rect.position = position; + rect.tex_coords = tex_coords; + rect.tex_coords_len = tex_coords_len; + + _cogl_framebuffer_draw_multitextured_rectangles (framebuffer, + pipeline, + &rect, + 1, + TRUE); +} + +void +cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + const float *coordinates, + unsigned int n_rectangles) +{ + CoglMultiTexturedRect *rects; + int i; + + /* XXX: All the _*_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_framebuffer_draw_multitextured_rectangles. + */ + + rects = g_alloca (n_rectangles * sizeof (CoglMultiTexturedRect)); + + for (i = 0; i < n_rectangles; i++) + { + rects[i].position = &coordinates[i * 4]; + rects[i].tex_coords = NULL; + rects[i].tex_coords_len = 0; + } + + _cogl_framebuffer_draw_multitextured_rectangles (framebuffer, + pipeline, + rects, + n_rectangles, + TRUE); +} + +void +cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + const float *coordinates, + unsigned int n_rectangles) +{ + CoglMultiTexturedRect *rects; + int i; + + /* XXX: All the _*_rectangle* APIs normalize their input into an array of + * _CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_framebuffer_draw_multitextured_rectangles. + */ + + rects = g_alloca (n_rectangles * sizeof (CoglMultiTexturedRect)); + + for (i = 0; i < n_rectangles; i++) + { + rects[i].position = &coordinates[i * 8]; + rects[i].tex_coords = &coordinates[i * 8 + 4]; + rects[i].tex_coords_len = 4; + } + + _cogl_framebuffer_draw_multitextured_rectangles (framebuffer, + pipeline, + rects, + n_rectangles, + TRUE); +} diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h new file mode 100644 index 0000000..347284f --- /dev/null +++ b/cogl/cogl-framebuffer.h @@ -0,0 +1,1818 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_FRAMEBUFFER_H +#define __COGL_FRAMEBUFFER_H + +#ifdef COGL_HAS_WIN32_SUPPORT +#include +#endif /* COGL_HAS_WIN32_SUPPORT */ + +/* We forward declare the CoglFramebuffer type here to avoid some circular + * dependency issues with the following headers. + */ +#ifdef __COGL_H_INSIDE__ +/* For the public C api we typedef interface types as void to avoid needing + * lots of casting in code and instead we will rely on runtime type checking + * for these objects. */ +typedef void CoglFramebuffer; +#else +typedef struct _CoglFramebuffer CoglFramebuffer; +#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X)) +#endif + +#include +#include +#include +#ifdef COGL_ENABLE_EXPERIMENTAL_API +#include +#include +#include +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-framebuffer + * @short_description: A common interface for manipulating framebuffers + * + * Framebuffers are a collection of buffers that can be rendered too. + * A framebuffer may be comprised of one or more color buffers, an + * optional depth buffer and an optional stencil buffer. Other + * configuration parameters are associated with framebuffers too such + * as whether the framebuffer supports multi-sampling (an anti-aliasing + * technique) or dithering. + * + * There are two kinds of framebuffer in Cogl, #CoglOnscreen + * framebuffers and #CoglOffscreen framebuffers. As the names imply + * offscreen framebuffers are for rendering something offscreen + * (perhaps to a texture which is bound as one of the color buffers). + * The exact semantics of onscreen framebuffers depends on the window + * system backend that you are using, but typically you can expect + * rendering to a #CoglOnscreen framebuffer will be immediately + * visible to the user. + * + * If you want to create a new framebuffer then you should start by + * looking at the #CoglOnscreen and #CoglOffscreen constructor + * functions, such as cogl_offscreen_new_with_texture() or + * cogl_onscreen_new(). The #CoglFramebuffer interface deals with + * all aspects that are common between those two types of framebuffer. + * + * Setup of a new CoglFramebuffer happens in two stages. There is a + * configuration stage where you specify all the options and ancillary + * buffers you want associated with your framebuffer and then when you + * are happy with the configuration you can "allocate" the framebuffer + * using cogl_framebuffer_allocate(). Technically explicitly calling + * cogl_framebuffer_allocate() is optional for convenience and the + * framebuffer will automatically be allocated when you first try to + * draw to it, but if you do the allocation manually then you can + * also catch any possible errors that may arise from your + * configuration. + */ + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_framebuffer_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_framebuffer_get_gtype (void); +#endif + +/** + * cogl_framebuffer_allocate: + * @framebuffer: A #CoglFramebuffer + * @error: A pointer to a #CoglError for returning exceptions. + * + * Explicitly allocates a configured #CoglFramebuffer allowing developers to + * check and handle any errors that might arise from an unsupported + * configuration so that fallback configurations may be tried. + * + * Many applications don't support any fallback options at least when + * they are initially developed and in that case the don't need to use this API + * since Cogl will automatically allocate a framebuffer when it first gets + * used. The disadvantage of relying on automatic allocation is that the + * program will abort with an error message if there is an error during + * automatic allocation. + * + * Return value: %TRUE if there were no error allocating the framebuffer, else %FALSE. + * Since: 1.8 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, + CoglError **error); + +/** + * cogl_framebuffer_get_width: + * @framebuffer: A #CoglFramebuffer + * + * Queries the current width of the given @framebuffer. + * + * Return value: The width of @framebuffer. + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_width (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_height: + * @framebuffer: A #CoglFramebuffer + * + * Queries the current height of the given @framebuffer. + * + * Return value: The height of @framebuffer. + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_height (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_set_viewport: + * @framebuffer: A #CoglFramebuffer + * @x: The top-left x coordinate of the viewport origin (only integers + * supported currently) + * @y: The top-left y coordinate of the viewport origin (only integers + * supported currently) + * @width: The width of the viewport (only integers supported currently) + * @height: The height of the viewport (only integers supported currently) + * + * Defines a scale and offset for everything rendered relative to the + * top-left of the destination framebuffer. + * + * By default the viewport has an origin of (0,0) and width and height + * that match the framebuffer's size. Assuming a default projection and + * modelview matrix then you could translate the contents of a window + * down and right by leaving the viewport size unchanged by moving the + * offset to (10,10). The viewport coordinates are measured in pixels. + * If you left the x and y origin as (0,0) you could scale the windows + * contents down by specify and width and height that's half the real + * size of the framebuffer. + * + * Although the function takes floating point arguments, existing + * drivers only allow the use of integer values. In the future floating + * point values will be exposed via a checkable feature. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, + float x, + float y, + float width, + float height); + +/** + * cogl_framebuffer_get_viewport_x: + * @framebuffer: A #CoglFramebuffer + * + * Queries the x coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() + * or the default value which is 0. + * + * Return value: The x coordinate of the viewport origin. + * Since: 1.8 + * Stability: unstable + */ +float +cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_viewport_y: + * @framebuffer: A #CoglFramebuffer + * + * Queries the y coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() + * or the default value which is 0. + * + * Return value: The y coordinate of the viewport origin. + * Since: 1.8 + * Stability: unstable + */ +float +cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_viewport_width: + * @framebuffer: A #CoglFramebuffer + * + * Queries the width of the viewport as set using cogl_framebuffer_set_viewport() + * or the default value which is the width of the framebuffer. + * + * Return value: The width of the viewport. + * Since: 1.8 + * Stability: unstable + */ +float +cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_viewport_height: + * @framebuffer: A #CoglFramebuffer + * + * Queries the height of the viewport as set using cogl_framebuffer_set_viewport() + * or the default value which is the height of the framebuffer. + * + * Return value: The height of the viewport. + * Since: 1.8 + * Stability: unstable + */ +float +cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_viewport4fv: + * @framebuffer: A #CoglFramebuffer + * @viewport: (out caller-allocates) (array fixed-size=4): A pointer to an + * array of 4 floats to receive the (x, y, width, height) + * components of the current viewport. + * + * Queries the x, y, width and height components of the current viewport as set + * using cogl_framebuffer_set_viewport() or the default values which are 0, 0, + * framebuffer_width and framebuffer_height. The values are written into the + * given @viewport array. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer, + float *viewport); + +/** + * cogl_framebuffer_push_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * + * Copies the current model-view matrix onto the matrix stack. The matrix + * can later be restored with cogl_framebuffer_pop_matrix(). + * + * Since: 1.10 + */ +void +cogl_framebuffer_push_matrix (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_pop_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * + * Restores the model-view matrix on the top of the matrix stack. + * + * Since: 1.10 + */ +void +cogl_framebuffer_pop_matrix (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_identity_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * + * Resets the current model-view matrix to the identity matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_identity_matrix (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_scale: + * @framebuffer: A #CoglFramebuffer pointer + * @x: Amount to scale along the x-axis + * @y: Amount to scale along the y-axis + * @z: Amount to scale along the z-axis + * + * Multiplies the current model-view matrix by one that scales the x, + * y and z axes by the given values. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_scale (CoglFramebuffer *framebuffer, + float x, + float y, + float z); + +/** + * cogl_framebuffer_translate: + * @framebuffer: A #CoglFramebuffer pointer + * @x: Distance to translate along the x-axis + * @y: Distance to translate along the y-axis + * @z: Distance to translate along the z-axis + * + * Multiplies the current model-view matrix by one that translates the + * model along all three axes according to the given values. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_translate (CoglFramebuffer *framebuffer, + float x, + float y, + float z); + +/** + * cogl_framebuffer_rotate: + * @framebuffer: A #CoglFramebuffer pointer + * @angle: Angle in degrees to rotate. + * @x: X-component of vertex to rotate around. + * @y: Y-component of vertex to rotate around. + * @z: Z-component of vertex to rotate around. + * + * Multiplies the current model-view matrix by one that rotates the + * model around the axis-vector specified by @x, @y and @z. The + * rotation follows the right-hand thumb rule so for example rotating + * by 10 degrees about the axis-vector (0, 0, 1) causes a small + * counter-clockwise rotation. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_rotate (CoglFramebuffer *framebuffer, + float angle, + float x, + float y, + float z); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * cogl_framebuffer_rotate_quaternion: + * @framebuffer: A #CoglFramebuffer pointer + * @quaternion: A #CoglQuaternion + * + * Multiplies the current model-view matrix by one that rotates + * according to the rotation described by @quaternion. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_framebuffer_rotate_quaternion (CoglFramebuffer *framebuffer, + const CoglQuaternion *quaternion); + +/** + * cogl_framebuffer_rotate_euler: + * @framebuffer: A #CoglFramebuffer pointer + * @euler: A #CoglEuler + * + * Multiplies the current model-view matrix by one that rotates + * according to the rotation described by @euler. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_framebuffer_rotate_euler (CoglFramebuffer *framebuffer, + const CoglEuler *euler); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +/** + * cogl_framebuffer_transform: + * @framebuffer: A #CoglFramebuffer pointer + * @matrix: the matrix to multiply with the current model-view + * + * Multiplies the current model-view matrix by the given matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_transform (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix); + +/** + * cogl_framebuffer_get_modelview_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * @matrix: (out): return location for the model-view matrix + * + * Stores the current model-view matrix in @matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_get_modelview_matrix (CoglFramebuffer *framebuffer, + CoglMatrix *matrix); + +/** + * cogl_framebuffer_set_modelview_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * @matrix: the new model-view matrix + * + * Sets @matrix as the new model-view matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_set_modelview_matrix (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix); + +/** + * cogl_framebuffer_perspective: + * @framebuffer: A #CoglFramebuffer pointer + * @fov_y: Vertical field of view angle in degrees. + * @aspect: The (width over height) aspect ratio for display + * @z_near: The distance to the near clipping plane (Must be positive, + * and must not be 0) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current projection matrix with a perspective matrix + * based on the provided values. + * + * You should be careful not to have to great a @z_far / @z_near + * ratio since that will reduce the effectiveness of depth testing + * since there wont be enough precision to identify the depth of + * objects near to each other. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_perspective (CoglFramebuffer *framebuffer, + float fov_y, + float aspect, + float z_near, + float z_far); + +/** + * cogl_framebuffer_frustum: + * @framebuffer: A #CoglFramebuffer pointer + * @left: X position of the left clipping plane where it + * intersects the near clipping plane + * @right: X position of the right clipping plane where it + * intersects the near clipping plane + * @bottom: Y position of the bottom clipping plane where it + * intersects the near clipping plane + * @top: Y position of the top clipping plane where it intersects + * the near clipping plane + * @z_near: The distance to the near clipping plane (Must be positive) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current projection matrix with a perspective matrix + * for a given viewing frustum defined by 4 side clip planes that + * all cross through the origin and 2 near and far clip planes. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_frustum (CoglFramebuffer *framebuffer, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far); + +/** + * cogl_framebuffer_orthographic: + * @framebuffer: A #CoglFramebuffer pointer + * @x_1: The x coordinate for the first vertical clipping plane + * @y_1: The y coordinate for the first horizontal clipping plane + * @x_2: The x coordinate for the second vertical clipping plane + * @y_2: The y coordinate for the second horizontal clipping plane + * @near: The distance to the near clipping + * plane (will be negative if the plane is + * behind the viewer) + * @far: The distance to the far clipping + * plane (will be negative if the plane is + * behind the viewer) + * + * Replaces the current projection matrix with an orthographic projection + * matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_orthographic (CoglFramebuffer *framebuffer, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far); + +/** + * cogl_framebuffer_get_projection_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * @matrix: (out): return location for the projection matrix + * + * Stores the current projection matrix in @matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_get_projection_matrix (CoglFramebuffer *framebuffer, + CoglMatrix *matrix); + +/** + * cogl_framebuffer_set_projection_matrix: + * @framebuffer: A #CoglFramebuffer pointer + * @matrix: the new projection matrix + * + * Sets @matrix as the new projection matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_set_projection_matrix (CoglFramebuffer *framebuffer, + const CoglMatrix *matrix); + +/** + * cogl_framebuffer_push_scissor_clip: + * @framebuffer: A #CoglFramebuffer pointer + * @x: left edge of the clip rectangle in window coordinates + * @y: top edge of the clip rectangle in window coordinates + * @width: width of the clip rectangle + * @height: height of the clip rectangle + * + * Specifies a rectangular clipping area for all subsequent drawing + * operations. Any drawing commands that extend outside the rectangle + * will be clipped so that only the portion inside the rectangle will + * be displayed. The rectangle dimensions are not transformed by the + * current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_framebuffer_pop_clip(). + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_push_scissor_clip (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height); + +/** + * cogl_framebuffer_push_rectangle_clip: + * @framebuffer: A #CoglFramebuffer pointer + * @x_1: x coordinate for top left corner of the clip rectangle + * @y_1: y coordinate for top left corner of the clip rectangle + * @x_2: x coordinate for bottom right corner of the clip rectangle + * @y_2: y coordinate for bottom right corner of the clip rectangle + * + * Specifies a modelview transformed rectangular clipping area for all + * subsequent drawing operations. Any drawing commands that extend + * outside the rectangle will be clipped so that only the portion + * inside the rectangle will be displayed. The rectangle dimensions + * are transformed by the current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_framebuffer_pop_clip(). + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_push_rectangle_clip (CoglFramebuffer *framebuffer, + float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_framebuffer_push_primitive_clip: + * @framebuffer: A #CoglFramebuffer pointer + * @primitive: A #CoglPrimitive describing a flat 2D shape + * @bounds_x1: x coordinate for the top-left corner of the primitives + * bounds + * @bounds_y1: y coordinate for the top-left corner of the primitives + * bounds + * @bounds_x2: x coordinate for the bottom-right corner of the + * primitives bounds. + * @bounds_y2: y coordinate for the bottom-right corner of the + * primitives bounds. + * + * Sets a new clipping area using a 2D shaped described with a + * #CoglPrimitive. The shape must not contain self overlapping + * geometry and must lie on a single 2D plane. A bounding box of the + * 2D shape in local coordinates (the same coordinates used to + * describe the shape) must be given. It is acceptable for the bounds + * to be larger than the true bounds but behaviour is undefined if the + * bounds are smaller than the true bounds. + * + * The primitive is transformed by the current model-view matrix and + * the silhouette is intersected with the previous clipping area. To + * restore the previous clipping area, call + * cogl_framebuffer_pop_clip(). + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2); + +/** + * cogl_framebuffer_pop_clip: + * @framebuffer: A #CoglFramebuffer pointer + * + * Reverts the clipping region to the state before the last call to + * cogl_framebuffer_push_scissor_clip(), cogl_framebuffer_push_rectangle_clip() + * cogl_framebuffer_push_path_clip(), or cogl_framebuffer_push_primitive_clip(). + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_pop_clip (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_red_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of red bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_red_bits (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_green_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of green bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_green_bits (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_blue_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of blue bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_blue_bits (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_alpha_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of alpha bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 1.8 + * Stability: unstable + */ +int +cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_depth_bits: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Retrieves the number of depth bits of @framebuffer + * + * Return value: the number of bits + * + * Since: 2.0 + * Stability: unstable + */ +int +cogl_framebuffer_get_depth_bits (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_dither_enabled: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Returns whether dithering has been requested for the given @framebuffer. + * See cogl_framebuffer_set_dither_enabled() for more details about dithering. + * + * This may return %TRUE even when the underlying @framebuffer + * display pipeline does not support dithering. This value only represents + * the user's request for dithering. + * + * Return value: %TRUE if dithering has been requested or %FALSE if not. + * Since: 1.8 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_set_dither_enabled: + * @framebuffer: a pointer to a #CoglFramebuffer + * @dither_enabled: %TRUE to enable dithering or %FALSE to disable + * + * Enables or disabled dithering if supported by the hardware. + * + * Dithering is a hardware dependent technique to increase the visible + * color resolution beyond what the underlying hardware supports by playing + * tricks with the colors placed into the framebuffer to give the illusion + * of other colors. (For example this can be compared to half-toning used + * by some news papers to show varying levels of grey even though their may + * only be black and white are available). + * + * If the current display pipeline for @framebuffer does not support dithering + * then this has no affect. + * + * Dithering is enabled by default. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer, + CoglBool dither_enabled); + +/** + * cogl_framebuffer_get_depth_write_enabled: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Queries whether depth buffer writing is enabled for @framebuffer. This + * can be controlled via cogl_framebuffer_set_depth_write_enabled(). + * + * Return value: %TRUE if depth writing is enabled or %FALSE if not. + * Since: 1.18 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_get_depth_write_enabled (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_set_depth_write_enabled: + * @framebuffer: a pointer to a #CoglFramebuffer + * @depth_write_enabled: %TRUE to enable depth writing or %FALSE to disable + * + * Enables or disables depth buffer writing when rendering to @framebuffer. + * If depth writing is enabled for both the framebuffer and the rendering + * pipeline, and the framebuffer has an associated depth buffer, depth + * information will be written to this buffer during rendering. + * + * Depth buffer writing is enabled by default. + * + * Since: 1.18 + * Stability: unstable + */ +void +cogl_framebuffer_set_depth_write_enabled (CoglFramebuffer *framebuffer, + CoglBool depth_write_enabled); + +/** + * cogl_framebuffer_get_color_mask: + * @framebuffer: a pointer to a #CoglFramebuffer + * + * Gets the current #CoglColorMask of which channels would be written to the + * current framebuffer. Each bit set in the mask means that the + * corresponding color would be written. + * + * Returns: A #CoglColorMask + * Since: 1.8 + * Stability: unstable + */ +CoglColorMask +cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_set_color_mask: + * @framebuffer: a pointer to a #CoglFramebuffer + * @color_mask: A #CoglColorMask of which color channels to write to + * the current framebuffer. + * + * Defines a bit mask of which color channels should be written to the + * given @framebuffer. If a bit is set in @color_mask that means that + * color will be written. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer, + CoglColorMask color_mask); + +/** + * cogl_framebuffer_set_depth_texture_enabled: + * @framebuffer: A #CoglFramebuffer + * @enabled: TRUE or FALSE + * + * If @enabled is #TRUE, the depth buffer used when rendering to @framebuffer + * is available as a texture. You can retrieve the texture with + * cogl_framebuffer_get_depth_texture(). + * + * It's possible that your GPU does not support depth textures. You + * should check the %COGL_FEATURE_ID_DEPTH_TEXTURE feature before using this + * function. + * It's not valid to call this function after the framebuffer has been + * allocated as the creation of the depth texture is done at allocation time. + * + * + * Since: 1.14 + * Stability: unstable + */ +void +cogl_framebuffer_set_depth_texture_enabled (CoglFramebuffer *framebuffer, + CoglBool enabled); + +/** + * cogl_framebuffer_get_depth_texture_enabled: + * @framebuffer: A #CoglFramebuffer + * + * Queries whether texture based depth buffer has been enabled via + * cogl_framebuffer_set_depth_texture_enabled(). + * + * Return value: %TRUE if a depth texture has been enabled, else + * %FALSE. + * + * Since: 1.14 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_get_depth_texture_enabled (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_get_depth_texture: + * @framebuffer: A #CoglFramebuffer + * + * Retrieves the depth buffer of @framebuffer as a #CoglTexture. You need to + * call cogl_framebuffer_get_depth_texture(fb, TRUE); before using this + * function. + * + * Calling this function implicitely allocates the framebuffer. + * The texture returned stays valid as long as the framebuffer stays + * valid. + * + * Returns: (transfer none): the depth texture + * + * Since: 1.14 + * Stability: unstable + */ +CoglTexture * +cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_set_samples_per_pixel: + * @framebuffer: A #CoglFramebuffer framebuffer + * @samples_per_pixel: The minimum number of samples per pixel + * + * Requires that when rendering to @framebuffer then @n point samples + * should be made per pixel which will all contribute to the final + * resolved color for that pixel. The idea is that the hardware aims + * to get quality similar to what you would get if you rendered + * everything twice as big (for 4 samples per pixel) and then scaled + * that image back down with filtering. It can effectively remove the + * jagged edges of polygons and should be more efficient than if you + * were to manually render at a higher resolution and downscale + * because the hardware is often able to take some shortcuts. For + * example the GPU may only calculate a single texture sample for all + * points of a single pixel, and for tile based architectures all the + * extra sample data (such as depth and stencil samples) may be + * handled on-chip and so avoid increased demand on system memory + * bandwidth. + * + * By default this value is usually set to 0 and that is referred to + * as "single-sample" rendering. A value of 1 or greater is referred + * to as "multisample" rendering. + * + * There are some semantic differences between single-sample + * rendering and multisampling with just 1 point sample such as it + * being redundant to use the cogl_framebuffer_resolve_samples() and + * cogl_framebuffer_resolve_samples_region() apis with single-sample + * rendering. + * + * It's recommended that + * cogl_framebuffer_resolve_samples_region() be explicitly used at the + * end of rendering to a point sample buffer to minimize the number of + * samples that get resolved. By default Cogl will implicitly resolve + * all framebuffer samples but if only a small region of a + * framebuffer has changed this can lead to redundant work being + * done. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_set_samples_per_pixel (CoglFramebuffer *framebuffer, + int samples_per_pixel); + +/** + * cogl_framebuffer_get_samples_per_pixel: + * @framebuffer: A #CoglFramebuffer framebuffer + * + * Gets the number of points that are sampled per-pixel when + * rasterizing geometry. Usually by default this will return 0 which + * means that single-sample not multisample rendering has been chosen. + * When using a GPU supporting multisample rendering it's possible to + * increase the number of samples per pixel using + * cogl_framebuffer_set_samples_per_pixel(). + * + * Calling cogl_framebuffer_get_samples_per_pixel() before the + * framebuffer has been allocated will simply return the value set + * using cogl_framebuffer_set_samples_per_pixel(). After the + * framebuffer has been allocated the value will reflect the actual + * number of samples that will be made by the GPU. + * + * Returns: The number of point samples made per pixel when + * rasterizing geometry or 0 if single-sample rendering + * has been chosen. + * + * Since: 1.10 + * Stability: unstable + */ +int +cogl_framebuffer_get_samples_per_pixel (CoglFramebuffer *framebuffer); + + +/** + * cogl_framebuffer_resolve_samples: + * @framebuffer: A #CoglFramebuffer framebuffer + * + * When point sample rendering (also known as multisample rendering) + * has been enabled via cogl_framebuffer_set_samples_per_pixel() + * then you can optionally call this function (or + * cogl_framebuffer_resolve_samples_region()) to explicitly resolve + * the point samples into values for the final color buffer. + * + * Some GPUs will implicitly resolve the point samples during + * rendering and so this function is effectively a nop, but with other + * architectures it is desirable to defer the resolve step until the + * end of the frame. + * + * Since Cogl will automatically ensure samples are resolved if the + * target color buffer is used as a source this API only needs to be + * used if explicit control is desired - perhaps because you want to + * ensure that the resolve is completed in advance to avoid later + * having to wait for the resolve to complete. + * + * If you are performing incremental updates to a framebuffer you + * should consider using cogl_framebuffer_resolve_samples_region() + * instead to avoid resolving redundant pixels. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_resolve_samples (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_resolve_samples_region: + * @framebuffer: A #CoglFramebuffer framebuffer + * @x: top-left x coordinate of region to resolve + * @y: top-left y coordinate of region to resolve + * @width: width of region to resolve + * @height: height of region to resolve + * + * When point sample rendering (also known as multisample rendering) + * has been enabled via cogl_framebuffer_set_samples_per_pixel() + * then you can optionally call this function (or + * cogl_framebuffer_resolve_samples()) to explicitly resolve the point + * samples into values for the final color buffer. + * + * Some GPUs will implicitly resolve the point samples during + * rendering and so this function is effectively a nop, but with other + * architectures it is desirable to defer the resolve step until the + * end of the frame. + * + * Use of this API is recommended if incremental, small updates to + * a framebuffer are being made because by default Cogl will + * implicitly resolve all the point samples of the framebuffer which + * can result in redundant work if only a small number of samples have + * changed. + * + * Because some GPUs implicitly resolve point samples this function + * only guarantees that at-least the region specified will be resolved + * and if you have rendered to a larger region then it's possible that + * other samples may be implicitly resolved. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height); + +/** + * cogl_framebuffer_get_context: + * @framebuffer: A #CoglFramebuffer + * + * Can be used to query the #CoglContext a given @framebuffer was + * instantiated within. This is the #CoglContext that was passed to + * cogl_onscreen_new() for example. + * + * Return value: (transfer none): The #CoglContext that the given + * @framebuffer was instantiated within. + * Since: 1.8 + * Stability: unstable + */ +CoglContext * +cogl_framebuffer_get_context (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_clear: + * @framebuffer: A #CoglFramebuffer + * @buffers: A mask of #CoglBufferBit's identifying which auxiliary + * buffers to clear + * @color: The color to clear the color buffer too if specified in + * @buffers. + * + * Clears all the auxiliary buffers identified in the @buffers mask, and if + * that includes the color buffer then the specified @color is used. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + const CoglColor *color); + +/** + * cogl_framebuffer_clear4f: + * @framebuffer: A #CoglFramebuffer + * @buffers: A mask of #CoglBufferBit's identifying which auxiliary + * buffers to clear + * @red: The red component of color to clear the color buffer too if + * specified in @buffers. + * @green: The green component of color to clear the color buffer too if + * specified in @buffers. + * @blue: The blue component of color to clear the color buffer too if + * specified in @buffers. + * @alpha: The alpha component of color to clear the color buffer too if + * specified in @buffers. + * + * Clears all the auxiliary buffers identified in the @buffers mask, and if + * that includes the color buffer then the specified @color is used. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha); + +/** + * cogl_framebuffer_draw_primitive: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @primitive: A #CoglPrimitive geometry object + * + * Draws the given @primitive geometry to the specified destination + * @framebuffer using the graphics processing state described by @pipeline. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D + * are associated with layers of the given @pipeline. + * + * This api doesn't support any of the legacy global state options such + * as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or + * cogl_program_use() + * + * Stability: unstable + * Since: 1.10 + * Deprecated: 1.16: Use #CoglPrimitives and + * cogl_primitive_draw() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_draw) +void +cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPrimitive *primitive); + +/** + * cogl_framebuffer_vdraw_attributes: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @mode: The #CoglVerticesMode defining the topology of vertices + * @first_vertex: The vertex offset within the given attributes to draw from + * @n_vertices: The number of vertices to draw from the given attributes + * @...: A set of vertex #CoglAttributes defining vertex geometry + * + * First defines a geometry primitive by grouping a set of vertex attributes; + * specifying a @first_vertex; a number of vertices (@n_vertices) and + * specifying what kind of topology the vertices have via @mode. + * + * Then the function draws the given @primitive geometry to the specified + * destination @framebuffer using the graphics processing pipeline described by + * @pipeline. + * + * The list of #CoglAttributes define the attributes of the vertices to + * be drawn, such as positions, colors and normals and should be %NULL + * terminated. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D + * are associated with layers of the given @pipeline. + * + * Stability: unstable + * Since: 1.10 + * Deprecated: 1.16: Use #CoglPrimitives and + * cogl_primitive_draw() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_draw) +void +cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + ...) COGL_GNUC_NULL_TERMINATED; + +/** + * cogl_framebuffer_draw_attributes: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @mode: The #CoglVerticesMode defining the topology of vertices + * @first_vertex: The vertex offset within the given attributes to draw from + * @n_vertices: The number of vertices to draw from the given attributes + * @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex + * geometry + * @n_attributes: The number of attributes in the @attributes array. + * + * First defines a geometry primitive by grouping a set of vertex @attributes; + * specifying a @first_vertex; a number of vertices (@n_vertices) and + * specifying what kind of topology the vertices have via @mode. + * + * Then the function draws the given @primitive geometry to the specified + * destination @framebuffer using the graphics processing pipeline described by + * @pipeline. + * + * The list of #CoglAttributes define the attributes of the vertices to + * be drawn, such as positions, colors and normals and the number of attributes + * is given as @n_attributes. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D + * are associated with layers of the given @pipeline. + * + * This api doesn't support any of the legacy global state options such + * as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or + * cogl_program_use() + * + * Stability: unstable + * Since: 1.10 + * Deprecated: 1.16: Use #CoglPrimitives and + * cogl_primitive_draw() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_draw) +void +cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes); + +/** + * cogl_framebuffer_vdraw_indexed_attributes: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @mode: The #CoglVerticesMode defining the topology of vertices + * @first_vertex: The vertex offset within the given attributes to draw from + * @n_vertices: The number of vertices to draw from the given attributes + * @indices: The array of indices used by the GPU to lookup attribute + * data for each vertex. + * @...: A set of vertex #CoglAttributes defining vertex geometry + * + * Behaves the same as cogl_framebuffer_vdraw_attributes() except that + * instead of reading vertex data sequentially from the specified + * attributes the @indices provide an indirection for how the data + * should be indexed allowing a random access order to be + * specified. + * + * For example an indices array of [0, 1, 2, 0, 2, 3] could be used + * used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES + + * @n_vertices = 6) but only provide attribute data for the 4 corners + * of a rectangle. When the GPU needs to read in each of the 6 + * vertices it will read the @indices array for each vertex in + * sequence and use the index to look up the vertex attribute data. So + * here you can see that first and fourth vertex will point to the + * same data and third and fifth vertex will also point to shared + * data. + * + * Drawing with indices can be a good way of minimizing the size of a + * mesh by allowing you to avoid data for duplicate vertices because + * multiple entries in the index array can refer back to a single + * shared vertex. + * + * The @indices array must be at least as long as @first_vertex + * + @n_vertices otherwise the GPU will overrun the indices array when + * looking up vertex data. + * + * Since it's very common to want to draw a run of rectangles using + * indices to avoid duplicating vertex data you can use + * cogl_get_rectangle_indices() to get a set of indices that can be + * shared. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or + * #CoglTexture3D are associated with layers of the given @pipeline. + * + * This api doesn't support any of the legacy global state + * options such as cogl_set_depth_test_enabled(), + * cogl_set_backface_culling_enabled() or cogl_program_use() + * + * Stability: unstable + * Since: 1.10 + * Deprecated: 1.16: Use #CoglPrimitives and + * cogl_primitive_draw() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_draw) +void +cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + ...) COGL_GNUC_NULL_TERMINATED; + +/** + * cogl_framebuffer_draw_indexed_attributes: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @mode: The #CoglVerticesMode defining the topology of vertices + * @first_vertex: The vertex offset within the given attributes to draw from + * @n_vertices: The number of vertices to draw from the given attributes + * @indices: The array of indices used by the GPU to lookup attribute + * data for each vertex. + * @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex + * geometry + * @n_attributes: The number of attributes in the @attributes array. + * + * Behaves the same as cogl_framebuffer_draw_attributes() except that + * instead of reading vertex data sequentially from the specified + * @attributes the @indices provide an indirection for how the data + * should be indexed allowing a random access order to be + * specified. + * + * For example an indices array of [0, 1, 2, 0, 2, 3] could be used + * used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES + + * @n_vertices = 6) but only provide attribute data for the 4 corners + * of a rectangle. When the GPU needs to read in each of the 6 + * vertices it will read the @indices array for each vertex in + * sequence and use the index to look up the vertex attribute data. So + * here you can see that first and fourth vertex will point to the + * same data and third and fifth vertex will also point to shared + * data. + * + * Drawing with indices can be a good way of minimizing the size of a + * mesh by allowing you to avoid data for duplicate vertices because + * multiple entries in the index array can refer back to a single + * shared vertex. + * + * The @indices array must be at least as long as @first_vertex + * + @n_vertices otherwise the GPU will overrun the indices array when + * looking up vertex data. + * + * Since it's very common to want to draw a run of rectangles using + * indices to avoid duplicating vertex data you can use + * cogl_get_rectangle_indices() to get a set of indices that can be + * shared. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or + * #CoglTexture3D are associated with layers of the given @pipeline. + * + * This api doesn't support any of the legacy global state + * options such as cogl_set_depth_test_enabled(), + * cogl_set_backface_culling_enabled() or cogl_program_use() + * + * Stability: unstable + * Since: 1.10 + * Deprecated: 1.16: Use #CoglPrimitives and + * cogl_primitive_draw() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_draw) +void +cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes); + +/** + * cogl_framebuffer_draw_rectangle: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @x_1: X coordinate of the top-left corner + * @y_1: Y coordinate of the top-left corner + * @x_2: X coordinate of the bottom-right corner + * @y_2: Y coordinate of the bottom-right corner + * + * Draws a rectangle to @framebuffer with the given @pipeline state + * and with the top left corner positioned at (@x_1, @y_1) and the + * bottom right corner positioned at (@x_2, @y_2). + * + * The position is the position before the rectangle has been + * transformed by the model-view matrix and the projection + * matrix. + * + * If you want to describe a rectangle with a texture mapped on + * it then you can use + * cogl_framebuffer_draw_textured_rectangle(). + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_framebuffer_draw_textured_rectangle: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @x_1: x coordinate upper left on screen. + * @y_1: y coordinate upper left on screen. + * @x_2: x coordinate lower right on screen. + * @y_2: y coordinate lower right on screen. + * @s_1: S texture coordinate of the top-left coorner + * @t_1: T texture coordinate of the top-left coorner + * @s_2: S texture coordinate of the bottom-right coorner + * @t_2: T texture coordinate of the bottom-right coorner + * + * Draws a textured rectangle to @framebuffer using the given + * @pipeline state with the top left corner positioned at (@x_1, @y_1) + * and the bottom right corner positioned at (@x_2, @y_2). The top + * left corner will have texture coordinates of (@s_1, @t_1) and the + * bottom right corner will have texture coordinates of (@s_2, @t_2). + * + * The position is the position before the rectangle has been + * transformed by the model-view matrix and the projection + * matrix. + * + * This is a high level drawing api that can handle any kind of + * #CoglMetaTexture texture such as #CoglTexture2DSliced textures + * which may internally be comprised of multiple low-level textures. + * This is unlike low-level drawing apis such as cogl_primitive_draw() + * which only support low level texture types that are directly + * supported by GPUs such as #CoglTexture2D. + * + * The given texture coordinates will only be used for the first + * texture layer of the pipeline and if your pipeline has more than + * one layer then all other layers will have default texture + * coordinates of @s_1=0.0 @t_1=0.0 @s_2=1.0 @t_2=1.0 + * + * The given texture coordinates should always be normalized such that + * (0, 0) corresponds to the top left and (1, 1) corresponds to the + * bottom right. To map an entire texture across the rectangle pass + * in @s_1=0, @t_1=0, @s_2=1, @t_2=1. + * + * Even if you have associated a #CoglTextureRectangle texture + * with one of your @pipeline layers which normally implies working + * with non-normalized texture coordinates this api should still be + * passed normalized texture coordinates. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2, + float s_1, + float t_1, + float s_2, + float t_2); + +/** + * cogl_framebuffer_draw_multitextured_rectangle: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @x_1: x coordinate upper left on screen. + * @y_1: y coordinate upper left on screen. + * @x_2: x coordinate lower right on screen. + * @y_2: y coordinate lower right on screen. + * @tex_coords: (in) (array) (transfer none): An array containing groups of + * 4 float values: [s_1, t_1, s_2, t_2] that are interpreted as two texture + * coordinates; one for the top left texel, and one for the bottom right + * texel. Each value should be between 0.0 and 1.0, where the coordinate + * (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the + * bottom right. + * @tex_coords_len: The length of the @tex_coords array. (For one layer + * and one group of texture coordinates, this would be 4) + * + * Draws a textured rectangle to @framebuffer with the given @pipeline + * state with the top left corner positioned at (@x_1, @y_1) and the + * bottom right corner positioned at (@x_2, @y_2). As a pipeline may + * contain multiple texture layers this interface lets you supply + * texture coordinates for each layer of the pipeline. + * + * The position is the position before the rectangle has been + * transformed by the model-view matrix and the projection + * matrix. + * + * This is a high level drawing api that can handle any kind of + * #CoglMetaTexture texture for the first layer such as + * #CoglTexture2DSliced textures which may internally be comprised of + * multiple low-level textures. This is unlike low-level drawing apis + * such as cogl_primitive_draw() which only support low level texture + * types that are directly supported by GPUs such as #CoglTexture2D. + * + * This api can not currently handle multiple high-level meta + * texture layers. The first layer may be a high level meta texture + * such as #CoglTexture2DSliced but all other layers much be low + * level textures such as #CoglTexture2D and additionally they + * should be textures that can be sampled using normalized coordinates + * (so not #CoglTextureRectangle textures). + * + * The top left texture coordinate for layer 0 of any pipeline will be + * (tex_coords[0], tex_coords[1]) and the bottom right coordinate will + * be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 + * would be (tex_coords[4], tex_coords[5]) (tex_coords[6], + * tex_coords[7]) and so on... + * + * The given texture coordinates should always be normalized such that + * (0, 0) corresponds to the top left and (1, 1) corresponds to the + * bottom right. To map an entire texture across the rectangle pass + * in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, + * tex_coords[3]=1. + * + * Even if you have associated a #CoglTextureRectangle texture + * which normally implies working with non-normalized texture + * coordinates this api should still be passed normalized texture + * coordinates. + * + * The first pair of coordinates are for the first layer (with the + * smallest layer index) and if you supply less texture coordinates + * than there are layers in the current source material then default + * texture coordinates (0.0, 0.0, 1.0, 1.0) are generated. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_draw_multitextured_rectangle (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2, + const float *tex_coords, + int tex_coords_len); + +/** + * cogl_framebuffer_draw_rectangles: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @coordinates: (in) (array) (transfer none): an array of coordinates + * containing groups of 4 float values: [x_1, y_1, x_2, y_2] that are + * interpreted as two position coordinates; one for the top left of + * the rectangle (x1, y1), and one for the bottom right of the + * rectangle (x2, y2). + * @n_rectangles: number of rectangles defined in @coordinates. + * + * Draws a series of rectangles to @framebuffer with the given + * @pipeline state in the same way that + * cogl_framebuffer_draw_rectangle() does. + * + * The top left corner of the first rectangle is positioned at + * (coordinates[0], coordinates[1]) and the bottom right corner is + * positioned at (coordinates[2], coordinates[3]). The positions for + * the second rectangle are (coordinates[4], coordinates[5]) and + * (coordinates[6], coordinates[7]) and so on... + * + * The position is the position before the rectangle has been + * transformed by the model-view matrix and the projection + * matrix. + * + * As a general rule for better performance its recommended to use + * this this API instead of calling + * cogl_framebuffer_draw_textured_rectangle() separately for multiple + * rectangles if all of the rectangles will be drawn together with the + * same @pipeline state. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + const float *coordinates, + unsigned int n_rectangles); + +/** + * cogl_framebuffer_draw_textured_rectangles: + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * @coordinates: (in) (array) (transfer none): an array containing + * groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2] + * that have the same meaning as the arguments for + * cogl_framebuffer_draw_textured_rectangle(). + * @n_rectangles: number of rectangles to @coordinates to draw + * + * Draws a series of rectangles to @framebuffer with the given + * @pipeline state in the same way that + * cogl_framebuffer_draw_textured_rectangle() does. + * + * The position is the position before the rectangle has been + * transformed by the model-view matrix and the projection + * matrix. + * + * This is a high level drawing api that can handle any kind of + * #CoglMetaTexture texture such as #CoglTexture2DSliced textures + * which may internally be comprised of multiple low-level textures. + * This is unlike low-level drawing apis such as cogl_primitive_draw() + * which only support low level texture types that are directly + * supported by GPUs such as #CoglTexture2D. + * + * The top left corner of the first rectangle is positioned at + * (coordinates[0], coordinates[1]) and the bottom right corner is + * positioned at (coordinates[2], coordinates[3]). The top left + * texture coordinate is (coordinates[4], coordinates[5]) and the + * bottom right texture coordinate is (coordinates[6], + * coordinates[7]). The coordinates for subsequent rectangles + * are defined similarly by the subsequent coordinates. + * + * As a general rule for better performance its recommended to use + * this this API instead of calling + * cogl_framebuffer_draw_textured_rectangle() separately for multiple + * rectangles if all of the rectangles will be drawn together with the + * same @pipeline state. + * + * The given texture coordinates should always be normalized such that + * (0, 0) corresponds to the top left and (1, 1) corresponds to the + * bottom right. To map an entire texture across the rectangle pass + * in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, + * tex_coords[3]=1. + * + * Even if you have associated a #CoglTextureRectangle texture + * which normally implies working with non-normalized texture + * coordinates this api should still be passed normalized texture + * coordinates. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + const float *coordinates, + unsigned int n_rectangles); + +/* XXX: Should we take an n_buffers + buffer id array instead of using + * the CoglBufferBits type which doesn't seem future proof? */ +/** + * cogl_framebuffer_discard_buffers: + * @framebuffer: A #CoglFramebuffer + * @buffers: A #CoglBufferBit mask of which ancillary buffers you want + * to discard. + * + * Declares that the specified @buffers no longer need to be referenced + * by any further rendering commands. This can be an important + * optimization to avoid subsequent frames of rendering depending on + * the results of a previous frame. + * + * For example; some tile-based rendering GPUs are able to avoid allocating and + * accessing system memory for the depth and stencil buffer so long as these + * buffers are not required as input for subsequent frames and that can save a + * significant amount of memory bandwidth used to save and restore their + * contents to system memory between frames. + * + * It is currently considered an error to try and explicitly discard the color + * buffer by passing %COGL_BUFFER_BIT_COLOR. This is because the color buffer is + * already implicitly discard when you finish rendering to a #CoglOnscreen + * framebuffer, and it's not meaningful to try and discard the color buffer of + * a #CoglOffscreen framebuffer since they are single-buffered. + * + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers); + +/** + * cogl_framebuffer_finish: + * @framebuffer: A #CoglFramebuffer pointer + * + * This blocks the CPU until all pending rendering associated with the + * specified framebuffer has completed. It's very rare that developers should + * ever need this level of synchronization with the GPU and should never be + * used unless you clearly understand why you need to explicitly force + * synchronization. + * + * One example might be for benchmarking purposes to be sure timing + * measurements reflect the time that the GPU is busy for not just the time it + * takes to queue rendering commands. + * + * Stability: unstable + * Since: 1.10 + */ +void +cogl_framebuffer_finish (CoglFramebuffer *framebuffer); + +/** + * cogl_framebuffer_read_pixels_into_bitmap: + * @framebuffer: A #CoglFramebuffer + * @x: The x position to read from + * @y: The y position to read from + * @source: Identifies which auxillary buffer you want to read + * (only COGL_READ_PIXELS_COLOR_BUFFER supported currently) + * @bitmap: The bitmap to store the results in. + * + * This reads a rectangle of pixels from the given framebuffer where + * position (0, 0) is the top left. The pixel at (x, y) is the first + * read, and a rectangle of pixels with the same size as the bitmap is + * read right and downwards from that point. + * + * Currently Cogl assumes that the framebuffer is in a premultiplied + * format so if the format of @bitmap is non-premultiplied it will + * convert it. To read the pixel values without any conversion you + * should either specify a format that doesn't use an alpha channel or + * use one of the formats ending in PRE. + * + * Return value: %TRUE if the read succeeded or %FALSE otherwise. The + * function is only likely to fail if the bitmap points to a pixel + * buffer and it could not be mapped. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap); + +/** + * cogl_framebuffer_read_pixels: + * @framebuffer: A #CoglFramebuffer + * @x: The x position to read from + * @y: The y position to read from + * @width: The width of the region of rectangles to read + * @height: The height of the region of rectangles to read + * @format: The pixel format to store the data in + * @pixels: The address of the buffer to store the data in + * + * This is a convenience wrapper around + * cogl_framebuffer_read_pixels_into_bitmap() which allocates a + * temporary #CoglBitmap to read pixel data directly into the given + * buffer. The rowstride of the buffer is assumed to be the width of + * the region times the bytes per pixel of the format. The source for + * the data is always taken from the color buffer. If you want to use + * any other rowstride or source, please use the + * cogl_framebuffer_read_pixels_into_bitmap() function directly. + * + * The implementation of the function looks like this: + * + * |[ + * bitmap = cogl_bitmap_new_for_data (context, + * width, height, + * format, + * /* rowstride */ + * bpp * width, + * pixels); + * cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + * x, y, + * COGL_READ_PIXELS_COLOR_BUFFER, + * bitmap); + * cogl_object_unref (bitmap); + * ]| + * + * Return value: %TRUE if the read succeeded or %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height, + CoglPixelFormat format, + uint8_t *pixels); + +/** + * cogl_get_draw_framebuffer: + * + * Gets the current #CoglFramebuffer as set using + * cogl_push_framebuffer() + * + * Return value: (transfer none): The current #CoglFramebuffer + * Stability: unstable + * Since: 1.8 + */ +CoglFramebuffer * +cogl_get_draw_framebuffer (void); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +/* XXX: Note these are defined outside the COGL_ENABLE_EXPERIMENTAL_API guard since + * otherwise the glib-mkenums stuff will get upset. */ + +uint32_t +cogl_framebuffer_error_quark (void); + +/** + * COGL_FRAMEBUFFER_ERROR: + * + * An error domain for reporting #CoglFramebuffer exceptions + */ +#define COGL_FRAMEBUFFER_ERROR (cogl_framebuffer_error_quark ()) + +typedef enum { /*< prefix=COGL_FRAMEBUFFER_ERROR >*/ + COGL_FRAMEBUFFER_ERROR_ALLOCATE +} CoglFramebufferError; + +/** + * cogl_is_framebuffer: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglFramebuffer. + * + * Return value: %TRUE if the object references a #CoglFramebuffer + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_framebuffer (void *object); + +COGL_END_DECLS + +#endif /* __COGL_FRAMEBUFFER_H */ diff --git a/cogl/cogl-gl-header.h.in b/cogl/cogl-gl-header.h.in new file mode 100644 index 0000000..0696dcf --- /dev/null +++ b/cogl/cogl-gl-header.h.in @@ -0,0 +1,46 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(COGL_COMPILATION) +#error "cogl-gl-header.h should only be included when compiling Cogl" +#endif + +#ifndef __COGL_GL_HEADER_H__ +#define __COGL_GL_HEADER_H__ + +#include "cogl-defines.h" + +@COGL_GL_HEADER_INCLUDES@ + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#endif /* __COGL_GL_HEADER_H__ */ diff --git a/cogl/cogl-gl-header.h.win32 b/cogl/cogl-gl-header.h.win32 new file mode 100644 index 0000000..67799a6 --- /dev/null +++ b/cogl/cogl-gl-header.h.win32 @@ -0,0 +1,48 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(COGL_COMPILATION) +#error "cogl-gl-header.h should only be included when compiling Cogl" +#endif + +#ifndef __COGL_GL_HEADER_H__ +#define __COGL_GL_HEADER_H__ + +#include "cogl-defines.h" + +#include +#include +#include + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif + +#endif /* __COGL_GL_HEADER_H__ */ diff --git a/cogl/cogl-gles2-context-private.h b/cogl/cogl-gles2-context-private.h new file mode 100644 index 0000000..805b064 --- /dev/null +++ b/cogl/cogl-gles2-context-private.h @@ -0,0 +1,201 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Collabora Ltd. + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Tomeu Vizoso + * Robert Bragg + * + */ + +#ifndef __COGL_GLES2_CONTEXT_PRIVATE_H +#define __COGL_GLES2_CONTEXT_PRIVATE_H + +#include + +#include "cogl-object-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-list.h" + +typedef struct _CoglGLES2Offscreen +{ + CoglList link; + CoglOffscreen *original_offscreen; + CoglGLFramebuffer gl_framebuffer; +} CoglGLES2Offscreen; + +typedef struct +{ + /* GL's ID for the shader */ + GLuint object_id; + /* Shader type */ + GLenum type; + + /* Number of references to this shader. The shader will have one + * reference when it is created. This reference will be removed when + * glDeleteShader is called. An additional reference will be taken + * whenever the shader is attached to a program. This is necessary + * to correctly detect when a shader is destroyed because + * glDeleteShader doesn't actually delete the object if it is + * attached to a program */ + int ref_count; + + /* Set once this object has had glDeleteShader called on it. We need + * to keep track of this so we don't deref the data twice if the + * application calls glDeleteShader multiple times */ + CoglBool deleted; +} CoglGLES2ShaderData; + +typedef enum +{ + COGL_GLES2_FLIP_STATE_UNKNOWN, + COGL_GLES2_FLIP_STATE_NORMAL, + COGL_GLES2_FLIP_STATE_FLIPPED +} CoglGLES2FlipState; + +typedef struct +{ + /* GL's ID for the program */ + GLuint object_id; + + /* List of shaders attached to this program */ + GList *attached_shaders; + + /* Reference count. There can be up to two references. One of these + * will exist between glCreateProgram and glDeleteShader, the other + * will exist while the program is made current. This is necessary + * to correctly detect when the program is deleted because + * glDeleteShader will delay the deletion if the program is + * current */ + int ref_count; + + /* Set once this object has had glDeleteProgram called on it. We need + * to keep track of this so we don't deref the data twice if the + * application calls glDeleteProgram multiple times */ + CoglBool deleted; + + GLuint flip_vector_location; + + /* A cache of what value we've put in the flip vector uniform so + * that we don't flush unless it's changed */ + CoglGLES2FlipState flip_vector_state; + + CoglGLES2Context *context; +} CoglGLES2ProgramData; + +/* State tracked for each texture unit */ +typedef struct +{ + /* The currently bound texture for the GL_TEXTURE_2D */ + GLuint current_texture_2d; +} CoglGLES2TextureUnitData; + +/* State tracked for each texture object */ +typedef struct +{ + /* GL's ID for this object */ + GLuint object_id; + + GLenum target; + + /* The details for texture when it has a 2D target */ + int width, height; + GLenum format; +} CoglGLES2TextureObjectData; + +struct _CoglGLES2Context +{ + CoglObject _parent; + + CoglContext *context; + + /* This is set to FALSE until the first time the GLES2 context is + * bound to something. We need to keep track of this so we can set + * the viewport and scissor the first time it is bound. */ + CoglBool has_been_bound; + + CoglFramebuffer *read_buffer; + CoglGLES2Offscreen *gles2_read_buffer; + CoglFramebuffer *write_buffer; + CoglGLES2Offscreen *gles2_write_buffer; + + GLuint current_fbo_handle; + + CoglList foreign_offscreens; + + CoglGLES2Vtable *vtable; + + /* Hash table mapping GL's IDs for shaders and objects to ShaderData + * and ProgramData so that we can maintain extra data for these + * objects. Although technically the IDs will end up global across + * all GLES2 contexts because they will all be in the same share + * list, we don't really want to expose this outside of the Cogl API + * so we will assume it is undefined behaviour if an application + * relies on this. */ + GHashTable *shader_map; + GHashTable *program_map; + + /* Currently in use program. We need to keep track of this so that + * we can keep a reference to the data for the program while it is + * current */ + CoglGLES2ProgramData *current_program; + + /* Whether the currently bound framebuffer needs flipping. This is + * used to check for changes so that we can dirty the following + * state flags */ + CoglGLES2FlipState current_flip_state; + + /* The following state is tracked separately from the GL context + * because we need to modify it depending on whether we are flipping + * the geometry. */ + CoglBool viewport_dirty; + int viewport[4]; + CoglBool scissor_dirty; + int scissor[4]; + CoglBool front_face_dirty; + GLenum front_face; + + /* We need to keep track of the pack alignment so we can flip the + * results of glReadPixels read from a CoglOffscreen */ + int pack_alignment; + + /* A hash table of CoglGLES2TextureObjects indexed by the texture + * object ID so that we can track some state */ + GHashTable *texture_object_map; + + /* Array of CoglGLES2TextureUnits to keep track of state for each + * texture unit */ + GArray *texture_units; + + /* The currently active texture unit indexed from 0 (not from + * GL_TEXTURE0) */ + int current_texture_unit; + + void *winsys; +}; + +#endif /* __COGL_GLES2_CONTEXT_PRIVATE_H */ diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c new file mode 100644 index 0000000..33c4387 --- /dev/null +++ b/cogl/cogl-gles2-context.c @@ -0,0 +1,1966 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Collabora Ltd. + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Tomeu Vizoso + * Robert Bragg + * Neil Roberts + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-gles2.h" +#include "cogl-gles2-context-private.h" + +#include "cogl-context-private.h" +#include "cogl-display-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-framebuffer-gl-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-renderer-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-texture-2d-gl.h" +#include "cogl-texture-2d-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-error-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_gles2_context_free (CoglGLES2Context *gles2_context); + +COGL_OBJECT_DEFINE (GLES2Context, gles2_context); +COGL_GTYPE_DEFINE_CLASS (GLES2Context, gles2_context); + +static CoglGLES2Context *current_gles2_context; + +static CoglUserDataKey offscreen_wrapper_key; + +/* The application's main function is renamed to this so that we can + * provide an alternative main function */ +#define MAIN_WRAPPER_REPLACEMENT_NAME "_c31" +/* This uniform is used to flip the rendering or not depending on + * whether we are rendering to an offscreen buffer or not */ +#define MAIN_WRAPPER_FLIP_UNIFORM "_cogl_flip_vector" +/* These comments are used to delimit the added wrapper snippet so + * that we can remove it again when the shader source is requested via + * glGetShaderSource */ +#define MAIN_WRAPPER_BEGIN "/*_COGL_WRAPPER_BEGIN*/" +#define MAIN_WRAPPER_END "/*_COGL_WRAPPER_END*/" + +/* This wrapper function around 'main' is appended to every vertex shader + * so that we can add some extra code to flip the rendering when + * rendering to an offscreen buffer */ +static const char +main_wrapper_function[] = + MAIN_WRAPPER_BEGIN "\n" + "uniform vec4 " MAIN_WRAPPER_FLIP_UNIFORM ";\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " " MAIN_WRAPPER_REPLACEMENT_NAME " ();\n" + " gl_Position *= " MAIN_WRAPPER_FLIP_UNIFORM ";\n" + "}\n" + MAIN_WRAPPER_END; + +enum { + RESTORE_FB_NONE, + RESTORE_FB_FROM_OFFSCREEN, + RESTORE_FB_FROM_ONSCREEN, +}; + +uint32_t +_cogl_gles2_context_error_quark (void) +{ + return g_quark_from_static_string ("cogl-gles2-context-error-quark"); +} + +static void +shader_data_unref (CoglGLES2Context *context, + CoglGLES2ShaderData *shader_data) +{ + if (--shader_data->ref_count < 1) + /* Removing the hash table entry should also destroy the data */ + g_hash_table_remove (context->shader_map, + GINT_TO_POINTER (shader_data->object_id)); +} + +static void +program_data_unref (CoglGLES2ProgramData *program_data) +{ + if (--program_data->ref_count < 1) + /* Removing the hash table entry should also destroy the data */ + g_hash_table_remove (program_data->context->program_map, + GINT_TO_POINTER (program_data->object_id)); +} + +static void +detach_shader (CoglGLES2ProgramData *program_data, + CoglGLES2ShaderData *shader_data) +{ + GList *l; + + for (l = program_data->attached_shaders; l; l = l->next) + { + if (l->data == shader_data) + { + shader_data_unref (program_data->context, shader_data); + program_data->attached_shaders = + g_list_delete_link (program_data->attached_shaders, l); + break; + } + } +} + +static CoglBool +is_symbol_character (char ch) +{ + return g_ascii_isalnum (ch) || ch == '_'; +} + +static void +replace_token (char *string, + const char *token, + const char *replacement, + int length) +{ + char *token_pos; + char *last_pos = string; + char *end = string + length; + int token_length = strlen (token); + + /* NOTE: this assumes token and replacement are the same length */ + + while ((token_pos = _cogl_util_memmem (last_pos, + end - last_pos, + token, + token_length))) + { + /* Make sure this isn't in the middle of some longer token */ + if ((token_pos <= string || + !is_symbol_character (token_pos[-1])) && + (token_pos + token_length == end || + !is_symbol_character (token_pos[token_length]))) + memcpy (token_pos, replacement, token_length); + + last_pos = token_pos + token_length; + } +} + +static void +update_current_flip_state (CoglGLES2Context *gles2_ctx) +{ + CoglGLES2FlipState new_flip_state; + + if (gles2_ctx->current_fbo_handle == 0 && + cogl_is_offscreen (gles2_ctx->write_buffer)) + new_flip_state = COGL_GLES2_FLIP_STATE_FLIPPED; + else + new_flip_state = COGL_GLES2_FLIP_STATE_NORMAL; + + /* If the flip state has changed then we need to reflush all of the + * dependent state */ + if (new_flip_state != gles2_ctx->current_flip_state) + { + gles2_ctx->viewport_dirty = TRUE; + gles2_ctx->scissor_dirty = TRUE; + gles2_ctx->front_face_dirty = TRUE; + gles2_ctx->current_flip_state = new_flip_state; + } +} + +static GLuint +get_current_texture_2d_object (CoglGLES2Context *gles2_ctx) +{ + return g_array_index (gles2_ctx->texture_units, + CoglGLES2TextureUnitData, + gles2_ctx->current_texture_unit).current_texture_2d; +} + +static void +set_texture_object_data (CoglGLES2Context *gles2_ctx, + GLenum target, + GLint level, + GLenum internal_format, + GLsizei width, + GLsizei height) +{ + GLuint texture_id = get_current_texture_2d_object (gles2_ctx); + CoglGLES2TextureObjectData *texture_object; + + /* We want to keep track of all texture objects where the data is + * created by this context so that we can delete them later */ + texture_object = g_hash_table_lookup (gles2_ctx->texture_object_map, + GUINT_TO_POINTER (texture_id)); + if (texture_object == NULL) + { + texture_object = g_slice_new0 (CoglGLES2TextureObjectData); + texture_object->object_id = texture_id; + + g_hash_table_insert (gles2_ctx->texture_object_map, + GUINT_TO_POINTER (texture_id), + texture_object); + } + + switch (target) + { + case GL_TEXTURE_2D: + texture_object->target = GL_TEXTURE_2D; + + /* We want to keep track of the dimensions of any texture object + * setting the GL_TEXTURE_2D target */ + if (level == 0) + { + texture_object->width = width; + texture_object->height = height; + texture_object->format = internal_format; + } + break; + + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + texture_object->target = GL_TEXTURE_CUBE_MAP; + break; + } +} + +static void +copy_flipped_texture (CoglGLES2Context *gles2_ctx, + int level, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + GLuint tex_id = get_current_texture_2d_object (gles2_ctx); + CoglGLES2TextureObjectData *tex_object_data; + CoglContext *ctx; + const CoglWinsysVtable *winsys; + CoglTexture2D *dst_texture; + CoglPixelFormat internal_format; + + tex_object_data = g_hash_table_lookup (gles2_ctx->texture_object_map, + GUINT_TO_POINTER (tex_id)); + + /* We can't do anything if the application hasn't set a level 0 + * image on this texture object */ + if (tex_object_data == NULL || + tex_object_data->target != GL_TEXTURE_2D || + tex_object_data->width <= 0 || + tex_object_data->height <= 0) + return; + + switch (tex_object_data->format) + { + case GL_RGB: + internal_format = COGL_PIXEL_FORMAT_RGB_888; + break; + + case GL_RGBA: + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + break; + + case GL_ALPHA: + internal_format = COGL_PIXEL_FORMAT_A_8; + break; + + case GL_LUMINANCE: + internal_format = COGL_PIXEL_FORMAT_G_8; + break; + + default: + /* We can't handle this format so just give up */ + return; + } + + ctx = gles2_ctx->context; + winsys = ctx->display->renderer->winsys_vtable; + + /* We need to make sure the rendering on the GLES2 context is + * complete before the blit will be ready in the GLES2 context */ + ctx->glFinish (); + /* We need to force Cogl to rebind the texture because according to + * the GL spec a shared texture isn't guaranteed to be updated until + * is rebound */ + _cogl_get_texture_unit (0)->dirty_gl_texture = TRUE; + + /* Temporarily switch back to the Cogl context */ + winsys->restore_context (ctx); + + dst_texture = + cogl_gles2_texture_2d_new_from_handle (gles2_ctx->context, + gles2_ctx, + tex_id, + tex_object_data->width, + tex_object_data->height, + internal_format); + + if (dst_texture) + { + CoglTexture *src_texture = + COGL_OFFSCREEN (gles2_ctx->read_buffer)->texture; + CoglPipeline *pipeline = cogl_pipeline_new (ctx); + const CoglOffscreenFlags flags = COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL; + CoglOffscreen *offscreen = + _cogl_offscreen_new_with_texture_full (COGL_TEXTURE (dst_texture), + flags, level); + int src_width = cogl_texture_get_width (src_texture); + int src_height = cogl_texture_get_height (src_texture); + /* The framebuffer size might be different from the texture size + * if a level > 0 is used */ + int dst_width = + cogl_framebuffer_get_width (COGL_FRAMEBUFFER (offscreen)); + int dst_height = + cogl_framebuffer_get_height (COGL_FRAMEBUFFER (offscreen)); + float x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2; + + cogl_pipeline_set_layer_texture (pipeline, 0, src_texture); + cogl_pipeline_set_blend (pipeline, + "RGBA = ADD(SRC_COLOR, 0)", + NULL); + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer_num */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + x_1 = dst_x * 2.0f / dst_width - 1.0f; + y_1 = dst_y * 2.0f / dst_height - 1.0f; + x_2 = x_1 + width * 2.0f / dst_width; + y_2 = y_1 + height * 2.0f / dst_height; + + s_1 = src_x / (float) src_width; + t_1 = 1.0f - src_y / (float) src_height; + s_2 = (src_x + width) / (float) src_width; + t_2 = 1.0f - (src_y + height) / (float) src_height; + + cogl_framebuffer_draw_textured_rectangle (COGL_FRAMEBUFFER (offscreen), + pipeline, + x_1, y_1, + x_2, y_2, + s_1, t_1, + s_2, t_2); + + _cogl_framebuffer_flush_journal (COGL_FRAMEBUFFER (offscreen)); + + /* We need to make sure the rendering is complete before the + * blit will be ready in the GLES2 context */ + ctx->glFinish (); + + cogl_object_unref (pipeline); + cogl_object_unref (dst_texture); + cogl_object_unref (offscreen); + } + + winsys->set_gles2_context (gles2_ctx, NULL); + + /* From what I understand of the GL spec, changes to a shared object + * are not guaranteed to be propagated to another context until that + * object is rebound in that context so we can just rebind it + * here */ + gles2_ctx->vtable->glBindTexture (GL_TEXTURE_2D, tex_id); +} + +/* We wrap glBindFramebuffer so that when framebuffer 0 is bound + * we can instead bind the write_framebuffer passed to + * cogl_push_gles2_context(). + */ +static void +gl_bind_framebuffer_wrapper (GLenum target, GLuint framebuffer) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + gles2_ctx->current_fbo_handle = framebuffer; + + if (framebuffer == 0 && cogl_is_offscreen (gles2_ctx->write_buffer)) + { + CoglGLES2Offscreen *write = gles2_ctx->gles2_write_buffer; + framebuffer = write->gl_framebuffer.fbo_handle; + } + + gles2_ctx->context->glBindFramebuffer (target, framebuffer); + + update_current_flip_state (gles2_ctx); +} + +static int +transient_bind_read_buffer (CoglGLES2Context *gles2_ctx) +{ + if (gles2_ctx->current_fbo_handle == 0) + { + if (cogl_is_offscreen (gles2_ctx->read_buffer)) + { + CoglGLES2Offscreen *read = gles2_ctx->gles2_read_buffer; + GLuint read_fbo_handle = read->gl_framebuffer.fbo_handle; + + gles2_ctx->context->glBindFramebuffer (GL_FRAMEBUFFER, + read_fbo_handle); + + return RESTORE_FB_FROM_OFFSCREEN; + } + else + { + _cogl_framebuffer_gl_bind (gles2_ctx->read_buffer, + 0 /* target ignored */); + + return RESTORE_FB_FROM_ONSCREEN; + } + } + else + return RESTORE_FB_NONE; +} + +static void +restore_write_buffer (CoglGLES2Context *gles2_ctx, + int restore_mode) +{ + switch (restore_mode) + { + case RESTORE_FB_FROM_OFFSCREEN: + + gl_bind_framebuffer_wrapper (GL_FRAMEBUFFER, 0); + + break; + case RESTORE_FB_FROM_ONSCREEN: + + /* Note: we can't restore the original write buffer using + * _cogl_framebuffer_gl_bind() if it's an offscreen + * framebuffer because _cogl_framebuffer_gl_bind() doesn't + * know about the fbo handle owned by the gles2 context. + */ + if (cogl_is_offscreen (gles2_ctx->write_buffer)) + gl_bind_framebuffer_wrapper (GL_FRAMEBUFFER, 0); + else + _cogl_framebuffer_gl_bind (gles2_ctx->write_buffer, GL_FRAMEBUFFER); + + break; + case RESTORE_FB_NONE: + break; + } +} + +/* We wrap glReadPixels so when framebuffer 0 is bound then we can + * read from the read_framebuffer passed to cogl_push_gles2_context(). + */ +static void +gl_read_pixels_wrapper (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLvoid *pixels) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + int restore_mode = transient_bind_read_buffer (gles2_ctx); + + gles2_ctx->context->glReadPixels (x, y, width, height, format, type, pixels); + + restore_write_buffer (gles2_ctx, restore_mode); + + /* If the read buffer is a CoglOffscreen then the data will be + * upside down compared to what GL expects so we need to flip it */ + if (gles2_ctx->current_fbo_handle == 0 && + cogl_is_offscreen (gles2_ctx->read_buffer)) + { + int bpp, bytes_per_row, stride, y; + uint8_t *bytes = pixels; + uint8_t *temprow; + + /* Try to determine the bytes per pixel for the given + * format/type combination. If there's a format which doesn't + * make sense then we'll just give up because GL will probably + * have just thrown an error */ + switch (format) + { + case GL_RGB: + switch (type) + { + case GL_UNSIGNED_BYTE: + bpp = 3; + break; + + case GL_UNSIGNED_SHORT_5_6_5: + bpp = 2; + break; + + default: + return; + } + break; + + case GL_RGBA: + switch (type) + { + case GL_UNSIGNED_BYTE: + bpp = 4; + break; + + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + bpp = 2; + break; + + default: + return; + } + break; + + case GL_ALPHA: + switch (type) + { + case GL_UNSIGNED_BYTE: + bpp = 1; + break; + + default: + return; + } + break; + + default: + return; + } + + bytes_per_row = bpp * width; + stride = ((bytes_per_row + gles2_ctx->pack_alignment - 1) & + ~(gles2_ctx->pack_alignment - 1)); + temprow = g_alloca (bytes_per_row); + + /* vertically flip the buffer in-place */ + for (y = 0; y < height / 2; y++) + { + if (y != height - y - 1) /* skip center row */ + { + memcpy (temprow, + bytes + y * stride, + bytes_per_row); + memcpy (bytes + y * stride, + bytes + (height - y - 1) * stride, + bytes_per_row); + memcpy (bytes + (height - y - 1) * stride, + temprow, + bytes_per_row); + } + } + } +} + +static void +gl_copy_tex_image_2d_wrapper (GLenum target, + GLint level, + GLenum internal_format, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* If we are reading from a CoglOffscreen buffer then the image will + * be upside down with respect to what GL expects so we can't use + * glCopyTexImage2D. Instead we we'll try to use the Cogl API to + * flip it */ + if (gles2_ctx->current_fbo_handle == 0 && + cogl_is_offscreen (gles2_ctx->read_buffer)) + { + /* This will only work with the GL_TEXTURE_2D target. FIXME: + * GLES2 also supports setting cube map textures with + * glTexImage2D so we need to handle that too */ + if (target != GL_TEXTURE_2D) + return; + + /* Create an empty texture to hold the data */ + gles2_ctx->vtable->glTexImage2D (target, + level, + internal_format, + width, height, + border, + internal_format, /* format */ + GL_UNSIGNED_BYTE, /* type */ + NULL /* data */); + + copy_flipped_texture (gles2_ctx, + level, + x, y, /* src_x/src_y */ + 0, 0, /* dst_x/dst_y */ + width, height); + } + else + { + int restore_mode = transient_bind_read_buffer (gles2_ctx); + + gles2_ctx->context->glCopyTexImage2D (target, level, internal_format, + x, y, width, height, border); + + restore_write_buffer (gles2_ctx, restore_mode); + + set_texture_object_data (gles2_ctx, + target, + level, + internal_format, + width, height); + } +} + +static void +gl_copy_tex_sub_image_2d_wrapper (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* If we are reading from a CoglOffscreen buffer then the image will + * be upside down with respect to what GL expects so we can't use + * glCopyTexSubImage2D. Instead we we'll try to use the Cogl API to + * flip it */ + if (gles2_ctx->current_fbo_handle == 0 && + cogl_is_offscreen (gles2_ctx->read_buffer)) + { + /* This will only work with the GL_TEXTURE_2D target. FIXME: + * GLES2 also supports setting cube map textures with + * glTexImage2D so we need to handle that too */ + if (target != GL_TEXTURE_2D) + return; + + copy_flipped_texture (gles2_ctx, + level, + x, y, /* src_x/src_y */ + xoffset, yoffset, /* dst_x/dst_y */ + width, height); + } + else + { + int restore_mode = transient_bind_read_buffer (gles2_ctx); + + gles2_ctx->context->glCopyTexSubImage2D (target, level, + xoffset, yoffset, + x, y, width, height); + + restore_write_buffer (gles2_ctx, restore_mode); + } +} + +static GLuint +gl_create_shader_wrapper (GLenum type) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + GLuint id; + + id = gles2_ctx->context->glCreateShader (type); + + if (id != 0) + { + CoglGLES2ShaderData *data = g_slice_new (CoglGLES2ShaderData); + + data->object_id = id; + data->type = type; + data->ref_count = 1; + data->deleted = FALSE; + + g_hash_table_insert (gles2_ctx->shader_map, + GINT_TO_POINTER (id), + data); + } + + return id; +} + +static void +gl_delete_shader_wrapper (GLuint shader) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ShaderData *shader_data; + + if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, + GINT_TO_POINTER (shader))) && + !shader_data->deleted) + { + shader_data->deleted = TRUE; + shader_data_unref (gles2_ctx, shader_data); + } + + gles2_ctx->context->glDeleteShader (shader); +} + +static GLuint +gl_create_program_wrapper (void) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + GLuint id; + + id = gles2_ctx->context->glCreateProgram (); + + if (id != 0) + { + CoglGLES2ProgramData *data = g_slice_new (CoglGLES2ProgramData); + + data->object_id = id; + data->attached_shaders = NULL; + data->ref_count = 1; + data->deleted = FALSE; + data->context = gles2_ctx; + data->flip_vector_location = 0; + data->flip_vector_state = COGL_GLES2_FLIP_STATE_UNKNOWN; + + g_hash_table_insert (gles2_ctx->program_map, + GINT_TO_POINTER (id), + data); + } + + return id; +} + +static void +gl_delete_program_wrapper (GLuint program) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ProgramData *program_data; + + if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, + GINT_TO_POINTER (program))) && + !program_data->deleted) + { + program_data->deleted = TRUE; + program_data_unref (program_data); + } + + gles2_ctx->context->glDeleteProgram (program); +} + +static void +gl_use_program_wrapper (GLuint program) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ProgramData *program_data; + + program_data = g_hash_table_lookup (gles2_ctx->program_map, + GINT_TO_POINTER (program)); + + if (program_data) + program_data->ref_count++; + if (gles2_ctx->current_program) + program_data_unref (gles2_ctx->current_program); + + gles2_ctx->current_program = program_data; + + gles2_ctx->context->glUseProgram (program); +} + +static void +gl_attach_shader_wrapper (GLuint program, + GLuint shader) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ProgramData *program_data; + CoglGLES2ShaderData *shader_data; + + if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, + GINT_TO_POINTER (program))) && + (shader_data = g_hash_table_lookup (gles2_ctx->shader_map, + GINT_TO_POINTER (shader))) && + /* Ignore attempts to attach a shader that is already attached */ + g_list_find (program_data->attached_shaders, shader_data) == NULL) + { + shader_data->ref_count++; + program_data->attached_shaders = + g_list_prepend (program_data->attached_shaders, shader_data); + } + + gles2_ctx->context->glAttachShader (program, shader); +} + +static void +gl_detach_shader_wrapper (GLuint program, + GLuint shader) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ProgramData *program_data; + CoglGLES2ShaderData *shader_data; + + if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, + GINT_TO_POINTER (program))) && + (shader_data = g_hash_table_lookup (gles2_ctx->shader_map, + GINT_TO_POINTER (shader)))) + detach_shader (program_data, shader_data); + + gles2_ctx->context->glDetachShader (program, shader); +} + +static void +gl_shader_source_wrapper (GLuint shader, + GLsizei count, + const char *const *string, + const GLint *length) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ShaderData *shader_data; + + if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, + GINT_TO_POINTER (shader))) && + shader_data->type == GL_VERTEX_SHADER) + { + char **string_copy = g_alloca ((count + 1) * sizeof (char *)); + int *length_copy = g_alloca ((count + 1) * sizeof (int)); + int i; + + /* Replace any occurences of the symbol 'main' with a different + * symbol so that we can provide our own wrapper main + * function */ + + for (i = 0; i < count; i++) + { + int string_length; + + if (length == NULL || length[i] < 0) + string_length = strlen (string[i]); + else + string_length = length[i]; + + string_copy[i] = g_memdup (string[i], string_length); + + replace_token (string_copy[i], + "main", + MAIN_WRAPPER_REPLACEMENT_NAME, + string_length); + + length_copy[i] = string_length; + } + + string_copy[count] = (char *) main_wrapper_function; + length_copy[count] = sizeof (main_wrapper_function) - 1; + + gles2_ctx->context->glShaderSource (shader, + count + 1, + (const char *const *) string_copy, + length_copy); + + /* Note: we don't need to free the last entry in string_copy[] + * because it is our static wrapper string... */ + for (i = 0; i < count; i++) + g_free (string_copy[i]); + } + else + gles2_ctx->context->glShaderSource (shader, count, string, length); +} + +static void +gl_get_shader_source_wrapper (GLuint shader, + GLsizei buf_size, + GLsizei *length_out, + GLchar *source) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ShaderData *shader_data; + GLsizei length; + + gles2_ctx->context->glGetShaderSource (shader, + buf_size, + &length, + source); + + if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, + GINT_TO_POINTER (shader))) && + shader_data->type == GL_VERTEX_SHADER) + { + GLsizei copy_length = MIN (length, buf_size - 1); + static const char wrapper_marker[] = MAIN_WRAPPER_BEGIN; + char *wrapper_start; + + /* Strip out the wrapper snippet we added when the source was + * specified */ + wrapper_start = _cogl_util_memmem (source, + copy_length, + wrapper_marker, + sizeof (wrapper_marker) - 1); + if (wrapper_start) + { + length = wrapper_start - source; + copy_length = length; + *wrapper_start = '\0'; + } + + /* Correct the name of the main function back to its original */ + replace_token (source, + MAIN_WRAPPER_REPLACEMENT_NAME, + "main", + copy_length); + } + + if (length_out) + *length_out = length; +} + +static void +gl_link_program_wrapper (GLuint program) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + CoglGLES2ProgramData *program_data; + + gles2_ctx->context->glLinkProgram (program); + + program_data = g_hash_table_lookup (gles2_ctx->program_map, + GINT_TO_POINTER (program)); + + if (program_data) + { + GLint status; + + gles2_ctx->context->glGetProgramiv (program, GL_LINK_STATUS, &status); + + if (status) + program_data->flip_vector_location = + gles2_ctx->context->glGetUniformLocation (program, + MAIN_WRAPPER_FLIP_UNIFORM); + } +} + +static void +gl_get_program_iv_wrapper (GLuint program, + GLenum pname, + GLint *params) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + gles2_ctx->context->glGetProgramiv (program, pname, params); + + switch (pname) + { + case GL_ATTACHED_SHADERS: + /* Decrease the number of shaders to try and hide the shader + * wrapper we added */ + if (*params > 1) + (*params)--; + break; + } +} + +static void +flush_viewport_state (CoglGLES2Context *gles2_ctx) +{ + if (gles2_ctx->viewport_dirty) + { + int y; + + if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) + { + /* We need to know the height of the current framebuffer in + * order to flip the viewport. Fortunately we don't need to + * track the height of the FBOs created within the GLES2 + * context because we would never be flipping if they are + * bound so we can just assume Cogl's framebuffer is bound + * when we are flipping */ + int fb_height = cogl_framebuffer_get_height (gles2_ctx->write_buffer); + y = fb_height - (gles2_ctx->viewport[1] + gles2_ctx->viewport[3]); + } + else + y = gles2_ctx->viewport[1]; + + gles2_ctx->context->glViewport (gles2_ctx->viewport[0], + y, + gles2_ctx->viewport[2], + gles2_ctx->viewport[3]); + + gles2_ctx->viewport_dirty = FALSE; + } +} + +static void +flush_scissor_state (CoglGLES2Context *gles2_ctx) +{ + if (gles2_ctx->scissor_dirty) + { + int y; + + if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) + { + /* See comment above about the viewport flipping */ + int fb_height = cogl_framebuffer_get_height (gles2_ctx->write_buffer); + y = fb_height - (gles2_ctx->scissor[1] + gles2_ctx->scissor[3]); + } + else + y = gles2_ctx->scissor[1]; + + gles2_ctx->context->glScissor (gles2_ctx->scissor[0], + y, + gles2_ctx->scissor[2], + gles2_ctx->scissor[3]); + + gles2_ctx->scissor_dirty = FALSE; + } +} + +static void +flush_front_face_state (CoglGLES2Context *gles2_ctx) +{ + if (gles2_ctx->front_face_dirty) + { + GLenum front_face; + + if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) + { + if (gles2_ctx->front_face == GL_CW) + front_face = GL_CCW; + else + front_face = GL_CW; + } + else + front_face = gles2_ctx->front_face; + + gles2_ctx->context->glFrontFace (front_face); + + gles2_ctx->front_face_dirty = FALSE; + } +} + +static void +pre_draw_wrapper (CoglGLES2Context *gles2_ctx) +{ + /* If there's no current program then we'll just let GL report an + * error */ + if (gles2_ctx->current_program == NULL) + return; + + flush_viewport_state (gles2_ctx); + flush_scissor_state (gles2_ctx); + flush_front_face_state (gles2_ctx); + + /* We want to flip rendering when the application is rendering to a + * Cogl offscreen buffer in order to maintain the flipped texture + * coordinate origin */ + if (gles2_ctx->current_flip_state != + gles2_ctx->current_program->flip_vector_state) + { + GLuint location = + gles2_ctx->current_program->flip_vector_location; + float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + + if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) + value[1] = -1.0f; + + gles2_ctx->context->glUniform4fv (location, 1, value); + + gles2_ctx->current_program->flip_vector_state = + gles2_ctx->current_flip_state; + } +} + +static void +gl_clear_wrapper (GLbitfield mask) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* Clearing is affected by the scissor state so we need to ensure + * that's flushed */ + flush_scissor_state (gles2_ctx); + + gles2_ctx->context->glClear (mask); +} + +static void +gl_draw_elements_wrapper (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid *indices) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + pre_draw_wrapper (gles2_ctx); + + gles2_ctx->context->glDrawElements (mode, count, type, indices); +} + +static void +gl_draw_arrays_wrapper (GLenum mode, + GLint first, + GLsizei count) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + pre_draw_wrapper (gles2_ctx); + + gles2_ctx->context->glDrawArrays (mode, first, count); +} + +static void +gl_get_program_info_log_wrapper (GLuint program, + GLsizei buf_size, + GLsizei *length_out, + GLchar *info_log) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + GLsizei length; + + gles2_ctx->context->glGetProgramInfoLog (program, + buf_size, + &length, + info_log); + + replace_token (info_log, + MAIN_WRAPPER_REPLACEMENT_NAME, + "main", + MIN (length, buf_size)); + + if (length_out) + *length_out = length; +} + +static void +gl_get_shader_info_log_wrapper (GLuint shader, + GLsizei buf_size, + GLsizei *length_out, + GLchar *info_log) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + GLsizei length; + + gles2_ctx->context->glGetShaderInfoLog (shader, + buf_size, + &length, + info_log); + + replace_token (info_log, + MAIN_WRAPPER_REPLACEMENT_NAME, + "main", + MIN (length, buf_size)); + + if (length_out) + *length_out = length; +} + +static void +gl_front_face_wrapper (GLenum mode) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* If the mode doesn't make any sense then we'll just let the + * context deal with it directly so that it will throw an error */ + if (mode != GL_CW && mode != GL_CCW) + gles2_ctx->context->glFrontFace (mode); + else + { + gles2_ctx->front_face = mode; + gles2_ctx->front_face_dirty = TRUE; + } +} + +static void +gl_viewport_wrapper (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* If the viewport is invalid then we'll just let the context deal + * with it directly so that it will throw an error */ + if (width < 0 || height < 0) + gles2_ctx->context->glViewport (x, y, width, height); + else + { + gles2_ctx->viewport[0] = x; + gles2_ctx->viewport[1] = y; + gles2_ctx->viewport[2] = width; + gles2_ctx->viewport[3] = height; + gles2_ctx->viewport_dirty = TRUE; + } +} + +static void +gl_scissor_wrapper (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + /* If the scissor is invalid then we'll just let the context deal + * with it directly so that it will throw an error */ + if (width < 0 || height < 0) + gles2_ctx->context->glScissor (x, y, width, height); + else + { + gles2_ctx->scissor[0] = x; + gles2_ctx->scissor[1] = y; + gles2_ctx->scissor[2] = width; + gles2_ctx->scissor[3] = height; + gles2_ctx->scissor_dirty = TRUE; + } +} + +static void +gl_get_boolean_v_wrapper (GLenum pname, + GLboolean *params) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + switch (pname) + { + case GL_VIEWPORT: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = !!gles2_ctx->viewport[i]; + } + break; + + case GL_SCISSOR_BOX: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = !!gles2_ctx->scissor[i]; + } + break; + + default: + gles2_ctx->context->glGetBooleanv (pname, params); + } +} + +static void +gl_get_integer_v_wrapper (GLenum pname, + GLint *params) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + switch (pname) + { + case GL_VIEWPORT: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = gles2_ctx->viewport[i]; + } + break; + + case GL_SCISSOR_BOX: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = gles2_ctx->scissor[i]; + } + break; + + case GL_FRONT_FACE: + params[0] = gles2_ctx->front_face; + break; + + default: + gles2_ctx->context->glGetIntegerv (pname, params); + } +} + +static void +gl_get_float_v_wrapper (GLenum pname, + GLfloat *params) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + switch (pname) + { + case GL_VIEWPORT: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = gles2_ctx->viewport[i]; + } + break; + + case GL_SCISSOR_BOX: + { + int i; + + for (i = 0; i < 4; i++) + params[i] = gles2_ctx->scissor[i]; + } + break; + + case GL_FRONT_FACE: + params[0] = gles2_ctx->front_face; + break; + + default: + gles2_ctx->context->glGetFloatv (pname, params); + } +} + +static void +gl_pixel_store_i_wrapper (GLenum pname, GLint param) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + gles2_ctx->context->glPixelStorei (pname, param); + + if (pname == GL_PACK_ALIGNMENT && + (param == 1 || param == 2 || param == 4 || param == 8)) + gles2_ctx->pack_alignment = param; +} + +static void +gl_active_texture_wrapper (GLenum texture) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + int texture_unit; + + gles2_ctx->context->glActiveTexture (texture); + + texture_unit = texture - GL_TEXTURE0; + + /* If the application is binding some odd looking texture unit + * numbers then we'll just ignore it and hope that GL has generated + * an error */ + if (texture_unit >= 0 && texture_unit < 512) + { + gles2_ctx->current_texture_unit = texture_unit; + g_array_set_size (gles2_ctx->texture_units, + MAX (texture_unit, gles2_ctx->texture_units->len)); + } +} + +static void +gl_delete_textures_wrapper (GLsizei n, + const GLuint *textures) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + int texture_index; + int texture_unit; + + gles2_ctx->context->glDeleteTextures (n, textures); + + for (texture_index = 0; texture_index < n; texture_index++) + { + /* Reset any texture units that have any of these textures bound */ + for (texture_unit = 0; + texture_unit < gles2_ctx->texture_units->len; + texture_unit++) + { + CoglGLES2TextureUnitData *unit = + &g_array_index (gles2_ctx->texture_units, + CoglGLES2TextureUnitData, + texture_unit); + + if (unit->current_texture_2d == textures[texture_index]) + unit->current_texture_2d = 0; + } + + /* Remove the binding. We can do this immediately because unlike + * shader objects the deletion isn't delayed until the object is + * unbound */ + g_hash_table_remove (gles2_ctx->texture_object_map, + GUINT_TO_POINTER (textures[texture_index])); + } +} + +static void +gl_bind_texture_wrapper (GLenum target, + GLuint texture) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + gles2_ctx->context->glBindTexture (target, texture); + + if (target == GL_TEXTURE_2D) + { + CoglGLES2TextureUnitData *unit = + &g_array_index (gles2_ctx->texture_units, + CoglGLES2TextureUnitData, + gles2_ctx->current_texture_unit); + unit->current_texture_2d = texture; + } +} + +static void +gl_tex_image_2d_wrapper (GLenum target, + GLint level, + GLint internal_format, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + CoglGLES2Context *gles2_ctx = current_gles2_context; + + gles2_ctx->context->glTexImage2D (target, + level, + internal_format, + width, height, + border, + format, + type, + pixels); + + set_texture_object_data (gles2_ctx, + target, + level, + internal_format, + width, height); +} + +static void +_cogl_gles2_offscreen_free (CoglGLES2Offscreen *gles2_offscreen) +{ + _cogl_list_remove (&gles2_offscreen->link); + g_slice_free (CoglGLES2Offscreen, gles2_offscreen); +} + +static void +force_delete_program_object (CoglGLES2Context *context, + CoglGLES2ProgramData *program_data) +{ + if (!program_data->deleted) + { + context->context->glDeleteProgram (program_data->object_id); + program_data->deleted = TRUE; + program_data_unref (program_data); + } +} + +static void +force_delete_shader_object (CoglGLES2Context *context, + CoglGLES2ShaderData *shader_data) +{ + if (!shader_data->deleted) + { + context->context->glDeleteShader (shader_data->object_id); + shader_data->deleted = TRUE; + shader_data_unref (context, shader_data); + } +} + +static void +force_delete_texture_object (CoglGLES2Context *context, + CoglGLES2TextureObjectData *texture_data) +{ + context->context->glDeleteTextures (1, &texture_data->object_id); +} + +static void +_cogl_gles2_context_free (CoglGLES2Context *gles2_context) +{ + CoglContext *ctx = gles2_context->context; + const CoglWinsysVtable *winsys; + GList *objects, *l; + + if (gles2_context->current_program) + program_data_unref (gles2_context->current_program); + + /* Try to forcibly delete any shaders, programs and textures so that + * they won't get leaked. Because all GLES2 contexts are in the same + * share list as Cogl's context these won't get deleted by default. + * FIXME: we should do this for all of the other resources too, like + * textures */ + objects = g_hash_table_get_values (gles2_context->program_map); + for (l = objects; l; l = l->next) + force_delete_program_object (gles2_context, l->data); + g_list_free (objects); + objects = g_hash_table_get_values (gles2_context->shader_map); + for (l = objects; l; l = l->next) + force_delete_shader_object (gles2_context, l->data); + g_list_free (objects); + objects = g_hash_table_get_values (gles2_context->texture_object_map); + for (l = objects; l; l = l->next) + force_delete_texture_object (gles2_context, l->data); + g_list_free (objects); + + /* All of the program and shader objects should now be destroyed */ + if (g_hash_table_size (gles2_context->program_map) > 0) + g_warning ("Program objects have been leaked from a CoglGLES2Context"); + if (g_hash_table_size (gles2_context->shader_map) > 0) + g_warning ("Shader objects have been leaked from a CoglGLES2Context"); + + g_hash_table_destroy (gles2_context->program_map); + g_hash_table_destroy (gles2_context->shader_map); + + g_hash_table_destroy (gles2_context->texture_object_map); + g_array_free (gles2_context->texture_units, TRUE); + + winsys = ctx->display->renderer->winsys_vtable; + winsys->destroy_gles2_context (gles2_context); + + while (!_cogl_list_empty (&gles2_context->foreign_offscreens)) + { + CoglGLES2Offscreen *gles2_offscreen = + _cogl_container_of (gles2_context->foreign_offscreens.next, + CoglGLES2Offscreen, + link); + + /* Note: this will also indirectly free the gles2_offscreen by + * calling the destroy notify for the _user_data */ + cogl_object_set_user_data (COGL_OBJECT (gles2_offscreen->original_offscreen), + &offscreen_wrapper_key, + NULL, + NULL); + } + + g_free (gles2_context->vtable); + + g_free (gles2_context); +} + +static void +free_shader_data (CoglGLES2ShaderData *data) +{ + g_slice_free (CoglGLES2ShaderData, data); +} + +static void +free_program_data (CoglGLES2ProgramData *data) +{ + while (data->attached_shaders) + detach_shader (data, + data->attached_shaders->data); + + g_slice_free (CoglGLES2ProgramData, data); +} + +static void +free_texture_object_data (CoglGLES2TextureObjectData *data) +{ + g_slice_free (CoglGLES2TextureObjectData, data); +} + +CoglGLES2Context * +cogl_gles2_context_new (CoglContext *ctx, CoglError **error) +{ + CoglGLES2Context *gles2_ctx; + const CoglWinsysVtable *winsys; + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT)) + { + _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, + COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, + "Backend doesn't support creating GLES2 contexts"); + + return NULL; + } + + gles2_ctx = g_malloc0 (sizeof (CoglGLES2Context)); + + gles2_ctx->context = ctx; + + _cogl_list_init (&gles2_ctx->foreign_offscreens); + + winsys = ctx->display->renderer->winsys_vtable; + gles2_ctx->winsys = winsys->context_create_gles2_context (ctx, error); + if (gles2_ctx->winsys == NULL) + { + g_free (gles2_ctx); + return NULL; + } + + gles2_ctx->current_flip_state = COGL_GLES2_FLIP_STATE_UNKNOWN; + gles2_ctx->viewport_dirty = TRUE; + gles2_ctx->scissor_dirty = TRUE; + gles2_ctx->front_face_dirty = TRUE; + gles2_ctx->front_face = GL_CCW; + gles2_ctx->pack_alignment = 4; + + gles2_ctx->vtable = g_malloc0 (sizeof (CoglGLES2Vtable)); +#define COGL_EXT_BEGIN(name, \ + min_gl_major, min_gl_minor, \ + gles_availability, \ + extension_suffixes, extension_names) + +#define COGL_EXT_FUNCTION(ret, name, args) \ + gles2_ctx->vtable->name = (void *) ctx->name; + +#define COGL_EXT_END() + +#include "gl-prototypes/cogl-gles2-functions.h" + +#undef COGL_EXT_BEGIN +#undef COGL_EXT_FUNCTION +#undef COGL_EXT_END + + gles2_ctx->vtable->glBindFramebuffer = + (void *) gl_bind_framebuffer_wrapper; + gles2_ctx->vtable->glReadPixels = + (void *) gl_read_pixels_wrapper; + gles2_ctx->vtable->glCopyTexImage2D = + (void *) gl_copy_tex_image_2d_wrapper; + gles2_ctx->vtable->glCopyTexSubImage2D = + (void *) gl_copy_tex_sub_image_2d_wrapper; + + gles2_ctx->vtable->glCreateShader = gl_create_shader_wrapper; + gles2_ctx->vtable->glDeleteShader = gl_delete_shader_wrapper; + gles2_ctx->vtable->glCreateProgram = gl_create_program_wrapper; + gles2_ctx->vtable->glDeleteProgram = gl_delete_program_wrapper; + gles2_ctx->vtable->glUseProgram = gl_use_program_wrapper; + gles2_ctx->vtable->glAttachShader = gl_attach_shader_wrapper; + gles2_ctx->vtable->glDetachShader = gl_detach_shader_wrapper; + gles2_ctx->vtable->glShaderSource = gl_shader_source_wrapper; + gles2_ctx->vtable->glGetShaderSource = gl_get_shader_source_wrapper; + gles2_ctx->vtable->glLinkProgram = gl_link_program_wrapper; + gles2_ctx->vtable->glGetProgramiv = gl_get_program_iv_wrapper; + gles2_ctx->vtable->glGetProgramInfoLog = gl_get_program_info_log_wrapper; + gles2_ctx->vtable->glGetShaderInfoLog = gl_get_shader_info_log_wrapper; + gles2_ctx->vtable->glClear = gl_clear_wrapper; + gles2_ctx->vtable->glDrawElements = gl_draw_elements_wrapper; + gles2_ctx->vtable->glDrawArrays = gl_draw_arrays_wrapper; + gles2_ctx->vtable->glFrontFace = gl_front_face_wrapper; + gles2_ctx->vtable->glViewport = gl_viewport_wrapper; + gles2_ctx->vtable->glScissor = gl_scissor_wrapper; + gles2_ctx->vtable->glGetBooleanv = gl_get_boolean_v_wrapper; + gles2_ctx->vtable->glGetIntegerv = gl_get_integer_v_wrapper; + gles2_ctx->vtable->glGetFloatv = gl_get_float_v_wrapper; + gles2_ctx->vtable->glPixelStorei = gl_pixel_store_i_wrapper; + gles2_ctx->vtable->glActiveTexture = gl_active_texture_wrapper; + gles2_ctx->vtable->glDeleteTextures = gl_delete_textures_wrapper; + gles2_ctx->vtable->glBindTexture = gl_bind_texture_wrapper; + gles2_ctx->vtable->glTexImage2D = gl_tex_image_2d_wrapper; + + gles2_ctx->shader_map = + g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, /* key_destroy */ + (GDestroyNotify) free_shader_data); + gles2_ctx->program_map = + g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, /* key_destroy */ + (GDestroyNotify) free_program_data); + + gles2_ctx->texture_object_map = + g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, /* key_destroy */ + (GDestroyNotify) free_texture_object_data); + + gles2_ctx->texture_units = g_array_new (FALSE, /* not zero terminated */ + TRUE, /* clear */ + sizeof (CoglGLES2TextureUnitData)); + gles2_ctx->current_texture_unit = 0; + g_array_set_size (gles2_ctx->texture_units, 1); + + return _cogl_gles2_context_object_new (gles2_ctx); +} + +const CoglGLES2Vtable * +cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx) +{ + return gles2_ctx->vtable; +} + +/* When drawing to a CoglFramebuffer from a separate context we have + * to be able to allocate ancillary buffers for that context... + */ +static CoglGLES2Offscreen * +_cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen, + CoglGLES2Context *gles2_context, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen); + const CoglWinsysVtable *winsys; + CoglError *internal_error = NULL; + CoglGLES2Offscreen *gles2_offscreen; + int level_width; + int level_height; + + if (!framebuffer->allocated && + !cogl_framebuffer_allocate (framebuffer, error)) + { + return NULL; + } + + _cogl_list_for_each (gles2_offscreen, + &gles2_context->foreign_offscreens, + link) + { + if (gles2_offscreen->original_offscreen == offscreen) + return gles2_offscreen; + } + + winsys = _cogl_framebuffer_get_winsys (framebuffer); + winsys->save_context (framebuffer->context); + if (!winsys->set_gles2_context (gles2_context, &internal_error)) + { + winsys->restore_context (framebuffer->context); + + cogl_error_free (internal_error); + _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to bind gles2 context to create framebuffer"); + return NULL; + } + + gles2_offscreen = g_slice_new0 (CoglGLES2Offscreen); + + _cogl_texture_get_level_size (offscreen->texture, + offscreen->texture_level, + &level_width, + &level_height, + NULL); + + if (!_cogl_framebuffer_try_creating_gl_fbo (gles2_context->context, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &COGL_FRAMEBUFFER (offscreen)->config, + offscreen->allocation_flags, + &gles2_offscreen->gl_framebuffer)) + { + winsys->restore_context (framebuffer->context); + + g_slice_free (CoglGLES2Offscreen, gles2_offscreen); + + _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to create an OpenGL framebuffer object"); + return NULL; + } + + winsys->restore_context (framebuffer->context); + + gles2_offscreen->original_offscreen = offscreen; + + _cogl_list_insert (&gles2_context->foreign_offscreens, + &gles2_offscreen->link); + + /* So we avoid building up an ever growing collection of ancillary + * buffers for wrapped framebuffers, we make sure that the wrappers + * get freed when the original offscreen framebuffer is freed. */ + cogl_object_set_user_data (COGL_OBJECT (framebuffer), + &offscreen_wrapper_key, + gles2_offscreen, + (CoglUserDataDestroyCallback) + _cogl_gles2_offscreen_free); + + return gles2_offscreen; +} + +CoglBool +cogl_push_gles2_context (CoglContext *ctx, + CoglGLES2Context *gles2_ctx, + CoglFramebuffer *read_buffer, + CoglFramebuffer *write_buffer, + CoglError **error) +{ + const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; + CoglError *internal_error = NULL; + + _COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE); + + /* The read/write buffers are properties of the gles2 context and we + * don't currently track the read/write buffers as part of the stack + * entries so we explicitly don't allow the same context to be + * pushed multiple times. */ + if (g_queue_find (&ctx->gles2_context_stack, gles2_ctx)) + { + g_critical ("Pushing the same GLES2 context multiple times isn't " + "supported"); + return FALSE; + } + + if (ctx->gles2_context_stack.length == 0) + { + _cogl_journal_flush (read_buffer->journal); + if (write_buffer != read_buffer) + _cogl_journal_flush (write_buffer->journal); + winsys->save_context (ctx); + } + else + gles2_ctx->vtable->glFlush (); + + if (gles2_ctx->read_buffer != read_buffer) + { + if (cogl_is_offscreen (read_buffer)) + { + gles2_ctx->gles2_read_buffer = + _cogl_gles2_offscreen_allocate (COGL_OFFSCREEN (read_buffer), + gles2_ctx, + error); + /* XXX: what consistency guarantees should this api have? + * + * It should be safe to return at this point but we provide + * no guarantee to the caller whether their given buffers + * may be referenced and old buffers unreferenced even + * if the _push fails. */ + if (!gles2_ctx->gles2_read_buffer) + return FALSE; + } + else + gles2_ctx->gles2_read_buffer = NULL; + if (gles2_ctx->read_buffer) + cogl_object_unref (gles2_ctx->read_buffer); + gles2_ctx->read_buffer = cogl_object_ref (read_buffer); + } + + if (gles2_ctx->write_buffer != write_buffer) + { + if (cogl_is_offscreen (write_buffer)) + { + gles2_ctx->gles2_write_buffer = + _cogl_gles2_offscreen_allocate (COGL_OFFSCREEN (write_buffer), + gles2_ctx, + error); + /* XXX: what consistency guarantees should this api have? + * + * It should be safe to return at this point but we provide + * no guarantee to the caller whether their given buffers + * may be referenced and old buffers unreferenced even + * if the _push fails. */ + if (!gles2_ctx->gles2_write_buffer) + return FALSE; + } + else + gles2_ctx->gles2_write_buffer = NULL; + if (gles2_ctx->write_buffer) + cogl_object_unref (gles2_ctx->write_buffer); + gles2_ctx->write_buffer = cogl_object_ref (write_buffer); + + update_current_flip_state (gles2_ctx); + } + + if (!winsys->set_gles2_context (gles2_ctx, &internal_error)) + { + winsys->restore_context (ctx); + + cogl_error_free (internal_error); + _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, + COGL_GLES2_CONTEXT_ERROR_DRIVER, + "Driver failed to make GLES2 context current"); + return FALSE; + } + + g_queue_push_tail (&ctx->gles2_context_stack, gles2_ctx); + + /* The last time this context was pushed may have been with a + * different offscreen draw framebuffer and so if GL framebuffer 0 + * is bound for this GLES2 context we may need to bind a new, + * corresponding, window system framebuffer... */ + if (gles2_ctx->current_fbo_handle == 0) + { + if (cogl_is_offscreen (gles2_ctx->write_buffer)) + { + CoglGLES2Offscreen *write = gles2_ctx->gles2_write_buffer; + GLuint handle = write->gl_framebuffer.fbo_handle; + gles2_ctx->context->glBindFramebuffer (GL_FRAMEBUFFER, handle); + } + } + + current_gles2_context = gles2_ctx; + + /* If this is the first time this gles2 context has been used then + * we'll force the viewport and scissor to the right size. GL has + * the semantics that the viewport and scissor default to the size + * of the first surface the context is used with. If the first + * CoglFramebuffer that this context is used with is an offscreen, + * then the surface from GL's point of view will be the 1x1 dummy + * surface so the viewport will be wrong. Therefore we just override + * the default viewport and scissor here */ + if (!gles2_ctx->has_been_bound) + { + int fb_width = cogl_framebuffer_get_width (write_buffer); + int fb_height = cogl_framebuffer_get_height (write_buffer); + + gles2_ctx->vtable->glViewport (0, 0, /* x/y */ + fb_width, fb_height); + gles2_ctx->vtable->glScissor (0, 0, /* x/y */ + fb_width, fb_height); + gles2_ctx->has_been_bound = TRUE; + } + + return TRUE; +} + +CoglGLES2Vtable * +cogl_gles2_get_current_vtable (void) +{ + return current_gles2_context ? current_gles2_context->vtable : NULL; +} + +void +cogl_pop_gles2_context (CoglContext *ctx) +{ + CoglGLES2Context *gles2_ctx; + const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; + + _COGL_RETURN_IF_FAIL (ctx->gles2_context_stack.length > 0); + + g_queue_pop_tail (&ctx->gles2_context_stack); + + gles2_ctx = g_queue_peek_tail (&ctx->gles2_context_stack); + + if (gles2_ctx) + { + winsys->set_gles2_context (gles2_ctx, NULL); + current_gles2_context = gles2_ctx; + } + else + { + winsys->restore_context (ctx); + current_gles2_context = NULL; + } +} + +CoglTexture2D * +cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx, + CoglGLES2Context *gles2_ctx, + unsigned int handle, + int width, + int height, + CoglPixelFormat format) +{ + return cogl_texture_2d_gl_new_from_foreign (ctx, + handle, + width, + height, + format); +} + +CoglBool +cogl_gles2_texture_get_handle (CoglTexture *texture, + unsigned int *handle, + unsigned int *target) +{ + return cogl_texture_get_gl_texture (texture, handle, target); +} diff --git a/cogl/cogl-gles2-types.h b/cogl/cogl-gles2-types.h new file mode 100644 index 0000000..8f41bf8 --- /dev/null +++ b/cogl/cogl-gles2-types.h @@ -0,0 +1,474 @@ +#ifndef __COGL_GLES2_TYPES_H_ +#define __COGL_GLES2_TYPES_H_ + +/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef int32_t GLfixed; + +/* GL types for handling large vertex buffer objects */ +typedef signed long int GLintptr; +typedef long GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* PixelFormat */ +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ +#define GL_TEXTURE 0x1702 + +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 + +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 + +#define GL_NONE 0 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 + + +#ifdef __cplusplus +} +#endif + +#endif /* __COGL_GLES2_TYPES_H_ */ diff --git a/cogl/cogl-gles2.h b/cogl/cogl-gles2.h new file mode 100644 index 0000000..84c9ba1 --- /dev/null +++ b/cogl/cogl-gles2.h @@ -0,0 +1,420 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Collabora Ltd. + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Tomeu Vizoso + * Robert Bragg + * + */ + +#ifndef __COGL_GLES2_H__ +#define __COGL_GLES2_H__ + +/* NB: cogl-gles2.h is a top-level header that can be included directly + * but we want to be careful not to define __COGL_H_INSIDE__ when this + * is included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private + * api definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include +#include +#include +#include +#include + +/* CoglGLES2Vtable depends on GLES 2.0 typedefs being available but we + * want to be careful that the public api doesn't expose arbitrary + * system GL headers as part of the Cogl API so although when building + * internally we consistently refer to the system headers to avoid + * conflicts we only expose the minimal set of GLES 2.0 types and enums + * publicly. + */ +#ifdef COGL_COMPILATION +#include "cogl-gl-header.h" +#else +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-gles2 + * @short_description: A portable api to access OpenGLES 2.0 + * + * Cogl provides portable access to the OpenGLES api through a single + * library that is able to smooth over inconsistencies between the + * different vendor drivers for OpenGLES in a single place. + * + * The api is designed to allow Cogl to transparently implement the + * api on top of other drivers, such as OpenGL, D3D or on Cogl's own + * drawing api so even if your platform doesn't come with an + * OpenGLES 2.0 api Cogl may still be able to expose the api to your + * application. + * + * Since Cogl is a library and not an api specification it is possible + * to add OpenGLES 2.0 api features to Cogl which can immidiately + * benefit developers regardless of what platform they are running on. + * + * With this api it's possible to re-use existing OpenGLES 2.0 code + * within applications that are rendering with the Cogl API and also + * it's possible for applications that render using OpenGLES 2.0 to + * incorporate content rendered with Cogl. + * + * Applications can check for OpenGLES 2.0 api support by checking for + * %COGL_FEATURE_ID_GLES2_CONTEXT support with cogl_has_feature(). + * + * Since: 1.12 + * Stability: unstable + */ + +/** + * CoglGLES2Context: + * + * Represents an OpenGLES 2.0 api context used as a sandbox for + * OpenGLES 2.0 state. This is comparable to an EGLContext for those + * who have used OpenGLES 2.0 with EGL before. + * + * Since: 1.12 + * Stability: unstable + */ +typedef struct _CoglGLES2Context CoglGLES2Context; + +/** + * CoglGLES2Vtable: + * + * Provides function pointers for the full OpenGLES 2.0 api. The + * api must be accessed this way and not by directly calling + * symbols of any system OpenGLES 2.0 api. + * + * Since: 1.12 + * Stability: unstable + */ +typedef struct _CoglGLES2Vtable CoglGLES2Vtable; + +struct _CoglGLES2Vtable +{ + /*< private >*/ +#define COGL_EXT_BEGIN(name, \ + min_gl_major, min_gl_minor, \ + gles_availability, \ + extension_suffixes, extension_names) + +#define COGL_EXT_FUNCTION(ret, name, args) \ + ret (* name) args; + +#define COGL_EXT_END() + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +#undef COGL_EXT_BEGIN +#undef COGL_EXT_FUNCTION +#undef COGL_EXT_END +}; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_gles2_context_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_gles2_context_get_gtype (void); +#endif + +uint32_t +_cogl_gles2_context_error_quark (void); + +/** + * COGL_GLES2_CONTEXT_ERROR: + * + * An error domain for runtime exceptions relating to the + * cogl_gles2_context api. + * + * Since: 2.0 + * Stability: unstable + */ +#define COGL_GLES2_CONTEXT_ERROR (_cogl_gles2_context_error_quark ()) + +/** + * CoglGLES2ContextError: + * @COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED: Creating GLES2 contexts + * isn't supported. Applications should use cogl_has_feature() to + * check for the %COGL_FEATURE_ID_GLES2_CONTEXT. + * @COGL_GLES2_CONTEXT_ERROR_DRIVER: An underlying driver error + * occured. + * + * Error codes that relate to the cogl_gles2_context api. + */ +typedef enum { /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/ + COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, + COGL_GLES2_CONTEXT_ERROR_DRIVER +} CoglGLES2ContextError; + +/** + * cogl_gles2_context_new: + * @ctx: A #CoglContext + * @error: A pointer to a #CoglError for returning exceptions + * + * Allocates a new OpenGLES 2.0 context that can be used to render to + * #CoglOffscreen framebuffers (Rendering to #CoglOnscreen + * framebuffers is not currently supported). + * + * To actually access the OpenGLES 2.0 api itself you need to use + * cogl_gles2_context_get_vtable(). You should not try to directly link + * to and use the symbols provided by the a system OpenGLES 2.0 + * driver. + * + * Once you have allocated an OpenGLES 2.0 context you can make it + * current using cogl_push_gles2_context(). For those familiar with + * using the EGL api, this serves a similar purpose to eglMakeCurrent. + * + * Before using this api applications can check for OpenGLES 2.0 + * api support by checking for %COGL_FEATURE_ID_GLES2_CONTEXT support + * with cogl_has_feature(). This function will return %FALSE and + * return an %COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED error if the + * feature isn't available. + * + * Since: 2.0 + * Return value: A newly allocated #CoglGLES2Context or %NULL if there + * was an error and @error will be updated in that case. + * Stability: unstable + */ +CoglGLES2Context * +cogl_gles2_context_new (CoglContext *ctx, CoglError **error); + +/** + * cogl_gles2_context_get_vtable: + * @gles2_ctx: A #CoglGLES2Context allocated with + * cogl_gles2_context_new() + * + * Queries the OpenGLES 2.0 api function pointers that should be + * used for rendering with the given @gles2_ctx. + * + * You should not try to directly link to and use the symbols + * provided by any system OpenGLES 2.0 driver. + * + * Since: 2.0 + * Return value: A pointer to a #CoglGLES2Vtable providing pointers + * to functions for the full OpenGLES 2.0 api. + * Stability: unstable + */ +const CoglGLES2Vtable * +cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx); + +/** + * cogl_push_gles2_context: + * @ctx: A #CoglContext + * @gles2_ctx: A #CoglGLES2Context allocated with + * cogl_gles2_context_new() + * @read_buffer: A #CoglFramebuffer to access to read operations + * such as glReadPixels. (must be a #CoglOffscreen + * framebuffer currently) + * @write_buffer: A #CoglFramebuffer to access for drawing operations + * such as glDrawArrays. (must be a #CoglOffscreen + * framebuffer currently) + * @error: A pointer to a #CoglError for returning exceptions + * + * Pushes the given @gles2_ctx onto a stack associated with @ctx so + * that the OpenGLES 2.0 api can be used instead of the Cogl + * rendering apis to read and write to the specified framebuffers. + * + * Usage of the api available through a #CoglGLES2Vtable is only + * allowed between cogl_push_gles2_context() and + * cogl_pop_gles2_context() calls. + * + * If there is a runtime problem with switching over to the given + * @gles2_ctx then this function will return %FALSE and return + * an error through @error. + * + * Since: 2.0 + * Return value: %TRUE if operation was successfull or %FALSE + * otherwise and @error will be updated. + * Stability: unstable + */ +CoglBool +cogl_push_gles2_context (CoglContext *ctx, + CoglGLES2Context *gles2_ctx, + CoglFramebuffer *read_buffer, + CoglFramebuffer *write_buffer, + CoglError **error); + +/** + * cogl_pop_gles2_context: + * @ctx: A #CoglContext + * + * Restores the previously active #CoglGLES2Context if there + * were nested calls to cogl_push_gles2_context() or otherwise + * restores the ability to render with the Cogl api instead + * of OpenGLES 2.0. + * + * The behaviour is undefined if calls to cogl_pop_gles2_context() + * are not balenced with the number of corresponding calls to + * cogl_push_gles2_context(). + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pop_gles2_context (CoglContext *ctx); + +/** + * cogl_gles2_get_current_vtable: + * + * Returns the OpenGL ES 2.0 api vtable for the currently pushed + * #CoglGLES2Context (last pushed with cogl_push_gles2_context()) or + * %NULL if no #CoglGLES2Context has been pushed. + * + * Return value: The #CoglGLES2Vtable for the currently pushed + * #CoglGLES2Context or %NULL if none has been pushed. + * Since: 2.0 + * Stability: unstable + */ +CoglGLES2Vtable * +cogl_gles2_get_current_vtable (void); + +/** + * cogl_gles2_texture_2d_new_from_handle: + * @ctx: A #CoglContext + * @gles2_ctx: A #CoglGLES2Context allocated with + * cogl_gles2_context_new() + * @handle: An OpenGL ES 2.0 texture handle created with + * glGenTextures() + * @width: Width of the texture to allocate + * @height: Height of the texture to allocate + * @format: The format of the texture + * + * Creates a #CoglTexture2D from an OpenGL ES 2.0 texture handle that + * was created within the given @gles2_ctx via glGenTextures(). The + * texture needs to have been associated with the GL_TEXTURE_2D target. + * + * This interface is only intended for sharing textures to read + * from. The behaviour is undefined if the texture is modified using + * the Cogl api. + * + * Applications should only pass this function handles that were + * created via a #CoglGLES2Vtable or via libcogl-gles2 and not pass + * handles created directly using the system's native libGLESv2 + * api. + * + * Since: 2.0 + * Stability: unstable + */ +CoglTexture2D * +cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx, + CoglGLES2Context *gles2_ctx, + unsigned int handle, + int width, + int height, + CoglPixelFormat format); + +/** + * cogl_gles2_texture_get_handle: + * @texture: A #CoglTexture + * @handle: A return location for an OpenGL ES 2.0 texture handle + * @target: A return location for an OpenGL ES 2.0 texture target + * + * Gets an OpenGL ES 2.0 texture handle for a #CoglTexture that can + * then be referenced by a #CoglGLES2Context. As well as returning + * a texture handle the texture's target (such as GL_TEXTURE_2D) is + * also returned. + * + * If the #CoglTexture can not be shared with a #CoglGLES2Context then + * this function will return %FALSE. + * + * This api does not affect the lifetime of the CoglTexture and you + * must take care not to reference the returned handle after the + * original texture has been freed. + * + * This interface is only intended for sharing textures to read + * from. The behaviour is undefined if the texture is modified by a + * GLES2 context. + * + * This function will only return %TRUE for low-level + * #CoglTextures such as #CoglTexture2D or #CoglTexture3D but + * not for high level meta textures such as + * #CoglTexture2DSliced + * + * The handle returned should not be passed directly to a system + * OpenGL ES 2.0 library, the handle is only intended to be used via + * a #CoglGLES2Vtable or via libcogl-gles2. + * + * Return value: %TRUE if a handle and target could be returned + * otherwise %FALSE is returned. + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_gles2_texture_get_handle (CoglTexture *texture, + unsigned int *handle, + unsigned int *target); + +/** + * cogl_is_gles2_context: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglGLES2Context. + * + * Return value: %TRUE if the object references a #CoglGLES2Context + * and %FALSE otherwise. + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_is_gles2_context (void *object); + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_GLES2_H__ */ + diff --git a/cogl/cogl-glib-source.c b/cogl/cogl-glib-source.c new file mode 100644 index 0000000..fea2544 --- /dev/null +++ b/cogl/cogl-glib-source.c @@ -0,0 +1,195 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-glib-source.h" +#include "cogl-poll.h" + +typedef struct _CoglGLibSource +{ + GSource source; + + CoglRenderer *renderer; + + GArray *poll_fds; + int poll_fds_age; + + int64_t expiration_time; +} CoglGLibSource; + +static CoglBool +cogl_glib_source_prepare (GSource *source, int *timeout) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + CoglPollFD *poll_fds; + int n_poll_fds; + int64_t cogl_timeout; + int age; + int i; + + age = cogl_poll_renderer_get_info (cogl_source->renderer, + &poll_fds, + &n_poll_fds, + &cogl_timeout); + + /* We have to be careful not to call g_source_add/remove_poll unless + * the FDs have changed because it will cause the main loop to + * immediately wake up. If we call it every time the source is + * prepared it will effectively never go idle. */ + if (age != cogl_source->poll_fds_age) + { + /* Remove any existing polls before adding the new ones */ + for (i = 0; i < cogl_source->poll_fds->len; i++) + { + GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i); + g_source_remove_poll (source, poll_fd); + } + + g_array_set_size (cogl_source->poll_fds, n_poll_fds); + + for (i = 0; i < n_poll_fds; i++) + { + GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i); + poll_fd->fd = poll_fds[i].fd; + g_source_add_poll (source, poll_fd); + } + } + + cogl_source->poll_fds_age = age; + + /* Update the events */ + for (i = 0; i < n_poll_fds; i++) + { + GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i); + poll_fd->events = poll_fds[i].events; + poll_fd->revents = 0; + } + + if (cogl_timeout == -1) + { + *timeout = -1; + cogl_source->expiration_time = -1; + } + else + { + /* Round up to ensure that we don't try again too early */ + *timeout = (cogl_timeout + 999) / 1000; + cogl_source->expiration_time = (g_source_get_time (source) + + cogl_timeout); + } + + return *timeout == 0; +} + +static CoglBool +cogl_glib_source_check (GSource *source) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + int i; + + if (cogl_source->expiration_time >= 0 && + g_source_get_time (source) >= cogl_source->expiration_time) + return TRUE; + + for (i = 0; i < cogl_source->poll_fds->len; i++) + { + GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i); + if (poll_fd->revents != 0) + return TRUE; + } + + return FALSE; +} + +static CoglBool +cogl_glib_source_dispatch (GSource *source, + GSourceFunc callback, + void *user_data) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + CoglPollFD *poll_fds = + (CoglPollFD *) &g_array_index (cogl_source->poll_fds, GPollFD, 0); + + cogl_poll_renderer_dispatch (cogl_source->renderer, + poll_fds, + cogl_source->poll_fds->len); + + return TRUE; +} + +static void +cogl_glib_source_finalize (GSource *source) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + + g_array_free (cogl_source->poll_fds, TRUE); +} + +static GSourceFuncs +cogl_glib_source_funcs = + { + cogl_glib_source_prepare, + cogl_glib_source_check, + cogl_glib_source_dispatch, + cogl_glib_source_finalize + }; + +GSource * +cogl_glib_renderer_source_new (CoglRenderer *renderer, + int priority) +{ + GSource *source; + CoglGLibSource *cogl_source; + + source = g_source_new (&cogl_glib_source_funcs, + sizeof (CoglGLibSource)); + cogl_source = (CoglGLibSource *) source; + + cogl_source->renderer = renderer; + cogl_source->poll_fds = g_array_new (FALSE, FALSE, sizeof (GPollFD)); + + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority (source, priority); + + return source; +} + +GSource * +cogl_glib_source_new (CoglContext *context, + int priority) +{ + return cogl_glib_renderer_source_new (cogl_context_get_renderer (context), + priority); +} + + diff --git a/cogl/cogl-glib-source.h b/cogl/cogl-glib-source.h new file mode 100644 index 0000000..ddb7f99 --- /dev/null +++ b/cogl/cogl-glib-source.h @@ -0,0 +1,97 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_GSOURCE_H__ +#define __COGL_GSOURCE_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * cogl_glib_source_new: + * @context: A #CoglContext + * @priority: The priority of the #GSource + * + * Creates a #GSource which handles Cogl's internal system event + * processing. This can be used as a convenience instead of + * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in + * applications that are already using the GLib main loop. After this + * is called the #GSource should be attached to the main loop using + * g_source_attach(). + * + * Applications that manually connect to a #CoglRenderer before they + * create a #CoglContext should instead use + * cogl_glib_renderer_source_new() so that events may be dispatched + * before a context has been created. In that case you don't need to + * use this api in addition later, it is simply enough to use + * cogl_glib_renderer_source_new() instead. + * + * This api is actually just a thin convenience wrapper around + * cogl_glib_renderer_source_new() + * + * Return value: a new #GSource + * + * Stability: unstable + * Since: 1.10 + */ +GSource * +cogl_glib_source_new (CoglContext *context, + int priority); + +/** + * cogl_glib_renderer_source_new: + * @renderer: A #CoglRenderer + * @priority: The priority of the #GSource + * + * Creates a #GSource which handles Cogl's internal system event + * processing. This can be used as a convenience instead of + * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in + * applications that are already using the GLib main loop. After this + * is called the #GSource should be attached to the main loop using + * g_source_attach(). + * + * Return value: a new #GSource + * + * Stability: unstable + * Since: 1.16 + */ +GSource * +cogl_glib_renderer_source_new (CoglRenderer *renderer, + int priority); + +G_END_DECLS + +#endif /* __COGL_GSOURCE_H__ */ diff --git a/cogl/cogl-glsl-shader-boilerplate.h b/cogl/cogl-glsl-shader-boilerplate.h new file mode 100644 index 0000000..6d882da --- /dev/null +++ b/cogl/cogl-glsl-shader-boilerplate.h @@ -0,0 +1,86 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_SHADER_BOILERPLATE_H +#define __COGL_SHADER_BOILERPLATE_H + +#define _COGL_COMMON_SHADER_BOILERPLATE \ + "#define COGL_VERSION 100\n" \ + "\n" \ + "uniform mat4 cogl_modelview_matrix;\n" \ + "uniform mat4 cogl_modelview_projection_matrix;\n" \ + "uniform mat4 cogl_projection_matrix;\n" + +/* This declares all of the variables that we might need. This is + * working on the assumption that the compiler will optimise them out + * if they are not actually used. The GLSL spec at least implies that + * this will happen for varyings but it doesn't explicitly so for + * attributes */ +#define _COGL_VERTEX_SHADER_BOILERPLATE \ + _COGL_COMMON_SHADER_BOILERPLATE \ + "#define cogl_color_out _cogl_color\n" \ + "varying vec4 _cogl_color;\n" \ + "#define cogl_tex_coord_out _cogl_tex_coord\n" \ + "#define cogl_position_out gl_Position\n" \ + "#define cogl_point_size_out gl_PointSize\n" \ + "\n" \ + "attribute vec4 cogl_color_in;\n" \ + "attribute vec4 cogl_position_in;\n" \ + "#define cogl_tex_coord_in cogl_tex_coord0_in;\n" \ + "attribute vec3 cogl_normal_in;\n" + +#define _COGL_FRAGMENT_SHADER_BOILERPLATE \ + "#ifdef GL_ES\n" \ + "precision highp float;\n" \ + "#endif\n" \ + _COGL_COMMON_SHADER_BOILERPLATE \ + "\n" \ + "varying vec4 _cogl_color;\n" \ + "\n" \ + "#define cogl_color_in _cogl_color\n" \ + "#define cogl_tex_coord_in _cogl_tex_coord\n" \ + "\n" \ + "#define cogl_color_out gl_FragColor\n" \ + "#define cogl_depth_out gl_FragDepth\n" \ + "\n" \ + "#define cogl_front_facing gl_FrontFacing\n" \ + "\n" \ + "#define cogl_point_coord gl_PointCoord\n" +#if 0 + /* GLSL 1.2 has a bottom left origin, though later versions + * allow use of an origin_upper_left keyword which would be + * more appropriate for Cogl. */ + "#define coglFragCoord gl_FragCoord\n" +#endif + +#endif /* __COGL_SHADER_BOILERPLATE_H */ + diff --git a/cogl/cogl-glsl-shader-private.h b/cogl/cogl-glsl-shader-private.h new file mode 100644 index 0000000..9899c12 --- /dev/null +++ b/cogl/cogl-glsl-shader-private.h @@ -0,0 +1,41 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef _COGL_GLSL_SHADER_PRIVATE_H_ +#define _COGL_GLSL_SHADER_PRIVATE_H_ + +void +_cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx, + GLuint shader_gl_handle, + GLenum shader_gl_type, + CoglPipeline *pipeline, + GLsizei count_in, + const char **strings_in, + const GLint *lengths_in); + +#endif /* _COGL_GLSL_SHADER_PRIVATE_H_ */ diff --git a/cogl/cogl-glsl-shader.c b/cogl/cogl-glsl-shader.c new file mode 100644 index 0000000..196e0c7 --- /dev/null +++ b/cogl/cogl-glsl-shader.c @@ -0,0 +1,192 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-glsl-shader-private.h" +#include "cogl-glsl-shader-boilerplate.h" + +#include + +#include + +static CoglBool +add_layer_vertex_boilerplate_cb (CoglPipelineLayer *layer, + void *user_data) +{ + GString *layer_declarations = user_data; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + g_string_append_printf (layer_declarations, + "attribute vec4 cogl_tex_coord%d_in;\n" + "#define cogl_texture_matrix%i cogl_texture_matrix[%i]\n" + "#define cogl_tex_coord%i_out _cogl_tex_coord[%i]\n", + layer->index, + layer->index, + unit_index, + layer->index, + unit_index); + return TRUE; +} + +static CoglBool +add_layer_fragment_boilerplate_cb (CoglPipelineLayer *layer, + void *user_data) +{ + GString *layer_declarations = user_data; + g_string_append_printf (layer_declarations, + "#define cogl_tex_coord%i_in _cogl_tex_coord[%i]\n", + layer->index, + _cogl_pipeline_layer_get_unit_index (layer)); + return TRUE; +} + +void +_cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx, + GLuint shader_gl_handle, + GLenum shader_gl_type, + CoglPipeline *pipeline, + GLsizei count_in, + const char **strings_in, + const GLint *lengths_in) +{ + const char *vertex_boilerplate; + const char *fragment_boilerplate; + + const char **strings = g_alloca (sizeof (char *) * (count_in + 4)); + GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 4)); + char *version_string; + int count = 0; + + int n_layers; + + vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE; + fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE; + + version_string = g_strdup_printf ("#version %i\n\n", + ctx->glsl_version_to_use); + strings[count] = version_string; + lengths[count++] = -1; + + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + static const char texture_3d_extension[] = + "#extension GL_OES_texture_3D : enable\n"; + strings[count] = texture_3d_extension; + lengths[count++] = sizeof (texture_3d_extension) - 1; + } + + if (shader_gl_type == GL_VERTEX_SHADER) + { + strings[count] = vertex_boilerplate; + lengths[count++] = strlen (vertex_boilerplate); + } + else if (shader_gl_type == GL_FRAGMENT_SHADER) + { + strings[count] = fragment_boilerplate; + lengths[count++] = strlen (fragment_boilerplate); + } + + n_layers = cogl_pipeline_get_n_layers (pipeline); + if (n_layers) + { + GString *layer_declarations = ctx->codegen_boilerplate_buffer; + g_string_set_size (layer_declarations, 0); + + g_string_append_printf (layer_declarations, + "varying vec4 _cogl_tex_coord[%d];\n", + n_layers); + + if (shader_gl_type == GL_VERTEX_SHADER) + { + g_string_append_printf (layer_declarations, + "uniform mat4 cogl_texture_matrix[%d];\n", + n_layers); + + _cogl_pipeline_foreach_layer_internal (pipeline, + add_layer_vertex_boilerplate_cb, + layer_declarations); + } + else if (shader_gl_type == GL_FRAGMENT_SHADER) + { + _cogl_pipeline_foreach_layer_internal (pipeline, + add_layer_fragment_boilerplate_cb, + layer_declarations); + } + + strings[count] = layer_declarations->str; + lengths[count++] = -1; /* null terminated */ + } + + memcpy (strings + count, strings_in, sizeof (char *) * count_in); + if (lengths_in) + memcpy (lengths + count, lengths_in, sizeof (GLint) * count_in); + else + { + int i; + + for (i = 0; i < count_in; i++) + lengths[count + i] = -1; /* null terminated */ + } + count += count_in; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE))) + { + GString *buf = g_string_new (NULL); + int i; + + g_string_append_printf (buf, + "%s shader:\n", + shader_gl_type == GL_VERTEX_SHADER ? + "vertex" : "fragment"); + for (i = 0; i < count; i++) + if (lengths[i] != -1) + g_string_append_len (buf, strings[i], lengths[i]); + else + g_string_append (buf, strings[i]); + + g_message ("%s", buf->str); + + g_string_free (buf, TRUE); + } + + GE( ctx, glShaderSource (shader_gl_handle, count, + (const char **) strings, lengths) ); + + g_free (version_string); +} diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h new file mode 100644 index 0000000..20b7e67 --- /dev/null +++ b/cogl/cogl-glx-display-private.h @@ -0,0 +1,61 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_DISPLAY_GLX_PRIVATE_H +#define __COGL_DISPLAY_GLX_PRIVATE_H + +#include "cogl-object-private.h" + +typedef struct _CoglGLXCachedConfig +{ + /* This will be -1 if there is no cached config in this slot */ + int depth; + CoglBool found; + GLXFBConfig fb_config; + CoglBool can_mipmap; +} CoglGLXCachedConfig; + +#define COGL_GLX_N_CACHED_CONFIGS 3 + +typedef struct _CoglGLXDisplay +{ + CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS]; + + CoglBool found_fbconfig; + CoglBool fbconfig_has_rgba_visual; + GLXFBConfig fbconfig; + + /* Single context for all wins */ + GLXContext glx_context; + GLXWindow dummy_glxwin; + Window dummy_xwin; +} CoglGLXDisplay; + +#endif /* __COGL_DISPLAY_GLX_PRIVATE_H */ diff --git a/cogl/cogl-glx-renderer-private.h b/cogl/cogl-glx-renderer-private.h new file mode 100644 index 0000000..cb8ff97 --- /dev/null +++ b/cogl/cogl-glx-renderer-private.h @@ -0,0 +1,108 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_RENDERER_GLX_PRIVATE_H +#define __COGL_RENDERER_GLX_PRIVATE_H + +#include +#include "cogl-object-private.h" +#include "cogl-xlib-renderer-private.h" + +typedef struct _CoglGLXRenderer +{ + int glx_major; + int glx_minor; + + int glx_error_base; + int glx_event_base; + + CoglBool is_direct; + + /* Vblank stuff */ + int dri_fd; + + /* enumeration with relatioship between OML_sync_control + * UST (unadjusted-system-time) and the system clock */ + enum { + COGL_GLX_UST_IS_UNKNOWN, + COGL_GLX_UST_IS_GETTIMEOFDAY, + COGL_GLX_UST_IS_MONOTONIC_TIME, + COGL_GLX_UST_IS_OTHER + } ust_type; + + /* GModule pointing to libGL which we use to get glX functions out of */ + GModule *libgl_module; + + CoglClosure *flush_notifications_idle; + + /* Copy of the winsys features that are based purely on the + * information we can get without using a GL context. We want to + * determine this before we have a context so that we can use the + * function pointers from the extensions earlier. This is necessary + * to use the glXCreateContextAttribs function. */ + unsigned long base_winsys_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_WINSYS_FEATURE_N_FEATURES)]; + + CoglFeatureFlags legacy_feature_flags; + + /* Function pointers for core GLX functionality. We can't just link + against these directly because we need to conditionally load + libGL when we are using GLX so that it won't conflict with a GLES + library if we are using EGL + GLES. These are just the functions + that we want to use before calling glXGetProcAddress */ + Bool + (* glXQueryExtension) (Display *dpy, int *errorb, int *event); + const char * + (* glXQueryExtensionsString) (Display *dpy, int screen); + Bool + (* glXQueryVersion) (Display *dpy, int *maj, int *min); + void * + (* glXGetProcAddress) (const GLubyte *procName); + + int + (* glXQueryDrawable) (Display *dpy, GLXDrawable drawable, + int attribute, unsigned int *value); + + /* Function pointers for GLX specific extensions */ +#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d, e, f, g) + +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + ret (APIENTRY * name) args; + +#define COGL_WINSYS_FEATURE_END() + +#include "cogl-winsys-glx-feature-functions.h" + +#undef COGL_WINSYS_FEATURE_BEGIN +#undef COGL_WINSYS_FEATURE_FUNCTION +#undef COGL_WINSYS_FEATURE_END +} CoglGLXRenderer; + +#endif /* __COGL_RENDERER_GLX_PRIVATE_H */ diff --git a/cogl/cogl-glx.h b/cogl/cogl-glx.h new file mode 100644 index 0000000..15918bb --- /dev/null +++ b/cogl/cogl-glx.h @@ -0,0 +1,95 @@ +/* + * Cogl + * + * A Low-Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_GLX_H__ +#define __COGL_GLX_H__ + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_GLX_H_INSIDE__ */ +#ifndef __COGL_GLX_H_INSIDE__ +#define __COGL_GLX_H_INSIDE__ +#endif + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + + +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_glx_context_get_glx_context: + * @context: A #CoglContext pointer + * + * If you have done a runtime check to determine that Cogl is using + * GLX internally then this API can be used to retrieve the GLXContext + * handle that was setup internally. The result is undefined if Cogl + * is not using GLX. + * + * Return value: The internally setup GLXContext handle. + * Since: 1.18 + * Stability: unstable + */ +GLXContext +cogl_glx_context_get_glx_context (CoglContext *context); + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_GLX_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_GLX_H__ */ diff --git a/cogl/cogl-gpu-info-private.h b/cogl/cogl-gpu-info-private.h new file mode 100644 index 0000000..e532cdd --- /dev/null +++ b/cogl/cogl-gpu-info-private.h @@ -0,0 +1,117 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_GPU_INFO_PRIVATE_H +#define __COGL_GPU_INFO_PRIVATE_H + +#include "cogl-context.h" + +typedef enum _CoglGpuInfoArchitectureFlag +{ + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE, + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED, + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_SOFTWARE, + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_DEFERRED, + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_SOFTWARE +} CoglGpuInfoArchitectureFlag; + +typedef enum _CoglGpuInfoArchitecture +{ + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + COGL_GPU_INFO_ARCHITECTURE_SANDYBRIDGE, + COGL_GPU_INFO_ARCHITECTURE_SGX, + COGL_GPU_INFO_ARCHITECTURE_MALI, + COGL_GPU_INFO_ARCHITECTURE_LLVMPIPE, + COGL_GPU_INFO_ARCHITECTURE_SOFTPIPE, + COGL_GPU_INFO_ARCHITECTURE_SWRAST +} CoglGpuInfoArchitecture; + +typedef enum +{ + COGL_GPU_INFO_VENDOR_UNKNOWN, + COGL_GPU_INFO_VENDOR_INTEL, + COGL_GPU_INFO_VENDOR_IMAGINATION_TECHNOLOGIES, + COGL_GPU_INFO_VENDOR_ARM, + COGL_GPU_INFO_VENDOR_QUALCOMM, + COGL_GPU_INFO_VENDOR_NVIDIA, + COGL_GPU_INFO_VENDOR_ATI, + COGL_GPU_INFO_VENDOR_MESA +} CoglGpuInfoVendor; + +typedef enum +{ + COGL_GPU_INFO_DRIVER_PACKAGE_UNKNOWN, + COGL_GPU_INFO_DRIVER_PACKAGE_MESA +} CoglGpuInfoDriverPackage; + +typedef enum +{ + /* If this bug is present then it is faster to read pixels into a + * PBO and then memcpy out of the PBO into system memory rather than + * directly read into system memory. + * https://bugs.freedesktop.org/show_bug.cgi?id=46631 + */ + COGL_GPU_INFO_DRIVER_BUG_MESA_46631_SLOW_READ_PIXELS = 1 << 0 +} CoglGpuInfoDriverBug; + +typedef struct _CoglGpuInfoVersion CoglGpuInfoVersion; + +typedef struct _CoglGpuInfo CoglGpuInfo; + +struct _CoglGpuInfo +{ + CoglGpuInfoVendor vendor; + const char *vendor_name; + + CoglGpuInfoDriverPackage driver_package; + const char *driver_package_name; + int driver_package_version; + + CoglGpuInfoArchitecture architecture; + const char *architecture_name; + CoglGpuInfoArchitectureFlag architecture_flags; + + CoglGpuInfoDriverBug driver_bugs; +}; + +/* + * _cogl_gpu_info_init: + * @ctx: A #CoglContext + * @gpu: A return location for the GPU information + * + * Determines information about the GPU and driver from the given + * context. + */ +void +_cogl_gpu_info_init (CoglContext *ctx, + CoglGpuInfo *gpu); + +#endif /* __COGL_GPU_INFO_PRIVATE_H */ diff --git a/cogl/cogl-gpu-info.c b/cogl/cogl-gpu-info.c new file mode 100644 index 0000000..54dfe18 --- /dev/null +++ b/cogl/cogl-gpu-info.c @@ -0,0 +1,581 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-gpu-info-private.h" +#include "cogl-context-private.h" +#include "cogl-version.h" + +typedef struct +{ + const char *renderer_string; + const char *version_string; + const char *vendor_string; +} CoglGpuInfoStrings; + +typedef struct CoglGpuInfoArchitectureDescription +{ + CoglGpuInfoArchitecture architecture; + const char *name; + CoglGpuInfoArchitectureFlag flags; + CoglBool (* check_function) (const CoglGpuInfoStrings *strings); + +} CoglGpuInfoArchitectureDescription; + +typedef struct +{ + CoglGpuInfoVendor vendor; + const char *name; + CoglBool (* check_function) (const CoglGpuInfoStrings *strings); + const CoglGpuInfoArchitectureDescription *architectures; + +} CoglGpuInfoVendorDescription; + +typedef struct +{ + CoglGpuInfoDriverPackage driver_package; + const char *name; + CoglBool (* check_function) (const CoglGpuInfoStrings *strings, + int *version_out); +} CoglGpuInfoDriverPackageDescription; + +static CoglBool +_cogl_gpu_info_parse_version_string (const char *version_string, + int n_components, + const char **tail, + int *version_ret) +{ + int version = 0; + uint64_t part; + int i; + + for (i = 0; ; i++) + { + errno = 0; + part = g_ascii_strtoull (version_string, + (char **) &version_string, + 10); + + if (errno || part > COGL_VERSION_MAX_COMPONENT_VALUE) + return FALSE; + + version |= part << ((2 - i) * COGL_VERSION_COMPONENT_BITS); + + if (i + 1 >= n_components) + break; + + if (*version_string != '.') + return FALSE; + + version_string++; + } + + if (version_ret) + *version_ret = version; + if (tail) + *tail = version_string; + + return TRUE; +} + +static CoglBool +match_phrase (const char *string, const char *phrase) +{ + const char *part = strstr (string, phrase); + int len; + + if (part == NULL) + return FALSE; + + /* The match must either be at the beginning of the string or + preceded by a space. */ + if (part > string && part[-1] != ' ') + return FALSE; + + /* Also match must either be at end of string or followed by a + * space. */ + len = strlen (phrase); + if (part[len] != '\0' && part[len] != ' ') + return FALSE; + + return TRUE; +} + +static CoglBool +check_intel_vendor (const CoglGpuInfoStrings *strings) +{ + return match_phrase (strings->renderer_string, "Intel(R)"); +} + +static CoglBool +check_imagination_technologies_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "Imagination Technologies") != 0) + return FALSE; + return TRUE; +} + +static CoglBool +check_arm_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "ARM") != 0) + return FALSE; + return TRUE; +} + +static CoglBool +check_qualcomm_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "Qualcomm") != 0) + return FALSE; + return TRUE; +} + +static CoglBool +check_nvidia_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "NVIDIA") != 0) + return FALSE; + + return TRUE; +} + +static CoglBool +check_ati_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "ATI") != 0) + return FALSE; + + return TRUE; +} + +static CoglBool +check_mesa_vendor (const CoglGpuInfoStrings *strings) +{ + if (strcmp (strings->vendor_string, "Tungsten Graphics, Inc") == 0) + return TRUE; + else if (strcmp (strings->vendor_string, "VMware, Inc.") == 0) + return TRUE; + else if (strcmp (strings->vendor_string, "Mesa Project") == 0) + return TRUE; + + return FALSE; +} + +static CoglBool +check_true (const CoglGpuInfoStrings *strings) +{ + /* This is a last resort so it always matches */ + return TRUE; +} + +static CoglBool +check_sandybridge_architecture (const CoglGpuInfoStrings *strings) +{ + return match_phrase (strings->renderer_string, "Sandybridge"); +} + +static CoglBool +check_llvmpipe_architecture (const CoglGpuInfoStrings *strings) +{ + return match_phrase (strings->renderer_string, "llvmpipe"); +} + +static CoglBool +check_softpipe_architecture (const CoglGpuInfoStrings *strings) +{ + return match_phrase (strings->renderer_string, "softpipe"); +} + +static CoglBool +check_swrast_architecture (const CoglGpuInfoStrings *strings) +{ + return match_phrase (strings->renderer_string, "software rasterizer") || + match_phrase (strings->renderer_string, "Software Rasterizer"); +} + +static CoglBool +check_sgx_architecture (const CoglGpuInfoStrings *strings) +{ + if (strncmp (strings->renderer_string, "PowerVR SGX", 12) != 0) + return FALSE; + + return TRUE; +} + +static CoglBool +check_mali_architecture (const CoglGpuInfoStrings *strings) +{ + if (strncmp (strings->renderer_string, "Mali-", 5) != 0) + return FALSE; + + return TRUE; +} + +static const CoglGpuInfoArchitectureDescription +intel_architectures[] = + { + { + COGL_GPU_INFO_ARCHITECTURE_SANDYBRIDGE, + "Sandybridge", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + check_sandybridge_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + "Unknown", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + check_true + } + }; + +static const CoglGpuInfoArchitectureDescription +powervr_architectures[] = + { + { + COGL_GPU_INFO_ARCHITECTURE_SGX, + "SGX", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_DEFERRED, + check_sgx_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + "Unknown", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED | + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED, + check_true + } + }; + +static const CoglGpuInfoArchitectureDescription +arm_architectures[] = + { + { + COGL_GPU_INFO_ARCHITECTURE_MALI, + "Mali", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + check_mali_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + "Unknown", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_TILED | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + check_true + } + }; + +static const CoglGpuInfoArchitectureDescription +mesa_architectures[] = + { + { + COGL_GPU_INFO_ARCHITECTURE_LLVMPIPE, + "LLVM Pipe", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_SOFTWARE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_SOFTWARE, + check_llvmpipe_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_SOFTPIPE, + "Softpipe", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_SOFTWARE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_SOFTWARE, + check_softpipe_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_SWRAST, + "SWRast", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_SOFTWARE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_SOFTWARE, + check_swrast_architecture + }, + { + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + "Unknown", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_FRAGMENT_IMMEDIATE_MODE, + check_true + } + }; + +static const CoglGpuInfoArchitectureDescription +unknown_architectures[] = + { + { + COGL_GPU_INFO_ARCHITECTURE_UNKNOWN, + "Unknown", + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE | + COGL_GPU_INFO_ARCHITECTURE_FLAG_VERTEX_IMMEDIATE_MODE, + check_true + } + }; + +static const CoglGpuInfoVendorDescription +_cogl_gpu_info_vendors[] = + { + { + COGL_GPU_INFO_VENDOR_INTEL, + "Intel", + check_intel_vendor, + intel_architectures + }, + { + COGL_GPU_INFO_VENDOR_IMAGINATION_TECHNOLOGIES, + "Imagination Technologies", + check_imagination_technologies_vendor, + powervr_architectures + }, + { + COGL_GPU_INFO_VENDOR_ARM, + "ARM", + check_arm_vendor, + arm_architectures + }, + { + COGL_GPU_INFO_VENDOR_QUALCOMM, + "Qualcomm", + check_qualcomm_vendor, + unknown_architectures + }, + { + COGL_GPU_INFO_VENDOR_NVIDIA, + "Nvidia", + check_nvidia_vendor, + unknown_architectures + }, + { + COGL_GPU_INFO_VENDOR_ATI, + "ATI", + check_ati_vendor, + unknown_architectures + }, + /* Must be last */ + { + COGL_GPU_INFO_VENDOR_MESA, + "Mesa", + check_mesa_vendor, + mesa_architectures + }, + { + COGL_GPU_INFO_VENDOR_UNKNOWN, + "Unknown", + check_true, + unknown_architectures + } + }; + +static CoglBool +check_mesa_driver_package (const CoglGpuInfoStrings *strings, + int *version_ret) +{ + uint64_t micro_part; + const char *v; + + /* The version string should always begin a two-part GL version + number */ + if (!_cogl_gpu_info_parse_version_string (strings->version_string, + 2, /* n_components */ + &v, /* tail */ + NULL /* version_ret */)) + return FALSE; + + /* In mesa this will be followed optionally by "(Core Profile)" and + * then "Mesa" */ + v = strstr (v, " Mesa "); + if (!v) + return FALSE; + + v += 6; + + /* Next there will be a version string that is at least two + components. On a git devel build the version will be something + like "-devel" instead */ + if (!_cogl_gpu_info_parse_version_string (v, + 2, /* n_components */ + &v, /* tail */ + version_ret)) + return FALSE; + + /* If it is a development build then we'll just leave the micro + number as 0 */ + if (g_str_has_prefix (v, "-devel")) + return TRUE; + + /* Otherwise there should be a micro version number */ + if (*v != '.') + return FALSE; + + errno = 0; + micro_part = g_ascii_strtoull (v + 1, NULL /* endptr */, 10 /* base */); + if (errno || micro_part > COGL_VERSION_MAX_COMPONENT_VALUE) + return FALSE; + + *version_ret = COGL_VERSION_ENCODE (COGL_VERSION_GET_MAJOR (*version_ret), + COGL_VERSION_GET_MINOR (*version_ret), + micro_part); + + return TRUE; +} + +UNIT_TEST (check_mesa_driver_package_parser, + 0, /* no requirements */ + 0 /* no failure cases */) +{ + /* renderer_string, version_string, vendor_string;*/ + const CoglGpuInfoStrings test_strings[2] = { + { NULL, "3.1 Mesa 9.2-devel15436ad", NULL }, + { NULL, "3.1 (Core Profile) Mesa 9.2.0-devel (git-15436ad)", NULL } + }; + int i; + int version; + + for (i = 0; i < G_N_ELEMENTS (test_strings); i++) + { + g_assert (check_mesa_driver_package (&test_strings[i], &version)); + g_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0)); + } +} + +static CoglBool +check_unknown_driver_package (const CoglGpuInfoStrings *strings, + int *version_out) +{ + *version_out = 0; + + /* This is a last resort so it always matches */ + return TRUE; +} + +static const CoglGpuInfoDriverPackageDescription +_cogl_gpu_info_driver_packages[] = + { + { + COGL_GPU_INFO_DRIVER_PACKAGE_MESA, + "Mesa", + check_mesa_driver_package + }, + /* Must be last */ + { + COGL_GPU_INFO_DRIVER_PACKAGE_UNKNOWN, + "Unknown", + check_unknown_driver_package + } + }; + +void +_cogl_gpu_info_init (CoglContext *ctx, + CoglGpuInfo *gpu) +{ + CoglGpuInfoStrings strings; + int i; + + strings.renderer_string = (const char *) ctx->glGetString (GL_RENDERER); + strings.version_string = _cogl_context_get_gl_version (ctx); + strings.vendor_string = (const char *) ctx->glGetString (GL_VENDOR); + + /* Determine the driver package */ + for (i = 0; ; i++) + { + const CoglGpuInfoDriverPackageDescription *description = + _cogl_gpu_info_driver_packages + i; + + if (description->check_function (&strings, &gpu->driver_package_version)) + { + gpu->driver_package = description->driver_package; + gpu->driver_package_name = description->name; + break; + } + } + + /* Determine the GPU vendor */ + for (i = 0; ; i++) + { + const CoglGpuInfoVendorDescription *description = + _cogl_gpu_info_vendors + i; + + if (description->check_function (&strings)) + { + int j; + + gpu->vendor = description->vendor; + gpu->vendor_name = description->name; + + for (j = 0; ; j++) + { + const CoglGpuInfoArchitectureDescription *architecture = + description->architectures + j; + + if (architecture->check_function (&strings)) + { + gpu->architecture = architecture->architecture; + gpu->architecture_name = architecture->name; + gpu->architecture_flags = architecture->flags; + goto probed; + } + } + } + } + +probed: + + COGL_NOTE (WINSYS, "Driver package = %s, vendor = %s, architecture = %s\n", + gpu->driver_package_name, + gpu->vendor_name, + gpu->architecture_name); + + /* Determine the driver bugs */ + + /* In Mesa the glReadPixels implementation is really slow + when using the Intel driver. The Intel + driver has a fast blit path when reading into a PBO. Reading into + a temporary PBO and then memcpying back out to the application's + memory is faster than a regular glReadPixels in this case */ + if (gpu->vendor == COGL_GPU_INFO_VENDOR_INTEL && + gpu->driver_package == COGL_GPU_INFO_DRIVER_PACKAGE_MESA) + gpu->driver_bugs |= COGL_GPU_INFO_DRIVER_BUG_MESA_46631_SLOW_READ_PIXELS; +} diff --git a/cogl/cogl-gtype-private.h b/cogl/cogl-gtype-private.h new file mode 100644 index 0000000..8498385 --- /dev/null +++ b/cogl/cogl-gtype-private.h @@ -0,0 +1,278 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_GTYPE_PRIVATE_H__ +#define __COGL_GTYPE_PRIVATE_H__ + +#include "config.h" + +#include +#include + +#include "cogl-object-private.h" + +/* Move this to public headers? */ +typedef struct _CoglGtypeObject CoglGtypeObject; +typedef struct _CoglGtypeClass CoglGtypeClass; + +struct _CoglGtypeObject +{ + GTypeInstance parent_instance; + + guint dummy; +}; + +struct _CoglGtypeClass +{ + GTypeClass base_class; + + guint dummy; +}; + +#define I_(str) (g_intern_static_string ((str))) + +/**/ + +#define COGL_GTYPE_DEFINE_BOXED(Name,underscore_name,copy_func,free_func) \ +GType \ +cogl_##underscore_name##_get_gtype (void) \ +{ \ + static volatile size_t type_volatile = 0; \ + if (g_once_init_enter (&type_volatile)) \ + { \ + GType type = \ + g_boxed_type_register_static (g_intern_static_string (I_("Cogl" # Name)), \ + (GBoxedCopyFunc)copy_func, \ + (GBoxedFreeFunc)free_func); \ + g_once_init_leave (&type_volatile, type); \ + } \ + return type_volatile; \ +} + +#define COGL_GTYPE_IMPLEMENT_INTERFACE(name) { \ + const GInterfaceInfo g_implement_interface_info = { \ + (GInterfaceInitFunc) _cogl_gtype_dummy_iface_init, NULL, NULL \ + }; \ + g_type_add_interface_static (fundamental_type_id, \ + cogl_##name##_get_gtype(), \ + &g_implement_interface_info); \ + } + +#define _COGL_GTYPE_DEFINE_BASE_CLASS_BEGIN(Name,name) \ +GType \ +cogl_##name##_get_gtype (void) \ +{ \ + static volatile gsize type_id__volatile = 0; \ + if (g_once_init_enter (&type_id__volatile)) \ + { \ + static const GTypeFundamentalInfo finfo = { \ + (G_TYPE_FLAG_CLASSED | \ + G_TYPE_FLAG_INSTANTIATABLE | \ + G_TYPE_FLAG_DERIVABLE | \ + G_TYPE_FLAG_DEEP_DERIVABLE), \ + }; \ + static const GTypeValueTable value_table = { \ + _cogl_gtype_object_init_value, \ + _cogl_gtype_object_free_value, \ + _cogl_gtype_object_copy_value, \ + _cogl_gtype_object_peek_pointer, \ + "p", \ + _cogl_gtype_object_collect_value, \ + "p", \ + _cogl_gtype_object_lcopy_value, \ + }; \ + const GTypeInfo node_info = { \ + sizeof (CoglObjectClass), \ + (GBaseInitFunc) _cogl_gtype_object_class_base_init, \ + (GBaseFinalizeFunc) _cogl_gtype_object_class_base_finalize, \ + (GClassInitFunc) _cogl_gtype_object_class_init, \ + (GClassFinalizeFunc) NULL, \ + NULL, \ + sizeof (CoglObject), \ + 0, \ + (GInstanceInitFunc) _cogl_gtype_object_init, \ + &value_table, \ + }; \ + GType fundamental_type_id = \ + g_type_register_fundamental (g_type_fundamental_next (), \ + I_("Cogl" # Name), \ + &node_info, &finfo, \ + G_TYPE_FLAG_ABSTRACT); \ + g_once_init_leave (&type_id__volatile, \ + fundamental_type_id); + +#define _COGL_GTYPE_DEFINE_BASE_CLASS_END() \ + } \ + return type_id__volatile; \ + } + +#define COGL_GTYPE_DEFINE_BASE_CLASS(Name,name,...) \ + _COGL_GTYPE_DEFINE_BASE_CLASS_BEGIN(Name,name) \ + {__VA_ARGS__;} \ + _COGL_GTYPE_DEFINE_BASE_CLASS_END() + +#define _COGL_GTYPE_DEFINE_INTERFACE_EXTENDED_BEGIN(Name,name) \ + \ + static void name##_default_init (Name##Interface *klass); \ + GType \ + name##_get_gtype (void) \ + { \ + static volatile gsize type_id__volatile = 0; \ + if (g_once_init_enter (&type_id__volatile)) \ + { \ + GType fundamental_type_id = \ + g_type_register_static_simple (G_TYPE_INTERFACE, \ + g_intern_static_string (#Name), \ + sizeof (Name##Interface), \ + (GClassInitFunc)name##_default_init, \ + 0, \ + (GInstanceInitFunc)NULL, \ + (GTypeFlags) 0); \ + g_type_interface_add_prerequisite (fundamental_type_id, \ + cogl_object_get_gtype()); \ + { /* custom code follows */ + +#define _COGL_GTYPE_DEFINE_INTERFACE_EXTENDED_END() \ + /* following custom code */ \ + } \ + g_once_init_leave (&type_id__volatile, \ + fundamental_type_id); \ + } \ + return type_id__volatile; \ + } /* closes name##_get_type() */ + + +#define COGL_GTYPE_DEFINE_INTERFACE(Name,name) \ + typedef struct _Cogl##Name##Iface Cogl##Name##Iface; \ + typedef Cogl##Name##Iface Cogl##Name##Interface; \ + struct _Cogl##Name##Iface \ + { \ + /*< private >*/ \ + GTypeInterface g_iface; \ + }; \ + _COGL_GTYPE_DEFINE_INTERFACE_EXTENDED_BEGIN (Cogl##Name, cogl_##name) \ + _COGL_GTYPE_DEFINE_INTERFACE_EXTENDED_END () \ + static void \ + cogl_##name##_default_init (Cogl##Name##Interface *iface) \ + { \ + } + +#define _COGL_GTYPE_DEFINE_TYPE_EXTENDED_BEGIN(Name,name,parent,flags) \ + \ + static void name##_init (Name *self); \ + static void name##_class_init (Name##Class *klass); \ + static gpointer name##_parent_class = NULL; \ + static gint Name##_private_offset; \ + \ + static void \ + name##_class_intern_init (gpointer klass) \ + { \ + name##_parent_class = g_type_class_peek_parent (klass); \ + name##_class_init ((Name##Class*) klass); \ + } \ + \ + static inline gpointer \ + name##_get_instance_private (Name *self) \ + { \ + return (G_STRUCT_MEMBER_P (self, Name ##_private_offset)); \ + } \ + \ + GType \ + name##_get_gtype (void) \ + { \ + static volatile gsize type_id__volatile = 0; \ + if (g_once_init_enter (&type_id__volatile)) \ + { \ + GType fundamental_type_id = \ + g_type_register_static_simple (parent, \ + g_intern_static_string (#Name), \ + sizeof (Name##Class), \ + (GClassInitFunc) name##_class_intern_init, \ + sizeof (Name), \ + (GInstanceInitFunc) name##_init, \ + (GTypeFlags) flags); \ + { /* custom code follows */ + +#define _COGL_GTYPE_DEFINE_TYPE_EXTENDED_END() \ + /* following custom code */ \ + } \ + g_once_init_leave (&type_id__volatile, \ + fundamental_type_id); \ + } \ + return type_id__volatile; \ + } /* closes name##_get_type() */ + + +#define COGL_GTYPE_DEFINE_CLASS(Name,name,...) \ + typedef struct _Cogl##Name##Class Cogl##Name##Class; \ + struct _Cogl##Name##Class { \ + CoglObjectClass parent_class; \ + }; \ + _COGL_GTYPE_DEFINE_TYPE_EXTENDED_BEGIN(Cogl##Name, \ + cogl_##name, \ + cogl_object_get_gtype(), \ + 0) \ + {__VA_ARGS__;} \ + _COGL_GTYPE_DEFINE_TYPE_EXTENDED_END() \ + static void \ + cogl_##name##_init (Cogl##Name *instance) \ + { \ + } \ + static void \ + cogl_##name##_class_init (Cogl##Name##Class *klass) \ + { \ + } + +void _cogl_gtype_object_init_value (GValue *value); +void _cogl_gtype_object_free_value (GValue *value); +void _cogl_gtype_object_copy_value (const GValue *src, + GValue *dst); +gpointer _cogl_gtype_object_peek_pointer (const GValue *value); +gchar *_cogl_gtype_object_collect_value (GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags); +gchar *_cogl_gtype_object_lcopy_value (const GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags); + +void _cogl_gtype_object_class_base_init (CoglObjectClass *klass); +void _cogl_gtype_object_class_base_finalize (CoglObjectClass *klass); +void _cogl_gtype_object_class_init (CoglObjectClass *klass); +void _cogl_gtype_object_init (CoglObject *object); + +void cogl_object_value_set_object (GValue *value, + gpointer object); +gpointer cogl_object_value_get_object (const GValue *value); + +void _cogl_gtype_dummy_iface_init (gpointer iface); + +#endif /* __COGL_GTYPE_PRIVATE_H__ */ diff --git a/cogl/cogl-gtype.c b/cogl/cogl-gtype.c new file mode 100644 index 0000000..314d8e4 --- /dev/null +++ b/cogl/cogl-gtype.c @@ -0,0 +1,153 @@ +#include "cogl-gtype-private.h" + +#include + +void +_cogl_gtype_object_init_value (GValue *value) +{ + value->data[0].v_pointer = NULL; +} + +void +_cogl_gtype_object_free_value (GValue *value) +{ + if (value->data[0].v_pointer != NULL) + cogl_object_unref (value->data[0].v_pointer); +} + +void +_cogl_gtype_object_copy_value (const GValue *src, + GValue *dst) +{ + if (src->data[0].v_pointer != NULL) + dst->data[0].v_pointer = cogl_object_ref (src->data[0].v_pointer); + else + dst->data[0].v_pointer = NULL; +} + +gpointer +_cogl_gtype_object_peek_pointer (const GValue *value) +{ + return value->data[0].v_pointer; +} + +gchar * +_cogl_gtype_object_collect_value (GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags) +{ + CoglObject *object; + + object = collect_values[0].v_pointer; + + if (object == NULL) + { + value->data[0].v_pointer = NULL; + return NULL; + } + + if (object->klass == NULL) + return g_strconcat ("invalid unclassed CoglObject pointer for " + "value type '", + G_VALUE_TYPE_NAME (value), + "'", + NULL); + + value->data[0].v_pointer = cogl_object_ref (object); + + return NULL; +} + +gchar * +_cogl_gtype_object_lcopy_value (const GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags) +{ + CoglObject **object_p = collect_values[0].v_pointer; + + if (object_p == NULL) + return g_strconcat ("value location for '", + G_VALUE_TYPE_NAME (value), + "' passed as NULL", + NULL); + + if (value->data[0].v_pointer == NULL) + *object_p = NULL; + else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) + *object_p = value->data[0].v_pointer; + else + *object_p = cogl_object_ref (value->data[0].v_pointer); + + return NULL; +} + +void +_cogl_gtype_object_class_base_init (CoglObjectClass *klass) +{ +} + +void +_cogl_gtype_object_class_base_finalize (CoglObjectClass *klass) +{ +} + +void +_cogl_gtype_object_class_init (CoglObjectClass *klass) +{ +} + +void +_cogl_gtype_object_init (CoglObject *object) +{ +} + +void +_cogl_gtype_dummy_iface_init (gpointer iface) +{ +} + +/** + * cogl_object_value_set_object: + * @value: a #GValue initialized with %COGL_GTYPE_TYPE_OBJECT + * @object: (type Cogl.GtypeObject) (allow-none): a #CoglGtypeObject, or %NULL + * + * Sets the contents of a #GValue initialized with %COGL_GTYPE_TYPE_OBJECT. + * + */ +void +cogl_object_value_set_object (GValue *value, + gpointer object) +{ + CoglObject *old_object; + + old_object = value->data[0].v_pointer; + + if (object != NULL) + { + /* take over ownership */ + value->data[0].v_pointer = object; + } + else + value->data[0].v_pointer = NULL; + + if (old_object != NULL) + cogl_object_unref (old_object); +} + +/** + * cogl_object_value_get_object: + * @value: a #GValue initialized with %COGL_GTYPE_TYPE_OBJECT + * + * Retrieves a pointer to the #CoglGtypeObject contained inside + * the passed #GValue. + * + * Return value: (transfer none) (type Cogl.GtypeObject): a pointer to + * a #CoglGtypeObject, or %NULL + */ +gpointer +cogl_object_value_get_object (const GValue *value) +{ + return value->data[0].v_pointer; +} diff --git a/cogl/cogl-i18n-private.h b/cogl/cogl-i18n-private.h new file mode 100644 index 0000000..f77a343 --- /dev/null +++ b/cogl/cogl-i18n-private.h @@ -0,0 +1,41 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef _COGL_I18N_PRIVATE_H_ +#define _COGL_I18N_PRIVATE_H_ + +#ifdef ENABLE_NLS +#include +#else +#define _(X) X +#define N_(X) X +#endif + +#endif /* _COGL_I18N_PRIVATE_H_ */ diff --git a/cogl/cogl-index-buffer-private.h b/cogl/cogl-index-buffer-private.h new file mode 100644 index 0000000..d9596cd --- /dev/null +++ b/cogl/cogl-index-buffer-private.h @@ -0,0 +1,44 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_INDEX_BUFFER_PRIVATE_H +#define __COGL_INDEX_BUFFER_PRIVATE_H + +#include "cogl-buffer-private.h" + +struct _CoglIndexBuffer +{ + CoglBuffer _parent; +}; + +#endif /* __COGL_INDEX_BUFFER_PRIVATE_H */ diff --git a/cogl/cogl-index-buffer.c b/cogl/cogl-index-buffer.c new file mode 100644 index 0000000..cddaf47 --- /dev/null +++ b/cogl/cogl-index-buffer.c @@ -0,0 +1,112 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object-private.h" +#include "cogl-indices.h" +#include "cogl-indices-private.h" +#include "cogl-context-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_index_buffer_free (CoglIndexBuffer *indices); + +COGL_BUFFER_DEFINE (IndexBuffer, index_buffer); +COGL_GTYPE_DEFINE_CLASS (IndexBuffer, index_buffer); + +/* XXX: Unlike the wiki design this just takes a size. A single + * indices buffer should be able to contain multiple ranges of indices + * which the wiki design doesn't currently consider. */ +CoglIndexBuffer * +cogl_index_buffer_new (CoglContext *context, size_t bytes) +{ + CoglIndexBuffer *indices = g_slice_new (CoglIndexBuffer); + + /* parent's constructor */ + _cogl_buffer_initialize (COGL_BUFFER (indices), + context, + bytes, + COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, + COGL_BUFFER_USAGE_HINT_INDEX_BUFFER, + COGL_BUFFER_UPDATE_HINT_STATIC); + + return _cogl_index_buffer_object_new (indices); +} + +static void +_cogl_index_buffer_free (CoglIndexBuffer *indices) +{ + /* parent's destructor */ + _cogl_buffer_fini (COGL_BUFFER (indices)); + + g_slice_free (CoglIndexBuffer, indices); +} + +/* XXX: do we want a convenience function like this as an alternative + * to using cogl_buffer_set_data? The advantage of this is that we can + * track meta data such as the indices type and max_index_value for a + * range as part of the indices buffer. If we just leave people to use + * cogl_buffer_set_data then we either need a way to specify the type + * and max index value at draw time or we'll want a separate way to + * declare the type and max value for a range after uploading the + * data. + * + * XXX: I think in the end it'll be that CoglIndices are to + * CoglIndexBuffers as CoglAttributes are to CoglAttributeBuffers. I.e + * a CoglIndexBuffer is a lite subclass of CoglBuffer that simply + * implies that the buffer will later be bound as indices but doesn't + * track more detailed meta data. CoglIndices build on a + * CoglIndexBuffer and define the type and max_index_value for some + * sub-range of a CoglIndexBuffer. + */ +#if 0 +void +cogl_index_buffer_set_data (CoglIndexBuffer *indices, + CoglIndicesType type, + int max_index_value, + size_t write_offset, + void *user_indices, + int n_indices) +{ + GList *l; + + for (l = indices->ranges; l; l = l->next) + { + + } + cogl_buffer_set +} +#endif + diff --git a/cogl/cogl-index-buffer.h b/cogl/cogl-index-buffer.h new file mode 100644 index 0000000..204c858 --- /dev/null +++ b/cogl/cogl-index-buffer.h @@ -0,0 +1,107 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_INDEX_BUFFER_H__ +#define __COGL_INDEX_BUFFER_H__ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-index-buffer + * @short_description: Functions for creating and manipulating vertex + * indices. + * + * FIXME + */ + +#define COGL_INDEX_BUFFER(buffer) ((CoglIndexBuffer*) buffer) + +typedef struct _CoglIndexBuffer CoglIndexBuffer; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_index_buffer_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_index_buffer_get_gtype (void); +#endif + +/** + * cogl_index_buffer_new: + * @context: A #CoglContext + * @bytes: The number of bytes to allocate for vertex attribute data. + * + * Declares a new #CoglIndexBuffer of @size bytes to contain vertex + * indices. Once declared, data can be set using + * cogl_buffer_set_data() or by mapping it into the application's + * address space using cogl_buffer_map(). + * + * Return value: (transfer full): A newly allocated #CoglIndexBuffer + * + * Since: 1.4 + * Stability: Unstable + */ +CoglIndexBuffer * +cogl_index_buffer_new (CoglContext *context, + size_t bytes); + +/** + * cogl_is_index_buffer: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglIndexBuffer. + * + * Returns: %TRUE if the @object references a #CoglIndexBuffer, + * %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_is_index_buffer (void *object); + +COGL_END_DECLS + +#endif /* __COGL_INDEX_BUFFER_H__ */ + diff --git a/cogl/cogl-indices-private.h b/cogl/cogl-indices-private.h new file mode 100644 index 0000000..3d58916 --- /dev/null +++ b/cogl/cogl-indices-private.h @@ -0,0 +1,60 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_INDICES_PRIVATE_H +#define __COGL_INDICES_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-index-buffer-private.h" +#include "cogl-types.h" + +struct _CoglIndices +{ + CoglObject _parent; + + CoglIndexBuffer *buffer; + size_t offset; + + CoglIndicesType type; + + int immutable_ref; +}; + +CoglIndices * +_cogl_indices_immutable_ref (CoglIndices *indices); + +void +_cogl_indices_immutable_unref (CoglIndices *indices); + +#endif /* __COGL_INDICES_PRIVATE_H */ + diff --git a/cogl/cogl-indices.c b/cogl/cogl-indices.c new file mode 100644 index 0000000..2256830 --- /dev/null +++ b/cogl/cogl-indices.c @@ -0,0 +1,271 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-object-private.h" +#include "cogl-context-private.h" +#include "cogl-indices.h" +#include "cogl-indices-private.h" +#include "cogl-index-buffer.h" +#include "cogl-gtype-private.h" + +#include + +static void _cogl_indices_free (CoglIndices *indices); + +COGL_OBJECT_DEFINE (Indices, indices); +COGL_GTYPE_DEFINE_CLASS (Indices, indices); + +static size_t +sizeof_indices_type (CoglIndicesType type) +{ + switch (type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + return 1; + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + return 2; + case COGL_INDICES_TYPE_UNSIGNED_INT: + return 4; + } + g_return_val_if_reached (0); +} + +CoglIndices * +cogl_indices_new_for_buffer (CoglIndicesType type, + CoglIndexBuffer *buffer, + size_t offset) +{ + CoglIndices *indices = g_slice_new (CoglIndices); + + indices->buffer = cogl_object_ref (buffer); + indices->offset = offset; + + indices->type = type; + + indices->immutable_ref = 0; + + return _cogl_indices_object_new (indices); +} + +CoglIndices * +cogl_indices_new (CoglContext *context, + CoglIndicesType type, + const void *indices_data, + int n_indices) +{ + size_t buffer_bytes = sizeof_indices_type (type) * n_indices; + CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes); + CoglBuffer *buffer = COGL_BUFFER (index_buffer); + CoglIndices *indices; + CoglError *ignore_error = NULL; + + _cogl_buffer_set_data (buffer, + 0, + indices_data, + buffer_bytes, + &ignore_error); + if (ignore_error) + { + cogl_error_free (ignore_error); + cogl_object_unref (index_buffer); + return NULL; + } + + indices = cogl_indices_new_for_buffer (type, index_buffer, 0); + cogl_object_unref (index_buffer); + + return indices; +} + +CoglIndexBuffer * +cogl_indices_get_buffer (CoglIndices *indices) +{ + return indices->buffer; +} + +CoglIndicesType +cogl_indices_get_type (CoglIndices *indices) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), + COGL_INDICES_TYPE_UNSIGNED_BYTE); + return indices->type; +} + +size_t +cogl_indices_get_offset (CoglIndices *indices) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), 0); + + return indices->offset; +} + +static void +warn_about_midscene_changes (void) +{ + static CoglBool seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of indices has " + "undefined results\n"); + seen = TRUE; + } +} + +void +cogl_indices_set_offset (CoglIndices *indices, + size_t offset) +{ + _COGL_RETURN_IF_FAIL (cogl_is_indices (indices)); + + if (G_UNLIKELY (indices->immutable_ref)) + warn_about_midscene_changes (); + + indices->offset = offset; +} + +static void +_cogl_indices_free (CoglIndices *indices) +{ + cogl_object_unref (indices->buffer); + g_slice_free (CoglIndices, indices); +} + +CoglIndices * +_cogl_indices_immutable_ref (CoglIndices *indices) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), NULL); + + indices->immutable_ref++; + _cogl_buffer_immutable_ref (COGL_BUFFER (indices->buffer)); + return indices; +} + +void +_cogl_indices_immutable_unref (CoglIndices *indices) +{ + _COGL_RETURN_IF_FAIL (cogl_is_indices (indices)); + _COGL_RETURN_IF_FAIL (indices->immutable_ref > 0); + + indices->immutable_ref--; + _cogl_buffer_immutable_unref (COGL_BUFFER (indices->buffer)); +} + +CoglIndices * +cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles) +{ + int n_indices = n_rectangles * 6; + + /* Check if the largest index required will fit in a byte array... */ + if (n_indices <= 256 / 4 * 6) + { + /* Generate the byte array if we haven't already */ + if (ctx->rectangle_byte_indices == NULL) + { + uint8_t *byte_array = g_malloc (256 / 4 * 6 * sizeof (uint8_t)); + uint8_t *p = byte_array; + int i, vert_num = 0; + + for (i = 0; i < 256 / 4; i++) + { + *(p++) = vert_num + 0; + *(p++) = vert_num + 1; + *(p++) = vert_num + 2; + *(p++) = vert_num + 0; + *(p++) = vert_num + 2; + *(p++) = vert_num + 3; + vert_num += 4; + } + + ctx->rectangle_byte_indices + = cogl_indices_new (ctx, + COGL_INDICES_TYPE_UNSIGNED_BYTE, + byte_array, + 256 / 4 * 6); + + g_free (byte_array); + } + + return ctx->rectangle_byte_indices; + } + else + { + if (ctx->rectangle_short_indices_len < n_indices) + { + uint16_t *short_array; + uint16_t *p; + int i, vert_num = 0; + + if (ctx->rectangle_short_indices != NULL) + cogl_object_unref (ctx->rectangle_short_indices); + /* Pick a power of two >= MAX (512, n_indices) */ + if (ctx->rectangle_short_indices_len == 0) + ctx->rectangle_short_indices_len = 512; + while (ctx->rectangle_short_indices_len < n_indices) + ctx->rectangle_short_indices_len *= 2; + + /* Over-allocate to generate a whole number of quads */ + p = short_array = g_malloc ((ctx->rectangle_short_indices_len + + 5) / 6 * 6 + * sizeof (uint16_t)); + + /* Fill in the complete quads */ + for (i = 0; i < ctx->rectangle_short_indices_len; i += 6) + { + *(p++) = vert_num + 0; + *(p++) = vert_num + 1; + *(p++) = vert_num + 2; + *(p++) = vert_num + 0; + *(p++) = vert_num + 2; + *(p++) = vert_num + 3; + vert_num += 4; + } + + ctx->rectangle_short_indices + = cogl_indices_new (ctx, + COGL_INDICES_TYPE_UNSIGNED_SHORT, + short_array, + ctx->rectangle_short_indices_len); + + g_free (short_array); + } + + return ctx->rectangle_short_indices; + } +} + diff --git a/cogl/cogl-indices.h b/cogl/cogl-indices.h new file mode 100644 index 0000000..3cc9239 --- /dev/null +++ b/cogl/cogl-indices.h @@ -0,0 +1,165 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_INDICES_H__ +#define __COGL_INDICES_H__ + +/* We forward declare the CoglIndices type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglIndices CoglIndices; + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-indices + * @short_description: Describe vertex indices stored in a #CoglIndexBuffer. + * + * Indices allow you to avoid duplicating vertices in your vertex data + * by virtualizing your data and instead providing a sequence of index + * values that tell the GPU which data should be used for each vertex. + * + * If the GPU is given a sequence of indices it doesn't simply walk + * through each vertex of your data in order it will instead walk + * through the indices which can provide random access to the + * underlying data. + * + * Since it's very common to have duplicate vertices when describing a + * shape as a list of triangles it can often be a significant space + * saving to describe geometry using indices. Reducing the size of + * your models can make it cheaper to map them into the GPU by + * reducing the demand on memory bandwidth and may help to make better + * use of your GPUs internal vertex caching. + * + * For example, to describe a quadrilateral as 2 triangles for the GPU + * you could either provide data with 6 vertices or instead with + * indices you can provide vertex data for just 4 vertices and an + * index buffer that specfies the 6 vertices by indexing the shared + * vertices multiple times. + * + * |[ + * CoglVertex2f quad_vertices[] = { + * {x0, y0}, //0 = top left + * {x1, y1}, //1 = bottom left + * {x2, y2}, //2 = bottom right + * {x3, y3}, //3 = top right + * }; + * //tell the gpu how to interpret the quad as 2 triangles... + * unsigned char indices[] = {0, 1, 2, 0, 2, 3}; + * ]| + * + * Even in the above illustration we see a saving of 10bytes for one + * quad compared to having data for 6 vertices and no indices but if + * you need to draw 100s or 1000s of quads then its really quite + * significant. + * + * Something else to consider is that often indices can be defined + * once and remain static while the vertex data may change for + * animations perhaps. That means you may be able to ignore the + * negligable cost of mapping your indices into the GPU if they don't + * ever change. + * + * The above illustration is actually a good example of static indices + * because it's really common that developers have quad mesh data that + * they need to display and we know exactly what that indices array + * needs to look like depending on the number of quads that need to be + * drawn. It doesn't matter how the quads might be animated and + * changed the indices will remain the same. Cogl even has a utility + * (cogl_get_rectangle_indices()) to get access to re-useable indices + * for drawing quads as above. + */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_indices_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_indices_get_gtype (void); +#endif + +CoglIndices * +cogl_indices_new (CoglContext *context, + CoglIndicesType type, + const void *indices_data, + int n_indices); + +CoglIndices * +cogl_indices_new_for_buffer (CoglIndicesType type, + CoglIndexBuffer *buffer, + size_t offset); + +CoglIndexBuffer * +cogl_indices_get_buffer (CoglIndices *indices); + +CoglIndicesType +cogl_indices_get_type (CoglIndices *indices); + +size_t +cogl_indices_get_offset (CoglIndices *indices); + +void +cogl_indices_set_offset (CoglIndices *indices, + size_t offset); + +CoglIndices * +cogl_get_rectangle_indices (CoglContext *context, int n_rectangles); + +/** + * cogl_is_indices: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglIndices. + * + * Return value: %TRUE if the object references a #CoglIndices + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_indices (void *object); + +COGL_END_DECLS + +#endif /* __COGL_INDICES_H__ */ + diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h new file mode 100644 index 0000000..8211359 --- /dev/null +++ b/cogl/cogl-journal-private.h @@ -0,0 +1,121 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_JOURNAL_PRIVATE_H +#define __COGL_JOURNAL_PRIVATE_H + +#include "cogl-texture.h" +#include "cogl-object-private.h" +#include "cogl-clip-stack.h" +#include "cogl-fence-private.h" + +#define COGL_JOURNAL_VBO_POOL_SIZE 8 + +typedef struct _CoglJournal +{ + CoglObject _parent; + + /* A pointer the framebuffer that is using this journal. This is + only valid when the journal is not empty. It *does* take a + reference on the framebuffer. Although this creates a circular + reference, the framebuffer has special code to handle the case + where the journal is the only thing holding a reference and it + will cause the journal to flush */ + CoglFramebuffer *framebuffer; + + GArray *entries; + GArray *vertices; + size_t needed_vbo_len; + + /* A pool of attribute buffers is used so that we can avoid repeatedly + reallocating buffers. Only one of these buffers at a time will be + used by Cogl but we keep more than one alive anyway in case the + GL driver is internally using the buffer and it would have to + allocate a new one when we start writing to it */ + CoglAttributeBuffer *vbo_pool[COGL_JOURNAL_VBO_POOL_SIZE]; + /* The next vbo to use from the pool. We just cycle through them in + order */ + unsigned int next_vbo_in_pool; + + int fast_read_pixel_count; + + CoglList pending_fences; + +} CoglJournal; + +/* To improve batching of geometry when submitting vertices to OpenGL we + * log the texture rectangles we want to draw to a journal, so when we + * later flush the journal we aim to batch data, and gl draw calls. */ +typedef struct _CoglJournalEntry +{ + CoglPipeline *pipeline; + CoglMatrixEntry *modelview_entry; + CoglClipStack *clip_stack; + /* Offset into ctx->logged_vertices */ + size_t array_offset; + int n_layers; +} CoglJournalEntry; + +CoglJournal * +_cogl_journal_new (CoglFramebuffer *framebuffer); + +void +_cogl_journal_log_quad (CoglJournal *journal, + const float *position, + CoglPipeline *pipeline, + int n_layers, + CoglTexture *layer0_override_texture, + const float *tex_coords, + unsigned int tex_coords_len); + +void +_cogl_journal_flush (CoglJournal *journal); + +void +_cogl_journal_discard (CoglJournal *journal); + +CoglBool +_cogl_journal_all_entries_within_bounds (CoglJournal *journal, + float clip_x0, + float clip_y0, + float clip_x1, + float clip_y1); + +CoglBool +_cogl_journal_try_read_pixel (CoglJournal *journal, + int x, + int y, + CoglBitmap *bitmap, + CoglBool *found_intersection); + +CoglBool +_cogl_is_journal (void *object); + +#endif /* __COGL_JOURNAL_PRIVATE_H */ diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c new file mode 100644 index 0000000..dff34a0 --- /dev/null +++ b/cogl/cogl-journal.c @@ -0,0 +1,1852 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-context-private.h" +#include "cogl-journal-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-vertex-buffer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-profile.h" +#include "cogl-attribute-private.h" +#include "cogl-point-in-poly-private.h" +#include "cogl-private.h" +#include "cogl1-context.h" + +#include +#include +#include + +/* XXX NB: + * The data logged in logged_vertices is formatted as follows: + * + * Per entry: + * 4 RGBA GLubytes for the color + * 2 floats for the top left position + * 2 * n_layers floats for the top left texture coordinates + * 2 floats for the bottom right position + * 2 * n_layers floats for the bottom right texture coordinates + */ +#define GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS(N_LAYERS) \ + (N_LAYERS * 2 + 2) + +/* XXX NB: + * Once in the vertex array, the journal's vertex data is arranged as follows: + * 4 vertices per quad: + * 2 or 3 GLfloats per position (3 when doing software transforms) + * 4 RGBA GLubytes, + * 2 GLfloats per tex coord * n_layers + * + * Where n_layers corresponds to the number of pipeline layers enabled + * + * To avoid frequent changes in the stride of our vertex data we always pad + * n_layers to be >= 2 + * + * There will be four vertices per quad in the vertex array + * + * When we are transforming quads in software we need to also track the z + * coordinate of transformed vertices. + * + * So for a given number of layers this gets the stride in 32bit words: + */ +#define SW_TRANSFORM (!(COGL_DEBUG_ENABLED \ + (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))) +#define POS_STRIDE (SW_TRANSFORM ? 3 : 2) /* number of 32bit words */ +#define N_POS_COMPONENTS POS_STRIDE +#define COLOR_STRIDE 1 /* number of 32bit words */ +#define TEX_STRIDE 2 /* number of 32bit words */ +#define MIN_LAYER_PADING 2 +#define GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS(N_LAYERS) \ + (POS_STRIDE + COLOR_STRIDE + \ + TEX_STRIDE * (N_LAYERS < MIN_LAYER_PADING ? MIN_LAYER_PADING : N_LAYERS)) + +/* If a batch is longer than this threshold then we'll assume it's not + worth doing software clipping and it's cheaper to program the GPU + to do the clip */ +#define COGL_JOURNAL_HARDWARE_CLIP_THRESHOLD 8 + +typedef struct _CoglJournalFlushState +{ + CoglContext *ctx; + + CoglJournal *journal; + + CoglAttributeBuffer *attribute_buffer; + GArray *attributes; + int current_attribute; + + size_t stride; + size_t array_offset; + GLuint current_vertex; + + CoglIndices *indices; + size_t indices_type_size; + + CoglPipeline *pipeline; +} CoglJournalFlushState; + +typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start, + int n_entries, + void *data); +typedef CoglBool (*CoglJournalBatchTest) (CoglJournalEntry *entry0, + CoglJournalEntry *entry1); + +static void _cogl_journal_free (CoglJournal *journal); + +COGL_OBJECT_INTERNAL_DEFINE (Journal, journal); + +static void +_cogl_journal_free (CoglJournal *journal) +{ + int i; + + if (journal->entries) + g_array_free (journal->entries, TRUE); + if (journal->vertices) + g_array_free (journal->vertices, TRUE); + + for (i = 0; i < COGL_JOURNAL_VBO_POOL_SIZE; i++) + if (journal->vbo_pool[i]) + cogl_object_unref (journal->vbo_pool[i]); + + g_slice_free (CoglJournal, journal); +} + +CoglJournal * +_cogl_journal_new (CoglFramebuffer *framebuffer) +{ + CoglJournal *journal = g_slice_new0 (CoglJournal); + + /* The journal keeps a pointer back to the framebuffer because there + is effectively a 1:1 mapping between journals and framebuffers. + However, to avoid a circular reference the journal doesn't take a + reference unless it is non-empty. The framebuffer has a special + unref implementation to ensure that the journal is flushed when + the journal is the only thing keeping it alive */ + journal->framebuffer = framebuffer; + + journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry)); + journal->vertices = g_array_new (FALSE, FALSE, sizeof (float)); + + _cogl_list_init (&journal->pending_fences); + + return _cogl_journal_object_new (journal); +} + +static void +_cogl_journal_dump_logged_quad (uint8_t *data, int n_layers) +{ + size_t stride = GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (n_layers); + int i; + + g_print ("n_layers = %d; rgba=0x%02X%02X%02X%02X\n", + n_layers, data[0], data[1], data[2], data[3]); + + data += 4; + + for (i = 0; i < 2; i++) + { + float *v = (float *)data + (i * stride); + int j; + + g_print ("v%d: x = %f, y = %f", i, v[0], v[1]); + + for (j = 0; j < n_layers; j++) + { + float *t = v + 2 + TEX_STRIDE * j; + g_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]); + } + g_print ("\n"); + } +} + +static void +_cogl_journal_dump_quad_vertices (uint8_t *data, int n_layers) +{ + size_t stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers); + int i; + + g_print ("n_layers = %d; stride = %d; pos stride = %d; color stride = %d; " + "tex stride = %d; stride in bytes = %d\n", + n_layers, (int)stride, POS_STRIDE, COLOR_STRIDE, + TEX_STRIDE, (int)stride * 4); + + for (i = 0; i < 4; i++) + { + float *v = (float *)data + (i * stride); + uint8_t *c = data + (POS_STRIDE * 4) + (i * stride * 4); + int j; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED + (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))) + g_print ("v%d: x = %f, y = %f, rgba=0x%02X%02X%02X%02X", + i, v[0], v[1], c[0], c[1], c[2], c[3]); + else + g_print ("v%d: x = %f, y = %f, z = %f, rgba=0x%02X%02X%02X%02X", + i, v[0], v[1], v[2], c[0], c[1], c[2], c[3]); + for (j = 0; j < n_layers; j++) + { + float *t = v + POS_STRIDE + COLOR_STRIDE + TEX_STRIDE * j; + g_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]); + } + g_print ("\n"); + } +} + +static void +_cogl_journal_dump_quad_batch (uint8_t *data, int n_layers, int n_quads) +{ + size_t byte_stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers) * 4; + int i; + + g_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n", + n_layers, n_quads); + for (i = 0; i < n_quads; i++) + _cogl_journal_dump_quad_vertices (data + byte_stride * 2 * i, n_layers); +} + +static void +batch_and_call (CoglJournalEntry *entries, + int n_entries, + CoglJournalBatchTest can_batch_callback, + CoglJournalBatchCallback batch_callback, + void *data) +{ + int i; + int batch_len = 1; + CoglJournalEntry *batch_start = entries; + + if (n_entries < 1) + return; + + for (i = 1; i < n_entries; i++) + { + CoglJournalEntry *entry0 = &entries[i - 1]; + CoglJournalEntry *entry1 = entry0 + 1; + + if (can_batch_callback (entry0, entry1)) + { + batch_len++; + continue; + } + + batch_callback (batch_start, batch_len, data); + + batch_start = entry1; + batch_len = 1; + } + + /* The last batch... */ + batch_callback (batch_start, batch_len, data); +} + +static void +_cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + CoglContext *ctx = state->ctx; + CoglFramebuffer *framebuffer = state->journal->framebuffer; + CoglAttribute **attributes; + CoglDrawFlags draw_flags = (COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | + COGL_DRAW_SKIP_LEGACY_STATE); + + COGL_STATIC_TIMER (time_flush_modelview_and_entries, + "flush: pipeline+entries", /* parent */ + "flush: modelview+entries", + "The time spent flushing modelview + entries", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, time_flush_modelview_and_entries); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) + g_print ("BATCHING: modelview batch len = %d\n", batch_len); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))) + _cogl_context_set_current_modelview_entry (ctx, + batch_start->modelview_entry); + + attributes = (CoglAttribute **)state->attributes->data; + + if (!_cogl_pipeline_get_real_blend_enabled (state->pipeline)) + draw_flags |= COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE; + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS)) + { + /* XXX: it's rather evil that we sneak in the GL_QUADS enum here... */ + _cogl_framebuffer_draw_attributes (framebuffer, + state->pipeline, + GL_QUADS, + state->current_vertex, batch_len * 4, + attributes, + state->attributes->len, + draw_flags); + } + else +#endif /* HAVE_COGL_GL */ + { + if (batch_len > 1) + { + CoglVerticesMode mode = COGL_VERTICES_MODE_TRIANGLES; + int first_vertex = state->current_vertex * 6 / 4; + _cogl_framebuffer_draw_indexed_attributes (framebuffer, + state->pipeline, + mode, + first_vertex, + batch_len * 6, + state->indices, + attributes, + state->attributes->len, + draw_flags); + } + else + { + _cogl_framebuffer_draw_attributes (framebuffer, + state->pipeline, + COGL_VERTICES_MODE_TRIANGLE_FAN, + state->current_vertex, 4, + attributes, + state->attributes->len, + draw_flags); + } + } + + /* DEBUGGING CODE XXX: This path will cause all rectangles to be + * drawn with a coloured outline. Each batch will be rendered with + * the same color. This may e.g. help with debugging texture slicing + * issues, visually seeing what is batched and debugging blending + * issues, plus it looks quite cool. + */ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES))) + { + static CoglPipeline *outline = NULL; + uint8_t color_intensity; + int i; + CoglAttribute *loop_attributes[1]; + + if (outline == NULL) + outline = cogl_pipeline_new (ctx); + + /* The least significant three bits represent the three + components so that the order of colours goes red, green, + yellow, blue, magenta, cyan. Black and white are skipped. The + next two bits give four scales of intensity for those colours + in the order 0xff, 0xcc, 0x99, and 0x66. This gives a total + of 24 colours. If there are more than 24 batches on the stage + then it will wrap around */ + color_intensity = 0xff - 0x33 * (ctx->journal_rectangles_color >> 3); + cogl_pipeline_set_color4ub (outline, + (ctx->journal_rectangles_color & 1) ? + color_intensity : 0, + (ctx->journal_rectangles_color & 2) ? + color_intensity : 0, + (ctx->journal_rectangles_color & 4) ? + color_intensity : 0, + 0xff); + + loop_attributes[0] = attributes[0]; /* we just want the position */ + for (i = 0; i < batch_len; i++) + _cogl_framebuffer_draw_attributes (framebuffer, + outline, + COGL_VERTICES_MODE_LINE_LOOP, + 4 * i + state->current_vertex, 4, + loop_attributes, + 1, + draw_flags); + + /* Go to the next color */ + do + ctx->journal_rectangles_color = ((ctx->journal_rectangles_color + 1) & + ((1 << 5) - 1)); + /* We don't want to use black or white */ + while ((ctx->journal_rectangles_color & 0x07) == 0 + || (ctx->journal_rectangles_color & 0x07) == 0x07); + } + + state->current_vertex += (4 * batch_len); + + COGL_TIMER_STOP (_cogl_uprof_context, time_flush_modelview_and_entries); +} + +static CoglBool +compare_entry_modelviews (CoglJournalEntry *entry0, + CoglJournalEntry *entry1) +{ + /* Batch together quads with the same model view matrix */ + return entry0->modelview_entry == entry1->modelview_entry; +} + +/* At this point we have a run of quads that we know have compatible + * pipelines, but they may not all have the same modelview matrix */ +static void +_cogl_journal_flush_pipeline_and_entries (CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + COGL_STATIC_TIMER (time_flush_pipeline_entries, + "flush: texcoords+pipeline+entries", /* parent */ + "flush: pipeline+entries", + "The time spent flushing pipeline + entries", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, time_flush_pipeline_entries); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) + g_print ("BATCHING: pipeline batch len = %d\n", batch_len); + + state->pipeline = batch_start->pipeline; + + /* If we haven't transformed the quads in software then we need to also break + * up batches according to changes in the modelview matrix... */ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))) + { + batch_and_call (batch_start, + batch_len, + compare_entry_modelviews, + _cogl_journal_flush_modelview_and_entries, + data); + } + else + _cogl_journal_flush_modelview_and_entries (batch_start, batch_len, data); + + COGL_TIMER_STOP (_cogl_uprof_context, time_flush_pipeline_entries); +} + +static CoglBool +compare_entry_pipelines (CoglJournalEntry *entry0, CoglJournalEntry *entry1) +{ + /* batch rectangles using compatible pipelines */ + + if (_cogl_pipeline_equal (entry0->pipeline, + entry1->pipeline, + (COGL_PIPELINE_STATE_ALL & + ~COGL_PIPELINE_STATE_COLOR), + COGL_PIPELINE_LAYER_STATE_ALL, + 0)) + return TRUE; + else + return FALSE; +} + +typedef struct _CreateAttributeState +{ + int current; + CoglJournalFlushState *flush_state; +} CreateAttributeState; + +static CoglBool +create_attribute_cb (CoglPipeline *pipeline, + int layer_number, + void *user_data) +{ + CreateAttributeState *state = user_data; + CoglJournalFlushState *flush_state = state->flush_state; + CoglAttribute **attribute_entry = + &g_array_index (flush_state->attributes, + CoglAttribute *, + state->current + 2); + const char *names[] = { + "cogl_tex_coord0_in", + "cogl_tex_coord1_in", + "cogl_tex_coord2_in", + "cogl_tex_coord3_in", + "cogl_tex_coord4_in", + "cogl_tex_coord5_in", + "cogl_tex_coord6_in", + "cogl_tex_coord7_in" + }; + char *name; + + /* XXX NB: + * Our journal's vertex data is arranged as follows: + * 4 vertices per quad: + * 2 or 3 floats per position (3 when doing software transforms) + * 4 RGBA bytes, + * 2 floats per tex coord * n_layers + * (though n_layers may be padded; see definition of + * GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS for details) + */ + name = layer_number < 8 ? (char *)names[layer_number] : + g_strdup_printf ("cogl_tex_coord%d_in", layer_number); + + /* XXX: it may be worth having some form of static initializer for + * attributes... */ + *attribute_entry = + cogl_attribute_new (flush_state->attribute_buffer, + name, + flush_state->stride, + flush_state->array_offset + + (POS_STRIDE + COLOR_STRIDE) * 4 + + TEX_STRIDE * 4 * state->current, + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + if (layer_number >= 8) + g_free (name); + + state->current++; + + return TRUE; +} + +/* Since the stride may not reflect the number of texture layers in use + * (due to padding) we deal with texture coordinate offsets separately + * from vertex and color offsets... */ +static void +_cogl_journal_flush_texcoord_vbo_offsets_and_entries ( + CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + CreateAttributeState create_attrib_state; + int i; + COGL_STATIC_TIMER (time_flush_texcoord_pipeline_entries, + "flush: vbo+texcoords+pipeline+entries", /* parent */ + "flush: texcoords+pipeline+entries", + "The time spent flushing texcoord offsets + pipeline " + "+ entries", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, time_flush_texcoord_pipeline_entries); + + /* NB: attributes 0 and 1 are position and color */ + + for (i = 2; i < state->attributes->len; i++) + cogl_object_unref (g_array_index (state->attributes, CoglAttribute *, i)); + + g_array_set_size (state->attributes, batch_start->n_layers + 2); + + create_attrib_state.current = 0; + create_attrib_state.flush_state = state; + + cogl_pipeline_foreach_layer (batch_start->pipeline, + create_attribute_cb, + &create_attrib_state); + + batch_and_call (batch_start, + batch_len, + compare_entry_pipelines, + _cogl_journal_flush_pipeline_and_entries, + data); + COGL_TIMER_STOP (_cogl_uprof_context, time_flush_texcoord_pipeline_entries); +} + +static CoglBool +compare_entry_layer_numbers (CoglJournalEntry *entry0, CoglJournalEntry *entry1) +{ + if (_cogl_pipeline_layer_numbers_equal (entry0->pipeline, entry1->pipeline)) + return TRUE; + else + return FALSE; +} + +/* At this point we know the stride has changed from the previous batch + * of journal entries */ +static void +_cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + CoglContext *ctx = state->journal->framebuffer->context; + size_t stride; + int i; + CoglAttribute **attribute_entry; + COGL_STATIC_TIMER (time_flush_vbo_texcoord_pipeline_entries, + "flush: clip+vbo+texcoords+pipeline+entries", /* parent */ + "flush: vbo+texcoords+pipeline+entries", + "The time spent flushing vbo + texcoord offsets + " + "pipeline + entries", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, + time_flush_vbo_texcoord_pipeline_entries); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) + g_print ("BATCHING: vbo offset batch len = %d\n", batch_len); + + /* XXX NB: + * Our journal's vertex data is arranged as follows: + * 4 vertices per quad: + * 2 or 3 GLfloats per position (3 when doing software transforms) + * 4 RGBA GLubytes, + * 2 GLfloats per tex coord * n_layers + * (though n_layers may be padded; see definition of + * GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS for details) + */ + stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (batch_start->n_layers); + stride *= sizeof (float); + state->stride = stride; + + for (i = 0; i < state->attributes->len; i++) + cogl_object_unref (g_array_index (state->attributes, CoglAttribute *, i)); + + g_array_set_size (state->attributes, 2); + + attribute_entry = &g_array_index (state->attributes, CoglAttribute *, 0); + *attribute_entry = cogl_attribute_new (state->attribute_buffer, + "cogl_position_in", + stride, + state->array_offset, + N_POS_COMPONENTS, + COGL_ATTRIBUTE_TYPE_FLOAT); + + attribute_entry = &g_array_index (state->attributes, CoglAttribute *, 1); + *attribute_entry = + cogl_attribute_new (state->attribute_buffer, + "cogl_color_in", + stride, + state->array_offset + (POS_STRIDE * 4), + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS)) + state->indices = cogl_get_rectangle_indices (ctx, batch_len); + + /* We only create new Attributes when the stride within the + * AttributeBuffer changes. (due to a change in the number of pipeline + * layers) While the stride remains constant we walk forward through + * the above AttributeBuffer using a vertex offset passed to + * cogl_draw_attributes + */ + state->current_vertex = 0; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL))) + { + uint8_t *verts; + + /* Mapping a buffer for read is probably a really bad thing to + do but this will only happen during debugging so it probably + doesn't matter */ + verts = ((uint8_t *)_cogl_buffer_map (COGL_BUFFER (state->attribute_buffer), + COGL_BUFFER_ACCESS_READ, 0, + NULL) + + state->array_offset); + + _cogl_journal_dump_quad_batch (verts, + batch_start->n_layers, + batch_len); + + cogl_buffer_unmap (COGL_BUFFER (state->attribute_buffer)); + } + + batch_and_call (batch_start, + batch_len, + compare_entry_layer_numbers, + _cogl_journal_flush_texcoord_vbo_offsets_and_entries, + data); + + /* progress forward through the VBO containing all our vertices */ + state->array_offset += (stride * 4 * batch_len); + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL))) + g_print ("new vbo offset = %lu\n", (unsigned long)state->array_offset); + + COGL_TIMER_STOP (_cogl_uprof_context, + time_flush_vbo_texcoord_pipeline_entries); +} + +static CoglBool +compare_entry_strides (CoglJournalEntry *entry0, CoglJournalEntry *entry1) +{ + /* Currently the only thing that affects the stride for our vertex arrays + * is the number of pipeline layers. We need to update our VBO offsets + * whenever the stride changes. */ + /* TODO: We should be padding the n_layers == 1 case as if it were + * n_layers == 2 so we can reduce the need to split batches. */ + if (entry0->n_layers == entry1->n_layers || + (entry0->n_layers <= MIN_LAYER_PADING && + entry1->n_layers <= MIN_LAYER_PADING)) + return TRUE; + else + return FALSE; +} + +/* At this point we know the batch has a unique clip stack */ +static void +_cogl_journal_flush_clip_stacks_and_entries (CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + CoglFramebuffer *framebuffer = state->journal->framebuffer; + CoglContext *ctx = framebuffer->context; + CoglMatrixStack *projection_stack; + + COGL_STATIC_TIMER (time_flush_clip_stack_pipeline_entries, + "Journal Flush", /* parent */ + "flush: clip+vbo+texcoords+pipeline+entries", + "The time spent flushing clip + vbo + texcoord offsets + " + "pipeline + entries", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, + time_flush_clip_stack_pipeline_entries); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) + g_print ("BATCHING: clip stack batch len = %d\n", batch_len); + + _cogl_clip_stack_flush (batch_start->clip_stack, framebuffer); + + /* XXX: Because we are manually flushing clip state here we need to + * make sure that the clip state gets updated the next time we flush + * framebuffer state by marking the current framebuffer's clip state + * as changed. */ + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + + /* If we have transformed all our quads at log time then we ensure + * no further model transform is applied by loading the identity + * matrix here. We need to do this after flushing the clip stack + * because the clip stack flushing code can modify the current + * modelview matrix entry */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))) + _cogl_context_set_current_modelview_entry (ctx, &ctx->identity_entry); + + /* Setting up the clip state can sometimes also update the current + * projection matrix entry so we should update it again. This will have + * no affect if the clip code didn't modify the projection */ + projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + _cogl_context_set_current_projection_entry (ctx, + projection_stack->last_entry); + + batch_and_call (batch_start, + batch_len, + compare_entry_strides, + _cogl_journal_flush_vbo_offsets_and_entries, /* callback */ + data); + + COGL_TIMER_STOP (_cogl_uprof_context, + time_flush_clip_stack_pipeline_entries); +} + +typedef struct +{ + float x_1, y_1; + float x_2, y_2; +} ClipBounds; + +static CoglBool +can_software_clip_entry (CoglJournalEntry *journal_entry, + CoglJournalEntry *prev_journal_entry, + CoglClipStack *clip_stack, + ClipBounds *clip_bounds_out) +{ + CoglPipeline *pipeline = journal_entry->pipeline; + CoglClipStack *clip_entry; + int layer_num; + + clip_bounds_out->x_1 = -G_MAXFLOAT; + clip_bounds_out->y_1 = -G_MAXFLOAT; + clip_bounds_out->x_2 = G_MAXFLOAT; + clip_bounds_out->y_2 = G_MAXFLOAT; + + /* Check the pipeline is usable. We can short-cut here for + entries using the same pipeline as the previous entry */ + if (prev_journal_entry == NULL || pipeline != prev_journal_entry->pipeline) + { + /* If the pipeline has a user program then we can't reliably modify + the texture coordinates */ + if (cogl_pipeline_get_user_program (pipeline)) + return FALSE; + + /* If any of the pipeline layers have a texture matrix then we can't + reliably modify the texture coordinates */ + for (layer_num = cogl_pipeline_get_n_layers (pipeline) - 1; + layer_num >= 0; + layer_num--) + if (_cogl_pipeline_layer_has_user_matrix (pipeline, layer_num)) + return FALSE; + } + + /* Now we need to verify that each clip entry's matrix is just a + translation of the journal entry's modelview matrix. We can + also work out the bounds of the clip in modelview space using + this translation */ + for (clip_entry = clip_stack; clip_entry; clip_entry = clip_entry->parent) + { + float rect_x1, rect_y1, rect_x2, rect_y2; + CoglClipStackRect *clip_rect; + float tx, ty, tz; + CoglMatrixEntry *modelview_entry; + + clip_rect = (CoglClipStackRect *) clip_entry; + + modelview_entry = journal_entry->modelview_entry; + if (!cogl_matrix_entry_calculate_translation (clip_rect->matrix_entry, + modelview_entry, + &tx, &ty, &tz)) + return FALSE; + + if (clip_rect->x0 < clip_rect->x1) + { + rect_x1 = clip_rect->x0; + rect_x2 = clip_rect->x1; + } + else + { + rect_x1 = clip_rect->x1; + rect_x2 = clip_rect->x0; + } + if (clip_rect->y0 < clip_rect->y1) + { + rect_y1 = clip_rect->y0; + rect_y2 = clip_rect->y1; + } + else + { + rect_y1 = clip_rect->y1; + rect_y2 = clip_rect->y0; + } + + clip_bounds_out->x_1 = MAX (clip_bounds_out->x_1, rect_x1 - tx); + clip_bounds_out->y_1 = MAX (clip_bounds_out->y_1, rect_y1 - ty); + clip_bounds_out->x_2 = MIN (clip_bounds_out->x_2, rect_x2 - tx); + clip_bounds_out->y_2 = MIN (clip_bounds_out->y_2, rect_y2 - ty); + } + + if (clip_bounds_out->x_2 <= clip_bounds_out->x_1 || + clip_bounds_out->y_2 <= clip_bounds_out->y_1) + memset (clip_bounds_out, 0, sizeof (ClipBounds)); + + return TRUE; +} + +static void +software_clip_entry (CoglJournalEntry *journal_entry, + float *verts, + ClipBounds *clip_bounds) +{ + size_t stride = + GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (journal_entry->n_layers); + float rx1, ry1, rx2, ry2; + float vx1, vy1, vx2, vy2; + int layer_num; + + /* Remove the clip on the entry */ + _cogl_clip_stack_unref (journal_entry->clip_stack); + journal_entry->clip_stack = NULL; + + vx1 = verts[0]; + vy1 = verts[1]; + vx2 = verts[stride]; + vy2 = verts[stride + 1]; + + if (vx1 < vx2) + { + rx1 = vx1; + rx2 = vx2; + } + else + { + rx1 = vx2; + rx2 = vx1; + } + if (vy1 < vy2) + { + ry1 = vy1; + ry2 = vy2; + } + else + { + ry1 = vy2; + ry2 = vy1; + } + + rx1 = CLAMP (rx1, clip_bounds->x_1, clip_bounds->x_2); + ry1 = CLAMP (ry1, clip_bounds->y_1, clip_bounds->y_2); + rx2 = CLAMP (rx2, clip_bounds->x_1, clip_bounds->x_2); + ry2 = CLAMP (ry2, clip_bounds->y_1, clip_bounds->y_2); + + /* Check if the rectangle intersects the clip at all */ + if (rx1 == rx2 || ry1 == ry2) + /* Will set all of the vertex data to 0 in the hope that this + will create a degenerate rectangle and the GL driver will + be able to clip it quickly */ + memset (verts, 0, sizeof (float) * stride * 2); + else + { + if (vx1 > vx2) + { + float t = rx1; + rx1 = rx2; + rx2 = t; + } + if (vy1 > vy2) + { + float t = ry1; + ry1 = ry2; + ry2 = t; + } + + verts[0] = rx1; + verts[1] = ry1; + verts[stride] = rx2; + verts[stride + 1] = ry2; + + /* Convert the rectangle coordinates to a fraction of the original + rectangle */ + rx1 = (rx1 - vx1) / (vx2 - vx1); + ry1 = (ry1 - vy1) / (vy2 - vy1); + rx2 = (rx2 - vx1) / (vx2 - vx1); + ry2 = (ry2 - vy1) / (vy2 - vy1); + + for (layer_num = 0; layer_num < journal_entry->n_layers; layer_num++) + { + float *t = verts + 2 + 2 * layer_num; + float tx1 = t[0], ty1 = t[1]; + float tx2 = t[stride], ty2 = t[stride + 1]; + t[0] = rx1 * (tx2 - tx1) + tx1; + t[1] = ry1 * (ty2 - ty1) + ty1; + t[stride] = rx2 * (tx2 - tx1) + tx1; + t[stride + 1] = ry2 * (ty2 - ty1) + ty1; + } + } +} + +static void +maybe_software_clip_entries (CoglJournalEntry *batch_start, + int batch_len, + CoglJournalFlushState *state) +{ + CoglContext *ctx; + CoglJournal *journal; + CoglClipStack *clip_stack, *clip_entry; + int entry_num; + + /* This tries to find cases where the entry is logged with a clip + but it would be faster to modify the vertex and texture + coordinates rather than flush the clip so that it can batch + better */ + + /* If the batch is reasonably long then it's worthwhile programming + the GPU to do the clip */ + if (batch_len >= COGL_JOURNAL_HARDWARE_CLIP_THRESHOLD) + return; + + clip_stack = batch_start->clip_stack; + + if (clip_stack == NULL) + return; + + /* Verify that all of the clip stack entries are a simple rectangle + clip */ + for (clip_entry = clip_stack; clip_entry; clip_entry = clip_entry->parent) + if (clip_entry->type != COGL_CLIP_STACK_RECT) + return; + + ctx = state->ctx; + journal = state->journal; + + /* This scratch buffer is used to store the translation for each + entry in the journal. We store it in a separate buffer because + it's expensive to calculate but at this point we still don't know + whether we can clip all of the entries so we don't want to do the + rest of the dependant calculations until we're sure we can. */ + if (ctx->journal_clip_bounds == NULL) + ctx->journal_clip_bounds = g_array_new (FALSE, FALSE, sizeof (ClipBounds)); + g_array_set_size (ctx->journal_clip_bounds, batch_len); + + for (entry_num = 0; entry_num < batch_len; entry_num++) + { + CoglJournalEntry *journal_entry = batch_start + entry_num; + CoglJournalEntry *prev_journal_entry = + entry_num ? batch_start + (entry_num - 1) : NULL; + ClipBounds *clip_bounds = &g_array_index (ctx->journal_clip_bounds, + ClipBounds, entry_num); + + if (!can_software_clip_entry (journal_entry, prev_journal_entry, + clip_stack, + clip_bounds)) + return; + } + + /* If we make it here then we know we can software clip the entire batch */ + + COGL_NOTE (CLIPPING, "Software clipping a batch of length %i", batch_len); + + for (entry_num = 0; entry_num < batch_len; entry_num++) + { + CoglJournalEntry *journal_entry = batch_start + entry_num; + float *verts = &g_array_index (journal->vertices, float, + journal_entry->array_offset + 1); + ClipBounds *clip_bounds = &g_array_index (ctx->journal_clip_bounds, + ClipBounds, entry_num); + + software_clip_entry (journal_entry, verts, clip_bounds); + } + + return; +} + +static void +_cogl_journal_maybe_software_clip_entries (CoglJournalEntry *batch_start, + int batch_len, + void *data) +{ + CoglJournalFlushState *state = data; + + COGL_STATIC_TIMER (time_check_software_clip, + "Journal Flush", /* parent */ + "flush: software clipping", + "Time spent software clipping", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, + time_check_software_clip); + + maybe_software_clip_entries (batch_start, batch_len, state); + + COGL_TIMER_STOP (_cogl_uprof_context, + time_check_software_clip); +} + +static CoglBool +compare_entry_clip_stacks (CoglJournalEntry *entry0, CoglJournalEntry *entry1) +{ + return entry0->clip_stack == entry1->clip_stack; +} + +/* Gets a new vertex array from the pool. A reference is taken on the + array so it can be treated as if it was just newly allocated */ +static CoglAttributeBuffer * +create_attribute_buffer (CoglJournal *journal, + size_t n_bytes) +{ + CoglAttributeBuffer *vbo; + CoglContext *ctx = journal->framebuffer->context; + + /* If CoglBuffers are being emulated with malloc then there's not + really any point in using the pool so we'll just allocate the + buffer directly */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_VBOS)) + return cogl_attribute_buffer_new_with_size (ctx, n_bytes); + + vbo = journal->vbo_pool[journal->next_vbo_in_pool]; + + if (vbo == NULL) + { + vbo = cogl_attribute_buffer_new_with_size (ctx, n_bytes); + journal->vbo_pool[journal->next_vbo_in_pool] = vbo; + } + else if (cogl_buffer_get_size (COGL_BUFFER (vbo)) < n_bytes) + { + /* If the buffer is too small then we'll just recreate it */ + cogl_object_unref (vbo); + vbo = cogl_attribute_buffer_new_with_size (ctx, n_bytes); + journal->vbo_pool[journal->next_vbo_in_pool] = vbo; + } + + journal->next_vbo_in_pool = ((journal->next_vbo_in_pool + 1) % + COGL_JOURNAL_VBO_POOL_SIZE); + + return cogl_object_ref (vbo); +} + +static CoglAttributeBuffer * +upload_vertices (CoglJournal *journal, + const CoglJournalEntry *entries, + int n_entries, + size_t needed_vbo_len, + GArray *vertices) +{ + CoglAttributeBuffer *attribute_buffer; + CoglBuffer *buffer; + const float *vin; + float *vout; + int entry_num; + int i; + CoglMatrixEntry *last_modelview_entry = NULL; + CoglMatrix modelview; + + g_assert (needed_vbo_len); + + attribute_buffer = create_attribute_buffer (journal, needed_vbo_len * 4); + buffer = COGL_BUFFER (attribute_buffer); + cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_STATIC); + + vout = _cogl_buffer_map_range_for_fill_or_fallback (buffer, + 0, /* offset */ + needed_vbo_len * 4); + vin = &g_array_index (vertices, float, 0); + + /* Expand the number of vertices from 2 to 4 while uploading */ + for (entry_num = 0; entry_num < n_entries; entry_num++) + { + const CoglJournalEntry *entry = entries + entry_num; + size_t vb_stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (entry->n_layers); + size_t array_stride = + GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (entry->n_layers); + + /* Copy the color to all four of the vertices */ + for (i = 0; i < 4; i++) + memcpy (vout + vb_stride * i + POS_STRIDE, vin, 4); + vin++; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))) + { + vout[vb_stride * 0] = vin[0]; + vout[vb_stride * 0 + 1] = vin[1]; + vout[vb_stride * 1] = vin[0]; + vout[vb_stride * 1 + 1] = vin[array_stride + 1]; + vout[vb_stride * 2] = vin[array_stride]; + vout[vb_stride * 2 + 1] = vin[array_stride + 1]; + vout[vb_stride * 3] = vin[array_stride]; + vout[vb_stride * 3 + 1] = vin[1]; + } + else + { + float v[8]; + + v[0] = vin[0]; + v[1] = vin[1]; + v[2] = vin[0]; + v[3] = vin[array_stride + 1]; + v[4] = vin[array_stride]; + v[5] = vin[array_stride + 1]; + v[6] = vin[array_stride]; + v[7] = vin[1]; + + if (entry->modelview_entry != last_modelview_entry) + cogl_matrix_entry_get (entry->modelview_entry, &modelview); + cogl_matrix_transform_points (&modelview, + 2, /* n_components */ + sizeof (float) * 2, /* stride_in */ + v, /* points_in */ + /* strideout */ + vb_stride * sizeof (float), + vout, /* points_out */ + 4 /* n_points */); + } + + for (i = 0; i < entry->n_layers; i++) + { + const float *tin = vin + 2; + float *tout = vout + POS_STRIDE + COLOR_STRIDE; + + tout[vb_stride * 0 + i * 2] = tin[i * 2]; + tout[vb_stride * 0 + 1 + i * 2] = tin[i * 2 + 1]; + tout[vb_stride * 1 + i * 2] = tin[i * 2]; + tout[vb_stride * 1 + 1 + i * 2] = tin[array_stride + i * 2 + 1]; + tout[vb_stride * 2 + i * 2] = tin[array_stride + i * 2]; + tout[vb_stride * 2 + 1 + i * 2] = tin[array_stride + i * 2 + 1]; + tout[vb_stride * 3 + i * 2] = tin[array_stride + i * 2]; + tout[vb_stride * 3 + 1 + i * 2] = tin[i * 2 + 1]; + } + + vin += array_stride * 2; + vout += vb_stride * 4; + } + + _cogl_buffer_unmap_for_fill_or_fallback (buffer); + + return attribute_buffer; +} + +void +_cogl_journal_discard (CoglJournal *journal) +{ + int i; + + if (journal->entries->len <= 0) + return; + + for (i = 0; i < journal->entries->len; i++) + { + CoglJournalEntry *entry = + &g_array_index (journal->entries, CoglJournalEntry, i); + _cogl_pipeline_journal_unref (entry->pipeline); + cogl_matrix_entry_unref (entry->modelview_entry); + _cogl_clip_stack_unref (entry->clip_stack); + } + + g_array_set_size (journal->entries, 0); + g_array_set_size (journal->vertices, 0); + journal->needed_vbo_len = 0; + journal->fast_read_pixel_count = 0; + + /* The journal only holds a reference to the framebuffer while the + journal is not empty */ + cogl_object_unref (journal->framebuffer); +} + +/* Note: A return value of FALSE doesn't mean 'no' it means + * 'unknown' */ +CoglBool +_cogl_journal_all_entries_within_bounds (CoglJournal *journal, + float clip_x0, + float clip_y0, + float clip_x1, + float clip_y1) +{ + CoglJournalEntry *entry = (CoglJournalEntry *)journal->entries->data; + CoglClipStack *clip_entry; + CoglClipStack *reference = NULL; + int bounds_x0; + int bounds_y0; + int bounds_x1; + int bounds_y1; + int i; + + if (journal->entries->len == 0) + return TRUE; + + /* Find the shortest clip_stack ancestry that leaves us in the + * required bounds */ + for (clip_entry = entry->clip_stack; + clip_entry; + clip_entry = clip_entry->parent) + { + _cogl_clip_stack_get_bounds (clip_entry, + &bounds_x0, &bounds_y0, + &bounds_x1, &bounds_y1); + + if (bounds_x0 >= clip_x0 && bounds_y0 >= clip_y0 && + bounds_x1 <= clip_x1 && bounds_y1 <= clip_y1) + reference = clip_entry; + else + break; + } + + if (!reference) + return FALSE; + + /* For the remaining journal entries we will only verify they share + * 'reference' as an ancestor in their clip stack since that's + * enough to know that they would be within the required bounds. + */ + for (i = 1; i < journal->entries->len; i++) + { + CoglBool found_reference = FALSE; + entry = &g_array_index (journal->entries, CoglJournalEntry, i); + + for (clip_entry = entry->clip_stack; + clip_entry; + clip_entry = clip_entry->parent) + { + if (clip_entry == reference) + { + found_reference = TRUE; + break; + } + } + + if (!found_reference) + return FALSE; + } + + return TRUE; +} + +static void +post_fences (CoglJournal *journal) +{ + CoglFenceClosure *fence, *tmp; + + _cogl_list_for_each_safe (fence, tmp, &journal->pending_fences, link) + { + _cogl_list_remove (&fence->link); + _cogl_fence_submit (fence); + } +} + +/* XXX NB: When _cogl_journal_flush() returns all state relating + * to pipelines, all glEnable flags and current matrix state + * is undefined. + */ +void +_cogl_journal_flush (CoglJournal *journal) +{ + CoglFramebuffer *framebuffer; + CoglContext *ctx; + CoglJournalFlushState state; + int i; + COGL_STATIC_TIMER (flush_timer, + "Mainloop", /* parent */ + "Journal Flush", + "The time spent flushing the Cogl journal", + 0 /* no application private data */); + COGL_STATIC_TIMER (discard_timer, + "Journal Flush", /* parent */ + "flush: discard", + "The time spent discarding the Cogl journal after a flush", + 0 /* no application private data */); + + if (journal->entries->len == 0) + { + post_fences (journal); + return; + } + + framebuffer = journal->framebuffer; + ctx = framebuffer->context; + + /* The entries in this journal may depend on images in other + * framebuffers which may require that we flush the journals + * associated with those framebuffers before we can flush + * this journal... */ + _cogl_framebuffer_flush_dependency_journals (framebuffer); + + /* Note: we start the timer after flushing dependency journals so + * that the timer isn't started recursively. */ + COGL_TIMER_START (_cogl_uprof_context, flush_timer); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING))) + g_print ("BATCHING: journal len = %d\n", journal->entries->len); + + /* NB: the journal deals with flushing the modelview stack and clip + state manually */ + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_ALL & + ~(COGL_FRAMEBUFFER_STATE_MODELVIEW | + COGL_FRAMEBUFFER_STATE_CLIP)); + + /* We need to mark the current modelview state of the framebuffer as + * dirty because we are going to manually replace it */ + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_MODELVIEW; + + state.ctx = ctx; + state.journal = journal; + + state.attributes = ctx->journal_flush_attributes_array; + + if (G_UNLIKELY ((COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_CLIP)) == 0)) + { + /* We do an initial walk of the journal to analyse the clip stack + batches to see if we can do software clipping. We do this as a + separate walk of the journal because we can modify entries and + this may end up joining together clip stack batches in the next + iteration. */ + batch_and_call ((CoglJournalEntry *)journal->entries->data, /* first entry */ + journal->entries->len, /* max number of entries to consider */ + compare_entry_clip_stacks, + _cogl_journal_maybe_software_clip_entries, /* callback */ + &state); /* data */ + } + + /* We upload the vertices after the clip stack pass in case it + modifies the entries */ + state.attribute_buffer = + upload_vertices (journal, + &g_array_index (journal->entries, CoglJournalEntry, 0), + journal->entries->len, + journal->needed_vbo_len, + journal->vertices); + state.array_offset = 0; + + /* batch_and_call() batches a list of journal entries according to some + * given criteria and calls a callback once for each determined batch. + * + * The process of flushing the journal is staggered to reduce the amount + * of driver/GPU state changes necessary: + * 1) We split the entries according to the clip state. + * 2) We split the entries according to the stride of the vertices: + * Each time the stride of our vertex data changes we need to call + * gl{Vertex,Color}Pointer to inform GL of new VBO offsets. + * Currently the only thing that affects the stride of our vertex data + * is the number of pipeline layers. + * 3) We split the entries explicitly by the number of pipeline layers: + * We pad our vertex data when the number of layers is < 2 so that we + * can minimize changes in stride. Each time the number of layers + * changes we need to call glTexCoordPointer to inform GL of new VBO + * offsets. + * 4) We then split according to compatible Cogl pipelines: + * This is where we flush pipeline state + * 5) Finally we split according to modelview matrix changes: + * This is when we finally tell GL to draw something. + * Note: Splitting by modelview changes is skipped when are doing the + * vertex transformation in software at log time. + */ + batch_and_call ((CoglJournalEntry *)journal->entries->data, /* first entry */ + journal->entries->len, /* max number of entries to consider */ + compare_entry_clip_stacks, + _cogl_journal_flush_clip_stacks_and_entries, /* callback */ + &state); /* data */ + + for (i = 0; i < state.attributes->len; i++) + cogl_object_unref (g_array_index (state.attributes, CoglAttribute *, i)); + g_array_set_size (state.attributes, 0); + + cogl_object_unref (state.attribute_buffer); + + COGL_TIMER_START (_cogl_uprof_context, discard_timer); + _cogl_journal_discard (journal); + COGL_TIMER_STOP (_cogl_uprof_context, discard_timer); + + post_fences (journal); + + COGL_TIMER_STOP (_cogl_uprof_context, flush_timer); +} + +static CoglBool +add_framebuffer_deps_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglFramebuffer *framebuffer = user_data; + CoglTexture *texture = _cogl_pipeline_layer_get_texture_real (layer); + const GList *l; + + if (!texture) + return TRUE; + + for (l = _cogl_texture_get_associated_framebuffers (texture); l; l = l->next) + _cogl_framebuffer_add_dependency (framebuffer, l->data); + + return TRUE; +} + +void +_cogl_journal_log_quad (CoglJournal *journal, + const float *position, + CoglPipeline *pipeline, + int n_layers, + CoglTexture *layer0_override_texture, + const float *tex_coords, + unsigned int tex_coords_len) +{ + CoglFramebuffer *framebuffer = journal->framebuffer; + size_t stride; + int next_vert; + float *v; + int i; + int next_entry; + uint32_t disable_layers; + CoglJournalEntry *entry; + CoglPipeline *final_pipeline; + CoglClipStack *clip_stack; + CoglPipelineFlushOptions flush_options; + CoglMatrixStack *modelview_stack; + COGL_STATIC_TIMER (log_timer, + "Mainloop", /* parent */ + "Journal Log", + "The time spent logging in the Cogl journal", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, log_timer); + + /* Adding something to the journal should mean that we are in the + * middle of the scene. Although this will also end up being set + * when the journal is actually flushed, we set it here explicitly + * so that we will know sooner */ + _cogl_framebuffer_mark_mid_scene (framebuffer); + + /* If the framebuffer was previously empty then we'll take a + reference to the current framebuffer. This reference will be + removed when the journal is flushed */ + if (journal->vertices->len == 0) + cogl_object_ref (framebuffer); + + /* The vertex data is logged into a separate array. The data needs + to be copied into a vertex array before it's given to GL so we + only store two vertices per quad and expand it to four while + uploading. */ + + /* XXX: See definition of GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS for details + * about how we pack our vertex data */ + stride = GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (n_layers); + + next_vert = journal->vertices->len; + g_array_set_size (journal->vertices, next_vert + 2 * stride + 1); + v = &g_array_index (journal->vertices, float, next_vert); + + /* We calculate the needed size of the vbo as we go because it + depends on the number of layers in each entry and it's not easy + calculate based on the length of the logged vertices array */ + journal->needed_vbo_len += GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers) * 4; + + /* XXX: All the jumping around to fill in this strided buffer doesn't + * seem ideal. */ + + /* FIXME: This is a hacky optimization, since it will break if we + * change the definition of CoglColor: */ + _cogl_pipeline_get_colorubv (pipeline, (uint8_t *) v); + v++; + + memcpy (v, position, sizeof (float) * 2); + memcpy (v + stride, position + 2, sizeof (float) * 2); + + for (i = 0; i < n_layers; i++) + { + /* XXX: See definition of GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS + * for details about how we pack our vertex data */ + GLfloat *t = v + 2 + i * 2; + + memcpy (t, tex_coords + i * 4, sizeof (float) * 2); + memcpy (t + stride, tex_coords + i * 4 + 2, sizeof (float) * 2); + } + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL))) + { + g_print ("Logged new quad:\n"); + v = &g_array_index (journal->vertices, float, next_vert); + _cogl_journal_dump_logged_quad ((uint8_t *)v, n_layers); + } + + next_entry = journal->entries->len; + g_array_set_size (journal->entries, next_entry + 1); + entry = &g_array_index (journal->entries, CoglJournalEntry, next_entry); + + entry->n_layers = n_layers; + entry->array_offset = next_vert; + + final_pipeline = pipeline; + + flush_options.flags = 0; + if (G_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers)) + { + disable_layers = (1 << n_layers) - 1; + disable_layers = ~disable_layers; + flush_options.disable_layers = disable_layers; + flush_options.flags |= COGL_PIPELINE_FLUSH_DISABLE_MASK; + } + if (G_UNLIKELY (layer0_override_texture)) + { + flush_options.flags |= COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE; + flush_options.layer0_override_texture = layer0_override_texture; + } + + if (G_UNLIKELY (flush_options.flags)) + { + final_pipeline = cogl_pipeline_copy (pipeline); + _cogl_pipeline_apply_overrides (final_pipeline, &flush_options); + } + + entry->pipeline = _cogl_pipeline_journal_ref (final_pipeline); + + clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer); + entry->clip_stack = _cogl_clip_stack_ref (clip_stack); + + if (G_UNLIKELY (final_pipeline != pipeline)) + cogl_object_unref (final_pipeline); + + modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + entry->modelview_entry = cogl_matrix_entry_ref (modelview_stack->last_entry); + + _cogl_pipeline_foreach_layer_internal (pipeline, + add_framebuffer_deps_cb, + framebuffer); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BATCHING))) + _cogl_journal_flush (journal); + + COGL_TIMER_STOP (_cogl_uprof_context, log_timer); +} + +static void +entry_to_screen_polygon (CoglFramebuffer *framebuffer, + const CoglJournalEntry *entry, + float *vertices, + float *poly) +{ + size_t array_stride = + GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (entry->n_layers); + CoglMatrixStack *projection_stack; + CoglMatrix projection; + CoglMatrix modelview; + int i; + float viewport[4]; + + poly[0] = vertices[0]; + poly[1] = vertices[1]; + poly[2] = 0; + poly[3] = 1; + + poly[4] = vertices[0]; + poly[5] = vertices[array_stride + 1]; + poly[6] = 0; + poly[7] = 1; + + poly[8] = vertices[array_stride]; + poly[9] = vertices[array_stride + 1]; + poly[10] = 0; + poly[11] = 1; + + poly[12] = vertices[array_stride]; + poly[13] = vertices[1]; + poly[14] = 0; + poly[15] = 1; + + /* TODO: perhaps split the following out into a more generalized + * _cogl_transform_points utility... + */ + + cogl_matrix_entry_get (entry->modelview_entry, &modelview); + cogl_matrix_transform_points (&modelview, + 2, /* n_components */ + sizeof (float) * 4, /* stride_in */ + poly, /* points_in */ + /* strideout */ + sizeof (float) * 4, + poly, /* points_out */ + 4 /* n_points */); + + projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + cogl_matrix_stack_get (projection_stack, &projection); + + cogl_matrix_project_points (&projection, + 3, /* n_components */ + sizeof (float) * 4, /* stride_in */ + poly, /* points_in */ + /* strideout */ + sizeof (float) * 4, + poly, /* points_out */ + 4 /* n_points */); + + cogl_framebuffer_get_viewport4fv (framebuffer, viewport); + +/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1) + * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with + * (0,0) being top left. */ +#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ + ( ( ((x) + 1.0) * ((vp_width) / 2.0) ) + (vp_origin_x) ) +/* Note: for Y we first flip all coordinates around the X axis while in + * normalized device coodinates */ +#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ + ( ( ((-(y)) + 1.0) * ((vp_height) / 2.0) ) + (vp_origin_y) ) + + /* Scale from normalized device coordinates (in range [-1,1]) to + * window coordinates ranging [0,window-size] ... */ + for (i = 0; i < 4; i++) + { + float w = poly[4 * i + 3]; + + /* Perform perspective division */ + poly[4 * i] /= w; + poly[4 * i + 1] /= w; + + /* Apply viewport transform */ + poly[4 * i] = VIEWPORT_TRANSFORM_X (poly[4 * i], + viewport[0], viewport[2]); + poly[4 * i + 1] = VIEWPORT_TRANSFORM_Y (poly[4 * i + 1], + viewport[1], viewport[3]); + } + +#undef VIEWPORT_TRANSFORM_X +#undef VIEWPORT_TRANSFORM_Y +} + +static CoglBool +try_checking_point_hits_entry_after_clipping (CoglFramebuffer *framebuffer, + CoglJournalEntry *entry, + float *vertices, + float x, + float y, + CoglBool *hit) +{ + CoglBool can_software_clip = TRUE; + CoglBool needs_software_clip = FALSE; + CoglClipStack *clip_entry; + + *hit = TRUE; + + /* Verify that all of the clip stack entries are simple rectangle + * clips */ + for (clip_entry = entry->clip_stack; + clip_entry; + clip_entry = clip_entry->parent) + { + if (x < clip_entry->bounds_x0 || + x >= clip_entry->bounds_x1 || + y < clip_entry->bounds_y0 || + y >= clip_entry->bounds_y1) + { + *hit = FALSE; + return TRUE; + } + + if (clip_entry->type == COGL_CLIP_STACK_WINDOW_RECT) + { + /* XXX: technically we could still run the software clip in + * this case because for our purposes we know this clip + * can be ignored now, but [can_]sofware_clip_entry() doesn't + * know this and will bail out. */ + can_software_clip = FALSE; + } + else if (clip_entry->type == COGL_CLIP_STACK_RECT) + { + CoglClipStackRect *rect_entry = (CoglClipStackRect *)entry; + + if (rect_entry->can_be_scissor == FALSE) + needs_software_clip = TRUE; + /* If can_be_scissor is TRUE then we know it's screen + * aligned and the hit test we did above has determined + * that we are inside this clip. */ + } + else + return FALSE; + } + + if (needs_software_clip) + { + ClipBounds clip_bounds; + float poly[16]; + + if (!can_software_clip) + return FALSE; + + if (!can_software_clip_entry (entry, NULL, + entry->clip_stack, &clip_bounds)) + return FALSE; + + software_clip_entry (entry, vertices, &clip_bounds); + entry_to_screen_polygon (framebuffer, entry, vertices, poly); + + *hit = _cogl_util_point_in_screen_poly (x, y, poly, sizeof (float) * 4, 4); + return TRUE; + } + + return TRUE; +} + +CoglBool +_cogl_journal_try_read_pixel (CoglJournal *journal, + int x, + int y, + CoglBitmap *bitmap, + CoglBool *found_intersection) +{ + CoglContext *ctx; + CoglPixelFormat format; + int i; + + /* XXX: this number has been plucked out of thin air, but the idea + * is that if so many pixels are being read from the same un-changed + * journal than we expect that it will be more efficient to fail + * here so we end up flushing and rendering the journal so that + * further reads can directly read from the framebuffer. There will + * be a bit more lag to flush the render but if there are going to + * continue being lots of arbitrary single pixel reads they will end + * up faster in the end. */ + if (journal->fast_read_pixel_count > 50) + return FALSE; + + format = cogl_bitmap_get_format (bitmap); + + if (format != COGL_PIXEL_FORMAT_RGBA_8888_PRE && + format != COGL_PIXEL_FORMAT_RGBA_8888) + return FALSE; + + ctx = _cogl_bitmap_get_context (bitmap); + + *found_intersection = FALSE; + + /* NB: The most recently added journal entry is the last entry, and + * assuming this is a simple scene only comprised of opaque coloured + * rectangles with no special pipelines involved (e.g. enabling + * depth testing) then we can assume painter's algorithm for the + * entries and so our fast read-pixel just needs to walk backwards + * through the journal entries trying to intersect each entry with + * the given point of interest. */ + for (i = journal->entries->len - 1; i >= 0; i--) + { + CoglJournalEntry *entry = + &g_array_index (journal->entries, CoglJournalEntry, i); + uint8_t *color = (uint8_t *)&g_array_index (journal->vertices, float, + entry->array_offset); + float *vertices = (float *)color + 1; + float poly[16]; + CoglFramebuffer *framebuffer = journal->framebuffer; + uint8_t *pixel; + CoglError *ignore_error; + + entry_to_screen_polygon (framebuffer, entry, vertices, poly); + + if (!_cogl_util_point_in_screen_poly (x, y, poly, sizeof (float) * 4, 4)) + continue; + + if (entry->clip_stack) + { + CoglBool hit; + + if (!try_checking_point_hits_entry_after_clipping (framebuffer, + entry, + vertices, + x, y, &hit)) + return FALSE; /* hit couldn't be determined */ + + if (!hit) + continue; + } + + *found_intersection = TRUE; + + /* If we find that the rectangle the point of interest + * intersects has any state more complex than a constant opaque + * color then we bail out. */ + if (!_cogl_pipeline_equal (ctx->opaque_color_pipeline, entry->pipeline, + (COGL_PIPELINE_STATE_ALL & + ~COGL_PIPELINE_STATE_COLOR), + COGL_PIPELINE_LAYER_STATE_ALL, + 0)) + return FALSE; + + + /* we currently only care about cases where the premultiplied or + * unpremultipled colors are equivalent... */ + if (color[3] != 0xff) + return FALSE; + + pixel = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + &ignore_error); + if (pixel == NULL) + { + cogl_error_free (ignore_error); + return FALSE; + } + + pixel[0] = color[0]; + pixel[1] = color[1]; + pixel[2] = color[2]; + pixel[3] = color[3]; + + _cogl_bitmap_unmap (bitmap); + + goto success; + } + +success: + journal->fast_read_pixel_count++; + return TRUE; +} diff --git a/cogl/cogl-kms-display.h b/cogl/cogl-kms-display.h new file mode 100644 index 0000000..05226df --- /dev/null +++ b/cogl/cogl-kms-display.h @@ -0,0 +1,119 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_KMS_DISPLAY_H__ +#define __COGL_KMS_DISPLAY_H__ + +#include +#include + +#include + +COGL_BEGIN_DECLS + +/** + * cogl_kms_display_queue_modes_reset: + * @display: A #CoglDisplay + * + * Asks Cogl to explicitly reset the crtc output modes at the next + * #CoglOnscreen swap_buffers request. For applications that support + * VT switching they may want to re-assert the output modes when + * switching back to the applications VT since the modes are often not + * correctly restored automatically. + * + * The @display must have been either explicitly setup via + * cogl_display_setup() or implicitily setup by having created a + * context using the @display + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_kms_display_queue_modes_reset (CoglDisplay *display); + +typedef struct { + uint32_t id; + uint32_t x, y; + drmModeModeInfo mode; + + uint32_t *connectors; + uint32_t count; + + CoglBool ignore; +} CoglKmsCrtc; + +/** + * cogl_kms_display_set_layout: + * @onscreen: a #CoglDisplay + * @width: the framebuffer width + * @height: the framebuffer height + * @crtcs: the array of #CoglKmsCrtc structure with the desired CRTC layout + * + * Configures @display to use a framebuffer sized @width x @height, covering + * the CRTCS in @crtcs. + * @width and @height must be within the driver framebuffer limits, and @crtcs + * must be valid KMS API IDs. + * + * Calling this function overrides the automatic mode setting done by Cogl, + * and for this reason must be called before the first call to cogl_onscreen_swap_buffers(). + * + * If you want to restore the default behaviour, you can call this function + * with @width and @height set to -1. + * + * Stability: unstable + */ +CoglBool +cogl_kms_display_set_layout (CoglDisplay *display, + int width, + int height, + CoglKmsCrtc **crtcs, + int n_crtcs, + CoglError **error); + + +/** + * cogl_kms_display_set_layout: + * @onscreen: a #CoglDisplay + * @id: KMS output id + * @ignore: Ignore ouput or not + * + * Tells cogl to ignore (or stop ignoring) a ctrc which means + * it never flips buffers at this crtc. + * + * Stability: unstable + */ +void +cogl_kms_display_set_ignore_crtc (CoglDisplay *display, + uint32_t id, + CoglBool ignore); +COGL_END_DECLS +#endif /* __COGL_KMS_DISPLAY_H__ */ diff --git a/cogl/cogl-kms-renderer.h b/cogl/cogl-kms-renderer.h new file mode 100644 index 0000000..4e4948e --- /dev/null +++ b/cogl/cogl-kms-renderer.h @@ -0,0 +1,74 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_KMS_RENDERER_H__ +#define __COGL_KMS_RENDERER_H__ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_kms_renderer_set_kms_fd: + * @renderer: A #CoglRenderer + * @fd: The fd to kms to use + * + * Sets the file descriptor Cogl should use to communicate + * to the kms driver. If -1 (the default), then Cogl will + * open its own FD by trying to open "/dev/dri/card0". + * + * Since: 1.18 + * Stability: unstable + */ +void +cogl_kms_renderer_set_kms_fd (CoglRenderer *renderer, + int fd); + +/** + * cogl_kms_renderer_get_kms_fd: + * @renderer: A #CoglRenderer + * + * Queries the file descriptor Cogl is using internally for + * communicating with the kms driver. + * + * Return value: The kms file descriptor or -1 if no kms file + * desriptor has been opened by Cogl. + * Stability: unstable + */ +int +cogl_kms_renderer_get_kms_fd (CoglRenderer *renderer); + +struct gbm_device * +cogl_kms_renderer_get_gbm (CoglRenderer *renderer); +COGL_END_DECLS +#endif /* __COGL_KMS_RENDERER_H__ */ diff --git a/cogl/cogl-list.c b/cogl/cogl-list.c new file mode 100644 index 0000000..3fbc675 --- /dev/null +++ b/cogl/cogl-list.c @@ -0,0 +1,94 @@ +/* + * Copyright © 2008-2011 Kristian Høgsberg + * Copyright © 2011, 2012 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* This list implementation is based on the Wayland source code */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-list.h" + +void +_cogl_list_init (CoglList *list) +{ + list->prev = list; + list->next = list; +} + +void +_cogl_list_insert (CoglList *list, CoglList *elm) +{ + elm->prev = list; + elm->next = list->next; + list->next = elm; + elm->next->prev = elm; +} + +void +_cogl_list_remove (CoglList *elm) +{ + elm->prev->next = elm->next; + elm->next->prev = elm->prev; + elm->next = NULL; + elm->prev = NULL; +} + +int +_cogl_list_length (CoglList *list) +{ + CoglList *e; + int count; + + count = 0; + e = list->next; + while (e != list) + { + e = e->next; + count++; + } + + return count; +} + +int +_cogl_list_empty (CoglList *list) +{ + return list->next == list; +} + +void +_cogl_list_insert_list (CoglList *list, + CoglList *other) +{ + if (_cogl_list_empty (other)) + return; + + other->next->prev = list; + other->prev->next = list->next; + list->next->prev = other->prev; + list->next = other->next; +} diff --git a/cogl/cogl-list.h b/cogl/cogl-list.h new file mode 100644 index 0000000..20cbec8 --- /dev/null +++ b/cogl/cogl-list.h @@ -0,0 +1,129 @@ +/* + * Copyright © 2008 Kristian Høgsberg + * Copyright © 2012, 2013 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/* This list implementation is based on the Wayland source code */ + +#ifndef COGL_LIST_H +#define COGL_LIST_H + +#include + +/** + * CoglList - linked list + * + * The list head is of "CoglList" type, and must be initialized + * using cogl_list_init(). All entries in the list must be of the same + * type. The item type must have a "CoglList" member. This + * member will be initialized by cogl_list_insert(). There is no need to + * call cogl_list_init() on the individual item. To query if the list is + * empty in O(1), use cogl_list_empty(). + * + * Let's call the list reference "CoglList foo_list", the item type as + * "item_t", and the item member as "CoglList link". The following code + * + * The following code will initialize a list: + * + * cogl_list_init (foo_list); + * cogl_list_insert (foo_list, item1); Pushes item1 at the head + * cogl_list_insert (foo_list, item2); Pushes item2 at the head + * cogl_list_insert (item2, item3); Pushes item3 after item2 + * + * The list now looks like [item2, item3, item1] + * + * Will iterate the list in ascending order: + * + * item_t *item; + * cogl_list_for_each(item, foo_list, link) { + * Do_something_with_item(item); + * } + */ + +typedef struct _CoglList CoglList; + +struct _CoglList +{ + CoglList *prev; + CoglList *next; +}; + +void +_cogl_list_init (CoglList *list); + +void +_cogl_list_insert (CoglList *list, + CoglList *elm); + +void +_cogl_list_remove (CoglList *elm); + +int +_cogl_list_length (CoglList *list); + +int +_cogl_list_empty (CoglList *list); + +void +_cogl_list_insert_list (CoglList *list, + CoglList *other); + +/* This assigns to iterator first so that taking a reference to it + * later in the second step won't be an undefined operation. It + * assigns the value of list_node rather than 0 so that it is possible + * have list_node be based on the previous value of iterator. In that + * respect iterator is just used as a convenient temporary variable. + * The compiler optimises all of this down to a single subtraction by + * a constant */ +#define _cogl_list_set_iterator(list_node, iterator, member) \ + ((iterator) = (void *) (list_node), \ + (iterator) = (void *) ((char *) (iterator) - \ + (((char *) &(iterator)->member) - \ + (char *) (iterator)))) + +#define _cogl_container_of(ptr, type, member) \ + (type *) ((char *) (ptr) - offsetof (type, member)) + +#define _cogl_list_for_each(pos, head, member) \ + for (_cogl_list_set_iterator ((head)->next, pos, member); \ + &pos->member != (head); \ + _cogl_list_set_iterator (pos->member.next, pos, member)) + +#define _cogl_list_for_each_safe(pos, tmp, head, member) \ + for (_cogl_list_set_iterator ((head)->next, pos, member), \ + _cogl_list_set_iterator ((pos)->member.next, tmp, member); \ + &pos->member != (head); \ + pos = tmp, \ + _cogl_list_set_iterator (pos->member.next, tmp, member)) + +#define _cogl_list_for_each_reverse(pos, head, member) \ + for (_cogl_list_set_iterator ((head)->prev, pos, member); \ + &pos->member != (head); \ + _cogl_list_set_iterator (pos->member.prev, pos, member)) + +#define _cogl_list_for_each_reverse_safe(pos, tmp, head, member) \ + for (_cogl_list_set_iterator ((head)->prev, pos, member), \ + _cogl_list_set_iterator ((pos)->member.prev, tmp, member); \ + &pos->member != (head); \ + pos = tmp, \ + _cogl_list_set_iterator (pos->member.prev, tmp, member)) + +#endif /* COGL_LIST_H */ diff --git a/cogl/cogl-macros.h b/cogl/cogl-macros.h new file mode 100644 index 0000000..17708f9 --- /dev/null +++ b/cogl/cogl-macros.h @@ -0,0 +1,273 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_MACROS_H__ +#define __COGL_MACROS_H__ + +#include + +/* These macros are used to mark deprecated functions, and thus have + * to be exposed in a public header. + * + * They are only intended for internal use and should not be used by + * other projects. + */ +#if defined(COGL_DISABLE_DEPRECATION_WARNINGS) || defined(COGL_COMPILATION) + +#define COGL_DEPRECATED +#define COGL_DEPRECATED_FOR(f) +#define COGL_UNAVAILABLE(maj,min) + +#else /* COGL_DISABLE_DEPRECATION_WARNINGS */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define COGL_DEPRECATED __attribute__((__deprecated__)) +#elif defined(_MSC_VER) && (_MSC_VER >= 1300) +#define COGL_DEPRECATED __declspec(deprecated) +#else +#define COGL_DEPRECATED +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define COGL_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead"))) +#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) +#define COGL_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead")) +#else +#define COGL_DEPRECATED_FOR(f) G_DEPRECATED +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define COGL_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min))) +#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) +#define COGL_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min)) +#else +#define COGL_UNAVAILABLE(maj,min) +#endif + +#endif /* COGL_DISABLE_DEPRECATION_WARNINGS */ + +/** + * COGL_VERSION_MIN_REQUIRED: + * + * A macro that should be defined by the user prior to including the + * cogl.h header. + * + * The definition should be one of the predefined Cogl version macros, + * such as: %COGL_VERSION_1_8, %COGL_VERSION_1_10, ... + * + * This macro defines the lower bound for the Cogl API to be used. + * + * If a function has been deprecated in a newer version of Cogl, it + * is possible to use this symbol to avoid the compiler warnings without + * disabling warnings for every deprecated function. + * + * Since: 1.16 + */ +#ifndef COGL_VERSION_MIN_REQUIRED +# define COGL_VERSION_MIN_REQUIRED (COGL_VERSION_CURRENT_STABLE) +#endif + +/** + * COGL_VERSION_MAX_ALLOWED: + * + * A macro that should be define by the user prior to including the + * cogl.h header. + * + * The definition should be one of the predefined Cogl version macros, + * such as: %COGL_VERSION_1_0, %COGL_VERSION_1_2, ... + * + * This macro defines the upper bound for the Cogl API to be used. + * + * If a function has been introduced in a newer version of Cogl, it + * is possible to use this symbol to get compiler warnings when trying + * to use that function. + * + * Since: 1.16 + */ +#ifndef COGL_VERSION_MAX_ALLOWED +# if COGL_VERSION_MIN_REQUIRED > COGL_VERSION_PREVIOUS_STABLE +# define COGL_VERSION_MAX_ALLOWED COGL_VERSION_MIN_REQUIRED +# else +# define COGL_VERSION_MAX_ALLOWED COGL_VERSION_CURRENT_STABLE +# endif +#endif + +/* sanity checks */ +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_MIN_REQUIRED +# error "COGL_VERSION_MAX_ALLOWED must be >= COGL_VERSION_MIN_REQUIRED" +#endif +#if COGL_VERSION_MIN_REQUIRED < COGL_VERSION_1_0 +# error "COGL_VERSION_MIN_REQUIRED must be >= COGL_VERSION_1_0" +#endif + +/* XXX: Every new stable minor release should add a set of macros here */ +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_0 +# define COGL_DEPRECATED_IN_1_0 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_0_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_0 +# define COGL_DEPRECATED_IN_1_0_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_0 +# define COGL_AVAILABLE_IN_1_0 COGL_UNAVAILABLE(1, 0) +#else +# define COGL_AVAILABLE_IN_1_0 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_2 +# define COGL_DEPRECATED_IN_1_2 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_2_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_2 +# define COGL_DEPRECATED_IN_1_2_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_2 +# define COGL_AVAILABLE_IN_1_2 COGL_UNAVAILABLE(1, 2) +#else +# define COGL_AVAILABLE_IN_1_2 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_4 +# define COGL_DEPRECATED_IN_1_4 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_4_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_4 +# define COGL_DEPRECATED_IN_1_4_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_4 +# define COGL_AVAILABLE_IN_1_4 COGL_UNAVAILABLE(1, 4) +#else +# define COGL_AVAILABLE_IN_1_4 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_6 +# define COGL_DEPRECATED_IN_1_6 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_6_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_6 +# define COGL_DEPRECATED_IN_1_6_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_6 +# define COGL_AVAILABLE_IN_1_6 COGL_UNAVAILABLE(1, 6) +#else +# define COGL_AVAILABLE_IN_1_6 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_8 +# define COGL_DEPRECATED_IN_1_8 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_8_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_8 +# define COGL_DEPRECATED_IN_1_8_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_8 +# define COGL_AVAILABLE_IN_1_8 COGL_UNAVAILABLE(1, 8) +#else +# define COGL_AVAILABLE_IN_1_8 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_10 +# define COGL_DEPRECATED_IN_1_10 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_10_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_10 +# define COGL_DEPRECATED_IN_1_10_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_10 +# define COGL_AVAILABLE_IN_1_10 COGL_UNAVAILABLE(1, 10) +#else +# define COGL_AVAILABLE_IN_1_10 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_12 +# define COGL_DEPRECATED_IN_1_12 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_12_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_12 +# define COGL_DEPRECATED_IN_1_12_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_12 +# define COGL_AVAILABLE_IN_1_12 COGL_UNAVAILABLE(1, 12) +#else +# define COGL_AVAILABLE_IN_1_12 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_14 +# define COGL_DEPRECATED_IN_1_14 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_14_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_14 +# define COGL_DEPRECATED_IN_1_14_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_14 +# define COGL_AVAILABLE_IN_1_14 COGL_UNAVAILABLE(1, 14) +#else +# define COGL_AVAILABLE_IN_1_14 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_16 +# define COGL_DEPRECATED_IN_1_16 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_16_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_16 +# define COGL_DEPRECATED_IN_1_16_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_16 +# define COGL_AVAILABLE_IN_1_16 COGL_UNAVAILABLE(1, 16) +#else +# define COGL_AVAILABLE_IN_1_16 +#endif + +#if COGL_VERSION_MIN_REQUIRED >= COGL_VERSION_1_18 +# define COGL_DEPRECATED_IN_1_18 COGL_DEPRECATED +# define COGL_DEPRECATED_IN_1_18_FOR(f) COGL_DEPRECATED_FOR(f) +#else +# define COGL_DEPRECATED_IN_1_18 +# define COGL_DEPRECATED_IN_1_18_FOR(f) +#endif + +#if COGL_VERSION_MAX_ALLOWED < COGL_VERSION_1_18 +# define COGL_AVAILABLE_IN_1_18 COGL_UNAVAILABLE(1, 18) +#else +# define COGL_AVAILABLE_IN_1_18 +#endif + +#endif /* __COGL_MACROS_H__ */ diff --git a/cogl/cogl-magazine-private.h b/cogl/cogl-magazine-private.h new file mode 100644 index 0000000..091801b --- /dev/null +++ b/cogl/cogl-magazine-private.h @@ -0,0 +1,81 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_MAGAZINE_PRIVATE_H__ +#define __COGL_MAGAZINE_PRIVATE_H__ + +#include + +#include "cogl-memory-stack-private.h" + +typedef struct _CoglMagazineChunk CoglMagazineChunk; + +struct _CoglMagazineChunk +{ + CoglMagazineChunk *next; +}; + +typedef struct _CoglMagazine +{ + size_t chunk_size; + + CoglMemoryStack *stack; + CoglMagazineChunk *head; +} CoglMagazine; + +CoglMagazine * +_cogl_magazine_new (size_t chunk_size, int initial_chunk_count); + +static inline void * +_cogl_magazine_chunk_alloc (CoglMagazine *magazine) +{ + if (G_LIKELY (magazine->head)) + { + CoglMagazineChunk *chunk = magazine->head; + magazine->head = chunk->next; + return chunk; + } + else + return _cogl_memory_stack_alloc (magazine->stack, magazine->chunk_size); +} + +static inline void +_cogl_magazine_chunk_free (CoglMagazine *magazine, void *data) +{ + CoglMagazineChunk *chunk = data; + + chunk->next = magazine->head; + magazine->head = chunk; +} + +void +_cogl_magazine_free (CoglMagazine *magazine); + +#endif /* __COGL_MAGAZINE_PRIVATE_H__ */ diff --git a/cogl/cogl-magazine.c b/cogl/cogl-magazine.c new file mode 100644 index 0000000..5617751 --- /dev/null +++ b/cogl/cogl-magazine.c @@ -0,0 +1,84 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * CoglMagazine provides a really light weight allocator for chunks + * of memory with a pre-determined size. + * + * This allocator builds on CoglMemoryStack for making all initial + * allocations but never frees memory back to the stack. + * + * Memory chunks that haven't been allocated yet are stored in a + * singly linked, fifo, list. + * + * Allocating from a magazine is simply a question of popping an entry + * from the head of the fifo list. If no entries are available then + * instead allocate from the memory stack instead. + * + * When an entry is freed, it is put back into the fifo list for + * re-use. + * + * No attempt is ever made to shrink the amount of memory associated + * with a CoglMagazine. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-memory-stack-private.h" +#include "cogl-magazine-private.h" +#include + +#define ROUND_UP_8(X) ((X + (8 - 1)) & ~(8 - 1)) + +CoglMagazine * +_cogl_magazine_new (size_t chunk_size, int initial_chunk_count) +{ + CoglMagazine *magazine = g_new0 (CoglMagazine, 1); + + chunk_size = MAX (chunk_size, sizeof (CoglMagazineChunk)); + chunk_size = ROUND_UP_8 (chunk_size); + + magazine->chunk_size = chunk_size; + magazine->stack = _cogl_memory_stack_new (chunk_size * initial_chunk_count); + magazine->head = NULL; + + return magazine; +} + +void +_cogl_magazine_free (CoglMagazine *magazine) +{ + _cogl_memory_stack_free (magazine->stack); + g_free (magazine); +} diff --git a/cogl/cogl-matrix-private.h b/cogl/cogl-matrix-private.h new file mode 100644 index 0000000..d9fc98e --- /dev/null +++ b/cogl/cogl-matrix-private.h @@ -0,0 +1,58 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_MATRIX_PRIVATE_H +#define __COGL_MATRIX_PRIVATE_H + +#include + +COGL_BEGIN_DECLS + +#define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \ + { \ + g_print ("%s:\n", G_STRFUNC); \ + cogl_debug_matrix_print (MATRIX); \ + } + +void +_cogl_matrix_prefix_print (const char *prefix, const CoglMatrix *matrix); + +void +_cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix, + const CoglMatrix *src); + +COGL_END_DECLS + +#endif /* __COGL_MATRIX_PRIVATE_H */ + diff --git a/cogl/cogl-matrix-stack-private.h b/cogl/cogl-matrix-stack-private.h new file mode 100644 index 0000000..0d5caf8 --- /dev/null +++ b/cogl/cogl-matrix-stack-private.h @@ -0,0 +1,200 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Havoc Pennington for litl + * Robert Bragg + */ + +#ifndef _COGL_MATRIX_STACK_PRIVATE_H_ +#define _COGL_MATRIX_STACK_PRIVATE_H_ + +#include "cogl-object-private.h" +#include "cogl-matrix-stack.h" +#include "cogl-context.h" +#include "cogl-framebuffer.h" + +typedef enum _CoglMatrixOp +{ + COGL_MATRIX_OP_LOAD_IDENTITY, + COGL_MATRIX_OP_TRANSLATE, + COGL_MATRIX_OP_ROTATE, + COGL_MATRIX_OP_ROTATE_QUATERNION, + COGL_MATRIX_OP_ROTATE_EULER, + COGL_MATRIX_OP_SCALE, + COGL_MATRIX_OP_MULTIPLY, + COGL_MATRIX_OP_LOAD, + COGL_MATRIX_OP_SAVE, +} CoglMatrixOp; + +struct _CoglMatrixEntry +{ + CoglMatrixEntry *parent; + CoglMatrixOp op; + unsigned int ref_count; + +#ifdef COGL_DEBUG_ENABLED + /* used for performance tracing */ + int composite_gets; +#endif +}; + +typedef struct _CoglMatrixEntryTranslate +{ + CoglMatrixEntry _parent_data; + + float x; + float y; + float z; + +} CoglMatrixEntryTranslate; + +typedef struct _CoglMatrixEntryRotate +{ + CoglMatrixEntry _parent_data; + + float angle; + float x; + float y; + float z; + +} CoglMatrixEntryRotate; + +typedef struct _CoglMatrixEntryRotateEuler +{ + CoglMatrixEntry _parent_data; + + /* This doesn't store an actual CoglEuler in order to avoid the + * padding */ + float heading; + float pitch; + float roll; +} CoglMatrixEntryRotateEuler; + +typedef struct _CoglMatrixEntryRotateQuaternion +{ + CoglMatrixEntry _parent_data; + + /* This doesn't store an actual CoglQuaternion in order to avoid the + * padding */ + float values[4]; +} CoglMatrixEntryRotateQuaternion; + +typedef struct _CoglMatrixEntryScale +{ + CoglMatrixEntry _parent_data; + + float x; + float y; + float z; + +} CoglMatrixEntryScale; + +typedef struct _CoglMatrixEntryMultiply +{ + CoglMatrixEntry _parent_data; + + CoglMatrix *matrix; + +} CoglMatrixEntryMultiply; + +typedef struct _CoglMatrixEntryLoad +{ + CoglMatrixEntry _parent_data; + + CoglMatrix *matrix; + +} CoglMatrixEntryLoad; + +typedef struct _CoglMatrixEntrySave +{ + CoglMatrixEntry _parent_data; + + CoglMatrix *cache; + CoglBool cache_valid; + +} CoglMatrixEntrySave; + +typedef union _CoglMatrixEntryFull +{ + CoglMatrixEntry any; + CoglMatrixEntryTranslate translate; + CoglMatrixEntryRotate rotate; + CoglMatrixEntryRotateEuler rotate_euler; + CoglMatrixEntryRotateQuaternion rotate_quaternion; + CoglMatrixEntryScale scale; + CoglMatrixEntryMultiply multiply; + CoglMatrixEntryLoad load; + CoglMatrixEntrySave save; +} CoglMatrixEntryFull; + +struct _CoglMatrixStack +{ + CoglObject _parent; + + CoglContext *context; + + CoglMatrixEntry *last_entry; +}; + +typedef struct _CoglMatrixEntryCache +{ + CoglMatrixEntry *entry; + CoglBool flushed_identity; + CoglBool flipped; +} CoglMatrixEntryCache; + +void +_cogl_matrix_entry_identity_init (CoglMatrixEntry *entry); + +typedef enum { + COGL_MATRIX_MODELVIEW, + COGL_MATRIX_PROJECTION, + COGL_MATRIX_TEXTURE +} CoglMatrixMode; + +void +_cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx, + CoglMatrixEntry *entry, + CoglMatrixMode mode, + CoglFramebuffer *framebuffer, + CoglBool disable_flip); + +void +_cogl_matrix_entry_cache_init (CoglMatrixEntryCache *cache); + +CoglBool +_cogl_matrix_entry_cache_maybe_update (CoglMatrixEntryCache *cache, + CoglMatrixEntry *entry, + CoglBool flip); + +void +_cogl_matrix_entry_cache_destroy (CoglMatrixEntryCache *cache); + +#endif /* _COGL_MATRIX_STACK_PRIVATE_H_ */ diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c new file mode 100644 index 0000000..400855f --- /dev/null +++ b/cogl/cogl-matrix-stack.c @@ -0,0 +1,1211 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Havoc Pennington for litl + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-matrix-stack.h" +#include "cogl-framebuffer-private.h" +#include "cogl-object-private.h" +#include "cogl-offscreen.h" +#include "cogl-matrix-private.h" +#include "cogl-magazine-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_matrix_stack_free (CoglMatrixStack *stack); + +COGL_OBJECT_DEFINE (MatrixStack, matrix_stack); +COGL_GTYPE_DEFINE_CLASS (MatrixStack, matrix_stack); +COGL_GTYPE_DEFINE_BOXED (MatrixEntry, matrix_entry, + cogl_matrix_entry_ref, + cogl_matrix_entry_unref); + +static CoglMagazine *cogl_matrix_stack_magazine; +static CoglMagazine *cogl_matrix_stack_matrices_magazine; + +/* XXX: Note: this leaves entry->parent uninitialized! */ +static CoglMatrixEntry * +_cogl_matrix_entry_new (CoglMatrixOp operation) +{ + CoglMatrixEntry *entry = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_magazine); + + entry->ref_count = 1; + entry->op = operation; + +#ifdef COGL_DEBUG_ENABLED + entry->composite_gets = 0; +#endif + + return entry; +} + +static void * +_cogl_matrix_stack_push_entry (CoglMatrixStack *stack, + CoglMatrixEntry *entry) +{ + /* NB: The initial reference of the entry is transferred to the + * stack here. + * + * The stack only maintains a reference to the top of the stack (the + * last entry pushed) and each entry in-turn maintains a reference + * to its parent. + * + * We don't need to take a reference to the parent from the entry + * here because the we are stealing the reference that was held by + * the stack while that parent was previously the top of the stack. + */ + entry->parent = stack->last_entry; + stack->last_entry = entry; + + return entry; +} + +static void * +_cogl_matrix_stack_push_operation (CoglMatrixStack *stack, + CoglMatrixOp operation) +{ + CoglMatrixEntry *entry = _cogl_matrix_entry_new (operation); + + _cogl_matrix_stack_push_entry (stack, entry); + + return entry; +} + +static void * +_cogl_matrix_stack_push_replacement_entry (CoglMatrixStack *stack, + CoglMatrixOp operation) +{ + CoglMatrixEntry *old_top = stack->last_entry; + CoglMatrixEntry *new_top; + + /* This would only be called for operations that completely replace + * the matrix. In that case we don't need to keep a reference to + * anything up to the last save entry. This optimisation could be + * important for applications that aren't using the stack but + * instead just perform their own matrix manipulations and load a + * new stack every frame. If this optimisation isn't done then the + * stack would just grow endlessly. See the comments + * cogl_matrix_stack_pop for a description of how popping works. */ + for (new_top = old_top; + new_top->op != COGL_MATRIX_OP_SAVE && new_top->parent; + new_top = new_top->parent) + ; + + cogl_matrix_entry_ref (new_top); + cogl_matrix_entry_unref (old_top); + stack->last_entry = new_top; + + return _cogl_matrix_stack_push_operation (stack, operation); +} + +void +_cogl_matrix_entry_identity_init (CoglMatrixEntry *entry) +{ + entry->ref_count = 1; + entry->op = COGL_MATRIX_OP_LOAD_IDENTITY; + entry->parent = NULL; +#ifdef COGL_DEBUG_ENABLED + entry->composite_gets = 0; +#endif +} + +void +cogl_matrix_stack_load_identity (CoglMatrixStack *stack) +{ + _cogl_matrix_stack_push_replacement_entry (stack, + COGL_MATRIX_OP_LOAD_IDENTITY); +} + +void +cogl_matrix_stack_translate (CoglMatrixStack *stack, + float x, + float y, + float z) +{ + CoglMatrixEntryTranslate *entry; + + entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_TRANSLATE); + + entry->x = x; + entry->y = y; + entry->z = z; +} + +void +cogl_matrix_stack_rotate (CoglMatrixStack *stack, + float angle, + float x, + float y, + float z) +{ + CoglMatrixEntryRotate *entry; + + entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_ROTATE); + + entry->angle = angle; + entry->x = x; + entry->y = y; + entry->z = z; +} + +void +cogl_matrix_stack_rotate_quaternion (CoglMatrixStack *stack, + const CoglQuaternion *quaternion) +{ + CoglMatrixEntryRotateQuaternion *entry; + + entry = _cogl_matrix_stack_push_operation (stack, + COGL_MATRIX_OP_ROTATE_QUATERNION); + + entry->values[0] = quaternion->w; + entry->values[1] = quaternion->x; + entry->values[2] = quaternion->y; + entry->values[3] = quaternion->z; +} + +void +cogl_matrix_stack_rotate_euler (CoglMatrixStack *stack, + const CoglEuler *euler) +{ + CoglMatrixEntryRotateEuler *entry; + + entry = _cogl_matrix_stack_push_operation (stack, + COGL_MATRIX_OP_ROTATE_EULER); + + entry->heading = euler->heading; + entry->pitch = euler->pitch; + entry->roll = euler->roll; +} + +void +cogl_matrix_stack_scale (CoglMatrixStack *stack, + float x, + float y, + float z) +{ + CoglMatrixEntryScale *entry; + + entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_SCALE); + + entry->x = x; + entry->y = y; + entry->z = z; +} + +void +cogl_matrix_stack_multiply (CoglMatrixStack *stack, + const CoglMatrix *matrix) +{ + CoglMatrixEntryMultiply *entry; + + entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_MULTIPLY); + + entry->matrix = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_matrices_magazine); + + cogl_matrix_init_from_array (entry->matrix, (float *)matrix); +} + +void +cogl_matrix_stack_set (CoglMatrixStack *stack, + const CoglMatrix *matrix) +{ + CoglMatrixEntryLoad *entry; + + entry = + _cogl_matrix_stack_push_replacement_entry (stack, + COGL_MATRIX_OP_LOAD); + + entry->matrix = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_matrices_magazine); + + cogl_matrix_init_from_array (entry->matrix, (float *)matrix); +} + +void +cogl_matrix_stack_frustum (CoglMatrixStack *stack, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + CoglMatrixEntryLoad *entry; + + entry = + _cogl_matrix_stack_push_replacement_entry (stack, + COGL_MATRIX_OP_LOAD); + + entry->matrix = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_matrices_magazine); + + cogl_matrix_init_identity (entry->matrix); + cogl_matrix_frustum (entry->matrix, + left, right, bottom, top, + z_near, z_far); +} + +void +cogl_matrix_stack_perspective (CoglMatrixStack *stack, + float fov_y, + float aspect, + float z_near, + float z_far) +{ + CoglMatrixEntryLoad *entry; + + entry = + _cogl_matrix_stack_push_replacement_entry (stack, + COGL_MATRIX_OP_LOAD); + + entry->matrix = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_matrices_magazine); + + cogl_matrix_init_identity (entry->matrix); + cogl_matrix_perspective (entry->matrix, + fov_y, aspect, z_near, z_far); +} + +void +cogl_matrix_stack_orthographic (CoglMatrixStack *stack, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far) +{ + CoglMatrixEntryLoad *entry; + + entry = + _cogl_matrix_stack_push_replacement_entry (stack, + COGL_MATRIX_OP_LOAD); + + entry->matrix = + _cogl_magazine_chunk_alloc (cogl_matrix_stack_matrices_magazine); + + cogl_matrix_init_identity (entry->matrix); + cogl_matrix_orthographic (entry->matrix, + x_1, y_1, x_2, y_2, near, far); +} + +void +cogl_matrix_stack_push (CoglMatrixStack *stack) +{ + CoglMatrixEntrySave *entry; + + entry = _cogl_matrix_stack_push_operation (stack, COGL_MATRIX_OP_SAVE); + + entry->cache_valid = FALSE; +} + +CoglMatrixEntry * +cogl_matrix_entry_ref (CoglMatrixEntry *entry) +{ + /* A NULL pointer is considered a valid stack so we should accept + that as an argument */ + if (entry) + entry->ref_count++; + + return entry; +} + +void +cogl_matrix_entry_unref (CoglMatrixEntry *entry) +{ + CoglMatrixEntry *parent; + + for (; entry && --entry->ref_count <= 0; entry = parent) + { + parent = entry->parent; + + switch (entry->op) + { + case COGL_MATRIX_OP_LOAD_IDENTITY: + case COGL_MATRIX_OP_TRANSLATE: + case COGL_MATRIX_OP_ROTATE: + case COGL_MATRIX_OP_ROTATE_QUATERNION: + case COGL_MATRIX_OP_ROTATE_EULER: + case COGL_MATRIX_OP_SCALE: + break; + case COGL_MATRIX_OP_MULTIPLY: + { + CoglMatrixEntryMultiply *multiply = + (CoglMatrixEntryMultiply *)entry; + _cogl_magazine_chunk_free (cogl_matrix_stack_matrices_magazine, + multiply->matrix); + break; + } + case COGL_MATRIX_OP_LOAD: + { + CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry; + _cogl_magazine_chunk_free (cogl_matrix_stack_matrices_magazine, + load->matrix); + break; + } + case COGL_MATRIX_OP_SAVE: + { + CoglMatrixEntrySave *save = (CoglMatrixEntrySave *)entry; + if (save->cache_valid) + _cogl_magazine_chunk_free (cogl_matrix_stack_matrices_magazine, + save->cache); + break; + } + } + + _cogl_magazine_chunk_free (cogl_matrix_stack_magazine, entry); + } +} + +void +cogl_matrix_stack_pop (CoglMatrixStack *stack) +{ + CoglMatrixEntry *old_top; + CoglMatrixEntry *new_top; + + _COGL_RETURN_IF_FAIL (stack != NULL); + + old_top = stack->last_entry; + _COGL_RETURN_IF_FAIL (old_top != NULL); + + /* To pop we are moving the top of the stack to the old top's parent + * node. The stack always needs to have a reference to the top entry + * so we must take a reference to the new top. The stack would have + * previously had a reference to the old top so we need to decrease + * the ref count on that. We need to ref the new head first in case + * this stack was the only thing referencing the old top. In that + * case the call to cogl_matrix_entry_unref will unref the parent. + */ + + /* Find the last save operation and remove it */ + + /* XXX: it would be an error to pop to the very beginning of the + * stack so we don't need to check for NULL pointer dereferencing. */ + for (new_top = old_top; + new_top->op != COGL_MATRIX_OP_SAVE; + new_top = new_top->parent) + ; + + new_top = new_top->parent; + cogl_matrix_entry_ref (new_top); + + cogl_matrix_entry_unref (old_top); + + stack->last_entry = new_top; +} + +CoglBool +cogl_matrix_stack_get_inverse (CoglMatrixStack *stack, + CoglMatrix *inverse) +{ + CoglMatrix matrix; + CoglMatrix *internal = cogl_matrix_stack_get (stack, &matrix); + + if (internal) + return cogl_matrix_get_inverse (internal, inverse); + else + return cogl_matrix_get_inverse (&matrix, inverse); +} + +/* In addition to writing the stack matrix into the give @matrix + * argument this function *may* sometimes also return a pointer + * to a matrix too so if we are querying the inverse matrix we + * should query from the return matrix so that the result can + * be cached within the stack. */ +CoglMatrix * +cogl_matrix_entry_get (CoglMatrixEntry *entry, + CoglMatrix *matrix) +{ + int depth; + CoglMatrixEntry *current; + CoglMatrixEntry **children; + int i; + + for (depth = 0, current = entry; + current; + current = current->parent, depth++) + { + switch (current->op) + { + case COGL_MATRIX_OP_LOAD_IDENTITY: + cogl_matrix_init_identity (matrix); + goto initialized; + case COGL_MATRIX_OP_LOAD: + { + CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)current; + _cogl_matrix_init_from_matrix_without_inverse (matrix, + load->matrix); + goto initialized; + } + case COGL_MATRIX_OP_SAVE: + { + CoglMatrixEntrySave *save = (CoglMatrixEntrySave *)current; + if (!save->cache_valid) + { + CoglMagazine *matrices_magazine = + cogl_matrix_stack_matrices_magazine; + save->cache = _cogl_magazine_chunk_alloc (matrices_magazine); + cogl_matrix_entry_get (current->parent, save->cache); + save->cache_valid = TRUE; + } + _cogl_matrix_init_from_matrix_without_inverse (matrix, save->cache); + goto initialized; + } + default: + continue; + } + } + +initialized: + + if (depth == 0) + { + switch (entry->op) + { + case COGL_MATRIX_OP_LOAD_IDENTITY: + case COGL_MATRIX_OP_TRANSLATE: + case COGL_MATRIX_OP_ROTATE: + case COGL_MATRIX_OP_ROTATE_QUATERNION: + case COGL_MATRIX_OP_ROTATE_EULER: + case COGL_MATRIX_OP_SCALE: + case COGL_MATRIX_OP_MULTIPLY: + return NULL; + + case COGL_MATRIX_OP_LOAD: + { + CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry; + return load->matrix; + } + case COGL_MATRIX_OP_SAVE: + { + CoglMatrixEntrySave *save = (CoglMatrixEntrySave *)entry; + return save->cache; + } + } + g_warn_if_reached (); + return NULL; + } + +#ifdef COGL_ENABLE_DEBUG + if (!current) + { + g_warning ("Inconsistent matrix stack"); + return NULL; + } + + entry->composite_gets++; +#endif + + children = g_alloca (sizeof (CoglMatrixEntry) * depth); + + /* We need walk the list of entries from the init/load/save entry + * back towards the leaf node but the nodes don't link to their + * children so we need to re-walk them here to add to a separate + * array. */ + for (i = depth - 1, current = entry; + i >= 0 && current; + i--, current = current->parent) + { + children[i] = current; + } + +#ifdef COGL_ENABLE_DEBUG + if (COGL_DEBUG_ENABLED (COGL_DEBUG_PERFORMANCE) && + entry->composite_gets >= 2) + { + COGL_NOTE (PERFORMANCE, + "Re-composing a matrix stack entry multiple times"); + } +#endif + + for (i = 0; i < depth; i++) + { + switch (children[i]->op) + { + case COGL_MATRIX_OP_TRANSLATE: + { + CoglMatrixEntryTranslate *translate = + (CoglMatrixEntryTranslate *)children[i]; + cogl_matrix_translate (matrix, + translate->x, + translate->y, + translate->z); + continue; + } + case COGL_MATRIX_OP_ROTATE: + { + CoglMatrixEntryRotate *rotate= + (CoglMatrixEntryRotate *)children[i]; + cogl_matrix_rotate (matrix, + rotate->angle, + rotate->x, + rotate->y, + rotate->z); + continue; + } + case COGL_MATRIX_OP_ROTATE_EULER: + { + CoglMatrixEntryRotateEuler *rotate = + (CoglMatrixEntryRotateEuler *)children[i]; + CoglEuler euler; + cogl_euler_init (&euler, + rotate->heading, + rotate->pitch, + rotate->roll); + cogl_matrix_rotate_euler (matrix, + &euler); + continue; + } + case COGL_MATRIX_OP_ROTATE_QUATERNION: + { + CoglMatrixEntryRotateQuaternion *rotate = + (CoglMatrixEntryRotateQuaternion *)children[i]; + CoglQuaternion quaternion; + cogl_quaternion_init_from_array (&quaternion, rotate->values); + cogl_matrix_rotate_quaternion (matrix, &quaternion); + continue; + } + case COGL_MATRIX_OP_SCALE: + { + CoglMatrixEntryScale *scale = + (CoglMatrixEntryScale *)children[i]; + cogl_matrix_scale (matrix, + scale->x, + scale->y, + scale->z); + continue; + } + case COGL_MATRIX_OP_MULTIPLY: + { + CoglMatrixEntryMultiply *multiply = + (CoglMatrixEntryMultiply *)children[i]; + cogl_matrix_multiply (matrix, matrix, multiply->matrix); + continue; + } + + case COGL_MATRIX_OP_LOAD_IDENTITY: + case COGL_MATRIX_OP_LOAD: + case COGL_MATRIX_OP_SAVE: + g_warn_if_reached (); + continue; + } + } + + return NULL; +} + +CoglMatrixEntry * +cogl_matrix_stack_get_entry (CoglMatrixStack *stack) +{ + return stack->last_entry; +} + +/* In addition to writing the stack matrix into the give @matrix + * argument this function *may* sometimes also return a pointer + * to a matrix too so if we are querying the inverse matrix we + * should query from the return matrix so that the result can + * be cached within the stack. */ +CoglMatrix * +cogl_matrix_stack_get (CoglMatrixStack *stack, + CoglMatrix *matrix) +{ + return cogl_matrix_entry_get (stack->last_entry, matrix); +} + +static void +_cogl_matrix_stack_free (CoglMatrixStack *stack) +{ + cogl_matrix_entry_unref (stack->last_entry); + g_slice_free (CoglMatrixStack, stack); +} + +CoglMatrixStack * +cogl_matrix_stack_new (CoglContext *ctx) +{ + CoglMatrixStack *stack = g_slice_new (CoglMatrixStack); + + if (G_UNLIKELY (cogl_matrix_stack_magazine == NULL)) + { + cogl_matrix_stack_magazine = + _cogl_magazine_new (sizeof (CoglMatrixEntryFull), 20); + cogl_matrix_stack_matrices_magazine = + _cogl_magazine_new (sizeof (CoglMatrix), 20); + } + + stack->context = ctx; + stack->last_entry = NULL; + + cogl_matrix_entry_ref (&ctx->identity_entry); + _cogl_matrix_stack_push_entry (stack, &ctx->identity_entry); + + return _cogl_matrix_stack_object_new (stack); +} + +static CoglMatrixEntry * +_cogl_matrix_entry_skip_saves (CoglMatrixEntry *entry) +{ + /* We currently assume that every stack starts with an + * _OP_LOAD_IDENTITY so we don't need to worry about + * NULL pointer dereferencing here. */ + while (entry->op == COGL_MATRIX_OP_SAVE) + entry = entry->parent; + + return entry; +} + +CoglBool +cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0, + CoglMatrixEntry *entry1, + float *x, + float *y, + float *z) +{ + GSList *head0 = NULL; + GSList *head1 = NULL; + CoglMatrixEntry *node0; + CoglMatrixEntry *node1; + int len0 = 0; + int len1 = 0; + int count; + GSList *common_ancestor0; + GSList *common_ancestor1; + + /* Algorithm: + * + * 1) Ignoring _OP_SAVE entries walk the ancestors of each entry to + * the root node or any non-translation node, adding a pointer to + * each ancestor node to two linked lists. + * + * 2) Compare the lists to find the nodes where they start to + * differ marking the common_ancestor node for each list. + * + * 3) For the list corresponding to entry0, start iterating after + * the common ancestor applying the negative of all translations + * to x, y and z. + * + * 4) For the list corresponding to entry1, start iterating after + * the common ancestor applying the positive of all translations + * to x, y and z. + * + * If we come across any non-translation operations during 3) or 4) + * then bail out returning FALSE. + */ + + for (node0 = entry0; node0; node0 = node0->parent) + { + GSList *link; + + if (node0->op == COGL_MATRIX_OP_SAVE) + continue; + + link = alloca (sizeof (GSList)); + link->next = head0; + link->data = node0; + head0 = link; + len0++; + + if (node0->op != COGL_MATRIX_OP_TRANSLATE) + break; + } + for (node1 = entry1; node1; node1 = node1->parent) + { + GSList *link; + + if (node1->op == COGL_MATRIX_OP_SAVE) + continue; + + link = alloca (sizeof (GSList)); + link->next = head1; + link->data = node1; + head1 = link; + len1++; + + if (node1->op != COGL_MATRIX_OP_TRANSLATE) + break; + } + + if (head0->data != head1->data) + return FALSE; + + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + count = MIN (len0, len1) - 1; + while (count--) + { + if (head0->data != head1->data) + break; + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + } + + *x = 0; + *y = 0; + *z = 0; + + for (head0 = common_ancestor0->next; head0; head0 = head0->next) + { + CoglMatrixEntryTranslate *translate; + + node0 = head0->data; + + if (node0->op != COGL_MATRIX_OP_TRANSLATE) + return FALSE; + + translate = (CoglMatrixEntryTranslate *)node0; + + *x = *x - translate->x; + *y = *y - translate->y; + *z = *z - translate->z; + } + for (head1 = common_ancestor1->next; head1; head1 = head1->next) + { + CoglMatrixEntryTranslate *translate; + + node1 = head1->data; + + if (node1->op != COGL_MATRIX_OP_TRANSLATE) + return FALSE; + + translate = (CoglMatrixEntryTranslate *)node1; + + *x = *x + translate->x; + *y = *y + translate->y; + *z = *z + translate->z; + } + + return TRUE; +} + +CoglBool +cogl_matrix_entry_is_identity (CoglMatrixEntry *entry) +{ + return entry ? entry->op == COGL_MATRIX_OP_LOAD_IDENTITY : FALSE; +} + +static void +_cogl_matrix_flush_to_gl_builtin (CoglContext *ctx, + CoglBool is_identity, + CoglMatrix *matrix, + CoglMatrixMode mode) +{ + g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + if (ctx->flushed_matrix_mode != mode) + { + GLenum gl_mode = 0; + + switch (mode) + { + case COGL_MATRIX_MODELVIEW: + gl_mode = GL_MODELVIEW; + break; + + case COGL_MATRIX_PROJECTION: + gl_mode = GL_PROJECTION; + break; + + case COGL_MATRIX_TEXTURE: + gl_mode = GL_TEXTURE; + break; + } + + GE (ctx, glMatrixMode (gl_mode)); + ctx->flushed_matrix_mode = mode; + } + + if (is_identity) + GE (ctx, glLoadIdentity ()); + else + GE (ctx, glLoadMatrixf (cogl_matrix_get_array (matrix))); +#endif +} + +void +_cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx, + CoglMatrixEntry *entry, + CoglMatrixMode mode, + CoglFramebuffer *framebuffer, + CoglBool disable_flip) +{ + g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + CoglBool needs_flip; + CoglMatrixEntryCache *cache; + + if (mode == COGL_MATRIX_PROJECTION) + { + /* Because Cogl defines texture coordinates to have a top left + * origin and because offscreen framebuffers may be used for + * rendering to textures we always render upside down to + * offscreen buffers. Also for some backends we need to render + * onscreen buffers upside-down too. + */ + if (disable_flip) + needs_flip = FALSE; + else + needs_flip = cogl_is_offscreen (framebuffer); + + cache = &ctx->builtin_flushed_projection; + } + else + { + needs_flip = FALSE; + + if (mode == COGL_MATRIX_MODELVIEW) + cache = &ctx->builtin_flushed_modelview; + else + cache = NULL; + } + + /* We don't need to do anything if the state is the same */ + if (!cache || + _cogl_matrix_entry_cache_maybe_update (cache, entry, needs_flip)) + { + CoglBool is_identity; + CoglMatrix matrix; + + if (entry->op == COGL_MATRIX_OP_LOAD_IDENTITY) + is_identity = TRUE; + else + { + is_identity = FALSE; + cogl_matrix_entry_get (entry, &matrix); + } + + if (needs_flip) + { + CoglMatrix flipped_matrix; + + cogl_matrix_multiply (&flipped_matrix, + &ctx->y_flip_matrix, + is_identity ? + &ctx->identity_matrix : + &matrix); + + _cogl_matrix_flush_to_gl_builtin (ctx, + /* not identity */ + FALSE, + &flipped_matrix, + mode); + } + else + { + _cogl_matrix_flush_to_gl_builtin (ctx, + is_identity, + &matrix, + mode); + } + } + } +#endif +} + +CoglBool +cogl_matrix_entry_equal (CoglMatrixEntry *entry0, + CoglMatrixEntry *entry1) +{ + for (; + entry0 && entry1; + entry0 = entry0->parent, entry1 = entry1->parent) + { + entry0 = _cogl_matrix_entry_skip_saves (entry0); + entry1 = _cogl_matrix_entry_skip_saves (entry1); + + if (entry0 == entry1) + return TRUE; + + if (entry0->op != entry1->op) + return FALSE; + + switch (entry0->op) + { + case COGL_MATRIX_OP_LOAD_IDENTITY: + return TRUE; + case COGL_MATRIX_OP_TRANSLATE: + { + CoglMatrixEntryTranslate *translate0 = + (CoglMatrixEntryTranslate *)entry0; + CoglMatrixEntryTranslate *translate1 = + (CoglMatrixEntryTranslate *)entry1; + /* We could perhaps use an epsilon to compare here? + * I expect the false negatives are probaly never going to + * be a problem and this is a bit cheaper. */ + if (translate0->x != translate1->x || + translate0->y != translate1->y || + translate0->z != translate1->z) + return FALSE; + } + break; + case COGL_MATRIX_OP_ROTATE: + { + CoglMatrixEntryRotate *rotate0 = + (CoglMatrixEntryRotate *)entry0; + CoglMatrixEntryRotate *rotate1 = + (CoglMatrixEntryRotate *)entry1; + if (rotate0->angle != rotate1->angle || + rotate0->x != rotate1->x || + rotate0->y != rotate1->y || + rotate0->z != rotate1->z) + return FALSE; + } + break; + case COGL_MATRIX_OP_ROTATE_QUATERNION: + { + CoglMatrixEntryRotateQuaternion *rotate0 = + (CoglMatrixEntryRotateQuaternion *)entry0; + CoglMatrixEntryRotateQuaternion *rotate1 = + (CoglMatrixEntryRotateQuaternion *)entry1; + int i; + for (i = 0; i < 4; i++) + if (rotate0->values[i] != rotate1->values[i]) + return FALSE; + } + break; + case COGL_MATRIX_OP_ROTATE_EULER: + { + CoglMatrixEntryRotateEuler *rotate0 = + (CoglMatrixEntryRotateEuler *)entry0; + CoglMatrixEntryRotateEuler *rotate1 = + (CoglMatrixEntryRotateEuler *)entry1; + + if (rotate0->heading != rotate1->heading || + rotate0->pitch != rotate1->pitch || + rotate0->roll != rotate1->roll) + return FALSE; + } + break; + case COGL_MATRIX_OP_SCALE: + { + CoglMatrixEntryScale *scale0 = (CoglMatrixEntryScale *)entry0; + CoglMatrixEntryScale *scale1 = (CoglMatrixEntryScale *)entry1; + if (scale0->x != scale1->x || + scale0->y != scale1->y || + scale0->z != scale1->z) + return FALSE; + } + break; + case COGL_MATRIX_OP_MULTIPLY: + { + CoglMatrixEntryMultiply *mult0 = (CoglMatrixEntryMultiply *)entry0; + CoglMatrixEntryMultiply *mult1 = (CoglMatrixEntryMultiply *)entry1; + if (!cogl_matrix_equal (mult0->matrix, mult1->matrix)) + return FALSE; + } + break; + case COGL_MATRIX_OP_LOAD: + { + CoglMatrixEntryLoad *load0 = (CoglMatrixEntryLoad *)entry0; + CoglMatrixEntryLoad *load1 = (CoglMatrixEntryLoad *)entry1; + /* There's no need to check any further since an + * _OP_LOAD makes all the ancestors redundant as far as + * the final matrix value is concerned. */ + return cogl_matrix_equal (load0->matrix, load1->matrix); + } + case COGL_MATRIX_OP_SAVE: + /* We skip over saves above so we shouldn't see save entries */ + g_warn_if_reached (); + } + } + + return FALSE; +} + +void +cogl_debug_matrix_entry_print (CoglMatrixEntry *entry) +{ + int depth; + CoglMatrixEntry *e; + CoglMatrixEntry **children; + int i; + + for (depth = 0, e = entry; e; e = e->parent) + depth++; + + children = g_alloca (sizeof (CoglMatrixEntry) * depth); + + for (i = depth - 1, e = entry; + i >= 0 && e; + i--, e = e->parent) + { + children[i] = e; + } + + g_print ("MatrixEntry %p =\n", entry); + + for (i = 0; i < depth; i++) + { + entry = children[i]; + + switch (entry->op) + { + case COGL_MATRIX_OP_LOAD_IDENTITY: + g_print (" LOAD IDENTITY\n"); + continue; + case COGL_MATRIX_OP_TRANSLATE: + { + CoglMatrixEntryTranslate *translate = + (CoglMatrixEntryTranslate *)entry; + g_print (" TRANSLATE X=%f Y=%f Z=%f\n", + translate->x, + translate->y, + translate->z); + continue; + } + case COGL_MATRIX_OP_ROTATE: + { + CoglMatrixEntryRotate *rotate = + (CoglMatrixEntryRotate *)entry; + g_print (" ROTATE ANGLE=%f X=%f Y=%f Z=%f\n", + rotate->angle, + rotate->x, + rotate->y, + rotate->z); + continue; + } + case COGL_MATRIX_OP_ROTATE_QUATERNION: + { + CoglMatrixEntryRotateQuaternion *rotate = + (CoglMatrixEntryRotateQuaternion *)entry; + g_print (" ROTATE QUATERNION w=%f x=%f y=%f z=%f\n", + rotate->values[0], + rotate->values[1], + rotate->values[2], + rotate->values[3]); + continue; + } + case COGL_MATRIX_OP_ROTATE_EULER: + { + CoglMatrixEntryRotateEuler *rotate = + (CoglMatrixEntryRotateEuler *)entry; + g_print (" ROTATE EULER heading=%f pitch=%f roll=%f\n", + rotate->heading, + rotate->pitch, + rotate->roll); + continue; + } + case COGL_MATRIX_OP_SCALE: + { + CoglMatrixEntryScale *scale = (CoglMatrixEntryScale *)entry; + g_print (" SCALE X=%f Y=%f Z=%f\n", + scale->x, + scale->y, + scale->z); + continue; + } + case COGL_MATRIX_OP_MULTIPLY: + { + CoglMatrixEntryMultiply *mult = (CoglMatrixEntryMultiply *)entry; + g_print (" MULT:\n"); + _cogl_matrix_prefix_print (" ", mult->matrix); + continue; + } + case COGL_MATRIX_OP_LOAD: + { + CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry; + g_print (" LOAD:\n"); + _cogl_matrix_prefix_print (" ", load->matrix); + continue; + } + case COGL_MATRIX_OP_SAVE: + g_print (" SAVE\n"); + } + } +} + +void +_cogl_matrix_entry_cache_init (CoglMatrixEntryCache *cache) +{ + cache->entry = NULL; + cache->flushed_identity = FALSE; + cache->flipped = FALSE; +} + +/* NB: This function can report false negatives since it never does a + * deep comparison of the stack matrices. */ +CoglBool +_cogl_matrix_entry_cache_maybe_update (CoglMatrixEntryCache *cache, + CoglMatrixEntry *entry, + CoglBool flip) +{ + CoglBool is_identity; + CoglBool updated = FALSE; + + if (cache->flipped != flip) + { + cache->flipped = flip; + updated = TRUE; + } + + is_identity = (entry->op == COGL_MATRIX_OP_LOAD_IDENTITY); + if (cache->flushed_identity != is_identity) + { + cache->flushed_identity = is_identity; + updated = TRUE; + } + + if (cache->entry != entry) + { + cogl_matrix_entry_ref (entry); + if (cache->entry) + cogl_matrix_entry_unref (cache->entry); + cache->entry = entry; + + /* We want to make sure here that if the cache->entry and the + * given @entry are both identity matrices then even though they + * are different entries we don't want to consider this an + * update... + */ + updated |= !is_identity; + } + + return updated; +} + +void +_cogl_matrix_entry_cache_destroy (CoglMatrixEntryCache *cache) +{ + if (cache->entry) + cogl_matrix_entry_unref (cache->entry); +} diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h new file mode 100644 index 0000000..6ea323a --- /dev/null +++ b/cogl/cogl-matrix-stack.h @@ -0,0 +1,645 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Havoc Pennington for litl + * Robert Bragg + */ + +#ifndef _COGL_MATRIX_STACK_H_ +#define _COGL_MATRIX_STACK_H_ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#include "cogl-matrix.h" +#include "cogl-context.h" + + +/** + * SECTION:cogl-matrix-stack + * @short_description: Functions for efficiently tracking many + * related transformations + * + * Matrices can be used (for example) to describe the model-view + * transforms of objects, texture transforms, and projective + * transforms. + * + * The #CoglMatrix api provides a good way to manipulate individual + * matrices representing a single transformation but if you need to + * track many-many such transformations for many objects that are + * organized in a scenegraph for example then using a separate + * #CoglMatrix for each object may not be the most efficient way. + * + * A #CoglMatrixStack enables applications to track lots of + * transformations that are related to each other in some kind of + * hierarchy. In a scenegraph for example if you want to know how to + * transform a particular node then you usually have to walk up + * through the ancestors and accumulate their transforms before + * finally applying the transform of the node itself. In this model + * things are grouped together spatially according to their ancestry + * and all siblings with the same parent share the same initial + * transformation. The #CoglMatrixStack API is suited to tracking lots + * of transformations that fit this kind of model. + * + * Compared to using the #CoglMatrix api directly to track many + * related transforms, these can be some advantages to using a + * #CoglMatrixStack: + * + * Faster equality comparisons of transformations + * Efficient comparisons of the differences between arbitrary + * transformations + * Avoid redundant arithmetic related to common transforms + * + * Can be more space efficient (not always though) + * + * + * For reference (to give an idea of when a #CoglMatrixStack can + * provide a space saving) a #CoglMatrix can be expected to take 72 + * bytes whereas a single #CoglMatrixEntry in a #CoglMatrixStack is + * currently around 32 bytes on a 32bit CPU or 36 bytes on a 64bit + * CPU. An entry is needed for each individual operation applied to + * the stack (such as rotate, scale, translate) so if most of your + * leaf node transformations only need one or two simple operations + * relative to their parent then a matrix stack will likely take less + * space than having a #CoglMatrix for each node. + * + * Even without any space saving though the ability to perform fast + * comparisons and avoid redundant arithmetic (especially sine and + * cosine calculations for rotations) can make using a matrix stack + * worthwhile. + */ + +/** + * CoglMatrixStack: + * + * Tracks your current position within a hierarchy and lets you build + * up a graph of transformations as you traverse through a hierarchy + * such as a scenegraph. + * + * A #CoglMatrixStack always maintains a reference to a single + * transformation at any point in time, representing the + * transformation at the current position in the hierarchy. You can + * get a reference to the current transformation by calling + * cogl_matrix_stack_get_entry(). + * + * When a #CoglMatrixStack is first created with + * cogl_matrix_stack_new() then it is conceptually positioned at the + * root of your hierarchy and the current transformation simply + * represents an identity transformation. + * + * As you traverse your object hierarchy (your scenegraph) then you + * should call cogl_matrix_stack_push() whenever you move down one + * level and call cogl_matrix_stack_pop() whenever you move back up + * one level towards the root. + * + * At any time you can apply a set of operations, such as "rotate", + * "scale", "translate" on top of the current transformation of a + * #CoglMatrixStack using functions such as + * cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and + * cogl_matrix_stack_translate(). These operations will derive a new + * current transformation and will never affect a transformation + * that you have referenced using cogl_matrix_stack_get_entry(). + * + * Internally applying operations to a #CoglMatrixStack builds up a + * graph of #CoglMatrixEntry structures which each represent a single + * immutable transform. + */ +typedef struct _CoglMatrixStack CoglMatrixStack; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_matrix_stack_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_matrix_stack_get_gtype (void); +#endif + +/** + * CoglMatrixEntry: + * + * Represents a single immutable transformation that was retrieved + * from a #CoglMatrixStack using cogl_matrix_stack_get_entry(). + * + * Internally a #CoglMatrixEntry represents a single matrix + * operation (such as "rotate", "scale", "translate") which is applied + * to the transform of a single parent entry. + * + * Using the #CoglMatrixStack api effectively builds up a graph of + * these immutable #CoglMatrixEntry structures whereby operations + * that can be shared between multiple transformations will result + * in shared #CoglMatrixEntry nodes in the graph. + * + * When a #CoglMatrixStack is first created it references one + * #CoglMatrixEntry that represents a single "load identity" + * operation. This serves as the root entry and all operations + * that are then applied to the stack will extend the graph + * starting from this root "load identity" entry. + * + * Given the typical usage model for a #CoglMatrixStack and the way + * the entries are built up while traversing a scenegraph then in most + * cases where an application is interested in comparing two + * transformations for equality then it is enough to simply compare + * two #CoglMatrixEntry pointers directly. Technically this can lead + * to false negatives that could be identified with a deeper + * comparison but often these false negatives are unlikely and + * don't matter anyway so this enables extremely cheap comparisons. + * + * #CoglMatrixEntrys are reference counted using + * cogl_matrix_entry_ref() and cogl_matrix_entry_unref() not with + * cogl_object_ref() and cogl_object_unref(). + */ +typedef struct _CoglMatrixEntry CoglMatrixEntry; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_matrix_entry_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_matrix_entry_get_gtype (void); +#endif + + +/** + * cogl_matrix_stack_new: + * @ctx: A #CoglContext + * + * Allocates a new #CoglMatrixStack that can be used to build up + * transformations relating to objects in a scenegraph like hierarchy. + * (See the description of #CoglMatrixStack and #CoglMatrixEntry for + * more details of what a matrix stack is best suited for) + * + * When a #CoglMatrixStack is first allocated it is conceptually + * positioned at the root of your scenegraph hierarchy. As you + * traverse your scenegraph then you should call + * cogl_matrix_stack_push() whenever you move down a level and + * cogl_matrix_stack_pop() whenever you move back up a level towards + * the root. + * + * Once you have allocated a #CoglMatrixStack you can get a reference + * to the current transformation for the current position in the + * hierarchy by calling cogl_matrix_stack_get_entry(). + * + * Once you have allocated a #CoglMatrixStack you can apply operations + * such as rotate, scale and translate to modify the current transform + * for the current position in the hierarchy by calling + * cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and + * cogl_matrix_stack_translate(). + * + * Return value: (transfer full): A newly allocated #CoglMatrixStack + */ +CoglMatrixStack * +cogl_matrix_stack_new (CoglContext *ctx); + +/** + * cogl_matrix_stack_push: + * @stack: A #CoglMatrixStack + * + * Saves the current transform and starts a new transform that derives + * from the current transform. + * + * This is usually called while traversing a scenegraph whenever you + * traverse one level deeper. cogl_matrix_stack_pop() can then be + * called when going back up one layer to restore the previous + * transform of an ancestor. + */ +void +cogl_matrix_stack_push (CoglMatrixStack *stack); + +/** + * cogl_matrix_stack_pop: + * @stack: A #CoglMatrixStack + * + * Restores the previous transform that was last saved by calling + * cogl_matrix_stack_push(). + * + * This is usually called while traversing a scenegraph whenever you + * return up one level in the graph towards the root node. + */ +void +cogl_matrix_stack_pop (CoglMatrixStack *stack); + +/** + * cogl_matrix_stack_load_identity: + * @stack: A #CoglMatrixStack + * + * Resets the current matrix to the identity matrix. + */ +void +cogl_matrix_stack_load_identity (CoglMatrixStack *stack); + +/** + * cogl_matrix_stack_scale: + * @stack: A #CoglMatrixStack + * @x: Amount to scale along the x-axis + * @y: Amount to scale along the y-axis + * @z: Amount to scale along the z-axis + * + * Multiplies the current matrix by one that scales the x, y and z + * axes by the given values. + */ +void +cogl_matrix_stack_scale (CoglMatrixStack *stack, + float x, + float y, + float z); + +/** + * cogl_matrix_stack_translate: + * @stack: A #CoglMatrixStack + * @x: Distance to translate along the x-axis + * @y: Distance to translate along the y-axis + * @z: Distance to translate along the z-axis + * + * Multiplies the current matrix by one that translates along all + * three axes according to the given values. + */ +void +cogl_matrix_stack_translate (CoglMatrixStack *stack, + float x, + float y, + float z); + +/** + * cogl_matrix_stack_rotate: + * @stack: A #CoglMatrixStack + * @angle: Angle in degrees to rotate. + * @x: X-component of vertex to rotate around. + * @y: Y-component of vertex to rotate around. + * @z: Z-component of vertex to rotate around. + * + * Multiplies the current matrix by one that rotates the around the + * axis-vector specified by @x, @y and @z. The rotation follows the + * right-hand thumb rule so for example rotating by 10 degrees about + * the axis-vector (0, 0, 1) causes a small counter-clockwise + * rotation. + */ +void +cogl_matrix_stack_rotate (CoglMatrixStack *stack, + float angle, + float x, + float y, + float z); + +/** + * cogl_matrix_stack_rotate_quaternion: + * @stack: A #CoglMatrixStack + * @quaternion: A #CoglQuaternion + * + * Multiplies the current matrix by one that rotates according to the + * rotation described by @quaternion. + */ +void +cogl_matrix_stack_rotate_quaternion (CoglMatrixStack *stack, + const CoglQuaternion *quaternion); + +/** + * cogl_matrix_stack_rotate_euler: + * @stack: A #CoglMatrixStack + * @euler: A #CoglEuler + * + * Multiplies the current matrix by one that rotates according to the + * rotation described by @euler. + */ +void +cogl_matrix_stack_rotate_euler (CoglMatrixStack *stack, + const CoglEuler *euler); + +/** + * cogl_matrix_stack_multiply: + * @stack: A #CoglMatrixStack + * @matrix: the matrix to multiply with the current model-view + * + * Multiplies the current matrix by the given matrix. + */ +void +cogl_matrix_stack_multiply (CoglMatrixStack *stack, + const CoglMatrix *matrix); + +/** + * cogl_matrix_stack_frustum: + * @stack: A #CoglMatrixStack + * @left: X position of the left clipping plane where it + * intersects the near clipping plane + * @right: X position of the right clipping plane where it + * intersects the near clipping plane + * @bottom: Y position of the bottom clipping plane where it + * intersects the near clipping plane + * @top: Y position of the top clipping plane where it intersects + * the near clipping plane + * @z_near: The distance to the near clipping plane (Must be positive) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current matrix with a perspective matrix for a given + * viewing frustum defined by 4 side clip planes that all cross + * through the origin and 2 near and far clip planes. + */ +void +cogl_matrix_stack_frustum (CoglMatrixStack *stack, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far); + +/** + * cogl_matrix_stack_perspective: + * @stack: A #CoglMatrixStack + * @fov_y: Vertical field of view angle in degrees. + * @aspect: The (width over height) aspect ratio for display + * @z_near: The distance to the near clipping plane (Must be positive, + * and must not be 0) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current matrix with a perspective matrix based on the + * provided values. + * + * You should be careful not to have too great a @z_far / @z_near + * ratio since that will reduce the effectiveness of depth testing + * since there wont be enough precision to identify the depth of + * objects near to each other. + */ +void +cogl_matrix_stack_perspective (CoglMatrixStack *stack, + float fov_y, + float aspect, + float z_near, + float z_far); + +/** + * cogl_matrix_stack_orthographic: + * @stack: A #CoglMatrixStack + * @x_1: The x coordinate for the first vertical clipping plane + * @y_1: The y coordinate for the first horizontal clipping plane + * @x_2: The x coordinate for the second vertical clipping plane + * @y_2: The y coordinate for the second horizontal clipping plane + * @near: The distance to the near clipping + * plane (will be negative if the plane is + * behind the viewer) + * @far: The distance to the far clipping + * plane (will be negative if the plane is + * behind the viewer) + * + * Replaces the current matrix with an orthographic projection matrix. + */ +void +cogl_matrix_stack_orthographic (CoglMatrixStack *stack, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far); + +/** + * cogl_matrix_stack_get_inverse: + * @stack: A #CoglMatrixStack + * @inverse: (out): The destination for a 4x4 inverse transformation matrix + * + * Gets the inverse transform of the current matrix and uses it to + * initialize a new #CoglMatrix. + * + * Return value: %TRUE if the inverse was successfully calculated or %FALSE + * for degenerate transformations that can't be inverted (in this case the + * @inverse matrix will simply be initialized with the identity matrix) + */ +CoglBool +cogl_matrix_stack_get_inverse (CoglMatrixStack *stack, + CoglMatrix *inverse); + +/** + * cogl_matrix_stack_get_entry: + * @stack: A #CoglMatrixStack + * + * Gets a reference to the current transform represented by a + * #CoglMatrixEntry pointer. + * + * The transform represented by a #CoglMatrixEntry is + * immutable. + * + * #CoglMatrixEntrys are reference counted using + * cogl_matrix_entry_ref() and cogl_matrix_entry_unref() and you + * should call cogl_matrix_entry_unref() when you are finished with + * and entry you get via cogl_matrix_stack_get_entry(). + * + * Return value: (transfer none): A pointer to the #CoglMatrixEntry + * representing the current matrix stack transform. + */ +CoglMatrixEntry * +cogl_matrix_stack_get_entry (CoglMatrixStack *stack); + +/** + * cogl_matrix_stack_get: + * @stack: A #CoglMatrixStack + * @matrix: (out): The potential destination for the current matrix + * + * Resolves the current @stack transform into a #CoglMatrix by + * combining the operations that have been applied to build up the + * current transform. + * + * There are two possible ways that this function may return its + * result depending on whether the stack is able to directly point + * to an internal #CoglMatrix or whether the result needs to be + * composed of multiple operations. + * + * If an internal matrix contains the required result then this + * function will directly return a pointer to that matrix, otherwise + * if the function returns %NULL then @matrix will be initialized + * to match the current transform of @stack. + * + * @matrix will be left untouched if a direct pointer is + * returned. + * + * Return value: A direct pointer to the current transform or %NULL + * and in that case @matrix will be initialized with + * the value of the current transform. + */ +CoglMatrix * +cogl_matrix_stack_get (CoglMatrixStack *stack, + CoglMatrix *matrix); + +/** + * cogl_matrix_entry_get: + * @entry: A #CoglMatrixEntry + * @matrix: (out): The potential destination for the transform as + * a matrix + * + * Resolves the current @entry transform into a #CoglMatrix by + * combining the sequence of operations that have been applied to + * build up the current transform. + * + * There are two possible ways that this function may return its + * result depending on whether it's possible to directly point + * to an internal #CoglMatrix or whether the result needs to be + * composed of multiple operations. + * + * If an internal matrix contains the required result then this + * function will directly return a pointer to that matrix, otherwise + * if the function returns %NULL then @matrix will be initialized + * to match the transform of @entry. + * + * @matrix will be left untouched if a direct pointer is + * returned. + * + * Return value: A direct pointer to a #CoglMatrix transform or %NULL + * and in that case @matrix will be initialized with + * the effective transform represented by @entry. + */ +CoglMatrix * +cogl_matrix_entry_get (CoglMatrixEntry *entry, + CoglMatrix *matrix); + +/** + * cogl_matrix_stack_set: + * @stack: A #CoglMatrixStack + * @matrix: A #CoglMatrix replace the current matrix value with + * + * Replaces the current @stack matrix value with the value of @matrix. + * This effectively discards any other operations that were applied + * since the last time cogl_matrix_stack_push() was called or since + * the stack was initialized. + */ +void +cogl_matrix_stack_set (CoglMatrixStack *stack, + const CoglMatrix *matrix); + +/** + * cogl_is_matrix_stack: + * @object: a #CoglObject + * + * Determines if the given #CoglObject refers to a #CoglMatrixStack. + * + * Return value: %TRUE if @object is a #CoglMatrixStack, otherwise + * %FALSE. + */ +CoglBool +cogl_is_matrix_stack (void *object); + +/** + * cogl_matrix_entry_calculate_translation: + * @entry0: The first reference transform + * @entry1: A second reference transform + * @x: (out): The destination for the x-component of the translation + * @y: (out): The destination for the y-component of the translation + * @z: (out): The destination for the z-component of the translation + * + * Determines if the only difference between two transforms is a + * translation and if so returns what the @x, @y, and @z components of + * the translation are. + * + * If the difference between the two translations involves anything + * other than a translation then the function returns %FALSE. + * + * Return value: %TRUE if the only difference between the transform of + * @entry0 and the transform of @entry1 is a translation, + * otherwise %FALSE. + */ +CoglBool +cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0, + CoglMatrixEntry *entry1, + float *x, + float *y, + float *z); + +/** + * cogl_matrix_entry_is_identity: + * @entry: A #CoglMatrixEntry + * + * Determines whether @entry is known to represent an identity + * transform. + * + * If this returns %TRUE then the entry is definitely the identity + * matrix. If it returns %FALSE it may or may not be the identity + * matrix but no expensive comparison is performed to verify it. + * + * Return value: %TRUE if @entry is definitely an identity transform, + * otherwise %FALSE. + */ +CoglBool +cogl_matrix_entry_is_identity (CoglMatrixEntry *entry); + +/** + * cogl_matrix_entry_equal: + * @entry0: The first #CoglMatrixEntry to compare + * @entry1: A second #CoglMatrixEntry to compare + * + * Compares two arbitrary #CoglMatrixEntry transforms for equality + * returning %TRUE if they are equal or %FALSE otherwise. + * + * In many cases it is unnecessary to use this api and instead + * direct pointer comparisons of entries are good enough and much + * cheaper too. + * + * Return value: %TRUE if @entry0 represents the same transform as + * @entry1, otherwise %FALSE. + */ +CoglBool +cogl_matrix_entry_equal (CoglMatrixEntry *entry0, + CoglMatrixEntry *entry1); + +/** + * cogl_debug_matrix_entry_print: + * @entry: A #CoglMatrixEntry + * + * Allows visualizing the operations that build up the given @entry + * for debugging purposes by printing to stdout. + */ +void +cogl_debug_matrix_entry_print (CoglMatrixEntry *entry); + +/** + * cogl_matrix_entry_ref: + * @entry: A #CoglMatrixEntry + * + * Takes a reference on the given @entry to ensure the @entry stays + * alive and remains valid. When you are finished with the @entry then + * you should call cogl_matrix_entry_unref(). + * + * It is an error to pass an @entry pointer to cogl_object_ref() and + * cogl_object_unref() + */ +CoglMatrixEntry * +cogl_matrix_entry_ref (CoglMatrixEntry *entry); + +/** + * cogl_matrix_entry_unref: + * @entry: A #CoglMatrixEntry + * + * Releases a reference on @entry either taken by calling + * cogl_matrix_entry_unref() or to release the reference given when + * calling cogl_matrix_stack_get_entry(). + */ +void +cogl_matrix_entry_unref (CoglMatrixEntry *entry); + +#endif /* _COGL_MATRIX_STACK_H_ */ diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c new file mode 100644 index 0000000..fd0f6af --- /dev/null +++ b/cogl/cogl-matrix.c @@ -0,0 +1,2313 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ +/* + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Note: a lot of this code is based on code that was taken from Mesa. + * + * Changes compared to the original code from Mesa: + * + * - instead of allocating matrix->m and matrix->inv using malloc, our + * public CoglMatrix typedef is large enough to directly contain the + * matrix, its inverse, a type and a set of flags. + * - instead of having a _cogl_matrix_analyse which updates the type, + * flags and inverse, we have _cogl_matrix_update_inverse which + * essentially does the same thing (internally making use of + * _cogl_matrix_update_type_and_flags()) but with additional guards in + * place to bail out when the inverse matrix is still valid. + * - when initializing a matrix with the identity matrix we don't + * immediately initialize the inverse matrix; rather we just set the + * dirty flag for the inverse (since it's likely the user won't request + * the inverse of the identity matrix) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +COGL_GTYPE_DEFINE_BOXED (Matrix, matrix, + cogl_matrix_copy, + cogl_matrix_free); + +/* + * Symbolic names to some of the entries in the matrix + * + * These are handy for the viewport mapping, which is expressed as a matrix. + */ +#define MAT_SX 0 +#define MAT_SY 5 +#define MAT_SZ 10 +#define MAT_TX 12 +#define MAT_TY 13 +#define MAT_TZ 14 + +/* + * These identify different kinds of 4x4 transformation matrices and we use + * this information to find fast-paths when available. + */ +enum CoglMatrixType { + COGL_MATRIX_TYPE_GENERAL, /**< general 4x4 matrix */ + COGL_MATRIX_TYPE_IDENTITY, /**< identity matrix */ + COGL_MATRIX_TYPE_3D_NO_ROT, /**< orthogonal projection and others... */ + COGL_MATRIX_TYPE_PERSPECTIVE, /**< perspective projection matrix */ + COGL_MATRIX_TYPE_2D, /**< 2-D transformation */ + COGL_MATRIX_TYPE_2D_NO_ROT, /**< 2-D scale & translate only */ + COGL_MATRIX_TYPE_3D, /**< 3-D transformation */ + COGL_MATRIX_N_TYPES +} ; + +#define DEG2RAD (G_PI/180.0) + +/* Dot product of two 2-element vectors */ +#define DOT2(A,B) ( (A)[0]*(B)[0] + (A)[1]*(B)[1] ) + +/* Dot product of two 3-element vectors */ +#define DOT3(A,B) ( (A)[0]*(B)[0] + (A)[1]*(B)[1] + (A)[2]*(B)[2] ) + +#define CROSS3(N, U, V) \ +do { \ + (N)[0] = (U)[1]*(V)[2] - (U)[2]*(V)[1]; \ + (N)[1] = (U)[2]*(V)[0] - (U)[0]*(V)[2]; \ + (N)[2] = (U)[0]*(V)[1] - (U)[1]*(V)[0]; \ +} while (0) + +#define SUB_3V(DST, SRCA, SRCB) \ +do { \ + (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ + (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ + (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ +} while (0) + +#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]) + +/* + * \defgroup MatFlags MAT_FLAG_XXX-flags + * + * Bitmasks to indicate different kinds of 4x4 matrices in CoglMatrix::flags + */ +#define MAT_FLAG_IDENTITY 0 /*< is an identity matrix flag. + * (Not actually used - the identity + * matrix is identified by the absense + * of all other flags.) + */ +#define MAT_FLAG_GENERAL 0x1 /*< is a general matrix flag */ +#define MAT_FLAG_ROTATION 0x2 /*< is a rotation matrix flag */ +#define MAT_FLAG_TRANSLATION 0x4 /*< is a translation matrix flag */ +#define MAT_FLAG_UNIFORM_SCALE 0x8 /*< is an uniform scaling matrix flag */ +#define MAT_FLAG_GENERAL_SCALE 0x10 /*< is a general scaling matrix flag */ +#define MAT_FLAG_GENERAL_3D 0x20 /*< general 3D matrix flag */ +#define MAT_FLAG_PERSPECTIVE 0x40 /*< is a perspective proj matrix flag */ +#define MAT_FLAG_SINGULAR 0x80 /*< is a singular matrix flag */ +#define MAT_DIRTY_TYPE 0x100 /*< matrix type is dirty */ +#define MAT_DIRTY_FLAGS 0x200 /*< matrix flags are dirty */ +#define MAT_DIRTY_INVERSE 0x400 /*< matrix inverse is dirty */ + +/* angle preserving matrix flags mask */ +#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE) + +/* geometry related matrix flags mask */ +#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ + MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D | \ + MAT_FLAG_PERSPECTIVE | \ + MAT_FLAG_SINGULAR) + +/* length preserving matrix flags mask */ +#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION) + + +/* 3D (non-perspective) matrix flags mask */ +#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ + MAT_FLAG_TRANSLATION | \ + MAT_FLAG_UNIFORM_SCALE | \ + MAT_FLAG_GENERAL_SCALE | \ + MAT_FLAG_GENERAL_3D) + +/* dirty matrix flags mask */ +#define MAT_DIRTY_ALL (MAT_DIRTY_TYPE | \ + MAT_DIRTY_FLAGS | \ + MAT_DIRTY_INVERSE) + + +/* + * Test geometry related matrix flags. + * + * @mat a pointer to a CoglMatrix structure. + * @a flags mask. + * + * Returns: non-zero if all geometry related matrix flags are contained within + * the mask, or zero otherwise. + */ +#define TEST_MAT_FLAGS(mat, a) \ + ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) + + + +/* + * Names of the corresponding CoglMatrixType values. + */ +static const char *types[] = { + "COGL_MATRIX_TYPE_GENERAL", + "COGL_MATRIX_TYPE_IDENTITY", + "COGL_MATRIX_TYPE_3D_NO_ROT", + "COGL_MATRIX_TYPE_PERSPECTIVE", + "COGL_MATRIX_TYPE_2D", + "COGL_MATRIX_TYPE_2D_NO_ROT", + "COGL_MATRIX_TYPE_3D" +}; + + +/* + * Identity matrix. + */ +static float identity[16] = { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 +}; + + +#define A(row,col) a[(col<<2)+row] +#define B(row,col) b[(col<<2)+row] +#define R(row,col) result[(col<<2)+row] + +/* + * Perform a full 4x4 matrix multiplication. + * + * It's assumed that @result != @b. @product == @a is allowed. + * + * KW: 4*16 = 64 multiplications + */ +static void +matrix_multiply4x4 (float *result, const float *a, const float *b) +{ + int i; + for (i = 0; i < 4; i++) + { + const float ai0 = A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); + R(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); + R(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); + R(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); + R(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); + } +} + +/* + * Multiply two matrices known to occupy only the top three rows, such + * as typical model matrices, and orthogonal matrices. + * + * @a matrix. + * @b matrix. + * @product will receive the product of \p a and \p b. + */ +static void +matrix_multiply3x4 (float *result, const float *a, const float *b) +{ + int i; + for (i = 0; i < 3; i++) + { + const float ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3); + R(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); + R(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); + R(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); + R(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; + } + R(3,0) = 0; + R(3,1) = 0; + R(3,2) = 0; + R(3,3) = 1; +} + +#undef A +#undef B +#undef R + +/* + * Multiply a matrix by an array of floats with known properties. + * + * @mat pointer to a CoglMatrix structure containing the left multiplication + * matrix, and that will receive the product result. + * @m right multiplication matrix array. + * @flags flags of the matrix \p m. + * + * Joins both flags and marks the type and inverse as dirty. Calls + * matrix_multiply3x4() if both matrices are 3D, or matrix_multiply4x4() + * otherwise. + */ +static void +matrix_multiply_array_with_flags (CoglMatrix *result, + const float *array, + unsigned int flags) +{ + result->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS (result, MAT_FLAGS_3D)) + matrix_multiply3x4 ((float *)result, (float *)result, array); + else + matrix_multiply4x4 ((float *)result, (float *)result, array); +} + +/* Joins both flags and marks the type and inverse as dirty. Calls + * matrix_multiply3x4() if both matrices are 3D, or matrix_multiply4x4() + * otherwise. + */ +static void +_cogl_matrix_multiply (CoglMatrix *result, + const CoglMatrix *a, + const CoglMatrix *b) +{ + result->flags = (a->flags | + b->flags | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); + + if (TEST_MAT_FLAGS(result, MAT_FLAGS_3D)) + matrix_multiply3x4 ((float *)result, (float *)a, (float *)b); + else + matrix_multiply4x4 ((float *)result, (float *)a, (float *)b); +} + +void +cogl_matrix_multiply (CoglMatrix *result, + const CoglMatrix *a, + const CoglMatrix *b) +{ + _cogl_matrix_multiply (result, a, b); + _COGL_MATRIX_DEBUG_PRINT (result); +} + +#if 0 +/* Marks the matrix flags with general flag, and type and inverse dirty flags. + * Calls matrix_multiply4x4() for the multiplication. + */ +static void +_cogl_matrix_multiply_array (CoglMatrix *result, const float *array) +{ + result->flags |= (MAT_FLAG_GENERAL | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE | + MAT_DIRTY_FLAGS); + + matrix_multiply4x4 ((float *)result, (float *)result, (float *)array); +} +#endif + +/* + * Print a matrix array. + * + * Called by _cogl_matrix_print() to print a matrix or its inverse. + */ +static void +print_matrix_floats (const char *prefix, const float m[16]) +{ + int i; + for (i = 0;i < 4; i++) + g_print ("%s\t%f %f %f %f\n", prefix, m[i], m[4+i], m[8+i], m[12+i] ); +} + +void +_cogl_matrix_prefix_print (const char *prefix, const CoglMatrix *matrix) +{ + if (!(matrix->flags & MAT_DIRTY_TYPE)) + { + _COGL_RETURN_IF_FAIL (matrix->type < COGL_MATRIX_N_TYPES); + g_print ("%sMatrix type: %s, flags: %x\n", + prefix, types[matrix->type], (int)matrix->flags); + } + else + g_print ("%sMatrix type: DIRTY, flags: %x\n", + prefix, (int)matrix->flags); + + print_matrix_floats (prefix, (float *)matrix); + g_print ("%sInverse: \n", prefix); + if (!(matrix->flags & MAT_DIRTY_INVERSE)) + { + float prod[16]; + print_matrix_floats (prefix, matrix->inv); + matrix_multiply4x4 (prod, (float *)matrix, matrix->inv); + g_print ("%sMat * Inverse:\n", prefix); + print_matrix_floats (prefix, prod); + } + else + g_print ("%s - not available\n", prefix); +} + +/* + * Dumps the contents of a CoglMatrix structure. + */ +void +cogl_debug_matrix_print (const CoglMatrix *matrix) +{ + _cogl_matrix_prefix_print ("", matrix); +} + +/* + * References an element of 4x4 matrix. + * + * @m matrix array. + * @c column of the desired element. + * @r row of the desired element. + * + * Returns: value of the desired element. + * + * Calculate the linear storage index of the element and references it. + */ +#define MAT(m,r,c) (m)[(c)*4+(r)] + +/* + * Swaps the values of two floating pointer variables. + * + * Used by invert_matrix_general() to swap the row pointers. + */ +#define SWAP_ROWS(a, b) { float *_tmp = a; (a)=(b); (b)=_tmp; } + +/* + * Compute inverse of 4x4 transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * \author + * Code contributed by Jacques Leroy jle@star.be + * + * Calculates the inverse matrix by performing the gaussian matrix reduction + * with partial pivoting followed by back/substitution with the loops manually + * unrolled. + */ +static CoglBool +invert_matrix_general (CoglMatrix *matrix) +{ + const float *m = (float *)matrix; + float *out = matrix->inv; + float wtmp[4][8]; + float m0, m1, m2, m3, s; + float *r0, *r1, *r2, *r3; + + r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; + + r0[0] = MAT (m, 0, 0), r0[1] = MAT (m, 0, 1), + r0[2] = MAT (m, 0, 2), r0[3] = MAT (m, 0, 3), + r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, + + r1[0] = MAT (m, 1, 0), r1[1] = MAT (m, 1, 1), + r1[2] = MAT (m, 1, 2), r1[3] = MAT (m, 1, 3), + r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, + + r2[0] = MAT (m, 2, 0), r2[1] = MAT (m, 2, 1), + r2[2] = MAT (m, 2, 2), r2[3] = MAT (m, 2, 3), + r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, + + r3[0] = MAT (m, 3, 0), r3[1] = MAT (m, 3, 1), + r3[2] = MAT (m, 3, 2), r3[3] = MAT (m, 3, 3), + r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; + + /* choose pivot - or die */ + if (fabsf (r3[0]) > fabsf (r2[0])) + SWAP_ROWS (r3, r2); + if (fabsf (r2[0]) > fabsf (r1[0])) + SWAP_ROWS (r2, r1); + if (fabsf (r1[0]) > fabsf (r0[0])) + SWAP_ROWS (r1, r0); + if (0.0 == r0[0]) + return FALSE; + + /* eliminate first variable */ + m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; + s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; + s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; + s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; + s = r0[4]; + if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r0[5]; + if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r0[6]; + if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r0[7]; + if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (fabsf (r3[1]) > fabsf (r2[1])) + SWAP_ROWS (r3, r2); + if (fabsf (r2[1]) > fabsf (r1[1])) + SWAP_ROWS (r2, r1); + if (0.0 == r1[1]) + return FALSE; + + /* eliminate second variable */ + m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1]; + r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; + r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; + s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } + s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } + s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } + s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } + + /* choose pivot - or die */ + if (fabsf (r3[2]) > fabsf (r2[2])) + SWAP_ROWS (r3, r2); + if (0.0 == r2[2]) + return FALSE; + + /* eliminate third variable */ + m3 = r3[2] / r2[2]; + r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], + r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], + r3[7] -= m3 * r2[7]; + + /* last check */ + if (0.0 == r3[3]) + return FALSE; + + s = 1.0f / r3[3]; /* now back substitute row 3 */ + r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; + + m2 = r2[3]; /* now back substitute row 2 */ + s = 1.0f / r2[2]; + r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), + r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); + m1 = r1[3]; + r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, + r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; + m0 = r0[3]; + r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, + r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; + + m1 = r1[2]; /* now back substitute row 1 */ + s = 1.0f / r1[1]; + r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), + r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); + m0 = r0[2]; + r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, + r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; + + m0 = r0[1]; /* now back substitute row 0 */ + s = 1.0f / r0[0]; + r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), + r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); + + MAT (out, 0, 0) = r0[4]; MAT (out, 0, 1) = r0[5], + MAT (out, 0, 2) = r0[6]; MAT (out, 0, 3) = r0[7], + MAT (out, 1, 0) = r1[4]; MAT (out, 1, 1) = r1[5], + MAT (out, 1, 2) = r1[6]; MAT (out, 1, 3) = r1[7], + MAT (out, 2, 0) = r2[4]; MAT (out, 2, 1) = r2[5], + MAT (out, 2, 2) = r2[6]; MAT (out, 2, 3) = r2[7], + MAT (out, 3, 0) = r3[4]; MAT (out, 3, 1) = r3[5], + MAT (out, 3, 2) = r3[6]; MAT (out, 3, 3) = r3[7]; + + return TRUE; +} +#undef SWAP_ROWS + +/* + * Compute inverse of a general 3d transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * \author Adapted from graphics gems II. + * + * Calculates the inverse of the upper left by first calculating its + * determinant and multiplying it to the symmetric adjust matrix of each + * element. Finally deals with the translation part by transforming the + * original translation vector using by the calculated submatrix inverse. + */ +static CoglBool +invert_matrix_3d_general (CoglMatrix *matrix) +{ + const float *in = (float *)matrix; + float *out = matrix->inv; + float pos, neg, t; + float det; + + /* Calculate the determinant of upper left 3x3 submatrix and + * determine if the matrix is singular. + */ + pos = neg = 0.0; + t = MAT (in,0,0) * MAT (in,1,1) * MAT (in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT (in,1,0) * MAT (in,2,1) * MAT (in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = MAT (in,2,0) * MAT (in,0,1) * MAT (in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT (in,2,0) * MAT (in,1,1) * MAT (in,0,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT (in,1,0) * MAT (in,0,1) * MAT (in,2,2); + if (t >= 0.0) pos += t; else neg += t; + + t = -MAT (in,0,0) * MAT (in,2,1) * MAT (in,1,2); + if (t >= 0.0) pos += t; else neg += t; + + det = pos + neg; + + if (det*det < 1e-25) + return FALSE; + + det = 1.0f / det; + MAT (out,0,0) = + ( (MAT (in, 1, 1)*MAT (in, 2, 2) - MAT (in, 2, 1)*MAT (in, 1, 2) )*det); + MAT (out,0,1) = + (- (MAT (in, 0, 1)*MAT (in, 2, 2) - MAT (in, 2, 1)*MAT (in, 0, 2) )*det); + MAT (out,0,2) = + ( (MAT (in, 0, 1)*MAT (in, 1, 2) - MAT (in, 1, 1)*MAT (in, 0, 2) )*det); + MAT (out,1,0) = + (- (MAT (in,1,0)*MAT (in,2,2) - MAT (in,2,0)*MAT (in,1,2) )*det); + MAT (out,1,1) = + ( (MAT (in,0,0)*MAT (in,2,2) - MAT (in,2,0)*MAT (in,0,2) )*det); + MAT (out,1,2) = + (- (MAT (in,0,0)*MAT (in,1,2) - MAT (in,1,0)*MAT (in,0,2) )*det); + MAT (out,2,0) = + ( (MAT (in,1,0)*MAT (in,2,1) - MAT (in,2,0)*MAT (in,1,1) )*det); + MAT (out,2,1) = + (- (MAT (in,0,0)*MAT (in,2,1) - MAT (in,2,0)*MAT (in,0,1) )*det); + MAT (out,2,2) = + ( (MAT (in,0,0)*MAT (in,1,1) - MAT (in,1,0)*MAT (in,0,1) )*det); + + /* Do the translation part */ + MAT (out,0,3) = - (MAT (in, 0, 3) * MAT (out, 0, 0) + + MAT (in, 1, 3) * MAT (out, 0, 1) + + MAT (in, 2, 3) * MAT (out, 0, 2) ); + MAT (out,1,3) = - (MAT (in, 0, 3) * MAT (out, 1, 0) + + MAT (in, 1, 3) * MAT (out, 1, 1) + + MAT (in, 2, 3) * MAT (out, 1, 2) ); + MAT (out,2,3) = - (MAT (in, 0, 3) * MAT (out, 2 ,0) + + MAT (in, 1, 3) * MAT (out, 2, 1) + + MAT (in, 2, 3) * MAT (out, 2, 2) ); + + return TRUE; +} + +/* + * Compute inverse of a 3d transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * If the matrix is not an angle preserving matrix then calls + * invert_matrix_3d_general for the actual calculation. Otherwise calculates + * the inverse matrix analyzing and inverting each of the scaling, rotation and + * translation parts. + */ +static CoglBool +invert_matrix_3d (CoglMatrix *matrix) +{ + const float *in = (float *)matrix; + float *out = matrix->inv; + + memcpy (out, identity, 16 * sizeof (float)); + + if (!TEST_MAT_FLAGS(matrix, MAT_FLAGS_ANGLE_PRESERVING)) + return invert_matrix_3d_general (matrix); + + if (matrix->flags & MAT_FLAG_UNIFORM_SCALE) + { + float scale = (MAT (in, 0, 0) * MAT (in, 0, 0) + + MAT (in, 0, 1) * MAT (in, 0, 1) + + MAT (in, 0, 2) * MAT (in, 0, 2)); + + if (scale == 0.0) + return FALSE; + + scale = 1.0f / scale; + + /* Transpose and scale the 3 by 3 upper-left submatrix. */ + MAT (out, 0, 0) = scale * MAT (in, 0, 0); + MAT (out, 1, 0) = scale * MAT (in, 0, 1); + MAT (out, 2, 0) = scale * MAT (in, 0, 2); + MAT (out, 0, 1) = scale * MAT (in, 1, 0); + MAT (out, 1, 1) = scale * MAT (in, 1, 1); + MAT (out, 2, 1) = scale * MAT (in, 1, 2); + MAT (out, 0, 2) = scale * MAT (in, 2, 0); + MAT (out, 1, 2) = scale * MAT (in, 2, 1); + MAT (out, 2, 2) = scale * MAT (in, 2, 2); + } + else if (matrix->flags & MAT_FLAG_ROTATION) + { + /* Transpose the 3 by 3 upper-left submatrix. */ + MAT (out, 0, 0) = MAT (in, 0, 0); + MAT (out, 1, 0) = MAT (in, 0, 1); + MAT (out, 2, 0) = MAT (in, 0, 2); + MAT (out, 0, 1) = MAT (in, 1, 0); + MAT (out, 1, 1) = MAT (in, 1, 1); + MAT (out, 2, 1) = MAT (in, 1, 2); + MAT (out, 0, 2) = MAT (in, 2, 0); + MAT (out, 1, 2) = MAT (in, 2, 1); + MAT (out, 2, 2) = MAT (in, 2, 2); + } + else + { + /* pure translation */ + memcpy (out, identity, 16 * sizeof (float)); + MAT (out, 0, 3) = - MAT (in, 0, 3); + MAT (out, 1, 3) = - MAT (in, 1, 3); + MAT (out, 2, 3) = - MAT (in, 2, 3); + return TRUE; + } + + if (matrix->flags & MAT_FLAG_TRANSLATION) + { + /* Do the translation part */ + MAT (out,0,3) = - (MAT (in, 0, 3) * MAT (out, 0, 0) + + MAT (in, 1, 3) * MAT (out, 0, 1) + + MAT (in, 2, 3) * MAT (out, 0, 2) ); + MAT (out,1,3) = - (MAT (in, 0, 3) * MAT (out, 1, 0) + + MAT (in, 1, 3) * MAT (out, 1, 1) + + MAT (in, 2, 3) * MAT (out, 1, 2) ); + MAT (out,2,3) = - (MAT (in, 0, 3) * MAT (out, 2, 0) + + MAT (in, 1, 3) * MAT (out, 2, 1) + + MAT (in, 2, 3) * MAT (out, 2, 2) ); + } + else + MAT (out, 0, 3) = MAT (out, 1, 3) = MAT (out, 2, 3) = 0.0; + + return TRUE; +} + +/* + * Compute inverse of an identity transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: always %TRUE. + * + * Simply copies identity into CoglMatrix::inv. + */ +static CoglBool +invert_matrix_identity (CoglMatrix *matrix) +{ + memcpy (matrix->inv, identity, 16 * sizeof (float)); + return TRUE; +} + +/* + * Compute inverse of a no-rotation 3d transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * Calculates the + */ +static CoglBool +invert_matrix_3d_no_rotation (CoglMatrix *matrix) +{ + const float *in = (float *)matrix; + float *out = matrix->inv; + + if (MAT (in,0,0) == 0 || MAT (in,1,1) == 0 || MAT (in,2,2) == 0) + return FALSE; + + memcpy (out, identity, 16 * sizeof (float)); + MAT (out,0,0) = 1.0f / MAT (in,0,0); + MAT (out,1,1) = 1.0f / MAT (in,1,1); + MAT (out,2,2) = 1.0f / MAT (in,2,2); + + if (matrix->flags & MAT_FLAG_TRANSLATION) + { + MAT (out,0,3) = - (MAT (in,0,3) * MAT (out,0,0)); + MAT (out,1,3) = - (MAT (in,1,3) * MAT (out,1,1)); + MAT (out,2,3) = - (MAT (in,2,3) * MAT (out,2,2)); + } + + return TRUE; +} + +/* + * Compute inverse of a no-rotation 2d transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * Calculates the inverse matrix by applying the inverse scaling and + * translation to the identity matrix. + */ +static CoglBool +invert_matrix_2d_no_rotation (CoglMatrix *matrix) +{ + const float *in = (float *)matrix; + float *out = matrix->inv; + + if (MAT (in, 0, 0) == 0 || MAT (in, 1, 1) == 0) + return FALSE; + + memcpy (out, identity, 16 * sizeof (float)); + MAT (out, 0, 0) = 1.0f / MAT (in, 0, 0); + MAT (out, 1, 1) = 1.0f / MAT (in, 1, 1); + + if (matrix->flags & MAT_FLAG_TRANSLATION) + { + MAT (out, 0, 3) = - (MAT (in, 0, 3) * MAT (out, 0, 0)); + MAT (out, 1, 3) = - (MAT (in, 1, 3) * MAT (out, 1, 1)); + } + + return TRUE; +} + +#if 0 +/* broken */ +static CoglBool +invert_matrix_perspective (CoglMatrix *matrix) +{ + const float *in = matrix; + float *out = matrix->inv; + + if (MAT (in,2,3) == 0) + return FALSE; + + memcpy( out, identity, 16 * sizeof(float) ); + + MAT (out, 0, 0) = 1.0f / MAT (in, 0, 0); + MAT (out, 1, 1) = 1.0f / MAT (in, 1, 1); + + MAT (out, 0, 3) = MAT (in, 0, 2); + MAT (out, 1, 3) = MAT (in, 1, 2); + + MAT (out,2,2) = 0; + MAT (out,2,3) = -1; + + MAT (out,3,2) = 1.0f / MAT (in,2,3); + MAT (out,3,3) = MAT (in,2,2) * MAT (out,3,2); + + return TRUE; +} +#endif + +/* + * Matrix inversion function pointer type. + */ +typedef CoglBool (*inv_mat_func)(CoglMatrix *matrix); + +/* + * Table of the matrix inversion functions according to the matrix type. + */ +static inv_mat_func inv_mat_tab[7] = { + invert_matrix_general, + invert_matrix_identity, + invert_matrix_3d_no_rotation, +#if 0 + /* Don't use this function for now - it fails when the projection matrix + * is premultiplied by a translation (ala Chromium's tilesort SPU). + */ + invert_matrix_perspective, +#else + invert_matrix_general, +#endif + invert_matrix_3d, /* lazy! */ + invert_matrix_2d_no_rotation, + invert_matrix_3d +}; + +#define ZERO(x) (1<flags &= ~MAT_FLAGS_GEOMETRY; + + /* Check for translation - no-one really cares + */ + if ((mask & MASK_NO_TRX) != MASK_NO_TRX) + matrix->flags |= MAT_FLAG_TRANSLATION; + + /* Do the real work + */ + if (mask == (unsigned int) MASK_IDENTITY) + matrix->type = COGL_MATRIX_TYPE_IDENTITY; + else if ((mask & MASK_2D_NO_ROT) == (unsigned int) MASK_2D_NO_ROT) + { + matrix->type = COGL_MATRIX_TYPE_2D_NO_ROT; + + if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) + matrix->flags |= MAT_FLAG_GENERAL_SCALE; + } + else if ((mask & MASK_2D) == (unsigned int) MASK_2D) + { + float mm = DOT2 (m, m); + float m4m4 = DOT2 (m+4,m+4); + float mm4 = DOT2 (m,m+4); + + matrix->type = COGL_MATRIX_TYPE_2D; + + /* Check for scale */ + if (SQ (mm-1) > SQ (1e-6) || + SQ (m4m4-1) > SQ (1e-6)) + matrix->flags |= MAT_FLAG_GENERAL_SCALE; + + /* Check for rotation */ + if (SQ (mm4) > SQ (1e-6)) + matrix->flags |= MAT_FLAG_GENERAL_3D; + else + matrix->flags |= MAT_FLAG_ROTATION; + + } + else if ((mask & MASK_3D_NO_ROT) == (unsigned int) MASK_3D_NO_ROT) + { + matrix->type = COGL_MATRIX_TYPE_3D_NO_ROT; + + /* Check for scale */ + if (SQ (m[0]-m[5]) < SQ (1e-6) && + SQ (m[0]-m[10]) < SQ (1e-6)) + { + if (SQ (m[0]-1.0) > SQ (1e-6)) + matrix->flags |= MAT_FLAG_UNIFORM_SCALE; + } + else + matrix->flags |= MAT_FLAG_GENERAL_SCALE; + } + else if ((mask & MASK_3D) == (unsigned int) MASK_3D) + { + float c1 = DOT3 (m,m); + float c2 = DOT3 (m+4,m+4); + float c3 = DOT3 (m+8,m+8); + float d1 = DOT3 (m, m+4); + float cp[3]; + + matrix->type = COGL_MATRIX_TYPE_3D; + + /* Check for scale */ + if (SQ (c1-c2) < SQ (1e-6) && SQ (c1-c3) < SQ (1e-6)) + { + if (SQ (c1-1.0) > SQ (1e-6)) + matrix->flags |= MAT_FLAG_UNIFORM_SCALE; + /* else no scale at all */ + } + else + matrix->flags |= MAT_FLAG_GENERAL_SCALE; + + /* Check for rotation */ + if (SQ (d1) < SQ (1e-6)) + { + CROSS3 ( cp, m, m+4); + SUB_3V ( cp, cp, (m+8)); + if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) + matrix->flags |= MAT_FLAG_ROTATION; + else + matrix->flags |= MAT_FLAG_GENERAL_3D; + } + else + matrix->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ + } + else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0f) + { + matrix->type = COGL_MATRIX_TYPE_PERSPECTIVE; + matrix->flags |= MAT_FLAG_GENERAL; + } + else + { + matrix->type = COGL_MATRIX_TYPE_GENERAL; + matrix->flags |= MAT_FLAG_GENERAL; + } +} + +/* + * Analyze a matrix given that its flags are accurate. + * + * This is the more common operation, hopefully. + */ +static void +analyse_from_flags (CoglMatrix *matrix) +{ + const float *m = (float *)matrix; + + if (TEST_MAT_FLAGS(matrix, 0)) + matrix->type = COGL_MATRIX_TYPE_IDENTITY; + else if (TEST_MAT_FLAGS(matrix, (MAT_FLAG_TRANSLATION | + MAT_FLAG_UNIFORM_SCALE | + MAT_FLAG_GENERAL_SCALE))) + { + if ( m[10] == 1.0f && m[14] == 0.0f ) + matrix->type = COGL_MATRIX_TYPE_2D_NO_ROT; + else + matrix->type = COGL_MATRIX_TYPE_3D_NO_ROT; + } + else if (TEST_MAT_FLAGS (matrix, MAT_FLAGS_3D)) + { + if ( m[ 8]==0.0f + && m[ 9]==0.0f + && m[2]==0.0f && m[6]==0.0f && m[10]==1.0f && m[14]==0.0f) + { + matrix->type = COGL_MATRIX_TYPE_2D; + } + else + matrix->type = COGL_MATRIX_TYPE_3D; + } + else if ( m[4]==0.0f && m[12]==0.0f + && m[1]==0.0f && m[13]==0.0f + && m[2]==0.0f && m[6]==0.0f + && m[3]==0.0f && m[7]==0.0f && m[11]==-1.0f && m[15]==0.0f) + { + matrix->type = COGL_MATRIX_TYPE_PERSPECTIVE; + } + else + matrix->type = COGL_MATRIX_TYPE_GENERAL; +} + +/* + * Analyze and update the type and flags of a matrix. + * + * If the matrix type is dirty then calls either analyse_from_scratch() or + * analyse_from_flags() to determine its type, according to whether the flags + * are dirty or not, respectively. If the matrix has an inverse and it's dirty + * then calls matrix_invert(). Finally clears the dirty flags. + */ +static void +_cogl_matrix_update_type_and_flags (CoglMatrix *matrix) +{ + if (matrix->flags & MAT_DIRTY_TYPE) + { + if (matrix->flags & MAT_DIRTY_FLAGS) + analyse_from_scratch (matrix); + else + analyse_from_flags (matrix); + } + + matrix->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE); +} + +/* + * Compute inverse of a transformation matrix. + * + * @mat pointer to a CoglMatrix structure. The matrix inverse will be + * stored in the CoglMatrix::inv attribute. + * + * Returns: %TRUE for success, %FALSE for failure (\p singular matrix). + * + * Calls the matrix inversion function in inv_mat_tab corresponding to the + * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag, + * and copies the identity matrix into CoglMatrix::inv. + */ +static CoglBool +_cogl_matrix_update_inverse (CoglMatrix *matrix) +{ + if (matrix->flags & MAT_DIRTY_FLAGS || + matrix->flags & MAT_DIRTY_INVERSE) + { + _cogl_matrix_update_type_and_flags (matrix); + + if (inv_mat_tab[matrix->type](matrix)) + matrix->flags &= ~MAT_FLAG_SINGULAR; + else + { + matrix->flags |= MAT_FLAG_SINGULAR; + memcpy (matrix->inv, identity, 16 * sizeof (float)); + } + + matrix->flags &= ~MAT_DIRTY_INVERSE; + } + + if (matrix->flags & MAT_FLAG_SINGULAR) + return FALSE; + else + return TRUE; +} + +CoglBool +cogl_matrix_get_inverse (const CoglMatrix *matrix, CoglMatrix *inverse) +{ + if (_cogl_matrix_update_inverse ((CoglMatrix *)matrix)) + { + cogl_matrix_init_from_array (inverse, matrix->inv); + return TRUE; + } + else + { + cogl_matrix_init_identity (inverse); + return FALSE; + } +} + +/* + * Generate a 4x4 transformation matrix from glRotate parameters, and + * post-multiply the input matrix by it. + * + * \author + * This function was contributed by Erich Boleyn (erich@uruk.org). + * Optimizations contributed by Rudolf Opalla (rudi@khm.de). + */ +static void +_cogl_matrix_rotate (CoglMatrix *matrix, + float angle, + float x, + float y, + float z) +{ + float xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; + float m[16]; + CoglBool optimized; + + s = sinf (angle * DEG2RAD); + c = cosf (angle * DEG2RAD); + + memcpy (m, identity, 16 * sizeof (float)); + optimized = FALSE; + +#define M(row,col) m[col*4+row] + + if (x == 0.0f) + { + if (y == 0.0f) + { + if (z != 0.0f) + { + optimized = TRUE; + /* rotate only around z-axis */ + M (0,0) = c; + M (1,1) = c; + if (z < 0.0f) + { + M (0,1) = s; + M (1,0) = -s; + } + else + { + M (0,1) = -s; + M (1,0) = s; + } + } + } + else if (z == 0.0f) + { + optimized = TRUE; + /* rotate only around y-axis */ + M (0,0) = c; + M (2,2) = c; + if (y < 0.0f) + { + M (0,2) = -s; + M (2,0) = s; + } + else + { + M (0,2) = s; + M (2,0) = -s; + } + } + } + else if (y == 0.0f) + { + if (z == 0.0f) + { + optimized = TRUE; + /* rotate only around x-axis */ + M (1,1) = c; + M (2,2) = c; + if (x < 0.0f) + { + M (1,2) = s; + M (2,1) = -s; + } + else + { + M (1,2) = -s; + M (2,1) = s; + } + } + } + + if (!optimized) + { + const float mag = sqrtf (x * x + y * y + z * z); + + if (mag <= 1.0e-4) + { + /* no rotation, leave mat as-is */ + return; + } + + x /= mag; + y /= mag; + z /= mag; + + + /* + * Arbitrary axis rotation matrix. + * + * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied + * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation + * (which is about the X-axis), and the two composite transforms + * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary + * from the arbitrary axis to the X-axis then back. They are + * all elementary rotations. + * + * Rz' is a rotation about the Z-axis, to bring the axis vector + * into the x-z plane. Then Ry' is applied, rotating about the + * Y-axis to bring the axis vector parallel with the X-axis. The + * rotation about the X-axis is then performed. Ry and Rz are + * simply the respective inverse transforms to bring the arbitrary + * axis back to it's original orientation. The first transforms + * Rz' and Ry' are considered inverses, since the data from the + * arbitrary axis gives you info on how to get to it, not how + * to get away from it, and an inverse must be applied. + * + * The basic calculation used is to recognize that the arbitrary + * axis vector (x, y, z), since it is of unit length, actually + * represents the sines and cosines of the angles to rotate the + * X-axis to the same orientation, with theta being the angle about + * Z and phi the angle about Y (in the order described above) + * as follows: + * + * cos ( theta ) = x / sqrt ( 1 - z^2 ) + * sin ( theta ) = y / sqrt ( 1 - z^2 ) + * + * cos ( phi ) = sqrt ( 1 - z^2 ) + * sin ( phi ) = z + * + * Note that cos ( phi ) can further be inserted to the above + * formulas: + * + * cos ( theta ) = x / cos ( phi ) + * sin ( theta ) = y / sin ( phi ) + * + * ...etc. Because of those relations and the standard trigonometric + * relations, it is pssible to reduce the transforms down to what + * is used below. It may be that any primary axis chosen will give the + * same results (modulo a sign convention) using thie method. + * + * Particularly nice is to notice that all divisions that might + * have caused trouble when parallel to certain planes or + * axis go away with care paid to reducing the expressions. + * After checking, it does perform correctly under all cases, since + * in all the cases of division where the denominator would have + * been zero, the numerator would have been zero as well, giving + * the expected result. + */ + + xx = x * x; + yy = y * y; + zz = z * z; + xy = x * y; + yz = y * z; + zx = z * x; + xs = x * s; + ys = y * s; + zs = z * s; + one_c = 1.0f - c; + + /* We already hold the identity-matrix so we can skip some statements */ + M (0,0) = (one_c * xx) + c; + M (0,1) = (one_c * xy) - zs; + M (0,2) = (one_c * zx) + ys; + /* M (0,3) = 0.0f; */ + + M (1,0) = (one_c * xy) + zs; + M (1,1) = (one_c * yy) + c; + M (1,2) = (one_c * yz) - xs; + /* M (1,3) = 0.0f; */ + + M (2,0) = (one_c * zx) - ys; + M (2,1) = (one_c * yz) + xs; + M (2,2) = (one_c * zz) + c; + /* M (2,3) = 0.0f; */ + + /* + M (3,0) = 0.0f; + M (3,1) = 0.0f; + M (3,2) = 0.0f; + M (3,3) = 1.0f; + */ + } +#undef M + + matrix_multiply_array_with_flags (matrix, m, MAT_FLAG_ROTATION); +} + +void +cogl_matrix_rotate (CoglMatrix *matrix, + float angle, + float x, + float y, + float z) +{ + _cogl_matrix_rotate (matrix, angle, x, y, z); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_matrix_rotate_quaternion (CoglMatrix *matrix, + const CoglQuaternion *quaternion) +{ + CoglMatrix rotation_transform; + + cogl_matrix_init_from_quaternion (&rotation_transform, quaternion); + cogl_matrix_multiply (matrix, matrix, &rotation_transform); +} + +void +cogl_matrix_rotate_euler (CoglMatrix *matrix, + const CoglEuler *euler) +{ + CoglMatrix rotation_transform; + + cogl_matrix_init_from_euler (&rotation_transform, euler); + cogl_matrix_multiply (matrix, matrix, &rotation_transform); +} + +/* + * Apply a perspective projection matrix. + * + * Creates the projection matrix and multiplies it with matrix, marking the + * MAT_FLAG_PERSPECTIVE flag. + */ +static void +_cogl_matrix_frustum (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float nearval, + float farval) +{ + float x, y, a, b, c, d; + float m[16]; + + x = (2.0f * nearval) / (right - left); + y = (2.0f * nearval) / (top - bottom); + a = (right + left) / (right - left); + b = (top + bottom) / (top - bottom); + c = -(farval + nearval) / ( farval - nearval); + d = -(2.0f * farval * nearval) / (farval - nearval); /* error? */ + +#define M(row,col) m[col*4+row] + M (0,0) = x; M (0,1) = 0.0f; M (0,2) = a; M (0,3) = 0.0f; + M (1,0) = 0.0f; M (1,1) = y; M (1,2) = b; M (1,3) = 0.0f; + M (2,0) = 0.0f; M (2,1) = 0.0f; M (2,2) = c; M (2,3) = d; + M (3,0) = 0.0f; M (3,1) = 0.0f; M (3,2) = -1.0f; M (3,3) = 0.0f; +#undef M + + matrix_multiply_array_with_flags (matrix, m, MAT_FLAG_PERSPECTIVE); +} + +void +cogl_matrix_frustum (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + _cogl_matrix_frustum (matrix, left, right, bottom, top, z_near, z_far); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_matrix_perspective (CoglMatrix *matrix, + float fov_y, + float aspect, + float z_near, + float z_far) +{ + float ymax = z_near * tan (fov_y * G_PI / 360.0); + + cogl_matrix_frustum (matrix, + -ymax * aspect, /* left */ + ymax * aspect, /* right */ + -ymax, /* bottom */ + ymax, /* top */ + z_near, + z_far); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +/* + * Apply an orthographic projection matrix. + * + * Creates the projection matrix and multiplies it with matrix, marking the + * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags. + */ +static void +_cogl_matrix_orthographic (CoglMatrix *matrix, + float x_1, + float y_1, + float x_2, + float y_2, + float nearval, + float farval) +{ + float m[16]; + +#define M(row, col) m[col * 4 + row] + M (0,0) = 2.0f / (x_2 - x_1); + M (0,1) = 0.0f; + M (0,2) = 0.0f; + M (0,3) = -(x_2 + x_1) / (x_2 - x_1); + + M (1,0) = 0.0f; + M (1,1) = 2.0f / (y_1 - y_2); + M (1,2) = 0.0f; + M (1,3) = -(y_1 + y_2) / (y_1 - y_2); + + M (2,0) = 0.0f; + M (2,1) = 0.0f; + M (2,2) = -2.0f / (farval - nearval); + M (2,3) = -(farval + nearval) / (farval - nearval); + + M (3,0) = 0.0f; + M (3,1) = 0.0f; + M (3,2) = 0.0f; + M (3,3) = 1.0f; +#undef M + + matrix_multiply_array_with_flags (matrix, m, + (MAT_FLAG_GENERAL_SCALE | + MAT_FLAG_TRANSLATION)); +} + +void +cogl_matrix_ortho (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float near, + float far) +{ + _cogl_matrix_orthographic (matrix, left, top, right, bottom, near, far); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_matrix_orthographic (CoglMatrix *matrix, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far) +{ + _cogl_matrix_orthographic (matrix, x_1, y_1, x_2, y_2, near, far); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +/* + * Multiply a matrix with a general scaling matrix. + * + * Multiplies in-place the elements of matrix by the scale factors. Checks if + * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE + * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and + * MAT_DIRTY_INVERSE dirty flags. + */ +static void +_cogl_matrix_scale (CoglMatrix *matrix, float x, float y, float z) +{ + float *m = (float *)matrix; + m[0] *= x; m[4] *= y; m[8] *= z; + m[1] *= x; m[5] *= y; m[9] *= z; + m[2] *= x; m[6] *= y; m[10] *= z; + m[3] *= x; m[7] *= y; m[11] *= z; + + if (fabsf (x - y) < 1e-8 && fabsf (x - z) < 1e-8) + matrix->flags |= MAT_FLAG_UNIFORM_SCALE; + else + matrix->flags |= MAT_FLAG_GENERAL_SCALE; + + matrix->flags |= (MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); +} + +void +cogl_matrix_scale (CoglMatrix *matrix, + float sx, + float sy, + float sz) +{ + _cogl_matrix_scale (matrix, sx, sy, sz); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +/* + * Multiply a matrix with a translation matrix. + * + * Adds the translation coordinates to the elements of matrix in-place. Marks + * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE + * dirty flags. + */ +static void +_cogl_matrix_translate (CoglMatrix *matrix, float x, float y, float z) +{ + float *m = (float *)matrix; + m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; + m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; + m[14] = m[2] * x + m[6] * y + m[10] * z + m[14]; + m[15] = m[3] * x + m[7] * y + m[11] * z + m[15]; + + matrix->flags |= (MAT_FLAG_TRANSLATION | + MAT_DIRTY_TYPE | + MAT_DIRTY_INVERSE); +} + +void +cogl_matrix_translate (CoglMatrix *matrix, + float x, + float y, + float z) +{ + _cogl_matrix_translate (matrix, x, y, z); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +#if 0 +/* + * Set matrix to do viewport and depthrange mapping. + * Transforms Normalized Device Coords to window/Z values. + */ +static void +_cogl_matrix_viewport (CoglMatrix *matrix, + float x, float y, + float width, float height, + float zNear, float zFar, float depthMax) +{ + float *m = (float *)matrix; + m[MAT_SX] = width / 2.0f; + m[MAT_TX] = m[MAT_SX] + x; + m[MAT_SY] = height / 2.0f; + m[MAT_TY] = m[MAT_SY] + y; + m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0f); + m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0f + zNear); + matrix->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; + matrix->type = COGL_MATRIX_TYPE_3D_NO_ROT; +} +#endif + +/* + * Set a matrix to the identity matrix. + * + * @mat matrix. + * + * Copies ::identity into \p CoglMatrix::m, and into CoglMatrix::inv if + * not NULL. Sets the matrix type to identity, resets the flags. It + * doesn't initialize the inverse matrix, it just marks it dirty. + */ +static void +_cogl_matrix_init_identity (CoglMatrix *matrix) +{ + memcpy (matrix, identity, 16 * sizeof (float)); + + matrix->type = COGL_MATRIX_TYPE_IDENTITY; + matrix->flags = MAT_DIRTY_INVERSE; +} + +void +cogl_matrix_init_identity (CoglMatrix *matrix) +{ + _cogl_matrix_init_identity (matrix); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +/* + * Set a matrix to the (tx, ty, tz) translation matrix. + * + * @matix matrix. + * @tx x coordinate of the translation vector + * @ty y coordinate of the translation vector + * @tz z coordinate of the translation vector + */ +static void +_cogl_matrix_init_translation (CoglMatrix *matrix, + float tx, + float ty, + float tz) +{ + memcpy (matrix, identity, 16 * sizeof (float)); + + matrix->xw = tx; + matrix->yw = ty; + matrix->zw = tz; + + matrix->type = COGL_MATRIX_TYPE_3D; + matrix->flags = MAT_FLAG_TRANSLATION | MAT_DIRTY_INVERSE; +} + +void +cogl_matrix_init_translation (CoglMatrix *matrix, + float tx, + float ty, + float tz) +{ + _cogl_matrix_init_translation (matrix, tx, ty, tz); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +#if 0 +/* + * Test if the given matrix preserves vector lengths. + */ +static CoglBool +_cogl_matrix_is_length_preserving (const CoglMatrix *m) +{ + return TEST_MAT_FLAGS (m, MAT_FLAGS_LENGTH_PRESERVING); +} + +/* + * Test if the given matrix does any rotation. + * (or perhaps if the upper-left 3x3 is non-identity) + */ +static CoglBool +_cogl_matrix_has_rotation (const CoglMatrix *matrix) +{ + if (matrix->flags & (MAT_FLAG_GENERAL | + MAT_FLAG_ROTATION | + MAT_FLAG_GENERAL_3D | + MAT_FLAG_PERSPECTIVE)) + return TRUE; + else + return FALSE; +} + +static CoglBool +_cogl_matrix_is_general_scale (const CoglMatrix *matrix) +{ + return (matrix->flags & MAT_FLAG_GENERAL_SCALE) ? TRUE : FALSE; +} + +static CoglBool +_cogl_matrix_is_dirty (const CoglMatrix *matrix) +{ + return (matrix->flags & MAT_DIRTY_ALL) ? TRUE : FALSE; +} +#endif + +/* + * Loads a matrix array into CoglMatrix. + * + * @m matrix array. + * @mat matrix. + * + * Copies \p m into CoglMatrix::m and marks the MAT_FLAG_GENERAL and + * MAT_DIRTY_ALL + * flags. + */ +static void +_cogl_matrix_init_from_array (CoglMatrix *matrix, const float *array) +{ + memcpy (matrix, array, 16 * sizeof (float)); + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); +} + +void +cogl_matrix_init_from_array (CoglMatrix *matrix, const float *array) +{ + _cogl_matrix_init_from_array (matrix, array); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +_cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix, + const CoglMatrix *src) +{ + memcpy (matrix, src, 16 * sizeof (float)); + matrix->type = src->type; + matrix->flags = src->flags | MAT_DIRTY_INVERSE; +} + +static void +_cogl_matrix_init_from_quaternion (CoglMatrix *matrix, + const CoglQuaternion *quaternion) +{ + float qnorm = _COGL_QUATERNION_NORM (quaternion); + float s = (qnorm > 0.0f) ? (2.0f / qnorm) : 0.0f; + float xs = quaternion->x * s; + float ys = quaternion->y * s; + float zs = quaternion->z * s; + float wx = quaternion->w * xs; + float wy = quaternion->w * ys; + float wz = quaternion->w * zs; + float xx = quaternion->x * xs; + float xy = quaternion->x * ys; + float xz = quaternion->x * zs; + float yy = quaternion->y * ys; + float yz = quaternion->y * zs; + float zz = quaternion->z * zs; + + matrix->xx = 1.0f - (yy + zz); + matrix->yx = xy + wz; + matrix->zx = xz - wy; + matrix->xy = xy - wz; + matrix->yy = 1.0f - (xx + zz); + matrix->zy = yz + wx; + matrix->xz = xz + wy; + matrix->yz = yz - wx; + matrix->zz = 1.0f - (xx + yy); + matrix->xw = matrix->yw = matrix->zw = 0.0f; + matrix->wx = matrix->wy = matrix->wz = 0.0f; + matrix->ww = 1.0f; + + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); +} + +void +cogl_matrix_init_from_quaternion (CoglMatrix *matrix, + const CoglQuaternion *quaternion) +{ + _cogl_matrix_init_from_quaternion (matrix, quaternion); +} + +void +cogl_matrix_init_from_euler (CoglMatrix *matrix, + const CoglEuler *euler) +{ + /* Convert angles to radians */ + float heading_rad = euler->heading / 180.0f * G_PI; + float pitch_rad = euler->pitch / 180.0f * G_PI; + float roll_rad = euler->roll / 180.0f * G_PI; + /* Pre-calculate the sin and cos */ + float sin_heading = sinf (heading_rad); + float cos_heading = cosf (heading_rad); + float sin_pitch = sinf (pitch_rad); + float cos_pitch = cosf (pitch_rad); + float sin_roll = sinf (roll_rad); + float cos_roll = cosf (roll_rad); + + /* These calculations are based on the following website but they + * use a different order for the rotations so it has been modified + * slightly. + * http://www.euclideanspace.com/maths/geometry/ + * rotations/conversions/eulerToMatrix/index.htm + */ + + /* Heading rotation x=0, y=1, z=0 gives: + * + * [ ch 0 sh 0 ] + * [ 0 1 0 0 ] + * [ -sh 0 ch 0 ] + * [ 0 0 0 1 ] + * + * Pitch rotation x=1, y=0, z=0 gives: + * [ 1 0 0 0 ] + * [ 0 cp -sp 0 ] + * [ 0 sp cp 0 ] + * [ 0 0 0 1 ] + * + * Roll rotation x=0, y=0, z=1 gives: + * [ cr -sr 0 0 ] + * [ sr cr 0 0 ] + * [ 0 0 1 0 ] + * [ 0 0 0 1 ] + * + * Heading matrix * pitch matrix = + * [ ch sh*sp cp*sh 0 ] + * [ 0 cp -sp 0 ] + * [ -sh ch*sp ch*cp 0 ] + * [ 0 0 0 1 ] + * + * That matrix * roll matrix = + * [ ch*cr + sh*sp*sr sh*sp*cr - ch*sr sh*cp 0 ] + * [ cp*sr cp*cr -sp 0 ] + * [ ch*sp*sr - sh*cr sh*sr + ch*sp*cr ch*cp 0 ] + * [ 0 0 0 1 ] + */ + + matrix->xx = cos_heading * cos_roll + sin_heading * sin_pitch * sin_roll; + matrix->yx = cos_pitch * sin_roll; + matrix->zx = cos_heading * sin_pitch * sin_roll - sin_heading * cos_roll; + matrix->wx = 0.0f; + + matrix->xy = sin_heading * sin_pitch * cos_roll - cos_heading * sin_roll; + matrix->yy = cos_pitch * cos_roll; + matrix->zy = sin_heading * sin_roll + cos_heading * sin_pitch * cos_roll; + matrix->wy = 0.0f; + + matrix->xz = sin_heading * cos_pitch; + matrix->yz = -sin_pitch; + matrix->zz = cos_heading * cos_pitch; + matrix->wz = 0; + + matrix->xw = 0; + matrix->yw = 0; + matrix->zw = 0; + matrix->ww = 1; + + matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL); +} + +/* + * Transpose a float matrix. + */ +static void +_cogl_matrix_util_transposef (float to[16], const float from[16]) +{ + to[0] = from[0]; + to[1] = from[4]; + to[2] = from[8]; + to[3] = from[12]; + to[4] = from[1]; + to[5] = from[5]; + to[6] = from[9]; + to[7] = from[13]; + to[8] = from[2]; + to[9] = from[6]; + to[10] = from[10]; + to[11] = from[14]; + to[12] = from[3]; + to[13] = from[7]; + to[14] = from[11]; + to[15] = from[15]; +} + +void +cogl_matrix_view_2d_in_frustum (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float z_near, + float z_2d, + float width_2d, + float height_2d) +{ + float left_2d_plane = left / z_near * z_2d; + float right_2d_plane = right / z_near * z_2d; + float bottom_2d_plane = bottom / z_near * z_2d; + float top_2d_plane = top / z_near * z_2d; + + float width_2d_start = right_2d_plane - left_2d_plane; + float height_2d_start = top_2d_plane - bottom_2d_plane; + + /* Factors to scale from framebuffer geometry to frustum + * cross-section geometry. */ + float width_scale = width_2d_start / width_2d; + float height_scale = height_2d_start / height_2d; + + cogl_matrix_translate (matrix, + left_2d_plane, top_2d_plane, -z_2d); + + cogl_matrix_scale (matrix, width_scale, -height_scale, width_scale); +} + +/* Assuming a symmetric perspective matrix is being used for your + * projective transform this convenience function lets you compose a + * view transform such that geometry on the z=0 plane will map to + * screen coordinates with a top left origin of (0,0) and with the + * given width and height. + */ +void +cogl_matrix_view_2d_in_perspective (CoglMatrix *matrix, + float fov_y, + float aspect, + float z_near, + float z_2d, + float width_2d, + float height_2d) +{ + float top = z_near * tan (fov_y * G_PI / 360.0); + cogl_matrix_view_2d_in_frustum (matrix, + -top * aspect, + top * aspect, + -top, + top, + z_near, + z_2d, + width_2d, + height_2d); +} + +CoglBool +cogl_matrix_equal (const void *v1, const void *v2) +{ + const CoglMatrix *a = v1; + const CoglMatrix *b = v2; + + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + /* We want to avoid having a fuzzy _equal() function (e.g. that uses + * an arbitrary epsilon value) since this function noteably conforms + * to the prototype suitable for use with g_hash_table_new() and a + * fuzzy hash function isn't really appropriate for comparing hash + * table keys since it's possible that you could end up fetching + * different values if you end up with multiple similar keys in use + * at the same time. If you consider that fuzzyness allows cases + * such as A == B == C but A != C then you could also end up loosing + * values in a hash table. + * + * We do at least use the == operator to compare values though so + * that -0 is considered equal to 0. + */ + + /* XXX: We don't compare the flags, inverse matrix or padding */ + if (a->xx == b->xx && + a->xy == b->xy && + a->xz == b->xz && + a->xw == b->xw && + a->yx == b->yx && + a->yy == b->yy && + a->yz == b->yz && + a->yw == b->yw && + a->zx == b->zx && + a->zy == b->zy && + a->zz == b->zz && + a->zw == b->zw && + a->wx == b->wx && + a->wy == b->wy && + a->wz == b->wz && + a->ww == b->ww) + return TRUE; + else + return FALSE; +} + +CoglMatrix * +cogl_matrix_copy (const CoglMatrix *matrix) +{ + if (G_LIKELY (matrix)) + return g_slice_dup (CoglMatrix, matrix); + + return NULL; +} + +void +cogl_matrix_free (CoglMatrix *matrix) +{ + g_slice_free (CoglMatrix, matrix); +} + +const float * +cogl_matrix_get_array (const CoglMatrix *matrix) +{ + return (float *)matrix; +} + +void +cogl_matrix_transform_point (const CoglMatrix *matrix, + float *x, + float *y, + float *z, + float *w) +{ + float _x = *x, _y = *y, _z = *z, _w = *w; + + *x = matrix->xx * _x + matrix->xy * _y + matrix->xz * _z + matrix->xw * _w; + *y = matrix->yx * _x + matrix->yy * _y + matrix->yz * _z + matrix->yw * _w; + *z = matrix->zx * _x + matrix->zy * _y + matrix->zz * _z + matrix->zw * _w; + *w = matrix->wx * _x + matrix->wy * _y + matrix->wz * _z + matrix->ww * _w; +} + +typedef struct _Point2f +{ + float x; + float y; +} Point2f; + +typedef struct _Point3f +{ + float x; + float y; + float z; +} Point3f; + +typedef struct _Point4f +{ + float x; + float y; + float z; + float w; +} Point4f; + +static void +_cogl_matrix_transform_points_f2 (const CoglMatrix *matrix, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + int i; + + for (i = 0; i < n_points; i++) + { + Point2f p = *(Point2f *)((uint8_t *)points_in + i * stride_in); + Point3f *o = (Point3f *)((uint8_t *)points_out + i * stride_out); + + o->x = matrix->xx * p.x + matrix->xy * p.y + matrix->xw; + o->y = matrix->yx * p.x + matrix->yy * p.y + matrix->yw; + o->z = matrix->zx * p.x + matrix->zy * p.y + matrix->zw; + } +} + +static void +_cogl_matrix_project_points_f2 (const CoglMatrix *matrix, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + int i; + + for (i = 0; i < n_points; i++) + { + Point2f p = *(Point2f *)((uint8_t *)points_in + i * stride_in); + Point4f *o = (Point4f *)((uint8_t *)points_out + i * stride_out); + + o->x = matrix->xx * p.x + matrix->xy * p.y + matrix->xw; + o->y = matrix->yx * p.x + matrix->yy * p.y + matrix->yw; + o->z = matrix->zx * p.x + matrix->zy * p.y + matrix->zw; + o->w = matrix->wx * p.x + matrix->wy * p.y + matrix->ww; + } +} + +static void +_cogl_matrix_transform_points_f3 (const CoglMatrix *matrix, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + int i; + + for (i = 0; i < n_points; i++) + { + Point3f p = *(Point3f *)((uint8_t *)points_in + i * stride_in); + Point3f *o = (Point3f *)((uint8_t *)points_out + i * stride_out); + + o->x = matrix->xx * p.x + matrix->xy * p.y + + matrix->xz * p.z + matrix->xw; + o->y = matrix->yx * p.x + matrix->yy * p.y + + matrix->yz * p.z + matrix->yw; + o->z = matrix->zx * p.x + matrix->zy * p.y + + matrix->zz * p.z + matrix->zw; + } +} + +static void +_cogl_matrix_project_points_f3 (const CoglMatrix *matrix, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + int i; + + for (i = 0; i < n_points; i++) + { + Point3f p = *(Point3f *)((uint8_t *)points_in + i * stride_in); + Point4f *o = (Point4f *)((uint8_t *)points_out + i * stride_out); + + o->x = matrix->xx * p.x + matrix->xy * p.y + + matrix->xz * p.z + matrix->xw; + o->y = matrix->yx * p.x + matrix->yy * p.y + + matrix->yz * p.z + matrix->yw; + o->z = matrix->zx * p.x + matrix->zy * p.y + + matrix->zz * p.z + matrix->zw; + o->w = matrix->wx * p.x + matrix->wy * p.y + + matrix->wz * p.z + matrix->ww; + } +} + +static void +_cogl_matrix_project_points_f4 (const CoglMatrix *matrix, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + int i; + + for (i = 0; i < n_points; i++) + { + Point4f p = *(Point4f *)((uint8_t *)points_in + i * stride_in); + Point4f *o = (Point4f *)((uint8_t *)points_out + i * stride_out); + + o->x = matrix->xx * p.x + matrix->xy * p.y + + matrix->xz * p.z + matrix->xw * p.w; + o->y = matrix->yx * p.x + matrix->yy * p.y + + matrix->yz * p.z + matrix->yw * p.w; + o->z = matrix->zx * p.x + matrix->zy * p.y + + matrix->zz * p.z + matrix->zw * p.w; + o->w = matrix->wx * p.x + matrix->wy * p.y + + matrix->wz * p.z + matrix->ww * p.w; + } +} + +void +cogl_matrix_transform_points (const CoglMatrix *matrix, + int n_components, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + /* The results of transforming always have three components... */ + _COGL_RETURN_IF_FAIL (stride_out >= sizeof (Point3f)); + + if (n_components == 2) + _cogl_matrix_transform_points_f2 (matrix, + stride_in, points_in, + stride_out, points_out, + n_points); + else + { + _COGL_RETURN_IF_FAIL (n_components == 3); + + _cogl_matrix_transform_points_f3 (matrix, + stride_in, points_in, + stride_out, points_out, + n_points); + } +} + +void +cogl_matrix_project_points (const CoglMatrix *matrix, + int n_components, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points) +{ + if (n_components == 2) + _cogl_matrix_project_points_f2 (matrix, + stride_in, points_in, + stride_out, points_out, + n_points); + else if (n_components == 3) + _cogl_matrix_project_points_f3 (matrix, + stride_in, points_in, + stride_out, points_out, + n_points); + else + { + _COGL_RETURN_IF_FAIL (n_components == 4); + + _cogl_matrix_project_points_f4 (matrix, + stride_in, points_in, + stride_out, points_out, + n_points); + } +} + +CoglBool +cogl_matrix_is_identity (const CoglMatrix *matrix) +{ + if (!(matrix->flags & MAT_DIRTY_TYPE) && + matrix->type == COGL_MATRIX_TYPE_IDENTITY) + return TRUE; + else + return memcmp (matrix, identity, sizeof (float) * 16) == 0; +} + +void +cogl_matrix_look_at (CoglMatrix *matrix, + float eye_position_x, + float eye_position_y, + float eye_position_z, + float object_x, + float object_y, + float object_z, + float world_up_x, + float world_up_y, + float world_up_z) +{ + CoglMatrix tmp; + float forward[3]; + float side[3]; + float up[3]; + + /* Get a unit viewing direction vector */ + cogl_vector3_init (forward, + object_x - eye_position_x, + object_y - eye_position_y, + object_z - eye_position_z); + cogl_vector3_normalize (forward); + + cogl_vector3_init (up, world_up_x, world_up_y, world_up_z); + + /* Take the sideways direction as being perpendicular to the viewing + * direction and the word up vector. */ + cogl_vector3_cross_product (side, forward, up); + cogl_vector3_normalize (side); + + /* Now we have unit sideways and forward-direction vectors calculate + * a new mutually perpendicular up vector. */ + cogl_vector3_cross_product (up, side, forward); + + tmp.xx = side[0]; + tmp.yx = side[1]; + tmp.zx = side[2]; + tmp.wx = 0; + + tmp.xy = up[0]; + tmp.yy = up[1]; + tmp.zy = up[2]; + tmp.wy = 0; + + tmp.xz = -forward[0]; + tmp.yz = -forward[1]; + tmp.zz = -forward[2]; + tmp.wz = 0; + + tmp.xw = 0; + tmp.yw = 0; + tmp.zw = 0; + tmp.ww = 1; + + tmp.flags = (MAT_FLAG_GENERAL_3D | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); + + cogl_matrix_translate (&tmp, -eye_position_x, -eye_position_y, -eye_position_z); + + cogl_matrix_multiply (matrix, matrix, &tmp); +} + +void +cogl_matrix_transpose (CoglMatrix *matrix) +{ + float new_values[16]; + + /* We don't need to do anything if the matrix is the identity matrix */ + if (!(matrix->flags & MAT_DIRTY_TYPE) && + matrix->type == COGL_MATRIX_TYPE_IDENTITY) + return; + + _cogl_matrix_util_transposef (new_values, cogl_matrix_get_array (matrix)); + + cogl_matrix_init_from_array (matrix, new_values); +} + +#ifdef COGL_HAS_GTYPE_SUPPORT +GType +cogl_gtype_matrix_get_type (void) +{ + return cogl_matrix_get_gtype (); +} +#endif diff --git a/cogl/cogl-matrix.h b/cogl/cogl-matrix.h new file mode 100644 index 0000000..58ec5c7 --- /dev/null +++ b/cogl/cogl-matrix.h @@ -0,0 +1,821 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_MATRIX_H +#define __COGL_MATRIX_H + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif /* COGL_HAS_GTYPE_SUPPORT */ + +#include +#include + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +#include +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-matrix + * @short_description: Functions for initializing and manipulating 4x4 matrices + * + * Matrices are used in Cogl to describe affine model-view transforms, texture + * transforms, and projective transforms. This exposes a utility API that can + * be used for direct manipulation of these matrices. + */ + +/** + * CoglMatrix: + * + * A CoglMatrix holds a 4x4 transform matrix. This is a single precision, + * column-major matrix which means it is compatible with what OpenGL expects. + * + * A CoglMatrix can represent transforms such as, rotations, scaling, + * translation, sheering, and linear projections. You can combine these + * transforms by multiplying multiple matrices in the order you want them + * applied. + * + * The transformation of a vertex (x, y, z, w) by a CoglMatrix is given by: + * + * |[ + * x_new = xx * x + xy * y + xz * z + xw * w + * y_new = yx * x + yy * y + yz * z + yw * w + * z_new = zx * x + zy * y + zz * z + zw * w + * w_new = wx * x + wy * y + wz * z + ww * w + * ]| + * + * Where w is normally 1 + * + * You must consider the members of the CoglMatrix structure read only, + * and all matrix modifications must be done via the cogl_matrix API. This + * allows Cogl to annotate the matrices internally. Violation of this will give + * undefined results. If you need to initialize a matrix with a constant other + * than the identity matrix you can use cogl_matrix_init_from_array(). + */ +struct _CoglMatrix +{ + /* column 0 */ + float xx; + float yx; + float zx; + float wx; + + /* column 1 */ + float xy; + float yy; + float zy; + float wy; + + /* column 2 */ + float xz; + float yz; + float zz; + float wz; + + /* column 3 */ + float xw; + float yw; + float zw; + float ww; + + /*< private >*/ + + /* Note: we may want to extend this later with private flags + * and a cache of the inverse transform matrix. */ + float COGL_PRIVATE (inv)[16]; + unsigned long COGL_PRIVATE (type); + unsigned long COGL_PRIVATE (flags); + unsigned long COGL_PRIVATE (_padding3); +}; +COGL_STRUCT_SIZE_ASSERT (CoglMatrix, 128 + sizeof (unsigned long) * 3); + + +/** + * cogl_matrix_init_identity: + * @matrix: A 4x4 transformation matrix + * + * Resets matrix to the identity matrix: + * + * |[ + * .xx=1; .xy=0; .xz=0; .xw=0; + * .yx=0; .yy=1; .yz=0; .yw=0; + * .zx=0; .zy=0; .zz=1; .zw=0; + * .wx=0; .wy=0; .wz=0; .ww=1; + * ]| + */ +void +cogl_matrix_init_identity (CoglMatrix *matrix); + +/** + * cogl_matrix_init_translation: + * @matrix: A 4x4 transformation matrix + * @tx: x coordinate of the translation vector + * @ty: y coordinate of the translation vector + * @tz: z coordinate of the translation vector + * + * Resets matrix to the (tx, ty, tz) translation matrix: + * + * |[ + * .xx=1; .xy=0; .xz=0; .xw=tx; + * .yx=0; .yy=1; .yz=0; .yw=ty; + * .zx=0; .zy=0; .zz=1; .zw=tz; + * .wx=0; .wy=0; .wz=0; .ww=1; + * ]| + * + * Since: 2.0 + */ +void +cogl_matrix_init_translation (CoglMatrix *matrix, + float tx, + float ty, + float tz); + +/** + * cogl_matrix_multiply: + * @result: The address of a 4x4 matrix to store the result in + * @a: A 4x4 transformation matrix + * @b: A 4x4 transformation matrix + * + * Multiplies the two supplied matrices together and stores + * the resulting matrix inside @result. + * + * It is possible to multiply the @a matrix in-place, so + * @result can be equal to @a but can't be equal to @b. + */ +void +cogl_matrix_multiply (CoglMatrix *result, + const CoglMatrix *a, + const CoglMatrix *b); + +/** + * cogl_matrix_rotate: + * @matrix: A 4x4 transformation matrix + * @angle: The angle you want to rotate in degrees + * @x: X component of your rotation vector + * @y: Y component of your rotation vector + * @z: Z component of your rotation vector + * + * Multiplies @matrix with a rotation matrix that applies a rotation + * of @angle degrees around the specified 3D vector. + */ +void +cogl_matrix_rotate (CoglMatrix *matrix, + float angle, + float x, + float y, + float z); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +/** + * cogl_matrix_rotate_quaternion: + * @matrix: A 4x4 transformation matrix + * @quaternion: A quaternion describing a rotation + * + * Multiplies @matrix with a rotation transformation described by the + * given #CoglQuaternion. + * + * Since: 2.0 + */ +void +cogl_matrix_rotate_quaternion (CoglMatrix *matrix, + const CoglQuaternion *quaternion); + +/** + * cogl_matrix_rotate_euler: + * @matrix: A 4x4 transformation matrix + * @euler: A euler describing a rotation + * + * Multiplies @matrix with a rotation transformation described by the + * given #CoglEuler. + * + * Since: 2.0 + */ +void +cogl_matrix_rotate_euler (CoglMatrix *matrix, + const CoglEuler *euler); +#endif + +/** + * cogl_matrix_translate: + * @matrix: A 4x4 transformation matrix + * @x: The X translation you want to apply + * @y: The Y translation you want to apply + * @z: The Z translation you want to apply + * + * Multiplies @matrix with a transform matrix that translates along + * the X, Y and Z axis. + */ +void +cogl_matrix_translate (CoglMatrix *matrix, + float x, + float y, + float z); + +/** + * cogl_matrix_scale: + * @matrix: A 4x4 transformation matrix + * @sx: The X scale factor + * @sy: The Y scale factor + * @sz: The Z scale factor + * + * Multiplies @matrix with a transform matrix that scales along the X, + * Y and Z axis. + */ +void +cogl_matrix_scale (CoglMatrix *matrix, + float sx, + float sy, + float sz); + +/** + * cogl_matrix_look_at: + * @matrix: A 4x4 transformation matrix + * @eye_position_x: The X coordinate to look from + * @eye_position_y: The Y coordinate to look from + * @eye_position_z: The Z coordinate to look from + * @object_x: The X coordinate of the object to look at + * @object_y: The Y coordinate of the object to look at + * @object_z: The Z coordinate of the object to look at + * @world_up_x: The X component of the world's up direction vector + * @world_up_y: The Y component of the world's up direction vector + * @world_up_z: The Z component of the world's up direction vector + * + * Applies a view transform @matrix that positions the camera at + * the coordinate (@eye_position_x, @eye_position_y, @eye_position_z) + * looking towards an object at the coordinate (@object_x, @object_y, + * @object_z). The top of the camera is aligned to the given world up + * vector, which is normally simply (0, 1, 0) to map up to the + * positive direction of the y axis. + * + * Because there is a lot of missleading documentation online for + * gluLookAt regarding the up vector we want to try and be a bit + * clearer here. + * + * The up vector should simply be relative to your world coordinates + * and does not need to change as you move the eye and object + * positions. Many online sources may claim that the up vector needs + * to be perpendicular to the vector between the eye and object + * position (partly because the man page is somewhat missleading) but + * that is not necessary for this function. + * + * You should never look directly along the world-up + * vector. + * + * It is assumed you are using a typical projection matrix where + * your origin maps to the center of your viewport. + * + * Almost always when you use this function it should be the first + * transform applied to a new modelview transform + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_matrix_look_at (CoglMatrix *matrix, + float eye_position_x, + float eye_position_y, + float eye_position_z, + float object_x, + float object_y, + float object_z, + float world_up_x, + float world_up_y, + float world_up_z); + +/** + * cogl_matrix_frustum: + * @matrix: A 4x4 transformation matrix + * @left: X position of the left clipping plane where it + * intersects the near clipping plane + * @right: X position of the right clipping plane where it + * intersects the near clipping plane + * @bottom: Y position of the bottom clipping plane where it + * intersects the near clipping plane + * @top: Y position of the top clipping plane where it intersects + * the near clipping plane + * @z_near: The distance to the near clipping plane (Must be positive) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Multiplies @matrix by the given frustum perspective matrix. + */ +void +cogl_matrix_frustum (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far); + +/** + * cogl_matrix_perspective: + * @matrix: A 4x4 transformation matrix + * @fov_y: Vertical field of view angle in degrees. + * @aspect: The (width over height) aspect ratio for display + * @z_near: The distance to the near clipping plane (Must be positive, + * and must not be 0) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Multiplies @matrix by the described perspective matrix + * + * You should be careful not to have to great a @z_far / @z_near + * ratio since that will reduce the effectiveness of depth testing + * since there wont be enough precision to identify the depth of + * objects near to each other. + */ +void +cogl_matrix_perspective (CoglMatrix *matrix, + float fov_y, + float aspect, + float z_near, + float z_far); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +/** + * cogl_matrix_orthographic: + * @matrix: A 4x4 transformation matrix + * @x_1: The x coordinate for the first vertical clipping plane + * @y_1: The y coordinate for the first horizontal clipping plane + * @x_2: The x coordinate for the second vertical clipping plane + * @y_2: The y coordinate for the second horizontal clipping plane + * @near: The distance to the near clipping + * plane (will be negative if the plane is + * behind the viewer) + * @far: The distance to the far clipping + * plane (will be negative if the plane is + * behind the viewer) + * + * Multiplies @matrix by a parallel projection matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_matrix_orthographic (CoglMatrix *matrix, + float x_1, + float y_1, + float x_2, + float y_2, + float near, + float far); +#endif + +/** + * cogl_matrix_ortho: + * @matrix: A 4x4 transformation matrix + * @left: The coordinate for the left clipping plane + * @right: The coordinate for the right clipping plane + * @bottom: The coordinate for the bottom clipping plane + * @top: The coordinate for the top clipping plane + * @near: The distance to the near clipping + * plane (will be negative if the plane is + * behind the viewer) + * @far: The distance to the far clipping + * plane (will be negative if the plane is + * behind the viewer) + * + * Multiplies @matrix by a parallel projection matrix. + * + * Deprecated: 1.10: Use cogl_matrix_orthographic() + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_matrix_orthographic) +void +cogl_matrix_ortho (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float near, + float far); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +/** + * cogl_matrix_view_2d_in_frustum: + * @matrix: A 4x4 transformation matrix + * @left: coord of left vertical clipping plane + * @right: coord of right vertical clipping plane + * @bottom: coord of bottom horizontal clipping plane + * @top: coord of top horizontal clipping plane + * @z_near: The distance to the near clip plane. Never pass 0 and always pass + * a positive number. + * @z_2d: The distance to the 2D plane. (Should always be positive and + * be between @z_near and the z_far value that was passed to + * cogl_matrix_frustum()) + * @width_2d: The width of the 2D coordinate system + * @height_2d: The height of the 2D coordinate system + * + * Multiplies @matrix by a view transform that maps the 2D coordinates + * (0,0) top left and (@width_2d,@height_2d) bottom right the full viewport + * size. Geometry at a depth of 0 will now lie on this 2D plane. + * + * Note: this doesn't multiply the matrix by any projection matrix, + * but it assumes you have a perspective projection as defined by + * passing the corresponding arguments to cogl_matrix_frustum(). + + * Toolkits such as Clutter that mix 2D and 3D drawing can use this to + * create a 2D coordinate system within a 3D perspective projected + * view frustum. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_matrix_view_2d_in_frustum (CoglMatrix *matrix, + float left, + float right, + float bottom, + float top, + float z_near, + float z_2d, + float width_2d, + float height_2d); + +/** + * cogl_matrix_view_2d_in_perspective: + * @fov_y: A field of view angle for the Y axis + * @aspect: The ratio of width to height determining the field of view angle + * for the x axis. + * @z_near: The distance to the near clip plane. Never pass 0 and always pass + * a positive number. + * @z_2d: The distance to the 2D plane. (Should always be positive and + * be between @z_near and the z_far value that was passed to + * cogl_matrix_frustum()) + * @width_2d: The width of the 2D coordinate system + * @height_2d: The height of the 2D coordinate system + * + * Multiplies @matrix by a view transform that maps the 2D coordinates + * (0,0) top left and (@width_2d,@height_2d) bottom right the full viewport + * size. Geometry at a depth of 0 will now lie on this 2D plane. + * + * Note: this doesn't multiply the matrix by any projection matrix, + * but it assumes you have a perspective projection as defined by + * passing the corresponding arguments to cogl_matrix_perspective(). + * + * Toolkits such as Clutter that mix 2D and 3D drawing can use this to + * create a 2D coordinate system within a 3D perspective projected + * view frustum. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_matrix_view_2d_in_perspective (CoglMatrix *matrix, + float fov_y, + float aspect, + float z_near, + float z_2d, + float width_2d, + float height_2d); + +#endif + +/** + * cogl_matrix_init_from_array: + * @matrix: A 4x4 transformation matrix + * @array: A linear array of 16 floats (column-major order) + * + * Initializes @matrix with the contents of @array + */ +void +cogl_matrix_init_from_array (CoglMatrix *matrix, + const float *array); + +/** + * cogl_matrix_get_array: + * @matrix: A 4x4 transformation matrix + * + * Casts @matrix to a float array which can be directly passed to OpenGL. + * + * Return value: a pointer to the float array + */ +const float * +cogl_matrix_get_array (const CoglMatrix *matrix); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +/** + * cogl_matrix_init_from_quaternion: + * @matrix: A 4x4 transformation matrix + * @quaternion: A #CoglQuaternion + * + * Initializes @matrix from a #CoglQuaternion rotation. + */ +void +cogl_matrix_init_from_quaternion (CoglMatrix *matrix, + const CoglQuaternion *quaternion); + +/** + * cogl_matrix_init_from_euler: + * @matrix: A 4x4 transformation matrix + * @euler: A #CoglEuler + * + * Initializes @matrix from a #CoglEuler rotation. + */ +void +cogl_matrix_init_from_euler (CoglMatrix *matrix, + const CoglEuler *euler); +#endif + +/** + * cogl_matrix_equal: + * @v1: A 4x4 transformation matrix + * @v2: A 4x4 transformation matrix + * + * Compares two matrices to see if they represent the same + * transformation. Although internally the matrices may have different + * annotations associated with them and may potentially have a cached + * inverse matrix these are not considered in the comparison. + * + * Since: 1.4 + */ +CoglBool +cogl_matrix_equal (const void *v1, const void *v2); + +/** + * cogl_matrix_copy: + * @matrix: A 4x4 transformation matrix you want to copy + * + * Allocates a new #CoglMatrix on the heap and initializes it with + * the same values as @matrix. + * + * Return value: (transfer full): A newly allocated #CoglMatrix which + * should be freed using cogl_matrix_free() + * + * Since: 1.6 + */ +CoglMatrix * +cogl_matrix_copy (const CoglMatrix *matrix); + +/** + * cogl_matrix_free: + * @matrix: A 4x4 transformation matrix you want to free + * + * Frees a #CoglMatrix that was previously allocated via a call to + * cogl_matrix_copy(). + * + * Since: 1.6 + */ +void +cogl_matrix_free (CoglMatrix *matrix); + +/** + * cogl_matrix_get_inverse: + * @matrix: A 4x4 transformation matrix + * @inverse: (out): The destination for a 4x4 inverse transformation matrix + * + * Gets the inverse transform of a given matrix and uses it to initialize + * a new #CoglMatrix. + * + * Although the first parameter is annotated as const to indicate + * that the transform it represents isn't modified this function may + * technically save a copy of the inverse transform within the given + * #CoglMatrix so that subsequent requests for the inverse transform may + * avoid costly inversion calculations. + * + * Return value: %TRUE if the inverse was successfully calculated or %FALSE + * for degenerate transformations that can't be inverted (in this case the + * @inverse matrix will simply be initialized with the identity matrix) + * + * Since: 1.2 + */ +CoglBool +cogl_matrix_get_inverse (const CoglMatrix *matrix, + CoglMatrix *inverse); + +/* FIXME: to be consistent with cogl_matrix_{transform,project}_points + * this could be renamed to cogl_matrix_project_point for Cogl 2.0... + */ + +/** + * cogl_matrix_transform_point: + * @matrix: A 4x4 transformation matrix + * @x: (inout): The X component of your points position + * @y: (inout): The Y component of your points position + * @z: (inout): The Z component of your points position + * @w: (inout): The W component of your points position + * + * Transforms a point whos position is given and returned as four float + * components. + */ +void +cogl_matrix_transform_point (const CoglMatrix *matrix, + float *x, + float *y, + float *z, + float *w); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +/** + * cogl_matrix_transform_points: + * @matrix: A transformation matrix + * @n_components: The number of position components for each input point. + * (either 2 or 3) + * @stride_in: The stride in bytes between input points. + * @points_in: A pointer to the first component of the first input point. + * @stride_out: The stride in bytes between output points. + * @points_out: A pointer to the first component of the first output point. + * @n_points: The number of points to transform. + * + * Transforms an array of input points and writes the result to + * another array of output points. The input points can either have 2 + * or 3 components each. The output points always have 3 components. + * The output array can simply point to the input array to do the + * transform in-place. + * + * If you need to transform 4 component points see + * cogl_matrix_project_points(). + * + * Here's an example with differing input/output strides: + * |[ + * typedef struct { + * float x,y; + * uint8_t r,g,b,a; + * float s,t,p; + * } MyInVertex; + * typedef struct { + * uint8_t r,g,b,a; + * float x,y,z; + * } MyOutVertex; + * MyInVertex vertices[N_VERTICES]; + * MyOutVertex results[N_VERTICES]; + * CoglMatrix matrix; + * + * my_load_vertices (vertices); + * my_get_matrix (&matrix); + * + * cogl_matrix_transform_points (&matrix, + * 2, + * sizeof (MyInVertex), + * &vertices[0].x, + * sizeof (MyOutVertex), + * &results[0].x, + * N_VERTICES); + * ]| + * + * Stability: unstable + */ +void +cogl_matrix_transform_points (const CoglMatrix *matrix, + int n_components, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points); + +/** + * cogl_matrix_project_points: + * @matrix: A projection matrix + * @n_components: The number of position components for each input point. + * (either 2, 3 or 4) + * @stride_in: The stride in bytes between input points. + * @points_in: A pointer to the first component of the first input point. + * @stride_out: The stride in bytes between output points. + * @points_out: A pointer to the first component of the first output point. + * @n_points: The number of points to transform. + * + * Projects an array of input points and writes the result to another + * array of output points. The input points can either have 2, 3 or 4 + * components each. The output points always have 4 components (known + * as homogenous coordinates). The output array can simply point to + * the input array to do the transform in-place. + * + * Here's an example with differing input/output strides: + * |[ + * typedef struct { + * float x,y; + * uint8_t r,g,b,a; + * float s,t,p; + * } MyInVertex; + * typedef struct { + * uint8_t r,g,b,a; + * float x,y,z; + * } MyOutVertex; + * MyInVertex vertices[N_VERTICES]; + * MyOutVertex results[N_VERTICES]; + * CoglMatrix matrix; + * + * my_load_vertices (vertices); + * my_get_matrix (&matrix); + * + * cogl_matrix_project_points (&matrix, + * 2, + * sizeof (MyInVertex), + * &vertices[0].x, + * sizeof (MyOutVertex), + * &results[0].x, + * N_VERTICES); + * ]| + * + * Stability: unstable + */ +void +cogl_matrix_project_points (const CoglMatrix *matrix, + int n_components, + size_t stride_in, + const void *points_in, + size_t stride_out, + void *points_out, + int n_points); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +/** + * cogl_matrix_is_identity: + * @matrix: A #CoglMatrix + * + * Determines if the given matrix is an identity matrix. + * + * Returns: %TRUE if @matrix is an identity matrix else %FALSE + * Since: 1.8 + */ +CoglBool +cogl_matrix_is_identity (const CoglMatrix *matrix); + +/** + * cogl_matrix_transpose: + * @matrix: A #CoglMatrix + * + * Replaces @matrix with its transpose. Ie, every element (i,j) in the + * new matrix is taken from element (j,i) in the old matrix. + * + * Since: 1.10 + */ +void +cogl_matrix_transpose (CoglMatrix *matrix); + +/** + * cogl_debug_matrix_print: + * @matrix: A #CoglMatrix + * + * Prints the contents of a #CoglMatrix to stdout. + * + * Since: 2.0 + */ +void +cogl_debug_matrix_print (const CoglMatrix *matrix); + +#ifdef COGL_HAS_GTYPE_SUPPORT + +#define COGL_GTYPE_TYPE_MATRIX (cogl_matrix_get_gtype ()) + +/** + * cogl_matrix_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_matrix_get_gtype (void); + +/** + * cogl_gtype_matrix_get_type: + * + * Returns: the GType for the registered "CoglMatrix" boxed type. This + * can be used for example to define GObject properties that accept a + * #CoglMatrix value. + * + * Deprecated: 1.18: Use cogl_matrix_get_gtype() instead. + */ +GType +cogl_gtype_matrix_get_type (void); + +#endif /* COGL_HAS_GTYPE_SUPPORT*/ + +COGL_END_DECLS + +#endif /* __COGL_MATRIX_H */ diff --git a/cogl/cogl-memory-stack-private.h b/cogl/cogl-memory-stack-private.h new file mode 100644 index 0000000..2b6ee82 --- /dev/null +++ b/cogl/cogl-memory-stack-private.h @@ -0,0 +1,50 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_MEMORY_STACK__ +#define __COGL_MEMORY_STACK__ + +#include + +typedef struct _CoglMemoryStack CoglMemoryStack; + +CoglMemoryStack * +_cogl_memory_stack_new (size_t initial_size_bytes); + +void * +_cogl_memory_stack_alloc (CoglMemoryStack *stack, size_t bytes); + +void +_cogl_memory_stack_rewind (CoglMemoryStack *stack); + +void +_cogl_memory_stack_free (CoglMemoryStack *stack); + +#endif /* __COGL_MEMORY_STACK__ */ diff --git a/cogl/cogl-memory-stack.c b/cogl/cogl-memory-stack.c new file mode 100644 index 0000000..f723abc --- /dev/null +++ b/cogl/cogl-memory-stack.c @@ -0,0 +1,196 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * CoglMemoryStack provides a really simple, but lightning fast + * memory stack allocation strategy: + * + * - The underlying pool of memory is grow-only. + * - The pool is considered to be a stack which may be comprised + * of multiple smaller stacks. Allocation is done as follows: + * - If there's enough memory in the current sub-stack then the + * stack-pointer will be returned as the allocation and the + * stack-pointer will be incremented by the allocation size. + * - If there isn't enough memory in the current sub-stack + * then a new sub-stack is allocated twice as big as the current + * sub-stack or twice as big as the requested allocation size if + * that's bigger and the stack-pointer is set to the start of the + * new sub-stack. + * - Allocations can't be freed in a random-order, you can only + * rewind the entire stack back to the start. There is no + * the concept of stack frames to allow partial rewinds. + * + * For example; we plan to use this in our tesselator which has to + * allocate lots of small vertex, edge and face structures because + * when tesselation has been finished we just want to free the whole + * lot in one go. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-memory-stack-private.h" +#include "cogl-list.h" + +#include + +#include + +typedef struct _CoglMemorySubStack +{ + CoglList link; + size_t bytes; + uint8_t *data; +} CoglMemorySubStack; + +struct _CoglMemoryStack +{ + CoglList sub_stacks; + + CoglMemorySubStack *sub_stack; + size_t sub_stack_offset; +}; + +static CoglMemorySubStack * +_cogl_memory_sub_stack_alloc (size_t bytes) +{ + CoglMemorySubStack *sub_stack = g_slice_new (CoglMemorySubStack); + sub_stack->bytes = bytes; + sub_stack->data = g_malloc (bytes); + return sub_stack; +} + +static void +_cogl_memory_stack_add_sub_stack (CoglMemoryStack *stack, + size_t sub_stack_bytes) +{ + CoglMemorySubStack *sub_stack = + _cogl_memory_sub_stack_alloc (sub_stack_bytes); + _cogl_list_insert (stack->sub_stacks.prev, &sub_stack->link); + stack->sub_stack = sub_stack; + stack->sub_stack_offset = 0; +} + +CoglMemoryStack * +_cogl_memory_stack_new (size_t initial_size_bytes) +{ + CoglMemoryStack *stack = g_slice_new0 (CoglMemoryStack); + + _cogl_list_init (&stack->sub_stacks); + + _cogl_memory_stack_add_sub_stack (stack, initial_size_bytes); + + return stack; +} + +void * +_cogl_memory_stack_alloc (CoglMemoryStack *stack, size_t bytes) +{ + CoglMemorySubStack *sub_stack; + void *ret; + + sub_stack = stack->sub_stack; + if (G_LIKELY (sub_stack->bytes - stack->sub_stack_offset >= bytes)) + { + ret = sub_stack->data + stack->sub_stack_offset; + stack->sub_stack_offset += bytes; + return ret; + } + + /* If the stack has been rewound and then a large initial allocation + * is made then we may need to skip over one or more of the + * sub-stacks that are too small for the requested allocation + * size... */ + for (_cogl_list_set_iterator (sub_stack->link.next, sub_stack, link); + &sub_stack->link != &stack->sub_stacks; + _cogl_list_set_iterator (sub_stack->link.next, sub_stack, link)) + { + if (sub_stack->bytes >= bytes) + { + ret = sub_stack->data; + stack->sub_stack = sub_stack; + stack->sub_stack_offset = bytes; + return ret; + } + } + + /* Finally if we couldn't find a free sub-stack with enough space + * for the requested allocation we allocate another sub-stack that's + * twice as big as the last sub-stack or twice as big as the + * requested allocation if that's bigger. + */ + + sub_stack = _cogl_container_of (stack->sub_stacks.prev, + CoglMemorySubStack, + link); + + _cogl_memory_stack_add_sub_stack (stack, MAX (sub_stack->bytes, bytes) * 2); + + sub_stack = _cogl_container_of (stack->sub_stacks.prev, + CoglMemorySubStack, + link); + + stack->sub_stack_offset += bytes; + + return sub_stack->data; +} + +void +_cogl_memory_stack_rewind (CoglMemoryStack *stack) +{ + stack->sub_stack = _cogl_container_of (stack->sub_stacks.next, + CoglMemorySubStack, + link); + stack->sub_stack_offset = 0; +} + +static void +_cogl_memory_sub_stack_free (CoglMemorySubStack *sub_stack) +{ + g_free (sub_stack->data); + g_slice_free (CoglMemorySubStack, sub_stack); +} + +void +_cogl_memory_stack_free (CoglMemoryStack *stack) +{ + + while (!_cogl_list_empty (&stack->sub_stacks)) + { + CoglMemorySubStack *sub_stack = + _cogl_container_of (stack->sub_stacks.next, CoglMemorySubStack, link); + _cogl_list_remove (&sub_stack->link); + _cogl_memory_sub_stack_free (sub_stack); + } + + g_slice_free (CoglMemoryStack, stack); +} diff --git a/cogl/cogl-meta-texture.c b/cogl/cogl-meta-texture.c new file mode 100644 index 0000000..554aaad --- /dev/null +++ b/cogl/cogl-meta-texture.c @@ -0,0 +1,642 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-texture.h" +#include "cogl-matrix.h" +#include "cogl-spans.h" +#include "cogl-meta-texture.h" +#include "cogl-texture-rectangle-private.h" + +#include +#include + +typedef struct _ForeachData +{ + float meta_region_coords[4]; + CoglPipelineWrapMode wrap_s; + CoglPipelineWrapMode wrap_t; + CoglMetaTextureCallback callback; + void *user_data; + + int width; + int height; + + CoglTexture *padded_textures[9]; + const float *grid_slice_texture_coords; + float slice_offset_s; + float slice_offset_t; + float slice_range_s; + float slice_range_t; +} ForeachData; + +static void +padded_grid_repeat_cb (CoglTexture *slice_texture, + const float *slice_texture_coords, + const float *meta_coords, + void *user_data) +{ + ForeachData *data; + float mapped_coords[4]; + + /* Ignore padding slices for the current grid */ + if (!slice_texture) + return; + + data = user_data; + + /* NB: the slice_texture_coords[] we get here will always be + * normalized. + * + * We now need to map the normalized slice_texture_coords[] we have + * here back to the real slice coordinates we saved in the previous + * stage... + */ + mapped_coords[0] = + slice_texture_coords[0] * data->slice_range_s + data->slice_offset_s; + mapped_coords[1] = + slice_texture_coords[1] * data->slice_range_t + data->slice_offset_t; + mapped_coords[2] = + slice_texture_coords[2] * data->slice_range_s + data->slice_offset_s; + mapped_coords[3] = + slice_texture_coords[3] * data->slice_range_t + data->slice_offset_t; + + data->callback (slice_texture, + mapped_coords, meta_coords, data->user_data); +} + +static int +setup_padded_spans (CoglSpan *spans, + float start, + float end, + float range, + int *real_index) +{ + int span_index = 0; + + if (start > 0) + { + spans[0].start = 0; + spans[0].size = start; + spans[0].waste = 0; + span_index++; + spans[1].start = spans[0].size; + } + else + spans[span_index].start = 0; + + spans[span_index].size = end - start; + spans[span_index].waste = 0; + *real_index = span_index; + span_index++; + + if (end < range) + { + spans[span_index].start = + spans[span_index - 1].start + spans[span_index - 1].size; + spans[span_index].size = range - end; + spans[span_index].waste = 0; + span_index++; + } + + return span_index; +} + +/* This handles each sub-texture within the range [0,1] of our + * original meta texture and repeats each one separately across the + * users requested virtual texture coordinates. + * + * A notable advantage of this approach is that we will batch + * together callbacks corresponding to the same underlying slice + * together. + */ +static void +create_grid_and_repeat_cb (CoglTexture *slice_texture, + const float *slice_texture_coords, + const float *meta_coords, + void *user_data) +{ + ForeachData *data = user_data; + CoglSpan x_spans[3]; + int n_x_spans; + int x_real_index; + CoglSpan y_spans[3]; + int n_y_spans; + int y_real_index; + + /* NB: This callback is called for each slice of the meta-texture + * in the range [0,1]. + * + * We define a "padded grid" for each slice of the meta-texture in + * the range [0,1]. The x axis and y axis grid lines are defined + * using CoglSpans. + * + * The padded grid maps over the meta-texture coordinates in the + * range [0,1] but only contains one valid cell that corresponds to + * current slice being iterated and all the surrounding cells just + * provide padding. + * + * Once we've defined our padded grid we then repeat that across + * the user's original region, calling their callback whenever + * we see our current slice - ignoring padding. + * + * NB: we can assume meta_coords[] are normalized at this point + * since TextureRectangles aren't iterated with this code-path. + * + * NB: spans are always defined using non-normalized coordinates + */ + n_x_spans = setup_padded_spans (x_spans, + meta_coords[0] * data->width, + meta_coords[2] * data->width, + data->width, + &x_real_index); + n_y_spans = setup_padded_spans (y_spans, + meta_coords[1] * data->height, + meta_coords[3] * data->height, + data->height, + &y_real_index); + + data->padded_textures[n_x_spans * y_real_index + x_real_index] = + slice_texture; + + /* Our callback is going to be passed normalized slice texture + * coordinates, and we will need to map the range [0,1] to the real + * slice_texture_coords we have here... */ + data->grid_slice_texture_coords = slice_texture_coords; + data->slice_range_s = fabs (data->grid_slice_texture_coords[2] - + data->grid_slice_texture_coords[0]); + data->slice_range_t = fabs (data->grid_slice_texture_coords[3] - + data->grid_slice_texture_coords[1]); + data->slice_offset_s = MIN (data->grid_slice_texture_coords[0], + data->grid_slice_texture_coords[2]); + data->slice_offset_t = MIN (data->grid_slice_texture_coords[1], + data->grid_slice_texture_coords[3]); + + /* Now actually iterate the region the user originally requested + * using the current padded grid */ + _cogl_texture_spans_foreach_in_region (x_spans, + n_x_spans, + y_spans, + n_y_spans, + data->padded_textures, + data->meta_region_coords, + data->width, + data->height, + data->wrap_s, + data->wrap_t, + padded_grid_repeat_cb, + data); + + /* Clear the padded_textures ready for the next iteration */ + data->padded_textures[n_x_spans * y_real_index + x_real_index] = NULL; +} + +#define SWAP(A,B) do { float tmp = B; B = A; A = tmp; } while (0) + +typedef struct _ClampData +{ + float start; + float end; + CoglBool s_flipped; + CoglBool t_flipped; + CoglMetaTextureCallback callback; + void *user_data; +} ClampData; + +static void +clamp_s_cb (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data) +{ + ClampData *clamp_data = user_data; + float mapped_meta_coords[4] = { + clamp_data->start, + meta_coords[1], + clamp_data->end, + meta_coords[3] + }; + if (clamp_data->s_flipped) + SWAP (mapped_meta_coords[0], mapped_meta_coords[2]); + /* NB: we never need to flip the t coords when dealing with + * s-axis clamping so no need to check if ->t_flipped */ + clamp_data->callback (sub_texture, + sub_texture_coords, mapped_meta_coords, + clamp_data->user_data); +} + +static void +clamp_t_cb (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data) +{ + ClampData *clamp_data = user_data; + float mapped_meta_coords[4] = { + meta_coords[0], + clamp_data->start, + meta_coords[2], + clamp_data->end, + }; + if (clamp_data->s_flipped) + SWAP (mapped_meta_coords[0], mapped_meta_coords[2]); + if (clamp_data->t_flipped) + SWAP (mapped_meta_coords[1], mapped_meta_coords[3]); + clamp_data->callback (sub_texture, + sub_texture_coords, mapped_meta_coords, + clamp_data->user_data); +} + +static CoglBool +foreach_clamped_region (CoglMetaTexture *meta_texture, + float *tx_1, + float *ty_1, + float *tx_2, + float *ty_2, + CoglPipelineWrapMode wrap_s, + CoglPipelineWrapMode wrap_t, + CoglMetaTextureCallback callback, + void *user_data) +{ + float width = cogl_texture_get_width (COGL_TEXTURE (meta_texture)); + ClampData clamp_data; + + /* Consider that *tx_1 may be > *tx_2 and to simplify things + * we just flip them around if that's the case and keep a note + * of the fact that they are flipped. */ + if (*tx_1 > *tx_2) + { + SWAP (*tx_1, *tx_2); + clamp_data.s_flipped = TRUE; + } + else + clamp_data.s_flipped = FALSE; + + /* The same goes for ty_1 and ty_2... */ + if (*ty_1 > *ty_2) + { + SWAP (*ty_1, *ty_2); + clamp_data.t_flipped = TRUE; + } + else + clamp_data.t_flipped = FALSE; + + clamp_data.callback = callback; + clamp_data.user_data = user_data; + + if (wrap_s == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE) + { + float max_s_coord; + float half_texel_width; + + /* Consider that rectangle textures have non-normalized + * coordinates... */ + if (cogl_is_texture_rectangle (meta_texture)) + max_s_coord = width; + else + max_s_coord = 1.0; + + half_texel_width = max_s_coord / (width * 2); + + /* Handle any left clamped region */ + if (*tx_1 < 0) + { + clamp_data.start = *tx_1; + clamp_data.end = MIN (0, *tx_2);; + cogl_meta_texture_foreach_in_region (meta_texture, + half_texel_width, *ty_1, + half_texel_width, *ty_2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + wrap_t, + clamp_s_cb, + &clamp_data); + /* Have we handled everything? */ + if (*tx_2 <= 0) + return TRUE; + + /* clamp tx_1 since we've handled everything with x < 0 */ + *tx_1 = 0; + } + + /* Handle any right clamped region - including the corners */ + if (*tx_2 > max_s_coord) + { + clamp_data.start = MAX (max_s_coord, *tx_1); + clamp_data.end = *tx_2; + cogl_meta_texture_foreach_in_region (meta_texture, + max_s_coord - half_texel_width, + *ty_1, + max_s_coord - half_texel_width, + *ty_2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + wrap_t, + clamp_s_cb, + &clamp_data); + /* Have we handled everything? */ + if (*tx_1 >= max_s_coord) + return TRUE; + + /* clamp tx_2 since we've handled everything with x > + * max_s_coord */ + *tx_2 = max_s_coord; + } + } + + if (wrap_t == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE) + { + float height = cogl_texture_get_height (COGL_TEXTURE (meta_texture)); + float max_t_coord; + float half_texel_height; + + /* Consider that rectangle textures have non-normalized + * coordinates... */ + if (cogl_is_texture_rectangle (meta_texture)) + max_t_coord = height; + else + max_t_coord = 1.0; + + half_texel_height = max_t_coord / (height * 2); + + /* Handle any top clamped region */ + if (*ty_1 < 0) + { + clamp_data.start = *ty_1; + clamp_data.end = MIN (0, *ty_2);; + cogl_meta_texture_foreach_in_region (meta_texture, + *tx_1, half_texel_height, + *tx_2, half_texel_height, + wrap_s, + COGL_PIPELINE_WRAP_MODE_REPEAT, + clamp_t_cb, + &clamp_data); + /* Have we handled everything? */ + if (*tx_2 <= 0) + return TRUE; + + /* clamp ty_1 since we've handled everything with y < 0 */ + *ty_1 = 0; + } + + /* Handle any bottom clamped region */ + if (*ty_2 > max_t_coord) + { + clamp_data.start = MAX (max_t_coord, *ty_1);; + clamp_data.end = *ty_2; + cogl_meta_texture_foreach_in_region (meta_texture, + *tx_1, + max_t_coord - half_texel_height, + *tx_2, + max_t_coord - half_texel_height, + wrap_s, + COGL_PIPELINE_WRAP_MODE_REPEAT, + clamp_t_cb, + &clamp_data); + /* Have we handled everything? */ + if (*ty_1 >= max_t_coord) + return TRUE; + + /* clamp ty_2 since we've handled everything with y > + * max_t_coord */ + *ty_2 = max_t_coord; + } + } + + if (clamp_data.s_flipped) + SWAP (*tx_1, *tx_2); + if (clamp_data.t_flipped) + SWAP (*ty_1, *ty_2); + + return FALSE; +} + +typedef struct _NormalizeData +{ + CoglMetaTextureCallback callback; + void *user_data; + float s_normalize_factor; + float t_normalize_factor; +} NormalizeData; + +static void +normalize_meta_coords_cb (CoglTexture *slice_texture, + const float *slice_coords, + const float *meta_coords, + void *user_data) +{ + NormalizeData *data = user_data; + float normalized_meta_coords[4] = { + meta_coords[0] * data->s_normalize_factor, + meta_coords[1] * data->t_normalize_factor, + meta_coords[2] * data->s_normalize_factor, + meta_coords[3] * data->t_normalize_factor + }; + + data->callback (slice_texture, + slice_coords, normalized_meta_coords, + data->user_data); +} + +typedef struct _UnNormalizeData +{ + CoglMetaTextureCallback callback; + void *user_data; + float width; + float height; +} UnNormalizeData; + +static void +un_normalize_slice_coords_cb (CoglTexture *slice_texture, + const float *slice_coords, + const float *meta_coords, + void *user_data) +{ + UnNormalizeData *data = user_data; + float un_normalized_slice_coords[4] = { + slice_coords[0] * data->width, + slice_coords[1] * data->height, + slice_coords[2] * data->width, + slice_coords[3] * data->height + }; + + data->callback (slice_texture, + un_normalized_slice_coords, meta_coords, + data->user_data); +} + +void +cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture, + float tx_1, + float ty_1, + float tx_2, + float ty_2, + CoglPipelineWrapMode wrap_s, + CoglPipelineWrapMode wrap_t, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglTexture *texture = COGL_TEXTURE (meta_texture); + float width = cogl_texture_get_width (texture); + float height = cogl_texture_get_height (texture); + NormalizeData normalize_data; + + if (wrap_s == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_s = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + if (wrap_t == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_t = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + + if (wrap_s == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE || + wrap_t == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE) + { + CoglBool finished = foreach_clamped_region (meta_texture, + &tx_1, &ty_1, &tx_2, &ty_2, + wrap_s, wrap_t, + callback, + user_data); + if (finished) + return; + + /* Since clamping has been handled we now want to normalize our + * wrap modes we se can assume from this point on we don't + * need to consider CLAMP_TO_EDGE. (NB: The spans code will + * assert that CLAMP_TO_EDGE isn't requested) */ + if (wrap_s == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE) + wrap_s = COGL_PIPELINE_WRAP_MODE_REPEAT; + if (wrap_t == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE) + wrap_t = COGL_PIPELINE_WRAP_MODE_REPEAT; + } + + /* It makes things simpler to deal with non-normalized region + * coordinates beyond this point and only re-normalize just before + * calling the user's callback... */ + + if (!cogl_is_texture_rectangle (COGL_TEXTURE (meta_texture))) + { + normalize_data.callback = callback; + normalize_data.user_data = user_data; + normalize_data.s_normalize_factor = 1.0f / width; + normalize_data.t_normalize_factor = 1.0f / height; + callback = normalize_meta_coords_cb; + user_data = &normalize_data; + tx_1 *= width; + ty_1 *= height; + tx_2 *= width; + ty_2 *= height; + } + + /* XXX: at some point this wont be routed through the CoglTexture + * vtable, instead there will be a separate CoglMetaTexture + * interface vtable. */ + + if (texture->vtable->foreach_sub_texture_in_region) + { + ForeachData data; + + data.meta_region_coords[0] = tx_1; + data.meta_region_coords[1] = ty_1; + data.meta_region_coords[2] = tx_2; + data.meta_region_coords[3] = ty_2; + data.wrap_s = wrap_s; + data.wrap_t = wrap_t; + data.callback = callback; + data.user_data = user_data; + + data.width = width; + data.height = height; + + memset (data.padded_textures, 0, sizeof (data.padded_textures)); + + /* + * 1) We iterate all the slices of the meta-texture only within + * the range [0,1]. + * + * 2) We define a "padded grid" for each slice of the + * meta-texture in the range [0,1]. + * + * The padded grid maps over the meta-texture coordinates in + * the range [0,1] but only contains one valid cell that + * corresponds to current slice being iterated and all the + * surrounding cells just provide padding. + * + * 3) Once we've defined our padded grid we then repeat that + * across the user's original region, calling their callback + * whenever we see our current slice - ignoring padding. + * + * A notable benefit of this design is that repeating a texture + * made of multiple slices will result in us repeating each + * slice in-turn so the user gets repeat callbacks for the same + * texture batched together. For manual emulation of texture + * repeats done by drawing geometry this makes it more likely + * that we can batch geometry. + */ + + texture->vtable->foreach_sub_texture_in_region (texture, + 0, 0, 1, 1, + create_grid_and_repeat_cb, + &data); + } + else + { + CoglSpan x_span = { 0, width, 0 }; + CoglSpan y_span = { 0, height, 0 }; + float meta_region_coords[4] = { tx_1, ty_1, tx_2, ty_2 }; + UnNormalizeData un_normalize_data; + + /* If we are dealing with a CoglTextureRectangle then we need a shim + * callback that un_normalizes the slice coordinates we get from + * _cogl_texture_spans_foreach_in_region before passing them to + * the user's callback. */ + if (cogl_is_texture_rectangle (meta_texture)) + { + un_normalize_data.callback = callback; + un_normalize_data.user_data = user_data; + un_normalize_data.width = width; + un_normalize_data.height = height; + callback = un_normalize_slice_coords_cb; + user_data = &un_normalize_data; + } + + _cogl_texture_spans_foreach_in_region (&x_span, 1, + &y_span, 1, + &texture, + meta_region_coords, + width, + height, + wrap_s, + wrap_t, + callback, + user_data); + } +} +#undef SWAP diff --git a/cogl/cogl-meta-texture.h b/cogl/cogl-meta-texture.h new file mode 100644 index 0000000..69c8cb0 --- /dev/null +++ b/cogl/cogl-meta-texture.h @@ -0,0 +1,194 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_META_TEXTURE_H__ +#define __COGL_META_TEXTURE_H__ + +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-meta-texture + * @short_description: Interface for high-level textures built from + * low-level textures like #CoglTexture2D and + * #CoglTexture3D. + * + * Cogl helps to make it easy to deal with high level textures such + * as #CoglAtlasTextures, #CoglSubTextures, + * #CoglTexturePixmapX11 textures and #CoglTexture2DSliced textures + * consistently. + * + * A #CoglMetaTexture is a texture that might internally be + * represented by one or more low-level #CoglTextures + * such as #CoglTexture2D or #CoglTexture3D. These low-level textures + * are the only ones that a GPU really understands but because + * applications often want more high-level texture abstractions + * (such as storing multiple textures inside one larger "atlas" + * texture) it's desirable to be able to deal with these + * using a common interface. + * + * For example the GPU is not able to automatically handle repeating a + * texture that is part of a larger atlas texture but if you use + * %COGL_PIPELINE_WRAP_MODE_REPEAT with an atlas texture when drawing + * with cogl_rectangle() you should see that it "Just Works™" - at + * least if you don't use multi-texturing. The reason this works is + * because cogl_rectangle() internally understands the #CoglMetaTexture + * interface and is able to manually resolve the low-level textures + * using this interface and by making multiple draw calls it can + * emulate the texture repeat modes. + * + * Cogl doesn't aim to pretend that meta-textures are just like real + * textures because it would get extremely complex to try and emulate + * low-level GPU semantics transparently for these textures. The low + * level drawing APIs of Cogl, such as cogl_primitive_draw() don't + * actually know anything about the #CoglMetaTexture interface and its + * the developer's responsibility to resolve all textures referenced + * by a #CoglPipeline to low-level textures before drawing. + * + * If you want to develop custom primitive APIs like + * cogl_framebuffer_draw_rectangle() and you want to support drawing + * with #CoglAtlasTextures or #CoglSubTextures for + * example, then you will need to use this #CoglMetaTexture interface + * to be able to resolve high-level textures into low-level textures + * before drawing with Cogl's low-level drawing APIs such as + * cogl_primitive_draw(). + * + * Most developers won't need to use this interface directly + * but still it is worth understanding the distinction between + * low-level and meta textures because you may find other references + * in the documentation that detail limitations of using + * meta-textures. + */ + +#ifdef __COGL_H_INSIDE__ +/* For the public C api we typedef interface types as void to avoid needing + * lots of casting in code and instead we will rely on runtime type checking + * for these objects. */ +typedef void CoglMetaTexture; +#else +typedef struct _CoglMetaTexture CoglMetaTexture; +#define COGL_META_TEXTURE(X) ((CoglMetaTexture *)X) +#endif + +/** + * CoglMetaTextureCallback: + * @sub_texture: A low-level #CoglTexture making up part of a + * #CoglMetaTexture. + * @sub_texture_coords: A float 4-tuple ordered like + * (tx1,ty1,tx2,ty2) defining what region of the + * current @sub_texture maps to a sub-region of a + * #CoglMetaTexture. (tx1,ty1) is the top-left + * sub-region coordinate and (tx2,ty2) is the + * bottom-right. These are low-level texture + * coordinates. + * @meta_coords: A float 4-tuple ordered like (tx1,ty1,tx2,ty2) + * defining what sub-region of a #CoglMetaTexture this + * low-level @sub_texture maps too. (tx1,ty1) is + * the top-left sub-region coordinate and (tx2,ty2) is + * the bottom-right. These are high-level meta-texture + * coordinates. + * @user_data: A private pointer passed to + * cogl_meta_texture_foreach_in_region(). + * + * A callback used with cogl_meta_texture_foreach_in_region() to + * retrieve details of all the low-level #CoglTextures that + * make up a given #CoglMetaTexture. + * + * Since: 1.10 + * Stability: unstable + */ +typedef void (*CoglMetaTextureCallback) (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data); + +/** + * cogl_meta_texture_foreach_in_region: + * @meta_texture: An object implementing the #CoglMetaTexture + * interface. + * @tx_1: The top-left x coordinate of the region to iterate + * @ty_1: The top-left y coordinate of the region to iterate + * @tx_2: The bottom-right x coordinate of the region to iterate + * @ty_2: The bottom-right y coordinate of the region to iterate + * @wrap_s: The wrap mode for the x-axis + * @wrap_t: The wrap mode for the y-axis + * @callback: A #CoglMetaTextureCallback pointer to be called + * for each low-level texture within the specified region. + * @user_data: A private pointer that is passed to @callback. + * + * Allows you to manually iterate the low-level textures that define a + * given region of a high-level #CoglMetaTexture. + * + * For example cogl_texture_2d_sliced_new_with_size() can be used to + * create a meta texture that may slice a large image into multiple, + * smaller power-of-two sized textures. These high level textures are + * not directly understood by a GPU and so this API must be used to + * manually resolve the underlying textures for drawing. + * + * All high level textures (#CoglAtlasTexture, #CoglSubTexture, + * #CoglTexturePixmapX11, and #CoglTexture2DSliced) can be handled + * consistently using this interface which greately simplifies + * implementing primitives that support all texture types. + * + * For example if you use the cogl_rectangle() API then Cogl will + * internally use this API to resolve the low level textures of any + * meta textures you have associated with CoglPipeline layers. + * + * The low level drawing APIs such as cogl_primitive_draw() + * don't understand the #CoglMetaTexture interface and so it is your + * responsibility to use this API to resolve all CoglPipeline textures + * into low-level textures before drawing. + * + * For each low-level texture that makes up part of the given region + * of the @meta_texture, @callback is called specifying how the + * low-level texture maps to the original region. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture, + float tx_1, + float ty_1, + float tx_2, + float ty_2, + CoglPipelineWrapMode wrap_s, + CoglPipelineWrapMode wrap_t, + CoglMetaTextureCallback callback, + void *user_data); + +COGL_END_DECLS + +#endif /* __COGL_META_TEXTURE_H__ */ diff --git a/cogl/cogl-node-private.h b/cogl/cogl-node-private.h new file mode 100644 index 0000000..8fe2477 --- /dev/null +++ b/cogl/cogl-node-private.h @@ -0,0 +1,89 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_NODE_PRIVATE_H +#define __COGL_NODE_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-list.h" + +typedef struct _CoglNode CoglNode; + +/* Pipelines and layers represent their state in a tree structure where + * some of the state relating to a given pipeline or layer may actually + * be owned by one if is ancestors in the tree. We have a common data + * type to track the tree heirachy so we can share code... */ +struct _CoglNode +{ + /* the parent in terms of class hierarchy, so anything inheriting + * from CoglNode also inherits from CoglObject. */ + CoglObject _parent; + + /* The parent pipeline/layer */ + CoglNode *parent; + + /* The list entry here contains pointers to the node's siblings */ + CoglList link; + + /* List of children */ + CoglList children; + + /* TRUE if the node took a strong reference on its parent. Weak + * pipelines for instance don't take a reference on their parent. */ + CoglBool has_parent_reference; +}; + +#define COGL_NODE(X) ((CoglNode *)(X)) + +void +_cogl_pipeline_node_init (CoglNode *node); + +typedef void (*CoglNodeUnparentVFunc) (CoglNode *node); + +void +_cogl_pipeline_node_set_parent_real (CoglNode *node, + CoglNode *parent, + CoglNodeUnparentVFunc unparent, + CoglBool take_strong_reference); + +void +_cogl_pipeline_node_unparent_real (CoglNode *node); + +typedef CoglBool (*CoglNodeChildCallback) (CoglNode *child, void *user_data); + +void +_cogl_pipeline_node_foreach_child (CoglNode *node, + CoglNodeChildCallback callback, + void *user_data); + +#endif /* __COGL_NODE_PRIVATE_H */ diff --git a/cogl/cogl-node.c b/cogl/cogl-node.c new file mode 100644 index 0000000..60d3e73 --- /dev/null +++ b/cogl/cogl-node.c @@ -0,0 +1,110 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-node-private.h" + +void +_cogl_pipeline_node_init (CoglNode *node) +{ + node->parent = NULL; + _cogl_list_init (&node->children); +} + +void +_cogl_pipeline_node_set_parent_real (CoglNode *node, + CoglNode *parent, + CoglNodeUnparentVFunc unparent, + CoglBool take_strong_reference) +{ + /* NB: the old parent may indirectly be keeping the new parent alive + * so we have to ref the new parent before unrefing the old. + * + * Note: we take a reference here regardless of + * take_strong_reference because weak children may need special + * handling when the parent disposes itself which relies on a + * consistent link to all weak nodes. Once the node is linked to its + * parent then we remove the reference at the end if + * take_strong_reference == FALSE. */ + cogl_object_ref (parent); + + if (node->parent) + unparent (node); + + _cogl_list_insert (&parent->children, &node->link); + + node->parent = parent; + node->has_parent_reference = take_strong_reference; + + /* Now that there is a consistent parent->child link we can remove + * the parent reference if no reference was requested. If it turns + * out that the new parent was only being kept alive by the old + * parent then it will be disposed of here. */ + if (!take_strong_reference) + cogl_object_unref (parent); +} + +void +_cogl_pipeline_node_unparent_real (CoglNode *node) +{ + CoglNode *parent = node->parent; + + if (parent == NULL) + return; + + _COGL_RETURN_IF_FAIL (!_cogl_list_empty (&parent->children)); + + _cogl_list_remove (&node->link); + + if (node->has_parent_reference) + cogl_object_unref (parent); + + node->parent = NULL; +} + +void +_cogl_pipeline_node_foreach_child (CoglNode *node, + CoglNodeChildCallback callback, + void *user_data) +{ + CoglNode *child, *next; + + _cogl_list_for_each_safe (child, next, &node->children, link) + callback (child, user_data); +} + + diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h new file mode 100644 index 0000000..7955a35 --- /dev/null +++ b/cogl/cogl-object-private.h @@ -0,0 +1,323 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_OBJECT_PRIVATE_H +#define __COGL_OBJECT_PRIVATE_H + +#include + +#include "cogl-types.h" +#include "cogl-object.h" +#include "cogl-debug.h" + +/* For compatability until all components have been converted */ +typedef struct _CoglObjectClass CoglHandleClass; +typedef struct _CoglObject CoglHandleObject; + +/* XXX: sadly we didn't fully consider when we copied the cairo API + * for _set_user_data that the callback doesn't get a pointer to the + * instance which is desired in most cases. This means you tend to end + * up creating micro allocations for the private data just so you can + * pair up the data of interest with the original instance for + * identification when it is later destroyed. + * + * Internally we use a small hack to avoid needing these micro + * allocations by actually passing the instance as a second argument + * to the callback */ +typedef void (*CoglUserDataDestroyInternalCallback) (void *user_data, + void *instance); + +typedef struct _CoglObjectClass +{ +#ifdef COGL_HAS_GTYPE_SUPPORT + GTypeClass base_class; +#endif + const char *name; + void *virt_free; + void *virt_unref; +} CoglObjectClass; + +#define COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES 2 + +typedef struct +{ + CoglUserDataKey *key; + void *user_data; + CoglUserDataDestroyInternalCallback destroy; +} CoglUserDataEntry; + +/* All Cogl objects inherit from this base object by adding a member: + * + * CoglObject _parent; + * + * at the top of its main structure. This structure is initialized + * when you call _cogl_#type_name#_object_new (new_object); + */ +struct _CoglObject +{ + CoglObjectClass *klass; /* equivalent to GTypeInstance */ + + CoglUserDataEntry user_data_entry[ + COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES]; + GArray *user_data_array; + int n_user_data_entries; + + unsigned int ref_count; +}; + +/* Helper macro to encapsulate the common code for COGL reference + counted objects */ + +#ifdef COGL_OBJECT_DEBUG + +#define _COGL_OBJECT_DEBUG_NEW(type_name, obj) \ + COGL_NOTE (OBJECT, "COGL " G_STRINGIFY (type_name) " NEW %p %i", \ + (obj), (obj)->ref_count) + +#define _COGL_OBJECT_DEBUG_REF(type_name, object) G_STMT_START { \ + CoglObject *__obj = (CoglObject *)object; \ + COGL_NOTE (OBJECT, "COGL %s REF %p %i", \ + (__obj)->klass->name, \ + (__obj), (__obj)->ref_count); } G_STMT_END + +#define _COGL_OBJECT_DEBUG_UNREF(type_name, object) G_STMT_START { \ + CoglObject *__obj = (CoglObject *)object; \ + COGL_NOTE (OBJECT, "COGL %s UNREF %p %i", \ + (__obj)->klass->name, \ + (__obj), (__obj)->ref_count - 1); } G_STMT_END + +#define COGL_OBJECT_DEBUG_FREE(obj) \ + COGL_NOTE (OBJECT, "COGL %s FREE %p", \ + (obj)->klass->name, (obj)) + +#else /* !COGL_OBJECT_DEBUG */ + +#define _COGL_OBJECT_DEBUG_NEW(type_name, obj) +#define _COGL_OBJECT_DEBUG_REF(type_name, obj) +#define _COGL_OBJECT_DEBUG_UNREF(type_name, obj) +#define COGL_OBJECT_DEBUG_FREE(obj) + +#endif /* COGL_OBJECT_DEBUG */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +#define _COGL_GTYPE_INIT_CLASS(type_name) do { \ + _cogl_##type_name##_class.base_class.g_type = cogl_##type_name##_get_gtype (); \ +} while (0) +#else +#define _COGL_GTYPE_INIT_CLASS(type_name) +#endif + +#define COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +CoglObjectClass _cogl_##type_name##_class; \ +static unsigned long _cogl_object_##type_name##_count; \ + \ +static inline void \ +_cogl_object_##type_name##_inc (void) \ +{ \ + _cogl_object_##type_name##_count++; \ +} \ + \ +static inline void \ +_cogl_object_##type_name##_dec (void) \ +{ \ + _cogl_object_##type_name##_count--; \ +} \ + \ +static void \ +_cogl_object_##type_name##_indirect_free (CoglObject *obj) \ +{ \ + _cogl_##type_name##_free ((Cogl##TypeName *) obj); \ + _cogl_object_##type_name##_dec (); \ +} \ + \ +static void \ +_cogl_object_##type_name##_class_init (void) \ +{ \ + _cogl_object_##type_name##_count = 0; \ + \ + if (_cogl_debug_instances == NULL) \ + _cogl_debug_instances = \ + g_hash_table_new (g_str_hash, g_str_equal); \ + \ + _cogl_##type_name##_class.virt_free = \ + _cogl_object_##type_name##_indirect_free; \ + _cogl_##type_name##_class.virt_unref = \ + _cogl_object_default_unref; \ + _cogl_##type_name##_class.name = "Cogl"#TypeName; \ + \ + g_hash_table_insert (_cogl_debug_instances, \ + (void *) _cogl_##type_name##_class.name, \ + &_cogl_object_##type_name##_count); \ + \ + { code; } \ +} \ + \ +static Cogl##TypeName * \ +_cogl_##type_name##_object_new (Cogl##TypeName *new_obj) \ +{ \ + CoglObject *obj = (CoglObject *)&new_obj->_parent; \ + obj->ref_count = 0; \ + cogl_object_ref (obj); \ + obj->n_user_data_entries = 0; \ + obj->user_data_array = NULL; \ + \ + obj->klass = &_cogl_##type_name##_class; \ + if (!obj->klass->virt_free) \ + { \ + _cogl_object_##type_name##_class_init (); \ + } \ + \ + _cogl_object_##type_name##_inc (); \ + _COGL_OBJECT_DEBUG_NEW (TypeName, obj); \ + return new_obj; \ +} + +#define COGL_OBJECT_DEFINE_WITH_CODE_GTYPE(TypeName, type_name, code) \ + \ +COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, \ + type_name, \ + do { code; } while (0); \ + _COGL_GTYPE_INIT_CLASS (type_name)) \ + \ +CoglBool \ +cogl_is_##type_name (void *object) \ +{ \ + CoglObject *obj = object; \ + \ + if (object == NULL) \ + return FALSE; \ + \ + return obj->klass == &_cogl_##type_name##_class; \ +} + +#define COGL_OBJECT_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +CoglBool \ +cogl_is_##type_name (void *object) \ +{ \ + CoglObject *obj = object; \ + \ + if (object == NULL) \ + return FALSE; \ + \ + return obj->klass == &_cogl_##type_name##_class; \ +} + +#define COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +CoglBool \ +_cogl_is_##type_name (void *object) \ +{ \ + CoglObject *obj = object; \ + \ + if (object == NULL) \ + return FALSE; \ + \ + return obj->klass == &_cogl_##type_name##_class; \ +} + +#define COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING(type_name) \ + \ +void * G_GNUC_DEPRECATED \ +cogl_##type_name##_ref (void *object) \ +{ \ + if (!cogl_is_##type_name (object)) \ + return NULL; \ + \ + _COGL_OBJECT_DEBUG_REF (TypeName, object); \ + \ + cogl_handle_ref (object); \ + \ + return object; \ +} \ + \ +void G_GNUC_DEPRECATED \ +cogl_##type_name##_unref (void *object) \ +{ \ + if (!cogl_is_##type_name (object)) \ + { \ + g_warning (G_STRINGIFY (cogl_##type_name##_unref) \ + ": Ignoring unref of Cogl handle " \ + "due to type mismatch"); \ + return; \ + } \ + \ + _COGL_OBJECT_DEBUG_UNREF (TypeName, object); \ + \ + cogl_handle_unref (object); \ +} + +#define COGL_OBJECT_DEFINE(TypeName, type_name) \ + COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (TypeName, type_name, (void) 0) + +#define COGL_OBJECT_INTERNAL_DEFINE(TypeName, type_name) \ + COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE (TypeName, type_name, (void) 0) + +/* For temporary compatability */ +#define COGL_HANDLE_INTERNAL_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE (TypeName, type_name, code) \ + \ +static Cogl##TypeName * \ +_cogl_##type_name##_handle_new (CoglHandle handle) \ +{ \ + return _cogl_##type_name##_object_new (handle); \ +} + +#define COGL_HANDLE_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +COGL_OBJECT_DEFINE_WITH_CODE (TypeName, type_name, code) \ + \ +static Cogl##TypeName * \ +_cogl_##type_name##_handle_new (CoglHandle handle) \ +{ \ + return _cogl_##type_name##_object_new (handle); \ +} + +#define COGL_HANDLE_DEFINE(TypeName, type_name) \ + COGL_HANDLE_DEFINE_WITH_CODE (TypeName, type_name, (void) 0) + +void +_cogl_object_set_user_data (CoglObject *object, + CoglUserDataKey *key, + void *user_data, + CoglUserDataDestroyInternalCallback destroy); + +void +_cogl_object_default_unref (void *obj); + +#endif /* __COGL_OBJECT_PRIVATE_H */ + diff --git a/cogl/cogl-object.c b/cogl/cogl-object.c new file mode 100644 index 0000000..452f625 --- /dev/null +++ b/cogl/cogl-object.c @@ -0,0 +1,304 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-util.h" +#include "cogl-types.h" +#include "cogl-object-private.h" +#include "cogl-gtype-private.h" + +COGL_GTYPE_DEFINE_BASE_CLASS (Object, object); + +void * +cogl_object_ref (void *object) +{ + CoglObject *obj = object; + + _COGL_RETURN_VAL_IF_FAIL (object != NULL, NULL); + + obj->ref_count++; + return object; +} + +CoglHandle +cogl_handle_ref (CoglHandle handle) +{ + return cogl_object_ref (handle); +} + +void +_cogl_object_default_unref (void *object) +{ + CoglObject *obj = object; + + _COGL_RETURN_IF_FAIL (object != NULL); + _COGL_RETURN_IF_FAIL (obj->ref_count > 0); + + if (--obj->ref_count < 1) + { + void (*free_func)(void *obj); + + if (obj->n_user_data_entries) + { + int i; + int count = MIN (obj->n_user_data_entries, + COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES); + + for (i = 0; i < count; i++) + { + CoglUserDataEntry *entry = &obj->user_data_entry[i]; + if (entry->destroy) + entry->destroy (entry->user_data, obj); + } + + if (obj->user_data_array != NULL) + { + for (i = 0; i < obj->user_data_array->len; i++) + { + CoglUserDataEntry *entry = + &g_array_index (obj->user_data_array, + CoglUserDataEntry, i); + + if (entry->destroy) + entry->destroy (entry->user_data, obj); + } + g_array_free (obj->user_data_array, TRUE); + } + } + + COGL_OBJECT_DEBUG_FREE (obj); + free_func = obj->klass->virt_free; + free_func (obj); + } +} + +void +cogl_object_unref (void *obj) +{ + void (* unref_func) (void *) = ((CoglObject *) obj)->klass->virt_unref; + unref_func (obj); +} + +void +cogl_handle_unref (CoglHandle handle) +{ + cogl_object_unref (handle); +} + +GType +cogl_handle_get_type (void) +{ + static GType our_type = 0; + + /* XXX: We are keeping the "CoglHandle" name for now incase it would + * break bindings to change to "CoglObject" */ + if (G_UNLIKELY (our_type == 0)) + our_type = g_boxed_type_register_static (g_intern_static_string ("CoglHandle"), + (GBoxedCopyFunc) cogl_object_ref, + (GBoxedFreeFunc) cogl_object_unref); + + return our_type; +} + +/* XXX: Unlike for cogl_object_get_user_data this code will return + * an empty entry if available and no entry for the given key can be + * found. */ +static CoglUserDataEntry * +_cogl_object_find_entry (CoglObject *object, CoglUserDataKey *key) +{ + CoglUserDataEntry *entry = NULL; + int count; + int i; + + count = MIN (object->n_user_data_entries, + COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES); + + for (i = 0; i < count; i++) + { + CoglUserDataEntry *current = &object->user_data_entry[i]; + if (current->key == key) + return current; + if (current->user_data == NULL) + entry = current; + } + + if (G_UNLIKELY (object->user_data_array != NULL)) + { + for (i = 0; i < object->user_data_array->len; i++) + { + CoglUserDataEntry *current = + &g_array_index (object->user_data_array, CoglUserDataEntry, i); + + if (current->key == key) + return current; + if (current->user_data == NULL) + entry = current; + } + } + + return entry; +} + +void +_cogl_object_set_user_data (CoglObject *object, + CoglUserDataKey *key, + void *user_data, + CoglUserDataDestroyInternalCallback destroy) +{ + CoglUserDataEntry new_entry; + CoglUserDataEntry *entry; + + if (user_data) + { + new_entry.key = key; + new_entry.user_data = user_data; + new_entry.destroy = destroy; + } + else + memset (&new_entry, 0, sizeof (new_entry)); + + entry = _cogl_object_find_entry (object, key); + if (entry) + { + if (G_LIKELY (entry->destroy)) + entry->destroy (entry->user_data, object); + } + else + { + /* NB: Setting a value of NULL is documented to delete the + * corresponding entry so we can return immediately in this + * case. */ + if (user_data == NULL) + return; + + if (G_LIKELY (object->n_user_data_entries < + COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES)) + entry = &object->user_data_entry[object->n_user_data_entries++]; + else + { + if (G_UNLIKELY (object->user_data_array == NULL)) + { + object->user_data_array = + g_array_new (FALSE, FALSE, sizeof (CoglUserDataEntry)); + } + + g_array_set_size (object->user_data_array, + object->user_data_array->len + 1); + entry = + &g_array_index (object->user_data_array, CoglUserDataEntry, + object->user_data_array->len - 1); + + object->n_user_data_entries++; + } + } + + *entry = new_entry; +} + +void +cogl_object_set_user_data (CoglObject *object, + CoglUserDataKey *key, + void *user_data, + CoglUserDataDestroyCallback destroy) +{ + _cogl_object_set_user_data (object, key, user_data, + (CoglUserDataDestroyInternalCallback)destroy); +} + +void * +cogl_object_get_user_data (CoglObject *object, CoglUserDataKey *key) +{ + int count; + int i; + + count = MIN (object->n_user_data_entries, + COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES); + + for (i = 0; i < count; i++) + { + CoglUserDataEntry *entry = &object->user_data_entry[i]; + if (entry->key == key) + return entry->user_data; + } + + if (object->user_data_array != NULL) + { + for (i = 0; i < object->user_data_array->len; i++) + { + CoglUserDataEntry *entry = + &g_array_index (object->user_data_array, CoglUserDataEntry, i); + + if (entry->key == key) + return entry->user_data; + } + } + + return NULL; +} + +void +cogl_debug_object_foreach_type (CoglDebugObjectForeachTypeCallback func, + void *user_data) +{ + GHashTableIter iter; + unsigned long *instance_count; + CoglDebugObjectTypeInfo info; + + g_hash_table_iter_init (&iter, _cogl_debug_instances); + while (g_hash_table_iter_next (&iter, + (void *) &info.name, + (void *) &instance_count)) + { + info.instance_count = *instance_count; + func (&info, user_data); + } +} + +static void +print_instances_cb (const CoglDebugObjectTypeInfo *info, + void *user_data) +{ + g_print ("\t%s: %lu\n", info->name, info->instance_count); +} + +void +cogl_debug_object_print_instances (void) +{ + g_print ("Cogl instances:\n"); + + cogl_debug_object_foreach_type (print_instances_cb, NULL); +} diff --git a/cogl/cogl-object.h b/cogl/cogl-object.h new file mode 100644 index 0000000..a0bed88 --- /dev/null +++ b/cogl/cogl-object.h @@ -0,0 +1,251 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_OBJECT_H +#define __COGL_OBJECT_H + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +typedef struct _CoglObject CoglObject; + +#define COGL_OBJECT(X) ((CoglObject *)X) + +/** + * CoglObject: + * + * Ref Func: cogl_object_ref + * Unref Func: cogl_object_unref + * Set Value Func: cogl_object_value_set_object + * Get Value Func: cogl_object_value_get_object + */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_object_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_object_get_gtype (void); +#endif + +/** + * cogl_object_ref: (skip) + * @object: a #CoglObject + * + * Increases the reference count of @object by 1 + * + * Returns: the @object, with its reference count increased + */ +void * +cogl_object_ref (void *object); + +/** + * cogl_object_unref: (skip) + * @object: a #CoglObject + * + * Drecreases the reference count of @object by 1; if the reference + * count reaches 0, the resources allocated by @object will be freed + */ +void +cogl_object_unref (void *object); + +/** + * CoglUserDataKey: + * @unused: ignored. + * + * A #CoglUserDataKey is used to declare a key for attaching data to a + * #CoglObject using cogl_object_set_user_data. The typedef only exists as a + * formality to make code self documenting since only the unique address of a + * #CoglUserDataKey is used. + * + * Typically you would declare a static #CoglUserDataKey and set private data + * on an object something like this: + * + * |[ + * static CoglUserDataKey path_private_key; + * + * static void + * destroy_path_private_cb (void *data) + * { + * g_free (data); + * } + * + * static void + * my_path_set_data (CoglPath *path, void *data) + * { + * cogl_object_set_user_data (COGL_OBJECT (path), + * &private_key, + * data, + * destroy_path_private_cb); + * } + * ]| + * + * Since: 1.4 + */ +typedef struct { + int unused; +} CoglUserDataKey; + +/** + * CoglUserDataDestroyCallback: + * @user_data: The data whos association with a #CoglObject has been + * destoyed. + * + * When associating private data with a #CoglObject a callback can be + * given which will be called either if the object is destroyed or if + * cogl_object_set_user_data() is called with NULL user_data for the + * same key. + * + * Since: 1.4 + */ +#ifdef COGL_HAS_GTYPE_SUPPORT +typedef GDestroyNotify CoglUserDataDestroyCallback; +#else +typedef void (*CoglUserDataDestroyCallback) (void *user_data); +#endif + +/** + * CoglDebugObjectTypeInfo: + * @name: A human readable name for the type. + * @instance_count: The number of objects of this type that are + * currently in use + * + * This struct is used to pass information to the callback when + * cogl_debug_object_foreach_type() is called. + * + * Since: 1.8 + * Stability: unstable + */ +typedef struct { + const char *name; + unsigned long instance_count; +} CoglDebugObjectTypeInfo; + +/** + * CoglDebugObjectForeachTypeCallback: + * @info: A pointer to a struct containing information about the type. + * + * A callback function to use for cogl_debug_object_foreach_type(). + * + * Since: 1.8 + * Stability: unstable + */ +typedef void +(* CoglDebugObjectForeachTypeCallback) (const CoglDebugObjectTypeInfo *info, + void *user_data); + +/** + * cogl_object_set_user_data: (skip) + * @object: The object to associate private data with + * @key: The address of a #CoglUserDataKey which provides a unique value + * with which to index the private data. + * @user_data: The data to associate with the given object, + * or %NULL to remove a previous association. + * @destroy: A #CoglUserDataDestroyCallback to call if the object is + * destroyed or if the association is removed by later setting + * %NULL data for the same key. + * + * Associates some private @user_data with a given #CoglObject. To + * later remove the association call cogl_object_set_user_data() with + * the same @key but NULL for the @user_data. + * + * Since: 1.4 + */ +void +cogl_object_set_user_data (CoglObject *object, + CoglUserDataKey *key, + void *user_data, + CoglUserDataDestroyCallback destroy); + +/** + * cogl_object_get_user_data: (skip) + * @object: The object with associated private data to query + * @key: The address of a #CoglUserDataKey which provides a unique value + * with which to index the private data. + * + * Finds the user data previously associated with @object using + * the given @key. If no user data has been associated with @object + * for the given @key this function returns NULL. + * + * Returns: (transfer none): The user data previously associated + * with @object using the given @key; or %NULL if no associated + * data is found. + * + * Since: 1.4 + */ +void * +cogl_object_get_user_data (CoglObject *object, + CoglUserDataKey *key); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * cogl_debug_object_foreach_type: + * @func: (scope call): A callback function for each type + * @user_data: (closure): A pointer to pass to @func + * + * Invokes @func once for each type of object that Cogl uses and + * passes a count of the number of objects for that type. This is + * intended to be used solely for debugging purposes to track down + * issues with objects leaking. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_debug_object_foreach_type (CoglDebugObjectForeachTypeCallback func, + void *user_data); + +/** + * cogl_debug_object_print_instances: + * + * Prints a list of all the object types that Cogl uses along with the + * number of objects of that type that are currently in use. This is + * intended to be used solely for debugging purposes to track down + * issues with objects leaking. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_debug_object_print_instances (void); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +#endif /* __COGL_OBJECT_H */ + diff --git a/cogl/cogl-offscreen.h b/cogl/cogl-offscreen.h new file mode 100644 index 0000000..9c84442 --- /dev/null +++ b/cogl/cogl-offscreen.h @@ -0,0 +1,172 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_OFFSCREEN_H__ +#define __COGL_OFFSCREEN_H__ + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-offscreen + * @short_description: Functions for creating and manipulating offscreen + * framebuffers. + * + * Cogl allows creating and operating on offscreen framebuffers. + */ + +typedef struct _CoglOffscreen CoglOffscreen; + +#define COGL_OFFSCREEN(X) ((CoglOffscreen *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_offscreen_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_offscreen_get_gtype (void); +#endif + +/* Offscreen api */ + +/** + * cogl_offscreen_new_with_texture: + * @texture: A #CoglTexture pointer + * + * This creates an offscreen framebuffer object using the given + * @texture as the primary color buffer. It doesn't just initialize + * the contents of the offscreen buffer with the @texture; they are + * tightly bound so that drawing to the offscreen buffer effectively + * updates the contents of the given texture. You don't need to + * destroy the offscreen buffer before you can use the @texture again. + * + * This api only works with low-level #CoglTexture types such as + * #CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not + * with meta-texture types such as #CoglTexture2DSliced. + * + * The storage for the framebuffer is actually allocated lazily + * so this function will never return %NULL to indicate a runtime + * error. This means it is still possible to configure the framebuffer + * before it is really allocated. + * + * Simple applications without full error handling can simply rely on + * Cogl to lazily allocate the storage of framebuffers but you should + * be aware that if Cogl encounters an error (such as running out of + * GPU memory) then your application will simply abort with an error + * message. If you need to be able to catch such exceptions at runtime + * then you can explicitly allocate your framebuffer when you have + * finished configuring it by calling cogl_framebuffer_allocate() and + * passing in a #CoglError argument to catch any exceptions. + * + * Return value: (transfer full): a newly instantiated #CoglOffscreen + * framebuffer. + */ +CoglOffscreen * +cogl_offscreen_new_with_texture (CoglTexture *texture); + +/** + * cogl_offscreen_new_to_texture: + * @texture: A #CoglTexture pointer + * + * This creates an offscreen buffer object using the given @texture as the + * primary color buffer. It doesn't just initialize the contents of the + * offscreen buffer with the @texture; they are tightly bound so that + * drawing to the offscreen buffer effectivly updates the contents of the + * given texture. You don't need to destroy the offscreen buffer before + * you can use the @texture again. + * + * This only works with low-level #CoglTexture types such as + * #CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not + * with meta-texture types such as #CoglTexture2DSliced. + * + * Return value: (transfer full): a newly instantiated #CoglOffscreen + * framebuffer or %NULL if it wasn't possible to create the + * buffer. + * Deprecated: 1.16: Use cogl_offscreen_new_with_texture instead. + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_offscreen_new_with_texture) +CoglOffscreen * +cogl_offscreen_new_to_texture (CoglTexture *texture); + +/** + * cogl_is_offscreen: + * @object: A pointer to a #CoglObject + * + * Determines whether the given #CoglObject references an offscreen + * framebuffer object. + * + * Returns: %TRUE if @object is a #CoglOffscreen framebuffer, + * %FALSE otherwise + */ +CoglBool +cogl_is_offscreen (void *object); + +/** + * cogl_offscreen_ref: + * @offscreen: A pointer to a #CoglOffscreen framebuffer + * + * Increments the reference count on the @offscreen framebuffer. + * + * Return value: (transfer none): For convenience it returns the + * given @offscreen + * + * Deprecated: 1.2: cogl_object_ref() should be used in new code. + */ +COGL_DEPRECATED_FOR (cogl_object_ref) +void * +cogl_offscreen_ref (void *offscreen); + +/** + * cogl_offscreen_unref: + * @offscreen: A pointer to a #CoglOffscreen framebuffer + * + * Decreases the reference count for the @offscreen buffer and frees it when + * the count reaches 0. + * + * Deprecated: 1.2: cogl_object_unref() should be used in new code. + */ +COGL_DEPRECATED_FOR (cogl_object_unref) +void +cogl_offscreen_unref (void *offscreen); + +COGL_END_DECLS + +#endif /* __COGL_OFFSCREEN_H__ */ diff --git a/cogl/cogl-onscreen-private.h b/cogl/cogl-onscreen-private.h new file mode 100644 index 0000000..b30aeb9 --- /dev/null +++ b/cogl/cogl-onscreen-private.h @@ -0,0 +1,127 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_ONSCREEN_PRIVATE_H +#define __COGL_ONSCREEN_PRIVATE_H + +#include "cogl-onscreen.h" +#include "cogl-framebuffer-private.h" +#include "cogl-closure-list-private.h" +#include "cogl-list.h" + +#include + +#ifdef COGL_HAS_WIN32_SUPPORT +#include +#endif + +typedef struct _CoglOnscreenEvent +{ + CoglList link; + + CoglOnscreen *onscreen; + CoglFrameInfo *info; + CoglFrameEvent type; +} CoglOnscreenEvent; + +typedef struct _CoglOnscreenQueuedDirty +{ + CoglList link; + + CoglOnscreen *onscreen; + CoglOnscreenDirtyInfo info; +} CoglOnscreenQueuedDirty; + +struct _CoglOnscreen +{ + CoglFramebuffer _parent; + +#ifdef COGL_HAS_X11_SUPPORT + uint32_t foreign_xid; + CoglOnscreenX11MaskCallback foreign_update_mask_callback; + void *foreign_update_mask_data; +#endif + +#ifdef COGL_HAS_WIN32_SUPPORT + HWND foreign_hwnd; +#endif + +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT + struct wl_surface *foreign_surface; +#endif + + CoglBool swap_throttled; + + CoglList frame_closures; + + CoglBool resizable; + CoglList resize_closures; + + CoglList dirty_closures; + + int64_t frame_counter; + int64_t swap_frame_counter; /* frame counter at last all to + * cogl_onscreen_swap_region() or + * cogl_onscreen_swap_buffers() */ + GQueue pending_frame_infos; + + void *winsys; +}; + +CoglOnscreen * +_cogl_onscreen_new (void); + +void +_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer, + int width, int height); + +void +_cogl_onscreen_queue_event (CoglOnscreen *onscreen, + CoglFrameEvent type, + CoglFrameInfo *info); + +void +_cogl_onscreen_notify_frame_sync (CoglOnscreen *onscreen, CoglFrameInfo *info); + +void +_cogl_onscreen_notify_complete (CoglOnscreen *onscreen, CoglFrameInfo *info); + +void +_cogl_onscreen_notify_resize (CoglOnscreen *onscreen); + +void +_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info); + + +void +_cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen); + +#endif /* __COGL_ONSCREEN_PRIVATE_H */ diff --git a/cogl/cogl-onscreen-template-private.h b/cogl/cogl-onscreen-template-private.h new file mode 100644 index 0000000..1b19d35 --- /dev/null +++ b/cogl/cogl-onscreen-template-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_ONSCREEN_TEMPLATE_PRIVATE_H +#define __COGL_ONSCREEN_TEMPLATE_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-swap-chain.h" +#include "cogl-framebuffer-private.h" + +struct _CoglOnscreenTemplate +{ + CoglObject _parent; + + CoglFramebufferConfig config; +}; + +#endif /* __COGL_ONSCREEN_TEMPLATE_PRIVATE_H */ diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c new file mode 100644 index 0000000..5a5e54c --- /dev/null +++ b/cogl/cogl-onscreen-template.c @@ -0,0 +1,97 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object.h" + +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-gtype-private.h" + +#include + +static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template); + +COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template); +COGL_GTYPE_DEFINE_CLASS (OnscreenTemplate, onscreen_template); + +static void +_cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template) +{ + g_slice_free (CoglOnscreenTemplate, onscreen_template); +} + +CoglOnscreenTemplate * +cogl_onscreen_template_new (CoglSwapChain *swap_chain) +{ + CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate); + char *user_config; + + onscreen_template->config.swap_chain = swap_chain; + if (swap_chain) + cogl_object_ref (swap_chain); + else + onscreen_template->config.swap_chain = cogl_swap_chain_new (); + + onscreen_template->config.swap_throttled = TRUE; + onscreen_template->config.need_stencil = TRUE; + onscreen_template->config.samples_per_pixel = 0; + + user_config = getenv ("COGL_POINT_SAMPLES_PER_PIXEL"); + if (user_config) + { + unsigned long samples_per_pixel = strtoul (user_config, NULL, 10); + if (samples_per_pixel != ULONG_MAX) + onscreen_template->config.samples_per_pixel = + samples_per_pixel; + } + + return _cogl_onscreen_template_object_new (onscreen_template); +} + +void +cogl_onscreen_template_set_samples_per_pixel ( + CoglOnscreenTemplate *onscreen_template, + int samples_per_pixel) +{ + onscreen_template->config.samples_per_pixel = samples_per_pixel; +} + +void +cogl_onscreen_template_set_swap_throttled ( + CoglOnscreenTemplate *onscreen_template, + CoglBool throttled) +{ + onscreen_template->config.swap_throttled = throttled; +} diff --git a/cogl/cogl-onscreen-template.h b/cogl/cogl-onscreen-template.h new file mode 100644 index 0000000..cd1d853 --- /dev/null +++ b/cogl/cogl-onscreen-template.h @@ -0,0 +1,125 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ONSCREEN_TEMPLATE_H__ +#define __COGL_ONSCREEN_TEMPLATE_H__ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate; + +#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_onscreen_template_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_onscreen_template_get_gtype (void); +#endif + +CoglOnscreenTemplate * +cogl_onscreen_template_new (CoglSwapChain *swap_chain); + +/** + * cogl_onscreen_template_set_samples_per_pixel: + * @onscreen_template: A #CoglOnscreenTemplate template framebuffer + * @n: The minimum number of samples per pixel + * + * Requires that any future CoglOnscreen framebuffers derived from + * this template must support making at least @n samples per pixel + * which will all contribute to the final resolved color for that + * pixel. + * + * By default this value is usually set to 0 and that is referred to + * as "single-sample" rendering. A value of 1 or greater is referred + * to as "multisample" rendering. + * + * There are some semantic differences between single-sample + * rendering and multisampling with just 1 point sample such as it + * being redundant to use the cogl_framebuffer_resolve_samples() and + * cogl_framebuffer_resolve_samples_region() apis with single-sample + * rendering. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_onscreen_template_set_samples_per_pixel ( + CoglOnscreenTemplate *onscreen_template, + int n); + +/** + * cogl_onscreen_template_set_swap_throttled: + * @onscreen_template: A #CoglOnscreenTemplate template framebuffer + * @throttled: Whether throttling should be enabled + * + * Requests that any future #CoglOnscreen framebuffers derived from this + * template should enable or disable swap throttling according to the given + * @throttled argument. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_onscreen_template_set_swap_throttled ( + CoglOnscreenTemplate *onscreen_template, + CoglBool throttled); + +/** + * cogl_is_onscreen_template: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglOnscreenTemplate. + * + * Return value: %TRUE if the object references a #CoglOnscreenTemplate + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_onscreen_template (void *object); + +COGL_END_DECLS + +#endif /* __COGL_ONSCREEN_TEMPLATE_H__ */ diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c new file mode 100644 index 0000000..4768509 --- /dev/null +++ b/cogl/cogl-onscreen.c @@ -0,0 +1,746 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-onscreen-private.h" +#include "cogl-frame-info-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl1-context.h" +#include "cogl-closure-list-private.h" +#include "cogl-poll-private.h" +#include "cogl-gtype-private.h" + +static void _cogl_onscreen_free (CoglOnscreen *onscreen); + +COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Onscreen, onscreen, + _cogl_onscreen_class.virt_unref = + _cogl_framebuffer_unref); +COGL_GTYPE_DEFINE_CLASS (Onscreen, onscreen, + COGL_GTYPE_IMPLEMENT_INTERFACE (framebuffer)); + +static gpointer +cogl_dummy_copy (gpointer data) +{ + return data; +} + +static void +cogl_dummy_free (gpointer data) +{ +} + +COGL_GTYPE_DEFINE_BOXED (FrameClosure, frame_closure, + cogl_dummy_copy, + cogl_dummy_free); +COGL_GTYPE_DEFINE_BOXED (OnscreenResizeClosure, + onscreen_resize_closure, + cogl_dummy_copy, + cogl_dummy_free); +COGL_GTYPE_DEFINE_BOXED (OnscreenDirtyClosure, + onscreen_dirty_closure, + cogl_dummy_copy, + cogl_dummy_free); + +static void +_cogl_onscreen_init_from_template (CoglOnscreen *onscreen, + CoglOnscreenTemplate *onscreen_template) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + _cogl_list_init (&onscreen->frame_closures); + _cogl_list_init (&onscreen->resize_closures); + _cogl_list_init (&onscreen->dirty_closures); + + framebuffer->config = onscreen_template->config; + cogl_object_ref (framebuffer->config.swap_chain); +} + +/* XXX: While we still have backend in Clutter we need a dummy object + * to represent the CoglOnscreen framebuffer that the backend + * creates... */ +CoglOnscreen * +_cogl_onscreen_new (void) +{ + CoglOnscreen *onscreen = g_new0 (CoglOnscreen, 1); + + _COGL_GET_CONTEXT (ctx, NULL); + + _cogl_framebuffer_init (COGL_FRAMEBUFFER (onscreen), + ctx, + COGL_FRAMEBUFFER_TYPE_ONSCREEN, + 0x1eadbeef, /* width */ + 0x1eadbeef); /* height */ + /* NB: make sure to pass positive width/height numbers here + * because otherwise we'll hit input validation assertions!*/ + + _cogl_onscreen_init_from_template (onscreen, ctx->display->onscreen_template); + + COGL_FRAMEBUFFER (onscreen)->allocated = TRUE; + + /* XXX: Note we don't initialize onscreen->winsys in this case. */ + + return _cogl_onscreen_object_new (onscreen); +} + +CoglOnscreen * +cogl_onscreen_new (CoglContext *ctx, int width, int height) +{ + CoglOnscreen *onscreen; + + /* FIXME: We are assuming onscreen buffers will always be + premultiplied so we'll set the premult flag on the bitmap + format. This will usually be correct because the result of the + default blending operations for Cogl ends up with premultiplied + data in the framebuffer. However it is possible for the + framebuffer to be in whatever format depending on what + CoglPipeline is used to render to it. Eventually we may want to + add a way for an application to inform Cogl that the framebuffer + is not premultiplied in case it is being used for some special + purpose. */ + + onscreen = g_new0 (CoglOnscreen, 1); + _cogl_framebuffer_init (COGL_FRAMEBUFFER (onscreen), + ctx, + COGL_FRAMEBUFFER_TYPE_ONSCREEN, + width, /* width */ + height); /* height */ + + _cogl_onscreen_init_from_template (onscreen, ctx->display->onscreen_template); + + return _cogl_onscreen_object_new (onscreen); +} + +static void +_cogl_onscreen_free (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + CoglFrameInfo *frame_info; + + _cogl_closure_list_disconnect_all (&onscreen->resize_closures); + _cogl_closure_list_disconnect_all (&onscreen->frame_closures); + _cogl_closure_list_disconnect_all (&onscreen->dirty_closures); + + while ((frame_info = g_queue_pop_tail (&onscreen->pending_frame_infos))) + cogl_object_unref (frame_info); + g_queue_clear (&onscreen->pending_frame_infos); + + if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen)) + framebuffer->context->window_buffer = NULL; + + winsys->onscreen_deinit (onscreen); + _COGL_RETURN_IF_FAIL (onscreen->winsys == NULL); + + /* Chain up to parent */ + _cogl_framebuffer_free (framebuffer); + + g_free (onscreen); +} + +static void +notify_event (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info) +{ + _cogl_closure_list_invoke (&onscreen->frame_closures, + CoglFrameCallback, + onscreen, event, info); +} + +static void +_cogl_dispatch_onscreen_cb (CoglContext *context) +{ + CoglOnscreenEvent *event, *tmp; + CoglList queue; + + /* Dispatching the event callback may cause another frame to be + * drawn which in may cause another event to be queued immediately. + * To make sure this loop will only dispatch one set of events we'll + * steal the queue and iterate that separately */ + _cogl_list_init (&queue); + _cogl_list_insert_list (&queue, &context->onscreen_events_queue); + _cogl_list_init (&context->onscreen_events_queue); + + _cogl_closure_disconnect (context->onscreen_dispatch_idle); + context->onscreen_dispatch_idle = NULL; + + _cogl_list_for_each_safe (event, tmp, &queue, link) + { + CoglOnscreen *onscreen = event->onscreen; + CoglFrameInfo *info = event->info; + + notify_event (onscreen, event->type, info); + + cogl_object_unref (onscreen); + cogl_object_unref (info); + + g_slice_free (CoglOnscreenEvent, event); + } + + while (!_cogl_list_empty (&context->onscreen_dirty_queue)) + { + CoglOnscreenQueuedDirty *qe = + _cogl_container_of (context->onscreen_dirty_queue.next, + CoglOnscreenQueuedDirty, + link); + + _cogl_list_remove (&qe->link); + + _cogl_closure_list_invoke (&qe->onscreen->dirty_closures, + CoglOnscreenDirtyCallback, + qe->onscreen, + &qe->info); + + cogl_object_unref (qe->onscreen); + + g_slice_free (CoglOnscreenQueuedDirty, qe); + } +} + +static void +_cogl_onscreen_queue_dispatch_idle (CoglOnscreen *onscreen) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; + + if (!ctx->onscreen_dispatch_idle) + { + ctx->onscreen_dispatch_idle = + _cogl_poll_renderer_add_idle (ctx->display->renderer, + (CoglIdleCallback) + _cogl_dispatch_onscreen_cb, + ctx, + NULL); + } +} + +void +_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; + CoglOnscreenQueuedDirty *qe = g_slice_new (CoglOnscreenQueuedDirty); + + qe->onscreen = cogl_object_ref (onscreen); + qe->info = *info; + _cogl_list_insert (ctx->onscreen_dirty_queue.prev, &qe->link); + + _cogl_onscreen_queue_dispatch_idle (onscreen); +} + +void +_cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglOnscreenDirtyInfo info; + + info.x = 0; + info.y = 0; + info.width = framebuffer->width; + info.height = framebuffer->height; + + _cogl_onscreen_queue_dirty (onscreen, &info); +} + +void +_cogl_onscreen_queue_event (CoglOnscreen *onscreen, + CoglFrameEvent type, + CoglFrameInfo *info) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; + + CoglOnscreenEvent *event = g_slice_new (CoglOnscreenEvent); + + event->onscreen = cogl_object_ref (onscreen); + event->info = cogl_object_ref (info); + event->type = type; + + _cogl_list_insert (ctx->onscreen_events_queue.prev, &event->link); + + _cogl_onscreen_queue_dispatch_idle (onscreen); +} + +void +cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + CoglFrameInfo *info; + + _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); + + info = _cogl_frame_info_new (); + info->frame_counter = onscreen->frame_counter; + g_queue_push_tail (&onscreen->pending_frame_infos, info); + + /* FIXME: we shouldn't need to flush *all* journals here! */ + cogl_flush (); + + winsys = _cogl_framebuffer_get_winsys (framebuffer); + winsys->onscreen_swap_buffers_with_damage (onscreen, + rectangles, n_rectangles); + cogl_framebuffer_discard_buffers (framebuffer, + COGL_BUFFER_BIT_COLOR | + COGL_BUFFER_BIT_DEPTH | + COGL_BUFFER_BIT_STENCIL); + + if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + { + CoglFrameInfo *info; + + g_warn_if_fail (onscreen->pending_frame_infos.length == 1); + + info = g_queue_pop_tail (&onscreen->pending_frame_infos); + + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info); + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info); + + cogl_object_unref (info); + } + + onscreen->frame_counter++; + framebuffer->mid_scene = FALSE; +} + +void +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen) +{ + cogl_onscreen_swap_buffers_with_damage (onscreen, NULL, 0); +} + +void +cogl_onscreen_swap_region (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + CoglFrameInfo *info; + + _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); + + info = _cogl_frame_info_new (); + info->frame_counter = onscreen->frame_counter; + g_queue_push_tail (&onscreen->pending_frame_infos, info); + + /* FIXME: we shouldn't need to flush *all* journals here! */ + cogl_flush (); + + winsys = _cogl_framebuffer_get_winsys (framebuffer); + + /* This should only be called if the winsys advertises + COGL_WINSYS_FEATURE_SWAP_REGION */ + _COGL_RETURN_IF_FAIL (winsys->onscreen_swap_region != NULL); + + winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer), + rectangles, + n_rectangles); + + cogl_framebuffer_discard_buffers (framebuffer, + COGL_BUFFER_BIT_COLOR | + COGL_BUFFER_BIT_DEPTH | + COGL_BUFFER_BIT_STENCIL); + + if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + { + CoglFrameInfo *info; + + g_warn_if_fail (onscreen->pending_frame_infos.length == 1); + + info = g_queue_pop_tail (&onscreen->pending_frame_infos); + + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info); + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info); + + cogl_object_unref (info); + } + + onscreen->frame_counter++; + framebuffer->mid_scene = FALSE; +} + +int +cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + + _COGL_RETURN_VAL_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0); + + winsys = _cogl_framebuffer_get_winsys (framebuffer); + + if (!winsys->onscreen_get_buffer_age) + return 0; + + return winsys->onscreen_get_buffer_age (onscreen); +} + +#ifdef COGL_HAS_X11_SUPPORT +void +cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen, + uint32_t xid, + CoglOnscreenX11MaskCallback update, + void *user_data) +{ + /* We don't wan't applications to get away with being lazy here and not + * passing an update callback... */ + _COGL_RETURN_IF_FAIL (update); + + onscreen->foreign_xid = xid; + onscreen->foreign_update_mask_callback = update; + onscreen->foreign_update_mask_data = user_data; +} + +uint32_t +cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + if (onscreen->foreign_xid) + return onscreen->foreign_xid; + else + { + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + + /* This should only be called for x11 onscreens */ + _COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_x11_get_window_xid != NULL, 0); + + return winsys->onscreen_x11_get_window_xid (onscreen); + } +} + +uint32_t +cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + XVisualInfo *visinfo; + uint32_t id; + + /* This should only be called for xlib based onscreens */ + _COGL_RETURN_VAL_IF_FAIL (winsys->xlib_get_visual_info != NULL, 0); + + visinfo = winsys->xlib_get_visual_info (); + id = (uint32_t)visinfo->visualid; + + XFree (visinfo); + return id; +} +#endif /* COGL_HAS_X11_SUPPORT */ + +#ifdef COGL_HAS_WIN32_SUPPORT + +void +cogl_win32_onscreen_set_foreign_window (CoglOnscreen *onscreen, + HWND hwnd) +{ + onscreen->foreign_hwnd = hwnd; +} + +HWND +cogl_win32_onscreen_get_window (CoglOnscreen *onscreen) +{ + if (onscreen->foreign_hwnd) + return onscreen->foreign_hwnd; + else + { + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys = + _cogl_framebuffer_get_winsys (framebuffer); + + /* This should only be called for win32 onscreens */ + _COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_win32_get_window != NULL, 0); + + return winsys->onscreen_win32_get_window (onscreen); + } +} + +#endif /* COGL_HAS_WIN32_SUPPORT */ + +CoglFrameClosure * +cogl_onscreen_add_frame_callback (CoglOnscreen *onscreen, + CoglFrameCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy) +{ + return _cogl_closure_list_add (&onscreen->frame_closures, + callback, + user_data, + destroy); +} + +void +cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen, + CoglFrameClosure *closure) +{ + _COGL_RETURN_IF_FAIL (closure); + + _cogl_closure_disconnect (closure); +} + +typedef struct _SwapBufferCallbackState +{ + CoglSwapBuffersNotify callback; + void *user_data; +} SwapBufferCallbackState; + +static void +destroy_swap_buffers_callback_state (void *user_data) +{ + g_slice_free (SwapBufferCallbackState, user_data); +} + +static void +shim_swap_buffers_callback (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + SwapBufferCallbackState *state = user_data; + + /* XXX: Note that technically it is a change in semantics for this + * interface to forward _SYNC events here and also makes the api + * name somewhat missleading. + * + * In practice though this interface is currently used by + * applications for throttling, not because they are strictly + * interested in knowing when a frame has been presented and so + * forwarding _SYNC events should serve them better. + */ + if (event == COGL_FRAME_EVENT_SYNC) + state->callback (COGL_FRAMEBUFFER (onscreen), state->user_data); +} + +unsigned int +cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen, + CoglSwapBuffersNotify callback, + void *user_data) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; + SwapBufferCallbackState *state = g_slice_new (SwapBufferCallbackState); + CoglFrameClosure *closure; + unsigned int id = ctx->next_swap_callback_id++; + + state->callback = callback; + state->user_data = user_data; + + closure = + cogl_onscreen_add_frame_callback (onscreen, + shim_swap_buffers_callback, + state, + destroy_swap_buffers_callback_state); + + g_hash_table_insert (ctx->swap_callback_closures, + GINT_TO_POINTER (id), + closure); + + return id; +} + +void +cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen, + unsigned int id) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context; + CoglFrameClosure *closure = g_hash_table_lookup (ctx->swap_callback_closures, + GINT_TO_POINTER (id)); + + _COGL_RETURN_IF_FAIL (closure); + + cogl_onscreen_remove_frame_callback (onscreen, closure); +} + +void +cogl_onscreen_set_swap_throttled (CoglOnscreen *onscreen, + CoglBool throttled) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + framebuffer->config.swap_throttled = throttled; + if (framebuffer->allocated) + { + const CoglWinsysVtable *winsys = + _cogl_framebuffer_get_winsys (framebuffer); + winsys->onscreen_update_swap_throttled (onscreen); + } +} + +void +cogl_onscreen_show (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + + if (!framebuffer->allocated) + { + if (!cogl_framebuffer_allocate (framebuffer, NULL)) + return; + } + + winsys = _cogl_framebuffer_get_winsys (framebuffer); + if (winsys->onscreen_set_visibility) + winsys->onscreen_set_visibility (onscreen, TRUE); +} + +void +cogl_onscreen_hide (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + if (framebuffer->allocated) + { + const CoglWinsysVtable *winsys = + _cogl_framebuffer_get_winsys (framebuffer); + if (winsys->onscreen_set_visibility) + winsys->onscreen_set_visibility (onscreen, FALSE); + } +} + +void +_cogl_onscreen_notify_frame_sync (CoglOnscreen *onscreen, CoglFrameInfo *info) +{ + notify_event (onscreen, COGL_FRAME_EVENT_SYNC, info); +} + +void +_cogl_onscreen_notify_complete (CoglOnscreen *onscreen, CoglFrameInfo *info) +{ + notify_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info); +} + +void +_cogl_onscreen_notify_resize (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + _cogl_closure_list_invoke (&onscreen->resize_closures, + CoglOnscreenResizeCallback, + onscreen, + framebuffer->width, + framebuffer->height); +} + +void +_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer, + int width, int height) +{ + if (framebuffer->width == width && framebuffer->height == height) + return; + + framebuffer->width = width; + framebuffer->height = height; + + cogl_framebuffer_set_viewport (framebuffer, 0, 0, width, height); + + if (!_cogl_has_private_feature (framebuffer->context, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS)) + _cogl_onscreen_queue_full_dirty (COGL_ONSCREEN (framebuffer)); +} + +void +cogl_onscreen_set_resizable (CoglOnscreen *onscreen, + CoglBool resizable) +{ + CoglFramebuffer *framebuffer; + const CoglWinsysVtable *winsys; + + if (onscreen->resizable == resizable) + return; + + onscreen->resizable = resizable; + + framebuffer = COGL_FRAMEBUFFER (onscreen); + if (framebuffer->allocated) + { + winsys = _cogl_framebuffer_get_winsys (COGL_FRAMEBUFFER (onscreen)); + + if (winsys->onscreen_set_resizable) + winsys->onscreen_set_resizable (onscreen, resizable); + } +} + +CoglBool +cogl_onscreen_get_resizable (CoglOnscreen *onscreen) +{ + return onscreen->resizable; +} + +CoglOnscreenResizeClosure * +cogl_onscreen_add_resize_callback (CoglOnscreen *onscreen, + CoglOnscreenResizeCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy) +{ + return _cogl_closure_list_add (&onscreen->resize_closures, + callback, + user_data, + destroy); +} + +void +cogl_onscreen_remove_resize_callback (CoglOnscreen *onscreen, + CoglOnscreenResizeClosure *closure) +{ + _cogl_closure_disconnect (closure); +} + +CoglOnscreenDirtyClosure * +cogl_onscreen_add_dirty_callback (CoglOnscreen *onscreen, + CoglOnscreenDirtyCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy) +{ + return _cogl_closure_list_add (&onscreen->dirty_closures, + callback, + user_data, + destroy); +} + +void +cogl_onscreen_remove_dirty_callback (CoglOnscreen *onscreen, + CoglOnscreenDirtyClosure *closure) +{ + _COGL_RETURN_IF_FAIL (closure); + + _cogl_closure_disconnect (closure); +} + +int64_t +cogl_onscreen_get_frame_counter (CoglOnscreen *onscreen) +{ + return onscreen->frame_counter; +} diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h new file mode 100644 index 0000000..0edae92 --- /dev/null +++ b/cogl/cogl-onscreen.h @@ -0,0 +1,1012 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011,2012,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ONSCREEN_H +#define __COGL_ONSCREEN_H + +#include +#include +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +typedef struct _CoglOnscreen CoglOnscreen; +#define COGL_ONSCREEN(X) ((CoglOnscreen *)(X)) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_onscreen_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_onscreen_get_gtype (void); +#endif + +/** + * cogl_onscreen_new: (constructor) + * @context: A #CoglContext + * @width: The desired framebuffer width + * @height: The desired framebuffer height + * + * Instantiates an "unallocated" #CoglOnscreen framebuffer that may be + * configured before later being allocated, either implicitly when + * it is first used or explicitly via cogl_framebuffer_allocate(). + * + * Return value: (transfer full): A newly instantiated #CoglOnscreen framebuffer + * Since: 1.8 + * Stability: unstable + */ +CoglOnscreen * +cogl_onscreen_new (CoglContext *context, int width, int height); + +#ifdef COGL_HAS_X11 +typedef void (*CoglOnscreenX11MaskCallback) (CoglOnscreen *onscreen, + uint32_t event_mask, + void *user_data); + +/** + * cogl_x11_onscreen_set_foreign_window_xid: + * @onscreen: The unallocated framebuffer to associated with an X + * window. + * @xid: The XID of an existing X window + * @update: A callback that notifies of updates to what Cogl requires + * to be in the core X protocol event mask. + * @user_data: user data passed to @update + * + * Ideally we would recommend that you let Cogl be responsible for + * creating any X window required to back an onscreen framebuffer but + * if you really need to target a window created manually this + * function can be called before @onscreen has been allocated to set a + * foreign XID for your existing X window. + * + * Since Cogl needs, for example, to track changes to the size of an X + * window it requires that certain events be selected for via the core + * X protocol. This requirement may also be changed asynchronously so + * you must pass in an @update callback to inform you of Cogl's + * required event mask. + * + * For example if you are using Xlib you could use this API roughly + * as follows: + * [{ + * static void + * my_update_cogl_x11_event_mask (CoglOnscreen *onscreen, + * uint32_t event_mask, + * void *user_data) + * { + * XSetWindowAttributes attrs; + * MyData *data = user_data; + * attrs.event_mask = event_mask | data->my_event_mask; + * XChangeWindowAttributes (data->xdpy, + * data->xwin, + * CWEventMask, + * &attrs); + * } + * + * { + * *snip* + * cogl_x11_onscreen_set_foreign_window_xid (onscreen, + * data->xwin, + * my_update_cogl_x11_event_mask, + * data); + * *snip* + * } + * }] + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen, + uint32_t xid, + CoglOnscreenX11MaskCallback update, + void *user_data); + +/** + * cogl_x11_onscreen_get_window_xid: + * @onscreen: A #CoglOnscreen framebuffer + * + * Assuming you know the given @onscreen framebuffer is based on an x11 window + * this queries the XID of that window. If + * cogl_x11_onscreen_set_foreign_window_xid() was previously called then it + * will return that same XID otherwise it will be the XID of a window Cogl + * created internally. If the window has not been allocated yet and a foreign + * xid has not been set then it's undefined what value will be returned. + * + * It's undefined what this function does if called when not using an x11 based + * renderer. + * + * Since: 1.10 + * Stability: unstable + */ +uint32_t +cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen); + +/* XXX: we should maybe remove this, since nothing currently uses + * it and the current implementation looks dubious. */ +uint32_t +cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen); +#endif /* COGL_HAS_X11 */ + +#ifdef COGL_HAS_WIN32_SUPPORT +/** + * cogl_win32_onscreen_set_foreign_window: + * @onscreen: A #CoglOnscreen framebuffer + * @hwnd: A win32 window handle + * + * Ideally we would recommend that you let Cogl be responsible for + * creating any window required to back an onscreen framebuffer but + * if you really need to target a window created manually this + * function can be called before @onscreen has been allocated to set a + * foreign XID for your existing X window. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_win32_onscreen_set_foreign_window (CoglOnscreen *onscreen, + HWND hwnd); + +/** + * cogl_win32_onscreen_get_window: + * @onscreen: A #CoglOnscreen framebuffer + * + * Queries the internally created window HWND backing the given @onscreen + * framebuffer. If cogl_win32_onscreen_set_foreign_window() has been used then + * it will return the same handle set with that API. + * + * Since: 1.10 + * Stability: unstable + */ +HWND +cogl_win32_onscreen_get_window (CoglOnscreen *onscreen); +#endif /* COGL_HAS_WIN32_SUPPORT */ + +#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) +struct wl_surface * +cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen); +struct wl_shell_surface * +cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen); + +/** + * cogl_wayland_onscreen_set_foreign_surface: + * @onscreen: An unallocated framebuffer. + * @surface A Wayland surface to associate with the @onscreen. + * + * Allows you to explicitly notify Cogl of an existing Wayland surface to use, + * which prevents Cogl from allocating a surface and shell surface for the + * @onscreen. An allocated surface will not be destroyed when the @onscreen is + * freed. + * + * This function must be called before @onscreen is allocated. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_wayland_onscreen_set_foreign_surface (CoglOnscreen *onscreen, + struct wl_surface *surface); + +/** + * cogl_wayland_onscreen_resize: + * @onscreen: A #CoglOnscreen framebuffer + * @width: The desired width of the framebuffer + * @height: The desired height of the framebuffer + * @offset_x: A relative x offset for the new framebuffer + * @offset_y: A relative y offset for the new framebuffer + * + * Resizes the backbuffer of the given @onscreen framebuffer to the + * given size. Since a buffer is usually conceptually scaled with a + * center point the @offset_x and @offset_y arguments allow the newly + * allocated buffer to be positioned relative to the old buffer size. + * + * For example a buffer that is being resized by moving the bottom right + * corner, and the top left corner is remaining static would use x and y + * offsets of (0, 0) since the top-left of the new buffer should have the same + * position as the old buffer. If the center of the old buffer is being zoomed + * into then all the corners of the new buffer move out from the center and the x + * and y offsets would be (-half_x_size_increase, -half_y_size_increase) where + * x/y_size_increase is how many pixels bigger the buffer is on the x and y + * axis. + * + * Note that if some drawing commands have been applied to the + * framebuffer since the last swap buffers then the resize will be + * queued and will only take effect in the next swap buffers. + * + * If multiple calls to cogl_wayland_onscreen_resize() get queued + * before the next swap buffers request then the relative x and y + * offsets accumulate instead of being replaced. The @width and + * @height values superseed the old values. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_wayland_onscreen_resize (CoglOnscreen *onscreen, + int width, + int height, + int offset_x, + int offset_y); +#endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */ + +/** + * cogl_onscreen_set_swap_throttled: + * @onscreen: A #CoglOnscreen framebuffer + * @throttled: Whether swap throttling is wanted or not. + * + * Requests that the given @onscreen framebuffer should have swap buffer + * requests (made using cogl_onscreen_swap_buffers()) throttled either by a + * displays vblank period or perhaps some other mechanism in a composited + * environment. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_onscreen_set_swap_throttled (CoglOnscreen *onscreen, + CoglBool throttled); + +/** + * cogl_onscreen_show: + * @onscreen: The onscreen framebuffer to make visible + * + * This requests to make @onscreen visible to the user. + * + * Actually the precise semantics of this function depend on the + * window system currently in use, and if you don't have a + * multi-windowining system this function may in-fact do nothing. + * + * This function will implicitly allocate the given @onscreen + * framebuffer before showing it if it hasn't already been allocated. + * + * When using the Wayland winsys calling this will set the surface to + * a toplevel type which will make it appear. If the application wants + * to set a different type for the surface, it can avoid calling + * cogl_onscreen_show() and set its own type directly with the Wayland + * client API via cogl_wayland_onscreen_get_surface(). + * + * Since Cogl doesn't explicitly track the visibility status of + * onscreen framebuffers it wont try to avoid redundant window system + * requests e.g. to show an already visible window. This also means + * that it's acceptable to alternatively use native APIs to show and + * hide windows without confusing Cogl. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_onscreen_show (CoglOnscreen *onscreen); + +/** + * cogl_onscreen_hide: + * @onscreen: The onscreen framebuffer to make invisible + * + * This requests to make @onscreen invisible to the user. + * + * Actually the precise semantics of this function depend on the + * window system currently in use, and if you don't have a + * multi-windowining system this function may in-fact do nothing. + * + * This function does not implicitly allocate the given @onscreen + * framebuffer before hiding it. + * + * Since Cogl doesn't explicitly track the visibility status of + * onscreen framebuffers it wont try to avoid redundant window system + * requests e.g. to show an already visible window. This also means + * that it's acceptable to alternatively use native APIs to show and + * hide windows without confusing Cogl. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_onscreen_hide (CoglOnscreen *onscreen); + +/** + * cogl_onscreen_swap_buffers: + * @onscreen: A #CoglOnscreen framebuffer + * + * Swaps the current back buffer being rendered too, to the front for display. + * + * This function also implicitly discards the contents of the color, depth and + * stencil buffers as if cogl_framebuffer_discard_buffers() were used. The + * significance of the discard is that you should not expect to be able to + * start a new frame that incrementally builds on the contents of the previous + * frame. + * + * It is highly recommended that applications use + * cogl_onscreen_swap_buffers_with_damage() instead whenever possible + * and also use the cogl_onscreen_get_buffer_age() api so they can + * perform incremental updates to older buffers instead of having to + * render a full buffer for every frame. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen); + + +/** + * cogl_onscreen_get_buffer_age: + * @onscreen: A #CoglOnscreen framebuffer + * + * Gets the current age of the buffer contents. + * + * This function allows applications to query the age of the current + * back buffer contents for a #CoglOnscreen as the number of frames + * elapsed since the contents were most recently defined. + * + * These age values exposes enough information to applications about + * how Cogl internally manages back buffers to allow applications to + * re-use the contents of old frames and minimize how much must be + * redrawn for the next frame. + * + * The back buffer contents can either be reported as invalid (has an + * age of 0) or it may be reported to be the same contents as from n + * frames prior to the current frame. + * + * The queried value remains valid until the next buffer swap. + * + * One caveat is that under X11 the buffer age does not reflect + * changes to buffer contents caused by the window systems. X11 + * applications must track Expose events to determine what buffer + * regions need to additionally be repaired each frame. + * + * The recommended way to take advantage of this buffer age api is to + * build up a circular buffer of length 3 for tracking damage regions + * over the last 3 frames and when starting a new frame look at the + * age of the buffer and combine the damage regions for the current + * frame with the damage regions of previous @age frames so you know + * everything that must be redrawn to update the old contents for the + * new frame. + * + * If the system doesn't not support being able to track the age + * of back buffers then this function will always return 0 which + * implies that the contents are undefined. + * + * The %COGL_FEATURE_ID_BUFFER_AGE feature can optionally be + * explicitly checked to determine if Cogl is currently tracking the + * age of #CoglOnscreen back buffer contents. If this feature is + * missing then this function will always return 0. + * + * Return value: The age of the buffer contents or 0 when the buffer + * contents are undefined. + * + * Since: 1.14 + * Stability: stable + */ +int +cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen); + +/** + * cogl_onscreen_swap_buffers_with_damage: + * @onscreen: A #CoglOnscreen framebuffer + * @rectangles: An array of integer 4-tuples representing damaged + * rectangles as (x, y, width, height) tuples. + * @n_rectangles: The number of 4-tuples to be read from @rectangles + * + * Swaps the current back buffer being rendered too, to the front for + * display and provides information to any system compositor about + * what regions of the buffer have changed (damage) with respect to + * the last swapped buffer. + * + * This function has the same semantics as + * cogl_framebuffer_swap_buffers() except that it additionally allows + * applications to pass a list of damaged rectangles which may be + * passed on to a compositor so that it can minimize how much of the + * screen is redrawn in response to this applications newly swapped + * front buffer. + * + * For example if your application is only animating a small object in + * the corner of the screen and everything else is remaining static + * then it can help the compositor to know that only the bottom right + * corner of your newly swapped buffer has really changed with respect + * to your previously swapped front buffer. + * + * If @n_rectangles is 0 then the whole buffer will implicitly be + * reported as damaged as if cogl_onscreen_swap_buffers() had been + * called. + * + * This function also implicitly discards the contents of the color, + * depth and stencil buffers as if cogl_framebuffer_discard_buffers() + * were used. The significance of the discard is that you should not + * expect to be able to start a new frame that incrementally builds on + * the contents of the previous frame. If you want to perform + * incremental updates to older back buffers then please refer to the + * cogl_onscreen_get_buffer_age() api. + * + * Whenever possible it is recommended that applications use this + * function instead of cogl_onscreen_swap_buffers() to improve + * performance when running under a compositor. + * + * It is highly recommended to use this API in conjunction with + * the cogl_onscreen_get_buffer_age() api so that your application can + * perform incremental rendering based on old back buffers. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles); + +/** + * cogl_onscreen_swap_region: + * @onscreen: A #CoglOnscreen framebuffer + * @rectangles: An array of integer 4-tuples representing rectangles as + * (x, y, width, height) tuples. + * @n_rectangles: The number of 4-tuples to be read from @rectangles + * + * Swaps a region of the back buffer being rendered too, to the front for + * display. @rectangles represents the region as array of @n_rectangles each + * defined by 4 sequential (x, y, width, height) integers. + * + * This function also implicitly discards the contents of the color, depth and + * stencil buffers as if cogl_framebuffer_discard_buffers() were used. The + * significance of the discard is that you should not expect to be able to + * start a new frame that incrementally builds on the contents of the previous + * frame. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_onscreen_swap_region (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles); + +/** + * CoglFrameEvent: + * @COGL_FRAME_EVENT_SYNC: Notifies that the system compositor has + * acknowledged a frame and is ready for a + * new frame to be created. + * @COGL_FRAME_EVENT_COMPLETE: Notifies that a frame has ended. This + * is a good time for applications to + * collect statistics about the frame + * since the #CoglFrameInfo should hold + * the most data at this point. No other + * events should be expected after a + * @COGL_FRAME_EVENT_COMPLETE event. + * + * Identifiers that are passed to #CoglFrameCallback functions + * (registered using cogl_onscreen_add_frame_callback()) that + * mark the progression of a frame in some way which usually + * means that new information will have been accumulated in the + * frame's corresponding #CoglFrameInfo object. + * + * The last event that will be sent for a frame will be a + * @COGL_FRAME_EVENT_COMPLETE event and so these are a good + * opportunity to collect statistics about a frame since the + * #CoglFrameInfo should hold the most data at this point. + * + * A frame may not be completed before the next frame can start + * so applications should avoid needing to collect all statistics for + * a particular frame before they can start a new frame. + * + * Since: 1.14 + * Stability: unstable + */ +typedef enum _CoglFrameEvent +{ + COGL_FRAME_EVENT_SYNC = 1, + COGL_FRAME_EVENT_COMPLETE +} CoglFrameEvent; + +/** + * CoglFrameCallback: + * @onscreen: The onscreen that the frame is associated with + * @event: A #CoglFrameEvent notifying how the frame has progressed + * @info: The meta information, such as timing information, about + * the frame that has progressed. + * @user_data: The user pointer passed to + * cogl_onscreen_add_frame_callback() + * + * Is a callback that can be registered via + * cogl_onscreen_add_frame_callback() to be called when a frame + * progresses in some notable way. + * + * Please see the documentation for #CoglFrameEvent and + * cogl_onscreen_add_frame_callback() for more details about what + * events can be notified. + * + * Since: 1.14 + * Stability: unstable + */ +typedef void (*CoglFrameCallback) (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data); + +/** + * CoglFrameClosure: + * + * An opaque type that tracks a #CoglFrameCallback and associated user + * data. A #CoglFrameClosure pointer will be returned from + * cogl_onscreen_add_frame_callback() and it allows you to remove a + * callback later using cogl_onscreen_remove_frame_callback(). + * + * Since: 1.14 + * Stability: unstable + */ +typedef struct _CoglClosure CoglFrameClosure; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_frame_closure_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_frame_closure_get_gtype (void); +#endif + +/** + * cogl_onscreen_add_frame_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @callback: (scope notified): A callback function to call for frame events + * @user_data: (closure): A private pointer to be passed to @callback + * @destroy: (allow-none): An optional callback to destroy @user_data + * when the @callback is removed or @onscreen is freed. + * + * Installs a @callback function that will be called for significant + * events relating to the given @onscreen framebuffer. + * + * The @callback will be used to notify when the system compositor is + * ready for this application to render a new frame. In this case + * %COGL_FRAME_EVENT_SYNC will be passed as the event argument to the + * given @callback in addition to the #CoglFrameInfo corresponding to + * the frame beeing acknowledged by the compositor. + * + * The @callback will also be called to notify when the frame has + * ended. In this case %COGL_FRAME_EVENT_COMPLETE will be passed as + * the event argument to the given @callback in addition to the + * #CoglFrameInfo corresponding to the newly presented frame. The + * meaning of "ended" here simply means that no more timing + * information will be collected within the corresponding + * #CoglFrameInfo and so this is a good opportunity to analyse the + * given info. It does not necessarily mean that the GPU has finished + * rendering the corresponding frame. + * + * We highly recommend throttling your application according to + * %COGL_FRAME_EVENT_SYNC events so that your application can avoid + * wasting resources, drawing more frames than your system compositor + * can display. + * + * Return value: a #CoglFrameClosure pointer that can be used to + * remove the callback and associated @user_data later. + * Since: 1.14 + * Stability: unstable + */ +CoglFrameClosure * +cogl_onscreen_add_frame_callback (CoglOnscreen *onscreen, + CoglFrameCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy); + +/** + * cogl_onscreen_remove_frame_callback: + * @onscreen: A #CoglOnscreen + * @closure: A #CoglFrameClosure returned from + * cogl_onscreen_add_frame_callback() + * + * Removes a callback and associated user data that were previously + * registered using cogl_onscreen_add_frame_callback(). + * + * If a destroy callback was passed to + * cogl_onscreen_add_frame_callback() to destroy the user data then + * this will get called. + * + * Since: 1.14 + * Stability: unstable + */ +void +cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen, + CoglFrameClosure *closure); + +typedef void (*CoglSwapBuffersNotify) (CoglFramebuffer *framebuffer, + void *user_data); + +/** + * cogl_onscreen_add_swap_buffers_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @callback: (scope notified): A callback function to call when a swap + * has completed + * @user_data: (closure): A private pointer to be passed to @callback + * + * Installs a @callback function that should be called whenever a swap buffers + * request (made using cogl_onscreen_swap_buffers()) for the given + * @onscreen completes. + * + * Applications should check for the %COGL_FEATURE_ID_SWAP_BUFFERS_EVENT + * feature before using this API. It's currently undefined when and if + * registered callbacks will be called if this feature is not supported. + * + * We recommend using this mechanism when available to manually throttle your + * applications (in conjunction with cogl_onscreen_set_swap_throttled()) so + * your application will be able to avoid long blocks in the driver caused by + * throttling when you request to swap buffers too quickly. + * + * Return value: a unique identifier that can be used to remove to remove + * the callback later. + * Since: 1.10 + * Stability: unstable + * Deprecated: 1.14: Use cogl_onscreen_add_frame_callback() instead + */ +COGL_DEPRECATED_IN_1_14_FOR (cogl_onscreen_add_frame_callback) +unsigned int +cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen, + CoglSwapBuffersNotify callback, + void *user_data); + +/** + * cogl_onscreen_remove_swap_buffers_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @id: An identifier returned from cogl_onscreen_add_swap_buffers_callback() + * + * Removes a callback that was previously registered + * using cogl_onscreen_add_swap_buffers_callback(). + * + * Since: 1.10 + * Stability: unstable + * Deprecated: 1.14: Use cogl_onscreen_remove_frame_callback() instead + */ + +COGL_DEPRECATED_IN_1_14_FOR (cogl_onscreen_remove_frame_callback) +void +cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen, + unsigned int id); + +/** + * cogl_onscreen_set_resizable: + * @onscreen: A #CoglOnscreen framebuffer + * + * Lets you request Cogl to mark an @onscreen framebuffer as + * resizable or not. + * + * By default, if possible, a @onscreen will be created by Cogl + * as non resizable, but it is not guaranteed that this is always + * possible for all window systems. + * + * Cogl does not know whether marking the @onscreen framebuffer + * is truly meaningful for your current window system (consider + * applications being run fullscreen on a phone or TV) so this + * function may not have any useful effect. If you are running on a + * multi windowing system such as X11 or Win32 or OSX then Cogl will + * request to the window system that users be allowed to resize the + * @onscreen, although it's still possible that some other window + * management policy will block this possibility. + * + * Whenever an @onscreen framebuffer is resized the viewport + * will be automatically updated to match the new size of the + * framebuffer with an origin of (0,0). If your application needs more + * specialized control of the viewport it will need to register a + * resize handler using cogl_onscreen_add_resize_callback() so that it + * can track when the viewport has been changed automatically. + * + * Since: 2.0 + */ +void +cogl_onscreen_set_resizable (CoglOnscreen *onscreen, + CoglBool resizable); + +/** + * cogl_onscreen_get_resizable: + * @onscreen: A #CoglOnscreen framebuffer + * + * Lets you query whether @onscreen has been marked as resizable via + * the cogl_onscreen_set_resizable() api. + * + * By default, if possible, a @onscreen will be created by Cogl + * as non resizable, but it is not guaranteed that this is always + * possible for all window systems. + * + * If cogl_onscreen_set_resizable(@onscreen, %TRUE) has been + * previously called then this function will return %TRUE, but it's + * possible that the current windowing system being used does not + * support window resizing (consider fullscreen windows on a phone or + * a TV). This function is not aware of whether resizing is truly + * meaningful with your window system, only whether the @onscreen has + * been marked as resizable. + * + * Return value: Returns whether @onscreen has been marked as + * resizable or not. + * Since: 2.0 + */ +CoglBool +cogl_onscreen_get_resizable (CoglOnscreen *onscreen); + +/** + * CoglOnscreenResizeCallback: + * @onscreen: A #CoglOnscreen framebuffer that was resized + * @width: The new width of @onscreen + * @height: The new height of @onscreen + * @user_data: The private passed to + * cogl_onscreen_add_resize_callback() + * + * Is a callback type used with the + * cogl_onscreen_add_resize_callback() allowing applications to be + * notified whenever an @onscreen framebuffer is resized. + * + * Cogl automatically updates the viewport of an @onscreen + * framebuffer that is resized so this callback is also an indication + * that the viewport has been modified too + * + * A resize callback will only ever be called while dispatching + * Cogl events from the system mainloop; so for example during + * cogl_poll_renderer_dispatch(). This is so that callbacks shouldn't + * occur while an application might have arbitrary locks held for + * example. + * + * Since: 2.0 + */ +typedef void (*CoglOnscreenResizeCallback) (CoglOnscreen *onscreen, + int width, + int height, + void *user_data); + +/** + * CoglOnscreenResizeClosure: + * + * An opaque type that tracks a #CoglOnscreenResizeCallback and + * associated user data. A #CoglOnscreenResizeClosure pointer will be + * returned from cogl_onscreen_add_resize_callback() and it allows you + * to remove a callback later using + * cogl_onscreen_remove_resize_callback(). + * + * Since: 2.0 + * Stability: unstable + */ +typedef struct _CoglClosure CoglOnscreenResizeClosure; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_onscreen_resize_closure_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_onscreen_resize_closure_get_gtype (void); +#endif + +/** + * cogl_onscreen_add_resize_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @callback: (scope notified): A #CoglOnscreenResizeCallback to call when + * the @onscreen changes size. + * @user_data: (closure): Private data to be passed to @callback. + * @destroy: (allow-none): An optional callback to destroy @user_data + * when the @callback is removed or @onscreen is freed. + * + * Registers a @callback with @onscreen that will be called whenever + * the @onscreen framebuffer changes size. + * + * The @callback can be removed using + * cogl_onscreen_remove_resize_callback() passing the returned closure + * pointer. + * + * Since Cogl automatically updates the viewport of an @onscreen + * framebuffer that is resized, a resize callback can also be used to + * track when the viewport has been changed automatically by Cogl in + * case your application needs more specialized control over the + * viewport. + * + * A resize callback will only ever be called while dispatching + * Cogl events from the system mainloop; so for example during + * cogl_poll_renderer_dispatch(). This is so that callbacks shouldn't + * occur while an application might have arbitrary locks held for + * example. + * + * Return value: a #CoglOnscreenResizeClosure pointer that can be used to + * remove the callback and associated @user_data later. + * Since: 2.0 + */ +CoglOnscreenResizeClosure * +cogl_onscreen_add_resize_callback (CoglOnscreen *onscreen, + CoglOnscreenResizeCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy); + +/** + * cogl_onscreen_remove_resize_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @closure: An identifier returned from cogl_onscreen_add_resize_callback() + * + * Removes a resize @callback and @user_data pair that were previously + * associated with @onscreen via cogl_onscreen_add_resize_callback(). + * + * Since: 2.0 + */ +void +cogl_onscreen_remove_resize_callback (CoglOnscreen *onscreen, + CoglOnscreenResizeClosure *closure); + +/** + * CoglOnscreenDirtyInfo: + * @x: Left edge of the dirty rectangle + * @y: Top edge of the dirty rectangle, measured from the top of the window + * @width: Width of the dirty rectangle + * @height: Height of the dirty rectangle + * + * A structure passed to callbacks registered using + * cogl_onscreen_add_dirty_callback(). The members describe a + * rectangle within the onscreen buffer that should be redrawn. + * + * Since: 1.16 + * Stability: unstable + */ +typedef struct _CoglOnscreenDirtyInfo CoglOnscreenDirtyInfo; + +struct _CoglOnscreenDirtyInfo +{ + int x, y; + int width, height; +}; + +/** + * CoglOnscreenDirtyCallback: + * @onscreen: The onscreen that the frame is associated with + * @info: A #CoglOnscreenDirtyInfo struct containing the details of the + * dirty area + * @user_data: The user pointer passed to + * cogl_onscreen_add_frame_callback() + * + * Is a callback that can be registered via + * cogl_onscreen_add_dirty_callback() to be called when the windowing + * system determines that a region of the onscreen window has been + * lost and the application should redraw it. + * + * Since: 1.16 + * Stability: unstable + */ +typedef void (*CoglOnscreenDirtyCallback) (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info, + void *user_data); + +/** + * CoglOnscreenDirtyClosure: + * + * An opaque type that tracks a #CoglOnscreenDirtyCallback and associated + * user data. A #CoglOnscreenDirtyClosure pointer will be returned from + * cogl_onscreen_add_dirty_callback() and it allows you to remove a + * callback later using cogl_onscreen_remove_dirty_callback(). + * + * Since: 1.16 + * Stability: unstable + */ +typedef struct _CoglClosure CoglOnscreenDirtyClosure; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_onscreen_dirty_closure_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_onscreen_dirty_closure_get_gtype (void); +#endif + +/** + * cogl_onscreen_add_dirty_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @callback: (scope notified): A callback function to call for dirty events + * @user_data: (closure): A private pointer to be passed to @callback + * @destroy: (allow-none): An optional callback to destroy @user_data when the + * @callback is removed or @onscreen is freed. + * + * Installs a @callback function that will be called whenever the + * window system has lost the contents of a region of the onscreen + * buffer and the application should redraw it to repair the buffer. + * For example this may happen in a window system without a compositor + * if a window that was previously covering up the onscreen window has + * been moved causing a region of the onscreen to be exposed. + * + * The @callback will be passed a #CoglOnscreenDirtyInfo struct which + * decribes a rectangle containing the newly dirtied region. Note that + * this may be called multiple times to describe a non-rectangular + * region composed of multiple smaller rectangles. + * + * The dirty events are separate from %COGL_FRAME_EVENT_SYNC events so + * the application should also listen for this event before rendering + * the dirty region to ensure that the framebuffer is actually ready + * for rendering. + * + * Return value: a #CoglOnscreenDirtyClosure pointer that can be used to + * remove the callback and associated @user_data later. + * Since: 1.16 + * Stability: unstable + */ +CoglOnscreenDirtyClosure * +cogl_onscreen_add_dirty_callback (CoglOnscreen *onscreen, + CoglOnscreenDirtyCallback callback, + void *user_data, + CoglUserDataDestroyCallback destroy); + +/** + * cogl_onscreen_remove_dirty_callback: + * @onscreen: A #CoglOnscreen + * @closure: A #CoglOnscreenDirtyClosure returned from + * cogl_onscreen_add_dirty_callback() + * + * Removes a callback and associated user data that were previously + * registered using cogl_onscreen_add_dirty_callback(). + * + * If a destroy callback was passed to + * cogl_onscreen_add_dirty_callback() to destroy the user data then + * this will also get called. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_onscreen_remove_dirty_callback (CoglOnscreen *onscreen, + CoglOnscreenDirtyClosure *closure); + +/** + * cogl_is_onscreen: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglOnscreen. + * + * Return value: %TRUE if the object references a #CoglOnscreen + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_onscreen (void *object); + +/** + * cogl_onscreen_get_frame_counter: + * + * Gets the value of the framebuffers frame counter. This is + * a counter that increases by one each time + * cogl_onscreen_swap_buffers() or cogl_onscreen_swap_region() + * is called. + * + * Return value: the current frame counter value + * Since: 1.14 + * Stability: unstable + */ +int64_t +cogl_onscreen_get_frame_counter (CoglOnscreen *onscreen); + +COGL_END_DECLS + +#endif /* __COGL_ONSCREEN_H */ diff --git a/cogl/cogl-output-private.h b/cogl/cogl-output-private.h new file mode 100644 index 0000000..d264d48 --- /dev/null +++ b/cogl/cogl-output-private.h @@ -0,0 +1,57 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_OUTPUT_PRIVATE_H +#define __COGL_OUTPUT_PRIVATE_H + +#include "cogl-output.h" +#include "cogl-object-private.h" + +struct _CoglOutput +{ + CoglObject _parent; + + char *name; + + int x; /* Must be first field for _cogl_output_values_equal() */ + int y; + int width; + int height; + int mm_width; + int mm_height; + float refresh_rate; + CoglSubpixelOrder subpixel_order; +}; + +CoglOutput *_cogl_output_new (const char *name); +CoglBool _cogl_output_values_equal (CoglOutput *output, + CoglOutput *other); + +#endif /* __COGL_OUTPUT_PRIVATE_H */ diff --git a/cogl/cogl-output.c b/cogl/cogl-output.c new file mode 100644 index 0000000..ae85605 --- /dev/null +++ b/cogl/cogl-output.c @@ -0,0 +1,119 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-output-private.h" +#include "cogl-gtype-private.h" + +#include + +static void _cogl_output_free (CoglOutput *output); + +COGL_OBJECT_DEFINE (Output, output); +COGL_GTYPE_DEFINE_CLASS (Output, output); + +CoglOutput * +_cogl_output_new (const char *name) +{ + CoglOutput *output; + + output = g_slice_new0 (CoglOutput); + output->name = g_strdup (name); + + return _cogl_output_object_new (output); +} + +static void +_cogl_output_free (CoglOutput *output) +{ + g_free (output->name); + + g_slice_free (CoglOutput, output); +} + +gboolean +_cogl_output_values_equal (CoglOutput *output, + CoglOutput *other) +{ + return memcmp ((const char *)output + G_STRUCT_OFFSET (CoglOutput, x), + (const char *)other + G_STRUCT_OFFSET (CoglOutput, x), + sizeof (CoglOutput) - G_STRUCT_OFFSET (CoglOutput, x)) == 0; +} + +int +cogl_output_get_x (CoglOutput *output) +{ + return output->x; +} + +int +cogl_output_get_y (CoglOutput *output) +{ + return output->y; +} + +int +cogl_output_get_width (CoglOutput *output) +{ + return output->width; +} + +int +cogl_output_get_height (CoglOutput *output) +{ + return output->height; +} + +int +cogl_output_get_mm_width (CoglOutput *output) +{ + return output->mm_width; +} + +int +cogl_output_get_mm_height (CoglOutput *output) +{ + return output->mm_height; +} + +CoglSubpixelOrder +cogl_output_get_subpixel_order (CoglOutput *output) +{ + return output->subpixel_order; +} + +float +cogl_output_get_refresh_rate (CoglOutput *output) +{ + return output->refresh_rate; +} diff --git a/cogl/cogl-output.h b/cogl/cogl-output.h new file mode 100644 index 0000000..6eec10e --- /dev/null +++ b/cogl/cogl-output.h @@ -0,0 +1,261 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Owen Taylor + */ +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_OUTPUT_H +#define __COGL_OUTPUT_H + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-output + * @short_description: information about an output device + * + * The #CoglOutput object holds information about an output device + * such as a monitor or laptop display. It can be queried to find + * out the position of the output with respect to the screen + * coordinate system and other information such as the resolution + * and refresh rate of the device. + * + * There can be any number of outputs which may overlap: the + * same area of the screen may be displayed by multiple output + * devices. + * + * XXX: though it's possible to query the position of the output + * with respect to screen coordinates, there is currently no way + * of finding out the position of a #CoglOnscreen in screen + * coordinates, at least without using windowing-system specific + * API's, so it's not easy to get the output positions relative + * to the #CoglOnscreen. + */ + +typedef struct _CoglOutput CoglOutput; +#define COGL_OUTPUT(X) ((CoglOutput *)(X)) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_output_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_output_get_gtype (void); +#endif + +/** + * CoglSubpixelOrder: + * @COGL_SUBPIXEL_ORDER_UNKNOWN: the layout of subpixel + * components for the device is unknown. + * @COGL_SUBPIXEL_ORDER_NONE: the device displays colors + * without geometrically-separated subpixel components, + * or the positioning or colors of the components do not + * match any of the values in the enumeration. + * @COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB: the device has + * horizontally arranged components in the order + * red-green-blue from left to right. + * @COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR: the device has + * horizontally arranged components in the order + * blue-green-red from left to right. + * @COGL_SUBPIXEL_ORDER_VERTICAL_RGB: the device has + * vertically arranged components in the order + * red-green-blue from top to bottom. + * @COGL_SUBPIXEL_ORDER_VERTICAL_BGR: the device has + * vertically arranged components in the order + * blue-green-red from top to bottom. + * + * Some output devices (such as LCD panels) display colors + * by making each pixel consist of smaller "subpixels" + * that each have a particular color. By using knowledge + * of the layout of this subpixel components, it is possible + * to create image content with higher resolution than the + * pixel grid. + * + * Since: 1.14 + * Stability: unstable + */ +typedef enum { + COGL_SUBPIXEL_ORDER_UNKNOWN, + COGL_SUBPIXEL_ORDER_NONE, + COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB, + COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR, + COGL_SUBPIXEL_ORDER_VERTICAL_RGB, + COGL_SUBPIXEL_ORDER_VERTICAL_BGR +} CoglSubpixelOrder; + +/** + * cogl_is_output: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglOutput. + * + * Return value: %TRUE if the object references a #CoglOutput + * and %FALSE otherwise. + * Since: 1.14 + * Stability: unstable + */ +CoglBool +cogl_is_output (void *object); + +/** + * cogl_output_get_x: + * @output: a #CoglOutput + * + * Gets the X position of the output with respect to the coordinate + * system of the screen. + * + * Return value: the X position of the output as a pixel offset + * from the left side of the screen coordinate space + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_x (CoglOutput *output); + +/** + * cogl_output_get_y: + * @output: a #CoglOutput + * + * Gets the Y position of the output with respect to the coordinate + * system of the screen. + * + * Return value: the Y position of the output as a pixel offset + * from the top side of the screen coordinate space + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_y (CoglOutput *output); + +/** + * cogl_output_get_width: + * @output: a #CoglOutput + * + * Gets the width of the output in pixels. + * + * Return value: the width of the output in pixels + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_width (CoglOutput *output); + +/** + * cogl_output_get_height: + * @output: a #CoglOutput + * + * Gets the height of the output in pixels. + * + * Return value: the height of the output in pixels + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_height (CoglOutput *output); + +/** + * cogl_output_get_mm_width: + * @output: a #CoglOutput + * + * Gets the physical width of the output. In some cases (such as + * as a projector), the value returned here might correspond to + * nominal resolution rather than the actual physical size of the + * output device. + * + * Return value: the height of the output in millimeters. A value + * of 0 indicates the width is unknown + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_mm_width (CoglOutput *output); + +/** + * cogl_output_get_mm_height: + * @output: a #CoglOutput + * + * Gets the physical height of the output. In some cases (such as + * as a projector), the value returned here might correspond to + * nominal resolution rather than the actual physical size of the + * output device. + * + * Return value: the height of the output in millimeters. A value + * of 0 indicates that the height is unknown + * Since: 1.14 + * Stability: unstable + */ +int +cogl_output_get_mm_height (CoglOutput *output); + +/** + * cogl_output_get_subpixel_order: + * @output: a #CoglOutput + * + * For an output device where each pixel is made up of smaller components + * with different colors, returns the layout of the subpixel + * components. + * + * Return value: the order of subpixel components for the output device + * Since: 1.14 + * Stability: unstable + */ +CoglSubpixelOrder +cogl_output_get_subpixel_order (CoglOutput *output); + +/** + * cogl_output_get_refresh_rate: + * @output: a #CoglOutput + * + * Gets the number of times per second that the output device refreshes + * the display contents. + * + * Return value: the refresh rate of the output device. A value of zero + * indicates that the refresh rate is unknown. + * Since: 1.14 + * Stability: unstable + */ +float +cogl_output_get_refresh_rate (CoglOutput *output); + +COGL_END_DECLS + +#endif /* __COGL_OUTPUT_H */ + + + diff --git a/cogl/cogl-pango.h b/cogl/cogl-pango.h new file mode 100644 index 0000000..b24c1b8 --- /dev/null +++ b/cogl/cogl-pango.h @@ -0,0 +1,40 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ +#ifndef __COGL_PANGO_H_COMPAT__ +#define __COGL_PANGO_H_COMPAT__ + +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +#error "#include is unsupported; please #include " +#else +#warning "#include is deprecated; please #include " +#include +#endif + +#endif /* __COGL_PANGO_H_COMPAT__ */ diff --git a/cogl/cogl-pipeline-cache.c b/cogl/cogl-pipeline-cache.c new file mode 100644 index 0000000..0a6bb6a --- /dev/null +++ b/cogl/cogl-pipeline-cache.c @@ -0,0 +1,216 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-cache.h" +#include "cogl-pipeline-hash-table.h" + +struct _CoglPipelineCache +{ + CoglPipelineHashTable fragment_hash; + CoglPipelineHashTable vertex_hash; + CoglPipelineHashTable combined_hash; +}; + +CoglPipelineCache * +_cogl_pipeline_cache_new (void) +{ + CoglPipelineCache *cache = g_new (CoglPipelineCache, 1); + unsigned long vertex_state; + unsigned long layer_vertex_state; + unsigned int fragment_state; + unsigned int layer_fragment_state; + + _COGL_GET_CONTEXT (ctx, 0); + + vertex_state = + _cogl_pipeline_get_state_for_vertex_codegen (ctx); + layer_vertex_state = + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN; + fragment_state = + _cogl_pipeline_get_state_for_fragment_codegen (ctx); + layer_fragment_state = + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx); + + _cogl_pipeline_hash_table_init (&cache->vertex_hash, + vertex_state, + layer_vertex_state, + "vertex shaders"); + _cogl_pipeline_hash_table_init (&cache->fragment_hash, + fragment_state, + layer_fragment_state, + "fragment shaders"); + _cogl_pipeline_hash_table_init (&cache->combined_hash, + vertex_state | fragment_state, + layer_vertex_state | layer_fragment_state, + "programs"); + + return cache; +} + +void +_cogl_pipeline_cache_free (CoglPipelineCache *cache) +{ + _cogl_pipeline_hash_table_destroy (&cache->fragment_hash); + _cogl_pipeline_hash_table_destroy (&cache->vertex_hash); + _cogl_pipeline_hash_table_destroy (&cache->combined_hash); + g_free (cache); +} + +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_fragment_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + return _cogl_pipeline_hash_table_get (&cache->fragment_hash, + key_pipeline); +} + +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_vertex_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + return _cogl_pipeline_hash_table_get (&cache->vertex_hash, + key_pipeline); +} + +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_combined_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + return _cogl_pipeline_hash_table_get (&cache->combined_hash, + key_pipeline); +} + +#ifdef ENABLE_UNIT_TESTS + +static void +create_pipelines (CoglPipeline **pipelines, + int n_pipelines) +{ + int i; + + for (i = 0; i < n_pipelines; i++) + { + char *source = g_strdup_printf (" cogl_color_out = " + "vec4 (%f, 0.0, 0.0, 1.0);\n", + i / 255.0f); + CoglSnippet *snippet = + cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + source); + + g_free (source); + + pipelines[i] = cogl_pipeline_new (test_ctx); + cogl_pipeline_add_snippet (pipelines[i], snippet); + cogl_object_unref (snippet); + } + + /* Test that drawing with them works. This should create the entries + * in the cache */ + for (i = 0; i < n_pipelines; i++) + { + cogl_framebuffer_draw_rectangle (test_fb, + pipelines[i], + i, 0, + i + 1, 1); + test_utils_check_pixel_rgb (test_fb, i, 0, i, 0, 0); + } + +} + +UNIT_TEST (check_pipeline_pruning, + TEST_REQUIREMENT_GLSL, /* requirements */ + 0 /* no failure cases */) +{ + CoglPipeline *pipelines[18]; + int fb_width, fb_height; + CoglPipelineHashTable *fragment_hash = + &test_ctx->pipeline_cache->fragment_hash; + CoglPipelineHashTable *combined_hash = + &test_ctx->pipeline_cache->combined_hash; + int i; + + fb_width = cogl_framebuffer_get_width (test_fb); + fb_height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + fb_width, + fb_height, + -1, + 100); + + /* Create 18 unique pipelines. This should end up being more than + * the initial expected minimum size so it will trigger the garbage + * collection. However all of the pipelines will be in use so they + * won't be collected */ + create_pipelines (pipelines, 18); + + /* These pipelines should all have unique entries in the cache. We + * should have run the garbage collection once and at that point the + * expected minimum size would have been 17 */ + g_assert_cmpint (g_hash_table_size (fragment_hash->table), ==, 18); + g_assert_cmpint (g_hash_table_size (combined_hash->table), ==, 18); + g_assert_cmpint (fragment_hash->expected_min_size, ==, 17); + g_assert_cmpint (combined_hash->expected_min_size, ==, 17); + + /* Destroy the original pipelines and create some new ones. This + * should run the garbage collector again but this time the + * pipelines won't be in use so it should free some of them */ + for (i = 0; i < 18; i++) + cogl_object_unref (pipelines[i]); + + create_pipelines (pipelines, 18); + + /* The garbage collection should have freed half of the original 18 + * pipelines which means there should now be 18*1.5 = 27 */ + g_assert_cmpint (g_hash_table_size (fragment_hash->table), ==, 27); + g_assert_cmpint (g_hash_table_size (combined_hash->table), ==, 27); + /* The 35th pipeline would have caused the garbage collection. At + * that point there would be 35-18=17 used unique pipelines. */ + g_assert_cmpint (fragment_hash->expected_min_size, ==, 17); + g_assert_cmpint (combined_hash->expected_min_size, ==, 17); + + for (i = 0; i < 18; i++) + cogl_object_unref (pipelines[i]); +} + +#endif /* ENABLE_UNIT_TESTS */ diff --git a/cogl/cogl-pipeline-cache.h b/cogl/cogl-pipeline-cache.h new file mode 100644 index 0000000..bd5862e --- /dev/null +++ b/cogl/cogl-pipeline-cache.h @@ -0,0 +1,93 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PIPELINE_CACHE_H__ +#define __COGL_PIPELINE_CACHE_H__ + +#include "cogl-pipeline.h" + +typedef struct _CoglPipelineCache CoglPipelineCache; + +typedef struct +{ + CoglPipeline *pipeline; + + /* Number of usages of this template. If this drops to zero then it + * will be a candidate for removal from the cache */ + int usage_count; +} CoglPipelineCacheEntry; + +CoglPipelineCache * +_cogl_pipeline_cache_new (void); + +void +_cogl_pipeline_cache_free (CoglPipelineCache *cache); + +/* + * Gets a pipeline from the cache that has the same state as + * @key_pipeline for the state in + * COGL_PIPELINE_STATE_AFFECTS_FRAGMENT_CODEGEN. If there is no + * matching pipline already then a copy of key_pipeline is stored in + * the cache so that it will be used next time the function is called + * with a similar pipeline. In that case the copy itself will be + * returned + */ +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_fragment_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline); + +/* + * Gets a pipeline from the cache that has the same state as + * @key_pipeline for the state in + * COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN. If there is no + * matching pipline already then a copy of key_pipeline is stored in + * the cache so that it will be used next time the function is called + * with a similar pipeline. In that case the copy itself will be + * returned + */ +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_vertex_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline); + +/* + * Gets a pipeline from the cache that has the same state as + * @key_pipeline for the combination of the state state in + * COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN and + * COGL_PIPELINE_STATE_AFFECTS_FRAGMENT_CODEGEN. If there is no + * matching pipline already then a copy of key_pipeline is stored in + * the cache so that it will be used next time the function is called + * with a similar pipeline. In that case the copy itself will be + * returned + */ +CoglPipelineCacheEntry * +_cogl_pipeline_cache_get_combined_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline); + +#endif /* __COGL_PIPELINE_CACHE_H__ */ diff --git a/cogl/cogl-pipeline-debug.c b/cogl/cogl-pipeline-debug.c new file mode 100644 index 0000000..beb35b3 --- /dev/null +++ b/cogl/cogl-pipeline-debug.c @@ -0,0 +1,301 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-layer-private.h" +#include "cogl-node-private.h" + +#include + +typedef struct +{ + int parent_id; + int *node_id_ptr; + GString *graph; + int indent; +} PrintDebugState; + +static CoglBool +dump_layer_cb (CoglNode *node, void *user_data) +{ + CoglPipelineLayer *layer = COGL_PIPELINE_LAYER (node); + PrintDebugState *state = user_data; + int layer_id = *state->node_id_ptr; + PrintDebugState state_out; + GString *changes_label; + CoglBool changes = FALSE; + + if (state->parent_id >= 0) + g_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n", + state->indent, "", + layer->_parent.parent, + layer); + + g_string_append_printf (state->graph, + "%*slayer%p [label=\"layer=0x%p\\n" + "ref count=%d\" " + "color=\"blue\"];\n", + state->indent, "", + layer, + layer, + COGL_OBJECT (layer)->ref_count); + + changes_label = g_string_new (""); + g_string_append_printf (changes_label, + "%*slayer%p -> layer_state%d [weight=100];\n" + "%*slayer_state%d [shape=box label=\"", + state->indent, "", + layer, + layer_id, + state->indent, "", + layer_id); + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_UNIT) + { + changes = TRUE; + g_string_append_printf (changes_label, + "\\lunit=%u\\n", + layer->unit_index); + } + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA) + { + changes = TRUE; + g_string_append_printf (changes_label, + "\\ltexture=%p\\n", + layer->texture); + } + + if (changes) + { + g_string_append_printf (changes_label, "\"];\n"); + g_string_append (state->graph, changes_label->str); + g_string_free (changes_label, TRUE); + } + + state_out.parent_id = layer_id; + + state_out.node_id_ptr = state->node_id_ptr; + (*state_out.node_id_ptr)++; + + state_out.graph = state->graph; + state_out.indent = state->indent + 2; + + _cogl_pipeline_node_foreach_child (COGL_NODE (layer), + dump_layer_cb, + &state_out); + + return TRUE; +} + +static CoglBool +dump_layer_ref_cb (CoglPipelineLayer *layer, void *data) +{ + PrintDebugState *state = data; + int pipeline_id = *state->node_id_ptr; + + g_string_append_printf (state->graph, + "%*spipeline_state%d -> layer%p;\n", + state->indent, "", + pipeline_id, + layer); + + return TRUE; +} + +static CoglBool +dump_pipeline_cb (CoglNode *node, void *user_data) +{ + CoglPipeline *pipeline = COGL_PIPELINE (node); + PrintDebugState *state = user_data; + int pipeline_id = *state->node_id_ptr; + PrintDebugState state_out; + GString *changes_label; + CoglBool changes = FALSE; + CoglBool layers = FALSE; + + if (state->parent_id >= 0) + g_string_append_printf (state->graph, "%*spipeline%d -> pipeline%d;\n", + state->indent, "", + state->parent_id, + pipeline_id); + + g_string_append_printf (state->graph, + "%*spipeline%d [label=\"pipeline=0x%p\\n" + "ref count=%d\\n" + "breadcrumb=\\\"%s\\\"\" color=\"red\"];\n", + state->indent, "", + pipeline_id, + pipeline, + COGL_OBJECT (pipeline)->ref_count, + pipeline->has_static_breadcrumb ? +#ifdef COGL_DEBUG_ENABLED + pipeline->static_breadcrumb : "NULL" +#else + "NULL" +#endif + ); + + changes_label = g_string_new (""); + g_string_append_printf (changes_label, + "%*spipeline%d -> pipeline_state%d [weight=100];\n" + "%*spipeline_state%d [shape=box label=\"", + state->indent, "", + pipeline_id, + pipeline_id, + state->indent, "", + pipeline_id); + + + if (pipeline->differences & COGL_PIPELINE_STATE_COLOR) + { + changes = TRUE; + g_string_append_printf (changes_label, + "\\lcolor=0x%02X%02X%02X%02X\\n", + cogl_color_get_red_byte (&pipeline->color), + cogl_color_get_green_byte (&pipeline->color), + cogl_color_get_blue_byte (&pipeline->color), + cogl_color_get_alpha_byte (&pipeline->color)); + } + + if (pipeline->differences & COGL_PIPELINE_STATE_BLEND) + { + const char *blend_enable_name; + + changes = TRUE; + + switch (pipeline->blend_enable) + { + case COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC: + blend_enable_name = "AUTO"; + break; + case COGL_PIPELINE_BLEND_ENABLE_ENABLED: + blend_enable_name = "ENABLED"; + break; + case COGL_PIPELINE_BLEND_ENABLE_DISABLED: + blend_enable_name = "DISABLED"; + break; + default: + blend_enable_name = "UNKNOWN"; + } + g_string_append_printf (changes_label, + "\\lblend=%s\\n", + blend_enable_name); + } + + if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS) + { + changes = TRUE; + layers = TRUE; + g_string_append_printf (changes_label, "\\ln_layers=%d\\n", + pipeline->n_layers); + } + + if (changes) + { + g_string_append_printf (changes_label, "\"];\n"); + g_string_append (state->graph, changes_label->str); + g_string_free (changes_label, TRUE); + } + + if (layers) + { + g_list_foreach (pipeline->layer_differences, + (GFunc)dump_layer_ref_cb, + state); + } + + state_out.parent_id = pipeline_id; + + state_out.node_id_ptr = state->node_id_ptr; + (*state_out.node_id_ptr)++; + + state_out.graph = state->graph; + state_out.indent = state->indent + 2; + + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + dump_pipeline_cb, + &state_out); + + return TRUE; +} + +/* This function is just here to be called from GDB so we don't really + want to put a declaration in a header and we just add it here to + avoid a warning */ +void +_cogl_debug_dump_pipelines_dot_file (const char *filename); + +void +_cogl_debug_dump_pipelines_dot_file (const char *filename) +{ + GString *graph; + PrintDebugState layer_state; + PrintDebugState pipeline_state; + int layer_id = 0; + int pipeline_id = 0; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!ctx->default_pipeline) + return; + + graph = g_string_new (""); + g_string_append_printf (graph, "digraph {\n"); + + layer_state.graph = graph; + layer_state.parent_id = -1; + layer_state.node_id_ptr = &layer_id; + layer_state.indent = 0; + dump_layer_cb ((CoglNode *)ctx->default_layer_0, &layer_state); + + pipeline_state.graph = graph; + pipeline_state.parent_id = -1; + pipeline_state.node_id_ptr = &pipeline_id; + pipeline_state.indent = 0; + dump_pipeline_cb ((CoglNode *)ctx->default_pipeline, &pipeline_state); + + g_string_append_printf (graph, "}\n"); + + if (filename) + g_file_set_contents (filename, graph->str, -1, NULL); + else + g_print ("%s", graph->str); + + g_string_free (graph, TRUE); +} diff --git a/cogl/cogl-pipeline-hash-table.c b/cogl/cogl-pipeline-hash-table.c new file mode 100644 index 0000000..9c8e3df --- /dev/null +++ b/cogl/cogl-pipeline-hash-table.c @@ -0,0 +1,233 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-hash-table.h" +#include "cogl-pipeline-cache.h" + +typedef struct +{ + CoglPipelineCacheEntry parent; + + /* Calculating the hash is a little bit expensive for pipelines so + * we don't want to do it repeatedly for entries that are already in + * the hash table. Instead we cache the value here and calculate it + * outside of the GHashTable. */ + unsigned int hash_value; + + /* GHashTable annoyingly doesn't let us pass a user data pointer to + * the hash and equal functions so to work around it we have to + * store the pointer in every hash table entry. We will use this + * entry as both the key and the value */ + CoglPipelineHashTable *hash; + + /* The number of unique pipelines that had been created when this + * pipeline was last accessed */ + int age; +} CoglPipelineHashTableEntry; + +static void +value_destroy_cb (void *value) +{ + CoglPipelineHashTableEntry *entry = value; + + cogl_object_unref (entry->parent.pipeline); + + g_slice_free (CoglPipelineHashTableEntry, entry); +} + +static unsigned int +entry_hash (const void *data) +{ + const CoglPipelineHashTableEntry *entry = data; + + return entry->hash_value; +} + +static CoglBool +entry_equal (const void *a, + const void *b) +{ + const CoglPipelineHashTableEntry *entry_a = a; + const CoglPipelineHashTableEntry *entry_b = b; + const CoglPipelineHashTable *hash = entry_a->hash; + + return _cogl_pipeline_equal (entry_a->parent.pipeline, + entry_b->parent.pipeline, + hash->main_state, + hash->layer_state, + 0); +} + +void +_cogl_pipeline_hash_table_init (CoglPipelineHashTable *hash, + unsigned int main_state, + unsigned int layer_state, + const char *debug_string) +{ + hash->n_unique_pipelines = 0; + hash->debug_string = debug_string; + hash->main_state = main_state; + hash->layer_state = layer_state; + /* We'll only start pruning once we get to 16 unique pipelines */ + hash->expected_min_size = 8; + hash->table = g_hash_table_new_full (entry_hash, + entry_equal, + NULL, /* key destroy */ + value_destroy_cb); +} + +void +_cogl_pipeline_hash_table_destroy (CoglPipelineHashTable *hash) +{ + g_hash_table_destroy (hash->table); +} + +static void +collect_prunable_entries_cb (void *key, + void *value, + void *user_data) +{ + GQueue *entries = user_data; + CoglPipelineCacheEntry *entry = value; + + if (entry->usage_count == 0) + g_queue_push_tail (entries, entry); +} + +static int +compare_pipeline_age_cb (const void *a, + const void *b) +{ + const CoglPipelineHashTableEntry *ae = a; + const CoglPipelineHashTableEntry *be = b; + + return be->age - ae->age; +} + +static void +prune_old_pipelines (CoglPipelineHashTable *hash) +{ + GQueue entries; + GList *l; + int i; + + /* Collect all of the prunable entries into a GQueue */ + g_queue_init (&entries); + g_hash_table_foreach (hash->table, + collect_prunable_entries_cb, + &entries); + + /* Sort the entries by increasing order of age */ + entries.head = g_list_sort (entries.head, compare_pipeline_age_cb); + + /* The +1 is to include the pipeline that we're about to add */ + hash->expected_min_size = (g_hash_table_size (hash->table) - + entries.length + + 1); + + /* Remove oldest half of the prunable pipelines. We still want to + * keep some of the prunable entries that are recently used because + * it's not unlikely that the application will recreate the same + * pipeline */ + for (l = entries.head, i = 0; i < entries.length / 2; l = l->next, i++) + { + CoglPipelineCacheEntry *entry = l->data; + + g_hash_table_remove (hash->table, entry); + } + + g_list_free (entries.head); +} + +CoglPipelineCacheEntry * +_cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash, + CoglPipeline *key_pipeline) +{ + CoglPipelineHashTableEntry dummy_entry; + CoglPipelineHashTableEntry *entry; + unsigned int copy_state; + + dummy_entry.parent.pipeline = key_pipeline; + dummy_entry.hash = hash; + dummy_entry.hash_value = _cogl_pipeline_hash (key_pipeline, + hash->main_state, + hash->layer_state, + 0); + entry = g_hash_table_lookup (hash->table, &dummy_entry); + + if (entry) + { + entry->age = hash->n_unique_pipelines; + return &entry->parent; + } + + if (hash->n_unique_pipelines == 50) + g_warning ("Over 50 separate %s have been generated which is very " + "unusual, so something is probably wrong!\n", + hash->debug_string); + + /* If we are going to have more than twice the expected minimum + * number of pipelines in the hash then we'll try pruning and update + * the minimum */ + if (g_hash_table_size (hash->table) >= hash->expected_min_size * 2) + prune_old_pipelines (hash); + + entry = g_slice_new (CoglPipelineHashTableEntry); + entry->parent.usage_count = 0; + entry->hash = hash; + entry->hash_value = dummy_entry.hash_value; + entry->age = hash->n_unique_pipelines; + + copy_state = hash->main_state; + if (hash->layer_state) + copy_state |= COGL_PIPELINE_STATE_LAYERS; + + /* Create a new pipeline that is a child of the root pipeline + * instead of a normal copy so that the template pipeline won't hold + * a reference to the original pipeline */ + entry->parent.pipeline = _cogl_pipeline_deep_copy (key_pipeline, + copy_state, + hash->layer_state); + + g_hash_table_insert (hash->table, entry, entry); + + hash->n_unique_pipelines++; + + return &entry->parent; +} diff --git a/cogl/cogl-pipeline-hash-table.h b/cogl/cogl-pipeline-hash-table.h new file mode 100644 index 0000000..035e8df --- /dev/null +++ b/cogl/cogl-pipeline-hash-table.h @@ -0,0 +1,81 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PIPELINE_HASH_H__ +#define __COGL_PIPELINE_HASH_H__ + +#include "cogl-pipeline-cache.h" + +typedef struct +{ + /* Total number of pipelines that were ever added to the hash. This + * is not decremented when a pipeline is removed. It is only used to + * generate a warning if an unusually high number of pipelines are + * generated */ + int n_unique_pipelines; + + /* This is the expected minimum size we could prune the hash table + * to if we were to remove all pipelines that are not in use. This + * is only updated after we prune the table */ + int expected_min_size; + + /* String that will be used to describe the usage of this hash table + * in the debug warning when too many pipelines are generated. This + * must be a static string because it won't be copied or freed */ + const char *debug_string; + + unsigned int main_state; + unsigned int layer_state; + + GHashTable *table; +} CoglPipelineHashTable; + +void +_cogl_pipeline_hash_table_init (CoglPipelineHashTable *hash, + unsigned int main_state, + unsigned int layer_state, + const char *debug_string); + +void +_cogl_pipeline_hash_table_destroy (CoglPipelineHashTable *hash); + +/* + * Gets a pipeline from the hash that has the same state as + * @key_pipeline according to the limited state bits passed to + * _cogl_pipeline_hash_table_init(). If there is no matching pipelines + * already then a copy of key_pipeline is stored in the hash so that + * it will be used next time the function is called with a similar + * pipeline. In that case the copy itself will be returned + */ +CoglPipelineCacheEntry * +_cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash, + CoglPipeline *key_pipeline); + +#endif /* __COGL_PIPELINE_HASH_H__ */ diff --git a/cogl/cogl-pipeline-layer-private.h b/cogl/cogl-pipeline-layer-private.h new file mode 100644 index 0000000..38cd3b5 --- /dev/null +++ b/cogl/cogl-pipeline-layer-private.h @@ -0,0 +1,390 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_LAYER_PRIVATE_H +#define __COGL_PIPELINE_LAYER_PRIVATE_H + +#include "cogl-private.h" +#include "cogl-pipeline.h" +#include "cogl-node-private.h" +#include "cogl-texture.h" +#include "cogl-matrix.h" +#include "cogl-pipeline-layer-state.h" +#include "cogl-pipeline-snippet-private.h" +#include "cogl-sampler-cache-private.h" + +#include + +typedef struct _CoglPipelineLayer CoglPipelineLayer; +#define COGL_PIPELINE_LAYER(OBJECT) ((CoglPipelineLayer *)OBJECT) + +/* XXX: should I rename these as + * COGL_PIPELINE_LAYER_STATE_INDEX_XYZ... ? + */ +typedef enum +{ + /* sparse state */ + COGL_PIPELINE_LAYER_STATE_UNIT_INDEX, + COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX, + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA_INDEX, + COGL_PIPELINE_LAYER_STATE_SAMPLER_INDEX, + COGL_PIPELINE_LAYER_STATE_COMBINE_INDEX, + COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT_INDEX, + COGL_PIPELINE_LAYER_STATE_USER_MATRIX_INDEX, + COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS_INDEX, + COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS_INDEX, + COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX, + + /* note: layers don't currently have any non-sparse state */ + + COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT, + COGL_PIPELINE_LAYER_STATE_COUNT = COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT +} CoglPipelineLayerStateIndex; + +/* XXX: If you add or remove state groups here you may need to update + * some of the state masks following this enum too! + * + * FIXME: perhaps it would be better to rename this enum to + * CoglPipelineLayerStateGroup to better convey the fact that a single + * enum here can map to multiple properties. + */ +typedef enum +{ + COGL_PIPELINE_LAYER_STATE_UNIT = + 1L< TEXTURE0 to store + very large layer numbers */ + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE, + COGL_PIPELINE_COMBINE_SOURCE_CONSTANT, + COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR, + COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS, + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 +} CoglPipelineCombineSource; + +typedef enum +{ + /* These are the same values as GL */ + COGL_PIPELINE_COMBINE_OP_SRC_COLOR = 0x0300, + COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR = 0x0301, + COGL_PIPELINE_COMBINE_OP_SRC_ALPHA = 0x0302, + COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA = 0x0303 +} CoglPipelineCombineOp; + +typedef struct +{ + /* The texture combine state determines how the color of individual + * texture fragments are calculated. */ + CoglPipelineCombineFunc texture_combine_rgb_func; + CoglPipelineCombineSource texture_combine_rgb_src[3]; + CoglPipelineCombineOp texture_combine_rgb_op[3]; + + CoglPipelineCombineFunc texture_combine_alpha_func; + CoglPipelineCombineSource texture_combine_alpha_src[3]; + CoglPipelineCombineOp texture_combine_alpha_op[3]; + + float texture_combine_constant[4]; + + /* The texture matrix dscribes how to transform texture coordinates */ + CoglMatrix matrix; + + CoglPipelineSnippetList vertex_snippets; + CoglPipelineSnippetList fragment_snippets; + + CoglBool point_sprite_coords; +} CoglPipelineLayerBigState; + +struct _CoglPipelineLayer +{ + /* XXX: Please think twice about adding members that *have* be + * initialized during a _cogl_pipeline_layer_copy. We are aiming + * to have copies be as cheap as possible and copies may be + * done by the primitives APIs which means they may happen + * in performance critical code paths. + * + * XXX: If you are extending the state we track please consider if + * the state is expected to vary frequently across many pipelines or + * if the state can be shared among many derived pipelines instead. + * This will determine if the state should be added directly to this + * structure which will increase the memory overhead for *all* + * layers or if instead it can go under ->big_state. + */ + + /* Layers represent their state in a tree structure where some of + * the state relating to a given pipeline or layer may actually be + * owned by one if is ancestors in the tree. We have a common data + * type to track the tree heirachy so we can share code... */ + CoglNode _parent; + + /* Some layers have a pipeline owner, which is to say that the layer + * is referenced in that pipelines->layer_differences list. A layer + * doesn't always have an owner and may simply be an ancestor for + * other layers that keeps track of some shared state. */ + CoglPipeline *owner; + + /* The lowest index is blended first then others on top */ + int index; + + /* A mask of which state groups are different in this layer + * in comparison to its parent. */ + unsigned int differences; + + /* Common differences + * + * As a basic way to reduce memory usage we divide the layer + * state into two groups; the minimal state modified in 90% of + * all layers and the rest, so that the second group can + * be allocated dynamically when required. + */ + + /* Each layer is directly associated with a single texture unit */ + int unit_index; + + /* The type of the texture. This is always set even if the texture + is NULL and it will be used to determine what type of texture + lookups to use in any shaders generated by the pipeline + backends. */ + CoglTextureType texture_type; + /* The texture for this layer, or NULL for an empty + * layer */ + CoglTexture *texture; + + const CoglSamplerCacheEntry *sampler_cache_entry; + + /* Infrequent differences aren't currently tracked in + * a separate, dynamically allocated structure as they are + * for pipelines... */ + CoglPipelineLayerBigState *big_state; + + /* bitfields */ + + /* Determines if layer->big_state is valid */ + unsigned int has_big_state:1; + +}; + +typedef CoglBool +(*CoglPipelineLayerStateComparitor) (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + + + +void +_cogl_pipeline_init_default_layers (void); + +static inline CoglPipelineLayer * +_cogl_pipeline_layer_get_parent (CoglPipelineLayer *layer) +{ + CoglNode *parent_node = COGL_NODE (layer)->parent; + return COGL_PIPELINE_LAYER (parent_node); +} + +CoglPipelineLayer * +_cogl_pipeline_layer_copy (CoglPipelineLayer *layer); + +void +_cogl_pipeline_layer_resolve_authorities (CoglPipelineLayer *layer, + unsigned long differences, + CoglPipelineLayer **authorities); + +CoglBool +_cogl_pipeline_layer_equal (CoglPipelineLayer *layer0, + CoglPipelineLayer *layer1, + unsigned long differences_mask, + CoglPipelineEvalFlags flags); + +CoglPipelineLayer * +_cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); + +void +_cogl_pipeline_layer_prune_redundant_ancestry (CoglPipelineLayer *layer); + +CoglBool +_cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer); + +CoglBool +_cogl_pipeline_layer_has_user_matrix (CoglPipeline *pipeline, + int layer_index); + +/* + * Calls the pre_paint method on the layer texture if there is + * one. This will determine whether mipmaps are needed based on the + * filter settings. + */ +void +_cogl_pipeline_layer_pre_paint (CoglPipelineLayer *layerr); + +void +_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer, + CoglSamplerCacheWrapMode *wrap_mode_s, + CoglSamplerCacheWrapMode *wrap_mode_t, + CoglSamplerCacheWrapMode *wrap_mode_r); + +void +_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer, + CoglPipelineFilter *min_filter, + CoglPipelineFilter *mag_filter); + +const CoglSamplerCacheEntry * +_cogl_pipeline_layer_get_sampler_state (CoglPipelineLayer *layer); + +void +_cogl_pipeline_get_layer_filters (CoglPipeline *pipeline, + int layer_index, + CoglPipelineFilter *min_filter, + CoglPipelineFilter *mag_filter); + +typedef enum { + COGL_PIPELINE_LAYER_TYPE_TEXTURE +} CoglPipelineLayerType; + +CoglPipelineLayerType +_cogl_pipeline_layer_get_type (CoglPipelineLayer *layer); + +CoglTexture * +_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer); + +CoglTexture * +_cogl_pipeline_layer_get_texture_real (CoglPipelineLayer *layer); + +CoglTextureType +_cogl_pipeline_layer_get_texture_type (CoglPipelineLayer *layer); + +CoglPipelineFilter +_cogl_pipeline_layer_get_min_filter (CoglPipelineLayer *layer); + +CoglPipelineFilter +_cogl_pipeline_layer_get_mag_filter (CoglPipelineLayer *layer); + +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer); + +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer); + +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer); + +void +_cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest, + CoglPipelineLayer *src, + unsigned long differences); + +unsigned long +_cogl_pipeline_layer_compare_differences (CoglPipelineLayer *layer0, + CoglPipelineLayer *layer1); + +CoglPipelineLayer * +_cogl_pipeline_layer_get_authority (CoglPipelineLayer *layer, + unsigned long difference); + +CoglTexture * +_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer); + +int +_cogl_pipeline_layer_get_unit_index (CoglPipelineLayer *layer); + +CoglBool +_cogl_pipeline_layer_needs_combine_separate + (CoglPipelineLayer *combine_authority); + +#endif /* __COGL_PIPELINE_LAYER_PRIVATE_H */ diff --git a/cogl/cogl-pipeline-layer-state-private.h b/cogl/cogl-pipeline-layer-state-private.h new file mode 100644 index 0000000..64e70cf --- /dev/null +++ b/cogl/cogl-pipeline-layer-state-private.h @@ -0,0 +1,141 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_LAYER_STATE_PRIVATE_H +#define __COGL_PIPELINE_LAYER_STATE_PRIVATE_H + +#include "cogl-pipeline-layer-state.h" +#include "cogl-pipeline-private.h" + +CoglPipelineLayer * +_cogl_pipeline_set_layer_unit (CoglPipeline *required_owner, + CoglPipelineLayer *layer, + int unit_index); + +CoglPipelineFilter +_cogl_pipeline_get_layer_min_filter (CoglPipeline *pipeline, + int layer_index); + +CoglPipelineFilter +_cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline, + int layer_index); + +CoglBool +_cogl_pipeline_layer_texture_type_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags); + +CoglBool +_cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags); + +CoglBool +_cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_combine_constant_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_sampler_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_point_sprite_coords_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_vertex_snippets_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +CoglBool +_cogl_pipeline_layer_fragment_snippets_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +void +_cogl_pipeline_layer_hash_unit_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_texture_type_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_texture_data_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_sampler_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_combine_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_combine_constant_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_user_matrix_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_point_sprite_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_vertex_snippets_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_fragment_snippets_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +#endif /* __COGL_PIPELINE_LAYER_STATE_PRIVATE_H */ diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c new file mode 100644 index 0000000..fb20192 --- /dev/null +++ b/cogl/cogl-pipeline-layer-state.c @@ -0,0 +1,1814 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-blend-string.h" +#include "cogl-util.h" +#include "cogl-matrix.h" +#include "cogl-snippet-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline-layer-state-private.h" +#include "cogl-error-private.h" + +#include "string.h" +#if 0 +#include "cogl-context-private.h" +#include "cogl-color-private.h" + +#endif + +/* + * XXX: consider special casing layer->unit_index so it's not a sparse + * property so instead we can assume it's valid for all layer + * instances. + * - We would need to initialize ->unit_index in + * _cogl_pipeline_layer_copy (). + * + * XXX: If you use this API you should consider that the given layer + * might not be writeable and so a new derived layer will be allocated + * and modified instead. The layer modified will be returned so you + * can identify when this happens. + */ +CoglPipelineLayer * +_cogl_pipeline_set_layer_unit (CoglPipeline *required_owner, + CoglPipelineLayer *layer, + int unit_index) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_UNIT; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, change); + CoglPipelineLayer *new; + + if (authority->unit_index == unit_index) + return layer; + + new = + _cogl_pipeline_layer_pre_change_notify (required_owner, + layer, + change); + if (new != layer) + layer = new; + else + { + /* If the layer we found is currently the authority on the state + * we are changing see if we can revert to one of our ancestors + * being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, change); + + if (old_authority->unit_index == unit_index) + { + layer->differences &= ~change; + return layer; + } + } + } + + layer->unit_index = unit_index; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + + return layer; +} + +CoglTexture * +_cogl_pipeline_layer_get_texture_real (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA); + + return authority->texture; +} + +CoglTexture * +cogl_pipeline_get_layer_texture (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineLayer *layer = + _cogl_pipeline_get_layer (pipeline, layer_index); + return _cogl_pipeline_layer_get_texture (layer); +} + +CoglTextureType +_cogl_pipeline_layer_get_texture_type (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE); + + return authority->texture_type; +} + +static void +_cogl_pipeline_set_layer_texture_type (CoglPipeline *pipeline, + int layer_index, + CoglTextureType texture_type) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineLayer *new; + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + if (texture_type == authority->texture_type) + return; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, change); + + if (old_authority->texture_type == texture_type) + { + layer->differences &= ~change; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + goto changed; + } + } + } + + layer->texture_type = texture_type; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + +changed: + + pipeline->dirty_real_blend_enable = TRUE; +} + +static void +_cogl_pipeline_set_layer_texture_data (CoglPipeline *pipeline, + int layer_index, + CoglTexture *texture) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineLayer *new; + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + if (authority->texture == texture) + return; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, change); + + if (old_authority->texture == texture) + { + layer->differences &= ~change; + + if (layer->texture != NULL) + cogl_object_unref (layer->texture); + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + goto changed; + } + } + } + + if (texture != NULL) + cogl_object_ref (texture); + if (layer == authority && + layer->texture != NULL) + cogl_object_unref (layer->texture); + layer->texture = texture; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + +changed: + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +cogl_pipeline_set_layer_texture (CoglPipeline *pipeline, + int layer_index, + CoglTexture *texture) +{ + /* For the convenience of fragend code we separate texture state + * into the "type" and the "data", and setting a layer texture + * updates both of these properties. + * + * One example for why this is helpful is that the fragends may + * cache programs they generate and want to re-use those programs + * with all pipelines having equivalent fragment processing state. + * For the sake of determining if pipelines have equivalent fragment + * processing state we don't need to compare that the same + * underlying texture objects are referenced by the pipelines but we + * do need to see if they use the same texture types. Making this + * distinction is much simpler if they are in different state + * groups. + * + * Note: if a NULL texture is set then we leave the type unchanged + * so we can avoid needlessly invalidating any associated fragment + * program. + */ + if (texture) + { + CoglTextureType texture_type = + _cogl_texture_get_type (texture); + _cogl_pipeline_set_layer_texture_type (pipeline, + layer_index, + texture_type); + } + _cogl_pipeline_set_layer_texture_data (pipeline, layer_index, texture); +} + +void +cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline, + int layer_index, + CoglTextureType texture_type) +{ + CoglContext *ctx = _cogl_context_get_default (); + + /* Disallow setting texture types that aren't supported */ + switch (texture_type) + { + case COGL_TEXTURE_TYPE_2D: + break; + + case COGL_TEXTURE_TYPE_3D: + if (ctx->default_gl_texture_3d_tex == NULL) + { + g_warning ("The default 3D texture was set on a pipeline but " + "3D textures are not supported"); + texture_type = COGL_TEXTURE_TYPE_2D; + return; + } + break; + + case COGL_TEXTURE_TYPE_RECTANGLE: + if (ctx->default_gl_texture_rect_tex == NULL) + { + g_warning ("The default rectangle texture was set on a pipeline but " + "rectangle textures are not supported"); + texture_type = COGL_TEXTURE_TYPE_2D; + } + break; + } + + _cogl_pipeline_set_layer_texture_type (pipeline, layer_index, texture_type); + _cogl_pipeline_set_layer_texture_data (pipeline, layer_index, NULL); +} + +static void +_cogl_pipeline_set_layer_sampler_state (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglPipelineLayer *authority, + const CoglSamplerCacheEntry *state) +{ + CoglPipelineLayer *new; + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + + if (authority->sampler_cache_entry == state) + return; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, change); + + if (old_authority->sampler_cache_entry == state) + { + layer->differences &= ~change; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + return; + } + } + } + + layer->sampler_cache_entry = state; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } +} + +static CoglSamplerCacheWrapMode +public_to_internal_wrap_mode (CoglPipelineWrapMode mode) +{ + return (CoglSamplerCacheWrapMode)mode; +} + +static CoglPipelineWrapMode +internal_to_public_wrap_mode (CoglSamplerCacheWrapMode internal_mode) +{ + _COGL_RETURN_VAL_IF_FAIL (internal_mode != + COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_BORDER, + COGL_PIPELINE_WRAP_MODE_AUTOMATIC); + return (CoglPipelineWrapMode)internal_mode; +} + +void +cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglSamplerCacheWrapMode internal_mode = + public_to_internal_wrap_mode (mode); + const CoglSamplerCacheEntry *sampler_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = + _cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache, + authority->sampler_cache_entry, + internal_mode, + authority->sampler_cache_entry-> + wrap_mode_t, + authority->sampler_cache_entry-> + wrap_mode_p); + _cogl_pipeline_set_layer_sampler_state (pipeline, + layer, + authority, + sampler_state); +} + +void +cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglSamplerCacheWrapMode internal_mode = + public_to_internal_wrap_mode (mode); + const CoglSamplerCacheEntry *sampler_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = + _cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache, + authority->sampler_cache_entry, + authority->sampler_cache_entry-> + wrap_mode_s, + internal_mode, + authority->sampler_cache_entry-> + wrap_mode_p); + _cogl_pipeline_set_layer_sampler_state (pipeline, + layer, + authority, + sampler_state); +} + +/* The rationale for naming the third texture coordinate 'p' instead + of OpenGL's usual 'r' is that 'r' conflicts with the usual naming + of the 'red' component when treating a vector as a color. Under + GLSL this is awkward because the texture swizzling for a vector + uses a single letter for each component and the names for colors, + textures and positions are synonymous. GLSL works around this by + naming the components of the texture s, t, p and q. Cogl already + effectively already exposes this naming because it exposes GLSL so + it makes sense to use that naming consistently. Another alternative + could be u, v and w. This is what Blender and Direct3D use. However + the w component conflicts with the w component of a position + vertex. */ +void +cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglSamplerCacheWrapMode internal_mode = + public_to_internal_wrap_mode (mode); + const CoglSamplerCacheEntry *sampler_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = + _cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache, + authority->sampler_cache_entry, + authority->sampler_cache_entry-> + wrap_mode_s, + authority->sampler_cache_entry-> + wrap_mode_t, + internal_mode); + _cogl_pipeline_set_layer_sampler_state (pipeline, + layer, + authority, + sampler_state); +} + +void +cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglSamplerCacheWrapMode internal_mode = + public_to_internal_wrap_mode (mode); + const CoglSamplerCacheEntry *sampler_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = + _cogl_sampler_cache_update_wrap_modes (ctx->sampler_cache, + authority->sampler_cache_entry, + internal_mode, + internal_mode, + internal_mode); + _cogl_pipeline_set_layer_sampler_state (pipeline, + layer, + authority, + sampler_state); + /* XXX: I wonder if we should really be duplicating the mode into + * the 'p' wrap mode too? */ +} + +/* FIXME: deprecate this API */ +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *authority; + const CoglSamplerCacheEntry *sampler_state; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = authority->sampler_cache_entry; + return internal_to_public_wrap_mode (sampler_state->wrap_mode_s); +} + +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_s (CoglPipeline *pipeline, int layer_index) +{ + CoglPipelineLayer *layer; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + /* FIXME: we shouldn't ever construct a layer in a getter function */ + + return _cogl_pipeline_layer_get_wrap_mode_s (layer); +} + +/* FIXME: deprecate this API */ +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *authority; + const CoglSamplerCacheEntry *sampler_state; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + sampler_state = authority->sampler_cache_entry; + return internal_to_public_wrap_mode (sampler_state->wrap_mode_t); +} + +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index) +{ + CoglPipelineLayer *layer; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + /* FIXME: we shouldn't ever construct a layer in a getter function */ + + return _cogl_pipeline_layer_get_wrap_mode_t (layer); +} + +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_p (CoglPipelineLayer *layer) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, change); + const CoglSamplerCacheEntry *sampler_state; + + sampler_state = authority->sampler_cache_entry; + return internal_to_public_wrap_mode (sampler_state->wrap_mode_p); +} + +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index) +{ + CoglPipelineLayer *layer; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + return _cogl_pipeline_layer_get_wrap_mode_p (layer); +} + +void +_cogl_pipeline_layer_get_wrap_modes (CoglPipelineLayer *layer, + CoglSamplerCacheWrapMode *wrap_mode_s, + CoglSamplerCacheWrapMode *wrap_mode_t, + CoglSamplerCacheWrapMode *wrap_mode_p) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + *wrap_mode_s = authority->sampler_cache_entry->wrap_mode_s; + *wrap_mode_t = authority->sampler_cache_entry->wrap_mode_t; + *wrap_mode_p = authority->sampler_cache_entry->wrap_mode_p; +} + +CoglBool +cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index, + CoglBool enable, + CoglError **error) +{ + CoglPipelineLayerState change = + COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; + CoglPipelineLayer *layer; + CoglPipelineLayer *new; + CoglPipelineLayer *authority; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Don't allow point sprite coordinates to be enabled if the driver + doesn't support it */ + if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE)) + { + if (error) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Point sprite texture coordinates are enabled for " + "a layer but the GL driver does not support it."); + } + else + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + g_warning ("Point sprite texture coordinates are enabled " + "for a layer but the GL driver does not support it."); + warning_seen = TRUE; + } + + return FALSE; + } + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + if (authority->big_state->point_sprite_coords == enable) + return TRUE; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, change); + + if (old_authority->big_state->point_sprite_coords == enable) + { + layer->differences &= ~change; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + return TRUE; + } + } + } + + layer->big_state->point_sprite_coords = enable; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + + return TRUE; +} + +CoglBool +cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineLayerState change = + COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + /* FIXME: we shouldn't ever construct a layer in a getter function */ + + authority = _cogl_pipeline_layer_get_authority (layer, change); + + return authority->big_state->point_sprite_coords; +} + +static void +_cogl_pipeline_layer_add_vertex_snippet (CoglPipeline *pipeline, + int layer_index, + CoglSnippet *snippet) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS; + CoglPipelineLayer *layer, *authority; + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + layer = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + + _cogl_pipeline_snippet_list_add (&layer->big_state->vertex_snippets, + snippet); + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } +} + +static void +_cogl_pipeline_layer_add_fragment_snippet (CoglPipeline *pipeline, + int layer_index, + CoglSnippet *snippet) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS; + CoglPipelineLayer *layer, *authority; + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, change); + + layer = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, change); + + _cogl_pipeline_snippet_list_add (&layer->big_state->fragment_snippets, + snippet); + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= change; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } +} + +void +cogl_pipeline_add_layer_snippet (CoglPipeline *pipeline, + int layer_index, + CoglSnippet *snippet) +{ + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + _COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet)); + _COGL_RETURN_IF_FAIL (snippet->hook >= COGL_SNIPPET_FIRST_LAYER_HOOK); + + if (snippet->hook < COGL_SNIPPET_FIRST_LAYER_FRAGMENT_HOOK) + _cogl_pipeline_layer_add_vertex_snippet (pipeline, + layer_index, + snippet); + else + _cogl_pipeline_layer_add_fragment_snippet (pipeline, + layer_index, + snippet); +} + +CoglBool +_cogl_pipeline_layer_texture_type_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags) +{ + return authority0->texture_type == authority1->texture_type; +} + +CoglBool +_cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags) +{ + if (authority0->texture == NULL) + { + if (authority1->texture == NULL) + return (_cogl_pipeline_layer_get_texture_type (authority0) == + _cogl_pipeline_layer_get_texture_type (authority1)); + else + return FALSE; + } + else if (authority1->texture == NULL) + return FALSE; + else + { + GLuint gl_handle0, gl_handle1; + + cogl_texture_get_gl_texture (authority0->texture, &gl_handle0, NULL); + cogl_texture_get_gl_texture (authority1->texture, &gl_handle1, NULL); + + return gl_handle0 == gl_handle1; + } +} + +CoglBool +_cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + CoglPipelineLayerBigState *big_state0 = authority0->big_state; + CoglPipelineLayerBigState *big_state1 = authority1->big_state; + int n_args; + int i; + + if (big_state0->texture_combine_rgb_func != + big_state1->texture_combine_rgb_func) + return FALSE; + + if (big_state0->texture_combine_alpha_func != + big_state1->texture_combine_alpha_func) + return FALSE; + + n_args = + _cogl_get_n_args_for_combine_func (big_state0->texture_combine_rgb_func); + for (i = 0; i < n_args; i++) + { + if ((big_state0->texture_combine_rgb_src[i] != + big_state1->texture_combine_rgb_src[i]) || + (big_state0->texture_combine_rgb_op[i] != + big_state1->texture_combine_rgb_op[i])) + return FALSE; + } + + n_args = + _cogl_get_n_args_for_combine_func (big_state0->texture_combine_alpha_func); + for (i = 0; i < n_args; i++) + { + if ((big_state0->texture_combine_alpha_src[i] != + big_state1->texture_combine_alpha_src[i]) || + (big_state0->texture_combine_alpha_op[i] != + big_state1->texture_combine_alpha_op[i])) + return FALSE; + } + + return TRUE; +} + +CoglBool +_cogl_pipeline_layer_combine_constant_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + return memcmp (authority0->big_state->texture_combine_constant, + authority1->big_state->texture_combine_constant, + sizeof (float) * 4) == 0 ? TRUE : FALSE; +} + +CoglBool +_cogl_pipeline_layer_sampler_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + /* We compare the actual sampler objects rather than just the entry + pointers because two states with different values can lead to the + same state in GL terms when AUTOMATIC is used as a wrap mode */ + return (authority0->sampler_cache_entry->sampler_object == + authority1->sampler_cache_entry->sampler_object); +} + +CoglBool +_cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + CoglPipelineLayerBigState *big_state0 = authority0->big_state; + CoglPipelineLayerBigState *big_state1 = authority1->big_state; + + if (!cogl_matrix_equal (&big_state0->matrix, &big_state1->matrix)) + return FALSE; + + return TRUE; +} + +CoglBool +_cogl_pipeline_layer_point_sprite_coords_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + CoglPipelineLayerBigState *big_state0 = authority0->big_state; + CoglPipelineLayerBigState *big_state1 = authority1->big_state; + + return big_state0->point_sprite_coords == big_state1->point_sprite_coords; +} + +CoglBool +_cogl_pipeline_layer_vertex_snippets_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + return _cogl_pipeline_snippet_list_equal (&authority0->big_state-> + vertex_snippets, + &authority1->big_state-> + vertex_snippets); +} + +CoglBool +_cogl_pipeline_layer_fragment_snippets_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + return _cogl_pipeline_snippet_list_equal (&authority0->big_state-> + fragment_snippets, + &authority1->big_state-> + fragment_snippets); +} + +static void +setup_texture_combine_state (CoglBlendStringStatement *statement, + CoglPipelineCombineFunc *texture_combine_func, + CoglPipelineCombineSource *texture_combine_src, + CoglPipelineCombineOp *texture_combine_op) +{ + int i; + + switch (statement->function->type) + { + case COGL_BLEND_STRING_FUNCTION_REPLACE: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_REPLACE; + break; + case COGL_BLEND_STRING_FUNCTION_MODULATE: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_MODULATE; + break; + case COGL_BLEND_STRING_FUNCTION_ADD: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_ADD; + break; + case COGL_BLEND_STRING_FUNCTION_ADD_SIGNED: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED; + break; + case COGL_BLEND_STRING_FUNCTION_INTERPOLATE: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE; + break; + case COGL_BLEND_STRING_FUNCTION_SUBTRACT: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_SUBTRACT; + break; + case COGL_BLEND_STRING_FUNCTION_DOT3_RGB: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB; + break; + case COGL_BLEND_STRING_FUNCTION_DOT3_RGBA: + *texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA; + break; + } + + for (i = 0; i < statement->function->argc; i++) + { + CoglBlendStringArgument *arg = &statement->args[i]; + + switch (arg->source.info->type) + { + case COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT: + texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_CONSTANT; + break; + case COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE: + texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE; + break; + case COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N: + texture_combine_src[i] = + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 + arg->source.texture; + break; + case COGL_BLEND_STRING_COLOR_SOURCE_PRIMARY: + texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR; + break; + case COGL_BLEND_STRING_COLOR_SOURCE_PREVIOUS: + texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS; + break; + default: + g_warning ("Unexpected texture combine source"); + texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE; + } + + if (arg->source.mask == COGL_BLEND_STRING_CHANNEL_MASK_RGB) + { + if (statement->args[i].source.one_minus) + texture_combine_op[i] = + COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR; + else + texture_combine_op[i] = COGL_PIPELINE_COMBINE_OP_SRC_COLOR; + } + else + { + if (statement->args[i].source.one_minus) + texture_combine_op[i] = + COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA; + else + texture_combine_op[i] = COGL_PIPELINE_COMBINE_OP_SRC_ALPHA; + } + } +} + +CoglBool +cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, + int layer_index, + const char *combine_description, + CoglError **error) +{ + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE; + CoglPipelineLayer *authority; + CoglPipelineLayer *layer; + CoglBlendStringStatement statements[2]; + CoglBlendStringStatement split[2]; + CoglBlendStringStatement *rgb; + CoglBlendStringStatement *a; + int count; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, state); + + count = + _cogl_blend_string_compile (combine_description, + COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE, + statements, + error); + if (!count) + return FALSE; + + if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA) + { + _cogl_blend_string_split_rgba_statement (statements, + &split[0], &split[1]); + rgb = &split[0]; + a = &split[1]; + } + else + { + rgb = &statements[0]; + a = &statements[1]; + } + + /* FIXME: compare the new state with the current state! */ + + /* possibly flush primitives referencing the current state... */ + layer = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state); + + setup_texture_combine_state (rgb, + &layer->big_state->texture_combine_rgb_func, + layer->big_state->texture_combine_rgb_src, + layer->big_state->texture_combine_rgb_op); + + setup_texture_combine_state (a, + &layer->big_state->texture_combine_alpha_func, + layer->big_state->texture_combine_alpha_src, + layer->big_state->texture_combine_alpha_op); + + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, state); + + if (_cogl_pipeline_layer_combine_state_equal (authority, + old_authority)) + { + layer->differences &= ~state; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + goto changed; + } + } + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= state; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + +changed: + + pipeline->dirty_real_blend_enable = TRUE; + return TRUE; +} + +void +cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline, + int layer_index, + const CoglColor *constant_color) +{ + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineLayer *new; + float color_as_floats[4]; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, state); + + color_as_floats[0] = cogl_color_get_red_float (constant_color); + color_as_floats[1] = cogl_color_get_green_float (constant_color); + color_as_floats[2] = cogl_color_get_blue_float (constant_color); + color_as_floats[3] = cogl_color_get_alpha_float (constant_color); + + if (memcmp (authority->big_state->texture_combine_constant, + color_as_floats, sizeof (float) * 4) == 0) + return; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, state); + CoglPipelineLayerBigState *old_big_state = old_authority->big_state; + + if (memcmp (old_big_state->texture_combine_constant, + color_as_floats, sizeof (float) * 4) == 0) + { + layer->differences &= ~state; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + goto changed; + } + } + } + + memcpy (layer->big_state->texture_combine_constant, + color_as_floats, + sizeof (color_as_floats)); + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= state; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } + +changed: + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +_cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline, + int layer_index, + float *constant) +{ + CoglPipelineLayerState change = + COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + /* FIXME: we shouldn't ever construct a layer in a getter function */ + + authority = _cogl_pipeline_layer_get_authority (layer, change); + memcpy (constant, authority->big_state->texture_combine_constant, + sizeof (float) * 4); +} + +/* We should probably make a public API version of this that has a + matrix out-param. For an internal API it's good to be able to avoid + copying the matrix */ +const CoglMatrix * +_cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, int layer_index) +{ + CoglPipelineLayerState change = + COGL_PIPELINE_LAYER_STATE_USER_MATRIX; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); + + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + authority = _cogl_pipeline_layer_get_authority (layer, change); + return &authority->big_state->matrix; +} + +void +cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline, + int layer_index, + const CoglMatrix *matrix) +{ + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_USER_MATRIX; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineLayer *new; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, state); + + if (cogl_matrix_equal (matrix, &authority->big_state->matrix)) + return; + + new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state); + if (new != layer) + layer = new; + else + { + /* If the original layer we found is currently the authority on + * the state we are changing see if we can revert to one of our + * ancestors being the authority. */ + if (layer == authority && + _cogl_pipeline_layer_get_parent (authority) != NULL) + { + CoglPipelineLayer *parent = + _cogl_pipeline_layer_get_parent (authority); + CoglPipelineLayer *old_authority = + _cogl_pipeline_layer_get_authority (parent, state); + + if (cogl_matrix_equal (matrix, &old_authority->big_state->matrix)) + { + layer->differences &= ~state; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + return; + } + } + } + + layer->big_state->matrix = *matrix; + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (layer != authority) + { + layer->differences |= state; + _cogl_pipeline_layer_prune_redundant_ancestry (layer); + } +} + +CoglTexture * +_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer) +{ + _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), NULL); + + return _cogl_pipeline_layer_get_texture_real (layer); +} + +CoglBool +_cogl_pipeline_layer_has_user_matrix (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_USER_MATRIX); + + /* If the authority is the default pipeline then no, otherwise yes */ + return _cogl_pipeline_layer_get_parent (authority) ? TRUE : FALSE; +} + +void +_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer, + CoglPipelineFilter *min_filter, + CoglPipelineFilter *mag_filter) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + *min_filter = authority->sampler_cache_entry->min_filter; + *mag_filter = authority->sampler_cache_entry->mag_filter; +} + +void +_cogl_pipeline_get_layer_filters (CoglPipeline *pipeline, + int layer_index, + CoglPipelineFilter *min_filter, + CoglPipelineFilter *mag_filter) +{ + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + *min_filter = authority->sampler_cache_entry->min_filter; + *mag_filter = authority->sampler_cache_entry->mag_filter; +} + +CoglPipelineFilter +cogl_pipeline_get_layer_min_filter (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineFilter min_filter; + CoglPipelineFilter mag_filter; + + _cogl_pipeline_get_layer_filters (pipeline, layer_index, + &min_filter, &mag_filter); + return min_filter; +} + +CoglPipelineFilter +cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineFilter min_filter; + CoglPipelineFilter mag_filter; + + _cogl_pipeline_get_layer_filters (pipeline, layer_index, + &min_filter, &mag_filter); + return mag_filter; +} + +CoglPipelineFilter +_cogl_pipeline_layer_get_min_filter (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0); + + authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + return authority->sampler_cache_entry->min_filter; +} + +CoglPipelineFilter +_cogl_pipeline_layer_get_mag_filter (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0); + + authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + return authority->sampler_cache_entry->mag_filter; +} + +void +cogl_pipeline_set_layer_filters (CoglPipeline *pipeline, + int layer_index, + CoglPipelineFilter min_filter, + CoglPipelineFilter mag_filter) +{ + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_SAMPLER; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + const CoglSamplerCacheEntry *sampler_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + _COGL_RETURN_IF_FAIL (mag_filter == COGL_PIPELINE_FILTER_NEAREST || + mag_filter == COGL_PIPELINE_FILTER_LINEAR); + + /* Note: this will ensure that the layer exists, creating one if it + * doesn't already. + * + * Note: If the layer already existed it's possibly owned by another + * pipeline. If the layer is created then it will be owned by + * pipeline. */ + layer = _cogl_pipeline_get_layer (pipeline, layer_index); + + /* Now find the ancestor of the layer that is the authority for the + * state we want to change */ + authority = _cogl_pipeline_layer_get_authority (layer, state); + + sampler_state = + _cogl_sampler_cache_update_filters (ctx->sampler_cache, + authority->sampler_cache_entry, + min_filter, + mag_filter); + _cogl_pipeline_set_layer_sampler_state (pipeline, + layer, + authority, + sampler_state); +} + +const CoglSamplerCacheEntry * +_cogl_pipeline_layer_get_sampler_state (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority; + + authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_SAMPLER); + + return authority->sampler_cache_entry; +} + +void +_cogl_pipeline_layer_hash_unit_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + int unit = authority->unit_index; + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &unit, sizeof (unit)); +} + +void +_cogl_pipeline_layer_hash_texture_type_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + CoglTextureType texture_type = authority->texture_type; + + state->hash = _cogl_util_one_at_a_time_hash (state->hash, + &texture_type, + sizeof (texture_type)); +} + +void +_cogl_pipeline_layer_hash_texture_data_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + GLuint gl_handle; + + cogl_texture_get_gl_texture (authority->texture, &gl_handle, NULL); + + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &gl_handle, sizeof (gl_handle)); +} + +void +_cogl_pipeline_layer_hash_sampler_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, + &authority->sampler_cache_entry, + sizeof (authority->sampler_cache_entry)); +} + +void +_cogl_pipeline_layer_hash_combine_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + unsigned int hash = state->hash; + CoglPipelineLayerBigState *b = authority->big_state; + int n_args; + int i; + + hash = _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_rgb_func, + sizeof (b->texture_combine_rgb_func)); + n_args = _cogl_get_n_args_for_combine_func (b->texture_combine_rgb_func); + for (i = 0; i < n_args; i++) + { + hash = + _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_rgb_src[i], + sizeof (b->texture_combine_rgb_src[i])); + hash = + _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_rgb_op[i], + sizeof (b->texture_combine_rgb_op[i])); + } + + hash = _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_alpha_func, + sizeof (b->texture_combine_alpha_func)); + n_args = _cogl_get_n_args_for_combine_func (b->texture_combine_alpha_func); + for (i = 0; i < n_args; i++) + { + hash = + _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_alpha_src[i], + sizeof (b->texture_combine_alpha_src[i])); + hash = + _cogl_util_one_at_a_time_hash (hash, &b->texture_combine_alpha_op[i], + sizeof (b->texture_combine_alpha_op[i])); + } + + state->hash = hash; +} + +void +_cogl_pipeline_layer_hash_combine_constant_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + CoglPipelineLayerBigState *b = authority->big_state; + CoglBool need_hash = FALSE; + int n_args; + int i; + + /* XXX: If the user also asked to hash the ALPHA_FUNC_STATE then it + * would be nice if we could combine the n_args loops in this + * function and _cogl_pipeline_layer_hash_combine_state. + */ + + n_args = _cogl_get_n_args_for_combine_func (b->texture_combine_rgb_func); + for (i = 0; i < n_args; i++) + { + if (b->texture_combine_rgb_src[i] == + COGL_PIPELINE_COMBINE_SOURCE_CONSTANT) + { + /* XXX: should we be careful to only hash the alpha + * component in the COGL_PIPELINE_COMBINE_OP_SRC_ALPHA case? */ + need_hash = TRUE; + goto done; + } + } + + n_args = _cogl_get_n_args_for_combine_func (b->texture_combine_alpha_func); + for (i = 0; i < n_args; i++) + { + if (b->texture_combine_alpha_src[i] == + COGL_PIPELINE_COMBINE_SOURCE_CONSTANT) + { + /* XXX: should we be careful to only hash the alpha + * component in the COGL_PIPELINE_COMBINE_OP_SRC_ALPHA case? */ + need_hash = TRUE; + goto done; + } + } + +done: + if (need_hash) + { + float *constant = b->texture_combine_constant; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, constant, + sizeof (float) * 4); + } +} + +void +_cogl_pipeline_layer_hash_user_matrix_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + CoglPipelineLayerBigState *big_state = authority->big_state; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &big_state->matrix, + sizeof (float) * 16); +} + +void +_cogl_pipeline_layer_hash_point_sprite_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + CoglPipelineLayerBigState *big_state = authority->big_state; + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &big_state->point_sprite_coords, + sizeof (big_state->point_sprite_coords)); +} + +void +_cogl_pipeline_layer_hash_vertex_snippets_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + _cogl_pipeline_snippet_list_hash (&authority->big_state->vertex_snippets, + &state->hash); +} + +void +_cogl_pipeline_layer_hash_fragment_snippets_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + _cogl_pipeline_snippet_list_hash (&authority->big_state->fragment_snippets, + &state->hash); +} diff --git a/cogl/cogl-pipeline-layer-state.h b/cogl/cogl-pipeline-layer-state.h new file mode 100644 index 0000000..4be7d39 --- /dev/null +++ b/cogl/cogl-pipeline-layer-state.h @@ -0,0 +1,620 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIPELINE_LAYER_STATE_H__ +#define __COGL_PIPELINE_LAYER_STATE_H__ + +#include +#include +#include +#include + +COGL_BEGIN_DECLS + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * CoglPipelineFilter: + * @COGL_PIPELINE_FILTER_NEAREST: Measuring in manhatten distance from the, + * current pixel center, use the nearest texture texel + * @COGL_PIPELINE_FILTER_LINEAR: Use the weighted average of the 4 texels + * nearest the current pixel center + * @COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST: Select the mimap level whose + * texel size most closely matches the current pixel, and use the + * %COGL_PIPELINE_FILTER_NEAREST criterion + * @COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST: Select the mimap level whose + * texel size most closely matches the current pixel, and use the + * %COGL_PIPELINE_FILTER_LINEAR criterion + * @COGL_PIPELINE_FILTER_NEAREST_MIPMAP_LINEAR: Select the two mimap levels + * whose texel size most closely matches the current pixel, use + * the %COGL_PIPELINE_FILTER_NEAREST criterion on each one and take + * their weighted average + * @COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR: Select the two mimap levels + * whose texel size most closely matches the current pixel, use + * the %COGL_PIPELINE_FILTER_LINEAR criterion on each one and take + * their weighted average + * + * Texture filtering is used whenever the current pixel maps either to more + * than one texture element (texel) or less than one. These filter enums + * correspond to different strategies used to come up with a pixel color, by + * possibly referring to multiple neighbouring texels and taking a weighted + * average or simply using the nearest texel. + */ +typedef enum { + COGL_PIPELINE_FILTER_NEAREST = 0x2600, + COGL_PIPELINE_FILTER_LINEAR = 0x2601, + COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700, + COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701, + COGL_PIPELINE_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702, + COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703 +} CoglPipelineFilter; +/* NB: these values come from the equivalents in gl.h */ + +/** + * CoglPipelineWrapMode: + * @COGL_PIPELINE_WRAP_MODE_REPEAT: The texture will be repeated. This + * is useful for example to draw a tiled background. + * @COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE: The coordinates outside the + * range 0→1 will sample copies of the edge pixels of the + * texture. This is useful to avoid artifacts if only one copy of + * the texture is being rendered. + * @COGL_PIPELINE_WRAP_MODE_AUTOMATIC: Cogl will try to automatically + * decide which of the above two to use. For cogl_rectangle(), it + * will use repeat mode if any of the texture coordinates are + * outside the range 0→1, otherwise it will use clamp to edge. For + * cogl_polygon() it will always use repeat mode. For + * cogl_vertex_buffer_draw() it will use repeat mode except for + * layers that have point sprite coordinate generation enabled. This + * is the default value. + * + * The wrap mode specifies what happens when texture coordinates + * outside the range 0→1 are used. Note that if the filter mode is + * anything but %COGL_PIPELINE_FILTER_NEAREST then texels outside the + * range 0→1 might be used even when the coordinate is exactly 0 or 1 + * because OpenGL will try to sample neighbouring pixels. For example + * if you are trying to render the full texture then you may get + * artifacts around the edges when the pixels from the other side are + * merged in if the wrap mode is set to repeat. + * + * Since: 2.0 + */ +/* GL_ALWAYS is just used here as a value that is known not to clash + * with any valid GL wrap modes + * + * XXX: keep the values in sync with the CoglPipelineWrapModeInternal + * enum so no conversion is actually needed. + */ +typedef enum { + COGL_PIPELINE_WRAP_MODE_REPEAT = 0x2901, + COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT = 0x8370, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE = 0x812F, + COGL_PIPELINE_WRAP_MODE_AUTOMATIC = 0x0207 /* GL_ALWAYS */ +} CoglPipelineWrapMode; +/* NB: these values come from the equivalents in gl.h */ + +/** + * cogl_pipeline_set_layer: + * @pipeline: A #CoglPipeline object + * @layer_index: the index of the layer + * @texture: a #CoglTexture for the layer object + * + * In addition to the standard OpenGL lighting model a Cogl pipeline may have + * one or more layers comprised of textures that can be blended together in + * order, with a number of different texture combine modes. This function + * defines a new texture layer. + * + * The index values of multiple layers do not have to be consecutive; it is + * only their relative order that is important. + * + * The @texture parameter can also be %NULL in which case the pipeline + * will use a default white texture. The type of the default texture + * will be the same as whatever texture was last used for the pipeline + * or %COGL_TEXTURE_TYPE_2D if none has been specified yet. To + * explicitly specify the type of default texture required, use + * cogl_pipeline_set_layer_null_texture() instead. + * + * In the future, we may define other types of pipeline layers, such + * as purely GLSL based layers. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_texture (CoglPipeline *pipeline, + int layer_index, + CoglTexture *texture); + +/** + * cogl_pipeline_set_layer_null_texture: + * @pipeline: A #CoglPipeline + * @layer_index: The layer number to modify + * @texture_type: The type of the default texture to use + * + * Sets the texture for this layer to be the default texture for the + * given type. This is equivalent to calling + * cogl_pipeline_set_layer_texture() with %NULL for the texture + * argument except that you can also specify the type of default + * texture to use. The default texture is a 1x1 pixel white texture. + * + * This function is mostly useful if you want to create a base + * pipeline that you want to create multiple copies from using + * cogl_pipeline_copy(). In that case this function can be used to + * specify the texture type so that any pipeline copies can share the + * internal texture type state for efficiency. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline, + int layer_index, + CoglTextureType texture_type); + +/** + * cogl_pipeline_get_layer_texture: + * @pipeline: A #CoglPipeline object + * @layer_index: the index of the layer + * + * Return value: (transfer none): the texture that was set for the + * given layer of the pipeline or %NULL if no texture was set. + * Stability: unstable + * Since: 1.10 + */ +CoglTexture * +cogl_pipeline_get_layer_texture (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_remove_layer: + * @pipeline: A #CoglPipeline object + * @layer_index: Specifies the layer you want to remove + * + * This function removes a layer from your pipeline + * Since: 1.10 + * Stability: unstable + */ +void +cogl_pipeline_remove_layer (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_set_layer_combine: + * @pipeline: A #CoglPipeline object + * @layer_index: Specifies the layer you want define a combine function for + * @blend_string: A Cogl blend string + * describing the desired texture combine function. + * @error: A #CoglError that may report parse errors or lack of GPU/driver + * support. May be %NULL, in which case a warning will be printed out if an + * error is encountered. + * + * If not already familiar; you can refer + * here for an overview of what blend + * strings are and there syntax. + * + * These are all the functions available for texture combining: + * + * REPLACE(arg0) = arg0 + * MODULATE(arg0, arg1) = arg0 x arg1 + * ADD(arg0, arg1) = arg0 + arg1 + * ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5 + * INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2) + * SUBTRACT(arg0, arg1) = arg0 - arg1 + * + * + * DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + + * (arg0[G] - 0.5)) * (arg1[G] - 0.5) + + * (arg0[B] - 0.5)) * (arg1[B] - 0.5)) + * + * + * + * + * DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + + * (arg0[G] - 0.5)) * (arg1[G] - 0.5) + + * (arg0[B] - 0.5)) * (arg1[B] - 0.5)) + * + * + * + * + * Refer to the + * color-source syntax for + * describing the arguments. The valid source names for texture combining + * are: + * + * + * TEXTURE + * Use the color from the current texture layer + * + * + * TEXTURE_0, TEXTURE_1, etc + * Use the color from the specified texture layer + * + * + * CONSTANT + * Use the color from the constant given with + * cogl_pipeline_set_layer_combine_constant() + * + * + * PRIMARY + * Use the color of the pipeline as set with + * cogl_pipeline_set_color() + * + * + * PREVIOUS + * Either use the texture color from the previous layer, or + * if this is layer 0, use the color of the pipeline as set with + * cogl_pipeline_set_color() + * + * + * + * + * Layer Combine Examples + * This is effectively what the default blending is: + * + * RGBA = MODULATE (PREVIOUS, TEXTURE) + * + * This could be used to cross-fade between two images, using + * the alpha component of a constant as the interpolator. The constant + * color is given by calling + * cogl_pipeline_set_layer_combine_constant(). + * + * RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A]) + * + * + * + * You can't give a multiplication factor for arguments as you can + * with blending. + * + * Return value: %TRUE if the blend string was successfully parsed, and the + * described texture combining is supported by the underlying driver and + * or hardware. On failure, %FALSE is returned and @error is set + * + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, + int layer_index, + const char *blend_string, + CoglError **error); + +/** + * cogl_pipeline_set_layer_combine_constant: + * @pipeline: A #CoglPipeline object + * @layer_index: Specifies the layer you want to specify a constant used + * for texture combining + * @constant: The constant color you want + * + * When you are using the 'CONSTANT' color source in a layer combine + * description then you can use this function to define its value. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline, + int layer_index, + const CoglColor *constant); + +/** + * cogl_pipeline_set_layer_matrix: + * @pipeline: A #CoglPipeline object + * @layer_index: the index for the layer inside @pipeline + * @matrix: the transformation matrix for the layer + * + * This function lets you set a matrix that can be used to e.g. translate + * and rotate a single layer of a pipeline used to fill your geometry. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline, + int layer_index, + const CoglMatrix *matrix); + +/** + * cogl_pipeline_get_n_layers: + * @pipeline: A #CoglPipeline object + * + * Retrieves the number of layers defined for the given @pipeline + * + * Return value: the number of layers + * + * Since: 2.0 + * Stability: unstable + */ +int +cogl_pipeline_get_n_layers (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_layer_filters: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @min_filter: the filter used when scaling a texture down. + * @mag_filter: the filter used when magnifying a texture. + * + * Changes the decimation and interpolation filters used when a texture is + * drawn at other scales than 100%. + * + * It is an error to pass anything other than + * %COGL_PIPELINE_FILTER_NEAREST or %COGL_PIPELINE_FILTER_LINEAR as + * magnification filters since magnification doesn't ever need to + * reference values stored in the mipmap chain. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_filters (CoglPipeline *pipeline, + int layer_index, + CoglPipelineFilter min_filter, + CoglPipelineFilter mag_filter); + +/** + * cogl_pipeline_get_layer_min_filter: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * + * Retrieves the currently set minification #CoglPipelineFilter set on + * the specified layer. The miniifcation filter determines how the + * layer should be sampled when down-scaled. + * + * The default filter is %COGL_PIPELINE_FILTER_LINEAR but this can be + * changed using cogl_pipeline_set_layer_filters(). + * + * Return value: The minification #CoglPipelineFilter for the + * specified layer. + * Since: 1.10 + * Stability: unstable + */ +CoglPipelineFilter +cogl_pipeline_get_layer_min_filter (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_get_layer_mag_filter: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * + * Retrieves the currently set magnification #CoglPipelineFilter set on + * the specified layer. The magnification filter determines how the + * layer should be sampled when up-scaled. + * + * The default filter is %COGL_PIPELINE_FILTER_LINEAR but this can be + * changed using cogl_pipeline_set_layer_filters(). + * + * Return value: The magnification #CoglPipelineFilter for the + * specified layer. + * Since: 1.10 + * Stability: unstable + */ +CoglPipelineFilter +cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_set_layer_point_sprite_coords_enabled: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @enable: whether to enable point sprite coord generation. + * @error: A return location for a CoglError, or NULL to ignore errors. + * + * When rendering points, if @enable is %TRUE then the texture + * coordinates for this layer will be replaced with coordinates that + * vary from 0.0 to 1.0 across the primitive. The top left of the + * point will have the coordinates 0.0,0.0 and the bottom right will + * have 1.0,1.0. If @enable is %FALSE then the coordinates will be + * fixed for the entire point. + * + * This function will only work if %COGL_FEATURE_ID_POINT_SPRITE is + * available. If the feature is not available then the function will + * return %FALSE and set @error. + * + * Return value: %TRUE if the function succeeds, %FALSE otherwise. + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index, + CoglBool enable, + CoglError **error); + +/** + * cogl_pipeline_get_layer_point_sprite_coords_enabled: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to check. + * + * Gets whether point sprite coordinate generation is enabled for this + * texture layer. + * + * Return value: whether the texture coordinates will be replaced with + * point sprite coordinates. + * + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_get_layer_wrap_mode_s: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 's' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 's' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Stability: unstable + */ +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_s (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_set_layer_wrap_mode_s: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 's' coordinate of texture lookups on this layer. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode); + +/** + * cogl_pipeline_get_layer_wrap_mode_t: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 't' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 't' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Stability: unstable + */ +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, + int layer_index); + + +/** + * cogl_pipeline_set_layer_wrap_mode_t: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 't' coordinate of texture lookups on this layer. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode); + +/** + * cogl_pipeline_get_layer_wrap_mode_p: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 'p' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 'p' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Stability: unstable + */ +CoglPipelineWrapMode +cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, + int layer_index); + +/** + * cogl_pipeline_set_layer_wrap_mode_p: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 'p' coordinate of texture lookups on + * this layer. 'p' is the third coordinate. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode); + +/** + * cogl_pipeline_set_layer_wrap_mode: + * @pipeline: A #CoglPipeline object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for all three coordinates of texture lookups on + * this layer. This is equivalent to calling + * cogl_pipeline_set_layer_wrap_mode_s(), + * cogl_pipeline_set_layer_wrap_mode_t() and + * cogl_pipeline_set_layer_wrap_mode_p() separately. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode); + +/** + * cogl_pipeline_add_layer_snippet: + * @pipeline: A #CoglPipeline + * @layer: The layer to hook the snippet to + * @snippet: A #CoglSnippet + * + * Adds a shader snippet that will hook on to the given layer of the + * pipeline. The exact part of the pipeline that the snippet wraps + * around depends on the hook that is given to + * cogl_snippet_new(). Note that some hooks can't be used with a layer + * and need to be added with cogl_pipeline_add_snippet() instead. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_pipeline_add_layer_snippet (CoglPipeline *pipeline, + int layer, + CoglSnippet *snippet); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +#endif /* __COGL_PIPELINE_LAYER_STATE_H__ */ diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c new file mode 100644 index 0000000..37a5120 --- /dev/null +++ b/cogl/cogl-pipeline-layer.c @@ -0,0 +1,942 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-texture-private.h" + +#include "cogl-pipeline.h" +#include "cogl-pipeline-layer-private.h" +#include "cogl-pipeline-layer-state-private.h" +#include "cogl-pipeline-layer-state.h" +#include "cogl-node-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-context-private.h" +#include "cogl-texture-private.h" + +#include + +static void +_cogl_pipeline_layer_free (CoglPipelineLayer *layer); + +/* This type was made deprecated before the cogl_is_pipeline_layer + function was ever exposed in the public headers so there's no need + to make the cogl_is_pipeline_layer function public. We use INTERNAL + so that the cogl_is_* function won't get defined */ +COGL_OBJECT_INTERNAL_DEFINE (PipelineLayer, pipeline_layer); + + +CoglPipelineLayer * +_cogl_pipeline_layer_get_authority (CoglPipelineLayer *layer, + unsigned long difference) +{ + CoglPipelineLayer *authority = layer; + while (!(authority->differences & difference)) + authority = _cogl_pipeline_layer_get_parent (authority); + return authority; +} + +int +_cogl_pipeline_layer_get_unit_index (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, COGL_PIPELINE_LAYER_STATE_UNIT); + return authority->unit_index; +} + +CoglBool +_cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *combine_authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_COMBINE); + CoglPipelineLayerBigState *big_state = combine_authority->big_state; + CoglPipelineLayer *tex_authority; + CoglPipelineLayer *snippets_authority; + + /* has_alpha maintains the alpha status for the GL_PREVIOUS layer */ + + /* For anything but the default texture combine we currently just + * assume it may result in an alpha value < 1 + * + * FIXME: we could do better than this. */ + if (big_state->texture_combine_alpha_func != + COGL_PIPELINE_COMBINE_FUNC_MODULATE || + big_state->texture_combine_alpha_src[0] != + COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS || + big_state->texture_combine_alpha_op[0] != + COGL_PIPELINE_COMBINE_OP_SRC_ALPHA || + big_state->texture_combine_alpha_src[1] != + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE || + big_state->texture_combine_alpha_op[1] != + COGL_PIPELINE_COMBINE_OP_SRC_ALPHA) + { + return TRUE; + } + + /* NB: A layer may have a combine mode set on it but not yet + * have an associated texture which would mean we'd fallback + * to the default texture which doesn't have an alpha component + */ + tex_authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA); + if (tex_authority->texture && + _cogl_texture_get_format (tex_authority->texture) & COGL_A_BIT) + { + return TRUE; + } + + /* All bets are off if the layer contains any snippets */ + snippets_authority = _cogl_pipeline_layer_get_authority + (layer, COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS); + if (snippets_authority->big_state->vertex_snippets.entries != NULL) + return TRUE; + snippets_authority = _cogl_pipeline_layer_get_authority + (layer, COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS); + if (snippets_authority->big_state->fragment_snippets.entries != NULL) + return TRUE; + + return FALSE; +} + +unsigned int +_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func) +{ + switch (func) + { + case COGL_PIPELINE_COMBINE_FUNC_REPLACE: + return 1; + case COGL_PIPELINE_COMBINE_FUNC_MODULATE: + case COGL_PIPELINE_COMBINE_FUNC_ADD: + case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED: + case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT: + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB: + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA: + return 2; + case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE: + return 3; + } + return 0; +} + +void +_cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest, + CoglPipelineLayer *src, + unsigned long differences) +{ + CoglPipelineLayerBigState *big_dest, *big_src; + + if ((differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE) && + !dest->has_big_state) + { + dest->big_state = g_slice_new (CoglPipelineLayerBigState); + dest->has_big_state = TRUE; + } + + big_dest = dest->big_state; + big_src = src->big_state; + + dest->differences |= differences; + + while (differences) + { + int index = _cogl_util_ffs (differences) - 1; + + differences &= ~(1 << index); + + /* This convoluted switch statement is just here so that we'll + * get a warning if a new state is added without handling it + * here */ + switch (index) + { + case COGL_PIPELINE_LAYER_STATE_COUNT: + case COGL_PIPELINE_LAYER_STATE_UNIT_INDEX: + g_warn_if_reached (); + break; + + case COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX: + dest->texture_type = src->texture_type; + break; + + case COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA_INDEX: + dest->texture = src->texture; + if (dest->texture) + cogl_object_ref (dest->texture); + break; + + case COGL_PIPELINE_LAYER_STATE_SAMPLER_INDEX: + dest->sampler_cache_entry = src->sampler_cache_entry; + break; + + case COGL_PIPELINE_LAYER_STATE_COMBINE_INDEX: + { + CoglPipelineCombineFunc func; + int n_args, i; + + func = big_src->texture_combine_rgb_func; + big_dest->texture_combine_rgb_func = func; + n_args = _cogl_get_n_args_for_combine_func (func); + for (i = 0; i < n_args; i++) + { + big_dest->texture_combine_rgb_src[i] = + big_src->texture_combine_rgb_src[i]; + big_dest->texture_combine_rgb_op[i] = + big_src->texture_combine_rgb_op[i]; + } + + func = big_src->texture_combine_alpha_func; + big_dest->texture_combine_alpha_func = func; + n_args = _cogl_get_n_args_for_combine_func (func); + for (i = 0; i < n_args; i++) + { + big_dest->texture_combine_alpha_src[i] = + big_src->texture_combine_alpha_src[i]; + big_dest->texture_combine_alpha_op[i] = + big_src->texture_combine_alpha_op[i]; + } + } + break; + + case COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT_INDEX: + memcpy (big_dest->texture_combine_constant, + big_src->texture_combine_constant, + sizeof (big_dest->texture_combine_constant)); + break; + + case COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS_INDEX: + big_dest->point_sprite_coords = big_src->point_sprite_coords; + break; + + case COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS_INDEX: + _cogl_pipeline_snippet_list_copy (&big_dest->vertex_snippets, + &big_src->vertex_snippets); + break; + + case COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX: + _cogl_pipeline_snippet_list_copy (&big_dest->fragment_snippets, + &big_src->fragment_snippets); + break; + } + } +} + +static void +_cogl_pipeline_layer_init_multi_property_sparse_state ( + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + CoglPipelineLayer *authority; + + /* Nothing to initialize in these cases since they are all comprised + * of one member which we expect to immediately be overwritten. */ + if (!(change & COGL_PIPELINE_LAYER_STATE_MULTI_PROPERTY)) + return; + + authority = _cogl_pipeline_layer_get_authority (layer, change); + + switch (change) + { + /* XXX: avoid using a default: label so we get a warning if we + * don't explicitly handle a newly defined state-group here. */ + case COGL_PIPELINE_LAYER_STATE_UNIT: + case COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE: + case COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA: + case COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS: + case COGL_PIPELINE_LAYER_STATE_USER_MATRIX: + case COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT: + case COGL_PIPELINE_LAYER_STATE_SAMPLER: + g_return_if_reached (); + + /* XXX: technically we could probably even consider these as + * single property state-groups from the pov that currently the + * corresponding property setters always update all of the values + * at the same time. */ + case COGL_PIPELINE_LAYER_STATE_COMBINE: + { + int n_args; + int i; + CoglPipelineLayerBigState *src_big_state = authority->big_state; + CoglPipelineLayerBigState *dest_big_state = layer->big_state; + GLint func = src_big_state->texture_combine_rgb_func; + + dest_big_state->texture_combine_rgb_func = func; + n_args = _cogl_get_n_args_for_combine_func (func); + for (i = 0; i < n_args; i++) + { + dest_big_state->texture_combine_rgb_src[i] = + src_big_state->texture_combine_rgb_src[i]; + dest_big_state->texture_combine_rgb_op[i] = + src_big_state->texture_combine_rgb_op[i]; + } + + func = src_big_state->texture_combine_alpha_func; + dest_big_state->texture_combine_alpha_func = func; + n_args = _cogl_get_n_args_for_combine_func (func); + for (i = 0; i < n_args; i++) + { + dest_big_state->texture_combine_alpha_src[i] = + src_big_state->texture_combine_alpha_src[i]; + dest_big_state->texture_combine_alpha_op[i] = + src_big_state->texture_combine_alpha_op[i]; + } + break; + } + case COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS: + _cogl_pipeline_snippet_list_copy (&layer->big_state->vertex_snippets, + &authority->big_state-> + vertex_snippets); + break; + case COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS: + _cogl_pipeline_snippet_list_copy (&layer->big_state->fragment_snippets, + &authority->big_state-> + fragment_snippets); + break; + } +} + +/* NB: If a layer has descendants we can't modify the layer + * NB: If the layer is owned and the owner has descendants we can't + * modify the layer. + * + * This function will allocate a new derived layer if you are trying + * to change the state of a layer with dependants (as described above) + * so you must always check the return value. + * + * If a new layer is returned it will be owned by required_owner. + * (NB: a layer is always modified with respect to a pipeline - the + * "required_owner") + * + * required_owner can only by NULL for new, currently unowned layers + * with no dependants. + */ +CoglPipelineLayer * +_cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + CoglTextureUnit *unit; + + /* Identify the case where the layer is new with no owner or + * dependants and so we don't need to do anything. */ + if (_cogl_list_empty (&COGL_NODE (layer)->children) && + layer->owner == NULL) + goto init_layer_state; + + /* We only allow a NULL required_owner for new layers */ + _COGL_RETURN_VAL_IF_FAIL (required_owner != NULL, layer); + + /* Chain up: + * A modification of a layer is indirectly also a modification of + * its owner so first make sure to flush the journal of any + * references to the current owner state and if necessary perform + * a copy-on-write for the required_owner if it has dependants. + */ + _cogl_pipeline_pre_change_notify (required_owner, + COGL_PIPELINE_STATE_LAYERS, + NULL, + TRUE); + + /* Unlike pipelines; layers are simply considered immutable once + * they have dependants - either direct children, or another + * pipeline as an owner. + */ + if (!_cogl_list_empty (&COGL_NODE (layer)->children) || + layer->owner != required_owner) + { + CoglPipelineLayer *new = _cogl_pipeline_layer_copy (layer); + if (layer->owner == required_owner) + _cogl_pipeline_remove_layer_difference (required_owner, layer, FALSE); + _cogl_pipeline_add_layer_difference (required_owner, new, FALSE); + cogl_object_unref (new); + layer = new; + goto init_layer_state; + } + + /* Note: At this point we know there is only one pipeline dependant on + * this layer (required_owner), and there are no other layers + * dependant on this layer so it's ok to modify it. */ + + /* NB: Although layers can have private state associated with them + * by multiple backends we know that a layer can't be *changed* if + * it has multiple dependants so if we reach here we know we only + * have a single owner and can only be associated with a single + * backend that needs to be notified of the layer change... + */ + if (required_owner->progend != COGL_PIPELINE_PROGEND_UNDEFINED) + { + const CoglPipelineProgend *progend = + _cogl_pipeline_progends[required_owner->progend]; + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[progend->fragend]; + const CoglPipelineVertend *vertend = + _cogl_pipeline_vertends[progend->vertend]; + + if (fragend->layer_pre_change_notify) + fragend->layer_pre_change_notify (required_owner, layer, change); + if (vertend->layer_pre_change_notify) + vertend->layer_pre_change_notify (required_owner, layer, change); + if (progend->layer_pre_change_notify) + progend->layer_pre_change_notify (required_owner, layer, change); + } + + /* If the layer being changed is the same as the last layer we + * flushed to the corresponding texture unit then we keep a track of + * the changes so we can try to minimize redundant OpenGL calls if + * the same layer is flushed again. + */ + unit = _cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer)); + if (unit->layer == layer) + unit->layer_changes_since_flush |= change; + +init_layer_state: + + if (required_owner) + required_owner->age++; + + if (change & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE && + !layer->has_big_state) + { + layer->big_state = g_slice_new (CoglPipelineLayerBigState); + layer->has_big_state = TRUE; + } + + /* Note: conceptually we have just been notified that a single + * property value is about to change, but since some state-groups + * contain multiple properties and 'layer' is about to take over + * being the authority for the property's corresponding state-group + * we need to maintain the integrity of the other property values + * too. + * + * To ensure this we handle multi-property state-groups by copying + * all the values from the old-authority to the new... + * + * We don't have to worry about non-sparse property groups since + * we never take over being an authority for such properties so + * they automatically maintain integrity. + */ + if (change & COGL_PIPELINE_LAYER_STATE_ALL_SPARSE && + !(layer->differences & change)) + { + _cogl_pipeline_layer_init_multi_property_sparse_state (layer, change); + layer->differences |= change; + } + + return layer; +} + +static void +_cogl_pipeline_layer_unparent (CoglNode *layer) +{ + /* Chain up */ + _cogl_pipeline_node_unparent_real (layer); +} + +static void +_cogl_pipeline_layer_set_parent (CoglPipelineLayer *layer, + CoglPipelineLayer *parent) +{ + /* Chain up */ + _cogl_pipeline_node_set_parent_real (COGL_NODE (layer), + COGL_NODE (parent), + _cogl_pipeline_layer_unparent, + TRUE); +} + +CoglPipelineLayer * +_cogl_pipeline_layer_copy (CoglPipelineLayer *src) +{ + CoglPipelineLayer *layer = g_slice_new (CoglPipelineLayer); + + _cogl_pipeline_node_init (COGL_NODE (layer)); + + layer->owner = NULL; + layer->index = src->index; + layer->differences = 0; + layer->has_big_state = FALSE; + + _cogl_pipeline_layer_set_parent (layer, src); + + return _cogl_pipeline_layer_object_new (layer); +} + +/* XXX: This is duplicated logic; the same as for + * _cogl_pipeline_prune_redundant_ancestry it would be nice to find a + * way to consolidate these functions! */ +void +_cogl_pipeline_layer_prune_redundant_ancestry (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *new_parent = _cogl_pipeline_layer_get_parent (layer); + + /* walk up past ancestors that are now redundant and potentially + * reparent the layer. */ + while (_cogl_pipeline_layer_get_parent (new_parent) && + (new_parent->differences | layer->differences) == + layer->differences) + new_parent = _cogl_pipeline_layer_get_parent (new_parent); + + _cogl_pipeline_layer_set_parent (layer, new_parent); +} + +/* Determine the mask of differences between two layers. + * + * XXX: If layers and pipelines could both be cast to a common Tree + * type of some kind then we could have a unified + * compare_differences() function. + */ +unsigned long +_cogl_pipeline_layer_compare_differences (CoglPipelineLayer *layer0, + CoglPipelineLayer *layer1) +{ + GSList *head0 = NULL; + GSList *head1 = NULL; + CoglPipelineLayer *node0; + CoglPipelineLayer *node1; + int len0 = 0; + int len1 = 0; + int count; + GSList *common_ancestor0; + GSList *common_ancestor1; + unsigned long layers_difference = 0; + + /* Algorithm: + * + * 1) Walk the ancestors of each layer to the root node, adding a + * pointer to each ancester node to two linked lists + * + * 2) Compare the lists to find the nodes where they start to + * differ marking the common_ancestor node for each list. + * + * 3) For each list now iterate starting after the common_ancestor + * nodes ORing each nodes ->difference mask into the final + * differences mask. + */ + + for (node0 = layer0; node0; node0 = _cogl_pipeline_layer_get_parent (node0)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head0; + link->data = node0; + head0 = link; + len0++; + } + for (node1 = layer1; node1; node1 = _cogl_pipeline_layer_get_parent (node1)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head1; + link->data = node1; + head1 = link; + len1++; + } + + /* NB: There's no point looking at the head entries since we know both layers + * must have the same default layer as their root node. */ + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + count = MIN (len0, len1) - 1; + while (count--) + { + if (head0->data != head1->data) + break; + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + } + + for (head0 = common_ancestor0->next; head0; head0 = head0->next) + { + node0 = head0->data; + layers_difference |= node0->differences; + } + for (head1 = common_ancestor1->next; head1; head1 = head1->next) + { + node1 = head1->data; + layers_difference |= node1->differences; + } + + return layers_difference; +} + +static CoglBool +layer_state_equal (CoglPipelineLayerStateIndex state_index, + CoglPipelineLayer **authorities0, + CoglPipelineLayer **authorities1, + CoglPipelineLayerStateComparitor comparitor) +{ + return comparitor (authorities0[state_index], authorities1[state_index]); +} + +void +_cogl_pipeline_layer_resolve_authorities (CoglPipelineLayer *layer, + unsigned long differences, + CoglPipelineLayer **authorities) +{ + unsigned long remaining = differences; + CoglPipelineLayer *authority = layer; + + do + { + unsigned long found = authority->differences & remaining; + int i; + + if (found == 0) + continue; + + for (i = 0; TRUE; i++) + { + unsigned long state = (1L< found) + break; + } + + remaining &= ~found; + if (remaining == 0) + return; + } + while ((authority = _cogl_pipeline_layer_get_parent (authority))); + + g_assert (remaining == 0); +} + +CoglBool +_cogl_pipeline_layer_equal (CoglPipelineLayer *layer0, + CoglPipelineLayer *layer1, + unsigned long differences_mask, + CoglPipelineEvalFlags flags) +{ + unsigned long layers_difference; + CoglPipelineLayer *authorities0[COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT]; + CoglPipelineLayer *authorities1[COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT]; + + if (layer0 == layer1) + return TRUE; + + layers_difference = + _cogl_pipeline_layer_compare_differences (layer0, layer1); + + /* Only compare the sparse state groups requested by the caller... */ + layers_difference &= differences_mask; + + _cogl_pipeline_layer_resolve_authorities (layer0, + layers_difference, + authorities0); + _cogl_pipeline_layer_resolve_authorities (layer1, + layers_difference, + authorities1); + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE) + { + CoglPipelineLayerStateIndex state_index = + COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX; + if (!_cogl_pipeline_layer_texture_type_equal (authorities0[state_index], + authorities1[state_index], + flags)) + return FALSE; + } + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA) + { + CoglPipelineLayerStateIndex state_index = + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA_INDEX; + if (!_cogl_pipeline_layer_texture_data_equal (authorities0[state_index], + authorities1[state_index], + flags)) + return FALSE; + } + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_COMBINE_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_combine_state_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_combine_constant_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_SAMPLER && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_SAMPLER_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_sampler_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_USER_MATRIX && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_USER_MATRIX_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_user_matrix_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_point_sprite_coords_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_vertex_snippets_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_fragment_snippets_equal)) + return FALSE; + + return TRUE; +} + +static void +_cogl_pipeline_layer_free (CoglPipelineLayer *layer) +{ + _cogl_pipeline_layer_unparent (COGL_NODE (layer)); + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA && + layer->texture != NULL) + cogl_object_unref (layer->texture); + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS) + _cogl_pipeline_snippet_list_free (&layer->big_state->vertex_snippets); + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS) + _cogl_pipeline_snippet_list_free (&layer->big_state->fragment_snippets); + + if (layer->differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE) + g_slice_free (CoglPipelineLayerBigState, layer->big_state); + + g_slice_free (CoglPipelineLayer, layer); +} + +void +_cogl_pipeline_init_default_layers (void) +{ + CoglPipelineLayer *layer = g_slice_new0 (CoglPipelineLayer); + CoglPipelineLayerBigState *big_state = + g_slice_new0 (CoglPipelineLayerBigState); + CoglPipelineLayer *new; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _cogl_pipeline_node_init (COGL_NODE (layer)); + + layer->index = 0; + + layer->differences = COGL_PIPELINE_LAYER_STATE_ALL_SPARSE; + + layer->unit_index = 0; + + layer->texture = NULL; + layer->texture_type = COGL_TEXTURE_TYPE_2D; + + layer->sampler_cache_entry = + _cogl_sampler_cache_get_default_entry (ctx->sampler_cache); + + layer->big_state = big_state; + layer->has_big_state = TRUE; + + /* Choose the same default combine mode as OpenGL: + * RGBA = MODULATE(PREVIOUS[RGBA],TEXTURE[RGBA]) */ + big_state->texture_combine_rgb_func = + COGL_PIPELINE_COMBINE_FUNC_MODULATE; + big_state->texture_combine_rgb_src[0] = + COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS; + big_state->texture_combine_rgb_src[1] = + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE; + big_state->texture_combine_rgb_op[0] = + COGL_PIPELINE_COMBINE_OP_SRC_COLOR; + big_state->texture_combine_rgb_op[1] = + COGL_PIPELINE_COMBINE_OP_SRC_COLOR; + big_state->texture_combine_alpha_func = + COGL_PIPELINE_COMBINE_FUNC_MODULATE; + big_state->texture_combine_alpha_src[0] = + COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS; + big_state->texture_combine_alpha_src[1] = + COGL_PIPELINE_COMBINE_SOURCE_TEXTURE; + big_state->texture_combine_alpha_op[0] = + COGL_PIPELINE_COMBINE_OP_SRC_ALPHA; + big_state->texture_combine_alpha_op[1] = + COGL_PIPELINE_COMBINE_OP_SRC_ALPHA; + + big_state->point_sprite_coords = FALSE; + + cogl_matrix_init_identity (&big_state->matrix); + + ctx->default_layer_0 = _cogl_pipeline_layer_object_new (layer); + + /* TODO: we should make default_layer_n comprise of two + * descendants of default_layer_0: + * - the first descendant should change the texture combine + * to what we expect is most commonly used for multitexturing + * - the second should revert the above change. + * + * why? the documentation for how a new layer is initialized + * doesn't say that layers > 0 have different defaults so unless + * we change the documentation we can't use different defaults, + * but if the user does what we expect and changes the + * texture combine then we can revert the authority to the + * first descendant which means we can maximize the number + * of layers with a common ancestor. + * + * The main problem will be that we'll need to disable the + * optimizations for flattening the ancestry when we make + * the second descendant which reverts the state. + */ + ctx->default_layer_n = _cogl_pipeline_layer_copy (layer); + new = _cogl_pipeline_set_layer_unit (NULL, ctx->default_layer_n, 1); + g_assert (new == ctx->default_layer_n); + /* Since we passed a newly allocated layer we don't expect that + * _set_layer_unit() will have to allocate *another* layer. */ + + /* Finally we create a dummy dependant for ->default_layer_n which + * effectively ensures that ->default_layer_n and ->default_layer_0 + * remain immutable. + */ + ctx->dummy_layer_dependant = + _cogl_pipeline_layer_copy (ctx->default_layer_n); +} + +void +_cogl_pipeline_layer_pre_paint (CoglPipelineLayer *layer) +{ + CoglPipelineLayer *texture_authority; + + texture_authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA); + + if (texture_authority->texture != NULL) + { + CoglTexturePrePaintFlags flags = 0; + CoglPipelineFilter min_filter; + CoglPipelineFilter mag_filter; + + _cogl_pipeline_layer_get_filters (layer, &min_filter, &mag_filter); + + if (min_filter == COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST + || min_filter == COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST + || min_filter == COGL_PIPELINE_FILTER_NEAREST_MIPMAP_LINEAR + || min_filter == COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR) + flags |= COGL_TEXTURE_NEEDS_MIPMAP; + + _cogl_texture_pre_paint (texture_authority->texture, flags); + } +} + +/* Determines if we need to handle the RGB and A texture combining + * separately or is the same function used for both channel masks and + * with the same arguments... + */ +CoglBool +_cogl_pipeline_layer_needs_combine_separate + (CoglPipelineLayer *combine_authority) +{ + CoglPipelineLayerBigState *big_state = combine_authority->big_state; + int n_args; + int i; + + if (big_state->texture_combine_rgb_func != + big_state->texture_combine_alpha_func) + return TRUE; + + n_args = _cogl_get_n_args_for_combine_func (big_state->texture_combine_rgb_func); + + for (i = 0; i < n_args; i++) + { + if (big_state->texture_combine_rgb_src[i] != + big_state->texture_combine_alpha_src[i]) + return TRUE; + + /* + * We can allow some variation of the source operands without + * needing a separation... + * + * "A = REPLACE (CONSTANT[A])" + either of the following... + * "RGB = REPLACE (CONSTANT[RGB])" + * "RGB = REPLACE (CONSTANT[A])" + * + * can be combined as: + * "RGBA = REPLACE (CONSTANT)" or + * "RGBA = REPLACE (CONSTANT[A])" or + * + * And "A = REPLACE (1-CONSTANT[A])" + either of the following... + * "RGB = REPLACE (1-CONSTANT)" or + * "RGB = REPLACE (1-CONSTANT[A])" + * + * can be combined as: + * "RGBA = REPLACE (1-CONSTANT)" or + * "RGBA = REPLACE (1-CONSTANT[A])" + */ + switch (big_state->texture_combine_alpha_op[i]) + { + case GL_SRC_ALPHA: + switch (big_state->texture_combine_rgb_op[i]) + { + case GL_SRC_COLOR: + case GL_SRC_ALPHA: + break; + default: + return FALSE; + } + break; + case GL_ONE_MINUS_SRC_ALPHA: + switch (big_state->texture_combine_rgb_op[i]) + { + case GL_ONE_MINUS_SRC_COLOR: + case GL_ONE_MINUS_SRC_ALPHA: + break; + default: + return FALSE; + } + break; + default: + return FALSE; /* impossible */ + } + } + + return FALSE; +} + + diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h new file mode 100644 index 0000000..845fdd8 --- /dev/null +++ b/cogl/cogl-pipeline-private.h @@ -0,0 +1,998 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_PRIVATE_H +#define __COGL_PIPELINE_PRIVATE_H + +#include "cogl-node-private.h" +#include "cogl-pipeline-layer-private.h" +#include "cogl-pipeline.h" +#include "cogl-matrix.h" +#include "cogl-object-private.h" +#include "cogl-profile.h" +#include "cogl-list.h" +#include "cogl-boxed-value.h" +#include "cogl-pipeline-snippet-private.h" +#include "cogl-pipeline-state.h" +#include "cogl-framebuffer.h" +#include "cogl-bitmask.h" + +#include + +#ifdef HAVE_COGL_GL + +#define COGL_PIPELINE_PROGEND_FIXED_ARBFP 0 +#define COGL_PIPELINE_PROGEND_FIXED 1 +#define COGL_PIPELINE_PROGEND_GLSL 2 +#define COGL_PIPELINE_N_PROGENDS 3 + +#define COGL_PIPELINE_VERTEND_FIXED 0 +#define COGL_PIPELINE_VERTEND_GLSL 1 +#define COGL_PIPELINE_N_VERTENDS 2 + +#define COGL_PIPELINE_FRAGEND_ARBFP 0 +#define COGL_PIPELINE_FRAGEND_FIXED 1 +#define COGL_PIPELINE_FRAGEND_GLSL 2 +#define COGL_PIPELINE_N_FRAGENDS 3 + +#else /* HAVE_COGL_GL */ + +#ifdef HAVE_COGL_GLES2 + +#define COGL_PIPELINE_PROGEND_GLSL 0 +#define COGL_PIPELINE_VERTEND_GLSL 0 +#define COGL_PIPELINE_FRAGEND_GLSL 0 + +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_PROGEND_FIXED 1 +#define COGL_PIPELINE_VERTEND_FIXED 1 +#define COGL_PIPELINE_FRAGEND_FIXED 1 + +#define COGL_PIPELINE_N_PROGENDS 2 +#define COGL_PIPELINE_N_VERTENDS 2 +#define COGL_PIPELINE_N_FRAGENDS 2 +#else +#define COGL_PIPELINE_N_PROGENDS 1 +#define COGL_PIPELINE_N_VERTENDS 1 +#define COGL_PIPELINE_N_FRAGENDS 1 +#endif + +#else /* HAVE_COGL_GLES2 */ + +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_PROGEND_FIXED 0 +#define COGL_PIPELINE_VERTEND_FIXED 0 +#define COGL_PIPELINE_FRAGEND_FIXED 0 +#define COGL_PIPELINE_N_PROGENDS 1 +#define COGL_PIPELINE_N_VERTENDS 1 +#define COGL_PIPELINE_N_FRAGENDS 1 +#else +#error No drivers defined +#endif + +#endif /* HAVE_COGL_GLES2 */ + +#endif /* HAVE_COGL_GL */ + +#define COGL_PIPELINE_PROGEND_DEFAULT 0 +#define COGL_PIPELINE_PROGEND_UNDEFINED 3 + +/* XXX: should I rename these as + * COGL_PIPELINE_STATE_INDEX_XYZ... ? + */ +typedef enum +{ + /* sparse state */ + COGL_PIPELINE_STATE_COLOR_INDEX, + COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX, + COGL_PIPELINE_STATE_LAYERS_INDEX, + COGL_PIPELINE_STATE_LIGHTING_INDEX, + COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX, + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX, + COGL_PIPELINE_STATE_BLEND_INDEX, + COGL_PIPELINE_STATE_USER_SHADER_INDEX, + COGL_PIPELINE_STATE_DEPTH_INDEX, + COGL_PIPELINE_STATE_FOG_INDEX, + COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX, + COGL_PIPELINE_STATE_POINT_SIZE_INDEX, + COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX, + COGL_PIPELINE_STATE_LOGIC_OPS_INDEX, + COGL_PIPELINE_STATE_CULL_FACE_INDEX, + COGL_PIPELINE_STATE_UNIFORMS_INDEX, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS_INDEX, + + /* non-sparse */ + COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX, + + COGL_PIPELINE_STATE_COUNT +} CoglPipelineStateIndex; + +#define COGL_PIPELINE_STATE_SPARSE_COUNT (COGL_PIPELINE_STATE_COUNT - 1) + +/* Used in pipeline->differences masks and for notifying pipeline + * state changes. + * + * XXX: If you add or remove state groups here you may need to update + * some of the state masks following this enum too! + * + * FIXME: perhaps it would be better to rename this enum to + * CoglPipelineStateGroup to better convey the fact that a single enum + * here can map to multiple properties. + */ +typedef enum _CoglPipelineState +{ + COGL_PIPELINE_STATE_COLOR = + 1L<big_state. + */ + + /* Layers represent their state in a tree structure where some of + * the state relating to a given pipeline or layer may actually be + * owned by one if is ancestors in the tree. We have a common data + * type to track the tree heirachy so we can share code... */ + CoglNode _parent; + + /* When weak pipelines are destroyed the user is notified via this + * callback */ + CoglPipelineDestroyCallback destroy_callback; + + /* When notifying that a weak pipeline has been destroyed this + * private data is passed to the above callback */ + void *destroy_data; + + /* We need to track if a pipeline is referenced in the journal + * because we can't allow modification to these pipelines without + * flushing the journal first */ + unsigned int journal_ref_count; + + /* A mask of which sparse state groups are different in this + * pipeline in comparison to its parent. */ + unsigned int differences; + + /* Whenever a pipeline is modified we increment the age. There's no + * guarantee that it won't wrap but it can nevertheless be a + * convenient mechanism to determine when a pipeline has been + * changed to you can invalidate some some associated cache that + * depends on the old state. */ + unsigned int age; + + /* This is the primary color of the pipeline. + * + * This is a sparse property, ref COGL_PIPELINE_STATE_COLOR */ + CoglColor color; + + /* A pipeline may be made up with multiple layers used to combine + * textures together. + * + * This is sparse state, ref COGL_PIPELINE_STATE_LAYERS */ + unsigned int n_layers; + GList *layer_differences; + + /* As a basic way to reduce memory usage we divide the pipeline + * state into two groups; the minimal state modified in 90% of + * all pipelines and the rest, so that the second group can + * be allocated dynamically when required... */ + CoglPipelineBigState *big_state; + +#ifdef COGL_DEBUG_ENABLED + /* For debugging purposes it's possible to associate a static const + * string with a pipeline which can be an aid when trying to trace + * where the pipeline originates from */ + const char *static_breadcrumb; +#endif + + /* Cached state... */ + + /* A cached, complete list of the layers this pipeline depends + * on sorted by layer->unit_index. */ + CoglPipelineLayer **layers_cache; + /* To avoid a separate ->layers_cache allocation for common + * pipelines with only a few layers... */ + CoglPipelineLayer *short_layers_cache[3]; + + /* The deprecated cogl_pipeline_get_layers() API returns a + * const GList of layers, which we track here... */ + GList *deprecated_get_layers_list; + + /* XXX: consider adding an authorities cache to speed up sparse + * property value lookups: + * CoglPipeline *authorities_cache[COGL_PIPELINE_N_SPARSE_PROPERTIES]; + * and corresponding authorities_cache_dirty:1 bitfield + */ + + /* bitfields */ + + /* Weak pipelines don't count as dependants on their parents which + * means that the parent pipeline can be modified without + * considering how the modifications may affect the weak pipeline. + */ + unsigned int is_weak:1; + + /* Determines if pipeline->big_state is valid */ + unsigned int has_big_state:1; + + /* By default blending is enabled automatically depending on the + * unlit color, the lighting colors or the texture format. The user + * can override this to explicitly enable or disable blending. + * + * This is a sparse property */ + unsigned int blend_enable:3; + + /* There are many factors that can determine if we need to enable + * blending, this holds our final decision */ + unsigned int real_blend_enable:1; + + /* Since the code for deciding if blending really needs to be + * enabled for a particular pipeline is quite expensive we update + * the real_blend_enable flag lazily when flushing a pipeline if + * this dirty flag has been set. */ + unsigned int dirty_real_blend_enable:1; + + /* Whenever a pipeline is flushed we keep track of whether the + * pipeline was used with a color attribute where we don't know + * whether the colors are opaque. The real_blend_enable state + * depends on this, and must be updated whenever this changes (even + * if dirty_real_blend_enable isn't set) */ + unsigned int unknown_color_alpha:1; + + unsigned int layers_cache_dirty:1; + unsigned int deprecated_get_layers_list_dirty:1; + +#ifdef COGL_DEBUG_ENABLED + /* For debugging purposes it's possible to associate a static const + * string with a pipeline which can be an aid when trying to trace + * where the pipeline originates from */ + unsigned int has_static_breadcrumb:1; +#endif + + /* There are multiple fragment and vertex processing backends for + * CoglPipeline, glsl, arbfp and fixed that are bundled under a + * "progend". This identifies the backend being used for the + * pipeline. */ + unsigned int progend:3; +}; + +typedef struct _CoglPipelineFragend +{ + void (*start) (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference); + CoglBool (*add_layer) (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference); + CoglBool (*passthrough) (CoglPipeline *pipeline); + CoglBool (*end) (CoglPipeline *pipeline, + unsigned long pipelines_difference); + + void (*pipeline_pre_change_notify) (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color); + void (*pipeline_set_parent_notify) (CoglPipeline *pipeline); + void (*layer_pre_change_notify) (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); +} CoglPipelineFragend; + +typedef struct _CoglPipelineVertend +{ + void (*start) (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference); + CoglBool (*add_layer) (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference, + CoglFramebuffer *framebuffer); + CoglBool (*end) (CoglPipeline *pipeline, + unsigned long pipelines_difference); + + void (*pipeline_pre_change_notify) (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color); + void (*layer_pre_change_notify) (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); +} CoglPipelineVertend; + +typedef struct +{ + int vertend; + int fragend; + CoglBool (*start) (CoglPipeline *pipeline); + void (*end) (CoglPipeline *pipeline, + unsigned long pipelines_difference); + void (*pipeline_pre_change_notify) (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color); + void (*layer_pre_change_notify) (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); + /* This is called after all of the other functions whenever the + pipeline is flushed, even if the pipeline hasn't changed since + the last flush */ + void (* pre_paint) (CoglPipeline *pipeline, CoglFramebuffer *framebuffer); +} CoglPipelineProgend; + +typedef enum +{ + COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1, + COGL_PIPELINE_PROGRAM_TYPE_ARBFP, + COGL_PIPELINE_PROGRAM_TYPE_FIXED +} CoglPipelineProgramType; + +extern const CoglPipelineFragend * +_cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS]; +extern const CoglPipelineVertend * +_cogl_pipeline_vertends[COGL_PIPELINE_N_VERTENDS]; +extern const CoglPipelineProgend * +_cogl_pipeline_progends[]; + +void +_cogl_pipeline_init_default_pipeline (void); + +static inline CoglPipeline * +_cogl_pipeline_get_parent (CoglPipeline *pipeline) +{ + CoglNode *parent_node = COGL_NODE (pipeline)->parent; + return COGL_PIPELINE (parent_node); +} + +static inline CoglPipeline * +_cogl_pipeline_get_authority (CoglPipeline *pipeline, + unsigned long difference) +{ + CoglPipeline *authority = pipeline; + while (!(authority->differences & difference)) + authority = _cogl_pipeline_get_parent (authority); + return authority; +} + +typedef CoglBool (*CoglPipelineStateComparitor) (CoglPipeline *authority0, + CoglPipeline *authority1); + +void +_cogl_pipeline_update_authority (CoglPipeline *pipeline, + CoglPipeline *authority, + CoglPipelineState state, + CoglPipelineStateComparitor comparitor); + +void +_cogl_pipeline_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color, + CoglBool from_layer_change); + +void +_cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline); + +void +_cogl_pipeline_update_real_blend_enable (CoglPipeline *pipeline, + CoglBool unknown_color_alpha); + +typedef enum +{ + COGL_PIPELINE_GET_LAYER_NO_CREATE = 1<<0 +} CoglPipelineGetLayerFlags; + +CoglPipelineLayer * +_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, + int layer_index, + CoglPipelineGetLayerFlags flags); + +#define _cogl_pipeline_get_layer(p, l) \ + _cogl_pipeline_get_layer_with_flags (p, l, 0) + +CoglBool +_cogl_is_pipeline_layer (void *object); + +void +_cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority, + CoglPipelineLayer *layer); + +/* + * SECTION:cogl-pipeline-internals + * @short_description: Functions for creating custom primitives that make use + * of Cogl pipelines for filling. + * + * Normally you shouldn't need to use this API directly, but if you need to + * developing a custom/specialised primitive - probably using raw OpenGL - then + * this API aims to expose enough of the pipeline internals to support being + * able to fill your geometry according to a given Cogl pipeline. + */ + +CoglBool +_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline); + +/* + * Calls the pre_paint method on the layer texture if there is + * one. This will determine whether mipmaps are needed based on the + * filter settings. + */ +void +_cogl_pipeline_pre_paint_for_layer (CoglPipeline *pipeline, + int layer_id); + +/* + * CoglPipelineFlushFlag: + * @COGL_PIPELINE_FLUSH_FALLBACK_MASK: The fallback_layers member is set to + * a uint32_t mask of the layers that can't be supported with the user + * supplied texture and need to be replaced with fallback textures. (1 = + * fallback, and the least significant bit = layer 0) + * @COGL_PIPELINE_FLUSH_DISABLE_MASK: The disable_layers member is set to + * a uint32_t mask of the layers that you want to completly disable + * texturing for (1 = fallback, and the least significant bit = layer 0) + * @COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE: The layer0_override_texture member is + * set to a GLuint OpenGL texture name to override the texture used for + * layer 0 of the pipeline. This is intended for dealing with sliced + * textures where you will need to point to each of the texture slices in + * turn when drawing your geometry. Passing a value of 0 is the same as + * not passing the option at all. + * @COGL_PIPELINE_FLUSH_SKIP_GL_COLOR: When flushing the GL state for the + * pipeline don't call glColor. + */ +typedef enum _CoglPipelineFlushFlag +{ + COGL_PIPELINE_FLUSH_FALLBACK_MASK = 1L<<0, + COGL_PIPELINE_FLUSH_DISABLE_MASK = 1L<<1, + COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE = 1L<<2, + COGL_PIPELINE_FLUSH_SKIP_GL_COLOR = 1L<<3 +} CoglPipelineFlushFlag; + +/* + * CoglPipelineFlushOptions: + * + */ +typedef struct _CoglPipelineFlushOptions +{ + CoglPipelineFlushFlag flags; + + uint32_t fallback_layers; + uint32_t disable_layers; + CoglTexture *layer0_override_texture; +} CoglPipelineFlushOptions; + +void +_cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type); + +void +_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type); + +unsigned int +_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func); + +/* + * _cogl_pipeline_weak_copy: + * @pipeline: A #CoglPipeline object + * @callback: A callback to notify when your weak pipeline is destroyed + * @user_data: Private data to pass to your given callback. + * + * Returns a weak copy of the given source @pipeline. Unlike a normal + * copy no internal reference is taken on the source @pipeline and you + * can expect that later modifications of the source pipeline (or in + * fact any other pipeline) can result in the weak pipeline being + * destroyed. + * + * To understand this better its good to know a bit about the internal + * design of #CoglPipeline... + * + * Internally #CoglPipelines are represented as a graph of + * property diff's, where each node is a diff of properties that gets + * applied on top of its parent. Copying a pipeline creates an empty + * diff and a child->parent relationship between the empty diff and + * the source @pipeline, parent. + * + * Because of this internal graph design a single #CoglPipeline may + * indirectly depend on a chain of ancestors to fully define all of + * its properties. Because a node depends on its ancestors it normally + * owns a reference to its parent to stop it from being freed. Also if + * you try to modify a pipeline with children we internally use a + * copy-on-write mechanism to ensure that you don't indirectly change + * the properties those children. + * + * Weak pipelines avoid the use of copy-on-write to preserve the + * integrity of weak dependants and instead weak dependants are + * simply destroyed allowing the parent to be modified directly. Also + * because weak pipelines don't own a reference to their parent they + * won't stop the source @pipeline from being freed when the user + * releases their reference on it. + * + * Because weak pipelines don't own a reference on their parent they + * are the recommended mechanism for creating derived pipelines that you + * want to cache as a private property of the original pipeline + * because they won't result in a circular dependency. + * + * An example use case: + * + * Consider for example you are implementing a custom primitive that is + * not compatible with certain source pipelines. To handle this you + * implement a validation stage that given an arbitrary pipeline as + * input will create a derived pipeline that is suitable for drawing + * your primitive. + * + * Because you don't want to have to repeat this validation every time + * the same incompatible pipeline is given as input you want to cache + * the result as a private property of the original pipeline. If the + * derived pipeline were created using cogl_pipeline_copy that would + * create a circular dependency so the original pipeline can never be + * freed. + * + * If you instead create a weak copy you won't stop the original pipeline + * from being freed if it's no longer needed, and you will instead simply + * be notified that your weak pipeline has been destroyed. + * + * This is the recommended coding pattern for validating an input + * pipeline and caching a derived result: + * |[ + * static CoglUserDataKey _cogl_my_cache_key; + * + * typedef struct { + * CoglPipeline *validated_source; + * } MyValidatedMaterialCache; + * + * static void + * destroy_cache_cb (CoglObject *object, void *user_data) + * { + * g_slice_free (MyValidatedMaterialCache, user_data); + * } + * + * static void + * invalidate_cache_cb (CoglPipeline *destroyed, void *user_data) + * { + * MyValidatedMaterialCache *cache = user_data; + * cogl_object_unref (cache->validated_source); + * cache->validated_source = NULL; + * } + * + * static CoglPipeline * + * get_validated_pipeline (CoglPipeline *source) + * { + * MyValidatedMaterialCache *cache = + * cogl_object_get_user_data (COGL_OBJECT (source), + * &_cogl_my_cache_key); + * if (G_UNLIKELY (cache == NULL)) + * { + * cache = g_slice_new (MyValidatedMaterialCache); + * cogl_object_set_user_data (COGL_OBJECT (source), + * &_cogl_my_cache_key, + * cache, destroy_cache_cb); + * cache->validated_source = source; + * } + * + * if (G_UNLIKELY (cache->validated_source == NULL)) + * { + * cache->validated_source = source; + * + * / * Start validating source... * / + * + * / * If you find you need to change something... * / + * if (cache->validated_source == source) + * cache->validated_source = + * cogl_pipeline_weak_copy (source, + * invalidate_cache_cb, + * cache); + * + * / * Modify cache->validated_source * / + * } + * + * return cache->validated_source; + * } + * ]| + */ +CoglPipeline * +_cogl_pipeline_weak_copy (CoglPipeline *pipeline, + CoglPipelineDestroyCallback callback, + void *user_data); + +void +_cogl_pipeline_set_progend (CoglPipeline *pipeline, int progend); + +CoglPipeline * +_cogl_pipeline_get_parent (CoglPipeline *pipeline); + +void +_cogl_pipeline_get_colorubv (CoglPipeline *pipeline, + uint8_t *color); + +/* XXX: At some point it could be good for this to accept a mask of + * the state groups we are interested in comparing since we can + * probably use that information in a number situations to reduce + * the work we do. */ +unsigned long +_cogl_pipeline_compare_differences (CoglPipeline *pipeline0, + CoglPipeline *pipeline1); + +CoglBool +_cogl_pipeline_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1, + unsigned int differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags); + +unsigned int +_cogl_pipeline_hash (CoglPipeline *pipeline, + unsigned int differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags); + +/* Makes a copy of the given pipeline that is a child of the root + * pipeline rather than a child of the source pipeline. That way the + * new pipeline won't hold a reference to the source pipeline. The + * differences specified in @differences and @layer_differences are + * copied across and all other state is left with the default + * values. */ +CoglPipeline * +_cogl_pipeline_deep_copy (CoglPipeline *pipeline, + unsigned long differences, + unsigned long layer_differences); + +CoglPipeline * +_cogl_pipeline_journal_ref (CoglPipeline *pipeline); + +void +_cogl_pipeline_journal_unref (CoglPipeline *pipeline); + +const CoglMatrix * +_cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, + int layer_index); + +void +_cogl_pipeline_texture_storage_change_notify (CoglTexture *texture); + +void +_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline); + +void +_cogl_pipeline_apply_overrides (CoglPipeline *pipeline, + CoglPipelineFlushOptions *options); + +CoglPipelineBlendEnable +_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline); + +void +_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline, + CoglPipelineBlendEnable enable); + +CoglBool +_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline); + +#ifdef COGL_DEBUG_ENABLED +void +_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline, + const char *breadcrumb); +#endif + +unsigned long +_cogl_pipeline_get_age (CoglPipeline *pipeline); + +CoglPipeline * +_cogl_pipeline_get_authority (CoglPipeline *pipeline, + unsigned long difference); + +void +_cogl_pipeline_add_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglBool inc_n_layers); + +void +_cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglBool dec_n_layers); + +CoglPipeline * +_cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline, + CoglPipelineState pipeline_state, + CoglPipelineLayerState layer_state); + +void +_cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline, + int layer_index, + float *constant); + +void +_cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n); + + +/* + * API to support the deprecate cogl_pipeline_layer_xyz functions... + */ + +const GList * +_cogl_pipeline_get_layers (CoglPipeline *pipeline); + +typedef CoglBool (*CoglPipelineInternalLayerCallback) (CoglPipelineLayer *layer, + void *user_data); + +void +_cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline, + CoglPipelineInternalLayerCallback callback, + void *user_data); + +CoglBool +_cogl_pipeline_layer_numbers_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1); + +CoglBool +_cogl_pipeline_layer_and_unit_numbers_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1); + +CoglBool +_cogl_pipeline_need_texture_combine_separate + (CoglPipelineLayer *combine_authority); + +void +_cogl_pipeline_init_state_hash_functions (void); + +void +_cogl_pipeline_init_layer_state_hash_functions (void); + +CoglPipelineState +_cogl_pipeline_get_state_for_vertex_codegen (CoglContext *context); + +CoglPipelineLayerState +_cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context); + +CoglPipelineState +_cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context); + +#endif /* __COGL_PIPELINE_PRIVATE_H */ + diff --git a/cogl/cogl-pipeline-snippet-private.h b/cogl/cogl-pipeline-snippet-private.h new file mode 100644 index 0000000..7a9d233 --- /dev/null +++ b/cogl/cogl-pipeline-snippet-private.h @@ -0,0 +1,116 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_SNIPPET_PRIVATE_H +#define __COGL_PIPELINE_SNIPPET_PRIVATE_H + +#include + +#include "cogl-snippet.h" + +typedef struct +{ + GList *entries; +} CoglPipelineSnippetList; + +/* Arguments to pass to _cogl_pipeline_snippet_generate_code() */ +typedef struct +{ + CoglPipelineSnippetList *snippets; + + /* Only snippets at this hook point will be used */ + CoglSnippetHook hook; + + /* The final function to chain on to after all of the snippets code + has been run */ + const char *chain_function; + + /* The name of the final generated function */ + const char *final_name; + + /* A prefix to insert before each generate function name */ + const char *function_prefix; + + /* The return type of all of the functions, or NULL to use void */ + const char *return_type; + + /* A variable to return from the functions. The snippets are + expected to modify this variable. Ignored if return_type is + NULL */ + const char *return_variable; + + /* If this is TRUE then it won't allocate a separate variable for + the return value. Instead it is expected that the snippet will + modify one of the argument variables directly and that will be + returned */ + CoglBool return_variable_is_argument; + + /* The argument names or NULL if there are none */ + const char *arguments; + + /* The argument types or NULL */ + const char *argument_declarations; + + /* The string to generate the source into */ + GString *source_buf; +} CoglPipelineSnippetData; + +void +_cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data); + +void +_cogl_pipeline_snippet_generate_declarations (GString *declarations_buf, + CoglSnippetHook hook, + CoglPipelineSnippetList *list); + +void +_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list); + +void +_cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list, + CoglSnippet *snippet); + +void +_cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst, + const CoglPipelineSnippetList *src); + +void +_cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list, + unsigned int *hash); + +CoglBool +_cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0, + CoglPipelineSnippetList *list1); + +#endif /* __COGL_PIPELINE_SNIPPET_PRIVATE_H */ + diff --git a/cogl/cogl-pipeline-snippet.c b/cogl/cogl-pipeline-snippet.c new file mode 100644 index 0000000..59f85b3 --- /dev/null +++ b/cogl/cogl-pipeline-snippet.c @@ -0,0 +1,286 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-types.h" +#include "cogl-pipeline-snippet-private.h" +#include "cogl-snippet-private.h" +#include "cogl-util.h" + +/* Helper functions that are used by both GLSL pipeline backends */ + +void +_cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data) +{ + GList *first_snippet, *l; + CoglSnippet *snippet; + int snippet_num = 0; + int n_snippets = 0; + + first_snippet = data->snippets->entries; + + /* First count the number of snippets so we can easily tell when + we're at the last one */ + for (l = data->snippets->entries; l; l = l->next) + { + snippet = l->data; + + if (snippet->hook == data->hook) + { + /* Don't bother processing any previous snippets if we reach + one that has a replacement */ + if (snippet->replace) + { + n_snippets = 1; + first_snippet = l; + } + else + n_snippets++; + } + } + + /* If there weren't any snippets then generate a stub function with + the final name */ + if (n_snippets == 0) + { + if (data->return_type) + g_string_append_printf (data->source_buf, + "\n" + "%s\n" + "%s (%s)\n" + "{\n" + " return %s (%s);\n" + "}\n", + data->return_type, + data->final_name, + data->argument_declarations ? + data->argument_declarations : "", + data->chain_function, + data->arguments ? data->arguments : ""); + else + g_string_append_printf (data->source_buf, + "\n" + "void\n" + "%s (%s)\n" + "{\n" + " %s (%s);\n" + "}\n", + data->final_name, + data->argument_declarations ? + data->argument_declarations : "", + data->chain_function, + data->arguments ? data->arguments : ""); + + return; + } + + for (l = first_snippet; snippet_num < n_snippets; l = l->next) + { + snippet = l->data; + + if (snippet->hook == data->hook) + { + const char *source; + + if ((source = cogl_snippet_get_declarations (snippet))) + g_string_append (data->source_buf, source); + + g_string_append_printf (data->source_buf, + "\n" + "%s\n", + data->return_type ? + data->return_type : + "void"); + + if (snippet_num + 1 < n_snippets) + g_string_append_printf (data->source_buf, + "%s_%i", + data->function_prefix, + snippet_num); + else + g_string_append (data->source_buf, data->final_name); + + g_string_append (data->source_buf, " ("); + + if (data->argument_declarations) + g_string_append (data->source_buf, data->argument_declarations); + + g_string_append (data->source_buf, + ")\n" + "{\n"); + + if (data->return_type && !data->return_variable_is_argument) + g_string_append_printf (data->source_buf, + " %s %s;\n" + "\n", + data->return_type, + data->return_variable); + + if ((source = cogl_snippet_get_pre (snippet))) + g_string_append (data->source_buf, source); + + /* Chain on to the next function, or bypass it if there is + a replace string */ + if ((source = cogl_snippet_get_replace (snippet))) + g_string_append (data->source_buf, source); + else + { + g_string_append (data->source_buf, " "); + + if (data->return_type) + g_string_append_printf (data->source_buf, + "%s = ", + data->return_variable); + + if (snippet_num > 0) + g_string_append_printf (data->source_buf, + "%s_%i", + data->function_prefix, + snippet_num - 1); + else + g_string_append (data->source_buf, data->chain_function); + + g_string_append (data->source_buf, " ("); + + if (data->arguments) + g_string_append (data->source_buf, data->arguments); + + g_string_append (data->source_buf, ");\n"); + } + + if ((source = cogl_snippet_get_post (snippet))) + g_string_append (data->source_buf, source); + + if (data->return_type) + g_string_append_printf (data->source_buf, + " return %s;\n", + data->return_variable); + + g_string_append (data->source_buf, "}\n"); + snippet_num++; + } + } +} + +void +_cogl_pipeline_snippet_generate_declarations (GString *declarations_buf, + CoglSnippetHook hook, + CoglPipelineSnippetList *snippets) +{ + GList *l; + + for (l = snippets->entries; l; l = l->next) + { + CoglSnippet *snippet = l->data; + + if (snippet->hook == hook) + { + const char *source; + + if ((source = cogl_snippet_get_declarations (snippet))) + g_string_append (declarations_buf, source); + } + } +} + +void +_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list) +{ + GList *l, *tmp; + + for (l = list->entries; l; l = tmp) + { + tmp = l->next; + + cogl_object_unref (l->data); + g_list_free_1 (l); + } +} + +void +_cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list, + CoglSnippet *snippet) +{ + list->entries = g_list_append (list->entries, cogl_object_ref (snippet)); + + _cogl_snippet_make_immutable (snippet); +} + +void +_cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst, + const CoglPipelineSnippetList *src) +{ + GQueue queue = G_QUEUE_INIT; + const GList *l; + + for (l = src->entries; l; l = l->next) + g_queue_push_tail (&queue, cogl_object_ref (l->data)); + + dst->entries = queue.head; +} + +void +_cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list, + unsigned int *hash) +{ + GList *l; + + for (l = list->entries; l; l = l->next) + { + CoglSnippet *snippet = l->data; + + *hash = _cogl_util_one_at_a_time_hash (*hash, + &snippet, + sizeof (CoglSnippet *)); + } +} + +CoglBool +_cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0, + CoglPipelineSnippetList *list1) +{ + GList *l0, *l1; + + for (l0 = list0->entries, l1 = list1->entries; + l0 && l1; + l0 = l0->next, l1 = l1->next) + if (l0->data != l1->data) + return FALSE; + + return l0 == NULL && l1 == NULL; +} diff --git a/cogl/cogl-pipeline-state-private.h b/cogl/cogl-pipeline-state-private.h new file mode 100644 index 0000000..366683e --- /dev/null +++ b/cogl/cogl-pipeline-state-private.h @@ -0,0 +1,196 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_STATE_PRIVATE_H +#define __COGL_PIPELINE_STATE_PRIVATE_H + +CoglPipeline * +_cogl_pipeline_get_user_program (CoglPipeline *pipeline); + +CoglBool +_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline); + +CoglBool +_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline); + +CoglBool +_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline); + +CoglBool +_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline); + +void +_cogl_pipeline_set_fog_state (CoglPipeline *pipeline, + const CoglPipelineFogState *fog_state); + +CoglBool +_cogl_pipeline_color_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_alpha_func_reference_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_blend_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_depth_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_fog_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_non_zero_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1); +CoglBool +_cogl_pipeline_per_vertex_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_logic_ops_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_user_shader_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_cull_face_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_uniforms_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_vertex_snippets_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +CoglBool +_cogl_pipeline_fragment_snippets_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +void +_cogl_pipeline_hash_color_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_layers_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_lighting_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_alpha_func_reference_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_blend_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_user_shader_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_depth_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_fog_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_non_zero_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_per_vertex_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_logic_ops_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_cull_face_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_uniforms_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_vertex_snippets_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_hash_fragment_snippets_state (CoglPipeline *authority, + CoglPipelineHashState *state); + +void +_cogl_pipeline_compare_uniform_differences (unsigned long *differences, + CoglPipeline *pipeline0, + CoglPipeline *pipeline1); + +#endif /* __COGL_PIPELINE_STATE_PRIVATE_H */ diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c new file mode 100644 index 0000000..04c76f8 --- /dev/null +++ b/cogl/cogl-pipeline-state.c @@ -0,0 +1,2171 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-color-private.h" +#include "cogl-blend-string.h" +#include "cogl-util.h" +#include "cogl-depth-state-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-snippet-private.h" +#include "cogl-error-private.h" + +#include + +#include "string.h" + +#ifndef GL_FUNC_ADD +#define GL_FUNC_ADD 0x8006 +#endif + +CoglPipeline * +_cogl_pipeline_get_user_program (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER); + + return authority->big_state->user_program; +} + +CoglBool +_cogl_pipeline_color_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return cogl_color_equal (&authority0->color, &authority1->color); +} + +CoglBool +_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineLightingState *state0 = &authority0->big_state->lighting_state; + CoglPipelineLightingState *state1 = &authority1->big_state->lighting_state; + + if (memcmp (state0->ambient, state1->ambient, sizeof (float) * 4) != 0) + return FALSE; + if (memcmp (state0->diffuse, state1->diffuse, sizeof (float) * 4) != 0) + return FALSE; + if (memcmp (state0->specular, state1->specular, sizeof (float) * 4) != 0) + return FALSE; + if (memcmp (state0->emission, state1->emission, sizeof (float) * 4) != 0) + return FALSE; + if (state0->shininess != state1->shininess) + return FALSE; + + return TRUE; +} + +CoglBool +_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineAlphaFuncState *alpha_state0 = + &authority0->big_state->alpha_state; + CoglPipelineAlphaFuncState *alpha_state1 = + &authority1->big_state->alpha_state; + + return alpha_state0->alpha_func == alpha_state1->alpha_func; +} + +CoglBool +_cogl_pipeline_alpha_func_reference_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineAlphaFuncState *alpha_state0 = + &authority0->big_state->alpha_state; + CoglPipelineAlphaFuncState *alpha_state1 = + &authority1->big_state->alpha_state; + + return (alpha_state0->alpha_func_reference == + alpha_state1->alpha_func_reference); +} + +CoglBool +_cogl_pipeline_blend_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineBlendState *blend_state0 = &authority0->big_state->blend_state; + CoglPipelineBlendState *blend_state1 = &authority1->big_state->blend_state; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (blend_state0->blend_equation_rgb != blend_state1->blend_equation_rgb) + return FALSE; + + if (blend_state0->blend_equation_alpha != + blend_state1->blend_equation_alpha) + return FALSE; + if (blend_state0->blend_src_factor_alpha != + blend_state1->blend_src_factor_alpha) + return FALSE; + if (blend_state0->blend_dst_factor_alpha != + blend_state1->blend_dst_factor_alpha) + return FALSE; + + if (blend_state0->blend_src_factor_rgb != + blend_state1->blend_src_factor_rgb) + return FALSE; + if (blend_state0->blend_dst_factor_rgb != + blend_state1->blend_dst_factor_rgb) + return FALSE; + + if (blend_state0->blend_src_factor_rgb == GL_ONE_MINUS_CONSTANT_COLOR || + blend_state0->blend_src_factor_rgb == GL_CONSTANT_COLOR || + blend_state0->blend_dst_factor_rgb == GL_ONE_MINUS_CONSTANT_COLOR || + blend_state0->blend_dst_factor_rgb == GL_CONSTANT_COLOR) + { + if (!cogl_color_equal (&blend_state0->blend_constant, + &blend_state1->blend_constant)) + return FALSE; + } + + return TRUE; +} + +CoglBool +_cogl_pipeline_depth_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + if (authority0->big_state->depth_state.test_enabled == FALSE && + authority1->big_state->depth_state.test_enabled == FALSE) + return TRUE; + else + { + CoglDepthState *s0 = &authority0->big_state->depth_state; + CoglDepthState *s1 = &authority1->big_state->depth_state; + return s0->test_enabled == s1->test_enabled && + s0->test_function == s1->test_function && + s0->write_enabled == s1->write_enabled && + s0->range_near == s1->range_near && + s0->range_far == s1->range_far; + } +} + +CoglBool +_cogl_pipeline_fog_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineFogState *fog_state0 = &authority0->big_state->fog_state; + CoglPipelineFogState *fog_state1 = &authority1->big_state->fog_state; + + if (fog_state0->enabled == fog_state1->enabled && + cogl_color_equal (&fog_state0->color, &fog_state1->color) && + fog_state0->mode == fog_state1->mode && + fog_state0->density == fog_state1->density && + fog_state0->z_near == fog_state1->z_near && + fog_state0->z_far == fog_state1->z_far) + return TRUE; + else + return FALSE; +} + +CoglBool +_cogl_pipeline_non_zero_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return (authority0->big_state->non_zero_point_size == + authority1->big_state->non_zero_point_size); +} + +CoglBool +_cogl_pipeline_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return authority0->big_state->point_size == authority1->big_state->point_size; +} + +CoglBool +_cogl_pipeline_per_vertex_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return (authority0->big_state->per_vertex_point_size == + authority1->big_state->per_vertex_point_size); +} + +CoglBool +_cogl_pipeline_logic_ops_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineLogicOpsState *logic_ops_state0 = &authority0->big_state->logic_ops_state; + CoglPipelineLogicOpsState *logic_ops_state1 = &authority1->big_state->logic_ops_state; + + return logic_ops_state0->color_mask == logic_ops_state1->color_mask; +} + +CoglBool +_cogl_pipeline_cull_face_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + CoglPipelineCullFaceState *cull_face_state0 + = &authority0->big_state->cull_face_state; + CoglPipelineCullFaceState *cull_face_state1 + = &authority1->big_state->cull_face_state; + + /* The cull face state is considered equal if two pipelines are both + set to no culling. If the front winding property is ever used for + anything else or the comparison is used not just for drawing then + this would have to change */ + + if (cull_face_state0->mode == COGL_PIPELINE_CULL_FACE_MODE_NONE) + return cull_face_state1->mode == COGL_PIPELINE_CULL_FACE_MODE_NONE; + + return (cull_face_state0->mode == cull_face_state1->mode && + cull_face_state0->front_winding == cull_face_state1->front_winding); +} + +CoglBool +_cogl_pipeline_user_shader_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return (authority0->big_state->user_program == + authority1->big_state->user_program); +} + +typedef struct +{ + const CoglBoxedValue **dst_values; + const CoglBoxedValue *src_values; + int override_count; +} GetUniformsClosure; + +static CoglBool +get_uniforms_cb (int uniform_num, void *user_data) +{ + GetUniformsClosure *data = user_data; + + if (data->dst_values[uniform_num] == NULL) + data->dst_values[uniform_num] = data->src_values + data->override_count; + + data->override_count++; + + return TRUE; +} + +static void +_cogl_pipeline_get_all_uniform_values (CoglPipeline *pipeline, + const CoglBoxedValue **values) +{ + GetUniformsClosure data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + memset (values, 0, + sizeof (const CoglBoxedValue *) * ctx->n_uniform_names); + + data.dst_values = values; + + do + { + if ((pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS)) + { + const CoglPipelineUniformsState *uniforms_state = + &pipeline->big_state->uniforms_state; + + data.override_count = 0; + data.src_values = uniforms_state->override_values; + + _cogl_bitmask_foreach (&uniforms_state->override_mask, + get_uniforms_cb, + &data); + } + pipeline = _cogl_pipeline_get_parent (pipeline); + } + while (pipeline); +} + +CoglBool +_cogl_pipeline_uniforms_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + unsigned long *differences; + const CoglBoxedValue **values0, **values1; + int n_longs; + int i; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (authority0 == authority1) + return TRUE; + + values0 = g_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names); + values1 = g_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names); + + n_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names); + differences = g_alloca (n_longs * sizeof (unsigned long)); + memset (differences, 0, sizeof (unsigned long) * n_longs); + _cogl_pipeline_compare_uniform_differences (differences, + authority0, + authority1); + + _cogl_pipeline_get_all_uniform_values (authority0, values0); + _cogl_pipeline_get_all_uniform_values (authority1, values1); + + COGL_FLAGS_FOREACH_START (differences, n_longs, i) + { + const CoglBoxedValue *value0 = values0[i]; + const CoglBoxedValue *value1 = values1[i]; + + if (value0 == NULL) + { + if (value1 != NULL && value1->type != COGL_BOXED_NONE) + return FALSE; + } + else if (value1 == NULL) + { + if (value0 != NULL && value0->type != COGL_BOXED_NONE) + return FALSE; + } + else if (!_cogl_boxed_value_equal (value0, value1)) + return FALSE; + } + COGL_FLAGS_FOREACH_END; + + return TRUE; +} + +CoglBool +_cogl_pipeline_vertex_snippets_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return _cogl_pipeline_snippet_list_equal (&authority0->big_state-> + vertex_snippets, + &authority1->big_state-> + vertex_snippets); +} + +CoglBool +_cogl_pipeline_fragment_snippets_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return _cogl_pipeline_snippet_list_equal (&authority0->big_state-> + fragment_snippets, + &authority1->big_state-> + fragment_snippets); +} + +void +cogl_pipeline_get_color (CoglPipeline *pipeline, + CoglColor *color) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR); + + *color = authority->color; +} + +/* This is used heavily by the cogl journal when logging quads */ +void +_cogl_pipeline_get_colorubv (CoglPipeline *pipeline, + uint8_t *color) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR); + + _cogl_color_get_rgba_4ubv (&authority->color, color); +} + +void +cogl_pipeline_set_color (CoglPipeline *pipeline, + const CoglColor *color) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_COLOR; + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + if (cogl_color_equal (color, &authority->color)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, color, FALSE); + + pipeline->color = *color; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_color_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +cogl_pipeline_set_color4ub (CoglPipeline *pipeline, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha) +{ + CoglColor color; + cogl_color_init_from_4ub (&color, red, green, blue, alpha); + cogl_pipeline_set_color (pipeline, &color); +} + +void +cogl_pipeline_set_color4f (CoglPipeline *pipeline, + float red, + float green, + float blue, + float alpha) +{ + CoglColor color; + cogl_color_init_from_4f (&color, red, green, blue, alpha); + cogl_pipeline_set_color (pipeline, &color); +} + +CoglPipelineBlendEnable +_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE); + return authority->blend_enable; +} + +static CoglBool +_cogl_pipeline_blend_enable_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return authority0->blend_enable == authority1->blend_enable ? TRUE : FALSE; +} + +void +_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline, + CoglPipelineBlendEnable enable) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE; + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + _COGL_RETURN_IF_FAIL (enable > 1 && + "don't pass TRUE or FALSE to _set_blend_enabled!"); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + if (authority->blend_enable == enable) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->blend_enable = enable; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_blend_enable_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +cogl_pipeline_get_ambient (CoglPipeline *pipeline, + CoglColor *ambient) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); + + cogl_color_init_from_4fv (ambient, + authority->big_state->lighting_state.ambient); +} + +void +cogl_pipeline_set_ambient (CoglPipeline *pipeline, + const CoglColor *ambient) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; + CoglPipeline *authority; + CoglPipelineLightingState *lighting_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + lighting_state = &authority->big_state->lighting_state; + if (cogl_color_equal (ambient, &lighting_state->ambient)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + lighting_state = &pipeline->big_state->lighting_state; + lighting_state->ambient[0] = cogl_color_get_red_float (ambient); + lighting_state->ambient[1] = cogl_color_get_green_float (ambient); + lighting_state->ambient[2] = cogl_color_get_blue_float (ambient); + lighting_state->ambient[3] = cogl_color_get_alpha_float (ambient); + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_lighting_state_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +cogl_pipeline_get_diffuse (CoglPipeline *pipeline, + CoglColor *diffuse) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); + + cogl_color_init_from_4fv (diffuse, + authority->big_state->lighting_state.diffuse); +} + +void +cogl_pipeline_set_diffuse (CoglPipeline *pipeline, + const CoglColor *diffuse) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; + CoglPipeline *authority; + CoglPipelineLightingState *lighting_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + lighting_state = &authority->big_state->lighting_state; + if (cogl_color_equal (diffuse, &lighting_state->diffuse)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + lighting_state = &pipeline->big_state->lighting_state; + lighting_state->diffuse[0] = cogl_color_get_red_float (diffuse); + lighting_state->diffuse[1] = cogl_color_get_green_float (diffuse); + lighting_state->diffuse[2] = cogl_color_get_blue_float (diffuse); + lighting_state->diffuse[3] = cogl_color_get_alpha_float (diffuse); + + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_lighting_state_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +void +cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline, + const CoglColor *color) +{ + cogl_pipeline_set_ambient (pipeline, color); + cogl_pipeline_set_diffuse (pipeline, color); +} + +void +cogl_pipeline_get_specular (CoglPipeline *pipeline, + CoglColor *specular) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); + + cogl_color_init_from_4fv (specular, + authority->big_state->lighting_state.specular); +} + +void +cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular) +{ + CoglPipeline *authority; + CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; + CoglPipelineLightingState *lighting_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + lighting_state = &authority->big_state->lighting_state; + if (cogl_color_equal (specular, &lighting_state->specular)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + lighting_state = &pipeline->big_state->lighting_state; + lighting_state->specular[0] = cogl_color_get_red_float (specular); + lighting_state->specular[1] = cogl_color_get_green_float (specular); + lighting_state->specular[2] = cogl_color_get_blue_float (specular); + lighting_state->specular[3] = cogl_color_get_alpha_float (specular); + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_lighting_state_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +float +cogl_pipeline_get_shininess (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); + + return authority->big_state->lighting_state.shininess; +} + +void +cogl_pipeline_set_shininess (CoglPipeline *pipeline, + float shininess) +{ + CoglPipeline *authority; + CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; + CoglPipelineLightingState *lighting_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + if (shininess < 0.0) + { + g_warning ("Out of range shininess %f supplied for pipeline\n", + shininess); + return; + } + + authority = _cogl_pipeline_get_authority (pipeline, state); + + lighting_state = &authority->big_state->lighting_state; + + if (lighting_state->shininess == shininess) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + lighting_state = &pipeline->big_state->lighting_state; + lighting_state->shininess = shininess; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_lighting_state_equal); +} + +void +cogl_pipeline_get_emission (CoglPipeline *pipeline, + CoglColor *emission) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); + + cogl_color_init_from_4fv (emission, + authority->big_state->lighting_state.emission); +} + +void +cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission) +{ + CoglPipeline *authority; + CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; + CoglPipelineLightingState *lighting_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + lighting_state = &authority->big_state->lighting_state; + if (cogl_color_equal (emission, &lighting_state->emission)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + lighting_state = &pipeline->big_state->lighting_state; + lighting_state->emission[0] = cogl_color_get_red_float (emission); + lighting_state->emission[1] = cogl_color_get_green_float (emission); + lighting_state->emission[2] = cogl_color_get_blue_float (emission); + lighting_state->emission[3] = cogl_color_get_alpha_float (emission); + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_lighting_state_equal); + + pipeline->dirty_real_blend_enable = TRUE; +} + +static void +_cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline, + CoglPipelineAlphaFunc alpha_func) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_ALPHA_FUNC; + CoglPipeline *authority; + CoglPipelineAlphaFuncState *alpha_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + alpha_state = &authority->big_state->alpha_state; + if (alpha_state->alpha_func == alpha_func) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + alpha_state = &pipeline->big_state->alpha_state; + alpha_state->alpha_func = alpha_func; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_alpha_func_state_equal); +} + +static void +_cogl_pipeline_set_alpha_test_function_reference (CoglPipeline *pipeline, + float alpha_reference) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE; + CoglPipeline *authority; + CoglPipelineAlphaFuncState *alpha_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + alpha_state = &authority->big_state->alpha_state; + if (alpha_state->alpha_func_reference == alpha_reference) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + alpha_state = &pipeline->big_state->alpha_state; + alpha_state->alpha_func_reference = alpha_reference; + + _cogl_pipeline_update_authority + (pipeline, authority, state, + _cogl_pipeline_alpha_func_reference_state_equal); +} + +void +cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline, + CoglPipelineAlphaFunc alpha_func, + float alpha_reference) +{ + _cogl_pipeline_set_alpha_test_function (pipeline, alpha_func); + _cogl_pipeline_set_alpha_test_function_reference (pipeline, alpha_reference); +} + +CoglPipelineAlphaFunc +cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_ALPHA_FUNC); + + return authority->big_state->alpha_state.alpha_func; +} + +float +cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0.0f); + + authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE); + + return authority->big_state->alpha_state.alpha_func_reference; +} + +static GLenum +arg_to_gl_blend_factor (CoglBlendStringArgument *arg) +{ + if (arg->source.is_zero) + return GL_ZERO; + if (arg->factor.is_one) + return GL_ONE; + else if (arg->factor.is_src_alpha_saturate) + return GL_SRC_ALPHA_SATURATE; + else if (arg->factor.source.info->type == + COGL_BLEND_STRING_COLOR_SOURCE_SRC_COLOR) + { + if (arg->factor.source.mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_SRC_COLOR; + else + return GL_SRC_COLOR; + } + else + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_SRC_ALPHA; + else + return GL_SRC_ALPHA; + } + } + else if (arg->factor.source.info->type == + COGL_BLEND_STRING_COLOR_SOURCE_DST_COLOR) + { + if (arg->factor.source.mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_DST_COLOR; + else + return GL_DST_COLOR; + } + else + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_DST_ALPHA; + else + return GL_DST_ALPHA; + } + } +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + else if (arg->factor.source.info->type == + COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT) + { + if (arg->factor.source.mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_CONSTANT_COLOR; + else + return GL_CONSTANT_COLOR; + } + else + { + if (arg->factor.source.one_minus) + return GL_ONE_MINUS_CONSTANT_ALPHA; + else + return GL_CONSTANT_ALPHA; + } + } +#endif + + g_warning ("Unable to determine valid blend factor from blend string\n"); + return GL_ONE; +} + +static void +setup_blend_state (CoglBlendStringStatement *statement, + GLenum *blend_equation, + GLint *blend_src_factor, + GLint *blend_dst_factor) +{ + switch (statement->function->type) + { + case COGL_BLEND_STRING_FUNCTION_ADD: + *blend_equation = GL_FUNC_ADD; + break; + /* TODO - add more */ + default: + g_warning ("Unsupported blend function given"); + *blend_equation = GL_FUNC_ADD; + } + + *blend_src_factor = arg_to_gl_blend_factor (&statement->args[0]); + *blend_dst_factor = arg_to_gl_blend_factor (&statement->args[1]); +} + +CoglBool +cogl_pipeline_set_blend (CoglPipeline *pipeline, + const char *blend_description, + CoglError **error) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_BLEND; + CoglPipeline *authority; + CoglBlendStringStatement statements[2]; + CoglBlendStringStatement *rgb; + CoglBlendStringStatement *a; + int count; + CoglPipelineBlendState *blend_state; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + count = + _cogl_blend_string_compile (blend_description, + COGL_BLEND_STRING_CONTEXT_BLENDING, + statements, + error); + if (!count) + return FALSE; + + if (count == 1) + rgb = a = statements; + else + { + rgb = &statements[0]; + a = &statements[1]; + } + + authority = + _cogl_pipeline_get_authority (pipeline, state); + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + blend_state = &pipeline->big_state->blend_state; + + setup_blend_state (rgb, + &blend_state->blend_equation_rgb, + &blend_state->blend_src_factor_rgb, + &blend_state->blend_dst_factor_rgb); + setup_blend_state (a, + &blend_state->blend_equation_alpha, + &blend_state->blend_src_factor_alpha, + &blend_state->blend_dst_factor_alpha); + + /* If we are the current authority see if we can revert to one of our + * ancestors being the authority */ + if (pipeline == authority && + _cogl_pipeline_get_parent (authority) != NULL) + { + CoglPipeline *parent = _cogl_pipeline_get_parent (authority); + CoglPipeline *old_authority = + _cogl_pipeline_get_authority (parent, state); + + if (_cogl_pipeline_blend_state_equal (authority, old_authority)) + pipeline->differences &= ~state; + } + + /* If we weren't previously the authority on this state then we need + * to extended our differences mask and so it's possible that some + * of our ancestry will now become redundant, so we aim to reparent + * ourselves if that's true... */ + if (pipeline != authority) + { + pipeline->differences |= state; + _cogl_pipeline_prune_redundant_ancestry (pipeline); + } + + pipeline->dirty_real_blend_enable = TRUE; + + return TRUE; +} + +void +cogl_pipeline_set_blend_constant (CoglPipeline *pipeline, + const CoglColor *constant_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLEND_CONSTANT)) + return; + +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + { + CoglPipelineState state = COGL_PIPELINE_STATE_BLEND; + CoglPipeline *authority; + CoglPipelineBlendState *blend_state; + + authority = _cogl_pipeline_get_authority (pipeline, state); + + blend_state = &authority->big_state->blend_state; + if (cogl_color_equal (constant_color, &blend_state->blend_constant)) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + blend_state = &pipeline->big_state->blend_state; + blend_state->blend_constant = *constant_color; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_blend_state_equal); + + pipeline->dirty_real_blend_enable = TRUE; + } +#endif +} + +CoglHandle +cogl_pipeline_get_user_program (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER); + + return authority->big_state->user_program; +} + +/* XXX: for now we don't mind if the program has vertex shaders + * attached but if we ever make a similar API public we should only + * allow attaching of programs containing fragment shaders. Eventually + * we will have a CoglPipeline abstraction to also cover vertex + * processing. + */ +void +cogl_pipeline_set_user_program (CoglPipeline *pipeline, + CoglHandle program) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_USER_SHADER; + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + if (authority->big_state->user_program == program) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + if (program != COGL_INVALID_HANDLE) + _cogl_pipeline_set_progend (pipeline, COGL_PIPELINE_PROGEND_UNDEFINED); + + /* If we are the current authority see if we can revert to one of our + * ancestors being the authority */ + if (pipeline == authority && + _cogl_pipeline_get_parent (authority) != NULL) + { + CoglPipeline *parent = _cogl_pipeline_get_parent (authority); + CoglPipeline *old_authority = + _cogl_pipeline_get_authority (parent, state); + + if (old_authority->big_state->user_program == program) + pipeline->differences &= ~state; + } + else if (pipeline != authority) + { + /* If we weren't previously the authority on this state then we + * need to extended our differences mask and so it's possible + * that some of our ancestry will now become redundant, so we + * aim to reparent ourselves if that's true... */ + pipeline->differences |= state; + _cogl_pipeline_prune_redundant_ancestry (pipeline); + } + + if (program != COGL_INVALID_HANDLE) + cogl_handle_ref (program); + if (authority == pipeline && + pipeline->big_state->user_program != COGL_INVALID_HANDLE) + cogl_handle_unref (pipeline->big_state->user_program); + pipeline->big_state->user_program = program; + + pipeline->dirty_real_blend_enable = TRUE; +} + +CoglBool +cogl_pipeline_set_depth_state (CoglPipeline *pipeline, + const CoglDepthState *depth_state, + CoglError **error) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_DEPTH; + CoglPipeline *authority; + CoglDepthState *orig_state; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + _COGL_RETURN_VAL_IF_FAIL (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + orig_state = &authority->big_state->depth_state; + if (orig_state->test_enabled == depth_state->test_enabled && + orig_state->write_enabled == depth_state->write_enabled && + orig_state->test_function == depth_state->test_function && + orig_state->range_near == depth_state->range_near && + orig_state->range_far == depth_state->range_far) + return TRUE; + + if (ctx->driver == COGL_DRIVER_GLES1 && + (depth_state->range_near != 0 || + depth_state->range_far != 1)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "glDepthRange not available on GLES 1"); + return FALSE; + } + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->depth_state = *depth_state; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_depth_state_equal); + + return TRUE; +} + +void +cogl_pipeline_get_depth_state (CoglPipeline *pipeline, + CoglDepthState *state) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH); + *state = authority->big_state->depth_state; +} + +CoglColorMask +cogl_pipeline_get_color_mask (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS); + + return authority->big_state->logic_ops_state.color_mask; +} + +void +cogl_pipeline_set_color_mask (CoglPipeline *pipeline, + CoglColorMask color_mask) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_LOGIC_OPS; + CoglPipeline *authority; + CoglPipelineLogicOpsState *logic_ops_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + logic_ops_state = &authority->big_state->logic_ops_state; + if (logic_ops_state->color_mask == color_mask) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + logic_ops_state = &pipeline->big_state->logic_ops_state; + logic_ops_state->color_mask = color_mask; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_logic_ops_state_equal); +} + +void +_cogl_pipeline_set_fog_state (CoglPipeline *pipeline, + const CoglPipelineFogState *fog_state) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_FOG; + CoglPipeline *authority; + CoglPipelineFogState *current_fog_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + current_fog_state = &authority->big_state->fog_state; + + if (current_fog_state->enabled == fog_state->enabled && + cogl_color_equal (¤t_fog_state->color, &fog_state->color) && + current_fog_state->mode == fog_state->mode && + current_fog_state->density == fog_state->density && + current_fog_state->z_near == fog_state->z_near && + current_fog_state->z_far == fog_state->z_far) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->fog_state = *fog_state; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_fog_state_equal); +} + +void +cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline, + CoglPipelineCullFaceMode cull_face_mode) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; + CoglPipeline *authority; + CoglPipelineCullFaceState *cull_face_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + cull_face_state = &authority->big_state->cull_face_state; + + if (cull_face_state->mode == cull_face_mode) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->cull_face_state.mode = cull_face_mode; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_cull_face_state_equal); +} + +void +cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline, + CoglWinding front_winding) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; + CoglPipeline *authority; + CoglPipelineCullFaceState *cull_face_state; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + cull_face_state = &authority->big_state->cull_face_state; + + if (cull_face_state->front_winding == front_winding) + return; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->cull_face_state.front_winding = front_winding; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_cull_face_state_equal); +} + +CoglPipelineCullFaceMode +cogl_pipeline_get_cull_face_mode (CoglPipeline *pipeline) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), + COGL_PIPELINE_CULL_FACE_MODE_NONE); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + return authority->big_state->cull_face_state.mode; +} + +CoglWinding +cogl_pipeline_get_front_face_winding (CoglPipeline *pipeline) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), + COGL_PIPELINE_CULL_FACE_MODE_NONE); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + return authority->big_state->cull_face_state.front_winding; +} + +float +cogl_pipeline_get_point_size (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE); + + return authority->big_state->point_size; +} + +static void +_cogl_pipeline_set_non_zero_point_size (CoglPipeline *pipeline, + CoglBool value) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE; + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->non_zero_point_size = !!value; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_non_zero_point_size_equal); +} + +void +cogl_pipeline_set_point_size (CoglPipeline *pipeline, + float point_size) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_POINT_SIZE; + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + if (authority->big_state->point_size == point_size) + return; + + /* Changing the point size may additionally modify + * COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE. */ + + if ((authority->big_state->point_size > 0.0f) != (point_size > 0.0f)) + _cogl_pipeline_set_non_zero_point_size (pipeline, point_size > 0.0f); + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->point_size = point_size; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_point_size_equal); +} + +CoglBool +cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline, + CoglBool enable, + CoglError **error) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE; + CoglPipeline *authority; + + _COGL_GET_CONTEXT (ctx, FALSE); + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + authority = _cogl_pipeline_get_authority (pipeline, state); + + enable = !!enable; + + if (authority->big_state->per_vertex_point_size == enable) + return TRUE; + + if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Per-vertex point size is not supported"); + + return FALSE; + } + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + pipeline->big_state->per_vertex_point_size = enable; + + _cogl_pipeline_update_authority (pipeline, authority, state, + _cogl_pipeline_point_size_equal); + + return TRUE; +} + +CoglBool +cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE); + + return authority->big_state->per_vertex_point_size; +} + +static CoglBoxedValue * +_cogl_pipeline_override_uniform (CoglPipeline *pipeline, + int location) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_UNIFORMS; + CoglPipelineUniformsState *uniforms_state; + int override_index; + + _COGL_GET_CONTEXT (ctx, NULL); + + g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL); + g_return_val_if_fail (location >= 0, NULL); + g_return_val_if_fail (location < ctx->n_uniform_names, NULL); + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + uniforms_state = &pipeline->big_state->uniforms_state; + + /* Count the number of bits that are set below this location. That + should give us the position where our new value should lie */ + override_index = _cogl_bitmask_popcount_upto (&uniforms_state->override_mask, + location); + + _cogl_bitmask_set (&uniforms_state->changed_mask, location, TRUE); + + /* If this pipeline already has an override for this value then we + can just use it directly */ + if (_cogl_bitmask_get (&uniforms_state->override_mask, location)) + return uniforms_state->override_values + override_index; + + /* We need to create a new override value in the right position + within the array. This is pretty inefficient but the hope is that + it will be much more common to modify an existing uniform rather + than modify a new one so it is more important to optimise the + former case. */ + + if (uniforms_state->override_values == NULL) + { + g_assert (override_index == 0); + uniforms_state->override_values = g_new (CoglBoxedValue, 1); + } + else + { + /* We need to grow the array and copy in the old values */ + CoglBoxedValue *old_values = uniforms_state->override_values; + int old_size = _cogl_bitmask_popcount (&uniforms_state->override_mask); + + uniforms_state->override_values = g_new (CoglBoxedValue, old_size + 1); + + /* Copy in the old values leaving a gap for the new value */ + memcpy (uniforms_state->override_values, + old_values, + sizeof (CoglBoxedValue) * override_index); + memcpy (uniforms_state->override_values + override_index + 1, + old_values + override_index, + sizeof (CoglBoxedValue) * (old_size - override_index)); + + g_free (old_values); + } + + _cogl_boxed_value_init (uniforms_state->override_values + override_index); + + _cogl_bitmask_set (&uniforms_state->override_mask, location, TRUE); + + return uniforms_state->override_values + override_index; +} + +void +cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline, + int uniform_location, + float value) +{ + CoglBoxedValue *boxed_value; + + boxed_value = _cogl_pipeline_override_uniform (pipeline, uniform_location); + + _cogl_boxed_value_set_1f (boxed_value, value); +} + +void +cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline, + int uniform_location, + int value) +{ + CoglBoxedValue *boxed_value; + + boxed_value = _cogl_pipeline_override_uniform (pipeline, uniform_location); + + _cogl_boxed_value_set_1i (boxed_value, value); +} + +void +cogl_pipeline_set_uniform_float (CoglPipeline *pipeline, + int uniform_location, + int n_components, + int count, + const float *value) +{ + CoglBoxedValue *boxed_value; + + boxed_value = _cogl_pipeline_override_uniform (pipeline, uniform_location); + + _cogl_boxed_value_set_float (boxed_value, n_components, count, value); +} + +void +cogl_pipeline_set_uniform_int (CoglPipeline *pipeline, + int uniform_location, + int n_components, + int count, + const int *value) +{ + CoglBoxedValue *boxed_value; + + boxed_value = _cogl_pipeline_override_uniform (pipeline, uniform_location); + + _cogl_boxed_value_set_int (boxed_value, n_components, count, value); +} + +void +cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline, + int uniform_location, + int dimensions, + int count, + CoglBool transpose, + const float *value) +{ + CoglBoxedValue *boxed_value; + + boxed_value = _cogl_pipeline_override_uniform (pipeline, uniform_location); + + _cogl_boxed_value_set_matrix (boxed_value, + dimensions, + count, + transpose, + value); +} + +static void +_cogl_pipeline_add_vertex_snippet (CoglPipeline *pipeline, + CoglSnippet *snippet) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_VERTEX_SNIPPETS; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + _cogl_pipeline_snippet_list_add (&pipeline->big_state->vertex_snippets, + snippet); +} + +static void +_cogl_pipeline_add_fragment_snippet (CoglPipeline *pipeline, + CoglSnippet *snippet) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS; + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); + + _cogl_pipeline_snippet_list_add (&pipeline->big_state->fragment_snippets, + snippet); +} + +void +cogl_pipeline_add_snippet (CoglPipeline *pipeline, + CoglSnippet *snippet) +{ + g_return_if_fail (cogl_is_pipeline (pipeline)); + g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (snippet->hook < COGL_SNIPPET_FIRST_LAYER_HOOK); + + if (snippet->hook < COGL_SNIPPET_FIRST_PIPELINE_FRAGMENT_HOOK) + _cogl_pipeline_add_vertex_snippet (pipeline, snippet); + else + _cogl_pipeline_add_fragment_snippet (pipeline, snippet); +} + +CoglBool +_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + + return authority->big_state->vertex_snippets.entries != NULL; +} + +static CoglBool +check_layer_has_vertex_snippet (CoglPipelineLayer *layer, + void *user_data) +{ + unsigned long state = COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, state); + CoglBool *found_vertex_snippet = user_data; + + if (authority->big_state->vertex_snippets.entries) + { + *found_vertex_snippet = TRUE; + return FALSE; + } + + return TRUE; +} + +CoglBool +_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline) +{ + CoglBool found_vertex_snippet = FALSE; + + if (_cogl_pipeline_has_non_layer_vertex_snippets (pipeline)) + return TRUE; + + _cogl_pipeline_foreach_layer_internal (pipeline, + check_layer_has_vertex_snippet, + &found_vertex_snippet); + + return found_vertex_snippet; +} + +CoglBool +_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + + return authority->big_state->fragment_snippets.entries != NULL; +} + +static CoglBool +check_layer_has_fragment_snippet (CoglPipelineLayer *layer, + void *user_data) +{ + unsigned long state = COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, state); + CoglBool *found_fragment_snippet = user_data; + + if (authority->big_state->fragment_snippets.entries) + { + *found_fragment_snippet = TRUE; + return FALSE; + } + + return TRUE; +} + +CoglBool +_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline) +{ + CoglBool found_fragment_snippet = FALSE; + + if (_cogl_pipeline_has_non_layer_fragment_snippets (pipeline)) + return TRUE; + + _cogl_pipeline_foreach_layer_internal (pipeline, + check_layer_has_fragment_snippet, + &found_fragment_snippet); + + return found_fragment_snippet; +} + +void +_cogl_pipeline_hash_color_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &authority->color, + _COGL_COLOR_DATA_SIZE); +} + +void +_cogl_pipeline_hash_blend_enable_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + uint8_t blend_enable = authority->blend_enable; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &blend_enable, 1); +} + +void +_cogl_pipeline_hash_lighting_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineLightingState *lighting_state = + &authority->big_state->lighting_state; + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, lighting_state, + sizeof (CoglPipelineLightingState)); +} + +void +_cogl_pipeline_hash_alpha_func_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineAlphaFuncState *alpha_state = &authority->big_state->alpha_state; + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &alpha_state->alpha_func, + sizeof (alpha_state->alpha_func)); +} + +void +_cogl_pipeline_hash_alpha_func_reference_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineAlphaFuncState *alpha_state = &authority->big_state->alpha_state; + float ref = alpha_state->alpha_func_reference; + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &ref, sizeof (float)); +} + +void +_cogl_pipeline_hash_blend_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineBlendState *blend_state = &authority->big_state->blend_state; + unsigned int hash; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!authority->real_blend_enable) + return; + + hash = state->hash; + + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_equation_rgb, + sizeof (blend_state->blend_equation_rgb)); + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_equation_alpha, + sizeof (blend_state->blend_equation_alpha)); + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_src_factor_alpha, + sizeof (blend_state->blend_src_factor_alpha)); + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_dst_factor_alpha, + sizeof (blend_state->blend_dst_factor_alpha)); + + if (blend_state->blend_src_factor_rgb == GL_ONE_MINUS_CONSTANT_COLOR || + blend_state->blend_src_factor_rgb == GL_CONSTANT_COLOR || + blend_state->blend_dst_factor_rgb == GL_ONE_MINUS_CONSTANT_COLOR || + blend_state->blend_dst_factor_rgb == GL_CONSTANT_COLOR) + { + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_constant, + sizeof (blend_state->blend_constant)); + } + + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_src_factor_rgb, + sizeof (blend_state->blend_src_factor_rgb)); + hash = + _cogl_util_one_at_a_time_hash (hash, &blend_state->blend_dst_factor_rgb, + sizeof (blend_state->blend_dst_factor_rgb)); + + state->hash = hash; +} + +void +_cogl_pipeline_hash_user_shader_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglHandle user_program = authority->big_state->user_program; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &user_program, + sizeof (user_program)); +} + +void +_cogl_pipeline_hash_depth_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglDepthState *depth_state = &authority->big_state->depth_state; + unsigned int hash = state->hash; + + if (depth_state->test_enabled) + { + uint8_t enabled = depth_state->test_enabled; + CoglDepthTestFunction function = depth_state->test_function; + hash = _cogl_util_one_at_a_time_hash (hash, &enabled, sizeof (enabled)); + hash = _cogl_util_one_at_a_time_hash (hash, &function, sizeof (function)); + } + + if (depth_state->write_enabled) + { + uint8_t enabled = depth_state->write_enabled; + float near_val = depth_state->range_near; + float far_val = depth_state->range_far; + hash = _cogl_util_one_at_a_time_hash (hash, &enabled, sizeof (enabled)); + hash = _cogl_util_one_at_a_time_hash (hash, &near_val, sizeof (near_val)); + hash = _cogl_util_one_at_a_time_hash (hash, &far_val, sizeof (far_val)); + } + + state->hash = hash; +} + +void +_cogl_pipeline_hash_fog_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineFogState *fog_state = &authority->big_state->fog_state; + unsigned long hash = state->hash; + + if (!fog_state->enabled) + hash = _cogl_util_one_at_a_time_hash (hash, &fog_state->enabled, + sizeof (fog_state->enabled)); + else + hash = _cogl_util_one_at_a_time_hash (hash, &fog_state, + sizeof (CoglPipelineFogState)); + + state->hash = hash; +} + +void +_cogl_pipeline_hash_non_zero_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglBool non_zero_point_size = authority->big_state->non_zero_point_size; + + state->hash = _cogl_util_one_at_a_time_hash (state->hash, + &non_zero_point_size, + sizeof (non_zero_point_size)); +} + +void +_cogl_pipeline_hash_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + float point_size = authority->big_state->point_size; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &point_size, + sizeof (point_size)); +} + +void +_cogl_pipeline_hash_per_vertex_point_size_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglBool per_vertex_point_size = authority->big_state->per_vertex_point_size; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, + &per_vertex_point_size, + sizeof (per_vertex_point_size)); +} + +void +_cogl_pipeline_hash_logic_ops_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state; + state->hash = _cogl_util_one_at_a_time_hash (state->hash, &logic_ops_state->color_mask, + sizeof (CoglColorMask)); +} + +void +_cogl_pipeline_hash_cull_face_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + CoglPipelineCullFaceState *cull_face_state + = &authority->big_state->cull_face_state; + + /* The cull face state is considered equal if two pipelines are both + set to no culling. If the front winding property is ever used for + anything else or the hashing is used not just for drawing then + this would have to change */ + if (cull_face_state->mode == COGL_PIPELINE_CULL_FACE_MODE_NONE) + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, + &cull_face_state->mode, + sizeof (CoglPipelineCullFaceMode)); + else + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, + cull_face_state, + sizeof (CoglPipelineCullFaceState)); +} + +void +_cogl_pipeline_hash_uniforms_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + /* This isn't used anywhere yet because the uniform state doesn't + affect program generation. It's quite a hassle to implement so + let's just leave it until something actually needs it */ + g_warn_if_reached (); +} + +void +_cogl_pipeline_compare_uniform_differences (unsigned long *differences, + CoglPipeline *pipeline0, + CoglPipeline *pipeline1) +{ + GSList *head0 = NULL; + GSList *head1 = NULL; + CoglPipeline *node0; + CoglPipeline *node1; + int len0 = 0; + int len1 = 0; + int count; + GSList *common_ancestor0; + GSList *common_ancestor1; + + /* This algorithm is copied from + _cogl_pipeline_compare_differences(). It might be nice to share + the code more */ + + for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head0; + link->data = node0; + head0 = link; + len0++; + } + for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head1; + link->data = node1; + head1 = link; + len1++; + } + + /* NB: There's no point looking at the head entries since we know both + * pipelines must have the same default pipeline as their root node. */ + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + count = MIN (len0, len1) - 1; + while (count--) + { + if (head0->data != head1->data) + break; + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + } + + for (head0 = common_ancestor0->next; head0; head0 = head0->next) + { + node0 = head0->data; + if ((node0->differences & COGL_PIPELINE_STATE_UNIFORMS)) + { + const CoglPipelineUniformsState *uniforms_state = + &node0->big_state->uniforms_state; + _cogl_bitmask_set_flags (&uniforms_state->override_mask, + differences); + } + } + for (head1 = common_ancestor1->next; head1; head1 = head1->next) + { + node1 = head1->data; + if ((node1->differences & COGL_PIPELINE_STATE_UNIFORMS)) + { + const CoglPipelineUniformsState *uniforms_state = + &node1->big_state->uniforms_state; + _cogl_bitmask_set_flags (&uniforms_state->override_mask, + differences); + } + } +} + +void +_cogl_pipeline_hash_vertex_snippets_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + _cogl_pipeline_snippet_list_hash (&authority->big_state->vertex_snippets, + &state->hash); +} + +void +_cogl_pipeline_hash_fragment_snippets_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + _cogl_pipeline_snippet_list_hash (&authority->big_state->fragment_snippets, + &state->hash); +} + +UNIT_TEST (check_blend_constant_ancestry, + 0 /* no requirements */, + 0 /* no known failures */) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglNode *node; + int pipeline_length = 0; + int i; + + /* Repeatedly making a copy of a pipeline and changing the same + * state (in this case the blend constant) shouldn't cause a long + * chain of pipelines to be created because the redundant ancestry + * should be pruned. */ + + for (i = 0; i < 20; i++) + { + CoglColor color; + CoglPipeline *tmp_pipeline; + + cogl_color_init_from_4f (&color, i / 20.0f, 0.0f, 0.0f, 1.0f); + + tmp_pipeline = cogl_pipeline_copy (pipeline); + cogl_object_unref (pipeline); + pipeline = tmp_pipeline; + + cogl_pipeline_set_blend_constant (pipeline, &color); + } + + for (node = (CoglNode *) pipeline; node; node = node->parent) + pipeline_length++; + + g_assert_cmpint (pipeline_length, <=, 2); + + cogl_object_unref (pipeline); +} + +UNIT_TEST (check_uniform_ancestry, + 0 /* no requirements */, + TEST_KNOWN_FAILURE) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglNode *node; + int pipeline_length = 0; + int i; + + /* Repeatedly making a copy of a pipeline and changing a uniform + * shouldn't cause a long chain of pipelines to be created */ + + for (i = 0; i < 20; i++) + { + CoglPipeline *tmp_pipeline; + int uniform_location; + + tmp_pipeline = cogl_pipeline_copy (pipeline); + cogl_object_unref (pipeline); + pipeline = tmp_pipeline; + + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "a_uniform"); + + cogl_pipeline_set_uniform_1i (pipeline, uniform_location, i); + } + + for (node = (CoglNode *) pipeline; node; node = node->parent) + pipeline_length++; + + g_assert_cmpint (pipeline_length, <=, 2); + + cogl_object_unref (pipeline); +} diff --git a/cogl/cogl-pipeline-state.h b/cogl/cogl-pipeline-state.h new file mode 100644 index 0000000..6acbb6d --- /dev/null +++ b/cogl/cogl-pipeline-state.h @@ -0,0 +1,980 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIPELINE_STATE_H__ +#define __COGL_PIPELINE_STATE_H__ + +#include +#include +#include + +COGL_BEGIN_DECLS + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * cogl_pipeline_set_color: + * @pipeline: A #CoglPipeline object + * @color: The components of the color + * + * Sets the basic color of the pipeline, used when no lighting is enabled. + * + * Note that if you don't add any layers to the pipeline then the color + * will be blended unmodified with the destination; the default blend + * expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for + * semi-transparent red. See cogl_color_premultiply(). + * + * The default value is (1.0, 1.0, 1.0, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_color (CoglPipeline *pipeline, + const CoglColor *color); + +/** + * cogl_pipeline_set_color4ub: + * @pipeline: A #CoglPipeline object + * @red: The red component + * @green: The green component + * @blue: The blue component + * @alpha: The alpha component + * + * Sets the basic color of the pipeline, used when no lighting is enabled. + * + * The default value is (0xff, 0xff, 0xff, 0xff) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_color4ub (CoglPipeline *pipeline, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha); + +/** + * cogl_pipeline_set_color4f: + * @pipeline: A #CoglPipeline object + * @red: The red component + * @green: The green component + * @blue: The blue component + * @alpha: The alpha component + * + * Sets the basic color of the pipeline, used when no lighting is enabled. + * + * The default value is (1.0, 1.0, 1.0, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_color4f (CoglPipeline *pipeline, + float red, + float green, + float blue, + float alpha); + +/** + * cogl_pipeline_get_color: + * @pipeline: A #CoglPipeline object + * @color: (out): The location to store the color + * + * Retrieves the current pipeline color. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_color (CoglPipeline *pipeline, + CoglColor *color); + +/** + * cogl_pipeline_set_ambient: + * @pipeline: A #CoglPipeline object + * @ambient: The components of the desired ambient color + * + * Sets the pipeline's ambient color, in the standard OpenGL lighting + * model. The ambient color affects the overall color of the object. + * + * Since the diffuse color will be intense when the light hits the surface + * directly, the ambient will be most apparent where the light hits at a + * slant. + * + * The default value is (0.2, 0.2, 0.2, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_ambient (CoglPipeline *pipeline, + const CoglColor *ambient); + +/** + * cogl_pipeline_get_ambient: + * @pipeline: A #CoglPipeline object + * @ambient: The location to store the ambient color + * + * Retrieves the current ambient color for @pipeline + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_ambient (CoglPipeline *pipeline, + CoglColor *ambient); + +/** + * cogl_pipeline_set_diffuse: + * @pipeline: A #CoglPipeline object + * @diffuse: The components of the desired diffuse color + * + * Sets the pipeline's diffuse color, in the standard OpenGL lighting + * model. The diffuse color is most intense where the light hits the + * surface directly - perpendicular to the surface. + * + * The default value is (0.8, 0.8, 0.8, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_diffuse (CoglPipeline *pipeline, + const CoglColor *diffuse); + +/** + * cogl_pipeline_get_diffuse: + * @pipeline: A #CoglPipeline object + * @diffuse: The location to store the diffuse color + * + * Retrieves the current diffuse color for @pipeline + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_diffuse (CoglPipeline *pipeline, + CoglColor *diffuse); + +/** + * cogl_pipeline_set_ambient_and_diffuse: + * @pipeline: A #CoglPipeline object + * @color: The components of the desired ambient and diffuse colors + * + * Conveniently sets the diffuse and ambient color of @pipeline at the same + * time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse(). + * + * The default ambient color is (0.2, 0.2, 0.2, 1.0) + * + * The default diffuse color is (0.8, 0.8, 0.8, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline, + const CoglColor *color); + +/** + * cogl_pipeline_set_specular: + * @pipeline: A #CoglPipeline object + * @specular: The components of the desired specular color + * + * Sets the pipeline's specular color, in the standard OpenGL lighting + * model. The intensity of the specular color depends on the viewport + * position, and is brightest along the lines of reflection. + * + * The default value is (0.0, 0.0, 0.0, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_specular (CoglPipeline *pipeline, + const CoglColor *specular); + +/** + * cogl_pipeline_get_specular: + * @pipeline: A #CoglPipeline object + * @specular: The location to store the specular color + * + * Retrieves the pipelines current specular color. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_specular (CoglPipeline *pipeline, + CoglColor *specular); + +/** + * cogl_pipeline_set_shininess: + * @pipeline: A #CoglPipeline object + * @shininess: The desired shininess; must be >= 0.0 + * + * Sets the shininess of the pipeline, in the standard OpenGL lighting + * model, which determines the size of the specular highlights. A + * higher @shininess will produce smaller highlights which makes the + * object appear more shiny. + * + * The default value is 0.0 + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_shininess (CoglPipeline *pipeline, + float shininess); + +/** + * cogl_pipeline_get_shininess: + * @pipeline: A #CoglPipeline object + * + * Retrieves the pipelines current emission color. + * + * Return value: The pipelines current shininess value + * + * Since: 2.0 + * Stability: Unstable + */ +float +cogl_pipeline_get_shininess (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_emission: + * @pipeline: A #CoglPipeline object + * @emission: The components of the desired emissive color + * + * Sets the pipeline's emissive color, in the standard OpenGL lighting + * model. It will look like the surface is a light source emitting this + * color. + * + * The default value is (0.0, 0.0, 0.0, 1.0) + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_emission (CoglPipeline *pipeline, + const CoglColor *emission); + +/** + * cogl_pipeline_get_emission: + * @pipeline: A #CoglPipeline object + * @emission: The location to store the emission color + * + * Retrieves the pipelines current emission color. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_emission (CoglPipeline *pipeline, + CoglColor *emission); + +/** + * CoglPipelineAlphaFunc: + * @COGL_PIPELINE_ALPHA_FUNC_NEVER: Never let the fragment through. + * @COGL_PIPELINE_ALPHA_FUNC_LESS: Let the fragment through if the incoming + * alpha value is less than the reference alpha value + * @COGL_PIPELINE_ALPHA_FUNC_EQUAL: Let the fragment through if the incoming + * alpha value equals the reference alpha value + * @COGL_PIPELINE_ALPHA_FUNC_LEQUAL: Let the fragment through if the incoming + * alpha value is less than or equal to the reference alpha value + * @COGL_PIPELINE_ALPHA_FUNC_GREATER: Let the fragment through if the incoming + * alpha value is greater than the reference alpha value + * @COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL: Let the fragment through if the incoming + * alpha value does not equal the reference alpha value + * @COGL_PIPELINE_ALPHA_FUNC_GEQUAL: Let the fragment through if the incoming + * alpha value is greater than or equal to the reference alpha value. + * @COGL_PIPELINE_ALPHA_FUNC_ALWAYS: Always let the fragment through. + * + * Alpha testing happens before blending primitives with the framebuffer and + * gives an opportunity to discard fragments based on a comparison with the + * incoming alpha value and a reference alpha value. The #CoglPipelineAlphaFunc + * determines how the comparison is done. + */ +typedef enum { + COGL_PIPELINE_ALPHA_FUNC_NEVER = 0x0200, + COGL_PIPELINE_ALPHA_FUNC_LESS = 0x0201, + COGL_PIPELINE_ALPHA_FUNC_EQUAL = 0x0202, + COGL_PIPELINE_ALPHA_FUNC_LEQUAL = 0x0203, + COGL_PIPELINE_ALPHA_FUNC_GREATER = 0x0204, + COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL = 0x0205, + COGL_PIPELINE_ALPHA_FUNC_GEQUAL = 0x0206, + COGL_PIPELINE_ALPHA_FUNC_ALWAYS = 0x0207 +} CoglPipelineAlphaFunc; +/* NB: these values come from the equivalents in gl.h */ + +/** + * cogl_pipeline_set_alpha_test_function: + * @pipeline: A #CoglPipeline object + * @alpha_func: A @CoglPipelineAlphaFunc constant + * @alpha_reference: A reference point that the chosen alpha function uses + * to compare incoming fragments to. + * + * Before a primitive is blended with the framebuffer, it goes through an + * alpha test stage which lets you discard fragments based on the current + * alpha value. This function lets you change the function used to evaluate + * the alpha channel, and thus determine which fragments are discarded + * and which continue on to the blending stage. + * + * The default is %COGL_PIPELINE_ALPHA_FUNC_ALWAYS + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline, + CoglPipelineAlphaFunc alpha_func, + float alpha_reference); + +/** + * cogl_pipeline_get_alpha_test_function: + * @pipeline: A #CoglPipeline object + * + * Return value: The alpha test function of @pipeline. + * + * Since: 2.0 + * Stability: Unstable + */ +CoglPipelineAlphaFunc +cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline); + +/** + * cogl_pipeline_get_alpha_test_reference: + * @pipeline: A #CoglPipeline object + * + * Return value: The alpha test reference value of @pipeline. + * + * Since: 2.0 + * Stability: Unstable + */ +float +cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_blend: + * @pipeline: A #CoglPipeline object + * @blend_string: A Cogl blend string + * describing the desired blend function. + * @error: return location for a #CoglError that may report lack of driver + * support if you give separate blend string statements for the alpha + * channel and RGB channels since some drivers, or backends such as + * GLES 1.1, don't support this feature. May be %NULL, in which case a + * warning will be printed out using GLib's logging facilities if an + * error is encountered. + * + * If not already familiar; please refer here + * for an overview of what blend strings are, and their syntax. + * + * Blending occurs after the alpha test function, and combines fragments with + * the framebuffer. + + * Currently the only blend function Cogl exposes is ADD(). So any valid + * blend statements will be of the form: + * + * |[ + * <channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>)) + * ]| + * + * This is the list of source-names usable as blend factors: + * + * SRC_COLOR: The color of the in comming fragment + * DST_COLOR: The color of the framebuffer + * CONSTANT: The constant set via cogl_pipeline_set_blend_constant() + * + * + * The source names can be used according to the + * color-source and factor syntax, + * so for example "(1-SRC_COLOR[A])" would be a valid factor, as would + * "(CONSTANT[RGB])" + * + * These can also be used as factors: + * + * 0: (0, 0, 0, 0) + * 1: (1, 1, 1, 1) + * SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A]) + * + * + * Remember; all color components are normalized to the range [0, 1] + * before computing the result of blending. + * + * + * Blend Strings/1 + * Blend a non-premultiplied source over a destination with + * premultiplied alpha: + * + * "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))" + * "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))" + * + * + * + * + * Blend Strings/2 + * Blend a premultiplied source over a destination with + * premultiplied alpha + * + * "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))" + * + * + * + * The default blend string is: + * |[ + * RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A])) + * ]| + * + * That gives normal alpha-blending when the calculated color for the pipeline + * is in premultiplied form. + * + * Return value: %TRUE if the blend string was successfully parsed, and the + * described blending is supported by the underlying driver/hardware. If + * there was an error, %FALSE is returned and @error is set accordingly (if + * present). + * + * Since: 2.0 + * Stability: Unstable + */ +CoglBool +cogl_pipeline_set_blend (CoglPipeline *pipeline, + const char *blend_string, + CoglError **error); + +/** + * cogl_pipeline_set_blend_constant: + * @pipeline: A #CoglPipeline object + * @constant_color: The constant color you want + * + * When blending is setup to reference a CONSTANT blend factor then + * blending will depend on the constant set with this function. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_blend_constant (CoglPipeline *pipeline, + const CoglColor *constant_color); + +/** + * cogl_pipeline_set_point_size: + * @pipeline: a #CoglPipeline pointer + * @point_size: the new point size. + * + * Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is + * used with the attribute buffer API. Note that typically the GPU + * will only support a limited minimum and maximum range of point + * sizes. If the chosen point size is outside that range then the + * nearest value within that range will be used instead. The size of a + * point is in screen space so it will be the same regardless of any + * transformations. + * + * If the point size is set to 0.0 then drawing points with the + * pipeline will have undefined results. This is the default value so + * if an application wants to draw points it must make sure to use a + * pipeline that has an explicit point size set on it. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_point_size (CoglPipeline *pipeline, + float point_size); + +/** + * cogl_pipeline_get_point_size: + * @pipeline: a #CoglPipeline pointer + * + * Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is + * used with the vertex buffer API. + * + * Return value: the point size of the @pipeline. + * + * Since: 2.0 + * Stability: Unstable + */ +float +cogl_pipeline_get_point_size (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_per_vertex_point_size: + * @pipeline: a #CoglPipeline pointer + * @enable: whether to enable per-vertex point size + * @error: a location to store a #CoglError if the change failed + * + * Sets whether to use a per-vertex point size or to use the value set + * by cogl_pipeline_set_point_size(). If per-vertex point size is + * enabled then the point size can be set for an individual point + * either by drawing with a #CoglAttribute with the name + * ‘cogl_point_size_in’ or by writing to the GLSL builtin + * ‘cogl_point_size_out’ from a vertex shader snippet. + * + * If per-vertex point size is enabled and this attribute is not used + * and cogl_point_size_out is not written to then the results are + * undefined. + * + * Note that enabling this will only work if the + * %COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE feature is available. If + * this is not available then the function will return %FALSE and set + * a #CoglError. + * + * Since: 2.0 + * Stability: Unstable + * Return value: %TRUE if the change suceeded or %FALSE otherwise + */ +CoglBool +cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline, + CoglBool enable, + CoglError **error); + +/** + * cogl_pipeline_get_per_vertex_point_size: + * @pipeline: a #CoglPipeline pointer + * + * Since: 2.0 + * Stability: Unstable + * Return value: %TRUE if the pipeline has per-vertex point size + * enabled or %FALSE otherwise. The per-vertex point size can be + * enabled with cogl_pipeline_set_per_vertex_point_size(). + */ +CoglBool +cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline); + +/** + * cogl_pipeline_get_color_mask: + * @pipeline: a #CoglPipeline object. + * + * Gets the current #CoglColorMask of which channels would be written to the + * current framebuffer. Each bit set in the mask means that the + * corresponding color would be written. + * + * Returns: A #CoglColorMask + * Since: 1.8 + * Stability: unstable + */ +CoglColorMask +cogl_pipeline_get_color_mask (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_color_mask: + * @pipeline: a #CoglPipeline object. + * @color_mask: A #CoglColorMask of which color channels to write to + * the current framebuffer. + * + * Defines a bit mask of which color channels should be written to the + * current framebuffer. If a bit is set in @color_mask that means that + * color will be written. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_pipeline_set_color_mask (CoglPipeline *pipeline, + CoglColorMask color_mask); + +/** + * cogl_pipeline_get_user_program: + * @pipeline: a #CoglPipeline object. + * + * Queries what user program has been associated with the given + * @pipeline using cogl_pipeline_set_user_program(). + * + * Return value: (transfer none): The current user program or %COGL_INVALID_HANDLE. + * + * Since: 2.0 + * Stability: Unstable + */ +CoglHandle +cogl_pipeline_get_user_program (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_user_program: + * @pipeline: a #CoglPipeline object. + * @program: A #CoglHandle to a linked CoglProgram + * + * Associates a linked CoglProgram with the given pipeline so that the + * program can take full control of vertex and/or fragment processing. + * + * This is an example of how it can be used to associate an ARBfp + * program with a #CoglPipeline: + * |[ + * CoglHandle shader; + * CoglHandle program; + * CoglPipeline *pipeline; + * + * shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + * cogl_shader_source (shader, + * "!!ARBfp1.0\n" + * "MOV result.color,fragment.color;\n" + * "END\n"); + * cogl_shader_compile (shader); + * + * program = cogl_create_program (); + * cogl_program_attach_shader (program, shader); + * cogl_program_link (program); + * + * pipeline = cogl_pipeline_new (); + * cogl_pipeline_set_user_program (pipeline, program); + * + * cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff); + * cogl_rectangle (0, 0, 100, 100); + * ]| + * + * It is possibly worth keeping in mind that this API is not part of + * the long term design for how we want to expose shaders to Cogl + * developers (We are planning on deprecating the cogl_program and + * cogl_shader APIs in favour of a "snippet" framework) but in the + * meantime we hope this will handle most practical GLSL and ARBfp + * requirements. + * + * Also remember you need to check for either the + * %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before + * using the cogl_program or cogl_shader API. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_user_program (CoglPipeline *pipeline, + CoglHandle program); + +/** + * cogl_pipeline_set_depth_state: + * @pipeline: A #CoglPipeline object + * @state: A #CoglDepthState struct + * @error: A #CoglError to report failures to setup the given @state. + * + * This commits all the depth state configured in @state struct to the + * given @pipeline. The configuration values are copied into the + * pipeline so there is no requirement to keep the #CoglDepthState + * struct around if you don't need it any more. + * + * Note: Since some platforms do not support the depth range feature + * it is possible for this function to fail and report an @error. + * + * Returns: TRUE if the GPU supports all the given @state else %FALSE + * and returns an @error. + * + * Since: 2.0 + * Stability: Unstable + */ +CoglBool +cogl_pipeline_set_depth_state (CoglPipeline *pipeline, + const CoglDepthState *state, + CoglError **error); + +/** + * cogl_pipeline_get_depth_state: + * @pipeline: A #CoglPipeline object + * @state_out: (out): A destination #CoglDepthState struct + * + * Retrieves the current depth state configuration for the given + * @pipeline as previously set using cogl_pipeline_set_depth_state(). + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_get_depth_state (CoglPipeline *pipeline, + CoglDepthState *state_out); + +/** + * CoglPipelineCullFaceMode: + * @COGL_PIPELINE_CULL_FACE_MODE_NONE: Neither face will be + * culled. This is the default. + * @COGL_PIPELINE_CULL_FACE_MODE_FRONT: Front faces will be culled. + * @COGL_PIPELINE_CULL_FACE_MODE_BACK: Back faces will be culled. + * @COGL_PIPELINE_CULL_FACE_MODE_BOTH: All faces will be culled. + * + * Specifies which faces should be culled. This can be set on a + * pipeline using cogl_pipeline_set_cull_face_mode(). + */ +typedef enum +{ + COGL_PIPELINE_CULL_FACE_MODE_NONE, + COGL_PIPELINE_CULL_FACE_MODE_FRONT, + COGL_PIPELINE_CULL_FACE_MODE_BACK, + COGL_PIPELINE_CULL_FACE_MODE_BOTH +} CoglPipelineCullFaceMode; + +/** + * cogl_pipeline_set_cull_face_mode: + * @pipeline: A #CoglPipeline + * @cull_face_mode: The new mode to set + * + * Sets which faces will be culled when drawing. Face culling can be + * used to increase efficiency by avoiding drawing faces that would + * get overridden. For example, if a model has gaps so that it is + * impossible to see the inside then faces which are facing away from + * the screen will never be seen so there is no point in drawing + * them. This can be acheived by setting the cull face mode to + * %COGL_PIPELINE_CULL_FACE_MODE_BACK. + * + * Face culling relies on the primitives being drawn with a specific + * order to represent which faces are facing inside and outside the + * model. This order can be specified by calling + * cogl_pipeline_set_front_face_winding(). + * + * Status: Unstable + * Since: 2.0 + */ +void +cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline, + CoglPipelineCullFaceMode cull_face_mode); + +/** + * cogl_pipeline_get_cull_face_mode: + * + * Return value: the cull face mode that was previously set with + * cogl_pipeline_set_cull_face_mode(). + * + * Status: Unstable + * Since: 2.0 + */ +CoglPipelineCullFaceMode +cogl_pipeline_get_cull_face_mode (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_front_face_winding: + * @pipeline: a #CoglPipeline + * @front_winding: the winding order + * + * The order of the vertices within a primitive specifies whether it + * is considered to be front or back facing. This function specifies + * which order is considered to be the front + * faces. %COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to + * primitives with vertices in a counter-clockwise order and + * %COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is + * %COGL_WINDING_COUNTER_CLOCKWISE. + * + * Status: Unstable + * Since: 2.0 + */ +void +cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline, + CoglWinding front_winding); + +/** + * cogl_pipeline_get_front_face_winding: + * @pipeline: a #CoglPipeline + * + * The order of the vertices within a primitive specifies whether it + * is considered to be front or back facing. This function specifies + * which order is considered to be the front + * faces. %COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to + * primitives with vertices in a counter-clockwise order and + * %COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is + * %COGL_WINDING_COUNTER_CLOCKWISE. + * + * Returns: The @pipeline front face winding + * + * Status: Unstable + * Since: 2.0 + */ +CoglWinding +cogl_pipeline_get_front_face_winding (CoglPipeline *pipeline); + +/** + * cogl_pipeline_set_uniform_1f: + * @pipeline: A #CoglPipeline object + * @uniform_location: The uniform's location identifier + * @value: The new value for the uniform + * + * Sets a new value for the uniform at @uniform_location. If this + * pipeline has a user program attached and is later used as a source + * for drawing, the given value will be assigned to the uniform which + * can be accessed from the shader's source. The value for + * @uniform_location should be retrieved from the string name of the + * uniform by calling cogl_pipeline_get_uniform_location(). + * + * This function should be used to set uniforms that are of type + * float. It can also be used to set a single member of a float array + * uniform. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline, + int uniform_location, + float value); + +/** + * cogl_pipeline_set_uniform_1i: + * @pipeline: A #CoglPipeline object + * @uniform_location: The uniform's location identifier + * @value: The new value for the uniform + * + * Sets a new value for the uniform at @uniform_location. If this + * pipeline has a user program attached and is later used as a source + * for drawing, the given value will be assigned to the uniform which + * can be accessed from the shader's source. The value for + * @uniform_location should be retrieved from the string name of the + * uniform by calling cogl_pipeline_get_uniform_location(). + * + * This function should be used to set uniforms that are of type + * int. It can also be used to set a single member of a int array + * uniform or a sampler uniform. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline, + int uniform_location, + int value); + +/** + * cogl_pipeline_set_uniform_float: + * @pipeline: A #CoglPipeline object + * @uniform_location: The uniform's location identifier + * @n_components: The number of components in the corresponding uniform's type + * @count: The number of values to set + * @value: Pointer to the new values to set + * + * Sets new values for the uniform at @uniform_location. If this + * pipeline has a user program attached and is later used as a source + * for drawing, the given values will be assigned to the uniform which + * can be accessed from the shader's source. The value for + * @uniform_location should be retrieved from the string name of the + * uniform by calling cogl_pipeline_get_uniform_location(). + * + * This function can be used to set any floating point type uniform, + * including float arrays and float vectors. For example, to set a + * single vec4 uniform you would use 4 for @n_components and 1 for + * @count. To set an array of 8 float values, you could use 1 for + * @n_components and 8 for @count. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_uniform_float (CoglPipeline *pipeline, + int uniform_location, + int n_components, + int count, + const float *value); + +/** + * cogl_pipeline_set_uniform_int: + * @pipeline: A #CoglPipeline object + * @uniform_location: The uniform's location identifier + * @n_components: The number of components in the corresponding uniform's type + * @count: The number of values to set + * @value: Pointer to the new values to set + * + * Sets new values for the uniform at @uniform_location. If this + * pipeline has a user program attached and is later used as a source + * for drawing, the given values will be assigned to the uniform which + * can be accessed from the shader's source. The value for + * @uniform_location should be retrieved from the string name of the + * uniform by calling cogl_pipeline_get_uniform_location(). + * + * This function can be used to set any integer type uniform, + * including int arrays and int vectors. For example, to set a single + * ivec4 uniform you would use 4 for @n_components and 1 for + * @count. To set an array of 8 int values, you could use 1 for + * @n_components and 8 for @count. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_uniform_int (CoglPipeline *pipeline, + int uniform_location, + int n_components, + int count, + const int *value); + +/** + * cogl_pipeline_set_uniform_matrix: + * @pipeline: A #CoglPipeline object + * @uniform_location: The uniform's location identifier + * @dimensions: The size of the matrix + * @count: The number of values to set + * @transpose: Whether to transpose the matrix + * @value: Pointer to the new values to set + * + * Sets new values for the uniform at @uniform_location. If this + * pipeline has a user program attached and is later used as a source + * for drawing, the given values will be assigned to the uniform which + * can be accessed from the shader's source. The value for + * @uniform_location should be retrieved from the string name of the + * uniform by calling cogl_pipeline_get_uniform_location(). + * + * This function can be used to set any matrix type uniform, including + * matrix arrays. For example, to set a single mat4 uniform you would + * use 4 for @dimensions and 1 for @count. To set an array of 8 + * mat3 values, you could use 3 for @dimensions and 8 for @count. + * + * If @transpose is %FALSE then the matrix is expected to be in + * column-major order or if it is %TRUE then the matrix is in + * row-major order. You can pass a #CoglMatrix by calling by passing + * the result of cogl_matrix_get_array() in @value and setting + * @transpose to %FALSE. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline, + int uniform_location, + int dimensions, + int count, + CoglBool transpose, + const float *value); + +/** + * cogl_pipeline_add_snippet: + * @pipeline: A #CoglPipeline + * @snippet: The #CoglSnippet to add to the vertex processing hook + * + * Adds a shader snippet to @pipeline. The snippet will wrap around or + * replace some part of the pipeline as defined by the hook point in + * @snippet. Note that some hook points are specific to a layer and + * must be added with cogl_pipeline_add_layer_snippet() instead. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_pipeline_add_snippet (CoglPipeline *pipeline, + CoglSnippet *snippet); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +#endif /* __COGL_PIPELINE_STATE_H__ */ diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c new file mode 100644 index 0000000..b2fee10 --- /dev/null +++ b/cogl/cogl-pipeline.c @@ -0,0 +1,3174 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-context-private.h" +#include "cogl-object.h" + +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-pipeline-layer-state-private.h" +#include "cogl-texture-private.h" +#include "cogl-blend-string.h" +#include "cogl-journal-private.h" +#include "cogl-color-private.h" +#include "cogl-util.h" +#include "cogl-profile.h" +#include "cogl-depth-state-private.h" +#include "cogl1-context.h" +#include "cogl-gtype-private.h" + +#include +#include +#include + +static void _cogl_pipeline_free (CoglPipeline *tex); +static void recursively_free_layer_caches (CoglPipeline *pipeline); +static CoglBool _cogl_pipeline_is_weak (CoglPipeline *pipeline); + +const CoglPipelineFragend *_cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS]; +const CoglPipelineVertend *_cogl_pipeline_vertends[COGL_PIPELINE_N_VERTENDS]; +/* The 'MAX' here is so that we don't define an empty array when there + are no progends */ +const CoglPipelineProgend * +_cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)]; + +#ifdef COGL_PIPELINE_FRAGEND_GLSL +#include "cogl-pipeline-fragend-glsl-private.h" +#endif +#ifdef COGL_PIPELINE_FRAGEND_ARBFP +#include "cogl-pipeline-fragend-arbfp-private.h" +#endif +#ifdef COGL_PIPELINE_FRAGEND_FIXED +#include "cogl-pipeline-fragend-fixed-private.h" +#endif + +#ifdef COGL_PIPELINE_VERTEND_GLSL +#include "cogl-pipeline-vertend-glsl-private.h" +#endif +#ifdef COGL_PIPELINE_VERTEND_FIXED +#include "cogl-pipeline-vertend-fixed-private.h" +#endif + +#ifdef COGL_PIPELINE_PROGEND_FIXED_ARBFP +#include "cogl-pipeline-progend-fixed-arbfp-private.h" +#endif +#ifdef COGL_PIPELINE_PROGEND_FIXED +#include "cogl-pipeline-progend-fixed-private.h" +#endif +#ifdef COGL_PIPELINE_PROGEND_GLSL +#include "cogl-pipeline-progend-glsl-private.h" +#endif + +COGL_OBJECT_DEFINE (Pipeline, pipeline); +COGL_GTYPE_DEFINE_CLASS (Pipeline, pipeline); + +/* + * This initializes the first pipeline owned by the Cogl context. All + * subsequently instantiated pipelines created via the cogl_pipeline_new() + * API will initially be a copy of this pipeline. + * + * The default pipeline is the topmost ancester for all pipelines. + */ +void +_cogl_pipeline_init_default_pipeline (void) +{ + /* Create new - blank - pipeline */ + CoglPipeline *pipeline = g_slice_new0 (CoglPipeline); + /* XXX: NB: It's important that we zero this to avoid polluting + * pipeline hash values with un-initialized data */ + CoglPipelineBigState *big_state = g_slice_new0 (CoglPipelineBigState); + CoglPipelineLightingState *lighting_state = &big_state->lighting_state; + CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state; + CoglPipelineBlendState *blend_state = &big_state->blend_state; + CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state; + CoglPipelineCullFaceState *cull_face_state = &big_state->cull_face_state; + CoglPipelineUniformsState *uniforms_state = &big_state->uniforms_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Take this opportunity to setup the backends... */ +#ifdef COGL_PIPELINE_FRAGEND_GLSL + _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_GLSL] = + &_cogl_pipeline_glsl_fragend; +#endif +#ifdef COGL_PIPELINE_FRAGEND_ARBFP + _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] = + &_cogl_pipeline_arbfp_fragend; +#endif +#ifdef COGL_PIPELINE_FRAGEND_FIXED + _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] = + &_cogl_pipeline_fixed_fragend; +#endif +#ifdef COGL_PIPELINE_PROGEND_FIXED + _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED_ARBFP] = + &_cogl_pipeline_fixed_arbfp_progend; +#endif +#ifdef COGL_PIPELINE_PROGEND_FIXED + _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED] = + &_cogl_pipeline_fixed_progend; +#endif +#ifdef COGL_PIPELINE_PROGEND_GLSL + _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_GLSL] = + &_cogl_pipeline_glsl_progend; +#endif + +#ifdef COGL_PIPELINE_VERTEND_GLSL + _cogl_pipeline_vertends[COGL_PIPELINE_VERTEND_GLSL] = + &_cogl_pipeline_glsl_vertend; +#endif +#ifdef COGL_PIPELINE_VERTEND_FIXED + _cogl_pipeline_vertends[COGL_PIPELINE_VERTEND_FIXED] = + &_cogl_pipeline_fixed_vertend; +#endif + + _cogl_pipeline_node_init (COGL_NODE (pipeline)); + + pipeline->is_weak = FALSE; + pipeline->journal_ref_count = 0; + pipeline->progend = COGL_PIPELINE_PROGEND_UNDEFINED; + pipeline->differences = COGL_PIPELINE_STATE_ALL_SPARSE; + + pipeline->real_blend_enable = FALSE; + + pipeline->blend_enable = COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC; + pipeline->layer_differences = NULL; + pipeline->n_layers = 0; + + pipeline->big_state = big_state; + pipeline->has_big_state = TRUE; + + pipeline->static_breadcrumb = "default pipeline"; + pipeline->has_static_breadcrumb = TRUE; + + pipeline->age = 0; + + /* Use the same defaults as the GL spec... */ + cogl_color_init_from_4ub (&pipeline->color, 0xff, 0xff, 0xff, 0xff); + + /* Use the same defaults as the GL spec... */ + lighting_state->ambient[0] = 0.2; + lighting_state->ambient[1] = 0.2; + lighting_state->ambient[2] = 0.2; + lighting_state->ambient[3] = 1.0; + + lighting_state->diffuse[0] = 0.8; + lighting_state->diffuse[1] = 0.8; + lighting_state->diffuse[2] = 0.8; + lighting_state->diffuse[3] = 1.0; + + lighting_state->specular[0] = 0; + lighting_state->specular[1] = 0; + lighting_state->specular[2] = 0; + lighting_state->specular[3] = 1.0; + + lighting_state->emission[0] = 0; + lighting_state->emission[1] = 0; + lighting_state->emission[2] = 0; + lighting_state->emission[3] = 1.0; + + lighting_state->shininess = 0.0f; + + /* Use the same defaults as the GL spec... */ + alpha_state->alpha_func = COGL_PIPELINE_ALPHA_FUNC_ALWAYS; + alpha_state->alpha_func_reference = 0.0; + + /* Not the same as the GL default, but seems saner... */ +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + blend_state->blend_equation_rgb = GL_FUNC_ADD; + blend_state->blend_equation_alpha = GL_FUNC_ADD; + blend_state->blend_src_factor_alpha = GL_ONE; + blend_state->blend_dst_factor_alpha = GL_ONE_MINUS_SRC_ALPHA; + cogl_color_init_from_4ub (&blend_state->blend_constant, + 0x00, 0x00, 0x00, 0x00); +#endif + blend_state->blend_src_factor_rgb = GL_ONE; + blend_state->blend_dst_factor_rgb = GL_ONE_MINUS_SRC_ALPHA; + + big_state->user_program = COGL_INVALID_HANDLE; + + cogl_depth_state_init (&big_state->depth_state); + + big_state->point_size = 0.0f; + + logic_ops_state->color_mask = COGL_COLOR_MASK_ALL; + + cull_face_state->mode = COGL_PIPELINE_CULL_FACE_MODE_NONE; + cull_face_state->front_winding = COGL_WINDING_COUNTER_CLOCKWISE; + + _cogl_bitmask_init (&uniforms_state->override_mask); + _cogl_bitmask_init (&uniforms_state->changed_mask); + uniforms_state->override_values = NULL; + + ctx->default_pipeline = _cogl_pipeline_object_new (pipeline); +} + +static void +_cogl_pipeline_unparent (CoglNode *pipeline) +{ + /* Chain up */ + _cogl_pipeline_node_unparent_real (pipeline); +} + +static CoglBool +recursively_free_layer_caches_cb (CoglNode *node, + void *user_data) +{ + recursively_free_layer_caches (COGL_PIPELINE (node)); + return TRUE; +} + +/* This recursively frees the layers_cache of a pipeline and all of + * its descendants. + * + * For instance if we change a pipelines ->layer_differences list + * then that pipeline and all of its descendants may now have + * incorrect layer caches. */ +static void +recursively_free_layer_caches (CoglPipeline *pipeline) +{ + /* Note: we maintain the invariable that if a pipeline already has a + * dirty layers_cache then so do all of its descendants. */ + if (pipeline->layers_cache_dirty) + return; + + if (G_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache)) + g_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers, + pipeline->layers_cache); + pipeline->layers_cache_dirty = TRUE; + + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + recursively_free_layer_caches_cb, + NULL); +} + +static void +_cogl_pipeline_set_parent (CoglPipeline *pipeline, + CoglPipeline *parent, + CoglBool take_strong_reference) +{ + /* Chain up */ + _cogl_pipeline_node_set_parent_real (COGL_NODE (pipeline), + COGL_NODE (parent), + _cogl_pipeline_unparent, + take_strong_reference); + + /* Since we just changed the ancestry of the pipeline its cache of + * layers could now be invalid so free it... */ + if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS) + recursively_free_layer_caches (pipeline); + + /* If the backends are also caching state along with the pipeline + * that depends on the pipeline's ancestry then it may be notified + * here... + */ + if (pipeline->progend != COGL_PIPELINE_PROGEND_UNDEFINED) + { + const CoglPipelineProgend *progend = + _cogl_pipeline_progends[pipeline->progend]; + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[progend->fragend]; + + /* Currently only the fragends ever care about reparenting of + * pipelines... */ + if (fragend->pipeline_set_parent_notify) + fragend->pipeline_set_parent_notify (pipeline); + } +} + +static void +_cogl_pipeline_promote_weak_ancestors (CoglPipeline *strong) +{ + CoglNode *n; + + _COGL_RETURN_IF_FAIL (!strong->is_weak); + + /* If the parent of strong is weak, then we want to promote it by + taking a reference on strong's grandparent. We don't need to take + a reference on strong's direct parent */ + + if (COGL_NODE (strong)->parent == NULL) + return; + + for (n = COGL_NODE (strong)->parent; + /* We can assume that all weak pipelines have a parent */ + COGL_PIPELINE (n)->is_weak; + n = n->parent) + /* 'n' is weak so we take a reference on its parent */ + cogl_object_ref (n->parent); +} + +static void +_cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong) +{ + CoglNode *n; + + _COGL_RETURN_IF_FAIL (!strong->is_weak); + + /* This reverts the effect of calling + _cogl_pipeline_promote_weak_ancestors */ + + if (COGL_NODE (strong)->parent == NULL) + return; + + for (n = COGL_NODE (strong)->parent; + /* We can assume that all weak pipelines have a parent */ + COGL_PIPELINE (n)->is_weak; + n = n->parent) + /* 'n' is weak so we unref its parent */ + cogl_object_unref (n->parent); +} + +/* XXX: Always have an eye out for opportunities to lower the cost of + * cogl_pipeline_copy. */ +static CoglPipeline * +_cogl_pipeline_copy (CoglPipeline *src, CoglBool is_weak) +{ + CoglPipeline *pipeline = g_slice_new (CoglPipeline); + + _cogl_pipeline_node_init (COGL_NODE (pipeline)); + + pipeline->is_weak = is_weak; + + pipeline->journal_ref_count = 0; + + pipeline->differences = 0; + + pipeline->has_big_state = FALSE; + + /* NB: real_blend_enable isn't a sparse property, it's valid for + * every pipeline node so we have fast access to it. */ + pipeline->real_blend_enable = src->real_blend_enable; + pipeline->dirty_real_blend_enable = src->dirty_real_blend_enable; + pipeline->unknown_color_alpha = src->unknown_color_alpha; + + /* XXX: + * consider generalizing the idea of "cached" properties. These + * would still have an authority like other sparse properties but + * you wouldn't have to walk up the ancestry to find the authority + * because the value would be cached directly in each pipeline. + */ + + pipeline->layers_cache_dirty = TRUE; + pipeline->deprecated_get_layers_list = NULL; + pipeline->deprecated_get_layers_list_dirty = TRUE; + + pipeline->progend = src->progend; + + pipeline->has_static_breadcrumb = FALSE; + + pipeline->age = 0; + + _cogl_pipeline_set_parent (pipeline, src, !is_weak); + + /* The semantics for copying a weak pipeline are that we promote all + * weak ancestors to temporarily become strong pipelines until the + * copy is freed. */ + if (!is_weak) + _cogl_pipeline_promote_weak_ancestors (pipeline); + + return _cogl_pipeline_object_new (pipeline); +} + +CoglPipeline * +cogl_pipeline_copy (CoglPipeline *src) +{ + return _cogl_pipeline_copy (src, FALSE); +} + +CoglPipeline * +_cogl_pipeline_weak_copy (CoglPipeline *pipeline, + CoglPipelineDestroyCallback callback, + void *user_data) +{ + CoglPipeline *copy; + CoglPipeline *copy_pipeline; + + copy = _cogl_pipeline_copy (pipeline, TRUE); + copy_pipeline = COGL_PIPELINE (copy); + copy_pipeline->destroy_callback = callback; + copy_pipeline->destroy_data = user_data; + + return copy; +} + +CoglPipeline * +cogl_pipeline_new (CoglContext *context) +{ + CoglPipeline *new; + + new = cogl_pipeline_copy (context->default_pipeline); +#ifdef COGL_DEBUG_ENABLED + _cogl_pipeline_set_static_breadcrumb (new, "new"); +#endif + return new; +} + +static CoglBool +destroy_weak_children_cb (CoglNode *node, + void *user_data) +{ + CoglPipeline *pipeline = COGL_PIPELINE (node); + + if (_cogl_pipeline_is_weak (pipeline)) + { + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + destroy_weak_children_cb, + NULL); + + pipeline->destroy_callback (pipeline, pipeline->destroy_data); + _cogl_pipeline_unparent (COGL_NODE (pipeline)); + } + + return TRUE; +} + +static void +_cogl_pipeline_free (CoglPipeline *pipeline) +{ + if (!pipeline->is_weak) + _cogl_pipeline_revert_weak_ancestors (pipeline); + + /* Weak pipelines don't take a reference on their parent */ + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + destroy_weak_children_cb, + NULL); + + g_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children)); + + _cogl_pipeline_unparent (COGL_NODE (pipeline)); + + if (pipeline->differences & COGL_PIPELINE_STATE_USER_SHADER && + pipeline->big_state->user_program) + cogl_handle_unref (pipeline->big_state->user_program); + + if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS) + { + CoglPipelineUniformsState *uniforms_state + = &pipeline->big_state->uniforms_state; + int n_overrides = _cogl_bitmask_popcount (&uniforms_state->override_mask); + int i; + + for (i = 0; i < n_overrides; i++) + _cogl_boxed_value_destroy (uniforms_state->override_values + i); + g_free (uniforms_state->override_values); + + _cogl_bitmask_destroy (&uniforms_state->override_mask); + _cogl_bitmask_destroy (&uniforms_state->changed_mask); + } + + if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE) + g_slice_free (CoglPipelineBigState, pipeline->big_state); + + if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS) + { + g_list_foreach (pipeline->layer_differences, + (GFunc)cogl_object_unref, NULL); + g_list_free (pipeline->layer_differences); + } + + if (pipeline->differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS) + _cogl_pipeline_snippet_list_free (&pipeline->big_state->vertex_snippets); + + if (pipeline->differences & COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS) + _cogl_pipeline_snippet_list_free (&pipeline->big_state->fragment_snippets); + + g_list_free (pipeline->deprecated_get_layers_list); + + recursively_free_layer_caches (pipeline); + + g_slice_free (CoglPipeline, pipeline); +} + +CoglBool +_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + return pipeline->real_blend_enable; +} + +static void +_cogl_pipeline_update_layers_cache (CoglPipeline *pipeline) +{ + /* Note: we assume this pipeline is a _LAYERS authority */ + int n_layers; + CoglPipeline *current; + int layers_found; + + if (G_LIKELY (!pipeline->layers_cache_dirty) || + pipeline->n_layers == 0) + return; + + pipeline->layers_cache_dirty = FALSE; + + n_layers = pipeline->n_layers; + if (G_LIKELY (n_layers < G_N_ELEMENTS (pipeline->short_layers_cache))) + { + pipeline->layers_cache = pipeline->short_layers_cache; + memset (pipeline->layers_cache, 0, + sizeof (CoglPipelineLayer *) * + G_N_ELEMENTS (pipeline->short_layers_cache)); + } + else + { + pipeline->layers_cache = + g_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers); + } + + /* Notes: + * + * Each pipeline doesn't have to contain a complete list of the layers + * it depends on, some of them are indirectly referenced through the + * pipeline's ancestors. + * + * pipeline->layer_differences only contains a list of layers that + * have changed in relation to its parent. + * + * pipeline->layer_differences is not maintained sorted, but it + * won't contain multiple layers corresponding to a particular + * ->unit_index. + * + * Some of the ancestor pipelines may reference layers with + * ->unit_index values >= n_layers so we ignore them. + * + * As we ascend through the ancestors we are searching for any + * CoglPipelineLayers corresponding to the texture ->unit_index + * values in the range [0,n_layers-1]. As soon as a pointer is found + * we ignore layers of further ancestors with the same ->unit_index + * values. + */ + + layers_found = 0; + for (current = pipeline; + _cogl_pipeline_get_parent (current); + current = _cogl_pipeline_get_parent (current)) + { + GList *l; + + if (!(current->differences & COGL_PIPELINE_STATE_LAYERS)) + continue; + + for (l = current->layer_differences; l; l = l->next) + { + CoglPipelineLayer *layer = l->data; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + if (unit_index < n_layers && !pipeline->layers_cache[unit_index]) + { + pipeline->layers_cache[unit_index] = layer; + layers_found++; + if (layers_found == n_layers) + return; + } + } + } + + g_warn_if_reached (); +} + +/* XXX: Be carefull when using this API that the callback given doesn't result + * in the layer cache being invalidated during the iteration! */ +void +_cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline, + CoglPipelineInternalLayerCallback callback, + void *user_data) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + int n_layers; + int i; + CoglBool cont; + + n_layers = authority->n_layers; + if (n_layers == 0) + return; + + _cogl_pipeline_update_layers_cache (authority); + + for (i = 0, cont = TRUE; i < n_layers && cont == TRUE; i++) + { + _COGL_RETURN_IF_FAIL (authority->layers_cache_dirty == FALSE); + cont = callback (authority->layers_cache[i], user_data); + } +} + +CoglBool +_cogl_pipeline_layer_numbers_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1) +{ + CoglPipeline *authority0 = + _cogl_pipeline_get_authority (pipeline0, COGL_PIPELINE_STATE_LAYERS); + CoglPipeline *authority1 = + _cogl_pipeline_get_authority (pipeline1, COGL_PIPELINE_STATE_LAYERS); + int n_layers = authority0->n_layers; + int i; + + if (authority1->n_layers != n_layers) + return FALSE; + + _cogl_pipeline_update_layers_cache (authority0); + _cogl_pipeline_update_layers_cache (authority1); + + for (i = 0; i < n_layers; i++) + { + CoglPipelineLayer *layer0 = authority0->layers_cache[i]; + CoglPipelineLayer *layer1 = authority1->layers_cache[i]; + + if (layer0->index != layer1->index) + return FALSE; + } + + return TRUE; +} + +CoglBool +_cogl_pipeline_layer_and_unit_numbers_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1) +{ + CoglPipeline *authority0 = + _cogl_pipeline_get_authority (pipeline0, COGL_PIPELINE_STATE_LAYERS); + CoglPipeline *authority1 = + _cogl_pipeline_get_authority (pipeline1, COGL_PIPELINE_STATE_LAYERS); + int n_layers = authority0->n_layers; + int i; + + if (authority1->n_layers != n_layers) + return FALSE; + + _cogl_pipeline_update_layers_cache (authority0); + _cogl_pipeline_update_layers_cache (authority1); + + for (i = 0; i < n_layers; i++) + { + CoglPipelineLayer *layer0 = authority0->layers_cache[i]; + CoglPipelineLayer *layer1 = authority1->layers_cache[i]; + int unit0, unit1; + + if (layer0->index != layer1->index) + return FALSE; + + unit0 = _cogl_pipeline_layer_get_unit_index (layer0); + unit1 = _cogl_pipeline_layer_get_unit_index (layer1); + if (unit0 != unit1) + return FALSE; + } + + return TRUE; +} + +typedef struct +{ + int i; + int *indices; +} AppendLayerIndexState; + +static CoglBool +append_layer_index_cb (CoglPipelineLayer *layer, + void *user_data) +{ + AppendLayerIndexState *state = user_data; + state->indices[state->i++] = layer->index; + return TRUE; +} + +void +cogl_pipeline_foreach_layer (CoglPipeline *pipeline, + CoglPipelineLayerCallback callback, + void *user_data) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + AppendLayerIndexState state; + CoglBool cont; + int i; + + /* XXX: We don't know what the user is going to want to do to the layers + * but any modification of layers can result in the layer graph changing + * which could confuse _cogl_pipeline_foreach_layer_internal(). We first + * get a list of layer indices which will remain valid so long as the + * user doesn't remove layers. */ + + state.i = 0; + state.indices = g_alloca (authority->n_layers * sizeof (int)); + + _cogl_pipeline_foreach_layer_internal (pipeline, + append_layer_index_cb, + &state); + + for (i = 0, cont = TRUE; i < authority->n_layers && cont; i++) + cont = callback (pipeline, state.indices[i], user_data); +} + +static CoglBool +layer_has_alpha_cb (CoglPipelineLayer *layer, void *data) +{ + CoglBool *has_alpha = data; + *has_alpha = _cogl_pipeline_layer_has_alpha (layer); + + /* return FALSE to stop iterating layers if we find any layer + * has alpha ... + * + * FIXME: actually we should never be bailing out because it's + * always possible that a later layer could discard any previous + * alpha! + */ + + return !(*has_alpha); +} + +/* NB: If this pipeline returns FALSE that doesn't mean that the + * pipeline is definitely opaque, it just means that that the + * given changes dont imply transparency. + * + * If you want to find out of the pipeline is opaque then assuming + * this returns FALSE for a set of changes then you can follow + * up + */ +static CoglBool +_cogl_pipeline_change_implies_transparency (CoglPipeline *pipeline, + unsigned int changes, + const CoglColor *override_color, + CoglBool unknown_color_alpha) +{ + /* In the case of a layer state change we need to check everything + * else first since they contribute to the has_alpha status of the + * "PREVIOUS" layer. */ + if (changes & COGL_PIPELINE_STATE_LAYERS) + changes = COGL_PIPELINE_STATE_AFFECTS_BLENDING; + + if (unknown_color_alpha) + return TRUE; + + if ((override_color && cogl_color_get_alpha_byte (override_color) != 0xff)) + return TRUE; + + if (changes & COGL_PIPELINE_STATE_COLOR) + { + CoglColor tmp; + cogl_pipeline_get_color (pipeline, &tmp); + if (cogl_color_get_alpha_byte (&tmp) != 0xff) + return TRUE; + } + + if (changes & COGL_PIPELINE_STATE_USER_SHADER) + { + /* We can't make any assumptions about the alpha channel if the user + * is using an unknown fragment shader. + * + * TODO: check that it isn't just a vertex shader! + */ + if (_cogl_pipeline_get_user_program (pipeline) != COGL_INVALID_HANDLE) + return TRUE; + } + + if (changes & COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS) + { + if (_cogl_pipeline_has_non_layer_fragment_snippets (pipeline)) + return TRUE; + } + + if (changes & COGL_PIPELINE_STATE_VERTEX_SNIPPETS) + { + if (_cogl_pipeline_has_non_layer_vertex_snippets (pipeline)) + return TRUE; + } + + /* XXX: we should only need to look at these if lighting is enabled + */ + if (changes & COGL_PIPELINE_STATE_LIGHTING) + { + /* XXX: This stuff is showing up in sysprof reports which is + * silly because lighting isn't currently actually supported + * by Cogl except for these token properties. When we actually + * expose lighting support we can avoid these checks when + * lighting is disabled. */ +#if 0 + CoglColor tmp; + cogl_pipeline_get_ambient (pipeline, &tmp); + if (cogl_color_get_alpha_byte (&tmp) != 0xff) + return TRUE; + cogl_pipeline_get_diffuse (pipeline, &tmp); + if (cogl_color_get_alpha_byte (&tmp) != 0xff) + return TRUE; + cogl_pipeline_get_specular (pipeline, &tmp); + if (cogl_color_get_alpha_byte (&tmp) != 0xff) + return TRUE; + cogl_pipeline_get_emission (pipeline, &tmp); + if (cogl_color_get_alpha_byte (&tmp) != 0xff) + return TRUE; +#endif + } + + if (changes & COGL_PIPELINE_STATE_LAYERS) + { + /* has_alpha tracks the alpha status of the GL_PREVIOUS layer. + * To start with that's defined by the pipeline color which + * must be fully opaque if we got this far. */ + CoglBool has_alpha = FALSE; + _cogl_pipeline_foreach_layer_internal (pipeline, + layer_has_alpha_cb, + &has_alpha); + if (has_alpha) + return TRUE; + } + + return FALSE; +} + +static CoglBool +_cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline, + unsigned int changes, + const CoglColor *override_color, + CoglBool unknown_color_alpha) +{ + CoglPipeline *enable_authority; + CoglPipeline *blend_authority; + CoglPipelineBlendState *blend_state; + CoglPipelineBlendEnable enabled; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING))) + return FALSE; + + /* We unconditionally check the _BLEND_ENABLE state first because + * all the other changes are irrelevent if blend_enable != _AUTOMATIC + */ + enable_authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE); + + enabled = enable_authority->blend_enable; + if (enabled != COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC) + return enabled == COGL_PIPELINE_BLEND_ENABLE_ENABLED ? TRUE : FALSE; + + blend_authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND); + + blend_state = &blend_authority->big_state->blend_state; + + /* We are trying to identify some cases that are equivalent to + * blending being disable, where the output is simply GL_SRC_COLOR. + * + * Note: we currently only consider a few cases that can be + * optimized but there could be opportunities to special case more + * blend functions later. + */ + + /* As the most common way that we currently use to effectively + * disable blending is to use an equation of + * "RGBA=ADD(SRC_COLOR, 0)" that's the first thing we check + * for... */ + if (blend_state->blend_equation_rgb == GL_FUNC_ADD && + blend_state->blend_equation_alpha == GL_FUNC_ADD && + blend_state->blend_src_factor_alpha == GL_ONE && + blend_state->blend_dst_factor_alpha == GL_ZERO) + { + return FALSE; + } + + /* NB: The default blending equation for Cogl is + * "RGBA=ADD(SRC_COLOR, DST_COLOR * (1-SRC_COLOR[A]))" + * + * Next we check if the default blending equation is being used. If + * so then we follow that by looking for cases where SRC_COLOR[A] == + * 1 since that simplifies "DST_COLOR * (1-SRC_COLOR[A])" to 0 which + * also effectively requires no blending. + */ + + if (blend_state->blend_equation_rgb != GL_FUNC_ADD || + blend_state->blend_equation_alpha != GL_FUNC_ADD) + return TRUE; + + if (blend_state->blend_src_factor_alpha != GL_ONE || + blend_state->blend_dst_factor_alpha != GL_ONE_MINUS_SRC_ALPHA) + return TRUE; + + if (blend_state->blend_src_factor_rgb != GL_ONE || + blend_state->blend_dst_factor_rgb != GL_ONE_MINUS_SRC_ALPHA) + return TRUE; + + /* Given the above constraints, it's now a case of finding any + * SRC_ALPHA that != 1 */ + + if (_cogl_pipeline_change_implies_transparency (pipeline, changes, + override_color, + unknown_color_alpha)) + return TRUE; + + /* At this point, considering just the state that has changed it + * looks like blending isn't needed. If blending was previously + * enabled though it could be that some other state still requires + * that we have blending enabled because it implies transparency. + * In this case we still need to go and check the other state... + * + * XXX: We could explicitly keep track of the mask of state groups + * that are currently causing blending to be enabled so that we + * never have to resort to checking *all* the state and can instead + * always limit the check to those in the mask. + */ + if (pipeline->real_blend_enable) + { + unsigned int other_state = + COGL_PIPELINE_STATE_AFFECTS_BLENDING & ~changes; + if (other_state && + _cogl_pipeline_change_implies_transparency (pipeline, other_state, NULL, FALSE)) + return TRUE; + } + + return FALSE; +} + +void +_cogl_pipeline_set_progend (CoglPipeline *pipeline, int progend) +{ + pipeline->progend = progend; +} + +static void +_cogl_pipeline_copy_differences (CoglPipeline *dest, + CoglPipeline *src, + unsigned long differences) +{ + CoglPipelineBigState *big_state; + + if (differences & COGL_PIPELINE_STATE_COLOR) + dest->color = src->color; + + if (differences & COGL_PIPELINE_STATE_BLEND_ENABLE) + dest->blend_enable = src->blend_enable; + + if (differences & COGL_PIPELINE_STATE_LAYERS) + { + GList *l; + + if (dest->differences & COGL_PIPELINE_STATE_LAYERS && + dest->layer_differences) + { + g_list_foreach (dest->layer_differences, + (GFunc)cogl_object_unref, + NULL); + g_list_free (dest->layer_differences); + } + + for (l = src->layer_differences; l; l = l->next) + { + /* NB: a layer can't have more than one ->owner so we can't + * simply take a references on each of the original + * layer_differences, we have to derive new layers from the + * originals instead. */ + CoglPipelineLayer *copy = _cogl_pipeline_layer_copy (l->data); + _cogl_pipeline_add_layer_difference (dest, copy, FALSE); + cogl_object_unref (copy); + } + + /* Note: we initialize n_layers after adding the layer differences + * since the act of adding the layers will initialize n_layers to 0 + * because dest isn't initially a STATE_LAYERS authority. */ + dest->n_layers = src->n_layers; + } + + if (differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE) + { + if (!dest->has_big_state) + { + dest->big_state = g_slice_new (CoglPipelineBigState); + dest->has_big_state = TRUE; + } + big_state = dest->big_state; + } + else + goto check_for_blending_change; + + if (differences & COGL_PIPELINE_STATE_LIGHTING) + { + memcpy (&big_state->lighting_state, + &src->big_state->lighting_state, + sizeof (CoglPipelineLightingState)); + } + + if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC) + big_state->alpha_state.alpha_func = + src->big_state->alpha_state.alpha_func; + + if (differences & COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE) + big_state->alpha_state.alpha_func_reference = + src->big_state->alpha_state.alpha_func_reference; + + if (differences & COGL_PIPELINE_STATE_BLEND) + { + memcpy (&big_state->blend_state, + &src->big_state->blend_state, + sizeof (CoglPipelineBlendState)); + } + + if (differences & COGL_PIPELINE_STATE_USER_SHADER) + { + if (src->big_state->user_program) + big_state->user_program = + cogl_handle_ref (src->big_state->user_program); + else + big_state->user_program = COGL_INVALID_HANDLE; + } + + if (differences & COGL_PIPELINE_STATE_DEPTH) + { + memcpy (&big_state->depth_state, + &src->big_state->depth_state, + sizeof (CoglDepthState)); + } + + if (differences & COGL_PIPELINE_STATE_FOG) + { + memcpy (&big_state->fog_state, + &src->big_state->fog_state, + sizeof (CoglPipelineFogState)); + } + + if (differences & COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE) + big_state->non_zero_point_size = src->big_state->non_zero_point_size; + + if (differences & COGL_PIPELINE_STATE_POINT_SIZE) + big_state->point_size = src->big_state->point_size; + + if (differences & COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE) + big_state->per_vertex_point_size = src->big_state->per_vertex_point_size; + + if (differences & COGL_PIPELINE_STATE_LOGIC_OPS) + { + memcpy (&big_state->logic_ops_state, + &src->big_state->logic_ops_state, + sizeof (CoglPipelineLogicOpsState)); + } + + if (differences & COGL_PIPELINE_STATE_CULL_FACE) + { + memcpy (&big_state->cull_face_state, + &src->big_state->cull_face_state, + sizeof (CoglPipelineCullFaceState)); + } + + if (differences & COGL_PIPELINE_STATE_UNIFORMS) + { + int n_overrides = + _cogl_bitmask_popcount (&src->big_state->uniforms_state.override_mask); + int i; + + big_state->uniforms_state.override_values = + g_malloc (n_overrides * sizeof (CoglBoxedValue)); + + for (i = 0; i < n_overrides; i++) + { + CoglBoxedValue *dst_bv = + big_state->uniforms_state.override_values + i; + const CoglBoxedValue *src_bv = + src->big_state->uniforms_state.override_values + i; + + _cogl_boxed_value_copy (dst_bv, src_bv); + } + + _cogl_bitmask_init (&big_state->uniforms_state.override_mask); + _cogl_bitmask_set_bits (&big_state->uniforms_state.override_mask, + &src->big_state->uniforms_state.override_mask); + + _cogl_bitmask_init (&big_state->uniforms_state.changed_mask); + } + + if (differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS) + _cogl_pipeline_snippet_list_copy (&big_state->vertex_snippets, + &src->big_state->vertex_snippets); + + if (differences & COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS) + _cogl_pipeline_snippet_list_copy (&big_state->fragment_snippets, + &src->big_state->fragment_snippets); + + /* XXX: we shouldn't bother doing this in most cases since + * _copy_differences is typically used to initialize pipeline state + * by copying it from the current authority, so it's not actually + * *changing* anything. + */ +check_for_blending_change: + if (differences & COGL_PIPELINE_STATE_AFFECTS_BLENDING) + dest->dirty_real_blend_enable = TRUE; + + dest->differences |= differences; +} + +static void +_cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline, + CoglPipelineState change) +{ + CoglPipeline *authority; + + _COGL_RETURN_IF_FAIL (change & COGL_PIPELINE_STATE_ALL_SPARSE); + + if (!(change & COGL_PIPELINE_STATE_MULTI_PROPERTY)) + return; + + authority = _cogl_pipeline_get_authority (pipeline, change); + + switch (change) + { + /* XXX: avoid using a default: label so we get a warning if we + * don't explicitly handle a newly defined state-group here. */ + case COGL_PIPELINE_STATE_COLOR: + case COGL_PIPELINE_STATE_BLEND_ENABLE: + case COGL_PIPELINE_STATE_ALPHA_FUNC: + case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE: + case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE: + case COGL_PIPELINE_STATE_POINT_SIZE: + case COGL_PIPELINE_STATE_USER_SHADER: + case COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE: + case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE: + g_return_if_reached (); + + case COGL_PIPELINE_STATE_LAYERS: + pipeline->n_layers = authority->n_layers; + pipeline->layer_differences = NULL; + break; + case COGL_PIPELINE_STATE_LIGHTING: + { + memcpy (&pipeline->big_state->lighting_state, + &authority->big_state->lighting_state, + sizeof (CoglPipelineLightingState)); + break; + } + case COGL_PIPELINE_STATE_BLEND: + { + memcpy (&pipeline->big_state->blend_state, + &authority->big_state->blend_state, + sizeof (CoglPipelineBlendState)); + break; + } + case COGL_PIPELINE_STATE_DEPTH: + { + memcpy (&pipeline->big_state->depth_state, + &authority->big_state->depth_state, + sizeof (CoglDepthState)); + break; + } + case COGL_PIPELINE_STATE_FOG: + { + memcpy (&pipeline->big_state->fog_state, + &authority->big_state->fog_state, + sizeof (CoglPipelineFogState)); + break; + } + case COGL_PIPELINE_STATE_LOGIC_OPS: + { + memcpy (&pipeline->big_state->logic_ops_state, + &authority->big_state->logic_ops_state, + sizeof (CoglPipelineLogicOpsState)); + break; + } + case COGL_PIPELINE_STATE_CULL_FACE: + { + memcpy (&pipeline->big_state->cull_face_state, + &authority->big_state->cull_face_state, + sizeof (CoglPipelineCullFaceState)); + break; + } + case COGL_PIPELINE_STATE_UNIFORMS: + { + CoglPipelineUniformsState *uniforms_state = + &pipeline->big_state->uniforms_state; + _cogl_bitmask_init (&uniforms_state->override_mask); + _cogl_bitmask_init (&uniforms_state->changed_mask); + uniforms_state->override_values = NULL; + break; + } + case COGL_PIPELINE_STATE_VERTEX_SNIPPETS: + _cogl_pipeline_snippet_list_copy (&pipeline->big_state->vertex_snippets, + &authority->big_state->vertex_snippets); + break; + + case COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS: + _cogl_pipeline_snippet_list_copy (&pipeline->big_state->fragment_snippets, + &authority->big_state-> + fragment_snippets); + break; + } +} + +static CoglBool +check_if_strong_cb (CoglNode *node, void *user_data) +{ + CoglPipeline *pipeline = COGL_PIPELINE (node); + CoglBool *has_strong_child = user_data; + + if (!_cogl_pipeline_is_weak (pipeline)) + { + *has_strong_child = TRUE; + return FALSE; + } + + return TRUE; +} + +static CoglBool +has_strong_children (CoglPipeline *pipeline) +{ + CoglBool has_strong_child = FALSE; + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + check_if_strong_cb, + &has_strong_child); + return has_strong_child; +} + +static CoglBool +_cogl_pipeline_is_weak (CoglPipeline *pipeline) +{ + if (pipeline->is_weak && !has_strong_children (pipeline)) + return TRUE; + else + return FALSE; +} + +static CoglBool +reparent_children_cb (CoglNode *node, + void *user_data) +{ + CoglPipeline *pipeline = COGL_PIPELINE (node); + CoglPipeline *parent = user_data; + + _cogl_pipeline_set_parent (pipeline, parent, TRUE); + + return TRUE; +} + +void +_cogl_pipeline_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color, + CoglBool from_layer_change) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If primitives have been logged in the journal referencing the + * current state of this pipeline we need to flush the journal + * before we can modify it... */ + if (pipeline->journal_ref_count) + { + CoglBool skip_journal_flush = FALSE; + + /* XXX: We don't usually need to flush the journal just due to + * color changes since pipeline colors are logged in the + * journal's vertex buffer. The exception is when the change in + * color enables or disables the need for blending. */ + if (change == COGL_PIPELINE_STATE_COLOR) + { + CoglBool will_need_blending = + _cogl_pipeline_needs_blending_enabled (pipeline, + change, + new_color, + FALSE); + CoglBool blend_enable = pipeline->real_blend_enable ? TRUE : FALSE; + + if (will_need_blending == blend_enable) + skip_journal_flush = TRUE; + } + + if (!skip_journal_flush) + { + /* XXX: note we use cogl_flush() not _cogl_flush_journal() so + * we will flush *all* known journals that might reference the + * current pipeline. */ + cogl_flush (); + } + } + + /* XXX: + * To simplify things for the vertex, fragment and program backends + * we are careful about how we report STATE_LAYERS changes. + * + * All STATE_LAYERS change notifications with the exception of + * ->n_layers will also result in layer_pre_change_notifications. + * + * For backends that perform code generation for fragment processing + * they typically need to understand the details of how layers get + * changed to determine if they need to repeat codegen. It doesn't + * help them to report a pipeline STATE_LAYERS change for all layer + * changes since it's so broad, they really need to wait for the + * specific layer change to be notified. What does help though is + * to report a STATE_LAYERS change for a change in ->n_layers + * because they typically do need to repeat codegen in that case. + * + * Here we ensure that change notifications against a pipeline or + * against a layer are mutually exclusive as far as fragment, vertex + * and program backends are concerned. + * + * NB: A pipeline can potentially have private state from multiple + * backends associated with it because descendants may cache state + * with an ancestor to maximize the chance that it can later be + * re-used by other descendants and a descendent can require a + * different backend to an ancestor. + */ + if (!from_layer_change) + { + int i; + + for (i = 0; i < COGL_PIPELINE_N_PROGENDS; i++) + { + const CoglPipelineProgend *progend = _cogl_pipeline_progends[i]; + const CoglPipelineVertend *vertend = + _cogl_pipeline_vertends[progend->vertend]; + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[progend->fragend]; + + if (vertend->pipeline_pre_change_notify) + vertend->pipeline_pre_change_notify (pipeline, change, new_color); + + /* TODO: make the vertend and fragend implementation details + * of the progend */ + + if (fragend->pipeline_pre_change_notify) + fragend->pipeline_pre_change_notify (pipeline, change, new_color); + + if (progend->pipeline_pre_change_notify) + progend->pipeline_pre_change_notify (pipeline, change, new_color); + } + } + + /* There may be an arbitrary tree of descendants of this pipeline; + * any of which may indirectly depend on this pipeline as the + * authority for some set of properties. (Meaning for example that + * one of its descendants derives its color or blending state from + * this pipeline.) + * + * We can't modify any property that this pipeline is the authority + * for unless we create another pipeline to take its place first and + * make sure descendants reference this new pipeline instead. + */ + + /* The simplest descendants to handle are weak pipelines; we simply + * destroy them if we are modifying a pipeline they depend on. This + * means weak pipelines never cause us to do a copy-on-write. */ + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + destroy_weak_children_cb, + NULL); + + /* If there are still children remaining though we'll need to + * perform a copy-on-write and reparent the dependants as children + * of the copy. */ + if (!_cogl_list_empty (&COGL_NODE (pipeline)->children)) + { + CoglPipeline *new_authority; + + COGL_STATIC_COUNTER (pipeline_copy_on_write_counter, + "pipeline copy on write counter", + "Increments each time a pipeline " + "must be copied to allow modification", + 0 /* no application private data */); + + COGL_COUNTER_INC (_cogl_uprof_context, pipeline_copy_on_write_counter); + + new_authority = + cogl_pipeline_copy (_cogl_pipeline_get_parent (pipeline)); +#ifdef COGL_DEBUG_ENABLED + _cogl_pipeline_set_static_breadcrumb (new_authority, + "pre_change_notify:copy-on-write"); +#endif + + /* We could explicitly walk the descendants, OR together the set + * of differences that we determine this pipeline is the + * authority on and only copy those differences copied across. + * + * Or, if we don't explicitly walk the descendants we at least + * know that pipeline->differences represents the largest set of + * differences that this pipeline could possibly be an authority + * on. + * + * We do the later just because it's simplest, but we might need + * to come back to this later... + */ + _cogl_pipeline_copy_differences (new_authority, pipeline, + pipeline->differences); + + /* Reparent the dependants of pipeline to be children of + * new_authority instead... */ + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + reparent_children_cb, + new_authority); + + /* The children will keep the new authority alive so drop the + * reference we got when copying... */ + cogl_object_unref (new_authority); + } + + /* At this point we know we have a pipeline with no strong + * dependants (though we may have some weak children) so we are now + * free to modify the pipeline. */ + + pipeline->age++; + + if (change & COGL_PIPELINE_STATE_NEEDS_BIG_STATE && + !pipeline->has_big_state) + { + pipeline->big_state = g_slice_new (CoglPipelineBigState); + pipeline->has_big_state = TRUE; + } + + /* Note: conceptually we have just been notified that a single + * property value is about to change, but since some state-groups + * contain multiple properties and 'pipeline' is about to take over + * being the authority for the property's corresponding state-group + * we need to maintain the integrity of the other property values + * too. + * + * To ensure this we handle multi-property state-groups by copying + * all the values from the old-authority to the new... + * + * We don't have to worry about non-sparse property groups since + * we never take over being an authority for such properties so + * they automatically maintain integrity. + */ + if (change & COGL_PIPELINE_STATE_ALL_SPARSE && + !(pipeline->differences & change)) + { + _cogl_pipeline_init_multi_property_sparse_state (pipeline, change); + pipeline->differences |= change; + } + + /* Each pipeline has a sorted cache of the layers it depends on + * which will need updating via _cogl_pipeline_update_layers_cache + * if a pipeline's layers are changed. */ + if (change == COGL_PIPELINE_STATE_LAYERS) + recursively_free_layer_caches (pipeline); + + /* If the pipeline being changed is the same as the last pipeline we + * flushed then we keep a track of the changes so we can try to + * minimize redundant OpenGL calls if the same pipeline is flushed + * again. + */ + if (ctx->current_pipeline == pipeline) + ctx->current_pipeline_changes_since_flush |= change; +} + + +void +_cogl_pipeline_add_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglBool inc_n_layers) +{ + _COGL_RETURN_IF_FAIL (layer->owner == NULL); + + layer->owner = pipeline; + cogl_object_ref (layer); + + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + /* Note: the last argument to _cogl_pipeline_pre_change_notify is + * needed to differentiate STATE_LAYER changes which don't affect + * the number of layers from those that do. NB: Layer change + * notifications that don't change the number of layers don't get + * forwarded to the fragend. */ + _cogl_pipeline_pre_change_notify (pipeline, + COGL_PIPELINE_STATE_LAYERS, + NULL, + !inc_n_layers); + + pipeline->differences |= COGL_PIPELINE_STATE_LAYERS; + + pipeline->layer_differences = + g_list_prepend (pipeline->layer_differences, layer); + + if (inc_n_layers) + pipeline->n_layers++; + + /* Adding a layer difference may mean this pipeline now overrides + * all of the layers of its parent which might make the parent + * redundant so we should try to prune the hierarchy */ + _cogl_pipeline_prune_redundant_ancestry (pipeline); +} + +void +_cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglBool dec_n_layers) +{ + /* - Flush journal primitives referencing the current state. + * - Make sure the pipeline has no dependants so it may be modified. + * - If the pipeline isn't currently an authority for the state being + * changed, then initialize that state from the current authority. + */ + /* Note: the last argument to _cogl_pipeline_pre_change_notify is + * needed to differentiate STATE_LAYER changes which don't affect + * the number of layers from those that do. NB: Layer change + * notifications that don't change the number of layers don't get + * forwarded to the fragend. */ + _cogl_pipeline_pre_change_notify (pipeline, + COGL_PIPELINE_STATE_LAYERS, + NULL, + !dec_n_layers); + + /* We only need to remove the layer difference if the pipeline is + * currently the owner. If it is not the owner then one of two + * things will happen to make sure this layer is replaced. If it is + * the last layer being removed then decrementing n_layers will + * ensure that the last layer is skipped. If it is any other layer + * then the subsequent layers will have been shifted down and cause + * it be replaced */ + if (layer->owner == pipeline) + { + layer->owner = NULL; + cogl_object_unref (layer); + + pipeline->layer_differences = + g_list_remove (pipeline->layer_differences, layer); + } + + pipeline->differences |= COGL_PIPELINE_STATE_LAYERS; + + if (dec_n_layers) + pipeline->n_layers--; +} + +static void +_cogl_pipeline_try_reverting_layers_authority (CoglPipeline *authority, + CoglPipeline *old_authority) +{ + if (authority->layer_differences == NULL && + _cogl_pipeline_get_parent (authority)) + { + /* If the previous _STATE_LAYERS authority has the same + * ->n_layers then we can revert to that being the authority + * again. */ + if (!old_authority) + { + old_authority = + _cogl_pipeline_get_authority (_cogl_pipeline_get_parent (authority), + COGL_PIPELINE_STATE_LAYERS); + } + + if (old_authority->n_layers == authority->n_layers) + authority->differences &= ~COGL_PIPELINE_STATE_LAYERS; + } +} + +void +_cogl_pipeline_update_real_blend_enable (CoglPipeline *pipeline, + CoglBool unknown_color_alpha) +{ + CoglPipeline *parent; + unsigned int differences; + + if (pipeline->dirty_real_blend_enable == FALSE && + pipeline->unknown_color_alpha == unknown_color_alpha) + return; + + if (pipeline->dirty_real_blend_enable) + { + differences = pipeline->differences; + + parent = _cogl_pipeline_get_parent (pipeline); + while (parent->dirty_real_blend_enable) + { + differences |= parent->differences; + parent = _cogl_pipeline_get_parent (parent); + } + + /* We initialize the pipeline's real_blend_enable with a known + * reference value from its nearest ancestor with clean state so + * we can then potentially reduce the work involved in checking + * if the pipeline really needs blending itself because we can + * just look at the things that differ between the ancestor and + * this pipeline. + */ + pipeline->real_blend_enable = parent->real_blend_enable; + } + else /* pipeline->unknown_color_alpha != unknown_color_alpha */ + differences = 0; + + /* Note we don't call _cogl_pipeline_pre_change_notify() for this + * state change because ->real_blend_enable is lazily derived from + * other state while flushing the pipeline and we'd need to avoid + * recursion problems in cases where _pre_change_notify() flushes + * the journal if the pipeline is referenced by a journal. + */ + pipeline->real_blend_enable = + _cogl_pipeline_needs_blending_enabled (pipeline, differences, + NULL, unknown_color_alpha); + pipeline->dirty_real_blend_enable = FALSE; + pipeline->unknown_color_alpha = unknown_color_alpha; +} + +typedef struct +{ + int keep_n; + int current_pos; + int first_index_to_prune; +} CoglPipelinePruneLayersInfo; + +static CoglBool +update_prune_layers_info_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglPipelinePruneLayersInfo *state = user_data; + + if (state->current_pos == state->keep_n) + { + state->first_index_to_prune = layer->index; + return FALSE; + } + state->current_pos++; + return TRUE; +} + +void +_cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + CoglPipelinePruneLayersInfo state; + GList *l; + GList *next; + + if (authority->n_layers <= n) + return; + + /* This call to foreach_layer_internal needs to be done before + * calling pre_change_notify because it recreates the layer cache. + * We are relying on pre_change_notify to clear the layer cache + * before we change the number of layers */ + state.keep_n = n; + state.current_pos = 0; + _cogl_pipeline_foreach_layer_internal (pipeline, + update_prune_layers_info_cb, + &state); + + _cogl_pipeline_pre_change_notify (pipeline, + COGL_PIPELINE_STATE_LAYERS, + NULL, + FALSE); + + pipeline->differences |= COGL_PIPELINE_STATE_LAYERS; + pipeline->n_layers = n; + + /* It's possible that this pipeline owns some of the layers being + * discarded, so we'll need to unlink them... */ + for (l = pipeline->layer_differences; l; l = next) + { + CoglPipelineLayer *layer = l->data; + next = l->next; /* we're modifying the list we're iterating */ + + if (layer->index >= state.first_index_to_prune) + _cogl_pipeline_remove_layer_difference (pipeline, layer, FALSE); + } + + pipeline->differences |= COGL_PIPELINE_STATE_LAYERS; +} + +typedef struct +{ + /* The layer we are trying to find */ + int layer_index; + + /* The layer we find or untouched if not found */ + CoglPipelineLayer *layer; + + /* If the layer can't be found then a new layer should be + * inserted after this texture unit index... */ + int insert_after; + + /* When adding a layer we need the list of layers to shift up + * to a new texture unit. When removing we need the list of + * layers to shift down. + * + * Note: the list isn't sorted */ + CoglPipelineLayer **layers_to_shift; + int n_layers_to_shift; + + /* When adding a layer we don't need a complete list of + * layers_to_shift if we find a layer already corresponding to the + * layer_index. */ + CoglBool ignore_shift_layers_if_found; + +} CoglPipelineLayerInfo; + +/* Returns TRUE once we know there is nothing more to update */ +static CoglBool +update_layer_info (CoglPipelineLayer *layer, + CoglPipelineLayerInfo *layer_info) +{ + if (layer->index == layer_info->layer_index) + { + layer_info->layer = layer; + if (layer_info->ignore_shift_layers_if_found) + return TRUE; + } + else if (layer->index < layer_info->layer_index) + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + layer_info->insert_after = unit_index; + } + else + layer_info->layers_to_shift[layer_info->n_layers_to_shift++] = + layer; + + return FALSE; +} + +/* Returns FALSE to break out of a _foreach_layer () iteration */ +static CoglBool +update_layer_info_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineLayerInfo *layer_info = user_data; + + if (update_layer_info (layer, layer_info)) + return FALSE; /* break */ + else + return TRUE; /* continue */ +} + +static void +_cogl_pipeline_get_layer_info (CoglPipeline *pipeline, + CoglPipelineLayerInfo *layer_info) +{ + /* Note: we are assuming this pipeline is a _STATE_LAYERS authority */ + int n_layers = pipeline->n_layers; + int i; + + /* FIXME: _cogl_pipeline_foreach_layer_internal now calls + * _cogl_pipeline_update_layers_cache anyway so this codepath is + * pointless! */ + if (layer_info->ignore_shift_layers_if_found && + pipeline->layers_cache_dirty) + { + /* The expectation is that callers of + * _cogl_pipeline_get_layer_info are likely to be modifying the + * list of layers associated with a pipeline so in this case + * where we don't have a cache of the layers and we don't + * necessarily have to iterate all the layers of the pipeline we + * use a foreach_layer callback instead of updating the cache + * and iterating that as below. */ + _cogl_pipeline_foreach_layer_internal (pipeline, + update_layer_info_cb, + layer_info); + return; + } + + _cogl_pipeline_update_layers_cache (pipeline); + for (i = 0; i < n_layers; i++) + { + CoglPipelineLayer *layer = pipeline->layers_cache[i]; + + if (update_layer_info (layer, layer_info)) + return; + } +} + +CoglPipelineLayer * +_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, + int layer_index, + CoglPipelineGetLayerFlags flags) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + CoglPipelineLayerInfo layer_info; + CoglPipelineLayer *layer; + int unit_index; + int i; + CoglContext *ctx; + + /* The layer index of the layer we want info about */ + layer_info.layer_index = layer_index; + + /* If a layer already exists with the given index this will be + * updated. */ + layer_info.layer = NULL; + + /* If a layer isn't found for the given index we'll need to know + * where to insert a new layer. */ + layer_info.insert_after = -1; + + /* If a layer can't be found then we'll need to insert a new layer + * and bump up the texture unit for all layers with an index + * > layer_index. */ + layer_info.layers_to_shift = + g_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers); + layer_info.n_layers_to_shift = 0; + + /* If an exact match is found though we don't need a complete + * list of layers with indices > layer_index... */ + layer_info.ignore_shift_layers_if_found = TRUE; + + _cogl_pipeline_get_layer_info (authority, &layer_info); + + if (layer_info.layer || (flags & COGL_PIPELINE_GET_LAYER_NO_CREATE)) + return layer_info.layer; + + ctx = _cogl_context_get_default (); + + unit_index = layer_info.insert_after + 1; + if (unit_index == 0) + layer = _cogl_pipeline_layer_copy (ctx->default_layer_0); + else + { + CoglPipelineLayer *new; + layer = _cogl_pipeline_layer_copy (ctx->default_layer_n); + new = _cogl_pipeline_set_layer_unit (NULL, layer, unit_index); + /* Since we passed a newly allocated layer we wouldn't expect + * _set_layer_unit() to have to allocate *another* layer. */ + g_assert (new == layer); + } + layer->index = layer_index; + + for (i = 0; i < layer_info.n_layers_to_shift; i++) + { + CoglPipelineLayer *shift_layer = layer_info.layers_to_shift[i]; + + unit_index = _cogl_pipeline_layer_get_unit_index (shift_layer); + _cogl_pipeline_set_layer_unit (pipeline, shift_layer, unit_index + 1); + /* NB: shift_layer may not be writeable so _set_layer_unit() + * will allocate a derived layer internally which will become + * owned by pipeline. Check the return value if we need to do + * anything else with this layer. */ + } + + _cogl_pipeline_add_layer_difference (pipeline, layer, TRUE); + + cogl_object_unref (layer); + + return layer; +} + +void +_cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority, + CoglPipelineLayer *layer) +{ + /* Find the GList link that references the empty layer */ + GList *link = g_list_find (layers_authority->layer_differences, layer); + /* No pipeline directly owns the root node layer so this is safe... */ + CoglPipelineLayer *layer_parent = _cogl_pipeline_layer_get_parent (layer); + CoglPipelineLayerInfo layer_info; + CoglPipeline *old_layers_authority; + + _COGL_RETURN_IF_FAIL (link != NULL); + + /* If the layer's parent doesn't have an owner then we can simply + * take ownership ourselves and drop our reference on the empty + * layer. We don't want to take ownership of the root node layer so + * we also need to verify that the parent has a parent + */ + if (layer_parent->index == layer->index && layer_parent->owner == NULL && + _cogl_pipeline_layer_get_parent (layer_parent) != NULL) + { + cogl_object_ref (layer_parent); + layer_parent->owner = layers_authority; + link->data = layer_parent; + cogl_object_unref (layer); + recursively_free_layer_caches (layers_authority); + return; + } + + /* Now we want to find the layer that would become the authority for + * layer->index if we were to remove layer from + * layers_authority->layer_differences + */ + + /* The layer index of the layer we want info about */ + layer_info.layer_index = layer->index; + + /* If a layer already exists with the given index this will be + * updated. */ + layer_info.layer = NULL; + + /* If a layer can't be found then we'll need to insert a new layer + * and bump up the texture unit for all layers with an index + * > layer_index. */ + layer_info.layers_to_shift = + g_alloca (sizeof (CoglPipelineLayer *) * layers_authority->n_layers); + layer_info.n_layers_to_shift = 0; + + /* If an exact match is found though we don't need a complete + * list of layers with indices > layer_index... */ + layer_info.ignore_shift_layers_if_found = TRUE; + + /* We know the default/root pipeline isn't a LAYERS authority so it's + * safe to use the result of _cogl_pipeline_get_parent (layers_authority) + * without checking it. + */ + old_layers_authority = + _cogl_pipeline_get_authority (_cogl_pipeline_get_parent (layers_authority), + COGL_PIPELINE_STATE_LAYERS); + + _cogl_pipeline_get_layer_info (old_layers_authority, &layer_info); + + /* If layer is the defining layer for the corresponding ->index then + * we can't get rid of it. */ + if (!layer_info.layer) + return; + + /* If the layer that would become the authority for layer->index is + * _cogl_pipeline_layer_get_parent (layer) then we can simply remove the + * layer difference. */ + if (layer_info.layer == _cogl_pipeline_layer_get_parent (layer)) + { + _cogl_pipeline_remove_layer_difference (layers_authority, layer, FALSE); + _cogl_pipeline_try_reverting_layers_authority (layers_authority, + old_layers_authority); + } +} + +typedef struct +{ + int i; + CoglPipeline *pipeline; + unsigned long fallback_layers; +} CoglPipelineFallbackState; + +static CoglBool +fallback_layer_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglPipelineFallbackState *state = user_data; + CoglPipeline *pipeline = state->pipeline; + CoglTextureType texture_type = _cogl_pipeline_layer_get_texture_type (layer); + CoglTexture *texture = NULL; + COGL_STATIC_COUNTER (layer_fallback_counter, + "layer fallback counter", + "Increments each time a layer's texture is " + "forced to a fallback texture", + 0 /* no application private data */); + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (!(state->fallback_layers & 1<i)) + return TRUE; + + COGL_COUNTER_INC (_cogl_uprof_context, layer_fallback_counter); + + switch (texture_type) + { + case COGL_TEXTURE_TYPE_2D: + texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex); + break; + + case COGL_TEXTURE_TYPE_3D: + texture = COGL_TEXTURE (ctx->default_gl_texture_3d_tex); + break; + + case COGL_TEXTURE_TYPE_RECTANGLE: + texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex); + break; + } + + if (texture == NULL) + { + g_warning ("We don't have a fallback texture we can use to fill " + "in for an invalid pipeline layer, since it was " + "using an unsupported texture target "); + /* might get away with this... */ + texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex); + } + + cogl_pipeline_set_layer_texture (pipeline, layer->index, texture); + + state->i++; + + return TRUE; +} + +typedef struct +{ + CoglPipeline *pipeline; + CoglTexture *texture; +} CoglPipelineOverrideLayerState; + +static CoglBool +override_layer_texture_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglPipelineOverrideLayerState *state = user_data; + + cogl_pipeline_set_layer_texture (state->pipeline, + layer->index, + state->texture); + + return TRUE; +} + +void +_cogl_pipeline_apply_overrides (CoglPipeline *pipeline, + CoglPipelineFlushOptions *options) +{ + COGL_STATIC_COUNTER (apply_overrides_counter, + "pipeline overrides counter", + "Increments each time we have to apply " + "override options to a pipeline", + 0 /* no application private data */); + + COGL_COUNTER_INC (_cogl_uprof_context, apply_overrides_counter); + + if (options->flags & COGL_PIPELINE_FLUSH_DISABLE_MASK) + { + int i; + + /* NB: we can assume that once we see one bit to disable + * a layer, all subsequent layers are also disabled. */ + for (i = 0; i < 32 && options->disable_layers & (1<flags & COGL_PIPELINE_FLUSH_FALLBACK_MASK) + { + CoglPipelineFallbackState state; + + state.i = 0; + state.pipeline = pipeline; + state.fallback_layers = options->fallback_layers; + + _cogl_pipeline_foreach_layer_internal (pipeline, + fallback_layer_cb, + &state); + } + + if (options->flags & COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE) + { + CoglPipelineOverrideLayerState state; + + _cogl_pipeline_prune_to_n_layers (pipeline, 1); + + /* NB: we are overriding the first layer, but we don't know + * the user's given layer_index, which is why we use + * _cogl_pipeline_foreach_layer_internal() here even though we know + * there's only one layer. */ + state.pipeline = pipeline; + state.texture = options->layer0_override_texture; + _cogl_pipeline_foreach_layer_internal (pipeline, + override_layer_texture_cb, + &state); + } +} + +static CoglBool +_cogl_pipeline_layers_equal (CoglPipeline *authority0, + CoglPipeline *authority1, + unsigned long differences, + CoglPipelineEvalFlags flags) +{ + int i; + + if (authority0->n_layers != authority1->n_layers) + return FALSE; + + _cogl_pipeline_update_layers_cache (authority0); + _cogl_pipeline_update_layers_cache (authority1); + + for (i = 0; i < authority0->n_layers; i++) + { + if (!_cogl_pipeline_layer_equal (authority0->layers_cache[i], + authority1->layers_cache[i], + differences, + flags)) + return FALSE; + } + return TRUE; +} + +/* Determine the mask of differences between two pipelines */ +unsigned long +_cogl_pipeline_compare_differences (CoglPipeline *pipeline0, + CoglPipeline *pipeline1) +{ + GSList *head0 = NULL; + GSList *head1 = NULL; + CoglPipeline *node0; + CoglPipeline *node1; + int len0 = 0; + int len1 = 0; + int count; + GSList *common_ancestor0; + GSList *common_ancestor1; + unsigned long pipelines_difference = 0; + + /* Algorithm: + * + * 1) Walk the ancestors of each pipeline to the root node, adding a + * pointer to each ancester node to two linked lists + * + * 2) Compare the lists to find the nodes where they start to + * differ marking the common_ancestor node for each list. + * + * 3) For each list now iterate starting after the common_ancestor + * nodes ORing each nodes ->difference mask into the final + * differences mask. + */ + + for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head0; + link->data = node0; + head0 = link; + len0++; + } + for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1)) + { + GSList *link = alloca (sizeof (GSList)); + link->next = head1; + link->data = node1; + head1 = link; + len1++; + } + + /* NB: There's no point looking at the head entries since we know both + * pipelines must have the same default pipeline as their root node. */ + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + count = MIN (len0, len1) - 1; + while (count--) + { + if (head0->data != head1->data) + break; + common_ancestor0 = head0; + common_ancestor1 = head1; + head0 = head0->next; + head1 = head1->next; + } + + for (head0 = common_ancestor0->next; head0; head0 = head0->next) + { + node0 = head0->data; + pipelines_difference |= node0->differences; + } + for (head1 = common_ancestor1->next; head1; head1 = head1->next) + { + node1 = head1->data; + pipelines_difference |= node1->differences; + } + + return pipelines_difference; +} + +static void +_cogl_pipeline_resolve_authorities (CoglPipeline *pipeline, + unsigned long differences, + CoglPipeline **authorities) +{ + unsigned long remaining = differences; + CoglPipeline *authority = pipeline; + + do + { + unsigned long found = authority->differences & remaining; + int i; + + if (found == 0) + continue; + + for (i = 0; TRUE; i++) + { + unsigned long state = (1L< found) + break; + } + + remaining &= ~found; + if (remaining == 0) + return; + } + while ((authority = _cogl_pipeline_get_parent (authority))); + + g_assert (remaining == 0); +} + +/* Comparison of two arbitrary pipelines is done by: + * 1) walking up the parents of each pipeline until a common + * ancestor is found, and at each step ORing together the + * difference masks. + * + * 2) using the final difference mask to determine which state + * groups to compare. + * + * This is used, for example, by the Cogl journal to compare pipelines so that + * it can split up geometry that needs different OpenGL state. + * + * XXX: When comparing texture layers, _cogl_pipeline_equal will actually + * compare the underlying GL texture handle that the Cogl texture uses so that + * atlas textures and sub textures will be considered equal if they point to + * the same texture. This is useful for comparing pipelines in the journal but + * it means that _cogl_pipeline_equal doesn't strictly compare whether the + * pipelines are the same. If we needed those semantics we could perhaps add + * another function or some flags to control the behaviour. + * + * XXX: Similarly when comparing the wrap modes, + * COGL_PIPELINE_WRAP_MODE_AUTOMATIC is considered to be the same as + * COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE because once they get to the + * journal stage they act exactly the same. + */ +CoglBool +_cogl_pipeline_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1, + unsigned int differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags) +{ + unsigned long pipelines_difference; + CoglPipeline *authorities0[COGL_PIPELINE_STATE_SPARSE_COUNT]; + CoglPipeline *authorities1[COGL_PIPELINE_STATE_SPARSE_COUNT]; + int bit; + CoglBool ret; + + COGL_STATIC_TIMER (pipeline_equal_timer, + "Mainloop", /* parent */ + "_cogl_pipeline_equal", + "The time spent comparing cogl pipelines", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, pipeline_equal_timer); + + if (pipeline0 == pipeline1) + { + ret = TRUE; + goto done; + } + + ret = FALSE; + + _cogl_pipeline_update_real_blend_enable (pipeline0, FALSE); + _cogl_pipeline_update_real_blend_enable (pipeline1, FALSE); + + /* First check non-sparse properties */ + + if (differences & COGL_PIPELINE_STATE_REAL_BLEND_ENABLE && + pipeline0->real_blend_enable != pipeline1->real_blend_enable) + goto done; + + /* Then check sparse properties */ + + pipelines_difference = + _cogl_pipeline_compare_differences (pipeline0, pipeline1); + + /* Only compare the sparse state groups requested by the caller... */ + pipelines_difference &= differences; + + _cogl_pipeline_resolve_authorities (pipeline0, + pipelines_difference, + authorities0); + _cogl_pipeline_resolve_authorities (pipeline1, + pipelines_difference, + authorities1); + + COGL_FLAGS_FOREACH_START (&pipelines_difference, 1, bit) + { + /* XXX: We considered having an array of callbacks for each state index + * that we'd call here but decided that this way the compiler is more + * likely going to be able to in-line the comparison functions and use + * the index to jump straight to the required code. */ + switch ((CoglPipelineStateIndex)bit) + { + case COGL_PIPELINE_STATE_COLOR_INDEX: + if (!cogl_color_equal (&authorities0[bit]->color, + &authorities1[bit]->color)) + goto done; + break; + case COGL_PIPELINE_STATE_LIGHTING_INDEX: + if (!_cogl_pipeline_lighting_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX: + if (!_cogl_pipeline_alpha_func_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX: + if (!_cogl_pipeline_alpha_func_reference_state_equal ( + authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_BLEND_INDEX: + /* We don't need to compare the detailed blending state if we know + * blending is disabled for both pipelines. */ + if (pipeline0->real_blend_enable) + { + if (!_cogl_pipeline_blend_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + } + break; + case COGL_PIPELINE_STATE_DEPTH_INDEX: + if (!_cogl_pipeline_depth_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_FOG_INDEX: + if (!_cogl_pipeline_fog_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_CULL_FACE_INDEX: + if (!_cogl_pipeline_cull_face_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX: + if (!_cogl_pipeline_non_zero_point_size_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_POINT_SIZE_INDEX: + if (!_cogl_pipeline_point_size_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX: + if (!_cogl_pipeline_per_vertex_point_size_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_LOGIC_OPS_INDEX: + if (!_cogl_pipeline_logic_ops_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_USER_SHADER_INDEX: + if (!_cogl_pipeline_user_shader_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_UNIFORMS_INDEX: + if (!_cogl_pipeline_uniforms_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX: + if (!_cogl_pipeline_vertex_snippets_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS_INDEX: + if (!_cogl_pipeline_fragment_snippets_state_equal (authorities0[bit], + authorities1[bit])) + goto done; + break; + case COGL_PIPELINE_STATE_LAYERS_INDEX: + { + if (!_cogl_pipeline_layers_equal (authorities0[bit], + authorities1[bit], + layer_differences, + flags)) + goto done; + break; + } + + case COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX: + case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX: + case COGL_PIPELINE_STATE_COUNT: + g_warn_if_reached (); + } + } + COGL_FLAGS_FOREACH_END; + + ret = TRUE; +done: + COGL_TIMER_STOP (_cogl_uprof_context, pipeline_equal_timer); + return ret; +} + +void +_cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline) +{ + CoglPipeline *new_parent = _cogl_pipeline_get_parent (pipeline); + + /* Before considering pruning redundant ancestry we check if this + * pipeline is an authority for layer state and if so only consider + * reparenting if it *owns* all the layers it depends on. NB: A + * pipeline can be be a STATE_LAYERS authority but it may still + * defer to its ancestors to define the state for some of its + * layers. + * + * For example a pipeline that derives from a parent with 5 layers + * can become a STATE_LAYERS authority by simply changing it's + * ->n_layers count to 4 and in that case it can still defer to its + * ancestors to define the state of those 4 layers. + * + * If a pipeline depends on any ancestors for layer state then we + * immediatly bail out. + */ + if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS) + { + if (pipeline->n_layers != g_list_length (pipeline->layer_differences)) + return; + } + + /* walk up past ancestors that are now redundant and potentially + * reparent the pipeline. */ + while (_cogl_pipeline_get_parent (new_parent) && + (new_parent->differences | pipeline->differences) == + pipeline->differences) + new_parent = _cogl_pipeline_get_parent (new_parent); + + if (new_parent != _cogl_pipeline_get_parent (pipeline)) + { + CoglBool is_weak = _cogl_pipeline_is_weak (pipeline); + _cogl_pipeline_set_parent (pipeline, new_parent, is_weak ? FALSE : TRUE); + } +} + +void +_cogl_pipeline_update_authority (CoglPipeline *pipeline, + CoglPipeline *authority, + CoglPipelineState state, + CoglPipelineStateComparitor comparitor) +{ + /* If we are the current authority see if we can revert to one of + * our ancestors being the authority */ + if (pipeline == authority && + _cogl_pipeline_get_parent (authority) != NULL) + { + CoglPipeline *parent = _cogl_pipeline_get_parent (authority); + CoglPipeline *old_authority = + _cogl_pipeline_get_authority (parent, state); + + if (comparitor (authority, old_authority)) + pipeline->differences &= ~state; + } + else if (pipeline != authority) + { + /* If we weren't previously the authority on this state then we + * need to extended our differences mask and so it's possible + * that some of our ancestry will now become redundant, so we + * aim to reparent ourselves if that's true... */ + pipeline->differences |= state; + _cogl_pipeline_prune_redundant_ancestry (pipeline); + } +} + +CoglBool +_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG); + return authority->big_state->fog_state.enabled; +} + +unsigned long +_cogl_pipeline_get_age (CoglPipeline *pipeline) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); + + return pipeline->age; +} + +void +cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index) +{ + CoglPipeline *authority; + CoglPipelineLayerInfo layer_info; + int i; + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + + /* The layer index of the layer we want info about */ + layer_info.layer_index = layer_index; + + /* This will be updated with a reference to the layer being removed + * if it can be found. */ + layer_info.layer = NULL; + + /* This will be filled in with a list of layers that need to be + * dropped down to a lower texture unit to fill the gap of the + * removed layer. */ + layer_info.layers_to_shift = + g_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers); + layer_info.n_layers_to_shift = 0; + + /* Unlike when we query layer info when adding a layer we must + * always have a complete layers_to_shift list... */ + layer_info.ignore_shift_layers_if_found = FALSE; + + _cogl_pipeline_get_layer_info (authority, &layer_info); + + if (layer_info.layer == NULL) + return; + + for (i = 0; i < layer_info.n_layers_to_shift; i++) + { + CoglPipelineLayer *shift_layer = layer_info.layers_to_shift[i]; + int unit_index = _cogl_pipeline_layer_get_unit_index (shift_layer); + _cogl_pipeline_set_layer_unit (pipeline, shift_layer, unit_index - 1); + /* NB: shift_layer may not be writeable so _set_layer_unit() + * will allocate a derived layer internally which will become + * owned by pipeline. Check the return value if we need to do + * anything else with this layer. */ + } + + _cogl_pipeline_remove_layer_difference (pipeline, layer_info.layer, TRUE); + _cogl_pipeline_try_reverting_layers_authority (pipeline, NULL); + + pipeline->dirty_real_blend_enable = TRUE; +} + +static CoglBool +prepend_layer_to_list_cb (CoglPipelineLayer *layer, + void *user_data) +{ + GList **layers = user_data; + + *layers = g_list_prepend (*layers, layer); + return TRUE; +} + +/* TODO: deprecate this API and replace it with + * cogl_pipeline_foreach_layer + * TODO: update the docs to note that if the user modifies any layers + * then the list may become invalid. + */ +const GList * +_cogl_pipeline_get_layers (CoglPipeline *pipeline) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); + + if (!pipeline->deprecated_get_layers_list_dirty) + g_list_free (pipeline->deprecated_get_layers_list); + + pipeline->deprecated_get_layers_list = NULL; + + _cogl_pipeline_foreach_layer_internal (pipeline, + prepend_layer_to_list_cb, + &pipeline->deprecated_get_layers_list); + pipeline->deprecated_get_layers_list = + g_list_reverse (pipeline->deprecated_get_layers_list); + + pipeline->deprecated_get_layers_list_dirty = 0; + + return pipeline->deprecated_get_layers_list; +} + +int +cogl_pipeline_get_n_layers (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); + + return authority->n_layers; +} + +void +_cogl_pipeline_pre_paint_for_layer (CoglPipeline *pipeline, + int layer_id) +{ + CoglPipelineLayer *layer = _cogl_pipeline_get_layer (pipeline, layer_id); + _cogl_pipeline_layer_pre_paint (layer); +} + +/* While a pipeline is referenced by the Cogl journal we can not allow + * modifications, so this gives us a mechanism to track journal + * references separately */ +CoglPipeline * +_cogl_pipeline_journal_ref (CoglPipeline *pipeline) +{ + pipeline->journal_ref_count++; + return cogl_object_ref (pipeline); +} + +void +_cogl_pipeline_journal_unref (CoglPipeline *pipeline) +{ + pipeline->journal_ref_count--; + cogl_object_unref (pipeline); +} + +#ifdef COGL_DEBUG_ENABLED +void +_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* It was a mistake that we ever copied the OpenGL style API for + * associating these things directly with the context when we + * originally wrote Cogl. Until the corresponding deprecated APIs + * can be removed though we now shoehorn the state changes through + * the cogl_pipeline API instead. + */ + + /* A program explicitly set on the pipeline has higher precedence than + * one associated with the context using cogl_program_use() */ + if (ctx->current_program && + cogl_pipeline_get_user_program (pipeline) == COGL_INVALID_HANDLE) + cogl_pipeline_set_user_program (pipeline, ctx->current_program); + + if (ctx->legacy_depth_test_enabled) + { + CoglDepthState depth_state; + cogl_depth_state_init (&depth_state); + cogl_depth_state_set_test_enabled (&depth_state, TRUE); + cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL); + } + + if (ctx->legacy_fog_state.enabled) + _cogl_pipeline_set_fog_state (pipeline, &ctx->legacy_fog_state); + + if (ctx->legacy_backface_culling_enabled) + cogl_pipeline_set_cull_face_mode (pipeline, + COGL_PIPELINE_CULL_FACE_MODE_BACK); +} + +void +_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline, + const char *breadcrumb) +{ + pipeline->has_static_breadcrumb = TRUE; + pipeline->static_breadcrumb = breadcrumb; +} +#endif + +typedef void (*LayerStateHashFunction) (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +static LayerStateHashFunction +layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT]; + +/* XXX: We don't statically initialize the array of hash functions, so + * we won't get caught out by later re-indexing the groups for some + * reason. */ +void +_cogl_pipeline_init_layer_state_hash_functions (void) +{ + CoglPipelineLayerStateIndex _index; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_UNIT_INDEX] = + _cogl_pipeline_layer_hash_unit_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX] = + _cogl_pipeline_layer_hash_texture_type_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA_INDEX] = + _cogl_pipeline_layer_hash_texture_data_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_SAMPLER_INDEX] = + _cogl_pipeline_layer_hash_sampler_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_COMBINE_INDEX] = + _cogl_pipeline_layer_hash_combine_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT_INDEX] = + _cogl_pipeline_layer_hash_combine_constant_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_USER_MATRIX_INDEX] = + _cogl_pipeline_layer_hash_user_matrix_state; + _index = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS_INDEX; + layer_state_hash_functions[_index] = + _cogl_pipeline_layer_hash_point_sprite_state; + _index = COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS_INDEX; + layer_state_hash_functions[_index] = + _cogl_pipeline_layer_hash_point_sprite_state; + _index = COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX; + layer_state_hash_functions[_index] = + _cogl_pipeline_layer_hash_fragment_snippets_state; + + { + /* So we get a big error if we forget to update this code! */ + _COGL_STATIC_ASSERT (COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT == 10, + "Don't forget to install a hash function for new " + "pipeline state and update assert at end of " + "_cogl_pipeline_init_state_hash_functions"); + } +} + +static CoglBool +_cogl_pipeline_hash_layer_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineHashState *state = user_data; + unsigned long differences = state->layer_differences; + CoglPipelineLayer *authorities[COGL_PIPELINE_LAYER_STATE_COUNT]; + unsigned long mask; + int i; + + /* Theoretically we would hash non-sparse layer state here but + * currently layers don't have any. */ + + /* XXX: we resolve all the authorities here - not just those + * corresponding to hash_state->layer_differences - because + * the hashing of some state groups actually depends on the values + * in other groups. For example we don't hash layer combine + * constants if they are aren't referenced by the current layer + * combine function. + */ + mask = COGL_PIPELINE_LAYER_STATE_ALL_SPARSE; + _cogl_pipeline_layer_resolve_authorities (layer, + mask, + authorities); + + /* So we go right ahead and hash the sparse state... */ + for (i = 0; i < COGL_PIPELINE_LAYER_STATE_COUNT; i++) + { + unsigned long current_state = (1L< differences) + break; + } + + return TRUE; +} + +void +_cogl_pipeline_hash_layers_state (CoglPipeline *authority, + CoglPipelineHashState *state) +{ + state->hash = + _cogl_util_one_at_a_time_hash (state->hash, &authority->n_layers, + sizeof (authority->n_layers)); + _cogl_pipeline_foreach_layer_internal (authority, + _cogl_pipeline_hash_layer_cb, + state); +} + +typedef void (*StateHashFunction) (CoglPipeline *authority, CoglPipelineHashState *state); + +static StateHashFunction +state_hash_functions[COGL_PIPELINE_STATE_SPARSE_COUNT]; + +/* We don't statically initialize the array of hash functions + * so we won't get caught out by later re-indexing the groups for + * some reason. */ +void +_cogl_pipeline_init_state_hash_functions (void) +{ + state_hash_functions[COGL_PIPELINE_STATE_COLOR_INDEX] = + _cogl_pipeline_hash_color_state; + state_hash_functions[COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX] = + _cogl_pipeline_hash_blend_enable_state; + state_hash_functions[COGL_PIPELINE_STATE_LAYERS_INDEX] = + _cogl_pipeline_hash_layers_state; + state_hash_functions[COGL_PIPELINE_STATE_LIGHTING_INDEX] = + _cogl_pipeline_hash_lighting_state; + state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX] = + _cogl_pipeline_hash_alpha_func_state; + state_hash_functions[COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX] = + _cogl_pipeline_hash_alpha_func_reference_state; + state_hash_functions[COGL_PIPELINE_STATE_BLEND_INDEX] = + _cogl_pipeline_hash_blend_state; + state_hash_functions[COGL_PIPELINE_STATE_USER_SHADER_INDEX] = + _cogl_pipeline_hash_user_shader_state; + state_hash_functions[COGL_PIPELINE_STATE_DEPTH_INDEX] = + _cogl_pipeline_hash_depth_state; + state_hash_functions[COGL_PIPELINE_STATE_FOG_INDEX] = + _cogl_pipeline_hash_fog_state; + state_hash_functions[COGL_PIPELINE_STATE_CULL_FACE_INDEX] = + _cogl_pipeline_hash_cull_face_state; + state_hash_functions[COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX] = + _cogl_pipeline_hash_non_zero_point_size_state; + state_hash_functions[COGL_PIPELINE_STATE_POINT_SIZE_INDEX] = + _cogl_pipeline_hash_point_size_state; + state_hash_functions[COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX] = + _cogl_pipeline_hash_per_vertex_point_size_state; + state_hash_functions[COGL_PIPELINE_STATE_LOGIC_OPS_INDEX] = + _cogl_pipeline_hash_logic_ops_state; + state_hash_functions[COGL_PIPELINE_STATE_UNIFORMS_INDEX] = + _cogl_pipeline_hash_uniforms_state; + state_hash_functions[COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX] = + _cogl_pipeline_hash_vertex_snippets_state; + state_hash_functions[COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS_INDEX] = + _cogl_pipeline_hash_fragment_snippets_state; + + { + /* So we get a big error if we forget to update this code! */ + _COGL_STATIC_ASSERT (COGL_PIPELINE_STATE_SPARSE_COUNT == 18, + "Make sure to install a hash function for " + "newly added pipeline state and update assert " + "in _cogl_pipeline_init_state_hash_functions"); + } +} + +unsigned int +_cogl_pipeline_hash (CoglPipeline *pipeline, + unsigned int differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags) +{ + CoglPipeline *authorities[COGL_PIPELINE_STATE_SPARSE_COUNT]; + unsigned int mask; + int i; + CoglPipelineHashState state; + unsigned int final_hash = 0; + + state.hash = 0; + state.layer_differences = layer_differences; + state.flags = flags; + + _cogl_pipeline_update_real_blend_enable (pipeline, FALSE); + + /* hash non-sparse state */ + + if (differences & COGL_PIPELINE_STATE_REAL_BLEND_ENABLE) + { + CoglBool enable = pipeline->real_blend_enable; + state.hash = + _cogl_util_one_at_a_time_hash (state.hash, &enable, sizeof (enable)); + } + + /* hash sparse state */ + + mask = differences & COGL_PIPELINE_STATE_ALL_SPARSE; + _cogl_pipeline_resolve_authorities (pipeline, mask, authorities); + + for (i = 0; i < COGL_PIPELINE_STATE_SPARSE_COUNT; i++) + { + unsigned int current_state = (1< differences) + break; + } + + return _cogl_util_one_at_a_time_mix (final_hash); +} + +typedef struct +{ + CoglContext *context; + CoglPipeline *src_pipeline; + CoglPipeline *dst_pipeline; + unsigned int layer_differences; +} DeepCopyData; + +static CoglBool +deep_copy_layer_cb (CoglPipelineLayer *src_layer, + void *user_data) +{ + DeepCopyData *data = user_data; + CoglPipelineLayer *dst_layer; + unsigned int differences = data->layer_differences; + + dst_layer = _cogl_pipeline_get_layer (data->dst_pipeline, src_layer->index); + + while (src_layer != data->context->default_layer_n && + src_layer != data->context->default_layer_0 && + differences) + { + unsigned long to_copy = differences & src_layer->differences; + + if (to_copy) + { + _cogl_pipeline_layer_copy_differences (dst_layer, src_layer, to_copy); + differences ^= to_copy; + } + + src_layer = COGL_PIPELINE_LAYER (COGL_NODE (src_layer)->parent); + } + + return TRUE; +} + +CoglPipeline * +_cogl_pipeline_deep_copy (CoglPipeline *pipeline, + unsigned long differences, + unsigned long layer_differences) +{ + CoglPipeline *new, *authority; + CoglBool copy_layer_state; + + _COGL_GET_CONTEXT (ctx, NULL); + + if ((differences & COGL_PIPELINE_STATE_LAYERS)) + { + copy_layer_state = TRUE; + differences &= ~COGL_PIPELINE_STATE_LAYERS; + } + else + copy_layer_state = FALSE; + + new = cogl_pipeline_new (ctx); + + for (authority = pipeline; + authority != ctx->default_pipeline && differences; + authority = COGL_PIPELINE (COGL_NODE (authority)->parent)) + { + unsigned long to_copy = differences & authority->differences; + + if (to_copy) + { + _cogl_pipeline_copy_differences (new, authority, to_copy); + differences ^= to_copy; + } + } + + if (copy_layer_state) + { + DeepCopyData data; + + /* The unit index doesn't need to be copied because it should + * end up with the same values anyway because the new pipeline + * will have the same indices as the source pipeline */ + layer_differences &= ~COGL_PIPELINE_LAYER_STATE_UNIT; + + data.context = ctx; + data.src_pipeline = pipeline; + data.dst_pipeline = new; + data.layer_differences = layer_differences; + + _cogl_pipeline_foreach_layer_internal (pipeline, + deep_copy_layer_cb, + &data); + } + + return new; +} + +typedef struct +{ + int i; + CoglPipelineLayer **layers; +} AddLayersToArrayState; + +static CoglBool +add_layer_to_array_cb (CoglPipelineLayer *layer, + void *user_data) +{ + AddLayersToArrayState *state = user_data; + state->layers[state->i++] = layer; + return TRUE; +} + +/* This tries to find the oldest ancestor whose pipeline and layer + state matches the given flags. This is mostly used to detect code + gen authorities so that we can reduce the numer of programs + generated */ +CoglPipeline * +_cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline, + CoglPipelineState pipeline_state, + CoglPipelineLayerState layer_state) +{ + CoglPipeline *authority0; + CoglPipeline *authority1; + int n_layers; + CoglPipelineLayer **authority0_layers; + CoglPipelineLayer **authority1_layers; + + /* Find the first pipeline that modifies state that affects the + * state or any layer state... */ + authority0 = _cogl_pipeline_get_authority (pipeline, + pipeline_state | + COGL_PIPELINE_STATE_LAYERS); + + /* Find the next ancestor after that, that also modifies the + * state... */ + if (_cogl_pipeline_get_parent (authority0)) + { + authority1 = + _cogl_pipeline_get_authority (_cogl_pipeline_get_parent (authority0), + pipeline_state | + COGL_PIPELINE_STATE_LAYERS); + } + else + return authority0; + + n_layers = cogl_pipeline_get_n_layers (authority0); + + for (;;) + { + AddLayersToArrayState state; + int i; + + if (n_layers != cogl_pipeline_get_n_layers (authority1)) + return authority0; + + /* If the programs differ by anything that isn't part of the + layer state then we can't continue */ + if (pipeline_state && + (_cogl_pipeline_compare_differences (authority0, authority1) & + pipeline_state)) + return authority0; + + authority0_layers = + g_alloca (sizeof (CoglPipelineLayer *) * n_layers); + state.i = 0; + state.layers = authority0_layers; + _cogl_pipeline_foreach_layer_internal (authority0, + add_layer_to_array_cb, + &state); + + authority1_layers = + g_alloca (sizeof (CoglPipelineLayer *) * n_layers); + state.i = 0; + state.layers = authority1_layers; + _cogl_pipeline_foreach_layer_internal (authority1, + add_layer_to_array_cb, + &state); + + for (i = 0; i < n_layers; i++) + { + unsigned long layer_differences; + + if (authority0_layers[i] == authority1_layers[i]) + continue; + + layer_differences = + _cogl_pipeline_layer_compare_differences (authority0_layers[i], + authority1_layers[i]); + + if (layer_differences & layer_state) + return authority0; + } + + /* Find the next ancestor after that, that also modifies state + * affecting codegen... */ + + if (!_cogl_pipeline_get_parent (authority1)) + break; + + authority0 = authority1; + authority1 = + _cogl_pipeline_get_authority (_cogl_pipeline_get_parent (authority1), + pipeline_state | + COGL_PIPELINE_STATE_LAYERS); + if (authority1 == authority0) + break; + } + + return authority1; +} + +CoglPipelineState +_cogl_pipeline_get_state_for_vertex_codegen (CoglContext *context) +{ + CoglPipelineState state = (COGL_PIPELINE_STATE_LAYERS | + COGL_PIPELINE_STATE_USER_SHADER | + COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE | + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + + /* If we don't have the builtin point size uniform then we'll add + * one in the GLSL but we'll only do this if the point size is + * non-zero. Whether or not the point size is zero is represented by + * COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE */ + if (!_cogl_has_private_feature + (context, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM)) + state |= COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE; + + return state; +} + +CoglPipelineLayerState +_cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context) +{ + CoglPipelineLayerState state = + (COGL_PIPELINE_LAYER_STATE_COMBINE | + COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE | + COGL_PIPELINE_LAYER_STATE_UNIT | + COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS); + + /* If the driver supports GLSL then we might be using gl_PointCoord + * to implement the sprite coords. In that case the generated code + * depends on the point sprite state */ + if (cogl_has_feature (context, COGL_FEATURE_ID_GLSL)) + state |= COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; + + return state; +} + +CoglPipelineState +_cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context) +{ + CoglPipelineState state = (COGL_PIPELINE_STATE_LAYERS | + COGL_PIPELINE_STATE_USER_SHADER | + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + + if (!_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST)) + state |= COGL_PIPELINE_STATE_ALPHA_FUNC; + + return state; +} + +int +cogl_pipeline_get_uniform_location (CoglPipeline *pipeline, + const char *uniform_name) +{ + void *location_ptr; + char *uniform_name_copy; + + _COGL_GET_CONTEXT (ctx, -1); + + /* This API is designed as if the uniform locations are specific to + a pipeline but they are actually unique across a whole + CoglContext. Potentially this could just be + cogl_context_get_uniform_location but it seems to make sense to + keep the API this way so that we can change the internals if need + be. */ + + /* Look for an existing uniform with this name */ + if (g_hash_table_lookup_extended (ctx->uniform_name_hash, + uniform_name, + NULL, + &location_ptr)) + return GPOINTER_TO_INT (location_ptr); + + uniform_name_copy = g_strdup (uniform_name); + g_ptr_array_add (ctx->uniform_names, uniform_name_copy); + g_hash_table_insert (ctx->uniform_name_hash, + uniform_name_copy, + GINT_TO_POINTER (ctx->n_uniform_names)); + + return ctx->n_uniform_names++; +} diff --git a/cogl/cogl-pipeline.h b/cogl/cogl-pipeline.h new file mode 100644 index 0000000..08ae3f6 --- /dev/null +++ b/cogl/cogl-pipeline.h @@ -0,0 +1,194 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIPELINE_H__ +#define __COGL_PIPELINE_H__ + +/* We forward declare the CoglPipeline type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglPipeline CoglPipeline; + +#include +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * SECTION:cogl-pipeline + * @short_description: Functions for creating and manipulating the GPU + * pipeline + * + * Cogl allows creating and manipulating objects representing the full + * configuration of the GPU pipeline. In simplified terms the GPU + * pipeline takes primitive geometry as the input, it first performs + * vertex processing, allowing you to deform your geometry, then + * rasterizes that (turning it from pure geometry into fragments) then + * performs fragment processing including depth testing and texture + * mapping. Finally it blends the result with the framebuffer. + */ + +#define COGL_PIPELINE(OBJECT) ((CoglPipeline *)OBJECT) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_pipeline_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_pipeline_get_gtype (void); +#endif + +/** + * cogl_pipeline_new: + * @context: a #CoglContext + * + * Allocates and initializes a default simple pipeline that will color + * a primitive white. + * + * Return value: (transfer full): a pointer to a new #CoglPipeline + * + * Since: 2.0 + * Stability: Unstable + */ +CoglPipeline * +cogl_pipeline_new (CoglContext *context); + +/** + * cogl_pipeline_copy: + * @source: a #CoglPipeline object to copy + * + * Creates a new pipeline with the configuration copied from the + * source pipeline. + * + * We would strongly advise developers to always aim to use + * cogl_pipeline_copy() instead of cogl_pipeline_new() whenever there will + * be any similarity between two pipelines. Copying a pipeline helps Cogl + * keep track of a pipelines ancestry which we may use to help minimize GPU + * state changes. + * + * Return value: (transfer full): a pointer to the newly allocated #CoglPipeline + * + * Since: 2.0 + * Stability: Unstable + */ +CoglPipeline * +cogl_pipeline_copy (CoglPipeline *source); + +/** + * cogl_is_pipeline: + * @object: A #CoglObject + * + * Gets whether the given @object references an existing pipeline object. + * + * Return value: %TRUE if the @object references a #CoglPipeline, + * %FALSE otherwise + * + * Since: 2.0 + * Stability: Unstable + */ +CoglBool +cogl_is_pipeline (void *object); + +/** + * CoglPipelineLayerCallback: + * @pipeline: The #CoglPipeline whos layers are being iterated + * @layer_index: The current layer index + * @user_data: The private data passed to cogl_pipeline_foreach_layer() + * + * The callback prototype used with cogl_pipeline_foreach_layer() for + * iterating all the layers of a @pipeline. + * + * Since: 2.0 + * Stability: Unstable + */ +typedef CoglBool (*CoglPipelineLayerCallback) (CoglPipeline *pipeline, + int layer_index, + void *user_data); + +/** + * cogl_pipeline_foreach_layer: + * @pipeline: A #CoglPipeline object + * @callback: (scope call): A #CoglPipelineLayerCallback to be + * called for each layer index + * @user_data: (closure): Private data that will be passed to the + * callback + * + * Iterates all the layer indices of the given @pipeline. + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_pipeline_foreach_layer (CoglPipeline *pipeline, + CoglPipelineLayerCallback callback, + void *user_data); + +/** + * cogl_pipeline_get_uniform_location: + * @pipeline: A #CoglPipeline object + * @uniform_name: The name of a uniform + * + * This is used to get an integer representing the uniform with the + * name @uniform_name. The integer can be passed to functions such as + * cogl_pipeline_set_uniform_1f() to set the value of a uniform. + * + * This function will always return a valid integer. Ie, unlike + * OpenGL, it does not return -1 if the uniform is not available in + * this pipeline so it can not be used to test whether uniforms are + * present. It is not necessary to set the program on the pipeline + * before calling this function. + * + * Return value: A integer representing the location of the given uniform. + * + * Since: 2.0 + * Stability: Unstable + */ +int +cogl_pipeline_get_uniform_location (CoglPipeline *pipeline, + const char *uniform_name); + + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +#endif /* __COGL_PIPELINE_H__ */ diff --git a/cogl/cogl-pixel-buffer-private.h b/cogl/cogl-pixel-buffer-private.h new file mode 100644 index 0000000..2735277 --- /dev/null +++ b/cogl/cogl-pixel-buffer-private.h @@ -0,0 +1,52 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__ +#define __COGL_PIXEL_BUFFER_PRIVATE_H__ + +#include "cogl-object-private.h" +#include "cogl-buffer-private.h" + +#include + +COGL_BEGIN_DECLS + +struct _CoglPixelBuffer +{ + CoglBuffer _parent; +}; + +COGL_END_DECLS + +#endif /* __COGL_PIXEL_BUFFER_PRIVATE_H__ */ diff --git a/cogl/cogl-pixel-buffer.c b/cogl/cogl-pixel-buffer.c new file mode 100644 index 0000000..e2d6565 --- /dev/null +++ b/cogl/cogl-pixel-buffer.c @@ -0,0 +1,134 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +/* For an overview of the functionality implemented here, please see + * cogl-buffer-array.h, which contains the gtk-doc section overview for the + * Pixel Buffers API. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-object.h" +#include "cogl-pixel-buffer-private.h" +#include "cogl-pixel-buffer.h" +#include "cogl-gtype-private.h" + +/* + * GL/GLES compatibility defines for the buffer API: + */ + +#if defined (HAVE_COGL_GL) + +#ifndef GL_PIXEL_UNPACK_BUFFER +#define GL_PIXEL_UNPACK_BUFFER GL_PIXEL_UNPACK_BUFFER_ARB +#endif + +#ifndef GL_PIXEL_PACK_BUFFER +#define GL_PIXEL_PACK_BUFFER GL_PIXEL_PACK_BUFFER_ARB +#endif + +#endif + +static void +_cogl_pixel_buffer_free (CoglPixelBuffer *buffer); + +COGL_BUFFER_DEFINE (PixelBuffer, pixel_buffer) +COGL_GTYPE_DEFINE_CLASS (PixelBuffer, pixel_buffer) + +static CoglPixelBuffer * +_cogl_pixel_buffer_new (CoglContext *context, + size_t size, + const void *data, + CoglError **error) +{ + CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer); + CoglBuffer *buffer = COGL_BUFFER (pixel_buffer); + + /* parent's constructor */ + _cogl_buffer_initialize (buffer, + context, + size, + COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK, + COGL_BUFFER_USAGE_HINT_TEXTURE, + COGL_BUFFER_UPDATE_HINT_STATIC); + + _cogl_pixel_buffer_object_new (pixel_buffer); + + if (data) + { + if (!_cogl_buffer_set_data (COGL_BUFFER (pixel_buffer), + 0, + data, + size, + error)) + { + cogl_object_unref (pixel_buffer); + return NULL; + } + } + + return pixel_buffer; +} + +CoglPixelBuffer * +cogl_pixel_buffer_new (CoglContext *context, + size_t size, + const void *data) +{ + CoglError *ignore_error = NULL; + CoglPixelBuffer *buffer = + _cogl_pixel_buffer_new (context, size, data, &ignore_error); + if (!buffer) + cogl_error_free (ignore_error); + return buffer; +} + +static void +_cogl_pixel_buffer_free (CoglPixelBuffer *buffer) +{ + /* parent's destructor */ + _cogl_buffer_fini (COGL_BUFFER (buffer)); + + g_slice_free (CoglPixelBuffer, buffer); +} + diff --git a/cogl/cogl-pixel-buffer.h b/cogl/cogl-pixel-buffer.h new file mode 100644 index 0000000..8ae6164 --- /dev/null +++ b/cogl/cogl-pixel-buffer.h @@ -0,0 +1,138 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIXEL_BUFFER_H__ +#define __COGL_PIXEL_BUFFER_H__ + +/* XXX: We forward declare CoglPixelBuffer here to allow for circular + * dependencies between some headers */ +typedef struct _CoglPixelBuffer CoglPixelBuffer; + +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#define COGL_PIXEL_BUFFER(buffer) ((CoglPixelBuffer *)(buffer)) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_pixel_buffer_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_pixel_buffer_get_gtype (void); +#endif + +/** + * cogl_pixel_buffer_new: + * @context: A #CoglContext + * @size: The number of bytes to allocate for the pixel data. + * @data: An optional pointer to vertex data to upload immediately + * + * Declares a new #CoglPixelBuffer of @size bytes to contain arrays of + * pixels. Once declared, data can be set using cogl_buffer_set_data() + * or by mapping it into the application's address space using + * cogl_buffer_map(). + * + * If @data isn't %NULL then @size bytes will be read from @data and + * immediately copied into the new buffer. + * + * Return value: (transfer full): a newly allocated #CoglPixelBuffer + * + * Since: 1.10 + * Stability: unstable + */ +CoglPixelBuffer * +cogl_pixel_buffer_new (CoglContext *context, + size_t size, + const void *data); + +/** + * cogl_is_pixel_buffer: + * @object: a #CoglObject to test + * + * Checks whether @object is a pixel buffer. + * + * Return value: %TRUE if the @object is a pixel buffer, and %FALSE + * otherwise + * + * Since: 1.2 + * Stability: Unstable + */ +CoglBool +cogl_is_pixel_buffer (void *object); + +#if 0 +/* + * cogl_pixel_buffer_set_region: + * @buffer: A #CoglPixelBuffer object + * @data: pixel data to upload to @array + * @src_width: width in pixels of the region to update + * @src_height: height in pixels of the region to update + * @src_rowstride: row stride in bytes of the source array + * @dst_x: upper left destination horizontal coordinate + * @dst_y: upper left destination vertical coordinate + * + * Uploads new data into a pixel array. The source data pointed by @data can + * have a different stride than @array in which case the function will do the + * right thing for you. For performance reasons, it is recommended for the + * source data to have the same stride than @array. + * + * Return value: %TRUE if the upload succeeded, %FALSE otherwise + * + * Since: 1.2 + * Stability: Unstable + */ +CoglBool +cogl_pixel_buffer_set_region (CoglPixelBuffer *buffer, + uint8_t *data, + unsigned int src_width, + unsigned int src_height, + unsigned int src_rowstride, + unsigned int dst_x, + unsigned int dst_y); +#endif + +COGL_END_DECLS + +#endif /* __COGL_PIXEL_BUFFER_H__ */ diff --git a/cogl/cogl-point-in-poly-private.h b/cogl/cogl-point-in-poly-private.h new file mode 100644 index 0000000..1f3f701 --- /dev/null +++ b/cogl/cogl-point-in-poly-private.h @@ -0,0 +1,46 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_POINT_INT_POLYGON_PRIVATE_H +#define __COGL_POINT_INT_POLYGON_PRIVATE_H + +#include + +COGL_BEGIN_DECLS + +int +_cogl_util_point_in_screen_poly (float point_x, + float point_y, + void *vertices, + size_t stride, + int n_vertices); + +COGL_END_DECLS + +#endif /* __COGL_POINT_INT_POLYGON_PRIVATE_H */ + diff --git a/cogl/cogl-point-in-poly.c b/cogl/cogl-point-in-poly.c new file mode 100644 index 0000000..cf87b93 --- /dev/null +++ b/cogl/cogl-point-in-poly.c @@ -0,0 +1,101 @@ +/* + * Point Inclusion in Polygon Test + * + * Copyright (c) 1970-2003, Wm. Randolph Franklin + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimers. + * 2. Redistributions in binary form must reproduce the above + * copyright notice in the documentation and/or other materials + * provided with the distribution. + * 3. The name of W. Randolph Franklin may not be used to endorse or + * promote products derived from this Software without specific + * prior written permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Note: + * The algorithm for this point_in_poly() function was learnt from: + * http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-point-in-poly-private.h" + +#include + +/* We've made a notable change to the original algorithm referenced + * above to make sure we have reliable results for screen aligned + * rectangles even though there may be some numerical in-precision in + * how the vertices of the polygon were calculated. + * + * We've avoided introducing an epsilon factor to the comparisons + * since we feel there's a risk of changing some semantics in ways that + * might not be desirable. One of those is that if you transform two + * polygons which share an edge and test a point close to that edge + * then this algorithm will currently give a positive result for only + * one polygon. + * + * Another concern is the way this algorithm resolves the corner case + * where the horizontal ray being cast to count edge crossings may + * cross directly through a vertex. The solution is based on the "idea + * of Simulation of Simplicity" and "pretends to shift the ray + * infinitesimally down so that it either clearly intersects, or + * clearly doesn't touch". I'm not familiar with the idea myself so I + * expect a misplaced epsilon is likely to break that aspect of the + * algorithm. + * + * The simple solution we've gone for is to pixel align the polygon + * vertices which should eradicate most noise due to in-precision. + */ +int +_cogl_util_point_in_screen_poly (float point_x, + float point_y, + void *vertices, + size_t stride, + int n_vertices) +{ + int i, j, c = 0; + + for (i = 0, j = n_vertices - 1; i < n_vertices; j = i++) + { + float vert_xi = *(float *)((uint8_t *)vertices + i * stride); + float vert_xj = *(float *)((uint8_t *)vertices + j * stride); + float vert_yi = *(float *)((uint8_t *)vertices + i * stride + + sizeof (float)); + float vert_yj = *(float *)((uint8_t *)vertices + j * stride + + sizeof (float)); + + vert_xi = COGL_UTIL_NEARBYINT (vert_xi); + vert_xj = COGL_UTIL_NEARBYINT (vert_xj); + vert_yi = COGL_UTIL_NEARBYINT (vert_yi); + vert_yj = COGL_UTIL_NEARBYINT (vert_yj); + + if (((vert_yi > point_y) != (vert_yj > point_y)) && + (point_x < (vert_xj - vert_xi) * (point_y - vert_yi) / + (vert_yj - vert_yi) + vert_xi) ) + c = !c; + } + + return c; +} + diff --git a/cogl/cogl-poll-private.h b/cogl/cogl-poll-private.h new file mode 100644 index 0000000..bdc9e6d --- /dev/null +++ b/cogl/cogl-poll-private.h @@ -0,0 +1,77 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_POLL_PRIVATE_H__ +#define __COGL_POLL_PRIVATE_H__ + +#include "cogl-poll.h" +#include "cogl-renderer.h" +#include "cogl-closure-list-private.h" + +void +_cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd); + +typedef int64_t (*CoglPollPrepareCallback) (void *user_data); +typedef void (*CoglPollDispatchCallback) (void *user_data, int revents); + +void +_cogl_poll_renderer_add_fd (CoglRenderer *renderer, + int fd, + CoglPollFDEvent events, + CoglPollPrepareCallback prepare, + CoglPollDispatchCallback dispatch, + void *user_data); + +void +_cogl_poll_renderer_modify_fd (CoglRenderer *renderer, + int fd, + CoglPollFDEvent events); + +typedef struct _CoglPollSource CoglPollSource; + +CoglPollSource * +_cogl_poll_renderer_add_source (CoglRenderer *renderer, + CoglPollPrepareCallback prepare, + CoglPollDispatchCallback dispatch, + void *user_data); + +void +_cogl_poll_renderer_remove_source (CoglRenderer *renderer, + CoglPollSource *source); + +typedef void (*CoglIdleCallback) (void *user_data); + +CoglClosure * +_cogl_poll_renderer_add_idle (CoglRenderer *renderer, + CoglIdleCallback idle_cb, + void *user_data, + CoglUserDataDestroyCallback destroy_cb); + +#endif /* __COGL_POLL_PRIVATE_H__ */ diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c new file mode 100644 index 0000000..1ce62f6 --- /dev/null +++ b/cogl/cogl-poll.c @@ -0,0 +1,267 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-poll.h" +#include "cogl-poll-private.h" +#include "cogl-winsys-private.h" +#include "cogl-renderer-private.h" + +struct _CoglPollSource +{ + int fd; + CoglPollPrepareCallback prepare; + CoglPollDispatchCallback dispatch; + void *user_data; +}; + +int +cogl_poll_renderer_get_info (CoglRenderer *renderer, + CoglPollFD **poll_fds, + int *n_poll_fds, + int64_t *timeout) +{ + GList *l, *next; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), 0); + _COGL_RETURN_VAL_IF_FAIL (poll_fds != NULL, 0); + _COGL_RETURN_VAL_IF_FAIL (n_poll_fds != NULL, 0); + _COGL_RETURN_VAL_IF_FAIL (timeout != NULL, 0); + + *timeout = -1; + + if (!_cogl_list_empty (&renderer->idle_closures)) + *timeout = 0; + + /* This loop needs to cope with the prepare callback removing its + * own fd */ + for (l = renderer->poll_sources; l; l = next) + { + CoglPollSource *source = l->data; + + next = l->next; + + if (source->prepare) + { + int64_t source_timeout = source->prepare (source->user_data); + if (source_timeout >= 0 && + (*timeout == -1 || *timeout > source_timeout)) + *timeout = source_timeout; + } + } + + /* This is deliberately set after calling the prepare callbacks in + * case one of them removes its fd */ + *poll_fds = (void *)renderer->poll_fds->data; + *n_poll_fds = renderer->poll_fds->len; + + return renderer->poll_fds_age; +} + +void +cogl_poll_renderer_dispatch (CoglRenderer *renderer, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + GList *l, *next; + + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + + _cogl_closure_list_invoke_no_args (&renderer->idle_closures); + + /* This loop needs to cope with the dispatch callback removing its + * own fd */ + for (l = renderer->poll_sources; l; l = next) + { + CoglPollSource *source = l->data; + int i; + + next = l->next; + + if (source->fd == -1) + { + source->dispatch (source->user_data, 0); + continue; + } + + for (i = 0; i < n_poll_fds; i++) + { + const CoglPollFD *pollfd = &poll_fds[i]; + + if (pollfd->fd == source->fd) + { + source->dispatch (source->user_data, pollfd->revents); + break; + } + } + } +} + +static int +find_pollfd (CoglRenderer *renderer, int fd) +{ + int i; + + for (i = 0; i < renderer->poll_fds->len; i++) + { + CoglPollFD *pollfd = &g_array_index (renderer->poll_fds, CoglPollFD, i); + + if (pollfd->fd == fd) + return i; + } + + return -1; +} + +void +_cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd) +{ + int i = find_pollfd (renderer, fd); + GList *l; + + if (i < 0) + return; + + g_array_remove_index_fast (renderer->poll_fds, i); + renderer->poll_fds_age++; + + for (l = renderer->poll_sources; l; l = l->next) + { + CoglPollSource *source = l->data; + if (source->fd == fd) + { + renderer->poll_sources = + g_list_delete_link (renderer->poll_sources, l); + g_slice_free (CoglPollSource, source); + break; + } + } +} + +void +_cogl_poll_renderer_modify_fd (CoglRenderer *renderer, + int fd, + CoglPollFDEvent events) +{ + int fd_index = find_pollfd (renderer, fd); + + if (fd_index == -1) + g_warn_if_reached (); + else + { + CoglPollFD *pollfd = + &g_array_index (renderer->poll_sources, CoglPollFD, fd_index); + + pollfd->events = events; + renderer->poll_fds_age++; + } +} + +void +_cogl_poll_renderer_add_fd (CoglRenderer *renderer, + int fd, + CoglPollFDEvent events, + CoglPollPrepareCallback prepare, + CoglPollDispatchCallback dispatch, + void *user_data) +{ + CoglPollFD pollfd = { + fd, + events + }; + CoglPollSource *source; + + _cogl_poll_renderer_remove_fd (renderer, fd); + + source = g_slice_new0 (CoglPollSource); + source->fd = fd; + source->prepare = prepare; + source->dispatch = dispatch; + source->user_data = user_data; + + renderer->poll_sources = g_list_prepend (renderer->poll_sources, source); + + g_array_append_val (renderer->poll_fds, pollfd); + renderer->poll_fds_age++; +} + +CoglPollSource * +_cogl_poll_renderer_add_source (CoglRenderer *renderer, + CoglPollPrepareCallback prepare, + CoglPollDispatchCallback dispatch, + void *user_data) +{ + CoglPollSource *source; + + source = g_slice_new0 (CoglPollSource); + source->fd = -1; + source->prepare = prepare; + source->dispatch = dispatch; + source->user_data = user_data; + + renderer->poll_sources = g_list_prepend (renderer->poll_sources, source); + + return source; +} + +void +_cogl_poll_renderer_remove_source (CoglRenderer *renderer, + CoglPollSource *source) +{ + GList *l; + + for (l = renderer->poll_sources; l; l = l->next) + { + if (l->data == source) + { + renderer->poll_sources = + g_list_delete_link (renderer->poll_sources, l); + g_slice_free (CoglPollSource, source); + break; + } + } +} + +CoglClosure * +_cogl_poll_renderer_add_idle (CoglRenderer *renderer, + CoglIdleCallback idle_cb, + void *user_data, + CoglUserDataDestroyCallback destroy_cb) +{ + return _cogl_closure_list_add (&renderer->idle_closures, + idle_cb, + user_data, + destroy_cb); +} diff --git a/cogl/cogl-poll.h b/cogl/cogl-poll.h new file mode 100644 index 0000000..fa93d92 --- /dev/null +++ b/cogl/cogl-poll.h @@ -0,0 +1,200 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_POLL_H__ +#define __COGL_POLL_H__ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-poll + * @short_description: Functions for integrating Cogl with an + * application's main loop + * + * Cogl needs to integrate with the application's main loop so that it + * can internally handle some events from the driver. All Cogl + * applications must use these functions. They provide enough + * information to describe the state that Cogl will need to wake up + * on. An application using the GLib main loop can instead use + * cogl_glib_source_new() which provides a #GSource ready to be added + * to the main loop. + */ + +/** + * CoglPollFDEvent: + * @COGL_POLL_FD_EVENT_IN: there is data to read + * @COGL_POLL_FD_EVENT_PRI: data can be written (without blocking) + * @COGL_POLL_FD_EVENT_OUT: there is urgent data to read. + * @COGL_POLL_FD_EVENT_ERR: error condition + * @COGL_POLL_FD_EVENT_HUP: hung up (the connection has been broken, usually + * for pipes and sockets). + * @COGL_POLL_FD_EVENT_NVAL: invalid request. The file descriptor is not open. + * + * A bitmask of events that Cogl may need to wake on for a file + * descriptor. Note that these all have the same values as the + * corresponding defines for the poll function call on Unix so they + * may be directly passed to poll. + * + * Since: 1.10 + * Stability: unstable + */ +typedef enum +{ + COGL_POLL_FD_EVENT_IN = COGL_SYSDEF_POLLIN, + COGL_POLL_FD_EVENT_PRI = COGL_SYSDEF_POLLPRI, + COGL_POLL_FD_EVENT_OUT = COGL_SYSDEF_POLLOUT, + COGL_POLL_FD_EVENT_ERR = COGL_SYSDEF_POLLERR, + COGL_POLL_FD_EVENT_HUP = COGL_SYSDEF_POLLHUP, + COGL_POLL_FD_EVENT_NVAL = COGL_SYSDEF_POLLNVAL +} CoglPollFDEvent; + +/** + * CoglPollFD: + * @fd: The file descriptor to block on + * @events: A bitmask of events to block on + * @revents: A bitmask of returned events + * + * A struct for describing the state of a file descriptor that Cogl + * needs to block on. The @events field contains a bitmask of + * #CoglPollFDEvents that should cause the application to wake + * up. After the application is woken up from idle it should pass back + * an array of #CoglPollFDs to Cogl and update the @revents + * mask to the actual events that occurred on the file descriptor. + * + * Note that CoglPollFD is deliberately exactly the same as struct + * pollfd on Unix so that it can simply be cast when calling poll. + * + * Since: 1.10 + * Stability: unstable + */ +typedef struct { + int fd; + short int events; + short int revents; +} CoglPollFD; + +/** + * cogl_poll_renderer_get_info: + * @renderer: A #CoglRenderer + * @poll_fds: A return location for a pointer to an array + * of #CoglPollFDs + * @n_poll_fds: A return location for the number of entries in *@poll_fds + * @timeout: A return location for the maximum length of time to wait + * in microseconds, or -1 to wait indefinitely. + * + * Is used to integrate Cogl with an application mainloop that is based + * on the unix poll(2) api (or select() or something equivalent). This + * api should be called whenever an application is about to go idle so + * that Cogl has a chance to describe what file descriptor events it + * needs to be woken up for. + * + * If your application is using the Glib mainloop then you + * should jump to the cogl_glib_source_new() api as a more convenient + * way of integrating Cogl with the mainloop. + * + * After the function is called *@poll_fds will contain a pointer to + * an array of #CoglPollFD structs describing the file descriptors + * that Cogl expects. The fd and events members will be updated + * accordingly. After the application has completed its idle it is + * expected to either update the revents members directly in this + * array or to create a copy of the array and update them + * there. + * + * When the application mainloop returns from calling poll(2) (or its + * equivalent) then it should call cogl_poll_renderer_dispatch() + * passing a pointer the array of CoglPollFDs with updated + * revent values. + * + * When using the %COGL_WINSYS_ID_WGL winsys (where file descriptors + * don't make any sense) or %COGL_WINSYS_ID_SDL (where the event + * handling functions of SDL don't allow blocking on a file + * descriptor) *n_poll_fds is guaranteed to be zero. + * + * @timeout will contain a maximum amount of time to wait in + * microseconds before the application should wake up or -1 if the + * application should wait indefinitely. This can also be 0 if + * Cogl needs to be woken up immediately. + * + * Return value: A "poll fd state age" that changes whenever the set + * of poll_fds has changed. If this API is being used to + * integrate with another system mainloop api then + * knowing if the set of file descriptors and events has + * really changed can help avoid redundant work + * depending the api. The age isn't guaranteed to change + * when the timeout changes. + * + * Stability: unstable + * Since: 1.16 + */ +int +cogl_poll_renderer_get_info (CoglRenderer *renderer, + CoglPollFD **poll_fds, + int *n_poll_fds, + int64_t *timeout); + +/** + * cogl_poll_renderer_dispatch: + * @renderer: A #CoglRenderer + * @poll_fds: An array of #CoglPollFDs describing the events + * that have occurred since the application went idle. + * @n_poll_fds: The length of the @poll_fds array. + * + * This should be called whenever an application is woken up from + * going idle in its main loop. The @poll_fds array should contain a + * list of file descriptors matched with the events that occurred in + * revents. The events field is ignored. It is safe to pass in extra + * file descriptors that Cogl didn't request when calling + * cogl_poll_renderer_get_info() or a shorter array missing some file + * descriptors that Cogl requested. + * + * If your application didn't originally create a #CoglRenderer + * manually then you can easily get a #CoglRenderer pointer by calling + * cogl_get_renderer(). + * + * Stability: unstable + * Since: 1.16 + */ +void +cogl_poll_renderer_dispatch (CoglRenderer *renderer, + const CoglPollFD *poll_fds, + int n_poll_fds); + +COGL_END_DECLS + +#endif /* __COGL_POLL_H__ */ diff --git a/cogl/cogl-primitive-private.h b/cogl/cogl-primitive-private.h new file mode 100644 index 0000000..7862729 --- /dev/null +++ b/cogl/cogl-primitive-private.h @@ -0,0 +1,73 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PRIMITIVE_PRIVATE_H +#define __COGL_PRIMITIVE_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-attribute-buffer-private.h" +#include "cogl-attribute-private.h" +#include "cogl-framebuffer.h" + +struct _CoglPrimitive +{ + CoglObject _parent; + + CoglIndices *indices; + CoglVerticesMode mode; + int first_vertex; + int n_vertices; + + int immutable_ref; + + CoglAttribute **attributes; + int n_attributes; + + int n_embedded_attributes; + CoglAttribute *embedded_attribute; +}; + +CoglPrimitive * +_cogl_primitive_immutable_ref (CoglPrimitive *primitive); + +void +_cogl_primitive_immutable_unref (CoglPrimitive *primitive); + +void +_cogl_primitive_draw (CoglPrimitive *primitive, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags); + +#endif /* __COGL_PRIMITIVE_PRIVATE_H */ + diff --git a/cogl/cogl-primitive-texture.c b/cogl/cogl-primitive-texture.c new file mode 100644 index 0000000..fce9723 --- /dev/null +++ b/cogl/cogl-primitive-texture.c @@ -0,0 +1,60 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-primitive-texture.h" +#include "cogl-texture-private.h" + +CoglBool +cogl_is_primitive_texture (void *object) +{ + return (cogl_is_texture (object) && + COGL_TEXTURE (object)->vtable->is_primitive); +} + +void +cogl_primitive_texture_set_auto_mipmap (CoglPrimitiveTexture *primitive_texture, + CoglBool value) +{ + CoglTexture *texture; + + _COGL_RETURN_IF_FAIL (cogl_is_primitive_texture (primitive_texture)); + + texture = COGL_TEXTURE (primitive_texture); + + g_assert (texture->vtable->set_auto_mipmap != NULL); + + texture->vtable->set_auto_mipmap (texture, value); +} diff --git a/cogl/cogl-primitive-texture.h b/cogl/cogl-primitive-texture.h new file mode 100644 index 0000000..effaac3 --- /dev/null +++ b/cogl/cogl-primitive-texture.h @@ -0,0 +1,111 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PRIMITIVE_TEXTURE_H__ +#define __COGL_PRIMITIVE_TEXTURE_H__ + +#include "cogl-types.h" + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-primitive-texture + * @short_description: Interface for low-level textures like + * #CoglTexture2D and #CoglTexture3D. + * + * A #CoglPrimitiveTexture is a texture that is directly represented + * by a single texture on the GPU. For example these could be a + * #CoglTexture2D, #CoglTexture3D or #CoglTextureRectangle. This is + * opposed to high level meta textures which may be composed of + * multiple primitive textures or a sub-region of another texture such + * as #CoglAtlasTexture and #CoglTexture2DSliced. + * + * A texture that implements this interface can be directly used with + * the low level cogl_primitive_draw() API. Other types of textures + * need to be first resolved to primitive textures using the + * #CoglMetaTexture interface. + * + * Most developers won't need to use this interface directly but + * still it is worth understanding the distinction between high-level + * and primitive textures because you may find other references in the + * documentation that detail limitations of using + * primitive textures. + */ + +#ifdef __COGL_H_INSIDE__ +/* For the public C api we typedef interface types as void to avoid needing + * lots of casting in code and instead we will rely on runtime type checking + * for these objects. */ +typedef void CoglPrimitiveTexture; +#else +typedef struct _CoglPrimitiveTexture CoglPrimitiveTexture; +#define COGL_PRIMITIVE_TEXTURE(X) ((CoglPrimitiveTexture *)X) +#endif + +/** + * cogl_is_primitive_texture: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a primitive texture object. + * + * Return value: %TRUE if the pointer references a primitive texture, and + * %FALSE otherwise + * Since: 2.0 + * Stability: unstable + */ +CoglBool +cogl_is_primitive_texture (void *object); + +/** + * cogl_primitive_texture_set_auto_mipmap: + * @primitive_texture: A #CoglPrimitiveTexture + * @value: The new value for whether to auto mipmap + * + * Sets whether the texture will automatically update the smaller + * mipmap levels after any part of level 0 is updated. The update will + * only occur whenever the texture is used for drawing with a texture + * filter that requires the lower mipmap levels. An application should + * disable this if it wants to upload its own data for the other + * levels. By default auto mipmapping is enabled. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_primitive_texture_set_auto_mipmap (CoglPrimitiveTexture *primitive_texture, + CoglBool value); + +COGL_END_DECLS + +#endif /* __COGL_PRIMITIVE_TEXTURE_H__ */ diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c new file mode 100644 index 0000000..b31a25a --- /dev/null +++ b/cogl/cogl-primitive.c @@ -0,0 +1,645 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-object-private.h" +#include "cogl-primitive.h" +#include "cogl-primitive-private.h" +#include "cogl-attribute-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +static void _cogl_primitive_free (CoglPrimitive *primitive); + +COGL_OBJECT_DEFINE (Primitive, primitive); +COGL_GTYPE_DEFINE_CLASS (Primitive, primitive); + +CoglPrimitive * +cogl_primitive_new_with_attributes (CoglVerticesMode mode, + int n_vertices, + CoglAttribute **attributes, + int n_attributes) +{ + CoglPrimitive *primitive; + int i; + + primitive = g_slice_alloc (sizeof (CoglPrimitive) + + sizeof (CoglAttribute *) * (n_attributes - 1)); + primitive->mode = mode; + primitive->first_vertex = 0; + primitive->n_vertices = n_vertices; + primitive->indices = NULL; + primitive->immutable_ref = 0; + + primitive->n_attributes = n_attributes; + primitive->n_embedded_attributes = n_attributes; + primitive->attributes = &primitive->embedded_attribute; + for (i = 0; i < n_attributes; i++) + { + CoglAttribute *attribute = attributes[i]; + cogl_object_ref (attribute); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); + + primitive->attributes[i] = attribute; + } + + return _cogl_primitive_object_new (primitive); +} + +/* This is just an internal convenience wrapper around + new_with_attributes that also unrefs the attributes. It is just + used for the builtin struct constructors */ +static CoglPrimitive * +_cogl_primitive_new_with_attributes_unref (CoglVerticesMode mode, + int n_vertices, + CoglAttribute **attributes, + int n_attributes) +{ + CoglPrimitive *primitive; + int i; + + primitive = cogl_primitive_new_with_attributes (mode, + n_vertices, + attributes, + n_attributes); + + for (i = 0; i < n_attributes; i++) + cogl_object_unref (attributes[i]); + + return primitive; +} + +CoglPrimitive * +cogl_primitive_new (CoglVerticesMode mode, + int n_vertices, + ...) +{ + va_list ap; + int n_attributes; + CoglAttribute **attributes; + int i; + CoglAttribute *attribute; + + va_start (ap, n_vertices); + for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++) + ; + va_end (ap); + + attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); + + va_start (ap, n_vertices); + for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++) + attributes[i] = attribute; + va_end (ap); + + return cogl_primitive_new_with_attributes (mode, n_vertices, + attributes, + i); +} + +CoglPrimitive * +cogl_primitive_new_p2 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP2), data); + CoglAttribute *attributes[1]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP2), + offsetof (CoglVertexP2, x), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 1); +} + +CoglPrimitive * +cogl_primitive_new_p3 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP3), data); + CoglAttribute *attributes[1]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP3), + offsetof (CoglVertexP3, x), + 3, + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 1); +} + +CoglPrimitive * +cogl_primitive_new_p2c4 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2C4 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP2C4), data); + CoglAttribute *attributes[2]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP2C4), + offsetof (CoglVertexP2C4, x), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_color_in", + sizeof (CoglVertexP2C4), + offsetof (CoglVertexP2C4, r), + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 2); +} + +CoglPrimitive * +cogl_primitive_new_p3c4 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3C4 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP3C4), data); + CoglAttribute *attributes[2]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP3C4), + offsetof (CoglVertexP3C4, x), + 3, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_color_in", + sizeof (CoglVertexP3C4), + offsetof (CoglVertexP3C4, r), + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 2); +} + +CoglPrimitive * +cogl_primitive_new_p2t2 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2T2 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP2T2), data); + CoglAttribute *attributes[2]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP2T2), + offsetof (CoglVertexP2T2, x), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_tex_coord0_in", + sizeof (CoglVertexP2T2), + offsetof (CoglVertexP2T2, s), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 2); +} + +CoglPrimitive * +cogl_primitive_new_p3t2 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3T2 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP3T2), data); + CoglAttribute *attributes[2]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP3T2), + offsetof (CoglVertexP3T2, x), + 3, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_tex_coord0_in", + sizeof (CoglVertexP3T2), + offsetof (CoglVertexP3T2, s), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 2); +} + +CoglPrimitive * +cogl_primitive_new_p2t2c4 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2T2C4 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, + n_vertices * sizeof (CoglVertexP2T2C4), data); + CoglAttribute *attributes[3]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP2T2C4), + offsetof (CoglVertexP2T2C4, x), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_tex_coord0_in", + sizeof (CoglVertexP2T2C4), + offsetof (CoglVertexP2T2C4, s), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[2] = cogl_attribute_new (attribute_buffer, + "cogl_color_in", + sizeof (CoglVertexP2T2C4), + offsetof (CoglVertexP2T2C4, r), + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 3); +} + +CoglPrimitive * +cogl_primitive_new_p3t2c4 (CoglContext *ctx, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3T2C4 *data) +{ + CoglAttributeBuffer *attribute_buffer = + cogl_attribute_buffer_new (ctx, + n_vertices * sizeof (CoglVertexP3T2C4), data); + CoglAttribute *attributes[3]; + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (CoglVertexP3T2C4), + offsetof (CoglVertexP3T2C4, x), + 3, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_tex_coord0_in", + sizeof (CoglVertexP3T2C4), + offsetof (CoglVertexP3T2C4, s), + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[2] = cogl_attribute_new (attribute_buffer, + "cogl_color_in", + sizeof (CoglVertexP3T2C4), + offsetof (CoglVertexP3T2C4, r), + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + cogl_object_unref (attribute_buffer); + + return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, + attributes, + 3); +} + +static void +_cogl_primitive_free (CoglPrimitive *primitive) +{ + int i; + + for (i = 0; i < primitive->n_attributes; i++) + cogl_object_unref (primitive->attributes[i]); + + if (primitive->attributes != &primitive->embedded_attribute) + g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes, + primitive->attributes); + + if (primitive->indices) + cogl_object_unref (primitive->indices); + + g_slice_free1 (sizeof (CoglPrimitive) + + sizeof (CoglAttribute *) * + (primitive->n_embedded_attributes - 1), primitive); +} + +static void +warn_about_midscene_changes (void) +{ + static CoglBool seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of primitives has " + "undefined results\n"); + seen = TRUE; + } +} + +void +cogl_primitive_set_attributes (CoglPrimitive *primitive, + CoglAttribute **attributes, + int n_attributes) +{ + int i; + + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + + if (G_UNLIKELY (primitive->immutable_ref)) + { + warn_about_midscene_changes (); + return; + } + + /* NB: we don't unref the previous attributes before refing the new + * in case we would end up releasing the last reference for an + * attribute thats actually in the new list too. */ + for (i = 0; i < n_attributes; i++) + { + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attributes[i])); + cogl_object_ref (attributes[i]); + } + + for (i = 0; i < primitive->n_attributes; i++) + cogl_object_unref (primitive->attributes[i]); + + /* First try to use the embedded storage assocated with the + * primitive, else fallback to slice allocating separate storage for + * the attribute pointers... */ + + if (n_attributes <= primitive->n_embedded_attributes) + { + if (primitive->attributes != &primitive->embedded_attribute) + g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes, + primitive->attributes); + primitive->attributes = &primitive->embedded_attribute; + } + else + { + if (primitive->attributes != &primitive->embedded_attribute) + g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes, + primitive->attributes); + primitive->attributes = + g_slice_alloc (sizeof (CoglAttribute *) * n_attributes); + } + + memcpy (primitive->attributes, attributes, + sizeof (CoglAttribute *) * n_attributes); + + primitive->n_attributes = n_attributes; +} + +int +cogl_primitive_get_first_vertex (CoglPrimitive *primitive) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); + + return primitive->first_vertex; +} + +void +cogl_primitive_set_first_vertex (CoglPrimitive *primitive, + int first_vertex) +{ + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + + if (G_UNLIKELY (primitive->immutable_ref)) + { + warn_about_midscene_changes (); + return; + } + + primitive->first_vertex = first_vertex; +} + +int +cogl_primitive_get_n_vertices (CoglPrimitive *primitive) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); + + return primitive->n_vertices; +} + +void +cogl_primitive_set_n_vertices (CoglPrimitive *primitive, + int n_vertices) +{ + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + + primitive->n_vertices = n_vertices; +} + +CoglVerticesMode +cogl_primitive_get_mode (CoglPrimitive *primitive) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); + + return primitive->mode; +} + +void +cogl_primitive_set_mode (CoglPrimitive *primitive, + CoglVerticesMode mode) +{ + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + + if (G_UNLIKELY (primitive->immutable_ref)) + { + warn_about_midscene_changes (); + return; + } + + primitive->mode = mode; +} + +void +cogl_primitive_set_indices (CoglPrimitive *primitive, + CoglIndices *indices, + int n_indices) +{ + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + + if (G_UNLIKELY (primitive->immutable_ref)) + { + warn_about_midscene_changes (); + return; + } + + if (indices) + cogl_object_ref (indices); + if (primitive->indices) + cogl_object_unref (primitive->indices); + primitive->indices = indices; + primitive->n_vertices = n_indices; +} + +CoglIndices * +cogl_primitive_get_indices (CoglPrimitive *primitive) +{ + return primitive->indices; +} + +CoglPrimitive * +cogl_primitive_copy (CoglPrimitive *primitive) +{ + CoglPrimitive *copy; + + copy = cogl_primitive_new_with_attributes (primitive->mode, + primitive->n_vertices, + primitive->attributes, + primitive->n_attributes); + + cogl_primitive_set_indices (copy, primitive->indices, primitive->n_vertices); + cogl_primitive_set_first_vertex (copy, primitive->first_vertex); + + return copy; +} + +CoglPrimitive * +_cogl_primitive_immutable_ref (CoglPrimitive *primitive) +{ + int i; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), NULL); + + primitive->immutable_ref++; + + for (i = 0; i < primitive->n_attributes; i++) + _cogl_attribute_immutable_ref (primitive->attributes[i]); + + return primitive; +} + +void +_cogl_primitive_immutable_unref (CoglPrimitive *primitive) +{ + int i; + + _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive)); + _COGL_RETURN_IF_FAIL (primitive->immutable_ref > 0); + + primitive->immutable_ref--; + + for (i = 0; i < primitive->n_attributes; i++) + _cogl_attribute_immutable_unref (primitive->attributes[i]); +} + +void +cogl_primitive_foreach_attribute (CoglPrimitive *primitive, + CoglPrimitiveAttributeCallback callback, + void *user_data) +{ + int i; + + for (i = 0; i < primitive->n_attributes; i++) + if (!callback (primitive, primitive->attributes[i], user_data)) + break; +} + +void +_cogl_primitive_draw (CoglPrimitive *primitive, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags) +{ + if (primitive->indices) + _cogl_framebuffer_draw_indexed_attributes (framebuffer, + pipeline, + primitive->mode, + primitive->first_vertex, + primitive->n_vertices, + primitive->indices, + primitive->attributes, + primitive->n_attributes, + flags); + else + _cogl_framebuffer_draw_attributes (framebuffer, + pipeline, + primitive->mode, + primitive->first_vertex, + primitive->n_vertices, + primitive->attributes, + primitive->n_attributes, + flags); +} + +void +cogl_primitive_draw (CoglPrimitive *primitive, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline) +{ + _cogl_primitive_draw (primitive, framebuffer, pipeline, 0 /* flags */); +} diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h new file mode 100644 index 0000000..0f20bb5 --- /dev/null +++ b/cogl/cogl-primitive.h @@ -0,0 +1,942 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PRIMITIVE_H__ +#define __COGL_PRIMITIVE_H__ + +/* We forward declare the CoglPrimitive type here to avoid some circular + * dependency issues with the following headers. + */ +typedef struct _CoglPrimitive CoglPrimitive; + +#include /* for CoglVerticesMode */ +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-primitive + * @short_description: Functions for creating, manipulating and drawing + * primitives + * + * FIXME + */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_primitive_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_primitive_get_gtype (void); +#endif + +/** + * CoglVertexP2: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p2(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y; +} CoglVertexP2; + +/** + * CoglVertexP3: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @z: The z component of a position attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p3(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y, z; +} CoglVertexP3; + +/** + * CoglVertexP2C4: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @r: The red component of a color attribute + * @b: The green component of a color attribute + * @g: The blue component of a color attribute + * @a: The alpha component of a color attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p2c4(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y; + uint8_t r, g, b, a; +} CoglVertexP2C4; + +/** + * CoglVertexP3C4: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @z: The z component of a position attribute + * @r: The red component of a color attribute + * @b: The green component of a color attribute + * @g: The blue component of a color attribute + * @a: The alpha component of a color attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p3c4(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y, z; + uint8_t r, g, b, a; +} CoglVertexP3C4; + +/** + * CoglVertexP2T2: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @s: The s component of a texture coordinate attribute + * @t: The t component of a texture coordinate attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p2t2(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y; + float s, t; +} CoglVertexP2T2; + +/** + * CoglVertexP3T2: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @z: The z component of a position attribute + * @s: The s component of a texture coordinate attribute + * @t: The t component of a texture coordinate attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p3t2(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y, z; + float s, t; +} CoglVertexP3T2; + + +/** + * CoglVertexP2T2C4: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @s: The s component of a texture coordinate attribute + * @t: The t component of a texture coordinate attribute + * @r: The red component of a color attribute + * @b: The green component of a color attribute + * @g: The blue component of a color attribute + * @a: The alpha component of a color attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p3t2c4(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y; + float s, t; + uint8_t r, g, b, a; +} CoglVertexP2T2C4; + +/** + * CoglVertexP3T2C4: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @z: The z component of a position attribute + * @s: The s component of a texture coordinate attribute + * @t: The t component of a texture coordinate attribute + * @r: The red component of a color attribute + * @b: The green component of a color attribute + * @g: The blue component of a color attribute + * @a: The alpha component of a color attribute + * + * A convenience vertex definition that can be used with + * cogl_primitive_new_p3t2c4(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct { + float x, y, z; + float s, t; + uint8_t r, g, b, a; +} CoglVertexP3T2C4; + +/** + * cogl_primitive_new: + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to process when drawing + * @...: A %NULL terminated list of attributes + * + * Combines a set of #CoglAttributes with a specific draw @mode + * and defines a vertex count so a #CoglPrimitive object can be retained and + * drawn later with no addition information required. + * + * The value passed as @n_vertices will simply update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + * + * Return value: (transfer full): A newly allocated #CoglPrimitive object + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new (CoglVerticesMode mode, + int n_vertices, + ...); + +/** + * cogl_primitive_new_with_attributes: + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to process when drawing + * @attributes: An array of CoglAttribute + * @n_attributes: The number of attributes + * + * Combines a set of #CoglAttributes with a specific draw @mode + * and defines a vertex count so a #CoglPrimitive object can be retained and + * drawn later with no addition information required. + * + * The value passed as @n_vertices will simply update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + * + * Return value: (transfer full): A newly allocated #CoglPrimitive object + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_with_attributes (CoglVerticesMode mode, + int n_vertices, + CoglAttribute **attributes, + int n_attributes); + +/** + * cogl_primitive_new_p2: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP2): An array + * of #CoglVertexP2 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position + * attribute with a #CoglAttribute and upload your data. + * + * For example to draw a convex polygon you can do: + * |[ + * CoglVertexP2 triangle[] = + * { + * { 0, 300 }, + * { 150, 0, }, + * { 300, 300 } + * }; + * prim = cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p2 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2 *data); + +/** + * cogl_primitive_new_p3: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP3): An array of + * #CoglVertexP3 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position + * attribute with a #CoglAttribute and upload your data. + * + * For example to draw a convex polygon you can do: + * |[ + * CoglVertexP3 triangle[] = + * { + * { 0, 300, 0 }, + * { 150, 0, 0 }, + * { 300, 300, 0 } + * }; + * prim = cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p3 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3 *data); + +/** + * cogl_primitive_new_p2c4: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP2C4): An array + * of #CoglVertexP2C4 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position + * and color attributes with #CoglAttributes and upload + * your data. + * + * For example to draw a convex polygon with a linear gradient you + * can do: + * |[ + * CoglVertexP2C4 triangle[] = + * { + * { 0, 300, 0xff, 0x00, 0x00, 0xff }, + * { 150, 0, 0x00, 0xff, 0x00, 0xff }, + * { 300, 300, 0xff, 0x00, 0x00, 0xff } + * }; + * prim = cogl_primitive_new_p2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p2c4 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2C4 *data); + +/** + * cogl_primitive_new_p3c4: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP3C4): An array + * of #CoglVertexP3C4 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position + * and color attributes with #CoglAttributes and upload + * your data. + * + * For example to draw a convex polygon with a linear gradient you + * can do: + * |[ + * CoglVertexP3C4 triangle[] = + * { + * { 0, 300, 0, 0xff, 0x00, 0x00, 0xff }, + * { 150, 0, 0, 0x00, 0xff, 0x00, 0xff }, + * { 300, 300, 0, 0xff, 0x00, 0x00, 0xff } + * }; + * prim = cogl_primitive_new_p3c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p3c4 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3C4 *data); + +/** + * cogl_primitive_new_p2t2: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP2T2): An array + * of #CoglVertexP2T2 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position and + * texture coordinate attributes with #CoglAttributes and + * upload your data. + * + * For example to draw a convex polygon with texture mapping you can + * do: + * |[ + * CoglVertexP2T2 triangle[] = + * { + * { 0, 300, 0.0, 1.0}, + * { 150, 0, 0.5, 0.0}, + * { 300, 300, 1.0, 1.0} + * }; + * prim = cogl_primitive_new_p2t2 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p2t2 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2T2 *data); + +/** + * cogl_primitive_new_p3t2: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP3T2): An array + * of #CoglVertexP3T2 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position and + * texture coordinate attributes with #CoglAttributes and + * upload your data. + * + * For example to draw a convex polygon with texture mapping you can + * do: + * |[ + * CoglVertexP3T2 triangle[] = + * { + * { 0, 300, 0, 0.0, 1.0}, + * { 150, 0, 0, 0.5, 0.0}, + * { 300, 300, 0, 1.0, 1.0} + * }; + * prim = cogl_primitive_new_p3t2 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p3t2 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3T2 *data); + +/** + * cogl_primitive_new_p2t2c4: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP2T2C4): An + * array of #CoglVertexP2T2C4 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position, texture + * coordinate and color attributes with #CoglAttributes and + * upload your data. + * + * For example to draw a convex polygon with texture mapping and a + * linear gradient you can do: + * |[ + * CoglVertexP2T2C4 triangle[] = + * { + * { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, + * { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, + * { 300, 300, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff} + * }; + * prim = cogl_primitive_new_p2t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p2t2c4 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP2T2C4 *data); + +/** + * cogl_primitive_new_p3t2c4: + * @context: A #CoglContext + * @mode: A #CoglVerticesMode defining how to draw the vertices + * @n_vertices: The number of vertices to read from @data and also + * the number of vertices to read when later drawing. + * @data: (array length=n_vertices): (type Cogl.VertexP3T2C4): An + * array of #CoglVertexP3T2C4 vertices + * + * Provides a convenient way to describe a primitive, such as a single + * triangle strip or a triangle fan, that will internally allocate the + * necessary #CoglAttributeBuffer storage, describe the position, texture + * coordinate and color attributes with #CoglAttributes and + * upload your data. + * + * For example to draw a convex polygon with texture mapping and a + * linear gradient you can do: + * |[ + * CoglVertexP3T2C4 triangle[] = + * { + * { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, + * { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, + * { 300, 300, 0, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff} + * }; + * prim = cogl_primitive_new_p3t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, + * 3, triangle); + * cogl_primitive_draw (prim); + * ]| + * + * The value passed as @n_vertices is initially used to determine how + * much can be read from @data but it will also be used to update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to read when drawing. + + * The primitive API doesn't support drawing with sliced + * textures (since switching between slices implies changing state and + * so that implies multiple primitives need to be submitted). You + * should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that + * might be used while drawing with this API. If your hardware doesn't + * support non-power of two textures (For example you are using GLES + * 1.1) then you will need to make sure your assets are resized to a + * power-of-two size (though they don't have to be square) + * + * Return value: (transfer full): A newly allocated #CoglPrimitive + * with a reference of 1. This can be freed using cogl_object_unref(). + * + * Since: 1.6 + * Stability: Unstable + */ +CoglPrimitive * +cogl_primitive_new_p3t2c4 (CoglContext *context, + CoglVerticesMode mode, + int n_vertices, + const CoglVertexP3T2C4 *data); +int +cogl_primitive_get_first_vertex (CoglPrimitive *primitive); + +void +cogl_primitive_set_first_vertex (CoglPrimitive *primitive, + int first_vertex); + +/** + * cogl_primitive_get_n_vertices: + * @primitive: A #CoglPrimitive object + * + * Queries the number of vertices to read when drawing the given + * @primitive. Usually this value is implicitly set when associating + * vertex data or indices with a #CoglPrimitive. + * + * If cogl_primitive_set_indices() has been used to associate a + * sequence of #CoglIndices with the given @primitive then the + * number of vertices to read can also be phrased as the number + * of indices to read. + * + * To be clear; it doesn't refer to the number of vertices - in + * terms of data - associated with the primitive it's just the number + * of vertices to read and draw. + * + * Returns: The number of vertices to read when drawing. + * + * Since: 1.8 + * Stability: unstable + */ +int +cogl_primitive_get_n_vertices (CoglPrimitive *primitive); + +/** + * cogl_primitive_set_n_vertices: + * @primitive: A #CoglPrimitive object + * @n_vertices: The number of vertices to read when drawing. + * + * Specifies how many vertices should be read when drawing the given + * @primitive. + * + * Usually this value is set implicitly when associating vertex data + * or indices with a #CoglPrimitive. + * + * To be clear; it doesn't refer to the number of vertices - in + * terms of data - associated with the primitive it's just the number + * of vertices to read and draw. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_primitive_set_n_vertices (CoglPrimitive *primitive, + int n_vertices); + +CoglVerticesMode +cogl_primitive_get_mode (CoglPrimitive *primitive); + +void +cogl_primitive_set_mode (CoglPrimitive *primitive, + CoglVerticesMode mode); + +/** + * cogl_primitive_set_attributes: + * @primitive: A #CoglPrimitive object + * @attributes: an array of #CoglAttribute pointers + * @n_attributes: the number of elements in @attributes + * + * Replaces all the attributes of the given #CoglPrimitive object. + * + * Since: 1.6 + * Stability: Unstable + */ +void +cogl_primitive_set_attributes (CoglPrimitive *primitive, + CoglAttribute **attributes, + int n_attributes); + +/** + * cogl_primitive_set_indices: + * @primitive: A #CoglPrimitive + * @indices: A #CoglIndices array + * @n_indices: The number of indices to reference when drawing + * + * Associates a sequence of #CoglIndices with the given @primitive. + * + * #CoglIndices provide a way to virtualize your real vertex data by + * providing a sequence of indices that index into your real vertex + * data. The GPU will walk though the index values to indirectly + * lookup the data for each vertex instead of sequentially walking + * through the data directly. This lets you save memory by indexing + * shared data multiple times instead of duplicating the data. + * + * The value passed as @n_indices will simply update the + * #CoglPrimitive n_vertices property as if + * cogl_primitive_set_n_vertices() were called. This property defines + * the number of vertices to draw or, put another way, how many + * indices should be read from @indices when drawing. + * + * The #CoglPrimitive first_vertex property + * also affects drawing with indices by defining the first entry of the + * indices to start drawing from. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_primitive_set_indices (CoglPrimitive *primitive, + CoglIndices *indices, + int n_indices); + +/** + * cogl_primitive_get_indices: + * @primitive: A #CoglPrimitive + * + * Return value: (transfer none): the indices that were set with + * cogl_primitive_set_indices() or %NULL if no indices were set. + * + * Since: 1.10 + * Stability: unstable + */ +CoglIndices * +cogl_primitive_get_indices (CoglPrimitive *primitive); + +/** + * cogl_primitive_copy: + * @primitive: A primitive copy + * + * Makes a copy of an existing #CoglPrimitive. Note that the primitive + * is a shallow copy which means it will use the same attributes and + * attribute buffers as the original primitive. + * + * Return value: (transfer full): the new primitive + * Since: 1.10 + * Stability: unstable + */ +CoglPrimitive * +cogl_primitive_copy (CoglPrimitive *primitive); + +/** + * cogl_is_primitive: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglPrimitive. + * + * Returns: %TRUE if the @object references a #CoglPrimitive, + * %FALSE otherwise + * + * Since: 1.6 + * Stability: Unstable + */ +CoglBool +cogl_is_primitive (void *object); + +/** + * CoglPrimitiveAttributeCallback: + * @primitive: The #CoglPrimitive whose attributes are being iterated + * @attribute: The #CoglAttribute + * @user_data: The private data passed to cogl_primitive_foreach_attribute() + * + * The callback prototype used with cogl_primitive_foreach_attribute() + * for iterating all the attributes of a #CoglPrimitive. + * + * The function should return TRUE to continue iteration or FALSE to + * stop. + * + * Since: 1.10 + * Stability: Unstable + */ +typedef CoglBool (* CoglPrimitiveAttributeCallback) (CoglPrimitive *primitive, + CoglAttribute *attribute, + void *user_data); + +/** + * cogl_primitive_foreach_attribute: + * @primitive: A #CoglPrimitive object + * @callback: (scope call): A #CoglPrimitiveAttributeCallback to be + * called for each attribute + * @user_data: (closure): Private data that will be passed to the + * callback + * + * Iterates all the attributes of the given #CoglPrimitive. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_primitive_foreach_attribute (CoglPrimitive *primitive, + CoglPrimitiveAttributeCallback callback, + void *user_data); + +/** + * cogl_primitive_draw: + * @primitive: A #CoglPrimitive geometry object + * @framebuffer: A destination #CoglFramebuffer + * @pipeline: A #CoglPipeline state object + * + * Draws the given @primitive geometry to the specified destination + * @framebuffer using the graphics processing state described by @pipeline. + * + * This drawing api doesn't support high-level meta texture types such + * as #CoglTexture2DSliced so it is the user's responsibility to + * ensure that only low-level textures that can be directly sampled by + * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D + * are associated with layers of the given @pipeline. + * + * Stability: unstable + * Since: 1.16 + */ +void +cogl_primitive_draw (CoglPrimitive *primitive, + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline); + + +COGL_END_DECLS + +#endif /* __COGL_PRIMITIVE_H__ */ + diff --git a/cogl/cogl-primitives-private.h b/cogl/cogl-primitives-private.h new file mode 100644 index 0000000..10db869 --- /dev/null +++ b/cogl/cogl-primitives-private.h @@ -0,0 +1,67 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PRIMITIVES_PRIVATE_H +#define __COGL_PRIMITIVES_PRIVATE_H + +#include + +COGL_BEGIN_DECLS + +/* Draws a rectangle without going through the journal so that it will + be flushed immediately. This should only be used in situations + where the code may be called while the journal is already being + flushed. In that case using the journal would go wrong */ +void +_cogl_rectangle_immediate (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2); + +typedef struct _CoglMultiTexturedRect +{ + const float *position; /* x0,y0,x1,y1 */ + const float *tex_coords; /* (tx0,ty0,tx1,ty1)(tx0,ty0,tx1,ty1)(... */ + int tex_coords_len; /* number of floats in tex_coords? */ +} CoglMultiTexturedRect; + +void +_cogl_framebuffer_draw_multitextured_rectangles ( + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglMultiTexturedRect *rects, + int n_rects, + CoglBool disable_legacy_state); + +COGL_END_DECLS + +#endif /* __COGL_PRIMITIVES_PRIVATE_H */ diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c new file mode 100644 index 0000000..bfe7735 --- /dev/null +++ b/cogl/cogl-primitives.c @@ -0,0 +1,1148 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-context-private.h" +#include "cogl-journal-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-vertex-buffer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-attribute-private.h" +#include "cogl-private.h" +#include "cogl-meta-texture.h" +#include "cogl-framebuffer-private.h" +#include "cogl1-context.h" +#include "cogl-primitives-private.h" + +#include +#include + +#define _COGL_MAX_BEZ_RECURSE_DEPTH 16 + +typedef struct _TextureSlicedQuadState +{ + CoglFramebuffer *framebuffer; + CoglPipeline *pipeline; + CoglTexture *main_texture; + float tex_virtual_origin_x; + float tex_virtual_origin_y; + float quad_origin_x; + float quad_origin_y; + float v_to_q_scale_x; + float v_to_q_scale_y; + float quad_len_x; + float quad_len_y; + CoglBool flipped_x; + CoglBool flipped_y; +} TextureSlicedQuadState; + +typedef struct _TextureSlicedPolygonState +{ + const CoglTextureVertex *vertices; + int n_vertices; + int stride; + CoglAttribute **attributes; +} TextureSlicedPolygonState; + +static void +log_quad_sub_textures_cb (CoglTexture *texture, + const float *subtexture_coords, + const float *virtual_coords, + void *user_data) +{ + TextureSlicedQuadState *state = user_data; + CoglFramebuffer *framebuffer = state->framebuffer; + CoglTexture *texture_override; + float quad_coords[4]; + +#define TEX_VIRTUAL_TO_QUAD(V, Q, AXIS) \ + do { \ + Q = V - state->tex_virtual_origin_##AXIS; \ + Q *= state->v_to_q_scale_##AXIS; \ + if (state->flipped_##AXIS) \ + Q = state->quad_len_##AXIS - Q; \ + Q += state->quad_origin_##AXIS; \ + } while (0); + + TEX_VIRTUAL_TO_QUAD (virtual_coords[0], quad_coords[0], x); + TEX_VIRTUAL_TO_QUAD (virtual_coords[1], quad_coords[1], y); + + TEX_VIRTUAL_TO_QUAD (virtual_coords[2], quad_coords[2], x); + TEX_VIRTUAL_TO_QUAD (virtual_coords[3], quad_coords[3], y); + +#undef TEX_VIRTUAL_TO_QUAD + + COGL_NOTE (DRAW, + "~~~~~ slice\n" + "qx1: %f\t" + "qy1: %f\n" + "qx2: %f\t" + "qy2: %f\n" + "tx1: %f\t" + "ty1: %f\n" + "tx2: %f\t" + "ty2: %f\n", + quad_coords[0], quad_coords[1], + quad_coords[2], quad_coords[3], + subtexture_coords[0], subtexture_coords[1], + subtexture_coords[2], subtexture_coords[3]); + + /* We only need to override the texture if it's different from the + main texture */ + if (texture == state->main_texture) + texture_override = NULL; + else + texture_override = texture; + + _cogl_journal_log_quad (framebuffer->journal, + quad_coords, + state->pipeline, + 1, /* one layer */ + texture_override, /* replace the layer0 texture */ + subtexture_coords, + 4); +} + +typedef struct _ValidateFirstLayerState +{ + CoglPipeline *override_pipeline; +} ValidateFirstLayerState; + +static CoglBool +validate_first_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + ValidateFirstLayerState *state = user_data; + CoglPipelineWrapMode clamp_to_edge = + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + CoglPipelineWrapMode wrap_s; + CoglPipelineWrapMode wrap_t; + + /* We can't use hardware repeat so we need to set clamp to edge + * otherwise it might pull in edge pixels from the other side. By + * default WRAP_MODE_AUTOMATIC becomes CLAMP_TO_EDGE so we only need + * to override if the wrap mode isn't already automatic or + * clamp_to_edge. + */ + wrap_s = cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index); + if (wrap_s != COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE && + wrap_s != COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (!state->override_pipeline) + state->override_pipeline = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_layer_wrap_mode_s (state->override_pipeline, + layer_index, clamp_to_edge); + } + + wrap_t = cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index); + if (wrap_t != COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE && + wrap_t != COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (!state->override_pipeline) + state->override_pipeline = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_layer_wrap_mode_t (state->override_pipeline, + layer_index, clamp_to_edge); + } + + return FALSE; +} + +/* This path doesn't currently support multitexturing but is used for + * CoglTextures that don't support repeating using the GPU so we need to + * manually emit extra geometry to fake the repeating. This includes: + * + * - CoglTexture2DSliced: when made of > 1 slice or if the users given + * texture coordinates require repeating, + * - CoglTexture2DAtlas: if the users given texture coordinates require + * repeating, + * - CoglTextureRectangle: if the users given texture coordinates require + * repeating, + * - CoglTexturePixmap: if the users given texture coordinates require + * repeating + */ +/* TODO: support multitexturing */ +static void +_cogl_texture_quad_multiple_primitives (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglTexture *texture, + int layer_index, + const float *position, + float tx_1, + float ty_1, + float tx_2, + float ty_2) +{ + TextureSlicedQuadState state; + CoglBool tex_virtual_flipped_x; + CoglBool tex_virtual_flipped_y; + CoglBool quad_flipped_x; + CoglBool quad_flipped_y; + ValidateFirstLayerState validate_first_layer_state; + CoglPipelineWrapMode wrap_s, wrap_t; + + wrap_s = cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index); + wrap_t = cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index); + + validate_first_layer_state.override_pipeline = NULL; + cogl_pipeline_foreach_layer (pipeline, + validate_first_layer_cb, + &validate_first_layer_state); + + state.framebuffer = framebuffer; + state.main_texture = texture; + + if (validate_first_layer_state.override_pipeline) + state.pipeline = validate_first_layer_state.override_pipeline; + else + state.pipeline = pipeline; + + /* Get together the data we need to transform the virtual texture + * coordinates of each slice into quad coordinates... + * + * NB: We need to consider that the quad coordinates and the texture + * coordinates may be inverted along the x or y axis, and must preserve the + * inversions when we emit the final geometry. + */ + +#define X0 0 +#define Y0 1 +#define X1 2 +#define Y1 3 + + tex_virtual_flipped_x = (tx_1 > tx_2) ? TRUE : FALSE; + tex_virtual_flipped_y = (ty_1 > ty_2) ? TRUE : FALSE; + state.tex_virtual_origin_x = tex_virtual_flipped_x ? tx_2 : tx_1; + state.tex_virtual_origin_y = tex_virtual_flipped_y ? ty_2 : ty_1; + + quad_flipped_x = (position[X0] > position[X1]) ? TRUE : FALSE; + quad_flipped_y = (position[Y0] > position[Y1]) ? TRUE : FALSE; + state.quad_origin_x = quad_flipped_x ? position[X1] : position[X0]; + state.quad_origin_y = quad_flipped_y ? position[Y1] : position[Y0]; + + /* flatten the two forms of coordinate inversion into one... */ + state.flipped_x = tex_virtual_flipped_x ^ quad_flipped_x; + state.flipped_y = tex_virtual_flipped_y ^ quad_flipped_y; + + /* We use the _len_AXIS naming here instead of _width and _height because + * log_quad_slice_cb uses a macro with symbol concatenation to handle both + * axis, so this is more convenient... */ + state.quad_len_x = fabs (position[X1] - position[X0]); + state.quad_len_y = fabs (position[Y1] - position[Y0]); + +#undef X0 +#undef Y0 +#undef X1 +#undef Y1 + + state.v_to_q_scale_x = fabs (state.quad_len_x / (tx_2 - tx_1)); + state.v_to_q_scale_y = fabs (state.quad_len_y / (ty_2 - ty_1)); + + /* For backwards compatablity the default wrap mode for cogl_rectangle() is + * _REPEAT... */ + if (wrap_s == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_s = COGL_PIPELINE_WRAP_MODE_REPEAT; + if (wrap_t == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_t = COGL_PIPELINE_WRAP_MODE_REPEAT; + + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (texture), + tx_1, ty_1, tx_2, ty_2, + wrap_s, + wrap_t, + log_quad_sub_textures_cb, + &state); + + if (validate_first_layer_state.override_pipeline) + cogl_object_unref (validate_first_layer_state.override_pipeline); +} + +typedef struct _ValidateTexCoordsState +{ + int i; + int n_layers; + const float *user_tex_coords; + int user_tex_coords_len; + float *final_tex_coords; + CoglPipeline *override_pipeline; + CoglBool needs_multiple_primitives; +} ValidateTexCoordsState; + +/* + * Validate the texture coordinates for this rectangle. + */ +static CoglBool +validate_tex_coords_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + ValidateTexCoordsState *state = user_data; + CoglTexture *texture; + const float *in_tex_coords; + float *out_tex_coords; + float default_tex_coords[4] = {0.0, 0.0, 1.0, 1.0}; + CoglTransformResult transform_result; + + state->i++; + + /* FIXME: we should be able to avoid this copying when no + * transform is required by the texture backend and the user + * has supplied enough coordinates for all the layers. + */ + + /* If the user didn't supply texture coordinates for this layer + then use the default coords */ + if (state->i >= state->user_tex_coords_len / 4) + in_tex_coords = default_tex_coords; + else + in_tex_coords = &state->user_tex_coords[state->i * 4]; + + out_tex_coords = &state->final_tex_coords[state->i * 4]; + + memcpy (out_tex_coords, in_tex_coords, sizeof (float) * 4); + + texture = cogl_pipeline_get_layer_texture (pipeline, layer_index); + + /* NB: NULL textures are handled by _cogl_pipeline_flush_gl_state */ + if (!texture) + return TRUE; + + /* Convert the texture coordinates to GL. + */ + transform_result = + _cogl_texture_transform_quad_coords_to_gl (texture, + out_tex_coords); + /* If the texture has waste or we are using GL_TEXTURE_RECT we + * can't handle texture repeating so we can't use the layer if + * repeating is required. + * + * NB: We already know that no texture matrix is being used if the + * texture doesn't support hardware repeat. + */ + if (transform_result == COGL_TRANSFORM_SOFTWARE_REPEAT) + { + if (state->i == 0) + { + if (state->n_layers > 1) + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + g_warning ("Skipping layers 1..n of your material since " + "the first layer doesn't support hardware " + "repeat (e.g. because of waste or use of " + "GL_TEXTURE_RECTANGLE_ARB) and you supplied " + "texture coordinates outside the range [0,1]." + "Falling back to software repeat assuming " + "layer 0 is the most important one keep"); + warning_seen = TRUE; + } + + if (state->override_pipeline) + cogl_object_unref (state->override_pipeline); + state->needs_multiple_primitives = TRUE; + return FALSE; + } + else + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + g_warning ("Skipping layer %d of your material " + "since you have supplied texture coords " + "outside the range [0,1] but the texture " + "doesn't support hardware repeat (e.g. " + "because of waste or use of " + "GL_TEXTURE_RECTANGLE_ARB). This isn't " + "supported with multi-texturing.", state->i); + warning_seen = TRUE; + + cogl_pipeline_set_layer_texture (pipeline, layer_index, NULL); + } + } + + /* By default WRAP_MODE_AUTOMATIC becomes to CLAMP_TO_EDGE. If + the texture coordinates need repeating then we'll override + this to GL_REPEAT. Otherwise we'll leave it at CLAMP_TO_EDGE + so that it won't blend in pixels from the opposite side when + the full texture is drawn with GL_LINEAR filter mode */ + if (transform_result == COGL_TRANSFORM_HARDWARE_REPEAT) + { + if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) == + COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (!state->override_pipeline) + state->override_pipeline = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_layer_wrap_mode_s (state->override_pipeline, + layer_index, + COGL_PIPELINE_WRAP_MODE_REPEAT); + } + if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) == + COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (!state->override_pipeline) + state->override_pipeline = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_layer_wrap_mode_t (state->override_pipeline, + layer_index, + COGL_PIPELINE_WRAP_MODE_REPEAT); + } + } + + return TRUE; +} + +/* This path supports multitexturing but only when each of the layers is + * handled with a single GL texture. Also if repeating is necessary then + * _cogl_texture_can_hardware_repeat() must return TRUE. + * This includes layers made from: + * + * - CoglTexture2DSliced: if only comprised of a single slice with optional + * waste, assuming the users given texture coordinates don't require + * repeating. + * - CoglTexture{1D,2D,3D}: always. + * - CoglTexture2DAtlas: assuming the users given texture coordinates don't + * require repeating. + * - CoglTextureRectangle: assuming the users given texture coordinates don't + * require repeating. + * - CoglTexturePixmap: assuming the users given texture coordinates don't + * require repeating. + */ +static CoglBool +_cogl_multitexture_quad_single_primitive (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + const float *position, + const float *user_tex_coords, + int user_tex_coords_len) +{ + int n_layers = cogl_pipeline_get_n_layers (pipeline); + ValidateTexCoordsState state; + float *final_tex_coords = alloca (sizeof (float) * 4 * n_layers); + + state.i = -1; + state.n_layers = n_layers; + state.user_tex_coords = user_tex_coords; + state.user_tex_coords_len = user_tex_coords_len; + state.final_tex_coords = final_tex_coords; + state.override_pipeline = NULL; + state.needs_multiple_primitives = FALSE; + + cogl_pipeline_foreach_layer (pipeline, + validate_tex_coords_cb, + &state); + + if (state.needs_multiple_primitives) + return FALSE; + + if (state.override_pipeline) + pipeline = state.override_pipeline; + + _cogl_journal_log_quad (framebuffer->journal, + position, + pipeline, + n_layers, + NULL, /* no texture override */ + final_tex_coords, + n_layers * 4); + + if (state.override_pipeline) + cogl_object_unref (state.override_pipeline); + + return TRUE; +} + +typedef struct _ValidateLayerState +{ + CoglContext *ctx; + int i; + int first_layer; + CoglPipeline *override_source; + CoglBool all_use_sliced_quad_fallback; +} ValidateLayerState; + +static CoglBool +_cogl_rectangles_validate_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + ValidateLayerState *state = user_data; + CoglTexture *texture; + + state->i++; + + /* We need to ensure the mipmaps are ready before deciding + * anything else about the texture because the texture storage + * could completely change if it needs to be migrated out of the + * atlas and will affect how we validate the layer. + * + * FIXME: this needs to be generalized. There could be any + * number of things that might require a shuffling of the + * underlying texture storage. We could add two mechanisms to + * generalize this a bit... + * + * 1) add a _cogl_pipeline_layer_update_storage() function that + * would for instance consider if mipmapping is necessary and + * potentially migrate the texture from an atlas. + * + * 2) allow setting of transient primitive-flags on a pipeline + * that may affect the outcome of _update_storage(). One flag + * could indicate that we expect to sample beyond the bounds of + * the texture border. + * + * flags = COGL_PIPELINE_PRIMITIVE_FLAG_VALID_BORDERS; + * _cogl_pipeline_layer_assert_primitive_flags (layer, flags) + * _cogl_pipeline_layer_update_storage (layer) + * enqueue primitive in journal + * + * when the primitive is dequeued and drawn we should: + * _cogl_pipeline_flush_gl_state (pipeline) + * draw primitive + * _cogl_pipeline_unassert_primitive_flags (layer, flags); + * + * _cogl_pipeline_layer_update_storage should take into + * consideration all the asserted primitive requirements. (E.g. + * there could be multiple primitives in the journal - or in a + * renderlist in the future - that need mipmaps or that need + * valid contents beyond their borders (for cogl_polygon) + * meaning they can't work with textures in an atas, so + * _cogl_pipeline_layer_update_storage would pass on these + * requirements to the texture atlas backend which would make + * sure the referenced texture is migrated out of the atlas and + * mipmaps are generated.) + */ + _cogl_pipeline_pre_paint_for_layer (pipeline, layer_index); + + texture = cogl_pipeline_get_layer_texture (pipeline, layer_index); + + /* NULL textures are handled by + * _cogl_pipeline_flush_gl_state */ + if (texture == NULL) + return TRUE; + + if (state->i == 0) + state->first_layer = layer_index; + + /* XXX: + * For now, if the first layer is sliced then all other layers are + * ignored since we currently don't support multi-texturing with + * sliced textures. If the first layer is not sliced then any other + * layers found to be sliced will be skipped. (with a warning) + * + * TODO: Add support for multi-texturing rectangles with sliced + * textures if no texture matrices are in use. + */ + if (cogl_texture_is_sliced (texture)) + { + if (state->i == 0) + { + if (cogl_pipeline_get_n_layers (pipeline) > 1) + { + static CoglBool warning_seen = FALSE; + + if (!state->override_source) + state->override_source = cogl_pipeline_copy (pipeline); + _cogl_pipeline_prune_to_n_layers (state->override_source, 1); + + if (!warning_seen) + g_warning ("Skipping layers 1..n of your pipeline since " + "the first layer is sliced. We don't currently " + "support any multi-texturing with sliced " + "textures but assume layer 0 is the most " + "important to keep"); + warning_seen = TRUE; + } + + state->all_use_sliced_quad_fallback = TRUE; + + return FALSE; + } + else + { + static CoglBool warning_seen = FALSE; + CoglTexture2D *tex_2d; + + if (!warning_seen) + g_warning ("Skipping layer %d of your pipeline consisting of " + "a sliced texture (unsuported for multi texturing)", + state->i); + warning_seen = TRUE; + + /* Note: currently only 2D textures can be sliced. */ + tex_2d = state->ctx->default_gl_texture_2d_tex; + cogl_pipeline_set_layer_texture (pipeline, layer_index, + COGL_TEXTURE (tex_2d)); + return TRUE; + } + } + +#ifdef COGL_ENABLE_DEBUG + /* If the texture can't be repeated with the GPU (e.g. because it has + * waste or if using GL_TEXTURE_RECTANGLE_ARB) then if a texture matrix + * is also in use we don't know if the result will end up trying + * to texture from the waste area. + * + * Note: we check can_hardware_repeat() first since it's cheaper. + * + * Note: cases where the texture coordinates will require repeating + * will be caught by later validation. + */ + if (!_cogl_texture_can_hardware_repeat (texture) && + _cogl_pipeline_layer_has_user_matrix (pipeline, layer_index)) + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + g_warning ("layer %d of your pipeline uses a custom " + "texture matrix but because the texture doesn't " + "support hardware repeating you may see artefacts " + "due to sampling beyond the texture's bounds.", + state->i); + warning_seen = TRUE; + } +#endif + + return TRUE; +} + +void +_cogl_framebuffer_draw_multitextured_rectangles ( + CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglMultiTexturedRect *rects, + int n_rects, + CoglBool disable_legacy_state) +{ + CoglContext *ctx = framebuffer->context; + CoglPipeline *original_pipeline; + ValidateLayerState state; + int i; + + original_pipeline = pipeline; + + /* + * Validate all the layers of the current source pipeline... + */ + state.ctx = ctx; + state.i = -1; + state.first_layer = 0; + state.override_source = NULL; + state.all_use_sliced_quad_fallback = FALSE; + cogl_pipeline_foreach_layer (pipeline, + _cogl_rectangles_validate_layer_cb, + &state); + + if (state.override_source) + pipeline = state.override_source; + + if (!disable_legacy_state) + { + if (G_UNLIKELY (ctx->legacy_state_set) && + _cogl_get_enable_legacy_state ()) + { + /* If we haven't already made a pipeline copy */ + if (pipeline == original_pipeline) + pipeline = cogl_pipeline_copy (pipeline); + _cogl_pipeline_apply_legacy_state (pipeline); + } + } + + /* + * Emit geometry for each of the rectangles... + */ + + for (i = 0; i < n_rects; i++) + { + CoglTexture *texture; + const float default_tex_coords[4] = {0.0, 0.0, 1.0, 1.0}; + const float *tex_coords; + + if (!state.all_use_sliced_quad_fallback) + { + CoglBool success = + _cogl_multitexture_quad_single_primitive (framebuffer, + pipeline, + rects[i].position, + rects[i].tex_coords, + rects[i].tex_coords_len); + + /* NB: If _cogl_multitexture_quad_single_primitive fails then it + * means the user tried to use texture repeat with a texture that + * can't be repeated by the GPU (e.g. due to waste or use of + * GL_TEXTURE_RECTANGLE_ARB) */ + if (success) + continue; + } + + /* If multitexturing failed or we are drawing with a sliced texture + * then we only support a single layer so we pluck out the texture + * from the first pipeline layer... */ + texture = cogl_pipeline_get_layer_texture (pipeline, state.first_layer); + + if (rects[i].tex_coords) + tex_coords = rects[i].tex_coords; + else + tex_coords = default_tex_coords; + + COGL_NOTE (DRAW, "Drawing Tex Quad (Multi-Prim Mode)"); + + _cogl_texture_quad_multiple_primitives (framebuffer, + pipeline, + texture, + state.first_layer, + rects[i].position, + tex_coords[0], + tex_coords[1], + tex_coords[2], + tex_coords[3]); + } + + if (pipeline != original_pipeline) + cogl_object_unref (pipeline); +} + +static void +_cogl_rectangles_with_multitexture_coords ( + CoglMultiTexturedRect *rects, + int n_rects) +{ + _cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (), + cogl_get_source (), + rects, + n_rects, + FALSE); +} + +void +cogl_rectangles (const float *verts, + unsigned int n_rects) +{ + CoglMultiTexturedRect *rects; + int i; + + /* XXX: All the cogl_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_rectangles_with_multitexture_coords. + */ + + rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect)); + + for (i = 0; i < n_rects; i++) + { + rects[i].position = &verts[i * 4]; + rects[i].tex_coords = NULL; + rects[i].tex_coords_len = 0; + } + + _cogl_rectangles_with_multitexture_coords (rects, n_rects); +} + +void +cogl_rectangles_with_texture_coords (const float *verts, + unsigned int n_rects) +{ + CoglMultiTexturedRect *rects; + int i; + + /* XXX: All the cogl_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_rectangles_with_multitexture_coords. + */ + + rects = g_alloca (n_rects * sizeof (CoglMultiTexturedRect)); + + for (i = 0; i < n_rects; i++) + { + rects[i].position = &verts[i * 8]; + rects[i].tex_coords = &verts[i * 8 + 4]; + rects[i].tex_coords_len = 4; + } + + _cogl_rectangles_with_multitexture_coords (rects, n_rects); +} + +void +cogl_rectangle_with_texture_coords (float x_1, + float y_1, + float x_2, + float y_2, + float tx_1, + float ty_1, + float tx_2, + float ty_2) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + const float tex_coords[4] = {tx_1, ty_1, tx_2, ty_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the cogl_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_rectangles_with_multitexture_coords. + */ + + rect.position = position; + rect.tex_coords = tex_coords; + rect.tex_coords_len = 4; + + _cogl_rectangles_with_multitexture_coords (&rect, 1); +} + +void +cogl_rectangle_with_multitexture_coords (float x_1, + float y_1, + float x_2, + float y_2, + const float *user_tex_coords, + int user_tex_coords_len) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the cogl_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_rectangles_with_multitexture_coords. + */ + + rect.position = position; + rect.tex_coords = user_tex_coords; + rect.tex_coords_len = user_tex_coords_len; + + _cogl_rectangles_with_multitexture_coords (&rect, 1); +} + +void +cogl_rectangle (float x_1, + float y_1, + float x_2, + float y_2) +{ + const float position[4] = {x_1, y_1, x_2, y_2}; + CoglMultiTexturedRect rect; + + /* XXX: All the cogl_rectangle* APIs normalize their input into an array of + * CoglMultiTexturedRect rectangles and pass these on to our work horse; + * _cogl_rectangles_with_multitexture_coords. + */ + + rect.position = position; + rect.tex_coords = NULL; + rect.tex_coords_len = 0; + + _cogl_rectangles_with_multitexture_coords (&rect, 1); +} + +void +_cogl_rectangle_immediate (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + float x_1, + float y_1, + float x_2, + float y_2) +{ + /* Draw a rectangle using the vertex array API to avoid going + through the journal. This should only be used in cases where the + code might be called while the journal is already being flushed + such as when flushing the clip state */ + CoglContext *ctx = framebuffer->context; + float vertices[8] = + { + x_1, y_1, + x_1, y_2, + x_2, y_1, + x_2, y_2 + }; + CoglAttributeBuffer *attribute_buffer; + CoglAttribute *attributes[1]; + + attribute_buffer = + cogl_attribute_buffer_new (ctx, sizeof (vertices), vertices); + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (float) * 2, /* stride */ + 0, /* offset */ + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + _cogl_framebuffer_draw_attributes (framebuffer, + pipeline, + COGL_VERTICES_MODE_TRIANGLE_STRIP, + 0, /* first_index */ + 4, /* n_vertices */ + attributes, + 1, + COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | + COGL_DRAW_SKIP_LEGACY_STATE); + + + cogl_object_unref (attributes[0]); + cogl_object_unref (attribute_buffer); +} + +typedef struct _AppendTexCoordsState +{ + const CoglTextureVertex *vertices_in; + int vertex; + int layer; + float *vertices_out; +} AppendTexCoordsState; + +static CoglBool +append_tex_coord_attributes_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + AppendTexCoordsState *state = user_data; + CoglTexture *texture; + float tx, ty; + float *t; + + tx = state->vertices_in[state->vertex].tx; + ty = state->vertices_in[state->vertex].ty; + + /* NULL textures will be handled in + * _cogl_pipeline_flush_layers_gl_state but there is no need to worry + * about scaling texture coordinates in this case */ + texture = cogl_pipeline_get_layer_texture (pipeline, layer_index); + if (texture != NULL) + _cogl_texture_transform_coords_to_gl (texture, &tx, &ty); + + /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */ + t = state->vertices_out + 3 + 2 * state->layer; + t[0] = tx; + t[1] = ty; + + state->layer++; + + return TRUE; +} + +typedef struct _ValidateState +{ + CoglPipeline *original_pipeline; + CoglPipeline *pipeline; +} ValidateState; + +static CoglBool +_cogl_polygon_validate_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + ValidateState *state = user_data; + + /* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes + * GL_CLAMP_TO_EDGE but we want the polygon API to use GL_REPEAT to + * maintain compatibility with previous releases + */ + + if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) == + COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (state->original_pipeline == state->pipeline) + state->pipeline = cogl_pipeline_copy (pipeline); + + cogl_pipeline_set_layer_wrap_mode_s (state->pipeline, layer_index, + COGL_PIPELINE_WRAP_MODE_REPEAT); + } + + if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) == + COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + if (state->original_pipeline == state->pipeline) + state->pipeline = cogl_pipeline_copy (pipeline); + + cogl_pipeline_set_layer_wrap_mode_t (state->pipeline, layer_index, + COGL_PIPELINE_WRAP_MODE_REPEAT); + } + + return TRUE; +} + +void +cogl_polygon (const CoglTextureVertex *vertices, + unsigned int n_vertices, + CoglBool use_color) +{ + CoglPipeline *pipeline; + ValidateState validate_state; + int n_layers; + int n_attributes; + CoglAttribute **attributes; + int i; + unsigned int stride; + size_t stride_bytes; + CoglAttributeBuffer *attribute_buffer; + float *v; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + pipeline = cogl_get_source (); + + validate_state.original_pipeline = pipeline; + validate_state.pipeline = pipeline; + cogl_pipeline_foreach_layer (pipeline, + _cogl_polygon_validate_layer_cb, + &validate_state); + pipeline = validate_state.pipeline; + + n_layers = cogl_pipeline_get_n_layers (pipeline); + + n_attributes = 1 + n_layers + (use_color ? 1 : 0); + attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); + + /* Our data is arranged like: + * [X, Y, Z, TX0, TY0, TX1, TY1..., R, G, B, A,...] */ + stride = 3 + (2 * n_layers) + (use_color ? 1 : 0); + stride_bytes = stride * sizeof (float); + + /* Make sure there is enough space in the global vertex array. This + * is used so we can render the polygon with a single call to OpenGL + * but still support any number of vertices */ + g_array_set_size (ctx->polygon_vertices, n_vertices * stride); + + attribute_buffer = + cogl_attribute_buffer_new (ctx, n_vertices * stride_bytes, NULL); + + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + stride_bytes, + 0, + 3, + COGL_ATTRIBUTE_TYPE_FLOAT); + + for (i = 0; i < n_layers; i++) + { + static const char *names[] = { + "cogl_tex_coord0_in", + "cogl_tex_coord1_in", + "cogl_tex_coord2_in", + "cogl_tex_coord3_in", + "cogl_tex_coord4_in", + "cogl_tex_coord5_in", + "cogl_tex_coord6_in", + "cogl_tex_coord7_in" + }; + char *allocated_name = NULL; + const char *name; + + if (i < 8) + name = names[i]; + else + name = allocated_name = g_strdup_printf ("cogl_tex_coord%d_in", i); + + attributes[i + 1] = cogl_attribute_new (attribute_buffer, + name, + stride_bytes, + /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */ + 12 + 8 * i, + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + g_free (allocated_name); + } + + if (use_color) + { + attributes[n_attributes - 1] = + cogl_attribute_new (attribute_buffer, + "cogl_color_in", + stride_bytes, + /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */ + 12 + 8 * n_layers, + 4, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + } + + /* Convert the vertices into an array of float vertex attributes */ + v = (float *)ctx->polygon_vertices->data; + for (i = 0; i < n_vertices; i++) + { + AppendTexCoordsState append_tex_coords_state; + uint8_t *c; + + /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */ + v[0] = vertices[i].x; + v[1] = vertices[i].y; + v[2] = vertices[i].z; + + append_tex_coords_state.vertices_in = vertices; + append_tex_coords_state.vertex = i; + append_tex_coords_state.layer = 0; + append_tex_coords_state.vertices_out = v; + cogl_pipeline_foreach_layer (pipeline, + append_tex_coord_attributes_cb, + &append_tex_coords_state); + + if (use_color) + { + /* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */ + c = (uint8_t *) (v + 3 + 2 * n_layers); + c[0] = cogl_color_get_red_byte (&vertices[i].color); + c[1] = cogl_color_get_green_byte (&vertices[i].color); + c[2] = cogl_color_get_blue_byte (&vertices[i].color); + c[3] = cogl_color_get_alpha_byte (&vertices[i].color); + } + + v += stride; + } + + v = (float *)ctx->polygon_vertices->data; + cogl_buffer_set_data (COGL_BUFFER (attribute_buffer), + 0, + v, + ctx->polygon_vertices->len * sizeof (float)); + + /* XXX: although this may seem redundant, we need to do this since + * cogl_polygon() can be used with legacy state and its the source stack + * which track whether legacy state is enabled. + * + * (We only have a CoglDrawFlag to disable legacy state not one + * to enable it) */ + cogl_push_source (pipeline); + + _cogl_framebuffer_draw_attributes (cogl_get_draw_framebuffer (), + pipeline, + COGL_VERTICES_MODE_TRIANGLE_FAN, + 0, n_vertices, + attributes, + n_attributes, + 0 /* no draw flags */); + + cogl_pop_source (); + + if (pipeline != validate_state.original_pipeline) + cogl_object_unref (pipeline); + + cogl_object_unref (attribute_buffer); + + for (i = 0; i < n_attributes; i++) + cogl_object_unref (attributes[i]); +} diff --git a/cogl/cogl-primitives.h b/cogl/cogl-primitives.h new file mode 100644 index 0000000..0c9211e --- /dev/null +++ b/cogl/cogl-primitives.h @@ -0,0 +1,197 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PRIMITIVES_H +#define __COGL_PRIMITIVES_H + +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-primitives + * @short_description: Functions that draw various primitive 3D shapes + * + * The primitives API provides utilities for drawing some + * common 3D shapes in a more convenient way than the CoglVertexBuffer + * API provides. + */ + +/** + * cogl_rectangle: + * @x_1: X coordinate of the top-left corner + * @y_1: Y coordinate of the top-left corner + * @x_2: X coordinate of the bottom-right corner + * @y_2: Y coordinate of the bottom-right corner + * + * Fills a rectangle at the given coordinates with the current source material + **/ +void +cogl_rectangle (float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_rectangle_with_texture_coords: + * @x1: x coordinate upper left on screen. + * @y1: y coordinate upper left on screen. + * @x2: x coordinate lower right on screen. + * @y2: y coordinate lower right on screen. + * @tx1: x part of texture coordinate to use for upper left pixel + * @ty1: y part of texture coordinate to use for upper left pixel + * @tx2: x part of texture coordinate to use for lower right pixel + * @ty2: y part of texture coordinate to use for left pixel + * + * Draw a rectangle using the current material and supply texture coordinates + * to be used for the first texture layer of the material. To draw the entire + * texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0. + * + * Since: 1.0 + */ +void +cogl_rectangle_with_texture_coords (float x1, + float y1, + float x2, + float y2, + float tx1, + float ty1, + float tx2, + float ty2); + +/** + * cogl_rectangle_with_multitexture_coords: + * @x1: x coordinate upper left on screen. + * @y1: y coordinate upper left on screen. + * @x2: x coordinate lower right on screen. + * @y2: y coordinate lower right on screen. + * @tex_coords: (in) (array) (transfer none): An array containing groups of + * 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture + * coordinates; one for the upper left texel, and one for the lower right + * texel. Each value should be between 0.0 and 1.0, where the coordinate + * (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the + * bottom right. + * @tex_coords_len: The length of the tex_coords array. (e.g. for one layer + * and one group of texture coordinates, this would be 4) + * + * This function draws a rectangle using the current source material to + * texture or fill with. As a material may contain multiple texture layers + * this interface lets you supply texture coordinates for each layer of the + * material. + * + * The first pair of coordinates are for the first layer (with the smallest + * layer index) and if you supply less texture coordinates than there are + * layers in the current source material then default texture coordinates + * (0.0, 0.0, 1.0, 1.0) are generated. + * + * Since: 1.0 + */ +void +cogl_rectangle_with_multitexture_coords (float x1, + float y1, + float x2, + float y2, + const float *tex_coords, + int tex_coords_len); + +/** + * cogl_rectangles_with_texture_coords: + * @verts: (in) (array) (transfer none): an array of vertices + * @n_rects: number of rectangles to draw + * + * Draws a series of rectangles in the same way that + * cogl_rectangle_with_texture_coords() does. In some situations it can give a + * significant performance boost to use this function rather than + * calling cogl_rectangle_with_texture_coords() separately for each rectangle. + * + * @verts should point to an array of #floats with + * @n_rects * 8 elements. Each group of 8 values corresponds to the + * parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same + * meaning as in cogl_rectangle_with_texture_coords(). + * + * Since: 0.8.6 + */ +void +cogl_rectangles_with_texture_coords (const float *verts, + unsigned int n_rects); + +/** + * cogl_rectangles: + * @verts: (in) (array) (transfer none): an array of vertices + * @n_rects: number of rectangles to draw + * + * Draws a series of rectangles in the same way that + * cogl_rectangle() does. In some situations it can give a + * significant performance boost to use this function rather than + * calling cogl_rectangle() separately for each rectangle. + * + * @verts should point to an array of #floats with + * @n_rects * 4 elements. Each group of 4 values corresponds to the + * parameters x1, y1, x2, and y2, and have the same + * meaning as in cogl_rectangle(). + * + * Since: 1.0 + */ +void +cogl_rectangles (const float *verts, + unsigned int n_rects); + +/** + * cogl_polygon: + * @vertices: An array of #CoglTextureVertex structs + * @n_vertices: The length of the vertices array + * @use_color: %TRUE if the color member of #CoglTextureVertex should be used + * + * Draws a convex polygon using the current source material to fill / texture + * with according to the texture coordinates passed. + * + * If @use_color is %TRUE then the color will be changed for each vertex using + * the value specified in the color member of #CoglTextureVertex. This can be + * used for example to make the texture fade out by setting the alpha value of + * the color. + * + * All of the texture coordinates must be in the range [0,1] and repeating the + * texture is not supported. + * + * Because of the way this function is implemented it will currently + * only work if either the texture is not sliced or the backend is not + * OpenGL ES and the minifying and magnifying functions are both set + * to COGL_MATERIAL_FILTER_NEAREST. + * + * Since: 1.0 + */ +void +cogl_polygon (const CoglTextureVertex *vertices, + unsigned int n_vertices, + CoglBool use_color); + +COGL_END_DECLS + +#endif /* __COGL_PRIMITIVES_H */ diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h new file mode 100644 index 0000000..333955c --- /dev/null +++ b/cogl/cogl-private.h @@ -0,0 +1,170 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PRIVATE_H__ +#define __COGL_PRIVATE_H__ + +#include + +#include "cogl-context.h" +#include "cogl-flags.h" + +COGL_BEGIN_DECLS + +typedef enum +{ + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, + COGL_PRIVATE_FEATURE_MESA_PACK_INVERT, + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, + COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES, + COGL_PRIVATE_FEATURE_PBOS, + COGL_PRIVATE_FEATURE_VBOS, + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, + COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, + COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, + COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, + COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT, + COGL_PRIVATE_FEATURE_ALPHA_TEST, + COGL_PRIVATE_FEATURE_FORMAT_CONVERSION, + COGL_PRIVATE_FEATURE_QUADS, + COGL_PRIVATE_FEATURE_BLEND_CONSTANT, + COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS, + COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM, + COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS, + COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, + COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE, + COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL, + COGL_PRIVATE_FEATURE_ARBFP, + COGL_PRIVATE_FEATURE_OES_EGL_SYNC, + /* If this is set then the winsys is responsible for queueing dirty + * events. Otherwise a dirty event will be queued when the onscreen + * is first allocated or when it is shown or resized */ + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + COGL_PRIVATE_FEATURE_ENABLE_PROGRAM_POINT_SIZE, + /* These features let us avoid conditioning code based on the exact + * driver being used and instead check for broad opengl feature + * sets that can be shared by several GL apis */ + COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_FIXED, + COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, + COGL_PRIVATE_FEATURE_GL_EMBEDDED, + COGL_PRIVATE_FEATURE_GL_WEB, + + COGL_N_PRIVATE_FEATURES +} CoglPrivateFeature; + +/* Sometimes when evaluating pipelines, either during comparisons or + * if calculating a hash value we need to tweak the evaluation + * semantics */ +typedef enum _CoglPipelineEvalFlags +{ + COGL_PIPELINE_EVAL_FLAG_NONE = 0 +} CoglPipelineEvalFlags; + +void +_cogl_transform_point (const CoglMatrix *matrix_mv, + const CoglMatrix *matrix_p, + const float *viewport, + float *x, + float *y); + +CoglBool +_cogl_check_extension (const char *name, char * const *ext); + +void +_cogl_clear (const CoglColor *color, unsigned long buffers); + +void +_cogl_init (void); + +void +_cogl_push_source (CoglPipeline *pipeline, CoglBool enable_legacy); + +CoglBool +_cogl_get_enable_legacy_state (void); + +#define _cogl_has_private_feature(ctx, feature) \ + COGL_FLAGS_GET ((ctx)->private_features, (feature)) + +/* + * _cogl_pixel_format_get_bytes_per_pixel: + * @format: a #CoglPixelFormat + * + * Queries how many bytes a pixel of the given @format takes. + * + * Return value: The number of bytes taken for a pixel of the given + * @format. + */ +int +_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format); + +/* + * _cogl_pixel_format_has_aligned_components: + * @format: a #CoglPixelFormat + * + * Queries whether the ordering of the components for the given + * @format depend on the endianness of the host CPU or if the + * components can be accessed using bit shifting and bitmasking by + * loading a whole pixel into a word. + * + * XXX: If we ever consider making something like this public we + * should really try to think of a better name and come up with + * much clearer documentation since it really depends on what + * point of view you consider this from whether a format like + * COGL_PIXEL_FORMAT_RGBA_8888 is endian dependent. E.g. If you + * read an RGBA_8888 pixel into a uint32 + * it's endian dependent how you mask out the different channels. + * But If you already have separate color components and you want + * to write them to an RGBA_8888 pixel then the bytes can be + * written sequentially regardless of the endianness. + * + * Return value: %TRUE if you need to consider the host CPU + * endianness when dealing with the given @format + * else %FALSE. + */ +CoglBool +_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format); + +/* + * COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format): + * @format: a #CoglPixelFormat + * + * Returns TRUE if the pixel format can take a premult bit. This is + * currently true for all formats that have an alpha channel except + * COGL_PIXEL_FORMAT_A_8 (because that doesn't have any other + * components to multiply by the alpha). + */ +#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \ + (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8) + +COGL_END_DECLS + +#endif /* __COGL_PRIVATE_H__ */ diff --git a/cogl/cogl-profile.c b/cogl/cogl-profile.c new file mode 100644 index 0000000..ce687a2 --- /dev/null +++ b/cogl/cogl-profile.c @@ -0,0 +1,126 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef COGL_ENABLE_PROFILE + +#include "cogl-profile.h" +#include "cogl-debug.h" +#include "cogl-i18n-private.h" + +#include + +UProfContext *_cogl_uprof_context; + +static CoglBool +debug_option_getter (void *user_data) +{ + unsigned int shift = GPOINTER_TO_UINT (user_data); + return COGL_DEBUG_ENABLED (shift); +} + +static void +debug_option_setter (CoglBool value, void *user_data) +{ + unsigned int shift = GPOINTER_TO_UINT (user_data); + + if (value) + COGL_DEBUG_SET_FLAG (shift); + else + COGL_DEBUG_CLEAR_FLAG (shift); +} + +static void +print_exit_report (void) +{ + if (getenv ("COGL_PROFILE_OUTPUT_REPORT")) + { + UProfContext *mainloop_context; + UProfTimerResult *mainloop_timer; + UProfReport *report; + + /* NB: uprof provides a shared context for mainloop statistics + * which needs to be setup by the application which controls the + * mainloop. + * + * If no "Mainloop" timer has been setup then we print a warning + * since we can't provide a meaningful Cogl report without one. + */ + mainloop_context = uprof_get_mainloop_context (); + mainloop_timer = uprof_context_get_timer_result (mainloop_context, + "Mainloop"); + /* just bail out if the mainloop timer wasn't hit */ + if (!mainloop_timer) + { + g_warning ("\n\n" + "No UProf \"Mainloop\" timer was setup by the " + "application therefore we\ncan't provide a meaningful " + "profile report.\n" + "\n" + "This should be done automatically if you are using Clutter " + "(if\nbuilt with --enable-profile)\n" + "\n" + "If you aren't using Clutter then you can declare a " + "\"Mainloop\" UProf\ntimer in your application like this:\n\n" + " UPROF_STATIC_TIMER (mainloop_timer, \n" + " NULL,\n" + " \"Mainloop\",\n" + " \"Time in glib mainloop\",\n" + " 0);\n" + "\n" + "And start/stop it around your mainloop like this:\n" + "\n" + " UPROF_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);\n" + " g_main_loop_run (loop);\n" + " UPROF_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer);\n"); + return; + } + + report = uprof_report_new ("Cogl report"); + uprof_report_add_context (report, _cogl_uprof_context); + uprof_report_print (report); + uprof_report_unref (report); + } + uprof_context_unref (_cogl_uprof_context); +} + +void +_cogl_uprof_init (void) +{ + _cogl_uprof_context = uprof_context_new ("Cogl"); + uprof_context_link (_cogl_uprof_context, uprof_get_mainloop_context ()); +#define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \ + G_STMT_START { \ + int shift = COGL_DEBUG_ ## MASK_NAME; \ + uprof_context_add_boolean_option (_cogl_uprof_context, \ + g_dgettext (GETTEXT_PACKAGE, GROUP), \ + NAME, \ + g_dgettext (GETTEXT_PACKAGE, \ + NAME_FORMATTED), \ + g_dgettext (GETTEXT_PACKAGE, \ + DESCRIPTION), \ + debug_option_getter, \ + debug_option_setter, \ + GUINT_TO_POINTER (shift)); \ + } G_STMT_END; + +#include "cogl-debug-options.h" +#undef OPT + + atexit (print_exit_report); +} + +void +_cogl_profile_trace_message (const char *format, ...) +{ + va_list ap; + + va_start (ap, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, ap); + va_end (ap); + + if (_cogl_uprof_context) + uprof_context_vtrace_message (_cogl_uprof_context, format, ap); +} + +#endif diff --git a/cogl/cogl-profile.h b/cogl/cogl-profile.h new file mode 100644 index 0000000..db95647 --- /dev/null +++ b/cogl/cogl-profile.h @@ -0,0 +1,68 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PROFILE_H__ +#define __COGL_PROFILE_H__ + + +#ifdef COGL_ENABLE_PROFILE + +#include + +extern UProfContext *_cogl_uprof_context; + +#define COGL_STATIC_TIMER UPROF_STATIC_TIMER +#define COGL_STATIC_COUNTER UPROF_STATIC_COUNTER +#define COGL_COUNTER_INC UPROF_COUNTER_INC +#define COGL_COUNTER_DEC UPROF_COUNTER_DEC +#define COGL_TIMER_START UPROF_TIMER_START +#define COGL_TIMER_STOP UPROF_TIMER_STOP + +void +_cogl_uprof_init (void); + +void +_cogl_profile_trace_message (const char *format, ...); + +#else + +#define COGL_STATIC_TIMER(A,B,C,D,E) extern void _cogl_dummy_decl (void) +#define COGL_STATIC_COUNTER(A,B,C,D) extern void _cogl_dummy_decl (void) +#define COGL_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END +#define COGL_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END +#define COGL_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END +#define COGL_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END + +#define _cogl_profile_trace_message g_message + +#endif + +#endif /* __COGL_PROFILE_H__ */ + diff --git a/cogl/cogl-quaternion-private.h b/cogl/cogl-quaternion-private.h new file mode 100644 index 0000000..eda672e --- /dev/null +++ b/cogl/cogl-quaternion-private.h @@ -0,0 +1,44 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_QUATERNION_PRIVATE_H__ +#define __COGL_QUATERNION_PRIVATE_H__ + +#include + +/* squared length */ +#define _COGL_QUATERNION_NORM(Q) \ + ((Q)->x*(Q)->x + (Q)->y*(Q)->y + (Q)->z*(Q)->z + (Q)->w*(Q)->w) + +#define _COGL_QUATERNION_DEGREES_TO_RADIANS (G_PI / 180.0f) +#define _COGL_QUATERNION_RADIANS_TO_DEGREES (180.0f / G_PI) + +#endif /* __COGL_QUATERNION_PRIVATE_H__ */ diff --git a/cogl/cogl-quaternion.c b/cogl/cogl-quaternion.c new file mode 100644 index 0000000..9567443 --- /dev/null +++ b/cogl/cogl-quaternion.c @@ -0,0 +1,673 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + * Various references relating to quaternions: + * + * http://www.cs.caltech.edu/courses/cs171/quatut.pdf + * http://mathworld.wolfram.com/Quaternion.html + * http://www.gamedev.net/reference/articles/article1095.asp + * http://www.cprogramming.com/tutorial/3d/quaternions.html + * http://www.isner.com/tutorials/quatSpells/quaternion_spells_12.htm + * http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56 + * 3D Maths Primer for Graphics and Game Development ISBN-10: 1556229119 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include "cogl-gtype-private.h" + +#include +#include + +#define FLOAT_EPSILON 1e-03 + +COGL_GTYPE_DEFINE_BOXED (Quaternion, quaternion, + cogl_quaternion_copy, + cogl_quaternion_free); + +static CoglQuaternion zero_quaternion = +{ + 0.0, 0.0, 0.0, 0.0, +}; + +static CoglQuaternion identity_quaternion = +{ + 1.0, 0.0, 0.0, 0.0, +}; + +/* This function is just here to be called from GDB so we don't really + want to put a declaration in a header and we just add it here to + avoid a warning */ +void +_cogl_quaternion_print (CoglQuaternion *quarternion); + +void +_cogl_quaternion_print (CoglQuaternion *quaternion) +{ + g_print ("[ %6.4f (%6.4f, %6.4f, %6.4f)]\n", + quaternion->w, + quaternion->x, + quaternion->y, + quaternion->z); +} + +void +cogl_quaternion_init (CoglQuaternion *quaternion, + float angle, + float x, + float y, + float z) +{ + float axis[3] = { x, y, z}; + cogl_quaternion_init_from_angle_vector (quaternion, angle, axis); +} + +void +cogl_quaternion_init_from_angle_vector (CoglQuaternion *quaternion, + float angle, + const float *axis3f_in) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + float axis[3]; + float half_angle; + float sin_half_angle; + + /* XXX: Should we make cogl_vector3_normalize have separate in and + * out args? */ + axis[0] = axis3f_in[0]; + axis[1] = axis3f_in[1]; + axis[2] = axis3f_in[2]; + cogl_vector3_normalize (axis); + + half_angle = angle * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f; + sin_half_angle = sinf (half_angle); + + quaternion->w = cosf (half_angle); + + quaternion->x = axis[0] * sin_half_angle; + quaternion->y = axis[1] * sin_half_angle; + quaternion->z = axis[2] * sin_half_angle; + + cogl_quaternion_normalize (quaternion); +} + +void +cogl_quaternion_init_identity (CoglQuaternion *quaternion) +{ + quaternion->w = 1.0; + + quaternion->x = 0.0; + quaternion->y = 0.0; + quaternion->z = 0.0; +} + +void +cogl_quaternion_init_from_array (CoglQuaternion *quaternion, + const float *array) +{ + quaternion->w = array[0]; + quaternion->x = array[1]; + quaternion->y = array[2]; + quaternion->z = array[3]; +} + +void +cogl_quaternion_init_from_x_rotation (CoglQuaternion *quaternion, + float angle) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + float half_angle = angle * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f; + + quaternion->w = cosf (half_angle); + + quaternion->x = sinf (half_angle); + quaternion->y = 0.0f; + quaternion->z = 0.0f; +} + +void +cogl_quaternion_init_from_y_rotation (CoglQuaternion *quaternion, + float angle) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + float half_angle = angle * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f; + + quaternion->w = cosf (half_angle); + + quaternion->x = 0.0f; + quaternion->y = sinf (half_angle); + quaternion->z = 0.0f; +} + +void +cogl_quaternion_init_from_z_rotation (CoglQuaternion *quaternion, + float angle) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + float half_angle = angle * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f; + + quaternion->w = cosf (half_angle); + + quaternion->x = 0.0f; + quaternion->y = 0.0f; + quaternion->z = sinf (half_angle); +} + +void +cogl_quaternion_init_from_euler (CoglQuaternion *quaternion, + const CoglEuler *euler) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + float sin_heading = + sinf (euler->heading * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + float sin_pitch = + sinf (euler->pitch * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + float sin_roll = + sinf (euler->roll * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + float cos_heading = + cosf (euler->heading * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + float cos_pitch = + cosf (euler->pitch * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + float cos_roll = + cosf (euler->roll * _COGL_QUATERNION_DEGREES_TO_RADIANS * 0.5f); + + quaternion->w = + cos_heading * cos_pitch * cos_roll + + sin_heading * sin_pitch * sin_roll; + + quaternion->x = + cos_heading * sin_pitch * cos_roll + + sin_heading * cos_pitch * sin_roll; + quaternion->y = + sin_heading * cos_pitch * cos_roll - + cos_heading * sin_pitch * sin_roll; + quaternion->z = + cos_heading * cos_pitch * sin_roll - + sin_heading * sin_pitch * cos_roll; +} + +void +cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion, + CoglQuaternion *src) +{ + memcpy (quaternion, src, sizeof (float) * 4); +} + +/* XXX: it could be nice to make something like this public... */ +/* + * COGL_MATRIX_READ: + * @MATRIX: A 4x4 transformation matrix + * @ROW: The row of the value you want to read + * @COLUMN: The column of the value you want to read + * + * Reads a value from the given matrix using integers to index + * into the matrix. + */ +#define COGL_MATRIX_READ(MATRIX, ROW, COLUMN) \ + (((const float *)matrix)[COLUMN * 4 + ROW]) + +void +cogl_quaternion_init_from_matrix (CoglQuaternion *quaternion, + const CoglMatrix *matrix) +{ + /* Algorithm devised by Ken Shoemake, Ref: + * http://campar.in.tum.de/twiki/pub/Chair/DwarfTutorial/quatut.pdf + */ + + /* 3D maths literature refers to the diagonal of a matrix as the + * "trace" of a matrix... */ + float trace = matrix->xx + matrix->yy + matrix->zz; + float root; + + if (trace > 0.0f) + { + root = sqrtf (trace + 1); + quaternion->w = root * 0.5f; + root = 0.5f / root; + quaternion->x = (matrix->zy - matrix->yz) * root; + quaternion->y = (matrix->xz - matrix->zx) * root; + quaternion->z = (matrix->yx - matrix->xy) * root; + } + else + { +#define X 0 +#define Y 1 +#define Z 2 +#define W 3 + int h = X; + if (matrix->yy > matrix->xx) + h = Y; + if (matrix->zz > COGL_MATRIX_READ (matrix, h, h)) + h = Z; + switch (h) + { +#define CASE_MACRO(i, j, k, I, J, K) \ + case I: \ + root = sqrtf ((COGL_MATRIX_READ (matrix, I, I) - \ + (COGL_MATRIX_READ (matrix, J, J) + \ + COGL_MATRIX_READ (matrix, K, K))) + \ + COGL_MATRIX_READ (matrix, W, W)); \ + quaternion->i = root * 0.5f;\ + root = 0.5f / root;\ + quaternion->j = (COGL_MATRIX_READ (matrix, I, J) + \ + COGL_MATRIX_READ (matrix, J, I)) * root; \ + quaternion->k = (COGL_MATRIX_READ (matrix, K, I) + \ + COGL_MATRIX_READ (matrix, I, K)) * root; \ + quaternion->w = (COGL_MATRIX_READ (matrix, K, J) - \ + COGL_MATRIX_READ (matrix, J, K)) * root;\ + break + CASE_MACRO (x, y, z, X, Y, Z); + CASE_MACRO (y, z, x, Y, Z, X); + CASE_MACRO (z, x, y, Z, X, Y); +#undef CASE_MACRO +#undef X +#undef Y +#undef Z + } + } + + if (matrix->ww != 1.0f) + { + float s = 1.0 / sqrtf (matrix->ww); + quaternion->w *= s; + quaternion->x *= s; + quaternion->y *= s; + quaternion->z *= s; + } +} + +CoglBool +cogl_quaternion_equal (const void *v1, const void *v2) +{ + const CoglQuaternion *a = v1; + const CoglQuaternion *b = v2; + + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + if (v1 == v2) + return TRUE; + + return (a->w == b->w && + a->x == b->x && + a->y == b->y && + a->z == b->z); +} + +CoglQuaternion * +cogl_quaternion_copy (const CoglQuaternion *src) +{ + if (G_LIKELY (src)) + { + CoglQuaternion *new = g_slice_new (CoglQuaternion); + memcpy (new, src, sizeof (float) * 4); + return new; + } + else + return NULL; +} + +void +cogl_quaternion_free (CoglQuaternion *quaternion) +{ + g_slice_free (CoglQuaternion, quaternion); +} + +float +cogl_quaternion_get_rotation_angle (const CoglQuaternion *quaternion) +{ + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + + /* FIXME: clamp [-1, 1] */ + return 2.0f * acosf (quaternion->w) * _COGL_QUATERNION_RADIANS_TO_DEGREES; +} + +void +cogl_quaternion_get_rotation_axis (const CoglQuaternion *quaternion, + float *vector3) +{ + float sin_half_angle_sqr; + float one_over_sin_angle_over_2; + + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + + /* NB: sin²(𝜃) + cos²(𝜃) = 1 */ + + sin_half_angle_sqr = 1.0f - quaternion->w * quaternion->w; + + if (sin_half_angle_sqr <= 0.0f) + { + /* Either an identity quaternion or numerical imprecision. + * Either way we return an arbitrary vector. */ + vector3[0] = 1; + vector3[1] = 0; + vector3[2] = 0; + return; + } + + /* Calculate 1 / sin(𝜃/2) */ + one_over_sin_angle_over_2 = 1.0f / sqrtf (sin_half_angle_sqr); + + vector3[0] = quaternion->x * one_over_sin_angle_over_2; + vector3[1] = quaternion->y * one_over_sin_angle_over_2; + vector3[2] = quaternion->z * one_over_sin_angle_over_2; +} + +void +cogl_quaternion_normalize (CoglQuaternion *quaternion) +{ + float slen = _COGL_QUATERNION_NORM (quaternion); + float factor = 1.0f / sqrtf (slen); + + quaternion->x *= factor; + quaternion->y *= factor; + quaternion->z *= factor; + + quaternion->w *= factor; + + return; +} + +float +cogl_quaternion_dot_product (const CoglQuaternion *a, + const CoglQuaternion *b) +{ + return a->w * b->w + a->x * b->x + a->y * b->y + a->z * b->z; +} + +void +cogl_quaternion_invert (CoglQuaternion *quaternion) +{ + quaternion->x = -quaternion->x; + quaternion->y = -quaternion->y; + quaternion->z = -quaternion->z; +} + +void +cogl_quaternion_multiply (CoglQuaternion *result, + const CoglQuaternion *a, + const CoglQuaternion *b) +{ + float w = a->w; + float x = a->x; + float y = a->y; + float z = a->z; + + _COGL_RETURN_IF_FAIL (b != result); + + result->w = w * b->w - x * b->x - y * b->y - z * b->z; + + result->x = w * b->x + x * b->w + y * b->z - z * b->y; + result->y = w * b->y + y * b->w + z * b->x - x * b->z; + result->z = w * b->z + z * b->w + x * b->y - y * b->x; +} + +void +cogl_quaternion_pow (CoglQuaternion *quaternion, float exponent) +{ + float half_angle; + float new_half_angle; + float factor; + + /* Try and identify and nop identity quaternions to avoid + * dividing by zero */ + if (fabs (quaternion->w) > 0.9999f) + return; + + /* NB: We are using quaternions to represent an axis (a), angle (𝜃) pair + * in this form: + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + */ + + /* FIXME: clamp [-1, 1] */ + /* Extract 𝜃/2 from w */ + half_angle = acosf (quaternion->w); + + /* Compute the new 𝜃/2 */ + new_half_angle = half_angle * exponent; + + /* Compute the new w value */ + quaternion->w = cosf (new_half_angle); + + /* And new xyz values */ + factor = sinf (new_half_angle) / sinf (half_angle); + quaternion->x *= factor; + quaternion->y *= factor; + quaternion->z *= factor; +} + +void +cogl_quaternion_slerp (CoglQuaternion *result, + const CoglQuaternion *a, + const CoglQuaternion *b, + float t) +{ + float cos_difference; + float qb_w; + float qb_x; + float qb_y; + float qb_z; + float fa; + float fb; + + _COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f); + + if (t == 0) + { + *result = *a; + return; + } + else if (t == 1) + { + *result = *b; + return; + } + + /* compute the cosine of the angle between the two given quaternions */ + cos_difference = cogl_quaternion_dot_product (a, b); + + /* If negative, use -b. Two quaternions q and -q represent the same angle but + * may produce a different slerp. We choose b or -b to rotate using the acute + * angle. + */ + if (cos_difference < 0.0f) + { + qb_w = -b->w; + qb_x = -b->x; + qb_y = -b->y; + qb_z = -b->z; + cos_difference = -cos_difference; + } + else + { + qb_w = b->w; + qb_x = b->x; + qb_y = b->y; + qb_z = b->z; + } + + /* If we have two unit quaternions the dot should be <= 1.0 */ + g_assert (cos_difference < 1.1f); + + + /* Determine the interpolation factors for each quaternion, simply using + * linear interpolation for quaternions that are nearly exactly the same. + * (this will avoid divisions by zero) + */ + + if (cos_difference > 0.9999f) + { + fa = 1.0f - t; + fb = t; + + /* XXX: should we also normalize() at the end in this case? */ + } + else + { + /* Calculate the sin of the angle between the two quaternions using the + * trig identity: sin²(𝜃) + cos²(𝜃) = 1 + */ + float sin_difference = sqrtf (1.0f - cos_difference * cos_difference); + + float difference = atan2f (sin_difference, cos_difference); + float one_over_sin_difference = 1.0f / sin_difference; + fa = sinf ((1.0f - t) * difference) * one_over_sin_difference; + fb = sinf (t * difference) * one_over_sin_difference; + } + + /* Finally interpolate the two quaternions */ + + result->x = fa * a->x + fb * qb_x; + result->y = fa * a->y + fb * qb_y; + result->z = fa * a->z + fb * qb_z; + result->w = fa * a->w + fb * qb_w; +} + +void +cogl_quaternion_nlerp (CoglQuaternion *result, + const CoglQuaternion *a, + const CoglQuaternion *b, + float t) +{ + float cos_difference; + float qb_w; + float qb_x; + float qb_y; + float qb_z; + float fa; + float fb; + + _COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f); + + if (t == 0) + { + *result = *a; + return; + } + else if (t == 1) + { + *result = *b; + return; + } + + /* compute the cosine of the angle between the two given quaternions */ + cos_difference = cogl_quaternion_dot_product (a, b); + + /* If negative, use -b. Two quaternions q and -q represent the same angle but + * may produce a different slerp. We choose b or -b to rotate using the acute + * angle. + */ + if (cos_difference < 0.0f) + { + qb_w = -b->w; + qb_x = -b->x; + qb_y = -b->y; + qb_z = -b->z; + cos_difference = -cos_difference; + } + else + { + qb_w = b->w; + qb_x = b->x; + qb_y = b->y; + qb_z = b->z; + } + + /* If we have two unit quaternions the dot should be <= 1.0 */ + g_assert (cos_difference < 1.1f); + + fa = 1.0f - t; + fb = t; + + result->x = fa * a->x + fb * qb_x; + result->y = fa * a->y + fb * qb_y; + result->z = fa * a->z + fb * qb_z; + result->w = fa * a->w + fb * qb_w; + + cogl_quaternion_normalize (result); +} + +void +cogl_quaternion_squad (CoglQuaternion *result, + const CoglQuaternion *prev, + const CoglQuaternion *a, + const CoglQuaternion *b, + const CoglQuaternion *next, + float t) +{ + CoglQuaternion slerp0; + CoglQuaternion slerp1; + + cogl_quaternion_slerp (&slerp0, a, b, t); + cogl_quaternion_slerp (&slerp1, prev, next, t); + cogl_quaternion_slerp (result, &slerp0, &slerp1, 2.0f * t * (1.0f - t)); +} + +const CoglQuaternion * +cogl_get_static_identity_quaternion (void) +{ + return &identity_quaternion; +} + +const CoglQuaternion * +cogl_get_static_zero_quaternion (void) +{ + return &zero_quaternion; +} + diff --git a/cogl/cogl-quaternion.h b/cogl/cogl-quaternion.h new file mode 100644 index 0000000..c70ecca --- /dev/null +++ b/cogl/cogl-quaternion.h @@ -0,0 +1,564 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_QUATERNION_H__ +#define __COGL_QUATERNION_H__ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-quaternion + * @short_description: Functions for initializing and manipulating + * quaternions. + * + * Quaternions have become a standard form for representing 3D + * rotations and have some nice properties when compared with other + * representation such as (roll,pitch,yaw) Euler angles. They can be + * used to interpolate between different rotations and they don't + * suffer from a problem called + * "Gimbal lock" + * where two of the axis of rotation may become aligned and you loose a + * degree of freedom. + * . + */ +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +/** + * CoglQuaternion: + * @w: based on the angle of rotation it is cos(𝜃/2) + * @x: based on the angle of rotation and x component of the axis of + * rotation it is sin(𝜃/2)*axis.x + * @y: based on the angle of rotation and y component of the axis of + * rotation it is sin(𝜃/2)*axis.y + * @z: based on the angle of rotation and z component of the axis of + * rotation it is sin(𝜃/2)*axis.z + * + * A quaternion is comprised of a scalar component and a 3D vector + * component. The scalar component is normally referred to as w and the + * vector might either be referred to as v or a (for axis) or expanded + * with the individual components: (x, y, z) A full quaternion would + * then be written as [w (x, y, z)]. + * + * Quaternions can be considered to represent an axis and angle + * pair although sadly these numbers are buried somewhat under some + * maths... + * + * For the curious you can see here that a given axis (a) and angle (𝜃) + * pair are represented in a quaternion as follows: + * |[ + * [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )] + * ]| + * + * Unit Quaternions: + * When using Quaternions to represent spatial orientations for 3D + * graphics it's always assumed you have a unit quaternion. The + * magnitude of a quaternion is defined as: + * |[ + * sqrt (w² + x² + y² + z²) + * ]| + * and a unit quaternion satisfies this equation: + * |[ + * w² + x² + y² + z² = 1 + * ]| + * + * Thankfully most of the time we don't actually have to worry about + * the maths that goes on behind the scenes but if you are curious to + * learn more here are some external references: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * 3D Maths Primer for Graphics and Game Development ISBN-10: 1556229119 + * + * + * + * + * + * + * + * + * + */ +struct _CoglQuaternion +{ + /*< public >*/ + float w; + + float x; + float y; + float z; + + /*< private >*/ + float padding0; + float padding1; + float padding2; + float padding3; +}; +COGL_STRUCT_SIZE_ASSERT (CoglQuaternion, 32); + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_quaternion_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_quaternion_get_gtype (void); +#endif + +/** + * cogl_quaternion_init: + * @quaternion: An uninitialized #CoglQuaternion + * @angle: The angle you want to rotate around the given axis + * @x: The x component of your axis vector about which you want to + * rotate. + * @y: The y component of your axis vector about which you want to + * rotate. + * @z: The z component of your axis vector about which you want to + * rotate. + * + * Initializes a quaternion that rotates @angle degrees around the + * axis vector (@x, @y, @z). The axis vector does not need to be + * normalized. + * + * Returns: A normalized, unit quaternion representing an orientation + * rotated @angle degrees around the axis vector (@x, @y, @z) + * + * Since: 2.0 + */ +void +cogl_quaternion_init (CoglQuaternion *quaternion, + float angle, + float x, + float y, + float z); + +/** + * cogl_quaternion_init_from_angle_vector: + * @quaternion: An uninitialized #CoglQuaternion + * @angle: The angle to rotate around @axis3f + * @axis3f: your 3 component axis vector about which you want to rotate. + * + * Initializes a quaternion that rotates @angle degrees around the + * given @axis vector. The axis vector does not need to be + * normalized. + * + * Returns: A normalized, unit quaternion representing an orientation + * rotated @angle degrees around the given @axis vector. + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_angle_vector (CoglQuaternion *quaternion, + float angle, + const float *axis3f); + +/** + * cogl_quaternion_init_identity: + * @quaternion: An uninitialized #CoglQuaternion + * + * Initializes the quaternion with the canonical quaternion identity + * [1 (0, 0, 0)] which represents no rotation. Multiplying a + * quaternion with this identity leaves the quaternion unchanged. + * + * You might also want to consider using + * cogl_get_static_identity_quaternion(). + * + * Since: 2.0 + */ +void +cogl_quaternion_init_identity (CoglQuaternion *quaternion); + +/** + * cogl_quaternion_init_from_array: + * @quaternion: A #CoglQuaternion + * @array: An array of 4 floats w,(x,y,z) + * + * Initializes a [w (x, y,z)] quaternion directly from an array of 4 + * floats: [w,x,y,z]. + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_array (CoglQuaternion *quaternion, + const float *array); + +/** + * cogl_quaternion_init_from_x_rotation: + * @quaternion: An uninitialized #CoglQuaternion + * @angle: The angle to rotate around the x axis + * + * XXX: check which direction this rotates + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_x_rotation (CoglQuaternion *quaternion, + float angle); + +/** + * cogl_quaternion_init_from_y_rotation: + * @quaternion: An uninitialized #CoglQuaternion + * @angle: The angle to rotate around the y axis + * + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_y_rotation (CoglQuaternion *quaternion, + float angle); + +/** + * cogl_quaternion_init_from_z_rotation: + * @quaternion: An uninitialized #CoglQuaternion + * @angle: The angle to rotate around the z axis + * + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_z_rotation (CoglQuaternion *quaternion, + float angle); + +/** + * cogl_quaternion_init_from_euler: + * @quaternion: A #CoglQuaternion + * @euler: A #CoglEuler with which to initialize the quaternion + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_euler (CoglQuaternion *quaternion, + const CoglEuler *euler); + +/** + * cogl_quaternion_init_from_quaternion: + * @quaternion: A #CoglQuaternion + * @src: A #CoglQuaternion with which to initialize @quaternion + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion, + CoglQuaternion *src); + +/** + * cogl_quaternion_init_from_matrix: + * @quaternion: A Cogl Quaternion + * @matrix: A rotation matrix with which to initialize the quaternion + * + * Initializes a quaternion from a rotation matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_quaternion_init_from_matrix (CoglQuaternion *quaternion, + const CoglMatrix *matrix); + +/** + * cogl_quaternion_equal: + * @v1: A #CoglQuaternion + * @v2: A #CoglQuaternion + * + * Compares that all the components of quaternions @a and @b are + * equal. + * + * An epsilon value is not used to compare the float components, but + * the == operator is at least used so that 0 and -0 are considered + * equal. + * + * Returns: %TRUE if the quaternions are equal else %FALSE. + * + * Since: 2.0 + */ +CoglBool +cogl_quaternion_equal (const void *v1, const void *v2); + +/** + * cogl_quaternion_copy: + * @src: A #CoglQuaternion + * + * Allocates a new #CoglQuaternion on the stack and initializes it with + * the same values as @src. + * + * Returns: A newly allocated #CoglQuaternion which should be freed + * using cogl_quaternion_free() + * + * Since: 2.0 + */ +CoglQuaternion * +cogl_quaternion_copy (const CoglQuaternion *src); + +/** + * cogl_quaternion_free: + * @quaternion: A #CoglQuaternion + * + * Frees a #CoglQuaternion that was previously allocated via + * cogl_quaternion_copy(). + * + * Since: 2.0 + */ +void +cogl_quaternion_free (CoglQuaternion *quaternion); + +/** + * cogl_quaternion_get_rotation_angle: + * @quaternion: A #CoglQuaternion + * + * + * Since: 2.0 + */ +float +cogl_quaternion_get_rotation_angle (const CoglQuaternion *quaternion); + +/** + * cogl_quaternion_get_rotation_axis: + * @quaternion: A #CoglQuaternion + * @vector3: (out): an allocated 3-float array + * + * Since: 2.0 + */ +void +cogl_quaternion_get_rotation_axis (const CoglQuaternion *quaternion, + float *vector3); + +/** + * cogl_quaternion_normalize: + * @quaternion: A #CoglQuaternion + * + * + * Since: 2.0 + */ +void +cogl_quaternion_normalize (CoglQuaternion *quaternion); + +/** + * cogl_quaternion_dot_product: + * @a: A #CoglQuaternion + * @b: A #CoglQuaternion + * + * Since: 2.0 + */ +float +cogl_quaternion_dot_product (const CoglQuaternion *a, + const CoglQuaternion *b); + +/** + * cogl_quaternion_invert: + * @quaternion: A #CoglQuaternion + * + * + * Since: 2.0 + */ +void +cogl_quaternion_invert (CoglQuaternion *quaternion); + +/** + * cogl_quaternion_multiply: + * @result: The destination #CoglQuaternion + * @left: The second #CoglQuaternion rotation to apply + * @right: The first #CoglQuaternion rotation to apply + * + * This combines the rotations of two quaternions into @result. The + * operation is not commutative so the order is important because AxB + * != BxA. Cogl follows the standard convention for quaternions here + * so the rotations are applied @right to @left. This is similar to the + * combining of matrices. + * + * It is possible to multiply the @a quaternion in-place, so + * @result can be equal to @a but can't be equal to @b. + * + * Since: 2.0 + */ +void +cogl_quaternion_multiply (CoglQuaternion *result, + const CoglQuaternion *left, + const CoglQuaternion *right); + +/** + * cogl_quaternion_pow: + * @quaternion: A #CoglQuaternion + * @exponent: the exponent + * + * + * Since: 2.0 + */ +void +cogl_quaternion_pow (CoglQuaternion *quaternion, float exponent); + +/** + * cogl_quaternion_slerp: + * @result: The destination #CoglQuaternion + * @a: The first #CoglQuaternion + * @b: The second #CoglQuaternion + * @t: The factor in the range [0,1] used to interpolate between + * quaternion @a and @b. + * + * Performs a spherical linear interpolation between two quaternions. + * + * Noteable properties: + * + * + * commutative: No + * + * + * constant velocity: Yes + * + * + * torque minimal (travels along the surface of the 4-sphere): Yes + * + * + * more expensive than cogl_quaternion_nlerp() + * + * + */ +void +cogl_quaternion_slerp (CoglQuaternion *result, + const CoglQuaternion *a, + const CoglQuaternion *b, + float t); + +/** + * cogl_quaternion_nlerp: + * @result: The destination #CoglQuaternion + * @a: The first #CoglQuaternion + * @b: The second #CoglQuaternion + * @t: The factor in the range [0,1] used to interpolate between + * quaterion @a and @b. + * + * Performs a normalized linear interpolation between two quaternions. + * That is it does a linear interpolation of the quaternion components + * and then normalizes the result. This will follow the shortest arc + * between the two orientations (just like the slerp() function) but + * will not progress at a constant speed. Unlike slerp() nlerp is + * commutative which is useful if you are blending animations + * together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp, + * d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp, + * b)). Finally nlerp is cheaper than slerp so it can be a good choice + * if you don't need the constant speed property of the slerp() function. + * + * Notable properties: + * + * + * commutative: Yes + * + * + * constant velocity: No + * + * + * torque minimal (travels along the surface of the 4-sphere): Yes + * + * + * faster than cogl_quaternion_slerp() + * + * + */ +void +cogl_quaternion_nlerp (CoglQuaternion *result, + const CoglQuaternion *a, + const CoglQuaternion *b, + float t); +/** + * cogl_quaternion_squad: + * @result: The destination #CoglQuaternion + * @prev: A #CoglQuaternion used before @a + * @a: The first #CoglQuaternion + * @b: The second #CoglQuaternion + * @next: A #CoglQuaternion that will be used after @b + * @t: The factor in the range [0,1] used to interpolate between + * quaternion @a and @b. + * + * + * Since: 2.0 + */ +void +cogl_quaternion_squad (CoglQuaternion *result, + const CoglQuaternion *prev, + const CoglQuaternion *a, + const CoglQuaternion *b, + const CoglQuaternion *next, + float t); + +/** + * cogl_get_static_identity_quaternion: + * + * Returns a pointer to a singleton quaternion constant describing the + * canonical identity [1 (0, 0, 0)] which represents no rotation. + * + * If you multiply a quaternion with the identity quaternion you will + * get back the same value as the original quaternion. + * + * Returns: A pointer to an identity quaternion + * + * Since: 2.0 + */ +const CoglQuaternion * +cogl_get_static_identity_quaternion (void); + +/** + * cogl_get_static_zero_quaternion: + * + * Returns: a pointer to a singleton quaternion constant describing a + * rotation of 180 degrees around a degenerate axis: + * [0 (0, 0, 0)] + * + * Since: 2.0 + */ +const CoglQuaternion * +cogl_get_static_zero_quaternion (void); + +COGL_END_DECLS + +#endif /* __COGL_QUATERNION_H__ */ + diff --git a/cogl/cogl-rectangle-map.c b/cogl/cogl-rectangle-map.c new file mode 100644 index 0000000..69368ee --- /dev/null +++ b/cogl/cogl-rectangle-map.c @@ -0,0 +1,764 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-rectangle-map.h" +#include "cogl-debug.h" + +/* Implements a data structure which keeps track of unused + sub-rectangles within a larger rectangle using a binary tree + structure. The algorithm for this is based on the description here: + + http://www.blackpawn.com/texts/lightmaps/default.html +*/ + +#if defined (COGL_ENABLE_DEBUG) && defined (HAVE_CAIRO) + +/* The cairo header is only used for debugging to generate an image of + the atlas */ +#include + +static void _cogl_rectangle_map_dump_image (CoglRectangleMap *map); + +#endif /* COGL_ENABLE_DEBUG && HAVE_CAIRO */ + +typedef struct _CoglRectangleMapNode CoglRectangleMapNode; +typedef struct _CoglRectangleMapStackEntry CoglRectangleMapStackEntry; + +typedef void (* CoglRectangleMapInternalForeachCb) (CoglRectangleMapNode *node, + void *data); + +typedef enum +{ + COGL_RECTANGLE_MAP_BRANCH, + COGL_RECTANGLE_MAP_FILLED_LEAF, + COGL_RECTANGLE_MAP_EMPTY_LEAF +} CoglRectangleMapNodeType; + +struct _CoglRectangleMap +{ + CoglRectangleMapNode *root; + + unsigned int n_rectangles; + + unsigned int space_remaining; + + GDestroyNotify value_destroy_func; + + /* Stack used for walking the structure. This is only used during + the lifetime of a single function call but it is kept here as an + optimisation to avoid reallocating it every time it is needed */ + GArray *stack; +}; + +struct _CoglRectangleMapNode +{ + CoglRectangleMapNodeType type; + + CoglRectangleMapEntry rectangle; + + unsigned int largest_gap; + + CoglRectangleMapNode *parent; + + union + { + /* Fields used when this is a branch */ + struct + { + CoglRectangleMapNode *left; + CoglRectangleMapNode *right; + } branch; + + /* Field used when this is a filled leaf */ + void *data; + } d; +}; + +struct _CoglRectangleMapStackEntry +{ + /* The node to search */ + CoglRectangleMapNode *node; + /* Index of next branch of this node to explore. Basically either 0 + to go left or 1 to go right */ + CoglBool next_index; +}; + +static CoglRectangleMapNode * +_cogl_rectangle_map_node_new (void) +{ + return g_slice_new (CoglRectangleMapNode); +} + +static void +_cogl_rectangle_map_node_free (CoglRectangleMapNode *node) +{ + g_slice_free (CoglRectangleMapNode, node); +} + +CoglRectangleMap * +_cogl_rectangle_map_new (unsigned int width, + unsigned int height, + GDestroyNotify value_destroy_func) +{ + CoglRectangleMap *map = g_new (CoglRectangleMap, 1); + CoglRectangleMapNode *root = _cogl_rectangle_map_node_new (); + + root->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + root->parent = NULL; + root->rectangle.x = 0; + root->rectangle.y = 0; + root->rectangle.width = width; + root->rectangle.height = height; + root->largest_gap = width * height; + + map->root = root; + map->n_rectangles = 0; + map->value_destroy_func = value_destroy_func; + map->space_remaining = width * height; + + map->stack = g_array_new (FALSE, FALSE, sizeof (CoglRectangleMapStackEntry)); + + return map; +} + +static void +_cogl_rectangle_map_stack_push (GArray *stack, + CoglRectangleMapNode *node, + CoglBool next_index) +{ + CoglRectangleMapStackEntry *new_entry; + + g_array_set_size (stack, stack->len + 1); + + new_entry = &g_array_index (stack, CoglRectangleMapStackEntry, + stack->len - 1); + + new_entry->node = node; + new_entry->next_index = next_index; +} + +static void +_cogl_rectangle_map_stack_pop (GArray *stack) +{ + g_array_set_size (stack, stack->len - 1); +} + +static CoglRectangleMapStackEntry * +_cogl_rectangle_map_stack_get_top (GArray *stack) +{ + return &g_array_index (stack, CoglRectangleMapStackEntry, + stack->len - 1); +} + +static CoglRectangleMapNode * +_cogl_rectangle_map_node_split_horizontally (CoglRectangleMapNode *node, + unsigned int left_width) +{ + /* Splits the node horizontally (according to emacs' definition, not + vim) by converting it to a branch and adding two new leaf + nodes. The leftmost branch will have the width left_width and + will be returned. If the node is already just the right size it + won't do anything */ + + CoglRectangleMapNode *left_node, *right_node; + + if (node->rectangle.width == left_width) + return node; + + left_node = _cogl_rectangle_map_node_new (); + left_node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + left_node->parent = node; + left_node->rectangle.x = node->rectangle.x; + left_node->rectangle.y = node->rectangle.y; + left_node->rectangle.width = left_width; + left_node->rectangle.height = node->rectangle.height; + left_node->largest_gap = (left_node->rectangle.width * + left_node->rectangle.height); + node->d.branch.left = left_node; + + right_node = _cogl_rectangle_map_node_new (); + right_node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + right_node->parent = node; + right_node->rectangle.x = node->rectangle.x + left_width; + right_node->rectangle.y = node->rectangle.y; + right_node->rectangle.width = node->rectangle.width - left_width; + right_node->rectangle.height = node->rectangle.height; + right_node->largest_gap = (right_node->rectangle.width * + right_node->rectangle.height); + node->d.branch.right = right_node; + + node->type = COGL_RECTANGLE_MAP_BRANCH; + + return left_node; +} + +static CoglRectangleMapNode * +_cogl_rectangle_map_node_split_vertically (CoglRectangleMapNode *node, + unsigned int top_height) +{ + /* Splits the node vertically (according to emacs' definition, not + vim) by converting it to a branch and adding two new leaf + nodes. The topmost branch will have the height top_height and + will be returned. If the node is already just the right size it + won't do anything */ + + CoglRectangleMapNode *top_node, *bottom_node; + + if (node->rectangle.height == top_height) + return node; + + top_node = _cogl_rectangle_map_node_new (); + top_node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + top_node->parent = node; + top_node->rectangle.x = node->rectangle.x; + top_node->rectangle.y = node->rectangle.y; + top_node->rectangle.width = node->rectangle.width; + top_node->rectangle.height = top_height; + top_node->largest_gap = (top_node->rectangle.width * + top_node->rectangle.height); + node->d.branch.left = top_node; + + bottom_node = _cogl_rectangle_map_node_new (); + bottom_node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + bottom_node->parent = node; + bottom_node->rectangle.x = node->rectangle.x; + bottom_node->rectangle.y = node->rectangle.y + top_height; + bottom_node->rectangle.width = node->rectangle.width; + bottom_node->rectangle.height = node->rectangle.height - top_height; + bottom_node->largest_gap = (bottom_node->rectangle.width * + bottom_node->rectangle.height); + node->d.branch.right = bottom_node; + + node->type = COGL_RECTANGLE_MAP_BRANCH; + + return top_node; +} + +#ifdef COGL_ENABLE_DEBUG + +static unsigned int +_cogl_rectangle_map_verify_recursive (CoglRectangleMapNode *node) +{ + /* This is just used for debugging the data structure. It + recursively walks the tree to verify that the largest gap values + all add up */ + + switch (node->type) + { + case COGL_RECTANGLE_MAP_BRANCH: + { + int sum = + _cogl_rectangle_map_verify_recursive (node->d.branch.left) + + _cogl_rectangle_map_verify_recursive (node->d.branch.right); + g_assert (node->largest_gap == + MAX (node->d.branch.left->largest_gap, + node->d.branch.right->largest_gap)); + return sum; + } + + case COGL_RECTANGLE_MAP_EMPTY_LEAF: + g_assert (node->largest_gap == + node->rectangle.width * node->rectangle.height); + return 0; + + case COGL_RECTANGLE_MAP_FILLED_LEAF: + g_assert (node->largest_gap == 0); + return 1; + } + + return 0; +} + +static unsigned int +_cogl_rectangle_map_get_space_remaining_recursive (CoglRectangleMapNode *node) +{ + /* This is just used for debugging the data structure. It + recursively walks the tree to verify that the remaining space + value adds up */ + + switch (node->type) + { + case COGL_RECTANGLE_MAP_BRANCH: + { + CoglRectangleMapNode *l = node->d.branch.left; + CoglRectangleMapNode *r = node->d.branch.right; + + return (_cogl_rectangle_map_get_space_remaining_recursive (l) + + _cogl_rectangle_map_get_space_remaining_recursive (r)); + } + + case COGL_RECTANGLE_MAP_EMPTY_LEAF: + return node->rectangle.width * node->rectangle.height; + + case COGL_RECTANGLE_MAP_FILLED_LEAF: + return 0; + } + + return 0; +} + +static void +_cogl_rectangle_map_verify (CoglRectangleMap *map) +{ + unsigned int actual_n_rectangles = + _cogl_rectangle_map_verify_recursive (map->root); + unsigned int actual_space_remaining = + _cogl_rectangle_map_get_space_remaining_recursive (map->root); + + g_assert_cmpuint (actual_n_rectangles, ==, map->n_rectangles); + g_assert_cmpuint (actual_space_remaining, ==, map->space_remaining); +} + +#endif /* COGL_ENABLE_DEBUG */ + +CoglBool +_cogl_rectangle_map_add (CoglRectangleMap *map, + unsigned int width, + unsigned int height, + void *data, + CoglRectangleMapEntry *rectangle) +{ + unsigned int rectangle_size = width * height; + /* Stack of nodes to search in */ + GArray *stack = map->stack; + CoglRectangleMapNode *found_node = NULL; + + /* Zero-sized rectangles break the algorithm for removing rectangles + so we'll disallow them */ + _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, FALSE); + + /* Start with the root node */ + g_array_set_size (stack, 0); + _cogl_rectangle_map_stack_push (stack, map->root, FALSE); + + /* Depth-first search for an empty node that is big enough */ + while (stack->len > 0) + { + CoglRectangleMapStackEntry *stack_top; + CoglRectangleMapNode *node; + int next_index; + + /* Pop an entry off the stack */ + stack_top = _cogl_rectangle_map_stack_get_top (stack); + node = stack_top->node; + next_index = stack_top->next_index; + _cogl_rectangle_map_stack_pop (stack); + + /* Regardless of the type of the node, there's no point + descending any further if the new rectangle won't fit within + it */ + if (node->rectangle.width >= width && + node->rectangle.height >= height && + node->largest_gap >= rectangle_size) + { + if (node->type == COGL_RECTANGLE_MAP_EMPTY_LEAF) + { + /* We've found a node we can use */ + found_node = node; + break; + } + else if (node->type == COGL_RECTANGLE_MAP_BRANCH) + { + if (next_index) + /* Try the right branch */ + _cogl_rectangle_map_stack_push (stack, + node->d.branch.right, + 0); + else + { + /* Make sure we remember to try the right branch once + we've finished descending the left branch */ + _cogl_rectangle_map_stack_push (stack, + node, + 1); + /* Try the left branch */ + _cogl_rectangle_map_stack_push (stack, + node->d.branch.left, + 0); + } + } + } + } + + if (found_node) + { + CoglRectangleMapNode *node; + + /* Split according to whichever axis will leave us with the + largest space */ + if (found_node->rectangle.width - width > + found_node->rectangle.height - height) + { + found_node = + _cogl_rectangle_map_node_split_horizontally (found_node, width); + found_node = + _cogl_rectangle_map_node_split_vertically (found_node, height); + } + else + { + found_node = + _cogl_rectangle_map_node_split_vertically (found_node, height); + found_node = + _cogl_rectangle_map_node_split_horizontally (found_node, width); + } + + found_node->type = COGL_RECTANGLE_MAP_FILLED_LEAF; + found_node->d.data = data; + found_node->largest_gap = 0; + if (rectangle) + *rectangle = found_node->rectangle; + + /* Walk back up the tree and update the stored largest gap for + the node's sub tree */ + for (node = found_node->parent; node; node = node->parent) + { + /* This node is a parent so it should always be a branch */ + g_assert (node->type == COGL_RECTANGLE_MAP_BRANCH); + + node->largest_gap = MAX (node->d.branch.left->largest_gap, + node->d.branch.right->largest_gap); + } + + /* There is now an extra rectangle in the map */ + map->n_rectangles++; + /* and less space */ + map->space_remaining -= rectangle_size; + +#ifdef COGL_ENABLE_DEBUG + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE))) + { +#ifdef HAVE_CAIRO + _cogl_rectangle_map_dump_image (map); +#endif + /* Dumping the rectangle map is really slow so we might as well + verify the space remaining here as it is also quite slow */ + _cogl_rectangle_map_verify (map); + } +#endif + + return TRUE; + } + else + return FALSE; +} + +void +_cogl_rectangle_map_remove (CoglRectangleMap *map, + const CoglRectangleMapEntry *rectangle) +{ + CoglRectangleMapNode *node = map->root; + unsigned int rectangle_size = rectangle->width * rectangle->height; + + /* We can do a binary-chop down the search tree to find the rectangle */ + while (node->type == COGL_RECTANGLE_MAP_BRANCH) + { + CoglRectangleMapNode *left_node = node->d.branch.left; + + /* If and only if the rectangle is in the left node then the x,y + position of the rectangle will be within the node's + rectangle */ + if (rectangle->x < left_node->rectangle.x + left_node->rectangle.width && + rectangle->y < left_node->rectangle.y + left_node->rectangle.height) + /* Go left */ + node = left_node; + else + /* Go right */ + node = node->d.branch.right; + } + + /* Make sure we found the right node */ + if (node->type != COGL_RECTANGLE_MAP_FILLED_LEAF || + node->rectangle.x != rectangle->x || + node->rectangle.y != rectangle->y || + node->rectangle.width != rectangle->width || + node->rectangle.height != rectangle->height) + /* This should only happen if someone tried to remove a rectangle + that was not in the map so something has gone wrong */ + g_return_if_reached (); + else + { + /* Convert the node back to an empty node */ + if (map->value_destroy_func) + map->value_destroy_func (node->d.data); + node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + node->largest_gap = rectangle_size; + + /* Walk back up the tree combining branch nodes that have two + empty leaves back into a single empty leaf */ + for (node = node->parent; node; node = node->parent) + { + /* This node is a parent so it should always be a branch */ + g_assert (node->type == COGL_RECTANGLE_MAP_BRANCH); + + if (node->d.branch.left->type == COGL_RECTANGLE_MAP_EMPTY_LEAF && + node->d.branch.right->type == COGL_RECTANGLE_MAP_EMPTY_LEAF) + { + _cogl_rectangle_map_node_free (node->d.branch.left); + _cogl_rectangle_map_node_free (node->d.branch.right); + node->type = COGL_RECTANGLE_MAP_EMPTY_LEAF; + + node->largest_gap = (node->rectangle.width * + node->rectangle.height); + } + else + break; + } + + /* Reduce the amount of space remaining in all of the parents + further up the chain */ + for (; node; node = node->parent) + node->largest_gap = MAX (node->d.branch.left->largest_gap, + node->d.branch.right->largest_gap); + + /* There is now one less rectangle */ + g_assert (map->n_rectangles > 0); + map->n_rectangles--; + /* and more space */ + map->space_remaining += rectangle_size; + } + +#ifdef COGL_ENABLE_DEBUG + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE))) + { +#ifdef HAVE_CAIRO + _cogl_rectangle_map_dump_image (map); +#endif + /* Dumping the rectangle map is really slow so we might as well + verify the space remaining here as it is also quite slow */ + _cogl_rectangle_map_verify (map); + } +#endif +} + +unsigned int +_cogl_rectangle_map_get_width (CoglRectangleMap *map) +{ + return map->root->rectangle.width; +} + +unsigned int +_cogl_rectangle_map_get_height (CoglRectangleMap *map) +{ + return map->root->rectangle.height; +} + +unsigned int +_cogl_rectangle_map_get_remaining_space (CoglRectangleMap *map) +{ + return map->space_remaining; +} + +unsigned int +_cogl_rectangle_map_get_n_rectangles (CoglRectangleMap *map) +{ + return map->n_rectangles; +} + +static void +_cogl_rectangle_map_internal_foreach (CoglRectangleMap *map, + CoglRectangleMapInternalForeachCb func, + void *data) +{ + /* Stack of nodes to search in */ + GArray *stack = map->stack; + + /* Start with the root node */ + g_array_set_size (stack, 0); + _cogl_rectangle_map_stack_push (stack, map->root, 0); + + /* Iterate all nodes depth-first */ + while (stack->len > 0) + { + CoglRectangleMapStackEntry *stack_top = + _cogl_rectangle_map_stack_get_top (stack); + CoglRectangleMapNode *node = stack_top->node; + + switch (node->type) + { + case COGL_RECTANGLE_MAP_BRANCH: + if (stack_top->next_index == 0) + { + /* Next time we come back to this node, go to the right */ + stack_top->next_index = 1; + + /* Explore the left branch next */ + _cogl_rectangle_map_stack_push (stack, + node->d.branch.left, + 0); + } + else if (stack_top->next_index == 1) + { + /* Next time we come back to this node, stop processing it */ + stack_top->next_index = 2; + + /* Explore the right branch next */ + _cogl_rectangle_map_stack_push (stack, + node->d.branch.right, + 0); + } + else + { + /* We're finished with this node so we can call the callback */ + func (node, data); + _cogl_rectangle_map_stack_pop (stack); + } + break; + + default: + /* Some sort of leaf node, just call the callback */ + func (node, data); + _cogl_rectangle_map_stack_pop (stack); + break; + } + } + + /* The stack should now be empty */ + g_assert (stack->len == 0); +} + +typedef struct _CoglRectangleMapForeachClosure +{ + CoglRectangleMapCallback callback; + void *data; +} CoglRectangleMapForeachClosure; + +static void +_cogl_rectangle_map_foreach_cb (CoglRectangleMapNode *node, void *data) +{ + CoglRectangleMapForeachClosure *closure = data; + + if (node->type == COGL_RECTANGLE_MAP_FILLED_LEAF) + closure->callback (&node->rectangle, node->d.data, closure->data); +} + +void +_cogl_rectangle_map_foreach (CoglRectangleMap *map, + CoglRectangleMapCallback callback, + void *data) +{ + CoglRectangleMapForeachClosure closure; + + closure.callback = callback; + closure.data = data; + + _cogl_rectangle_map_internal_foreach (map, + _cogl_rectangle_map_foreach_cb, + &closure); +} + +static void +_cogl_rectangle_map_free_cb (CoglRectangleMapNode *node, void *data) +{ + CoglRectangleMap *map = data; + + if (node->type == COGL_RECTANGLE_MAP_FILLED_LEAF && map->value_destroy_func) + map->value_destroy_func (node->d.data); + + _cogl_rectangle_map_node_free (node); +} + +void +_cogl_rectangle_map_free (CoglRectangleMap *map) +{ + _cogl_rectangle_map_internal_foreach (map, + _cogl_rectangle_map_free_cb, + map); + + g_array_free (map->stack, TRUE); + + g_free (map); +} + +#if defined (COGL_ENABLE_DEBUG) && defined (HAVE_CAIRO) + +static void +_cogl_rectangle_map_dump_image_cb (CoglRectangleMapNode *node, void *data) +{ + cairo_t *cr = data; + + if (node->type == COGL_RECTANGLE_MAP_FILLED_LEAF || + node->type == COGL_RECTANGLE_MAP_EMPTY_LEAF) + { + /* Fill the rectangle using a different colour depending on + whether the rectangle is used */ + if (node->type == COGL_RECTANGLE_MAP_FILLED_LEAF) + cairo_set_source_rgb (cr, 0.0, 0.0, 1.0); + else + cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); + + cairo_rectangle (cr, + node->rectangle.x, + node->rectangle.y, + node->rectangle.width, + node->rectangle.height); + + cairo_fill_preserve (cr); + + /* Draw a white outline around the rectangle */ + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); + cairo_stroke (cr); + } +} + +static void +_cogl_rectangle_map_dump_image (CoglRectangleMap *map) +{ + /* This dumps a png to help visualize the map. Each leaf rectangle + is drawn with a white outline. Unused leaves are filled in black + and used leaves are blue */ + + cairo_surface_t *surface = + cairo_image_surface_create (CAIRO_FORMAT_RGB24, + _cogl_rectangle_map_get_width (map), + _cogl_rectangle_map_get_height (map)); + cairo_t *cr = cairo_create (surface); + + _cogl_rectangle_map_internal_foreach (map, + _cogl_rectangle_map_dump_image_cb, + cr); + + cairo_destroy (cr); + + cairo_surface_write_to_png (surface, "cogl-rectangle-map-dump.png"); + + cairo_surface_destroy (surface); +} + +#endif /* COGL_ENABLE_DEBUG && HAVE_CAIRO */ diff --git a/cogl/cogl-rectangle-map.h b/cogl/cogl-rectangle-map.h new file mode 100644 index 0000000..1dd50fd --- /dev/null +++ b/cogl/cogl-rectangle-map.h @@ -0,0 +1,84 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_RECTANGLE_MAP_H +#define __COGL_RECTANGLE_MAP_H + +#include +#include "cogl-types.h" + +typedef struct _CoglRectangleMap CoglRectangleMap; +typedef struct _CoglRectangleMapEntry CoglRectangleMapEntry; + +typedef void (* CoglRectangleMapCallback) (const CoglRectangleMapEntry *entry, + void *rectangle_data, + void *user_data); + +struct _CoglRectangleMapEntry +{ + unsigned int x, y; + unsigned int width, height; +}; + +CoglRectangleMap * +_cogl_rectangle_map_new (unsigned int width, + unsigned int height, + GDestroyNotify value_destroy_func); + +CoglBool +_cogl_rectangle_map_add (CoglRectangleMap *map, + unsigned int width, + unsigned int height, + void *data, + CoglRectangleMapEntry *rectangle); + +void +_cogl_rectangle_map_remove (CoglRectangleMap *map, + const CoglRectangleMapEntry *rectangle); + +unsigned int +_cogl_rectangle_map_get_width (CoglRectangleMap *map); + +unsigned int +_cogl_rectangle_map_get_height (CoglRectangleMap *map); + +unsigned int +_cogl_rectangle_map_get_remaining_space (CoglRectangleMap *map); + +unsigned int +_cogl_rectangle_map_get_n_rectangles (CoglRectangleMap *map); + +void +_cogl_rectangle_map_foreach (CoglRectangleMap *map, + CoglRectangleMapCallback callback, + void *data); + +void +_cogl_rectangle_map_free (CoglRectangleMap *map); + +#endif /* __COGL_RECTANGLE_MAP_H */ diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h new file mode 100644 index 0000000..3871d91 --- /dev/null +++ b/cogl/cogl-renderer-private.h @@ -0,0 +1,132 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_RENDERER_PRIVATE_H +#define __COGL_RENDERER_PRIVATE_H + +#include + +#include "cogl-object-private.h" +#include "cogl-winsys-private.h" +#include "cogl-driver.h" +#include "cogl-texture-driver.h" +#include "cogl-context.h" +#include "cogl-closure-list-private.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include +#endif + +#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) +#include +#endif + +struct _CoglRenderer +{ + CoglObject _parent; + CoglBool connected; + CoglDriver driver_override; + const CoglDriverVtable *driver_vtable; + const CoglTextureDriver *texture_driver; + const CoglWinsysVtable *winsys_vtable; + CoglWinsysID winsys_id_override; + GList *constraints; + + GArray *poll_fds; + int poll_fds_age; + GList *poll_sources; + + CoglList idle_closures; + + GList *outputs; + +#ifdef COGL_HAS_XLIB_SUPPORT + Display *foreign_xdpy; + CoglBool xlib_enable_event_retrieval; +#endif + +#ifdef COGL_HAS_WIN32_SUPPORT + CoglBool win32_enable_event_retrieval; +#endif + + CoglDriver driver; + unsigned long private_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)]; +#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY + GModule *libgl_module; +#endif + +#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) + struct wl_display *foreign_wayland_display; + CoglBool wayland_enable_event_dispatch; +#endif + +#if defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) + int kms_fd; +#endif + +#ifdef COGL_HAS_SDL_SUPPORT + CoglBool sdl_event_type_set; + uint32_t sdl_event_type; +#endif + + /* List of callback functions that will be given every native event */ + GSList *event_filters; + void *winsys; +}; + +/* Mask of constraints that effect driver selection. All of the other + * constraints effect only the winsys selection */ +#define COGL_RENDERER_DRIVER_CONSTRAINTS \ + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 + +typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event, + void *data); + +CoglFilterReturn +_cogl_renderer_handle_native_event (CoglRenderer *renderer, + void *event); + +void +_cogl_renderer_add_native_filter (CoglRenderer *renderer, + CoglNativeFilterFunc func, + void *data); + +void +_cogl_renderer_remove_native_filter (CoglRenderer *renderer, + CoglNativeFilterFunc func, + void *data); + +void * +_cogl_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core); + +#endif /* __COGL_RENDERER_PRIVATE_H */ diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c new file mode 100644 index 0000000..ef6e900 --- /dev/null +++ b/cogl/cogl-renderer.c @@ -0,0 +1,869 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-util.h" +#include "cogl-private.h" +#include "cogl-object.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" + +#include "cogl-renderer.h" +#include "cogl-renderer-private.h" +#include "cogl-display-private.h" +#include "cogl-winsys-private.h" +#include "cogl-winsys-stub-private.h" +#include "cogl-config-private.h" +#include "cogl-error-private.h" +#include "cogl-gtype-private.h" + +#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT +#include "cogl-winsys-egl-x11-private.h" +#endif +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT +#include "cogl-winsys-egl-wayland-private.h" +#endif +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT +#include "cogl-winsys-egl-kms-private.h" +#endif +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +#include "cogl-winsys-egl-gdl-private.h" +#endif +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT +#include "cogl-winsys-egl-android-private.h" +#endif +#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT +#include "cogl-winsys-egl-null-private.h" +#endif +#ifdef COGL_HAS_GLX_SUPPORT +#include "cogl-winsys-glx-private.h" +#endif +#ifdef COGL_HAS_WGL_SUPPORT +#include "cogl-winsys-wgl-private.h" +#endif +#ifdef COGL_HAS_SDL_SUPPORT +#include "cogl-winsys-sdl-private.h" +#endif + +#ifdef COGL_HAS_XLIB_SUPPORT +#include "cogl-xlib-renderer.h" +#endif + +typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void); + +#ifdef HAVE_COGL_GL +extern const CoglTextureDriver _cogl_texture_driver_gl; +extern const CoglDriverVtable _cogl_driver_gl; +#endif +#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2) +extern const CoglTextureDriver _cogl_texture_driver_gles; +extern const CoglDriverVtable _cogl_driver_gles; +#endif + +extern const CoglDriverVtable _cogl_driver_nop; + +typedef struct _CoglDriverDescription +{ + CoglDriver id; + const char *name; + CoglRendererConstraint constraints; + /* It would be nice to make this a pointer and then use a compound + * literal from C99 to initialise it but we probably can't get away + * with using C99 here. Instead we'll just use a fixed-size array. + * GCC should complain if someone adds an 8th feature to a + * driver. */ + const CoglPrivateFeature private_features[8]; + const CoglDriverVtable *vtable; + const CoglTextureDriver *texture_driver; + const char *libgl_name; +} CoglDriverDescription; + +static CoglDriverDescription _cogl_drivers[] = +{ +#ifdef HAVE_COGL_GL + { + COGL_DRIVER_GL, + "gl", + 0, + { COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_FIXED, + COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, + -1 }, + &_cogl_driver_gl, + &_cogl_texture_driver_gl, + COGL_GL_LIBNAME, + }, + { + COGL_DRIVER_GL3, + "gl3", + 0, + { COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, + -1 }, + &_cogl_driver_gl, + &_cogl_texture_driver_gl, + COGL_GL_LIBNAME, + }, +#endif +#ifdef HAVE_COGL_GLES2 + { + COGL_DRIVER_GLES2, + "gles2", + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, + { COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_EMBEDDED, + COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, + -1 }, + &_cogl_driver_gles, + &_cogl_texture_driver_gles, + COGL_GLES2_LIBNAME, + }, +#endif +#ifdef HAVE_COGL_GLES + { + COGL_DRIVER_GLES1, + "gles1", + 0, + { COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_EMBEDDED, + COGL_PRIVATE_FEATURE_GL_FIXED, + -1 }, + &_cogl_driver_gles, + &_cogl_texture_driver_gles, + COGL_GLES1_LIBNAME, + }, +#endif +#ifdef USING_EMSCRIPTEN + { + COGL_DRIVER_WEBGL, + "webgl", + 0, + { COGL_PRIVATE_FEATURE_ANY_GL, + COGL_PRIVATE_FEATURE_GL_EMBEDDED, + COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, + COGL_PRIVATE_FEATURE_GL_WEB, + -1 }, + &_cogl_driver_gles, + &_cogl_texture_driver_gles, + NULL, + }, +#endif + { + COGL_DRIVER_NOP, + "nop", + 0, /* constraints satisfied */ + { -1 }, + &_cogl_driver_nop, + NULL, /* texture driver */ + NULL /* libgl_name */ + } +}; + +static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] = +{ +#ifdef COGL_HAS_GLX_SUPPORT + _cogl_winsys_glx_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT + _cogl_winsys_egl_xlib_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT + _cogl_winsys_egl_wayland_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT + _cogl_winsys_egl_kms_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + _cogl_winsys_egl_gdl_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT + _cogl_winsys_egl_android_get_vtable, +#endif +#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT + _cogl_winsys_egl_null_get_vtable, +#endif +#ifdef COGL_HAS_WGL_SUPPORT + _cogl_winsys_wgl_get_vtable, +#endif +#ifdef COGL_HAS_SDL_SUPPORT + _cogl_winsys_sdl_get_vtable, +#endif + _cogl_winsys_stub_get_vtable, +}; + +static void _cogl_renderer_free (CoglRenderer *renderer); + +COGL_OBJECT_DEFINE (Renderer, renderer); +COGL_GTYPE_DEFINE_CLASS (Renderer, renderer); + +typedef struct _CoglNativeFilterClosure +{ + CoglNativeFilterFunc func; + void *data; +} CoglNativeFilterClosure; + +uint32_t +cogl_renderer_error_quark (void) +{ + return g_quark_from_static_string ("cogl-renderer-error-quark"); +} + +static const CoglWinsysVtable * +_cogl_renderer_get_winsys (CoglRenderer *renderer) +{ + return renderer->winsys_vtable; +} + +static void +native_filter_closure_free (CoglNativeFilterClosure *closure) +{ + g_slice_free (CoglNativeFilterClosure, closure); +} + +static void +_cogl_renderer_free (CoglRenderer *renderer) +{ + const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer); + + _cogl_closure_list_disconnect_all (&renderer->idle_closures); + + if (winsys) + winsys->renderer_disconnect (renderer); + +#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY + if (renderer->libgl_module) + g_module_close (renderer->libgl_module); +#endif + + g_slist_foreach (renderer->event_filters, + (GFunc) native_filter_closure_free, + NULL); + g_slist_free (renderer->event_filters); + + g_array_free (renderer->poll_fds, TRUE); + + g_free (renderer); +} + +CoglRenderer * +cogl_renderer_new (void) +{ + CoglRenderer *renderer = g_new0 (CoglRenderer, 1); + + _cogl_init (); + + renderer->connected = FALSE; + renderer->event_filters = NULL; + + renderer->poll_fds = g_array_new (FALSE, TRUE, sizeof (CoglPollFD)); + + _cogl_list_init (&renderer->idle_closures); + +#ifdef COGL_HAS_XLIB_SUPPORT + renderer->xlib_enable_event_retrieval = TRUE; +#endif + +#ifdef COGL_HAS_WIN32_SUPPORT + renderer->win32_enable_event_retrieval = TRUE; +#endif + +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT + renderer->wayland_enable_event_dispatch = TRUE; +#endif + +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT + renderer->kms_fd = -1; +#endif + + return _cogl_renderer_object_new (renderer); +} + +#ifdef COGL_HAS_XLIB_SUPPORT +void +cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer, + Display *xdisplay) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->foreign_xdpy = xdisplay; + + /* If the application is using a foreign display then we can assume + it will also do its own event retrieval */ + cogl_xlib_renderer_set_event_retrieval_enabled (renderer, FALSE); +} + +Display * +cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + + return renderer->foreign_xdpy; +} + +void +cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, + CoglBool enable) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->xlib_enable_event_retrieval = enable; +} +#endif /* COGL_HAS_XLIB_SUPPORT */ + +CoglBool +cogl_renderer_check_onscreen_template (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template, + CoglError **error) +{ + CoglDisplay *display; + + if (!cogl_renderer_connect (renderer, error)) + return FALSE; + + display = cogl_display_new (renderer, onscreen_template); + if (!cogl_display_setup (display, error)) + { + cogl_object_unref (display); + return FALSE; + } + + cogl_object_unref (display); + + return TRUE; +} + +typedef CoglBool (*CoglDriverCallback) (CoglDriverDescription *description, + void *user_data); + +static void +foreach_driver_description (CoglDriver driver_override, + CoglDriverCallback callback, + void *user_data) +{ +#ifdef COGL_DEFAULT_DRIVER + const CoglDriverDescription *default_driver = NULL; +#endif + int i; + + if (driver_override != COGL_DRIVER_ANY) + { + for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++) + { + if (_cogl_drivers[i].id == driver_override) + { + callback (&_cogl_drivers[i], user_data); + return; + } + } + + g_warn_if_reached (); + return; + } + +#ifdef COGL_DEFAULT_DRIVER + for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++) + { + const CoglDriverDescription *desc = &_cogl_drivers[i]; + if (g_ascii_strcasecmp (desc->name, COGL_DEFAULT_DRIVER) == 0) + { + default_driver = desc; + break; + } + } + + if (default_driver) + { + if (!callback (default_driver, user_data)) + return; + } +#endif + + for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++) + { +#ifdef COGL_DEFAULT_DRIVER + if (&_cogl_drivers[i] == default_driver) + continue; +#endif + + if (!callback (&_cogl_drivers[i], user_data)) + return; + } +} + +static CoglDriver +driver_name_to_id (const char *name) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++) + { + if (g_ascii_strcasecmp (_cogl_drivers[i].name, name) == 0) + return _cogl_drivers[i].id; + } + + return COGL_DRIVER_ANY; +} + +static const char * +driver_id_to_name (CoglDriver id) +{ + switch (id) + { + case COGL_DRIVER_GL: + return "gl"; + case COGL_DRIVER_GL3: + return "gl3"; + case COGL_DRIVER_GLES1: + return "gles1"; + case COGL_DRIVER_GLES2: + return "gles2"; + case COGL_DRIVER_WEBGL: + return "webgl"; + case COGL_DRIVER_NOP: + return "nop"; + case COGL_DRIVER_ANY: + g_warn_if_reached (); + return "any"; + } + + g_warn_if_reached (); + return "unknown"; +} + +typedef struct _SatisfyConstraintsState +{ + GList *constraints; + const CoglDriverDescription *driver_description; +} SatisfyConstraintsState; + +static CoglBool +satisfy_constraints (CoglDriverDescription *description, + void *user_data) +{ + SatisfyConstraintsState *state = user_data; + GList *l; + + for (l = state->constraints; l; l = l->next) + { + CoglRendererConstraint constraint = GPOINTER_TO_UINT (l->data); + + /* Most of the constraints only affect the winsys selection so + * we'll filter them out */ + if (!(constraint & COGL_RENDERER_DRIVER_CONSTRAINTS)) + continue; + + /* If the driver doesn't satisfy any constraint then continue + * to the next driver description */ + if (!(constraint & description->constraints)) + return TRUE; + } + + state->driver_description = description; + + return FALSE; +} + +static CoglBool +_cogl_renderer_choose_driver (CoglRenderer *renderer, + CoglError **error) +{ + const char *driver_name = g_getenv ("COGL_DRIVER"); + CoglDriver driver_override = COGL_DRIVER_ANY; + const char *invalid_override = NULL; + const char *libgl_name; + SatisfyConstraintsState state; + const CoglDriverDescription *desc; + int i; + + if (!driver_name) + driver_name = _cogl_config_driver; + + if (driver_name) + { + driver_override = driver_name_to_id (driver_name); + if (driver_override == COGL_DRIVER_ANY) + invalid_override = driver_name; + } + + if (renderer->driver_override != COGL_DRIVER_ANY) + { + if (driver_override != COGL_DRIVER_ANY && + renderer->driver_override != driver_override) + { + _cogl_set_error (error, + COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "Application driver selection conflicts with driver " + "specified in configuration"); + return FALSE; + } + + driver_override = renderer->driver_override; + } + + if (driver_override != COGL_DRIVER_ANY) + { + CoglBool found = FALSE; + int i; + + for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++) + { + if (_cogl_drivers[i].id == driver_override) + { + found = TRUE; + break; + } + } + if (!found) + invalid_override = driver_id_to_name (driver_override); + } + + if (invalid_override) + { + _cogl_set_error (error, + COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "Driver \"%s\" is not available", + invalid_override); + return FALSE; + } + + state.driver_description = NULL; + state.constraints = renderer->constraints; + + foreach_driver_description (driver_override, + satisfy_constraints, + &state); + + if (!state.driver_description) + { + _cogl_set_error (error, + COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "No suitable driver found"); + return FALSE; + } + + desc = state.driver_description; + renderer->driver = desc->id; + renderer->driver_vtable = desc->vtable; + renderer->texture_driver = desc->texture_driver; + libgl_name = desc->libgl_name; + + memset(renderer->private_features, 0, sizeof (renderer->private_features)); + for (i = 0; desc->private_features[i] != -1; i++) + COGL_FLAGS_SET (renderer->private_features, + desc->private_features[i], TRUE); + +#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY + + if (COGL_FLAGS_GET (renderer->private_features, + COGL_PRIVATE_FEATURE_ANY_GL)) + { + renderer->libgl_module = g_module_open (libgl_name, + G_MODULE_BIND_LAZY); + + if (renderer->libgl_module == NULL) + { + _cogl_set_error (error, COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY, + "Failed to dynamically open the GL library \"%s\"", + libgl_name); + return FALSE; + } + } + +#endif /* HAVE_DIRECTLY_LINKED_GL_LIBRARY */ + + return TRUE; +} + +/* Final connection API */ + +CoglBool +cogl_renderer_connect (CoglRenderer *renderer, CoglError **error) +{ + int i; + GString *error_message; + CoglBool constraints_failed = FALSE; + + if (renderer->connected) + return TRUE; + + /* The driver needs to be chosen before connecting the renderer + because eglInitialize requires the library containing the GL API + to be loaded before its called */ + if (!_cogl_renderer_choose_driver (renderer, error)) + return FALSE; + + error_message = g_string_new (""); + for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++) + { + const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i](); + CoglError *tmp_error = NULL; + GList *l; + CoglBool skip_due_to_constraints = FALSE; + + if (renderer->winsys_id_override != COGL_WINSYS_ID_ANY) + { + if (renderer->winsys_id_override != winsys->id) + continue; + } + else + { + char *user_choice = getenv ("COGL_RENDERER"); + if (!user_choice) + user_choice = _cogl_config_renderer; + if (user_choice && + g_ascii_strcasecmp (winsys->name, user_choice) != 0) + continue; + } + + for (l = renderer->constraints; l; l = l->next) + { + CoglRendererConstraint constraint = GPOINTER_TO_UINT (l->data); + if (!(winsys->constraints & constraint)) + { + skip_due_to_constraints = TRUE; + break; + } + } + if (skip_due_to_constraints) + { + constraints_failed |= TRUE; + continue; + } + + /* At least temporarily we will associate this winsys with + * the renderer in-case ->renderer_connect calls API that + * wants to query the current winsys... */ + renderer->winsys_vtable = winsys; + + if (!winsys->renderer_connect (renderer, &tmp_error)) + { + g_string_append_c (error_message, '\n'); + g_string_append (error_message, tmp_error->message); + cogl_error_free (tmp_error); + } + else + { + renderer->connected = TRUE; + g_string_free (error_message, TRUE); + return TRUE; + } + } + + if (!renderer->connected) + { + if (constraints_failed) + { + _cogl_set_error (error, COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "Failed to connected to any renderer due to constraints"); + return FALSE; + } + + renderer->winsys_vtable = NULL; + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to connected to any renderer: %s", + error_message->str); + g_string_free (error_message, TRUE); + return FALSE; + } + + return TRUE; +} + +CoglFilterReturn +_cogl_renderer_handle_native_event (CoglRenderer *renderer, + void *event) +{ + GSList *l, *next; + + /* Pass the event on to all of the registered filters in turn */ + for (l = renderer->event_filters; l; l = next) + { + CoglNativeFilterClosure *closure = l->data; + + /* The next pointer is taken now so that we can handle the + closure being removed during emission */ + next = l->next; + + if (closure->func (event, closure->data) == COGL_FILTER_REMOVE) + return COGL_FILTER_REMOVE; + } + + /* If the backend for the renderer also wants to see the events, it + should just register its own filter */ + + return COGL_FILTER_CONTINUE; +} + +void +_cogl_renderer_add_native_filter (CoglRenderer *renderer, + CoglNativeFilterFunc func, + void *data) +{ + CoglNativeFilterClosure *closure; + + closure = g_slice_new (CoglNativeFilterClosure); + closure->func = func; + closure->data = data; + + renderer->event_filters = g_slist_prepend (renderer->event_filters, closure); +} + +void +_cogl_renderer_remove_native_filter (CoglRenderer *renderer, + CoglNativeFilterFunc func, + void *data) +{ + GSList *l, *prev = NULL; + + for (l = renderer->event_filters; l; prev = l, l = l->next) + { + CoglNativeFilterClosure *closure = l->data; + + if (closure->func == func && closure->data == data) + { + native_filter_closure_free (closure); + if (prev) + prev->next = g_slist_delete_link (prev->next, l); + else + renderer->event_filters = + g_slist_delete_link (renderer->event_filters, l); + break; + } + } +} + +void +cogl_renderer_set_winsys_id (CoglRenderer *renderer, + CoglWinsysID winsys_id) +{ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->winsys_id_override = winsys_id; +} + +CoglWinsysID +cogl_renderer_get_winsys_id (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0); + + return renderer->winsys_vtable->id; +} + +void * +_cogl_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer); + + return winsys->renderer_get_proc_address (renderer, name, in_core); +} + +int +cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer) +{ + int n = 0; + + _COGL_GET_CONTEXT (ctx, 0); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) + if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) || + cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) + GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n)); +#endif + + return n; +} + +void +cogl_renderer_add_constraint (CoglRenderer *renderer, + CoglRendererConstraint constraint) +{ + g_return_if_fail (!renderer->connected); + renderer->constraints = g_list_prepend (renderer->constraints, + GUINT_TO_POINTER (constraint)); +} + +void +cogl_renderer_remove_constraint (CoglRenderer *renderer, + CoglRendererConstraint constraint) +{ + g_return_if_fail (!renderer->connected); + renderer->constraints = g_list_remove (renderer->constraints, + GUINT_TO_POINTER (constraint)); +} + +void +cogl_renderer_set_driver (CoglRenderer *renderer, + CoglDriver driver) +{ + _COGL_RETURN_IF_FAIL (!renderer->connected); + renderer->driver_override = driver; +} + +CoglDriver +cogl_renderer_get_driver (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0); + + return renderer->driver; +} + +void +cogl_renderer_foreach_output (CoglRenderer *renderer, + CoglOutputCallback callback, + void *user_data) +{ + GList *l; + + _COGL_RETURN_IF_FAIL (renderer->connected); + _COGL_RETURN_IF_FAIL (callback != NULL); + + for (l = renderer->outputs; l; l = l->next) + callback (l->data, user_data); +} diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h new file mode 100644 index 0000000..78cb25d --- /dev/null +++ b/cogl/cogl-renderer.h @@ -0,0 +1,446 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_RENDERER_H__ +#define __COGL_RENDERER_H__ + +#include +#include +#include +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-renderer + * @short_description: Choosing a means to render + * + * A #CoglRenderer represents a means to render. It encapsulates the + * selection of an underlying driver, such as OpenGL or OpenGL-ES and + * a selection of a window system binding API such as GLX, or EGL or + * WGL. + * + * A #CoglRenderer has two states, "unconnected" and "connected". When + * a renderer is first instantiated using cogl_renderer_new() it is + * unconnected so that it can be configured and constraints can be + * specified for how the backend driver and window system should be + * chosen. + * + * After configuration a #CoglRenderer can (optionally) be explicitly + * connected using cogl_renderer_connect() which allows for the + * handling of connection errors so that fallback configurations can + * be tried if necessary. Applications that don't support any + * fallbacks though can skip using cogl_renderer_connect() and leave + * Cogl to automatically connect the renderer. + * + * Once you have a configured #CoglRenderer it can be used to create a + * #CoglDisplay object using cogl_display_new(). + * + * Many applications don't need to explicitly use + * cogl_renderer_new() or cogl_display_new() and can just jump + * straight to cogl_context_new() and pass a %NULL display argument so + * Cogl will automatically connect and setup a renderer and + * display. + */ + + +/** + * COGL_RENDERER_ERROR: + * + * An error domain for exceptions reported by Cogl + */ +#define COGL_RENDERER_ERROR cogl_renderer_error_quark () + +uint32_t +cogl_renderer_error_quark (void); + +typedef struct _CoglRenderer CoglRenderer; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_renderer_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_renderer_get_gtype (void); +#endif + +/** + * cogl_is_renderer: + * @object: A #CoglObject pointer + * + * Determines if the given @object is a #CoglRenderer + * + * Return value: %TRUE if @object is a #CoglRenderer, else %FALSE. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_renderer (void *object); + +/** + * cogl_renderer_new: + * + * Instantiates a new (unconnected) #CoglRenderer object. A + * #CoglRenderer represents a means to render. It encapsulates the + * selection of an underlying driver, such as OpenGL or OpenGL-ES and + * a selection of a window system binding API such as GLX, or EGL or + * WGL. + * + * While the renderer is unconnected it can be configured so that + * applications may specify backend constraints, such as "must use + * x11" for example via cogl_renderer_add_constraint(). + * + * There are also some platform specific configuration apis such + * as cogl_xlib_renderer_set_foreign_display() that may also be + * used while the renderer is unconnected. + * + * Once the renderer has been configured, then it may (optionally) be + * explicitly connected using cogl_renderer_connect() which allows + * errors to be handled gracefully and potentially fallback + * configurations can be tried out if there are initial failures. + * + * If a renderer is not explicitly connected then cogl_display_new() + * will automatically connect the renderer for you. If you don't + * have any code to deal with error/fallback situations then its fine + * to just let Cogl do the connection for you. + * + * Once you have setup your renderer then the next step is to create a + * #CoglDisplay using cogl_display_new(). + * + * Many applications don't need to explicitly use + * cogl_renderer_new() or cogl_display_new() and can just jump + * straight to cogl_context_new() and pass a %NULL display argument + * so Cogl will automatically connect and setup a renderer and + * display. + * + * Return value: (transfer full): A newly created #CoglRenderer. + * + * Since: 1.10 + * Stability: unstable + */ +CoglRenderer * +cogl_renderer_new (void); + +/* optional configuration APIs */ + +/** + * CoglWinsysID: + * @COGL_WINSYS_ID_ANY: Implies no preference for which backend is used + * @COGL_WINSYS_ID_STUB: Use the no-op stub backend + * @COGL_WINSYS_ID_GLX: Use the GLX window system binding API + * @COGL_WINSYS_ID_EGL_XLIB: Use EGL with the X window system via XLib + * @COGL_WINSYS_ID_EGL_NULL: Use EGL with the PowerVR NULL window system + * @COGL_WINSYS_ID_EGL_GDL: Use EGL with the GDL platform + * @COGL_WINSYS_ID_EGL_WAYLAND: Use EGL with the Wayland window system + * @COGL_WINSYS_ID_EGL_KMS: Use EGL with the KMS platform + * @COGL_WINSYS_ID_EGL_ANDROID: Use EGL with the Android platform + * @COGL_WINSYS_ID_WGL: Use the Microsoft Windows WGL binding API + * @COGL_WINSYS_ID_SDL: Use the SDL window system + * + * Identifies specific window system backends that Cogl supports. + * + * These can be used to query what backend Cogl is using or to try and + * explicitly select a backend to use. + */ +typedef enum +{ + COGL_WINSYS_ID_ANY, + COGL_WINSYS_ID_STUB, + COGL_WINSYS_ID_GLX, + COGL_WINSYS_ID_EGL_XLIB, + COGL_WINSYS_ID_EGL_NULL, + COGL_WINSYS_ID_EGL_GDL, + COGL_WINSYS_ID_EGL_WAYLAND, + COGL_WINSYS_ID_EGL_KMS, + COGL_WINSYS_ID_EGL_ANDROID, + COGL_WINSYS_ID_WGL, + COGL_WINSYS_ID_SDL +} CoglWinsysID; + +/** + * cogl_renderer_set_winsys_id: + * @renderer: A #CoglRenderer + * @winsys_id: An ID of the winsys you explicitly want to use. + * + * This allows you to explicitly select a winsys backend to use instead + * of letting Cogl automatically select a backend. + * + * if you select an unsupported backend then cogl_renderer_connect() + * will fail and report an error. + * + * This may only be called on an un-connected #CoglRenderer. + */ +void +cogl_renderer_set_winsys_id (CoglRenderer *renderer, + CoglWinsysID winsys_id); + +/** + * cogl_renderer_get_winsys_id: + * @renderer: A #CoglRenderer + * + * Queries which window system backend Cogl has chosen to use. + * + * This may only be called on a connected #CoglRenderer. + * + * Returns: The #CoglWinsysID corresponding to the chosen window + * system backend. + */ +CoglWinsysID +cogl_renderer_get_winsys_id (CoglRenderer *renderer); + +/** + * cogl_renderer_get_n_fragment_texture_units: + * @renderer: A #CoglRenderer + * + * Queries how many texture units can be used from fragment programs + * + * Returns: the number of texture image units. + * + * Since: 1.8 + * Stability: Unstable + */ +int +cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer); + +/** + * cogl_renderer_check_onscreen_template: + * @renderer: A #CoglRenderer + * @onscreen_template: A #CoglOnscreenTemplate + * @error: A pointer to a #CoglError for reporting exceptions + * + * Tests if a given @onscreen_template can be supported with the given + * @renderer. + * + * Return value: %TRUE if the @onscreen_template can be supported, + * else %FALSE. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_renderer_check_onscreen_template (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template, + CoglError **error); + +/* Final connection API */ + +/** + * cogl_renderer_connect: + * @renderer: An unconnected #CoglRenderer + * @error: a pointer to a #CoglError for reporting exceptions + * + * Connects the configured @renderer. Renderer connection isn't a + * very active process, it basically just means validating that + * any given constraint criteria can be satisfied and that a + * usable driver and window system backend can be found. + * + * Return value: %TRUE if there was no error while connecting the + * given @renderer. %FALSE if there was an error. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_renderer_connect (CoglRenderer *renderer, CoglError **error); + +/** + * CoglRendererConstraint: + * @COGL_RENDERER_CONSTRAINT_USES_X11: Require the renderer to be X11 based + * @COGL_RENDERER_CONSTRAINT_USES_XLIB: Require the renderer to be X11 + * based and use Xlib + * @COGL_RENDERER_CONSTRAINT_USES_EGL: Require the renderer to be EGL based + * @COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2: Require that the + * renderer supports creating a #CoglGLES2Context via + * cogl_gles2_context_new(). This can be used to integrate GLES 2.0 + * code into Cogl based applications. + * + * These constraint flags are hard-coded features of the different renderer + * backends. Sometimes a platform may support multiple rendering options which + * Cogl will usually choose from automatically. Some of these features are + * important to higher level applications and frameworks though, such as + * whether a renderer is X11 based because an application might only support + * X11 based input handling. An application might also need to ensure EGL is + * used internally too if they depend on access to an EGLDisplay for some + * purpose. + * + * Applications should ideally minimize how many of these constraints + * they depend on to ensure maximum portability. + * + * Since: 1.10 + * Stability: unstable + */ +typedef enum +{ + COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0), + COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1), + COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2), + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 = (1 << 3) +} CoglRendererConstraint; + + +/** + * cogl_renderer_add_constraint: + * @renderer: An unconnected #CoglRenderer + * @constraint: A #CoglRendererConstraint to add + * + * This adds a renderer selection @constraint. + * + * Applications should ideally minimize how many of these constraints they + * depend on to ensure maximum portability. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_renderer_add_constraint (CoglRenderer *renderer, + CoglRendererConstraint constraint); + +/** + * cogl_renderer_remove_constraint: + * @renderer: An unconnected #CoglRenderer + * @constraint: A #CoglRendererConstraint to remove + * + * This removes a renderer selection @constraint. + * + * Applications should ideally minimize how many of these constraints they + * depend on to ensure maximum portability. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_renderer_remove_constraint (CoglRenderer *renderer, + CoglRendererConstraint constraint); + +/** + * CoglDriver: + * @COGL_DRIVER_ANY: Implies no preference for which driver is used + * @COGL_DRIVER_NOP: A No-Op driver. + * @COGL_DRIVER_GL: An OpenGL driver. + * @COGL_DRIVER_GL3: An OpenGL driver using the core GL 3.1 profile + * @COGL_DRIVER_GLES1: An OpenGL ES 1.1 driver. + * @COGL_DRIVER_GLES2: An OpenGL ES 2.0 driver. + * @COGL_DRIVER_WEBGL: A WebGL driver. + * + * Identifiers for underlying hardware drivers that may be used by + * Cogl for rendering. + * + * Since: 1.10 + * Stability: unstable + */ +typedef enum +{ + COGL_DRIVER_ANY, + COGL_DRIVER_NOP, + COGL_DRIVER_GL, + COGL_DRIVER_GL3, + COGL_DRIVER_GLES1, + COGL_DRIVER_GLES2, + COGL_DRIVER_WEBGL +} CoglDriver; + +/** + * cogl_renderer_set_driver: + * @renderer: An unconnected #CoglRenderer + * + * Requests that Cogl should try to use a specific underlying driver + * for rendering. + * + * If you select an unsupported driver then cogl_renderer_connect() + * will fail and report an error. Most applications should not + * explicitly select a driver and should rely on Cogl automatically + * choosing the driver. + * + * This may only be called on an un-connected #CoglRenderer. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_renderer_set_driver (CoglRenderer *renderer, + CoglDriver driver); + +/** + * cogl_renderer_get_driver: + * @renderer: A connected #CoglRenderer + * + * Queries what underlying driver is being used by Cogl. + * + * This may only be called on a connected #CoglRenderer. + * + * Since: 1.10 + * Stability: unstable + */ +CoglDriver +cogl_renderer_get_driver (CoglRenderer *renderer); + +/** + * CoglOutputCallback: + * @output: The current display output being iterated + * @user_data: The user pointer passed to + * cogl_renderer_foreach_output() + * + * A callback type that can be passed to + * cogl_renderer_foreach_output() for iterating display outputs for a + * given renderer. + * + * Since: 1.14 + * Stability: Unstable + */ +typedef void (*CoglOutputCallback) (CoglOutput *output, void *user_data); + +/** + * cogl_renderer_foreach_output: + * @renderer: A connected #CoglRenderer + * @callback: (scope call): A #CoglOutputCallback to be called for + * each display output + * @user_data: A user pointer to be passed to @callback + * + * Iterates all known display outputs for the given @renderer and + * passes a corresponding #CoglOutput pointer to the given @callback + * for each one, along with the given @user_data. + * + * Since: 1.14 + * Stability: Unstable + */ +void +cogl_renderer_foreach_output (CoglRenderer *renderer, + CoglOutputCallback callback, + void *user_data); + +COGL_END_DECLS + +#endif /* __COGL_RENDERER_H__ */ + diff --git a/cogl/cogl-sampler-cache-private.h b/cogl/cogl-sampler-cache-private.h new file mode 100644 index 0000000..5688eff --- /dev/null +++ b/cogl/cogl-sampler-cache-private.h @@ -0,0 +1,96 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SAMPLER_CACHE_PRIVATE_H +#define __COGL_SAMPLER_CACHE_PRIVATE_H + +#include "cogl-context.h" +#include "cogl-gl-header.h" + +/* These aren't defined in the GLES headers */ +#ifndef GL_CLAMP_TO_BORDER +#define GL_CLAMP_TO_BORDER 0x812d +#endif +#ifndef GL_MIRRORED_REPEAT +#define GL_MIRRORED_REPEAT 0x8370 +#endif + +/* GL_ALWAYS is just used here as a value that is known not to clash + * with any valid GL wrap modes. + * + * XXX: keep the values in sync with the CoglPipelineWrapMode enum + * so no conversion is actually needed. + */ +typedef enum _CoglSamplerCacheWrapMode +{ + COGL_SAMPLER_CACHE_WRAP_MODE_REPEAT = GL_REPEAT, + COGL_SAMPLER_CACHE_WRAP_MODE_MIRRORED_REPEAT = GL_MIRRORED_REPEAT, + COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, + COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, + COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC = GL_ALWAYS +} CoglSamplerCacheWrapMode; + +typedef struct _CoglSamplerCache CoglSamplerCache; + +typedef struct _CoglSamplerCacheEntry +{ + GLuint sampler_object; + + GLenum min_filter; + GLenum mag_filter; + + CoglSamplerCacheWrapMode wrap_mode_s; + CoglSamplerCacheWrapMode wrap_mode_t; + CoglSamplerCacheWrapMode wrap_mode_p; +} CoglSamplerCacheEntry; + +CoglSamplerCache * +_cogl_sampler_cache_new (CoglContext *context); + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_get_default_entry (CoglSamplerCache *cache); + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_update_wrap_modes (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *old_entry, + CoglSamplerCacheWrapMode wrap_mode_s, + CoglSamplerCacheWrapMode wrap_mode_t, + CoglSamplerCacheWrapMode wrap_mode_p); + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_update_filters (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *old_entry, + GLenum min_filter, + GLenum mag_filter); + +void +_cogl_sampler_cache_free (CoglSamplerCache *cache); + +#endif /* __COGL_SAMPLER_CACHE_PRIVATE_H */ diff --git a/cogl/cogl-sampler-cache.c b/cogl/cogl-sampler-cache.c new file mode 100644 index 0000000..e21c64c --- /dev/null +++ b/cogl/cogl-sampler-cache.c @@ -0,0 +1,371 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-sampler-cache-private.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" + +#ifndef GL_TEXTURE_WRAP_R +#define GL_TEXTURE_WRAP_R 0x8072 +#endif + +struct _CoglSamplerCache +{ + CoglContext *context; + + /* The samplers are hashed in two tables. One is using the enum + values that Cogl exposes (so it can include the 'automatic' wrap + mode) and the other is using the converted values that will be + given to GL. The first is used to get a unique pointer for the + sampler state so that pipelines only need to store a single + pointer instead of the whole state and the second is used so that + only a single GL sampler object will be created for each unique + GL state. */ + GHashTable *hash_table_cogl; + GHashTable *hash_table_gl; + + /* This is used for generated fake unique sampler object numbers + when the sampler object extension is not supported */ + GLuint next_fake_sampler_object_number; +}; + +static CoglSamplerCacheWrapMode +get_real_wrap_mode (CoglSamplerCacheWrapMode wrap_mode) +{ + if (wrap_mode == COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC) + return COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_EDGE; + + return wrap_mode; +} + +static void +canonicalize_key (CoglSamplerCacheEntry *key) +{ + /* This converts the wrap modes to the enums that will actually be + given to GL so that it can be used as a key to get a unique GL + sampler object for the state */ + key->wrap_mode_s = get_real_wrap_mode (key->wrap_mode_s); + key->wrap_mode_t = get_real_wrap_mode (key->wrap_mode_t); + key->wrap_mode_p = get_real_wrap_mode (key->wrap_mode_p); +} + +static CoglBool +wrap_mode_equal_gl (CoglSamplerCacheWrapMode wrap_mode0, + CoglSamplerCacheWrapMode wrap_mode1) +{ + /* We want to compare the actual GLenum that will be used so that if + two different wrap_modes actually use the same GL state we'll + still use the same sampler object */ + return get_real_wrap_mode (wrap_mode0) == get_real_wrap_mode (wrap_mode1); +} + +static CoglBool +sampler_state_equal_gl (const void *value0, + const void *value1) +{ + const CoglSamplerCacheEntry *state0 = value0; + const CoglSamplerCacheEntry *state1 = value1; + + return (state0->mag_filter == state1->mag_filter && + state0->min_filter == state1->min_filter && + wrap_mode_equal_gl (state0->wrap_mode_s, state1->wrap_mode_s) && + wrap_mode_equal_gl (state0->wrap_mode_t, state1->wrap_mode_t) && + wrap_mode_equal_gl (state0->wrap_mode_p, state1->wrap_mode_p)); +} + +static unsigned int +hash_wrap_mode_gl (unsigned int hash, + CoglSamplerCacheWrapMode wrap_mode) +{ + /* We want to hash the actual GLenum that will be used so that if + two different wrap_modes actually use the same GL state we'll + still use the same sampler object */ + GLenum real_wrap_mode = get_real_wrap_mode (wrap_mode); + + return _cogl_util_one_at_a_time_hash (hash, + &real_wrap_mode, + sizeof (real_wrap_mode)); +} + +static unsigned int +hash_sampler_state_gl (const void *key) +{ + const CoglSamplerCacheEntry *entry = key; + unsigned int hash = 0; + + hash = _cogl_util_one_at_a_time_hash (hash, &entry->mag_filter, + sizeof (entry->mag_filter)); + hash = _cogl_util_one_at_a_time_hash (hash, &entry->min_filter, + sizeof (entry->min_filter)); + hash = hash_wrap_mode_gl (hash, entry->wrap_mode_s); + hash = hash_wrap_mode_gl (hash, entry->wrap_mode_t); + hash = hash_wrap_mode_gl (hash, entry->wrap_mode_p); + + return _cogl_util_one_at_a_time_mix (hash); +} + +static CoglBool +sampler_state_equal_cogl (const void *value0, + const void *value1) +{ + const CoglSamplerCacheEntry *state0 = value0; + const CoglSamplerCacheEntry *state1 = value1; + + return (state0->mag_filter == state1->mag_filter && + state0->min_filter == state1->min_filter && + state0->wrap_mode_s == state1->wrap_mode_s && + state0->wrap_mode_t == state1->wrap_mode_t && + state0->wrap_mode_p == state1->wrap_mode_p); +} + +static unsigned int +hash_sampler_state_cogl (const void *key) +{ + const CoglSamplerCacheEntry *entry = key; + unsigned int hash = 0; + + hash = _cogl_util_one_at_a_time_hash (hash, &entry->mag_filter, + sizeof (entry->mag_filter)); + hash = _cogl_util_one_at_a_time_hash (hash, &entry->min_filter, + sizeof (entry->min_filter)); + hash = _cogl_util_one_at_a_time_hash (hash, &entry->wrap_mode_s, + sizeof (entry->wrap_mode_s)); + hash = _cogl_util_one_at_a_time_hash (hash, &entry->wrap_mode_t, + sizeof (entry->wrap_mode_t)); + hash = _cogl_util_one_at_a_time_hash (hash, &entry->wrap_mode_p, + sizeof (entry->wrap_mode_p)); + + return _cogl_util_one_at_a_time_mix (hash); +} + +CoglSamplerCache * +_cogl_sampler_cache_new (CoglContext *context) +{ + CoglSamplerCache *cache = g_new (CoglSamplerCache, 1); + + /* No reference is taken on the context because it would create a + circular reference */ + cache->context = context; + + cache->hash_table_gl = g_hash_table_new (hash_sampler_state_gl, + sampler_state_equal_gl); + cache->hash_table_cogl = g_hash_table_new (hash_sampler_state_cogl, + sampler_state_equal_cogl); + cache->next_fake_sampler_object_number = 1; + + return cache; +} + +static void +set_wrap_mode (CoglContext *context, + GLuint sampler_object, + GLenum param, + CoglSamplerCacheWrapMode wrap_mode) +{ + GE( context, glSamplerParameteri (sampler_object, + param, + wrap_mode) ); +} + +static CoglSamplerCacheEntry * +_cogl_sampler_cache_get_entry_gl (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *key) +{ + CoglSamplerCacheEntry *entry; + + entry = g_hash_table_lookup (cache->hash_table_gl, key); + + if (entry == NULL) + { + CoglContext *context = cache->context; + + entry = g_slice_dup (CoglSamplerCacheEntry, key); + + if (_cogl_has_private_feature (context, + COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS)) + { + GE( context, glGenSamplers (1, &entry->sampler_object) ); + + GE( context, glSamplerParameteri (entry->sampler_object, + GL_TEXTURE_MIN_FILTER, + entry->min_filter) ); + GE( context, glSamplerParameteri (entry->sampler_object, + GL_TEXTURE_MAG_FILTER, + entry->mag_filter) ); + + set_wrap_mode (context, + entry->sampler_object, + GL_TEXTURE_WRAP_S, + entry->wrap_mode_s); + set_wrap_mode (context, + entry->sampler_object, + GL_TEXTURE_WRAP_T, + entry->wrap_mode_t); + set_wrap_mode (context, + entry->sampler_object, + GL_TEXTURE_WRAP_R, + entry->wrap_mode_p); + } + else + { + /* If sampler objects aren't supported then we'll invent a + unique number so that pipelines can still compare the + unique state just by comparing the sampler object + numbers */ + entry->sampler_object = cache->next_fake_sampler_object_number++; + } + + g_hash_table_insert (cache->hash_table_gl, entry, entry); + } + + return entry; +} + +static CoglSamplerCacheEntry * +_cogl_sampler_cache_get_entry_cogl (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *key) +{ + CoglSamplerCacheEntry *entry; + + entry = g_hash_table_lookup (cache->hash_table_cogl, key); + + if (entry == NULL) + { + CoglSamplerCacheEntry canonical_key; + CoglSamplerCacheEntry *gl_entry; + + entry = g_slice_dup (CoglSamplerCacheEntry, key); + + /* Get the sampler object number from the canonical GL version + of the sampler state cache */ + canonical_key = *key; + canonicalize_key (&canonical_key); + gl_entry = _cogl_sampler_cache_get_entry_gl (cache, &canonical_key); + entry->sampler_object = gl_entry->sampler_object; + + g_hash_table_insert (cache->hash_table_cogl, entry, entry); + } + + return entry; +} + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_get_default_entry (CoglSamplerCache *cache) +{ + CoglSamplerCacheEntry key; + + key.wrap_mode_s = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC; + key.wrap_mode_t = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC; + key.wrap_mode_p = COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC; + + key.min_filter = GL_LINEAR; + key.mag_filter = GL_LINEAR; + + return _cogl_sampler_cache_get_entry_cogl (cache, &key); +} + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_update_wrap_modes (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *old_entry, + CoglSamplerCacheWrapMode wrap_mode_s, + CoglSamplerCacheWrapMode wrap_mode_t, + CoglSamplerCacheWrapMode wrap_mode_p) +{ + CoglSamplerCacheEntry key = *old_entry; + + key.wrap_mode_s = wrap_mode_s; + key.wrap_mode_t = wrap_mode_t; + key.wrap_mode_p = wrap_mode_p; + + return _cogl_sampler_cache_get_entry_cogl (cache, &key); +} + +const CoglSamplerCacheEntry * +_cogl_sampler_cache_update_filters (CoglSamplerCache *cache, + const CoglSamplerCacheEntry *old_entry, + GLenum min_filter, + GLenum mag_filter) +{ + CoglSamplerCacheEntry key = *old_entry; + + key.min_filter = min_filter; + key.mag_filter = mag_filter; + + return _cogl_sampler_cache_get_entry_cogl (cache, &key); +} + +static void +hash_table_free_gl_cb (void *key, + void *value, + void *user_data) +{ + CoglContext *context = user_data; + CoglSamplerCacheEntry *entry = value; + + if (_cogl_has_private_feature (context, + COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS)) + GE( context, glDeleteSamplers (1, &entry->sampler_object) ); + + g_slice_free (CoglSamplerCacheEntry, entry); +} + +static void +hash_table_free_cogl_cb (void *key, + void *value, + void *user_data) +{ + CoglSamplerCacheEntry *entry = value; + + g_slice_free (CoglSamplerCacheEntry, entry); +} + +void +_cogl_sampler_cache_free (CoglSamplerCache *cache) +{ + g_hash_table_foreach (cache->hash_table_gl, + hash_table_free_gl_cb, + cache->context); + + g_hash_table_destroy (cache->hash_table_gl); + + g_hash_table_foreach (cache->hash_table_cogl, + hash_table_free_cogl_cb, + cache->context); + + g_hash_table_destroy (cache->hash_table_cogl); + + g_free (cache); +} diff --git a/cogl/cogl-sdl.c b/cogl/cogl-sdl.c new file mode 100644 index 0000000..1eb2eb6 --- /dev/null +++ b/cogl/cogl-sdl.c @@ -0,0 +1,111 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-sdl.h" +#include "cogl-context-private.h" +#include "cogl-renderer-private.h" + +void +cogl_sdl_renderer_set_event_type (CoglRenderer *renderer, int type) +{ + renderer->sdl_event_type_set = TRUE; + renderer->sdl_event_type = type; +} + +int +cogl_sdl_renderer_get_event_type (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (renderer->sdl_event_type_set, SDL_USEREVENT); + + return renderer->sdl_event_type; +} + +CoglContext * +cogl_sdl_context_new (int type, CoglError **error) +{ + CoglRenderer *renderer = cogl_renderer_new (); + CoglDisplay *display; + + cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_SDL); + + cogl_sdl_renderer_set_event_type (renderer, type); + + if (!cogl_renderer_connect (renderer, error)) + return NULL; + + display = cogl_display_new (renderer, NULL); + if (!cogl_display_setup (display, error)) + return NULL; + + return cogl_context_new (display, error); +} + +void +cogl_sdl_handle_event (CoglContext *context, SDL_Event *event) +{ + CoglRenderer *renderer; + + _COGL_RETURN_IF_FAIL (cogl_is_context (context)); + + renderer = context->display->renderer; + + _cogl_renderer_handle_native_event (renderer, event); +} + +static void +_cogl_sdl_push_wakeup_event (CoglContext *context) +{ + SDL_Event wakeup_event; + + wakeup_event.type = context->display->renderer->sdl_event_type; + + SDL_PushEvent (&wakeup_event); +} + +void +cogl_sdl_idle (CoglContext *context) +{ + CoglRenderer *renderer = context->display->renderer; + + cogl_poll_renderer_dispatch (renderer, NULL, 0); + + /* It is expected that this will be called from the application + * immediately before blocking in SDL_WaitEvent. However, + * dispatching cause more work to be queued. If that happens we need + * to make sure the blocking returns immediately. We'll post our + * dummy event to make sure that happens + */ + if (!_cogl_list_empty (&renderer->idle_closures)) + _cogl_sdl_push_wakeup_event (context); +} diff --git a/cogl/cogl-sdl.h b/cogl/cogl-sdl.h new file mode 100644 index 0000000..44d308d --- /dev/null +++ b/cogl/cogl-sdl.h @@ -0,0 +1,248 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SDL_H__ +#define __COGL_SDL_H__ + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-sdl + * @short_description: Integration api for the Simple DirectMedia + * Layer library. + * + * Cogl is a portable graphics api that can either be used standalone + * or alternatively integrated with certain existing frameworks. This + * api enables Cogl to be used in conjunction with the Simple + * DirectMedia Layer library. + * + * Using this API a typical SDL application would look something like + * this: + * |[ + * MyAppData data; + * CoglError *error = NULL; + * + * data.ctx = cogl_sdl_context_new (SDL_USEREVENT, &error); + * if (!data.ctx) + * { + * fprintf (stderr, "Failed to create context: %s\n", + * error->message); + * return 1; + * } + * + * my_application_setup (&data); + * + * data.redraw_queued = TRUE; + * while (!data.quit) + * { + * while (!data.quit) + * { + * if (!SDL_PollEvent (&event)) + * { + * if (data.redraw_queued) + * break; + * + * cogl_sdl_idle (ctx); + * if (!SDL_WaitEvent (&event)) + * { + * fprintf (stderr, "Error waiting for SDL events"); + * return 1; + * } + * } + * + * handle_event (&data, &event); + * cogl_sdl_handle_event (ctx, &event); + * } + * + * data.redraw_queued = redraw (&data); + * } + * ]| + */ + +/** + * cogl_sdl_context_new: + * @type: An SDL user event type between SDL_USEREVENT and + * SDL_NUMEVENTS - 1 + * @error: A CoglError return location. + * + * This is a convenience function for creating a new #CoglContext for + * use with SDL and specifying what SDL user event type Cogl can use + * as a way to interrupt SDL_WaitEvent(). + * + * This function is equivalent to the following code: + * |[ + * CoglRenderer *renderer = cogl_renderer_new (); + * CoglDisplay *display; + * + * cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_SDL); + * + * cogl_sdl_renderer_set_event_type (renderer, type); + * + * if (!cogl_renderer_connect (renderer, error)) + * return NULL; + * + * display = cogl_display_new (renderer, NULL); + * if (!cogl_display_setup (display, error)) + * return NULL; + * + * return cogl_context_new (display, error); + * ]| + * + * SDL applications are required to either use this API or + * to manually create a #CoglRenderer and call + * cogl_sdl_renderer_set_event_type(). + * + * Since: 2.0 + * Stability: unstable + */ +CoglContext * +cogl_sdl_context_new (int type, CoglError **error); + +/** + * cogl_sdl_renderer_set_event_type: + * @renderer: A #CoglRenderer + * @type: An SDL user event type between SDL_USEREVENT and + * SDL_NUMEVENTS - 1 + * + * Tells Cogl what SDL user event type it can use as a way to + * interrupt SDL_WaitEvent() to ensure that cogl_sdl_handle_event() + * will be called in a finite amount of time. + * + * This should only be called on an un-connected + * @renderer. + * + * For convenience most simple applications can use + * cogl_sdl_context_new() if they don't want to manually create + * #CoglRenderer and #CoglDisplay objects during + * initialization. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_sdl_renderer_set_event_type (CoglRenderer *renderer, int type); + +/** + * cogl_sdl_renderer_get_event_type: + * @renderer: A #CoglRenderer + * + * Queries what SDL user event type Cogl is using as a way to + * interrupt SDL_WaitEvent(). This is set either using + * cogl_sdl_context_new or by using + * cogl_sdl_renderer_set_event_type(). + * + * Since: 2.0 + * Stability: unstable + */ +int +cogl_sdl_renderer_get_event_type (CoglRenderer *renderer); + +/** + * cogl_sdl_handle_event: + * @context: A #CoglContext + * @event: An SDL event + * + * Passes control to Cogl so that it may dispatch any internal event + * callbacks in response to the given SDL @event. This function must + * be called for every SDL event. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_sdl_handle_event (CoglContext *context, SDL_Event *event); + +/** + * cogl_sdl_idle: + * @context: A #CoglContext + * + * Notifies Cogl that the application is idle and about to call + * SDL_WaitEvent(). Cogl may use this to run low priority book keeping + * tasks. + * + * Since: 2.0 + * Stability: unstable + */ +void +cogl_sdl_idle (CoglContext *context); + +#if SDL_MAJOR_VERSION >= 2 + +/** + * cogl_sdl_onscreen_get_window: + * @onscreen: A #CoglOnscreen + * + * Returns: the underlying SDL_Window associated with an onscreen framebuffer. + * + * Since: 2.0 + * Stability: unstable + */ +SDL_Window * +cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen); + +#endif /* SDL_MAJOR_VERSION */ + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_SDL_H__ */ diff --git a/cogl/cogl-snippet-private.h b/cogl/cogl-snippet-private.h new file mode 100644 index 0000000..e3269f2 --- /dev/null +++ b/cogl/cogl-snippet-private.h @@ -0,0 +1,77 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_SNIPPET_PRIVATE_H +#define __COGL_SNIPPET_PRIVATE_H + +#include + +#include "cogl-snippet.h" +#include "cogl-object-private.h" + +/* These values are also used in the enum for CoglSnippetHook. They + are copied here because we don't really want these names to be part + of the public API */ +#define COGL_SNIPPET_HOOK_BAND_SIZE 2048 +#define COGL_SNIPPET_FIRST_PIPELINE_HOOK 0 +#define COGL_SNIPPET_FIRST_PIPELINE_VERTEX_HOOK \ + COGL_SNIPPET_FIRST_PIPELINE_HOOK +#define COGL_SNIPPET_FIRST_PIPELINE_FRAGMENT_HOOK \ + (COGL_SNIPPET_FIRST_PIPELINE_VERTEX_HOOK + COGL_SNIPPET_HOOK_BAND_SIZE) +#define COGL_SNIPPET_FIRST_LAYER_HOOK (COGL_SNIPPET_HOOK_BAND_SIZE * 2) +#define COGL_SNIPPET_FIRST_LAYER_VERTEX_HOOK COGL_SNIPPET_FIRST_LAYER_HOOK +#define COGL_SNIPPET_FIRST_LAYER_FRAGMENT_HOOK \ + (COGL_SNIPPET_FIRST_LAYER_VERTEX_HOOK + COGL_SNIPPET_HOOK_BAND_SIZE) + +struct _CoglSnippet +{ + CoglObject _parent; + + CoglSnippetHook hook; + + /* This is set to TRUE the first time the snippet is attached to the + pipeline. After that any attempts to modify the snippet will be + ignored. */ + CoglBool immutable; + + char *declarations; + char *pre; + char *replace; + char *post; +}; + +void +_cogl_snippet_make_immutable (CoglSnippet *snippet); + +#endif /* __COGL_SNIPPET_PRIVATE_H */ + diff --git a/cogl/cogl-snippet.c b/cogl/cogl-snippet.c new file mode 100644 index 0000000..a3f5d6c --- /dev/null +++ b/cogl/cogl-snippet.c @@ -0,0 +1,187 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-types.h" +#include "cogl-snippet-private.h" +#include "cogl-util.h" +#include "cogl-gtype-private.h" + +static void +_cogl_snippet_free (CoglSnippet *snippet); + +COGL_OBJECT_DEFINE (Snippet, snippet); +COGL_GTYPE_DEFINE_CLASS (Snippet, snippet); + +CoglSnippet * +cogl_snippet_new (CoglSnippetHook hook, + const char *declarations, + const char *post) +{ + CoglSnippet *snippet = g_slice_new0 (CoglSnippet); + + _cogl_snippet_object_new (snippet); + + snippet->hook = hook; + + cogl_snippet_set_declarations (snippet, declarations); + cogl_snippet_set_post (snippet, post); + + return snippet; +} + +CoglSnippetHook +cogl_snippet_get_hook (CoglSnippet *snippet) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), 0); + + return snippet->hook; +} + +static CoglBool +_cogl_snippet_modify (CoglSnippet *snippet) +{ + if (snippet->immutable) + { + g_warning ("A CoglSnippet should not be modified once it has been " + "attached to a pipeline. Any modifications after that point " + "will be ignored."); + + return FALSE; + } + + return TRUE; +} + +void +cogl_snippet_set_declarations (CoglSnippet *snippet, + const char *declarations) +{ + _COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet)); + + if (!_cogl_snippet_modify (snippet)) + return; + + g_free (snippet->declarations); + snippet->declarations = declarations ? g_strdup (declarations) : NULL; +} + +const char * +cogl_snippet_get_declarations (CoglSnippet *snippet) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); + + return snippet->declarations; +} + +void +cogl_snippet_set_pre (CoglSnippet *snippet, + const char *pre) +{ + _COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet)); + + if (!_cogl_snippet_modify (snippet)) + return; + + g_free (snippet->pre); + snippet->pre = pre ? g_strdup (pre) : NULL; +} + +const char * +cogl_snippet_get_pre (CoglSnippet *snippet) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); + + return snippet->pre; +} + +void +cogl_snippet_set_replace (CoglSnippet *snippet, + const char *replace) +{ + _COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet)); + + if (!_cogl_snippet_modify (snippet)) + return; + + g_free (snippet->replace); + snippet->replace = replace ? g_strdup (replace) : NULL; +} + +const char * +cogl_snippet_get_replace (CoglSnippet *snippet) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); + + return snippet->replace; +} + +void +cogl_snippet_set_post (CoglSnippet *snippet, + const char *post) +{ + _COGL_RETURN_IF_FAIL (cogl_is_snippet (snippet)); + + if (!_cogl_snippet_modify (snippet)) + return; + + g_free (snippet->post); + snippet->post = post ? g_strdup (post) : NULL; +} + +const char * +cogl_snippet_get_post (CoglSnippet *snippet) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); + + return snippet->post; +} + +void +_cogl_snippet_make_immutable (CoglSnippet *snippet) +{ + snippet->immutable = TRUE; +} + +static void +_cogl_snippet_free (CoglSnippet *snippet) +{ + g_free (snippet->declarations); + g_free (snippet->pre); + g_free (snippet->replace); + g_free (snippet->post); + g_slice_free (CoglSnippet, snippet); +} diff --git a/cogl/cogl-snippet.h b/cogl/cogl-snippet.h new file mode 100644 index 0000000..b8d9efd --- /dev/null +++ b/cogl/cogl-snippet.h @@ -0,0 +1,866 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SNIPPET_H__ +#define __COGL_SNIPPET_H__ + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-snippet + * @short_description: Functions for creating and manipulating shader snippets + * + * #CoglSnippets are used to modify or replace parts of a + * #CoglPipeline using GLSL. GLSL is a programming language supported + * by OpenGL on programmable hardware to provide a more flexible + * description of what should be rendered. A description of GLSL + * itself is outside the scope of this documentation but any good + * OpenGL book should help to describe it. + * + * Unlike in OpenGL, when using GLSL with Cogl it is possible to write + * short snippets to replace small sections of the pipeline instead of + * having to replace the whole of either the vertex or fragment + * pipelines. Of course it is also possible to replace the whole of + * the pipeline if needed. + * + * Each snippet is a standalone chunk of code which would attach to + * the pipeline at a particular point. The code is split into four + * separate strings (all of which are optional): + * + * + * + * declarations + * + * The code in this string will be inserted outside of any function in + * the global scope of the shader. This can be used to declare + * uniforms, attributes, varyings and functions to be used by the + * snippet. + * + * + * + * pre + * + * The code in this string will be inserted before the hook point. + * + * + * + * post + * + * The code in this string will be inserted after the hook point. This + * can be used to modify the results of the builtin generated code for + * that hook point. + * + * + * + * replace + * + * If present the code in this string will replace the generated code + * for the hook point. + * + * + * + * + * All of the strings apart from the declarations string of a pipeline + * are generated in a single function so they can share variables + * declared from one string in another. The scope of the code is + * limited to each snippet so local variables declared in the snippet + * will not collide with variables declared in another + * snippet. However, code in the 'declarations' string is global to + * the shader so it is the application's responsibility to ensure that + * variables declared here will not collide with those from other + * snippets. + * + * The snippets can be added to a pipeline with + * cogl_pipeline_add_snippet() or + * cogl_pipeline_add_layer_snippet(). Which function to use depends on + * which hook the snippet is targetting. The snippets are all + * generated in the order they are added to the pipeline. That is, the + * post strings are executed in the order they are added to the + * pipeline and the pre strings are executed in reverse order. If any + * replace strings are given for a snippet then any other snippets + * with the same hook added before that snippet will be ignored. The + * different hooks are documented under #CoglSnippetHook. + * + * For portability with GLES2, it is recommended not to use the GLSL + * builtin names such as gl_FragColor. Instead there are replacement + * names under the cogl_* namespace which can be used instead. These + * are: + * + * + * + * uniform mat4 + * cogl_modelview_matrix + * + * The current modelview matrix. This is equivalent to + * #gl_ModelViewMatrix. + * + * + * + * uniform mat4 + * cogl_projection_matrix + * + * The current projection matrix. This is equivalent to + * #gl_ProjectionMatrix. + * + * + * + * uniform mat4 + * cogl_modelview_projection_matrix + * + * The combined modelview and projection matrix. A vertex shader + * would typically use this to transform the incoming vertex + * position. The separate modelview and projection matrices are + * usually only needed for lighting calculations. This is + * equivalent to #gl_ModelViewProjectionMatrix. + * + * + * + * uniform mat4 + * cogl_texture_matrix[] + * + * An array of matrices for transforming the texture + * coordinates. This is equivalent to #gl_TextureMatrix. + * + * + * + * + * In a vertex shader, the following are also available: + * + * + * + * attribute vec4 + * cogl_position_in + * + * The incoming vertex position. This is equivalent to #gl_Vertex. + * + * + * + * attribute vec4 + * cogl_color_in + * + * The incoming vertex color. This is equivalent to #gl_Color. + * + * + * + * attribute vec4 + * cogl_tex_coord_in + * + * The texture coordinate for layer 0. This is an alternative name + * for #cogl_tex_coord0_in. + * + * + * + * attribute vec4 + * cogl_tex_coord0_in + * + * The texture coordinate for the layer 0. This is equivalent to + * #gl_MultiTexCoord0. There will also be #cogl_tex_coord1_in and + * so on if more layers are added to the pipeline. + * + * + * + * attribute vec3 + * cogl_normal_in + * + * The normal of the vertex. This is equivalent to #gl_Normal. + * + * + * + * vec4 + * cogl_position_out + * + * The calculated position of the vertex. This must be written to + * in all vertex shaders. This is equivalent to #gl_Position. + * + * + * + * float + * cogl_point_size_in + * + * The incoming point size from the cogl_point_size_in attribute. + * This is only available if + * cogl_pipeline_set_per_vertex_point_size() is set on the + * pipeline. + * + * + * + * float + * cogl_point_size_out + * + * The calculated size of a point. This is equivalent to #gl_PointSize. + * + * + * + * varying vec4 + * cogl_color_out + * + * The calculated color of a vertex. This is equivalent to #gl_FrontColor. + * + * + * + * varying vec4 + * cogl_tex_coord0_out + * + * The calculated texture coordinate for layer 0 of the pipeline. + * This is equivalent to #gl_TexCoord[0]. There will also be + * #cogl_tex_coord1_out and so on if more layers are added to the + * pipeline. In the fragment shader, this varying is called + * #cogl_tex_coord0_in. + * + * + * + * + * In a fragment shader, the following are also available: + * + * + * + * varying vec4 cogl_color_in + * + * The calculated color of a vertex. This is equivalent to #gl_FrontColor. + * + * + * + * varying vec4 + * cogl_tex_coord0_in + * + * The texture coordinate for layer 0. This is equivalent to + * #gl_TexCoord[0]. There will also be #cogl_tex_coord1_in and so + * on if more layers are added to the pipeline. + * + * + * + * vec4 cogl_color_out + * + * The final calculated color of the fragment. All fragment shaders + * must write to this variable. This is equivalent to + * #gl_FrontColor. + * + * + * + * float cogl_depth_out + * + * An optional output variable specifying the depth value to use + * for this fragment. This is equivalent to #gl_FragDepth. + * + * + * + * bool cogl_front_facing + * + * A readonly variable that will be true if the current primitive + * is front facing. This can be used to implement two-sided + * coloring algorithms. This is equivalent to #gl_FrontFacing. + * + * + * + * vec2 cogl_point_coord + * + * When rendering points, this will contain a vec2 which represents + * the position within the point of the current fragment. + * vec2(0.0,0.0) will be the topleft of the point and vec2(1.0,1.0) + * will be the bottom right. Note that there is currently a bug in + * Cogl where when rendering to an offscreen buffer these + * coordinates will be upside-down. The value is undefined when not + * rendering points. This builtin can only be used if the + * %COGL_FEATURE_ID_POINT_SPRITE feature is available. + * + * + * + * + * Here is an example of using a snippet to add a desaturate effect to the + * generated color on a pipeline. + * + * + * CoglPipeline *pipeline = cogl_pipeline_new (); + * + * /* Set up the pipeline here, ie by adding a texture or other + * layers */ + * + * /* Create the snippet. The first string is the declarations which + * we will use to add a uniform. The second is the 'post' string which + * will contain the code to perform the desaturation. */ + * CoglSnippet *snippet = + * cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + * "uniform float factor;", + * "float gray = dot (vec3 (0.299, 0.587, 0.114), " + * " cogl_color_out.rgb);" + * "cogl_color_out.rgb = mix (vec3 (gray)," + * " cogl_color_out.rgb," + * " factor);"); + * + * /* Add it to the pipeline */ + * cogl_pipeline_add_snippet (pipeline, snippet); + * /* The pipeline keeps a reference to the snippet + * so we don't need to */ + * cogl_object_unref (snippet); + * + * /* Update the custom uniform on the pipeline */ + * int location = cogl_pipeline_get_uniform_location (pipeline, "factor"); + * cogl_pipeline_set_uniform_1f (pipeline, location, 0.5f); + * + * /* Now we can render with the snippet as usual */ + * cogl_push_source (pipeline); + * cogl_rectangle (0, 0, 10, 10); + * cogl_pop_source (); + * + */ +typedef struct _CoglSnippet CoglSnippet; + +#define COGL_SNIPPET(OBJECT) ((CoglSnippet *)OBJECT) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_snippet_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_snippet_get_gtype (void); +#endif + +/* Enumeration of all the hook points that a snippet can be attached + to within a pipeline. */ +/** + * CoglSnippetHook: + * @COGL_SNIPPET_HOOK_VERTEX_GLOBALS: A hook for declaring global data + * that can be shared with all other snippets that are on a vertex + * hook. + * @COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS: A hook for declaring global + * data wthat can be shared with all other snippets that are on a + * fragment hook. + * @COGL_SNIPPET_HOOK_VERTEX: A hook for the entire vertex processing + * stage of the pipeline. + * @COGL_SNIPPET_HOOK_VERTEX_TRANSFORM: A hook for the vertex transformation. + * @COGL_SNIPPET_HOOK_POINT_SIZE: A hook for manipulating the point + * size of a vertex. This is only used if + * cogl_pipeline_set_per_vertex_point_size() is enabled on the + * pipeline. + * @COGL_SNIPPET_HOOK_FRAGMENT: A hook for the entire fragment + * processing stage of the pipeline. + * @COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM: A hook for applying the + * layer matrix to a texture coordinate for a layer. + * @COGL_SNIPPET_HOOK_LAYER_FRAGMENT: A hook for the fragment + * processing of a particular layer. + * @COGL_SNIPPET_HOOK_TEXTURE_LOOKUP: A hook for the texture lookup + * stage of a given layer in a pipeline. + * + * #CoglSnippetHook is used to specify a location within a + * #CoglPipeline where the code of the snippet should be used when it + * is attached to a pipeline. + * + * + * + * %COGL_SNIPPET_HOOK_VERTEX_GLOBALS + * + * + * Adds a shader snippet at the beginning of the global section of the + * shader for the vertex processing. Any declarations here can be + * shared with all other snippets that are attached to a vertex hook. + * Only the ‘declarations’ string is used and the other strings are + * ignored. + * + * + * + * + * %COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS + * + * + * Adds a shader snippet at the beginning of the global section of the + * shader for the fragment processing. Any declarations here can be + * shared with all other snippets that are attached to a fragment + * hook. Only the ‘declarations’ string is used and the other strings + * are ignored. + * + * + * + * + * %COGL_SNIPPET_HOOK_VERTEX + * + * + * Adds a shader snippet that will hook on to the vertex processing + * stage of the pipeline. This gives a chance for the application to + * modify the vertex attributes generated by the shader. Typically the + * snippet will modify cogl_color_out or cogl_position_out builtins. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted at the top of the + * main() function before any vertex processing is done. + * + * + * The ‘replace’ string in @snippet will be used instead of the + * generated vertex processing if it is present. This can be used if + * the application wants to provide a complete vertex shader and + * doesn't need the generated output from Cogl. + * + * + * The ‘post’ string in @snippet will be inserted after all of the + * standard vertex processing is done. This can be used to modify the + * outputs. + * + * + * + * + * %COGL_SNIPPET_HOOK_VERTEX_TRANSFORM + * + * + * Adds a shader snippet that will hook on to the vertex transform stage. + * Typically the snippet will use the cogl_modelview_matrix, + * cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the + * cogl_position_in attribute. The hook must write to cogl_position_out. + * The default processing for this hook will multiply cogl_position_in by + * the combined modelview-projection matrix and store it on cogl_position_out. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted at the top of the + * main() function before the vertex transform is done. + * + * + * The ‘replace’ string in @snippet will be used instead of the + * generated vertex transform if it is present. + * + * + * The ‘post’ string in @snippet will be inserted after all of the + * standard vertex transformation is done. This can be used to modify the + * cogl_position_out in addition to the default processing. + * + * + * + * + * %COGL_SNIPPET_HOOK_POINT_SIZE + * + * + * Adds a shader snippet that will hook on to the point size + * calculation step within the vertex shader stage. The snippet should + * write to the builtin cogl_point_size_out with the new point size. + * The snippet can either read cogl_point_size_in directly and write a + * new value or first read an existing value in cogl_point_size_out + * that would be set by a previous snippet. Note that this hook is + * only used if cogl_pipeline_set_per_vertex_point_size() is enabled + * on the pipeline. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted just before + * calculating the point size. + * + * + * The ‘replace’ string in @snippet will be used instead of the + * generated point size calculation if it is present. + * + * + * The ‘post’ string in @snippet will be inserted after the + * standard point size calculation is done. This can be used to modify + * cogl_point_size_out in addition to the default processing. + * + * + * + * + * %COGL_SNIPPET_HOOK_FRAGMENT + * + * + * Adds a shader snippet that will hook on to the fragment processing + * stage of the pipeline. This gives a chance for the application to + * modify the fragment color generated by the shader. Typically the + * snippet will modify cogl_color_out. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted at the top of the + * main() function before any fragment processing is done. + * + * + * The ‘replace’ string in @snippet will be used instead of the + * generated fragment processing if it is present. This can be used if + * the application wants to provide a complete fragment shader and + * doesn't need the generated output from Cogl. + * + * + * The ‘post’ string in @snippet will be inserted after all of the + * standard fragment processing is done. At this point the generated + * value for the rest of the pipeline state will already be in + * cogl_color_out so the application can modify the result by altering + * this variable. + * + * + * + * + * %COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM + * + * + * Adds a shader snippet that will hook on to the texture coordinate + * transformation of a particular layer. This can be used to replace + * the processing for a layer or to modify the results. + * + * + * Within the snippet code for this hook there are two extra + * variables. The first is a mat4 called cogl_matrix which represents + * the user matrix for this layer. The second is called cogl_tex_coord + * and represents the incoming and outgoing texture coordinate. On + * entry to the hook, cogl_tex_coord contains the value of the + * corresponding texture coordinate attribute for this layer. The hook + * is expected to modify this variable. The output will be passed as a + * varying to the fragment processing stage. The default code will + * just multiply cogl_matrix by cogl_tex_coord and store the result in + * cogl_tex_coord. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted just before the + * fragment processing for this layer. At this point cogl_tex_coord + * still contains the value of the texture coordinate attribute. + * + * + * If a ‘replace’ string is given then this will be used instead of + * the default fragment processing for this layer. The snippet can + * modify cogl_tex_coord or leave it as is to apply no transformation. + * + * + * The ‘post’ string in @snippet will be inserted just after the + * transformation. At this point cogl_tex_coord will contain the + * results of the transformation but it can be further modified by the + * snippet. + * + * + * + * + * %COGL_SNIPPET_HOOK_LAYER_FRAGMENT + * + * + * Adds a shader snippet that will hook on to the fragment processing + * of a particular layer. This can be used to replace the processing + * for a layer or to modify the results. + * + * + * Within the snippet code for this hook there is an extra vec4 + * variable called ‘cogl_layer’. This contains the resulting color + * that will be used for the layer. This can be modified in the ‘post’ + * section or it the default processing can be replaced entirely using + * the ‘replace’ section. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted just before the + * fragment processing for this layer. + * + * + * If a ‘replace’ string is given then this will be used instead of + * the default fragment processing for this layer. The snippet must write to + * the ‘cogl_layer’ variable in that case. + * + * + * The ‘post’ string in @snippet will be inserted just after the + * fragment processing for the layer. The results can be modified by changing + * the value of the ‘cogl_layer’ variable. + * + * + * + * + * %COGL_SNIPPET_HOOK_TEXTURE_LOOKUP + * + * + * Adds a shader snippet that will hook on to the texture lookup part + * of a given layer. This gives a chance for the application to modify + * the coordinates that will be used for the texture lookup or to + * alter the returned texel. + * + * + * Within the snippet code for this hook there are three extra + * variables available. ‘cogl_sampler’ is a sampler object + * representing the sampler for the layer where the snippet is + * attached. ‘cogl_tex_coord’ is a vec4 which contains the texture + * coordinates that will be used for the texture lookup. This can be + * modified. ‘cogl_texel’ will contain the result of the texture + * lookup. This can also be modified. + * + * + * The ‘declarations’ string in @snippet will be inserted in the + * global scope of the shader. Use this to declare any uniforms, + * attributes or functions that the snippet requires. + * + * + * The ‘pre’ string in @snippet will be inserted at the top of the + * main() function before any fragment processing is done. This is a + * good place to modify the cogl_tex_coord variable. + * + * + * If a ‘replace’ string is given then this will be used instead of a + * the default texture lookup. The snippet would typically use its own + * sampler in this case. + * + * + * The ‘post’ string in @snippet will be inserted after texture lookup + * has been preformed. Here the snippet can modify the cogl_texel + * variable to alter the returned texel. + * + * + * + * + * + * Since: 1.10 + * Stability: Unstable + */ +typedef enum { + /* Per pipeline vertex hooks */ + COGL_SNIPPET_HOOK_VERTEX = 0, + COGL_SNIPPET_HOOK_VERTEX_TRANSFORM, + COGL_SNIPPET_HOOK_VERTEX_GLOBALS, + COGL_SNIPPET_HOOK_POINT_SIZE, + + /* Per pipeline fragment hooks */ + COGL_SNIPPET_HOOK_FRAGMENT = 2048, + COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS, + + /* Per layer vertex hooks */ + COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM = 4096, + + /* Per layer fragment hooks */ + COGL_SNIPPET_HOOK_LAYER_FRAGMENT = 6144, + COGL_SNIPPET_HOOK_TEXTURE_LOOKUP +} CoglSnippetHook; + +/** + * cogl_snippet_new: + * @hook: The point in the pipeline that this snippet will wrap around + * or replace. + * @declarations: The source code for the declarations for this + * snippet or %NULL. See cogl_snippet_set_declarations(). + * @post: The source code to run after the hook point where this + * shader snippet is attached or %NULL. See cogl_snippet_set_post(). + * + * Allocates and initializes a new snippet with the given source strings. + * + * Return value: a pointer to a new #CoglSnippet + * + * Since: 1.10 + * Stability: Unstable + */ +CoglSnippet * +cogl_snippet_new (CoglSnippetHook hook, + const char *declarations, + const char *post); + +/** + * cogl_snippet_get_hook: + * @snippet: A #CoglSnippet + * + * Return value: the hook that was set when cogl_snippet_new() was + * called. + * Since: 1.10 + * Stability: Unstable + */ +CoglSnippetHook +cogl_snippet_get_hook (CoglSnippet *snippet); + +/** + * cogl_is_snippet: + * @object: A #CoglObject pointer + * + * Gets whether the given @object references an existing snippet object. + * + * Return value: %TRUE if the @object references a #CoglSnippet, + * %FALSE otherwise + * + * Since: 1.10 + * Stability: Unstable + */ +CoglBool +cogl_is_snippet (void *object); + +/** + * cogl_snippet_set_declarations: + * @snippet: A #CoglSnippet + * @declarations: The new source string for the declarations section + * of this snippet. + * + * Sets a source string that will be inserted in the global scope of + * the generated shader when this snippet is used on a pipeline. This + * string is typically used to declare uniforms, attributes or + * functions that will be used by the other parts of the snippets. + * + * This function should only be called before the snippet is attached + * to its first pipeline. After that the snippet should be considered + * immutable. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_snippet_set_declarations (CoglSnippet *snippet, + const char *declarations); + +/** + * cogl_snippet_get_declarations: + * @snippet: A #CoglSnippet + * + * Return value: the source string that was set with + * cogl_snippet_set_declarations() or %NULL if none was set. + * + * Since: 1.10 + * Stability: Unstable + */ +const char * +cogl_snippet_get_declarations (CoglSnippet *snippet); + +/** + * cogl_snippet_set_pre: + * @snippet: A #CoglSnippet + * @pre: The new source string for the pre section of this snippet. + * + * Sets a source string that will be inserted before the hook point in + * the generated shader for the pipeline that this snippet is attached + * to. Please see the documentation of each hook point in + * #CoglPipeline for a description of how this string should be used. + * + * This function should only be called before the snippet is attached + * to its first pipeline. After that the snippet should be considered + * immutable. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_snippet_set_pre (CoglSnippet *snippet, + const char *pre); + +/** + * cogl_snippet_get_pre: + * @snippet: A #CoglSnippet + * + * Return value: the source string that was set with + * cogl_snippet_set_pre() or %NULL if none was set. + * + * Since: 1.10 + * Stability: Unstable + */ +const char * +cogl_snippet_get_pre (CoglSnippet *snippet); + +/** + * cogl_snippet_set_replace: + * @snippet: A #CoglSnippet + * @replace: The new source string for the replace section of this snippet. + * + * Sets a source string that will be used instead of any generated + * source code or any previous snippets for this hook point. Please + * see the documentation of each hook point in #CoglPipeline for a + * description of how this string should be used. + * + * This function should only be called before the snippet is attached + * to its first pipeline. After that the snippet should be considered + * immutable. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_snippet_set_replace (CoglSnippet *snippet, + const char *replace); + +/** + * cogl_snippet_get_replace: + * @snippet: A #CoglSnippet + * + * Return value: the source string that was set with + * cogl_snippet_set_replace() or %NULL if none was set. + * + * Since: 1.10 + * Stability: Unstable + */ +const char * +cogl_snippet_get_replace (CoglSnippet *snippet); + +/** + * cogl_snippet_set_post: + * @snippet: A #CoglSnippet + * @post: The new source string for the post section of this snippet. + * + * Sets a source string that will be inserted after the hook point in + * the generated shader for the pipeline that this snippet is attached + * to. Please see the documentation of each hook point in + * #CoglPipeline for a description of how this string should be used. + * + * This function should only be called before the snippet is attached + * to its first pipeline. After that the snippet should be considered + * immutable. + * + * Since: 1.10 + * Stability: Unstable + */ +void +cogl_snippet_set_post (CoglSnippet *snippet, + const char *post); + +/** + * cogl_snippet_get_post: + * @snippet: A #CoglSnippet + * + * Return value: the source string that was set with + * cogl_snippet_set_post() or %NULL if none was set. + * + * Since: 1.10 + * Stability: Unstable + */ +const char * +cogl_snippet_get_post (CoglSnippet *snippet); + +COGL_END_DECLS + +#endif /* __COGL_SNIPPET_H__ */ diff --git a/cogl/cogl-spans.c b/cogl/cogl-spans.c new file mode 100644 index 0000000..e7ca678 --- /dev/null +++ b/cogl/cogl-spans.c @@ -0,0 +1,183 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "math.h" + +#include "cogl-util.h" +#include "cogl-spans.h" + +void +_cogl_span_iter_update (CoglSpanIter *iter) +{ + /* Pick current span */ + iter->span = &iter->spans[iter->index]; + + /* Offset next position by span size */ + iter->next_pos = iter->pos + iter->span->size - iter->span->waste; + + /* Check if span intersects the area to cover */ + if (iter->next_pos <= iter->cover_start || + iter->pos >= iter->cover_end) + { + /* Intersection undefined */ + iter->intersects = FALSE; + return; + } + + iter->intersects = TRUE; + + /* Clip start position to coverage area */ + if (iter->pos < iter->cover_start) + iter->intersect_start = iter->cover_start; + else + iter->intersect_start = iter->pos; + + /* Clip end position to coverage area */ + if (iter->next_pos > iter->cover_end) + iter->intersect_end = iter->cover_end; + else + iter->intersect_end = iter->next_pos; +} + +void +_cogl_span_iter_begin (CoglSpanIter *iter, + const CoglSpan *spans, + int n_spans, + float normalize_factor, + float cover_start, + float cover_end, + CoglPipelineWrapMode wrap_mode) +{ + /* XXX: If CLAMP_TO_EDGE needs to be emulated then it needs to be + * done at a higher level than here... */ + _COGL_RETURN_IF_FAIL (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT || + wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT); + + iter->span = NULL; + + iter->spans = spans; + iter->n_spans = n_spans; + + /* We always iterate in a positive direction from the origin. If + * iter->flipped == TRUE that means whoever is using this API should + * interpreted the current span as extending in the opposite direction. I.e. + * it extends to the left if iterating the X axis, or up if the Y axis. */ + if (cover_start > cover_end) + { + float tmp = cover_start; + cover_start = cover_end; + cover_end = tmp; + iter->flipped = TRUE; + } + else + iter->flipped = FALSE; + + /* The texture spans cover the normalized texture coordinate space ranging + * from [0,1] but to help support repeating of sliced textures we allow + * iteration of any range so we need to relate the start of the range to the + * nearest point equivalent to 0. + */ + if (normalize_factor != 1.0) + { + float cover_start_normalized = cover_start / normalize_factor; + iter->origin = floorf (cover_start_normalized) * normalize_factor; + } + else + iter->origin = floorf (cover_start); + + iter->wrap_mode = wrap_mode; + + if (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT) + iter->index = 0; + else if (wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT) + { + if ((int)iter->origin % 2) + { + iter->index = iter->n_spans - 1; + iter->mirror_direction = -1; + iter->flipped = !iter->flipped; + } + else + { + iter->index = 0; + iter->mirror_direction = 1; + } + } + else + g_warn_if_reached (); + + iter->cover_start = cover_start; + iter->cover_end = cover_end; + iter->pos = iter->origin; + + /* Update intersection */ + _cogl_span_iter_update (iter); + + while (iter->next_pos <= iter->cover_start) + _cogl_span_iter_next (iter); +} + +void +_cogl_span_iter_next (CoglSpanIter *iter) +{ + /* Move current position */ + iter->pos = iter->next_pos; + + if (iter->wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT) + iter->index = (iter->index + 1) % iter->n_spans; + else if (iter->wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT) + { + iter->index += iter->mirror_direction; + if (iter->index == iter->n_spans || iter->index == -1) + { + iter->mirror_direction = -iter->mirror_direction; + iter->index += iter->mirror_direction; + iter->flipped = !iter->flipped; + } + } + else + g_warn_if_reached (); + + /* Update intersection */ + _cogl_span_iter_update (iter); +} + +CoglBool +_cogl_span_iter_end (CoglSpanIter *iter) +{ + /* End reached when whole area covered */ + return iter->pos >= iter->cover_end; +} + + diff --git a/cogl/cogl-spans.h b/cogl/cogl-spans.h new file mode 100644 index 0000000..a236784 --- /dev/null +++ b/cogl/cogl-spans.h @@ -0,0 +1,81 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SPANS_PRIVATE_H +#define __COGL_SPANS_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-pipeline-layer-state.h" + +typedef struct _CoglSpan +{ + float start; + float size; + float waste; +} CoglSpan; + +typedef struct _CoglSpanIter +{ + int index; + const CoglSpan *spans; + int n_spans; + const CoglSpan *span; + float pos; + float next_pos; + float origin; + float cover_start; + float cover_end; + float intersect_start; + float intersect_end; + CoglBool intersects; + CoglBool flipped; + CoglPipelineWrapMode wrap_mode; + int mirror_direction; +} CoglSpanIter; + +void +_cogl_span_iter_update (CoglSpanIter *iter); + +void +_cogl_span_iter_begin (CoglSpanIter *iter, + const CoglSpan *spans, + int n_spans, + float normalize_factor, + float cover_start, + float cover_end, + CoglPipelineWrapMode wrap_mode); + +void +_cogl_span_iter_next (CoglSpanIter *iter); + +CoglBool +_cogl_span_iter_end (CoglSpanIter *iter); + +#endif /* __COGL_SPANS_PRIVATE_H */ diff --git a/cogl/cogl-sub-texture-private.h b/cogl/cogl-sub-texture-private.h new file mode 100644 index 0000000..75c476d --- /dev/null +++ b/cogl/cogl-sub-texture-private.h @@ -0,0 +1,62 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SUB_TEXTURE_PRIVATE_H +#define __COGL_SUB_TEXTURE_PRIVATE_H + +#include "cogl-texture-private.h" + +#include + +struct _CoglSubTexture +{ + CoglTexture _parent; + + /* This is the texture that was passed in to + _cogl_sub_texture_new. If this is also a sub texture then we will + use the full texture from that to render instead of making a + chain. However we want to preserve the next texture in case the + user is expecting us to keep a reference and also so that we can + later add a cogl_sub_texture_get_parent_texture() function. */ + CoglTexture *next_texture; + /* This is the texture that will actually be used to draw. It will + point to the end of the chain if a sub texture of a sub texture + is created */ + CoglTexture *full_texture; + + /* The offset of the region represented by this sub-texture. This is + * the offset in full_texture which won't necessarily be the same as + * the offset passed to _cogl_sub_texture_new if next_texture is + * actually already a sub texture */ + int sub_x; + int sub_y; +}; + +#endif /* __COGL_SUB_TEXTURE_PRIVATE_H */ diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c new file mode 100644 index 0000000..7baf95e --- /dev/null +++ b/cogl/cogl-sub-texture.c @@ -0,0 +1,480 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-sub-texture-private.h" +#include "cogl-sub-texture.h" +#include "cogl-context-private.h" +#include "cogl-object.h" +#include "cogl-texture-driver.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-texture-2d.h" +#include "cogl-texture-gl-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +static void _cogl_sub_texture_free (CoglSubTexture *sub_tex); + +COGL_TEXTURE_DEFINE (SubTexture, sub_texture); +COGL_GTYPE_DEFINE_CLASS (SubTexture, sub_texture); + +static const CoglTextureVtable cogl_sub_texture_vtable; + +static void +_cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex, + float *coords) +{ + CoglTexture *tex = COGL_TEXTURE (sub_tex); + + /* NB: coords[] come in as non-normalized if sub_tex->full_texture + * is a CoglTextureRectangle otherwhise they are normalized. The + * coordinates we write out though must always be normalized. + * + * NB: sub_tex->sub_x/y/width/height are in non-normalized + * coordinates. + */ + if (cogl_is_texture_rectangle (sub_tex->full_texture)) + { + coords[0] = (coords[0] - sub_tex->sub_x) / tex->width; + coords[1] = (coords[1] - sub_tex->sub_y) / tex->height; + coords[2] = (coords[2] - sub_tex->sub_x) / tex->width; + coords[3] = (coords[3] - sub_tex->sub_y) / tex->height; + } + else + { + float width = cogl_texture_get_width (sub_tex->full_texture); + float height = cogl_texture_get_height (sub_tex->full_texture); + coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width; + coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height; + coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width; + coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height; + } +} + +static void +_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex, + float *coords) +{ + CoglTexture *tex = COGL_TEXTURE (sub_tex); + + /* NB: coords[] always come in as normalized coordinates but may go + * out as non-normalized if sub_tex->full_texture is a + * CoglTextureRectangle. + * + * NB: sub_tex->sub_x/y/width/height are in non-normalized + * coordinates. + */ + + if (cogl_is_texture_rectangle (sub_tex->full_texture)) + { + coords[0] = coords[0] * tex->width + sub_tex->sub_x; + coords[1] = coords[1] * tex->height + sub_tex->sub_y; + coords[2] = coords[2] * tex->width + sub_tex->sub_x; + coords[3] = coords[3] * tex->height + sub_tex->sub_y; + } + else + { + float width = cogl_texture_get_width (sub_tex->full_texture); + float height = cogl_texture_get_height (sub_tex->full_texture); + coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width; + coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height; + coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width; + coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height; + } +} + +typedef struct _CoglSubTextureForeachData +{ + CoglSubTexture *sub_tex; + CoglMetaTextureCallback callback; + void *user_data; +} CoglSubTextureForeachData; + +static void +unmap_coords_cb (CoglTexture *slice_texture, + const float *slice_texture_coords, + const float *meta_coords, + void *user_data) +{ + CoglSubTextureForeachData *data = user_data; + float unmapped_coords[4]; + + memcpy (unmapped_coords, meta_coords, sizeof (unmapped_coords)); + + _cogl_sub_texture_unmap_quad (data->sub_tex, unmapped_coords); + + data->callback (slice_texture, + slice_texture_coords, + unmapped_coords, + data->user_data); +} + +static void +_cogl_sub_texture_foreach_sub_texture_in_region ( + CoglTexture *tex, + float virtual_tx_1, + float virtual_ty_1, + float virtual_tx_2, + float virtual_ty_2, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + CoglTexture *full_texture = sub_tex->full_texture; + float mapped_coords[4] = + { virtual_tx_1, virtual_ty_1, virtual_tx_2, virtual_ty_2}; + float virtual_coords[4] = + { virtual_tx_1, virtual_ty_1, virtual_tx_2, virtual_ty_2}; + + /* map the virtual coordinates to ->full_texture coordinates */ + _cogl_sub_texture_map_quad (sub_tex, mapped_coords); + + /* TODO: Add something like cogl_is_low_level_texture() */ + if (cogl_is_texture_2d (full_texture) || + cogl_is_texture_rectangle (full_texture)) + { + callback (sub_tex->full_texture, + mapped_coords, + virtual_coords, + user_data); + } + else + { + CoglSubTextureForeachData data; + + data.sub_tex = sub_tex; + data.callback = callback; + data.user_data = user_data; + + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (full_texture), + mapped_coords[0], + mapped_coords[1], + mapped_coords[2], + mapped_coords[3], + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + unmap_coords_cb, + &data); + } +} + +static void +_cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (sub_tex->full_texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); +} + +static void +_cogl_sub_texture_free (CoglSubTexture *sub_tex) +{ + cogl_object_unref (sub_tex->next_texture); + cogl_object_unref (sub_tex->full_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (sub_tex)); +} + +CoglSubTexture * +cogl_sub_texture_new (CoglContext *ctx, + CoglTexture *next_texture, + int sub_x, int sub_y, + int sub_width, int sub_height) +{ + CoglTexture *full_texture; + CoglSubTexture *sub_tex; + CoglTexture *tex; + unsigned int next_width, next_height; + + next_width = cogl_texture_get_width (next_texture); + next_height = cogl_texture_get_height (next_texture); + + /* The region must specify a non-zero subset of the full texture */ + _COGL_RETURN_VAL_IF_FAIL (sub_x >= 0 && sub_y >= 0, NULL); + _COGL_RETURN_VAL_IF_FAIL (sub_width > 0 && sub_height > 0, NULL); + _COGL_RETURN_VAL_IF_FAIL (sub_x + sub_width <= next_width, NULL); + _COGL_RETURN_VAL_IF_FAIL (sub_y + sub_height <= next_height, NULL); + + sub_tex = g_new (CoglSubTexture, 1); + + tex = COGL_TEXTURE (sub_tex); + + _cogl_texture_init (tex, ctx, sub_width, sub_height, + _cogl_texture_get_format (next_texture), + NULL, /* no loader */ + &cogl_sub_texture_vtable); + + /* If the next texture is also a sub texture we can avoid one level + of indirection by referencing the full texture of that texture + instead. */ + if (cogl_is_sub_texture (next_texture)) + { + CoglSubTexture *other_sub_tex = COGL_SUB_TEXTURE (next_texture); + full_texture = other_sub_tex->full_texture; + sub_x += other_sub_tex->sub_x; + sub_y += other_sub_tex->sub_y; + } + else + full_texture = next_texture; + + sub_tex->next_texture = cogl_object_ref (next_texture); + sub_tex->full_texture = cogl_object_ref (full_texture); + + sub_tex->sub_x = sub_x; + sub_tex->sub_y = sub_y; + + return _cogl_sub_texture_object_new (sub_tex); +} + +static CoglBool +_cogl_sub_texture_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + CoglBool status = cogl_texture_allocate (sub_tex->full_texture, error); + + _cogl_texture_set_allocated (tex, + _cogl_texture_get_format (sub_tex->full_texture), + tex->width, tex->height); + + return status; +} + +CoglTexture * +cogl_sub_texture_get_parent (CoglSubTexture *sub_texture) +{ + return sub_texture->next_texture; +} + +static int +_cogl_sub_texture_get_max_waste (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return cogl_texture_get_max_waste (sub_tex->full_texture); +} + +static CoglBool +_cogl_sub_texture_is_sliced (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return cogl_texture_is_sliced (sub_tex->full_texture); +} + +static CoglBool +_cogl_sub_texture_can_hardware_repeat (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + /* We can hardware repeat if the subtexture actually represents all of the + of the full texture */ + return (tex->width == + cogl_texture_get_width (sub_tex->full_texture) && + tex->height == + cogl_texture_get_height (sub_tex->full_texture) && + _cogl_texture_can_hardware_repeat (sub_tex->full_texture)); +} + +static void +_cogl_sub_texture_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + /* This won't work if the sub texture is not the size of the full + texture and the coordinates are outside the range [0,1] */ + *s = ((*s * tex->width + sub_tex->sub_x) / + cogl_texture_get_width (sub_tex->full_texture)); + *t = ((*t * tex->height + sub_tex->sub_y) / + cogl_texture_get_height (sub_tex->full_texture)); + + _cogl_texture_transform_coords_to_gl (sub_tex->full_texture, s, t); +} + +static CoglTransformResult +_cogl_sub_texture_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + int i; + + /* We can't support repeating with this method. In this case + cogl-primitives will resort to manual repeating */ + for (i = 0; i < 4; i++) + if (coords[i] < 0.0f || coords[i] > 1.0f) + return COGL_TRANSFORM_SOFTWARE_REPEAT; + + _cogl_sub_texture_map_quad (sub_tex, coords); + + return _cogl_texture_transform_quad_coords_to_gl (sub_tex->full_texture, + coords); +} + +static CoglBool +_cogl_sub_texture_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return cogl_texture_get_gl_texture (sub_tex->full_texture, + out_gl_handle, + out_gl_target); +} + +static void +_cogl_sub_texture_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + _cogl_texture_gl_flush_legacy_texobj_filters (sub_tex->full_texture, + min_filter, mag_filter); +} + +static void +_cogl_sub_texture_pre_paint (CoglTexture *tex, + CoglTexturePrePaintFlags flags) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + _cogl_texture_pre_paint (sub_tex->full_texture, flags); +} + +static void +_cogl_sub_texture_ensure_non_quad_rendering (CoglTexture *tex) +{ +} + +static CoglBool +_cogl_sub_texture_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + if (level != 0) + { + int full_width = cogl_texture_get_width (sub_tex->full_texture); + int full_height = cogl_texture_get_width (sub_tex->full_texture); + + _COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_x == 0 && + cogl_texture_get_width (tex) == full_width, + FALSE); + _COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_y == 0 && + cogl_texture_get_height (tex) == full_height, + FALSE); + } + + return _cogl_texture_set_region_from_bitmap (sub_tex->full_texture, + src_x, src_y, + dst_width, dst_height, + bmp, + dst_x + sub_tex->sub_x, + dst_y + sub_tex->sub_y, + level, + error); +} + +static CoglPixelFormat +_cogl_sub_texture_get_format (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return _cogl_texture_get_format (sub_tex->full_texture); +} + +static GLenum +_cogl_sub_texture_get_gl_format (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return _cogl_texture_gl_get_format (sub_tex->full_texture); +} + +static CoglTextureType +_cogl_sub_texture_get_type (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return _cogl_texture_get_type (sub_tex->full_texture); +} + +static const CoglTextureVtable +cogl_sub_texture_vtable = + { + FALSE, /* not primitive */ + _cogl_sub_texture_allocate, + _cogl_sub_texture_set_region, + NULL, /* get_data */ + _cogl_sub_texture_foreach_sub_texture_in_region, + _cogl_sub_texture_get_max_waste, + _cogl_sub_texture_is_sliced, + _cogl_sub_texture_can_hardware_repeat, + _cogl_sub_texture_transform_coords_to_gl, + _cogl_sub_texture_transform_quad_coords_to_gl, + _cogl_sub_texture_get_gl_texture, + _cogl_sub_texture_gl_flush_legacy_texobj_filters, + _cogl_sub_texture_pre_paint, + _cogl_sub_texture_ensure_non_quad_rendering, + _cogl_sub_texture_gl_flush_legacy_texobj_wrap_modes, + _cogl_sub_texture_get_format, + _cogl_sub_texture_get_gl_format, + _cogl_sub_texture_get_type, + NULL, /* is_foreign */ + NULL /* set_auto_mipmap */ + }; diff --git a/cogl/cogl-sub-texture.h b/cogl/cogl-sub-texture.h new file mode 100644 index 0000000..ced2677 --- /dev/null +++ b/cogl/cogl-sub-texture.h @@ -0,0 +1,136 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SUB_TEXTURE_H +#define __COGL_SUB_TEXTURE_H + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-sub-texture + * @short_description: Functions for creating and manipulating + * sub-textures. + * + * These functions allow high-level textures to be created that + * represent a sub-region of another texture. For example these + * can be used to implement custom texture atlasing schemes. + */ + + +#define COGL_SUB_TEXTURE(tex) ((CoglSubTexture *) tex) +typedef struct _CoglSubTexture CoglSubTexture; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_sub_texture_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_sub_texture_get_gtype (void); +#endif + +/** + * cogl_sub_texture_new: + * @ctx: A #CoglContext pointer + * @parent_texture: The full texture containing a sub-region you want + * to make a #CoglSubTexture from. + * @sub_x: The top-left x coordinate of the parent region to make + * a texture from. + * @sub_y: The top-left y coordinate of the parent region to make + * a texture from. + * @sub_width: The width of the parent region to make a texture from. + * @sub_height: The height of the parent region to make a texture + * from. + * + * Creates a high-level #CoglSubTexture representing a sub-region of + * any other #CoglTexture. The sub-region must strictly lye within the + * bounds of the @parent_texture. The returned texture implements the + * #CoglMetaTexture interface because it's not a low level texture + * that hardware can understand natively. + * + * Remember: Unless you are using high level drawing APIs such + * as cogl_rectangle() or other APIs documented to understand the + * #CoglMetaTexture interface then you need to use the + * #CoglMetaTexture interface to resolve a #CoglSubTexture into a + * low-level texture before drawing. + * + * Return value: (transfer full): A newly allocated #CoglSubTexture + * representing a sub-region of @parent_texture. + * + * Since: 1.10 + * Stability: unstable + */ +CoglSubTexture * +cogl_sub_texture_new (CoglContext *ctx, + CoglTexture *parent_texture, + int sub_x, + int sub_y, + int sub_width, + int sub_height); + +/** + * cogl_sub_texture_get_parent: + * @sub_texture: A pointer to a #CoglSubTexture + * + * Retrieves the parent texture that @sub_texture derives its content + * from. This is the texture that was passed to + * cogl_sub_texture_new() as the parent_texture argument. + * + * Return value: (transfer none): The parent texture that @sub_texture + * derives its content from. + * Since: 1.10 + * Stability: unstable + */ +CoglTexture * +cogl_sub_texture_get_parent (CoglSubTexture *sub_texture); + +/** + * cogl_is_sub_texture: + * @object: a #CoglObject + * + * Checks whether @object is a #CoglSubTexture. + * + * Return value: %TRUE if the passed @object represents a + * #CoglSubTexture and %FALSE otherwise. + * + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_sub_texture (void *object); + +COGL_END_DECLS + +#endif /* __COGL_SUB_TEXTURE_H */ diff --git a/cogl/cogl-swap-chain-private.h b/cogl/cogl-swap-chain-private.h new file mode 100644 index 0000000..c67e6f0 --- /dev/null +++ b/cogl/cogl-swap-chain-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SWAP_CHAIN_PRIVATE_H +#define __COGL_SWAP_CHAIN_PRIVATE_H + +#include "cogl-object-private.h" + +struct _CoglSwapChain +{ + CoglObject _parent; + + CoglBool has_alpha; + + int length; +}; + +#endif /* __COGL_SWAP_CHAIN_PRIVATE_H */ diff --git a/cogl/cogl-swap-chain.c b/cogl/cogl-swap-chain.c new file mode 100644 index 0000000..e5dd2f4 --- /dev/null +++ b/cogl/cogl-swap-chain.c @@ -0,0 +1,76 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object.h" + +#include "cogl-swap-chain-private.h" +#include "cogl-swap-chain.h" +#include "cogl-gtype-private.h" + +static void _cogl_swap_chain_free (CoglSwapChain *swap_chain); + +COGL_OBJECT_DEFINE (SwapChain, swap_chain); +COGL_GTYPE_DEFINE_CLASS (SwapChain, swap_chain); + + +static void +_cogl_swap_chain_free (CoglSwapChain *swap_chain) +{ + g_slice_free (CoglSwapChain, swap_chain); +} + +CoglSwapChain * +cogl_swap_chain_new (void) +{ + CoglSwapChain *swap_chain = g_slice_new0 (CoglSwapChain); + + swap_chain->length = -1; /* no preference */ + + return _cogl_swap_chain_object_new (swap_chain); +} + +void +cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain, + CoglBool has_alpha) +{ + swap_chain->has_alpha = has_alpha; +} + +void +cogl_swap_chain_set_length (CoglSwapChain *swap_chain, + int length) +{ + swap_chain->length = length; +} diff --git a/cogl/cogl-swap-chain.h b/cogl/cogl-swap-chain.h new file mode 100644 index 0000000..d048867 --- /dev/null +++ b/cogl/cogl-swap-chain.h @@ -0,0 +1,71 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SWAP_CHAIN_H__ +#define __COGL_SWAP_CHAIN_H__ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +typedef struct _CoglSwapChain CoglSwapChain; + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_swap_chain_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_swap_chain_get_gtype (void); +#endif + +CoglSwapChain * +cogl_swap_chain_new (void); + +void +cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain, + CoglBool has_alpha); + +void +cogl_swap_chain_set_length (CoglSwapChain *swap_chain, + int length); + +CoglBool +cogl_is_swap_chain (void *object); + +COGL_END_DECLS + +#endif /* __COGL_SWAP_CHAIN_H__ */ diff --git a/cogl/cogl-texture-2d-gl.h b/cogl/cogl-texture-2d-gl.h new file mode 100644 index 0000000..e7b22df --- /dev/null +++ b/cogl/cogl-texture-2d-gl.h @@ -0,0 +1,78 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef _COGL_TEXTURE_2D_GL_H_ +#define _COGL_TEXTURE_2D_GL_H_ + +#include "cogl-context.h" +#include "cogl-texture-2d.h" + +COGL_BEGIN_DECLS + +/** + * cogl_texture_2d_gl_new_from_foreign: + * @ctx: A #CoglContext + * @gl_handle: A GL handle for a GL_TEXTURE_2D texture object + * @width: Width of the foreign GL texture + * @height: Height of the foreign GL texture + * @format: The format of the texture + * + * Wraps an existing GL_TEXTURE_2D texture object as a #CoglTexture2D. + * This can be used for integrating Cogl with software using OpenGL + * directly. + * + * The texture is still configurable until it has been allocated so + * for example you can declare whether the texture is premultiplied + * with cogl_texture_set_premultiplied(). + * + * The results are undefined for passing an invalid @gl_handle + * or if @width or @height don't have the correct texture + * geometry. + * + * Returns: (transfer full): A newly allocated #CoglTexture2D + * + * Since: 2.0 + */ +CoglTexture2D * +cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + int width, + int height, + CoglPixelFormat format); + +COGL_END_DECLS + +#endif /* _COGL_TEXTURE_2D_GL_H_ */ diff --git a/cogl/cogl-texture-2d-private.h b/cogl/cogl-texture-2d-private.h new file mode 100644 index 0000000..27847af --- /dev/null +++ b/cogl/cogl-texture-2d-private.h @@ -0,0 +1,134 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_2D_PRIVATE_H +#define __COGL_TEXTURE_2D_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d.h" + +#ifdef COGL_HAS_EGL_SUPPORT +#include "cogl-egl-defines.h" +#endif + +struct _CoglTexture2D +{ + CoglTexture _parent; + + /* The internal format of the GL texture represented as a + CoglPixelFormat */ + CoglPixelFormat internal_format; + + CoglBool auto_mipmap; + CoglBool mipmaps_dirty; + CoglBool is_foreign; + + /* TODO: factor out these OpenGL specific members into some form + * of driver private state. */ + + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_internal_format; + /* The texture object number */ + GLuint gl_texture; + GLenum gl_legacy_texobj_min_filter; + GLenum gl_legacy_texobj_mag_filter; + GLint gl_legacy_texobj_wrap_mode_s; + GLint gl_legacy_texobj_wrap_mode_t; + CoglTexturePixel first_pixel; +}; + +CoglTexture2D * +_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, + CoglBool can_convert_in_place); + +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) +/* NB: The reason we require the width, height and format to be passed + * even though they may seem redundant is because GLES 1/2 don't + * provide a way to query these properties. */ +CoglTexture2D * +_cogl_egl_texture_2d_new_from_image (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + EGLImageKHR image, + CoglError **error); +#endif + +CoglTexture2D * +_cogl_texture_2d_create_base (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + CoglTextureLoader *loader); + +void +_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex, + CoglBool value); + +/* + * _cogl_texture_2d_externally_modified: + * @texture: A #CoglTexture2D object + * + * This should be called whenever the texture is modified other than + * by using cogl_texture_set_region. It will cause the mipmaps to be + * invalidated + */ +void +_cogl_texture_2d_externally_modified (CoglTexture *texture); + +/* + * _cogl_texture_2d_copy_from_framebuffer: + * @texture: A #CoglTexture2D pointer + * @src_x: X-position to within the framebuffer to read from + * @src_y: Y-position to within the framebuffer to read from + * @width: width of the rectangle to copy + * @height: height of the rectangle to copy + * @src_fb: A source #CoglFramebuffer to copy from + * @dst_x: X-position to store the image within the texture + * @dst_y: Y-position to store the image within the texture + * @level: The mipmap level of @texture to copy too + * + * This copies a portion of the given @src_fb into the + * texture. + */ +void +_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *texture, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level); + +#endif /* __COGL_TEXTURE_2D_PRIVATE_H */ diff --git a/cogl/cogl-texture-2d-sliced-private.h b/cogl/cogl-texture-2d-sliced-private.h new file mode 100644 index 0000000..e827923 --- /dev/null +++ b/cogl/cogl-texture-2d-sliced-private.h @@ -0,0 +1,67 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_2D_SLICED_PRIVATE_H +#define __COGL_TEXTURE_2D_SLICED_PRIVATE_H + +#include "cogl-bitmap-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-sliced.h" + +#include + +struct _CoglTexture2DSliced +{ + CoglTexture _parent; + + GArray *slice_x_spans; + GArray *slice_y_spans; + GArray *slice_textures; + int max_waste; + CoglPixelFormat internal_format; +}; + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_foreign (CoglContext *context, + unsigned int gl_handle, + unsigned int gl_target, + int width, + int height, + int x_pot_waste, + int y_pot_waste, + CoglPixelFormat format); + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + int max_waste, + CoglBool can_convert_in_place); + +#endif /* __COGL_TEXTURE_2D_SLICED_PRIVATE_H */ diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c new file mode 100644 index 0000000..e76bef6 --- /dev/null +++ b/cogl/cogl-texture-2d-sliced.c @@ -0,0 +1,1546 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-bitmap.h" +#include "cogl-bitmap-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-gl.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-2d-sliced-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-texture-driver.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-spans.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-primitive-texture.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-gtype-private.h" + +#include +#include +#include + +static void _cogl_texture_2d_sliced_free (CoglTexture2DSliced *tex_2ds); + +COGL_TEXTURE_DEFINE (Texture2DSliced, texture_2d_sliced); +COGL_GTYPE_DEFINE_CLASS (Texture2DSliced, texture_2d_sliced, + COGL_GTYPE_IMPLEMENT_INTERFACE (texture)); + +static const CoglTextureVtable cogl_texture_2d_sliced_vtable; + +typedef struct _ForeachData +{ + CoglMetaTextureCallback callback; + void *user_data; + float x_normalize_factor; + float y_normalize_factor; +} ForeachData; + +static void +re_normalize_sub_texture_coords_cb (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data) +{ + ForeachData *data = user_data; + /* The coordinates passed to the span iterating code were + * un-normalized so we need to renormalize them before passing them + * on */ + float re_normalized_coords[4] = + { + meta_coords[0] * data->x_normalize_factor, + meta_coords[1] * data->y_normalize_factor, + meta_coords[2] * data->x_normalize_factor, + meta_coords[3] * data->y_normalize_factor + }; + + data->callback (sub_texture, sub_texture_coords, re_normalized_coords, + data->user_data); +} + +static void +_cogl_texture_2d_sliced_foreach_sub_texture_in_region ( + CoglTexture *tex, + float virtual_tx_1, + float virtual_ty_1, + float virtual_tx_2, + float virtual_ty_2, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglSpan *x_spans = (CoglSpan *)tex_2ds->slice_x_spans->data; + CoglSpan *y_spans = (CoglSpan *)tex_2ds->slice_y_spans->data; + CoglTexture **textures = (CoglTexture **)tex_2ds->slice_textures->data; + float un_normalized_coords[4]; + ForeachData data; + + /* NB: its convenient for us to store non-normalized coordinates in + * our CoglSpans but that means we need to un-normalize the incoming + * virtual coordinates and make sure we re-normalize the coordinates + * before calling the given callback. + */ + + data.callback = callback; + data.user_data = user_data; + data.x_normalize_factor = 1.0f / tex->width; + data.y_normalize_factor = 1.0f / tex->height; + + un_normalized_coords[0] = virtual_tx_1 * tex->width; + un_normalized_coords[1] = virtual_ty_1 * tex->height; + un_normalized_coords[2] = virtual_tx_2 * tex->width; + un_normalized_coords[3] = virtual_ty_2 * tex->height; + + /* Note that the normalize factors passed here are the reciprocal of + * the factors calculated above because the span iterating code + * normalizes by dividing by the factor instead of multiplying */ + _cogl_texture_spans_foreach_in_region (x_spans, + tex_2ds->slice_x_spans->len, + y_spans, + tex_2ds->slice_y_spans->len, + textures, + un_normalized_coords, + tex->width, + tex->height, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + re_normalize_sub_texture_coords_cb, + &data); +} + +static uint8_t * +_cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds, + CoglPixelFormat format) +{ + CoglSpan *last_x_span; + CoglSpan *last_y_span; + uint8_t *waste_buf = NULL; + + /* If the texture has any waste then allocate a buffer big enough to + fill the gaps */ + last_x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, + tex_2ds->slice_x_spans->len - 1); + last_y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, + tex_2ds->slice_y_spans->len - 1); + if (last_x_span->waste > 0 || last_y_span->waste > 0) + { + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + CoglSpan *first_x_span + = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0); + CoglSpan *first_y_span + = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0); + unsigned int right_size = first_y_span->size * last_x_span->waste; + unsigned int bottom_size = first_x_span->size * last_y_span->waste; + + waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp); + } + + return waste_buf; +} + +static CoglBool +_cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds, + CoglBitmap *source_bmp, + CoglTexture2D *slice_tex, + uint8_t *waste_buf, + CoglSpan *x_span, + CoglSpan *y_span, + CoglSpanIter *x_iter, + CoglSpanIter *y_iter, + int src_x, + int src_y, + int dst_x, + int dst_y, + CoglError **error) +{ + CoglBool need_x, need_y; + CoglContext *ctx = COGL_TEXTURE (tex_2ds)->context; + + /* If the x_span is sliced and the upload touches the + rightmost pixels then fill the waste with copies of the + pixels */ + need_x = x_span->waste > 0 && + x_iter->intersect_end - x_iter->pos >= x_span->size - x_span->waste; + + /* same for the bottom-most pixels */ + need_y = y_span->waste > 0 && + y_iter->intersect_end - y_iter->pos >= y_span->size - y_span->waste; + + if (need_x || need_y) + { + int bmp_rowstride = cogl_bitmap_get_rowstride (source_bmp); + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + uint8_t *bmp_data; + const uint8_t *src; + uint8_t *dst; + unsigned int wy, wx; + CoglBitmap *waste_bmp; + + bmp_data = _cogl_bitmap_map (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error); + if (bmp_data == NULL) + return FALSE; + + if (need_x) + { + src = (bmp_data + ((src_y + (int) y_iter->intersect_start - dst_y) * + bmp_rowstride) + + (src_x + (int)x_span->start + (int)x_span->size - + (int)x_span->waste - dst_x - 1) * bpp); + + dst = waste_buf; + + for (wy = 0; + wy < y_iter->intersect_end - y_iter->intersect_start; + wy++) + { + for (wx = 0; wx < x_span->waste; wx++) + { + memcpy (dst, src, bpp); + dst += bpp; + } + src += bmp_rowstride; + } + + waste_bmp = cogl_bitmap_new_for_data (ctx, + x_span->waste, + y_iter->intersect_end - + y_iter->intersect_start, + source_format, + x_span->waste * bpp, + waste_buf); + + if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + 0, /* src_x */ + 0, /* src_y */ + x_span->waste, /* width */ + /* height */ + y_iter->intersect_end - + y_iter->intersect_start, + waste_bmp, + /* dst_x */ + x_span->size - x_span->waste, + y_iter->intersect_start - + y_span->start, /* dst_y */ + 0, /* level */ + error)) + { + cogl_object_unref (waste_bmp); + _cogl_bitmap_unmap (source_bmp); + return FALSE; + } + + cogl_object_unref (waste_bmp); + } + + if (need_y) + { + unsigned int copy_width, intersect_width; + + src = (bmp_data + ((src_x + (int) x_iter->intersect_start - dst_x) * + bpp) + + (src_y + (int)y_span->start + (int)y_span->size - + (int)y_span->waste - dst_y - 1) * bmp_rowstride); + + dst = waste_buf; + + if (x_iter->intersect_end - x_iter->pos + >= x_span->size - x_span->waste) + copy_width = x_span->size + x_iter->pos - x_iter->intersect_start; + else + copy_width = x_iter->intersect_end - x_iter->intersect_start; + + intersect_width = x_iter->intersect_end - x_iter->intersect_start; + + for (wy = 0; wy < y_span->waste; wy++) + { + memcpy (dst, src, intersect_width * bpp); + dst += intersect_width * bpp; + + for (wx = intersect_width; wx < copy_width; wx++) + { + memcpy (dst, dst - bpp, bpp); + dst += bpp; + } + } + + waste_bmp = cogl_bitmap_new_for_data (ctx, + copy_width, + y_span->waste, + source_format, + copy_width * bpp, + waste_buf); + + if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + 0, /* src_x */ + 0, /* src_y */ + copy_width, /* width */ + y_span->waste, /* height */ + waste_bmp, + /* dst_x */ + x_iter->intersect_start - + x_iter->pos, + /* dst_y */ + y_span->size - y_span->waste, + 0, /* level */ + error)) + { + cogl_object_unref (waste_bmp); + _cogl_bitmap_unmap (source_bmp); + return FALSE; + } + + cogl_object_unref (waste_bmp); + } + + _cogl_bitmap_unmap (source_bmp); + } + + return TRUE; +} + +static CoglBool +_cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds, + CoglBitmap *bmp, + CoglError **error) +{ + CoglSpan *x_span; + CoglSpan *y_span; + CoglTexture2D *slice_tex; + int x, y; + uint8_t *waste_buf; + CoglPixelFormat bmp_format; + + bmp_format = cogl_bitmap_get_format (bmp); + + waste_buf = _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, + bmp_format); + + /* Iterate vertical slices */ + for (y = 0; y < tex_2ds->slice_y_spans->len; ++y) + { + y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, y); + + /* Iterate horizontal slices */ + for (x = 0; x < tex_2ds->slice_x_spans->len; ++x) + { + int slice_num = y * tex_2ds->slice_x_spans->len + x; + CoglSpanIter x_iter, y_iter; + + x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x); + + /* Pick the gl texture object handle */ + slice_tex = g_array_index (tex_2ds->slice_textures, + CoglTexture2D *, slice_num); + + if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + x_span->start, /* src x */ + y_span->start, /* src y */ + x_span->size - + x_span->waste, /* width */ + y_span->size - + y_span->waste, /* height */ + bmp, + 0, /* dst x */ + 0, /* dst y */ + 0, /* level */ + error)) + { + if (waste_buf) + g_free (waste_buf); + return FALSE; + } + + /* Set up a fake iterator that covers the whole slice */ + x_iter.intersect_start = x_span->start; + x_iter.intersect_end = (x_span->start + + x_span->size - + x_span->waste); + x_iter.pos = x_span->start; + + y_iter.intersect_start = y_span->start; + y_iter.intersect_end = (y_span->start + + y_span->size - + y_span->waste); + y_iter.pos = y_span->start; + + if (!_cogl_texture_2d_sliced_set_waste (tex_2ds, + bmp, + slice_tex, + waste_buf, + x_span, y_span, + &x_iter, &y_iter, + 0, /* src_x */ + 0, /* src_y */ + 0, /* dst_x */ + 0, + error)) /* dst_y */ + { + if (waste_buf) + g_free (waste_buf); + return FALSE; + } + } + } + + if (waste_buf) + g_free (waste_buf); + + return TRUE; +} + +static CoglBool +_cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglBitmap *source_bmp, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + CoglSpan *x_span; + CoglSpan *y_span; + CoglSpanIter x_iter; + CoglSpanIter y_iter; + CoglTexture2D *slice_tex; + int source_x = 0, source_y = 0; + int inter_w = 0, inter_h = 0; + int local_x = 0, local_y = 0; + uint8_t *waste_buf; + CoglPixelFormat source_format; + + source_format = cogl_bitmap_get_format (source_bmp); + + waste_buf = + _cogl_texture_2d_sliced_allocate_waste_buffer (tex_2ds, source_format); + + /* Iterate vertical spans */ + for (source_y = src_y, + _cogl_span_iter_begin (&y_iter, + (CoglSpan *)tex_2ds->slice_y_spans->data, + tex_2ds->slice_y_spans->len, + tex->height, + dst_y, + dst_y + height, + COGL_PIPELINE_WRAP_MODE_REPEAT); + + !_cogl_span_iter_end (&y_iter); + + _cogl_span_iter_next (&y_iter), + source_y += inter_h ) + { + y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, + y_iter.index); + + /* Iterate horizontal spans */ + for (source_x = src_x, + _cogl_span_iter_begin (&x_iter, + (CoglSpan *)tex_2ds->slice_x_spans->data, + tex_2ds->slice_x_spans->len, + tex->width, + dst_x, + dst_x + width, + COGL_PIPELINE_WRAP_MODE_REPEAT); + + !_cogl_span_iter_end (&x_iter); + + _cogl_span_iter_next (&x_iter), + source_x += inter_w ) + { + int slice_num; + + x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, + x_iter.index); + + /* Pick intersection width and height */ + inter_w = (x_iter.intersect_end - x_iter.intersect_start); + inter_h = (y_iter.intersect_end - y_iter.intersect_start); + + /* Localize intersection top-left corner to slice*/ + local_x = (x_iter.intersect_start - x_iter.pos); + local_y = (y_iter.intersect_start - y_iter.pos); + + slice_num = y_iter.index * tex_2ds->slice_x_spans->len + x_iter.index; + + /* Pick slice texture */ + slice_tex = g_array_index (tex_2ds->slice_textures, + CoglTexture2D *, slice_num); + + if (!_cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + source_x, + source_y, + inter_w, /* width */ + inter_h, /* height */ + source_bmp, + local_x, /* dst x */ + local_y, /* dst y */ + 0, /* level */ + error)) + { + if (waste_buf) + g_free (waste_buf); + return FALSE; + } + + if (!_cogl_texture_2d_sliced_set_waste (tex_2ds, + source_bmp, + slice_tex, + waste_buf, + x_span, y_span, + &x_iter, &y_iter, + src_x, src_y, + dst_x, dst_y, + error)) + { + if (waste_buf) + g_free (waste_buf); + return FALSE; + } + } + } + + if (waste_buf) + g_free (waste_buf); + + return TRUE; +} + +static int +_cogl_rect_slices_for_size (int size_to_fill, + int max_span_size, + int max_waste, + GArray *out_spans) +{ + int n_spans = 0; + CoglSpan span; + + /* Init first slice span */ + span.start = 0; + span.size = max_span_size; + span.waste = 0; + + /* Repeat until whole area covered */ + while (size_to_fill >= span.size) + { + /* Add another slice span of same size */ + if (out_spans) + g_array_append_val (out_spans, span); + span.start += span.size; + size_to_fill -= span.size; + n_spans++; + } + + /* Add one last smaller slice span */ + if (size_to_fill > 0) + { + span.size = size_to_fill; + if (out_spans) + g_array_append_val (out_spans, span); + n_spans++; + } + + return n_spans; +} + +static int +_cogl_pot_slices_for_size (int size_to_fill, + int max_span_size, + int max_waste, + GArray *out_spans) +{ + int n_spans = 0; + CoglSpan span; + + /* Init first slice span */ + span.start = 0; + span.size = max_span_size; + span.waste = 0; + + /* Fix invalid max_waste */ + if (max_waste < 0) + max_waste = 0; + + while (TRUE) + { + /* Is the whole area covered? */ + if (size_to_fill > span.size) + { + /* Not yet - add a span of this size */ + if (out_spans) + g_array_append_val (out_spans, span); + + span.start += span.size; + size_to_fill -= span.size; + n_spans++; + } + else if (span.size - size_to_fill <= max_waste) + { + /* Yes and waste is small enough */ + /* Pick the next power of two up from size_to_fill. This can + sometimes be less than the span.size that would be chosen + otherwise */ + span.size = _cogl_util_next_p2 (size_to_fill); + span.waste = span.size - size_to_fill; + if (out_spans) + g_array_append_val (out_spans, span); + + return ++n_spans; + } + else + { + /* Yes but waste is too large */ + while (span.size - size_to_fill > max_waste) + { + span.size /= 2; + g_assert (span.size > 0); + } + } + } + + /* Can't get here */ + return 0; +} + +static void +_cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + int i; + + /* Pass the set wrap mode on to all of the child textures */ + for (i = 0; i < tex_2ds->slice_textures->len; i++) + { + CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures, + CoglTexture2D *, + i); + + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (COGL_TEXTURE (slice_tex), + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); + } +} + +static void +free_spans (CoglTexture2DSliced *tex_2ds) +{ + if (tex_2ds->slice_x_spans != NULL) + { + g_array_free (tex_2ds->slice_x_spans, TRUE); + tex_2ds->slice_x_spans = NULL; + } + + if (tex_2ds->slice_y_spans != NULL) + { + g_array_free (tex_2ds->slice_y_spans, TRUE); + tex_2ds->slice_y_spans = NULL; + } +} + +static CoglBool +setup_spans (CoglContext *ctx, + CoglTexture2DSliced *tex_2ds, + int width, + int height, + int max_waste, + CoglPixelFormat internal_format, + CoglError **error) +{ + int max_width; + int max_height; + int n_x_slices; + int n_y_slices; + + int (*slices_for_size) (int, int, int, GArray*); + + /* Initialize size of largest slice according to supported features */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT)) + { + max_width = width; + max_height = height; + slices_for_size = _cogl_rect_slices_for_size; + } + else + { + max_width = _cogl_util_next_p2 (width); + max_height = _cogl_util_next_p2 (height); + slices_for_size = _cogl_pot_slices_for_size; + } + + /* Negative number means no slicing forced by the user */ + if (max_waste <= -1) + { + CoglSpan span; + + /* Check if size supported else bail out */ + if (!ctx->driver_vtable->texture_2d_can_create (ctx, + max_width, + max_height, + internal_format)) + { + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Sliced texture size of %d x %d not possible " + "with max waste set to -1", + width, + height); + return FALSE; + } + + n_x_slices = 1; + n_y_slices = 1; + + /* Init span arrays */ + tex_2ds->slice_x_spans = g_array_sized_new (FALSE, FALSE, + sizeof (CoglSpan), + 1); + + tex_2ds->slice_y_spans = g_array_sized_new (FALSE, FALSE, + sizeof (CoglSpan), + 1); + + /* Add a single span for width and height */ + span.start = 0; + span.size = max_width; + span.waste = max_width - width; + g_array_append_val (tex_2ds->slice_x_spans, span); + + span.size = max_height; + span.waste = max_height - height; + g_array_append_val (tex_2ds->slice_y_spans, span); + } + else + { + /* Decrease the size of largest slice until supported by GL */ + while (!ctx->driver_vtable->texture_2d_can_create (ctx, + max_width, + max_height, + internal_format)) + { + /* Alternate between width and height */ + if (max_width > max_height) + max_width /= 2; + else + max_height /= 2; + + if (max_width == 0 || max_height == 0) + { + /* Maybe it would be ok to just g_warn_if_reached() for this + * codepath */ + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "No suitable slice geometry found"); + free_spans (tex_2ds); + return FALSE; + } + } + + /* Determine the slices required to cover the bitmap area */ + n_x_slices = slices_for_size (width, + max_width, max_waste, + NULL); + + n_y_slices = slices_for_size (height, + max_height, max_waste, + NULL); + + /* Init span arrays with reserved size */ + tex_2ds->slice_x_spans = g_array_sized_new (FALSE, FALSE, + sizeof (CoglSpan), + n_x_slices); + + tex_2ds->slice_y_spans = g_array_sized_new (FALSE, FALSE, + sizeof (CoglSpan), + n_y_slices); + + /* Fill span arrays with info */ + slices_for_size (width, + max_width, max_waste, + tex_2ds->slice_x_spans); + + slices_for_size (height, + max_height, max_waste, + tex_2ds->slice_y_spans); + } + + return TRUE; +} + +static void +free_slices (CoglTexture2DSliced *tex_2ds) +{ + if (tex_2ds->slice_textures != NULL) + { + int i; + + for (i = 0; i < tex_2ds->slice_textures->len; i++) + { + CoglTexture2D *slice_tex = + g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i); + cogl_object_unref (slice_tex); + } + + g_array_free (tex_2ds->slice_textures, TRUE); + } + + free_spans (tex_2ds); +} + +static CoglBool +allocate_slices (CoglTexture2DSliced *tex_2ds, + int width, + int height, + int max_waste, + CoglPixelFormat internal_format, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + CoglContext *ctx = tex->context; + int n_x_slices; + int n_y_slices; + int n_slices; + int x, y; + CoglSpan *x_span; + CoglSpan *y_span; + + tex_2ds->internal_format = internal_format; + + if (!setup_spans (ctx, tex_2ds, + width, + height, + max_waste, + internal_format, + error)) + { + return FALSE; + } + + n_x_slices = tex_2ds->slice_x_spans->len; + n_y_slices = tex_2ds->slice_y_spans->len; + n_slices = n_x_slices * n_y_slices; + + tex_2ds->slice_textures = g_array_sized_new (FALSE, FALSE, + sizeof (CoglTexture2D *), + n_slices); + + /* Allocate each slice */ + for (y = 0; y < n_y_slices; ++y) + { + y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, y); + + for (x = 0; x < n_x_slices; ++x) + { + CoglTexture *slice; + + x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x); + + COGL_NOTE (SLICING, "CREATE SLICE (%d,%d)\tsize (%d,%d)", + x, y, + (int)(x_span->size - x_span->waste), + (int)(y_span->size - y_span->waste)); + + slice = COGL_TEXTURE ( + cogl_texture_2d_new_with_size (ctx, + x_span->size, y_span->size)); + + _cogl_texture_copy_internal_format (tex, slice); + + g_array_append_val (tex_2ds->slice_textures, slice); + if (!cogl_texture_allocate (slice, error)) + { + free_slices (tex_2ds); + return FALSE; + } + } + } + + return TRUE; +} + +static void +_cogl_texture_2d_sliced_free (CoglTexture2DSliced *tex_2ds) +{ + free_slices (tex_2ds); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_2ds)); +} + +static CoglTexture2DSliced * +_cogl_texture_2d_sliced_create_base (CoglContext *ctx, + int width, + int height, + int max_waste, + CoglPixelFormat internal_format, + CoglTextureLoader *loader) +{ + CoglTexture2DSliced *tex_2ds = g_new0 (CoglTexture2DSliced, 1); + + _cogl_texture_init (COGL_TEXTURE (tex_2ds), ctx, width, height, + internal_format, loader, + &cogl_texture_2d_sliced_vtable); + + tex_2ds->max_waste = max_waste; + + return _cogl_texture_2d_sliced_object_new (tex_2ds); +} + +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, + int width, + int height, + int max_waste) +{ + CoglTextureLoader *loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; + loader->src.sized.width = width; + loader->src.sized.height = height; + + return _cogl_texture_2d_sliced_create_base (ctx, + width, + height, + max_waste, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + loader); +} + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + int max_waste, + CoglBool can_convert_in_place) +{ + CoglTextureLoader *loader; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; + loader->src.bitmap.bitmap = cogl_object_ref (bmp); + loader->src.bitmap.can_convert_in_place = can_convert_in_place; + + return _cogl_texture_2d_sliced_create_base (_cogl_bitmap_get_context (bmp), + cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + max_waste, + cogl_bitmap_get_format (bmp), + loader); +} + +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + int max_waste) +{ + return _cogl_texture_2d_sliced_new_from_bitmap (bmp, + max_waste, + FALSE); +} + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + unsigned int gl_target, + int width, + int height, + int x_pot_waste, + int y_pot_waste, + CoglPixelFormat format) +{ + CoglTextureLoader *loader; + + /* NOTE: width, height and internal format are not queriable + * in GLES, hence such a function prototype. + */ + + /* This should only be called when the texture target is 2D. If a + rectangle texture is used then _cogl_texture_new_from_foreign + will create a cogl_texture_rectangle instead */ + _COGL_RETURN_VAL_IF_FAIL (gl_target == GL_TEXTURE_2D, NULL); + + /* Assert it is a valid GL texture object */ + _COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), FALSE); + + /* Validate width and height */ + _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); + + /* Validate pot waste */ + _COGL_RETURN_VAL_IF_FAIL (x_pot_waste >= 0 && x_pot_waste < width && + y_pot_waste >= 0 && y_pot_waste < height, + NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN; + loader->src.gl_foreign.gl_handle = gl_handle; + loader->src.gl_foreign.width = width + x_pot_waste; + loader->src.gl_foreign.height = height + y_pot_waste; + loader->src.gl_foreign.format = format; + + return _cogl_texture_2d_sliced_create_base (ctx, + width, + height, + 0, /* max waste */ + format, loader); +} + +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_data (CoglContext *ctx, + int width, + int height, + int max_waste, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture2DSliced *tex_2ds; + + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + /* Wrap the data into a bitmap */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + tex_2ds = cogl_texture_2d_sliced_new_from_bitmap (bmp, max_waste); + + cogl_object_unref (bmp); + + if (tex_2ds && + !cogl_texture_allocate (COGL_TEXTURE (tex_2ds), error)) + { + cogl_object_unref (tex_2ds); + return NULL; + } + + return tex_2ds; +} + +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, + const char *filename, + int max_waste, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture2DSliced *tex_2ds = NULL; + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + bmp = _cogl_bitmap_from_file (ctx, filename, error); + if (bmp == NULL) + return NULL; + + tex_2ds = _cogl_texture_2d_sliced_new_from_bitmap (bmp, + max_waste, + TRUE); /* can convert in-place */ + + cogl_object_unref (bmp); + + return tex_2ds; +} + +static CoglBool +allocate_with_size (CoglTexture2DSliced *tex_2ds, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + CoglPixelFormat internal_format = + _cogl_texture_determine_internal_format (tex, COGL_PIXEL_FORMAT_ANY); + + if (allocate_slices (tex_2ds, + loader->src.sized.width, + loader->src.sized.height, + tex_2ds->max_waste, + internal_format, + error)) + { + _cogl_texture_set_allocated (COGL_TEXTURE (tex_2ds), + internal_format, + loader->src.sized.width, + loader->src.sized.height); + return TRUE; + } + else + return FALSE; +} + +static CoglBool +allocate_from_bitmap (CoglTexture2DSliced *tex_2ds, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + CoglBitmap *bmp = loader->src.bitmap.bitmap; + int width = cogl_bitmap_get_width (bmp); + int height = cogl_bitmap_get_height (bmp); + CoglBool can_convert_in_place = loader->src.bitmap.can_convert_in_place; + CoglPixelFormat internal_format; + CoglBitmap *upload_bmp; + + _COGL_RETURN_VAL_IF_FAIL (tex_2ds->slice_textures == NULL, FALSE); + + internal_format = + _cogl_texture_determine_internal_format (tex, + cogl_bitmap_get_format (bmp)); + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return FALSE; + + if (!allocate_slices (tex_2ds, + width, + height, + tex_2ds->max_waste, + internal_format, + error)) + { + cogl_object_unref (upload_bmp); + return FALSE; + } + + if (!_cogl_texture_2d_sliced_upload_bitmap (tex_2ds, + upload_bmp, + error)) + { + free_slices (tex_2ds); + cogl_object_unref (upload_bmp); + return FALSE; + } + + cogl_object_unref (upload_bmp); + + _cogl_texture_set_allocated (tex, internal_format, width, height); + + return TRUE; +} + +static CoglBool +allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + CoglContext *ctx = tex->context; + CoglPixelFormat format = loader->src.gl_foreign.format; + int gl_width = loader->src.gl_foreign.width; + int gl_height = loader->src.gl_foreign.height; + int x_pot_waste = gl_width - tex->width; + int y_pot_waste = gl_height - tex->height; + CoglSpan x_span; + CoglSpan y_span; + CoglTexture2D *tex_2d = + cogl_texture_2d_gl_new_from_foreign (ctx, + loader->src.gl_foreign.gl_handle, + gl_width, + gl_height, + format); + + if (!cogl_texture_allocate (COGL_TEXTURE (tex_2d), error)) + { + cogl_object_unref (tex_2d); + return FALSE; + } + + /* The texture 2d backend may use a different pixel format if it + queries the actual texture so we'll refetch the format it + actually used */ + format = _cogl_texture_get_format (tex); + + tex_2ds->internal_format = format; + + /* Create slice arrays */ + tex_2ds->slice_x_spans = + g_array_sized_new (FALSE, FALSE, sizeof (CoglSpan), 1); + + tex_2ds->slice_y_spans = + g_array_sized_new (FALSE, FALSE, sizeof (CoglSpan), 1); + + tex_2ds->slice_textures = + g_array_sized_new (FALSE, FALSE, sizeof (CoglTexture2D *), 1); + + /* Store info for a single slice */ + x_span.start = 0; + x_span.size = gl_width; + x_span.waste = x_pot_waste; + g_array_append_val (tex_2ds->slice_x_spans, x_span); + + y_span.start = 0; + y_span.size = gl_height; + y_span.waste = y_pot_waste; + g_array_append_val (tex_2ds->slice_y_spans, y_span); + + g_array_append_val (tex_2ds->slice_textures, tex_2d); + + _cogl_texture_set_allocated (tex, + format, + tex->width, + tex->height); + + return TRUE; +} + +static CoglBool +_cogl_texture_2d_sliced_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTextureLoader *loader = tex->loader; + + _COGL_RETURN_VAL_IF_FAIL (loader, FALSE); + + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + return allocate_with_size (tex_2ds, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + return allocate_from_bitmap (tex_2ds, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN: + return allocate_from_gl_foreign (tex_2ds, loader, error); + default: + break; + } + + g_return_val_if_reached (FALSE); +} + +static CoglBool +_cogl_texture_2d_sliced_is_foreign (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + + /* Make sure slices were created */ + if (tex_2ds->slice_textures == NULL) + return FALSE; + + /* Pass the call on to the first slice */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + return _cogl_texture_is_foreign (COGL_TEXTURE (slice_tex)); +} + +static int +_cogl_texture_2d_sliced_get_max_waste (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + + return tex_2ds->max_waste; +} + +static CoglBool +_cogl_texture_2d_sliced_is_sliced (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + + /* It's only after allocating a sliced texture that we will know + * whether it really needed to be sliced... */ + if (!tex->allocated) + cogl_texture_allocate (tex, NULL); + + if (tex_2ds->slice_x_spans->len != 1 || + tex_2ds->slice_y_spans->len != 1) + return TRUE; + else + return FALSE; +} + +static CoglBool +_cogl_texture_2d_sliced_can_hardware_repeat (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + CoglSpan *x_span; + CoglSpan *y_span; + + /* If there's more than one texture then we can't hardware repeat */ + if (tex_2ds->slice_textures->len != 1) + return FALSE; + + /* If there's any waste then we can't hardware repeat */ + x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0); + y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0); + if (x_span->waste > 0 || y_span->waste > 0) + return FALSE; + + /* Otherwise pass the query on to the single slice texture */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + return _cogl_texture_can_hardware_repeat (COGL_TEXTURE (slice_tex)); +} + +static void +_cogl_texture_2d_sliced_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglSpan *x_span; + CoglSpan *y_span; + CoglTexture2D *slice_tex; + + g_assert (!_cogl_texture_2d_sliced_is_sliced (tex)); + + /* Don't include the waste in the texture coordinates */ + x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0); + y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0); + + *s *= tex->width / (float)x_span->size; + *t *= tex->height / (float)y_span->size; + + /* Let the child texture further transform the coords */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + _cogl_texture_transform_coords_to_gl (COGL_TEXTURE (slice_tex), s, t); +} + +static CoglTransformResult +_cogl_texture_2d_sliced_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglBool need_repeat = FALSE; + int i; + + /* This is a bit lazy - in the case where the quad lies entirely + * within a single slice we could avoid the fallback. But that + * could likely lead to visual inconsistency if the fallback involves + * dropping layers, so this might be the right thing to do anyways. + */ + if (_cogl_texture_2d_sliced_is_sliced (tex)) + return COGL_TRANSFORM_SOFTWARE_REPEAT; + + for (i = 0; i < 4; i++) + if (coords[i] < 0.0f || coords[i] > 1.0f) + need_repeat = TRUE; + + if (need_repeat && !_cogl_texture_2d_sliced_can_hardware_repeat (tex)) + return COGL_TRANSFORM_SOFTWARE_REPEAT; + + _cogl_texture_2d_sliced_transform_coords_to_gl (tex, coords + 0, coords + 1); + _cogl_texture_2d_sliced_transform_coords_to_gl (tex, coords + 2, coords + 3); + + return (need_repeat + ? COGL_TRANSFORM_HARDWARE_REPEAT : COGL_TRANSFORM_NO_REPEAT); +} + +static CoglBool +_cogl_texture_2d_sliced_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + + if (tex_2ds->slice_textures == NULL) + return FALSE; + + if (tex_2ds->slice_textures->len < 1) + return FALSE; + + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + + return cogl_texture_get_gl_texture (COGL_TEXTURE (slice_tex), + out_gl_handle, out_gl_target); +} + +static void +_cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + int i; + + _COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL); + + /* Apply new filters to every slice. The slice texture itself should + cache the value and avoid resubmitting the same filter value to + GL */ + for (i = 0; i < tex_2ds->slice_textures->len; i++) + { + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i); + _cogl_texture_gl_flush_legacy_texobj_filters (COGL_TEXTURE (slice_tex), + min_filter, mag_filter); + } +} + +static void +_cogl_texture_2d_sliced_pre_paint (CoglTexture *tex, + CoglTexturePrePaintFlags flags) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + int i; + + _COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL); + + /* Pass the pre-paint on to every slice */ + for (i = 0; i < tex_2ds->slice_textures->len; i++) + { + CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures, + CoglTexture2D *, i); + _cogl_texture_pre_paint (COGL_TEXTURE (slice_tex), flags); + } +} + +static void +_cogl_texture_2d_sliced_ensure_non_quad_rendering (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + int i; + + _COGL_RETURN_IF_FAIL (tex_2ds->slice_textures != NULL); + + /* Pass the call on to every slice */ + for (i = 0; i < tex_2ds->slice_textures->len; i++) + { + CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures, + CoglTexture2D *, i); + _cogl_texture_ensure_non_quad_rendering (COGL_TEXTURE (slice_tex)); + } +} + +static CoglBool +_cogl_texture_2d_sliced_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglBitmap *upload_bmp; + CoglBool status; + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + _cogl_texture_get_format (tex), + FALSE, /* can't convert in + place */ + error); + if (!upload_bmp) + return FALSE; + + status = _cogl_texture_2d_sliced_upload_subregion (tex_2ds, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + upload_bmp, + error); + cogl_object_unref (upload_bmp); + + return status; +} + +static CoglPixelFormat +_cogl_texture_2d_sliced_get_format (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + + return tex_2ds->internal_format; +} + +static GLenum +_cogl_texture_2d_sliced_get_gl_format (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + + /* Assert that we've allocated our slices at this point */ + cogl_texture_allocate (tex, NULL); /* (abort on error) */ + + /* Pass the call on to the first slice */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + return _cogl_texture_gl_get_format (COGL_TEXTURE (slice_tex)); +} + +static CoglTextureType +_cogl_texture_2d_sliced_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_2D; +} + +static const CoglTextureVtable +cogl_texture_2d_sliced_vtable = + { + FALSE, /* not primitive */ + _cogl_texture_2d_sliced_allocate, + _cogl_texture_2d_sliced_set_region, + NULL, /* get_data */ + _cogl_texture_2d_sliced_foreach_sub_texture_in_region, + _cogl_texture_2d_sliced_get_max_waste, + _cogl_texture_2d_sliced_is_sliced, + _cogl_texture_2d_sliced_can_hardware_repeat, + _cogl_texture_2d_sliced_transform_coords_to_gl, + _cogl_texture_2d_sliced_transform_quad_coords_to_gl, + _cogl_texture_2d_sliced_get_gl_texture, + _cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters, + _cogl_texture_2d_sliced_pre_paint, + _cogl_texture_2d_sliced_ensure_non_quad_rendering, + _cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes, + _cogl_texture_2d_sliced_get_format, + _cogl_texture_2d_sliced_get_gl_format, + _cogl_texture_2d_sliced_get_type, + _cogl_texture_2d_sliced_is_foreign, + NULL /* set_auto_mipmap */ + }; diff --git a/cogl/cogl-texture-2d-sliced.h b/cogl/cogl-texture-2d-sliced.h new file mode 100644 index 0000000..ec959a9 --- /dev/null +++ b/cogl/cogl-texture-2d-sliced.h @@ -0,0 +1,301 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_TEXURE_2D_SLICED_H +#define __COGL_TEXURE_2D_SLICED_H + +#include "cogl-context.h" +#include "cogl-types.h" + +/** + * SECTION:cogl-texture-2d-sliced + * @short_description: Functions for creating and manipulating 2D meta + * textures that may internally be comprised of + * multiple 2D textures with power-of-two sizes. + * + * These functions allow high-level meta textures (See the + * #CoglMetaTexture interface) to be allocated that may internally be + * comprised of multiple 2D texture "slices" with power-of-two sizes. + * + * This API can be useful when working with GPUs that don't have + * native support for non-power-of-two textures or if you want to load + * a texture that is larger than the GPUs maximum texture size limits. + * + * The algorithm for slicing works by first trying to map a virtual + * size to the next larger power-of-two size and then seeing how many + * wasted pixels that would result in. For example if you have a + * virtual texture that's 259 texels wide, the next pot size = 512 and + * the amount of waste would be 253 texels. If the amount of waste is + * above a max-waste threshold then we would next slice that texture + * into one that's 256 texels and then looking at how many more texels + * remain unallocated after that we choose the next power-of-two size. + * For the example of a 259 texel image that would mean having a 256 + * texel wide texture, leaving 3 texels unallocated so we'd then + * create a 4 texel wide texture - now there is only one texel of + * waste. The algorithm continues to slice the right most textures + * until the amount of waste is less than or equal to a specfied + * max-waste threshold. The same logic for slicing from left to right + * is also applied from top to bottom. + */ + +typedef struct _CoglTexture2DSliced CoglTexture2DSliced; +#define COGL_TEXTURE_2D_SLICED(X) ((CoglTexture2DSliced *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_2d_sliced_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_2d_sliced_get_gtype (void); +#endif + +/** + * cogl_texture_2d_sliced_new_with_size: + * @ctx: A #CoglContext + * @width: The virtual width of your sliced texture. + * @height: The virtual height of your sliced texture. + * @max_waste: The threshold of how wide a strip of wasted texels + * are allowed along the right and bottom textures before + * they must be sliced to reduce the amount of waste. A + * negative can be passed to disable slicing. + * + * Creates a #CoglTexture2DSliced that may internally be comprised of + * 1 or more #CoglTexture2D textures depending on GPU limitations. + * For example if the GPU only supports power-of-two sized textures + * then a sliced texture will turn a non-power-of-two size into a + * combination of smaller power-of-two sized textures. If the + * requested texture size is larger than is supported by the hardware + * then the texture will be sliced into smaller textures that can be + * accessed by the hardware. + * + * @max_waste is used as a threshold for recursively slicing the + * right-most or bottom-most slices into smaller sizes until the + * wasted padding at the bottom and right of the textures is less than + * specified. A negative @max_waste will disable slicing. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or let Cogl automatically allocate + * storage lazily. + * + * It's possible for the allocation of a sliced texture to fail + * later due to impossible slicing constraints if a negative + * @max_waste value is given. If the given virtual texture size size + * is larger than is supported by the hardware but slicing is disabled + * the texture size would be too large to handle. + * + * Returns: (transfer full): A new #CoglTexture2DSliced object with no storage + * allocated yet. + * + * Since: 1.10 + * Stability: unstable + */ +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, + int width, + int height, + int max_waste); + +/** + * cogl_texture_2d_sliced_new_from_file: + * @ctx: A #CoglContext + * @filename: the file to load + * @max_waste: The threshold of how wide a strip of wasted texels + * are allowed along the right and bottom textures before + * they must be sliced to reduce the amount of waste. A + * negative can be passed to disable slicing. + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a #CoglTexture2DSliced from an image file. + * + * A #CoglTexture2DSliced may internally be comprised of 1 or more + * #CoglTexture2D textures depending on GPU limitations. For example + * if the GPU only supports power-of-two sized textures then a sliced + * texture will turn a non-power-of-two size into a combination of + * smaller power-of-two sized textures. If the requested texture size + * is larger than is supported by the hardware then the texture will + * be sliced into smaller textures that can be accessed by the + * hardware. + * + * @max_waste is used as a threshold for recursively slicing the + * right-most or bottom-most slices into smaller sizes until the + * wasted padding at the bottom and right of the textures is less than + * specified. A negative @max_waste will disable slicing. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or let Cogl automatically allocate + * storage lazily. + * + * It's possible for the allocation of a sliced texture to fail + * later due to impossible slicing constraints if a negative + * @max_waste value is given. If the given virtual texture size is + * larger than is supported by the hardware but slicing is disabled + * the texture size would be too large to handle. + * + * Return value: (transfer full): A newly created #CoglTexture2DSliced + * or %NULL on failure and @error will be updated. + * + * Since: 1.16 + */ +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, + const char *filename, + int max_waste, + CoglError **error); + +/** + * cogl_texture_2d_sliced_new_from_data: + * @ctx: A #CoglContext + * @width: width of texture in pixels + * @height: height of texture in pixels + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @max_waste: The threshold of how wide a strip of wasted texels + * are allowed along the right and bottom textures before + * they must be sliced to reduce the amount of waste. A + * negative can be passed to disable slicing. + * @rowstride: the memory offset in bytes between the start of each + * row in @data. A value of 0 will make Cogl automatically + * calculate @rowstride from @width and @format. + * @data: pointer the memory region where the source buffer resides + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a new #CoglTexture2DSliced texture based on data residing + * in memory. + * + * A #CoglTexture2DSliced may internally be comprised of 1 or more + * #CoglTexture2D textures depending on GPU limitations. For example + * if the GPU only supports power-of-two sized textures then a sliced + * texture will turn a non-power-of-two size into a combination of + * smaller power-of-two sized textures. If the requested texture size + * is larger than is supported by the hardware then the texture will + * be sliced into smaller textures that can be accessed by the + * hardware. + * + * @max_waste is used as a threshold for recursively slicing the + * right-most or bottom-most slices into smaller sizes until the + * wasted padding at the bottom and right of the textures is less than + * specified. A negative @max_waste will disable slicing. + * + * This api will always immediately allocate GPU memory for all + * the required texture slices and upload the given data so that the + * @data pointer does not need to remain valid once this function + * returns. This means it is not possible to configure the texture + * before it is allocated. If you do need to configure the texture + * before allocation (to specify constraints on the internal format + * for example) then you can instead create a #CoglBitmap for your + * data and use cogl_texture_2d_sliced_new_from_bitmap() or use + * cogl_texture_2d_sliced_new_with_size() and then upload data using + * cogl_texture_set_data() + * + * It's possible for the allocation of a sliced texture to fail + * due to impossible slicing constraints if a negative @max_waste + * value is given. If the given virtual texture size is larger than is + * supported by the hardware but slicing is disabled the texture size + * would be too large to handle. + * + * Return value: (transfer full): A newly created #CoglTexture2DSliced + * or %NULL on failure and @error will be updated. + * + * Since: 1.16 + */ +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_data (CoglContext *ctx, + int width, + int height, + int max_waste, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error); + +/** + * cogl_texture_2d_sliced_new_from_bitmap: + * @bmp: A #CoglBitmap + * @max_waste: The threshold of how wide a strip of wasted texels + * are allowed along the right and bottom textures before + * they must be sliced to reduce the amount of waste. A + * negative can be passed to disable slicing. + * + * Creates a new #CoglTexture2DSliced texture based on data residing + * in a bitmap. + * + * A #CoglTexture2DSliced may internally be comprised of 1 or more + * #CoglTexture2D textures depending on GPU limitations. For example + * if the GPU only supports power-of-two sized textures then a sliced + * texture will turn a non-power-of-two size into a combination of + * smaller power-of-two sized textures. If the requested texture size + * is larger than is supported by the hardware then the texture will + * be sliced into smaller textures that can be accessed by the + * hardware. + * + * @max_waste is used as a threshold for recursively slicing the + * right-most or bottom-most slices into smaller sizes until the + * wasted padding at the bottom and right of the textures is less than + * specified. A negative @max_waste will disable slicing. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or let Cogl automatically allocate + * storage lazily. + * + * It's possible for the allocation of a sliced texture to fail + * later due to impossible slicing constraints if a negative + * @max_waste value is given. If the given virtual texture size is + * larger than is supported by the hardware but slicing is disabled + * the texture size would be too large to handle. + * + * Return value: (transfer full): A newly created #CoglTexture2DSliced + * or %NULL on failure and @error will be updated. + * + * Since: 1.16 + */ +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + int max_waste); + +/** + * cogl_is_texture_2d_sliced: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglTexture2DSliced. + * + * Return value: %TRUE if the object references a #CoglTexture2DSliced + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +CoglBool +cogl_is_texture_2d_sliced (void *object); + +#endif /* __COGL_TEXURE_2D_SLICED_H */ diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c new file mode 100644 index 0000000..cc28cd9 --- /dev/null +++ b/cogl/cogl-texture-2d.c @@ -0,0 +1,695 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-2d-gl-private.h" +#include "cogl-texture-driver.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-error-private.h" +#ifdef COGL_HAS_EGL_SUPPORT +#include "cogl-winsys-egl-private.h" +#endif +#include "cogl-gtype-private.h" + +#include +#include + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +#include "cogl-wayland-server.h" +#endif + +static void _cogl_texture_2d_free (CoglTexture2D *tex_2d); + +COGL_TEXTURE_DEFINE (Texture2D, texture_2d); +COGL_GTYPE_DEFINE_CLASS (Texture2D, texture_2d, + COGL_GTYPE_IMPLEMENT_INTERFACE (texture)); + +static const CoglTextureVtable cogl_texture_2d_vtable; + +typedef struct _CoglTexture2DManualRepeatData +{ + CoglTexture2D *tex_2d; + CoglMetaTextureCallback callback; + void *user_data; +} CoglTexture2DManualRepeatData; + +static void +_cogl_texture_2d_free (CoglTexture2D *tex_2d) +{ + CoglContext *ctx = COGL_TEXTURE (tex_2d)->context; + + ctx->driver_vtable->texture_2d_free (tex_2d); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_2d)); +} + +void +_cogl_texture_2d_set_auto_mipmap (CoglTexture *tex, + CoglBool value) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + tex_2d->auto_mipmap = value; +} + +CoglTexture2D * +_cogl_texture_2d_create_base (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + CoglTextureLoader *loader) +{ + CoglTexture2D *tex_2d = g_new (CoglTexture2D, 1); + CoglTexture *tex = COGL_TEXTURE (tex_2d); + + _cogl_texture_init (tex, ctx, width, height, internal_format, loader, + &cogl_texture_2d_vtable); + + tex_2d->mipmaps_dirty = TRUE; + tex_2d->auto_mipmap = TRUE; + + tex_2d->is_foreign = FALSE; + + ctx->driver_vtable->texture_2d_init (tex_2d); + + return _cogl_texture_2d_object_new (tex_2d); +} + +CoglTexture2D * +cogl_texture_2d_new_with_size (CoglContext *ctx, + int width, + int height) +{ + CoglTextureLoader *loader; + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; + loader->src.sized.width = width; + loader->src.sized.height = height; + + return _cogl_texture_2d_create_base (ctx, width, height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, loader); +} + +static CoglBool +_cogl_texture_2d_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglContext *ctx = tex->context; + + return ctx->driver_vtable->texture_2d_allocate (tex, error); +} + +CoglTexture2D * +_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, + CoglBool can_convert_in_place) +{ + CoglTextureLoader *loader; + + _COGL_RETURN_VAL_IF_FAIL (bmp != NULL, NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; + loader->src.bitmap.bitmap = cogl_object_ref (bmp); + loader->src.bitmap.can_convert_in_place = can_convert_in_place; + + return _cogl_texture_2d_create_base (_cogl_bitmap_get_context (bmp), + cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + cogl_bitmap_get_format (bmp), + loader); +} + +CoglTexture2D * +cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp) +{ + return _cogl_texture_2d_new_from_bitmap (bmp, + FALSE); /* can't convert in place */ +} + +CoglTexture2D * +cogl_texture_2d_new_from_file (CoglContext *ctx, + const char *filename, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture2D *tex_2d = NULL; + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + bmp = _cogl_bitmap_from_file (ctx, filename, error); + if (bmp == NULL) + return NULL; + + tex_2d = _cogl_texture_2d_new_from_bitmap (bmp, + TRUE); /* can convert in-place */ + + cogl_object_unref (bmp); + + return tex_2d; +} + +CoglTexture2D * +cogl_texture_2d_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture2D *tex_2d; + + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + /* Wrap the data into a bitmap */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + tex_2d = cogl_texture_2d_new_from_bitmap (bmp); + + cogl_object_unref (bmp); + + if (tex_2d && + !cogl_texture_allocate (COGL_TEXTURE (tex_2d), error)) + { + cogl_object_unref (tex_2d); + return NULL; + } + + return tex_2d; +} + +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) +/* NB: The reason we require the width, height and format to be passed + * even though they may seem redundant is because GLES 1/2 don't + * provide a way to query these properties. */ +CoglTexture2D * +_cogl_egl_texture_2d_new_from_image (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + EGLImageKHR image, + CoglError **error) +{ + CoglTextureLoader *loader; + CoglTexture2D *tex; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & + COGL_RENDERER_CONSTRAINT_USES_EGL, + NULL); + + _COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature + (ctx, + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE), + NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE; + loader->src.egl_image.image = image; + loader->src.egl_image.width = width; + loader->src.egl_image.height = height; + loader->src.egl_image.format = format; + + tex = _cogl_texture_2d_create_base (ctx, width, height, format, loader); + + if (!cogl_texture_allocate (COGL_TEXTURE (tex), error)) + { + cogl_object_unref (tex); + return NULL; + } + + return tex; +} +#endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */ + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +static void +shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer, + CoglPixelFormat *format_out, + CoglTextureComponents *components_out) +{ + CoglPixelFormat format; + CoglTextureComponents components = COGL_TEXTURE_COMPONENTS_RGBA; + + switch (wl_shm_buffer_get_format (shm_buffer)) + { +#if G_BYTE_ORDER == G_BIG_ENDIAN + case WL_SHM_FORMAT_ARGB8888: + format = COGL_PIXEL_FORMAT_ARGB_8888_PRE; + break; + case WL_SHM_FORMAT_XRGB8888: + format = COGL_PIXEL_FORMAT_ARGB_8888; + components = COGL_TEXTURE_COMPONENTS_RGB; + break; +#elif G_BYTE_ORDER == G_LITTLE_ENDIAN + case WL_SHM_FORMAT_ARGB8888: + format = COGL_PIXEL_FORMAT_BGRA_8888_PRE; + break; + case WL_SHM_FORMAT_XRGB8888: + format = COGL_PIXEL_FORMAT_BGRA_8888; + components = COGL_TEXTURE_COMPONENTS_RGB; + break; +#endif + default: + g_warn_if_reached (); + format = COGL_PIXEL_FORMAT_ARGB_8888; + } + + if (format_out) + *format_out = format; + if (components_out) + *components_out = components; +} + +CoglBool +cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture, + int src_x, + int src_y, + int width, + int height, + struct wl_shm_buffer * + shm_buffer, + int dst_x, + int dst_y, + int level, + CoglError **error) +{ + const uint8_t *data = wl_shm_buffer_get_data (shm_buffer); + int32_t stride = wl_shm_buffer_get_stride (shm_buffer); + CoglPixelFormat format; + int bpp; + + shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL); + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + + return _cogl_texture_set_region (COGL_TEXTURE (texture), + width, height, + format, + stride, + data + src_x * bpp + src_y * stride, + dst_x, dst_y, + level, + error); +} + +CoglTexture2D * +cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, + struct wl_resource *buffer, + CoglError **error) +{ + struct wl_shm_buffer *shm_buffer; + CoglTexture2D *tex = NULL; + + shm_buffer = wl_shm_buffer_get (buffer); + + if (shm_buffer) + { + int stride = wl_shm_buffer_get_stride (shm_buffer); + int width = wl_shm_buffer_get_width (shm_buffer); + int height = wl_shm_buffer_get_height (shm_buffer); + CoglPixelFormat format; + CoglTextureComponents components; + CoglBitmap *bmp; + + shm_buffer_get_cogl_pixel_format (shm_buffer, &format, &components); + + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + stride, + wl_shm_buffer_get_data (shm_buffer)); + + tex = cogl_texture_2d_new_from_bitmap (bmp); + + cogl_texture_set_components (COGL_TEXTURE (tex), components); + + cogl_object_unref (bmp); + + if (!cogl_texture_allocate (COGL_TEXTURE (tex), error)) + { + cogl_object_unref (tex); + return NULL; + } + else + return tex; + } + else + { + int format, width, height; + + if (_cogl_egl_query_wayland_buffer (ctx, + buffer, + EGL_TEXTURE_FORMAT, + &format) && + _cogl_egl_query_wayland_buffer (ctx, + buffer, + EGL_WIDTH, + &width) && + _cogl_egl_query_wayland_buffer (ctx, + buffer, + EGL_HEIGHT, + &height)) + { + EGLImageKHR image; + CoglPixelFormat internal_format; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & + COGL_RENDERER_CONSTRAINT_USES_EGL, + NULL); + + switch (format) + { + case EGL_TEXTURE_RGB: + internal_format = COGL_PIXEL_FORMAT_RGB_888; + break; + case EGL_TEXTURE_RGBA: + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + break; + default: + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Can't create texture from unknown " + "wayland buffer format %d\n", format); + return NULL; + } + + image = _cogl_egl_create_image (ctx, + EGL_WAYLAND_BUFFER_WL, + buffer, + NULL); + tex = _cogl_egl_texture_2d_new_from_image (ctx, + width, height, + internal_format, + image, + error); + _cogl_egl_destroy_image (ctx, image); + return tex; + } + } + + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Can't create texture from unknown " + "wayland buffer type\n"); + return NULL; +} +#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */ + +void +_cogl_texture_2d_externally_modified (CoglTexture *texture) +{ + if (!cogl_is_texture_2d (texture)) + return; + + COGL_TEXTURE_2D (texture)->mipmaps_dirty = TRUE; +} + +void +_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglContext *ctx = tex->context; + + /* Assert that the storage for this texture has been allocated */ + cogl_texture_allocate (tex, NULL); /* (abort on error) */ + + ctx->driver_vtable->texture_2d_copy_from_framebuffer (tex_2d, + src_x, + src_y, + width, + height, + src_fb, + dst_x, + dst_y, + level); + + tex_2d->mipmaps_dirty = TRUE; +} + +static int +_cogl_texture_2d_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static CoglBool +_cogl_texture_2d_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static CoglBool +_cogl_texture_2d_can_hardware_repeat (CoglTexture *tex) +{ + CoglContext *ctx = tex->context; + + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT) || + (_cogl_util_is_pot (tex->width) && + _cogl_util_is_pot (tex->height))) + return TRUE; + else + return FALSE; +} + +static void +_cogl_texture_2d_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + /* The texture coordinates map directly so we don't need to do + anything */ +} + +static CoglTransformResult +_cogl_texture_2d_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + /* The texture coordinates map directly so we don't need to do + anything other than check for repeats */ + + int i; + + for (i = 0; i < 4; i++) + if (coords[i] < 0.0f || coords[i] > 1.0f) + { + /* Repeat is needed */ + return (_cogl_texture_2d_can_hardware_repeat (tex) ? + COGL_TRANSFORM_HARDWARE_REPEAT : + COGL_TRANSFORM_SOFTWARE_REPEAT); + } + + /* No repeat is needed */ + return COGL_TRANSFORM_NO_REPEAT; +} + +static CoglBool +_cogl_texture_2d_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglContext *ctx = tex->context; + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + if (ctx->driver_vtable->texture_2d_get_gl_handle) + { + GLuint handle; + + if (out_gl_target) + *out_gl_target = GL_TEXTURE_2D; + + handle = ctx->driver_vtable->texture_2d_get_gl_handle (tex_2d); + + if (out_gl_handle) + *out_gl_handle = handle; + + return handle ? TRUE : FALSE; + } + else + return FALSE; +} + +static void +_cogl_texture_2d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + /* Only update if the mipmaps are dirty */ + if ((flags & COGL_TEXTURE_NEEDS_MIPMAP) && + tex_2d->auto_mipmap && tex_2d->mipmaps_dirty) + { + CoglContext *ctx = tex->context; + + ctx->driver_vtable->texture_2d_generate_mipmap (tex_2d); + + tex_2d->mipmaps_dirty = FALSE; + } +} + +static void +_cogl_texture_2d_ensure_non_quad_rendering (CoglTexture *tex) +{ + /* Nothing needs to be done */ +} + +static CoglBool +_cogl_texture_2d_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + CoglContext *ctx = tex->context; + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + if (!ctx->driver_vtable->texture_2d_copy_from_bitmap (tex_2d, + src_x, + src_y, + width, + height, + bmp, + dst_x, + dst_y, + level, + error)) + { + return FALSE; + } + + tex_2d->mipmaps_dirty = TRUE; + + return TRUE; +} + +static CoglBool +_cogl_texture_2d_get_data (CoglTexture *tex, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + CoglContext *ctx = tex->context; + + if (ctx->driver_vtable->texture_2d_get_data) + { + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + ctx->driver_vtable->texture_2d_get_data (tex_2d, format, rowstride, data); + return TRUE; + } + else + return FALSE; +} + +static CoglPixelFormat +_cogl_texture_2d_get_format (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->internal_format; +} + +static GLenum +_cogl_texture_2d_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->gl_internal_format; +} + +static CoglBool +_cogl_texture_2d_is_foreign (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->is_foreign; +} + +static CoglTextureType +_cogl_texture_2d_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_2D; +} + +static const CoglTextureVtable +cogl_texture_2d_vtable = + { + TRUE, /* primitive */ + _cogl_texture_2d_allocate, + _cogl_texture_2d_set_region, + _cogl_texture_2d_get_data, + NULL, /* foreach_sub_texture_in_region */ + _cogl_texture_2d_get_max_waste, + _cogl_texture_2d_is_sliced, + _cogl_texture_2d_can_hardware_repeat, + _cogl_texture_2d_transform_coords_to_gl, + _cogl_texture_2d_transform_quad_coords_to_gl, + _cogl_texture_2d_get_gl_texture, + _cogl_texture_2d_gl_flush_legacy_texobj_filters, + _cogl_texture_2d_pre_paint, + _cogl_texture_2d_ensure_non_quad_rendering, + _cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes, + _cogl_texture_2d_get_format, + _cogl_texture_2d_get_gl_format, + _cogl_texture_2d_get_type, + _cogl_texture_2d_is_foreign, + _cogl_texture_2d_set_auto_mipmap + }; diff --git a/cogl/cogl-texture-2d.h b/cogl/cogl-texture-2d.h new file mode 100644 index 0000000..c806ced --- /dev/null +++ b/cogl/cogl-texture-2d.h @@ -0,0 +1,234 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TEXTURE_2D_H +#define __COGL_TEXTURE_2D_H + +#include "cogl-context.h" +#include "cogl-bitmap.h" + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-texture-2d + * @short_description: Functions for creating and manipulating 2D textures + * + * These functions allow low-level 2D textures to be allocated. These + * differ from sliced textures for example which may internally be + * made up of multiple 2D textures, or atlas textures where Cogl must + * internally modify user texture coordinates before they can be used + * by the GPU. + * + * You should be aware that many GPUs only support power of two sizes + * for #CoglTexture2D textures. You can check support for non power of + * two textures by checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature + * via cogl_has_feature(). + */ + +typedef struct _CoglTexture2D CoglTexture2D; +#define COGL_TEXTURE_2D(X) ((CoglTexture2D *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_2d_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_2d_get_gtype (void); +#endif + +/** + * cogl_is_texture_2d: + * @object: A #CoglObject + * + * Gets whether the given object references an existing #CoglTexture2D + * object. + * + * Return value: %TRUE if the object references a #CoglTexture2D, + * %FALSE otherwise + */ +CoglBool +cogl_is_texture_2d (void *object); + +/** + * cogl_texture_2d_new_with_size: + * @ctx: A #CoglContext + * @width: Width of the texture to allocate + * @height: Height of the texture to allocate + * + * Creates a low-level #CoglTexture2D texture with a given @width and + * @height that your GPU can texture from directly. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is being used and can optimize how it is allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Many GPUs only support power of two sizes for #CoglTexture2D + * textures. You can check support for non power of two textures by + * checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature via + * cogl_has_feature(). + * + * Returns: (transfer full): A new #CoglTexture2D object with no storage yet allocated. + * + * Since: 2.0 + */ +CoglTexture2D * +cogl_texture_2d_new_with_size (CoglContext *ctx, + int width, + int height); + +/** + * cogl_texture_2d_new_from_file: + * @ctx: A #CoglContext + * @filename: the file to load + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a low-level #CoglTexture2D texture from an image file. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is being used and can optimize how it is allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Many GPUs only support power of two sizes for #CoglTexture2D + * textures. You can check support for non power of two textures by + * checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature via + * cogl_has_feature(). + * + * Return value: (transfer full): A newly created #CoglTexture2D or %NULL on failure + * and @error will be updated. + * + * Since: 1.16 + */ +CoglTexture2D * +cogl_texture_2d_new_from_file (CoglContext *ctx, + const char *filename, + CoglError **error); + +/** + * cogl_texture_2d_new_from_data: + * @ctx: A #CoglContext + * @width: width of texture in pixels + * @height: height of texture in pixels + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @rowstride: the memory offset in bytes between the starts of + * scanlines in @data. A value of 0 will make Cogl automatically + * calculate @rowstride from @width and @format. + * @data: pointer the memory region where the source buffer resides + * @error: A #CoglError for exceptions + * + * Creates a low-level #CoglTexture2D texture based on data residing + * in memory. + * + * This api will always immediately allocate GPU memory for the + * texture and upload the given data so that the @data pointer does + * not need to remain valid once this function returns. This means it + * is not possible to configure the texture before it is allocated. If + * you do need to configure the texture before allocation (to specify + * constraints on the internal format for example) then you can + * instead create a #CoglBitmap for your data and use + * cogl_texture_2d_new_from_bitmap() or use + * cogl_texture_2d_new_with_size() and then upload data using + * cogl_texture_set_data() + * + * Many GPUs only support power of two sizes for #CoglTexture2D + * textures. You can check support for non power of two textures by + * checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature via + * cogl_has_feature(). + * + * Returns: (transfer full): A newly allocated #CoglTexture2D, or if + * the size is not supported (because it is too large or a + * non-power-of-two size that the hardware doesn't support) + * it will return %NULL and set @error. + * + * Since: 2.0 + */ +CoglTexture2D * +cogl_texture_2d_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + CoglError **error); + +/** + * cogl_texture_2d_new_from_bitmap: + * @bitmap: A #CoglBitmap + * + * Creates a low-level #CoglTexture2D texture based on data residing + * in a #CoglBitmap. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is being used and can optimize how it is allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * Many GPUs only support power of two sizes for #CoglTexture2D + * textures. You can check support for non power of two textures by + * checking for the %COGL_FEATURE_ID_TEXTURE_NPOT feature via + * cogl_has_feature(). + * + * Returns: (transfer full): A newly allocated #CoglTexture2D + * + * Since: 2.0 + * Stability: unstable + */ +CoglTexture2D * +cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap); + +COGL_END_DECLS + +#endif /* __COGL_TEXTURE_2D_H */ diff --git a/cogl/cogl-texture-3d-private.h b/cogl/cogl-texture-3d-private.h new file mode 100644 index 0000000..b6e0066 --- /dev/null +++ b/cogl/cogl-texture-3d-private.h @@ -0,0 +1,66 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_TEXTURE_3D_PRIVATE_H +#define __COGL_TEXTURE_3D_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-3d.h" + +struct _CoglTexture3D +{ + CoglTexture _parent; + + /* The internal format of the texture represented as a + CoglPixelFormat */ + CoglPixelFormat internal_format; + int depth; + CoglBool auto_mipmap; + CoglBool mipmaps_dirty; + + /* TODO: factor out these OpenGL specific members into some form + * of driver private state. */ + + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_format; + /* The texture object number */ + GLuint gl_texture; + GLenum gl_legacy_texobj_min_filter; + GLenum gl_legacy_texobj_mag_filter; + GLint gl_legacy_texobj_wrap_mode_s; + GLint gl_legacy_texobj_wrap_mode_t; + GLint gl_legacy_texobj_wrap_mode_p; + CoglTexturePixel first_pixel; +}; + +#endif /* __COGL_TEXTURE_3D_PRIVATE_H */ diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c new file mode 100644 index 0000000..8e2ff08 --- /dev/null +++ b/cogl/cogl-texture-3d.c @@ -0,0 +1,761 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-texture-3d-private.h" +#include "cogl-texture-3d.h" +#include "cogl-texture-gl-private.h" +#include "cogl-texture-driver.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-error-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +/* These might not be defined on GLES */ +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif +#ifndef GL_TEXTURE_WRAP_R +#define GL_TEXTURE_WRAP_R 0x8072 +#endif + +static void _cogl_texture_3d_free (CoglTexture3D *tex_3d); + +COGL_TEXTURE_DEFINE (Texture3D, texture_3d); +COGL_GTYPE_DEFINE_CLASS (Texture3D, texture_3d, + COGL_GTYPE_IMPLEMENT_INTERFACE (texture)); + +static const CoglTextureVtable cogl_texture_3d_vtable; + +static void +_cogl_texture_3d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + CoglContext *ctx = tex->context; + + /* Only set the wrap mode if it's different from the current value + to avoid too many GL calls. */ + if (tex_3d->gl_legacy_texobj_wrap_mode_s != wrap_mode_s || + tex_3d->gl_legacy_texobj_wrap_mode_t != wrap_mode_t || + tex_3d->gl_legacy_texobj_wrap_mode_p != wrap_mode_p) + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, + GL_TEXTURE_WRAP_S, + wrap_mode_s) ); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, + GL_TEXTURE_WRAP_T, + wrap_mode_t) ); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, + GL_TEXTURE_WRAP_R, + wrap_mode_p) ); + + tex_3d->gl_legacy_texobj_wrap_mode_s = wrap_mode_s; + tex_3d->gl_legacy_texobj_wrap_mode_t = wrap_mode_t; + tex_3d->gl_legacy_texobj_wrap_mode_p = wrap_mode_p; + } +} + +static void +_cogl_texture_3d_free (CoglTexture3D *tex_3d) +{ + if (tex_3d->gl_texture) + _cogl_delete_gl_texture (tex_3d->gl_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_3d)); +} + +static void +_cogl_texture_3d_set_auto_mipmap (CoglTexture *tex, + CoglBool value) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + + tex_3d->auto_mipmap = value; +} + +static CoglTexture3D * +_cogl_texture_3d_create_base (CoglContext *ctx, + int width, + int height, + int depth, + CoglPixelFormat internal_format, + CoglTextureLoader *loader) +{ + CoglTexture3D *tex_3d = g_new (CoglTexture3D, 1); + CoglTexture *tex = COGL_TEXTURE (tex_3d); + + _cogl_texture_init (tex, ctx, width, height, + internal_format, loader, &cogl_texture_3d_vtable); + + tex_3d->gl_texture = 0; + + tex_3d->depth = depth; + tex_3d->mipmaps_dirty = TRUE; + tex_3d->auto_mipmap = TRUE; + + /* We default to GL_LINEAR for both filters */ + tex_3d->gl_legacy_texobj_min_filter = GL_LINEAR; + tex_3d->gl_legacy_texobj_mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_3d->gl_legacy_texobj_wrap_mode_s = GL_FALSE; + tex_3d->gl_legacy_texobj_wrap_mode_t = GL_FALSE; + tex_3d->gl_legacy_texobj_wrap_mode_p = GL_FALSE; + + return _cogl_texture_3d_object_new (tex_3d); +} + +CoglTexture3D * +cogl_texture_3d_new_with_size (CoglContext *ctx, + int width, + int height, + int depth) +{ + CoglTextureLoader *loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; + loader->src.sized.width = width; + loader->src.sized.height = height; + loader->src.sized.depth = depth; + + return _cogl_texture_3d_create_base (ctx, width, height, depth, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + loader); +} + +CoglTexture3D * +cogl_texture_3d_new_from_bitmap (CoglBitmap *bmp, + int height, + int depth) +{ + CoglTextureLoader *loader; + + _COGL_RETURN_VAL_IF_FAIL (bmp, NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; + loader->src.bitmap.bitmap = cogl_object_ref (bmp); + loader->src.bitmap.height = height; + loader->src.bitmap.depth = depth; + loader->src.bitmap.can_convert_in_place = FALSE; /* TODO add api for this */ + + return _cogl_texture_3d_create_base (_cogl_bitmap_get_context (bmp), + cogl_bitmap_get_width (bmp), + height, + depth, + cogl_bitmap_get_format (bmp), + loader); +} + +CoglTexture3D * +cogl_texture_3d_new_from_data (CoglContext *context, + int width, + int height, + int depth, + CoglPixelFormat format, + int rowstride, + int image_stride, + const uint8_t *data, + CoglError **error) +{ + CoglBitmap *bitmap; + CoglTexture3D *ret; + + _COGL_RETURN_VAL_IF_FAIL (data, NULL); + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + /* Image stride from height and rowstride if not given */ + if (image_stride == 0) + image_stride = height * rowstride; + + if (image_stride < rowstride * height) + return NULL; + + /* GL doesn't support uploading when the image_stride isn't a + multiple of the rowstride. If this happens we'll just pack the + image into a new bitmap. The documentation for this function + recommends avoiding this situation. */ + if (image_stride % rowstride != 0) + { + uint8_t *bmp_data; + int bmp_rowstride; + int z, y; + + bitmap = _cogl_bitmap_new_with_malloc_buffer (context, + width, + depth * height, + format, + error); + if (!bitmap) + return NULL; + + bmp_data = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + error); + + if (bmp_data == NULL) + { + cogl_object_unref (bitmap); + return NULL; + } + + bmp_rowstride = cogl_bitmap_get_rowstride (bitmap); + + /* Copy all of the images in */ + for (z = 0; z < depth; z++) + for (y = 0; y < height; y++) + memcpy (bmp_data + (z * bmp_rowstride * height + + bmp_rowstride * y), + data + z * image_stride + rowstride * y, + bmp_rowstride); + + _cogl_bitmap_unmap (bitmap); + } + else + bitmap = cogl_bitmap_new_for_data (context, + width, + image_stride / rowstride * depth, + format, + rowstride, + (uint8_t *) data); + + ret = cogl_texture_3d_new_from_bitmap (bitmap, + height, + depth); + + cogl_object_unref (bitmap); + + if (ret && + !cogl_texture_allocate (COGL_TEXTURE (ret), error)) + { + cogl_object_unref (ret); + return NULL; + } + + return ret; +} + +static CoglBool +_cogl_texture_3d_can_create (CoglContext *ctx, + int width, + int height, + int depth, + CoglPixelFormat internal_format, + CoglError **error) +{ + GLenum gl_intformat; + GLenum gl_type; + + /* This should only happen on GLES */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "3D textures are not supported by the GPU"); + return FALSE; + } + + /* If NPOT textures aren't supported then the size must be a power + of two */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT) && + (!_cogl_util_is_pot (width) || + !_cogl_util_is_pot (height) || + !_cogl_util_is_pot (depth))) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "A non-power-of-two size was requested but this is not " + "supported by the GPU"); + return FALSE; + } + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + NULL, + &gl_type); + + /* Check that the driver can create a texture with that size */ + if (!ctx->texture_driver->size_supported_3d (ctx, + GL_TEXTURE_3D, + gl_intformat, + gl_type, + width, + height, + depth)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "The requested dimensions are not supported by the GPU"); + return FALSE; + } + + return TRUE; +} + +static CoglBool +allocate_with_size (CoglTexture3D *tex_3d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_3d); + CoglContext *ctx = tex->context; + CoglPixelFormat internal_format; + int width = loader->src.sized.width; + int height = loader->src.sized.height; + int depth = loader->src.sized.depth; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + GLenum gl_error; + GLenum gl_texture; + + internal_format = + _cogl_texture_determine_internal_format (tex, COGL_PIXEL_FORMAT_ANY); + + if (!_cogl_texture_3d_can_create (ctx, + width, + height, + depth, + internal_format, + error)) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + gl_texture = + ctx->texture_driver->gen (ctx, GL_TEXTURE_3D, internal_format); + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + gl_texture, + FALSE); + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage3D (GL_TEXTURE_3D, 0, gl_intformat, + width, height, depth, + 0, gl_format, gl_type, NULL); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + GE( ctx, glDeleteTextures (1, &gl_texture) ); + return FALSE; + } + + tex_3d->gl_texture = gl_texture; + tex_3d->gl_format = gl_intformat; + + tex_3d->depth = depth; + + tex_3d->internal_format = internal_format; + + _cogl_texture_set_allocated (tex, internal_format, width, height); + + return TRUE; +} + +static CoglBool +allocate_from_bitmap (CoglTexture3D *tex_3d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_3d); + CoglContext *ctx = tex->context; + CoglPixelFormat internal_format; + CoglBitmap *bmp = loader->src.bitmap.bitmap; + int bmp_width = cogl_bitmap_get_width (bmp); + int height = loader->src.bitmap.height; + int depth = loader->src.bitmap.depth; + CoglPixelFormat bmp_format = cogl_bitmap_get_format (bmp); + CoglBool can_convert_in_place = loader->src.bitmap.can_convert_in_place; + CoglBitmap *upload_bmp; + CoglPixelFormat upload_format; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + internal_format = _cogl_texture_determine_internal_format (tex, bmp_format); + + if (!_cogl_texture_3d_can_create (ctx, + bmp_width, height, depth, + internal_format, + error)) + return FALSE; + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return FALSE; + + upload_format = cogl_bitmap_get_format (upload_bmp); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + upload_format, + NULL, /* internal format */ + &gl_format, + &gl_type); + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + NULL, + NULL); + + /* Keep a copy of the first pixel so that if glGenerateMipmap isn't + supported we can fallback to using GL_GENERATE_MIPMAP */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + CoglError *ignore = NULL; + uint8_t *data = _cogl_bitmap_map (upload_bmp, + COGL_BUFFER_ACCESS_READ, 0, + &ignore); + + tex_3d->first_pixel.gl_format = gl_format; + tex_3d->first_pixel.gl_type = gl_type; + + if (data) + { + memcpy (tex_3d->first_pixel.data, data, + _cogl_pixel_format_get_bytes_per_pixel (upload_format)); + _cogl_bitmap_unmap (upload_bmp); + } + else + { + g_warning ("Failed to read first pixel of bitmap for " + "glGenerateMipmap fallback"); + cogl_error_free (ignore); + memset (tex_3d->first_pixel.data, 0, + _cogl_pixel_format_get_bytes_per_pixel (upload_format)); + } + } + + tex_3d->gl_texture = + ctx->texture_driver->gen (ctx, GL_TEXTURE_3D, internal_format); + + if (!ctx->texture_driver->upload_to_gl_3d (ctx, + GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE, /* is_foreign */ + height, + depth, + upload_bmp, + gl_intformat, + gl_format, + gl_type, + error)) + { + cogl_object_unref (upload_bmp); + return FALSE; + } + + tex_3d->gl_format = gl_intformat; + + cogl_object_unref (upload_bmp); + + tex_3d->depth = loader->src.bitmap.depth; + + tex_3d->internal_format = internal_format; + + _cogl_texture_set_allocated (tex, internal_format, + bmp_width, loader->src.bitmap.height); + + return TRUE; +} + +static CoglBool +_cogl_texture_3d_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + CoglTextureLoader *loader = tex->loader; + + _COGL_RETURN_VAL_IF_FAIL (loader, FALSE); + + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + return allocate_with_size (tex_3d, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + return allocate_from_bitmap (tex_3d, loader, error); + default: + break; + } + + g_return_val_if_reached (FALSE); +} + +static int +_cogl_texture_3d_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static CoglBool +_cogl_texture_3d_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static CoglBool +_cogl_texture_3d_can_hardware_repeat (CoglTexture *tex) +{ + return TRUE; +} + +static void +_cogl_texture_3d_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + /* The texture coordinates map directly so we don't need to do + anything */ +} + +static CoglTransformResult +_cogl_texture_3d_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + /* The texture coordinates map directly so we don't need to do + anything other than check for repeats */ + + CoglBool need_repeat = FALSE; + int i; + + for (i = 0; i < 4; i++) + if (coords[i] < 0.0f || coords[i] > 1.0f) + need_repeat = TRUE; + + return (need_repeat ? COGL_TRANSFORM_HARDWARE_REPEAT + : COGL_TRANSFORM_NO_REPEAT); +} + +static CoglBool +_cogl_texture_3d_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + + if (out_gl_handle) + *out_gl_handle = tex_3d->gl_texture; + + if (out_gl_target) + *out_gl_target = GL_TEXTURE_3D; + + return TRUE; +} + +static void +_cogl_texture_3d_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + CoglContext *ctx = tex->context; + + if (min_filter == tex_3d->gl_legacy_texobj_min_filter + && mag_filter == tex_3d->gl_legacy_texobj_mag_filter) + return; + + /* Store new values */ + tex_3d->gl_legacy_texobj_min_filter = min_filter; + tex_3d->gl_legacy_texobj_mag_filter = mag_filter; + + /* Apply new filters to the texture */ + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, mag_filter) ); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, min_filter) ); +} + +static void +_cogl_texture_3d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + CoglContext *ctx = tex->context; + + /* Only update if the mipmaps are dirty */ + if ((flags & COGL_TEXTURE_NEEDS_MIPMAP) && + tex_3d->auto_mipmap && tex_3d->mipmaps_dirty) + { + /* glGenerateMipmap is defined in the FBO extension. If it's not + available we'll fallback to temporarily enabling + GL_GENERATE_MIPMAP and reuploading the first pixel */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + _cogl_texture_gl_generate_mipmaps (tex); +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + else if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE); + + GE( ctx, glTexParameteri (GL_TEXTURE_3D, + GL_GENERATE_MIPMAP, + GL_TRUE) ); + GE( ctx, glTexSubImage3D (GL_TEXTURE_3D, + 0, /* level */ + 0, /* xoffset */ + 0, /* yoffset */ + 0, /* zoffset */ + 1, /* width */ + 1, /* height */ + 1, /* depth */ + tex_3d->first_pixel.gl_format, + tex_3d->first_pixel.gl_type, + tex_3d->first_pixel.data) ); + GE( ctx, glTexParameteri (GL_TEXTURE_3D, + GL_GENERATE_MIPMAP, + GL_FALSE) ); + } +#endif + + tex_3d->mipmaps_dirty = FALSE; + } +} + +static void +_cogl_texture_3d_ensure_non_quad_rendering (CoglTexture *tex) +{ + /* Nothing needs to be done */ +} + +static CoglBool +_cogl_texture_3d_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + /* This function doesn't really make sense for 3D textures because + it can't specify which image to upload to */ + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Setting a 2D region on a 3D texture isn't " + "currently supported"); + + return FALSE; +} + +static int +_cogl_texture_3d_get_data (CoglTexture *tex, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + /* FIXME: we could probably implement this by assuming the data is + big enough to hold all of the images and that there is no stride + between the images. However it would be better to have an API + that can provide an image stride and this function probably isn't + particularly useful anyway so for now it just reports failure */ + return 0; +} + +static CoglPixelFormat +_cogl_texture_3d_get_format (CoglTexture *tex) +{ + return COGL_TEXTURE_3D (tex)->internal_format; +} + +static GLenum +_cogl_texture_3d_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_3D (tex)->gl_format; +} + +static CoglTextureType +_cogl_texture_3d_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_3D; +} + +static const CoglTextureVtable +cogl_texture_3d_vtable = + { + TRUE, /* primitive */ + _cogl_texture_3d_allocate, + _cogl_texture_3d_set_region, + _cogl_texture_3d_get_data, + NULL, /* foreach_sub_texture_in_region */ + _cogl_texture_3d_get_max_waste, + _cogl_texture_3d_is_sliced, + _cogl_texture_3d_can_hardware_repeat, + _cogl_texture_3d_transform_coords_to_gl, + _cogl_texture_3d_transform_quad_coords_to_gl, + _cogl_texture_3d_get_gl_texture, + _cogl_texture_3d_gl_flush_legacy_texobj_filters, + _cogl_texture_3d_pre_paint, + _cogl_texture_3d_ensure_non_quad_rendering, + _cogl_texture_3d_gl_flush_legacy_texobj_wrap_modes, + _cogl_texture_3d_get_format, + _cogl_texture_3d_get_gl_format, + _cogl_texture_3d_get_type, + NULL, /* is_foreign */ + _cogl_texture_3d_set_auto_mipmap + }; diff --git a/cogl/cogl-texture-3d.h b/cogl/cogl-texture-3d.h new file mode 100644 index 0000000..b3b038a --- /dev/null +++ b/cogl/cogl-texture-3d.h @@ -0,0 +1,204 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TEXTURE_3D_H +#define __COGL_TEXTURE_3D_H + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-texture-3d + * @short_description: Functions for creating and manipulating 3D textures + * + * These functions allow 3D textures to be used. 3D textures can be + * thought of as layers of 2D images arranged into a cuboid + * shape. When choosing a texel from the texture, Cogl will take into + * account the 'r' texture coordinate to select one of the images. + */ + +typedef struct _CoglTexture3D CoglTexture3D; + +#define COGL_TEXTURE_3D(X) ((CoglTexture3D *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_3d_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_3d_get_gtype (void); +#endif + +/** + * cogl_texture_3d_new_with_size: + * @context: a #CoglContext + * @width: width of the texture in pixels. + * @height: height of the texture in pixels. + * @depth: depth of the texture in pixels. + * + * Creates a low-level #CoglTexture3D texture with the specified + * dimensions and pixel format. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is going to be used and can optimize how it is + * allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * This texture will fail to allocate later if + * %COGL_FEATURE_ID_TEXTURE_3D is not advertised. Allocation can also + * fail if the requested dimensions are not supported by the + * GPU. + * + * Returns: (transfer full): A new #CoglTexture3D object with no storage yet allocated. + * Since: 1.10 + * Stability: Unstable + */ +CoglTexture3D * +cogl_texture_3d_new_with_size (CoglContext *context, + int width, + int height, + int depth); + +/** + * cogl_texture_3d_new_from_data: + * @context: a #CoglContext + * @width: width of the texture in pixels. + * @height: height of the texture in pixels. + * @depth: depth of the texture in pixels. + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @rowstride: the memory offset in bytes between the starts of + * scanlines in @data or 0 to infer it from the width and format + * @image_stride: the number of bytes from one image to the next. This + * can be used to add padding between the images in a similar way + * that the rowstride can be used to add padding between + * rows. Alternatively 0 can be passed to infer the @image_stride + * from the @height. + * @data: pointer the memory region where the source buffer resides + * @error: A CoglError return location. + * + * Creates a low-level 3D texture and initializes it with @data. The + * data is assumed to be packed array of @depth images. There can be + * padding between the images using @image_stride. + * + * This api will always immediately allocate GPU memory for the + * texture and upload the given data so that the @data pointer does + * not need to remain valid once this function returns. This means it + * is not possible to configure the texture before it is allocated. If + * you do need to configure the texture before allocation (to specify + * constraints on the internal format for example) then you can + * instead create a #CoglBitmap for your data and use + * cogl_texture_3d_new_from_bitmap(). + * + * Return value: (transfer full): the newly created #CoglTexture3D or + * %NULL if there was an error and an exception will be + * returned through @error. + * Since: 1.10 + * Stability: Unstable + */ +CoglTexture3D * +cogl_texture_3d_new_from_data (CoglContext *context, + int width, + int height, + int depth, + CoglPixelFormat format, + int rowstride, + int image_stride, + const uint8_t *data, + CoglError **error); + +/** + * cogl_texture_3d_new_from_bitmap: + * @bitmap: A #CoglBitmap object. + * @height: height of the texture in pixels. + * @depth: depth of the texture in pixels. + * + * Creates a low-level 3D texture and initializes it with the images + * in @bitmap. The images are assumed to be packed together after one + * another in the increasing y axis. The height of individual image is + * given as @height and the number of images is given in @depth. The + * actual height of the bitmap can be larger than @height × @depth. In + * this case it assumes there is padding between the images. + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is going to be used and can optimize how it is + * allocated. + * + * The texture is still configurable until it has been allocated so + * for example you can influence the internal format of the texture + * using cogl_texture_set_components() and + * cogl_texture_set_premultiplied(). + * + * This texture will fail to allocate later if + * %COGL_FEATURE_ID_TEXTURE_3D is not advertised. Allocation can also + * fail if the requested dimensions are not supported by the + * GPU. + * + * Return value: (transfer full): a newly created #CoglTexture3D + * Since: 2.0 + * Stability: unstable + */ +CoglTexture3D * +cogl_texture_3d_new_from_bitmap (CoglBitmap *bitmap, + int height, + int depth); + +/** + * cogl_is_texture_3d: + * @object: a #CoglObject + * + * Checks whether the given object references a #CoglTexture3D + * + * Return value: %TRUE if the passed object represents a 3D texture + * and %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_is_texture_3d (void *object); + +COGL_END_DECLS + +#endif /* __COGL_TEXTURE_3D_H */ diff --git a/cogl/cogl-texture-driver.h b/cogl/cogl-texture-driver.h new file mode 100644 index 0000000..3ab86ed --- /dev/null +++ b/cogl/cogl-texture-driver.h @@ -0,0 +1,206 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_DRIVER_H +#define __COGL_TEXTURE_DRIVER_H + +typedef struct _CoglTextureDriver CoglTextureDriver; + +struct _CoglTextureDriver +{ + /* + * A very small wrapper around glGenTextures() that ensures we default to + * non-mipmap filters when creating textures. This is to save some memory as + * the driver will not allocate room for the mipmap tree. + */ + GLuint + (* gen) (CoglContext *ctx, + GLenum gl_target, + CoglPixelFormat internal_format); + + /* + * This sets up the glPixelStore state for an upload to a destination with + * the same size, and with no offset. + */ + /* NB: GLES can't upload a sub region of pixel data from a larger source + * buffer which is why this interface is limited. The GL driver has a more + * flexible version of this function that is uses internally */ + void + (* prep_gl_for_pixels_upload) (CoglContext *ctx, + int pixels_rowstride, + int pixels_bpp); + + /* + * This uploads a sub-region from source_bmp to a single GL texture + * handle (i.e a single CoglTexture slice) + * + * It also updates the array of tex->first_pixels[slice_index] if + * dst_{x,y} == 0 + * + * The driver abstraction is in place because GLES doesn't support the pixel + * store options required to source from a subregion, so for GLES we have + * to manually create a transient source bitmap. + * + * XXX: sorry for the ridiculous number of arguments :-( + */ + CoglBool + (* upload_subregion_to_gl) (CoglContext *ctx, + CoglTexture *texture, + CoglBool is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + int level, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error); + + /* + * Replaces the contents of the GL texture with the entire bitmap. On + * GL this just directly calls glTexImage2D, but under GLES it needs + * to copy the bitmap if the rowstride is not a multiple of a possible + * alignment value because there is no GL_UNPACK_ROW_LENGTH + */ + CoglBool + (* upload_to_gl) (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error); + + /* + * Replaces the contents of the GL texture with the entire bitmap. The + * width of the texture is inferred from the bitmap. The height and + * depth of the texture is given directly. The 'image_height' (which + * is the number of rows between images) is inferred by dividing the + * height of the bitmap by the depth. + */ + CoglBool + (* upload_to_gl_3d) (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error); + + /* + * This sets up the glPixelStore state for an download to a destination with + * the same size, and with no offset. + */ + /* NB: GLES can't download pixel data into a sub region of a larger + * destination buffer, the GL driver has a more flexible version of + * this function that it uses internally. */ + void + (* prep_gl_for_pixels_download) (CoglContext *ctx, + int image_width, + int pixels_rowstride, + int pixels_bpp); + + /* + * This driver abstraction is needed because GLES doesn't support + * glGetTexImage (). On GLES this currently just returns FALSE which + * will lead to a generic fallback path being used that simply + * renders the texture and reads it back from the framebuffer. (See + * _cogl_texture_draw_and_read () ) + */ + CoglBool + (* gl_get_tex_image) (CoglContext *ctx, + GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + uint8_t *dest); + + /* + * It may depend on the driver as to what texture sizes are supported... + */ + CoglBool + (* size_supported) (CoglContext *ctx, + GLenum gl_target, + GLenum gl_intformat, + GLenum gl_format, + GLenum gl_type, + int width, + int height); + + CoglBool + (* size_supported_3d) (CoglContext *ctx, + GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height, + int depth); + + /* + * This driver abstraction is needed because GLES doesn't support setting + * a texture border color. + */ + void + (* try_setting_gl_border_color) (CoglContext *ctx, + GLuint gl_target, + const GLfloat *transparent_color); + + /* + * It may depend on the driver as to what texture targets may be used when + * creating a foreign texture. E.g. OpenGL supports ARB_texture_rectangle + * but GLES doesn't + */ + CoglBool + (* allows_foreign_gl_target) (CoglContext *ctx, + GLenum gl_target); + + /* + * The driver may impose constraints on what formats can be used to store + * texture data read from textures. For example GLES currently only supports + * RGBA_8888, and so we need to manually convert the data if the final + * destination has another format. + */ + CoglPixelFormat + (* find_best_gl_get_data_format) (CoglContext *context, + CoglPixelFormat format, + GLenum *closest_gl_format, + GLenum *closest_gl_type); +}; + +#endif /* __COGL_TEXTURE_DRIVER_H */ + diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h new file mode 100644 index 0000000..472c41d --- /dev/null +++ b/cogl/cogl-texture-private.h @@ -0,0 +1,409 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_PRIVATE_H +#define __COGL_TEXTURE_PRIVATE_H + +#include "cogl-bitmap-private.h" +#include "cogl-object-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-spans.h" +#include "cogl-meta-texture.h" +#include "cogl-framebuffer.h" + +#ifdef COGL_HAS_EGL_SUPPORT +#include "cogl-egl-defines.h" +#endif + +typedef struct _CoglTextureVtable CoglTextureVtable; + +/* Encodes three possibiloities result of transforming a quad */ +typedef enum { + /* quad doesn't cross the boundaries of a texture */ + COGL_TRANSFORM_NO_REPEAT, + /* quad crosses boundaries, hardware wrap mode can handle */ + COGL_TRANSFORM_HARDWARE_REPEAT, + /* quad crosses boundaries, needs software fallback; + * for a sliced texture, this might not actually involve + * repeating, just a quad crossing multiple slices */ + COGL_TRANSFORM_SOFTWARE_REPEAT, +} CoglTransformResult; + +/* Flags given to the pre_paint method */ +typedef enum { + /* The texture is going to be used with filters that require + mipmapping. This gives the texture the opportunity to + automatically update the mipmap tree */ + COGL_TEXTURE_NEEDS_MIPMAP = 1 +} CoglTexturePrePaintFlags; + +struct _CoglTextureVtable +{ + /* Virtual functions that must be implemented for a texture + backend */ + + CoglBool is_primitive; + + CoglBool (* allocate) (CoglTexture *tex, + CoglError **error); + + /* This should update the specified sub region of the texture with a + sub region of the given bitmap. The bitmap is not converted + before being set so the caller is expected to have called + _cogl_bitmap_convert_for_upload with a suitable internal_format + before passing here */ + CoglBool (* set_region) (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bitmap, + CoglError **error); + + /* This should copy the image data of the texture into @data. The + requested format will have been first passed through + ctx->texture_driver->find_best_gl_get_data_format so it should + always be a format that is valid for GL (ie, no conversion should + be necessary). */ + CoglBool (* get_data) (CoglTexture *tex, + CoglPixelFormat format, + int rowstride, + uint8_t *data); + + void (* foreach_sub_texture_in_region) (CoglTexture *tex, + float virtual_tx_1, + float virtual_ty_1, + float virtual_tx_2, + float virtual_ty_2, + CoglMetaTextureCallback callback, + void *user_data); + + int (* get_max_waste) (CoglTexture *tex); + + CoglBool (* is_sliced) (CoglTexture *tex); + + CoglBool (* can_hardware_repeat) (CoglTexture *tex); + + void (* transform_coords_to_gl) (CoglTexture *tex, + float *s, + float *t); + CoglTransformResult (* transform_quad_coords_to_gl) (CoglTexture *tex, + float *coords); + + CoglBool (* get_gl_texture) (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target); + + /* OpenGL driver specific virtual function */ + void (* gl_flush_legacy_texobj_filters) (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter); + + void (* pre_paint) (CoglTexture *tex, CoglTexturePrePaintFlags flags); + void (* ensure_non_quad_rendering) (CoglTexture *tex); + + /* OpenGL driver specific virtual function */ + void (* gl_flush_legacy_texobj_wrap_modes) (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p); + + CoglPixelFormat (* get_format) (CoglTexture *tex); + GLenum (* get_gl_format) (CoglTexture *tex); + + CoglTextureType (* get_type) (CoglTexture *tex); + + CoglBool (* is_foreign) (CoglTexture *tex); + + /* Only needs to be implemented if is_primitive == TRUE */ + void (* set_auto_mipmap) (CoglTexture *texture, + CoglBool value); +}; + +typedef enum _CoglTextureSoureType { + COGL_TEXTURE_SOURCE_TYPE_SIZED = 1, + COGL_TEXTURE_SOURCE_TYPE_BITMAP, + COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE, + COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN +} CoglTextureSourceType; + +typedef struct _CoglTextureLoader +{ + CoglTextureSourceType src_type; + union { + struct { + int width; + int height; + int depth; /* for 3d textures */ + } sized; + struct { + CoglBitmap *bitmap; + int height; /* for 3d textures */ + int depth; /* for 3d textures */ + CoglBool can_convert_in_place; + } bitmap; +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) + struct { + EGLImageKHR image; + int width; + int height; + CoglPixelFormat format; + } egl_image; +#endif + struct { + int width; + int height; + unsigned int gl_handle; + CoglPixelFormat format; + } gl_foreign; + } src; +} CoglTextureLoader; + +struct _CoglTexture +{ + CoglObject _parent; + CoglContext *context; + CoglTextureLoader *loader; + GList *framebuffers; + int max_level; + int width; + int height; + CoglBool allocated; + + /* + * Internal format + */ + CoglTextureComponents components; + unsigned int premultiplied:1; + + const CoglTextureVtable *vtable; +}; + +typedef enum _CoglTextureChangeFlags +{ + /* Whenever the internals of a texture are changed such that the + * underlying GL textures that represent the CoglTexture change then + * we notify cogl-material.c via + * _cogl_pipeline_texture_pre_change_notify + */ + COGL_TEXTURE_CHANGE_GL_TEXTURES + +} CoglTextureChangeFlags; + +typedef struct _CoglTexturePixel CoglTexturePixel; + +/* This is used by the texture backends to store the first pixel of + each GL texture. This is only used when glGenerateMipmap is not + available so that we can temporarily set GL_GENERATE_MIPMAP and + reupload a pixel */ +struct _CoglTexturePixel +{ + /* We need to store the format of the pixel because we store the + data in the source format which might end up being different for + each slice if a subregion is updated with a different format */ + GLenum gl_format; + GLenum gl_type; + uint8_t data[4]; +}; + +void +_cogl_texture_init (CoglTexture *texture, + CoglContext *ctx, + int width, + int height, + CoglPixelFormat src_format, + CoglTextureLoader *loader, + const CoglTextureVtable *vtable); + +void +_cogl_texture_free (CoglTexture *texture); + +/* This is used to register a type to the list of handle types that + will be considered a texture in cogl_is_texture() */ +void +_cogl_texture_register_texture_type (const CoglObjectClass *klass); + +#define COGL_TEXTURE_DEFINE(TypeName, type_name) \ + COGL_OBJECT_DEFINE_WITH_CODE_GTYPE \ + (TypeName, type_name, \ + _cogl_texture_register_texture_type (&_cogl_##type_name##_class)) + +#define COGL_TEXTURE_INTERNAL_DEFINE(TypeName, type_name) \ + COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE \ + (TypeName, type_name, \ + _cogl_texture_register_texture_type (&_cogl_##type_name##_class)) + +CoglBool +_cogl_texture_can_hardware_repeat (CoglTexture *texture); + +void +_cogl_texture_transform_coords_to_gl (CoglTexture *texture, + float *s, + float *t); +CoglTransformResult +_cogl_texture_transform_quad_coords_to_gl (CoglTexture *texture, + float *coords); + +void +_cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags); + +void +_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture); + +/* + * This determines a CoglPixelFormat according to texture::components + * and texture::premultiplied (i.e. the user required components and + * whether the texture should be considered premultiplied) + * + * A reference/source format can be given (or COGL_PIXEL_FORMAT_ANY) + * and wherever possible this function tries to simply return the + * given source format if its compatible with the required components. + * + * Texture backends can call this when allocating a texture to know + * how to convert a source image in preparation for uploading. + */ +CoglPixelFormat +_cogl_texture_determine_internal_format (CoglTexture *texture, + CoglPixelFormat src_format); + +/* This is called by texture backends when they have successfully + * allocated a texture. + * + * Most texture backends currently track the internal layout of + * textures using a CoglPixelFormat which will be finalized when a + * texture is allocated. At this point we need to update + * texture::components and texture::premultiplied according to the + * determined layout. + * + * XXX: Going forward we should probably aim to stop using + * CoglPixelFormat at all for tracking the internal layout of + * textures. + */ +void +_cogl_texture_set_internal_format (CoglTexture *texture, + CoglPixelFormat internal_format); + +CoglBool +_cogl_texture_is_foreign (CoglTexture *texture); + +void +_cogl_texture_associate_framebuffer (CoglTexture *texture, + CoglFramebuffer *framebuffer); + +const GList * +_cogl_texture_get_associated_framebuffers (CoglTexture *texture); + +void +_cogl_texture_flush_journal_rendering (CoglTexture *texture); + +void +_cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, + int n_x_spans, + CoglSpan *y_spans, + int n_y_spans, + CoglTexture **textures, + float *virtual_coords, + float x_normalize_factor, + float y_normalize_factor, + CoglPipelineWrapMode wrap_x, + CoglPipelineWrapMode wrap_y, + CoglMetaTextureCallback callback, + void *user_data); + +/* + * _cogl_texture_get_type: + * @texture: a #CoglTexture pointer + * + * Retrieves the texture type of the underlying hardware texture that + * this #CoglTexture will use. + * + * Return value: The type of the hardware texture. + */ +CoglTextureType +_cogl_texture_get_type (CoglTexture *texture); + +CoglBool +_cogl_texture_set_region (CoglTexture *texture, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + int dst_x, + int dst_y, + int level, + CoglError **error); + +CoglBool +_cogl_texture_set_region_from_bitmap (CoglTexture *texture, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bmp, + int dst_x, + int dst_y, + int level, + CoglError **error); + +CoglBool +_cogl_texture_needs_premult_conversion (CoglPixelFormat src_format, + CoglPixelFormat dst_format); + +int +_cogl_texture_get_n_levels (CoglTexture *texture); + +void +_cogl_texture_get_level_size (CoglTexture *texture, + int level, + int *width, + int *height, + int *depth); + +void +_cogl_texture_set_allocated (CoglTexture *texture, + CoglPixelFormat internal_format, + int width, + int height); + +CoglPixelFormat +_cogl_texture_get_format (CoglTexture *texture); + +CoglTextureLoader * +_cogl_texture_create_loader (void); + +void +_cogl_texture_copy_internal_format (CoglTexture *src, + CoglTexture *dest); + +#endif /* __COGL_TEXTURE_PRIVATE_H */ diff --git a/cogl/cogl-texture-rectangle-private.h b/cogl/cogl-texture-rectangle-private.h new file mode 100644 index 0000000..75029e7 --- /dev/null +++ b/cogl/cogl-texture-rectangle-private.h @@ -0,0 +1,66 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_RECTANGLE_H +#define __COGL_TEXTURE_RECTANGLE_H + +#include "cogl-pipeline-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-rectangle.h" + +struct _CoglTextureRectangle +{ + CoglTexture _parent; + + /* The internal format of the texture represented as a + CoglPixelFormat */ + CoglPixelFormat internal_format; + + /* TODO: factor out these OpenGL specific members into some form + * of driver private state. */ + + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_format; + /* The texture object number */ + GLuint gl_texture; + GLenum gl_legacy_texobj_min_filter; + GLenum gl_legacy_texobj_mag_filter; + GLint gl_legacy_texobj_wrap_mode_s; + GLint gl_legacy_texobj_wrap_mode_t; + CoglBool is_foreign; +}; + +CoglTextureRectangle * +_cogl_texture_rectangle_new_from_foreign (GLuint gl_handle, + GLuint width, + GLuint height, + CoglPixelFormat format); + +#endif /* __COGL_TEXTURE_RECTANGLE_H */ diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c new file mode 100644 index 0000000..65d2f06 --- /dev/null +++ b/cogl/cogl-texture-rectangle.c @@ -0,0 +1,781 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-texture-private.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-texture-driver.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-error-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +/* These aren't defined under GLES */ +#ifndef GL_TEXTURE_RECTANGLE_ARB +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#endif +#ifndef GL_CLAMP +#define GL_CLAMP 0x2900 +#endif +#ifndef GL_CLAMP_TO_BORDER +#define GL_CLAMP_TO_BORDER 0x812D +#endif + +static void _cogl_texture_rectangle_free (CoglTextureRectangle *tex_rect); + +COGL_TEXTURE_DEFINE (TextureRectangle, texture_rectangle); +COGL_GTYPE_DEFINE_CLASS (TextureRectangle, texture_rectangle, + COGL_GTYPE_IMPLEMENT_INTERFACE (texture)); + +static const CoglTextureVtable cogl_texture_rectangle_vtable; + +static CoglBool +can_use_wrap_mode (GLenum wrap_mode) +{ + return (wrap_mode == GL_CLAMP || + wrap_mode == GL_CLAMP_TO_EDGE || + wrap_mode == GL_CLAMP_TO_BORDER); +} + +static void +_cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + CoglContext *ctx = tex->context; + + /* Only set the wrap mode if it's different from the current value + to avoid too many GL calls. Texture rectangle doesn't make use of + the r coordinate so we can ignore its wrap mode */ + if (tex_rect->gl_legacy_texobj_wrap_mode_s != wrap_mode_s || + tex_rect->gl_legacy_texobj_wrap_mode_t != wrap_mode_t) + { + g_assert (can_use_wrap_mode (wrap_mode_s)); + g_assert (can_use_wrap_mode (wrap_mode_t)); + + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + tex_rect->is_foreign); + GE( ctx, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, + GL_TEXTURE_WRAP_S, wrap_mode_s) ); + GE( ctx, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, + GL_TEXTURE_WRAP_T, wrap_mode_t) ); + + tex_rect->gl_legacy_texobj_wrap_mode_s = wrap_mode_s; + tex_rect->gl_legacy_texobj_wrap_mode_t = wrap_mode_t; + } +} + +static void +_cogl_texture_rectangle_free (CoglTextureRectangle *tex_rect) +{ + if (!tex_rect->is_foreign && tex_rect->gl_texture) + _cogl_delete_gl_texture (tex_rect->gl_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_rect)); +} + +static CoglBool +_cogl_texture_rectangle_can_create (CoglContext *ctx, + unsigned int width, + unsigned int height, + CoglPixelFormat internal_format, + CoglError **error) +{ + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE)) + { + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_TYPE, + "The CoglTextureRectangle feature isn't available"); + return FALSE; + } + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + /* Check that the driver can create a texture with that size */ + if (!ctx->texture_driver->size_supported (ctx, + GL_TEXTURE_RECTANGLE_ARB, + gl_intformat, + gl_format, + gl_type, + width, + height)) + { + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "The requested texture size + format is unsupported"); + return FALSE; + } + + return TRUE; +} + +static void +_cogl_texture_rectangle_set_auto_mipmap (CoglTexture *tex, + CoglBool value) +{ + /* Rectangle textures currently never support mipmapping so there's + no point in doing anything here */ +} + +static CoglTextureRectangle * +_cogl_texture_rectangle_create_base (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + CoglTextureLoader *loader) +{ + CoglTextureRectangle *tex_rect = g_new (CoglTextureRectangle, 1); + CoglTexture *tex = COGL_TEXTURE (tex_rect); + + _cogl_texture_init (tex, ctx, width, height, + internal_format, loader, + &cogl_texture_rectangle_vtable); + + tex_rect->gl_texture = 0; + tex_rect->is_foreign = FALSE; + + /* We default to GL_LINEAR for both filters */ + tex_rect->gl_legacy_texobj_min_filter = GL_LINEAR; + tex_rect->gl_legacy_texobj_mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_rect->gl_legacy_texobj_wrap_mode_s = GL_FALSE; + tex_rect->gl_legacy_texobj_wrap_mode_t = GL_FALSE; + + return _cogl_texture_rectangle_object_new (tex_rect); +} + +CoglTextureRectangle * +cogl_texture_rectangle_new_with_size (CoglContext *ctx, + int width, + int height) +{ + CoglTextureLoader *loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; + loader->src.sized.width = width; + loader->src.sized.height = height; + + return _cogl_texture_rectangle_create_base (ctx, width, height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + loader); +} + +static CoglBool +allocate_with_size (CoglTextureRectangle *tex_rect, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_rect); + CoglContext *ctx = tex->context; + CoglPixelFormat internal_format; + int width = loader->src.sized.width; + int height = loader->src.sized.height; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + GLenum gl_error; + GLenum gl_texture; + + internal_format = + _cogl_texture_determine_internal_format (tex, COGL_PIXEL_FORMAT_ANY); + + if (!_cogl_texture_rectangle_can_create (ctx, + width, + height, + internal_format, + error)) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + gl_texture = + ctx->texture_driver->gen (ctx, + GL_TEXTURE_RECTANGLE_ARB, + internal_format); + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + gl_texture, + tex_rect->is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, gl_intformat, + width, height, 0, gl_format, gl_type, NULL); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + GE( ctx, glDeleteTextures (1, &gl_texture) ); + return FALSE; + } + + tex_rect->internal_format = internal_format; + + tex_rect->gl_texture = gl_texture; + tex_rect->gl_format = gl_intformat; + + _cogl_texture_set_allocated (COGL_TEXTURE (tex_rect), + internal_format, width, height); + + return TRUE; +} + +static CoglBool +allocate_from_bitmap (CoglTextureRectangle *tex_rect, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_rect); + CoglContext *ctx = tex->context; + CoglPixelFormat internal_format; + CoglBitmap *bmp = loader->src.bitmap.bitmap; + int width = cogl_bitmap_get_width (bmp); + int height = cogl_bitmap_get_height (bmp); + CoglBool can_convert_in_place = loader->src.bitmap.can_convert_in_place; + CoglBitmap *upload_bmp; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + internal_format = + _cogl_texture_determine_internal_format (tex, cogl_bitmap_get_format (bmp)); + + if (!_cogl_texture_rectangle_can_create (ctx, + width, + height, + internal_format, + error)) + return FALSE; + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + cogl_bitmap_get_format (upload_bmp), + NULL, /* internal format */ + &gl_format, + &gl_type); + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + NULL, + NULL); + + tex_rect->gl_texture = + ctx->texture_driver->gen (ctx, + GL_TEXTURE_RECTANGLE_ARB, + internal_format); + if (!ctx->texture_driver->upload_to_gl (ctx, + GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + FALSE, + upload_bmp, + gl_intformat, + gl_format, + gl_type, + error)) + { + cogl_object_unref (upload_bmp); + return FALSE; + } + + tex_rect->gl_format = gl_intformat; + tex_rect->internal_format = internal_format; + + cogl_object_unref (upload_bmp); + + _cogl_texture_set_allocated (COGL_TEXTURE (tex_rect), + internal_format, width, height); + + return TRUE; +} + +static CoglBool +allocate_from_gl_foreign (CoglTextureRectangle *tex_rect, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_rect); + CoglContext *ctx = tex->context; + CoglPixelFormat format = loader->src.gl_foreign.format; + GLenum gl_error = 0; + GLint gl_compressed = GL_FALSE; + GLenum gl_int_format = 0; + + if (!ctx->texture_driver->allows_foreign_gl_target (ctx, + GL_TEXTURE_RECTANGLE_ARB)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Foreign GL_TEXTURE_RECTANGLE textures are not " + "supported by your system"); + return FALSE; + } + + /* Make sure binding succeeds */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + loader->src.gl_foreign.gl_handle, TRUE); + if (ctx->glGetError () != GL_NO_ERROR) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Failed to bind foreign GL_TEXTURE_RECTANGLE texture"); + return FALSE; + } + + /* Obtain texture parameters */ + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS)) + { + GLint val; + + GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_RECTANGLE_ARB, 0, + GL_TEXTURE_COMPRESSED, + &gl_compressed) ); + + GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_RECTANGLE_ARB, 0, + GL_TEXTURE_INTERNAL_FORMAT, + &val) ); + + gl_int_format = val; + + /* If we can query GL for the actual pixel format then we'll ignore + the passed in format and use that. */ + if (!ctx->driver_vtable->pixel_format_from_gl_internal (ctx, + gl_int_format, + &format)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Unsupported internal format for foreign texture"); + return FALSE; + } + } + else +#endif + { + /* Otherwise we'll assume we can derive the GL format from the + passed in format */ + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + &gl_int_format, + NULL, + NULL); + } + + /* Compressed texture images not supported */ + if (gl_compressed == GL_TRUE) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Compressed foreign textures aren't currently supported"); + return FALSE; + } + + /* Setup bitmap info */ + tex_rect->is_foreign = TRUE; + + tex_rect->gl_texture = loader->src.gl_foreign.gl_handle; + tex_rect->gl_format = gl_int_format; + + /* Unknown filter */ + tex_rect->gl_legacy_texobj_min_filter = GL_FALSE; + tex_rect->gl_legacy_texobj_mag_filter = GL_FALSE; + + tex_rect->internal_format = format; + + _cogl_texture_set_allocated (COGL_TEXTURE (tex_rect), + format, + loader->src.gl_foreign.width, + loader->src.gl_foreign.height); + + return TRUE; +} + +static CoglBool +_cogl_texture_rectangle_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + CoglTextureLoader *loader = tex->loader; + + _COGL_RETURN_VAL_IF_FAIL (loader, FALSE); + + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + return allocate_with_size (tex_rect, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + return allocate_from_bitmap (tex_rect, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN: + return allocate_from_gl_foreign (tex_rect, loader, error); + default: + break; + } + + g_return_val_if_reached (FALSE); +} + +CoglTextureRectangle * +cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp) +{ + CoglTextureLoader *loader; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; + loader->src.bitmap.bitmap = cogl_object_ref (bmp); + loader->src.bitmap.can_convert_in_place = FALSE; /* TODO add api for this */ + + return _cogl_texture_rectangle_create_base (_cogl_bitmap_get_context (bmp), + cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + cogl_bitmap_get_format (bmp), + loader); +} + +CoglTextureRectangle * +cogl_texture_rectangle_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + int width, + int height, + CoglPixelFormat format) +{ + CoglTextureLoader *loader; + + /* NOTE: width, height and internal format are not queriable in + * GLES, hence such a function prototype. Also in the case of full + * opengl the user may be creating a Cogl texture for a + * texture_from_pixmap object where glTexImage2D may not have been + * called and the texture_from_pixmap spec doesn't clarify that it + * is reliable to query back the size from OpenGL. + */ + + /* Assert that it is a valid GL texture object */ + _COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), NULL); + + /* Validate width and height */ + _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN; + loader->src.gl_foreign.gl_handle = gl_handle; + loader->src.gl_foreign.width = width; + loader->src.gl_foreign.height = height; + loader->src.gl_foreign.format = format; + + return _cogl_texture_rectangle_create_base (ctx, width, height, + format, loader); +} + +static int +_cogl_texture_rectangle_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static CoglBool +_cogl_texture_rectangle_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static CoglBool +_cogl_texture_rectangle_can_hardware_repeat (CoglTexture *tex) +{ + return FALSE; +} + +static void +_cogl_texture_rectangle_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + *s *= tex->width; + *t *= tex->height; +} + +static CoglTransformResult +_cogl_texture_rectangle_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglBool need_repeat = FALSE; + int i; + + for (i = 0; i < 4; i++) + { + if (coords[i] < 0.0f || coords[i] > 1.0f) + need_repeat = TRUE; + coords[i] *= (i & 1) ? tex->height : tex->width; + } + + return (need_repeat ? COGL_TRANSFORM_SOFTWARE_REPEAT + : COGL_TRANSFORM_NO_REPEAT); +} + +static CoglBool +_cogl_texture_rectangle_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + + if (out_gl_handle) + *out_gl_handle = tex_rect->gl_texture; + + if (out_gl_target) + *out_gl_target = GL_TEXTURE_RECTANGLE_ARB; + + return TRUE; +} + +static void +_cogl_texture_rectangle_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + CoglContext *ctx = tex->context; + + if (min_filter == tex_rect->gl_legacy_texobj_min_filter + && mag_filter == tex_rect->gl_legacy_texobj_mag_filter) + return; + + /* Rectangle textures don't support mipmapping */ + g_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST); + + /* Store new values */ + tex_rect->gl_legacy_texobj_min_filter = min_filter; + tex_rect->gl_legacy_texobj_mag_filter = mag_filter; + + /* Apply new filters to the texture */ + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + tex_rect->is_foreign); + GE( ctx, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, + mag_filter) ); + GE( ctx, glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, + min_filter) ); +} + +static void +_cogl_texture_rectangle_pre_paint (CoglTexture *tex, + CoglTexturePrePaintFlags flags) +{ + /* Rectangle textures don't support mipmaps */ + g_assert ((flags & COGL_TEXTURE_NEEDS_MIPMAP) == 0); +} + +static void +_cogl_texture_rectangle_ensure_non_quad_rendering (CoglTexture *tex) +{ + /* Nothing needs to be done */ +} + +static CoglBool +_cogl_texture_rectangle_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + CoglBitmap *upload_bmp; + GLenum gl_format; + GLenum gl_type; + CoglContext *ctx = tex->context; + CoglBool status; + + upload_bmp = + _cogl_bitmap_convert_for_upload (bmp, + _cogl_texture_get_format (tex), + FALSE, /* can't convert in place */ + error); + if (upload_bmp == NULL) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + cogl_bitmap_get_format (upload_bmp), + NULL, /* internal format */ + &gl_format, + &gl_type); + + /* Send data to GL */ + status = + ctx->texture_driver->upload_subregion_to_gl (ctx, + tex, + FALSE, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + level, + upload_bmp, + gl_format, + gl_type, + error); + + cogl_object_unref (upload_bmp); + + return status; +} + +static CoglBool +_cogl_texture_rectangle_get_data (CoglTexture *tex, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + CoglContext *ctx = tex->context; + int bpp; + GLenum gl_format; + GLenum gl_type; + + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + NULL, /* internal format */ + &gl_format, + &gl_type); + + ctx->texture_driver->prep_gl_for_pixels_download (ctx, + rowstride, + tex->width, + bpp); + + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + tex_rect->is_foreign); + return ctx->texture_driver->gl_get_tex_image (ctx, + GL_TEXTURE_RECTANGLE_ARB, + gl_format, + gl_type, + data); +} + +static CoglPixelFormat +_cogl_texture_rectangle_get_format (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->internal_format; +} + +static GLenum +_cogl_texture_rectangle_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->gl_format; +} + +static CoglBool +_cogl_texture_rectangle_is_foreign (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->is_foreign; +} + +static CoglTextureType +_cogl_texture_rectangle_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_RECTANGLE; +} + +static const CoglTextureVtable +cogl_texture_rectangle_vtable = + { + TRUE, /* primitive */ + _cogl_texture_rectangle_allocate, + _cogl_texture_rectangle_set_region, + _cogl_texture_rectangle_get_data, + NULL, /* foreach_sub_texture_in_region */ + _cogl_texture_rectangle_get_max_waste, + _cogl_texture_rectangle_is_sliced, + _cogl_texture_rectangle_can_hardware_repeat, + _cogl_texture_rectangle_transform_coords_to_gl, + _cogl_texture_rectangle_transform_quad_coords_to_gl, + _cogl_texture_rectangle_get_gl_texture, + _cogl_texture_rectangle_gl_flush_legacy_texobj_filters, + _cogl_texture_rectangle_pre_paint, + _cogl_texture_rectangle_ensure_non_quad_rendering, + _cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes, + _cogl_texture_rectangle_get_format, + _cogl_texture_rectangle_get_gl_format, + _cogl_texture_rectangle_get_type, + _cogl_texture_rectangle_is_foreign, + _cogl_texture_rectangle_set_auto_mipmap + }; diff --git a/cogl/cogl-texture-rectangle.h b/cogl/cogl-texture-rectangle.h new file mode 100644 index 0000000..7619686 --- /dev/null +++ b/cogl/cogl-texture-rectangle.h @@ -0,0 +1,218 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_TEXURE_RECTANGLE_H +#define __COGL_TEXURE_RECTANGLE_H + +#include "cogl-context.h" + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-texture-rectangle + * @short_description: Functions for creating and manipulating rectangle + * textures for use with non-normalized coordinates. + * + * These functions allow low-level "rectangle" textures to be allocated. + * These textures are never constrained to power-of-two sizes but they + * also don't support having a mipmap and can only be wrapped with + * %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE. + * + * The most notable difference between rectangle textures and 2D + * textures is that rectangle textures are sampled using un-normalized + * texture coordinates, so instead of using coordinates (0,0) and + * (1,1) to map to the top-left and bottom right corners of the + * texture you would instead use (0,0) and (width,height). + * + * The use of non-normalized coordinates can be particularly + * convenient when writing glsl shaders that use a texture as a lookup + * table since you don't need to upload separate uniforms to map + * normalized coordinates to texels. + * + * If you want to sample from a rectangle texture from GLSL you should + * use the sampler2DRect sampler type. + * + * Applications wanting to use #CoglTextureRectangle should first check + * for the %COGL_FEATURE_ID_TEXTURE_RECTANGLE feature using + * cogl_has_feature(). + */ + +typedef struct _CoglTextureRectangle CoglTextureRectangle; +#define COGL_TEXTURE_RECTANGLE(X) ((CoglTextureRectangle *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_rectangle_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_rectangle_get_gtype (void); +#endif + +/** + * cogl_is_texture_rectangle: + * @object: A #CoglObject + * + * Gets whether the given object references an existing + * #CoglTextureRectangle object. + * + * Return value: %TRUE if the object references a + * #CoglTextureRectangle, %FALSE otherwise. + */ +CoglBool +cogl_is_texture_rectangle (void *object); + +/** + * cogl_texture_rectangle_new_with_size: + * @ctx: A #CoglContext pointer + * @width: The texture width to allocate + * @height: The texture height to allocate + * + * Creates a new #CoglTextureRectangle texture with a given @width, + * and @height. This texture is a low-level texture that the GPU can + * sample from directly unlike high-level textures such as + * #CoglTexture2DSliced and #CoglAtlasTexture. + * + * Unlike for #CoglTexture2D textures, coordinates for + * #CoglTextureRectangle textures should not be normalized. So instead + * of using the coordinate (1, 1) to sample the bottom right corner of + * a rectangle texture you would use (@width, @height) where @width + * and @height are the width and height of the texture. + * + * If you want to sample from a rectangle texture from GLSL you + * should use the sampler2DRect sampler type. + * + * Applications wanting to use #CoglTextureRectangle should + * first check for the %COGL_FEATURE_ID_TEXTURE_RECTANGLE feature + * using cogl_has_feature(). + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is going to be used and can optimize how it is + * allocated. + * + * Returns value: (transfer full): A pointer to a new #CoglTextureRectangle + * object with no storage allocated yet. + * + * Since: 1.10 + * Stability: unstable + */ +CoglTextureRectangle * +cogl_texture_rectangle_new_with_size (CoglContext *ctx, + int width, + int height); + +/** + * cogl_texture_rectangle_new_from_bitmap: + * @bitmap: A #CoglBitmap + * + * Allocates a new #CoglTextureRectangle texture which will be + * initialized with the pixel data from @bitmap. This texture is a + * low-level texture that the GPU can sample from directly unlike + * high-level textures such as #CoglTexture2DSliced and + * #CoglAtlasTexture. + * + * Unlike for #CoglTexture2D textures, coordinates for + * #CoglTextureRectangle textures should not be normalized. So instead + * of using the coordinate (1, 1) to sample the bottom right corner of + * a rectangle texture you would use (@width, @height) where @width + * and @height are the width and height of the texture. + * + * If you want to sample from a rectangle texture from GLSL you + * should use the sampler2DRect sampler type. + * + * Applications wanting to use #CoglTextureRectangle should + * first check for the %COGL_FEATURE_ID_TEXTURE_RECTANGLE feature + * using cogl_has_feature(). + * + * The storage for the texture is not allocated before this function + * returns. You can call cogl_texture_allocate() to explicitly + * allocate the underlying storage or preferably let Cogl + * automatically allocate storage lazily when it may know more about + * how the texture is going to be used and can optimize how it is + * allocated. + * + * Return value: (transfer full): A pointer to a new + * #CoglTextureRectangle texture. + * Since: 2.0 + * Stability: unstable + */ +CoglTextureRectangle * +cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bitmap); + +/** + * cogl_texture_rectangle_new_from_foreign: + * @ctx: A #CoglContext + * @gl_handle: A GL handle for a GL_TEXTURE_RECTANGLE texture object + * @width: Width of the foreign GL texture + * @height: Height of the foreign GL texture + * @format: The format of the texture + * + * Wraps an existing GL_TEXTURE_RECTANGLE texture object as a + * #CoglTextureRectangle. This can be used for integrating Cogl with + * software using OpenGL directly. + * + * Unlike for #CoglTexture2D textures, coordinates for + * #CoglTextureRectangle textures should not be normalized. So instead + * of using the coordinate (1, 1) to sample the bottom right corner of + * a rectangle texture you would use (@width, @height) where @width + * and @height are the width and height of the texture. + * + * The results are undefined for passing an invalid @gl_handle + * or if @width or @height don't have the correct texture + * geometry. + * + * If you want to sample from a rectangle texture from GLSL you + * should use the sampler2DRect sampler type. + * + * Applications wanting to use #CoglTextureRectangle should + * first check for the %COGL_FEATURE_ID_TEXTURE_RECTANGLE feature + * using cogl_has_feature(). + * + * The texture is still configurable until it has been allocated so + * for example you can declare whether the texture is premultiplied + * with cogl_texture_set_premultiplied(). + * + * Return value: (transfer full): A new #CoglTextureRectangle texture + */ +CoglTextureRectangle * +cogl_texture_rectangle_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + int width, + int height, + CoglPixelFormat format); + +COGL_END_DECLS + +#endif /* __COGL_TEXURE_RECTANGLE_H */ diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c new file mode 100644 index 0000000..d93db22 --- /dev/null +++ b/cogl/cogl-texture.c @@ -0,0 +1,1540 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * Copyright (C) 2010 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-bitmap.h" +#include "cogl-bitmap-private.h" +#include "cogl-buffer-private.h" +#include "cogl-pixel-buffer-private.h" +#include "cogl-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-driver.h" +#include "cogl-texture-2d-sliced-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-2d-gl.h" +#include "cogl-texture-3d-private.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-sub-texture-private.h" +#include "cogl-atlas-texture-private.h" +#include "cogl-pipeline.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-object-private.h" +#include "cogl-primitives.h" +#include "cogl-framebuffer-private.h" +#include "cogl1-context.h" +#include "cogl-sub-texture.h" +#include "cogl-primitive-texture.h" +#include "cogl-error-private.h" +#include "cogl-gtype-private.h" + +#include +#include +#include + +/* This isn't defined in the GLES headers */ +#ifndef GL_RED +#define GL_RED 0x1903 +#endif + +COGL_GTYPE_DEFINE_INTERFACE (Texture, texture); + +uint32_t +cogl_texture_error_quark (void) +{ + return g_quark_from_static_string ("cogl-texture-error-quark"); +} + +/* XXX: + * The CoglObject macros don't support any form of inheritance, so for + * now we implement the CoglObject support for the CoglTexture + * abstract class manually. + */ + +static GSList *_cogl_texture_types; + +void +_cogl_texture_register_texture_type (const CoglObjectClass *klass) +{ + _cogl_texture_types = g_slist_prepend (_cogl_texture_types, (void *) klass); +} + +CoglBool +cogl_is_texture (void *object) +{ + CoglObject *obj = (CoglObject *)object; + GSList *l; + + if (object == NULL) + return FALSE; + + for (l = _cogl_texture_types; l; l = l->next) + if (l->data == obj->klass) + return TRUE; + + return FALSE; +} + +void +_cogl_texture_init (CoglTexture *texture, + CoglContext *context, + int width, + int height, + CoglPixelFormat src_format, + CoglTextureLoader *loader, + const CoglTextureVtable *vtable) +{ + texture->context = context; + texture->max_level = 0; + texture->width = width; + texture->height = height; + texture->allocated = FALSE; + texture->vtable = vtable; + texture->framebuffers = NULL; + + texture->loader = loader; + + _cogl_texture_set_internal_format (texture, src_format); + + /* Although we want to initialize texture::components according + * to the source format, we always want the internal layout to + * be considered premultiplied by default. + * + * NB: this ->premultiplied state is user configurable so to avoid + * awkward documentation, setting this to 'true' does not depend on + * ->components having an alpha component (we will simply ignore the + * premultiplied status later if there is no alpha component). + * This way we don't have to worry about updating the + * ->premultiplied state in _set_components(). Similarly we don't + * have to worry about updating the ->components state in + * _set_premultiplied(). + */ + texture->premultiplied = TRUE; +} + +static void +_cogl_texture_free_loader (CoglTexture *texture) +{ + if (texture->loader) + { + CoglTextureLoader *loader = texture->loader; + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + case COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE: + case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN: + break; + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + cogl_object_unref (loader->src.bitmap.bitmap); + break; + } + g_slice_free (CoglTextureLoader, loader); + texture->loader = NULL; + } +} + +CoglTextureLoader * +_cogl_texture_create_loader (void) +{ + return g_slice_new0 (CoglTextureLoader); +} + +void +_cogl_texture_free (CoglTexture *texture) +{ + _cogl_texture_free_loader (texture); + + g_free (texture); +} + +CoglBool +_cogl_texture_needs_premult_conversion (CoglPixelFormat src_format, + CoglPixelFormat dst_format) +{ + return ((src_format & dst_format & COGL_A_BIT) && + src_format != COGL_PIXEL_FORMAT_A_8 && + dst_format != COGL_PIXEL_FORMAT_A_8 && + (src_format & COGL_PREMULT_BIT) != + (dst_format & COGL_PREMULT_BIT)); +} + +CoglBool +_cogl_texture_is_foreign (CoglTexture *texture) +{ + if (texture->vtable->is_foreign) + return texture->vtable->is_foreign (texture); + else + return FALSE; +} + +unsigned int +cogl_texture_get_width (CoglTexture *texture) +{ + return texture->width; +} + +unsigned int +cogl_texture_get_height (CoglTexture *texture) +{ + return texture->height; +} + +CoglPixelFormat +_cogl_texture_get_format (CoglTexture *texture) +{ + if (!texture->allocated) + cogl_texture_allocate (texture, NULL); + return texture->vtable->get_format (texture); +} + +int +cogl_texture_get_max_waste (CoglTexture *texture) +{ + return texture->vtable->get_max_waste (texture); +} + +int +_cogl_texture_get_n_levels (CoglTexture *texture) +{ + int width = cogl_texture_get_width (texture); + int height = cogl_texture_get_height (texture); + int max_dimension = MAX (width, height); + + if (cogl_is_texture_3d (texture)) + { + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (texture); + max_dimension = MAX (max_dimension, tex_3d->depth); + } + + return _cogl_util_fls (max_dimension); +} + +void +_cogl_texture_get_level_size (CoglTexture *texture, + int level, + int *width, + int *height, + int *depth) +{ + int current_width = cogl_texture_get_width (texture); + int current_height = cogl_texture_get_height (texture); + int current_depth; + int i; + + if (cogl_is_texture_3d (texture)) + { + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (texture); + current_depth = tex_3d->depth; + } + else + current_depth = 0; + + /* NB: The OpenGL spec (like D3D) uses a floor() convention to + * round down the size of a mipmap level when dividing the size + * of the previous level results in a fraction... + */ + for (i = 0; i < level; i++) + { + current_width = MAX (1, current_width >> 1); + current_height = MAX (1, current_height >> 1); + current_depth = MAX (1, current_depth >> 1); + } + + if (width) + *width = current_width; + if (height) + *height = current_height; + if (depth) + *depth = current_depth; +} + +CoglBool +cogl_texture_is_sliced (CoglTexture *texture) +{ + if (!texture->allocated) + cogl_texture_allocate (texture, NULL); + return texture->vtable->is_sliced (texture); +} + +/* If this returns FALSE, that implies _foreach_sub_texture_in_region + * will be needed to iterate over multiple sub textures for regions whos + * texture coordinates extend out of the range [0,1] + */ +CoglBool +_cogl_texture_can_hardware_repeat (CoglTexture *texture) +{ + if (!texture->allocated) + cogl_texture_allocate (texture, NULL); + return texture->vtable->can_hardware_repeat (texture); +} + +/* NB: You can't use this with textures comprised of multiple sub textures (use + * cogl_texture_is_sliced() to check) since coordinate transformation for such + * textures will be different for each slice. */ +void +_cogl_texture_transform_coords_to_gl (CoglTexture *texture, + float *s, + float *t) +{ + texture->vtable->transform_coords_to_gl (texture, s, t); +} + +CoglTransformResult +_cogl_texture_transform_quad_coords_to_gl (CoglTexture *texture, + float *coords) +{ + return texture->vtable->transform_quad_coords_to_gl (texture, coords); +} + +CoglBool +cogl_texture_get_gl_texture (CoglTexture *texture, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + if (!texture->allocated) + cogl_texture_allocate (texture, NULL); + + return texture->vtable->get_gl_texture (texture, + out_gl_handle, out_gl_target); +} + +CoglTextureType +_cogl_texture_get_type (CoglTexture *texture) +{ + return texture->vtable->get_type (texture); +} + +void +_cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags) +{ + /* Assert that the storage for the texture exists already if we're + * about to reference it for painting. + * + * Note: we abort on error here since it's a bit late to do anything + * about it if we fail to allocate the texture and the app could + * have explicitly allocated the texture earlier to handle problems + * gracefully. + * + * XXX: Maybe it could even be considered a programmer error if the + * texture hasn't been allocated by this point since it implies we + * are abount to paint with undefined texture contents? + */ + cogl_texture_allocate (texture, NULL); + + texture->vtable->pre_paint (texture, flags); +} + +void +_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture) +{ + texture->vtable->ensure_non_quad_rendering (texture); +} + +CoglBool +_cogl_texture_set_region_from_bitmap (CoglTexture *texture, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bmp, + int dst_x, + int dst_y, + int level, + CoglError **error) +{ + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x) + >= width, FALSE); + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y) + >= height, FALSE); + _COGL_RETURN_VAL_IF_FAIL (width > 0, FALSE); + _COGL_RETURN_VAL_IF_FAIL (height > 0, FALSE); + + /* Assert that the storage for this texture has been allocated */ + if (!cogl_texture_allocate (texture, error)) + return FALSE; + + /* Note that we don't prepare the bitmap for upload here because + some backends may be internally using a different format for the + actual GL texture than that reported by + _cogl_texture_get_format. For example the atlas textures are + always stored in an RGBA texture even if the texture format is + advertised as RGB. */ + + return texture->vtable->set_region (texture, + src_x, src_y, + dst_x, dst_y, + width, height, + level, + bmp, + error); +} + +CoglBool +cogl_texture_set_region_from_bitmap (CoglTexture *texture, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bitmap) +{ + CoglError *ignore_error = NULL; + CoglBool status = + _cogl_texture_set_region_from_bitmap (texture, + src_x, src_y, + dst_width, dst_height, + bitmap, + dst_x, dst_y, + 0, /* level */ + &ignore_error); + + if (!status) + cogl_error_free (ignore_error); + return status; +} + +CoglBool +_cogl_texture_set_region (CoglTexture *texture, + int width, + int height, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + int dst_x, + int dst_y, + int level, + CoglError **error) +{ + CoglContext *ctx = texture->context; + CoglBitmap *source_bmp; + CoglBool ret; + + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, FALSE); + + /* Rowstride from width if none specified */ + if (rowstride == 0) + rowstride = _cogl_pixel_format_get_bytes_per_pixel (format) * width; + + /* Init source bitmap */ + source_bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + ret = _cogl_texture_set_region_from_bitmap (texture, + 0, 0, + width, height, + source_bmp, + dst_x, dst_y, + level, + error); + + cogl_object_unref (source_bmp); + + return ret; +} + +CoglBool +cogl_texture_set_region (CoglTexture *texture, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + int width, + int height, + CoglPixelFormat format, + unsigned int rowstride, + const uint8_t *data) +{ + CoglError *ignore_error = NULL; + const uint8_t *first_pixel; + int bytes_per_pixel = _cogl_pixel_format_get_bytes_per_pixel (format); + CoglBool status; + + /* Rowstride from width if none specified */ + if (rowstride == 0) + rowstride = bytes_per_pixel * width; + + first_pixel = data + rowstride * src_y + bytes_per_pixel * src_x; + + status = _cogl_texture_set_region (texture, + dst_width, + dst_height, + format, + rowstride, + first_pixel, + dst_x, + dst_y, + 0, + &ignore_error); + if (!status) + cogl_error_free (ignore_error); + return status; +} + +CoglBool +cogl_texture_set_data (CoglTexture *texture, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + int level, + CoglError **error) +{ + int level_width; + int level_height; + + _cogl_texture_get_level_size (texture, + level, + &level_width, + &level_height, + NULL); + + return _cogl_texture_set_region (texture, + level_width, + level_height, + format, + rowstride, + data, + 0, 0, /* dest x, y */ + level, + error); +} + +/* Reads back the contents of a texture by rendering it to the framebuffer + * and reading back the resulting pixels. + * + * It will perform multiple renders if the texture is larger than the + * current glViewport. + * + * It assumes the projection and modelview have already been setup so + * that rendering to 0,0 with the same width and height of the viewport + * will exactly cover the viewport. + * + * NB: Normally this approach isn't normally used since we can just use + * glGetTexImage, but may be used as a fallback in some circumstances. + */ +static CoglBool +do_texture_draw_and_read (CoglFramebuffer *fb, + CoglPipeline *pipeline, + CoglTexture *texture, + CoglBitmap *target_bmp, + float *viewport, + CoglError **error) +{ + float rx1, ry1; + float rx2, ry2; + float tx1, ty1; + float tx2, ty2; + int bw, bh; + CoglBitmap *rect_bmp; + unsigned int tex_width, tex_height; + CoglContext *ctx = fb->context; + + tex_width = cogl_texture_get_width (texture); + tex_height = cogl_texture_get_height (texture); + + ry2 = 0; + ty2 = 0; + + /* Walk Y axis until whole bitmap height consumed */ + for (bh = tex_height; bh > 0; bh -= viewport[3]) + { + /* Rectangle Y coords */ + ry1 = ry2; + ry2 += (bh < viewport[3]) ? bh : viewport[3]; + + /* Normalized texture Y coords */ + ty1 = ty2; + ty2 = (ry2 / (float) tex_height); + + rx2 = 0; + tx2 = 0; + + /* Walk X axis until whole bitmap width consumed */ + for (bw = tex_width; bw > 0; bw-=viewport[2]) + { + int width; + int height; + + /* Rectangle X coords */ + rx1 = rx2; + rx2 += (bw < viewport[2]) ? bw : viewport[2]; + + width = rx2 - rx1; + height = ry2 - ry1; + + /* Normalized texture X coords */ + tx1 = tx2; + tx2 = (rx2 / (float) tex_width); + + /* Draw a portion of texture */ + cogl_framebuffer_draw_textured_rectangle (fb, + pipeline, + 0, 0, + rx2 - rx1, + ry2 - ry1, + tx1, ty1, + tx2, ty2); + + /* Read into a temporary bitmap */ + rect_bmp = _cogl_bitmap_new_with_malloc_buffer + (ctx, + width, height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + error); + if (!rect_bmp) + return FALSE; + + if (!_cogl_framebuffer_read_pixels_into_bitmap + (fb, + viewport[0], viewport[1], + COGL_READ_PIXELS_COLOR_BUFFER, + rect_bmp, + error)) + { + cogl_object_unref (rect_bmp); + return FALSE; + } + + /* Copy to target bitmap */ + if (!_cogl_bitmap_copy_subregion (rect_bmp, + target_bmp, + 0, 0, + rx1, ry1, + width, + height, + error)) + { + cogl_object_unref (rect_bmp); + return FALSE; + } + + /* Free temp bitmap */ + cogl_object_unref (rect_bmp); + } + } + + return TRUE; +} + +/* Reads back the contents of a texture by rendering it to the framebuffer + * and reading back the resulting pixels. + * + * NB: Normally this approach isn't normally used since we can just use + * glGetTexImage, but may be used as a fallback in some circumstances. + */ +static CoglBool +_cogl_texture_draw_and_read (CoglTexture *texture, + CoglBitmap *target_bmp, + GLuint target_gl_format, + GLuint target_gl_type, + CoglError **error) +{ + CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); + CoglContext *ctx = framebuffer->context; + float save_viewport[4]; + float viewport[4]; + CoglBool status = FALSE; + + viewport[0] = 0; + viewport[1] = 0; + viewport[2] = cogl_framebuffer_get_width (framebuffer); + viewport[3] = cogl_framebuffer_get_height (framebuffer); + + cogl_framebuffer_get_viewport4fv (framebuffer, save_viewport); + _cogl_framebuffer_push_projection (framebuffer); + cogl_framebuffer_orthographic (framebuffer, + 0, 0, + viewport[2], + viewport[3], + 0, 100); + + cogl_framebuffer_push_matrix (framebuffer); + cogl_framebuffer_identity_matrix (framebuffer); + + /* Direct copy operation */ + + if (ctx->texture_download_pipeline == NULL) + { + ctx->texture_download_pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_blend (ctx->texture_download_pipeline, + "RGBA = ADD (SRC_COLOR, 0)", + NULL); + } + + cogl_pipeline_set_layer_texture (ctx->texture_download_pipeline, 0, texture); + + cogl_pipeline_set_layer_combine (ctx->texture_download_pipeline, + 0, /* layer */ + "RGBA = REPLACE (TEXTURE)", + NULL); + + cogl_pipeline_set_layer_filters (ctx->texture_download_pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + if (!do_texture_draw_and_read (framebuffer, + ctx->texture_download_pipeline, + texture, target_bmp, viewport, + error)) + return FALSE; + + /* XXX: As an alleged PowerVR driver bug workaround where the driver + * is apparently not maintaining the alpha component of some + * framebuffers we render the alpha component of the texture + * separately to be sure we retrieve all components of the texture. + * + * TODO: verify if this is still an issue + */ + if ((_cogl_texture_get_format (texture) & COGL_A_BIT)/* && a_bits == 0*/) + { + uint8_t *srcdata; + uint8_t *dstdata; + uint8_t *srcpixel; + uint8_t *dstpixel; + int target_width = cogl_bitmap_get_width (target_bmp); + int target_height = cogl_bitmap_get_height (target_bmp); + int target_rowstride = cogl_bitmap_get_rowstride (target_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (COGL_PIXEL_FORMAT_RGBA_8888); + int alpha_rowstride = bpp * target_width; + CoglBitmap *alpha_bmp; + int x,y; + + if ((dstdata = _cogl_bitmap_map (target_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + error)) == NULL) + goto EXIT; + + /* Create temp bitmap for alpha values */ + alpha_bmp = + _cogl_bitmap_new_with_malloc_buffer (ctx, + target_width, + target_height, + COGL_PIXEL_FORMAT_RGBA_8888, + error); + if (!alpha_bmp) + { + _cogl_bitmap_unmap (target_bmp); + goto EXIT; + } + + + /* Draw alpha values into RGB channels */ + cogl_pipeline_set_layer_combine (ctx->texture_download_pipeline, + 0, /* layer */ + "RGBA = REPLACE (TEXTURE[A])", + NULL); + + if (!do_texture_draw_and_read (framebuffer, + ctx->texture_download_pipeline, + texture, alpha_bmp, viewport, + error)) + { + cogl_object_unref (alpha_bmp); + _cogl_bitmap_unmap (target_bmp); + goto EXIT; + } + + /* Copy temp R to target A */ + + /* Note: we don't try to catch errors since "mapping" an + * malloc buffer should never fail */ + srcdata = _cogl_bitmap_map (alpha_bmp, + COGL_BUFFER_ACCESS_READ, + 0 /* hints */, + NULL); + + for (y=0; ycontext; + CoglOffscreen *offscreen; + CoglFramebuffer *framebuffer; + CoglBitmap *bitmap; + CoglBool ret; + CoglError *ignore_error = NULL; + CoglPixelFormat real_format; + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + return FALSE; + + offscreen = _cogl_offscreen_new_with_texture_full + (sub_texture, + COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, + 0); + + framebuffer = COGL_FRAMEBUFFER (offscreen); + if (!cogl_framebuffer_allocate (framebuffer, &ignore_error)) + { + cogl_error_free (ignore_error); + return FALSE; + } + + /* Currently the framebuffer's internal format corresponds to the + * internal format of @sub_texture but in the case of atlas textures + * it's possible that this format doesn't reflect the correct + * premultiplied alpha status or what components are valid since + * atlas textures are always stored in a shared texture with a + * format of _RGBA_8888. + * + * Here we override the internal format to make sure the + * framebuffer's internal format matches the internal format of the + * parent meta_texture instead. + */ + real_format = _cogl_texture_get_format (meta_texture); + _cogl_framebuffer_set_internal_format (framebuffer, real_format); + + bitmap = cogl_bitmap_new_for_data (ctx, + width, height, + closest_format, + dst_rowstride, + dst_bits); + ret = _cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, + COGL_READ_PIXELS_COLOR_BUFFER, + bitmap, + &ignore_error); + + if (!ret) + cogl_error_free (ignore_error); + + cogl_object_unref (bitmap); + + cogl_object_unref (framebuffer); + + return ret; +} + +static CoglBool +get_texture_bits_via_copy (CoglTexture *texture, + int x, + int y, + int width, + int height, + uint8_t *dst_bits, + unsigned int dst_rowstride, + CoglPixelFormat dst_format) +{ + unsigned int full_rowstride; + uint8_t *full_bits; + CoglBool ret = TRUE; + int bpp; + int full_tex_width, full_tex_height; + + full_tex_width = cogl_texture_get_width (texture); + full_tex_height = cogl_texture_get_height (texture); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format); + + full_rowstride = bpp * full_tex_width; + full_bits = g_malloc (full_rowstride * full_tex_height); + + if (texture->vtable->get_data (texture, + dst_format, + full_rowstride, + full_bits)) + { + uint8_t *dst = dst_bits; + uint8_t *src = full_bits + x * bpp + y * full_rowstride; + int i; + + for (i = 0; i < height; i++) + { + memcpy (dst, src, bpp * width); + dst += dst_rowstride; + src += full_rowstride; + } + } + else + ret = FALSE; + + g_free (full_bits); + + return ret; +} + +typedef struct +{ + CoglTexture *meta_texture; + int orig_width; + int orig_height; + CoglBitmap *target_bmp; + uint8_t *target_bits; + CoglBool success; + CoglError *error; +} CoglTextureGetData; + +static void +texture_get_cb (CoglTexture *subtexture, + const float *subtexture_coords, + const float *virtual_coords, + void *user_data) +{ + CoglTextureGetData *tg_data = user_data; + CoglTexture *meta_texture = tg_data->meta_texture; + CoglPixelFormat closest_format = cogl_bitmap_get_format (tg_data->target_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (closest_format); + unsigned int rowstride = cogl_bitmap_get_rowstride (tg_data->target_bmp); + int subtexture_width = cogl_texture_get_width (subtexture); + int subtexture_height = cogl_texture_get_height (subtexture); + + int x_in_subtexture = (int) (0.5 + subtexture_width * subtexture_coords[0]); + int y_in_subtexture = (int) (0.5 + subtexture_height * subtexture_coords[1]); + int width = ((int) (0.5 + subtexture_width * subtexture_coords[2]) + - x_in_subtexture); + int height = ((int) (0.5 + subtexture_height * subtexture_coords[3]) + - y_in_subtexture); + int x_in_bitmap = (int) (0.5 + tg_data->orig_width * virtual_coords[0]); + int y_in_bitmap = (int) (0.5 + tg_data->orig_height * virtual_coords[1]); + + uint8_t *dst_bits; + + if (!tg_data->success) + return; + + dst_bits = tg_data->target_bits + x_in_bitmap * bpp + y_in_bitmap * rowstride; + + /* If we can read everything as a single slice, then go ahead and do that + * to avoid allocating an FBO. We'll leave it up to the GL implementation to + * do glGetTexImage as efficiently as possible. (GLES doesn't have that, + * so we'll fall through) + */ + if (x_in_subtexture == 0 && y_in_subtexture == 0 && + width == subtexture_width && height == subtexture_height) + { + if (subtexture->vtable->get_data (subtexture, + closest_format, + rowstride, + dst_bits)) + return; + } + + /* Next best option is a FBO and glReadPixels */ + if (get_texture_bits_via_offscreen (meta_texture, + subtexture, + x_in_subtexture, y_in_subtexture, + width, height, + dst_bits, + rowstride, + closest_format)) + return; + + /* Getting ugly: read the entire texture, copy out the part we want */ + if (get_texture_bits_via_copy (subtexture, + x_in_subtexture, y_in_subtexture, + width, height, + dst_bits, + rowstride, + closest_format)) + return; + + /* No luck, the caller will fall back to the draw-to-backbuffer and + * read implementation */ + tg_data->success = FALSE; +} + +int +cogl_texture_get_data (CoglTexture *texture, + CoglPixelFormat format, + unsigned int rowstride, + uint8_t *data) +{ + CoglContext *ctx = texture->context; + int bpp; + int byte_size; + CoglPixelFormat closest_format; + GLenum closest_gl_format; + GLenum closest_gl_type; + CoglBitmap *target_bmp; + int tex_width; + int tex_height; + CoglPixelFormat texture_format; + CoglError *ignore_error = NULL; + + CoglTextureGetData tg_data; + + texture_format = _cogl_texture_get_format (texture); + + /* Default to internal format if none specified */ + if (format == COGL_PIXEL_FORMAT_ANY) + format = texture_format; + + tex_width = cogl_texture_get_width (texture); + tex_height = cogl_texture_get_height (texture); + + /* Rowstride from texture width if none specified */ + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + if (rowstride == 0) + rowstride = tex_width * bpp; + + /* Return byte size if only that requested */ + byte_size = tex_height * rowstride; + if (data == NULL) + return byte_size; + + closest_format = + ctx->texture_driver->find_best_gl_get_data_format (ctx, + format, + &closest_gl_format, + &closest_gl_type); + + /* We can assume that whatever data GL gives us will have the + premult status of the original texture */ + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (closest_format)) + closest_format = ((closest_format & ~COGL_PREMULT_BIT) | + (texture_format & COGL_PREMULT_BIT)); + + /* If the application is requesting a conversion from a + * component-alpha texture and the driver doesn't support them + * natively then we can only read into an alpha-format buffer. In + * this case the driver will be faking the alpha textures with a + * red-component texture and it won't swizzle to the correct format + * while reading */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES)) + { + if (texture_format == COGL_PIXEL_FORMAT_A_8) + { + closest_format = COGL_PIXEL_FORMAT_A_8; + closest_gl_format = GL_RED; + closest_gl_type = GL_UNSIGNED_BYTE; + } + else if (format == COGL_PIXEL_FORMAT_A_8) + { + /* If we are converting to a component-alpha texture then we + * need to read all of the components to a temporary buffer + * because there is no way to get just the 4th component. + * Note: it doesn't matter whether the texture is + * pre-multiplied here because we're only going to look at + * the alpha component */ + closest_format = COGL_PIXEL_FORMAT_RGBA_8888; + closest_gl_format = GL_RGBA; + closest_gl_type = GL_UNSIGNED_BYTE; + } + } + + /* Is the requested format supported? */ + if (closest_format == format) + /* Target user data directly */ + target_bmp = cogl_bitmap_new_for_data (ctx, + tex_width, + tex_height, + format, + rowstride, + data); + else + { + target_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + tex_width, tex_height, + closest_format, + &ignore_error); + if (!target_bmp) + { + cogl_error_free (ignore_error); + return 0; + } + } + + tg_data.target_bits = _cogl_bitmap_map (target_bmp, COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + &ignore_error); + if (tg_data.target_bits) + { + tg_data.meta_texture = texture; + tg_data.orig_width = tex_width; + tg_data.orig_height = tex_height; + tg_data.target_bmp = target_bmp; + tg_data.error = NULL; + tg_data.success = TRUE; + + /* If there are any dependent framebuffers on the texture then we + need to flush their journals so the texture contents will be + up-to-date */ + _cogl_texture_flush_journal_rendering (texture); + + /* Iterating through the subtextures allows piecing together + * the data for a sliced texture, and allows us to do the + * read-from-framebuffer logic here in a simple fashion rather than + * passing offsets down through the code. */ + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (texture), + 0, 0, 1, 1, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + texture_get_cb, + &tg_data); + + _cogl_bitmap_unmap (target_bmp); + } + else + { + cogl_error_free (ignore_error); + tg_data.success = FALSE; + } + + /* XXX: In some cases _cogl_texture_2d_download_from_gl may fail + * to read back the texture data; such as for GLES which doesn't + * support glGetTexImage, so here we fallback to drawing the + * texture and reading the pixels from the framebuffer. */ + if (!tg_data.success) + { + if (!_cogl_texture_draw_and_read (texture, target_bmp, + closest_gl_format, + closest_gl_type, + &ignore_error)) + { + /* We have no more fallbacks so we just give up and + * hope for the best */ + g_warning ("Failed to read texture since draw-and-read " + "fallback failed: %s", ignore_error->message); + cogl_error_free (ignore_error); + cogl_object_unref (target_bmp); + return 0; + } + } + + /* Was intermediate used? */ + if (closest_format != format) + { + CoglBitmap *new_bmp; + CoglBool result; + CoglError *error = NULL; + + /* Convert to requested format directly into the user's buffer */ + new_bmp = cogl_bitmap_new_for_data (ctx, + tex_width, tex_height, + format, + rowstride, + data); + result = _cogl_bitmap_convert_into_bitmap (target_bmp, new_bmp, &error); + + if (!result) + { + cogl_error_free (error); + /* Return failure after cleaning up */ + byte_size = 0; + } + + cogl_object_unref (new_bmp); + } + + cogl_object_unref (target_bmp); + + return byte_size; +} + +static void +_cogl_texture_framebuffer_destroy_cb (void *user_data, + void *instance) +{ + CoglTexture *tex = user_data; + CoglFramebuffer *framebuffer = instance; + + tex->framebuffers = g_list_remove (tex->framebuffers, framebuffer); +} + +void +_cogl_texture_associate_framebuffer (CoglTexture *texture, + CoglFramebuffer *framebuffer) +{ + static CoglUserDataKey framebuffer_destroy_notify_key; + + /* Note: we don't take a reference on the framebuffer here because + * that would introduce a circular reference. */ + texture->framebuffers = g_list_prepend (texture->framebuffers, framebuffer); + + /* Since we haven't taken a reference on the framebuffer we setup + * some private data so we will be notified if it is destroyed... */ + _cogl_object_set_user_data (COGL_OBJECT (framebuffer), + &framebuffer_destroy_notify_key, + texture, + _cogl_texture_framebuffer_destroy_cb); +} + +const GList * +_cogl_texture_get_associated_framebuffers (CoglTexture *texture) +{ + return texture->framebuffers; +} + +void +_cogl_texture_flush_journal_rendering (CoglTexture *texture) +{ + GList *l; + + /* It could be that a referenced texture is part of a framebuffer + * which has an associated journal that must be flushed before it + * can be sampled from by the current primitive... */ + for (l = texture->framebuffers; l; l = l->next) + _cogl_framebuffer_flush_journal (l->data); +} + +/* This function lets you define a meta texture as a grid of textures + * whereby the x and y grid-lines are defined by an array of + * CoglSpans. With that grid based description this function can then + * iterate all the cells of the grid that lye within a region + * specified as virtual, meta-texture, coordinates. This function can + * also cope with regions that extend beyond the original meta-texture + * grid by iterating cells repeatedly according to the wrap_x/y + * arguments. + * + * To differentiate between texture coordinates of a specific, real, + * slice texture and the texture coordinates of a composite, meta + * texture, the coordinates of the meta texture are called "virtual" + * coordinates and the coordinates of spans are called "slice" + * coordinates. + * + * Note: no guarantee is given about the order in which the slices + * will be visited. + * + * Note: The slice coordinates passed to @callback are always + * normalized coordinates even if the span coordinates aren't + * normalized. + */ +void +_cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, + int n_x_spans, + CoglSpan *y_spans, + int n_y_spans, + CoglTexture **textures, + float *virtual_coords, + float x_normalize_factor, + float y_normalize_factor, + CoglPipelineWrapMode wrap_x, + CoglPipelineWrapMode wrap_y, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglSpanIter iter_x; + CoglSpanIter iter_y; + float slice_coords[4]; + float span_virtual_coords[4]; + + /* Iterate the y axis of the virtual rectangle */ + for (_cogl_span_iter_begin (&iter_y, + y_spans, + n_y_spans, + y_normalize_factor, + virtual_coords[1], + virtual_coords[3], + wrap_y); + !_cogl_span_iter_end (&iter_y); + _cogl_span_iter_next (&iter_y)) + { + if (iter_y.flipped) + { + slice_coords[1] = iter_y.intersect_end; + slice_coords[3] = iter_y.intersect_start; + span_virtual_coords[1] = iter_y.intersect_end; + span_virtual_coords[3] = iter_y.intersect_start; + } + else + { + slice_coords[1] = iter_y.intersect_start; + slice_coords[3] = iter_y.intersect_end; + span_virtual_coords[1] = iter_y.intersect_start; + span_virtual_coords[3] = iter_y.intersect_end; + } + + /* Map the current intersection to normalized slice coordinates */ + slice_coords[1] = (slice_coords[1] - iter_y.pos) / iter_y.span->size; + slice_coords[3] = (slice_coords[3] - iter_y.pos) / iter_y.span->size; + + /* Iterate the x axis of the virtual rectangle */ + for (_cogl_span_iter_begin (&iter_x, + x_spans, + n_x_spans, + x_normalize_factor, + virtual_coords[0], + virtual_coords[2], + wrap_x); + !_cogl_span_iter_end (&iter_x); + _cogl_span_iter_next (&iter_x)) + { + CoglTexture *span_tex; + + if (iter_x.flipped) + { + slice_coords[0] = iter_x.intersect_end; + slice_coords[2] = iter_x.intersect_start; + span_virtual_coords[0] = iter_x.intersect_end; + span_virtual_coords[2] = iter_x.intersect_start; + } + else + { + slice_coords[0] = iter_x.intersect_start; + slice_coords[2] = iter_x.intersect_end; + span_virtual_coords[0] = iter_x.intersect_start; + span_virtual_coords[2] = iter_x.intersect_end; + } + + /* Map the current intersection to normalized slice coordinates */ + slice_coords[0] = (slice_coords[0] - iter_x.pos) / iter_x.span->size; + slice_coords[2] = (slice_coords[2] - iter_x.pos) / iter_x.span->size; + + /* Pluck out the cogl texture for this span */ + span_tex = textures[iter_y.index * n_x_spans + iter_x.index]; + + callback (COGL_TEXTURE (span_tex), + slice_coords, + span_virtual_coords, + user_data); + } + } +} + +void +_cogl_texture_set_allocated (CoglTexture *texture, + CoglPixelFormat internal_format, + int width, + int height) +{ + _cogl_texture_set_internal_format (texture, internal_format); + + texture->width = width; + texture->height = height; + texture->allocated = TRUE; + + _cogl_texture_free_loader (texture); +} + +CoglBool +cogl_texture_allocate (CoglTexture *texture, + CoglError **error) +{ + if (texture->allocated) + return TRUE; + + if (texture->components == COGL_TEXTURE_COMPONENTS_RG && + !cogl_has_feature (texture->context, COGL_FEATURE_ID_TEXTURE_RG)) + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_FORMAT, + "A red-green texture was requested but the driver " + "does not support them"); + + texture->allocated = texture->vtable->allocate (texture, error); + + return texture->allocated; +} + +void +_cogl_texture_set_internal_format (CoglTexture *texture, + CoglPixelFormat internal_format) +{ + texture->premultiplied = FALSE; + + if (internal_format == COGL_PIXEL_FORMAT_ANY) + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + + if (internal_format == COGL_PIXEL_FORMAT_A_8) + { + texture->components = COGL_TEXTURE_COMPONENTS_A; + return; + } + else if (internal_format == COGL_PIXEL_FORMAT_RG_88) + { + texture->components = COGL_TEXTURE_COMPONENTS_RG; + return; + } + else if (internal_format & COGL_DEPTH_BIT) + { + texture->components = COGL_TEXTURE_COMPONENTS_DEPTH; + return; + } + else if (internal_format & COGL_A_BIT) + { + texture->components = COGL_TEXTURE_COMPONENTS_RGBA; + if (internal_format & COGL_PREMULT_BIT) + texture->premultiplied = TRUE; + return; + } + else + texture->components = COGL_TEXTURE_COMPONENTS_RGB; +} + +CoglPixelFormat +_cogl_texture_determine_internal_format (CoglTexture *texture, + CoglPixelFormat src_format) +{ + switch (texture->components) + { + case COGL_TEXTURE_COMPONENTS_DEPTH: + if (src_format & COGL_DEPTH_BIT) + return src_format; + else + { + CoglContext *ctx = texture->context; + + if (_cogl_has_private_feature (ctx, + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) || + _cogl_has_private_feature (ctx, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL)) + { + return COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8; + } + else + return COGL_PIXEL_FORMAT_DEPTH_16; + } + case COGL_TEXTURE_COMPONENTS_A: + return COGL_PIXEL_FORMAT_A_8; + case COGL_TEXTURE_COMPONENTS_RG: + return COGL_PIXEL_FORMAT_RG_88; + case COGL_TEXTURE_COMPONENTS_RGB: + if (src_format != COGL_PIXEL_FORMAT_ANY && + !(src_format & COGL_A_BIT) && !(src_format & COGL_DEPTH_BIT)) + return src_format; + else + return COGL_PIXEL_FORMAT_RGB_888; + case COGL_TEXTURE_COMPONENTS_RGBA: + { + CoglPixelFormat format; + + if (src_format != COGL_PIXEL_FORMAT_ANY && + (src_format & COGL_A_BIT) && src_format != COGL_PIXEL_FORMAT_A_8) + format = src_format; + else + format = COGL_PIXEL_FORMAT_RGBA_8888; + + if (texture->premultiplied) + { + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + return format |= COGL_PREMULT_BIT; + else + return COGL_PIXEL_FORMAT_RGBA_8888_PRE; + } + else + return format & ~COGL_PREMULT_BIT; + } + } + + g_return_val_if_reached (COGL_PIXEL_FORMAT_RGBA_8888_PRE); +} + +void +cogl_texture_set_components (CoglTexture *texture, + CoglTextureComponents components) +{ + _COGL_RETURN_IF_FAIL (!texture->allocated); + + if (texture->components == components) + return; + + texture->components = components; +} + +CoglTextureComponents +cogl_texture_get_components (CoglTexture *texture) +{ + return texture->components; +} + +void +cogl_texture_set_premultiplied (CoglTexture *texture, + CoglBool premultiplied) +{ + _COGL_RETURN_IF_FAIL (!texture->allocated); + + premultiplied = !!premultiplied; + + if (texture->premultiplied == premultiplied) + return; + + texture->premultiplied = premultiplied; +} + +CoglBool +cogl_texture_get_premultiplied (CoglTexture *texture) +{ + return texture->premultiplied; +} + +void +_cogl_texture_copy_internal_format (CoglTexture *src, + CoglTexture *dest) +{ + cogl_texture_set_components (dest, src->components); + cogl_texture_set_premultiplied (dest, src->premultiplied); +} diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h new file mode 100644 index 0000000..2718830 --- /dev/null +++ b/cogl/cogl-texture.h @@ -0,0 +1,524 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TEXTURE_H__ +#define __COGL_TEXTURE_H__ + +/* We forward declare the CoglTexture type here to avoid some circular + * dependency issues with the following headers. + */ +#ifdef __COGL_H_INSIDE__ +/* For the public C api we typedef interface types as void to avoid needing + * lots of casting in code and instead we will rely on runtime type checking + * for these objects. */ +typedef void CoglTexture; +#else +typedef struct _CoglTexture CoglTexture; +#define COGL_TEXTURE(X) ((CoglTexture *)X) +#endif + +#include +#include +#include +#if defined (COGL_ENABLE_EXPERIMENTAL_API) +#include +#endif +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-texture + * @short_description: Functions for creating and manipulating textures + * + * Cogl allows creating and manipulating textures using a uniform + * API that tries to hide all the various complexities of creating, + * loading and manipulating textures. + */ + +#define COGL_TEXTURE_MAX_WASTE 127 + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_get_gtype (void); +#endif + +/** + * COGL_TEXTURE_ERROR: + * + * #CoglError domain for texture errors. + * + * Since: 1.8 + * Stability: Unstable + */ +#define COGL_TEXTURE_ERROR (cogl_texture_error_quark ()) + +/** + * CoglTextureError: + * @COGL_TEXTURE_ERROR_SIZE: Unsupported size + * @COGL_TEXTURE_ERROR_FORMAT: Unsupported format + * @COGL_TEXTURE_ERROR_TYPE: A primitive texture type that is + * unsupported by the driver was used + * + * Error codes that can be thrown when allocating textures. + * + * Since: 1.8 + * Stability: Unstable + */ +typedef enum { + COGL_TEXTURE_ERROR_SIZE, + COGL_TEXTURE_ERROR_FORMAT, + COGL_TEXTURE_ERROR_BAD_PARAMETER, + COGL_TEXTURE_ERROR_TYPE +} CoglTextureError; + +/** + * CoglTextureType: + * @COGL_TEXTURE_TYPE_2D: A #CoglTexture2D + * @COGL_TEXTURE_TYPE_3D: A #CoglTexture3D + * @COGL_TEXTURE_TYPE_RECTANGLE: A #CoglTextureRectangle + * + * Constants representing the underlying hardware texture type of a + * #CoglTexture. + * + * Stability: unstable + * Since: 1.10 + */ +typedef enum { + COGL_TEXTURE_TYPE_2D, + COGL_TEXTURE_TYPE_3D, + COGL_TEXTURE_TYPE_RECTANGLE +} CoglTextureType; + +uint32_t cogl_texture_error_quark (void); + +/** + * cogl_is_texture: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a texture object. + * + * Return value: %TRUE if the @object references a texture, and + * %FALSE otherwise + */ +CoglBool +cogl_is_texture (void *object); + +/** + * CoglTextureComponents: + * @COGL_TEXTURE_COMPONENTS_A: Only the alpha component + * @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that + * this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature + * is advertised. + * @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components + * @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components + * @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component + * + * See cogl_texture_set_components(). + * + * Since: 1.18 + */ +typedef enum _CoglTextureComponents +{ + COGL_TEXTURE_COMPONENTS_A = 1, + COGL_TEXTURE_COMPONENTS_RG, + COGL_TEXTURE_COMPONENTS_RGB, + COGL_TEXTURE_COMPONENTS_RGBA, + COGL_TEXTURE_COMPONENTS_DEPTH +} CoglTextureComponents; + +/** + * cogl_texture_set_components: + * @texture: a #CoglTexture pointer. + * + * Affects the internal storage format for this texture by specifying + * what components will be required for sampling later. + * + * This api affects how data is uploaded to the GPU since unused + * components can potentially be discarded from source data. + * + * For textures created by the ‘_with_size’ constructors the default + * is %COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take + * a %CoglBitmap or a data pointer default to the same components as + * the pixel format of the data. + * + * Note that the %COGL_TEXTURE_COMPONENTS_RG format is not available + * on all drivers. The availability can be determined by checking for + * the %COGL_FEATURE_ID_TEXTURE_RG feature. If this format is used on + * a driver where it is not available then %COGL_TEXTURE_ERROR_FORMAT + * will be raised when the texture is allocated. Even if the feature + * is not available then %COGL_PIXEL_FORMAT_RG_88 can still be used as + * an image format as long as %COGL_TEXTURE_COMPONENTS_RG isn't used + * as the texture's components. + * + * Since: 1.18 + */ +void +cogl_texture_set_components (CoglTexture *texture, + CoglTextureComponents components); + +/** + * cogl_texture_get_components: + * @texture: a #CoglTexture pointer. + * + * Queries what components the given @texture stores internally as set + * via cogl_texture_set_components(). + * + * For textures created by the ‘_with_size’ constructors the default + * is %COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take + * a %CoglBitmap or a data pointer default to the same components as + * the pixel format of the data. + * + * Since: 1.18 + */ +CoglTextureComponents +cogl_texture_get_components (CoglTexture *texture); + +/** + * cogl_texture_set_premultiplied: + * @texture: a #CoglTexture pointer. + * @premultiplied: Whether any internally stored red, green or blue + * components are pre-multiplied by an alpha + * component. + * + * Affects the internal storage format for this texture by specifying + * whether red, green and blue color components should be stored as + * pre-multiplied alpha values. + * + * This api affects how data is uploaded to the GPU since Cogl will + * convert source data to have premultiplied or unpremultiplied + * components according to this state. + * + * For example if you create a texture via + * cogl_texture_2d_new_with_size() and then upload data via + * cogl_texture_set_data() passing a source format of + * %COGL_PIXEL_FORMAT_RGBA_8888 then Cogl will internally multiply the + * red, green and blue components of the source data by the alpha + * component, for each pixel so that the internally stored data has + * pre-multiplied alpha components. If you instead upload data that + * already has pre-multiplied components by passing + * %COGL_PIXEL_FORMAT_RGBA_8888_PRE as the source format to + * cogl_texture_set_data() then the data can be uploaded without being + * converted. + * + * By default the @premultipled state is @TRUE. + * + * Since: 1.18 + */ +void +cogl_texture_set_premultiplied (CoglTexture *texture, + CoglBool premultiplied); + +/** + * cogl_texture_get_premultiplied: + * @texture: a #CoglTexture pointer. + * + * Queries the pre-multiplied alpha status for internally stored red, + * green and blue components for the given @texture as set by + * cogl_texture_set_premultiplied(). + * + * By default the pre-multipled state is @TRUE. + * + * Return value: %TRUE if red, green and blue components are + * internally stored pre-multiplied by the alpha + * value or %FALSE if not. + * Since: 1.18 + */ +CoglBool +cogl_texture_get_premultiplied (CoglTexture *texture); + +/** + * cogl_texture_get_width: + * @texture: a #CoglTexture pointer. + * + * Queries the width of a cogl texture. + * + * Return value: the width of the GPU side texture in pixels + */ +unsigned int +cogl_texture_get_width (CoglTexture *texture); + +/** + * cogl_texture_get_height: + * @texture: a #CoglTexture pointer. + * + * Queries the height of a cogl texture. + * + * Return value: the height of the GPU side texture in pixels + */ +unsigned int +cogl_texture_get_height (CoglTexture *texture); + +/** + * cogl_texture_get_max_waste: + * @texture: a #CoglTexture pointer. + * + * Queries the maximum wasted (unused) pixels in one dimension of a GPU side + * texture. + * + * Return value: the maximum waste + */ +int +cogl_texture_get_max_waste (CoglTexture *texture); + +/** + * cogl_texture_is_sliced: + * @texture: a #CoglTexture pointer. + * + * Queries if a texture is sliced (stored as multiple GPU side tecture + * objects). + * + * Return value: %TRUE if the texture is sliced, %FALSE if the texture + * is stored as a single GPU texture + */ +CoglBool +cogl_texture_is_sliced (CoglTexture *texture); + +/** + * cogl_texture_get_gl_texture: + * @texture: a #CoglTexture pointer. + * @out_gl_handle: (out) (allow-none): pointer to return location for the + * textures GL handle, or %NULL. + * @out_gl_target: (out) (allow-none): pointer to return location for the + * GL target type, or %NULL. + * + * Queries the GL handles for a GPU side texture through its #CoglTexture. + * + * If the texture is spliced the data for the first sub texture will be + * queried. + * + * Return value: %TRUE if the handle was successfully retrieved, %FALSE + * if the handle was invalid + */ +CoglBool +cogl_texture_get_gl_texture (CoglTexture *texture, + unsigned int *out_gl_handle, + unsigned int *out_gl_target); + +/** + * cogl_texture_get_data: + * @texture: a #CoglTexture pointer. + * @format: the #CoglPixelFormat to store the texture as. + * @rowstride: the rowstride of @data in bytes or pass 0 to calculate + * from the bytes-per-pixel of @format multiplied by the + * @texture width. + * @data: memory location to write the @texture's contents, or %NULL + * to only query the data size through the return value. + * + * Copies the pixel data from a cogl texture to system memory. + * + * Don't pass the value of cogl_texture_get_rowstride() as the + * @rowstride argument, the rowstride should be the rowstride you + * want for the destination @data buffer not the rowstride of the + * source texture + * + * Return value: the size of the texture data in bytes + */ +int +cogl_texture_get_data (CoglTexture *texture, + CoglPixelFormat format, + unsigned int rowstride, + uint8_t *data); + +/** + * cogl_texture_set_region: + * @texture: a #CoglTexture. + * @src_x: upper left coordinate to use from source data. + * @src_y: upper left coordinate to use from source data. + * @dst_x: upper left destination horizontal coordinate. + * @dst_y: upper left destination vertical coordinate. + * @dst_width: width of destination region to write. (Must be less + * than or equal to @width) + * @dst_height: height of destination region to write. (Must be less + * than or equal to @height) + * @width: width of source data buffer. + * @height: height of source data buffer. + * @format: the #CoglPixelFormat used in the source buffer. + * @rowstride: rowstride of source buffer (computed from width if none + * specified) + * @data: the actual pixel data. + * + * Sets the pixels in a rectangular subregion of @texture from an in-memory + * buffer containing pixel data. + * + * The region set can't be larger than the source @data + * + * Return value: %TRUE if the subregion upload was successful, and + * %FALSE otherwise + */ +CoglBool +cogl_texture_set_region (CoglTexture *texture, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + int width, + int height, + CoglPixelFormat format, + unsigned int rowstride, + const uint8_t *data); + +#if defined (COGL_ENABLE_EXPERIMENTAL_API) + +/** + * cogl_texture_set_data: + * @texture a #CoglTexture. + * @format: the #CoglPixelFormat used in the source @data buffer. + * @rowstride: rowstride of the source @data buffer (computed from + * the texture width and @format if it equals 0) + * @data: the source data, pointing to the first top-left pixel to set + * @level: The mipmap level to update (Normally 0 for the largest, + * base texture) + * @error: A #CoglError to return exceptional errors + * + * Sets all the pixels for a given mipmap @level by copying the pixel + * data pointed to by the @data argument into the given @texture. + * + * @data should point to the first pixel to copy corresponding + * to the top left of the mipmap @level being set. + * + * If @rowstride equals 0 then it will be automatically calculated + * from the width of the mipmap level and the bytes-per-pixel for the + * given @format. + * + * A mipmap @level of 0 corresponds to the largest, base image of a + * texture and @level 1 is half the width and height of level 0. If + * dividing any dimension of the previous level by two results in a + * fraction then round the number down (floor()), but clamp to 1 + * something like this: + * + * |[ + * next_width = MAX (1, floor (prev_width)); + * ]| + * + * You can determine the number of mipmap levels for a given texture + * like this: + * + * |[ + * n_levels = 1 + floor (log2 (max_dimension)); + * ]| + * + * Where %max_dimension is the larger of cogl_texture_get_width() and + * cogl_texture_get_height(). + * + * It is an error to pass a @level number >= the number of levels that + * @texture can have according to the above calculation. + * + * Since the storage for a #CoglTexture is allocated lazily then + * if the given @texture has not previously been allocated then this + * api can return %FALSE and throw an exceptional @error if there is + * not enough memory to allocate storage for @texture. + * + * Return value: %TRUE if the data upload was successful, and + * %FALSE otherwise + */ +CoglBool +cogl_texture_set_data (CoglTexture *texture, + CoglPixelFormat format, + int rowstride, + const uint8_t *data, + int level, + CoglError **error); + +/** + * cogl_texture_set_region_from_bitmap: + * @texture: a #CoglTexture pointer + * @src_x: upper left coordinate to use from the source bitmap. + * @src_y: upper left coordinate to use from the source bitmap + * @dst_x: upper left destination horizontal coordinate. + * @dst_y: upper left destination vertical coordinate. + * @dst_width: width of destination region to write. (Must be less + * than or equal to the bitmap width) + * @dst_height: height of destination region to write. (Must be less + * than or equal to the bitmap height) + * @bitmap: The source bitmap to read from + * + * Copies a specified source region from @bitmap to the position + * (@src_x, @src_y) of the given destination texture @handle. + * + * The region updated can't be larger than the source + * bitmap + * + * Return value: %TRUE if the subregion upload was successful, and + * %FALSE otherwise + * + * Since: 1.8 + * Stability: unstable + */ +CoglBool +cogl_texture_set_region_from_bitmap (CoglTexture *texture, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bitmap); +#endif + +/** + * cogl_texture_allocate: + * @texture: A #CoglTexture + * @error: A #CoglError to return exceptional errors or %NULL + * + * Explicitly allocates the storage for the given @texture which + * allows you to be sure that there is enough memory for the + * texture and if not then the error can be handled gracefully. + * + * Normally applications don't need to use this api directly + * since the texture will be implicitly allocated when data is set on + * the texture, or if the texture is attached to a #CoglOffscreen + * framebuffer and rendered too. + * + * Return value: %TRUE if the texture was successfully allocated, + * otherwise %FALSE and @error will be updated if it + * wasn't %NULL. + */ +CoglBool +cogl_texture_allocate (CoglTexture *texture, + CoglError **error); + +COGL_END_DECLS + +#endif /* __COGL_TEXTURE_H__ */ diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h new file mode 100644 index 0000000..b4d79c7 --- /dev/null +++ b/cogl/cogl-types.h @@ -0,0 +1,925 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TYPES_H__ +#define __COGL_TYPES_H__ + +#include +#include + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif /* COGL_HAS_GTYPE_SUPPORT */ + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +#define COGL_BEGIN_DECLS extern "C" { +#define COGL_END_DECLS } +#else +#define COGL_BEGIN_DECLS +#define COGL_END_DECLS +#endif + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-types + * @short_description: Types used throughout the library + * + * General types used by various Cogl functions. +*/ + +/** + * CoglBool: + * + * A boolean data type used throughout the Cogl C api. This should be + * used in conjunction with the %TRUE and %FALSE macro defines for + * setting and testing boolean values. + * + * Since: 2.0 + * Stability: stable + */ +typedef int CoglBool; + +/** + * TRUE: + * + * A constant to be used with #CoglBool types to indicate a boolean in + * the "true" state. + * + * Since: 2.0 + * Stability: stable + */ +#ifndef TRUE +#define TRUE 1 +#endif + +/** + * FALSE: + * + * A constant to be used with #CoglBool types to indicate a boolean in + * the "false" state. + * + * Since: 2.0 + * Stability: stable + */ +#ifndef FALSE +#define FALSE 0 +#endif + +#if __GNUC__ >= 4 +#define COGL_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define COGL_GNUC_NULL_TERMINATED +#endif + +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && \ + !defined (COGL_COMPILATION) +#define COGL_GNUC_DEPRECATED \ + __attribute__((__deprecated__)) +#else +#define COGL_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +/* Some structures are meant to be opaque but they have public + definitions because we want the size to be public so they can be + allocated on the stack. This macro is used to ensure that users + don't accidentally access private members */ +#ifdef COGL_COMPILATION +#define COGL_PRIVATE(x) x +#else +#define COGL_PRIVATE(x) private_member_ ## x +#endif + +/* To help catch accidental changes to public structs that should + * be stack allocated we use this macro to compile time assert that + * a struct size is as expected. + */ +#define COGL_STRUCT_SIZE_ASSERT(TYPE, SIZE) \ +typedef struct { \ + char compile_time_assert_ ## TYPE ## _size[ \ + (sizeof (TYPE) == (SIZE)) ? 1 : -1]; \ + } _ ## TYPE ## SizeCheck + +/** + * CoglHandle: + * + * Type used for storing references to cogl objects, the CoglHandle is + * a fully opaque type without any public data members. + */ +typedef void * CoglHandle; + +/** + * COGL_INVALID_HANDLE: + * + * A COGL handle that is not valid, used for unitialized handles as well as + * error conditions. + */ +#define COGL_INVALID_HANDLE NULL + +#ifdef COGL_HAS_GTYPE_SUPPORT + +#define COGL_TYPE_HANDLE (cogl_handle_get_type ()) +GType +cogl_handle_get_type (void) G_GNUC_CONST; + +#endif /* COGL_HAS_GTYPE_SUPPORT */ + +/** + * cogl_handle_ref: + * @handle: a #CoglHandle + * + * Increases the reference count of @handle by 1 + * + * Return value: (transfer none): the handle, with its reference count increased + */ +CoglHandle +cogl_handle_ref (CoglHandle handle); + +/** + * cogl_handle_unref: + * @handle: a #CoglHandle + * + * Drecreases the reference count of @handle by 1; if the reference + * count reaches 0, the resources allocated by @handle will be freed + */ +void +cogl_handle_unref (CoglHandle handle); + +/** + * CoglFuncPtr: + * + * The type used by cogl for function pointers, note that this type + * is used as a generic catch-all cast for function pointers and the + * actual arguments and return type may be different. + */ +typedef void (* CoglFuncPtr) (void); + +/* We forward declare this in cogl-types to avoid circular dependencies + * between cogl-matrix.h, cogl-euler.h and cogl-quaterion.h */ +typedef struct _CoglMatrix CoglMatrix; + +/* Same as above we forward declared CoglQuaternion to avoid + * circular dependencies. */ +typedef struct _CoglQuaternion CoglQuaternion; + +/* Same as above we forward declared CoglEuler to avoid + * circular dependencies. */ +typedef struct _CoglEuler CoglEuler; + +/** + * CoglFixed: + * + * Fixed point number using a (16.16) notation. + */ +typedef int32_t CoglFixed; + +#define COGL_TYPE_FIXED (cogl_fixed_get_type ()) +GType +cogl_fixed_get_type (void) G_GNUC_CONST; + +/** + * CoglAngle: + * + * Integer representation of an angle such that 1024 corresponds to + * full circle (i.e., 2 * pi). + * + * Since: 1.0 + */ +typedef int32_t CoglAngle; + +typedef struct _CoglColor CoglColor; +typedef struct _CoglTextureVertex CoglTextureVertex; + +/* Enum declarations */ + +#define COGL_A_BIT (1 << 4) +#define COGL_BGR_BIT (1 << 5) +#define COGL_AFIRST_BIT (1 << 6) +#define COGL_PREMULT_BIT (1 << 7) +#define COGL_DEPTH_BIT (1 << 8) +#define COGL_STENCIL_BIT (1 << 9) + +/* XXX: Notes to those adding new formats here... + * + * First this diagram outlines how we allocate the 32bits of a + * CoglPixelFormat currently... + * + * 6 bits for flags + * |-----| + * enum unused 4 bits for the bytes-per-pixel + * and component alignment info + * |------| |-------------| |--| + * 00000000 xxxxxxxx xxxxxxSD PFBA0000 + * ^ stencil + * ^ depth + * ^ premult + * ^ alpha first + * ^ bgr order + * ^ has alpha + * + * The most awkward part about the formats is how we use the last 4 + * bits to encode the bytes per pixel and component alignment + * information. Ideally we should have had 3 bits for the bpp and a + * flag for alignment but we didn't plan for that in advance so we + * instead use a small lookup table to query the bpp and whether the + * components are byte aligned or not. + * + * The mapping is the following (see discussion on bug #660188): + * + * 0 = undefined + * 1, 8 = 1 bpp (e.g. A_8, G_8) + * 2 = 3 bpp, aligned (e.g. 888) + * 3 = 4 bpp, aligned (e.g. 8888) + * 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551) + * 7 = YUV: undefined bpp, undefined alignment + * 9 = 2 bpp, aligned + * 10 = depth, aligned (8, 16, 24, 32, 32f) + * 11 = undefined + * 12 = 3 bpp, not aligned + * 13 = 4 bpp, not aligned (e.g. 2101010) + * 14-15 = undefined + * + * Note: the gap at 10-11 is just because we wanted to maintain that + * all non-aligned formats have the third bit set in case that's + * useful later. + * + * Since we don't want to waste bits adding more and more flags, we'd + * like to see most new pixel formats that can't be represented + * uniquely with the existing flags in the least significant byte + * simply be enumerated with sequential values in the most significant + * enum byte. + * + * Note: Cogl avoids exposing any padded XRGB or RGBX formats and + * instead we leave it up to applications to decided whether they + * consider the A component as padding or valid data. We shouldn't + * change this policy without good reasoning. + * + * So to add a new format: + * 1) Use the mapping table above to figure out what to but in + * the lowest nibble. + * 2) OR in the COGL_PREMULT_BIT, COGL_AFIRST_BIT, COGL_A_BIT and + * COGL_BGR_BIT flags as appropriate. + * 3) If the result is not yet unique then also combine with an + * increment of the last sequence number in the most significant + * byte. + * + * The last sequence number used was 0 (i.e. no formats currently need + * a sequence number) + * Update this note whenever a new sequence number is used. + */ +/** + * CoglPixelFormat: + * @COGL_PIXEL_FORMAT_ANY: Any format + * @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask + * @COGL_PIXEL_FORMAT_RG_88: RG, 16 bits. Note that red-green textures + * are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised. + * See cogl_texture_set_components() for details. + * @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits + * @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits + * @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits + * @COGL_PIXEL_FORMAT_YUV: Not currently supported + * @COGL_PIXEL_FORMAT_G_8: Single luminance component + * @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits + * @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits + * @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits + * @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits + * @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits + * @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits + * @COGL_PIXEL_FORMAT_RGBA_1010102 : RGBA, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_BGRA_1010102 : BGRA, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_ARGB_2101010 : ARGB, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_ABGR_2101010 : ABGR, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits + * @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits + * @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits + * @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits + * @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits + * @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits + * @COGL_PIXEL_FORMAT_RGBA_1010102_PRE: Premultiplied RGBA, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc + * @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc + * + * Pixel formats used by Cogl. For the formats with a byte per + * component, the order of the components specify the order in + * increasing memory addresses. So for example + * %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the + * lowest address, green in the next address and blue after that + * regardless of the endianness of the system. + * + * For the formats with non byte aligned components the component + * order specifies the order within a 16-bit or 32-bit number from + * most significant bit to least significant. So for + * %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits + * 11-15, the green component would be in 6-11 and the blue component + * would be in 1-5. Therefore the order in memory depends on the + * endianness of the system. + * + * When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the + * internal format. Cogl will try to pick the best format to use + * internally and convert the texture data if necessary. + * + * Since: 0.8 + */ +typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/ + COGL_PIXEL_FORMAT_ANY = 0, + COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT, + + COGL_PIXEL_FORMAT_RGB_565 = 4, + COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT, + COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT, + COGL_PIXEL_FORMAT_YUV = 7, + COGL_PIXEL_FORMAT_G_8 = 8, + + COGL_PIXEL_FORMAT_RG_88 = 9, + + COGL_PIXEL_FORMAT_RGB_888 = 2, + COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT), + + COGL_PIXEL_FORMAT_RGBA_8888 = (3 | COGL_A_BIT), + COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_BIT | COGL_AFIRST_BIT), + COGL_PIXEL_FORMAT_ABGR_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), + + COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT), + COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT), + COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), + + COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT), + COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT), + COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), + COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT), + + COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT), + COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT), + + COGL_PIXEL_FORMAT_DEPTH_16 = (9 | COGL_DEPTH_BIT), + COGL_PIXEL_FORMAT_DEPTH_32 = (3 | COGL_DEPTH_BIT), + + COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT) +} CoglPixelFormat; + +/** + * CoglFeatureFlags: + * @COGL_FEATURE_TEXTURE_RECTANGLE: ARB_texture_rectangle support + * @COGL_FEATURE_TEXTURE_NPOT: Non power of two textures are supported + * by the hardware. This is a equivalent to the + * %COGL_FEATURE_TEXTURE_NPOT_BASIC, %COGL_FEATURE_TEXTURE_NPOT_MIPMAP + * and %COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined. + * @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support + * @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support + * @COGL_FEATURE_SHADERS_GLSL: GLSL support + * @COGL_FEATURE_SHADERS_ARBFP: ARBFP support + * @COGL_FEATURE_OFFSCREEN: FBO support + * @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs + * @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs + * @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available + * @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support + * @COGL_FEATURE_VBOS: VBO support + * @COGL_FEATURE_PBOS: PBO support + * @COGL_FEATURE_UNSIGNED_INT_INDICES: Set if + * %COGL_INDICES_TYPE_UNSIGNED_INT is supported in + * cogl_vertex_buffer_indices_new(). + * @COGL_FEATURE_DEPTH_RANGE: cogl_material_set_depth_range() support + * @COGL_FEATURE_TEXTURE_NPOT_BASIC: The hardware supports non power + * of two textures, but you also need to check the + * %COGL_FEATURE_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_TEXTURE_NPOT_REPEAT + * features to know if the hardware supports npot texture mipmaps + * or repeat modes other than + * %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively. + * @COGL_FEATURE_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in + * conjuntion with non power of two textures. + * @COGL_FEATURE_TEXTURE_NPOT_REPEAT: Repeat modes other than + * %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the + * hardware. + * @COGL_FEATURE_POINT_SPRITE: Whether + * cogl_material_set_layer_point_sprite_coords_enabled() is supported. + * @COGL_FEATURE_TEXTURE_3D: 3D texture support + * @COGL_FEATURE_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is + * supported with CoglBufferAccess including read support. + * @COGL_FEATURE_MAP_BUFFER_FOR_WRITE: Whether cogl_buffer_map() is + * supported with CoglBufferAccess including write support. + * @COGL_FEATURE_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering the + * depth buffer to a texture. + * + * Flags for the supported features. + * + * Since: 0.8 + */ +typedef enum +{ + COGL_FEATURE_TEXTURE_RECTANGLE = (1 << 1), + COGL_FEATURE_TEXTURE_NPOT = (1 << 2), + COGL_FEATURE_TEXTURE_YUV = (1 << 3), + COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4), + COGL_FEATURE_SHADERS_GLSL = (1 << 5), + COGL_FEATURE_OFFSCREEN = (1 << 6), + COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7), + COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8), + COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9), + COGL_FEATURE_STENCIL_BUFFER = (1 << 10), + COGL_FEATURE_VBOS = (1 << 11), + COGL_FEATURE_PBOS = (1 << 12), + COGL_FEATURE_UNSIGNED_INT_INDICES = (1 << 13), + COGL_FEATURE_DEPTH_RANGE = (1 << 14), + COGL_FEATURE_TEXTURE_NPOT_BASIC = (1 << 15), + COGL_FEATURE_TEXTURE_NPOT_MIPMAP = (1 << 16), + COGL_FEATURE_TEXTURE_NPOT_REPEAT = (1 << 17), + COGL_FEATURE_POINT_SPRITE = (1 << 18), + COGL_FEATURE_TEXTURE_3D = (1 << 19), + COGL_FEATURE_SHADERS_ARBFP = (1 << 20), + COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21), + COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22), + COGL_FEATURE_ONSCREEN_MULTIPLE = (1 << 23), + COGL_FEATURE_DEPTH_TEXTURE = (1 << 24) +} CoglFeatureFlags; + +/** + * CoglBufferTarget: + * @COGL_WINDOW_BUFFER: FIXME + * @COGL_OFFSCREEN_BUFFER: FIXME + * + * Target flags for FBOs. + * + * Since: 0.8 + */ +typedef enum +{ + COGL_WINDOW_BUFFER = (1 << 1), + COGL_OFFSCREEN_BUFFER = (1 << 2) +} CoglBufferTarget; + +/** + * CoglColor: + * @red: amount of red + * @green: amount of green + * @blue: amount of green + * @alpha: alpha + * + * A structure for holding a color definition. The contents of + * the CoglColor structure are private and should never by accessed + * directly. + * + * Since: 1.0 + */ +struct _CoglColor +{ + /*< private >*/ + uint8_t COGL_PRIVATE (red); + uint8_t COGL_PRIVATE (green); + uint8_t COGL_PRIVATE (blue); + + uint8_t COGL_PRIVATE (alpha); + + /* padding in case we want to change to floats at + * some point */ + uint32_t COGL_PRIVATE (padding0); + uint32_t COGL_PRIVATE (padding1); + uint32_t COGL_PRIVATE (padding2); +}; +COGL_STRUCT_SIZE_ASSERT (CoglColor, 16); + +/** + * CoglTextureVertex: + * @x: Model x-coordinate + * @y: Model y-coordinate + * @z: Model z-coordinate + * @tx: Texture x-coordinate + * @ty: Texture y-coordinate + * @color: The color to use at this vertex. This is ignored if + * use_color is %FALSE when calling cogl_polygon() + * + * Used to specify vertex information when calling cogl_polygon() + */ +struct _CoglTextureVertex +{ + float x, y, z; + float tx, ty; + + CoglColor color; +}; +COGL_STRUCT_SIZE_ASSERT (CoglTextureVertex, 36); + +/** + * CoglTextureFlags: + * @COGL_TEXTURE_NONE: No flags specified + * @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of + * the mipmap pyramid from the base level image whenever it is + * updated. The mipmaps are only generated when the texture is + * rendered with a mipmap filter so it should be free to leave out + * this flag when using other filtering modes + * @COGL_TEXTURE_NO_SLICING: Disables the slicing of the texture + * @COGL_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside + * the texture atlas used by Cogl + * + * Flags to pass to the cogl_texture_new_* family of functions. + * + * Since: 1.0 + */ +typedef enum { + COGL_TEXTURE_NONE = 0, + COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0, + COGL_TEXTURE_NO_SLICING = 1 << 1, + COGL_TEXTURE_NO_ATLAS = 1 << 2 +} CoglTextureFlags; + +/** + * CoglFogMode: + * @COGL_FOG_MODE_LINEAR: Calculates the fog blend factor as: + * |[ + * f = end - eye_distance / end - start + * ]| + * @COGL_FOG_MODE_EXPONENTIAL: Calculates the fog blend factor as: + * |[ + * f = e ^ -(density * eye_distance) + * ]| + * @COGL_FOG_MODE_EXPONENTIAL_SQUARED: Calculates the fog blend factor as: + * |[ + * f = e ^ -(density * eye_distance)^2 + * ]| + * + * The fog mode determines the equation used to calculate the fogging blend + * factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode + * determines f as: + * + * |[ + * f = end - eye_distance / end - start + * ]| + * + * Where eye_distance is the distance of the current fragment in eye + * coordinates from the origin. + * + * Since: 1.0 + */ +typedef enum { + COGL_FOG_MODE_LINEAR, + COGL_FOG_MODE_EXPONENTIAL, + COGL_FOG_MODE_EXPONENTIAL_SQUARED +} CoglFogMode; + +/** + * COGL_BLEND_STRING_ERROR: + * + * #CoglError domain for blend string parser errors + * + * Since: 1.0 + */ +#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ()) + +/** + * CoglBlendStringError: + * @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error + * @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error + * @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error + * @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not + * supported by the GPU + * + * Error enumeration for the blend strings parser + * + * Since: 1.0 + */ +typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/ + COGL_BLEND_STRING_ERROR_PARSE_ERROR, + COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, + COGL_BLEND_STRING_ERROR_INVALID_ERROR, + COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR +} CoglBlendStringError; + +uint32_t +cogl_blend_string_error_quark (void); + +#define COGL_SYSTEM_ERROR (_cogl_system_error_quark ()) + +/** + * CoglSystemError: + * @COGL_SYSTEM_ERROR_UNSUPPORTED: You tried to use a feature or + * configuration not currently available. + * @COGL_SYSTEM_ERROR_NO_MEMORY: You tried to allocate a resource + * such as a texture and there wasn't enough memory. + * + * Error enumeration for Cogl + * + * The @COGL_SYSTEM_ERROR_UNSUPPORTED error can be thrown for a + * variety of reasons. For example: + * + * + * You've tried to use a feature that is not + * advertised by cogl_has_feature(). This could happen if you create + * a 2d texture with a non-power-of-two size when + * %COGL_FEATURE_ID_TEXTURE_NPOT is not advertised. + * The GPU can not handle the configuration you have + * requested. An example might be if you try to use too many texture + * layers in a single #CoglPipeline + * The driver does not support some + * configuration. + * + * + * Currently this is only used by Cogl API marked as experimental so + * this enum should also be considered experimental. + * + * Since: 1.4 + * Stability: unstable + */ +typedef enum { /*< prefix=COGL_ERROR >*/ + COGL_SYSTEM_ERROR_UNSUPPORTED, + COGL_SYSTEM_ERROR_NO_MEMORY +} CoglSystemError; + +uint32_t +_cogl_system_error_quark (void); + +/** + * CoglAttributeType: + * @COGL_ATTRIBUTE_TYPE_BYTE: Data is the same size of a byte + * @COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE: Data is the same size of an + * unsigned byte + * @COGL_ATTRIBUTE_TYPE_SHORT: Data is the same size of a short integer + * @COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT: Data is the same size of + * an unsigned short integer + * @COGL_ATTRIBUTE_TYPE_FLOAT: Data is the same size of a float + * + * Data types for the components of a vertex attribute. + * + * Since: 1.0 + */ +typedef enum { + COGL_ATTRIBUTE_TYPE_BYTE = 0x1400, + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE = 0x1401, + COGL_ATTRIBUTE_TYPE_SHORT = 0x1402, + COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT = 0x1403, + COGL_ATTRIBUTE_TYPE_FLOAT = 0x1406 +} CoglAttributeType; + +/** + * CoglIndicesType: + * @COGL_INDICES_TYPE_UNSIGNED_BYTE: Your indices are unsigned bytes + * @COGL_INDICES_TYPE_UNSIGNED_SHORT: Your indices are unsigned shorts + * @COGL_INDICES_TYPE_UNSIGNED_INT: Your indices are unsigned ints + * + * You should aim to use the smallest data type that gives you enough + * range, since it reduces the size of your index array and can help + * reduce the demand on memory bandwidth. + * + * Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the + * %COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This + * should always be available on OpenGL but on OpenGL ES it will only + * be available if the GL_OES_element_index_uint extension is + * advertized. + */ +typedef enum { + COGL_INDICES_TYPE_UNSIGNED_BYTE, + COGL_INDICES_TYPE_UNSIGNED_SHORT, + COGL_INDICES_TYPE_UNSIGNED_INT +} CoglIndicesType; + +/** + * CoglVerticesMode: + * @COGL_VERTICES_MODE_POINTS: FIXME, equivalent to + * GL_POINTS + * @COGL_VERTICES_MODE_LINES: FIXME, equivalent to GL_LINES + * @COGL_VERTICES_MODE_LINE_LOOP: FIXME, equivalent to + * GL_LINE_LOOP + * @COGL_VERTICES_MODE_LINE_STRIP: FIXME, equivalent to + * GL_LINE_STRIP + * @COGL_VERTICES_MODE_TRIANGLES: FIXME, equivalent to + * GL_TRIANGLES + * @COGL_VERTICES_MODE_TRIANGLE_STRIP: FIXME, equivalent to + * GL_TRIANGLE_STRIP + * @COGL_VERTICES_MODE_TRIANGLE_FAN: FIXME, equivalent to GL_TRIANGLE_FAN + * + * Different ways of interpreting vertices when drawing. + * + * Since: 1.0 + */ +typedef enum { + COGL_VERTICES_MODE_POINTS = 0x0000, + COGL_VERTICES_MODE_LINES = 0x0001, + COGL_VERTICES_MODE_LINE_LOOP = 0x0002, + COGL_VERTICES_MODE_LINE_STRIP = 0x0003, + COGL_VERTICES_MODE_TRIANGLES = 0x0004, + COGL_VERTICES_MODE_TRIANGLE_STRIP = 0x0005, + COGL_VERTICES_MODE_TRIANGLE_FAN = 0x0006 +} CoglVerticesMode; + +/* NB: The above definitions are taken from gl.h equivalents */ + + +/* XXX: should this be CoglMaterialDepthTestFunction? + * It makes it very verbose but would be consistent with + * CoglMaterialWrapMode */ + +/** + * CoglDepthTestFunction: + * @COGL_DEPTH_TEST_FUNCTION_NEVER: Never passes. + * @COGL_DEPTH_TEST_FUNCTION_LESS: Passes if the fragment's depth + * value is less than the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_EQUAL: Passes if the fragment's depth + * value is equal to the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_LEQUAL: Passes if the fragment's depth + * value is less or equal to the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_GREATER: Passes if the fragment's depth + * value is greater than the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_NOTEQUAL: Passes if the fragment's depth + * value is not equal to the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_GEQUAL: Passes if the fragment's depth + * value greater than or equal to the value currently in the depth buffer. + * @COGL_DEPTH_TEST_FUNCTION_ALWAYS: Always passes. + * + * When using depth testing one of these functions is used to compare + * the depth of an incoming fragment against the depth value currently + * stored in the depth buffer. The function is changed using + * cogl_depth_state_set_test_function(). + * + * The test is only done when depth testing is explicitly enabled. (See + * cogl_depth_state_set_test_enabled()) + */ +typedef enum { + COGL_DEPTH_TEST_FUNCTION_NEVER = 0x0200, + COGL_DEPTH_TEST_FUNCTION_LESS = 0x0201, + COGL_DEPTH_TEST_FUNCTION_EQUAL = 0x0202, + COGL_DEPTH_TEST_FUNCTION_LEQUAL = 0x0203, + COGL_DEPTH_TEST_FUNCTION_GREATER = 0x0204, + COGL_DEPTH_TEST_FUNCTION_NOTEQUAL = 0x0205, + COGL_DEPTH_TEST_FUNCTION_GEQUAL = 0x0206, + COGL_DEPTH_TEST_FUNCTION_ALWAYS = 0x0207 +} CoglDepthTestFunction; +/* NB: The above definitions are taken from gl.h equivalents */ + +typedef enum { /*< prefix=COGL_RENDERER_ERROR >*/ + COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN, + COGL_RENDERER_ERROR_BAD_CONSTRAINT +} CoglRendererError; + +/** + * CoglFilterReturn: + * @COGL_FILTER_CONTINUE: The event was not handled, continues the + * processing + * @COGL_FILTER_REMOVE: Remove the event, stops the processing + * + * Return values for the #CoglXlibFilterFunc and #CoglWin32FilterFunc functions. + * + * Stability: Unstable + */ +typedef enum _CoglFilterReturn { /*< prefix=COGL_FILTER >*/ + COGL_FILTER_CONTINUE, + COGL_FILTER_REMOVE +} CoglFilterReturn; + +typedef enum _CoglWinsysFeature +{ + /* Available if the window system can support multiple onscreen + * framebuffers at the same time. */ + COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, + + /* Available if onscreen framebuffer swaps can be automatically + * throttled to the vblank frequency. */ + COGL_WINSYS_FEATURE_SWAP_THROTTLE, + + /* Available if its possible to query a counter that + * increments at each vblank. */ + COGL_WINSYS_FEATURE_VBLANK_COUNTER, + + /* Available if its possible to wait until the next vertical + * blank period */ + COGL_WINSYS_FEATURE_VBLANK_WAIT, + + /* Available if the window system supports mapping native + * pixmaps to textures. */ + COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP, + + /* Available if the window system supports reporting an event + * for swap buffer completions. */ + COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, + + /* Available if it's possible to swap a list of sub rectangles + * from the back buffer to the front buffer */ + COGL_WINSYS_FEATURE_SWAP_REGION, + + /* Available if swap_region requests can be automatically throttled + * to the vblank frequency. */ + COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, + + /* Available if the swap region implementation won't tear and thus + * only needs to be throttled to the framerate */ + COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED, + + /* Avaiable if the age of the back buffer can be queried */ + COGL_WINSYS_FEATURE_BUFFER_AGE, + + /* Avaiable if the winsys directly handles _SYNC and _COMPLETE events */ + COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT, + + COGL_WINSYS_FEATURE_N_FEATURES +} CoglWinsysFeature; + +/** + * CoglColorMask: + * @COGL_COLOR_MASK_NONE: None of the color channels are masked + * @COGL_COLOR_MASK_RED: Masks the red color channel + * @COGL_COLOR_MASK_GREEN: Masks the green color channel + * @COGL_COLOR_MASK_BLUE: Masks the blue color channel + * @COGL_COLOR_MASK_ALPHA: Masks the alpha color channel + * @COGL_COLOR_MASK_ALL: All of the color channels are masked + * + * Defines a bit mask of color channels. This can be used with + * cogl_pipeline_set_color_mask() for example to define which color + * channels should be written to the current framebuffer when + * drawing something. + */ +typedef enum +{ + COGL_COLOR_MASK_NONE = 0, + COGL_COLOR_MASK_RED = 1L<<0, + COGL_COLOR_MASK_GREEN = 1L<<1, + COGL_COLOR_MASK_BLUE = 1L<<2, + COGL_COLOR_MASK_ALPHA = 1L<<3, + /* XXX: glib-mkenums is a perl script that can't cope if we split + * this onto multiple lines! *sigh* */ + COGL_COLOR_MASK_ALL = (COGL_COLOR_MASK_RED | COGL_COLOR_MASK_GREEN | COGL_COLOR_MASK_BLUE | COGL_COLOR_MASK_ALPHA) +} CoglColorMask; + +/** + * CoglWinding: + * @COGL_WINDING_CLOCKWISE: Vertices are in a clockwise order + * @COGL_WINDING_COUNTER_CLOCKWISE: Vertices are in a counter-clockwise order + * + * Enum used to represent the two directions of rotation. This can be + * used to set the front face for culling by calling + * cogl_pipeline_set_front_face_winding(). + */ +typedef enum +{ + COGL_WINDING_CLOCKWISE, + COGL_WINDING_COUNTER_CLOCKWISE +} CoglWinding; + +/** + * CoglBufferBit: + * @COGL_BUFFER_BIT_COLOR: Selects the primary color buffer + * @COGL_BUFFER_BIT_DEPTH: Selects the depth buffer + * @COGL_BUFFER_BIT_STENCIL: Selects the stencil buffer + * + * Types of auxiliary buffers + * + * Since: 1.0 + */ +typedef enum { + COGL_BUFFER_BIT_COLOR = 1L<<0, + COGL_BUFFER_BIT_DEPTH = 1L<<1, + COGL_BUFFER_BIT_STENCIL = 1L<<2 +} CoglBufferBit; + +/** + * CoglReadPixelsFlags: + * @COGL_READ_PIXELS_COLOR_BUFFER: Read from the color buffer + * + * Flags for cogl_framebuffer_read_pixels_into_bitmap() + * + * Since: 1.0 + */ +typedef enum { /*< prefix=COGL_READ_PIXELS >*/ + COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0 +} CoglReadPixelsFlags; + +COGL_END_DECLS + +#endif /* __COGL_TYPES_H__ */ diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c new file mode 100644 index 0000000..a8a6504 --- /dev/null +++ b/cogl/cogl-util.c @@ -0,0 +1,286 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-private.h" + +/* + * cogl_util_next_p2: + * @a: Value to get the next power of two + * + * Calculates the next power of two greater than or equal to @a. + * + * Return value: @a if @a is already a power of two, otherwise returns + * the next nearest power of two. + */ +int +_cogl_util_next_p2 (int a) +{ + int rval = 1; + + while (rval < a) + rval <<= 1; + + return rval; +} + +unsigned int +_cogl_util_one_at_a_time_mix (unsigned int hash) +{ + hash += ( hash << 3 ); + hash ^= ( hash >> 11 ); + hash += ( hash << 15 ); + + return hash; +} + +/* The 'ffs' function is part of C99 so it isn't always available */ +#ifndef HAVE_FFS + +int +_cogl_util_ffs (int num) +{ + int i = 1; + + if (num == 0) + return 0; + + while ((num & 1) == 0) + { + num >>= 1; + i++; + } + + return i; +} +#endif /* HAVE_FFS */ + +/* The 'ffsl' is non-standard but when building with GCC we'll use its + builtin instead */ +#ifndef COGL_UTIL_HAVE_BUILTIN_FFSL + +int +_cogl_util_ffsl_wrapper (long int num) +{ + int i = 1; + + if (num == 0) + return 0; + + while ((num & 1) == 0) + { + num >>= 1; + i++; + } + + return i; +} + +#endif /* COGL_UTIL_HAVE_BUILTIN_FFSL */ + +#ifndef COGL_UTIL_HAVE_BUILTIN_POPCOUNTL + +const unsigned char +_cogl_util_popcount_table[256] = + { + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, + 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, + 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, + 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, + 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, + 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 + }; + +#endif /* COGL_UTIL_HAVE_BUILTIN_POPCOUNTL */ + +/* tests/conform/test-bitmask.c tests some cogl internals and includes this + * file directly but since these functions depend on other internal Cogl + * symbols we hide them from test-bitmask.c + * + * XXX: maybe there's a better way for us to handle internal testing + * to avoid needing hacks like this. + */ +#ifndef _COGL_IN_TEST_BITMASK + +/* Given a set of red, green and blue component masks, a depth and + * bits per pixel this function tries to determine a corresponding + * CoglPixelFormat. + * + * The depth is measured in bits not including padding for un-used + * alpha. The bits per pixel (bpp) does include padding for un-used + * alpha. + * + * This function firstly aims to match formats with RGB ordered + * components and only considers alpha coming first, in the most + * significant bits. If the function fails to match then it recurses + * by either switching the r and b masks around to check for BGR + * ordered formats or it recurses with the masks shifted to check for + * formats where the alpha component is the least significant bits. + */ +static CoglPixelFormat +_cogl_util_pixel_format_from_masks_real (unsigned long r_mask, + unsigned long g_mask, + unsigned long b_mask, + int depth, int bpp, + CoglBool check_bgr, + CoglBool check_afirst, + int recursion_depth) +{ + CoglPixelFormat image_format; + + if (depth == 24 && bpp == 24 && + r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) + { + return COGL_PIXEL_FORMAT_RGB_888; + } + else if ((depth == 24 || depth == 32) && bpp == 32 && + r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) + { + return COGL_PIXEL_FORMAT_ARGB_8888_PRE; + } + else if ((depth == 30 || depth == 32) && + r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff) + { + return COGL_PIXEL_FORMAT_ARGB_2101010_PRE; + } + else if (depth == 16 && bpp == 16 && + r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f) + { + return COGL_PIXEL_FORMAT_RGB_565; + } + + if (recursion_depth == 2) + return 0; + + /* Check for BGR ordering if we didn't find a match */ + if (check_bgr) + { + image_format = + _cogl_util_pixel_format_from_masks_real (b_mask, g_mask, r_mask, + depth, bpp, + FALSE, + TRUE, + recursion_depth + 1); + if (image_format) + return image_format ^ COGL_BGR_BIT; + } + + /* Check for alpha in the least significant bits if we still + * haven't found a match... */ + if (check_afirst && depth != bpp) + { + int shift = bpp - depth; + + image_format = + _cogl_util_pixel_format_from_masks_real (r_mask >> shift, + g_mask >> shift, + b_mask >> shift, + depth, bpp, + TRUE, + FALSE, + recursion_depth + 1); + if (image_format) + return image_format ^ COGL_AFIRST_BIT; + } + + return 0; +} + +CoglPixelFormat +_cogl_util_pixel_format_from_masks (unsigned long r_mask, + unsigned long g_mask, + unsigned long b_mask, + int depth, int bpp, + CoglBool byte_order_is_lsb_first) +{ + CoglPixelFormat image_format = + _cogl_util_pixel_format_from_masks_real (r_mask, g_mask, b_mask, + depth, bpp, + TRUE, + TRUE, + 0); + + if (!image_format) + { + const char *byte_order[] = { "MSB first", "LSB first" }; + g_warning ("Could not find a matching pixel format for red mask=0x%lx," + "green mask=0x%lx, blue mask=0x%lx at depth=%d, bpp=%d " + "and byte order=%s\n", r_mask, g_mask, b_mask, depth, bpp, + byte_order[!!byte_order_is_lsb_first]); + return 0; + } + + /* If the image is in little-endian then the order in memory is + reversed */ + if (byte_order_is_lsb_first && + _cogl_pixel_format_is_endian_dependant (image_format)) + { + image_format ^= COGL_BGR_BIT; + if (image_format & COGL_A_BIT) + image_format ^= COGL_AFIRST_BIT; + } + + return image_format; +} + +#ifndef HAVE_MEMMEM + +char * +_cogl_util_memmem (const void *haystack, + size_t haystack_len, + const void *needle, + size_t needle_len) +{ + size_t i; + + if (needle_len > haystack_len) + return NULL; + + for (i = 0; i <= haystack_len - needle_len; i++) + if (!memcmp ((const char *) haystack + i, needle, needle_len)) + return (char *) haystack + i; + + return NULL; +} + +#endif /* HAVE_MEMMEM */ + +#endif /* _COGL_IN_TEST_BITMASK */ diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h new file mode 100644 index 0000000..6df879d --- /dev/null +++ b/cogl/cogl-util.h @@ -0,0 +1,305 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_UTIL_H +#define __COGL_UTIL_H + +#include +#include + +#include +#include "cogl-types.h" + +#ifndef COGL_HAS_GLIB_SUPPORT +#include +#endif + +/* Double check that config.h has been included */ +#if !defined (GETTEXT_PACKAGE) && !defined (_COGL_IN_TEST_BITMASK) +#error "config.h must be included before including cogl-util.h" +#endif + +/* When compiling with Visual Studio, symbols that represent data that + are exported out of the DLL need to be marked with the dllexport + attribute. */ +#ifdef _MSC_VER +#ifdef COGL_BUILD_EXP +#define COGL_EXPORT __declspec(dllexport) +#else +#define COGL_EXPORT __declspec(dllimport) +#endif +#else +#define COGL_EXPORT +#endif + +int +_cogl_util_next_p2 (int a); + +/* The signbit macro is defined by ISO C99 so it should be available, + however if it's not we can fallback to an evil hack */ +#ifdef signbit +#define cogl_util_float_signbit(x) signbit(x) +#else +/* This trick was stolen from here: + http://lists.boost.org/Archives/boost/2006/08/108731.php + + It xors the integer reinterpretations of -1.0f and 1.0f. In theory + they should only differ by the signbit so that gives a mask for the + sign which we can just test against the value */ +static inline CoglBool +cogl_util_float_signbit (float x) +{ + static const union { float f; uint32_t i; } negative_one = { -1.0f }; + static const union { float f; uint32_t i; } positive_one = { +1.0f }; + union { float f; uint32_t i; } value = { x }; + + return !!((negative_one.i ^ positive_one.i) & value.i); +} +#endif + +/* This is a replacement for the nearbyint function which always + rounds to the nearest integer. nearbyint is apparently a C99 + function so it might not always be available but also it seems in + glibc it is defined as a function call so this macro could end up + faster anyway. We can't just add 0.5f because it will break for + negative numbers. */ +#define COGL_UTIL_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f)) + +/* Returns whether the given integer is a power of two */ +static inline CoglBool +_cogl_util_is_pot (unsigned int num) +{ + /* Make sure there is only one bit set */ + return (num & (num - 1)) == 0; +} + +/* Split Bob Jenkins' One-at-a-Time hash + * + * This uses the One-at-a-Time hash algorithm designed by Bob Jenkins + * but the mixing step is split out so the function can be used in a + * more incremental fashion. + */ +static inline unsigned int +_cogl_util_one_at_a_time_hash (unsigned int hash, + const void *key, + size_t bytes) +{ + const unsigned char *p = key; + int i; + + for (i = 0; i < bytes; i++) + { + hash += p[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + + return hash; +} + +unsigned int +_cogl_util_one_at_a_time_mix (unsigned int hash); + +/* These two builtins are available since GCC 3.4 */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define COGL_UTIL_HAVE_BUILTIN_FFSL +#define COGL_UTIL_HAVE_BUILTIN_POPCOUNTL +#define COGL_UTIL_HAVE_BUILTIN_CLZ +#endif + +/* The 'ffs' function is part of C99 so it isn't always available */ +#ifdef HAVE_FFS +#define _cogl_util_ffs ffs +#else +int +_cogl_util_ffs (int num); +#endif + +/* The 'ffsl' function is non-standard but GCC has a builtin for it + since 3.4 which we can use */ +#ifdef COGL_UTIL_HAVE_BUILTIN_FFSL +#define _cogl_util_ffsl __builtin_ffsl +#else +/* If ints and longs are the same size we can just use ffs. Hopefully + the compiler will optimise away this conditional */ +#define _cogl_util_ffsl(x) \ + (sizeof (long int) == sizeof (int) ? _cogl_util_ffs ((int) x) : \ + _cogl_util_ffsl_wrapper (x)) +int +_cogl_util_ffsl_wrapper (long int num); +#endif /* COGL_UTIL_HAVE_BUILTIN_FFSL */ + +static inline unsigned int +_cogl_util_fls (unsigned int n) +{ +#ifdef COGL_UTIL_HAVE_BUILTIN_CLZ + return n == 0 ? 0 : sizeof (unsigned int) * 8 - __builtin_clz (n); +#else + unsigned int v = 1; + + if (n == 0) + return 0; + + while (n >>= 1) + v++; + + return v; +#endif +} + +#ifdef COGL_UTIL_HAVE_BUILTIN_POPCOUNTL +#define _cogl_util_popcountl __builtin_popcountl +#else +extern const unsigned char _cogl_util_popcount_table[256]; + +/* There are many ways of doing popcount but doing a table lookup + seems to be the most robust against different sizes for long. Some + pages seem to claim it's the fastest method anyway. */ +static inline int +_cogl_util_popcountl (unsigned long num) +{ + int i; + int sum = 0; + + /* Let's hope GCC will unroll this loop.. */ + for (i = 0; i < sizeof (num); i++) + sum += _cogl_util_popcount_table[(num >> (i * 8)) & 0xff]; + + return sum; +} + +#endif /* COGL_UTIL_HAVE_BUILTIN_POPCOUNTL */ + +#ifdef COGL_HAS_GLIB_SUPPORT +#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR) +#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL) +#else +#ifdef COGL_ENABLE_DEBUG +#define _COGL_RETURN_START do { +#define _COGL_RETURN_END } while (0) +#else /* COGL_ENABLE_DEBUG */ +/* If debugging is disabled then we don't actually want to do the + * check but we still want the code for the expression to be generated + * so that it won't give loads of warnings about unused variables. + * Therefore we just surround the block with if(0) */ +#define _COGL_RETURN_START do { if (0) { +#define _COGL_RETURN_END } } while (0) +#endif /* COGL_ENABLE_DEBUG */ +#define _COGL_RETURN_IF_FAIL(EXPR) _COGL_RETURN_START { \ + if (!(EXPR)) \ + { \ + fprintf (stderr, "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #EXPR); \ + return; \ + }; \ + } _COGL_RETURN_END +#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) _COGL_RETURN_START { \ + if (!(EXPR)) \ + { \ + fprintf (stderr, "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #EXPR); \ + return (VAL); \ + }; \ + } _COGL_RETURN_END +#endif /* COGL_HAS_GLIB_SUPPORT */ + +/* Match a CoglPixelFormat according to channel masks, color depth, + * bits per pixel and byte order. These information are provided by + * the Visual and XImage structures. + * + * If no specific pixel format could be found, COGL_PIXEL_FORMAT_ANY + * is returned. + */ +CoglPixelFormat +_cogl_util_pixel_format_from_masks (unsigned long r_mask, + unsigned long g_mask, + unsigned long b_mask, + int depth, int bpp, + int byte_order); + +/* Since we can't rely on _Static_assert always being available for + * all compilers we have limited static assert that can be used in + * C code but not in headers. + */ +#define _COGL_TYPEDEF_ASSERT(EXPRESSION) \ + typedef struct { char Compile_Time_Assertion[(EXPRESSION) ? 1 : -1]; } \ + G_PASTE (_GStaticAssert_, __LINE__) + +/* _COGL_STATIC_ASSERT: + * @expression: An expression to assert evaluates to true at compile + * time. + * @message: A message to print to the console if the assertion fails + * at compile time. + * + * Allows you to assert that an expression evaluates to true at + * compile time and aborts compilation if not. If possible message + * will also be printed if the assertion fails. + * + * Note: Only Gcc >= 4.6 supports the c11 _Static_assert which lets us + * print a nice message if the compile time assertion fails. + */ +#ifdef HAVE_STATIC_ASSERT +#define _COGL_STATIC_ASSERT(EXPRESSION, MESSAGE) \ + _Static_assert (EXPRESSION, MESSAGE); +#else +#define _COGL_STATIC_ASSERT(EXPRESSION, MESSAGE) +#endif + +#ifdef HAVE_MEMMEM +#define _cogl_util_memmem memmem +#else +char * +_cogl_util_memmem (const void *haystack, + size_t haystack_len, + const void *needle, + size_t needle_len); +#endif + +static inline void +_cogl_util_scissor_intersect (int rect_x0, + int rect_y0, + int rect_x1, + int rect_y1, + int *scissor_x0, + int *scissor_y0, + int *scissor_x1, + int *scissor_y1) +{ + *scissor_x0 = MAX (*scissor_x0, rect_x0); + *scissor_y0 = MAX (*scissor_y0, rect_y0); + *scissor_x1 = MIN (*scissor_x1, rect_x1); + *scissor_y1 = MIN (*scissor_y1, rect_y1); +} + +#endif /* __COGL_UTIL_H */ diff --git a/cogl/cogl-vector.c b/cogl/cogl-vector.c new file mode 100644 index 0000000..9da94af --- /dev/null +++ b/cogl/cogl-vector.c @@ -0,0 +1,300 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include +#include +#include + +#define X 0 +#define Y 1 +#define Z 2 +#define W 3 + +void +cogl_vector3_init (float *vector, float x, float y, float z) +{ + vector[X] = x; + vector[Y] = y; + vector[Z] = z; +} + +void +cogl_vector3_init_zero (float *vector) +{ + memset (vector, 0, sizeof (float) * 3); +} + +CoglBool +cogl_vector3_equal (const void *v1, const void *v2) +{ + float *vector0 = (float *)v1; + float *vector1 = (float *)v2; + + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + /* There's no point picking an arbitrary epsilon that's appropriate + * for comparing the components so we just use == that will at least + * consider -0 and 0 to be equal. */ + return + vector0[X] == vector1[X] && + vector0[Y] == vector1[Y] && + vector0[Z] == vector1[Z]; +} + +CoglBool +cogl_vector3_equal_with_epsilon (const float *vector0, + const float *vector1, + float epsilon) +{ + _COGL_RETURN_VAL_IF_FAIL (vector0 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (vector1 != NULL, FALSE); + + if (fabsf (vector0[X] - vector1[X]) < epsilon && + fabsf (vector0[Y] - vector1[Y]) < epsilon && + fabsf (vector0[Z] - vector1[Z]) < epsilon) + return TRUE; + else + return FALSE; +} + +float * +cogl_vector3_copy (const float *vector) +{ + if (vector) + return g_slice_copy (sizeof (float) * 3, vector); + return NULL; +} + +void +cogl_vector3_free (float *vector) +{ + g_slice_free1 (sizeof (float) * 3, vector); +} + +void +cogl_vector3_invert (float *vector) +{ + vector[X] = -vector[X]; + vector[Y] = -vector[Y]; + vector[Z] = -vector[Z]; +} + +void +cogl_vector3_add (float *result, + const float *a, + const float *b) +{ + result[X] = a[X] + b[X]; + result[Y] = a[Y] + b[Y]; + result[Z] = a[Z] + b[Z]; +} + +void +cogl_vector3_subtract (float *result, + const float *a, + const float *b) +{ + result[X] = a[X] - b[X]; + result[Y] = a[Y] - b[Y]; + result[Z] = a[Z] - b[Z]; +} + +void +cogl_vector3_multiply_scalar (float *vector, + float scalar) +{ + vector[X] *= scalar; + vector[Y] *= scalar; + vector[Z] *= scalar; +} + +void +cogl_vector3_divide_scalar (float *vector, + float scalar) +{ + float one_over_scalar = 1.0f / scalar; + vector[X] *= one_over_scalar; + vector[Y] *= one_over_scalar; + vector[Z] *= one_over_scalar; +} + +void +cogl_vector3_normalize (float *vector) +{ + float mag_squared = + vector[X] * vector[X] + + vector[Y] * vector[Y] + + vector[Z] * vector[Z]; + + if (mag_squared > 0.0f) + { + float one_over_mag = 1.0f / sqrtf (mag_squared); + vector[X] *= one_over_mag; + vector[Y] *= one_over_mag; + vector[Z] *= one_over_mag; + } +} + +float +cogl_vector3_magnitude (const float *vector) +{ + return sqrtf (vector[X] * vector[X] + + vector[Y] * vector[Y] + + vector[Z] * vector[Z]); +} + +void +cogl_vector3_cross_product (float *result, + const float *a, + const float *b) +{ + float tmp[3]; + + tmp[X] = a[Y] * b[Z] - a[Z] * b[Y]; + tmp[Y] = a[Z] * b[X] - a[X] * b[Z]; + tmp[Z] = a[X] * b[Y] - a[Y] * b[X]; + result[X] = tmp[X]; + result[Y] = tmp[Y]; + result[Z] = tmp[Z]; +} + +float +cogl_vector3_dot_product (const float *a, const float *b) +{ + return a[X] * b[X] + a[Y] * b[Y] + a[Z] * b[Z]; +} + +float +cogl_vector3_distance (const float *a, const float *b) +{ + float dx = b[X] - a[X]; + float dy = b[Y] - a[Y]; + float dz = b[Z] - a[Z]; + + return sqrtf (dx * dx + dy * dy + dz * dz); +} + +#if 0 +void +cogl_vector4_init (float *vector, float x, float y, float z) +{ + vector[X] = x; + vector[Y] = y; + vector[Z] = z; + vector[W] = w; +} + +void +cogl_vector4_init_zero (float *vector) +{ + memset (vector, 0, sizeof (CoglVector4)); +} + +void +cogl_vector4_init_from_vector4 (float *vector, float *src) +{ + *vector4 = *src; +} + +CoglBool +cogl_vector4_equal (const void *v0, const void *v1) +{ + _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); + _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); + + return memcmp (v1, v2, sizeof (float) * 4) == 0 ? TRUE : FALSE; +} + +float * +cogl_vector4_copy (float *vector) +{ + if (vector) + return g_slice_dup (CoglVector4, vector); + return NULL; +} + +void +cogl_vector4_free (float *vector) +{ + g_slice_free (CoglVector4, vector); +} + +void +cogl_vector4_invert (float *vector) +{ + vector.x = -vector.x; + vector.y = -vector.y; + vector.z = -vector.z; + vector.w = -vector.w; +} + +void +cogl_vector4_add (float *result, + float *a, + float *b) +{ + result.x = a.x + b.x; + result.y = a.y + b.y; + result.z = a.z + b.z; + result.w = a.w + b.w; +} + +void +cogl_vector4_subtract (float *result, + float *a, + float *b) +{ + result.x = a.x - b.x; + result.y = a.y - b.y; + result.z = a.z - b.z; + result.w = a.w - b.w; +} + +void +cogl_vector4_divide (float *vector, + float scalar) +{ + float one_over_scalar = 1.0f / scalar; + result.x *= one_over_scalar; + result.y *= one_over_scalar; + result.z *= one_over_scalar; + result.w *= one_over_scalar; +} + +#endif diff --git a/cogl/cogl-vector.h b/cogl/cogl-vector.h new file mode 100644 index 0000000..08cf017 --- /dev/null +++ b/cogl/cogl-vector.h @@ -0,0 +1,356 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_VECTOR_H +#define __COGL_VECTOR_H + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-vector + * @short_description: Functions for handling single precision float + * vectors. + * + * This exposes a utility API that can be used for basic manipulation of 3 + * component float vectors. + */ + +/** + * cogl_vector3_init: + * @vector: The 3 component vector you want to initialize + * @x: The x component + * @y: The y component + * @z: The z component + * + * Initializes a 3 component, single precision float vector which can + * then be manipulated with the cogl_vector convenience APIs. Vectors + * can also be used in places where a "point" is often desired. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_init (float *vector, float x, float y, float z); + +/** + * cogl_vector3_init_zero: + * @vector: The 3 component vector you want to initialize + * + * Initializes a 3 component, single precision float vector with zero + * for each component. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_init_zero (float *vector); + +/** + * cogl_vector3_equal: + * @v1: The first 3 component vector you want to compare + * @v2: The second 3 component vector you want to compare + * + * Compares the components of two vectors and returns TRUE if they are + * the same. + * + * The comparison of the components is done with the '==' operator + * such that -0 is considered equal to 0, but otherwise there is no + * fuzziness such as an epsilon to consider vectors that are + * essentially identical except for some minor precision error + * differences due to the way they have been manipulated. + * + * Returns: TRUE if the vectors are equal else FALSE. + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_vector3_equal (const void *v1, const void *v2); + +/** + * cogl_vector3_equal_with_epsilon: + * @vector0: The first 3 component vector you want to compare + * @vector1: The second 3 component vector you want to compare + * @epsilon: The allowable difference between components to still be + * considered equal + * + * Compares the components of two vectors using the given epsilon and + * returns TRUE if they are the same, using an internal epsilon for + * comparing the floats. + * + * Each component is compared against the epsilon value in this way: + * |[ + * if (fabsf (vector0->x - vector1->x) < epsilon) + * ]| + * + * Returns: TRUE if the vectors are equal else FALSE. + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_vector3_equal_with_epsilon (const float *vector0, + const float *vector1, + float epsilon); + +/** + * cogl_vector3_copy: + * @vector: The 3 component vector you want to copy + * + * Allocates a new 3 component float vector on the heap initializing + * the components from the given @vector and returns a pointer to the + * newly allocated vector. You should free the memory using + * cogl_vector3_free() + * + * Returns: A newly allocated 3 component float vector + * + * Since: 1.4 + * Stability: Unstable + */ +float * +cogl_vector3_copy (const float *vector); + +/** + * cogl_vector3_free: + * @vector: The 3 component you want to free + * + * Frees a 3 component vector that was previously allocated with + * cogl_vector3_copy() + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_free (float *vector); + +/** + * cogl_vector3_invert: + * @vector: The 3 component vector you want to manipulate + * + * Inverts/negates all the components of the given @vector. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_invert (float *vector); + +/** + * cogl_vector3_add: + * @result: Where you want the result written + * @a: The first vector operand + * @b: The second vector operand + * + * Adds each of the corresponding components in vectors @a and @b + * storing the results in @result. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_add (float *result, + const float *a, + const float *b); + +/** + * cogl_vector3_subtract: + * @result: Where you want the result written + * @a: The first vector operand + * @b: The second vector operand + * + * Subtracts each of the corresponding components in vector @b from + * @a storing the results in @result. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_subtract (float *result, + const float *a, + const float *b); + +/** + * cogl_vector3_multiply_scalar: + * @vector: The 3 component vector you want to manipulate + * @scalar: The scalar you want to multiply the vector components by + * + * Multiplies each of the @vector components by the given scalar. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_multiply_scalar (float *vector, + float scalar); + +/** + * cogl_vector3_divide_scalar: + * @vector: The 3 component vector you want to manipulate + * @scalar: The scalar you want to divide the vector components by + * + * Divides each of the @vector components by the given scalar. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_divide_scalar (float *vector, + float scalar); + +/** + * cogl_vector3_normalize: + * @vector: The 3 component vector you want to manipulate + * + * Updates the vector so it is a "unit vector" such that the + * @vectors magnitude or length is equal to 1. + * + * It's safe to use this function with the [0, 0, 0] vector, it will not + * try to divide components by 0 (its norm) and will leave the vector + * untouched. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_normalize (float *vector); + +/** + * cogl_vector3_magnitude: + * @vector: The 3 component vector you want the magnitude for + * + * Calculates the scalar magnitude or length of @vector. + * + * Returns: The magnitude of @vector. + * + * Since: 1.4 + * Stability: Unstable + */ +float +cogl_vector3_magnitude (const float *vector); + +/** + * cogl_vector3_cross_product: + * @result: Where you want the result written + * @u: Your first 3 component vector + * @v: Your second 3 component vector + * + * Calculates the cross product between the two vectors @u and @v. + * + * The cross product is a vector perpendicular to both @u and @v. This + * can be useful for calculating the normal of a polygon by creating + * two vectors in its plane using the polygons vertices and taking + * their cross product. + * + * If the two vectors are parallel then the cross product is 0. + * + * You can use a right hand rule to determine which direction the + * perpendicular vector will point: If you place the two vectors tail, + * to tail and imagine grabbing the perpendicular line that extends + * through the common tail with your right hand such that you fingers + * rotate in the direction from @u to @v then the resulting vector + * points along your extended thumb. + * + * Returns: The cross product between two vectors @u and @v. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_vector3_cross_product (float *result, + const float *u, + const float *v); + +/** + * cogl_vector3_dot_product: + * @a: Your first 3 component vector + * @b: Your second 3 component vector + * + * Calculates the dot product of the two 3 component vectors. This + * can be used to determine the magnitude of one vector projected onto + * another. (for example a surface normal) + * + * For example if you have a polygon with a given normal vector and + * some other point for which you want to calculate its distance from + * the polygon, you can create a vector between one of the polygon + * vertices and that point and use the dot product to calculate the + * magnitude for that vector but projected onto the normal of the + * polygon. This way you don't just get the distance from the point to + * the edge of the polygon you get the distance from the point to the + * nearest part of the polygon. + * + * If you don't use a unit length normal in the above example + * then you would then also have to divide the result by the magnitude + * of the normal + * + * The dot product is calculated as: + * |[ + * (a->x * b->x + a->y * b->y + a->z * b->z) + * ]| + * + * For reference, the dot product can also be calculated from the + * angle between two vectors as: + * |[ + * |a||b|cos𝜃 + * ]| + * + * Returns: The dot product of two vectors. + * + * Since: 1.4 + * Stability: Unstable + */ +float +cogl_vector3_dot_product (const float *a, const float *b); + +/** + * cogl_vector3_distance: + * @a: The first point + * @b: The second point + * + * If you consider the two given vectors as (x,y,z) points instead + * then this will compute the distance between those two points. + * + * Returns: The distance between two points given as 3 component + * vectors. + * + * Since: 1.4 + * Stability: Unstable + */ +float +cogl_vector3_distance (const float *a, const float *b); + +COGL_END_DECLS + +#endif /* __COGL_VECTOR_H */ + diff --git a/cogl/cogl-version.h b/cogl/cogl-version.h new file mode 100644 index 0000000..7430188 --- /dev/null +++ b/cogl/cogl-version.h @@ -0,0 +1,348 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_VERSION_H__ +#define __COGL_VERSION_H__ + +#include + +/** + * SECTION:cogl-version + * @short_description: Macros for determining the version of Cogl being used + * + * Cogl offers a set of macros for checking the version of the library + * at compile time. + * + * Cogl adds version information to both API deprecations and additions; + * by definining the macros %COGL_VERSION_MIN_REQUIRED and + * %COGL_VERSION_MAX_ALLOWED, you can specify the range of Cogl versions + * whose API you want to use. Functions that were deprecated before, or + * introduced after, this range will trigger compiler warnings. For instance, + * if we define the following symbols: + * + * |[ + * COGL_VERSION_MIN_REQUIRED = COGL_VERSION_1_6 + * COGL_VERSION_MAX_ALLOWED = COGL_VERSION_1_8 + * ]| + * + * and we have the following functions annotated in the Cogl headers: + * + * |[ + * COGL_DEPRECATED_IN_1_4 void cogl_function_A (void); + * COGL_DEPRECATED_IN_1_6 void cogl_function_B (void); + * COGL_AVAILABLE_IN_1_8 void cogl_function_C (void); + * COGL_AVAILABLE_IN_1_10 void cogl_function_D (void); + * ]| + * + * then any application code using the functions above will get the output: + * + * |[ + * cogl_function_A: deprecation warning + * cogl_function_B: no warning + * cogl_function_C: no warning + * cogl_function_D: symbol not available warning + * ]| + * + * It is possible to disable the compiler warnings by defining the macro + * %COGL_DISABLE_DEPRECATION_WARNINGS before including the cogl.h + * header. + */ + +/** + * COGL_VERSION_MAJOR: + * + * The major version of the Cogl library (1, if %COGL_VERSION is 1.2.3) + * + * Since: 1.12.0 + */ +#define COGL_VERSION_MAJOR COGL_VERSION_MAJOR_INTERNAL + +/** + * COGL_VERSION_MINOR: + * + * The minor version of the Cogl library (2, if %COGL_VERSION is 1.2.3) + * + * Since: 1.12.0 + */ +#define COGL_VERSION_MINOR COGL_VERSION_MINOR_INTERNAL + +/** + * COGL_VERSION_MICRO: + * + * The micro version of the Cogl library (3, if %COGL_VERSION is 1.2.3) + * + * Since: 1.12.0 + */ +#define COGL_VERSION_MICRO COGL_VERSION_MICRO_INTERNAL + +/** + * COGL_VERSION_STRING: + * + * The full version of the Cogl library, in string form (suited for + * string concatenation) + * + * Since: 1.12.0 + */ +#define COGL_VERSION_STRING COGL_VERSION_STRING_INTERNAL + +/* Macros to handle compacting a 3-component version number into an + * int for quick comparison. This assumes all of the components are <= + * 1023 and that an int is >= 31 bits */ +#define COGL_VERSION_COMPONENT_BITS 10 +#define COGL_VERSION_MAX_COMPONENT_VALUE \ + ((1 << COGL_VERSION_COMPONENT_BITS) - 1) + +/** + * COGL_VERSION: + * + * The Cogl version encoded into a single integer using the + * COGL_VERSION_ENCODE() macro. This can be used for quick comparisons + * with particular versions. + * + * Since: 1.12.0 + */ +#define COGL_VERSION \ + COGL_VERSION_ENCODE (COGL_VERSION_MAJOR, \ + COGL_VERSION_MINOR, \ + COGL_VERSION_MICRO) + +/** + * COGL_VERSION_ENCODE: + * @major: The major part of a version number + * @minor: The minor part of a version number + * @micro: The micro part of a version number + * + * Encodes a 3 part version number into a single integer. This can be + * used to compare the Cogl version. For example if there is a known + * bug in Cogl versions between 1.3.2 and 1.3.4 you could use the + * following code to provide a workaround: + * + * |[ + * #if COGL_VERSION >= COGL_VERSION_ENCODE (1, 3, 2) && \ + * COGL_VERSION <= COGL_VERSION_ENCODE (1, 3, 4) + * /* Do the workaround */ + * #endif + * ]| + * + * Since: 1.12.0 + */ +#define COGL_VERSION_ENCODE(major, minor, micro) \ + (((major) << (COGL_VERSION_COMPONENT_BITS * 2)) | \ + ((minor) << COGL_VERSION_COMPONENT_BITS) \ + | (micro)) + +/** + * COGL_VERSION_GET_MAJOR: + * @version: An encoded version number + * + * Extracts the major part of an encoded version number. + * + * Since: 1.12.0 + */ +#define COGL_VERSION_GET_MAJOR(version) \ + (((version) >> (COGL_VERSION_COMPONENT_BITS * 2)) \ + & COGL_VERSION_MAX_COMPONENT_VALUE) + +/** + * COGL_VERSION_GET_MINOR: + * @version: An encoded version number + * + * Extracts the minor part of an encoded version number. + * + * Since: 1.12.0 + */ +#define COGL_VERSION_GET_MINOR(version) \ + (((version) >> COGL_VERSION_COMPONENT_BITS) & \ + COGL_VERSION_MAX_COMPONENT_VALUE) + +/** + * COGL_VERSION_GET_MICRO: + * @version: An encoded version number + * + * Extracts the micro part of an encoded version number. + * + * Since: 1.12.0 + */ +#define COGL_VERSION_GET_MICRO(version) \ + ((version) & COGL_VERSION_MAX_COMPONENT_VALUE) + +/** + * COGL_VERSION_CHECK: + * @major: The major part of a version number + * @minor: The minor part of a version number + * @micro: The micro part of a version number + * + * A convenient macro to check whether the Cogl version being compiled + * against is at least the given version number. For example if the + * function cogl_pipeline_frobnicate was added in version 2.0.1 and + * you want to conditionally use that function when it is available, + * you could write the following: + * + * |[ + * #if COGL_VERSION_CHECK (2, 0, 1) + * cogl_pipeline_frobnicate (pipeline); + * #else + * /* Frobnication is not supported. Use a red color instead */ + * cogl_pipeline_set_color_4f (pipeline, 1.0f, 0.0f, 0.0f, 1.0f); + * #endif + * ]| + * + * Return value: %TRUE if the Cogl version being compiled against is + * greater than or equal to the given three part version number. + * Since: 1.12.0 + */ +#define COGL_VERSION_CHECK(major, minor, micro) \ + (COGL_VERSION >= COGL_VERSION_ENCODE (major, minor, micro)) + +/** + * COGL_VERSION_1_0: + * + * A macro that evaluates to the 1.0 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_0 (COGL_VERSION_ENCODE (1, 0, 0)) + +/** + * COGL_VERSION_1_2: + * + * A macro that evaluates to the 1.2 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_2 (COGL_VERSION_ENCODE (1, 2, 0)) + +/** + * COGL_VERSION_1_4: + * + * A macro that evaluates to the 1.4 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_4 (COGL_VERSION_ENCODE (1, 4, 0)) + +/** + * COGL_VERSION_1_6: + * + * A macro that evaluates to the 1.6 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_6 (COGL_VERSION_ENCODE (1, 6, 0)) + +/** + * COGL_VERSION_1_8: + * + * A macro that evaluates to the 1.8 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_8 (COGL_VERSION_ENCODE (1, 8, 0)) + +/** + * COGL_VERSION_1_10: + * + * A macro that evaluates to the 1.10 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_10 (COGL_VERSION_ENCODE (1, 10, 0)) + +/** + * COGL_VERSION_1_12: + * + * A macro that evaluates to the 1.12 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_12 (COGL_VERSION_ENCODE (1, 12, 0)) + +/** + * COGL_VERSION_1_14: + * + * A macro that evaluates to the 1.14 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_14 (COGL_VERSION_ENCODE (1, 14, 0)) + +/** + * COGL_VERSION_1_16: + * + * A macro that evaluates to the 1.16 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.16 + */ +#define COGL_VERSION_1_16 (COGL_VERSION_ENCODE (1, 16, 0)) + +/** + * COGL_VERSION_1_18: + * + * A macro that evaluates to the 1.18 version of Cogl, in a format + * that can be used by the C pre-processor. + * + * Since: 1.18 + */ +#define COGL_VERSION_1_18 (COGL_VERSION_ENCODE (1, 18, 0)) + +/* evaluates to the current stable version; for development cycles, + * this means the next stable target + */ +#if (COGL_VERSION_MINOR_INTERNAL % 2) +#define COGL_VERSION_CURRENT_STABLE \ + (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR_INTERNAL, \ + COGL_VERSION_MINOR_INTERNAL + 1, 0)) +#else +#define COGL_VERSION_CURRENT_STABLE \ + (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR_INTERNAL, \ + COGL_VERSION_MINOR_INTERNAL, 0)) +#endif + +/* evaluates to the previous stable version */ +#if (COGL_VERSION_MINOR_INTERNAL % 2) +#define COGL_VERSION_PREVIOUS_STABLE \ + (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR_INTERNAL, \ + COGL_VERSION_MINOR_INTERNAL - 1, 0)) +#else +#define COGL_VERSION_PREVIOUS_STABLE \ + (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR_INTERNAL, \ + COGL_VERSION_MINOR_INTERNAL - 2, 0)) +#endif + +#endif /* __COGL_VERSION_H__ */ diff --git a/cogl/cogl-wayland-client.h b/cogl/cogl-wayland-client.h new file mode 100644 index 0000000..bac3f70 --- /dev/null +++ b/cogl/cogl-wayland-client.h @@ -0,0 +1,64 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __COGL_WAYLAND_CLIENT_H +#define __COGL_WAYLAND_CLIENT_H + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif +#endif /* COGL_COMPILATION */ + +#include + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_WAYLAND_CLIENT_H */ diff --git a/cogl/cogl-wayland-renderer.h b/cogl/cogl-wayland-renderer.h new file mode 100644 index 0000000..ea0a20b --- /dev/null +++ b/cogl/cogl-wayland-renderer.h @@ -0,0 +1,105 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_WAYLAND_RENDERER_H__ +#define __COGL_WAYLAND_RENDERER_H__ + +#include +#include + +#include + +COGL_BEGIN_DECLS + +/** + * cogl_wayland_renderer_set_foreign_display: + * @renderer: A #CoglRenderer + * @display: A Wayland display + * + * Allows you to explicitly control what Wayland display you want Cogl + * to work with instead of leaving Cogl to automatically connect to a + * wayland compositor. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer, + struct wl_display *display); + +/** + * cogl_wayland_renderer_set_event_dispatch_enabled: + * @renderer: A #CoglRenderer + * @enable: The new value + * + * Sets whether Cogl should handle calling wl_display_dispatch() and + * wl_display_flush() as part of its main loop integration via + * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch(). + * The default value is %TRUE. When it is enabled the application can + * register listeners for Wayland interfaces and the callbacks will be + * invoked during cogl_poll_renderer_dispatch(). If the application + * wants to integrate with its own code that is already handling + * reading from the Wayland display socket, it should disable this to + * avoid having competing code read from the socket. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_wayland_renderer_set_event_dispatch_enabled (CoglRenderer *renderer, + CoglBool enable); + +/** + * cogl_wayland_renderer_get_display: + * @renderer: A #CoglRenderer + * + * Retrieves the Wayland display that Cogl is using. If a foreign + * display has been specified using + * cogl_wayland_renderer_set_foreign_display() then that display will + * be returned. If no foreign display has been specified then the + * display that Cogl creates internally will be returned unless the + * renderer has not yet been connected (either implicitly or explicitly by + * calling cogl_renderer_connect()) in which case %NULL is returned. + * + * Returns: The wayland display currently associated with @renderer, + * or %NULL if the renderer hasn't yet been connected and no + * foreign display has been specified. + * + * Since: 1.8 + * Stability: unstable + */ +struct wl_display * +cogl_wayland_renderer_get_display (CoglRenderer *renderer); + +COGL_END_DECLS + +#endif /* __COGL_WAYLAND_RENDERER_H__ */ diff --git a/cogl/cogl-wayland-server.h b/cogl/cogl-wayland-server.h new file mode 100644 index 0000000..9c1f35f --- /dev/null +++ b/cogl/cogl-wayland-server.h @@ -0,0 +1,163 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __COGL_WAYLAND_SERVER_H +#define __COGL_WAYLAND_SERVER_H + +#include + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_wayland_display_set_compositor_display: + * @display: a #CoglDisplay + * @wayland_display: A compositor's Wayland display pointer + * + * Informs Cogl of a compositor's Wayland display pointer. This + * enables Cogl to register private wayland extensions required to + * pass buffers between the clients and compositor. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_wayland_display_set_compositor_display (CoglDisplay *display, + struct wl_display *wayland_display); + +/** + * cogl_wayland_texture_2d_new_from_buffer: + * @ctx: A #CoglContext + * @buffer: A Wayland resource for a buffer + * @error: A #CoglError for exceptions + * + * Uploads the @buffer referenced by the given Wayland resource to a + * #CoglTexture2D. The buffer resource may refer to a wl_buffer or a + * wl_shm_buffer. + * + * The results are undefined for passing an invalid @buffer + * pointer + * It is undefined if future updates to @buffer outside the + * control of Cogl will affect the allocated #CoglTexture2D. In some + * cases the contents of the buffer are copied (such as shm buffers), + * and in other cases the underlying storage is re-used directly (such + * as drm buffers) + * + * Returns: A newly allocated #CoglTexture2D, or if Cogl could not + * validate the @buffer in some way (perhaps because of + * an unsupported format) it will return %NULL and set + * @error. + * + * Since: 1.10 + * Stability: unstable + */ +CoglTexture2D * +cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, + struct wl_resource *buffer, + CoglError **error); + +/** + * cogl_wayland_texture_set_region_from_shm_buffer: + * @texture: a #CoglTexture + * @width: The width of the region to copy + * @height: The height of the region to copy + * @shm_buffer: The source buffer + * @src_x: The X offset within the source bufer to copy from + * @src_y: The Y offset within the source bufer to copy from + * @dst_x: The X offset within the texture to copy to + * @dst_y: The Y offset within the texture to copy to + * @level: The mipmap level of the texture to copy to + * @error: A #CoglError to return exceptional errors + * + * Sets the pixels in a rectangular subregion of @texture from a + * Wayland SHM buffer. Generally this would be used in response to + * wl_surface.damage event in a compositor in order to update the + * texture with the damaged region. This is just a convenience wrapper + * around getting the SHM buffer pointer and calling + * cogl_texture_set_region(). See that function for a description of + * the level parameter. + * + * Since the storage for a #CoglTexture is allocated lazily then + * if the given @texture has not previously been allocated then this + * api can return %FALSE and throw an exceptional @error if there is + * not enough memory to allocate storage for @texture. + * + * Return value: %TRUE if the subregion upload was successful, and + * %FALSE otherwise + * Since: 1.18 + * Stability: unstable + */ +CoglBool +cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture, + int src_x, + int src_y, + int width, + int height, + struct wl_shm_buffer * + shm_buffer, + int dst_x, + int dst_y, + int level, + CoglError **error); + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_WAYLAND_SERVER_H */ diff --git a/cogl/cogl-win32-renderer.c b/cogl/cogl-win32-renderer.c new file mode 100644 index 0000000..2bc3a5b --- /dev/null +++ b/cogl/cogl-win32-renderer.c @@ -0,0 +1,73 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-renderer-private.h" +#include "cogl-win32-renderer.h" + +CoglFilterReturn +cogl_win32_renderer_handle_event (CoglRenderer *renderer, + MSG *event) +{ + return _cogl_renderer_handle_native_event (renderer, event); +} + +void +cogl_win32_renderer_add_filter (CoglRenderer *renderer, + CoglWin32FilterFunc func, + void *data) +{ + _cogl_renderer_add_native_filter (renderer, + (CoglNativeFilterFunc)func, data); +} + +void +cogl_win32_renderer_remove_filter (CoglRenderer *renderer, + CoglWin32FilterFunc func, + void *data) +{ + _cogl_renderer_remove_native_filter (renderer, + (CoglNativeFilterFunc)func, data); +} + +void +cogl_win32_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, + CoglBool enable) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->win32_enable_event_retrieval = enable; +} diff --git a/cogl/cogl-win32-renderer.h b/cogl/cogl-win32-renderer.h new file mode 100644 index 0000000..2947ffa --- /dev/null +++ b/cogl/cogl-win32-renderer.h @@ -0,0 +1,123 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_WIN32_RENDERER_H__ +#define __COGL_WIN32_RENDERER_H__ + +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_win32_renderer_handle_event: + * @renderer: a #CoglRenderer + * @message: A pointer to a win32 MSG struct + * + * This function processes a single event; it can be used to hook into + * external event retrieval (for example that done by Clutter or + * GDK). + * + * Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that + * Cogl has internally handled the event and the caller should do no + * further processing. %COGL_FILTER_CONTINUE indicates that Cogl is + * either not interested in the event, or has used the event to update + * internal state without taking any exclusive action. + */ +CoglFilterReturn +cogl_win32_renderer_handle_event (CoglRenderer *renderer, + MSG *message); + +/** + * CoglWin32FilterFunc: + * @message: A pointer to a win32 MSG struct + * @data: The data that was given when the filter was added + * + * A callback function that can be registered with + * cogl_win32_renderer_add_filter(). The function should return + * %COGL_FILTER_REMOVE if it wants to prevent further processing or + * %COGL_FILTER_CONTINUE otherwise. + */ +typedef CoglFilterReturn (* CoglWin32FilterFunc) (MSG *message, + void *data); + +/** + * cogl_win32_renderer_add_filter: + * @renderer: a #CoglRenderer + * @func: the callback function + * @data: user data passed to @func when called + * + * Adds a callback function that will receive all native events. The + * function can stop further processing of the event by return + * %COGL_FILTER_REMOVE. + */ +void +cogl_win32_renderer_add_filter (CoglRenderer *renderer, + CoglWin32FilterFunc func, + void *data); + +/** + * cogl_win32_renderer_remove_filter: + * @renderer: a #CoglRenderer + * @func: the callback function + * @data: user data given when the callback was installed + * + * Removes a callback that was previously added with + * cogl_win32_renderer_add_filter(). + */ +void +cogl_win32_renderer_remove_filter (CoglRenderer *renderer, + CoglWin32FilterFunc func, + void *data); + +/** + * cogl_win32_renderer_set_event_retrieval_enabled: + * @renderer: a #CoglRenderer + * @enable: The new value + * + * Sets whether Cogl should automatically retrieve messages from + * Windows. It defaults to %TRUE. It can be set to %FALSE if the + * application wants to handle its own message retrieval. Note that + * Cogl still needs to see all of the messages to function properly so + * the application should call cogl_win32_renderer_handle_event() for + * each message if it disables automatic event retrieval. + * + * Since: 1.16 + * Stability: unstable + */ +void +cogl_win32_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, + CoglBool enable); + +COGL_END_DECLS + +#endif /* __COGL_WIN32_RENDERER_H__ */ diff --git a/cogl/cogl-x11-renderer-private.h b/cogl/cogl-x11-renderer-private.h new file mode 100644 index 0000000..17655da --- /dev/null +++ b/cogl/cogl-x11-renderer-private.h @@ -0,0 +1,40 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_RENDERER_X11_PRIVATE_H +#define __COGL_RENDERER_X11_PRIVATE_H + +typedef struct _CoglX11Renderer +{ + int damage_base; + int randr_base; +} CoglX11Renderer; + +#endif /* __COGL_RENDERER_X11_PRIVATE_H */ diff --git a/cogl/cogl-xlib-private.h b/cogl/cogl-xlib-private.h new file mode 100644 index 0000000..992a320 --- /dev/null +++ b/cogl/cogl-xlib-private.h @@ -0,0 +1,54 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_XLIB_PRIVATE_H +#define __COGL_XLIB_PRIVATE_H + +#include + +typedef struct _CoglXlibTrapState CoglXlibTrapState; + +struct _CoglXlibTrapState +{ + /* These values are intended to be internal to + * _cogl_xlib_{un,}trap_errors but they need to be in the header so + * that the struct can be allocated on the stack */ + int (* old_error_handler) (Display *, XErrorEvent *); + int trapped_error_code; + CoglXlibTrapState *old_state; +}; + +void +_cogl_xlib_query_damage_extension (void); + +int +_cogl_xlib_get_damage_base (void); + +#endif /* __COGL_XLIB_PRIVATE_H */ diff --git a/cogl/cogl-xlib-renderer-private.h b/cogl/cogl-xlib-renderer-private.h new file mode 100644 index 0000000..3c2b682 --- /dev/null +++ b/cogl/cogl-xlib-renderer-private.h @@ -0,0 +1,101 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_RENDERER_XLIB_PRIVATE_H +#define __COGL_RENDERER_XLIB_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-xlib-private.h" +#include "cogl-x11-renderer-private.h" +#include "cogl-context.h" +#include "cogl-output.h" + +typedef struct _CoglXlibRenderer +{ + CoglX11Renderer _parent; + + Display *xdpy; + + /* Current top of the XError trap state stack. The actual memory for + these is expected to be allocated on the stack by the caller */ + CoglXlibTrapState *trap_state; + + unsigned long outputs_update_serial; +} CoglXlibRenderer; + +CoglBool +_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error); + +void +_cogl_xlib_renderer_disconnect (CoglRenderer *renderer); + +/* + * cogl_xlib_renderer_trap_errors: + * @state: A temporary place to store data for the trap. + * + * Traps every X error until _cogl_xlib_renderer_untrap_errors() + * called. You should allocate an uninitialised CoglXlibTrapState + * struct on the stack to pass to this function. The same pointer + * should later be passed to _cogl_xlib_renderer_untrap_errors(). + * + * Calls to _cogl_xlib_renderer_trap_errors() can be nested as long as + * _cogl_xlib_renderer_untrap_errors() is called with the + * corresponding state pointers in reverse order. + */ +void +_cogl_xlib_renderer_trap_errors (CoglRenderer *renderer, + CoglXlibTrapState *state); + +/* + * cogl_xlib_renderer_untrap_errors: + * @state: The state that was passed to _cogl_xlib_renderer_trap_errors(). + * + * Removes the X error trap and returns the current status. + * + * Return value: the trapped error code, or 0 for success + */ +int +_cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer, + CoglXlibTrapState *state); + +CoglXlibRenderer * +_cogl_xlib_renderer_get_data (CoglRenderer *renderer); + +int64_t +_cogl_xlib_renderer_get_dispatch_timeout (CoglRenderer *renderer); + +CoglOutput * +_cogl_xlib_renderer_output_for_rectangle (CoglRenderer *renderer, + int x, + int y, + int width, + int height); + +#endif /* __COGL_RENDERER_XLIB_PRIVATE_H */ diff --git a/cogl/cogl-xlib-renderer.c b/cogl/cogl-xlib-renderer.c new file mode 100644 index 0000000..740f1e4 --- /dev/null +++ b/cogl/cogl-xlib-renderer.c @@ -0,0 +1,660 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-xlib-renderer.h" +#include "cogl-util.h" +#include "cogl-object.h" + +#include "cogl-output-private.h" +#include "cogl-renderer-private.h" +#include "cogl-xlib-renderer-private.h" +#include "cogl-x11-renderer-private.h" +#include "cogl-winsys-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" + +#include +#include +#include + +#include +#include + +static char *_cogl_x11_display_name = NULL; +static GList *_cogl_xlib_renderers = NULL; + +static void +destroy_xlib_renderer_data (void *user_data) +{ + g_slice_free (CoglXlibRenderer, user_data); +} + +CoglXlibRenderer * +_cogl_xlib_renderer_get_data (CoglRenderer *renderer) +{ + static CoglUserDataKey key; + CoglXlibRenderer *data; + + /* Constructs a CoglXlibRenderer struct on demand and attaches it to + the object using user data. It's done this way instead of using a + subclassing hierarchy in the winsys data because all EGL winsys's + need the EGL winsys data but only one of them wants the Xlib + data. */ + + data = cogl_object_get_user_data (COGL_OBJECT (renderer), &key); + + if (data == NULL) + { + data = g_slice_new0 (CoglXlibRenderer); + + cogl_object_set_user_data (COGL_OBJECT (renderer), + &key, + data, + destroy_xlib_renderer_data); + } + + return data; +} + +static void +register_xlib_renderer (CoglRenderer *renderer) +{ + GList *l; + + for (l = _cogl_xlib_renderers; l; l = l->next) + if (l->data == renderer) + return; + + _cogl_xlib_renderers = g_list_prepend (_cogl_xlib_renderers, renderer); +} + +static void +unregister_xlib_renderer (CoglRenderer *renderer) +{ + _cogl_xlib_renderers = g_list_remove (_cogl_xlib_renderers, renderer); +} + +static CoglRenderer * +get_renderer_for_xdisplay (Display *xdpy) +{ + GList *l; + + for (l = _cogl_xlib_renderers; l; l = l->next) + { + CoglRenderer *renderer = l->data; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + + if (xlib_renderer->xdpy == xdpy) + return renderer; + } + + return NULL; +} + +static int +error_handler (Display *xdpy, + XErrorEvent *error) +{ + CoglRenderer *renderer; + CoglXlibRenderer *xlib_renderer; + + renderer = get_renderer_for_xdisplay (xdpy); + + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + g_assert (xlib_renderer->trap_state); + + xlib_renderer->trap_state->trapped_error_code = error->error_code; + + return 0; +} + +void +_cogl_xlib_renderer_trap_errors (CoglRenderer *renderer, + CoglXlibTrapState *state) +{ + CoglXlibRenderer *xlib_renderer; + + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + state->trapped_error_code = 0; + state->old_error_handler = XSetErrorHandler (error_handler); + + state->old_state = xlib_renderer->trap_state; + xlib_renderer->trap_state = state; +} + +int +_cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer, + CoglXlibTrapState *state) +{ + CoglXlibRenderer *xlib_renderer; + + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + g_assert (state == xlib_renderer->trap_state); + + XSetErrorHandler (state->old_error_handler); + + xlib_renderer->trap_state = state->old_state; + + return state->trapped_error_code; +} + +static Display * +assert_xlib_display (CoglRenderer *renderer, CoglError **error) +{ + Display *xdpy = cogl_xlib_renderer_get_foreign_display (renderer); + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + /* A foreign display may have already been set... */ + if (xdpy) + { + xlib_renderer->xdpy = xdpy; + return xdpy; + } + + xdpy = XOpenDisplay (_cogl_x11_display_name); + if (xdpy == NULL) + { + _cogl_set_error (error, + COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN, + "Failed to open X Display %s", _cogl_x11_display_name); + return NULL; + } + + xlib_renderer->xdpy = xdpy; + return xdpy; +} + +static int +compare_outputs (CoglOutput *a, + CoglOutput *b) +{ + return strcmp (a->name, b->name); +} + +#define CSO(X) COGL_SUBPIXEL_ORDER_ ## X +static CoglSubpixelOrder subpixel_map[6][6] = { + { CSO(UNKNOWN), CSO(NONE), CSO(HORIZONTAL_RGB), CSO(HORIZONTAL_BGR), + CSO(VERTICAL_RGB), CSO(VERTICAL_BGR) }, /* 0 */ + { CSO(UNKNOWN), CSO(NONE), CSO(VERTICAL_RGB), CSO(VERTICAL_BGR), + CSO(HORIZONTAL_BGR), CSO(HORIZONTAL_RGB) }, /* 90 */ + { CSO(UNKNOWN), CSO(NONE), CSO(HORIZONTAL_BGR), CSO(HORIZONTAL_RGB), + CSO(VERTICAL_BGR), CSO(VERTICAL_RGB) }, /* 180 */ + { CSO(UNKNOWN), CSO(NONE), CSO(VERTICAL_BGR), CSO(VERTICAL_RGB), + CSO(HORIZONTAL_RGB), CSO(HORIZONTAL_BGR) }, /* 270 */ + { CSO(UNKNOWN), CSO(NONE), CSO(HORIZONTAL_BGR), CSO(HORIZONTAL_RGB), + CSO(VERTICAL_RGB), CSO(VERTICAL_BGR) }, /* Reflect_X */ + { CSO(UNKNOWN), CSO(NONE), CSO(HORIZONTAL_RGB), CSO(HORIZONTAL_BGR), + CSO(VERTICAL_BGR), CSO(VERTICAL_RGB) }, /* Reflect_Y */ +}; +#undef CSO + +static void +update_outputs (CoglRenderer *renderer, + CoglBool notify) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + XRRScreenResources *resources; + CoglXlibTrapState state; + CoglBool error = FALSE; + GList *new_outputs = NULL; + GList *l, *m; + CoglBool changed = FALSE; + int i; + + xlib_renderer->outputs_update_serial = XNextRequest (xlib_renderer->xdpy); + + resources = XRRGetScreenResources (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy)); + + _cogl_xlib_renderer_trap_errors (renderer, &state); + + for (i = 0; resources && i < resources->ncrtc && !error; i++) + { + XRRCrtcInfo *crtc_info = NULL; + XRROutputInfo *output_info = NULL; + CoglOutput *output; + float refresh_rate = 0; + int j; + + crtc_info = XRRGetCrtcInfo (xlib_renderer->xdpy, + resources, resources->crtcs[i]); + if (crtc_info == NULL) + { + error = TRUE; + goto next; + } + + if (crtc_info->mode == None) + goto next; + + for (j = 0; j < resources->nmode; j++) + { + if (resources->modes[j].id == crtc_info->mode) + refresh_rate = (resources->modes[j].dotClock / + ((float)resources->modes[j].hTotal * + resources->modes[j].vTotal)); + } + + output_info = XRRGetOutputInfo (xlib_renderer->xdpy, + resources, + crtc_info->outputs[0]); + if (output_info == NULL) + { + error = TRUE; + goto next; + } + + output = _cogl_output_new (output_info->name); + output->x = crtc_info->x; + output->y = crtc_info->y; + output->width = crtc_info->width; + output->height = crtc_info->height; + if ((crtc_info->rotation & (RR_Rotate_90 | RR_Rotate_270)) != 0) + { + output->mm_width = output_info->mm_height; + output->mm_height = output_info->mm_width; + } + else + { + output->mm_width = output_info->mm_width; + output->mm_height = output_info->mm_height; + } + + output->refresh_rate = refresh_rate; + + switch (output_info->subpixel_order) + { + case SubPixelUnknown: + default: + output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN; + break; + case SubPixelNone: + output->subpixel_order = COGL_SUBPIXEL_ORDER_NONE; + break; + case SubPixelHorizontalRGB: + output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB; + break; + case SubPixelHorizontalBGR: + output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR; + break; + case SubPixelVerticalRGB: + output->subpixel_order = COGL_SUBPIXEL_ORDER_VERTICAL_RGB; + break; + case SubPixelVerticalBGR: + output->subpixel_order = COGL_SUBPIXEL_ORDER_VERTICAL_BGR; + break; + } + + output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB; + + /* Handle the effect of rotation and reflection on subpixel order (ugh) */ + for (j = 0; j < 6; j++) + { + if ((crtc_info->rotation & (1 << j)) != 0) + output->subpixel_order = subpixel_map[j][output->subpixel_order]; + } + + new_outputs = g_list_prepend (new_outputs, output); + + next: + if (crtc_info != NULL) + XFree (crtc_info); + + if (output_info != NULL) + XFree (output_info); + } + + XFree (resources); + + if (!error) + { + new_outputs = g_list_sort (new_outputs, (GCompareFunc)compare_outputs); + + l = new_outputs; + m = renderer->outputs; + + while (l || m) + { + int cmp; + CoglOutput *output_l = l ? (CoglOutput *)l->data : NULL; + CoglOutput *output_m = m ? (CoglOutput *)m->data : NULL; + + if (l && m) + cmp = compare_outputs (output_l, output_m); + else if (l) + cmp = -1; + else + cmp = 1; + + if (cmp == 0) + { + GList *m_next = m->next; + + if (!_cogl_output_values_equal (output_l, output_m)) + { + renderer->outputs = g_list_remove_link (renderer->outputs, m); + renderer->outputs = g_list_insert_before (renderer->outputs, + m_next, output_l); + cogl_object_ref (output_l); + + changed = TRUE; + } + + l = l->next; + m = m_next; + } + else if (cmp < 0) + { + renderer->outputs = + g_list_insert_before (renderer->outputs, m, output_l); + cogl_object_ref (output_l); + changed = TRUE; + l = l->next; + } + else + { + GList *m_next = m->next; + renderer->outputs = g_list_remove_link (renderer->outputs, m); + changed = TRUE; + m = m_next; + } + } + } + + g_list_free_full (new_outputs, (GDestroyNotify)cogl_object_unref); + _cogl_xlib_renderer_untrap_errors (renderer, &state); + + if (changed) + { + const CoglWinsysVtable *winsys = renderer->winsys_vtable; + + if (notify) + COGL_NOTE (WINSYS, "Outputs changed:"); + else + COGL_NOTE (WINSYS, "Outputs:"); + + for (l = renderer->outputs; l; l = l->next) + { + CoglOutput *output = l->data; + const char *subpixel_string; + + switch (output->subpixel_order) + { + case COGL_SUBPIXEL_ORDER_UNKNOWN: + default: + subpixel_string = "unknown"; + break; + case COGL_SUBPIXEL_ORDER_NONE: + subpixel_string = "none"; + break; + case COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB: + subpixel_string = "horizontal_rgb"; + break; + case COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR: + subpixel_string = "horizontal_bgr"; + break; + case COGL_SUBPIXEL_ORDER_VERTICAL_RGB: + subpixel_string = "vertical_rgb"; + break; + case COGL_SUBPIXEL_ORDER_VERTICAL_BGR: + subpixel_string = "vertical_bgr"; + break; + } + + COGL_NOTE (WINSYS, + " %10s: +%d+%dx%dx%d mm=%dx%d dpi=%.1fx%.1f " + "subpixel_order=%s refresh_rate=%.3f", + output->name, + output->x, output->y, output->width, output->height, + output->mm_width, output->mm_height, + output->width / (output->mm_width / 25.4), + output->height / (output->mm_height / 25.4), + subpixel_string, + output->refresh_rate); + } + + if (notify && winsys->renderer_outputs_changed != NULL) + winsys->renderer_outputs_changed (renderer); + } +} + +static CoglFilterReturn +randr_filter (XEvent *event, + void *data) +{ + CoglRenderer *renderer = data; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglX11Renderer *x11_renderer = + (CoglX11Renderer *) xlib_renderer; + + if (x11_renderer->randr_base != -1 && + (event->xany.type == x11_renderer->randr_base + RRScreenChangeNotify || + event->xany.type == x11_renderer->randr_base + RRNotify) && + event->xany.serial >= xlib_renderer->outputs_update_serial) + update_outputs (renderer, TRUE); + + return COGL_FILTER_CONTINUE; +} + +static int64_t +prepare_xlib_events_timeout (void *user_data) +{ + CoglRenderer *renderer = user_data; + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + return XPending (xlib_renderer->xdpy) ? 0 : -1; +} + +static void +dispatch_xlib_events (void *user_data, int revents) +{ + CoglRenderer *renderer = user_data; + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + if (renderer->xlib_enable_event_retrieval) + while (XPending (xlib_renderer->xdpy)) + { + XEvent xevent; + + XNextEvent (xlib_renderer->xdpy, &xevent); + + cogl_xlib_renderer_handle_event (renderer, &xevent); + } +} + +CoglBool +_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglX11Renderer *x11_renderer = + (CoglX11Renderer *) xlib_renderer; + int damage_error; + int randr_error; + + if (!assert_xlib_display (renderer, error)) + return FALSE; + + if (getenv ("COGL_X11_SYNC")) + XSynchronize (xlib_renderer->xdpy, TRUE); + + /* Check whether damage events are supported on this display */ + if (!XDamageQueryExtension (xlib_renderer->xdpy, + &x11_renderer->damage_base, + &damage_error)) + x11_renderer->damage_base = -1; + + /* Check whether randr is supported on this display */ + if (!XRRQueryExtension (xlib_renderer->xdpy, + &x11_renderer->randr_base, + &randr_error)) + x11_renderer->randr_base = -1; + + xlib_renderer->trap_state = NULL; + + if (renderer->xlib_enable_event_retrieval) + { + _cogl_poll_renderer_add_fd (renderer, + ConnectionNumber (xlib_renderer->xdpy), + COGL_POLL_FD_EVENT_IN, + prepare_xlib_events_timeout, + dispatch_xlib_events, + renderer); + } + + XRRSelectInput(xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + RRScreenChangeNotifyMask + | RRCrtcChangeNotifyMask + | RROutputPropertyNotifyMask); + update_outputs (renderer, FALSE); + + register_xlib_renderer (renderer); + + cogl_xlib_renderer_add_filter (renderer, + randr_filter, + renderer); + + return TRUE; +} + +void +_cogl_xlib_renderer_disconnect (CoglRenderer *renderer) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + + g_list_free_full (renderer->outputs, (GDestroyNotify)cogl_object_unref); + renderer->outputs = NULL; + + if (!renderer->foreign_xdpy && xlib_renderer->xdpy) + XCloseDisplay (xlib_renderer->xdpy); + + unregister_xlib_renderer (renderer); +} + +Display * +cogl_xlib_renderer_get_display (CoglRenderer *renderer) +{ + CoglXlibRenderer *xlib_renderer; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + return xlib_renderer->xdpy; +} + +CoglFilterReturn +cogl_xlib_renderer_handle_event (CoglRenderer *renderer, + XEvent *event) +{ + return _cogl_renderer_handle_native_event (renderer, event); +} + +void +cogl_xlib_renderer_add_filter (CoglRenderer *renderer, + CoglXlibFilterFunc func, + void *data) +{ + _cogl_renderer_add_native_filter (renderer, + (CoglNativeFilterFunc)func, data); +} + +void +cogl_xlib_renderer_remove_filter (CoglRenderer *renderer, + CoglXlibFilterFunc func, + void *data) +{ + _cogl_renderer_remove_native_filter (renderer, + (CoglNativeFilterFunc)func, data); +} + +int64_t +_cogl_xlib_renderer_get_dispatch_timeout (CoglRenderer *renderer) +{ + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + if (renderer->xlib_enable_event_retrieval) + { + if (XPending (xlib_renderer->xdpy)) + return 0; + else + return -1; + } + else + return -1; +} + +CoglOutput * +_cogl_xlib_renderer_output_for_rectangle (CoglRenderer *renderer, + int x, + int y, + int width, + int height) +{ + int max_overlap = 0; + CoglOutput *max_overlapped = NULL; + GList *l; + int xa1 = x, xa2 = x + width; + int ya1 = y, ya2 = y + height; + + for (l = renderer->outputs; l; l = l->next) + { + CoglOutput *output = l->data; + int xb1 = output->x, xb2 = output->x + output->width; + int yb1 = output->y, yb2 = output->y + output->height; + + int overlap_x = MIN(xa2, xb2) - MAX(xa1, xb1); + int overlap_y = MIN(ya2, yb2) - MAX(ya1, yb1); + + if (overlap_x > 0 && overlap_y > 0) + { + int overlap = overlap_x * overlap_y; + if (overlap > max_overlap) + { + max_overlap = overlap; + max_overlapped = output; + } + } + } + + return max_overlapped; +} diff --git a/cogl/cogl-xlib-renderer.h b/cogl/cogl-xlib-renderer.h new file mode 100644 index 0000000..6318957 --- /dev/null +++ b/cogl/cogl-xlib-renderer.h @@ -0,0 +1,187 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_XLIB_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_XLIB_RENDERER_H__ +#define __COGL_XLIB_RENDERER_H__ + +#include + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include + +COGL_BEGIN_DECLS + +/* + * cogl_xlib_renderer_handle_event: + * @renderer: a #CoglRenderer + * @event: pointer to an XEvent structure + * + * This function processes a single event; it can be used to hook into + * external event retrieval (for example that done by Clutter or + * GDK). + * + * Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that + * Cogl has internally handled the event and the caller should do no + * further processing. %COGL_FILTER_CONTINUE indicates that Cogl is + * either not interested in the event, or has used the event to update + * internal state without taking any exclusive action. + */ +CoglFilterReturn +cogl_xlib_renderer_handle_event (CoglRenderer *renderer, + XEvent *event); + +/* + * CoglXlibFilterFunc: + * @event: pointer to an XEvent structure + * @data: the data that was given when the filter was added + * + * A callback function that can be registered with + * cogl_xlib_renderer_add_filter(). The function should return + * %COGL_FILTER_REMOVE if it wants to prevent further processing or + * %COGL_FILTER_CONTINUE otherwise. + */ +typedef CoglFilterReturn (* CoglXlibFilterFunc) (XEvent *event, + void *data); + +/* + * cogl_xlib_renderer_add_filter: + * @renderer: a #CoglRenderer + * @func: the callback function + * @data: user data passed to @func when called + * + * Adds a callback function that will receive all native events. The + * function can stop further processing of the event by return + * %COGL_FILTER_REMOVE. + */ +void +cogl_xlib_renderer_add_filter (CoglRenderer *renderer, + CoglXlibFilterFunc func, + void *data); + +/* + * cogl_xlib_renderer_remove_filter: + * @renderer: a #CoglRenderer + * @func: the callback function + * @data: user data given when the callback was installed + * + * Removes a callback that was previously added with + * cogl_xlib_renderer_add_filter(). + */ +void +cogl_xlib_renderer_remove_filter (CoglRenderer *renderer, + CoglXlibFilterFunc func, + void *data); + +/* + * cogl_xlib_renderer_get_foreign_display: + * @renderer: a #CoglRenderer + * + * Return value: the foreign Xlib display that will be used by any Xlib based + * winsys backend. The display needs to be set with + * cogl_xlib_renderer_set_foreign_display() before this function is called. + */ +Display * +cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer); + +/* + * cogl_xlib_renderer_set_foreign_display: + * @renderer: a #CoglRenderer + * + * Sets a foreign Xlib display that Cogl will use for and Xlib based winsys + * backend. + * + * Note that calling this function will automatically call + * cogl_xlib_renderer_set_event_retrieval_enabled() to disable Cogl's + * event retrieval. Cogl still needs to see all of the X events so the + * application should also use cogl_xlib_renderer_handle_event() if it + * uses this function. + */ +void +cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer, + Display *display); + +/** + * cogl_xlib_renderer_set_event_retrieval_enabled: + * @renderer: a #CoglRenderer + * @enable: The new value + * + * Sets whether Cogl should automatically retrieve events from the X + * display. This defaults to %TRUE unless + * cogl_xlib_renderer_set_foreign_display() is called. It can be set + * to %FALSE if the application wants to handle its own event + * retrieval. Note that Cogl still needs to see all of the X events to + * function properly so the application should call + * cogl_xlib_renderer_handle_event() for each event if it disables + * automatic event retrieval. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, + CoglBool enable); + +Display * +cogl_xlib_renderer_get_display (CoglRenderer *renderer); + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_XLIB_RENDERER_H__ */ diff --git a/cogl/cogl-xlib.c b/cogl/cogl-xlib.c new file mode 100644 index 0000000..315a1bf --- /dev/null +++ b/cogl/cogl-xlib.c @@ -0,0 +1,112 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cogl-xlib.h" + +/* FIXME: when we remove the last X11 based Clutter backend then we + * will get rid of these functions and instead rely on the equivalent + * _cogl_xlib_renderer API + */ + +/* This can't be in the Cogl context because it can be set before + context is created */ +static Display *_cogl_xlib_display = NULL; + +Display * +cogl_xlib_get_display (void) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + return cogl_xlib_renderer_get_display (ctx->display->renderer); +} + +void +cogl_xlib_set_display (Display *display) +{ + /* This can only be called once before the Cogl context is created */ + g_assert (_cogl_xlib_display == NULL); + + _cogl_xlib_display = display; +} + +/* These three functions are wrappers around the equivalent renderer + functions. They can be removed once all xlib-based backends in + Clutter know about the renderer */ +CoglFilterReturn +cogl_xlib_handle_event (XEvent *xevent) +{ + _COGL_GET_CONTEXT (ctx, COGL_FILTER_CONTINUE); + + /* Pass the event on to the renderer */ + return cogl_xlib_renderer_handle_event (ctx->display->renderer, xevent); +} + +void +_cogl_xlib_query_damage_extension (void) +{ + int damage_error; + Display *display; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + /* Check whether damage events are supported on this display */ + display = cogl_xlib_renderer_get_display (ctxt->display->renderer); + if (!XDamageQueryExtension (display, &ctxt->damage_base, &damage_error)) + ctxt->damage_base = -1; +} + +int +_cogl_xlib_get_damage_base (void) +{ + CoglX11Renderer *x11_renderer; + _COGL_GET_CONTEXT (ctxt, -1); + + x11_renderer = + (CoglX11Renderer *) _cogl_xlib_renderer_get_data (ctxt->display->renderer); + return x11_renderer->damage_base; +} diff --git a/cogl/cogl-xlib.h b/cogl/cogl-xlib.h new file mode 100644 index 0000000..ac4a140 --- /dev/null +++ b/cogl/cogl-xlib.h @@ -0,0 +1,132 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __COGL_XLIB_H__ +#define __COGL_XLIB_H__ + +#include + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_XLIB_H_INSIDE__ */ +#ifndef __COGL_XLIB_H_INSIDE__ +#define __COGL_XLIB_H_INSIDE__ +#endif + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include +#include +#include +#include + +COGL_BEGIN_DECLS + +/* + * cogl_xlib_get_display: + * + * Return value: the Xlib display that will be used by the Xlib winsys + * backend. The display needs to be set with _cogl_xlib_set_display() + * before this function is called. + * + * Stability: Unstable + * Deprecated: 1.16: Use cogl_xlib_renderer_get_display() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_get_display) +Display * +cogl_xlib_get_display (void); + +/* + * cogl_xlib_set_display: + * + * Sets the Xlib display that Cogl will use for the Xlib winsys + * backend. This function should eventually go away when Cogl gains a + * more complete winsys abstraction. + * + * Stability: Unstable + * Deprecated: 1.16: Use cogl_xlib_renderer_set_foreign_display() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_set_foreign_display) +void +cogl_xlib_set_display (Display *display); + +/* + * cogl_xlib_handle_event: + * @xevent: pointer to XEvent structure + * + * This function processes a single X event; it can be used to hook + * into external X event retrieval (for example that done by Clutter + * or GDK). + * + * Return value: #CoglXlibFilterReturn. %COGL_XLIB_FILTER_REMOVE + * indicates that Cogl has internally handled the event and the + * caller should do no further processing. %COGL_XLIB_FILTER_CONTINUE + * indicates that Cogl is either not interested in the event, + * or has used the event to update internal state without taking + * any exclusive action. + * + * Stability: Unstable + * Deprecated: 1.16: Use cogl_xlib_renderer_handle_event() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_handle_event) +CoglFilterReturn +cogl_xlib_handle_event (XEvent *xevent); + +COGL_END_DECLS + + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_XLIB_H_INSIDE__ +#undef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_XLIB_H__ */ diff --git a/cogl/cogl.c b/cogl/cogl.c new file mode 100644 index 0000000..d269bc4 --- /dev/null +++ b/cogl/cogl.c @@ -0,0 +1,823 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#include + +#include +#include +#include + +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_4 + +#include "cogl-i18n-private.h" +#include "cogl-debug.h" +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-winsys-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-matrix-private.h" +#include "cogl-journal-private.h" +#include "cogl-bitmap-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-driver.h" +#include "cogl-attribute-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-renderer-private.h" +#include "cogl-config-private.h" +#include "cogl-private.h" +#include "cogl1-context.h" +#include "cogl-offscreen.h" +#include "cogl-attribute-gl-private.h" +#include "cogl-clutter.h" + +CoglFuncPtr +cogl_get_proc_address (const char* name) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + return _cogl_renderer_get_proc_address (ctx->display->renderer, name, FALSE); +} + +CoglBool +_cogl_check_extension (const char *name, char * const *ext) +{ + while (*ext) + if (!strcmp (name, *ext)) + return TRUE; + else + ext++; + + return FALSE; +} + +/* XXX: This has been deprecated as public API */ +CoglBool +cogl_check_extension (const char *name, const char *ext) +{ + return cogl_clutter_check_extension (name, ext); +} + +/* XXX: it's expected that we'll deprecated this with + * cogl_framebuffer_clear at some point. */ +void +cogl_clear (const CoglColor *color, unsigned long buffers) +{ + cogl_framebuffer_clear (cogl_get_draw_framebuffer (), buffers, color); +} + +/* XXX: This API has been deprecated */ +void +cogl_set_depth_test_enabled (CoglBool setting) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->legacy_depth_test_enabled == setting) + return; + + ctx->legacy_depth_test_enabled = setting; + if (ctx->legacy_depth_test_enabled) + ctx->legacy_state_set++; + else + ctx->legacy_state_set--; +} + +/* XXX: This API has been deprecated */ +CoglBool +cogl_get_depth_test_enabled (void) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + return ctx->legacy_depth_test_enabled; +} + +void +cogl_set_backface_culling_enabled (CoglBool setting) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->legacy_backface_culling_enabled == setting) + return; + + ctx->legacy_backface_culling_enabled = setting; + + if (ctx->legacy_backface_culling_enabled) + ctx->legacy_state_set++; + else + ctx->legacy_state_set--; +} + +CoglBool +cogl_get_backface_culling_enabled (void) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + return ctx->legacy_backface_culling_enabled; +} + +void +cogl_set_source_color (const CoglColor *color) +{ + CoglPipeline *pipeline; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (cogl_color_get_alpha_byte (color) == 0xff) + { + cogl_pipeline_set_color (ctx->opaque_color_pipeline, color); + pipeline = ctx->opaque_color_pipeline; + } + else + { + CoglColor premultiplied = *color; + cogl_color_premultiply (&premultiplied); + cogl_pipeline_set_color (ctx->blended_color_pipeline, &premultiplied); + pipeline = ctx->blended_color_pipeline; + } + + cogl_set_source (pipeline); +} + +void +cogl_set_viewport (int x, + int y, + int width, + int height) +{ + CoglFramebuffer *framebuffer; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + framebuffer = cogl_get_draw_framebuffer (); + + cogl_framebuffer_set_viewport (framebuffer, + x, + y, + width, + height); +} + +/* XXX: This should be deprecated, and we should expose a way to also + * specify an x and y viewport offset */ +void +cogl_viewport (unsigned int width, + unsigned int height) +{ + cogl_set_viewport (0, 0, width, height); +} + +CoglFeatureFlags +cogl_get_features (void) +{ + _COGL_GET_CONTEXT (ctx, 0); + + return ctx->feature_flags; +} + +CoglBool +cogl_features_available (CoglFeatureFlags features) +{ + _COGL_GET_CONTEXT (ctx, 0); + + return (ctx->feature_flags & features) == features; +} + +CoglBool +cogl_has_feature (CoglContext *ctx, CoglFeatureID feature) +{ + return COGL_FLAGS_GET (ctx->features, feature); +} + +CoglBool +cogl_has_features (CoglContext *ctx, ...) +{ + va_list args; + CoglFeatureID feature; + + va_start (args, ctx); + while ((feature = va_arg (args, CoglFeatureID))) + if (!cogl_has_feature (ctx, feature)) + return FALSE; + va_end (args); + + return TRUE; +} + +void +cogl_foreach_feature (CoglContext *ctx, + CoglFeatureCallback callback, + void *user_data) +{ + int i; + for (i = 0; i < _COGL_N_FEATURE_IDS; i++) + if (COGL_FLAGS_GET (ctx->features, i)) + callback (i, user_data); +} + +/* XXX: This function should either be replaced with one returning + * integers, or removed/deprecated and make the + * _cogl_framebuffer_get_viewport* functions public. + */ +void +cogl_get_viewport (float viewport[4]) +{ + CoglFramebuffer *framebuffer; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + framebuffer = cogl_get_draw_framebuffer (); + cogl_framebuffer_get_viewport4fv (framebuffer, viewport); +} + +void +cogl_get_bitmasks (int *red, + int *green, + int *blue, + int *alpha) +{ + CoglFramebuffer *framebuffer; + + framebuffer = cogl_get_draw_framebuffer (); + + if (red) + *red = cogl_framebuffer_get_red_bits (framebuffer); + + if (green) + *green = cogl_framebuffer_get_green_bits (framebuffer); + + if (blue) + *blue = cogl_framebuffer_get_blue_bits (framebuffer); + + if (alpha) + *alpha = cogl_framebuffer_get_alpha_bits (framebuffer); +} + +void +cogl_set_fog (const CoglColor *fog_color, + CoglFogMode mode, + float density, + float z_near, + float z_far) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->legacy_fog_state.enabled == FALSE) + ctx->legacy_state_set++; + + ctx->legacy_fog_state.enabled = TRUE; + ctx->legacy_fog_state.color = *fog_color; + ctx->legacy_fog_state.mode = mode; + ctx->legacy_fog_state.density = density; + ctx->legacy_fog_state.z_near = z_near; + ctx->legacy_fog_state.z_far = z_far; +} + +void +cogl_disable_fog (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->legacy_fog_state.enabled == TRUE) + ctx->legacy_state_set--; + + ctx->legacy_fog_state.enabled = FALSE; +} + +void +cogl_flush (void) +{ + GList *l; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (l = ctx->framebuffers; l; l = l->next) + _cogl_framebuffer_flush_journal (l->data); +} + +void +cogl_read_pixels (int x, + int y, + int width, + int height, + CoglReadPixelsFlags source, + CoglPixelFormat format, + uint8_t *pixels) +{ + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + CoglBitmap *bitmap; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + bitmap = cogl_bitmap_new_for_data (ctx, + width, height, + format, + bpp * width, /* rowstride */ + pixels); + cogl_framebuffer_read_pixels_into_bitmap (_cogl_get_read_framebuffer (), + x, y, + source, + bitmap); + cogl_object_unref (bitmap); +} + +void +cogl_begin_gl (void) +{ + CoglPipeline *pipeline; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->in_begin_gl_block) + { + static CoglBool shown = FALSE; + if (!shown) + g_warning ("You should not nest cogl_begin_gl/cogl_end_gl blocks"); + shown = TRUE; + return; + } + ctx->in_begin_gl_block = TRUE; + + /* Flush all batched primitives */ + cogl_flush (); + + /* Flush framebuffer state, including clip state, modelview and + * projection matrix state + * + * NB: _cogl_framebuffer_flush_state may disrupt various state (such + * as the pipeline state) when flushing the clip stack, so should + * always be done first when preparing to draw. */ + _cogl_framebuffer_flush_state (cogl_get_draw_framebuffer (), + _cogl_get_read_framebuffer (), + COGL_FRAMEBUFFER_STATE_ALL); + + /* Setup the state for the current pipeline */ + + /* We considered flushing a specific, minimal pipeline here to try and + * simplify the GL state, but decided to avoid special cases and second + * guessing what would be actually helpful. + * + * A user should instead call cogl_set_source_color4ub() before + * cogl_begin_gl() to simplify the state flushed. + * + * XXX: note defining n_tex_coord_attribs using + * cogl_pipeline_get_n_layers is a hack, but the problem is that + * n_tex_coord_attribs is usually defined when drawing a primitive + * which isn't happening here. + * + * Maybe it would be more useful if this code did flush the + * opaque_color_pipeline and then call into cogl-pipeline-opengl.c to then + * restore all state for the material's backend back to default OpenGL + * values. + */ + pipeline = cogl_get_source (); + _cogl_pipeline_flush_gl_state (ctx, + pipeline, + cogl_get_draw_framebuffer (), + FALSE, + FALSE); + + /* Disable any cached vertex arrays */ + _cogl_gl_disable_all_attributes (ctx); +} + +void +cogl_end_gl (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!ctx->in_begin_gl_block) + { + static CoglBool shown = FALSE; + if (!shown) + g_warning ("cogl_end_gl is being called before cogl_begin_gl"); + shown = TRUE; + return; + } + ctx->in_begin_gl_block = FALSE; +} + +void +cogl_push_matrix (void) +{ + cogl_framebuffer_push_matrix (cogl_get_draw_framebuffer ()); +} + +void +cogl_pop_matrix (void) +{ + cogl_framebuffer_pop_matrix (cogl_get_draw_framebuffer ()); +} + +void +cogl_scale (float x, float y, float z) +{ + cogl_framebuffer_scale (cogl_get_draw_framebuffer (), x, y, z); +} + +void +cogl_translate (float x, float y, float z) +{ + cogl_framebuffer_translate (cogl_get_draw_framebuffer (), x, y, z); +} + +void +cogl_rotate (float angle, float x, float y, float z) +{ + cogl_framebuffer_rotate (cogl_get_draw_framebuffer (), angle, x, y, z); +} + +void +cogl_transform (const CoglMatrix *matrix) +{ + cogl_framebuffer_transform (cogl_get_draw_framebuffer (), matrix); +} + +void +cogl_perspective (float fov_y, + float aspect, + float z_near, + float z_far) +{ + cogl_framebuffer_perspective (cogl_get_draw_framebuffer (), + fov_y, aspect, z_near, z_far); +} + +void +cogl_frustum (float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + cogl_framebuffer_frustum (cogl_get_draw_framebuffer (), + left, right, bottom, top, z_near, z_far); +} + +void +cogl_ortho (float left, + float right, + float bottom, + float top, + float near, + float far) +{ + cogl_framebuffer_orthographic (cogl_get_draw_framebuffer (), + left, top, right, bottom, near, far); +} + +void +cogl_get_modelview_matrix (CoglMatrix *matrix) +{ + cogl_framebuffer_get_modelview_matrix (cogl_get_draw_framebuffer (), matrix); +} + +void +cogl_set_modelview_matrix (CoglMatrix *matrix) +{ + cogl_framebuffer_set_modelview_matrix (cogl_get_draw_framebuffer (), matrix); +} + +void +cogl_get_projection_matrix (CoglMatrix *matrix) +{ + cogl_framebuffer_get_projection_matrix (cogl_get_draw_framebuffer (), matrix); +} + +void +cogl_set_projection_matrix (CoglMatrix *matrix) +{ + cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix); +} + +uint32_t +_cogl_driver_error_quark (void) +{ + return g_quark_from_static_string ("cogl-driver-error-quark"); +} + +typedef struct _CoglSourceState +{ + CoglPipeline *pipeline; + int push_count; + /* If this is TRUE then the pipeline will be copied and the legacy + state will be applied whenever the pipeline is used. This is + necessary because some internal Cogl code expects to be able to + push a temporary pipeline to put GL into a known state. For that + to work it also needs to prevent applying the legacy state */ + CoglBool enable_legacy; +} CoglSourceState; + +static void +_push_source_real (CoglPipeline *pipeline, CoglBool enable_legacy) +{ + CoglSourceState *top = g_slice_new (CoglSourceState); + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + top->pipeline = cogl_object_ref (pipeline); + top->enable_legacy = enable_legacy; + top->push_count = 1; + + ctx->source_stack = g_list_prepend (ctx->source_stack, top); +} + +/* FIXME: This should take a context pointer for Cogl 2.0 Technically + * we could make it so we can retrieve a context reference from the + * pipeline, but this would not by symmetric with cogl_pop_source. */ +void +cogl_push_source (void *material_or_pipeline) +{ + CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + _cogl_push_source (pipeline, TRUE); +} + +/* This internal version of cogl_push_source is the same except it + never applies the legacy state. Some parts of Cogl use this + internally to set a temporary pipeline with a known state */ +void +_cogl_push_source (CoglPipeline *pipeline, CoglBool enable_legacy) +{ + CoglSourceState *top; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + + if (ctx->source_stack) + { + top = ctx->source_stack->data; + if (top->pipeline == pipeline && top->enable_legacy == enable_legacy) + { + top->push_count++; + return; + } + else + _push_source_real (pipeline, enable_legacy); + } + else + _push_source_real (pipeline, enable_legacy); +} + +/* FIXME: This needs to take a context pointer for Cogl 2.0 */ +void +cogl_pop_source (void) +{ + CoglSourceState *top; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (ctx->source_stack); + + top = ctx->source_stack->data; + top->push_count--; + if (top->push_count == 0) + { + cogl_object_unref (top->pipeline); + g_slice_free (CoglSourceState, top); + ctx->source_stack = g_list_delete_link (ctx->source_stack, + ctx->source_stack); + } +} + +/* FIXME: This needs to take a context pointer for Cogl 2.0 */ +void * +cogl_get_source (void) +{ + CoglSourceState *top; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, NULL); + + top = ctx->source_stack->data; + return top->pipeline; +} + +CoglBool +_cogl_get_enable_legacy_state (void) +{ + CoglSourceState *top; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, FALSE); + + top = ctx->source_stack->data; + return top->enable_legacy; +} + +void +cogl_set_source (void *material_or_pipeline) +{ + CoglSourceState *top; + CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline)); + _COGL_RETURN_IF_FAIL (ctx->source_stack); + + top = ctx->source_stack->data; + if (top->pipeline == pipeline && top->enable_legacy) + return; + + if (top->push_count == 1) + { + /* NB: top->pipeline may be only thing keeping pipeline + * alive currently so ref pipeline first... */ + cogl_object_ref (pipeline); + cogl_object_unref (top->pipeline); + top->pipeline = pipeline; + top->enable_legacy = TRUE; + } + else + { + top->push_count--; + cogl_push_source (pipeline); + } +} + +void +cogl_set_source_texture (CoglTexture *texture) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (texture != NULL); + + cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture); + cogl_set_source (ctx->texture_pipeline); +} + +void +cogl_set_source_color4ub (uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha) +{ + CoglColor c = { 0, }; + + cogl_color_init_from_4ub (&c, red, green, blue, alpha); + cogl_set_source_color (&c); +} + +void +cogl_set_source_color4f (float red, + float green, + float blue, + float alpha) +{ + CoglColor c = { 0, }; + + cogl_color_init_from_4f (&c, red, green, blue, alpha); + cogl_set_source_color (&c); +} + +/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1) + * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with + * (0,0) being top left. */ +#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ + ( ( ((x) + 1.0) * ((vp_width) / 2.0) ) + (vp_origin_x) ) +/* Note: for Y we first flip all coordinates around the X axis while in + * normalized device coodinates */ +#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ + ( ( ((-(y)) + 1.0) * ((vp_height) / 2.0) ) + (vp_origin_y) ) + +/* Transform a homogeneous vertex position from model space to Cogl + * window coordinates (with 0,0 being top left) */ +void +_cogl_transform_point (const CoglMatrix *matrix_mv, + const CoglMatrix *matrix_p, + const float *viewport, + float *x, + float *y) +{ + float z = 0; + float w = 1; + + /* Apply the modelview matrix transform */ + cogl_matrix_transform_point (matrix_mv, x, y, &z, &w); + + /* Apply the projection matrix transform */ + cogl_matrix_transform_point (matrix_p, x, y, &z, &w); + + /* Perform perspective division */ + *x /= w; + *y /= w; + + /* Apply viewport transform */ + *x = VIEWPORT_TRANSFORM_X (*x, viewport[0], viewport[2]); + *y = VIEWPORT_TRANSFORM_Y (*y, viewport[1], viewport[3]); +} + +#undef VIEWPORT_TRANSFORM_X +#undef VIEWPORT_TRANSFORM_Y + +uint32_t +_cogl_system_error_quark (void) +{ + return g_quark_from_static_string ("cogl-system-error-quark"); +} + +void +_cogl_init (void) +{ + static CoglBool initialized = FALSE; + + if (initialized == FALSE) + { +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, COGL_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif + +#ifdef COGL_HAS_GTYPE_SUPPORT + g_type_init (); +#endif + + _cogl_config_read (); + _cogl_debug_check_environment (); + initialized = TRUE; + } +} + +/* + * Returns the number of bytes-per-pixel of a given format. The bpp + * can be extracted from the least significant nibble of the pixel + * format (see CoglPixelFormat). + * + * The mapping is the following (see discussion on bug #660188): + * + * 0 = undefined + * 1, 8 = 1 bpp (e.g. A_8, G_8) + * 2 = 3 bpp, aligned (e.g. 888) + * 3 = 4 bpp, aligned (e.g. 8888) + * 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551) + * 7 = undefined yuv + * 9 = 2 bpp, aligned + * 10 = undefined + * 11 = undefined + * 12 = 3 bpp, not aligned + * 13 = 4 bpp, not aligned (e.g. 2101010) + * 14-15 = undefined + */ +int +_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format) +{ + int bpp_lut[] = { 0, 1, 3, 4, + 2, 2, 2, 0, + 1, 2, 0, 0, + 3, 4, 0, 0 }; + + return bpp_lut [format & 0xf]; +} + +/* Note: this also refers to the mapping defined above for + * _cogl_pixel_format_get_bytes_per_pixel() */ +CoglBool +_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format) +{ + int aligned_lut[] = { -1, 1, 1, 1, + 0, 0, 0, -1, + 1, 1, -1, -1, + 0, 0, -1, -1}; + int aligned = aligned_lut[format & 0xf]; + + _COGL_RETURN_VAL_IF_FAIL (aligned != -1, FALSE); + + /* NB: currently checking whether the format components are aligned + * or not determines whether the format is endian dependent or not. + * In the future though we might consider adding formats with + * aligned components that are also endian independant. */ + + return aligned; +} diff --git a/cogl/cogl.h b/cogl/cogl.h new file mode 100644 index 0000000..84c3951 --- /dev/null +++ b/cogl/cogl.h @@ -0,0 +1,194 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_H__ +#define __COGL_H__ + +#ifdef COGL_COMPILATION +#error " shouldn't be included internally" +#endif + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +#ifndef COGL_ENABLE_EXPERIMENTAL_API +#define COGL_ENABLE_EXPERIMENTAL_API +#endif +#endif + +/* We currently keep gtype integration delimited in case we eventually + * want to split it out into a separate utility library when Cogl + * becomes a standalone project. (like cairo-gobject.so) + */ +#define _COGL_SUPPORTS_GTYPE_INTEGRATION + +/* + * API common to the 1.x and 2.0 api... + */ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * 1.x only api... + */ +#ifndef COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#include +#include +#include +#include +#include +#include +#endif + +/* It would be good to move these casts up into 1.x only api if we can + * update Clutter, Mutter and GnomeShell to avoid redundant casts when + * they enable the experimental api... */ +#include + +#include +#include + +/* + * 2.0 api that's compatible with the 1.x api... + */ +#if defined (COGL_ENABLE_EXPERIMENTAL_API) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) +#include +#include +#endif +#ifdef COGL_HAS_WIN32_SUPPORT +#include +#endif +#ifdef COGL_HAS_GLIB_SUPPORT +#include +#endif +/* XXX: This will definitly go away once all the Clutter winsys + * code has been migrated down into Cogl! */ +#include +#endif + +/* + * API deprecations + */ +#include + +/* + * Cogl Path api compatability + * + * The cogl_path_ api used to be part of the core Cogl api so for + * compatability we include cogl-path.h via cogl.h + * + * Note: we have to make sure not to include cogl-path.h while + * building core cogl or generating the Cogl .gir data because + * cogl-path now gets built after cogl and some cogl-path headers are + * only generated at build time... + */ +#if defined (COGL_HAS_COGL_PATH_SUPPORT) && \ + !defined (COGL_COMPILATION) && \ + !defined (COGL_GIR_SCANNING) +#include +#endif + +/** + * SECTION:cogl + * @short_description: General purpose API + * + * General utility functions for COGL. + */ + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_H__ */ diff --git a/cogl/cogl.rc b/cogl/cogl.rc new file mode 100644 index 0000000..87b218f --- /dev/null +++ b/cogl/cogl.rc @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,18,2,0 + PRODUCTVERSION 1,18,2,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Intel Corporation" + VALUE "FileDescription", "cogl" + VALUE "FileVersion", "1.18.2.0" + VALUE "InternalName", "libcogl-1.0-2" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-1.0-2.dll" + VALUE "ProductName", "cogl" + VALUE "ProductVersion", "1.18.2" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/cogl/cogl.rc.in b/cogl/cogl.rc.in new file mode 100644 index 0000000..0911559 --- /dev/null +++ b/cogl/cogl.rc.in @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,@COGL_1_MINOR_VERSION@,@COGL_1_MICRO_VERSION@,0 + PRODUCTVERSION 1,@COGL_1_MINOR_VERSION@,@COGL_1_MICRO_VERSION@,0 + FILEFLAGSMASK 0 + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Intel Corporation" + VALUE "FileDescription", "cogl" + VALUE "FileVersion", "@COGL_1_VERSION@.0" + VALUE "InternalName", "libcogl-1.0-@COGL_LT_AGE@" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-1.0-@COGL_LT_AGE@.dll" + VALUE "ProductName", "cogl" + VALUE "ProductVersion", "@COGL_1_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols new file mode 100644 index 0000000..c48314a --- /dev/null +++ b/cogl/cogl.symbols @@ -0,0 +1,1108 @@ + + +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT +cogl_android_set_native_window +#endif + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_atlas_texture_get_gtype +#endif +cogl_atlas_texture_new_with_size +cogl_atlas_texture_new_from_file +cogl_atlas_texture_new_from_data +cogl_atlas_texture_new_from_bitmap + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_attribute_buffer_get_gtype +#endif +cogl_attribute_buffer_new_with_size + +cogl_attribute_buffer_new +cogl_attribute_get_buffer +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_attribute_get_gtype +#endif +cogl_attribute_get_normalized +cogl_attribute_new +cogl_attribute_new_const_1f +cogl_attribute_new_const_2f +cogl_attribute_new_const_2fv +cogl_attribute_new_const_2x2fv +cogl_attribute_new_const_3f +cogl_attribute_new_const_3fv +cogl_attribute_new_const_3x3fv +cogl_attribute_new_const_4f +cogl_attribute_new_const_4fv +cogl_attribute_new_const_4x4fv +cogl_attribute_set_buffer +cogl_attribute_set_normalized +cogl_attribute_type_get_type + +cogl_begin_gl + +cogl_bitmap_error_get_type +cogl_bitmap_get_buffer +cogl_bitmap_get_format +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_bitmap_get_gtype +#endif +cogl_bitmap_get_height +cogl_bitmap_get_rowstride +cogl_bitmap_get_size_from_file +cogl_bitmap_get_width +cogl_bitmap_new_for_data +cogl_bitmap_new_from_file +cogl_bitmap_new_from_buffer +cogl_bitmap_new_with_size +cogl_blend_string_error_get_type + +cogl_buffer_bit_get_type +cogl_buffer_get_size +cogl_buffer_get_update_hint +#if 0 +/* not implemented! */ +cogl_buffer_get_usage_hint +#endif +cogl_buffer_map +cogl_buffer_map_range +cogl_buffer_set_data +cogl_buffer_set_update_hint +#if 0 +/* not implemented! */ +cogl_buffer_set_usage_hint +#endif +cogl_buffer_target_get_type +cogl_buffer_unmap + +#ifndef COGL_DISABLE_DEPRECATED +cogl_check_extension +#endif + +cogl_clear + +#ifndef COGL_DISABLE_DEPRECATED +cogl_clip_ensure +#endif + +cogl_clip_pop + +#ifndef COGL_DISABLE_DEPRECATED +cogl_clip_push +#endif + +cogl_clip_push_rectangle + +cogl_clip_push_window_rect + +cogl_clip_push_primitive + +#ifndef COGL_DISABLE_DEPRECATED +cogl_clip_push_window_rectangle +cogl_clip_stack_restore +cogl_clip_stack_save +#endif + +#ifndef COGL_WINSYS_INTEGRATED +cogl_clutter_check_extension_CLUTTER +cogl_clutter_winsys_has_feature_CLUTTER +#ifdef COGL_HAS_XLIB +cogl_clutter_winsys_xlib_get_visual_info_CLUTTER +#endif +#endif + +cogl_color_copy +cogl_color_equal +cogl_color_free +cogl_color_get_alpha +cogl_color_get_alpha_byte +cogl_color_get_alpha_float +cogl_color_get_blue +cogl_color_get_blue_byte +cogl_color_get_blue_float +cogl_color_get_green +cogl_color_get_green_byte +cogl_color_get_green_float +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_color_get_gtype +#endif +cogl_color_get_red +cogl_color_get_red_byte +cogl_color_get_red_float +cogl_color_init_from_hsl +cogl_color_init_from_4f +cogl_color_init_from_4fv +cogl_color_init_from_4ub +cogl_color_mask_get_type +cogl_color_new +cogl_color_premultiply +cogl_color_set_alpha +cogl_color_set_alpha_byte +cogl_color_set_alpha_float +cogl_color_set_blue +cogl_color_set_blue_byte +cogl_color_set_blue_float +cogl_color_set_from_4f +cogl_color_set_from_4ub +cogl_color_set_green +cogl_color_set_green_byte +cogl_color_set_green_float +cogl_color_set_red +cogl_color_set_red_byte +cogl_color_set_red_float +cogl_color_to_hsl +cogl_color_unpremultiply + + +#ifdef COGL_HAS_EGL_SUPPORT +cogl_egl_context_get_egl_display +cogl_egl_context_get_egl_context +#endif + +#ifdef COGL_HAS_GLX_SUPPORT +cogl_glx_context_get_glx_context +#endif + +cogl_context_get_display +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_context_get_gtype +#endif +cogl_context_get_renderer +cogl_context_new + +cogl_create_program +cogl_create_shader + +cogl_debug_matrix_entry_print +cogl_debug_matrix_print +cogl_debug_object_foreach_type +cogl_debug_object_print_instances +cogl_depth_state_get_range +cogl_depth_state_get_test_enabled +cogl_depth_state_get_test_function +cogl_depth_state_get_write_enabled +cogl_depth_state_init +cogl_depth_state_set_test_enabled +cogl_depth_state_set_test_function +cogl_depth_state_set_range +cogl_depth_state_set_write_enabled +cogl_depth_test_function_get_type + +cogl_disable_fog + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_display_get_gtype +#endif +cogl_display_get_renderer +cogl_display_new +cogl_display_setup +cogl_display_set_onscreen_template + +cogl_double_to_fixed + +cogl_end_gl + +cogl_error_copy +cogl_error_free +cogl_error_matches + +cogl_euler_copy +cogl_euler_equal +cogl_euler_free +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_euler_get_gtype +#endif +cogl_euler_init +cogl_euler_init_from_matrix +#if 0 +/* not yet implemented */ +cogl_euler_init_from_quaternion +#endif + +cogl_features_available +cogl_feature_flags_get_type +cogl_fence_closure_get_user_data +cogl_fixed_atan +cogl_fixed_atan2 +cogl_fixed_cos +cogl_fixed_get_type +cogl_fixed_log2 +cogl_fixed_pow +cogl_fixed_pow2 +cogl_fixed_sin +cogl_fixed_sqrt +cogl_fixed_tan + +cogl_fog_mode_get_type + +cogl_foreach_feature + +cogl_flush + +cogl_framebuffer_add_fence_callback +cogl_framebuffer_allocate +cogl_framebuffer_cancel_fence_callback +cogl_framebuffer_clear4f +cogl_framebuffer_clear +cogl_framebuffer_discard_buffers +cogl_framebuffer_draw_primitive +cogl_framebuffer_draw_rectangle +cogl_framebuffer_draw_rectangles +cogl_framebuffer_draw_textured_rectangle +cogl_framebuffer_draw_textured_rectangles +cogl_framebuffer_finish +cogl_framebuffer_frustum +cogl_framebuffer_get_alpha_bits +cogl_framebuffer_get_blue_bits +cogl_framebuffer_get_color_format +cogl_framebuffer_get_color_mask +cogl_framebuffer_get_context +cogl_framebuffer_get_depth_bits +cogl_framebuffer_get_depth_texture +cogl_framebuffer_get_depth_texture_enabled +cogl_framebuffer_get_depth_write_enabled +cogl_framebuffer_get_dither_enabled +cogl_framebuffer_get_green_bits +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_framebuffer_get_gtype +#endif +cogl_framebuffer_get_height +cogl_framebuffer_get_modelview_matrix +cogl_framebuffer_get_projection_matrix +cogl_framebuffer_get_red_bits +cogl_framebuffer_get_samples_per_pixel +cogl_framebuffer_get_viewport4fv +cogl_framebuffer_get_viewport_height +cogl_framebuffer_get_viewport_width +cogl_framebuffer_get_viewport_x +cogl_framebuffer_get_viewport_y +cogl_framebuffer_get_width +cogl_framebuffer_identity_matrix +cogl_framebuffer_orthographic +cogl_framebuffer_perspective +cogl_framebuffer_pop_clip +cogl_framebuffer_pop_matrix +cogl_framebuffer_push_matrix +cogl_framebuffer_push_primitive_clip +cogl_framebuffer_push_rectangle_clip +cogl_framebuffer_push_scissor_clip +cogl_framebuffer_read_pixels +cogl_framebuffer_read_pixels_into_bitmap +cogl_framebuffer_resolve_samples +cogl_framebuffer_resolve_samples_region +cogl_framebuffer_rotate + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +cogl_framebuffer_rotate_euler +cogl_framebuffer_rotate_quaternion +#endif + +cogl_framebuffer_scale +cogl_framebuffer_set_color_mask +cogl_framebuffer_set_depth_texture_enabled +cogl_framebuffer_set_depth_write_enabled +cogl_framebuffer_set_dither_enabled +cogl_framebuffer_set_modelview_matrix +cogl_framebuffer_set_projection_matrix +cogl_framebuffer_set_samples_per_pixel +cogl_framebuffer_set_viewport +cogl_framebuffer_transform +cogl_framebuffer_translate +cogl_framebuffer_vdraw_attributes +/* cogl_framebuffer_vdraw_indexed_attributes */ /* Not Implemented! */ + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_frame_closure_get_gtype +#endif +cogl_frame_info_get_frame_counter + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_frame_info_get_gtype +#endif +cogl_frame_info_get_output +cogl_frame_info_get_presentation_time +cogl_frame_info_get_refresh_rate + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +cogl_gdl_display_set_plane +#endif + +cogl_frustum + +cogl_get_backface_culling_enabled +cogl_get_bitmasks +cogl_get_clock_time +cogl_get_depth_test_enabled +cogl_get_draw_framebuffer +cogl_get_features +cogl_get_modelview_matrix +cogl_get_option_group +cogl_get_proc_address +cogl_get_projection_matrix +cogl_get_rectangle_indices +cogl_get_source +cogl_get_static_identity_quaternion +cogl_get_static_zero_quaternion +cogl_get_viewport + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_gles2_context_get_gtype +#endif +cogl_gles2_context_get_vtable +cogl_gles2_context_new +cogl_gles2_get_current_vtable +cogl_gles2_texture_get_handle +cogl_gles2_texture_2d_new_from_handle + +#ifdef COGL_HAS_GLIB_SUPPORT +cogl_glib_renderer_source_new +cogl_glib_source_new +#endif + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_gtype_matrix_get_type +#endif + +cogl_handle_get_type +cogl_handle_ref +cogl_handle_unref + +cogl_has_feature +cogl_has_features + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_index_buffer_get_gtype +#endif +cogl_index_buffer_new +cogl_indices_get_buffer +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_indices_get_gtype +#endif +cogl_indices_get_offset +cogl_indices_get_type +cogl_indices_new +cogl_indices_new_for_buffer +cogl_indices_set_offset +cogl_indices_type_get_type + +cogl_is_atlas_texture +cogl_is_attribute +cogl_is_attribute_buffer +cogl_is_bitmap +cogl_is_buffer +cogl_is_context +cogl_is_frame_info +cogl_is_gles2_context +cogl_is_index_buffer +#if 0 +/* not implemented! */ +cogl_is_indices_array +#endif +cogl_is_material +cogl_is_matrix_stack +cogl_is_offscreen +cogl_is_output +cogl_is_pipeline +cogl_is_pixel_buffer +cogl_is_primitive +cogl_is_primitive_texture +cogl_is_program +cogl_is_renderer +cogl_is_shader +cogl_is_snippet +cogl_is_sub_texture +cogl_is_texture +#ifdef COGL_HAS_X11 +cogl_is_texture_pixmap_x11 +#endif +cogl_is_texture_rectangle +cogl_is_texture_2d +cogl_is_texture_3d + +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT +cogl_kms_display_queue_modes_reset +cogl_kms_display_set_layout +cogl_kms_renderer_get_kms_fd +#endif + +cogl_material_alpha_func_get_type +cogl_material_copy +cogl_material_filter_get_type +cogl_material_foreach_layer +cogl_material_get_ambient +cogl_material_get_color +cogl_material_get_depth_state +cogl_material_get_diffuse +cogl_material_get_emission +cogl_material_get_layers +cogl_material_get_layer_point_sprite_coords_enabled +cogl_material_get_layer_wrap_mode_p +cogl_material_get_layer_wrap_mode_s +cogl_material_get_layer_wrap_mode_t +cogl_material_get_n_layers +cogl_material_get_point_size +cogl_material_get_shininess +cogl_material_get_specular +cogl_material_get_user_program +cogl_material_layer_get_mag_filter +cogl_material_layer_get_min_filter +cogl_material_layer_get_texture +cogl_material_layer_get_type +cogl_material_layer_get_wrap_mode_p +cogl_material_layer_get_wrap_mode_s +cogl_material_layer_get_wrap_mode_t +cogl_material_layer_type_get_type +cogl_material_new +cogl_material_remove_layer +#ifndef COGL_DISABLE_DEPRECATED +cogl_material_ref +#endif +cogl_material_set_alpha_test_function +cogl_material_set_ambient +cogl_material_set_ambient_and_diffuse +cogl_material_set_blend +cogl_material_set_blend_constant +cogl_material_set_color +cogl_material_set_color4f +cogl_material_set_color4ub +cogl_material_set_depth_state +cogl_material_set_diffuse +cogl_material_set_emission +cogl_material_set_layer +cogl_material_set_layer_combine +cogl_material_set_layer_combine_constant +cogl_material_set_layer_filters +cogl_material_set_layer_matrix +cogl_material_set_layer_point_sprite_coords_enabled +cogl_material_set_layer_wrap_mode +cogl_material_set_layer_wrap_mode_p +cogl_material_set_layer_wrap_mode_s +cogl_material_set_layer_wrap_mode_t +cogl_material_set_point_size +cogl_material_set_shininess +cogl_material_set_specular +cogl_material_set_user_program +#ifndef COGL_DISABLE_DEPRECATED +cogl_material_unref +#endif +cogl_material_wrap_mode_get_type + +cogl_matrix_copy +cogl_matrix_entry_calculate_translation +cogl_matrix_entry_equal +cogl_matrix_entry_get +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_matrix_entry_get_gtype +#endif +cogl_matrix_entry_is_identity +cogl_matrix_entry_ref +cogl_matrix_entry_unref +cogl_matrix_equal +cogl_matrix_free +cogl_matrix_frustum +cogl_matrix_get_array +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_matrix_get_gtype +#endif +cogl_matrix_get_inverse +cogl_matrix_init_from_array +cogl_matrix_init_translation +cogl_matrix_is_identity +cogl_matrix_init_from_euler +cogl_matrix_init_from_quaternion +cogl_matrix_init_identity +cogl_matrix_look_at +cogl_matrix_multiply +#ifndef COGL_DISABLE_DEPRECATED +cogl_matrix_ortho +#endif +cogl_matrix_orthographic +cogl_matrix_perspective +cogl_matrix_project_points +cogl_matrix_rotate + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +cogl_matrix_rotate_euler +cogl_matrix_rotate_quaternion +#endif + +cogl_matrix_scale +cogl_matrix_stack_frustum +cogl_matrix_stack_get +cogl_matrix_stack_get_entry +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_matrix_stack_get_gtype +#endif +cogl_matrix_stack_get_inverse +cogl_matrix_stack_load_identity +cogl_matrix_stack_multiply +cogl_matrix_stack_new +cogl_matrix_stack_orthographic +cogl_matrix_stack_perspective +cogl_matrix_stack_pop +cogl_matrix_stack_push +cogl_matrix_stack_rotate +cogl_matrix_stack_rotate_euler +cogl_matrix_stack_rotate_quaternion +cogl_matrix_stack_scale +cogl_matrix_stack_set +cogl_matrix_stack_translate +cogl_matrix_transform_point +cogl_matrix_transform_points +cogl_matrix_translate +cogl_matrix_transpose +cogl_matrix_view_2d_in_frustum +cogl_matrix_view_2d_in_perspective + +cogl_meta_texture_foreach_in_region + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_object_get_gtype +#endif +cogl_object_get_user_data +cogl_object_ref +cogl_object_set_user_data +cogl_object_unref + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_offscreen_get_gtype +#endif +cogl_offscreen_new_to_texture +cogl_offscreen_new_with_texture + +cogl_onscreen_add_dirty_callback +cogl_onscreen_add_frame_callback +cogl_onscreen_add_resize_callback +cogl_onscreen_add_swap_buffers_callback +#ifndef COGL_WINSYS_INTEGRATED +cogl_onscreen_clutter_backend_set_size_CLUTTER +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_onscreen_dirty_closure_get_gtype +#endif +cogl_onscreen_get_buffer_age +cogl_onscreen_get_frame_counter +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_onscreen_get_gtype +#endif +cogl_onscreen_get_resizable +cogl_onscreen_hide +cogl_onscreen_new +cogl_onscreen_set_swap_throttled +cogl_onscreen_remove_dirty_callback +cogl_onscreen_remove_frame_callback +cogl_onscreen_remove_resize_callback +cogl_onscreen_remove_swap_buffers_callback +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_onscreen_resize_closure_get_gtype +#endif +cogl_onscreen_set_resizable +cogl_onscreen_set_swap_throttled +cogl_onscreen_show +cogl_onscreen_swap_buffers +cogl_onscreen_swap_buffers_with_damage +cogl_onscreen_swap_region +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_onscreen_template_get_gtype +#endif +cogl_onscreen_template_new +cogl_onscreen_template_set_samples_per_pixel +cogl_onscreen_template_set_swap_throttled + +cogl_ortho + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_output_get_gtype +#endif +cogl_output_get_height +cogl_output_get_mm_height +cogl_output_get_mm_width +cogl_output_get_refresh_rate +cogl_output_get_subpixel_order +cogl_output_get_width +cogl_output_get_x +cogl_output_get_y + +cogl_perspective + +cogl_pipeline_add_layer_snippet +cogl_pipeline_add_snippet +cogl_pipeline_copy +cogl_pipeline_foreach_layer +cogl_pipeline_get_alpha_test_function +cogl_pipeline_get_alpha_test_reference +cogl_pipeline_get_ambient +cogl_pipeline_get_color +cogl_pipeline_get_color_mask +cogl_pipeline_get_cull_face_mode +cogl_pipeline_get_depth_state +cogl_pipeline_get_diffuse +cogl_pipeline_get_emission +cogl_pipeline_get_front_face_winding +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_pipeline_get_gtype +#endif +cogl_pipeline_get_layer_mag_filter +cogl_pipeline_get_layer_min_filter +cogl_pipeline_get_layer_point_sprite_coords_enabled +cogl_pipeline_get_layer_texture +cogl_pipeline_get_layer_wrap_mode_p +cogl_pipeline_get_layer_wrap_mode_s +cogl_pipeline_get_layer_wrap_mode_t +cogl_pipeline_get_n_layers +cogl_pipeline_get_per_vertex_point_size +cogl_pipeline_get_point_size +cogl_pipeline_get_shininess +cogl_pipeline_get_specular +cogl_pipeline_get_uniform_location +cogl_pipeline_get_user_program +cogl_pipeline_new +cogl_pipeline_set_alpha_test_function +cogl_pipeline_set_ambient +cogl_pipeline_set_ambient_and_diffuse +cogl_pipeline_set_blend +cogl_pipeline_set_blend_constant +cogl_pipeline_set_color +cogl_pipeline_set_color_mask +cogl_pipeline_set_color4f +cogl_pipeline_set_color4ub +cogl_pipeline_set_cull_face_mode +cogl_pipeline_set_depth_state +cogl_pipeline_set_diffuse +cogl_pipeline_set_emission +cogl_pipeline_set_front_face_winding +cogl_pipeline_set_layer_combine +cogl_pipeline_set_layer_combine_constant +cogl_pipeline_set_layer_filters +cogl_pipeline_set_layer_matrix +cogl_pipeline_set_layer_null_texture +cogl_pipeline_set_layer_point_sprite_coords_enabled +cogl_pipeline_set_layer_texture +cogl_pipeline_set_layer_wrap_mode +cogl_pipeline_set_layer_wrap_mode_p +cogl_pipeline_set_layer_wrap_mode_s +cogl_pipeline_set_layer_wrap_mode_t +cogl_pipeline_set_per_vertex_point_size +cogl_pipeline_set_point_size +cogl_pipeline_remove_layer +cogl_pipeline_set_shininess +cogl_pipeline_set_specular +cogl_pipeline_set_uniform_float +cogl_pipeline_set_uniform_int +cogl_pipeline_set_uniform_matrix +cogl_pipeline_set_uniform_1f +cogl_pipeline_set_uniform_1i +cogl_pipeline_set_user_program + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_pixel_buffer_get_gtype +#endif +cogl_pixel_buffer_new +#if 0 +/* not exported in the main APIs for now */ +cogl_pixel_buffer_set_region +#endif +cogl_pixel_format_get_type + +cogl_poll_renderer_dispatch +cogl_poll_renderer_get_info + +cogl_polygon + +#ifndef COGL_DISABLE_DEPRECATED +cogl_pop_draw_buffer +#endif +cogl_pop_framebuffer +cogl_pop_gles2_context +cogl_pop_matrix +cogl_pop_source + +cogl_primitive_copy +cogl_primitive_foreach_attribute +cogl_primitive_get_first_vertex +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_primitive_get_gtype +#endif +cogl_primitive_get_indices +cogl_primitive_get_mode +cogl_primitive_get_n_vertices +cogl_primitive_new +cogl_primitive_new_p2 +cogl_primitive_new_p2c4 +cogl_primitive_new_p2t2 +cogl_primitive_new_p2t2c4 +cogl_primitive_new_p3 +cogl_primitive_new_p3c4 +cogl_primitive_new_p3t2 +cogl_primitive_new_p3t2c4 +cogl_primitive_new_with_attributes +cogl_primitive_set_attributes +cogl_primitive_set_first_vertex +cogl_primitive_set_indices +cogl_primitive_set_mode +cogl_primitive_set_n_vertices +cogl_primitive_draw + +cogl_primitive_texture_set_auto_mipmap + +cogl_program_attach_shader +cogl_program_get_uniform_location +cogl_program_link + +#ifndef COGL_DISABLE_DEPRECATED +cogl_program_ref +#endif + +cogl_program_set_uniform_float +cogl_program_set_uniform_int +cogl_program_set_uniform_matrix +cogl_program_set_uniform_1f +cogl_program_set_uniform_1i + +#ifndef COGL_DISABLE_DEPRECATED +cogl_program_uniform_float +cogl_program_uniform_int +cogl_program_uniform_matrix +cogl_program_uniform_1f +cogl_program_uniform_1i +cogl_program_unref +#endif + +cogl_program_use + +#ifndef COGL_DISABLE_DEPRECATED +cogl_push_draw_buffer +#endif + +cogl_push_framebuffer +cogl_push_gles2_context +cogl_push_matrix +cogl_push_source + +cogl_quaternion_copy +cogl_quaternion_dot_product +cogl_quaternion_equal +cogl_quaternion_free +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_quaternion_get_gtype +#endif +cogl_quaternion_get_rotation_angle +cogl_quaternion_get_rotation_axis +cogl_quaternion_init +cogl_quaternion_init_from_angle_vector +cogl_quaternion_init_from_array +cogl_quaternion_init_from_euler +cogl_quaternion_init_from_x_rotation +cogl_quaternion_init_from_y_rotation +cogl_quaternion_init_from_z_rotation +cogl_quaternion_init_identity +cogl_quaternion_invert +cogl_quaternion_multiply +cogl_quaternion_nlerp +cogl_quaternion_normalize +cogl_quaternion_pow +cogl_quaternion_slerp +cogl_quaternion_squad + +cogl_read_pixels +cogl_read_pixels_flags_get_type + +cogl_rectangle +cogl_rectangles +cogl_rectangles_with_texture_coords +cogl_rectangle_with_multitexture_coords +cogl_rectangle_with_texture_coords + +cogl_renderer_add_constraint +cogl_renderer_check_onscreen_template +cogl_renderer_connect +cogl_renderer_foreach_output +cogl_renderer_get_driver +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_renderer_get_gtype +#endif +cogl_renderer_get_n_fragment_texture_units +cogl_renderer_error_get_type +cogl_renderer_get_winsys_id +cogl_renderer_new +cogl_renderer_remove_constraint +cogl_renderer_set_driver +cogl_renderer_set_winsys_id + +cogl_rotate + +cogl_scale + +cogl_set_backface_culling_enabled +cogl_set_depth_test_enabled +#ifndef COGL_DISABLE_DEPRECATED +cogl_set_draw_buffer +#endif +cogl_set_fog +#ifdef COGL_HAS_SDL_SUPPORT +cogl_sdl_context_new +cogl_sdl_handle_event +cogl_sdl_idle +#if SDL_MAJOR_VERSION >= 2 +cogl_sdl_onscreen_get_window +#endif +cogl_sdl_renderer_get_event_type +cogl_sdl_renderer_set_event_type +#endif + +cogl_set_framebuffer +cogl_set_modelview_matrix +cogl_set_projection_matrix +cogl_set_source +cogl_set_source_color +cogl_set_source_color4f +cogl_set_source_color4ub +cogl_set_source_texture +cogl_set_viewport + +cogl_shader_compile +cogl_shader_get_info_log +cogl_shader_get_type +cogl_shader_is_compiled + +#ifndef COGL_DISABLE_DEPRECATED +cogl_shader_ref +#endif + +cogl_shader_source +cogl_shader_type_get_type + +#ifndef COGL_DISABLE_DEPRECATED +cogl_shader_unref +#endif + +cogl_snippet_get_declarations +cogl_snippet_get_hook +cogl_snippet_get_post +cogl_snippet_get_pre +cogl_snippet_get_replace +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_snippet_get_gtype +#endif +cogl_snippet_new +cogl_snippet_set_declarations +cogl_snippet_set_post +cogl_snippet_set_pre +cogl_snippet_set_replace + +cogl_sqrti + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_sub_texture_get_gtype +#endif +cogl_sub_texture_get_parent +cogl_sub_texture_new + +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_swap_chain_get_gtype +#endif +cogl_swap_chain_new +cogl_swap_chain_set_has_alpha +cogl_swap_chain_set_length + +cogl_system_error_get_type + +cogl_texture_allocate +cogl_texture_components_get_type +cogl_texture_error_get_type +cogl_texture_flags_get_type +cogl_texture_get_components +cogl_texture_get_data +cogl_texture_get_format +cogl_texture_get_gl_texture +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_get_gtype +#endif +cogl_texture_get_height +cogl_texture_get_max_waste +cogl_texture_get_premultiplied +cogl_texture_get_rowstride +cogl_texture_get_width +cogl_texture_is_sliced +cogl_texture_new_from_bitmap +cogl_texture_new_from_data +cogl_texture_new_from_file +cogl_texture_new_from_foreign +cogl_texture_new_from_sub_texture +cogl_texture_new_with_size +#ifdef COGL_HAS_X11 +cogl_texture_pixmap_x11_error_domain +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_pixmap_x11_get_gtype +#endif +cogl_texture_pixmap_x11_is_using_tfp_extension +cogl_texture_pixmap_x11_new +cogl_texture_pixmap_x11_set_damage_object +cogl_texture_pixmap_x11_update_area +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_rectangle_get_gtype +#endif +cogl_texture_rectangle_new_from_bitmap +cogl_texture_rectangle_new_from_foreign +cogl_texture_rectangle_new_with_size +#ifndef COGL_DISABLE_DEPRECATED +cogl_texture_ref +#endif +cogl_texture_set_components +cogl_texture_set_data +cogl_texture_set_premultiplied +cogl_texture_set_region +cogl_texture_set_region_from_bitmap +cogl_texture_type_get_type +#ifndef COGL_DISABLE_DEPRECATED +cogl_texture_unref +#endif +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_2d_get_gtype +#endif +cogl_texture_2d_new_from_bitmap +cogl_texture_2d_new_from_data +cogl_texture_2d_new_from_file +cogl_texture_2d_new_with_size +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_2d_sliced_get_gtype +#endif +cogl_texture_2d_sliced_new_from_bitmap +cogl_texture_2d_sliced_new_from_data +cogl_texture_2d_sliced_new_from_file +cogl_texture_2d_sliced_new_with_size +#ifdef COGL_HAS_GTYPE_SUPPORT +cogl_texture_3d_get_gtype +#endif +cogl_texture_3d_new_from_bitmap +cogl_texture_3d_new_from_data +cogl_texture_3d_new_with_size + +cogl_transform +cogl_translate + +cogl_vector3_add +cogl_vector3_copy +cogl_vector3_cross_product +cogl_vector3_distance +cogl_vector3_divide_scalar +cogl_vector3_dot_product +cogl_vector3_equal +cogl_vector3_equal_with_epsilon +cogl_vector3_free +cogl_vector3_init +cogl_vector3_init_zero +cogl_vector3_invert +cogl_vector3_magnitude +cogl_vector3_multiply_scalar +cogl_vector3_normalize +cogl_vector3_subtract + +cogl_vertex_buffer_add +cogl_vertex_buffer_delete +cogl_vertex_buffer_disable +cogl_vertex_buffer_draw +cogl_vertex_buffer_draw_elements +cogl_vertex_buffer_enable +cogl_vertex_buffer_get_n_vertices +cogl_vertex_buffer_indices_get_for_quads +cogl_vertex_buffer_indices_get_type +cogl_vertex_buffer_indices_new +cogl_vertex_buffer_new +#ifndef COGL_DISABLE_DEPRECATED +cogl_vertex_buffer_ref +#endif +cogl_vertex_buffer_submit +#ifndef COGL_DISABLE_DEPRECATED +cogl_vertex_buffer_unref +#endif + +cogl_vertices_mode_get_type + +#ifdef COGL_DISABLE_DEPRECATED +cogl_viewport +#endif + +cogl_winsys_feature_get_type + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +cogl_wayland_display_set_compositor_display +#endif +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT +cogl_wayland_onscreen_get_shell_surface +cogl_wayland_onscreen_get_surface +#endif +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +cogl_wayland_onscreen_resize +#endif +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT +cogl_wayland_onscreen_set_foreign_surface +#endif +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +cogl_wayland_renderer_get_display +cogl_wayland_renderer_set_event_dispatch_enabled +cogl_wayland_renderer_set_foreign_display +cogl_wayland_texture_set_region_from_shm_buffer +cogl_wayland_texture_2d_new_from_buffer +#endif + +cogl_winding_get_type + +#ifdef COGL_HAS_WIN32_SUPPORT +cogl_win32_onscreen_get_window +cogl_win32_onscreen_set_foreign_window +cogl_win32_renderer_add_filter +cogl_win32_renderer_handle_event +cogl_win32_renderer_remove_filter +cogl_win32_renderer_set_event_retrieval_enabled +#endif + +#ifdef COGL_HAS_XLIB +cogl_xlib_get_display +cogl_xlib_handle_event +cogl_xlib_renderer_add_filter +cogl_xlib_renderer_get_display +cogl_xlib_renderer_get_foreign_display +cogl_xlib_renderer_handle_event +cogl_xlib_renderer_remove_filter +cogl_xlib_renderer_set_event_retrieval_enabled +cogl_xlib_renderer_set_foreign_display +cogl_xlib_set_display +#endif + +#ifdef COGL_HAS_X11 +cogl_x11_onscreen_get_visual_xid +cogl_x11_onscreen_set_foreign_window_xid +#endif + +#ifndef COGL_NO_EXPORT_UNDERSCORE +/* probably these should not be exported at all, but anyways, for now... */ +/* eventually, this section should disappear (or cogl, cogl-pango, clutter et al */ +/* will link without the following) */ +_cogl_atlas_add_reorganize_callback +_cogl_atlas_new +_cogl_atlas_reserve_space +_cogl_atlas_texture_add_reorganize_callback +_cogl_atlas_texture_remove_reorganize_callback +_cogl_buffer_map_for_fill_or_fallback +_cogl_buffer_unmap_for_fill_or_fallback +_cogl_clip_stack_push_rectangle +_cogl_clip_stack_push_primitive +_cogl_context_get_default +_cogl_debug_instances +_cogl_framebuffer_get_modelview_stack +_cogl_framebuffer_get_projection_stack +_cogl_framebuffer_get_stencil_bits +_cogl_object_default_unref +_cogl_pipeline_foreach_layer_internal +_cogl_pipeline_layer_get_texture +_cogl_pipeline_prune_to_n_layers +_cogl_primitive_draw +_cogl_system_error_quark +_cogl_texture_can_hardware_repeat +_cogl_texture_get_format +#endif + +cogl_fence_closure_get_user_data +cogl_framebuffer_add_fence_callback +cogl_framebuffer_cancel_fence_callback diff --git a/cogl/cogl1-context.h b/cogl/cogl1-context.h new file mode 100644 index 0000000..92ac7d0 --- /dev/null +++ b/cogl/cogl1-context.h @@ -0,0 +1,862 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_1_CONTEXT_H__ +#define __COGL_1_CONTEXT_H__ + +#include +#include +#include +#include + +COGL_BEGIN_DECLS + +/** + * cogl_get_option_group: + * + * Retrieves the #GOptionGroup used by Cogl to parse the command + * line options. Clutter uses this to handle the Cogl command line + * options during its initialization process. + * + * Return value: a #GOptionGroup + * + * Since: 1.0 + * Deprecated: 1.16: Not replaced + */ +COGL_DEPRECATED_IN_1_16 +GOptionGroup * +cogl_get_option_group (void); + +/* Misc */ +/** + * cogl_get_features: + * + * Returns all of the features supported by COGL. + * + * Return value: A logical OR of all the supported COGL features. + * + * Since: 0.8 + * Deprecated: 1.10: Use cogl_foreach_feature() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_foreach_feature) +CoglFeatureFlags +cogl_get_features (void); + +/** + * cogl_features_available: + * @features: A bitmask of features to check for + * + * Checks whether the given COGL features are available. Multiple + * features can be checked for by or-ing them together with the '|' + * operator. %TRUE is only returned if all of the requested features + * are available. + * + * Return value: %TRUE if the features are available, %FALSE otherwise. + * Deprecated: 1.10: Use cogl_has_feature() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_has_feature) +CoglBool +cogl_features_available (CoglFeatureFlags features); + +/** + * cogl_get_proc_address: + * @name: the name of the function. + * + * Gets a pointer to a given GL or GL ES extension function. This acts + * as a wrapper around glXGetProcAddress() or whatever is the + * appropriate function for the current backend. + * + * This function should not be used to query core opengl API + * symbols since eglGetProcAddress for example doesn't allow this and + * and may return a junk pointer if you do. + * + * Return value: a pointer to the requested function or %NULL if the + * function is not available. + */ +CoglFuncPtr +cogl_get_proc_address (const char *name); + +/** + * cogl_check_extension: + * @name: extension to check for + * @ext: list of extensions + * + * Check whether @name occurs in list of extensions in @ext. + * + * Return value: %TRUE if the extension occurs in the list, %FALSE otherwise. + * + * Deprecated: 1.2: OpenGL is an implementation detail for Cogl and so it's + * not appropriate to expose OpenGL extensions through the Cogl API. This + * function can be replaced by the following equivalent code: + * |[ + * CoglBool retval = (strstr (ext, name) != NULL) ? TRUE : FALSE; + * ]| + */ +COGL_DEPRECATED +CoglBool +cogl_check_extension (const char *name, + const char *ext); + +/** + * cogl_get_bitmasks: + * @red: (out): Return location for the number of red bits or %NULL + * @green: (out): Return location for the number of green bits or %NULL + * @blue: (out): Return location for the number of blue bits or %NULL + * @alpha: (out): Return location for the number of alpha bits or %NULL + * + * Gets the number of bitplanes used for each of the color components + * in the color buffer. Pass %NULL for any of the arguments if the + * value is not required. + * + * Deprecated: 1.8: Use cogl_framebuffer_get_red/green/blue/alpha_bits() + * instead + */ +COGL_DEPRECATED_IN_1_8_FOR (cogl_framebuffer_get_red_OR_green_OR_blue_OR_alpha_bits) +void +cogl_get_bitmasks (int *red, + int *green, + int *blue, + int *alpha); + +/** + * cogl_perspective: + * @fovy: Vertical field of view angle in degrees. + * @aspect: The (width over height) aspect ratio for display + * @z_near: The distance to the near clipping plane (Must be positive) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current projection matrix with a perspective matrix + * based on the provided values. + * + * You should be careful not to have to great a @z_far / @z_near + * ratio since that will reduce the effectiveness of depth testing + * since there wont be enough precision to identify the depth of + * objects near to each other. + * + * Deprecated: 1.10: Use cogl_framebuffer_perspective() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_perspective) +void +cogl_perspective (float fovy, + float aspect, + float z_near, + float z_far); + +/** + * cogl_frustum: + * @left: X position of the left clipping plane where it + * intersects the near clipping plane + * @right: X position of the right clipping plane where it + * intersects the near clipping plane + * @bottom: Y position of the bottom clipping plane where it + * intersects the near clipping plane + * @top: Y position of the top clipping plane where it intersects + * the near clipping plane + * @z_near: The distance to the near clipping plane (Must be positive) + * @z_far: The distance to the far clipping plane (Must be positive) + * + * Replaces the current projection matrix with a perspective matrix + * for a given viewing frustum defined by 4 side clip planes that + * all cross through the origin and 2 near and far clip planes. + * + * Since: 0.8.2 + * Deprecated: 1.10: Use cogl_framebuffer_frustum() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_frustum) +void +cogl_frustum (float left, + float right, + float bottom, + float top, + float z_near, + float z_far); + +/** + * cogl_ortho: + * @left: The coordinate for the left clipping plane + * @right: The coordinate for the right clipping plane + * @bottom: The coordinate for the bottom clipping plane + * @top: The coordinate for the top clipping plane + * @near: The distance to the near clipping + * plane (negative if the plane is behind the viewer) + * @far: The distance for the far clipping + * plane (negative if the plane is behind the viewer) + * + * Replaces the current projection matrix with an orthographic projection + * matrix. See to see how the matrix is + * calculated. + * + *
+ * + * + *
+ * + * This function copies the arguments from OpenGL's glOrtho() even + * though they are unnecessarily confusing due to the z near and z far + * arguments actually being a "distance" from the origin, where + * negative values are behind the viewer, instead of coordinates for + * the z clipping planes which would have been consistent with the + * left, right bottom and top arguments. + * + * Since: 1.0 + * Deprecated: 1.10: Use cogl_framebuffer_orthographic() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_orthographic) +void +cogl_ortho (float left, + float right, + float bottom, + float top, + float near, + float far); + +/** + * cogl_viewport: + * @width: Width of the viewport + * @height: Height of the viewport + * + * Replace the current viewport with the given values. + * + * Since: 0.8.2 + * Deprecated: 1.8: Use cogl_framebuffer_set_viewport instead + */ +COGL_DEPRECATED_IN_1_8_FOR (cogl_framebuffer_set_viewport) +void +cogl_viewport (unsigned int width, + unsigned int height); + +/** + * cogl_set_viewport: + * @x: X offset of the viewport + * @y: Y offset of the viewport + * @width: Width of the viewport + * @height: Height of the viewport + * + * Replaces the current viewport with the given values. + * + * Since: 1.2 + * Deprecated: 1.8: Use cogl_framebuffer_set_viewport() instead + */ +COGL_DEPRECATED_IN_1_8_FOR (cogl_framebuffer_set_viewport) +void +cogl_set_viewport (int x, + int y, + int width, + int height); + +/** + * cogl_push_matrix: + * + * Stores the current model-view matrix on the matrix stack. The matrix + * can later be restored with cogl_pop_matrix(). + * + * Deprecated: 1.10: Use cogl_framebuffer_push_matrix() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_push_matrix) +void +cogl_push_matrix (void); + +/** + * cogl_pop_matrix: + * + * Restores the current model-view matrix from the matrix stack. + * + * Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_push_matrix) +void +cogl_pop_matrix (void); + +/** + * cogl_scale: + * @x: Amount to scale along the x-axis + * @y: Amount to scale along the y-axis + * @z: Amount to scale along the z-axis + * + * Multiplies the current model-view matrix by one that scales the x, + * y and z axes by the given values. + * + * Deprecated: 1.10: Use cogl_framebuffer_pop_matrix() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_scale) +void +cogl_scale (float x, + float y, + float z); + +/** + * cogl_translate: + * @x: Distance to translate along the x-axis + * @y: Distance to translate along the y-axis + * @z: Distance to translate along the z-axis + * + * Multiplies the current model-view matrix by one that translates the + * model along all three axes according to the given values. + * + * Deprecated: 1.10: Use cogl_framebuffer_translate() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_translate) +void +cogl_translate (float x, + float y, + float z); + +/** + * cogl_rotate: + * @angle: Angle in degrees to rotate. + * @x: X-component of vertex to rotate around. + * @y: Y-component of vertex to rotate around. + * @z: Z-component of vertex to rotate around. + * + * Multiplies the current model-view matrix by one that rotates the + * model around the vertex specified by @x, @y and @z. The rotation + * follows the right-hand thumb rule so for example rotating by 10 + * degrees about the vertex (0, 0, 1) causes a small counter-clockwise + * rotation. + * + * Deprecated: 1.10: Use cogl_framebuffer_rotate() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_rotate) +void +cogl_rotate (float angle, + float x, + float y, + float z); + +/** + * cogl_transform: + * @matrix: the matrix to multiply with the current model-view + * + * Multiplies the current model-view matrix by the given matrix. + * + * Since: 1.4 + * Deprecated: 1.10: Use cogl_framebuffer_transform() instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_transform) +void +cogl_transform (const CoglMatrix *matrix); + +/** + * cogl_get_modelview_matrix: + * @matrix: (out): return location for the model-view matrix + * + * Stores the current model-view matrix in @matrix. + * + * Deprecated: 1.10: Use cogl_framebuffer_get_modelview_matrix() + * instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_get_modelview_matrix) +void +cogl_get_modelview_matrix (CoglMatrix *matrix); + +/** + * cogl_set_modelview_matrix: + * @matrix: the new model-view matrix + * + * Loads @matrix as the new model-view matrix. + * + * Deprecated: 1.10: Use cogl_framebuffer_set_modelview_matrix() + * instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_set_modelview_matrix) +void +cogl_set_modelview_matrix (CoglMatrix *matrix); + +/** + * cogl_get_projection_matrix: + * @matrix: (out): return location for the projection matrix + * + * Stores the current projection matrix in @matrix. + * + * Deprecated: 1.10: Use cogl_framebuffer_get_projection_matrix() + * instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_get_projection_matrix) +void +cogl_get_projection_matrix (CoglMatrix *matrix); + +/** + * cogl_set_projection_matrix: + * @matrix: the new projection matrix + * + * Loads matrix as the new projection matrix. + * + * Deprecated: 1.10: Use cogl_framebuffer_set_projection_matrix() + * instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_set_projection_matrix) +void +cogl_set_projection_matrix (CoglMatrix *matrix); + +/** + * cogl_get_viewport: + * @v: (out) (array fixed-size=4): pointer to a 4 element array + * of #floats to receive the viewport dimensions. + * + * Stores the current viewport in @v. @v[0] and @v[1] get the x and y + * position of the viewport and @v[2] and @v[3] get the width and + * height. + * + * Deprecated: 1.10: Use cogl_framebuffer_get_viewport4fv() + * instead + */ +COGL_DEPRECATED_IN_1_10_FOR (cogl_framebuffer_get_viewport4fv) +void +cogl_get_viewport (float v[4]); + +/** + * cogl_set_depth_test_enabled: + * @setting: %TRUE to enable depth testing or %FALSE to disable. + * + * Sets whether depth testing is enabled. If it is disabled then the + * order that actors are layered on the screen depends solely on the + * order specified using clutter_actor_raise() and + * clutter_actor_lower(), otherwise it will also take into account the + * actor's depth. Depth testing is disabled by default. + * + * Deprecated: 1.16: Use cogl_pipeline_set_depth_state() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_depth_state) +void +cogl_set_depth_test_enabled (CoglBool setting); + +/** + * cogl_get_depth_test_enabled: + * + * Queries if depth testing has been enabled via cogl_set_depth_test_enable() + * + * Return value: %TRUE if depth testing is enabled, and %FALSE otherwise + * + * Deprecated: 1.16: Use cogl_pipeline_set_depth_state() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_depth_state) +CoglBool +cogl_get_depth_test_enabled (void); + +/** + * cogl_set_backface_culling_enabled: + * @setting: %TRUE to enable backface culling or %FALSE to disable. + * + * Sets whether textures positioned so that their backface is showing + * should be hidden. This can be used to efficiently draw two-sided + * textures or fully closed cubes without enabling depth testing. This + * only affects calls to the cogl_rectangle* family of functions and + * cogl_vertex_buffer_draw*. Backface culling is disabled by default. + * + * Deprecated: 1.16: Use cogl_pipeline_set_cull_face_mode() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_cull_face_mode) +void +cogl_set_backface_culling_enabled (CoglBool setting); + +/** + * cogl_get_backface_culling_enabled: + * + * Queries if backface culling has been enabled via + * cogl_set_backface_culling_enabled() + * + * Return value: %TRUE if backface culling is enabled, and %FALSE otherwise + * + * Deprecated: 1.16: Use cogl_pipeline_get_cull_face_mode() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_cull_face_mode) +CoglBool +cogl_get_backface_culling_enabled (void); + +/** + * cogl_set_fog: + * @fog_color: The color of the fog + * @mode: A #CoglFogMode that determines the equation used to calculate the + * fogging blend factor. + * @density: Used by %COGL_FOG_MODE_EXPONENTIAL and by + * %COGL_FOG_MODE_EXPONENTIAL_SQUARED equations. + * @z_near: Position along Z axis where no fogging should be applied + * @z_far: Position along Z axis where full fogging should be applied + * + * Enables fogging. Fogging causes vertices that are further away from the eye + * to be rendered with a different color. The color is determined according to + * the chosen fog mode; at it's simplest the color is linearly interpolated so + * that vertices at @z_near are drawn fully with their original color and + * vertices at @z_far are drawn fully with @fog_color. Fogging will remain + * enabled until you call cogl_disable_fog(). + * + * The fogging functions only work correctly when primitives use + * unmultiplied alpha colors. By default Cogl will premultiply textures + * and cogl_set_source_color() will premultiply colors, so unless you + * explicitly load your textures requesting an unmultiplied internal format + * and use cogl_material_set_color() you can only use fogging with fully + * opaque primitives. This might improve in the future when we can depend + * on fragment shaders. + * + * Deprecated: 1.16: Use #CoglSnippet shader api for fog + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_API) +void +cogl_set_fog (const CoglColor *fog_color, + CoglFogMode mode, + float density, + float z_near, + float z_far); + +/** + * cogl_disable_fog: + * + * This function disables fogging, so primitives drawn afterwards will not be + * blended with any previously set fog color. + * + * Deprecated: 1.16: Use #CoglSnippet shader api for fog + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_API) +void +cogl_disable_fog (void); + +/** + * cogl_clear: + * @color: Background color to clear to + * @buffers: A mask of #CoglBufferBit's identifying which auxiliary + * buffers to clear + * + * Clears all the auxiliary buffers identified in the @buffers mask, and if + * that includes the color buffer then the specified @color is used. + * + * Deprecated: 1.16: Use cogl_framebuffer_clear() api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_clear) +void +cogl_clear (const CoglColor *color, + unsigned long buffers); + +/** + * cogl_set_source: + * @material: A #CoglMaterial + * + * This function changes the material at the top of the source stack. + * The material at the top of this stack defines the GPU state used to + * process subsequent primitives, such as rectangles drawn with + * cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw(). + * + * Since: 1.0 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_source (void *material); + +/** + * cogl_get_source: + * + * Returns the current source material as previously set using + * cogl_set_source(). + * + * You should typically consider the returned material immutable + * and not try to change any of its properties unless you own a + * reference to that material. At times you may be able to get a + * reference to an internally managed materials and the result of + * modifying such materials is undefined. + * + * Return value: The current source material. + * + * Since: 1.6 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void * +cogl_get_source (void); + +/** + * cogl_push_source: + * @material: A #CoglMaterial + * + * Pushes the given @material to the top of the source stack. The + * material at the top of this stack defines the GPU state used to + * process later primitives as defined by cogl_set_source(). + * + * Since: 1.6 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_push_source (void *material); + +/** + * cogl_pop_source: + * + * Removes the material at the top of the source stack. The material + * at the top of this stack defines the GPU state used to process + * later primitives as defined by cogl_set_source(). + * + * Since: 1.6 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_pop_source (void); + +/** + * cogl_set_source_color: + * @color: a #CoglColor + * + * This is a convenience function for creating a solid fill source material + * from the given color. This color will be used for any subsequent drawing + * operation. + * + * The color will be premultiplied by Cogl, so the color should be + * non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for + * semi-transparent red. + * + * See also cogl_set_source_color4ub() and cogl_set_source_color4f() + * if you already have the color components. + * + * Since: 1.0 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_source_color (const CoglColor *color); + +/** + * cogl_set_source_color4ub: + * @red: value of the red channel, between 0 and 255 + * @green: value of the green channel, between 0 and 255 + * @blue: value of the blue channel, between 0 and 255 + * @alpha: value of the alpha channel, between 0 and 255 + * + * This is a convenience function for creating a solid fill source material + * from the given color using unsigned bytes for each component. This + * color will be used for any subsequent drawing operation. + * + * The value for each component is an unsigned byte in the range + * between 0 and 255. + * + * Since: 1.0 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_source_color4ub (uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha); + +/** + * cogl_set_source_color4f: + * @red: value of the red channel, between 0 and %1.0 + * @green: value of the green channel, between 0 and %1.0 + * @blue: value of the blue channel, between 0 and %1.0 + * @alpha: value of the alpha channel, between 0 and %1.0 + * + * This is a convenience function for creating a solid fill source material + * from the given color using normalized values for each component. This color + * will be used for any subsequent drawing operation. + * + * The value for each component is a fixed point number in the range + * between 0 and %1.0. If the values passed in are outside that + * range, they will be clamped. + * + * Since: 1.0 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_source_color4f (float red, + float green, + float blue, + float alpha); + +/** + * cogl_set_source_texture: + * @texture: The #CoglTexture you want as your source + * + * This is a convenience function for creating a material with the first + * layer set to @texture and setting that material as the source with + * cogl_set_source. + * + * Note: There is no interaction between calls to cogl_set_source_color + * and cogl_set_source_texture. If you need to blend a texture with a color then + * you can create a simple material like this: + * + * material = cogl_material_new (); + * cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80); + * cogl_material_set_layer (material, 0, tex_handle); + * cogl_set_source (material); + * + * + * Since: 1.0 + * Deprecated: 1.16: Latest drawing apis all take an explicit + * #CoglPipeline argument so this stack of + * #CoglMaterials shouldn't be used. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_source_texture (CoglTexture *texture); + +/** + * cogl_flush: + * + * This function should only need to be called in exceptional circumstances. + * + * As an optimization Cogl drawing functions may batch up primitives + * internally, so if you are trying to use raw GL outside of Cogl you stand a + * better chance of being successful if you ask Cogl to flush any batched + * geometry before making your state changes. + * + * It only ensure that the underlying driver is issued all the commands + * necessary to draw the batched primitives. It provides no guarantees about + * when the driver will complete the rendering. + * + * This provides no guarantees about the GL state upon returning and to avoid + * confusing Cogl you should aim to restore any changes you make before + * resuming use of Cogl. + * + * If you are making state changes with the intention of affecting Cogl drawing + * primitives you are 100% on your own since you stand a good chance of + * conflicting with Cogl internals. For example clutter-gst which currently + * uses direct GL calls to bind ARBfp programs will very likely break when Cogl + * starts to use ARBfb programs itself for the material API. + * + * Since: 1.0 + */ +void +cogl_flush (void); + +/** + * cogl_begin_gl: + * + * We do not advise nor reliably support the interleaving of raw GL drawing and + * Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl() + * provide a simple mechanism that may at least give you a fighting chance of + * succeeding. + * + * Note: this doesn't help you modify the behaviour of Cogl drawing functions + * through the modification of GL state; that will never be reliably supported, + * but if you are trying to do something like: + * + * |[ + * { + * - setup some OpenGL state. + * - draw using OpenGL (e.g. glDrawArrays() ) + * - reset modified OpenGL state. + * - continue using Cogl to draw + * } + * ]| + * + * You should surround blocks of drawing using raw GL with cogl_begin_gl() + * and cogl_end_gl(): + * + * |[ + * { + * cogl_begin_gl (); + * - setup some OpenGL state. + * - draw using OpenGL (e.g. glDrawArrays() ) + * - reset modified OpenGL state. + * cogl_end_gl (); + * - continue using Cogl to draw + * } + * ]| + * + * Don't ever try and do: + * + * |[ + * { + * - setup some OpenGL state. + * - use Cogl to draw + * - reset modified OpenGL state. + * } + * ]| + * + * When the internals of Cogl evolves, this is very liable to break. + * + * This function will flush all batched primitives, and subsequently flush + * all internal Cogl state to OpenGL as if it were going to draw something + * itself. + * + * The result is that the OpenGL modelview matrix will be setup; the state + * corresponding to the current source material will be set up and other world + * state such as backface culling, depth and fogging enabledness will be sent + * to OpenGL. + * + * No special material state is flushed, so if you want Cogl to setup a + * simplified material state it is your responsibility to set a simple source + * material before calling cogl_begin_gl(). E.g. by calling + * cogl_set_source_color4ub(). + * + * It is your responsibility to restore any OpenGL state that you modify + * to how it was after calling cogl_begin_gl() if you don't do this then the + * result of further Cogl calls is undefined. + * + * You can not nest begin/end blocks. + * + * Again we would like to stress, we do not advise the use of this API and if + * possible we would prefer to improve Cogl than have developers require raw + * OpenGL. + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglGLES2Context api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (CoglGLES2Context_API) +void +cogl_begin_gl (void); + +/** + * cogl_end_gl: + * + * This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing + * code using raw OpenGL. Please refer to cogl_begin_gl() for full details. + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglGLES2Context api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (CoglGLES2Context_API) +void +cogl_end_gl (void); + +COGL_END_DECLS + +#endif /* __COGL_1_CONTEXT_H__ */ diff --git a/cogl/cogl2-experimental.h b/cogl/cogl2-experimental.h new file mode 100644 index 0000000..e4623d3 --- /dev/null +++ b/cogl/cogl2-experimental.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL2_EXPERIMENTAL_H__ +#define __COGL2_EXPERIMENTAL_H__ + +#define COGL_ENABLE_EXPERIMENTAL_2_0_API +#include + +#endif /* __COGL2_EXPERIMENTAL_H__ */ diff --git a/cogl/deprecated/cogl-auto-texture.c b/cogl/deprecated/cogl-auto-texture.c new file mode 100644 index 0000000..87b19c5 --- /dev/null +++ b/cogl/deprecated/cogl-auto-texture.c @@ -0,0 +1,419 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2011,2012 Intel Corporation. + * Copyright (C) 2010 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#include + +#include "cogl-context-private.h" +#include "cogl-texture.h" +#include "cogl-util.h" +#include "cogl-texture-2d.h" +#include "cogl-texture-2d-private.h" +#include "cogl-primitive-texture.h" +#include "cogl-texture-2d-sliced-private.h" +#include "cogl-private.h" +#include "cogl-object.h" +#include "cogl-bitmap-private.h" +#include "cogl-atlas-texture-private.h" +#include "cogl-error-private.h" +#include "cogl-texture-rectangle.h" +#include "cogl-sub-texture.h" +#include "cogl-texture-2d-gl.h" + +#include "deprecated/cogl-auto-texture.h" + +static CoglTexture * +_cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error); + +static void +set_auto_mipmap_cb (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data) +{ + cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (sub_texture), + FALSE); +} + +CoglTexture * +cogl_texture_new_with_size (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + CoglError *skip_error = NULL; + + _COGL_GET_CONTEXT (ctx, NULL); + + if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) || + (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + /* First try creating a fast-path non-sliced texture */ + tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height)); + + _cogl_texture_set_internal_format (tex, internal_format); + + if (!cogl_texture_allocate (tex, &skip_error)) + { + cogl_error_free (skip_error); + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + /* If it fails resort to sliced textures */ + int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE; + tex = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, + width, + height, + max_waste)); + + _cogl_texture_set_internal_format (tex, internal_format); + } + + /* NB: This api existed before Cogl introduced lazy allocation of + * textures and so we maintain its original synchronous allocation + * semantics and return NULL if allocation fails... */ + if (!cogl_texture_allocate (tex, &skip_error)) + { + cogl_error_free (skip_error); + cogl_object_unref (tex); + return NULL; + } + + if (tex && + flags & COGL_TEXTURE_NO_AUTO_MIPMAP) + { + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex), + 0, 0, 1, 1, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + set_auto_mipmap_cb, + NULL); + } + + return tex; +} + +static CoglTexture * +_cogl_texture_new_from_data (CoglContext *ctx, + int width, + int height, + CoglTextureFlags flags, + CoglPixelFormat format, + CoglPixelFormat internal_format, + int rowstride, + const uint8_t *data, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture *tex; + + _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + + /* Rowstride from width if not given */ + if (rowstride == 0) + rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format); + + /* Wrap the data into a bitmap */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + tex = _cogl_texture_new_from_bitmap (bmp, + flags, + internal_format, + FALSE, /* can't convert in place */ + error); + + cogl_object_unref (bmp); + + return tex; +} + +CoglTexture * +cogl_texture_new_from_data (int width, + int height, + CoglTextureFlags flags, + CoglPixelFormat format, + CoglPixelFormat internal_format, + int rowstride, + const uint8_t *data) +{ + CoglError *ignore_error = NULL; + CoglTexture *tex; + + _COGL_GET_CONTEXT (ctx, NULL); + + tex = _cogl_texture_new_from_data (ctx, + width, height, + flags, + format, internal_format, + rowstride, + data, + &ignore_error); + if (!tex) + cogl_error_free (ignore_error); + return tex; +} + +static CoglTexture * +_cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error) +{ + CoglContext *ctx = _cogl_bitmap_get_context (bitmap); + CoglTexture *tex; + CoglError *internal_error = NULL; + + if (!flags && + !COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS)) + { + /* First try putting the texture in the atlas */ + CoglAtlasTexture *atlas_tex = + _cogl_atlas_texture_new_from_bitmap (bitmap, + can_convert_in_place); + + _cogl_texture_set_internal_format (COGL_TEXTURE (atlas_tex), + internal_format); + + if (cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error)) + return COGL_TEXTURE (atlas_tex); + + cogl_error_free (internal_error); + internal_error = NULL; + cogl_object_unref (atlas_tex); + } + + /* If that doesn't work try a fast path 2D texture */ + if ((_cogl_util_is_pot (bitmap->width) && + _cogl_util_is_pot (bitmap->height)) || + (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + tex = COGL_TEXTURE (_cogl_texture_2d_new_from_bitmap (bitmap, + can_convert_in_place)); + + _cogl_texture_set_internal_format (tex, internal_format); + + if (!cogl_texture_allocate (tex, &internal_error)) + { + cogl_error_free (internal_error); + internal_error = NULL; + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + /* Otherwise create a sliced texture */ + int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE; + tex = COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_bitmap (bitmap, + max_waste, + can_convert_in_place)); + + _cogl_texture_set_internal_format (tex, internal_format); + + if (!cogl_texture_allocate (tex, error)) + { + cogl_object_unref (tex); + tex = NULL; + } + } + + if (tex && + flags & COGL_TEXTURE_NO_AUTO_MIPMAP) + { + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex), + 0, 0, 1, 1, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + set_auto_mipmap_cb, + NULL); + } + + return tex; +} + +CoglTexture * +cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglError *ignore_error = NULL; + CoglTexture *tex = + _cogl_texture_new_from_bitmap (bitmap, + flags, + internal_format, + FALSE, /* can't convert in-place */ + &ignore_error); + if (!tex) + cogl_error_free (ignore_error); + return tex; +} + +CoglTexture * +cogl_texture_new_from_file (const char *filename, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + CoglError **error) +{ + CoglBitmap *bmp; + CoglTexture *texture = NULL; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + bmp = cogl_bitmap_new_from_file (filename, error); + if (bmp == NULL) + return NULL; + + texture = _cogl_texture_new_from_bitmap (bmp, flags, + internal_format, + TRUE, /* can convert in-place */ + error); + + cogl_object_unref (bmp); + + return texture; +} + +CoglTexture * +cogl_texture_new_from_foreign (GLuint gl_handle, + GLenum gl_target, + GLuint width, + GLuint height, + GLuint x_pot_waste, + GLuint y_pot_waste, + CoglPixelFormat format) +{ + _COGL_GET_CONTEXT (ctx, NULL); + +#ifdef HAVE_COGL_GL + if (gl_target == GL_TEXTURE_RECTANGLE_ARB) + { + CoglTextureRectangle *texture_rectangle; + CoglSubTexture *sub_texture; + + if (x_pot_waste != 0 || y_pot_waste != 0) + { + /* It shouldn't be necessary to have waste in this case since + * the texture isn't limited to power of two sizes. */ + g_warning ("You can't create a foreign GL_TEXTURE_RECTANGLE cogl " + "texture with waste\n"); + return NULL; + } + + texture_rectangle = cogl_texture_rectangle_new_from_foreign (ctx, + gl_handle, + width, + height, + format); + _cogl_texture_set_internal_format (COGL_TEXTURE (texture_rectangle), + format); + + /* CoglTextureRectangle textures work with non-normalized + * coordinates, but the semantics for this function that people + * depend on are that all returned texture works with normalized + * coordinates so we wrap with a CoglSubTexture... */ + sub_texture = cogl_sub_texture_new (ctx, + COGL_TEXTURE (texture_rectangle), + 0, 0, width, height); + return COGL_TEXTURE (sub_texture); + } +#endif + + if (x_pot_waste != 0 || y_pot_waste != 0) + { + CoglTexture *tex = + COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_foreign (ctx, + gl_handle, + gl_target, + width, + height, + x_pot_waste, + y_pot_waste, + format)); + _cogl_texture_set_internal_format (tex, format); + + cogl_texture_allocate (tex, NULL); + return tex; + } + else + { + CoglTexture *tex = + COGL_TEXTURE (cogl_texture_2d_gl_new_from_foreign (ctx, + gl_handle, + width, + height, + format)); + _cogl_texture_set_internal_format (tex, format); + + cogl_texture_allocate (tex, NULL); + return tex; + } +} + +CoglTexture * +cogl_texture_new_from_sub_texture (CoglTexture *full_texture, + int sub_x, + int sub_y, + int sub_width, + int sub_height) +{ + _COGL_GET_CONTEXT (ctx, NULL); + return COGL_TEXTURE (cogl_sub_texture_new (ctx, + full_texture, sub_x, sub_y, + sub_width, sub_height)); +} diff --git a/cogl/deprecated/cogl-auto-texture.h b/cogl/deprecated/cogl-auto-texture.h new file mode 100644 index 0000000..331c5a9 --- /dev/null +++ b/cogl/deprecated/cogl-auto-texture.h @@ -0,0 +1,221 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_AUTO_TEXTURE_H__ +#define __COGL_AUTO_TEXTURE_H__ + +COGL_BEGIN_DECLS + +/** + * cogl_texture_new_with_size: + * @width: width of texture in pixels. + * @height: height of texture in pixels. + * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE + * @internal_format: the #CoglPixelFormat to use for the GPU storage of the + * texture. + * + * Creates a new #CoglTexture with the specified dimensions and pixel format. + * + * Return value: (transfer full): A newly created #CoglTexture or %NULL on failure + * + * Since: 0.8 + * Deprecated: 1.18: Use specific constructors such as + * cogl_texture_2d_new_with_size() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_texture_2d_new_with_size__OR__cogl_texture_2d_sliced_new_with_size) +CoglTexture * +cogl_texture_new_with_size (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +/** + * cogl_texture_new_from_file: + * @filename: the file to load + * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE + * @internal_format: the #CoglPixelFormat to use for the GPU storage of the + * texture. If %COGL_PIXEL_FORMAT_ANY is given then a premultiplied + * format similar to the format of the source data will be used. The + * default blending equations of Cogl expect premultiplied color data; + * the main use of passing a non-premultiplied format here is if you + * have non-premultiplied source data and are going to adjust the blend + * mode (see cogl_material_set_blend()) or use the data for something + * other than straight blending. + * @error: return location for a #CoglError or %NULL + * + * Creates a #CoglTexture from an image file. + * + * Return value: (transfer full): A newly created #CoglTexture or + * %NULL on failure + * + * Since: 0.8 + * Deprecated: 1.18: Use specific constructors such as + * cogl_texture_2d_new_from_file() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_texture_2d_new_from_file__OR__cogl_texture_2d_sliced_new_from_file) +CoglTexture * +cogl_texture_new_from_file (const char *filename, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + CoglError **error); + +/** + * cogl_texture_new_from_data: + * @width: width of texture in pixels + * @height: height of texture in pixels + * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @internal_format: the #CoglPixelFormat that will be used for storing + * the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a + * premultiplied format similar to the format of the source data will + * be used. The default blending equations of Cogl expect premultiplied + * color data; the main use of passing a non-premultiplied format here + * is if you have non-premultiplied source data and are going to adjust + * the blend mode (see cogl_material_set_blend()) or use the data for + * something other than straight blending. + * @rowstride: the memory offset in bytes between the starts of + * scanlines in @data + * @data: pointer the memory region where the source buffer resides + * + * Creates a new #CoglTexture based on data residing in memory. + * + * Return value: (transfer full): A newly created #CoglTexture or + * %NULL on failure + * + * Since: 0.8 + * Deprecated: 1.18: Use specific constructors such as + * cogl_texture_2d_new_from_data() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_texture_2d_new_from_data__OR__cogl_texture_2d_sliced_new_from_data) +CoglTexture * +cogl_texture_new_from_data (int width, + int height, + CoglTextureFlags flags, + CoglPixelFormat format, + CoglPixelFormat internal_format, + int rowstride, + const uint8_t *data); + +/** + * cogl_texture_new_from_foreign: + * @gl_handle: opengl handle of foreign texture. + * @gl_target: opengl target type of foreign texture + * @width: width of foreign texture + * @height: height of foreign texture. + * @x_pot_waste: horizontal waste on the right hand edge of the texture. + * @y_pot_waste: vertical waste on the bottom edge of the texture. + * @format: format of the foreign texture. + * + * Creates a #CoglTexture based on an existing OpenGL texture; the + * width, height and format are passed along since it is not always + * possible to query these from OpenGL. + * + * The waste arguments allow you to create a Cogl texture that maps to + * a region smaller than the real OpenGL texture. For instance if your + * hardware only supports power-of-two textures you may load a + * non-power-of-two image into a larger power-of-two texture and use + * the waste arguments to tell Cogl which region should be mapped to + * the texture coordinate range [0:1]. + * + * Return value: (transfer full): A newly created #CoglTexture or + * %NULL on failure + * + * Since: 0.8 + * Deprecated: 1.18: Use specific constructors such as + * cogl_texture_2d_new_from_foreign() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_texture_2d_new_from_foreign) +CoglTexture * +cogl_texture_new_from_foreign (unsigned int gl_handle, + unsigned int gl_target, + unsigned int width, + unsigned int height, + unsigned int x_pot_waste, + unsigned int y_pot_waste, + CoglPixelFormat format); + +/** + * cogl_texture_new_from_bitmap: + * @bitmap: A #CoglBitmap pointer + * @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE + * @internal_format: the #CoglPixelFormat to use for the GPU storage of the + * texture + * + * Creates a #CoglTexture from a #CoglBitmap. + * + * Return value: (transfer full): A newly created #CoglTexture or + * %NULL on failure + * + * Since: 1.0 + * Deprecated: 1.18: Use specific constructors such as + * cogl_texture_2d_new_from_bitmap() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_texture_2d_new_from_bitmap__OR__cogl_texture_2d_sliced_new_from_bitmap) +CoglTexture * +cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +/** + * cogl_texture_new_from_sub_texture: + * @full_texture: a #CoglTexture pointer + * @sub_x: X coordinate of the top-left of the subregion + * @sub_y: Y coordinate of the top-left of the subregion + * @sub_width: Width in pixels of the subregion + * @sub_height: Height in pixels of the subregion + * + * Creates a new texture which represents a subregion of another + * texture. The GL resources will be shared so that no new texture + * data is actually allocated. + * + * Sub textures have undefined behaviour texture coordinates outside + * of the range [0,1] are used. They also do not work with + * CoglVertexBuffers. + * + * The sub texture will keep a reference to the full texture so you do + * not need to keep one separately if you only want to use the sub + * texture. + * + * Return value: (transfer full): A newly created #CoglTexture or + * %NULL on failure + * Since: 1.2 + * Deprecated: 1.18: Use cogl_sub_texture_new() + */ +COGL_DEPRECATED_IN_1_18_FOR(cogl_sub_texture_new) +CoglTexture * +cogl_texture_new_from_sub_texture (CoglTexture *full_texture, + int sub_x, + int sub_y, + int sub_width, + int sub_height); + +COGL_END_DECLS + +#endif /* __COGL_AUTO_TEXTURE_H__ */ diff --git a/cogl/deprecated/cogl-clip-state.c b/cogl/deprecated/cogl-clip-state.c new file mode 100644 index 0000000..1e0ec92 --- /dev/null +++ b/cogl/deprecated/cogl-clip-state.c @@ -0,0 +1,138 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-clip-state.h" +#include "cogl-clip-stack.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-journal-private.h" +#include "cogl-util.h" +#include "cogl-matrix-private.h" +#include "cogl1-context.h" + +void +cogl_clip_push_window_rectangle (int x_offset, + int y_offset, + int width, + int height) +{ + cogl_framebuffer_push_scissor_clip (cogl_get_draw_framebuffer (), + x_offset, y_offset, width, height); +} + +/* XXX: This is deprecated API */ +void +cogl_clip_push_window_rect (float x_offset, + float y_offset, + float width, + float height) +{ + cogl_clip_push_window_rectangle (x_offset, y_offset, width, height); +} + +void +cogl_clip_push_rectangle (float x_1, + float y_1, + float x_2, + float y_2) +{ + cogl_framebuffer_push_rectangle_clip (cogl_get_draw_framebuffer (), + x_1, y_1, x_2, y_2); +} + +/* XXX: Deprecated API */ +void +cogl_clip_push (float x_offset, + float y_offset, + float width, + float height) +{ + cogl_clip_push_rectangle (x_offset, + y_offset, + x_offset + width, + y_offset + height); +} + +void +cogl_clip_push_primitive (CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2) +{ + cogl_framebuffer_push_primitive_clip (cogl_get_draw_framebuffer (), + primitive, + bounds_x1, + bounds_y1, + bounds_x2, + bounds_y2); +} + +void +cogl_clip_pop (void) +{ + cogl_framebuffer_pop_clip (cogl_get_draw_framebuffer ()); +} + +void +cogl_clip_stack_save (void) +{ + /* This function was just used to temporarily switch the clip stack + * when using an offscreen buffer. This is no longer needed because + * each framebuffer maintains its own clip stack. The function is + * documented to do nothing since version 1.2 */ +} + +void +cogl_clip_stack_restore (void) +{ + /* Do nothing. See cogl_clip_stack_save() */ +} + +/* XXX: This should never have been made public API! */ +void +cogl_clip_ensure (void) +{ + /* Do nothing. + * + * This API shouldn't be used by anyone and the documented semantics + * are basically vague enough that we can get away with doing + * nothing here. + */ +} diff --git a/cogl/deprecated/cogl-clip-state.h b/cogl/deprecated/cogl-clip-state.h new file mode 100644 index 0000000..51091ab --- /dev/null +++ b/cogl/deprecated/cogl-clip-state.h @@ -0,0 +1,266 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLIP_STATE_H__ +#define __COGL_CLIP_STATE_H__ + +#include +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-clipping + * @short_description: Fuctions for manipulating a stack of clipping regions + * + * To support clipping your geometry to rectangles or paths Cogl exposes a + * stack based API whereby each clip region you push onto the stack is + * intersected with the previous region. + */ + +/** + * cogl_clip_push_window_rectangle: + * @x_offset: left edge of the clip rectangle in window coordinates + * @y_offset: top edge of the clip rectangle in window coordinates + * @width: width of the clip rectangle + * @height: height of the clip rectangle + * + * Specifies a rectangular clipping area for all subsequent drawing + * operations. Any drawing commands that extend outside the rectangle + * will be clipped so that only the portion inside the rectangle will + * be displayed. The rectangle dimensions are not transformed by the + * current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_clip_pop(). + * + * Since: 1.2 + * Deprecated: 1.16: Use cogl_framebuffer_push_scissor_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_scissor_clip) +void +cogl_clip_push_window_rectangle (int x_offset, + int y_offset, + int width, + int height); + +/** + * cogl_clip_push_window_rect: + * @x_offset: left edge of the clip rectangle in window coordinates + * @y_offset: top edge of the clip rectangle in window coordinates + * @width: width of the clip rectangle + * @height: height of the clip rectangle + * + * Specifies a rectangular clipping area for all subsequent drawing + * operations. Any drawing commands that extend outside the rectangle + * will be clipped so that only the portion inside the rectangle will + * be displayed. The rectangle dimensions are not transformed by the + * current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_clip_pop(). + * + * Deprecated: 1.16: Use cogl_framebuffer_push_scissor_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_scissor_clip) +void +cogl_clip_push_window_rect (float x_offset, + float y_offset, + float width, + float height); + +/** + * cogl_clip_push_rectangle: + * @x0: x coordinate for top left corner of the clip rectangle + * @y0: y coordinate for top left corner of the clip rectangle + * @x1: x coordinate for bottom right corner of the clip rectangle + * @y1: y coordinate for bottom right corner of the clip rectangle + * + * Specifies a rectangular clipping area for all subsequent drawing + * operations. Any drawing commands that extend outside the rectangle + * will be clipped so that only the portion inside the rectangle will + * be displayed. The rectangle dimensions are transformed by the + * current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_clip_pop(). + * + * Since: 1.2 + * Deprecated: 1.16: Use cogl_framebuffer_push_rectangle_clip() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_rectangle_clip) +void +cogl_clip_push_rectangle (float x0, + float y0, + float x1, + float y1); + +/** + * cogl_clip_push: + * @x_offset: left edge of the clip rectangle + * @y_offset: top edge of the clip rectangle + * @width: width of the clip rectangle + * @height: height of the clip rectangle + * + * Specifies a rectangular clipping area for all subsequent drawing + * operations. Any drawing commands that extend outside the rectangle + * will be clipped so that only the portion inside the rectangle will + * be displayed. The rectangle dimensions are transformed by the + * current model-view matrix. + * + * The rectangle is intersected with the current clip region. To undo + * the effect of this function, call cogl_clip_pop(). + * + * Deprecated: 1.16: The x, y, width, height arguments are inconsistent + * with other API that specify rectangles in model space, and when used + * with a coordinate space that puts the origin at the center and y+ + * extending up, it's awkward to use. Please use + * cogl_framebuffer_push_rectangle_clip() + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_rectangle_clip) +void +cogl_clip_push (float x_offset, + float y_offset, + float width, + float height); + +/** + * cogl_clip_push_primitive: + * @primitive: A #CoglPrimitive describing a flat 2D shape + * @bounds_x1: x coordinate for the top-left corner of the primitives + * bounds + * @bounds_y1: y coordinate for the top-left corner of the primitives + * bounds + * @bounds_x2: x coordinate for the bottom-right corner of the primitives + * bounds + * @bounds_y2: y coordinate for the bottom-right corner of the + * primitives bounds. + * + * Sets a new clipping area using a 2D shaped described with a + * #CoglPrimitive. The shape must not contain self overlapping + * geometry and must lie on a single 2D plane. A bounding box of the + * 2D shape in local coordinates (the same coordinates used to + * describe the shape) must be given. It is acceptable for the bounds + * to be larger than the true bounds but behaviour is undefined if the + * bounds are smaller than the true bounds. + * + * The primitive is transformed by the current model-view matrix and + * the silhouette is intersected with the previous clipping area. To + * restore the previous clipping area, call + * cogl_clip_pop(). + * + * Since: 1.10 + * Stability: unstable + * Deprecated: 1.16: Use cogl_framebuffer_push_primitive_clip() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_push_primitive_clip) +void +cogl_clip_push_primitive (CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2); +/** + * cogl_clip_pop: + * + * Reverts the clipping region to the state before the last call to + * cogl_clip_push(). + * + * Deprecated: 1.16: Use cogl_framebuffer_pop_clip() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_pop_clip) +void +cogl_clip_pop (void); + +/** + * cogl_clip_ensure: + * + * Ensures that the current clipping region has been set in GL. This + * will automatically be called before any Cogl primitives but it + * maybe be neccessary to call if you are using raw GL calls with + * clipping. + * + * Deprecated: 1.2: Calling this function has no effect + * + * Since: 1.0 + */ +COGL_DEPRECATED +void +cogl_clip_ensure (void); + +/** + * cogl_clip_stack_save: + * + * Save the entire state of the clipping stack and then clear all + * clipping. The previous state can be returned to with + * cogl_clip_stack_restore(). Each call to cogl_clip_push() after this + * must be matched by a call to cogl_clip_pop() before calling + * cogl_clip_stack_restore(). + * + * Deprecated: 1.2: This was originally added to allow us to save the + * clip stack when switching to an offscreen framebuffer, but it's + * not necessary anymore given that framebuffers now own separate + * clip stacks which will be automatically switched between when a + * new buffer is set. Calling this function has no effect + * + * Since: 0.8.2 + */ +COGL_DEPRECATED +void +cogl_clip_stack_save (void); + +/** + * cogl_clip_stack_restore: + * + * Restore the state of the clipping stack that was previously saved + * by cogl_clip_stack_save(). + * + * Deprecated: 1.2: This was originally added to allow us to restore + * the clip stack when switching back from an offscreen framebuffer, + * but it's not necessary anymore given that framebuffers now own + * separate clip stacks which will be automatically switched between + * when a new buffer is set. Calling this function has no effect + * + * Since: 0.8.2 + */ +COGL_DEPRECATED +void +cogl_clip_stack_restore (void); + +COGL_END_DECLS + +#endif /* __COGL_CLIP_STATE_H__ */ diff --git a/cogl/deprecated/cogl-clutter-xlib.h b/cogl/deprecated/cogl-clutter-xlib.h new file mode 100644 index 0000000..424ff49 --- /dev/null +++ b/cogl/deprecated/cogl-clutter-xlib.h @@ -0,0 +1,46 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_XLIB_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLUTTER_XLIB_H__ +#define __COGL_CLUTTER_XLIB_H__ + +#include + +COGL_BEGIN_DECLS + +#define cogl_clutter_winsys_xlib_get_visual_info cogl_clutter_winsys_xlib_get_visual_info_CLUTTER +XVisualInfo * +cogl_clutter_winsys_xlib_get_visual_info (void); + +COGL_END_DECLS + +#endif /* __COGL_CLUTTER_XLIB_H__ */ diff --git a/cogl/deprecated/cogl-clutter.c b/cogl/deprecated/cogl-clutter.c new file mode 100644 index 0000000..bb17bc2 --- /dev/null +++ b/cogl/deprecated/cogl-clutter.c @@ -0,0 +1,113 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-util.h" +#include "cogl-types.h" +#include "cogl-private.h" +#include "cogl-context-private.h" +#include "cogl-winsys-private.h" +#include "cogl-winsys-stub-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#ifdef COGL_HAS_XLIB_SUPPORT +#include "cogl-clutter-xlib.h" +#endif +#include "cogl-clutter.h" + +CoglBool +cogl_clutter_check_extension (const char *name, const char *ext) +{ + char *end; + int name_len, n; + + if (name == NULL || ext == NULL) + return FALSE; + + end = (char*)(ext + strlen(ext)); + + name_len = strlen(name); + + while (ext < end) + { + n = strcspn(ext, " "); + + if ((name_len == n) && (!strncmp(name, ext, n))) + return TRUE; + ext += (n + 1); + } + + return FALSE; +} + +CoglBool +cogl_clutter_winsys_has_feature (CoglWinsysFeature feature) +{ + return _cogl_winsys_has_feature (feature); +} + +void +cogl_onscreen_clutter_backend_set_size (int width, int height) +{ + CoglFramebuffer *framebuffer; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (_cogl_context_get_winsys (ctx) != _cogl_winsys_stub_get_vtable ()) + return; + + framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer); + + _cogl_framebuffer_winsys_update_size (framebuffer, width, height); +} + +#ifdef COGL_HAS_XLIB_SUPPORT +XVisualInfo * +cogl_clutter_winsys_xlib_get_visual_info (void) +{ + const CoglWinsysVtable *winsys; + + _COGL_GET_CONTEXT (ctx, NULL); + + winsys = _cogl_context_get_winsys (ctx); + + /* This should only be called for xlib contexts */ + _COGL_RETURN_VAL_IF_FAIL (winsys->xlib_get_visual_info != NULL, NULL); + + return winsys->xlib_get_visual_info (); +} +#endif diff --git a/cogl/deprecated/cogl-clutter.h b/cogl/deprecated/cogl-clutter.h new file mode 100644 index 0000000..cc6c446 --- /dev/null +++ b/cogl/deprecated/cogl-clutter.h @@ -0,0 +1,54 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLUTTER_H__ +#define __COGL_CLUTTER_H__ + +COGL_BEGIN_DECLS + +#define cogl_clutter_check_extension cogl_clutter_check_extension_CLUTTER +COGL_DEPRECATED_IN_1_16 +CoglBool +cogl_clutter_check_extension (const char *name, const char *ext); + +#define cogl_clutter_winsys_has_feature cogl_clutter_winsys_has_feature_CLUTTER +COGL_DEPRECATED_FOR (cogl_has_feature) +CoglBool +cogl_clutter_winsys_has_feature (CoglWinsysFeature feature); + +#define cogl_onscreen_clutter_backend_set_size cogl_onscreen_clutter_backend_set_size_CLUTTER +void +cogl_onscreen_clutter_backend_set_size (int width, int height); + +COGL_END_DECLS + +#endif /* __COGL_CLUTTER_H__ */ diff --git a/cogl/deprecated/cogl-fixed.c b/cogl/deprecated/cogl-fixed.c new file mode 100644 index 0000000..bdae6cd --- /dev/null +++ b/cogl/deprecated/cogl-fixed.c @@ -0,0 +1,1112 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#define G_IMPLEMENT_INLINES + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#ifdef HAVE_FLOAT_WORD_ORDER +#include +#endif + +#include "cogl-fixed.h" + +/* pre-computed sin table for 1st quadrant + * + * Currently contains 257 entries. + * + * The current maximum absolute error is about 1.9e-0.5 + * and is greatest around pi/2 where the second derivative + * of sin(x) is greatest. If greater accuracy is needed, + * modestly increasing the table size, or maybe using + * quadratic interpolation would drop the interpolation + * error below the precision limits of CoglFixed. + */ +static const CoglFixed sin_tbl[] = +{ + 0x00000000L, 0x00000192L, 0x00000324L, 0x000004B6L, + 0x00000648L, 0x000007DAL, 0x0000096CL, 0x00000AFEL, + 0x00000C90L, 0x00000E21L, 0x00000FB3L, 0x00001144L, + 0x000012D5L, 0x00001466L, 0x000015F7L, 0x00001787L, + 0x00001918L, 0x00001AA8L, 0x00001C38L, 0x00001DC7L, + 0x00001F56L, 0x000020E5L, 0x00002274L, 0x00002402L, + 0x00002590L, 0x0000271EL, 0x000028ABL, 0x00002A38L, + 0x00002BC4L, 0x00002D50L, 0x00002EDCL, 0x00003067L, + 0x000031F1L, 0x0000337CL, 0x00003505L, 0x0000368EL, + 0x00003817L, 0x0000399FL, 0x00003B27L, 0x00003CAEL, + 0x00003E34L, 0x00003FBAL, 0x0000413FL, 0x000042C3L, + 0x00004447L, 0x000045CBL, 0x0000474DL, 0x000048CFL, + 0x00004A50L, 0x00004BD1L, 0x00004D50L, 0x00004ECFL, + 0x0000504DL, 0x000051CBL, 0x00005348L, 0x000054C3L, + 0x0000563EL, 0x000057B9L, 0x00005932L, 0x00005AAAL, + 0x00005C22L, 0x00005D99L, 0x00005F0FL, 0x00006084L, + 0x000061F8L, 0x0000636BL, 0x000064DDL, 0x0000664EL, + 0x000067BEL, 0x0000692DL, 0x00006A9BL, 0x00006C08L, + 0x00006D74L, 0x00006EDFL, 0x00007049L, 0x000071B2L, + 0x0000731AL, 0x00007480L, 0x000075E6L, 0x0000774AL, + 0x000078ADL, 0x00007A10L, 0x00007B70L, 0x00007CD0L, + 0x00007E2FL, 0x00007F8CL, 0x000080E8L, 0x00008243L, + 0x0000839CL, 0x000084F5L, 0x0000864CL, 0x000087A1L, + 0x000088F6L, 0x00008A49L, 0x00008B9AL, 0x00008CEBL, + 0x00008E3AL, 0x00008F88L, 0x000090D4L, 0x0000921FL, + 0x00009368L, 0x000094B0L, 0x000095F7L, 0x0000973CL, + 0x00009880L, 0x000099C2L, 0x00009B03L, 0x00009C42L, + 0x00009D80L, 0x00009EBCL, 0x00009FF7L, 0x0000A130L, + 0x0000A268L, 0x0000A39EL, 0x0000A4D2L, 0x0000A605L, + 0x0000A736L, 0x0000A866L, 0x0000A994L, 0x0000AAC1L, + 0x0000ABEBL, 0x0000AD14L, 0x0000AE3CL, 0x0000AF62L, + 0x0000B086L, 0x0000B1A8L, 0x0000B2C9L, 0x0000B3E8L, + 0x0000B505L, 0x0000B620L, 0x0000B73AL, 0x0000B852L, + 0x0000B968L, 0x0000BA7DL, 0x0000BB8FL, 0x0000BCA0L, + 0x0000BDAFL, 0x0000BEBCL, 0x0000BFC7L, 0x0000C0D1L, + 0x0000C1D8L, 0x0000C2DEL, 0x0000C3E2L, 0x0000C4E4L, + 0x0000C5E4L, 0x0000C6E2L, 0x0000C7DEL, 0x0000C8D9L, + 0x0000C9D1L, 0x0000CAC7L, 0x0000CBBCL, 0x0000CCAEL, + 0x0000CD9FL, 0x0000CE8EL, 0x0000CF7AL, 0x0000D065L, + 0x0000D14DL, 0x0000D234L, 0x0000D318L, 0x0000D3FBL, + 0x0000D4DBL, 0x0000D5BAL, 0x0000D696L, 0x0000D770L, + 0x0000D848L, 0x0000D91EL, 0x0000D9F2L, 0x0000DAC4L, + 0x0000DB94L, 0x0000DC62L, 0x0000DD2DL, 0x0000DDF7L, + 0x0000DEBEL, 0x0000DF83L, 0x0000E046L, 0x0000E107L, + 0x0000E1C6L, 0x0000E282L, 0x0000E33CL, 0x0000E3F4L, + 0x0000E4AAL, 0x0000E55EL, 0x0000E610L, 0x0000E6BFL, + 0x0000E76CL, 0x0000E817L, 0x0000E8BFL, 0x0000E966L, + 0x0000EA0AL, 0x0000EAABL, 0x0000EB4BL, 0x0000EBE8L, + 0x0000EC83L, 0x0000ED1CL, 0x0000EDB3L, 0x0000EE47L, + 0x0000EED9L, 0x0000EF68L, 0x0000EFF5L, 0x0000F080L, + 0x0000F109L, 0x0000F18FL, 0x0000F213L, 0x0000F295L, + 0x0000F314L, 0x0000F391L, 0x0000F40CL, 0x0000F484L, + 0x0000F4FAL, 0x0000F56EL, 0x0000F5DFL, 0x0000F64EL, + 0x0000F6BAL, 0x0000F724L, 0x0000F78CL, 0x0000F7F1L, + 0x0000F854L, 0x0000F8B4L, 0x0000F913L, 0x0000F96EL, + 0x0000F9C8L, 0x0000FA1FL, 0x0000FA73L, 0x0000FAC5L, + 0x0000FB15L, 0x0000FB62L, 0x0000FBADL, 0x0000FBF5L, + 0x0000FC3BL, 0x0000FC7FL, 0x0000FCC0L, 0x0000FCFEL, + 0x0000FD3BL, 0x0000FD74L, 0x0000FDACL, 0x0000FDE1L, + 0x0000FE13L, 0x0000FE43L, 0x0000FE71L, 0x0000FE9CL, + 0x0000FEC4L, 0x0000FEEBL, 0x0000FF0EL, 0x0000FF30L, + 0x0000FF4EL, 0x0000FF6BL, 0x0000FF85L, 0x0000FF9CL, + 0x0000FFB1L, 0x0000FFC4L, 0x0000FFD4L, 0x0000FFE1L, + 0x0000FFECL, 0x0000FFF5L, 0x0000FFFBL, 0x0000FFFFL, + 0x00010000L, +}; + +/* pre-computed tan table for 1st quadrant */ +static const CoglFixed tan_tbl[] = +{ + 0x00000000L, 0x00000192L, 0x00000324L, 0x000004b7L, + 0x00000649L, 0x000007dbL, 0x0000096eL, 0x00000b01L, + 0x00000c94L, 0x00000e27L, 0x00000fbaL, 0x0000114eL, + 0x000012e2L, 0x00001477L, 0x0000160cL, 0x000017a1L, + 0x00001937L, 0x00001acdL, 0x00001c64L, 0x00001dfbL, + 0x00001f93L, 0x0000212cL, 0x000022c5L, 0x0000245fL, + 0x000025f9L, 0x00002795L, 0x00002931L, 0x00002aceL, + 0x00002c6cL, 0x00002e0aL, 0x00002faaL, 0x0000314aL, + 0x000032ecL, 0x0000348eL, 0x00003632L, 0x000037d7L, + 0x0000397dL, 0x00003b24L, 0x00003cccL, 0x00003e75L, + 0x00004020L, 0x000041ccL, 0x00004379L, 0x00004528L, + 0x000046d8L, 0x0000488aL, 0x00004a3dL, 0x00004bf2L, + 0x00004da8L, 0x00004f60L, 0x0000511aL, 0x000052d5L, + 0x00005492L, 0x00005651L, 0x00005812L, 0x000059d5L, + 0x00005b99L, 0x00005d60L, 0x00005f28L, 0x000060f3L, + 0x000062c0L, 0x0000648fL, 0x00006660L, 0x00006834L, + 0x00006a0aL, 0x00006be2L, 0x00006dbdL, 0x00006f9aL, + 0x0000717aL, 0x0000735dL, 0x00007542L, 0x0000772aL, + 0x00007914L, 0x00007b02L, 0x00007cf2L, 0x00007ee6L, + 0x000080dcL, 0x000082d6L, 0x000084d2L, 0x000086d2L, + 0x000088d6L, 0x00008adcL, 0x00008ce7L, 0x00008ef4L, + 0x00009106L, 0x0000931bL, 0x00009534L, 0x00009750L, + 0x00009971L, 0x00009b95L, 0x00009dbeL, 0x00009febL, + 0x0000a21cL, 0x0000a452L, 0x0000a68cL, 0x0000a8caL, + 0x0000ab0eL, 0x0000ad56L, 0x0000afa3L, 0x0000b1f5L, + 0x0000b44cL, 0x0000b6a8L, 0x0000b909L, 0x0000bb70L, + 0x0000bdddL, 0x0000c04fL, 0x0000c2c7L, 0x0000c545L, + 0x0000c7c9L, 0x0000ca53L, 0x0000cce3L, 0x0000cf7aL, + 0x0000d218L, 0x0000d4bcL, 0x0000d768L, 0x0000da1aL, + 0x0000dcd4L, 0x0000df95L, 0x0000e25eL, 0x0000e52eL, + 0x0000e806L, 0x0000eae7L, 0x0000edd0L, 0x0000f0c1L, + 0x0000f3bbL, 0x0000f6bfL, 0x0000f9cbL, 0x0000fce1L, + 0x00010000L, 0x00010329L, 0x0001065dL, 0x0001099aL, + 0x00010ce3L, 0x00011036L, 0x00011394L, 0x000116feL, + 0x00011a74L, 0x00011df6L, 0x00012184L, 0x0001251fL, + 0x000128c6L, 0x00012c7cL, 0x0001303fL, 0x00013410L, + 0x000137f0L, 0x00013bdfL, 0x00013fddL, 0x000143ebL, + 0x00014809L, 0x00014c37L, 0x00015077L, 0x000154c9L, + 0x0001592dL, 0x00015da4L, 0x0001622eL, 0x000166ccL, + 0x00016b7eL, 0x00017045L, 0x00017523L, 0x00017a17L, + 0x00017f22L, 0x00018444L, 0x00018980L, 0x00018ed5L, + 0x00019445L, 0x000199cfL, 0x00019f76L, 0x0001a53aL, + 0x0001ab1cL, 0x0001b11dL, 0x0001b73fL, 0x0001bd82L, + 0x0001c3e7L, 0x0001ca71L, 0x0001d11fL, 0x0001d7f4L, + 0x0001def1L, 0x0001e618L, 0x0001ed6aL, 0x0001f4e8L, + 0x0001fc96L, 0x00020473L, 0x00020c84L, 0x000214c9L, + 0x00021d44L, 0x000225f9L, 0x00022ee9L, 0x00023818L, + 0x00024187L, 0x00024b3aL, 0x00025534L, 0x00025f78L, + 0x00026a0aL, 0x000274edL, 0x00028026L, 0x00028bb8L, + 0x000297a8L, 0x0002a3fbL, 0x0002b0b5L, 0x0002bdddL, + 0x0002cb79L, 0x0002d98eL, 0x0002e823L, 0x0002f740L, + 0x000306ecL, 0x00031730L, 0x00032816L, 0x000339a6L, + 0x00034bebL, 0x00035ef2L, 0x000372c6L, 0x00038776L, + 0x00039d11L, 0x0003b3a6L, 0x0003cb48L, 0x0003e40aL, + 0x0003fe02L, 0x00041949L, 0x000435f7L, 0x0004542bL, + 0x00047405L, 0x000495a9L, 0x0004b940L, 0x0004def6L, + 0x00050700L, 0x00053196L, 0x00055ef9L, 0x00058f75L, + 0x0005c35dL, 0x0005fb14L, 0x00063709L, 0x000677c0L, + 0x0006bdd0L, 0x000709ecL, 0x00075ce6L, 0x0007b7bbL, + 0x00081b98L, 0x000889e9L, 0x0009046eL, 0x00098d4dL, + 0x000a2736L, 0x000ad593L, 0x000b9cc6L, 0x000c828aL, + 0x000d8e82L, 0x000ecb1bL, 0x001046eaL, 0x00121703L, + 0x00145b00L, 0x0017448dL, 0x001b2672L, 0x002095afL, + 0x0028bc49L, 0x0036519aL, 0x00517bb6L, 0x00a2f8fdL, + 0x46d3eab2L, +}; + +/* 257-value table of atan. + * + * atan_tbl[0] is atan(0.0) and atan_tbl[256] is atan(1). + * The angles are radians in CoglFixed truncated to 16-bit (they're + * all less than one) + */ +static const uint16_t atan_tbl[] = +{ + 0x0000, 0x00FF, 0x01FF, 0x02FF, 0x03FF, 0x04FF, 0x05FF, 0x06FF, + 0x07FF, 0x08FF, 0x09FE, 0x0AFE, 0x0BFD, 0x0CFD, 0x0DFC, 0x0EFB, + 0x0FFA, 0x10F9, 0x11F8, 0x12F7, 0x13F5, 0x14F3, 0x15F2, 0x16F0, + 0x17EE, 0x18EB, 0x19E9, 0x1AE6, 0x1BE3, 0x1CE0, 0x1DDD, 0x1ED9, + 0x1FD5, 0x20D1, 0x21CD, 0x22C8, 0x23C3, 0x24BE, 0x25B9, 0x26B3, + 0x27AD, 0x28A7, 0x29A1, 0x2A9A, 0x2B93, 0x2C8B, 0x2D83, 0x2E7B, + 0x2F72, 0x306A, 0x3160, 0x3257, 0x334D, 0x3442, 0x3538, 0x362D, + 0x3721, 0x3815, 0x3909, 0x39FC, 0x3AEF, 0x3BE2, 0x3CD4, 0x3DC5, + 0x3EB6, 0x3FA7, 0x4097, 0x4187, 0x4277, 0x4365, 0x4454, 0x4542, + 0x462F, 0x471C, 0x4809, 0x48F5, 0x49E0, 0x4ACB, 0x4BB6, 0x4CA0, + 0x4D89, 0x4E72, 0x4F5B, 0x5043, 0x512A, 0x5211, 0x52F7, 0x53DD, + 0x54C2, 0x55A7, 0x568B, 0x576F, 0x5852, 0x5934, 0x5A16, 0x5AF7, + 0x5BD8, 0x5CB8, 0x5D98, 0x5E77, 0x5F55, 0x6033, 0x6110, 0x61ED, + 0x62C9, 0x63A4, 0x647F, 0x6559, 0x6633, 0x670C, 0x67E4, 0x68BC, + 0x6993, 0x6A6A, 0x6B40, 0x6C15, 0x6CEA, 0x6DBE, 0x6E91, 0x6F64, + 0x7036, 0x7108, 0x71D9, 0x72A9, 0x7379, 0x7448, 0x7516, 0x75E4, + 0x76B1, 0x777E, 0x7849, 0x7915, 0x79DF, 0x7AA9, 0x7B72, 0x7C3B, + 0x7D03, 0x7DCA, 0x7E91, 0x7F57, 0x801C, 0x80E1, 0x81A5, 0x8269, + 0x832B, 0x83EE, 0x84AF, 0x8570, 0x8630, 0x86F0, 0x87AF, 0x886D, + 0x892A, 0x89E7, 0x8AA4, 0x8B5F, 0x8C1A, 0x8CD5, 0x8D8E, 0x8E47, + 0x8F00, 0x8FB8, 0x906F, 0x9125, 0x91DB, 0x9290, 0x9345, 0x93F9, + 0x94AC, 0x955F, 0x9611, 0x96C2, 0x9773, 0x9823, 0x98D2, 0x9981, + 0x9A2F, 0x9ADD, 0x9B89, 0x9C36, 0x9CE1, 0x9D8C, 0x9E37, 0x9EE0, + 0x9F89, 0xA032, 0xA0DA, 0xA181, 0xA228, 0xA2CE, 0xA373, 0xA418, + 0xA4BC, 0xA560, 0xA602, 0xA6A5, 0xA746, 0xA7E8, 0xA888, 0xA928, + 0xA9C7, 0xAA66, 0xAB04, 0xABA1, 0xAC3E, 0xACDB, 0xAD76, 0xAE11, + 0xAEAC, 0xAF46, 0xAFDF, 0xB078, 0xB110, 0xB1A7, 0xB23E, 0xB2D5, + 0xB36B, 0xB400, 0xB495, 0xB529, 0xB5BC, 0xB64F, 0xB6E2, 0xB773, + 0xB805, 0xB895, 0xB926, 0xB9B5, 0xBA44, 0xBAD3, 0xBB61, 0xBBEE, + 0xBC7B, 0xBD07, 0xBD93, 0xBE1E, 0xBEA9, 0xBF33, 0xBFBC, 0xC046, + 0xC0CE, 0xC156, 0xC1DD, 0xC264, 0xC2EB, 0xC371, 0xC3F6, 0xC47B, + 0xC4FF, 0xC583, 0xC606, 0xC689, 0xC70B, 0xC78D, 0xC80E, 0xC88F, + 0xC90F +}; + +/* look up table for square root */ +static const CoglFixed sqrt_tbl[] = +{ + 0x00000000L, 0x00010000L, 0x00016A0AL, 0x0001BB68L, + 0x00020000L, 0x00023C6FL, 0x00027312L, 0x0002A550L, + 0x0002D414L, 0x00030000L, 0x0003298BL, 0x0003510EL, + 0x000376CFL, 0x00039B05L, 0x0003BDDDL, 0x0003DF7CL, + 0x00040000L, 0x00041F84L, 0x00043E1EL, 0x00045BE1L, + 0x000478DEL, 0x00049524L, 0x0004B0BFL, 0x0004CBBCL, + 0x0004E624L, 0x00050000L, 0x00051959L, 0x00053237L, + 0x00054AA0L, 0x0005629AL, 0x00057A2BL, 0x00059159L, + 0x0005A828L, 0x0005BE9CL, 0x0005D4B9L, 0x0005EA84L, + 0x00060000L, 0x00061530L, 0x00062A17L, 0x00063EB8L, + 0x00065316L, 0x00066733L, 0x00067B12L, 0x00068EB4L, + 0x0006A21DL, 0x0006B54DL, 0x0006C847L, 0x0006DB0CL, + 0x0006ED9FL, 0x00070000L, 0x00071232L, 0x00072435L, + 0x0007360BL, 0x000747B5L, 0x00075935L, 0x00076A8CL, + 0x00077BBBL, 0x00078CC2L, 0x00079DA3L, 0x0007AE60L, + 0x0007BEF8L, 0x0007CF6DL, 0x0007DFBFL, 0x0007EFF0L, + 0x00080000L, 0x00080FF0L, 0x00081FC1L, 0x00082F73L, + 0x00083F08L, 0x00084E7FL, 0x00085DDAL, 0x00086D18L, + 0x00087C3BL, 0x00088B44L, 0x00089A32L, 0x0008A906L, + 0x0008B7C2L, 0x0008C664L, 0x0008D4EEL, 0x0008E361L, + 0x0008F1BCL, 0x00090000L, 0x00090E2EL, 0x00091C45L, + 0x00092A47L, 0x00093834L, 0x0009460CL, 0x000953CFL, + 0x0009617EL, 0x00096F19L, 0x00097CA1L, 0x00098A16L, + 0x00099777L, 0x0009A4C6L, 0x0009B203L, 0x0009BF2EL, + 0x0009CC47L, 0x0009D94FL, 0x0009E645L, 0x0009F32BL, + 0x000A0000L, 0x000A0CC5L, 0x000A1979L, 0x000A261EL, + 0x000A32B3L, 0x000A3F38L, 0x000A4BAEL, 0x000A5816L, + 0x000A646EL, 0x000A70B8L, 0x000A7CF3L, 0x000A8921L, + 0x000A9540L, 0x000AA151L, 0x000AAD55L, 0x000AB94BL, + 0x000AC534L, 0x000AD110L, 0x000ADCDFL, 0x000AE8A1L, + 0x000AF457L, 0x000B0000L, 0x000B0B9DL, 0x000B172DL, + 0x000B22B2L, 0x000B2E2BL, 0x000B3998L, 0x000B44F9L, + 0x000B504FL, 0x000B5B9AL, 0x000B66D9L, 0x000B720EL, + 0x000B7D37L, 0x000B8856L, 0x000B936AL, 0x000B9E74L, + 0x000BA973L, 0x000BB467L, 0x000BBF52L, 0x000BCA32L, + 0x000BD508L, 0x000BDFD5L, 0x000BEA98L, 0x000BF551L, + 0x000C0000L, 0x000C0AA6L, 0x000C1543L, 0x000C1FD6L, + 0x000C2A60L, 0x000C34E1L, 0x000C3F59L, 0x000C49C8L, + 0x000C542EL, 0x000C5E8CL, 0x000C68E0L, 0x000C732DL, + 0x000C7D70L, 0x000C87ACL, 0x000C91DFL, 0x000C9C0AL, + 0x000CA62CL, 0x000CB047L, 0x000CBA59L, 0x000CC464L, + 0x000CCE66L, 0x000CD861L, 0x000CE254L, 0x000CEC40L, + 0x000CF624L, 0x000D0000L, 0x000D09D5L, 0x000D13A2L, + 0x000D1D69L, 0x000D2727L, 0x000D30DFL, 0x000D3A90L, + 0x000D4439L, 0x000D4DDCL, 0x000D5777L, 0x000D610CL, + 0x000D6A9AL, 0x000D7421L, 0x000D7DA1L, 0x000D871BL, + 0x000D908EL, 0x000D99FAL, 0x000DA360L, 0x000DACBFL, + 0x000DB618L, 0x000DBF6BL, 0x000DC8B7L, 0x000DD1FEL, + 0x000DDB3DL, 0x000DE477L, 0x000DEDABL, 0x000DF6D8L, + 0x000E0000L, 0x000E0922L, 0x000E123DL, 0x000E1B53L, + 0x000E2463L, 0x000E2D6DL, 0x000E3672L, 0x000E3F70L, + 0x000E4869L, 0x000E515DL, 0x000E5A4BL, 0x000E6333L, + 0x000E6C16L, 0x000E74F3L, 0x000E7DCBL, 0x000E869DL, + 0x000E8F6BL, 0x000E9832L, 0x000EA0F5L, 0x000EA9B2L, + 0x000EB26BL, 0x000EBB1EL, 0x000EC3CBL, 0x000ECC74L, + 0x000ED518L, 0x000EDDB7L, 0x000EE650L, 0x000EEEE5L, + 0x000EF775L, 0x000F0000L, 0x000F0886L, 0x000F1107L, + 0x000F1984L, 0x000F21FCL, 0x000F2A6FL, 0x000F32DDL, + 0x000F3B47L, 0x000F43ACL, 0x000F4C0CL, 0x000F5468L, + 0x000F5CBFL, 0x000F6512L, 0x000F6D60L, 0x000F75AAL, + 0x000F7DEFL, 0x000F8630L, 0x000F8E6DL, 0x000F96A5L, + 0x000F9ED9L, 0x000FA709L, 0x000FAF34L, 0x000FB75BL, + 0x000FBF7EL, 0x000FC79DL, 0x000FCFB7L, 0x000FD7CEL, + 0x000FDFE0L, 0x000FE7EEL, 0x000FEFF8L, 0x000FF7FEL, + 0x00100000L, +}; + +/* the difference of the angle for two adjacent values in the + * sin_tbl table, expressed as CoglFixed number + */ +static const int sin_tbl_size = G_N_ELEMENTS (sin_tbl) - 1; + +static const double _magic = 68719476736.0 * 1.5; + +/* Where in the 64 bits of double is the mantissa. + * + * FIXME - this should go inside the configure.ac + */ +#ifdef HAVE_FLOAT_WORD_ORDER +#if (__FLOAT_WORD_ORDER == 1234) +#define _COGL_MAN 0 +#elif (__FLOAT_WORD_ORDER == 4321) +#define _COGL_MAN 1 +#else +#define COGL_NO_FAST_CONVERSIONS +#endif +#else /* HAVE_FLOAT_WORD_ORDER */ +#define COGL_NO_FAST_CONVERSIONS +#endif /* HAVE_FLOAT_WORD_ORDER */ + +/* + * cogl_double_to_fixed : + * @value: value to be converted + * + * A fast conversion from double precision floating to fixed point + * + * Return value: Fixed point representation of the value + */ +CoglFixed +cogl_double_to_fixed (double val) +{ +#ifdef COGL_NO_FAST_CONVERSIONS + return (CoglFixed) (val * (double) COGL_FIXED_1); +#else + union { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + + return dbl.i[_COGL_MAN]; +#endif +} + +/* + * cogl_double_to_int : + * @value: value to be converted + * + * A fast conversion from doulbe precision floatint point to int; + * used this instead of casting double/float to int. + * + * Return value: Integer part of the double + */ +int +cogl_double_to_int (double val) +{ +#ifdef COGL_NO_FAST_CONVERSIONS + return (int) (val); +#else + union { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + + return ((int) dbl.i[_COGL_MAN]) >> 16; +#endif +} + +unsigned int +cogl_double_to_uint (double val) +{ +#ifdef COGL_NO_FAST_CONVERSIONS + return (unsigned int)(val); +#else + union { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + + return (dbl.i[_COGL_MAN]) >> 16; +#endif +} + +#undef _COGL_MAN + +CoglFixed +cogl_fixed_sin (CoglFixed angle) +{ + int sign = 1, indx1, indx2; + CoglFixed low, high; + CoglFixed p1, p2; + CoglFixed d1, d2; + + /* convert negative angle to positive + sign */ + if ((int) angle < 0) + { + sign = -sign; + angle = -angle; + } + + /* reduce to <0, 2*pi) */ + angle = angle % COGL_FIXED_2_PI; + + /* reduce to first quadrant and sign */ + if (angle > COGL_FIXED_PI) + { + sign = -sign; + + if (angle > COGL_FIXED_PI + COGL_FIXED_PI_2) + { + /* fourth qudrant */ + angle = COGL_FIXED_2_PI - angle; + } + else + { + /* third quadrant */ + angle -= COGL_FIXED_PI; + } + } + else + { + if (angle > COGL_FIXED_PI_2) + { + /* second quadrant */ + angle = COGL_FIXED_PI - angle; + } + } + + /* Calculate indices of the two nearest values in our table + * and return weighted average. + * + * We multiple first than divide to preserve precision. Since + * angle is in the first quadrant, angle * SIN_TBL_SIZE (=256) + * can't overflow. + * + * Handle the end of the table gracefully + */ + indx1 = (angle * sin_tbl_size) / COGL_FIXED_PI_2; + + if (indx1 == sin_tbl_size) + { + indx2 = indx1; + indx1 = indx2 - 1; + } + else + { + indx2 = indx1 + 1; + } + + low = sin_tbl[indx1]; + high = sin_tbl[indx2]; + + /* Again multiply the divide; no danger of overflow */ + p1 = (indx1 * COGL_FIXED_PI_2) / sin_tbl_size; + p2 = (indx2 * COGL_FIXED_PI_2) / sin_tbl_size; + d1 = angle - p1; + d2 = p2 - angle; + + angle = ((low * d2 + high * d1) / (p2 - p1)); + + if (sign < 0) + angle = -angle; + + return angle; +} + +CoglFixed +cogl_angle_sin (CoglAngle angle) +{ + int sign = 1; + CoglFixed result; + + /* reduce negative angle to positive + sign */ + if (angle < 0) + { + sign = -sign; + angle = -angle; + } + + /* reduce to <0, 2*pi) */ + angle &= 0x3ff; + + /* reduce to first quadrant and sign */ + if (angle > 512) + { + sign = -sign; + + if (angle > 768) + { + /* fourth qudrant */ + angle = 1024 - angle; + } + else + { + /* third quadrant */ + angle -= 512; + } + } + else + { + if (angle > 256) + { + /* second quadrant */ + angle = 512 - angle; + } + } + + result = sin_tbl[angle]; + + if (sign < 0) + result = -result; + + return result; +} + +CoglFixed +cogl_fixed_tan (CoglFixed angle) +{ + return cogl_angle_tan (COGL_ANGLE_FROM_DEGX (angle)); +} + +CoglFixed +cogl_angle_tan (CoglAngle angle) +{ + int sign = 1; + CoglFixed result; + + /* reduce negative angle to positive + sign */ + if (angle < 0) + { + sign = -sign; + angle = -angle; + } + + /* reduce to <0, pi) */ + angle &= 0x1ff; + + /* reduce to first quadrant and sign */ + if (angle > 256) + { + sign = -sign; + angle = 512 - angle; + } + + result = tan_tbl[angle]; + + if (sign < 0) + result = -result; + + return result; +} + +CoglFixed +cogl_fixed_atan (CoglFixed x) +{ + CoglBool negative = FALSE; + CoglFixed angle; + + if (x < 0) + { + negative = TRUE; + x = -x; + } + + if (x > COGL_FIXED_1) + { + /* if x > 1 then atan(x) = pi/2 - atan(1/x) */ + angle = COGL_FIXED_PI / 2 + - atan_tbl[COGL_FIXED_DIV (COGL_FIXED_1, x) >> 8]; + } + else + angle = atan_tbl[x >> 8]; + + return negative ? -angle : angle; +} + +CoglFixed +cogl_fixed_atan2 (CoglFixed y, CoglFixed x) +{ + CoglFixed angle; + + if (x == 0) + angle = y >= 0 ? COGL_FIXED_PI_2 : -COGL_FIXED_PI_2; + else + { + angle = cogl_fixed_atan (COGL_FIXED_DIV (y, x)); + + if (x < 0) + angle += y >= 0 ? COGL_FIXED_PI : -COGL_FIXED_PI; + } + + return angle; +} + +CoglFixed +cogl_fixed_sqrt (CoglFixed x) +{ + /* The idea for this comes from the Alegro library, exploiting the + * fact that, + * sqrt (x) = sqrt (x/d) * sqrt (d); + * + * For d == 2^(n): + * + * sqrt (x) = sqrt (x/2^(2n)) * 2^n + * + * By locating suitable n for given x such that x >> 2n is in <0,255> + * we can use a LUT of precomputed values. + * + * This algorithm provides both good performance and precision; + * on ARM this function is about 5 times faster than c-lib sqrt, + * whilst producing errors < 1%. + */ + int t = 0; + int sh = 0; + unsigned int mask = 0x40000000; + unsigned fract = x & 0x0000ffff; + unsigned int d1, d2; + CoglFixed v1, v2; + + if (x <= 0) + return 0; + + if (x > COGL_FIXED_255 || x < COGL_FIXED_1) + { + /* + * Find the highest bit set + */ +#if defined (__arm__) && !defined(__ARM_ARCH_4T__) && !defined(__thumb__) + /* This actually requires at least arm v5, but gcc does not seem + * to set the architecture defines correctly, and it is I think + * very unlikely that anyone will want to use clutter on anything + * less than v5. + */ + int bit; + __asm__ ("clz %0, %1\n" + "rsb %0, %0, #31\n" + :"=r"(bit) + :"r" (x)); + + /* make even (2n) */ + bit &= 0xfffffffe; +#else + /* TODO -- add i386 branch using bshr + * + * NB: it's been said that the bshr instruction is poorly implemented + * and that it is possible to write a faster code in C using binary + * search -- at some point we should explore this + */ + int bit = 30; + while (bit >= 0) + { + if (x & mask) + break; + + mask = (mask >> 1 | mask >> 2); + bit -= 2; + } +#endif + + /* now bit indicates the highest bit set; there are two scenarios + * + * 1) bit < 23: Our number is smaller so we shift it left to maximase + * precision (< 16 really, since <16,23> never goes + * through here. + * + * 2) bit > 23: our number is above the table, so we shift right + */ + + sh = ((bit - 22) >> 1); + if (bit >= 8) + t = (x >> (16 - 22 + bit)); + else + t = (x << (22 - 16 - bit)); + } + else + { + t = COGL_FIXED_TO_INT (x); + } + + /* Do a weighted average of the two nearest values */ + v1 = sqrt_tbl[t]; + v2 = sqrt_tbl[t+1]; + + /* + * 12 is fairly arbitrary -- we want integer that is not too big to cost + * us precision + */ + d1 = (unsigned)(fract) >> 12; + d2 = ((unsigned)COGL_FIXED_1 >> 12) - d1; + + x = ((v1*d2) + (v2*d1))/(COGL_FIXED_1 >> 12); + + if (sh > 0) + x = x << sh; + else if (sh < 0) + x = x >> -sh; + + return x; +} + +/** + * cogl_sqrti: + * @x: integer value + * + * Very fast fixed point implementation of square root for integers. + * + * This function is at least 6x faster than clib sqrt() on x86, and (this is + * not a typo!) about 500x faster on ARM without FPU. It's error is < 5% + * for arguments < %COGL_SQRTI_ARG_5_PERCENT and < 10% for arguments < + * %COGL_SQRTI_ARG_10_PERCENT. The maximum argument that can be passed to + * this function is COGL_SQRTI_ARG_MAX. + * + * Return value: integer square root. + * + * + * Since: 0.2 + */ +int +cogl_sqrti (int number) +{ +#if defined __SSE2__ + /* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as + * the pure integer code below. It is also more accurate. + */ + return __builtin_sqrt (number); +#else + /* This is a fixed point implementation of the Quake III sqrt algorithm, + * described, for example, at + * http://www.codemaestro.com/reviews/review00000105.html + * + * While the original QIII is extremely fast, the use of floating division + * and multiplication makes it perform very on arm processors without FPU. + * + * The key to successfully replacing the floating point operations with + * fixed point is in the choice of the fixed point format. The QIII + * algorithm does not calculate the square root, but its reciprocal ('y' + * below), which is only at the end turned to the inverse value. In order + * for the algorithm to produce satisfactory results, the reciprocal value + * must be represented with sufficient precission; the 16.16 we use + * elsewhere in clutter is not good enough, and 10.22 is used instead. + */ + CoglFixed x; + uint32_t y_1; /* 10.22 fixed point */ + uint32_t f = 0x600000; /* '1.5' as 10.22 fixed */ + + union + { + float f; + uint32_t i; + } flt, flt2; + + flt.f = number; + + x = COGL_FIXED_FROM_INT (number) / 2; + + /* The QIII initial estimate */ + flt.i = 0x5f3759df - ( flt.i >> 1 ); + + /* Now, we convert the float to 10.22 fixed. We exploit the mechanism + * described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf. + * + * We want 22 bit fraction; a single precission float uses 23 bit + * mantisa, so we only need to add 2^(23-22) (no need for the 1.5 + * multiplier as we are only dealing with positive numbers). + * + * Note: we have to use two separate variables here -- for some reason, + * if we try to use just the flt variable, gcc on ARM optimises the whole + * addition out, and it all goes pear shape, since without it, the bits + * in the float will not be correctly aligned. + */ + flt2.f = flt.f + 2.0; + flt2.i &= 0x7FFFFF; + + /* Now we correct the estimate */ + y_1 = (flt2.i >> 11) * (flt2.i >> 11); + y_1 = (y_1 >> 8) * (x >> 8); + + y_1 = f - y_1; + flt2.i = (flt2.i >> 11) * (y_1 >> 11); + + /* If the original argument is less than 342, we do another + * iteration to improve precission (for arguments >= 342, the single + * iteration produces generally better results). + */ + if (x < 171) + { + y_1 = (flt2.i >> 11) * (flt2.i >> 11); + y_1 = (y_1 >> 8) * (x >> 8); + + y_1 = f - y_1; + flt2.i = (flt2.i >> 11) * (y_1 >> 11); + } + + /* Invert, round and convert from 10.22 to an integer + * 0x1e3c68 is a magical rounding constant that produces slightly + * better results than 0x200000. + */ + return (number * flt2.i + 0x1e3c68) >> 22; +#endif +} + +CoglFixed +cogl_fixed_mul (CoglFixed a, + CoglFixed b) +{ +#if defined(__arm__) && !defined(__thumb__) + /* This provides about 12% speedeup on the gcc -O2 optimised + * C version + * + * Based on code found in the following thread: + * http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-August/014405.html + */ + int res_low, res_hi; + + __asm__ ("smull %0, %1, %2, %3 \n" + "mov %0, %0, lsr %4 \n" + "add %1, %0, %1, lsl %5 \n" + : "=&r"(res_hi), "=&r"(res_low) \ + : "r"(a), "r"(b), "i"(COGL_FIXED_Q), "i"(32 - COGL_FIXED_Q)); + + return (CoglFixed) res_low; +#else + int64_t r = (int64_t) a * (int64_t) b; + + return (CoglFixed) (r >> COGL_FIXED_Q); +#endif +} + +CoglFixed +cogl_fixed_div (CoglFixed a, + CoglFixed b) +{ + return (CoglFixed) ((((int64_t) a) << COGL_FIXED_Q) / b); +} + +CoglFixed +cogl_fixed_mul_div (CoglFixed a, + CoglFixed b, + CoglFixed c) +{ + CoglFixed ab = cogl_fixed_mul (a, b); + CoglFixed quo = cogl_fixed_div (ab, c); + + return quo; +} + +/* + * The log2x() and pow2x() functions + * + * The implementation of the log2x() and pow2x() exploits the + * well-documented fact that the exponent part of IEEE floating + * number provides a good estimate of log2 of that number, while + * the mantissa serves as a good error-correction. + * + * The implementation here uses a quadratic error correction as + * described by Ian Stephenson at: + * http://www.dctsystems.co.uk/Software/power.html. + */ + +CoglFixed +cogl_fixed_log2 (unsigned int x) +{ + /* Note: we could easily have a version for CoglFixed x, but the int + * precision is enough for the current purposes. + */ + union + { + float f; + CoglFixed i; + } flt; + + CoglFixed magic = 0x58bb; + CoglFixed y; + + /* + * Convert x to float, then extract exponent. + * + * We want the result to be 16.16 fixed, so we shift (23-16) bits only + */ + flt.f = x; + flt.i >>= 7; + flt.i -= COGL_FIXED_FROM_INT (127); + + y = COGL_FIXED_FRACTION (flt.i); + + y = COGL_FIXED_MUL ((y - COGL_FIXED_MUL (y, y)), magic); + + return flt.i + y; +} + +unsigned int +cogl_fixed_pow2 (CoglFixed x) +{ + /* Note: we could easily have a version that produces CoglFixed result, + * but the range would be limited to x < 15, and the int precision + * is enough for the current purposes. + */ + + union + { + float f; + uint32_t i; + } flt; + + CoglFixed magic = 0x56f7; + CoglFixed y; + + flt.i = x; + + /* + * Reverse of the log2x function -- convert the fixed value to a suitable + * floating point exponent, and mantisa adjusted with quadratic error + * correction y. + */ + y = COGL_FIXED_FRACTION (x); + y = COGL_FIXED_MUL ((y - COGL_FIXED_MUL (y, y)), magic); + + /* Shift the exponent into it's position in the floating point + * representation; as our number is not int but 16.16 fixed, shift only + * by (23 - 16) + */ + flt.i += (COGL_FIXED_FROM_INT (127) - y); + flt.i <<= 7; + + return COGL_FLOAT_TO_UINT (flt.f); +} + +unsigned int +cogl_fixed_pow (unsigned int x, + CoglFixed y) +{ + return cogl_fixed_pow2 (COGL_FIXED_MUL (y, cogl_fixed_log2 (x))); +} + +CoglFixed +cogl_angle_cos (CoglAngle angle) +{ + CoglAngle a = angle + 256; + + return cogl_angle_sin (a); +} + +CoglFixed +cogl_fixed_cos (CoglFixed angle) +{ + CoglFixed a = angle + COGL_FIXED_PI_2; + + return cogl_fixed_sin (a); +} + +/* GType */ + +static GTypeInfo _info = { + 0, + NULL, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL, + NULL, +}; + +static GTypeFundamentalInfo _finfo = { 0, }; + +static void +cogl_value_init_fixed (GValue *value) +{ + value->data[0].v_int = 0; +} + +static void +cogl_value_copy_fixed (const GValue *src, + GValue *dest) +{ + dest->data[0].v_int = src->data[0].v_int; +} + +static char * +cogl_value_collect_fixed (GValue *value, + unsigned int n_collect_values, + GTypeCValue *collect_values, + unsigned int collect_flags) +{ + value->data[0].v_int = collect_values[0].v_int; + + return NULL; +} + +static char * +cogl_value_lcopy_fixed (const GValue *value, + unsigned int n_collect_values, + GTypeCValue *collect_values, + unsigned int collect_flags) +{ + int32_t *fixed_p = collect_values[0].v_pointer; + + if (!fixed_p) + return g_strdup_printf ("value location for '%s' passed as NULL", + G_VALUE_TYPE_NAME (value)); + + *fixed_p = value->data[0].v_int; + + return NULL; +} + +static void +cogl_value_transform_fixed_int (const GValue *src, + GValue *dest) +{ + dest->data[0].v_int = COGL_FIXED_TO_INT (src->data[0].v_int); +} + +static void +cogl_value_transform_fixed_double (const GValue *src, + GValue *dest) +{ + dest->data[0].v_double = COGL_FIXED_TO_DOUBLE (src->data[0].v_int); +} + +static void +cogl_value_transform_fixed_float (const GValue *src, + GValue *dest) +{ + dest->data[0].v_float = COGL_FIXED_TO_FLOAT (src->data[0].v_int); +} + +static void +cogl_value_transform_int_fixed (const GValue *src, + GValue *dest) +{ + dest->data[0].v_int = COGL_FIXED_FROM_INT (src->data[0].v_int); +} + +static void +cogl_value_transform_double_fixed (const GValue *src, + GValue *dest) +{ + dest->data[0].v_int = COGL_FIXED_FROM_DOUBLE (src->data[0].v_double); +} + +static void +cogl_value_transform_float_fixed (const GValue *src, + GValue *dest) +{ + dest->data[0].v_int = COGL_FIXED_FROM_FLOAT (src->data[0].v_float); +} + + +static const GTypeValueTable _cogl_fixed_value_table = { + cogl_value_init_fixed, + NULL, + cogl_value_copy_fixed, + NULL, + "i", + cogl_value_collect_fixed, + "p", + cogl_value_lcopy_fixed +}; + +GType +cogl_fixed_get_type (void) +{ + static GType _cogl_fixed_type = 0; + + if (G_UNLIKELY (_cogl_fixed_type == 0)) + { + _info.value_table = & _cogl_fixed_value_table; + _cogl_fixed_type = + g_type_register_fundamental (g_type_fundamental_next (), + g_intern_static_string ("CoglFixed"), + &_info, &_finfo, 0); + + g_value_register_transform_func (_cogl_fixed_type, G_TYPE_INT, + cogl_value_transform_fixed_int); + g_value_register_transform_func (G_TYPE_INT, _cogl_fixed_type, + cogl_value_transform_int_fixed); + + g_value_register_transform_func (_cogl_fixed_type, G_TYPE_FLOAT, + cogl_value_transform_fixed_float); + g_value_register_transform_func (G_TYPE_FLOAT, _cogl_fixed_type, + cogl_value_transform_float_fixed); + + g_value_register_transform_func (_cogl_fixed_type, G_TYPE_DOUBLE, + cogl_value_transform_fixed_double); + g_value_register_transform_func (G_TYPE_DOUBLE, _cogl_fixed_type, + cogl_value_transform_double_fixed); + } + + return _cogl_fixed_type; +} diff --git a/cogl/deprecated/cogl-fixed.h b/cogl/deprecated/cogl-fixed.h new file mode 100644 index 0000000..73d0ed5 --- /dev/null +++ b/cogl/deprecated/cogl-fixed.h @@ -0,0 +1,811 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_FIXED_H__ +#define __COGL_FIXED_H__ + +#include + +/** + * SECTION:cogl-fixed + * @short_description: Fixed Point API + * + * COGL has a fixed point API targeted at platforms without a floating + * point unit, such as embedded devices. On such platforms this API should + * be preferred to the floating point one as it does not trigger the slow + * path of software emulation, relying on integer math for fixed-to-floating + * and floating-to-fixed notations conversion. + * + * It is not recommened for use on platforms with a floating point unit + * (e.g. desktop systems), nor for use in language bindings. + * + * Basic rules of Fixed Point arithmethic: + * + * + * Two fixed point numbers can be directly added, subtracted and + * have their modulus taken. + * + * + * To add other numerical type to a fixed point number it has to + * be first converted to fixed point. + * + * + * A fixed point number can be directly multiplied or divided by + * an integer. + * + * + * Two fixed point numbers can only be multiplied and divided by + * the provided %COGL_FIXED_MUL and %COGL_FIXED_DIV macros. + * + * + * + * The fixed point API is available since COGL 1.0. + */ + +COGL_BEGIN_DECLS + +/** + * COGL_FIXED_BITS: + * + * Evaluates to the number of bits used by the #CoglFixed type. + * + * Since: 1.0 + */ +#define COGL_FIXED_BITS (32) + +/** + * COGL_FIXED_Q: + * + * Evaluates to the number of bits used for the non-integer part + * of the #CoglFixed type. + * + * Since: 1.0 + */ +#define COGL_FIXED_Q (COGL_FIXED_BITS - 16) + +/** + * COGL_FIXED_1: + * + * The number 1 expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_1 (1 << COGL_FIXED_Q) + +/** + * COGL_FIXED_0_5: + * + * The number 0.5 expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_0_5 (32768) + +/** + * COGL_FIXED_EPSILON: + * + * A very small number expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_EPSILON (1) + +/** + * COGL_FIXED_MAX: + * + * The biggest number representable using #CoglFixed + * + * Since: 1.0 + */ +#define COGL_FIXED_MAX (0x7fffffff) + +/** + * COGL_FIXED_MIN: + * + * The smallest number representable using #CoglFixed + * + * Since: 1.0 + */ +#define COGL_FIXED_MIN (0x80000000) + +/** + * COGL_FIXED_PI: + * + * The number pi, expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_PI (0x0003243f) + +/** + * COGL_FIXED_2_PI: + * + * Two times pi, expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_2_PI (0x0006487f) + +/** + * COGL_FIXED_PI_2: + * + * Half pi, expressed as a #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_PI_2 (0x00019220) + +/** + * COGL_FIXED_PI_4: + * + * pi / 4, expressed as #CoglFixed number. + * + * Since: 1.0 + */ +#define COGL_FIXED_PI_4 (0x0000c910) + +/** + * COGL_FIXED_360: + * + * Evaluates to the number 360 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_360 (COGL_FIXED_FROM_INT (360)) + +/** + * COGL_FIXED_270: + * + * Evaluates to the number 270 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_270 (COGL_FIXED_FROM_INT (270)) + +/** + * COGL_FIXED_255: + * + * Evaluates to the number 255 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_255 (COGL_FIXED_FROM_INT (255)) + +/** + * COGL_FIXED_240: + * + * Evaluates to the number 240 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_240 (COGL_FIXED_FROM_INT (240)) + +/** + * COGL_FIXED_180: + * + * Evaluates to the number 180 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_180 (COGL_FIXED_FROM_INT (180)) + +/** + * COGL_FIXED_120: + * + * Evaluates to the number 120 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_120 (COGL_FIXED_FROM_INT (120)) + +/** + * COGL_FIXED_90: + * + * Evaluates to the number 90 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_90 (COGL_FIXED_FROM_INT (90)) + +/** + * COGL_FIXED_60: + * + * Evaluates to the number 60 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_60 (COGL_FIXED_FROM_INT (60)) + +/** + * COGL_FIXED_45: + * + * Evaluates to the number 45 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_45 (COGL_FIXED_FROM_INT (45)) + +/** + * COGL_FIXED_30: + * + * Evaluates to the number 30 in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_30 (COGL_FIXED_FROM_INT (30)) + +/** + * COGL_RADIANS_TO_DEGREES: + * + * Evaluates to 180 / pi in fixed point notation. + * + * Since: 1.0 + */ +#define COGL_RADIANS_TO_DEGREES (0x394bb8) + +/* + * conversion macros + */ + +/** + * COGL_FIXED_FROM_FLOAT: + * @x: a floating point number + * + * Converts @x from a floating point to a fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_FROM_FLOAT(x) ((float) cogl_double_to_fixed (x)) + +/** + * COGL_FIXED_TO_FLOAT: + * @x: a #CoglFixed number + * + * Converts @x from a fixed point to a floating point notation, in + * single precision. + * + * Since: 1.0 + */ +#define COGL_FIXED_TO_FLOAT(x) ((float) ((int)(x) / 65536.0)) + +/** + * COGL_FIXED_FROM_DOUBLE: + * @x: a floating point number + * + * Converts @x from a double precision, floating point to a fixed + * point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_FROM_DOUBLE(x) (cogl_double_to_fixed (x)) + +/** + * COGL_FIXED_TO_DOUBLE: + * @x: a #CoglFixed number + * + * Converts @x from a fixed point to a floating point notation, in + * double precision. + * + * Since: 1.0 + */ +#define COGL_FIXED_TO_DOUBLE(x) ((double) ((int)(x) / 65536.0)) + +/** + * COGL_FIXED_FROM_INT: + * @x: an integer number + * + * Converts @x from an integer to a fixed point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_FROM_INT(x) ((x) << COGL_FIXED_Q) + +/** + * COGL_FIXED_TO_INT: + * @x: a #CoglFixed number + * + * Converts @x from a fixed point notation to an integer, dropping + * the fractional part without rounding. + * + * Since: 1.0 + */ +#define COGL_FIXED_TO_INT(x) ((x) >> COGL_FIXED_Q) + +/** + * COGL_FLOAT_TO_INT: + * @x: a floatint point number + * + * Converts @x from a floating point notation to a signed integer. + * + * Since: 1.0 + */ +#define COGL_FLOAT_TO_INT(x) (cogl_double_to_int ((x))) + +/** + * COGL_FLOAT_TO_UINT: + * @x: a floatint point number + * + * Converts @x from a floating point notation to an unsigned integer. + * + * Since: 1.0 + */ +#define COGL_FLOAT_TO_UINT(x) (cogl_double_to_uint ((x))) + +/* + * fixed point math functions + */ + +/** + * COGL_FIXED_FRACTION: + * @x: a #CoglFixed number + * + * Retrieves the fractionary part of @x. + * + * Since: 1.0 + */ +#define COGL_FIXED_FRACTION(x) ((x) & ((1 << COGL_FIXED_Q) - 1)) + +/** + * COGL_FIXED_FLOOR: + * @x: a #CoglFixed number + * + * Rounds down a fixed point number to the previous integer. + * + * Since: 1.0 + */ +#define COGL_FIXED_FLOOR(x) (((x) >= 0) ? ((x) >> COGL_FIXED_Q) \ + : ~((~(x)) >> COGL_FIXED_Q)) + +/** + * COGL_FIXED_CEIL: + * @x: a #CoglFixed number + * + * Rounds up a fixed point number to the next integer. + * + * Since: 1.0 + */ +#define COGL_FIXED_CEIL(x) (COGL_FIXED_FLOOR ((x) + 0xffff)) + +/** + * COGL_FIXED_MUL: + * @a: a #CoglFixed number + * @b: a #CoglFixed number + * + * Computes (a * b). + * + * Since: 1.0 + */ +#define COGL_FIXED_MUL(a,b) (cogl_fixed_mul ((a), (b))) + +/** + * COGL_FIXED_DIV: + * @a: a #CoglFixed number + * @b: a #CoglFixed number + * + * Computes (a / b). + * + * Since: 1.0 + */ +#define COGL_FIXED_DIV(a,b) (cogl_fixed_div ((a), (b))) + +/** + * COGL_FIXED_MUL_DIV: + * @a: a #CoglFixed number + * @b: a #CoglFixed number + * @c: a #CoglFixed number + * + * Computes ((a * b) / c). It is logically equivalent to: + * + * |[ + * res = COGL_FIXED_DIV (COGL_FIXED_MUL (a, b), c); + * ]| + * + * But it is shorter to type. + * + * Since: 1.0 + */ +#define COGL_FIXED_MUL_DIV(a,b,c) (cogl_fixed_mul_div ((a), (b), (c))) + +/** + * COGL_FIXED_FAST_MUL: + * @a: a #CoglFixed number + * @b: a #CoglFixed number + * + * Fast version of %COGL_FIXED_MUL, implemented as a macro. + * + * This macro might lose precision. If the precision of the result + * is important use %COGL_FIXED_MUL instead. + * + * Since: 1.0 + */ +#define COGL_FIXED_FAST_MUL(a,b) ((a) >> 8) * ((b) >> 8) + +/** + * COGL_FIXED_FAST_DIV: + * @a: a #CoglFixed number + * @b: a #CoglFixed number + * + * Fast version of %COGL_FIXED_DIV, implemented as a macro. + * + * This macro might lose precision. If the precision of the result + * is important use %COGL_FIXED_DIV instead. + * + * Since: 1.0 + */ +#define COGL_FIXED_FAST_DIV(a,b) ((((a) << 8) / (b)) << 8) + +/** + * cogl_fixed_sin: + * @angle: a #CoglFixed number + * + * Computes the sine of @angle. + * + * Return value: the sine of the passed angle, in fixed point notation + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_sin (CoglFixed angle); + +/** + * cogl_fixed_tan: + * @angle: a #CoglFixed number + * + * Computes the tangent of @angle. + * + * Return value: the tangent of the passed angle, in fixed point notation + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_tan (CoglFixed angle); + +/** + * cogl_fixed_cos: + * @angle: a #CoglFixed number + * + * Computes the cosine of @angle. + * + * Return value: the cosine of the passed angle, in fixed point notation + * + * Since: 1.0 + */ +CoglFixed cogl_fixed_cos (CoglFixed angle); + +/** + * cogl_fixed_atan: + * @a: a #CoglFixed number + * + * Computes the arc tangent of @a. + * + * Return value: the arc tangent of the passed value, in fixed point notation + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_atan (CoglFixed a); + +/** + * cogl_fixed_atan2: + * @a: the numerator as a #CoglFixed number + * @b: the denominator as a #CoglFixed number + * + * Computes the arc tangent of @a / @b but uses the sign of both + * arguments to return the angle in right quadrant. + * + * Return value: the arc tangent of the passed fraction, in fixed point + * notation + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_atan2 (CoglFixed a, + CoglFixed b); + +/*< public >*/ + +/* Fixed point math routines */ +G_INLINE_FUNC CoglFixed +cogl_fixed_mul (CoglFixed a, + CoglFixed b); + +G_INLINE_FUNC CoglFixed +cogl_fixed_div (CoglFixed a, + CoglFixed b); + +G_INLINE_FUNC CoglFixed +cogl_fixed_mul_div (CoglFixed a, + CoglFixed b, + CoglFixed c); + +/** + * COGL_SQRTI_ARG_MAX: + * + * Maximum argument that can be passed to cogl_sqrti() function. + * + * Since: 1.0 + */ +#ifndef __SSE2__ +#define COGL_SQRTI_ARG_MAX 0x3fffff +#else +#define COGL_SQRTI_ARG_MAX INT_MAX +#endif + +/** + * COGL_SQRTI_ARG_5_PERCENT: + * + * Maximum argument that can be passed to cogl_sqrti() for which the + * resulting error is < 5% + * + * Since: 1.0 + */ +#ifndef __SSE2__ +#define COGL_SQRTI_ARG_5_PERCENT 210 +#else +#define COGL_SQRTI_ARG_5_PERCENT INT_MAX +#endif + +/** + * COGL_SQRTI_ARG_10_PERCENT: + * + * Maximum argument that can be passed to cogl_sqrti() for which the + * resulting error is < 10% + * + * Since: 1.0 + */ +#ifndef __SSE2__ +#define COGL_SQRTI_ARG_10_PERCENT 5590 +#else +#define COGL_SQRTI_ARG_10_PERCENT INT_MAX +#endif + +/** + * cogl_fixed_sqrt: + * @x: a #CoglFixed number + * + * Computes the square root of @x. + * + * Return value: the square root of the passed value, in floating point + * notation + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_sqrt (CoglFixed x); + +/** + * cogl_fixed_log2: + * @x: value to calculate base 2 logarithm from + * + * Calculates base 2 logarithm. + * + * This function is some 2.5 times faster on x86, and over 12 times faster on + * fpu-less arm, than using libc log(). + * + * Return value: base 2 logarithm. + * + * Since: 1.0 + */ +CoglFixed +cogl_fixed_log2 (unsigned int x); + +/** + * cogl_fixed_pow2: + * @x: a #CoglFixed number + * + * Calculates 2 to the @x power. + * + * This function is around 11 times faster on x86, and around 22 times faster + * on fpu-less arm than libc pow(2, x). + * + * Return value: the power of 2 to the passed value + * + * Since: 1.0 + */ +unsigned int +cogl_fixed_pow2 (CoglFixed x); + +/** + * cogl_fixed_pow: + * @x: base + * @y: #CoglFixed exponent + * + * Calculates @x to the @y power. + * + * Return value: the power of @x to the @y + * + * Since: 1.0 + */ +unsigned int +cogl_fixed_pow (unsigned int x, + CoglFixed y); + +/** + * cogl_sqrti: + * @x: integer value + * + * Very fast fixed point implementation of square root for integers. + * + * This function is at least 6x faster than clib sqrt() on x86, and (this is + * not a typo!) about 500x faster on ARM without FPU. It's error is less than + * 5% for arguments smaller than %COGL_SQRTI_ARG_5_PERCENT and less than 10% + * for narguments smaller than %COGL_SQRTI_ARG_10_PERCENT. The maximum + * argument that can be passed to this function is %COGL_SQRTI_ARG_MAX. + * + * Return value: integer square root. + * + * Since: 1.0 + */ +int +cogl_sqrti (int x); + +/** + * COGL_ANGLE_FROM_DEG: + * @x: an angle in degrees in floating point notation + * + * Converts an angle in degrees into a #CoglAngle. + * + * Since: 1.0 + */ +#define COGL_ANGLE_FROM_DEG(x) (COGL_FLOAT_TO_INT (((float)(x) * 1024.0f) / 360.0f)) + +/** + * COGL_ANGLE_TO_DEG: + * @x: a #CoglAngle + * + * Converts a #CoglAngle into an angle in degrees, using floatint point + * notation. + * + * Since: 1.0 + */ +#define COGL_ANGLE_TO_DEG(x) (((float)(x) * 360.0) / 1024.0) + +/** + * COGL_ANGLE_FROM_DEGX: + * @x: an angle in degrees in fixed point notation + * + * Converts an angle in degrees into a #CoglAngle. + * + * Since: 1.0 + */ +#define COGL_ANGLE_FROM_DEGX(x) (COGL_FIXED_TO_INT ((((x) / 360) * 1024) + COGL_FIXED_0_5)) + +/** + * COGL_ANGLE_TO_DEGX: + * @x: a #CoglAngle + * + * Converts a #CoglAngle into an angle in degrees, using fixed point notation + * + * Since: 1.0 + */ +#define COGL_ANGLE_TO_DEGX(x) (COGL_FIXED_FROM_INT ((x) * 45) / 128) + +/** + * cogl_angle_sin: + * @angle: an angle expressed using #CoglAngle + * + * Computes the sine of @angle + * + * Return value: the sine of the passed angle + * + * Since: 1.0 + */ +CoglFixed +cogl_angle_sin (CoglAngle angle); + +/** + * cogl_angle_tan: + * @angle: an angle expressed using #CoglAngle + * + * Computes the tangent of @angle + * + * Return value: the tangent of the passed angle + * + * Since: 1.0 + */ +CoglFixed +cogl_angle_tan (CoglAngle angle); + +/** + * cogl_angle_cos: + * @angle: an angle expressed using #CoglAngle + * + * Computes the cosine of @angle + * + * Return value: the cosine of the passed angle + * + * Since: 1.0 + */ +CoglFixed +cogl_angle_cos (CoglAngle angle); + +/*< private >*/ + +#if defined (G_CAN_INLINE) +G_INLINE_FUNC CoglFixed +cogl_fixed_mul (CoglFixed a, + CoglFixed b) +{ +# ifdef __arm__ + int res_low, res_hi; + + __asm__ ("smull %0, %1, %2, %3 \n" + "mov %0, %0, lsr %4 \n" + "add %1, %0, %1, lsl %5 \n" + : "=r"(res_hi), "=r"(res_low)\ + : "r"(a), "r"(b), "i"(COGL_FIXED_Q), "i"(32 - COGL_FIXED_Q)); + + return (CoglFixed) res_low; +# else + long long r = (long long) a * (long long) b; + + return (unsigned int)(r >> COGL_FIXED_Q); +# endif +} +#endif + +#if defined (G_CAN_INLINE) +G_INLINE_FUNC CoglFixed +cogl_fixed_div (CoglFixed a, + CoglFixed b) +{ + return (CoglFixed) ((((int64_t) a) << COGL_FIXED_Q) / b); +} +#endif + +#if defined(G_CAN_INLINE) +G_INLINE_FUNC CoglFixed +cogl_fixed_mul_div (CoglFixed a, + CoglFixed b, + CoglFixed c) +{ + CoglFixed ab = cogl_fixed_mul (a, b); + CoglFixed quo = cogl_fixed_div (ab, c); + + return quo; +} +#endif + +CoglFixed +cogl_double_to_fixed (double value); + +int +cogl_double_to_int (double value); + +unsigned int +cogl_double_to_uint (double value); + +COGL_END_DECLS + +#endif /* __COGL_FIXED_H__ */ diff --git a/cogl/deprecated/cogl-framebuffer-deprecated.c b/cogl/deprecated/cogl-framebuffer-deprecated.c new file mode 100644 index 0000000..19f3ee4 --- /dev/null +++ b/cogl/deprecated/cogl-framebuffer-deprecated.c @@ -0,0 +1,295 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#include + +#include "cogl-types.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-framebuffer-deprecated.h" + +typedef struct _CoglFramebufferStackEntry +{ + CoglFramebuffer *draw_buffer; + CoglFramebuffer *read_buffer; +} CoglFramebufferStackEntry; + + +static CoglFramebufferStackEntry * +create_stack_entry (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer) +{ + CoglFramebufferStackEntry *entry = g_slice_new (CoglFramebufferStackEntry); + + entry->draw_buffer = draw_buffer; + entry->read_buffer = read_buffer; + + return entry; +} + +GSList * +_cogl_create_framebuffer_stack (void) +{ + CoglFramebufferStackEntry *entry; + GSList *stack = NULL; + + entry = create_stack_entry (NULL, NULL); + + return g_slist_prepend (stack, entry); +} + +void +_cogl_free_framebuffer_stack (GSList *stack) +{ + GSList *l; + + for (l = stack; l != NULL; l = l->next) + { + CoglFramebufferStackEntry *entry = l->data; + + if (entry->draw_buffer) + cogl_object_unref (entry->draw_buffer); + + if (entry->read_buffer) + cogl_object_unref (entry->draw_buffer); + + g_slice_free (CoglFramebufferStackEntry, entry); + } + g_slist_free (stack); +} + +static void +notify_buffers_changed (CoglFramebuffer *old_draw_buffer, + CoglFramebuffer *new_draw_buffer, + CoglFramebuffer *old_read_buffer, + CoglFramebuffer *new_read_buffer) +{ + /* XXX: To support the deprecated cogl_set_draw_buffer API we keep + * track of the last onscreen framebuffer that was set so that it + * can be restored if the COGL_WINDOW_BUFFER enum is used. A + * reference isn't taken to the framebuffer because otherwise we + * would have a circular reference between the context and the + * framebuffer. Instead the pointer is set to NULL in + * _cogl_onscreen_free as a kind of a cheap weak reference */ + if (new_draw_buffer && + new_draw_buffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + new_draw_buffer->context->window_buffer = new_draw_buffer; +} + +/* Set the current framebuffer without checking if it's already the + * current framebuffer. This is used by cogl_pop_framebuffer while + * the top of the stack is currently not up to date. */ +static void +_cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer) +{ + CoglFramebufferStackEntry *entry; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (ctx != NULL); + _COGL_RETURN_IF_FAIL (draw_buffer && read_buffer ? + draw_buffer->context == read_buffer->context : TRUE); + + entry = ctx->framebuffer_stack->data; + + notify_buffers_changed (entry->draw_buffer, + draw_buffer, + entry->read_buffer, + read_buffer); + + if (draw_buffer) + cogl_object_ref (draw_buffer); + if (entry->draw_buffer) + cogl_object_unref (entry->draw_buffer); + + if (read_buffer) + cogl_object_ref (read_buffer); + if (entry->read_buffer) + cogl_object_unref (entry->read_buffer); + + entry->draw_buffer = draw_buffer; + entry->read_buffer = read_buffer; +} + +static void +_cogl_set_framebuffers (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer) +{ + CoglFramebuffer *current_draw_buffer; + CoglFramebuffer *current_read_buffer; + + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (read_buffer)); + + current_draw_buffer = cogl_get_draw_framebuffer (); + current_read_buffer = _cogl_get_read_framebuffer (); + + if (current_draw_buffer != draw_buffer || + current_read_buffer != read_buffer) + _cogl_set_framebuffers_real (draw_buffer, read_buffer); +} + +void +cogl_set_framebuffer (CoglFramebuffer *framebuffer) +{ + _cogl_set_framebuffers (framebuffer, framebuffer); +} + +/* XXX: deprecated API */ +void +cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle handle) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (target == COGL_WINDOW_BUFFER) + handle = ctx->window_buffer; + + /* This is deprecated public API. The public API doesn't currently + really expose the concept of separate draw and read buffers so + for the time being this actually just sets both buffers */ + cogl_set_framebuffer (handle); +} + +CoglFramebuffer * +cogl_get_draw_framebuffer (void) +{ + CoglFramebufferStackEntry *entry; + + _COGL_GET_CONTEXT (ctx, NULL); + + g_assert (ctx->framebuffer_stack); + + entry = ctx->framebuffer_stack->data; + + return entry->draw_buffer; +} + +CoglFramebuffer * +_cogl_get_read_framebuffer (void) +{ + CoglFramebufferStackEntry *entry; + + _COGL_GET_CONTEXT (ctx, NULL); + + g_assert (ctx->framebuffer_stack); + + entry = ctx->framebuffer_stack->data; + + return entry->read_buffer; +} + +void +_cogl_push_framebuffers (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer) +{ + CoglContext *ctx; + CoglFramebuffer *old_draw_buffer, *old_read_buffer; + + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (read_buffer)); + + ctx = draw_buffer->context; + _COGL_RETURN_IF_FAIL (ctx != NULL); + _COGL_RETURN_IF_FAIL (draw_buffer->context == read_buffer->context); + + _COGL_RETURN_IF_FAIL (ctx->framebuffer_stack != NULL); + + /* Copy the top of the stack so that when we call cogl_set_framebuffer + it will still know what the old framebuffer was */ + old_draw_buffer = cogl_get_draw_framebuffer (); + if (old_draw_buffer) + cogl_object_ref (old_draw_buffer); + old_read_buffer = _cogl_get_read_framebuffer (); + if (old_read_buffer) + cogl_object_ref (old_read_buffer); + ctx->framebuffer_stack = + g_slist_prepend (ctx->framebuffer_stack, + create_stack_entry (old_draw_buffer, + old_read_buffer)); + + _cogl_set_framebuffers (draw_buffer, read_buffer); +} + +void +cogl_push_framebuffer (CoglFramebuffer *buffer) +{ + _cogl_push_framebuffers (buffer, buffer); +} + +/* XXX: deprecated API */ +void +cogl_push_draw_buffer (void) +{ + cogl_push_framebuffer (cogl_get_draw_framebuffer ()); +} + +void +cogl_pop_framebuffer (void) +{ + CoglFramebufferStackEntry *to_pop; + CoglFramebufferStackEntry *to_restore; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + g_assert (ctx->framebuffer_stack != NULL); + g_assert (ctx->framebuffer_stack->next != NULL); + + to_pop = ctx->framebuffer_stack->data; + to_restore = ctx->framebuffer_stack->next->data; + + if (to_pop->draw_buffer != to_restore->draw_buffer || + to_pop->read_buffer != to_restore->read_buffer) + notify_buffers_changed (to_pop->draw_buffer, + to_restore->draw_buffer, + to_pop->read_buffer, + to_restore->read_buffer); + + cogl_object_unref (to_pop->draw_buffer); + cogl_object_unref (to_pop->read_buffer); + g_slice_free (CoglFramebufferStackEntry, to_pop); + + ctx->framebuffer_stack = + g_slist_delete_link (ctx->framebuffer_stack, + ctx->framebuffer_stack); +} + +/* XXX: deprecated API */ +void +cogl_pop_draw_buffer (void) +{ + cogl_pop_framebuffer (); +} + +CoglPixelFormat +cogl_framebuffer_get_color_format (CoglFramebuffer *framebuffer) +{ + return framebuffer->internal_format; +} diff --git a/cogl/deprecated/cogl-framebuffer-deprecated.h b/cogl/deprecated/cogl-framebuffer-deprecated.h new file mode 100644 index 0000000..68ed9d3 --- /dev/null +++ b/cogl/deprecated/cogl-framebuffer-deprecated.h @@ -0,0 +1,264 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_FRAMEBUFFER_DEPRECATED_H__ +#define __COGL_FRAMEBUFFER_DEPRECATED_H__ + +#include + +COGL_BEGIN_DECLS + +/** + * cogl_set_framebuffer: + * @buffer: A #CoglFramebuffer object, either onscreen or offscreen. + * + * This redirects all subsequent drawing to the specified framebuffer. This can + * either be an offscreen buffer created with cogl_offscreen_new_to_texture () + * or in the future it may be an onscreen framebuffers too. + * + * Since: 1.2 + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_framebuffer (CoglFramebuffer *buffer); + +/** + * cogl_push_framebuffer: + * @buffer: A #CoglFramebuffer object, either onscreen or offscreen. + * + * Redirects all subsequent drawing to the specified framebuffer. This can + * either be an offscreen buffer created with cogl_offscreen_new_to_texture () + * or in the future it may be an onscreen framebuffer too. + * + * You should understand that a framebuffer owns the following state: + * + * The projection matrix + * The modelview matrix stack + * The viewport + * The clip stack + * + * So these items will automatically be saved and restored when you + * push and pop between different framebuffers. + * + * Also remember a newly allocated framebuffer will have an identity matrix for + * the projection and modelview matrices which gives you a coordinate space + * like OpenGL with (-1, -1) corresponding to the top left of the viewport, + * (1, 1) corresponding to the bottom right and +z coming out towards the + * viewer. + * + * If you want to set up a coordinate space like Clutter does with (0, 0) + * corresponding to the top left and (framebuffer_width, framebuffer_height) + * corresponding to the bottom right you can do so like this: + * + * |[ + * static void + * setup_viewport (unsigned int width, + * unsigned int height, + * float fovy, + * float aspect, + * float z_near, + * float z_far) + * { + * float z_camera; + * CoglMatrix projection_matrix; + * CoglMatrix mv_matrix; + * + * cogl_set_viewport (0, 0, width, height); + * cogl_perspective (fovy, aspect, z_near, z_far); + * + * cogl_get_projection_matrix (&projection_matrix); + * z_camera = 0.5 * projection_matrix.xx; + * + * cogl_matrix_init_identity (&mv_matrix); + * cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera); + * cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width); + * cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f); + * cogl_set_modelview_matrix (&mv_matrix); + * } + * + * static void + * my_init_framebuffer (ClutterStage *stage, + * CoglFramebuffer *framebuffer, + * unsigned int framebuffer_width, + * unsigned int framebuffer_height) + * { + * ClutterPerspective perspective; + * + * clutter_stage_get_perspective (stage, &perspective); + * + * cogl_push_framebuffer (framebuffer); + * setup_viewport (framebuffer_width, + * framebuffer_height, + * perspective.fovy, + * perspective.aspect, + * perspective.z_near, + * perspective.z_far); + * } + * ]| + * + * The previous framebuffer can be restored by calling cogl_pop_framebuffer() + * + * Since: 1.2 + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_push_framebuffer (CoglFramebuffer *buffer); + +/** + * cogl_pop_framebuffer: + * + * Restores the framebuffer that was previously at the top of the stack. + * All subsequent drawing will be redirected to this framebuffer. + * + * Since: 1.2 + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_pop_framebuffer (void); + +/** + * cogl_set_draw_buffer: + * @target: A #CoglBufferTarget that specifies what kind of framebuffer you + * are setting as the render target. + * @offscreen: If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER + * then this is a CoglHandle for the offscreen buffer. + * + * Redirects all subsequent drawing to the specified framebuffer. This + * can either be an offscreen buffer created with + * cogl_offscreen_new_to_texture () or you can revert to your original + * on screen window buffer. + * + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_set_draw_buffer (CoglBufferTarget target, + CoglHandle offscreen); + +/** + * cogl_push_draw_buffer: + * + * Save cogl_set_draw_buffer() state. + * + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_push_draw_buffer (void); + +/** + * cogl_pop_draw_buffer: + * + * Restore cogl_set_draw_buffer() state. + * + * Deprecated: 1.16: The latest drawing apis take explicit + * #CoglFramebuffer arguments so this stack of + * framebuffers shouldn't be used anymore. + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_pop_draw_buffer (void); + +/** + * cogl_read_pixels: + * @x: The window x position to start reading from + * @y: The window y position to start reading from + * @width: The width of the rectangle you want to read + * @height: The height of the rectangle you want to read + * @source: Identifies which auxillary buffer you want to read + * (only COGL_READ_PIXELS_COLOR_BUFFER supported currently) + * @format: The pixel format you want the result in + * (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently) + * @pixels: The location to write the pixel data. + * + * This reads a rectangle of pixels from the current framebuffer where + * position (0, 0) is the top left. The pixel at (x, y) is the first + * read, and the data is returned with a rowstride of (width * 4). + * + * Currently Cogl assumes that the framebuffer is in a premultiplied + * format so if @format is non-premultiplied it will convert it. To + * read the pixel values without any conversion you should either + * specify a format that doesn't use an alpha channel or use one of + * the formats ending in PRE. + * + * Deprecated: 1.16: Use cogl_framebuffer_read_pixels() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_framebuffer_read_pixels) +void +cogl_read_pixels (int x, + int y, + int width, + int height, + CoglReadPixelsFlags source, + CoglPixelFormat format, + uint8_t *pixels); + + +/* XXX: Since this api was marked unstable, maybe we can just + * remove this api if we can't find anyone is using it. */ +/** + * cogl_framebuffer_get_color_format: + * @framebuffer: A #CoglFramebuffer framebuffer + * + * Queries the common #CoglPixelFormat of all color buffers attached + * to this framebuffer. For an offscreen framebuffer created with + * cogl_offscreen_new_with_texture() this will correspond to the format + * of the texture. + * + * This API is deprecated because it is missleading to report a + * #CoglPixelFormat for the internal format of the @framebuffer since + * #CoglPixelFormat is such a precise format description and it's + * only the set of components and the premultiplied alpha status + * that is really known. + * + * Since: 1.8 + * Stability: unstable + * Deprecated 1.18: Removed since it is misleading + */ +COGL_DEPRECATED_IN_1_18 +CoglPixelFormat +cogl_framebuffer_get_color_format (CoglFramebuffer *framebuffer); + +COGL_END_DECLS + +#endif /* __COGL_FRAMEBUFFER_DEPRECATED_H__ */ diff --git a/cogl/deprecated/cogl-material-compat.c b/cogl/deprecated/cogl-material-compat.c new file mode 100644 index 0000000..25f97b1 --- /dev/null +++ b/cogl/deprecated/cogl-material-compat.c @@ -0,0 +1,461 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +CoglMaterial * +cogl_material_new (void) +{ + _COGL_GET_CONTEXT(ctx, NULL); + return COGL_MATERIAL (cogl_pipeline_new (ctx)); +} + +CoglMaterial * +cogl_material_copy (CoglMaterial *source) +{ + return COGL_MATERIAL (cogl_pipeline_copy (COGL_PIPELINE (source))); +} + +CoglHandle +cogl_material_ref (CoglHandle handle) +{ + return cogl_object_ref (handle); +} + +void +cogl_material_unref (CoglHandle handle) +{ + cogl_object_unref (handle); +} + +CoglBool +cogl_is_material (CoglHandle handle) +{ + return cogl_is_pipeline (handle); +} + +void +cogl_material_set_color (CoglMaterial *material, + const CoglColor *color) +{ + cogl_pipeline_set_color (COGL_PIPELINE (material), color); +} + +void +cogl_material_set_color4ub (CoglMaterial *material, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha) +{ + cogl_pipeline_set_color4ub (COGL_PIPELINE (material), + red, green, blue, alpha); +} + +void +cogl_material_set_color4f (CoglMaterial *material, + float red, + float green, + float blue, + float alpha) +{ + cogl_pipeline_set_color4f (COGL_PIPELINE (material), + red, green, blue, alpha); +} + +void +cogl_material_get_color (CoglMaterial *material, + CoglColor *color) +{ + cogl_pipeline_get_color (COGL_PIPELINE (material), color); +} + +void +cogl_material_set_ambient (CoglMaterial *material, + const CoglColor *ambient) +{ + cogl_pipeline_set_ambient (COGL_PIPELINE (material), ambient); +} + +void +cogl_material_get_ambient (CoglMaterial *material, + CoglColor *ambient) +{ + cogl_pipeline_get_ambient (COGL_PIPELINE (material), ambient); +} + +void +cogl_material_set_diffuse (CoglMaterial *material, + const CoglColor *diffuse) +{ + cogl_pipeline_set_diffuse (COGL_PIPELINE (material), diffuse); +} + +void +cogl_material_get_diffuse (CoglMaterial *material, + CoglColor *diffuse) +{ + cogl_pipeline_get_diffuse (COGL_PIPELINE (material), diffuse); +} + +void +cogl_material_set_ambient_and_diffuse (CoglMaterial *material, + const CoglColor *color) +{ + cogl_pipeline_set_ambient_and_diffuse (COGL_PIPELINE (material), color); + +} + +void +cogl_material_set_specular (CoglMaterial *material, + const CoglColor *specular) +{ + cogl_pipeline_set_specular (COGL_PIPELINE (material), specular); +} + +void +cogl_material_get_specular (CoglMaterial *material, + CoglColor *specular) +{ + cogl_pipeline_get_specular (COGL_PIPELINE (material), specular); +} + +void +cogl_material_set_shininess (CoglMaterial *material, + float shininess) +{ + cogl_pipeline_set_shininess (COGL_PIPELINE (material), shininess); +} + +float +cogl_material_get_shininess (CoglMaterial *material) +{ + return cogl_pipeline_get_shininess (COGL_PIPELINE (material)); +} + +void +cogl_material_set_emission (CoglMaterial *material, + const CoglColor *emission) +{ + cogl_pipeline_set_emission (COGL_PIPELINE (material), emission); + +} + +void +cogl_material_get_emission (CoglMaterial *material, + CoglColor *emission) +{ + cogl_pipeline_get_emission (COGL_PIPELINE (material), emission); + +} + +void +cogl_material_set_alpha_test_function (CoglMaterial *material, + CoglMaterialAlphaFunc alpha_func, + float alpha_reference) +{ + cogl_pipeline_set_alpha_test_function (COGL_PIPELINE (material), + alpha_func, + alpha_reference); +} + +CoglBool +cogl_material_set_blend (CoglMaterial *material, + const char *blend_string, + CoglError **error) +{ + return cogl_pipeline_set_blend (COGL_PIPELINE (material), + blend_string, + error); +} + +void +cogl_material_set_blend_constant (CoglMaterial *material, + const CoglColor *constant_color) +{ + cogl_pipeline_set_blend_constant (COGL_PIPELINE (material), constant_color); +} + +void +cogl_material_set_point_size (CoglMaterial *material, + float point_size) +{ + cogl_pipeline_set_point_size (COGL_PIPELINE (material), point_size); +} + +float +cogl_material_get_point_size (CoglMaterial *material) +{ + return cogl_pipeline_get_point_size (COGL_PIPELINE (material)); +} + +CoglHandle +cogl_material_get_user_program (CoglMaterial *material) +{ + return cogl_pipeline_get_user_program (COGL_PIPELINE (material)); +} + +void +cogl_material_set_user_program (CoglMaterial *material, + CoglHandle program) +{ + cogl_pipeline_set_user_program (COGL_PIPELINE (material), program); +} + +void +cogl_material_set_layer (CoglMaterial *material, + int layer_index, + CoglHandle texture) +{ + cogl_pipeline_set_layer_texture (COGL_PIPELINE (material), + layer_index, texture); +} + +void +cogl_material_remove_layer (CoglMaterial *material, + int layer_index) +{ + cogl_pipeline_remove_layer (COGL_PIPELINE (material), layer_index); +} + +CoglBool +cogl_material_set_layer_combine (CoglMaterial *material, + int layer_index, + const char *blend_string, + CoglError **error) +{ + return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material), + layer_index, + blend_string, + error); +} + +void +cogl_material_set_layer_combine_constant (CoglMaterial *material, + int layer_index, + const CoglColor *constant) +{ + cogl_pipeline_set_layer_combine_constant (COGL_PIPELINE (material), + layer_index, + constant); +} + +void +cogl_material_set_layer_matrix (CoglMaterial *material, + int layer_index, + const CoglMatrix *matrix) +{ + cogl_pipeline_set_layer_matrix (COGL_PIPELINE (material), + layer_index, matrix); +} + +const GList * +cogl_material_get_layers (CoglMaterial *material) +{ + return _cogl_pipeline_get_layers (COGL_PIPELINE (material)); +} + +int +cogl_material_get_n_layers (CoglMaterial *material) +{ + return cogl_pipeline_get_n_layers (COGL_PIPELINE (material)); +} + +CoglMaterialLayerType +cogl_material_layer_get_type (CoglMaterialLayer *layer) +{ + return COGL_MATERIAL_LAYER_TYPE_TEXTURE; +} + +CoglHandle +cogl_material_layer_get_texture (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_texture (COGL_PIPELINE_LAYER (layer)); +} + +CoglMaterialFilter +cogl_material_layer_get_min_filter (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_min_filter (COGL_PIPELINE_LAYER (layer)); +} + +CoglMaterialFilter +cogl_material_layer_get_mag_filter (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_mag_filter (COGL_PIPELINE_LAYER (layer)); +} + +void +cogl_material_set_layer_filters (CoglMaterial *material, + int layer_index, + CoglMaterialFilter min_filter, + CoglMaterialFilter mag_filter) +{ + cogl_pipeline_set_layer_filters (COGL_PIPELINE (material), + layer_index, + min_filter, + mag_filter); +} + +CoglBool +cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index, + CoglBool enable, + CoglError **error) +{ + CoglPipeline *pipeline = COGL_PIPELINE (material); + return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline, + layer_index, + enable, + error); +} + +CoglBool +cogl_material_get_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index) +{ + CoglPipeline *pipeline = COGL_PIPELINE (material); + return cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline, + layer_index); +} + +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_s (CoglMaterial *material, + int layer_index) +{ + return cogl_pipeline_get_layer_wrap_mode_s (COGL_PIPELINE (material), + layer_index); +} + +void +cogl_material_set_layer_wrap_mode_s (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode) +{ + cogl_pipeline_set_layer_wrap_mode_s (COGL_PIPELINE (material), layer_index, + mode); +} + +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_t (CoglMaterial *material, + int layer_index) +{ + return cogl_pipeline_get_layer_wrap_mode_t (COGL_PIPELINE (material), + layer_index); +} + +void +cogl_material_set_layer_wrap_mode_t (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode) +{ + cogl_pipeline_set_layer_wrap_mode_t (COGL_PIPELINE (material), layer_index, + mode); +} + +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, + int layer_index) +{ + return cogl_pipeline_get_layer_wrap_mode_p (COGL_PIPELINE (material), + layer_index); +} + +void +cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode) +{ + cogl_pipeline_set_layer_wrap_mode_p (COGL_PIPELINE (material), layer_index, + mode); +} + +void +cogl_material_set_layer_wrap_mode (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode) +{ + cogl_pipeline_set_layer_wrap_mode (COGL_PIPELINE (material), layer_index, + mode); +} + +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_s (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_wrap_mode_s (COGL_PIPELINE_LAYER (layer)); +} + +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_t (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_wrap_mode_t (COGL_PIPELINE_LAYER (layer)); +} + +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer) +{ + return _cogl_pipeline_layer_get_wrap_mode_p (COGL_PIPELINE_LAYER (layer)); +} + +void +cogl_material_foreach_layer (CoglMaterial *material, + CoglMaterialLayerCallback callback, + void *user_data) +{ + cogl_pipeline_foreach_layer (COGL_PIPELINE (material), + (CoglPipelineLayerCallback)callback, user_data); +} + +CoglBool +cogl_material_set_depth_state (CoglMaterial *material, + const CoglDepthState *state, + CoglError **error) +{ + return cogl_pipeline_set_depth_state (COGL_PIPELINE (material), + state, error); +} + +void +cogl_material_get_depth_state (CoglMaterial *material, + CoglDepthState *state_out) +{ + cogl_pipeline_get_depth_state (COGL_PIPELINE (material), state_out); +} + diff --git a/cogl/deprecated/cogl-material-compat.h b/cogl/deprecated/cogl-material-compat.h new file mode 100644 index 0000000..88d3ac3 --- /dev/null +++ b/cogl/deprecated/cogl-material-compat.h @@ -0,0 +1,1391 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_MATERIAL_H__ +#define __COGL_MATERIAL_H__ + +#include +#include +#include +#include +#include + +G_BEGIN_DECLS + +/** + * SECTION:cogl-material + * @short_description: Fuctions for creating and manipulating materials + * + * COGL allows creating and manipulating materials used to fill in + * geometry. Materials may simply be lighting attributes (such as an + * ambient and diffuse colour) or might represent one or more textures + * blended together. + */ + +typedef struct _CoglMaterial CoglMaterial; +typedef struct _CoglMaterialLayer CoglMaterialLayer; + +#define COGL_MATERIAL(OBJECT) ((CoglMaterial *)OBJECT) + +/** + * CoglMaterialFilter: + * @COGL_MATERIAL_FILTER_NEAREST: Measuring in manhatten distance from the, + * current pixel center, use the nearest texture texel + * @COGL_MATERIAL_FILTER_LINEAR: Use the weighted average of the 4 texels + * nearest the current pixel center + * @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST: Select the mimap level whose + * texel size most closely matches the current pixel, and use the + * %COGL_MATERIAL_FILTER_NEAREST criterion + * @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST: Select the mimap level whose + * texel size most closely matches the current pixel, and use the + * %COGL_MATERIAL_FILTER_LINEAR criterion + * @COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR: Select the two mimap levels + * whose texel size most closely matches the current pixel, use + * the %COGL_MATERIAL_FILTER_NEAREST criterion on each one and take + * their weighted average + * @COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR: Select the two mimap levels + * whose texel size most closely matches the current pixel, use + * the %COGL_MATERIAL_FILTER_LINEAR criterion on each one and take + * their weighted average + * + * Texture filtering is used whenever the current pixel maps either to more + * than one texture element (texel) or less than one. These filter enums + * correspond to different strategies used to come up with a pixel color, by + * possibly referring to multiple neighbouring texels and taking a weighted + * average or simply using the nearest texel. + */ +typedef enum { + COGL_MATERIAL_FILTER_NEAREST = 0x2600, + COGL_MATERIAL_FILTER_LINEAR = 0x2601, + COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700, + COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701, + COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702, + COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703 +} CoglMaterialFilter; +/* NB: these values come from the equivalents in gl.h */ + +/** + * CoglMaterialWrapMode: + * @COGL_MATERIAL_WRAP_MODE_REPEAT: The texture will be repeated. This + * is useful for example to draw a tiled background. + * @COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE: The coordinates outside the + * range 0→1 will sample copies of the edge pixels of the + * texture. This is useful to avoid artifacts if only one copy of + * the texture is being rendered. + * @COGL_MATERIAL_WRAP_MODE_AUTOMATIC: Cogl will try to automatically + * decide which of the above two to use. For cogl_rectangle(), it + * will use repeat mode if any of the texture coordinates are + * outside the range 0→1, otherwise it will use clamp to edge. For + * cogl_polygon() it will always use repeat mode. For + * cogl_vertex_buffer_draw() it will use repeat mode except for + * layers that have point sprite coordinate generation enabled. This + * is the default value. + * + * The wrap mode specifies what happens when texture coordinates + * outside the range 0→1 are used. Note that if the filter mode is + * anything but %COGL_MATERIAL_FILTER_NEAREST then texels outside the + * range 0→1 might be used even when the coordinate is exactly 0 or 1 + * because OpenGL will try to sample neighbouring pixels. For example + * if you are trying to render the full texture then you may get + * artifacts around the edges when the pixels from the other side are + * merged in if the wrap mode is set to repeat. + * + * Since: 1.4 + */ +/* GL_ALWAYS is just used here as a value that is known not to clash + * with any valid GL wrap modes + * + * XXX: keep the values in sync with the CoglMaterialWrapModeInternal + * enum so no conversion is actually needed. + */ +typedef enum { + COGL_MATERIAL_WRAP_MODE_REPEAT = 0x2901, + COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE = 0x812F, + COGL_MATERIAL_WRAP_MODE_AUTOMATIC = 0x0207 +} CoglMaterialWrapMode; +/* NB: these values come from the equivalents in gl.h */ + +/** + * cogl_material_new: + * + * Allocates and initializes a blank white material + * + * Return value: a pointer to a new #CoglMaterial + * Deprecated: 1.16: Use cogl_pipeline_new() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_new) +CoglMaterial * +cogl_material_new (void); + +/** + * cogl_material_copy: + * @source: a #CoglMaterial object to copy + * + * Creates a new material with the configuration copied from the + * source material. + * + * We would strongly advise developers to always aim to use + * cogl_material_copy() instead of cogl_material_new() whenever there will + * be any similarity between two materials. Copying a material helps Cogl + * keep track of a materials ancestry which we may use to help minimize GPU + * state changes. + * + * Returns: a pointer to the newly allocated #CoglMaterial + * + * Since: 1.2 + * Deprecated: 1.16: Use cogl_pipeline_copy() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_copy) +CoglMaterial * +cogl_material_copy (CoglMaterial *source); + +/** + * cogl_material_ref: + * @material: a #CoglMaterial object. + * + * Increment the reference count for a #CoglMaterial. + * + * Return value: the @material. + * + * Since: 1.0 + * + * Deprecated: 1.2: Use cogl_object_ref() instead + */ +COGL_DEPRECATED +CoglHandle +cogl_material_ref (CoglHandle material); + +/** + * cogl_material_unref: + * @material: a #CoglMaterial object. + * + * Decrement the reference count for a #CoglMaterial. + * + * Since: 1.0 + * + * Deprecated: 1.2: Use cogl_object_unref() instead + */ +COGL_DEPRECATED +void +cogl_material_unref (CoglHandle material); + +/** + * cogl_is_material: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing material object. + * + * Return value: %TRUE if the handle references a #CoglMaterial, + * %FALSE otherwise + * Deprecated: 1.16: Use cogl_is_pipeline() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_is_pipeline) +CoglBool +cogl_is_material (CoglHandle handle); + +/** + * cogl_material_set_color: + * @material: A #CoglMaterial object + * @color: The components of the color + * + * Sets the basic color of the material, used when no lighting is enabled. + * + * Note that if you don't add any layers to the material then the color + * will be blended unmodified with the destination; the default blend + * expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for + * semi-transparent red. See cogl_color_premultiply(). + * + * The default value is (1.0, 1.0, 1.0, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_color() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_color) +void +cogl_material_set_color (CoglMaterial *material, + const CoglColor *color); + +/** + * cogl_material_set_color4ub: + * @material: A #CoglMaterial object + * @red: The red component + * @green: The green component + * @blue: The blue component + * @alpha: The alpha component + * + * Sets the basic color of the material, used when no lighting is enabled. + * + * The default value is (0xff, 0xff, 0xff, 0xff) + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_color4ub() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_color4ub) +void +cogl_material_set_color4ub (CoglMaterial *material, + uint8_t red, + uint8_t green, + uint8_t blue, + uint8_t alpha); + +/** + * cogl_material_set_color4f: + * @material: A #CoglMaterial object + * @red: The red component + * @green: The green component + * @blue: The blue component + * @alpha: The alpha component + * + * Sets the basic color of the material, used when no lighting is enabled. + * + * The default value is (1.0, 1.0, 1.0, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_color4f() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_color4f) +void +cogl_material_set_color4f (CoglMaterial *material, + float red, + float green, + float blue, + float alpha); + +/** + * cogl_material_get_color: + * @material: A #CoglMaterial object + * @color: (out): The location to store the color + * + * Retrieves the current material color. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_get_color() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_color) +void +cogl_material_get_color (CoglMaterial *material, + CoglColor *color); + +/** + * cogl_material_set_ambient: + * @material: A #CoglMaterial object + * @ambient: The components of the desired ambient color + * + * Sets the material's ambient color, in the standard OpenGL lighting + * model. The ambient color affects the overall color of the object. + * + * Since the diffuse color will be intense when the light hits the surface + * directly, the ambient will be most apparent where the light hits at a + * slant. + * + * The default value is (0.2, 0.2, 0.2, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_ambient (CoglMaterial *material, + const CoglColor *ambient); + +/** + * cogl_material_get_ambient: + * @material: A #CoglMaterial object + * @ambient: The location to store the ambient color + * + * Retrieves the current ambient color for @material + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_get_ambient (CoglMaterial *material, + CoglColor *ambient); + +/** + * cogl_material_set_diffuse: + * @material: A #CoglMaterial object + * @diffuse: The components of the desired diffuse color + * + * Sets the material's diffuse color, in the standard OpenGL lighting + * model. The diffuse color is most intense where the light hits the + * surface directly - perpendicular to the surface. + * + * The default value is (0.8, 0.8, 0.8, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_diffuse (CoglMaterial *material, + const CoglColor *diffuse); + +/** + * cogl_material_get_diffuse: + * @material: A #CoglMaterial object + * @diffuse: The location to store the diffuse color + * + * Retrieves the current diffuse color for @material + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_get_diffuse (CoglMaterial *material, + CoglColor *diffuse); + +/** + * cogl_material_set_ambient_and_diffuse: + * @material: A #CoglMaterial object + * @color: The components of the desired ambient and diffuse colors + * + * Conveniently sets the diffuse and ambient color of @material at the same + * time. See cogl_material_set_ambient() and cogl_material_set_diffuse(). + * + * The default ambient color is (0.2, 0.2, 0.2, 1.0) + * + * The default diffuse color is (0.8, 0.8, 0.8, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_ambient_and_diffuse (CoglMaterial *material, + const CoglColor *color); + +/** + * cogl_material_set_specular: + * @material: A #CoglMaterial object + * @specular: The components of the desired specular color + * + * Sets the material's specular color, in the standard OpenGL lighting + * model. The intensity of the specular color depends on the viewport + * position, and is brightest along the lines of reflection. + * + * The default value is (0.0, 0.0, 0.0, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_specular (CoglMaterial *material, + const CoglColor *specular); + +/** + * cogl_material_get_specular: + * @material: A #CoglMaterial object + * @specular: The location to store the specular color + * + * Retrieves the materials current specular color. + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_get_specular (CoglMaterial *material, + CoglColor *specular); + +/** + * cogl_material_set_shininess: + * @material: A #CoglMaterial object + * @shininess: The desired shininess; must be >= 0.0 + * + * Sets the shininess of the material, in the standard OpenGL lighting + * model, which determines the size of the specular highlights. A + * higher @shininess will produce smaller highlights which makes the + * object appear more shiny. + * + * The default value is 0.0 + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_shininess (CoglMaterial *material, + float shininess); + +/** + * cogl_material_get_shininess: + * @material: A #CoglMaterial object + * + * Retrieves the materials current emission color. + * + * Return value: The materials current shininess value + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +float +cogl_material_get_shininess (CoglMaterial *material); + +/** + * cogl_material_set_emission: + * @material: A #CoglMaterial object + * @emission: The components of the desired emissive color + * + * Sets the material's emissive color, in the standard OpenGL lighting + * model. It will look like the surface is a light source emitting this + * color. + * + * The default value is (0.0, 0.0, 0.0, 1.0) + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_emission (CoglMaterial *material, + const CoglColor *emission); + +/** + * cogl_material_get_emission: + * @material: A #CoglMaterial object + * @emission: The location to store the emission color + * + * Retrieves the materials current emission color. + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglSnippet shader api for lighting + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_get_emission (CoglMaterial *material, + CoglColor *emission); + +/** + * CoglMaterialAlphaFunc: + * @COGL_MATERIAL_ALPHA_FUNC_NEVER: Never let the fragment through. + * @COGL_MATERIAL_ALPHA_FUNC_LESS: Let the fragment through if the incoming + * alpha value is less than the reference alpha value + * @COGL_MATERIAL_ALPHA_FUNC_EQUAL: Let the fragment through if the incoming + * alpha value equals the reference alpha value + * @COGL_MATERIAL_ALPHA_FUNC_LEQUAL: Let the fragment through if the incoming + * alpha value is less than or equal to the reference alpha value + * @COGL_MATERIAL_ALPHA_FUNC_GREATER: Let the fragment through if the incoming + * alpha value is greater than the reference alpha value + * @COGL_MATERIAL_ALPHA_FUNC_NOTEQUAL: Let the fragment through if the incoming + * alpha value does not equal the reference alpha value + * @COGL_MATERIAL_ALPHA_FUNC_GEQUAL: Let the fragment through if the incoming + * alpha value is greater than or equal to the reference alpha value. + * @COGL_MATERIAL_ALPHA_FUNC_ALWAYS: Always let the fragment through. + * + * Alpha testing happens before blending primitives with the framebuffer and + * gives an opportunity to discard fragments based on a comparison with the + * incoming alpha value and a reference alpha value. The #CoglMaterialAlphaFunc + * determines how the comparison is done. + */ +typedef enum { + COGL_MATERIAL_ALPHA_FUNC_NEVER = 0x0200, + COGL_MATERIAL_ALPHA_FUNC_LESS = 0x0201, + COGL_MATERIAL_ALPHA_FUNC_EQUAL = 0x0202, + COGL_MATERIAL_ALPHA_FUNC_LEQUAL = 0x0203, + COGL_MATERIAL_ALPHA_FUNC_GREATER = 0x0204, + COGL_MATERIAL_ALPHA_FUNC_NOTEQUAL = 0x0205, + COGL_MATERIAL_ALPHA_FUNC_GEQUAL = 0x0206, + COGL_MATERIAL_ALPHA_FUNC_ALWAYS = 0x0207 +} CoglMaterialAlphaFunc; + +/** + * cogl_material_set_alpha_test_function: + * @material: A #CoglMaterial object + * @alpha_func: A @CoglMaterialAlphaFunc constant + * @alpha_reference: A reference point that the chosen alpha function uses + * to compare incoming fragments to. + * + * Before a primitive is blended with the framebuffer, it goes through an + * alpha test stage which lets you discard fragments based on the current + * alpha value. This function lets you change the function used to evaluate + * the alpha channel, and thus determine which fragments are discarded + * and which continue on to the blending stage. + * + * The default is %COGL_MATERIAL_ALPHA_FUNC_ALWAYS + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_alpha_test_function() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_alpha_test_function) +void +cogl_material_set_alpha_test_function (CoglMaterial *material, + CoglMaterialAlphaFunc alpha_func, + float alpha_reference); + +/** + * cogl_material_set_blend: + * @material: A #CoglMaterial object + * @blend_string: A Cogl blend string + * describing the desired blend function. + * @error: return location for a #CoglError that may report lack of driver + * support if you give separate blend string statements for the alpha + * channel and RGB channels since some drivers, or backends such as + * GLES 1.1, don't support this feature. May be %NULL, in which case a + * warning will be printed out using GLib's logging facilities if an + * error is encountered. + * + * If not already familiar; please refer here + * for an overview of what blend strings are, and their syntax. + * + * Blending occurs after the alpha test function, and combines fragments with + * the framebuffer. + + * Currently the only blend function Cogl exposes is ADD(). So any valid + * blend statements will be of the form: + * + * |[ + * <channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>)) + * ]| + * + * The brackets around blend factors are currently not + * optional! + * + * This is the list of source-names usable as blend factors: + * + * SRC_COLOR: The color of the in comming fragment + * DST_COLOR: The color of the framebuffer + * CONSTANT: The constant set via cogl_material_set_blend_constant() + * + * + * The source names can be used according to the + * color-source and factor syntax, + * so for example "(1-SRC_COLOR[A])" would be a valid factor, as would + * "(CONSTANT[RGB])" + * + * These can also be used as factors: + * + * 0: (0, 0, 0, 0) + * 1: (1, 1, 1, 1) + * SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A]) + * + * + * Remember; all color components are normalized to the range [0, 1] + * before computing the result of blending. + * + * + * Blend Strings/1 + * Blend a non-premultiplied source over a destination with + * premultiplied alpha: + * + * "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))" + * "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))" + * + * + * + * + * Blend Strings/2 + * Blend a premultiplied source over a destination with + * premultiplied alpha + * + * "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))" + * + * + * + * The default blend string is: + * |[ + * RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A])) + * ]| + * + * That gives normal alpha-blending when the calculated color for the material + * is in premultiplied form. + * + * Return value: %TRUE if the blend string was successfully parsed, and the + * described blending is supported by the underlying driver/hardware. If + * there was an error, %FALSE is returned and @error is set accordingly (if + * present). + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_blend() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_blend) +CoglBool +cogl_material_set_blend (CoglMaterial *material, + const char *blend_string, + CoglError **error); + +/** + * cogl_material_set_blend_constant: + * @material: A #CoglMaterial object + * @constant_color: The constant color you want + * + * When blending is setup to reference a CONSTANT blend factor then + * blending will depend on the constant set with this function. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_blend_constant() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_blend_constant) +void +cogl_material_set_blend_constant (CoglMaterial *material, + const CoglColor *constant_color); + +/** + * cogl_material_set_point_size: + * @material: a material. + * @point_size: the new point size. + * + * Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is + * used with the vertex buffer API. Note that typically the GPU will + * only support a limited minimum and maximum range of point sizes. If + * the chosen point size is outside that range then the nearest value + * within that range will be used instead. The size of a point is in + * screen space so it will be the same regardless of any + * transformations. The default point size is 1.0. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_point_size() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_point_size) +void +cogl_material_set_point_size (CoglMaterial *material, + float point_size); + +/** + * cogl_material_get_point_size: + * @material: a #CoglHandle to a material. + * + * Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is + * used with the vertex buffer API. + * + * Return value: the point size of the material. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_get_point_size() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_point_size) +float +cogl_material_get_point_size (CoglMaterial *material); + +/** + * cogl_material_get_user_program: + * @material: a #CoglMaterial object. + * + * Queries what user program has been associated with the given + * @material using cogl_material_set_user_program(). + * + * Return value: (transfer none): The current user program + * or %COGL_INVALID_HANDLE. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglHandle +cogl_material_get_user_program (CoglMaterial *material); + +/** + * cogl_material_set_user_program: + * @material: a #CoglMaterial object. + * @program: A #CoglHandle to a linked CoglProgram + * + * Associates a linked CoglProgram with the given material so that the + * program can take full control of vertex and/or fragment processing. + * + * This is an example of how it can be used to associate an ARBfp + * program with a #CoglMaterial: + * |[ + * CoglHandle shader; + * CoglHandle program; + * CoglMaterial *material; + * + * shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + * cogl_shader_source (shader, + * "!!ARBfp1.0\n" + * "MOV result.color,fragment.color;\n" + * "END\n"); + * cogl_shader_compile (shader); + * + * program = cogl_create_program (); + * cogl_program_attach_shader (program, shader); + * cogl_program_link (program); + * + * material = cogl_material_new (); + * cogl_material_set_user_program (material, program); + * + * cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff); + * cogl_rectangle (0, 0, 100, 100); + * ]| + * + * It is possibly worth keeping in mind that this API is not part of + * the long term design for how we want to expose shaders to Cogl + * developers (We are planning on deprecating the cogl_program and + * cogl_shader APIs in favour of a "snippet" framework) but in the + * meantime we hope this will handle most practical GLSL and ARBfp + * requirements. + * + * Also remember you need to check for either the + * %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before + * using the cogl_program or cogl_shader API. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_material_set_user_program (CoglMaterial *material, + CoglHandle program); + +/** + * cogl_material_set_layer: + * @material: A #CoglMaterial object + * @layer_index: the index of the layer + * @texture: a #CoglHandle for the layer object + * + * In addition to the standard OpenGL lighting model a Cogl material may have + * one or more layers comprised of textures that can be blended together in + * order, with a number of different texture combine modes. This function + * defines a new texture layer. + * + * The index values of multiple layers do not have to be consecutive; it is + * only their relative order that is important. + * + * In the future, we may define other types of material layers, such + * as purely GLSL based layers. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_layer() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer) +void +cogl_material_set_layer (CoglMaterial *material, + int layer_index, + CoglHandle texture); + +/** + * cogl_material_remove_layer: + * @material: A #CoglMaterial object + * @layer_index: Specifies the layer you want to remove + * + * This function removes a layer from your material + * Deprecated: 1.16: Use cogl_pipeline_remove_layer() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_remove_layer) +void +cogl_material_remove_layer (CoglMaterial *material, + int layer_index); + + +/** + * cogl_material_set_layer_combine: + * @material: A #CoglMaterial object + * @layer_index: Specifies the layer you want define a combine function for + * @blend_string: A Cogl blend string + * describing the desired texture combine function. + * @error: A #CoglError that may report parse errors or lack of GPU/driver + * support. May be %NULL, in which case a warning will be printed out if an + * error is encountered. + * + * If not already familiar; you can refer + * here for an overview of what blend + * strings are and there syntax. + * + * These are all the functions available for texture combining: + * + * REPLACE(arg0) = arg0 + * MODULATE(arg0, arg1) = arg0 x arg1 + * ADD(arg0, arg1) = arg0 + arg1 + * ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5 + * INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2) + * SUBTRACT(arg0, arg1) = arg0 - arg1 + * + * + * DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + + * (arg0[G] - 0.5)) * (arg1[G] - 0.5) + + * (arg0[B] - 0.5)) * (arg1[B] - 0.5)) + * + * + * + * + * DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) + + * (arg0[G] - 0.5)) * (arg1[G] - 0.5) + + * (arg0[B] - 0.5)) * (arg1[B] - 0.5)) + * + * + * + * + * Refer to the + * color-source syntax for + * describing the arguments. The valid source names for texture combining + * are: + * + * + * TEXTURE + * Use the color from the current texture layer + * + * + * TEXTURE_0, TEXTURE_1, etc + * Use the color from the specified texture layer + * + * + * CONSTANT + * Use the color from the constant given with + * cogl_material_set_layer_constant() + * + * + * PRIMARY + * Use the color of the material as set with + * cogl_material_set_color() + * + * + * PREVIOUS + * Either use the texture color from the previous layer, or + * if this is layer 0, use the color of the material as set with + * cogl_material_set_color() + * + * + * + * + * Layer Combine Examples + * This is effectively what the default blending is: + * + * RGBA = MODULATE (PREVIOUS, TEXTURE) + * + * This could be used to cross-fade between two images, using + * the alpha component of a constant as the interpolator. The constant + * color is given by calling cogl_material_set_layer_constant. + * + * RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A]) + * + * + * + * You can't give a multiplication factor for arguments as you can + * with blending. + * + * Return value: %TRUE if the blend string was successfully parsed, and the + * described texture combining is supported by the underlying driver and + * or hardware. On failure, %FALSE is returned and @error is set + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_combine() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_combine) +CoglBool +cogl_material_set_layer_combine (CoglMaterial *material, + int layer_index, + const char *blend_string, + CoglError **error); + +/** + * cogl_material_set_layer_combine_constant: + * @material: A #CoglMaterial object + * @layer_index: Specifies the layer you want to specify a constant used + * for texture combining + * @constant: The constant color you want + * + * When you are using the 'CONSTANT' color source in a layer combine + * description then you can use this function to define its value. + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_combine_constant() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_combine_constant) +void +cogl_material_set_layer_combine_constant (CoglMaterial *material, + int layer_index, + const CoglColor *constant); + +/** + * cogl_material_set_layer_matrix: + * @material: A #CoglMaterial object + * @layer_index: the index for the layer inside @material + * @matrix: the transformation matrix for the layer + * + * This function lets you set a matrix that can be used to e.g. translate + * and rotate a single layer of a material used to fill your geometry. + * Deprecated: 1.16: Use cogl_pipeline_set_layer_matrix() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_matrix) +void +cogl_material_set_layer_matrix (CoglMaterial *material, + int layer_index, + const CoglMatrix *matrix); + +/** + * cogl_material_get_layers: + * @material: A #CoglMaterial object + * + * This function lets you access a material's internal list of layers + * for iteration. + * + * You should avoid using this API if possible since it was only + * made public by mistake and will be deprecated when we have + * suitable alternative. + * + * It's important to understand that the list returned may not + * remain valid if you modify the material or any of the layers in any + * way and so you would have to re-get the list in that + * situation. + * + * Return value: (element-type CoglMaterialLayer) (transfer none): A + * list of #CoglMaterialLayer's that can be passed to the + * cogl_material_layer_* functions. The list is owned by Cogl and it + * should not be modified or freed + * Deprecated: 1.16: Use cogl_pipeline_get_layers() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_layers) +const GList * +cogl_material_get_layers (CoglMaterial *material); + +/** + * cogl_material_get_n_layers: + * @material: A #CoglMaterial object + * + * Retrieves the number of layers defined for the given @material + * + * Return value: the number of layers + * + * Since: 1.0 + * Deprecated: 1.16: Use cogl_pipeline_get_n_layers() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_n_layers) +int +cogl_material_get_n_layers (CoglMaterial *material); + +/** + * CoglMaterialLayerType: + * @COGL_MATERIAL_LAYER_TYPE_TEXTURE: The layer represents a + * texture + * + * Available types of layers for a #CoglMaterial. This enumeration + * might be expanded in later versions. + * + * Since: 1.0 + */ +typedef enum { + COGL_MATERIAL_LAYER_TYPE_TEXTURE +} CoglMaterialLayerType; + + +/** + * cogl_material_layer_get_type: + * @layer: A #CoglMaterialLayer object + * + * Retrieves the type of the layer + * + * Currently there is only one type of layer defined: + * %COGL_MATERIAL_LAYER_TYPE_TEXTURE, but considering we may add purely GLSL + * based layers in the future, you should write code that checks the type + * first. + * + * Return value: the type of the layer + * Deprecated: 1.16: No replacement + */ +COGL_DEPRECATED_IN_1_16 +CoglMaterialLayerType +cogl_material_layer_get_type (CoglMaterialLayer *layer); + +/** + * cogl_material_layer_get_texture: + * @layer: A #CoglMaterialLayer object + * + * Extracts a texture handle for a specific layer. + * + * In the future Cogl may support purely GLSL based layers; for those + * layers this function which will likely return %COGL_INVALID_HANDLE if you + * try to get the texture handle from them. Considering this scenario, you + * should call cogl_material_layer_get_type() first in order check it is of + * type %COGL_MATERIAL_LAYER_TYPE_TEXTURE before calling this function. + * + * Return value: (transfer none): a #CoglHandle for the texture inside the layer + * Deprecated: 1.16: No replacement + */ +COGL_DEPRECATED_IN_1_16 +CoglHandle +cogl_material_layer_get_texture (CoglMaterialLayer *layer); + +/** + * cogl_material_layer_get_min_filter: + * @layer: a #CoglHandle for a material layer + * + * Queries the currently set downscaling filter for a material layer + * + * Return value: the current downscaling filter + * Deprecated: 1.16: No replacement + */ +COGL_DEPRECATED_IN_1_16 +CoglMaterialFilter +cogl_material_layer_get_min_filter (CoglMaterialLayer *layer); + +/** + * cogl_material_layer_get_mag_filter: + * @layer: A #CoglMaterialLayer object + * + * Queries the currently set downscaling filter for a material later + * + * Return value: the current downscaling filter + * Deprecated: 1.16: No replacement + */ +COGL_DEPRECATED_IN_1_16 +CoglMaterialFilter +cogl_material_layer_get_mag_filter (CoglMaterialLayer *layer); + +/** + * cogl_material_set_layer_filters: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @min_filter: the filter used when scaling a texture down. + * @mag_filter: the filter used when magnifying a texture. + * + * Changes the decimation and interpolation filters used when a texture is + * drawn at other scales than 100%. + * Deprecated: 1.16: Use cogl_pipeline_set_layer_filters() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_filters) +void +cogl_material_set_layer_filters (CoglMaterial *material, + int layer_index, + CoglMaterialFilter min_filter, + CoglMaterialFilter mag_filter); + +/** + * cogl_material_set_layer_point_sprite_coords_enabled: + * @material: a #CoglHandle to a material. + * @layer_index: the layer number to change. + * @enable: whether to enable point sprite coord generation. + * @error: A return location for a CoglError, or NULL to ignore errors. + * + * When rendering points, if @enable is %TRUE then the texture + * coordinates for this layer will be replaced with coordinates that + * vary from 0.0 to 1.0 across the primitive. The top left of the + * point will have the coordinates 0.0,0.0 and the bottom right will + * have 1.0,1.0. If @enable is %FALSE then the coordinates will be + * fixed for the entire point. + * + * This function will only work if %COGL_FEATURE_POINT_SPRITE is + * available. If the feature is not available then the function will + * return %FALSE and set @error. + * + * Return value: %TRUE if the function succeeds, %FALSE otherwise. + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_point_sprite_coords_enabled() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_point_sprite_coords_enabled) +CoglBool +cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index, + CoglBool enable, + CoglError **error); + +/** + * cogl_material_get_layer_point_sprite_coords_enabled: + * @material: a #CoglHandle to a material. + * @layer_index: the layer number to check. + * + * Gets whether point sprite coordinate generation is enabled for this + * texture layer. + * + * Return value: whether the texture coordinates will be replaced with + * point sprite coordinates. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_get_layer_point_sprite_coords_enabled() + * instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_layer_point_sprite_coords_enabled) +CoglBool +cogl_material_get_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index); + +/** + * cogl_material_get_layer_wrap_mode_s: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 's' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 's' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Deprecated: 1.16: Use cogl_pipeline_get_layer_wrap_mode_s() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_layer_wrap_mode_s) +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_s (CoglMaterial *material, + int layer_index); + +/** + * cogl_material_set_layer_wrap_mode_s: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 's' coordinate of texture lookups on this layer. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_wrap_mode_s() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_wrap_mode_s) +void +cogl_material_set_layer_wrap_mode_s (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode); + +/** + * cogl_material_get_layer_wrap_mode_t: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 't' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 't' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Deprecated: 1.16: Use cogl_pipeline_get_layer_wrap_mode_t() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_layer_wrap_mode_t) +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_t (CoglMaterial *material, + int layer_index); + + +/** + * cogl_material_set_layer_wrap_mode_t: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 't' coordinate of texture lookups on this layer. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_wrap_mode_t() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_wrap_mode_t) +void +cogl_material_set_layer_wrap_mode_t (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode); + +/** + * cogl_material_get_layer_wrap_mode_p: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * + * Returns the wrap mode for the 'p' coordinate of texture lookups on this + * layer. + * + * Return value: the wrap mode for the 'p' coordinate of texture lookups on + * this layer. + * + * Since: 1.6 + * Deprecated: 1.16: Use cogl_pipeline_get_layer_wrap_mode_p() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_layer_wrap_mode_p) +CoglMaterialWrapMode +cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, + int layer_index); + +/** + * cogl_material_set_layer_wrap_mode_p: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 'p' coordinate of texture lookups on + * this layer. 'p' is the third coordinate. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_wrap_mode_p() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_wrap_mode_p) +void +cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode); + +/** + * cogl_material_set_layer_wrap_mode: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for all three coordinates of texture lookups on + * this layer. This is equivalent to calling + * cogl_material_set_layer_wrap_mode_s(), + * cogl_material_set_layer_wrap_mode_t() and + * cogl_material_set_layer_wrap_mode_p() separately. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_set_layer_wrap_mode() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_layer_wrap_mode) +void +cogl_material_set_layer_wrap_mode (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode); + +/** + * cogl_material_layer_get_wrap_mode_s: + * @layer: A #CoglMaterialLayer object + * + * Gets the wrap mode for the 's' coordinate of texture lookups on this layer. + * + * Return value: the wrap mode value for the s coordinate. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_layer_get_wrap_mode_s() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_layer_get_wrap_mode_s) +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_s (CoglMaterialLayer *layer); + +/** + * cogl_material_layer_get_wrap_mode_t: + * @layer: A #CoglMaterialLayer object + * + * Gets the wrap mode for the 't' coordinate of texture lookups on this layer. + * + * Return value: the wrap mode value for the t coordinate. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_layer_get_wrap_mode_t() instead + */ + +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_layer_get_wrap_mode_t) +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_t (CoglMaterialLayer *layer); + +/** + * cogl_material_layer_get_wrap_mode_p: + * @layer: A #CoglMaterialLayer object + * + * Gets the wrap mode for the 'p' coordinate of texture lookups on + * this layer. 'p' is the third coordinate. + * + * Return value: the wrap mode value for the p coordinate. + * + * Since: 1.4 + * Deprecated: 1.16: Use cogl_pipeline_layer_get_wrap_mode_p() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_layer_get_wrap_mode_p) +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer); + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * cogl_material_set_depth_state: + * @material: A #CoglMaterial object + * @state: A #CoglDepthState struct + * @error: A #CoglError to report failures to setup the given @state. + * + * This commits all the depth state configured in @state struct to the + * given @material. The configuration values are copied into the + * material so there is no requirement to keep the #CoglDepthState + * struct around if you don't need it any more. + * + * Note: Since some platforms do not support the depth range feature + * it is possible for this function to fail and report an @error. + * + * Returns: TRUE if the GPU supports all the given @state else %FALSE + * and returns an @error. + * + * Since: 1.8 + * Stability: Unstable + * Deprecated: 1.16: Use cogl_pipeline_set_depth_state() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_set_depth_state) +CoglBool +cogl_material_set_depth_state (CoglMaterial *material, + const CoglDepthState *state, + CoglError **error); + +/** + * cogl_material_get_depth_state: + * @material: A #CoglMaterial object + * @state_out: A destination #CoglDepthState struct + * + * Retrieves the current depth state configuration for the given + * @pipeline as previously set using cogl_pipeline_set_depth_state(). + * + * Since: 2.0 + * Stability: Unstable + * Deprecated: 1.16: Use cogl_pipeline_get_depth_state() instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_pipeline_get_depth_state) +void +cogl_material_get_depth_state (CoglMaterial *material, + CoglDepthState *state_out); + +/** + * CoglMaterialLayerCallback: + * @material: The #CoglMaterial whos layers are being iterated + * @layer_index: The current layer index + * @user_data: The private data passed to cogl_material_foreach_layer() + * + * The callback prototype used with cogl_material_foreach_layer() for + * iterating all the layers of a @material. + * + * Since: 1.4 + * Stability: Unstable + * Deprecated: 1.16 + */ +typedef CoglBool (*CoglMaterialLayerCallback) (CoglMaterial *material, + int layer_index, + void *user_data); + +/** + * cogl_material_foreach_layer: + * @material: A #CoglMaterial object + * @callback: A #CoglMaterialLayerCallback to be called for each layer + * index + * @user_data: Private data that will be passed to the callback + * + * Iterates all the layer indices of the given @material. + * + * Since: 1.4 + * Stability: Unstable + * Deprecated: 1.16: No replacement + */ +COGL_DEPRECATED_IN_1_16 +void +cogl_material_foreach_layer (CoglMaterial *material, + CoglMaterialLayerCallback callback, + void *user_data); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +G_END_DECLS + +#endif /* __COGL_MATERIAL_H__ */ diff --git a/cogl/deprecated/cogl-program-private.h b/cogl/deprecated/cogl-program-private.h new file mode 100644 index 0000000..64ed72c --- /dev/null +++ b/cogl/deprecated/cogl-program-private.h @@ -0,0 +1,88 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_PROGRAM_H +#define __COGL_PROGRAM_H + +#include "cogl-object-private.h" +#include "cogl-shader-private.h" + +typedef struct _CoglProgram CoglProgram; + +struct _CoglProgram +{ + CoglHandleObject _parent; + + GSList *attached_shaders; + + GArray *custom_uniforms; + + /* An age counter that changes whenever the list of shaders is modified */ + unsigned int age; +}; + +typedef struct _CoglProgramUniform CoglProgramUniform; + +struct _CoglProgramUniform +{ + char *name; + CoglBoxedValue value; + /* The cached GL location for this uniform. This is only valid + between calls to _cogl_program_dirty_all_uniforms */ + GLint location; + /* Whether we have a location yet */ + unsigned int location_valid : 1; + /* Whether the uniform value has changed since the last time the + uniforms were flushed */ + unsigned int dirty : 1; +}; + +/* Internal function to flush the custom uniforms for the given use + program. This assumes the target GL program is already bound. The + gl_program still needs to be passed so that CoglProgram can query + the uniform locations. gl_program_changed should be set to TRUE if + we are flushing the uniforms against a different GL program from + the last time it was flushed. This will cause it to requery all of + the locations and assume that all uniforms are dirty */ +void +_cogl_program_flush_uniforms (CoglProgram *program, + GLuint gl_program, + CoglBool gl_program_changed); + +CoglShaderLanguage +_cogl_program_get_language (CoglHandle handle); + +CoglBool +_cogl_program_has_fragment_shader (CoglHandle handle); + +CoglBool +_cogl_program_has_vertex_shader (CoglHandle handle); + +#endif /* __COGL_PROGRAM_H */ diff --git a/cogl/deprecated/cogl-program.c b/cogl/deprecated/cogl-program.c new file mode 100644 index 0000000..9b44d35 --- /dev/null +++ b/cogl/deprecated/cogl-program.c @@ -0,0 +1,503 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#include "cogl-util.h" +#include "cogl-util-gl-private.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" + +#include "cogl-shader-private.h" +#include "cogl-program-private.h" + +#include + +static void _cogl_program_free (CoglProgram *program); + +COGL_HANDLE_DEFINE (Program, program); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (program); + +/* A CoglProgram is effectively just a list of shaders that will be + used together and a set of values for the custom uniforms. No + actual GL program is created - instead this is the responsibility + of the GLSL material backend. The uniform values are collected in + an array and then flushed whenever the material backend requests + it. */ + +static void +_cogl_program_free (CoglProgram *program) +{ + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Unref all of the attached shaders */ + g_slist_foreach (program->attached_shaders, (GFunc) cogl_handle_unref, NULL); + /* Destroy the list */ + g_slist_free (program->attached_shaders); + + for (i = 0; i < program->custom_uniforms->len; i++) + { + CoglProgramUniform *uniform = + &g_array_index (program->custom_uniforms, CoglProgramUniform, i); + + g_free (uniform->name); + + if (uniform->value.count > 1) + g_free (uniform->value.v.array); + } + + g_array_free (program->custom_uniforms, TRUE); + + g_slice_free (CoglProgram, program); +} + +CoglHandle +cogl_create_program (void) +{ + CoglProgram *program; + + program = g_slice_new0 (CoglProgram); + + program->custom_uniforms = + g_array_new (FALSE, FALSE, sizeof (CoglProgramUniform)); + program->age = 0; + + return _cogl_program_handle_new (program); +} + +void +cogl_program_attach_shader (CoglHandle program_handle, + CoglHandle shader_handle) +{ + CoglProgram *program; + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!cogl_is_program (program_handle) || !cogl_is_shader (shader_handle)) + return; + + program = program_handle; + shader = shader_handle; + + /* Only one shader is allowed if the type is ARBfp */ + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + _COGL_RETURN_IF_FAIL (program->attached_shaders == NULL); + else if (shader->language == COGL_SHADER_LANGUAGE_GLSL) + _COGL_RETURN_IF_FAIL (_cogl_program_get_language (program) == + COGL_SHADER_LANGUAGE_GLSL); + + program->attached_shaders + = g_slist_prepend (program->attached_shaders, + cogl_handle_ref (shader_handle)); + + program->age++; +} + +void +cogl_program_link (CoglHandle handle) +{ + /* There's no point in linking the program here because it will have + to be relinked with a different fixed functionality shader + whenever the settings change */ +} + +void +cogl_program_use (CoglHandle handle) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (handle == COGL_INVALID_HANDLE || + cogl_is_program (handle)); + + if (ctx->current_program == 0 && handle != 0) + ctx->legacy_state_set++; + else if (handle == 0 && ctx->current_program != 0) + ctx->legacy_state_set--; + + if (handle != COGL_INVALID_HANDLE) + cogl_handle_ref (handle); + if (ctx->current_program != COGL_INVALID_HANDLE) + cogl_handle_unref (ctx->current_program); + ctx->current_program = handle; +} + +int +cogl_program_get_uniform_location (CoglHandle handle, + const char *uniform_name) +{ + int i; + CoglProgram *program; + CoglProgramUniform *uniform; + + if (!cogl_is_program (handle)) + return -1; + + program = handle; + + /* We can't just ask the GL program object for the uniform location + directly because it will change every time the program is linked + with a different shader. Instead we make our own mapping of + uniform numbers and cache the names */ + for (i = 0; i < program->custom_uniforms->len; i++) + { + uniform = &g_array_index (program->custom_uniforms, + CoglProgramUniform, i); + + if (!strcmp (uniform->name, uniform_name)) + return i; + } + + /* Create a new uniform with the given name */ + g_array_set_size (program->custom_uniforms, + program->custom_uniforms->len + 1); + uniform = &g_array_index (program->custom_uniforms, + CoglProgramUniform, + program->custom_uniforms->len - 1); + + uniform->name = g_strdup (uniform_name); + memset (&uniform->value, 0, sizeof (CoglBoxedValue)); + uniform->dirty = TRUE; + uniform->location_valid = FALSE; + + return program->custom_uniforms->len - 1; +} + +static CoglProgramUniform * +cogl_program_modify_uniform (CoglProgram *program, + int uniform_no) +{ + CoglProgramUniform *uniform; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_program (program), NULL); + _COGL_RETURN_VAL_IF_FAIL (uniform_no >= 0 && + uniform_no < program->custom_uniforms->len, + NULL); + + uniform = &g_array_index (program->custom_uniforms, + CoglProgramUniform, uniform_no); + uniform->dirty = TRUE; + + return uniform; +} + +void +cogl_program_uniform_1f (int uniform_no, + float value) +{ + CoglProgramUniform *uniform; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + uniform = cogl_program_modify_uniform (ctx->current_program, uniform_no); + _cogl_boxed_value_set_1f (&uniform->value, value); +} + +void +cogl_program_set_uniform_1f (CoglHandle handle, + int uniform_location, + float value) +{ + CoglProgramUniform *uniform; + + uniform = cogl_program_modify_uniform (handle, uniform_location); + _cogl_boxed_value_set_1f (&uniform->value, value); +} + +void +cogl_program_uniform_1i (int uniform_no, + int value) +{ + CoglProgramUniform *uniform; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + uniform = cogl_program_modify_uniform (ctx->current_program, uniform_no); + _cogl_boxed_value_set_1i (&uniform->value, value); +} + +void +cogl_program_set_uniform_1i (CoglHandle handle, + int uniform_location, + int value) +{ + CoglProgramUniform *uniform; + + uniform = cogl_program_modify_uniform (handle, uniform_location); + _cogl_boxed_value_set_1i (&uniform->value, value); +} + +void +cogl_program_uniform_float (int uniform_no, + int size, + int count, + const float *value) +{ + CoglProgramUniform *uniform; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + uniform = cogl_program_modify_uniform (ctx->current_program, uniform_no); + _cogl_boxed_value_set_float (&uniform->value, size, count, value); +} + +void +cogl_program_set_uniform_float (CoglHandle handle, + int uniform_location, + int n_components, + int count, + const float *value) +{ + CoglProgramUniform *uniform; + + uniform = cogl_program_modify_uniform (handle, uniform_location); + _cogl_boxed_value_set_float (&uniform->value, n_components, count, value); +} + +void +cogl_program_uniform_int (int uniform_no, + int size, + int count, + const int *value) +{ + CoglProgramUniform *uniform; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + uniform = cogl_program_modify_uniform (ctx->current_program, uniform_no); + _cogl_boxed_value_set_int (&uniform->value, size, count, value); +} + +void +cogl_program_set_uniform_int (CoglHandle handle, + int uniform_location, + int n_components, + int count, + const int *value) +{ + CoglProgramUniform *uniform; + + uniform = cogl_program_modify_uniform (handle, uniform_location); + _cogl_boxed_value_set_int (&uniform->value, n_components, count, value); +} + +void +cogl_program_set_uniform_matrix (CoglHandle handle, + int uniform_location, + int dimensions, + int count, + CoglBool transpose, + const float *value) +{ + CoglProgramUniform *uniform; + + uniform = cogl_program_modify_uniform (handle, uniform_location); + _cogl_boxed_value_set_matrix (&uniform->value, + dimensions, + count, + transpose, + value); +} + +void +cogl_program_uniform_matrix (int uniform_no, + int size, + int count, + CoglBool transpose, + const float *value) +{ + CoglProgramUniform *uniform; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + uniform = cogl_program_modify_uniform (ctx->current_program, uniform_no); + _cogl_boxed_value_set_matrix (&uniform->value, size, count, transpose, value); +} + +/* ARBfp local parameters can be referenced like: + * + * "program.local[5]" + * ^14char offset (after whitespace is stripped) + */ +static int +get_local_param_index (const char *uniform_name) +{ + char *input = g_strdup (uniform_name); + int i; + char *p = input; + char *endptr; + int _index; + + for (i = 0; input[i] != '\0'; i++) + if (input[i] != '_' && input[i] != '\t') + *p++ = input[i]; + input[i] = '\0'; + + _COGL_RETURN_VAL_IF_FAIL (strncmp ("program.local[", input, 14) == 0, -1); + + _index = g_ascii_strtoull (input + 14, &endptr, 10); + _COGL_RETURN_VAL_IF_FAIL (endptr != input + 14, -1); + _COGL_RETURN_VAL_IF_FAIL (*endptr == ']', -1); + + _COGL_RETURN_VAL_IF_FAIL (_index >= 0, -1); + + g_free (input); + + return _index; +} + +#ifdef HAVE_COGL_GL + +static void +_cogl_program_flush_uniform_arbfp (GLint location, + CoglBoxedValue *value) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (value->type != COGL_BOXED_NONE) + { + _COGL_RETURN_IF_FAIL (value->type == COGL_BOXED_FLOAT); + _COGL_RETURN_IF_FAIL (value->size == 4); + _COGL_RETURN_IF_FAIL (value->count == 1); + + GE( ctx, glProgramLocalParameter4fv (GL_FRAGMENT_PROGRAM_ARB, location, + value->v.float_value) ); + } +} + +#endif /* HAVE_COGL_GL */ + +void +_cogl_program_flush_uniforms (CoglProgram *program, + GLuint gl_program, + CoglBool gl_program_changed) +{ + CoglProgramUniform *uniform; + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (ctx->driver != COGL_DRIVER_GLES1); + + for (i = 0; i < program->custom_uniforms->len; i++) + { + uniform = &g_array_index (program->custom_uniforms, + CoglProgramUniform, i); + + if (gl_program_changed || uniform->dirty) + { + if (gl_program_changed || !uniform->location_valid) + { + if (_cogl_program_get_language (program) == + COGL_SHADER_LANGUAGE_GLSL) + uniform->location = + ctx->glGetUniformLocation (gl_program, uniform->name); + else + uniform->location = + get_local_param_index (uniform->name); + + uniform->location_valid = TRUE; + } + + /* If the uniform isn't really in the program then there's + no need to actually set it */ + if (uniform->location != -1) + { + switch (_cogl_program_get_language (program)) + { + case COGL_SHADER_LANGUAGE_GLSL: + _cogl_boxed_value_set_uniform (ctx, + uniform->location, + &uniform->value); + break; + + case COGL_SHADER_LANGUAGE_ARBFP: +#ifdef HAVE_COGL_GL + _cogl_program_flush_uniform_arbfp (uniform->location, + &uniform->value); +#endif + break; + } + } + + uniform->dirty = FALSE; + } + } +} + +CoglShaderLanguage +_cogl_program_get_language (CoglHandle handle) +{ + CoglProgram *program = handle; + + /* Use the language of the first shader */ + + if (program->attached_shaders) + { + CoglShader *shader = program->attached_shaders->data; + return shader->language; + } + else + return COGL_SHADER_LANGUAGE_GLSL; +} + +static CoglBool +_cogl_program_has_shader_type (CoglProgram *program, + CoglShaderType type) +{ + GSList *l; + + for (l = program->attached_shaders; l; l = l->next) + { + CoglShader *shader = l->data; + + if (shader->type == type) + return TRUE; + } + + return FALSE; +} + +CoglBool +_cogl_program_has_fragment_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_FRAGMENT); +} + +CoglBool +_cogl_program_has_vertex_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_VERTEX); +} diff --git a/cogl/deprecated/cogl-shader-private.h b/cogl/deprecated/cogl-shader-private.h new file mode 100644 index 0000000..dcc16b9 --- /dev/null +++ b/cogl/deprecated/cogl-shader-private.h @@ -0,0 +1,72 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_SHADER_H +#define __COGL_SHADER_H + +#include "cogl-object-private.h" +#include "cogl-shader.h" +#include "cogl-gl-header.h" +#include "cogl-pipeline.h" + +typedef struct _CoglShader CoglShader; + +typedef enum +{ + COGL_SHADER_LANGUAGE_GLSL, + COGL_SHADER_LANGUAGE_ARBFP +} CoglShaderLanguage; + +struct _CoglShader +{ + CoglHandleObject _parent; + GLuint gl_handle; + CoglPipeline *compilation_pipeline; + CoglShaderType type; + CoglShaderLanguage language; + char *source; +}; + +void +_cogl_shader_compile_real (CoglHandle handle, + CoglPipeline *pipeline); + +CoglShaderLanguage +_cogl_program_get_language (CoglHandle handle); + +void +_cogl_shader_set_source_with_boilerplate (GLuint shader_gl_handle, + GLenum shader_gl_type, + int n_tex_coord_attribs, + GLsizei count_in, + const char **strings_in, + const GLint *lengths_in); + +#endif /* __COGL_SHADER_H */ diff --git a/cogl/deprecated/cogl-shader.c b/cogl/deprecated/cogl-shader.c new file mode 100644 index 0000000..08dcb82 --- /dev/null +++ b/cogl/deprecated/cogl-shader.c @@ -0,0 +1,377 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-shader-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-glsl-shader-private.h" +#include "cogl-glsl-shader-boilerplate.h" + +#include + +#include + +static void _cogl_shader_free (CoglShader *shader); + +COGL_HANDLE_DEFINE (Shader, shader); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (shader); + +#ifndef GL_FRAGMENT_SHADER +#define GL_FRAGMENT_SHADER 0x8B30 +#endif +#ifndef GL_VERTEX_SHADER +#define GL_VERTEX_SHADER 0x8B31 +#endif + +static void +_cogl_shader_free (CoglShader *shader) +{ + /* Frees shader resources but its handle is not + released! Do that separately before this! */ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + +#ifdef HAVE_COGL_GL + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + { + if (shader->gl_handle) + GE (ctx, glDeletePrograms (1, &shader->gl_handle)); + } + else +#endif + if (shader->gl_handle) + GE (ctx, glDeleteShader (shader->gl_handle)); + + g_slice_free (CoglShader, shader); +} + +CoglHandle +cogl_create_shader (CoglShaderType type) +{ + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + switch (type) + { + case COGL_SHADER_TYPE_VERTEX: + case COGL_SHADER_TYPE_FRAGMENT: + break; + default: + g_warning ("Unexpected shader type (0x%08lX) given to " + "cogl_create_shader", (unsigned long) type); + return COGL_INVALID_HANDLE; + } + + shader = g_slice_new (CoglShader); + shader->language = COGL_SHADER_LANGUAGE_GLSL; + shader->gl_handle = 0; + shader->compilation_pipeline = NULL; + shader->type = type; + + return _cogl_shader_handle_new (shader); +} + +static void +delete_shader (CoglShader *shader) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + +#ifdef HAVE_COGL_GL + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + { + if (shader->gl_handle) + GE (ctx, glDeletePrograms (1, &shader->gl_handle)); + } + else +#endif + { + if (shader->gl_handle) + GE (ctx, glDeleteShader (shader->gl_handle)); + } + + shader->gl_handle = 0; + + if (shader->compilation_pipeline) + { + cogl_object_unref (shader->compilation_pipeline); + shader->compilation_pipeline = NULL; + } +} + +void +cogl_shader_source (CoglHandle handle, + const char *source) +{ + CoglShader *shader; + CoglShaderLanguage language; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!cogl_is_shader (handle)) + return; + + shader = handle; + +#ifdef HAVE_COGL_GL + if (strncmp (source, "!!ARBfp1.0", 10) == 0) + language = COGL_SHADER_LANGUAGE_ARBFP; + else +#endif + language = COGL_SHADER_LANGUAGE_GLSL; + + /* Delete the old object if the language is changing... */ + if (G_UNLIKELY (language != shader->language) && + shader->gl_handle) + delete_shader (shader); + + shader->source = g_strdup (source); + + shader->language = language; +} + +void +cogl_shader_compile (CoglHandle handle) +{ + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!cogl_is_shader (handle)) + return; + +#ifdef HAVE_COGL_GL + shader = handle; + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + _cogl_shader_compile_real (handle, NULL); +#endif + + /* XXX: For GLSL we don't actually compile anything until the shader + * gets used so we have an opportunity to add some boilerplate to + * the shader. + * + * At the end of the day this is obviously a badly designed API + * given that we are having to lie to the user. It was a mistake to + * so thinly wrap the OpenGL shader API and the current plan is to + * replace it with a pipeline snippets API. */ +} + +void +_cogl_shader_compile_real (CoglHandle handle, + CoglPipeline *pipeline) +{ + CoglShader *shader = handle; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + +#ifdef HAVE_COGL_GL + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + { +#ifdef COGL_GL_DEBUG + GLenum gl_error; +#endif + + if (shader->gl_handle) + return; + + GE (ctx, glGenPrograms (1, &shader->gl_handle)); + + GE (ctx, glBindProgram (GL_FRAGMENT_PROGRAM_ARB, shader->gl_handle)); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE))) + g_message ("user ARBfp program:\n%s", shader->source); + +#ifdef COGL_GL_DEBUG + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; +#endif + ctx->glProgramString (GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen (shader->source), + shader->source); +#ifdef COGL_GL_DEBUG + gl_error = ctx->glGetError (); + if (gl_error != GL_NO_ERROR) + { + g_warning ("%s: GL error (%d): Failed to compile ARBfp:\n%s\n%s", + G_STRLOC, + gl_error, + shader->source, + ctx->glGetString (GL_PROGRAM_ERROR_STRING_ARB)); + } +#endif + } + else +#endif + { + GLenum gl_type; + GLint status; + + if (shader->gl_handle) + { + CoglPipeline *prev = shader->compilation_pipeline; + + /* XXX: currently the only things that will affect the + * boilerplate for user shaders, apart from driver features, + * are the pipeline layer-indices and texture-unit-indices + */ + if (pipeline == prev || + _cogl_pipeline_layer_and_unit_numbers_equal (prev, pipeline)) + return; + } + + if (shader->gl_handle) + delete_shader (shader); + + switch (shader->type) + { + case COGL_SHADER_TYPE_VERTEX: + gl_type = GL_VERTEX_SHADER; + break; + case COGL_SHADER_TYPE_FRAGMENT: + gl_type = GL_FRAGMENT_SHADER; + break; + default: + g_assert_not_reached (); + break; + } + + shader->gl_handle = ctx->glCreateShader (gl_type); + + _cogl_glsl_shader_set_source_with_boilerplate (ctx, + shader->gl_handle, + gl_type, + pipeline, + 1, + (const char **) + &shader->source, + NULL); + + GE (ctx, glCompileShader (shader->gl_handle)); + + shader->compilation_pipeline = cogl_object_ref (pipeline); + + GE (ctx, glGetShaderiv (shader->gl_handle, GL_COMPILE_STATUS, &status)); + if (!status) + { + char buffer[512]; + int len = 0; + + ctx->glGetShaderInfoLog (shader->gl_handle, 511, &len, buffer); + buffer[len] = '\0'; + + g_warning ("Failed to compile GLSL program:\n" + "src:\n%s\n" + "error:\n%s\n", + shader->source, + buffer); + } + } +} + +char * +cogl_shader_get_info_log (CoglHandle handle) +{ + if (!cogl_is_shader (handle)) + return NULL; + + /* XXX: This API doesn't really do anything! + * + * This API is purely for compatibility + * + * The reason we don't do anything is because a shader needs to + * be associated with a CoglPipeline for Cogl to be able to + * compile and link anything. + * + * The way this API was originally designed as a very thin wrapper + * over the GL api was a mistake and it's now very difficult to + * make the API work in a meaningful way given how the rest of Cogl + * has evolved. + * + * The CoglShader API is mostly deprecated by CoglSnippets and so + * these days we do the bare minimum to support the existing users + * of it until they are able to migrate to the snippets api. + */ + + return g_strdup (""); +} + +CoglShaderType +cogl_shader_get_type (CoglHandle handle) +{ + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, COGL_SHADER_TYPE_VERTEX); + + if (!cogl_is_shader (handle)) + { + g_warning ("Non shader handle type passed to cogl_shader_get_type"); + return COGL_SHADER_TYPE_VERTEX; + } + + shader = handle; + return shader->type; +} + +CoglBool +cogl_shader_is_compiled (CoglHandle handle) +{ +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) + if (!cogl_is_shader (handle)) + return FALSE; + + /* XXX: This API doesn't really do anything! + * + * This API is purely for compatibility and blatantly lies to the + * user about whether their shader has been compiled. + * + * I suppose we could say we're stretching the definition of + * "compile" and are deferring any related errors to be "linker" + * errors. + * + * The reason we don't do anything is because a shader needs to + * be associated with a CoglPipeline for Cogl to be able to + * compile and link anything. + * + * The CoglShader API is mostly deprecated by CoglSnippets and so + * these days we do the bare minimum to support the existing users + * of it until they are able to migrate to the snippets api. + */ + + return TRUE; + +#else + return FALSE; +#endif +} diff --git a/cogl/deprecated/cogl-shader.h b/cogl/deprecated/cogl-shader.h new file mode 100644 index 0000000..af225e8 --- /dev/null +++ b/cogl/deprecated/cogl-shader.h @@ -0,0 +1,704 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SHADER_H__ +#define __COGL_SHADER_H__ + +#include +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-shaders + * @short_description: Fuctions for accessing the programmable GL pipeline + * + * Cogl allows accessing the GL programmable pipeline in order to create + * vertex and fragment shaders. + * + * The shader source code can either be GLSL or ARBfp. If the source + * code is ARBfp, it must begin with the string “!!ARBfp1.0”. The + * application should check for the %COGL_FEATURE_SHADERS_GLSL or + * %COGL_FEATURE_SHADERS_ARBFP features before using shaders. + * + * When using GLSL Cogl provides replacement names for most of the + * builtin varyings and uniforms. It is recommended to use these names + * wherever possible to increase portability between OpenGL 2.0 and + * GLES 2.0. GLES 2.0 does not have most of the builtins under their + * original names so they will only work with the Cogl names. + * + * For use in all GLSL shaders, the Cogl builtins are as follows: + * + * + * + * + * uniform mat4 + * cogl_modelview_matrix + * + * The current modelview matrix. This is equivalent to + * #gl_ModelViewMatrix. + * + * + * + * uniform mat4 + * cogl_projection_matrix + * + * The current projection matrix. This is equivalent to + * #gl_ProjectionMatrix. + * + * + * + * uniform mat4 + * cogl_modelview_projection_matrix + * + * The combined modelview and projection matrix. A vertex shader + * would typically use this to transform the incoming vertex + * position. The separate modelview and projection matrices are + * usually only needed for lighting calculations. This is + * equivalent to #gl_ModelViewProjectionMatrix. + * + * + * + * uniform mat4 + * cogl_texture_matrix[] + * + * An array of matrices for transforming the texture + * coordinates. This is equivalent to #gl_TextureMatrix. + * + * + * + * + * + * In a vertex shader, the following are also available: + * + * + * + * + * attribute vec4 + * cogl_position_in + * + * The incoming vertex position. This is equivalent to #gl_Vertex. + * + * + * + * attribute vec4 + * cogl_color_in + * + * The incoming vertex color. This is equivalent to #gl_Color. + * + * + * + * attribute vec4 + * cogl_tex_coord_in + * + * The texture coordinate for the first texture unit. This is + * equivalent to #gl_MultiTexCoord0. + * + * + * + * attribute vec4 + * cogl_tex_coord0_in + * + * The texture coordinate for the first texture unit. This is + * equivalent to #gl_MultiTexCoord0. There is also + * #cogl_tex_coord1_in and so on. + * + * + * + * attribute vec3 + * cogl_normal_in + * + * The normal of the vertex. This is equivalent to #gl_Normal. + * + * + * + * vec4 + * cogl_position_out + * + * The calculated position of the vertex. This must be written to + * in all vertex shaders. This is equivalent to #gl_Position. + * + * + * + * float + * cogl_point_size_out + * + * The calculated size of a point. This is equivalent to #gl_PointSize. + * + * + * + * varying vec4 + * cogl_color_out + * + * The calculated color of a vertex. This is equivalent to #gl_FrontColor. + * + * + * + * varying vec4 + * cogl_tex_coord_out[] + * + * An array of calculated texture coordinates for a vertex. This is + * equivalent to #gl_TexCoord. + * + * + * + * + * + * In a fragment shader, the following are also available: + * + * + * + * + * varying vec4 cogl_color_in + * + * The calculated color of a vertex. This is equivalent to #gl_FrontColor. + * + * + * + * varying vec4 + * cogl_tex_coord_in[] + * + * An array of calculated texture coordinates for a vertex. This is + * equivalent to #gl_TexCoord. + * + * + * + * vec4 cogl_color_out + * + * The final calculated color of the fragment. All fragment shaders + * must write to this variable. This is equivalent to + * #gl_FrontColor. + * + * + * + * float cogl_depth_out + * + * An optional output variable specifying the depth value to use + * for this fragment. This is equivalent to #gl_FragDepth. + * + * + * + * bool cogl_front_facing + * + * A readonly variable that will be true if the current primitive + * is front facing. This can be used to implement two-sided + * coloring algorithms. This is equivalent to #gl_FrontFacing. + * + * + * + * + * + * It's worth nothing that this API isn't what Cogl would like to have + * in the long term and it may be removed in Cogl 2.0. The + * experimental #CoglShader API is the proposed replacement. + */ + +/** + * CoglShaderType: + * @COGL_SHADER_TYPE_VERTEX: A program for proccessing vertices + * @COGL_SHADER_TYPE_FRAGMENT: A program for processing fragments + * + * Types of shaders + * + * Since: 1.0 + */ +typedef enum { + COGL_SHADER_TYPE_VERTEX, + COGL_SHADER_TYPE_FRAGMENT +} CoglShaderType; + +/** + * cogl_create_shader: + * @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT. + * + * Create a new shader handle, use cogl_shader_source() to set the + * source code to be used on it. + * + * Returns: a new shader handle. + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglHandle +cogl_create_shader (CoglShaderType shader_type); + +/** + * cogl_shader_ref: + * @handle: A #CoglHandle to a shader. + * + * Add an extra reference to a shader. + * + * Returns: @handle + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglHandle +cogl_shader_ref (CoglHandle handle); + +/** + * cogl_shader_unref: + * @handle: A #CoglHandle to a shader. + * + * Removes a reference to a shader. If it was the last reference the + * shader object will be destroyed. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_shader_unref (CoglHandle handle); + +/** + * cogl_is_shader: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing shader object. + * + * Returns: %TRUE if the handle references a shader, + * %FALSE otherwise + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglBool +cogl_is_shader (CoglHandle handle); + +/** + * cogl_shader_source: + * @shader: #CoglHandle for a shader. + * @source: Shader source. + * + * Replaces the current source associated with a shader with a new + * one. + * + * Please see above + * for a description of the recommended format for the shader code. + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_shader_source (CoglHandle shader, + const char *source); + +/** + * cogl_shader_compile: + * @handle: #CoglHandle for a shader. + * + * Compiles the shader, no return value, but the shader is now ready + * for linking into a program. Note that calling this function is + * optional. If it is not called then the shader will be automatically + * compiled when it is linked. + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_shader_compile (CoglHandle handle); + +/** + * cogl_shader_get_info_log: + * @handle: #CoglHandle for a shader. + * + * Retrieves the information log for a coglobject, can be used in conjunction + * with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error + * messages that caused a shader to not compile correctly, mainly useful for + * debugging purposes. + * + * Return value: a newly allocated string containing the info log. Use + * g_free() to free it + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +char * +cogl_shader_get_info_log (CoglHandle handle); + +/** + * cogl_shader_get_type: + * @handle: #CoglHandle for a shader. + * + * Retrieves the type of a shader #CoglHandle + * + * Return value: %COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor + * or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglShaderType +cogl_shader_get_type (CoglHandle handle); + +/** + * cogl_shader_is_compiled: + * @handle: #CoglHandle for a shader. + * + * Retrieves whether a shader #CoglHandle has been compiled + * + * Return value: %TRUE if the shader object has sucessfully be compiled + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglBool +cogl_shader_is_compiled (CoglHandle handle); + +/** + * cogl_create_program: + * + * Create a new cogl program object that can be used to replace parts of the GL + * rendering pipeline with custom code. + * + * Returns: a new cogl program. + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglHandle +cogl_create_program (void); + +/** + * cogl_program_ref: + * @handle: A #CoglHandle to a program. + * + * Add an extra reference to a program. + * + * Deprecated: 1.0: Please use cogl_object_ref() instead. + * + * Returns: @handle + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglHandle +cogl_program_ref (CoglHandle handle); + +/** + * cogl_program_unref: + * @handle: A #CoglHandle to a program. + * + * Removes a reference to a program. If it was the last reference the + * program object will be destroyed. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_unref (CoglHandle handle); + +/** + * cogl_is_program: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing program object. + * + * Returns: %TRUE if the handle references a program, + * %FALSE otherwise + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +CoglBool +cogl_is_program (CoglHandle handle); + +/** + * cogl_program_attach_shader: + * @program_handle: a #CoglHandle for a shdaer program. + * @shader_handle: a #CoglHandle for a vertex of fragment shader. + * + * Attaches a shader to a program object. A program can have multiple + * vertex or fragment shaders but only one of them may provide a + * main() function. It is allowed to use a program with only a vertex + * shader or only a fragment shader. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_attach_shader (CoglHandle program_handle, + CoglHandle shader_handle); + +/** + * cogl_program_link: + * @handle: a #CoglHandle for a shader program. + * + * Links a program making it ready for use. Note that calling this + * function is optional. If it is not called the program will + * automatically be linked the first time it is used. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_link (CoglHandle handle); + +/** + * cogl_program_use: + * @handle: a #CoglHandle for a shader program or %COGL_INVALID_HANDLE. + * + * Activate a specific shader program replacing that part of the GL + * rendering pipeline, if passed in %COGL_INVALID_HANDLE the default + * behavior of GL is reinstated. + * + * This function affects the global state of the current Cogl + * context. It is much more efficient to attach the shader to a + * specific material used for rendering instead by calling + * cogl_material_set_user_program(). + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_use (CoglHandle handle); + +/** + * cogl_program_get_uniform_location: + * @handle: a #CoglHandle for a shader program. + * @uniform_name: the name of a uniform. + * + * Retrieve the location (offset) of a uniform variable in a shader program, + * a uniform is a variable that is constant for all vertices/fragments for a + * shader object and is possible to modify as an external parameter. + * + * Return value: the offset of a uniform in a specified program. + * This uniform can be set using cogl_program_uniform_1f() when the + * program is in use. + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +int +cogl_program_get_uniform_location (CoglHandle handle, + const char *uniform_name); + +/** + * cogl_program_set_uniform_1f: + * @program: A #CoglHandle for a linked program + * @uniform_location: the uniform location retrieved from + * cogl_program_get_uniform_location(). + * @value: the new value of the uniform. + * + * Changes the value of a floating point uniform for the given linked + * @program. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_set_uniform_1f (CoglHandle program, + int uniform_location, + float value); + +/** + * cogl_program_set_uniform_1i: + * @program: A #CoglHandle for a linked program + * @uniform_location: the uniform location retrieved from + * cogl_program_get_uniform_location(). + * @value: the new value of the uniform. + * + * Changes the value of an integer uniform for the given linked + * @program. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_set_uniform_1i (CoglHandle program, + int uniform_location, + int value); + +/** + * cogl_program_set_uniform_float: + * @program: A #CoglHandle for a linked program + * @uniform_location: the uniform location retrieved from + * cogl_program_get_uniform_location(). + * @n_components: The number of components for the uniform. For + * example with glsl you'd use 3 for a vec3 or 4 for a vec4. + * @count: For uniform arrays this is the array length otherwise just + * pass 1 + * @value: (array length=count): the new value of the uniform[s]. + * + * Changes the value of a float vector uniform, or uniform array for + * the given linked @program. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_set_uniform_float (CoglHandle program, + int uniform_location, + int n_components, + int count, + const float *value); + +/** + * cogl_program_set_uniform_int: + * @program: A #CoglHandle for a linked program + * @uniform_location: the uniform location retrieved from + * cogl_program_get_uniform_location(). + * @n_components: The number of components for the uniform. For + * example with glsl you'd use 3 for a vec3 or 4 for a vec4. + * @count: For uniform arrays this is the array length otherwise just + * pass 1 + * @value: (array length=count): the new value of the uniform[s]. + * + * Changes the value of a int vector uniform, or uniform array for + * the given linked @program. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_set_uniform_int (CoglHandle program, + int uniform_location, + int n_components, + int count, + const int *value); + +/** + * cogl_program_set_uniform_matrix: + * @program: A #CoglHandle for a linked program + * @uniform_location: the uniform location retrieved from + * cogl_program_get_uniform_location(). + * @dimensions: The dimensions of the matrix. So for for example pass + * 2 for a 2x2 matrix or 3 for 3x3. + * @count: For uniform arrays this is the array length otherwise just + * pass 1 + * @transpose: Whether to transpose the matrix when setting the uniform. + * @value: (array length=count): the new value of the uniform. + * + * Changes the value of a matrix uniform, or uniform array in the + * given linked @program. + * + * Since: 1.4 + * Deprecated: 1.16: Use #CoglSnippet api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_set_uniform_matrix (CoglHandle program, + int uniform_location, + int dimensions, + int count, + CoglBool transpose, + const float *value); + +/** + * cogl_program_uniform_1f: + * @uniform_no: the uniform to set. + * @value: the new value of the uniform. + * + * Changes the value of a floating point uniform in the currently + * used (see cogl_program_use()) shader program. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_uniform_1f (int uniform_no, + float value); + +/** + * cogl_program_uniform_1i: + * @uniform_no: the uniform to set. + * @value: the new value of the uniform. + * + * Changes the value of an integer uniform in the currently + * used (see cogl_program_use()) shader program. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_uniform_1i (int uniform_no, + int value); + +/** + * cogl_program_uniform_float: + * @uniform_no: the uniform to set. + * @size: Size of float vector. + * @count: Size of array of uniforms. + * @value: (array length=count): the new value of the uniform. + * + * Changes the value of a float vector uniform, or uniform array in the + * currently used (see cogl_program_use()) shader program. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_uniform_float (int uniform_no, + int size, + int count, + const float *value); + +/** + * cogl_program_uniform_int: + * @uniform_no: the uniform to set. + * @size: Size of int vector. + * @count: Size of array of uniforms. + * @value: (array length=count): the new value of the uniform. + * + * Changes the value of a int vector uniform, or uniform array in the + * currently used (see cogl_program_use()) shader program. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_uniform_int (int uniform_no, + int size, + int count, + const int *value); + +/** + * cogl_program_uniform_matrix: + * @uniform_no: the uniform to set. + * @size: Size of matrix. + * @count: Size of array of uniforms. + * @transpose: Whether to transpose the matrix when setting the uniform. + * @value: (array length=count): the new value of the uniform. + * + * Changes the value of a matrix uniform, or uniform array in the + * currently used (see cogl_program_use()) shader program. The @size + * parameter is used to determine the square size of the matrix. + * + * Deprecated: 1.16: Use #CoglSnippet api + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_snippet_) +void +cogl_program_uniform_matrix (int uniform_no, + int size, + int count, + CoglBool transpose, + const float *value); + +COGL_END_DECLS + +#endif /* __COGL_SHADER_H__ */ diff --git a/cogl/deprecated/cogl-texture-deprecated.c b/cogl/deprecated/cogl-texture-deprecated.c new file mode 100644 index 0000000..d18a013 --- /dev/null +++ b/cogl/deprecated/cogl-texture-deprecated.c @@ -0,0 +1,85 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#include + +#include "cogl-types.h" +#include "cogl-texture.h" +#include "cogl-texture-private.h" +#include "cogl-object-private.h" +#include "deprecated/cogl-texture-deprecated.h" + +CoglPixelFormat +cogl_texture_get_format (CoglTexture *texture) +{ + return _cogl_texture_get_format (texture); +} + +unsigned int +cogl_texture_get_rowstride (CoglTexture *texture) +{ + CoglPixelFormat format = cogl_texture_get_format (texture); + /* FIXME: This function should go away. It previously just returned + the rowstride that was used to upload the data as far as I can + tell. This is not helpful */ + + /* Just guess at a suitable rowstride */ + return (_cogl_pixel_format_get_bytes_per_pixel (format) + * cogl_texture_get_width (texture)); +} + +void * +cogl_texture_ref (void *object) +{ + if (!cogl_is_texture (object)) + return NULL; + + _COGL_OBJECT_DEBUG_REF (CoglTexture, object); + + cogl_object_ref (object); + + return object; +} + +void +cogl_texture_unref (void *object) +{ + if (!cogl_is_texture (object)) + { + g_warning (G_STRINGIFY (cogl_texture_unref) + ": Ignoring unref of CoglObject " + "due to type mismatch"); + return; + } + + _COGL_OBJECT_DEBUG_UNREF (CoglTexture, object); + + cogl_object_unref (object); +} diff --git a/cogl/deprecated/cogl-texture-deprecated.h b/cogl/deprecated/cogl-texture-deprecated.h new file mode 100644 index 0000000..4ab824d --- /dev/null +++ b/cogl/deprecated/cogl-texture-deprecated.h @@ -0,0 +1,105 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_DEPRECATED_H__ +#define __COGL_TEXTURE_DEPRECATED_H__ + +/** + * cogl_texture_get_format: + * @texture: a #CoglTexture pointer. + * + * Queries the #CoglPixelFormat of a cogl texture. + * + * Return value: the #CoglPixelFormat of the GPU side texture + * Deprecated: 1.18: This api is misleading + */ +COGL_DEPRECATED_IN_1_18 +CoglPixelFormat +cogl_texture_get_format (CoglTexture *texture); + +/** + * cogl_texture_get_rowstride: + * @texture a #CoglTexture pointer. + * + * Determines the bytes-per-pixel for the #CoglPixelFormat retrieved + * from cogl_texture_get_format() and multiplies that by the texture's + * width. + * + * It's very unlikely that anyone would need to use this API to + * query the internal rowstride of a #CoglTexture which can just be + * considered an implementation detail. Actually it's not even useful + * internally since underlying drivers are free to use a different + * format + * + * This API is only here for backwards compatibility and + * shouldn't be used in new code. In particular please don't be + * mislead to pass the returned value to cogl_texture_get_data() for + * the rowstride, since you should be passing the rowstride you desire + * for your destination buffer not the rowstride of the source + * texture. + * + * Return value: The bytes-per-pixel for the current format + * multiplied by the texture's width + * + * Deprecated: 1.10: There's no replacement for the API but there's + * also no known need for API either. It was just + * a mistake that it was ever published. + */ +COGL_DEPRECATED_IN_1_10 +unsigned int +cogl_texture_get_rowstride (CoglTexture *texture); + +/** + * cogl_texture_ref: (skip) + * @texture: a #CoglTexture. + * + * Increment the reference count for a cogl texture. + * + * Deprecated: 1.2: Use cogl_object_ref() instead + * + * Return value: the @texture pointer. + */ +COGL_DEPRECATED_FOR (cogl_object_ref) +void * +cogl_texture_ref (void *texture); + +/** + * cogl_texture_unref: (skip) + * @texture: a #CoglTexture. + * + * Decrement the reference count for a cogl texture. + * + * Deprecated: 1.2: Use cogl_object_unref() instead + */ +COGL_DEPRECATED_FOR (cogl_object_unref) +void +cogl_texture_unref (void *texture); + +#endif /* __COGL_TEXTURE_DEPRECATED_H__ */ diff --git a/cogl/deprecated/cogl-type-casts.h b/cogl/deprecated/cogl-type-casts.h new file mode 100644 index 0000000..ae716e7 --- /dev/null +++ b/cogl/deprecated/cogl-type-casts.h @@ -0,0 +1,53 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TYPE_CASTS_H__ +#define __COGL_TYPE_CASTS_H__ + +/* The various interface types in Cogl used to be more strongly typed + * which required lots type casting by developers. We provided + * macros for performing these casts following a widely used Gnome + * coding style. Since we now consistently typedef these interfaces + * as void for the public C api and use runtime type checking to + * catch programming errors the casts have become redundant and + * so these macros are only kept for compatibility... + */ + +#define COGL_FRAMEBUFFER(X) (X) +#define COGL_BUFFER(X) (X) +#define COGL_TEXTURE(X) (X) +#define COGL_META_TEXTURE(X) (X) +#define COGL_PRIMITIVE_TEXTURE(X) (X) + +#endif /* __COGL_TYPE_CASTS_H__ */ diff --git a/cogl/deprecated/cogl-vertex-buffer-private.h b/cogl/deprecated/cogl-vertex-buffer-private.h new file mode 100644 index 0000000..f803bbb --- /dev/null +++ b/cogl/deprecated/cogl-vertex-buffer-private.h @@ -0,0 +1,165 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_VERTEX_BUFFER_H +#define __COGL_VERTEX_BUFFER_H + +#include "cogl-object-private.h" + +#include "cogl-primitive.h" + +#include + +/* Note we put quite a bit into the flags here to help keep + * the down size of the CoglVertexBufferAttrib struct below. */ +typedef enum _CoglVertexBufferAttribFlags +{ + /* Types */ + /* NB: update the _TYPE_MASK below if these are changed */ + COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY = 1<<0, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY = 1<<1, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY = 1<<2, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY = 1<<3, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY = 1<<4, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID = 1<<5, + + COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMALIZED = 1<<6, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED = 1<<7, + + /* Usage hints */ + /* FIXME - flatten into one flag, since its used as a boolean */ + COGL_VERTEX_BUFFER_ATTRIB_FLAG_INFREQUENT_RESUBMIT = 1<<8, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT = 1<<9, + + /* GL Data types */ + /* NB: Update the _GL_TYPE_MASK below if these are changed */ + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_BYTE = 1<<10, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_BYTE = 1<<11, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_SHORT = 1<<12, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_SHORT = 1<<13, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_INT = 1<<14, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_UNSIGNED_INT = 1<<15, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_FLOAT = 1<<16, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_GL_TYPE_DOUBLE = 1<<17, + + COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED = 1<<18, + COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED = 1<<19 + + /* XXX NB: If we need > 24 bits then look at changing the layout + * of struct _CoglVertexBufferAttrib below */ +} CoglVertexBufferAttribFlags; + +#define COGL_VERTEX_BUFFER_ATTRIB_FLAG_TYPE_MASK \ + (COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY \ + | COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY \ + | COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY \ + | COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY \ + | COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY \ + | COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID) + +typedef struct _CoglVertexBufferAttrib +{ + /* TODO: look at breaking up the flags into seperate + * bitfields and seperate enums */ + CoglVertexBufferAttribFlags flags:24; + uint8_t id; + GQuark name; + char *name_without_detail; + union _u + { + const void *pointer; + size_t vbo_offset; + } u; + CoglAttributeType type; + size_t span_bytes; + uint16_t stride; + uint8_t n_components; + uint8_t texture_unit; + + int attribute_first; + CoglAttribute *attribute; + +} CoglVertexBufferAttrib; + +typedef enum _CoglVertexBufferVBOFlags +{ + COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED = 1<<0, + COGL_VERTEX_BUFFER_VBO_FLAG_MULTIPACK = 1<<1, + + /* FIXME - flatten into one flag, since its used as a boolean */ + COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT = 1<<3, + COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT = 1<<4, + + COGL_VERTEX_BUFFER_VBO_FLAG_SUBMITTED = 1<<5 +} CoglVertexBufferVBOFlags; + +/* + * A CoglVertexBufferVBO represents one or more attributes in a single + * buffer object + */ +typedef struct _CoglVertexBufferVBO +{ + CoglVertexBufferVBOFlags flags; + + CoglAttributeBuffer *attribute_buffer; + size_t buffer_bytes; + + GList *attributes; +} CoglVertexBufferVBO; + +typedef struct _CoglVertexBufferIndices +{ + CoglHandleObject _parent; + + CoglIndices *indices; +} CoglVertexBufferIndices; + +typedef struct _CoglVertexBuffer +{ + CoglHandleObject _parent; + + int n_vertices; /*!< The number of vertices in the buffer */ + GList *submitted_vbos; /* The VBOs currently submitted to the GPU */ + + /* Note: new_attributes is normally NULL and only valid while + * modifying a buffer. */ + GList *new_attributes; /*!< attributes pending submission */ + + CoglBool dirty_attributes; + + CoglPrimitive *primitive; + +} CoglVertexBuffer; + +#endif /* __COGL_VERTEX_BUFFER_H */ + diff --git a/cogl/deprecated/cogl-vertex-buffer.c b/cogl/deprecated/cogl-vertex-buffer.c new file mode 100644 index 0000000..b51db13 --- /dev/null +++ b/cogl/deprecated/cogl-vertex-buffer.c @@ -0,0 +1,1795 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +/* XXX: For an overview of the functionality implemented here, please + * see cogl-vertex-buffer.h, which contains the gtk-doc section overview + * for the Vertex Buffers API. + */ + +/* + * TODO: We need to do a better job of minimizing when we call glVertexPointer + * and pals in enable_state_for_drawing_buffer + * + * We should have an internal 2-tuple cache of (VBO, offset) for each of them + * so we can avoid some GL calls. We could have cogl wrappers for the + * gl*Pointer funcs that look like this: + * + * cogl_vertex_pointer (n_components, gl_type, stride, vbo, offset); + * cogl_color_pointer (n_components, gl_type, stride, vbo, offset); + * + * They would also accept NULL for the VBO handle to support old style vertex + * arrays. + * + * TODO: + * Actually hook this up to the cogl shaders infrastructure. The vertex + * buffer API has been designed to allow adding of arbitrary attributes for use + * with shaders, but this has yet to be actually plumbed together and tested. + * The bits we are missing: + * - cogl_program_use doesn't currently record within ctx-> which program + * is currently in use so a.t.m only Clutter knows the current shader. + * - We don't query the current shader program for the generic vertex indices + * (using glGetAttribLocation) so that we can call glEnableVertexAttribArray + * with those indices. + * (currently we just make up consecutive indices) + * - some dirty flag mechanims to know when the shader program has changed + * so we don't need to re-query it each time we draw a buffer. + * + * TODO + * Expose API that lets developers get back a buffer handle for a particular + * polygon so they may add custom attributes to them. + * - It should be possible to query/modify attributes efficiently, in place, + * avoiding copies. It would not be acceptable to simply require that + * developers must query back the n_vertices of a buffer and then the + * n_components, type and stride etc of each attribute since there + * would be too many combinations to realistically handle. + * + * - In practice, some cases might be best solved with a higher level + * EditableMesh API, (see futher below) but for many cases I think an + * API like this might be appropriate: + * + * cogl_vertex_buffer_foreach_vertex (buffer_handle, + * (AttributesBufferIteratorFunc)callback, + * "gl_Vertex", "gl_Color", NULL); + * static void callback (CoglVertexBufferVertex *vert) + * { + * GLfloat *pos = vert->attrib[0]; + * GLubyte *color = vert->attrib[1]; + * GLfloat *new_attrib = buf[vert->index]; + * + * new_attrib = pos*color; + * } + * + * TODO + * Think about a higher level Mesh API for building/modifying attribute buffers + * - E.g. look at Blender for inspiration here. They can build a mesh from + * "MVert", "MFace" and "MEdge" primitives. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-vertex-buffer-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline.h" +#include "cogl-pipeline-private.h" +#include "cogl-primitives.h" +#include "cogl-framebuffer-private.h" +#include "cogl-primitive-private.h" +#include "cogl-journal-private.h" +#include "cogl1-context.h" +#include "cogl-vertex-buffer.h" + +#define PAD_FOR_ALIGNMENT(VAR, TYPE_SIZE) \ + (VAR = TYPE_SIZE + ((VAR - 1) & ~(TYPE_SIZE - 1))) + +static void _cogl_vertex_buffer_free (CoglVertexBuffer *buffer); +static void _cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *buffer_indices); +static CoglUserDataKey _cogl_vertex_buffer_pipeline_priv_key; + +COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (vertex_buffer); +COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices); + +CoglHandle +cogl_vertex_buffer_new (unsigned int n_vertices) +{ + CoglVertexBuffer *buffer = g_slice_alloc (sizeof (CoglVertexBuffer)); + + buffer->n_vertices = n_vertices; + + buffer->submitted_vbos = NULL; + buffer->new_attributes = NULL; + buffer->primitive = cogl_primitive_new (COGL_VERTICES_MODE_TRIANGLES, + n_vertices, NULL); + + /* return COGL_INVALID_HANDLE; */ + return _cogl_vertex_buffer_handle_new (buffer); +} + +unsigned int +cogl_vertex_buffer_get_n_vertices (CoglHandle handle) +{ + CoglVertexBuffer *buffer; + + if (!cogl_is_vertex_buffer (handle)) + return 0; + + buffer = handle; + + return buffer->n_vertices; +} + +/* There are a number of standard OpenGL attributes that we deal with + * specially. These attributes are all namespaced with a "gl_" prefix + * so we should catch any typos instead of silently adding a custom + * attribute. + */ +static CoglVertexBufferAttribFlags +validate_gl_attribute (const char *gl_attribute, + uint8_t n_components, + uint8_t *texture_unit) +{ + CoglVertexBufferAttribFlags type; + char *detail_seperator = NULL; + int name_len; + + detail_seperator = strstr (gl_attribute, "::"); + if (detail_seperator) + name_len = detail_seperator - gl_attribute; + else + name_len = strlen (gl_attribute); + + if (strncmp (gl_attribute, "Vertex", name_len) == 0) + { + if (G_UNLIKELY (n_components == 1)) + g_critical ("glVertexPointer doesn't allow 1 component vertex " + "positions so we currently only support \"gl_Vertex\" " + "attributes where n_components == 2, 3 or 4"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY; + } + else if (strncmp (gl_attribute, "Color", name_len) == 0) + { + if (G_UNLIKELY (n_components != 3 && n_components != 4)) + g_critical ("glColorPointer expects 3 or 4 component colors so we " + "currently only support \"gl_Color\" attributes where " + "n_components == 3 or 4"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY; + } + else if (strncmp (gl_attribute, + "MultiTexCoord", + strlen ("MultiTexCoord")) == 0) + { + unsigned int unit; + + if (sscanf (gl_attribute, "MultiTexCoord%u", &unit) != 1) + { + g_warning ("gl_MultiTexCoord attributes should include a\n" + "texture unit number, E.g. gl_MultiTexCoord0\n"); + unit = 0; + } + /* FIXME: validate any '::' delimiter for this case */ + *texture_unit = unit; + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY; + } + else if (strncmp (gl_attribute, "Normal", name_len) == 0) + { + if (G_UNLIKELY (n_components != 3)) + g_critical ("glNormalPointer expects 3 component normals so we " + "currently only support \"gl_Normal\" attributes where " + "n_components == 3"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY; + } + else + { + g_warning ("Unknown gl_* attribute name gl_%s\n", gl_attribute); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID; + } + + return type; +} + +/* There are a number of standard OpenGL attributes that we deal with + * specially. These attributes are all namespaced with a "gl_" prefix + * so we should catch any typos instead of silently adding a custom + * attribute. + */ +static CoglVertexBufferAttribFlags +validate_cogl_attribute (const char *cogl_attribute, + uint8_t n_components, + uint8_t *texture_unit) +{ + CoglVertexBufferAttribFlags type; + char *detail_seperator = NULL; + int name_len; + + detail_seperator = strstr (cogl_attribute, "::"); + if (detail_seperator) + name_len = detail_seperator - cogl_attribute; + else + name_len = strlen (cogl_attribute); + + if (strncmp (cogl_attribute, "position_in", name_len) == 0) + { + if (G_UNLIKELY (n_components == 1)) + g_critical ("glVertexPointer doesn't allow 1 component vertex " + "positions so we currently only support " + "\"cogl_position_in\" attributes where " + "n_components == 2, 3 or 4"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_VERTEX_ARRAY; + } + else if (strncmp (cogl_attribute, "color_in", name_len) == 0) + { + if (G_UNLIKELY (n_components != 3 && n_components != 4)) + g_critical ("glColorPointer expects 3 or 4 component colors so we " + "currently only support \"cogl_color_in\" attributes " + "where n_components == 3 or 4"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_COLOR_ARRAY; + } + else if (strncmp (cogl_attribute, + "cogl_tex_coord", + strlen ("cogl_tex_coord")) == 0) + { + unsigned int unit; + + if (strcmp (cogl_attribute, "cogl_tex_coord_in") == 0) + unit = 0; + else if (sscanf (cogl_attribute, "cogl_tex_coord%u_in", &unit) != 1) + { + g_warning ("texture coordinate attributes should either be " + "referenced as \"cogl_tex_coord_in\" or with a" + "texture unit number like \"cogl_tex_coord1_in\""); + unit = 0; + } + /* FIXME: validate any '::' delimiter for this case */ + *texture_unit = unit; + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_TEXTURE_COORD_ARRAY; + } + else if (strncmp (cogl_attribute, "normal_in", name_len) == 0) + { + if (G_UNLIKELY (n_components != 3)) + g_critical ("glNormalPointer expects 3 component normals so we " + "currently only support \"cogl_normal_in\" attributes " + "where n_components == 3"); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMAL_ARRAY; + } + else + { + g_warning ("Unknown cogl_* attribute name cogl_%s\n", cogl_attribute); + type = COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID; + } + + return type; +} + +/* This validates that a custom attribute name is a valid GLSL variable name + * + * NB: attribute names may have a detail component delimited using '::' E.g. + * custom_attrib::foo or custom_attrib::bar + * + * maybe I should hang a compiled regex somewhere to handle this + */ +static CoglBool +validate_custom_attribute_name (const char *attribute_name) +{ + char *detail_seperator = NULL; + int name_len; + int i; + + detail_seperator = strstr (attribute_name, "::"); + if (detail_seperator) + name_len = detail_seperator - attribute_name; + else + name_len = strlen (attribute_name); + + if (name_len == 0 + || !g_ascii_isalpha (attribute_name[0]) + || attribute_name[0] != '_') + return FALSE; + + for (i = 1; i < name_len; i++) + if (!g_ascii_isalnum (attribute_name[i]) || attribute_name[i] != '_') + return FALSE; + + return TRUE; +} + +/* Iterates the CoglVertexBufferVBOs of a buffer and creates a flat list + * of all the submitted attributes + * + * Note: The CoglVertexBufferAttrib structs are deep copied, except the + * internal CoglAttribute pointer is set to NULL. + */ +static GList * +copy_submitted_attributes_list (CoglVertexBuffer *buffer) +{ + GList *tmp; + GList *submitted_attributes = NULL; + + for (tmp = buffer->submitted_vbos; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferVBO *cogl_vbo = tmp->data; + GList *tmp2; + + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *attribute = tmp2->data; + CoglVertexBufferAttrib *copy = + g_slice_alloc (sizeof (CoglVertexBufferAttrib)); + *copy = *attribute; + copy->name_without_detail = + g_strdup (attribute->name_without_detail); + copy->attribute = NULL; + submitted_attributes = g_list_prepend (submitted_attributes, copy); + } + } + return submitted_attributes; +} + +static size_t +sizeof_attribute_type (CoglAttributeType type) +{ + switch (type) + { + case COGL_ATTRIBUTE_TYPE_BYTE: + return 1; + case COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE: + return 1; + case COGL_ATTRIBUTE_TYPE_SHORT: + return 2; + case COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT: + return 2; + case COGL_ATTRIBUTE_TYPE_FLOAT: + return 4; + } + g_return_val_if_reached (0); +} + +static size_t +strideof (CoglAttributeType type, int n_components) +{ + return sizeof_attribute_type (type) * n_components; +} + +static char * +canonize_attribute_name (const char *attribute_name) +{ + char *detail_seperator = NULL; + int name_len; + + if (strncmp (attribute_name, "gl_", 3) != 0) + return g_strdup (attribute_name); + + /* skip past the "gl_" */ + attribute_name += 3; + + detail_seperator = strstr (attribute_name, "::"); + if (detail_seperator) + name_len = detail_seperator - attribute_name; + else + { + name_len = strlen (attribute_name); + detail_seperator = ""; + } + + if (strncmp (attribute_name, "Vertex", name_len) == 0) + return g_strconcat ("cogl_position_in", detail_seperator, NULL); + else if (strncmp (attribute_name, "Color", name_len) == 0) + return g_strconcat ("cogl_color_in", detail_seperator, NULL); + else if (strncmp (attribute_name, + "MultiTexCoord", + strlen ("MultiTexCoord")) == 0) + { + unsigned int unit; + + if (sscanf (attribute_name, "MultiTexCoord%u", &unit) != 1) + { + g_warning ("gl_MultiTexCoord attributes should include a\n" + "texture unit number, E.g. gl_MultiTexCoord0\n"); + unit = 0; + } + return g_strdup_printf ("cogl_tex_coord%u_in%s", + unit, detail_seperator); + } + else if (strncmp (attribute_name, "Normal", name_len) == 0) + return g_strconcat ("cogl_normal_in", detail_seperator, NULL); + else + { + g_warning ("Unknown gl_* attribute name gl_%s\n", attribute_name); + return g_strdup (attribute_name); + } +} + +void +cogl_vertex_buffer_add (CoglHandle handle, + const char *attribute_name, + uint8_t n_components, + CoglAttributeType type, + CoglBool normalized, + uint16_t stride, + const void *pointer) +{ + CoglVertexBuffer *buffer; + char *cogl_attribute_name; + GQuark name_quark; + CoglBool modifying_an_attrib = FALSE; + CoglVertexBufferAttrib *attribute; + CoglVertexBufferAttribFlags flags = 0; + uint8_t texture_unit = 0; + GList *tmp; + char *detail; + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + buffer->dirty_attributes = TRUE; + + cogl_attribute_name = canonize_attribute_name (attribute_name); + name_quark = g_quark_from_string (cogl_attribute_name); + + /* The submit function works by diffing between submitted_attributes + * and new_attributes to minimize the upload bandwidth + cost of + * allocating new VBOs, so if there isn't already a list of new_attributes + * we create one: */ + if (!buffer->new_attributes) + buffer->new_attributes = copy_submitted_attributes_list (buffer); + + /* Note: we first look for an existing attribute that we are modifying + * so we may skip needing to validate the name */ + for (tmp = buffer->new_attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *submitted_attribute = tmp->data; + if (submitted_attribute->name == name_quark) + { + modifying_an_attrib = TRUE; + + attribute = submitted_attribute; + + /* since we will skip validate_gl/cogl_attribute in this case, we + * need to pluck out the attribute type before overwriting the + * flags: */ + flags |= + attribute->flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_TYPE_MASK; + break; + } + } + + if (!modifying_an_attrib) + { + /* Validate the attribute name, is suitable as a variable name */ + if (strncmp (attribute_name, "gl_", 3) == 0) + { + /* Note: we pass the original attribute name here so that + * any warning messages correspond to the users original + * attribute name... */ + flags |= validate_gl_attribute (attribute_name + 3, + n_components, + &texture_unit); + if (flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID) + return; + } + else if (strncmp (attribute_name, "cogl_", 5) == 0) + { + flags |= validate_cogl_attribute (attribute_name + 5, + n_components, + &texture_unit); + if (flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_INVALID) + return; + } + else + { + flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_CUSTOM_ARRAY; + if (validate_custom_attribute_name (attribute_name)) + return; + } + + attribute = g_slice_alloc0 (sizeof (CoglVertexBufferAttrib)); + } + + attribute->name = name_quark; + detail = strstr (cogl_attribute_name, "::"); + if (detail) + attribute->name_without_detail = g_strndup (cogl_attribute_name, + detail - cogl_attribute_name); + else + attribute->name_without_detail = g_strdup (cogl_attribute_name); + attribute->type = type; + attribute->n_components = n_components; + if (stride == 0) + stride = strideof (type, n_components); + attribute->stride = stride; + attribute->u.pointer = pointer; + attribute->texture_unit = texture_unit; + attribute->attribute = NULL; + + flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED; + + /* Note: We currently just assume, if an attribute is *ever* updated + * then it should be taged as frequently changing. */ + if (modifying_an_attrib) + flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT; + else + flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_INFREQUENT_RESUBMIT; + + if (normalized) + flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_NORMALIZED; + attribute->flags = flags; + + attribute->span_bytes = buffer->n_vertices * attribute->stride; + + if (!modifying_an_attrib) + buffer->new_attributes = + g_list_prepend (buffer->new_attributes, attribute); + + g_free (cogl_attribute_name); +} + +static void +_cogl_vertex_buffer_attrib_free (CoglVertexBufferAttrib *attribute) +{ + if (attribute->attribute) + cogl_object_unref (attribute->attribute); + g_free (attribute->name_without_detail); + g_slice_free (CoglVertexBufferAttrib, attribute); +} + +void +cogl_vertex_buffer_delete (CoglHandle handle, + const char *attribute_name) +{ + CoglVertexBuffer *buffer; + char *cogl_attribute_name = canonize_attribute_name (attribute_name); + GQuark name = g_quark_from_string (cogl_attribute_name); + GList *tmp; + + g_free (cogl_attribute_name); + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + buffer->dirty_attributes = TRUE; + + /* The submit function works by diffing between submitted_attributes + * and new_attributes to minimize the upload bandwidth + cost of + * allocating new VBOs, so if there isn't already a list of new_attributes + * we create one: */ + if (!buffer->new_attributes) + buffer->new_attributes = copy_submitted_attributes_list (buffer); + + for (tmp = buffer->new_attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *submitted_attribute = tmp->data; + if (submitted_attribute->name == name) + { + buffer->new_attributes = + g_list_delete_link (buffer->new_attributes, tmp); + _cogl_vertex_buffer_attrib_free (submitted_attribute); + return; + } + } + + g_warning ("Failed to find an attribute named %s to delete\n", + attribute_name); +} + +static void +set_attribute_enable (CoglHandle handle, + const char *attribute_name, + CoglBool state) +{ + CoglVertexBuffer *buffer; + char *cogl_attribute_name = canonize_attribute_name (attribute_name); + GQuark name_quark = g_quark_from_string (cogl_attribute_name); + GList *tmp; + + g_free (cogl_attribute_name); + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + buffer->dirty_attributes = TRUE; + + /* NB: If a buffer is currently being edited, then there can be two seperate + * lists of attributes; those that are currently submitted and a new list yet + * to be submitted, we need to modify both. */ + + for (tmp = buffer->new_attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + if (attribute->name == name_quark) + { + if (state) + attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED; + else + attribute->flags &= ~COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED; + break; + } + } + + for (tmp = buffer->submitted_vbos; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferVBO *cogl_vbo = tmp->data; + GList *tmp2; + + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *attribute = tmp2->data; + if (attribute->name == name_quark) + { + if (state) + attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED; + else + attribute->flags &= ~COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED; + return; + } + } + } + + g_warning ("Failed to %s attribute named %s/%s\n", + state == TRUE ? "enable" : "disable", + attribute_name, cogl_attribute_name); +} + +void +cogl_vertex_buffer_enable (CoglHandle handle, + const char *attribute_name) +{ + set_attribute_enable (handle, attribute_name, TRUE); +} + +void +cogl_vertex_buffer_disable (CoglHandle handle, + const char *attribute_name) +{ + set_attribute_enable (handle, attribute_name, FALSE); +} + +/* Given an attribute that we know has already been submitted before, this + * function looks for the existing VBO that contains it. + * + * Note: It will free redundant attribute struct once the corresponding + * VBO has been found. + */ +static void +filter_already_submitted_attribute (CoglVertexBufferAttrib *attribute, + GList **reuse_vbos, + GList **submitted_vbos) +{ + GList *tmp; + + /* First check the cogl_vbos we already know are being reused since we + * are more likley to get a match here */ + for (tmp = *reuse_vbos; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferVBO *cogl_vbo = tmp->data; + GList *tmp2; + + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *vbo_attribute = tmp2->data; + + if (vbo_attribute->name == attribute->name) + { + vbo_attribute->flags &= + ~COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED; + /* Note: we don't free the redundant attribute here, since it + * will be freed after all filtering in + * cogl_vertex_buffer_submit */ + return; + } + } + } + + for (tmp = *submitted_vbos; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferVBO *cogl_vbo = tmp->data; + CoglVertexBufferAttrib *reuse_attribute = NULL; + GList *tmp2; + + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *vbo_attribute = tmp2->data; + if (vbo_attribute->name == attribute->name) + { + reuse_attribute = vbo_attribute; + /* Note: we don't free the redundant attribute here, since it + * will be freed after all filtering in + * cogl_vertex_buffer_submit */ + + *submitted_vbos = g_list_remove_link (*submitted_vbos, tmp); + tmp->next = *reuse_vbos; + *reuse_vbos = tmp; + break; + } + } + + if (!reuse_attribute) + continue; + + /* Mark all but the matched attribute as UNUSED, so that when we + * finish filtering all our attributes any attrributes still + * marked as UNUSED can be removed from their cogl_vbo */ + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *vbo_attribute = tmp2->data; + if (vbo_attribute != reuse_attribute) + vbo_attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED; + } + + return; + } + + g_critical ("Failed to find the cogl vbo that corresponds to an\n" + "attribute that had apparently already been submitted!"); +} + +/* When we first mark a CoglVertexBufferVBO to be reused, we mark the + * attributes as unsed, so that when filtering of attributes into VBOs is done + * we can then prune the now unsed attributes. */ +static void +remove_unused_attributes (CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + GList *next; + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + next = tmp->next; + + if (attribute->flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_UNUSED) + { + cogl_vbo->attributes = + g_list_delete_link (cogl_vbo->attributes, tmp); + g_slice_free (CoglVertexBufferAttrib, attribute); + } + } +} + +/* Give a newly added, strided, attribute, this function looks for a + * CoglVertexBufferVBO that the attribute is interleved with. If it can't + * find one then a new CoglVertexBufferVBO is allocated and added to the + * list of new_strided_vbos. + */ +static void +filter_strided_attribute (CoglVertexBufferAttrib *attribute, + GList **new_vbos) +{ + GList *tmp; + CoglVertexBufferVBO *new_cogl_vbo; + + for (tmp = *new_vbos; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferVBO *cogl_vbo = tmp->data; + GList *tmp2; + + if (!(cogl_vbo->flags & COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED)) + continue; + + for (tmp2 = cogl_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *vbo_attribute = tmp2->data; + const char *attribute_start = attribute->u.pointer; + const char *vbo_attribute_start = vbo_attribute->u.pointer; + + /* NB: All attributes have buffer->n_vertices values which + * simplifies determining which attributes are interleved + * since we assume they will start no farther than +- a + * stride away from each other: + */ + if (attribute_start <= (vbo_attribute_start - vbo_attribute->stride) + || attribute_start + >= (vbo_attribute_start + vbo_attribute->stride)) + continue; /* Not interleved */ + + cogl_vbo->attributes = + g_list_prepend (cogl_vbo->attributes, attribute); + + if (attribute->flags & + COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT) + { + cogl_vbo->flags &= + ~COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT; + cogl_vbo->flags |= + COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT; + } + return; + } + } + new_cogl_vbo = g_slice_alloc (sizeof (CoglVertexBufferVBO)); + new_cogl_vbo->attributes = NULL; + new_cogl_vbo->attributes = + g_list_prepend (new_cogl_vbo->attributes, attribute); + /* Any one of the interleved attributes will have the same span_bytes */ + new_cogl_vbo->attribute_buffer = NULL; + new_cogl_vbo->buffer_bytes = attribute->span_bytes; + new_cogl_vbo->flags = COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED; + + if (attribute->flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_INFREQUENT_RESUBMIT) + new_cogl_vbo->flags |= COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT; + else + new_cogl_vbo->flags |= COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT; + + *new_vbos = g_list_prepend (*new_vbos, new_cogl_vbo); + return; +} + +/* This iterates through the list of submitted VBOs looking for one that + * contains attribute. If found the list *link* is removed and returned */ +static GList * +unlink_submitted_vbo_containing_attribute (GList **submitted_vbos, + CoglVertexBufferAttrib *attribute) +{ + GList *tmp; + GList *next = NULL; + + for (tmp = *submitted_vbos; tmp != NULL; tmp = next) + { + CoglVertexBufferVBO *submitted_vbo = tmp->data; + GList *tmp2; + + next = tmp->next; + + for (tmp2 = submitted_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *submitted_attribute = tmp2->data; + + if (submitted_attribute->name == attribute->name) + { + *submitted_vbos = g_list_remove_link (*submitted_vbos, tmp); + return tmp; + } + } + } + + return NULL; +} + +/* Unlinks all the submitted VBOs that conflict with the new cogl_vbo and + * returns them as a list. */ +static GList * +get_submitted_vbo_conflicts (GList **submitted_vbos, + CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + GList *conflicts = NULL; + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + { + GList *link = + unlink_submitted_vbo_containing_attribute (submitted_vbos, + tmp->data); + if (link) + { + /* prepend the link to the list of conflicts: */ + link->next = conflicts; + conflicts = link; + } + } + return conflicts; +} + +/* Any attributes in cogl_vbo gets removed from conflict_vbo */ +static void +disassociate_conflicting_attributes (CoglVertexBufferVBO *conflict_vbo, + CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + + /* NB: The attributes list in conflict_vbo will be shrinking so + * we iterate those in the inner loop. */ + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + GList *tmp2; + for (tmp2 = conflict_vbo->attributes; tmp2 != NULL; tmp2 = tmp2->next) + { + CoglVertexBufferAttrib *conflict_attribute = tmp2->data; + + if (conflict_attribute->name == attribute->name) + { + _cogl_vertex_buffer_attrib_free (conflict_attribute); + conflict_vbo->attributes = + g_list_delete_link (conflict_vbo->attributes, tmp2); + break; + } + } + } +} + +static void +cogl_vertex_buffer_vbo_free (CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + _cogl_vertex_buffer_attrib_free (tmp->data); + g_list_free (cogl_vbo->attributes); + + if (cogl_vbo->flags & COGL_VERTEX_BUFFER_VBO_FLAG_SUBMITTED) + cogl_object_unref (cogl_vbo->attribute_buffer); + + g_slice_free (CoglVertexBufferVBO, cogl_vbo); +} + +/* This figures out the lowest attribute client pointer. (This pointer is used + * to upload all the interleved attributes). + * + * In the process it also replaces the client pointer with the attributes + * offset, and marks the attribute as submitted. + */ +static const void * +prep_strided_vbo_for_upload (CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + const char *lowest_pointer = NULL; + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + const char *client_pointer = attribute->u.pointer; + + if (!lowest_pointer || client_pointer < lowest_pointer) + lowest_pointer = client_pointer; + } + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + const char *client_pointer = attribute->u.pointer; + attribute->u.vbo_offset = client_pointer - lowest_pointer; + attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED; + } + + return lowest_pointer; +} + +static CoglBool +upload_multipack_vbo_via_map_buffer (CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + unsigned int offset = 0; + uint8_t *buf; + + _COGL_GET_CONTEXT (ctx, FALSE); + + buf = cogl_buffer_map (COGL_BUFFER (cogl_vbo->attribute_buffer), + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + if (!buf) + return FALSE; + + for (tmp = cogl_vbo->attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + gsize attribute_size = attribute->span_bytes; + gsize type_size = sizeof_attribute_type (attribute->type); + + PAD_FOR_ALIGNMENT (offset, type_size); + + memcpy (buf + offset, attribute->u.pointer, attribute_size); + + attribute->u.vbo_offset = offset; + attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED; + offset += attribute_size; + } + + cogl_buffer_unmap (COGL_BUFFER (cogl_vbo->attribute_buffer)); + + return TRUE; +} + +static void +upload_multipack_vbo_via_buffer_sub_data (CoglVertexBufferVBO *cogl_vbo) +{ + GList *l; + unsigned int offset = 0; + + for (l = cogl_vbo->attributes; l != NULL; l = l->next) + { + CoglVertexBufferAttrib *attribute = l->data; + gsize attribute_size = attribute->span_bytes; + gsize type_size = sizeof_attribute_type (attribute->type); + + PAD_FOR_ALIGNMENT (offset, type_size); + + cogl_buffer_set_data (COGL_BUFFER (cogl_vbo->attribute_buffer), + offset, + attribute->u.pointer, + attribute_size); + + attribute->u.vbo_offset = offset; + attribute->flags |= COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED; + offset += attribute_size; + } +} + +static void +upload_attributes (CoglVertexBufferVBO *cogl_vbo) +{ + CoglBufferUpdateHint usage; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (cogl_vbo->flags & COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT) + usage = COGL_BUFFER_UPDATE_HINT_DYNAMIC; + else + usage = COGL_BUFFER_UPDATE_HINT_STATIC; + cogl_buffer_set_update_hint (COGL_BUFFER (cogl_vbo->attribute_buffer), usage); + + if (cogl_vbo->flags & COGL_VERTEX_BUFFER_VBO_FLAG_STRIDED) + { + const void *pointer = prep_strided_vbo_for_upload (cogl_vbo); + cogl_buffer_set_data (COGL_BUFFER (cogl_vbo->attribute_buffer), + 0, /* offset */ + pointer, + cogl_vbo->buffer_bytes); + } + else /* MULTIPACK */ + { + /* I think it might depend on the specific driver/HW whether its better + * to use glMapBuffer here or glBufferSubData here. There is even a good + * thread about this topic here: + * http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg35004.html + * For now I have gone with glMapBuffer, but the jury is still out. + */ + + if (!upload_multipack_vbo_via_map_buffer (cogl_vbo)) + upload_multipack_vbo_via_buffer_sub_data (cogl_vbo); + } + + cogl_vbo->flags |= COGL_VERTEX_BUFFER_VBO_FLAG_SUBMITTED; +} + +/* Note: although there ends up being quite a few inner loops involved with + * resolving buffers, the number of attributes will be low so I don't expect + * them to cause a problem. */ +static void +cogl_vertex_buffer_vbo_resolve (CoglVertexBuffer *buffer, + CoglVertexBufferVBO *new_cogl_vbo, + GList **final_vbos) +{ + GList *conflicts; + GList *tmp; + GList *next; + CoglBool found_target_vbo = FALSE; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + conflicts = + get_submitted_vbo_conflicts (&buffer->submitted_vbos, new_cogl_vbo); + + for (tmp = conflicts; tmp != NULL; tmp = next) + { + CoglVertexBufferVBO *conflict_vbo = tmp->data; + + next = tmp->next; + + disassociate_conflicting_attributes (conflict_vbo, new_cogl_vbo); + + if (!conflict_vbo->attributes) + { + /* See if we can re-use this now empty VBO: */ + + if (!found_target_vbo + && conflict_vbo->buffer_bytes == new_cogl_vbo->buffer_bytes) + { + found_target_vbo = TRUE; + new_cogl_vbo->attribute_buffer = + cogl_object_ref (conflict_vbo->attribute_buffer); + cogl_vertex_buffer_vbo_free (conflict_vbo); + + upload_attributes (new_cogl_vbo); + + *final_vbos = g_list_prepend (*final_vbos, new_cogl_vbo); + } + else + cogl_vertex_buffer_vbo_free (conflict_vbo); + } + else + { + /* Relink the VBO back into buffer->submitted_vbos since it may + * be involved in other conflicts later */ + tmp->next = buffer->submitted_vbos; + tmp->prev = NULL; + buffer->submitted_vbos = tmp; + } + } + + if (!found_target_vbo) + { + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + new_cogl_vbo->attribute_buffer = + cogl_attribute_buffer_new (ctx, new_cogl_vbo->buffer_bytes, NULL); + + upload_attributes (new_cogl_vbo); + *final_vbos = g_list_prepend (*final_vbos, new_cogl_vbo); + } +} + +static void +update_primitive_attributes (CoglVertexBuffer *buffer) +{ + GList *l; + int n_attributes = 0; + CoglAttribute **attributes; + int i; + + if (!buffer->dirty_attributes) + return; + + buffer->dirty_attributes = FALSE; + + for (l = buffer->submitted_vbos; l; l = l->next) + { + CoglVertexBufferVBO *cogl_vbo = l->data; + GList *l2; + + for (l2 = cogl_vbo->attributes; l2; l2 = l2->next, n_attributes++) + ; + } + + _COGL_RETURN_IF_FAIL (n_attributes > 0); + + attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); + + i = 0; + for (l = buffer->submitted_vbos; l; l = l->next) + { + CoglVertexBufferVBO *cogl_vbo = l->data; + GList *l2; + + for (l2 = cogl_vbo->attributes; l2; l2 = l2->next) + { + CoglVertexBufferAttrib *attribute = l2->data; + if (G_LIKELY (attribute->flags & + COGL_VERTEX_BUFFER_ATTRIB_FLAG_ENABLED)) + { + if (G_UNLIKELY (!attribute->attribute)) + { + attribute->attribute = + cogl_attribute_new (cogl_vbo->attribute_buffer, + attribute->name_without_detail, + attribute->stride, + attribute->u.vbo_offset, + attribute->n_components, + attribute->type); + } + + attributes[i++] = attribute->attribute; + } + } + } + + cogl_primitive_set_attributes (buffer->primitive, attributes, i); +} + +static void +cogl_vertex_buffer_submit_real (CoglVertexBuffer *buffer) +{ + GList *tmp; + CoglVertexBufferVBO *new_multipack_vbo; + GList *new_multipack_vbo_link; + GList *new_vbos = NULL; + GList *reuse_vbos = NULL; + GList *final_vbos = NULL; + + if (!buffer->new_attributes) + goto done; + + /* The objective now is to copy the attribute data supplied by the client + * into buffer objects, but it's important to minimize the number of + * redundant data uploads. + * + * We obviously aim to group together the attributes that are interleved so + * that they can be delivered in one go to the driver. + * All BOs for interleved data are created as STATIC_DRAW_ARB. + * + * Non interleved attributes tagged as INFREQUENT_RESUBMIT will be grouped + * together back to back in a single BO created as STATIC_DRAW_ARB + * + * Non interleved attributes tagged as FREQUENT_RESUBMIT will be copied into + * individual buffer objects, and the BO itself created DYNAMIC_DRAW_ARB + * + * If we are modifying a previously submitted CoglVertexBuffer then we are + * carefull not to needlesly delete OpenGL buffer objects and replace with + * new ones, instead we upload new data to the existing buffers. + */ + + /* NB: We must forget attribute->pointer after submitting since the user + * is free to re-use that memory for other purposes now. */ + + /* Pseudo code: + * + * Broadly speaking we start with a list of unsorted attributes, and filter + * those into 'new' and 're-use' CoglVertexBufferVBO (CBO) lists. We then + * take the list of new CBO structs and compare with the CBOs that have + * already been submitted to the GPU (but ignoring those we already know will + * be re-used) to determine what other CBOs can be re-used, due to being + * superseded, and what new GL VBOs need to be created. + * + * We have two kinds of CBOs: + * - Multi Pack CBOs + * These contain multiple attributes tightly packed back to back) + * - Strided CBOs + * These typically contain multiple interleved sets of attributes, + * though they can contain just one attribute with a stride + * + * First create a new-CBOs entry "new-multipack-CBO" + * Tag "new-multipack-CBO" as MULTIPACK + INFREQUENT_RESUBMIT + * For each unsorted attrib: + * if already marked as submitted: + * iterate reuse-CBOs: + * if we find one that contains this attribute: + * free redundant unsorted attrib struct + * remove the UNUSED flag from the attrib found in the reuse-CBO + * continue to next unsorted attrib + * iterate submitted VBOs: + * if we find one that contains this attribute: + * free redundant unsorted attrib struct + * unlink the vbo and move it to the list of reuse-CBOs + * mark all attributes except the one just matched as UNUSED + * assert (found) + * continue to next unsorted attrib + * if strided: + * iterate the new, strided, CBOs, to see if the attribute is + * interleved with one of them, if found: + * add to the matched CBO + * else if not found: + * create a new-CBOs entry tagged STRIDED + INFREQUENT_RESUBMIT + * else if unstrided && tagged with FREQUENT_RESUBMIT: + * create a new-CBOs entry tagged MULTIPACK + FREQUENT_RESUBMIT + * else + * add to the new-multipack-CBO + * free list of unsorted-attribs + * + * Next compare the new list of CBOs with the submitted set and try to + * minimize the memory bandwidth required to upload the attributes and the + * overhead of creating new GL-BOs. + * + * We deal with four sets of CBOs: + * - The "new" CBOs + * (as determined above during filtering) + * - The "re-use" CBOs + * (as determined above during filtering) + * - The "submitted" CBOs + * (I.e. ones currently submitted to the GPU) + * - The "final" CBOs + * (The result of resolving the differences between the above sets) + * + * The re-use CBOs are dealt with first, and we simply delete any remaining + * attributes in these that are still marked as UNUSED, and move them + * to the list of final CBOs. + * + * Next we iterate through the "new" CBOs, searching for conflicts + * with the "submitted" CBOs and commit our decision to the "final" CBOs + * + * When searching for submitted entries we always unlink items from the + * submitted list once we make matches (before we make descisions + * based on the matches). If the CBO node is superseded it is freed, + * if it is modified but may be needed for more descisions later it is + * relinked back into the submitted list and if it's identical to a new + * CBO it will be linked into the final list. + * + * At the end the list of submitted CBOs represents the attributes that were + * deleted from the buffer. + * + * Iterate re-use-CBOs: + * Iterate attribs for each: + * if attrib UNUSED: + * remove the attrib from the CBO + free + * |Note: we could potentially mark this as a re-useable gap + * |if needs be later. + * add re-use CBO to the final-CBOs + * Iterate new-CBOs: + * List submitted CBOs conflicting with the this CBO (Unlinked items) + * found-target-BO=FALSE + * Iterate conflicting CBOs: + * Disassociate conflicting attribs from conflicting CBO struct + * If no attribs remain: + * If found-target-BO!=TRUE + * _AND_ If the total size of the conflicting CBO is compatible: + * |Note: We don't currently consider re-using oversized buffers + * found-target-BO=TRUE + * upload replacement data + * free submitted CBO struct + * add new CBO struct to final-CBOs + * else: + * delete conflict GL-BO + * delete conflict CBO struct + * else: + * relink CBO back into submitted-CBOs + * + * if found-target-BO == FALSE: + * create a new GL-BO + * upload data + * add new CBO struct to final-BOs + * + * Iterate through the remaining "submitted" CBOs: + * delete the submitted GL-BO + * free the submitted CBO struct + */ + + new_multipack_vbo = g_slice_alloc (sizeof (CoglVertexBufferVBO)); + new_multipack_vbo->attribute_buffer = NULL; + new_multipack_vbo->buffer_bytes = 0; + new_multipack_vbo->flags = + COGL_VERTEX_BUFFER_VBO_FLAG_MULTIPACK + | COGL_VERTEX_BUFFER_VBO_FLAG_INFREQUENT_RESUBMIT; + new_multipack_vbo->attributes = NULL; + new_vbos = g_list_prepend (new_vbos, new_multipack_vbo); + /* We save the link pointer here, just so we can do a fast removal later if + * no attributes get added to this vbo. */ + new_multipack_vbo_link = new_vbos; + + /* Start with a list of unsorted attributes, and filter those into + * potential new Cogl BO structs + */ + for (tmp = buffer->new_attributes; tmp != NULL; tmp = tmp->next) + { + CoglVertexBufferAttrib *attribute = tmp->data; + + if (attribute->flags & COGL_VERTEX_BUFFER_ATTRIB_FLAG_SUBMITTED) + { + /* If the attribute is already marked as submitted, then we need + * to find the existing VBO that contains it so we dont delete it. + * + * NB: this also frees the attribute struct since it's implicitly + * redundant in this case. + */ + filter_already_submitted_attribute (attribute, + &reuse_vbos, + &buffer->submitted_vbos); + } + else if (attribute->stride) + { + /* look for a CoglVertexBufferVBO that the attribute is + * interleved with. If one can't be found then a new + * CoglVertexBufferVBO is allocated and added to the list of + * new_vbos: */ + filter_strided_attribute (attribute, &new_vbos); + } + else if (attribute->flags & + COGL_VERTEX_BUFFER_ATTRIB_FLAG_FREQUENT_RESUBMIT) + { + CoglVertexBufferVBO *cogl_vbo = + g_slice_alloc (sizeof (CoglVertexBufferVBO)); + + /* attributes we expect will be frequently resubmitted are placed + * in their own VBO so that updates don't impact other attributes + */ + + cogl_vbo->flags = + COGL_VERTEX_BUFFER_VBO_FLAG_MULTIPACK + | COGL_VERTEX_BUFFER_VBO_FLAG_FREQUENT_RESUBMIT; + cogl_vbo->attributes = NULL; + cogl_vbo->attributes = g_list_prepend (cogl_vbo->attributes, + attribute); + cogl_vbo->attribute_buffer = NULL; + cogl_vbo->buffer_bytes = attribute->span_bytes; + new_vbos = g_list_prepend (new_vbos, cogl_vbo); + } + else + { + gsize type_size = sizeof_attribute_type (attribute->flags); + + /* Infrequently updated attributes just get packed back to back + * in a single VBO: */ + new_multipack_vbo->attributes = + g_list_prepend (new_multipack_vbo->attributes, + attribute); + + /* Note: we have to ensure that each run of attributes is + * naturally aligned according to its data type, which may + * require some padding bytes: */ + + /* XXX: We also have to be sure that the attributes aren't + * reorderd before being uploaded because the alignment padding + * is based on the adjacent attribute. + */ + + PAD_FOR_ALIGNMENT (new_multipack_vbo->buffer_bytes, type_size); + + new_multipack_vbo->buffer_bytes += attribute->span_bytes; + } + } + + /* At this point all buffer->new_attributes have been filtered into + * CoglVertexBufferVBOs... */ + g_list_free (buffer->new_attributes); + buffer->new_attributes = NULL; + + /* If the multipack vbo wasn't needed: */ + if (new_multipack_vbo->attributes == NULL) + { + new_vbos = g_list_delete_link (new_vbos, new_multipack_vbo_link); + g_slice_free (CoglVertexBufferVBO, new_multipack_vbo); + } + + for (tmp = reuse_vbos; tmp != NULL; tmp = tmp->next) + remove_unused_attributes (tmp->data); + final_vbos = g_list_concat (final_vbos, reuse_vbos); + + for (tmp = new_vbos; tmp != NULL; tmp = tmp->next) + cogl_vertex_buffer_vbo_resolve (buffer, tmp->data, &final_vbos); + + /* Anything left corresponds to deleted attributes: */ + for (tmp = buffer->submitted_vbos; tmp != NULL; tmp = tmp->next) + cogl_vertex_buffer_vbo_free (tmp->data); + g_list_free (buffer->submitted_vbos); + g_list_free (new_vbos); + + buffer->submitted_vbos = final_vbos; + +done: + update_primitive_attributes (buffer); +} + +void +cogl_vertex_buffer_submit (CoglHandle handle) +{ + CoglVertexBuffer *buffer; + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + + cogl_vertex_buffer_submit_real (buffer); +} + +typedef struct +{ + /* We have a ref-count on this private structure because we need to + refer to it both from the private data on a pipeline and any weak + pipelines that we create from it. If we didn't have the ref count + then we would depend on the order of destruction of a + CoglPipeline and the weak materials to avoid a crash */ + unsigned int ref_count; + + CoglPipeline *real_source; +} VertexBufferMaterialPrivate; + +static void +unref_pipeline_priv (VertexBufferMaterialPrivate *priv) +{ + if (--priv->ref_count < 1) + g_slice_free (VertexBufferMaterialPrivate, priv); +} + +static void +weak_override_source_destroyed_cb (CoglPipeline *pipeline, + void *user_data) +{ + VertexBufferMaterialPrivate *pipeline_priv = user_data; + /* Unref the weak pipeline copy since it is no longer valid - probably because + * one of its ancestors has been changed. */ + cogl_object_unref (pipeline_priv->real_source); + pipeline_priv->real_source = NULL; + /* A reference was added when we copied the weak material so we need + to unref it here */ + unref_pipeline_priv (pipeline_priv); +} + +static CoglBool +validate_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + VertexBufferMaterialPrivate *pipeline_priv = user_data; + CoglPipeline *source = pipeline_priv->real_source; + + if (!cogl_pipeline_get_layer_point_sprite_coords_enabled (source, + layer_index)) + { + CoglPipelineWrapMode wrap_s; + CoglPipelineWrapMode wrap_t; + CoglPipelineWrapMode wrap_p; + CoglBool need_override_source = FALSE; + + /* By default COGL_PIPELINE_WRAP_MODE_AUTOMATIC becomes + * GL_CLAMP_TO_EDGE but we want GL_REPEAT to maintain + * compatibility with older versions of Cogl so we'll override + * it. We don't want to do this for point sprites because in + * that case the whole texture is drawn so you would usually + * want clamp-to-edge. + */ + wrap_s = cogl_pipeline_get_layer_wrap_mode_s (source, layer_index); + if (wrap_s == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + need_override_source = TRUE; + wrap_s = COGL_PIPELINE_WRAP_MODE_REPEAT; + } + wrap_t = cogl_pipeline_get_layer_wrap_mode_t (source, layer_index); + if (wrap_t == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + need_override_source = TRUE; + wrap_t = COGL_PIPELINE_WRAP_MODE_REPEAT; + } + wrap_p = cogl_pipeline_get_layer_wrap_mode_p (source, layer_index); + if (wrap_p == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + { + need_override_source = TRUE; + wrap_p = COGL_PIPELINE_WRAP_MODE_REPEAT; + } + + if (need_override_source) + { + if (pipeline_priv->real_source == pipeline) + { + pipeline_priv->ref_count++; + pipeline_priv->real_source = source = + _cogl_pipeline_weak_copy (pipeline, + weak_override_source_destroyed_cb, + pipeline_priv); + } + + cogl_pipeline_set_layer_wrap_mode_s (source, layer_index, wrap_s); + cogl_pipeline_set_layer_wrap_mode_t (source, layer_index, wrap_t); + cogl_pipeline_set_layer_wrap_mode_p (source, layer_index, wrap_p); + } + } + + return TRUE; +} + +static void +destroy_pipeline_priv_cb (void *user_data) +{ + unref_pipeline_priv (user_data); +} + +static void +update_primitive_and_draw (CoglVertexBuffer *buffer, + CoglVerticesMode mode, + int first, + int count, + CoglVertexBufferIndices *buffer_indices) +{ + VertexBufferMaterialPrivate *pipeline_priv; + CoglPipeline *users_source; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl_primitive_set_mode (buffer->primitive, mode); + cogl_primitive_set_first_vertex (buffer->primitive, first); + cogl_primitive_set_n_vertices (buffer->primitive, count); + + if (buffer_indices) + cogl_primitive_set_indices (buffer->primitive, buffer_indices->indices, count); + else + cogl_primitive_set_indices (buffer->primitive, NULL, count); + + cogl_vertex_buffer_submit_real (buffer); + + users_source = cogl_get_source (); + pipeline_priv = + cogl_object_get_user_data (COGL_OBJECT (users_source), + &_cogl_vertex_buffer_pipeline_priv_key); + if (G_UNLIKELY (!pipeline_priv)) + { + pipeline_priv = g_slice_new0 (VertexBufferMaterialPrivate); + pipeline_priv->ref_count = 1; + cogl_object_set_user_data (COGL_OBJECT (users_source), + &_cogl_vertex_buffer_pipeline_priv_key, + pipeline_priv, + destroy_pipeline_priv_cb); + } + + if (G_UNLIKELY (!pipeline_priv->real_source)) + { + pipeline_priv->real_source = users_source; + cogl_pipeline_foreach_layer (pipeline_priv->real_source, + validate_layer_cb, + pipeline_priv); + } + + /* XXX: although this may seem redundant, we need to do this since + * CoglVertexBuffers can be used with legacy state and its the source stack + * which track whether legacy state is enabled. + * + * (We only have a CoglDrawFlag to disable legacy state not one + * to enable it) */ + cogl_push_source (pipeline_priv->real_source); + + _cogl_primitive_draw (buffer->primitive, + cogl_get_draw_framebuffer (), + pipeline_priv->real_source, + 0 /* no draw flags */); + + cogl_pop_source (); +} + +void +cogl_vertex_buffer_draw (CoglHandle handle, + CoglVerticesMode mode, + int first, + int count) +{ + CoglVertexBuffer *buffer; + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + + update_primitive_and_draw (buffer, mode, first, count, NULL); +} + +static CoglHandle +_cogl_vertex_buffer_indices_new_real (CoglIndices *indices) +{ + CoglVertexBufferIndices *buffer_indices = + g_slice_alloc (sizeof (CoglVertexBufferIndices)); + buffer_indices->indices = indices; + + return _cogl_vertex_buffer_indices_handle_new (buffer_indices); +} + +CoglHandle +cogl_vertex_buffer_indices_new (CoglIndicesType indices_type, + const void *indices_array, + int indices_len) +{ + CoglIndices *indices; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + indices = cogl_indices_new (ctx, indices_type, indices_array, indices_len); + return _cogl_vertex_buffer_indices_new_real (indices); +} + +CoglIndicesType +cogl_vertex_buffer_indices_get_type (CoglHandle indices_handle) +{ + CoglVertexBufferIndices *buffer_indices = NULL; + + if (!cogl_is_vertex_buffer_indices (indices_handle)) + return COGL_INDICES_TYPE_UNSIGNED_SHORT; + + buffer_indices = indices_handle; + + return cogl_indices_get_type (buffer_indices->indices); +} + +void +_cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *buffer_indices) +{ + cogl_object_unref (buffer_indices->indices); + g_slice_free (CoglVertexBufferIndices, buffer_indices); +} + +void +cogl_vertex_buffer_draw_elements (CoglHandle handle, + CoglVerticesMode mode, + CoglHandle indices_handle, + int min_index, + int max_index, + int indices_offset, + int count) +{ + CoglVertexBuffer *buffer; + CoglVertexBufferIndices *buffer_indices; + + if (!cogl_is_vertex_buffer (handle)) + return; + + buffer = handle; + + if (!cogl_is_vertex_buffer_indices (indices_handle)) + return; + + buffer_indices = indices_handle; + + update_primitive_and_draw (buffer, mode, indices_offset, count, + buffer_indices); +} + +static void +_cogl_vertex_buffer_free (CoglVertexBuffer *buffer) +{ + GList *tmp; + + for (tmp = buffer->submitted_vbos; tmp != NULL; tmp = tmp->next) + cogl_vertex_buffer_vbo_free (tmp->data); + g_list_free (buffer->submitted_vbos); + + for (tmp = buffer->new_attributes; tmp != NULL; tmp = tmp->next) + _cogl_vertex_buffer_attrib_free (tmp->data); + g_list_free (buffer->new_attributes); + + if (buffer->primitive) + cogl_object_unref (buffer->primitive); + + g_slice_free (CoglVertexBuffer, buffer); +} + +CoglHandle +cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices) +{ + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + if (n_indices <= 256 / 4 * 6) + { + if (ctx->quad_buffer_indices_byte == COGL_INVALID_HANDLE) + { + /* NB: cogl_get_quad_indices takes n_quads not n_indices... */ + CoglIndices *indices = cogl_get_rectangle_indices (ctx, 256 / 4); + cogl_object_ref (indices); + ctx->quad_buffer_indices_byte = + _cogl_vertex_buffer_indices_new_real (indices); + } + + return ctx->quad_buffer_indices_byte; + } + else + { + if (ctx->quad_buffer_indices && + ctx->quad_buffer_indices_len < n_indices) + { + cogl_handle_unref (ctx->quad_buffer_indices); + ctx->quad_buffer_indices = COGL_INVALID_HANDLE; + } + + if (ctx->quad_buffer_indices == COGL_INVALID_HANDLE) + { + /* NB: cogl_get_quad_indices takes n_quads not n_indices... */ + CoglIndices *indices = + cogl_get_rectangle_indices (ctx, n_indices / 6); + cogl_object_ref (indices); + ctx->quad_buffer_indices = + _cogl_vertex_buffer_indices_new_real (indices); + } + + ctx->quad_buffer_indices_len = n_indices; + + return ctx->quad_buffer_indices; + } + + g_return_val_if_reached (NULL); +} + diff --git a/cogl/deprecated/cogl-vertex-buffer.h b/cogl/deprecated/cogl-vertex-buffer.h new file mode 100644 index 0000000..3b3a8df --- /dev/null +++ b/cogl/deprecated/cogl-vertex-buffer.h @@ -0,0 +1,451 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_VERTEX_BUFFER_H__ +#define __COGL_VERTEX_BUFFER_H__ + +#include +#include +#include +#include + +COGL_BEGIN_DECLS + +/** + * SECTION:cogl-vertex-buffer + * @short_description: An API for submitting extensible arrays of vertex + * attributes to be mapped into the GPU for fast drawing. + * + * For example to describe a textured triangle, you could create a new cogl + * vertex buffer with 3 vertices, and then you might add 2 attributes for each + * vertex: + * + * + * a "gl_Position" describing the (x,y,z) position for each vertex. + * + * + * a "gl_MultiTexCoord0" describing the (tx,ty) texture coordinates for each + * vertex. + * + * + * + * The Vertex Buffer API is designed to be a fairly raw mechanism for + * developers to be able to submit geometry to Cogl in a format that can be + * directly consumed by an OpenGL driver and mapped into your GPU for fast + * re-use. It is designed to avoid repeated validation of the attributes by the + * driver; to minimize transport costs (e.g. considering indirect GLX + * use-cases) and to potentially avoid repeated format conversions when + * attributes are supplied in a format that is not natively supported by the + * GPU. + * + * Although this API does allow you to modify attributes after they have been + * submitted to the GPU you should be aware that modification is not that + * cheap, since it implies validating the new data and potentially the + * OpenGL driver will need to reformat it for the GPU. + * + * If at all possible think of tricks that let you re-use static attributes, + * and if you do need to repeatedly update attributes (e.g. for some kind of + * morphing geometry) then only update and re-submit the specific attributes + * that have changed. + */ + +/** + * cogl_vertex_buffer_new: + * @n_vertices: The number of vertices that your attributes will correspond to. + * + * Creates a new vertex buffer that you can use to add attributes. + * + * Return value: a new #CoglHandle + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglHandle +cogl_vertex_buffer_new (unsigned int n_vertices); + +/** + * cogl_vertex_buffer_get_n_vertices: + * @handle: A vertex buffer handle + * + * Retrieves the number of vertices that @handle represents + * + * Return value: the number of vertices + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +unsigned int +cogl_vertex_buffer_get_n_vertices (CoglHandle handle); + +/** + * cogl_vertex_buffer_add: + * @handle: A vertex buffer handle + * @attribute_name: The name of your attribute. It should be a valid GLSL + * variable name and standard attribute types must use one of following + * built-in names: (Note: they correspond to the built-in names of GLSL) + * + * "gl_Color" + * "gl_Normal" + * "gl_MultiTexCoord0, gl_MultiTexCoord1, ..." + * "gl_Vertex" + * + * To support adding multiple variations of the same attribute the name + * can have a detail component, E.g. "gl_Color::active" or + * "gl_Color::inactive" + * @n_components: The number of components per attribute and must be 1, 2, + * 3 or 4 + * @type: a #CoglAttributeType specifying the data type of each component. + * @normalized: If %TRUE, this specifies that values stored in an integer + * format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0] + * for unsigned values. If %FALSE they are converted to floats + * directly. + * @stride: This specifies the number of bytes from the start of one attribute + * value to the start of the next value (for the same attribute). So, for + * example, with a position interleved with color like this: + * XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the + * stride for both attributes is 6. The special value 0 means the + * values are stored sequentially in memory. + * @pointer: This addresses the first attribute in the vertex array. This + * must remain valid until you either call cogl_vertex_buffer_submit() or + * issue a draw call. + * + * Adds an attribute to a buffer, or replaces a previously added + * attribute with the same name. + * + * You either can use one of the built-in names such as "gl_Vertex", or + * "gl_MultiTexCoord0" to add standard attributes, like positions, colors + * and normals, or you can add custom attributes for use in shaders. + * + * The number of vertices declared when calling cogl_vertex_buffer_new() + * determines how many attribute values will be read from the supplied + * @pointer. + * + * The data for your attribute isn't copied anywhere until you call + * cogl_vertex_buffer_submit(), or issue a draw call which automatically + * submits pending attribute changes. so the supplied pointer must remain + * valid until then. If you are updating an existing attribute (done by + * re-adding it) then you still need to re-call cogl_vertex_buffer_submit() + * to commit the changes to the GPU. Be carefull to minimize the number + * of calls to cogl_vertex_buffer_submit(), though. + * + * If you are interleving attributes it is assumed that each interleaved + * attribute starts no farther than +- stride bytes from the other attributes + * it is interleved with. I.e. this is ok: + * + * |-0-0-0-0-0-0-0-0-0-0| + * + * This is not ok: + * + * |- - - - -0-0-0-0-0-0 0 0 0 0| + * + * (Though you can have multiple groups of interleved attributes) + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_add (CoglHandle handle, + const char *attribute_name, + uint8_t n_components, + CoglAttributeType type, + CoglBool normalized, + uint16_t stride, + const void *pointer); + +/** + * cogl_vertex_buffer_delete: + * @handle: A vertex buffer handle + * @attribute_name: The name of a previously added attribute + * + * Deletes an attribute from a buffer. You will need to call + * cogl_vertex_buffer_submit() or issue a draw call to commit this + * change to the GPU. + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_delete (CoglHandle handle, + const char *attribute_name); + +/** + * cogl_vertex_buffer_submit: + * @handle: A vertex buffer handle + * + * Submits all the user added attributes to the GPU; once submitted, the + * attributes can be used for drawing. + * + * You should aim to minimize calls to this function since it implies + * validating your data; it potentially incurs a transport cost (especially if + * you are using GLX indirect rendering) and potentially a format conversion + * cost if the GPU doesn't natively support any of the given attribute formats. + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_submit (CoglHandle handle); + +/** + * cogl_vertex_buffer_disable: + * @handle: A vertex buffer handle + * @attribute_name: The name of the attribute you want to disable + * + * Disables a previosuly added attribute. + * + * Since it can be costly to add and remove new attributes to buffers; to make + * individual buffers more reuseable it is possible to enable and disable + * attributes before using a buffer for drawing. + * + * You don't need to call cogl_vertex_buffer_submit() after using this + * function. + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_disable (CoglHandle handle, + const char *attribute_name); + +/** + * cogl_vertex_buffer_enable: + * @handle: A vertex buffer handle + * @attribute_name: The name of the attribute you want to enable + * + * Enables a previosuly disabled attribute. + * + * Since it can be costly to add and remove new attributes to buffers; to make + * individual buffers more reuseable it is possible to enable and disable + * attributes before using a buffer for drawing. + * + * You don't need to call cogl_vertex_buffer_submit() after using this function + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_enable (CoglHandle handle, + const char *attribute_name); + +/** + * cogl_vertex_buffer_draw: + * @handle: A vertex buffer handle + * @mode: A #CoglVerticesMode specifying how the vertices should be + * interpreted. + * @first: Specifies the index of the first vertex you want to draw with + * @count: Specifies the number of vertices you want to draw. + * + * Allows you to draw geometry using all or a subset of the + * vertices in a vertex buffer. + * + * Any un-submitted attribute changes are automatically submitted before + * drawing. + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_draw (CoglHandle handle, + CoglVerticesMode mode, + int first, + int count); + +/** + * cogl_vertex_buffer_indices_new: + * @indices_type: a #CoglIndicesType specifying the data type used for + * the indices. + * @indices_array: (array length=indices_len): Specifies the address of + * your array of indices + * @indices_len: The number of indices in indices_array + * + * Depending on how much geometry you are submitting it can be worthwhile + * optimizing the number of redundant vertices you submit. Using an index + * array allows you to reference vertices multiple times, for example + * during triangle strips. + * + * Return value: A CoglHandle for the indices which you can pass to + * cogl_vertex_buffer_draw_elements(). + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglHandle +cogl_vertex_buffer_indices_new (CoglIndicesType indices_type, + const void *indices_array, + int indices_len); + +/** + * cogl_vertex_buffer_indices_get_type: + * @indices: An indices handle + * + * Queries back the data type used for the given indices + * + * Returns: The CoglIndicesType used + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglIndicesType +cogl_vertex_buffer_indices_get_type (CoglHandle indices); + +/** + * cogl_vertex_buffer_draw_elements: + * @handle: A vertex buffer handle + * @mode: A #CoglVerticesMode specifying how the vertices should be + * interpreted. + * @indices: A CoglHandle for a set of indices allocated via + * cogl_vertex_buffer_indices_new () + * @min_index: Specifies the minimum vertex index contained in indices + * @max_index: Specifies the maximum vertex index contained in indices + * @indices_offset: An offset into named indices. The offset marks the first + * index to use for drawing. + * @count: Specifies the number of vertices you want to draw. + * + * This function lets you use an array of indices to specify the vertices + * within your vertex buffer that you want to draw. The indices themselves + * are created by calling cogl_vertex_buffer_indices_new () + * + * Any un-submitted attribute changes are automatically submitted before + * drawing. + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +void +cogl_vertex_buffer_draw_elements (CoglHandle handle, + CoglVerticesMode mode, + CoglHandle indices, + int min_index, + int max_index, + int indices_offset, + int count); + +/** + * cogl_vertex_buffer_ref: + * @handle: a @CoglHandle. + * + * Increment the reference count for a vertex buffer + * + * Return value: the @handle. + * + * Deprecated: 1.2: Use cogl_object_ref() instead + */ +COGL_DEPRECATED_FOR (cogl_object_ref) +CoglHandle +cogl_vertex_buffer_ref (CoglHandle handle); + +/** + * cogl_vertex_buffer_unref: + * @handle: a @CoglHandle. + * + * Decrement the reference count for a vertex buffer + * + * Deprecated: 1.2: Use cogl_object_unref() instead + */ +COGL_DEPRECATED_FOR (cogl_object_unref) +void +cogl_vertex_buffer_unref (CoglHandle handle); + +/** + * cogl_vertex_buffer_indices_get_for_quads: + * @n_indices: the number of indices in the vertex buffer. + * + * Creates a vertex buffer containing the indices needed to draw pairs + * of triangles from a list of vertices grouped as quads. There will + * be at least @n_indices entries in the buffer (but there may be + * more). + * + * The indices will follow this pattern: + * + * 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc + * + * For example, if you submit vertices for a quad like like that shown + * in then you can request 6 + * indices to render two triangles like those shown in . + * + *
+ * Example of vertices submitted to form a quad + * + *
+ * + *
+ * Illustration of the triangle indices that will be generated + * + *
+ * + * Returns: A %CoglHandle containing the indices. The handled is + * owned by Cogl and should not be modified or unref'd. + * + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglHandle +cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices); + +/** + * cogl_is_vertex_buffer: + * @handle: a #CoglHandle for a vertex buffer object + * + * Checks whether @handle is a Vertex Buffer Object + * + * Return value: %TRUE if the handle is a VBO, and %FALSE + * otherwise + * + * Since: 1.0 + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglBool +cogl_is_vertex_buffer (CoglHandle handle); + +/** + * cogl_is_vertex_buffer_indices: + * @handle: a #CoglHandle + * + * Checks whether @handle is a handle to the indices for a vertex + * buffer object + * + * Return value: %TRUE if the handle is indices, and %FALSE + * otherwise + * + * Since: 1.4 + * Deprecated: 1.16: Use the #CoglPrimitive api instead + */ +COGL_DEPRECATED_IN_1_16_FOR (cogl_primitive_API) +CoglBool +cogl_is_vertex_buffer_indices (CoglHandle handle); +COGL_END_DECLS + +#endif /* __COGL_VERTEX_BUFFER_H__ */ diff --git a/cogl/driver/gl/cogl-attribute-gl-private.h b/cogl/driver/gl/cogl-attribute-gl-private.h new file mode 100644 index 0000000..efb3c0e --- /dev/null +++ b/cogl/driver/gl/cogl-attribute-gl-private.h @@ -0,0 +1,53 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_ATTRIBUTE_GL_PRIVATE_H_ +#define _COGL_ATTRIBUTE_GL_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-framebuffer.h" +#include "cogl-attribute.h" +#include "cogl-attribute-private.h" + +void +_cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglFlushLayerState *layers_state, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes); + +void +_cogl_gl_disable_all_attributes (CoglContext *ctx); + +#endif /* _COGL_ATTRIBUTE_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-attribute-gl.c b/cogl/driver/gl/cogl-attribute-gl.c new file mode 100644 index 0000000..b23b0ab --- /dev/null +++ b/cogl/driver/gl/cogl-attribute-gl.c @@ -0,0 +1,539 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-error-private.h" +#include "cogl-context-private.h" +#include "cogl-attribute.h" +#include "cogl-attribute-private.h" +#include "cogl-attribute-gl-private.h" +#include "cogl-pipeline-progend-glsl-private.h" +#include "cogl-buffer-gl-private.h" + +typedef struct _ForeachChangedBitState +{ + CoglContext *context; + const CoglBitmask *new_bits; + CoglPipeline *pipeline; +} ForeachChangedBitState; + +static CoglBool +toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + CoglContext *context = state->context; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature + (context, COGL_PRIVATE_FEATURE_GL_FIXED), + FALSE); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + CoglBool enabled = _cogl_bitmask_get (state->new_bits, bit_num); + GLenum cap; + + switch (bit_num) + { + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: + cap = GL_COLOR_ARRAY; + break; + case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY: + cap = GL_VERTEX_ARRAY; + break; + case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY: + cap = GL_NORMAL_ARRAY; + break; + } + if (enabled) + GE (context, glEnableClientState (cap)); + else + GE (context, glDisableClientState (cap)); + } +#endif + + return TRUE; +} + +static CoglBool +toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + CoglContext *context = state->context; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature + (context, COGL_PRIVATE_FEATURE_GL_FIXED), + FALSE); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + CoglBool enabled = _cogl_bitmask_get (state->new_bits, bit_num); + + GE( context, glClientActiveTexture (GL_TEXTURE0 + bit_num) ); + + if (enabled) + GE( context, glEnableClientState (GL_TEXTURE_COORD_ARRAY) ); + else + GE( context, glDisableClientState (GL_TEXTURE_COORD_ARRAY) ); + } +#endif + + return TRUE; +} + +static CoglBool +toggle_custom_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + CoglBool enabled = _cogl_bitmask_get (state->new_bits, bit_num); + CoglContext *context = state->context; + + if (enabled) + GE( context, glEnableVertexAttribArray (bit_num) ); + else + GE( context, glDisableVertexAttribArray (bit_num) ); + + return TRUE; +} + +static void +foreach_changed_bit_and_save (CoglContext *context, + CoglBitmask *current_bits, + const CoglBitmask *new_bits, + CoglBitmaskForeachFunc callback, + ForeachChangedBitState *state) +{ + /* Get the list of bits that are different */ + _cogl_bitmask_clear_all (&context->changed_bits_tmp); + _cogl_bitmask_set_bits (&context->changed_bits_tmp, current_bits); + _cogl_bitmask_xor_bits (&context->changed_bits_tmp, new_bits); + + /* Iterate over each bit to change */ + state->new_bits = new_bits; + _cogl_bitmask_foreach (&context->changed_bits_tmp, + callback, + state); + + /* Store the new values */ + _cogl_bitmask_clear_all (current_bits); + _cogl_bitmask_set_bits (current_bits, new_bits); +} + +#ifdef COGL_PIPELINE_PROGEND_GLSL + +static void +setup_generic_buffered_attribute (CoglContext *context, + CoglPipeline *pipeline, + CoglAttribute *attribute, + uint8_t *base) +{ + int name_index = attribute->name_state->name_index; + int attrib_location = + _cogl_pipeline_progend_glsl_get_attrib_location (pipeline, name_index); + + if (attrib_location == -1) + return; + + GE( context, glVertexAttribPointer (attrib_location, + attribute->d.buffered.n_components, + attribute->d.buffered.type, + attribute->normalized, + attribute->d.buffered.stride, + base + attribute->d.buffered.offset) ); + _cogl_bitmask_set (&context->enable_custom_attributes_tmp, + attrib_location, TRUE); +} + +static void +setup_generic_const_attribute (CoglContext *context, + CoglPipeline *pipeline, + CoglAttribute *attribute) +{ + int name_index = attribute->name_state->name_index; + int attrib_location = + _cogl_pipeline_progend_glsl_get_attrib_location (pipeline, name_index); + int columns; + int i; + + if (attrib_location == -1) + return; + + if (attribute->d.constant.boxed.type == COGL_BOXED_MATRIX) + columns = attribute->d.constant.boxed.size; + else + columns = 1; + + /* Note: it's ok to access a COGL_BOXED_FLOAT as a matrix with only + * one column... */ + + switch (attribute->d.constant.boxed.size) + { + case 1: + GE( context, glVertexAttrib1fv (attrib_location, + attribute->d.constant.boxed.v.matrix)); + break; + case 2: + for (i = 0; i < columns; i++) + GE( context, glVertexAttrib2fv (attrib_location + i, + attribute->d.constant.boxed.v.matrix)); + break; + case 3: + for (i = 0; i < columns; i++) + GE( context, glVertexAttrib3fv (attrib_location + i, + attribute->d.constant.boxed.v.matrix)); + break; + case 4: + for (i = 0; i < columns; i++) + GE( context, glVertexAttrib4fv (attrib_location + i, + attribute->d.constant.boxed.v.matrix)); + break; + default: + g_warn_if_reached (); + } +} + +#endif /* COGL_PIPELINE_PROGEND_GLSL */ + +static void +setup_legacy_buffered_attribute (CoglContext *ctx, + CoglPipeline *pipeline, + CoglAttribute *attribute, + uint8_t *base) +{ + switch (attribute->name_state->name_id) + { + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY, TRUE); + GE (ctx, glColorPointer (attribute->d.buffered.n_components, + attribute->d.buffered.type, + attribute->d.buffered.stride, + base + attribute->d.buffered.offset)); + break; + case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY: + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY, TRUE); + GE (ctx, glNormalPointer (attribute->d.buffered.type, + attribute->d.buffered.stride, + base + attribute->d.buffered.offset)); + break; + case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY: + { + int layer_number = attribute->name_state->layer_number; + const CoglPipelineGetLayerFlags flags = + COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *layer = + _cogl_pipeline_get_layer_with_flags (pipeline, layer_number, flags); + + if (layer) + { + int unit = _cogl_pipeline_layer_get_unit_index (layer); + + _cogl_bitmask_set (&ctx->enable_texcoord_attributes_tmp, + unit, + TRUE); + + GE (ctx, glClientActiveTexture (GL_TEXTURE0 + unit)); + GE (ctx, glTexCoordPointer (attribute->d.buffered.n_components, + attribute->d.buffered.type, + attribute->d.buffered.stride, + base + attribute->d.buffered.offset)); + } + break; + } + case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY: + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY, TRUE); + GE (ctx, glVertexPointer (attribute->d.buffered.n_components, + attribute->d.buffered.type, + attribute->d.buffered.stride, + base + attribute->d.buffered.offset)); + break; + case COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY: +#ifdef COGL_PIPELINE_PROGEND_GLSL + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE)) + setup_generic_buffered_attribute (ctx, pipeline, attribute, base); +#endif + break; + default: + g_warn_if_reached (); + } +} + +static void +setup_legacy_const_attribute (CoglContext *ctx, + CoglPipeline *pipeline, + CoglAttribute *attribute) +{ +#ifdef COGL_PIPELINE_PROGEND_GLSL + if (attribute->name_state->name_id == COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY) + { + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE)) + setup_generic_const_attribute (ctx, pipeline, attribute); + } + else +#endif + { + float vector[4] = { 0, 0, 0, 1 }; + float *boxed = attribute->d.constant.boxed.v.float_value; + int n_components = attribute->d.constant.boxed.size; + int i; + + for (i = 0; i < n_components; i++) + vector[i] = boxed[i]; + + switch (attribute->name_state->name_id) + { + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: + GE (ctx, glColor4f (vector[0], vector[1], vector[2], vector[3])); + break; + case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY: + GE (ctx, glNormal3f (vector[0], vector[1], vector[2])); + break; + case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY: + { + int layer_number = attribute->name_state->layer_number; + const CoglPipelineGetLayerFlags flags = + COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *layer = + _cogl_pipeline_get_layer_with_flags (pipeline, + layer_number, + flags); + + if (layer) + { + int unit = _cogl_pipeline_layer_get_unit_index (layer); + + GE (ctx, glClientActiveTexture (GL_TEXTURE0 + unit)); + + GE (ctx, glMultiTexCoord4f (vector[0], + vector[1], + vector[2], + vector[3])); + } + break; + } + case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY: + GE (ctx, glVertex4f (vector[0], vector[1], vector[2], vector[3])); + break; + default: + g_warn_if_reached (); + } + } +} + +static void +apply_attribute_enable_updates (CoglContext *context, + CoglPipeline *pipeline) +{ + ForeachChangedBitState changed_bits_state; + + changed_bits_state.context = context; + changed_bits_state.new_bits = &context->enable_builtin_attributes_tmp; + changed_bits_state.pipeline = pipeline; + + foreach_changed_bit_and_save (context, + &context->enabled_builtin_attributes, + &context->enable_builtin_attributes_tmp, + toggle_builtin_attribute_enabled_cb, + &changed_bits_state); + + changed_bits_state.new_bits = &context->enable_texcoord_attributes_tmp; + foreach_changed_bit_and_save (context, + &context->enabled_texcoord_attributes, + &context->enable_texcoord_attributes_tmp, + toggle_texcood_attribute_enabled_cb, + &changed_bits_state); + + changed_bits_state.new_bits = &context->enable_custom_attributes_tmp; + foreach_changed_bit_and_save (context, + &context->enabled_custom_attributes, + &context->enable_custom_attributes_tmp, + toggle_custom_attribute_enabled_cb, + &changed_bits_state); +} + +void +_cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglFlushLayerState *layers_state, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes) +{ + CoglContext *ctx = framebuffer->context; + int i; + CoglBool with_color_attrib = FALSE; + CoglBool unknown_color_alpha = FALSE; + CoglPipeline *copy = NULL; + + /* Iterate the attributes to see if we have a color attribute which + * may affect our decision to enable blending or not. + * + * We need to do this before flushing the pipeline. */ + for (i = 0; i < n_attributes; i++) + switch (attributes[i]->name_state->name_id) + { + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: + if ((flags & COGL_DRAW_COLOR_ATTRIBUTE_IS_OPAQUE) == 0 && + _cogl_attribute_get_n_components (attributes[i]) == 4) + unknown_color_alpha = TRUE; + with_color_attrib = TRUE; + break; + + default: + break; + } + + if (G_UNLIKELY (layers_state->options.flags)) + { + /* If we haven't already created a derived pipeline... */ + if (!copy) + { + copy = cogl_pipeline_copy (pipeline); + pipeline = copy; + } + _cogl_pipeline_apply_overrides (pipeline, &layers_state->options); + + /* TODO: + * overrides = cogl_pipeline_get_data (pipeline, + * last_overrides_key); + * if (overrides) + * { + * age = cogl_pipeline_get_age (pipeline); + * XXX: actually we also need to check for legacy_state + * and blending overrides for use of glColorPointer... + * if (overrides->ags != age || + * memcmp (&overrides->options, &options, + * sizeof (options) != 0) + * { + * cogl_object_unref (overrides->weak_pipeline); + * g_slice_free (Overrides, overrides); + * overrides = NULL; + * } + * } + * if (!overrides) + * { + * overrides = g_slice_new (Overrides); + * overrides->weak_pipeline = + * cogl_pipeline_weak_copy (pipeline); + * _cogl_pipeline_apply_overrides (overrides->weak_pipeline, + * &options); + * + * cogl_pipeline_set_data (pipeline, last_overrides_key, + * weak_overrides, + * free_overrides_cb, + * NULL); + * } + * pipeline = overrides->weak_pipeline; + */ + } + + _cogl_pipeline_flush_gl_state (ctx, + pipeline, + framebuffer, + with_color_attrib, + unknown_color_alpha); + + _cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp); + _cogl_bitmask_clear_all (&ctx->enable_texcoord_attributes_tmp); + _cogl_bitmask_clear_all (&ctx->enable_custom_attributes_tmp); + + /* Bind the attribute pointers. We need to do this after the + * pipeline is flushed because when using GLSL that is the only + * point when we can determine the attribute locations */ + + for (i = 0; i < n_attributes; i++) + { + CoglAttribute *attribute = attributes[i]; + CoglAttributeBuffer *attribute_buffer; + CoglBuffer *buffer; + uint8_t *base; + + if (attribute->is_buffered) + { + attribute_buffer = cogl_attribute_get_buffer (attribute); + buffer = COGL_BUFFER (attribute_buffer); + + /* Note: we don't try and catch errors with binding buffers + * here since OOM errors at this point indicate that nothing + * has yet been uploaded to attribute buffer which we + * consider to be a programmer error. + */ + base = + _cogl_buffer_gl_bind (buffer, + COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER, + NULL); + + if (pipeline->progend == COGL_PIPELINE_PROGEND_GLSL) + setup_generic_buffered_attribute (ctx, pipeline, attribute, base); + else + setup_legacy_buffered_attribute (ctx, pipeline, attribute, base); + + _cogl_buffer_gl_unbind (buffer); + } + else + { + if (pipeline->progend == COGL_PIPELINE_PROGEND_GLSL) + setup_generic_const_attribute (ctx, pipeline, attribute); + else + setup_legacy_const_attribute (ctx, pipeline, attribute); + } + } + + apply_attribute_enable_updates (ctx, pipeline); + + if (copy) + cogl_object_unref (copy); +} + +void +_cogl_gl_disable_all_attributes (CoglContext *ctx) +{ + _cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp); + _cogl_bitmask_clear_all (&ctx->enable_texcoord_attributes_tmp); + _cogl_bitmask_clear_all (&ctx->enable_custom_attributes_tmp); + + /* XXX: we can pass a NULL source pipeline here because we know a + * source pipeline only needs to be referenced when enabling + * attributes. */ + apply_attribute_enable_updates (ctx, NULL); +} diff --git a/cogl/driver/gl/cogl-buffer-gl-private.h b/cogl/driver/gl/cogl-buffer-gl-private.h new file mode 100644 index 0000000..b8f0435 --- /dev/null +++ b/cogl/driver/gl/cogl-buffer-gl-private.h @@ -0,0 +1,74 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_BUFFER_GL_PRIVATE_H_ +#define _COGL_BUFFER_GL_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context.h" +#include "cogl-buffer.h" +#include "cogl-buffer-private.h" + +void +_cogl_buffer_gl_create (CoglBuffer *buffer); + +void +_cogl_buffer_gl_destroy (CoglBuffer *buffer); + +void * +_cogl_buffer_gl_map_range (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error); + +void +_cogl_buffer_gl_unmap (CoglBuffer *buffer); + +CoglBool +_cogl_buffer_gl_set_data (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size, + CoglError **error); + +void * +_cogl_buffer_gl_bind (CoglBuffer *buffer, + CoglBufferBindTarget target, + CoglError **error); + +void +_cogl_buffer_gl_unbind (CoglBuffer *buffer); + +#endif /* _COGL_BUFFER_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-buffer-gl.c b/cogl/driver/gl/cogl-buffer-gl.c new file mode 100644 index 0000000..0f98406 --- /dev/null +++ b/cogl/driver/gl/cogl-buffer-gl.c @@ -0,0 +1,442 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011,2012,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-buffer-gl-private.h" +#include "cogl-error-private.h" +#include "cogl-util-gl-private.h" + +/* + * GL/GLES compatibility defines for the buffer API: + */ + +#ifndef GL_PIXEL_PACK_BUFFER +#define GL_PIXEL_PACK_BUFFER 0x88EB +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#endif +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8893 +#endif +#ifndef GL_READ_ONLY +#define GL_READ_ONLY 0x88B8 +#endif +#ifndef GL_WRITE_ONLY +#define GL_WRITE_ONLY 0x88B9 +#endif +#ifndef GL_READ_WRITE +#define GL_READ_WRITE 0x88BA +#endif +#ifndef GL_MAP_READ_BIT +#define GL_MAP_READ_BIT 0x0001 +#endif +#ifndef GL_MAP_WRITE_BIT +#define GL_MAP_WRITE_BIT 0x0002 +#endif +#ifndef GL_MAP_INVALIDATE_RANGE_BIT +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#endif +#ifndef GL_MAP_INVALIDATE_BUFFER_BIT +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#endif + +void +_cogl_buffer_gl_create (CoglBuffer *buffer) +{ + CoglContext *ctx = buffer->context; + + GE (ctx, glGenBuffers (1, &buffer->gl_handle)); +} + +void +_cogl_buffer_gl_destroy (CoglBuffer *buffer) +{ + GE( buffer->context, glDeleteBuffers (1, &buffer->gl_handle) ); +} + +static GLenum +update_hints_to_gl_enum (CoglBuffer *buffer) +{ + /* usage hint is always DRAW for now */ + switch (buffer->update_hint) + { + case COGL_BUFFER_UPDATE_HINT_STATIC: + return GL_STATIC_DRAW; + case COGL_BUFFER_UPDATE_HINT_DYNAMIC: + return GL_DYNAMIC_DRAW; + + case COGL_BUFFER_UPDATE_HINT_STREAM: + /* OpenGL ES 1.1 only knows about STATIC_DRAW and DYNAMIC_DRAW */ +#if defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2) + if (buffer->context->driver != COGL_DRIVER_GLES1) + return GL_STREAM_DRAW; +#else + return GL_DYNAMIC_DRAW; +#endif + } + + g_assert_not_reached (); +} + +static GLenum +convert_bind_target_to_gl_target (CoglBufferBindTarget target) +{ + switch (target) + { + case COGL_BUFFER_BIND_TARGET_PIXEL_PACK: + return GL_PIXEL_PACK_BUFFER; + case COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK: + return GL_PIXEL_UNPACK_BUFFER; + case COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER: + return GL_ARRAY_BUFFER; + case COGL_BUFFER_BIND_TARGET_INDEX_BUFFER: + return GL_ELEMENT_ARRAY_BUFFER; + default: + g_return_val_if_reached (COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK); + } +} + +static CoglBool +recreate_store (CoglBuffer *buffer, + CoglError **error) +{ + CoglContext *ctx = buffer->context; + GLenum gl_target; + GLenum gl_enum; + GLenum gl_error; + + /* This assumes the buffer is already bound */ + + gl_target = convert_bind_target_to_gl_target (buffer->last_target); + gl_enum = update_hints_to_gl_enum (buffer); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glBufferData (gl_target, + buffer->size, + NULL, + gl_enum); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + return FALSE; + + buffer->store_created = TRUE; + return TRUE; +} + +GLenum +_cogl_buffer_access_to_gl_enum (CoglBufferAccess access) +{ + if ((access & COGL_BUFFER_ACCESS_READ_WRITE) == COGL_BUFFER_ACCESS_READ_WRITE) + return GL_READ_WRITE; + else if (access & COGL_BUFFER_ACCESS_WRITE) + return GL_WRITE_ONLY; + else + return GL_READ_ONLY; +} + +static void * +_cogl_buffer_bind_no_create (CoglBuffer *buffer, + CoglBufferBindTarget target) +{ + CoglContext *ctx = buffer->context; + + _COGL_RETURN_VAL_IF_FAIL (buffer != NULL, NULL); + + /* Don't allow binding the buffer to multiple targets at the same time */ + _COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[buffer->last_target] != buffer, + NULL); + + /* Don't allow nesting binds to the same target */ + _COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[target] == NULL, NULL); + + buffer->last_target = target; + ctx->current_buffer[target] = buffer; + + if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) + { + GLenum gl_target = convert_bind_target_to_gl_target (buffer->last_target); + GE( ctx, glBindBuffer (gl_target, buffer->gl_handle) ); + return NULL; + } + else + return buffer->data; +} + +void * +_cogl_buffer_gl_map_range (CoglBuffer *buffer, + size_t offset, + size_t size, + CoglBufferAccess access, + CoglBufferMapHint hints, + CoglError **error) +{ + uint8_t *data; + CoglBufferBindTarget target; + GLenum gl_target; + CoglContext *ctx = buffer->context; + GLenum gl_error; + + if (((access & COGL_BUFFER_ACCESS_READ) && + !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_READ)) || + ((access & COGL_BUFFER_ACCESS_WRITE) && + !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Tried to map a buffer with unsupported access mode"); + return NULL; + } + + target = buffer->last_target; + _cogl_buffer_bind_no_create (buffer, target); + + gl_target = convert_bind_target_to_gl_target (target); + + if ((hints & COGL_BUFFER_MAP_HINT_DISCARD_RANGE) && + offset == 0 && size >= buffer->size) + hints |= COGL_BUFFER_MAP_HINT_DISCARD; + + /* If the map buffer range extension is supported then we will + * always use it even if we are mapping the full range because the + * normal mapping function doesn't support passing the discard + * hints */ + if (ctx->glMapBufferRange) + { + GLbitfield gl_access = 0; + CoglBool should_recreate_store = !buffer->store_created; + + if ((access & COGL_BUFFER_ACCESS_READ)) + gl_access |= GL_MAP_READ_BIT; + if ((access & COGL_BUFFER_ACCESS_WRITE)) + gl_access |= GL_MAP_WRITE_BIT; + + if ((hints & COGL_BUFFER_MAP_HINT_DISCARD)) + { + /* glMapBufferRange generates an error if you pass the + * discard hint along with asking for read access. However + * it can make sense to ask for both if write access is also + * requested so that the application can immediately read + * back what it just wrote. To work around the restriction + * in GL we just recreate the buffer storage in that case + * which is an alternative way to indicate that the buffer + * contents can be discarded. */ + if ((access & COGL_BUFFER_ACCESS_READ)) + should_recreate_store = TRUE; + else + gl_access |= GL_MAP_INVALIDATE_BUFFER_BIT; + } + else if ((hints & COGL_BUFFER_MAP_HINT_DISCARD_RANGE) && + !(access & COGL_BUFFER_ACCESS_READ)) + gl_access |= GL_MAP_INVALIDATE_RANGE_BIT; + + if (should_recreate_store) + { + if (!recreate_store (buffer, error)) + { + _cogl_buffer_gl_unbind (buffer); + return NULL; + } + } + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + data = ctx->glMapBufferRange (gl_target, + offset, + size, + gl_access); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + _cogl_buffer_gl_unbind (buffer); + return NULL; + } + + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + } + else + { + /* create an empty store if we don't have one yet. creating the store + * lazily allows the user of the CoglBuffer to set a hint before the + * store is created. */ + if (!buffer->store_created || + (hints & COGL_BUFFER_MAP_HINT_DISCARD)) + { + if (!recreate_store (buffer, error)) + { + _cogl_buffer_gl_unbind (buffer); + return NULL; + } + } + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + data = ctx->glMapBuffer (gl_target, + _cogl_buffer_access_to_gl_enum (access)); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + _cogl_buffer_gl_unbind (buffer); + return NULL; + } + + _COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); + + data += offset; + } + + if (data) + buffer->flags |= COGL_BUFFER_FLAG_MAPPED; + + _cogl_buffer_gl_unbind (buffer); + + return data; +} + +void +_cogl_buffer_gl_unmap (CoglBuffer *buffer) +{ + CoglContext *ctx = buffer->context; + + _cogl_buffer_bind_no_create (buffer, buffer->last_target); + + GE( ctx, glUnmapBuffer (convert_bind_target_to_gl_target + (buffer->last_target)) ); + buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED; + + _cogl_buffer_gl_unbind (buffer); +} + +CoglBool +_cogl_buffer_gl_set_data (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size, + CoglError **error) +{ + CoglBufferBindTarget target; + GLenum gl_target; + CoglContext *ctx = buffer->context; + GLenum gl_error; + CoglBool status = TRUE; + CoglError *internal_error = NULL; + + target = buffer->last_target; + + _cogl_buffer_gl_bind (buffer, target, &internal_error); + + /* NB: _cogl_buffer_gl_bind() may return NULL in non-error + * conditions so we have to explicity check internal_error + * to see if an exception was thrown. + */ + if (internal_error) + { + _cogl_propagate_error (error, internal_error); + return FALSE; + } + + gl_target = convert_bind_target_to_gl_target (target); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glBufferSubData (gl_target, offset, size, data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_buffer_gl_unbind (buffer); + + return status; +} + +void * +_cogl_buffer_gl_bind (CoglBuffer *buffer, + CoglBufferBindTarget target, + CoglError **error) +{ + void *ret; + + ret = _cogl_buffer_bind_no_create (buffer, target); + + /* create an empty store if we don't have one yet. creating the store + * lazily allows the user of the CoglBuffer to set a hint before the + * store is created. */ + if ((buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) && + !buffer->store_created) + { + if (!recreate_store (buffer, error)) + { + _cogl_buffer_gl_unbind (buffer); + return NULL; + } + } + + return ret; +} + +void +_cogl_buffer_gl_unbind (CoglBuffer *buffer) +{ + CoglContext *ctx = buffer->context; + + _COGL_RETURN_IF_FAIL (buffer != NULL); + + /* the unbind should pair up with a previous bind */ + _COGL_RETURN_IF_FAIL (ctx->current_buffer[buffer->last_target] == buffer); + + if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) + { + GLenum gl_target = convert_bind_target_to_gl_target (buffer->last_target); + GE( ctx, glBindBuffer (gl_target, 0) ); + } + + ctx->current_buffer[buffer->last_target] = NULL; +} diff --git a/cogl/driver/gl/cogl-clip-stack-gl-private.h b/cogl/driver/gl/cogl-clip-stack-gl-private.h new file mode 100644 index 0000000..ff22d26 --- /dev/null +++ b/cogl/driver/gl/cogl-clip-stack-gl-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_CLIP_STACK_GL_PRIVATE_H_ +#define _COGL_CLIP_STACK_GL_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-framebuffer.h" +#include "cogl-clip-stack.h" + +void +_cogl_clip_stack_gl_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer); + +#endif /* _COGL_CLIP_STACK_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/driver/gl/cogl-clip-stack-gl.c new file mode 100644 index 0000000..ea1ae62 --- /dev/null +++ b/cogl/driver/gl/cogl-clip-stack-gl.c @@ -0,0 +1,627 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010,2011,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-primitives-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-clip-stack-gl-private.h" +#include "cogl-primitive-private.h" + +#ifndef GL_CLIP_PLANE0 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#endif + +static void +project_vertex (const CoglMatrix *modelview_projection, + float *vertex) +{ + int i; + + cogl_matrix_transform_point (modelview_projection, + &vertex[0], &vertex[1], + &vertex[2], &vertex[3]); + + /* Convert from homogenized coordinates */ + for (i = 0; i < 4; i++) + vertex[i] /= vertex[3]; +} + +static void +set_clip_plane (CoglFramebuffer *framebuffer, + int plane_num, + const float *vertex_a, + const float *vertex_b) +{ + CoglContext *ctx = framebuffer->context; + float planef[4]; + double planed[4]; + float angle; + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglMatrix inverse_projection; + + cogl_matrix_stack_get_inverse (projection_stack, &inverse_projection); + + /* Calculate the angle between the axes and the line crossing the + two points */ + angle = atan2f (vertex_b[1] - vertex_a[1], + vertex_b[0] - vertex_a[0]) * (180.0/G_PI); + + cogl_matrix_stack_push (modelview_stack); + + /* Load the inverse of the projection matrix so we can specify the plane + * in screen coordinates */ + cogl_matrix_stack_set (modelview_stack, &inverse_projection); + + /* Rotate about point a */ + cogl_matrix_stack_translate (modelview_stack, + vertex_a[0], vertex_a[1], vertex_a[2]); + /* Rotate the plane by the calculated angle so that it will connect + the two points */ + cogl_matrix_stack_rotate (modelview_stack, angle, 0.0f, 0.0f, 1.0f); + cogl_matrix_stack_translate (modelview_stack, + -vertex_a[0], -vertex_a[1], -vertex_a[2]); + + /* Clip planes can only be used when a fixed function backend is in + use so we know we can directly push this matrix to the builtin + state */ + _cogl_matrix_entry_flush_to_gl_builtins (ctx, + modelview_stack->last_entry, + COGL_MATRIX_MODELVIEW, + framebuffer, + FALSE /* don't disable flip */); + + planef[0] = 0; + planef[1] = -1.0; + planef[2] = 0; + planef[3] = vertex_a[1]; + + switch (ctx->driver) + { + default: + g_assert_not_reached (); + break; + + case COGL_DRIVER_GLES1: + GE( ctx, glClipPlanef (plane_num, planef) ); + break; + + case COGL_DRIVER_GL: + case COGL_DRIVER_GL3: + planed[0] = planef[0]; + planed[1] = planef[1]; + planed[2] = planef[2]; + planed[3] = planef[3]; + GE( ctx, glClipPlane (plane_num, planed) ); + break; + } + + cogl_matrix_stack_pop (modelview_stack); +} + +static void +set_clip_planes (CoglFramebuffer *framebuffer, + CoglMatrixEntry *modelview_entry, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglMatrix modelview_matrix; + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglMatrix projection_matrix; + CoglMatrix modelview_projection; + float signed_area; + + float vertex_tl[4] = { x_1, y_1, 0, 1.0 }; + float vertex_tr[4] = { x_2, y_1, 0, 1.0 }; + float vertex_bl[4] = { x_1, y_2, 0, 1.0 }; + float vertex_br[4] = { x_2, y_2, 0, 1.0 }; + + cogl_matrix_stack_get (projection_stack, &projection_matrix); + cogl_matrix_entry_get (modelview_entry, &modelview_matrix); + + cogl_matrix_multiply (&modelview_projection, + &projection_matrix, + &modelview_matrix); + + project_vertex (&modelview_projection, vertex_tl); + project_vertex (&modelview_projection, vertex_tr); + project_vertex (&modelview_projection, vertex_bl); + project_vertex (&modelview_projection, vertex_br); + + /* Calculate the signed area of the polygon formed by the four + vertices so that we can know its orientation */ + signed_area = (vertex_tl[0] * (vertex_tr[1] - vertex_bl[1]) + + vertex_tr[0] * (vertex_br[1] - vertex_tl[1]) + + vertex_br[0] * (vertex_bl[1] - vertex_tr[1]) + + vertex_bl[0] * (vertex_tl[1] - vertex_br[1])); + + /* Set the clip planes to form lines between all of the vertices + using the same orientation as we calculated */ + if (signed_area > 0.0f) + { + /* counter-clockwise */ + set_clip_plane (framebuffer, GL_CLIP_PLANE0, vertex_tl, vertex_bl); + set_clip_plane (framebuffer, GL_CLIP_PLANE1, vertex_bl, vertex_br); + set_clip_plane (framebuffer, GL_CLIP_PLANE2, vertex_br, vertex_tr); + set_clip_plane (framebuffer, GL_CLIP_PLANE3, vertex_tr, vertex_tl); + } + else + { + /* clockwise */ + set_clip_plane (framebuffer, GL_CLIP_PLANE0, vertex_tl, vertex_tr); + set_clip_plane (framebuffer, GL_CLIP_PLANE1, vertex_tr, vertex_br); + set_clip_plane (framebuffer, GL_CLIP_PLANE2, vertex_br, vertex_bl); + set_clip_plane (framebuffer, GL_CLIP_PLANE3, vertex_bl, vertex_tl); + } +} + +static void +add_stencil_clip_rectangle (CoglFramebuffer *framebuffer, + CoglMatrixEntry *modelview_entry, + float x_1, + float y_1, + float x_2, + float y_2, + CoglBool first) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); + + /* NB: This can be called while flushing the journal so we need + * to be very conservative with what state we change. + */ + + _cogl_context_set_current_projection_entry (ctx, + projection_stack->last_entry); + _cogl_context_set_current_modelview_entry (ctx, modelview_entry); + + if (first) + { + GE( ctx, glEnable (GL_STENCIL_TEST) ); + + /* Initially disallow everything */ + GE( ctx, glClearStencil (0) ); + GE( ctx, glClear (GL_STENCIL_BUFFER_BIT) ); + + /* Punch out a hole to allow the rectangle */ + GE( ctx, glStencilFunc (GL_NEVER, 0x1, 0x1) ); + GE( ctx, glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE) ); + + _cogl_rectangle_immediate (framebuffer, + ctx->stencil_pipeline, + x_1, y_1, x_2, y_2); + } + else + { + /* Add one to every pixel of the stencil buffer in the + rectangle */ + GE( ctx, glStencilFunc (GL_NEVER, 0x1, 0x3) ); + GE( ctx, glStencilOp (GL_INCR, GL_INCR, GL_INCR) ); + _cogl_rectangle_immediate (framebuffer, + ctx->stencil_pipeline, + x_1, y_1, x_2, y_2); + + /* Subtract one from all pixels in the stencil buffer so that + only pixels where both the original stencil buffer and the + rectangle are set will be valid */ + GE( ctx, glStencilOp (GL_DECR, GL_DECR, GL_DECR) ); + + _cogl_context_set_current_projection_entry (ctx, &ctx->identity_entry); + _cogl_context_set_current_modelview_entry (ctx, &ctx->identity_entry); + + _cogl_rectangle_immediate (framebuffer, + ctx->stencil_pipeline, + -1.0, -1.0, 1.0, 1.0); + } + + /* Restore the stencil mode */ + GE( ctx, glStencilFunc (GL_EQUAL, 0x1, 0x1) ); + GE( ctx, glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP) ); +} + +typedef void (*SilhouettePaintCallback) (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + void *user_data); + +static void +add_stencil_clip_silhouette (CoglFramebuffer *framebuffer, + SilhouettePaintCallback silhouette_callback, + CoglMatrixEntry *modelview_entry, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + CoglBool merge, + CoglBool need_clear, + void *user_data) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); + + /* NB: This can be called while flushing the journal so we need + * to be very conservative with what state we change. + */ + + _cogl_context_set_current_projection_entry (ctx, + projection_stack->last_entry); + _cogl_context_set_current_modelview_entry (ctx, modelview_entry); + + _cogl_pipeline_flush_gl_state (ctx, ctx->stencil_pipeline, + framebuffer, FALSE, FALSE); + + GE( ctx, glEnable (GL_STENCIL_TEST) ); + + GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) ); + GE( ctx, glDepthMask (FALSE) ); + + if (merge) + { + GE (ctx, glStencilMask (2)); + GE (ctx, glStencilFunc (GL_LEQUAL, 0x2, 0x6)); + } + else + { + /* If we're not using the stencil buffer for clipping then we + don't need to clear the whole stencil buffer, just the area + that will be drawn */ + if (need_clear) + /* If this is being called from the clip stack code then it + will have set up a scissor for the minimum bounding box of + all of the clips. That box will likely mean that this + _cogl_clear won't need to clear the entire + buffer. _cogl_framebuffer_clear_without_flush4f is used instead + of cogl_clear because it won't try to flush the journal */ + _cogl_framebuffer_clear_without_flush4f (framebuffer, + COGL_BUFFER_BIT_STENCIL, + 0, 0, 0, 0); + else + { + /* Just clear the bounding box */ + GE( ctx, glStencilMask (~(GLuint) 0) ); + GE( ctx, glStencilOp (GL_ZERO, GL_ZERO, GL_ZERO) ); + _cogl_rectangle_immediate (framebuffer, + ctx->stencil_pipeline, + bounds_x1, bounds_y1, + bounds_x2, bounds_y2); + } + GE (ctx, glStencilMask (1)); + GE (ctx, glStencilFunc (GL_LEQUAL, 0x1, 0x3)); + } + + GE (ctx, glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT)); + + silhouette_callback (framebuffer, ctx->stencil_pipeline, user_data); + + if (merge) + { + /* Now we have the new stencil buffer in bit 1 and the old + stencil buffer in bit 0 so we need to intersect them */ + GE (ctx, glStencilMask (3)); + GE (ctx, glStencilFunc (GL_NEVER, 0x2, 0x3)); + GE (ctx, glStencilOp (GL_DECR, GL_DECR, GL_DECR)); + /* Decrement all of the bits twice so that only pixels where the + value is 3 will remain */ + + _cogl_context_set_current_projection_entry (ctx, &ctx->identity_entry); + _cogl_context_set_current_modelview_entry (ctx, &ctx->identity_entry); + + _cogl_rectangle_immediate (framebuffer, ctx->stencil_pipeline, + -1.0, -1.0, 1.0, 1.0); + _cogl_rectangle_immediate (framebuffer, ctx->stencil_pipeline, + -1.0, -1.0, 1.0, 1.0); + } + + GE (ctx, glStencilMask (~(GLuint) 0)); + GE (ctx, glDepthMask (TRUE)); + GE (ctx, glColorMask (TRUE, TRUE, TRUE, TRUE)); + + GE (ctx, glStencilFunc (GL_EQUAL, 0x1, 0x1)); + GE (ctx, glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP)); +} + +static void +paint_primitive_silhouette (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + void *user_data) +{ + _cogl_primitive_draw (user_data, + framebuffer, + pipeline, + COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | + COGL_DRAW_SKIP_LEGACY_STATE); +} + +static void +add_stencil_clip_primitive (CoglFramebuffer *framebuffer, + CoglMatrixEntry *modelview_entry, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + CoglBool merge, + CoglBool need_clear) +{ + add_stencil_clip_silhouette (framebuffer, + paint_primitive_silhouette, + modelview_entry, + bounds_x1, + bounds_y1, + bounds_x2, + bounds_y2, + merge, + need_clear, + primitive); +} + +static void +enable_clip_planes (CoglContext *ctx) +{ + GE( ctx, glEnable (GL_CLIP_PLANE0) ); + GE( ctx, glEnable (GL_CLIP_PLANE1) ); + GE( ctx, glEnable (GL_CLIP_PLANE2) ); + GE( ctx, glEnable (GL_CLIP_PLANE3) ); +} + +static void +disable_clip_planes (CoglContext *ctx) +{ + GE( ctx, glDisable (GL_CLIP_PLANE3) ); + GE( ctx, glDisable (GL_CLIP_PLANE2) ); + GE( ctx, glDisable (GL_CLIP_PLANE1) ); + GE( ctx, glDisable (GL_CLIP_PLANE0) ); +} + +void +_cogl_clip_stack_gl_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + int has_clip_planes; + CoglBool using_clip_planes = FALSE; + CoglBool using_stencil_buffer = FALSE; + int scissor_x0; + int scissor_y0; + int scissor_x1; + int scissor_y1; + CoglClipStack *entry; + int scissor_y_start; + + /* If we have already flushed this state then we don't need to do + anything */ + if (ctx->current_clip_stack_valid) + { + if (ctx->current_clip_stack == stack && + (ctx->needs_viewport_scissor_workaround == FALSE || + (framebuffer->viewport_age == + framebuffer->viewport_age_for_scissor_workaround && + ctx->viewport_scissor_workaround_framebuffer == + framebuffer))) + return; + + _cogl_clip_stack_unref (ctx->current_clip_stack); + } + + ctx->current_clip_stack_valid = TRUE; + ctx->current_clip_stack = _cogl_clip_stack_ref (stack); + + has_clip_planes = + _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES); + + if (has_clip_planes) + disable_clip_planes (ctx); + GE( ctx, glDisable (GL_STENCIL_TEST) ); + + /* If the stack is empty then there's nothing else to do + * + * See comment below about ctx->needs_viewport_scissor_workaround + */ + if (stack == NULL && !ctx->needs_viewport_scissor_workaround) + { + COGL_NOTE (CLIPPING, "Flushed empty clip stack"); + + ctx->current_clip_stack_uses_stencil = FALSE; + GE (ctx, glDisable (GL_SCISSOR_TEST)); + return; + } + + /* Calculate the scissor rect first so that if we eventually have to + clear the stencil buffer then the clear will be clipped to the + intersection of all of the bounding boxes. This saves having to + clear the whole stencil buffer */ + _cogl_clip_stack_get_bounds (stack, + &scissor_x0, &scissor_y0, + &scissor_x1, &scissor_y1); + + /* XXX: ONGOING BUG: Intel viewport scissor + * + * Intel gen6 drivers don't correctly handle offset viewports, since + * primitives aren't clipped within the bounds of the viewport. To + * workaround this we push our own clip for the viewport that will + * use scissoring to ensure we clip as expected. + * + * TODO: file a bug upstream! + */ + if (ctx->needs_viewport_scissor_workaround) + { + _cogl_util_scissor_intersect (framebuffer->viewport_x, + framebuffer->viewport_y, + framebuffer->viewport_x + + framebuffer->viewport_width, + framebuffer->viewport_y + + framebuffer->viewport_height, + &scissor_x0, &scissor_y0, + &scissor_x1, &scissor_y1); + framebuffer->viewport_age_for_scissor_workaround = + framebuffer->viewport_age; + ctx->viewport_scissor_workaround_framebuffer = + framebuffer; + } + + /* Enable scissoring as soon as possible */ + if (scissor_x0 >= scissor_x1 || scissor_y0 >= scissor_y1) + scissor_x0 = scissor_y0 = scissor_x1 = scissor_y1 = scissor_y_start = 0; + else + { + /* We store the entry coordinates in Cogl coordinate space + * but OpenGL requires the window origin to be the bottom + * left so we may need to convert the incoming coordinates. + * + * NB: Cogl forces all offscreen rendering to be done upside + * down so in this case no conversion is needed. + */ + + if (cogl_is_offscreen (framebuffer)) + scissor_y_start = scissor_y0; + else + { + int framebuffer_height = + cogl_framebuffer_get_height (framebuffer); + + scissor_y_start = framebuffer_height - scissor_y1; + } + } + + COGL_NOTE (CLIPPING, "Flushing scissor to (%i, %i, %i, %i)", + scissor_x0, scissor_y0, + scissor_x1, scissor_y1); + + GE (ctx, glEnable (GL_SCISSOR_TEST)); + GE (ctx, glScissor (scissor_x0, scissor_y_start, + scissor_x1 - scissor_x0, + scissor_y1 - scissor_y0)); + + /* Add all of the entries. This will end up adding them in the + reverse order that they were specified but as all of the clips + are intersecting it should work out the same regardless of the + order */ + for (entry = stack; entry; entry = entry->parent) + { + switch (entry->type) + { + case COGL_CLIP_STACK_PRIMITIVE: + { + CoglClipStackPrimitive *primitive_entry = + (CoglClipStackPrimitive *) entry; + + COGL_NOTE (CLIPPING, "Adding stencil clip for primitive"); + + add_stencil_clip_primitive (framebuffer, + primitive_entry->matrix_entry, + primitive_entry->primitive, + primitive_entry->bounds_x1, + primitive_entry->bounds_y1, + primitive_entry->bounds_x2, + primitive_entry->bounds_y2, + using_stencil_buffer, + TRUE); + + using_stencil_buffer = TRUE; + break; + } + case COGL_CLIP_STACK_RECT: + { + CoglClipStackRect *rect = (CoglClipStackRect *) entry; + + /* We don't need to do anything extra if the clip for this + rectangle was entirely described by its scissor bounds */ + if (!rect->can_be_scissor) + { + /* If we support clip planes and we haven't already used + them then use that instead */ + if (has_clip_planes) + { + COGL_NOTE (CLIPPING, + "Adding clip planes clip for rectangle"); + + set_clip_planes (framebuffer, + rect->matrix_entry, + rect->x0, + rect->y0, + rect->x1, + rect->y1); + using_clip_planes = TRUE; + /* We can't use clip planes a second time */ + has_clip_planes = FALSE; + } + else + { + COGL_NOTE (CLIPPING, "Adding stencil clip for rectangle"); + + add_stencil_clip_rectangle (framebuffer, + rect->matrix_entry, + rect->x0, + rect->y0, + rect->x1, + rect->y1, + !using_stencil_buffer); + using_stencil_buffer = TRUE; + } + } + break; + } + case COGL_CLIP_STACK_WINDOW_RECT: + break; + /* We don't need to do anything for window space rectangles because + * their functionality is entirely implemented by the entry bounding + * box */ + } + } + + /* Enabling clip planes is delayed to now so that they won't affect + setting up the stencil buffer */ + if (using_clip_planes) + enable_clip_planes (ctx); + + ctx->current_clip_stack_uses_stencil = using_stencil_buffer; +} diff --git a/cogl/driver/gl/cogl-framebuffer-gl-private.h b/cogl/driver/gl/cogl-framebuffer-gl-private.h new file mode 100644 index 0000000..47a1c1c --- /dev/null +++ b/cogl/driver/gl/cogl-framebuffer-gl-private.h @@ -0,0 +1,102 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_FRAMEBUFFER_GL_PRIVATE_H__ +#define __COGL_FRAMEBUFFER_GL_PRIVATE_H__ + +CoglBool +_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen, + CoglError **error); + +void +_cogl_offscreen_gl_free (CoglOffscreen *offscreen); + +void +_cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state); + +void +_cogl_framebuffer_gl_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha); + +void +_cogl_framebuffer_gl_query_bits (CoglFramebuffer *framebuffer, + CoglFramebufferBits *bits); + +void +_cogl_framebuffer_gl_finish (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers); + +void +_cogl_framebuffer_gl_bind (CoglFramebuffer *framebuffer, GLenum target); + +void +_cogl_framebuffer_gl_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +void +_cogl_framebuffer_gl_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +CoglBool +_cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error); + +#endif /* __COGL_FRAMEBUFFER_GL_PRIVATE_H__ */ + + diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c new file mode 100644 index 0000000..c0f094d --- /dev/null +++ b/cogl/driver/gl/cogl-framebuffer-gl.c @@ -0,0 +1,1573 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-framebuffer-gl-private.h" +#include "cogl-buffer-gl-private.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-texture-private.h" + +#include +#include + +#ifndef GL_FRAMEBUFFER +#define GL_FRAMEBUFFER 0x8D40 +#endif +#ifndef GL_RENDERBUFFER +#define GL_RENDERBUFFER 0x8D41 +#endif +#ifndef GL_STENCIL_ATTACHMENT +#define GL_STENCIL_ATTACHMENT 0x8D00 +#endif +#ifndef GL_COLOR_ATTACHMENT0 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#endif +#ifndef GL_FRAMEBUFFER_COMPLETE +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#endif +#ifndef GL_STENCIL_INDEX8 +#define GL_STENCIL_INDEX8 0x8D48 +#endif +#ifndef GL_DEPTH_STENCIL +#define GL_DEPTH_STENCIL 0x84F9 +#endif +#ifndef GL_DEPTH24_STENCIL8 +#define GL_DEPTH24_STENCIL8 0x88F0 +#endif +#ifndef GL_DEPTH_ATTACHMENT +#define GL_DEPTH_ATTACHMENT 0x8D00 +#endif +#ifndef GL_DEPTH_STENCIL_ATTACHMENT +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#endif +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#endif +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif +#ifndef GL_TEXTURE_SAMPLES_IMG +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif +#ifndef GL_PACK_INVERT_MESA +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_COLOR +#define GL_COLOR 0x1800 +#endif +#ifndef GL_DEPTH +#define GL_DEPTH 0x1801 +#endif +#ifndef GL_STENCIL +#define GL_STENCIL 0x1802 +#endif + + +static void +_cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer) +{ + float gl_viewport_y; + + g_assert (framebuffer->viewport_width >=0 && + framebuffer->viewport_height >=0); + + /* Convert the Cogl viewport y offset to an OpenGL viewport y offset + * NB: OpenGL defines its window and viewport origins to be bottom + * left, while Cogl defines them to be top left. + * NB: We render upside down to offscreen framebuffers so we don't + * need to convert the y offset in this case. */ + if (cogl_is_offscreen (framebuffer)) + gl_viewport_y = framebuffer->viewport_y; + else + gl_viewport_y = framebuffer->height - + (framebuffer->viewport_y + framebuffer->viewport_height); + + COGL_NOTE (OPENGL, "Calling glViewport(%f, %f, %f, %f)", + framebuffer->viewport_x, + gl_viewport_y, + framebuffer->viewport_width, + framebuffer->viewport_height); + + GE (framebuffer->context, + glViewport (framebuffer->viewport_x, + gl_viewport_y, + framebuffer->viewport_width, + framebuffer->viewport_height)); +} + +static void +_cogl_framebuffer_gl_flush_clip_state (CoglFramebuffer *framebuffer) +{ + _cogl_clip_stack_flush (framebuffer->clip_stack, framebuffer); +} + +static void +_cogl_framebuffer_gl_flush_dither_state (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + if (ctx->current_gl_dither_enabled != framebuffer->dither_enabled) + { + if (framebuffer->dither_enabled) + GE (ctx, glEnable (GL_DITHER)); + else + GE (ctx, glDisable (GL_DITHER)); + ctx->current_gl_dither_enabled = framebuffer->dither_enabled; + } +} + +static void +_cogl_framebuffer_gl_flush_modelview_state (CoglFramebuffer *framebuffer) +{ + CoglMatrixEntry *modelview_entry = + _cogl_framebuffer_get_modelview_entry (framebuffer); + _cogl_context_set_current_modelview_entry (framebuffer->context, + modelview_entry); +} + +static void +_cogl_framebuffer_gl_flush_projection_state (CoglFramebuffer *framebuffer) +{ + CoglMatrixEntry *projection_entry = + _cogl_framebuffer_get_projection_entry (framebuffer); + _cogl_context_set_current_projection_entry (framebuffer->context, + projection_entry); +} + +static void +_cogl_framebuffer_gl_flush_color_mask_state (CoglFramebuffer *framebuffer) +{ + CoglContext *context = framebuffer->context; + + /* The color mask state is really owned by a CoglPipeline so to + * ensure the color mask is updated the next time we draw something + * we need to make sure the logic ops for the pipeline are + * re-flushed... */ + context->current_pipeline_changes_since_flush |= + COGL_PIPELINE_STATE_LOGIC_OPS; + context->current_pipeline_age--; +} + +static void +_cogl_framebuffer_gl_flush_front_face_winding_state (CoglFramebuffer *framebuffer) +{ + CoglContext *context = framebuffer->context; + CoglPipelineCullFaceMode mode; + + /* NB: The face winding state is actually owned by the current + * CoglPipeline. + * + * If we don't have a current pipeline then we can just assume that + * when we later do flush a pipeline we will check the current + * framebuffer to know how to setup the winding */ + if (!context->current_pipeline) + return; + + mode = cogl_pipeline_get_cull_face_mode (context->current_pipeline); + + /* If the current CoglPipeline has a culling mode that doesn't care + * about the winding we can avoid forcing an update of the state and + * bail out. */ + if (mode == COGL_PIPELINE_CULL_FACE_MODE_NONE || + mode == COGL_PIPELINE_CULL_FACE_MODE_BOTH) + return; + + /* Since the winding state is really owned by the current pipeline + * the way we "flush" an updated winding is to dirty the pipeline + * state... */ + context->current_pipeline_changes_since_flush |= + COGL_PIPELINE_STATE_CULL_FACE; + context->current_pipeline_age--; +} + +void +_cogl_framebuffer_gl_bind (CoglFramebuffer *framebuffer, GLenum target) +{ + CoglContext *ctx = framebuffer->context; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) + { + CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer); + GE (ctx, glBindFramebuffer (target, + offscreen->gl_framebuffer.fbo_handle)); + } + else + { + const CoglWinsysVtable *winsys = + _cogl_framebuffer_get_winsys (framebuffer); + winsys->onscreen_bind (COGL_ONSCREEN (framebuffer)); + /* glBindFramebuffer is an an extension with OpenGL ES 1.1 */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + GE (ctx, glBindFramebuffer (target, 0)); + + /* Initialise the glDrawBuffer state the first time the context + * is bound to the default framebuffer. If the winsys is using a + * surfaceless context for the initial make current then the + * default draw buffer will be GL_NONE so we need to correct + * that. We can't do it any earlier because binding GL_BACK when + * there is no default framebuffer won't work */ + if (!ctx->was_bound_to_onscreen) + { + if (ctx->glDrawBuffer) + { + GE (ctx, glDrawBuffer (GL_BACK)); + } + else if (ctx->glDrawBuffers) + { + /* glDrawBuffer isn't available on GLES 3.0 so we need + * to be able to use glDrawBuffers as well. On GLES 2 + * neither is available but the state should always be + * GL_BACK anyway so we don't need to set anything. On + * desktop GL this must be GL_BACK_LEFT instead of + * GL_BACK but as this code path will only be hit for + * GLES we can just use GL_BACK. */ + static const GLenum buffers[] = { GL_BACK }; + + GE (ctx, glDrawBuffers (G_N_ELEMENTS (buffers), buffers)); + } + + ctx->was_bound_to_onscreen = TRUE; + } + } +} + +void +_cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state) +{ + CoglContext *ctx = draw_buffer->context; + unsigned long differences; + int bit; + + /* We can assume that any state that has changed for the current + * framebuffer is different to the currently flushed value. */ + differences = ctx->current_draw_buffer_changes; + + /* Any state of the current framebuffer that hasn't already been + * flushed is assumed to be unknown so we will always flush that + * state if asked. */ + differences |= ~ctx->current_draw_buffer_state_flushed; + + /* We only need to consider the state we've been asked to flush */ + differences &= state; + + if (ctx->current_draw_buffer != draw_buffer) + { + /* If the previous draw buffer is NULL then we'll assume + everything has changed. This can happen if a framebuffer is + destroyed while it is the last flushed draw buffer. In that + case the framebuffer destructor will set + ctx->current_draw_buffer to NULL */ + if (ctx->current_draw_buffer == NULL) + differences |= state; + else + /* NB: we only need to compare the state we're being asked to flush + * and we don't need to compare the state we've already decided + * we will definitely flush... */ + differences |= _cogl_framebuffer_compare (ctx->current_draw_buffer, + draw_buffer, + state & ~differences); + + /* NB: we don't take a reference here, to avoid a circular + * reference. */ + ctx->current_draw_buffer = draw_buffer; + ctx->current_draw_buffer_state_flushed = 0; + } + + if (ctx->current_read_buffer != read_buffer && + state & COGL_FRAMEBUFFER_STATE_BIND) + { + differences |= COGL_FRAMEBUFFER_STATE_BIND; + /* NB: we don't take a reference here, to avoid a circular + * reference. */ + ctx->current_read_buffer = read_buffer; + } + + if (!differences) + return; + + /* Lazily ensure the framebuffers have been allocated */ + if (G_UNLIKELY (!draw_buffer->allocated)) + cogl_framebuffer_allocate (draw_buffer, NULL); + if (G_UNLIKELY (!read_buffer->allocated)) + cogl_framebuffer_allocate (read_buffer, NULL); + + /* We handle buffer binding separately since the method depends on whether + * we are binding the same buffer for read and write or not unlike all + * other state that only relates to the draw_buffer. */ + if (differences & COGL_FRAMEBUFFER_STATE_BIND) + { + if (draw_buffer == read_buffer) + _cogl_framebuffer_gl_bind (draw_buffer, GL_FRAMEBUFFER); + else + { + /* NB: Currently we only take advantage of binding separate + * read/write buffers for offscreen framebuffer blit + * purposes. */ + _COGL_RETURN_IF_FAIL (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)); + _COGL_RETURN_IF_FAIL (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); + _COGL_RETURN_IF_FAIL (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); + + _cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER); + _cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER); + } + + differences &= ~COGL_FRAMEBUFFER_STATE_BIND; + } + + COGL_FLAGS_FOREACH_START (&differences, 1, bit) + { + /* XXX: We considered having an array of callbacks for each state index + * that we'd call here but decided that this way the compiler is more + * likely going to be able to in-line the flush functions and use the + * index to jump straight to the required code. */ + switch (bit) + { + case COGL_FRAMEBUFFER_STATE_INDEX_VIEWPORT: + _cogl_framebuffer_gl_flush_viewport_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_CLIP: + _cogl_framebuffer_gl_flush_clip_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_DITHER: + _cogl_framebuffer_gl_flush_dither_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW: + _cogl_framebuffer_gl_flush_modelview_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION: + _cogl_framebuffer_gl_flush_projection_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK: + _cogl_framebuffer_gl_flush_color_mask_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING: + _cogl_framebuffer_gl_flush_front_face_winding_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE: + /* Nothing to do for depth write state change; the state will always + * be taken into account when flushing the pipeline's depth state. */ + break; + default: + g_warn_if_reached (); + } + } + COGL_FLAGS_FOREACH_END; + + ctx->current_draw_buffer_state_flushed |= state; + ctx->current_draw_buffer_changes &= ~state; +} + +static CoglTexture * +create_depth_texture (CoglContext *ctx, + int width, + int height) +{ + CoglTexture2D *depth_texture = + cogl_texture_2d_new_with_size (ctx, width, height); + + cogl_texture_set_components (COGL_TEXTURE (depth_texture), + COGL_TEXTURE_COMPONENTS_DEPTH); + + return COGL_TEXTURE (depth_texture); +} + +static CoglTexture * +attach_depth_texture (CoglContext *ctx, + CoglTexture *depth_texture, + CoglOffscreenAllocateFlags flags) +{ + GLuint tex_gl_handle; + GLenum tex_gl_target; + + if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL) + { + /* attach a GL_DEPTH_STENCIL texture to the GL_DEPTH_ATTACHMENT and + * GL_STENCIL_ATTACHMENT attachement points */ + g_assert (_cogl_texture_get_format (depth_texture) == + COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8); + + cogl_texture_get_gl_texture (depth_texture, + &tex_gl_handle, &tex_gl_target); + + GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + tex_gl_target, tex_gl_handle, + 0)); + GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, + GL_STENCIL_ATTACHMENT, + tex_gl_target, tex_gl_handle, + 0)); + } + else if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH) + { + /* attach a newly created GL_DEPTH_COMPONENT16 texture to the + * GL_DEPTH_ATTACHMENT attachement point */ + g_assert (_cogl_texture_get_format (depth_texture) == + COGL_PIXEL_FORMAT_DEPTH_16); + + cogl_texture_get_gl_texture (COGL_TEXTURE (depth_texture), + &tex_gl_handle, &tex_gl_target); + + GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + tex_gl_target, tex_gl_handle, + 0)); + } + + return COGL_TEXTURE (depth_texture); +} + +static GList * +try_creating_renderbuffers (CoglContext *ctx, + int width, + int height, + CoglOffscreenAllocateFlags flags, + int n_samples) +{ + GList *renderbuffers = NULL; + GLuint gl_depth_stencil_handle; + + if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL) + { + GLenum format; + + /* WebGL adds a GL_DEPTH_STENCIL_ATTACHMENT and requires that we + * use the GL_DEPTH_STENCIL format. */ +#ifdef HAVE_COGL_WEBGL + format = GL_DEPTH_STENCIL; +#else + /* Although GL_OES_packed_depth_stencil is mostly equivalent to + * GL_EXT_packed_depth_stencil, one notable difference is that + * GL_OES_packed_depth_stencil doesn't allow GL_DEPTH_STENCIL to + * be passed as an internal format to glRenderbufferStorage. + */ + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL)) + format = GL_DEPTH_STENCIL; + else + { + _COGL_RETURN_VAL_IF_FAIL ( + _cogl_has_private_feature (ctx, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL), + NULL); + format = GL_DEPTH24_STENCIL8; + } +#endif + + /* Create a renderbuffer for depth and stenciling */ + GE (ctx, glGenRenderbuffers (1, &gl_depth_stencil_handle)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_stencil_handle)); + if (n_samples) + GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER, + n_samples, + format, + width, height)); + else + GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format, + width, height)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0)); + + +#ifdef HAVE_COGL_WEBGL + GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, + GL_DEPTH_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, + gl_depth_stencil_handle)); +#else + GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, + GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, + gl_depth_stencil_handle)); + GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, + gl_depth_stencil_handle)); +#endif + renderbuffers = + g_list_prepend (renderbuffers, + GUINT_TO_POINTER (gl_depth_stencil_handle)); + } + + if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH) + { + GLuint gl_depth_handle; + + GE (ctx, glGenRenderbuffers (1, &gl_depth_handle)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_handle)); + /* For now we just ask for GL_DEPTH_COMPONENT16 since this is all that's + * available under GLES */ + if (n_samples) + GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER, + n_samples, + GL_DEPTH_COMPONENT16, + width, height)); + else + GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, + width, height)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0)); + GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, gl_depth_handle)); + renderbuffers = + g_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_depth_handle)); + } + + if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL) + { + GLuint gl_stencil_handle; + + GE (ctx, glGenRenderbuffers (1, &gl_stencil_handle)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_stencil_handle)); + if (n_samples) + GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER, + n_samples, + GL_STENCIL_INDEX8, + width, height)); + else + GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8, + width, height)); + GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0)); + GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, + GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, gl_stencil_handle)); + renderbuffers = + g_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_stencil_handle)); + } + + return renderbuffers; +} + +static void +delete_renderbuffers (CoglContext *ctx, GList *renderbuffers) +{ + GList *l; + + for (l = renderbuffers; l; l = l->next) + { + GLuint renderbuffer = GPOINTER_TO_UINT (l->data); + GE (ctx, glDeleteRenderbuffers (1, &renderbuffer)); + } + + g_list_free (renderbuffers); +} + +/* + * NB: This function may be called with a standalone GLES2 context + * bound so we can create a shadow framebuffer that wraps the same + * CoglTexture as the given CoglOffscreen. This function shouldn't + * modify anything in + */ +static CoglBool +try_creating_fbo (CoglContext *ctx, + CoglTexture *texture, + int texture_level, + int texture_level_width, + int texture_level_height, + CoglTexture *depth_texture, + CoglFramebufferConfig *config, + CoglOffscreenAllocateFlags flags, + CoglGLFramebuffer *gl_framebuffer) +{ + GLuint tex_gl_handle; + GLenum tex_gl_target; + GLenum status; + int n_samples; + + if (!cogl_texture_get_gl_texture (texture, &tex_gl_handle, &tex_gl_target)) + return FALSE; + + if (tex_gl_target != GL_TEXTURE_2D +#ifdef HAVE_COGL_GL + && tex_gl_target != GL_TEXTURE_RECTANGLE_ARB +#endif + ) + return FALSE; + + if (config->samples_per_pixel) + { + if (!ctx->glFramebufferTexture2DMultisampleIMG) + return FALSE; + n_samples = config->samples_per_pixel; + } + else + n_samples = 0; + + /* We are about to generate and bind a new fbo, so we pretend to + * change framebuffer state so that the old framebuffer will be + * rebound again before drawing. */ + ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_BIND; + + /* Generate framebuffer */ + ctx->glGenFramebuffers (1, &gl_framebuffer->fbo_handle); + GE (ctx, glBindFramebuffer (GL_FRAMEBUFFER, gl_framebuffer->fbo_handle)); + + if (n_samples) + { + GE (ctx, glFramebufferTexture2DMultisampleIMG (GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + tex_gl_target, tex_gl_handle, + n_samples, + texture_level)); + } + else + GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + tex_gl_target, tex_gl_handle, + texture_level)); + + /* attach either a depth/stencil texture, a depth texture or render buffers + * depending on what we've been asked to provide */ + + if (depth_texture && + flags & (COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL | + COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH)) + { + attach_depth_texture (ctx, depth_texture, flags); + + /* Let's clear the flags that are now fulfilled as we might need to + * create renderbuffers (for the ALLOCATE_FLAG_DEPTH | + * ALLOCATE_FLAG_STENCIL case) */ + flags &= ~(COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL | + COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH); + } + + if (flags) + { + gl_framebuffer->renderbuffers = + try_creating_renderbuffers (ctx, + texture_level_width, + texture_level_height, + flags, + n_samples); + } + + /* Make sure it's complete */ + status = ctx->glCheckFramebufferStatus (GL_FRAMEBUFFER); + + if (status != GL_FRAMEBUFFER_COMPLETE) + { + GE (ctx, glDeleteFramebuffers (1, &gl_framebuffer->fbo_handle)); + + delete_renderbuffers (ctx, gl_framebuffer->renderbuffers); + gl_framebuffer->renderbuffers = NULL; + + return FALSE; + } + + /* Update the real number of samples_per_pixel now that we have a + * complete framebuffer */ + if (n_samples) + { + GLenum attachment = GL_COLOR_ATTACHMENT0; + GLenum pname = GL_TEXTURE_SAMPLES_IMG; + int texture_samples; + + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + attachment, + pname, + &texture_samples) ); + gl_framebuffer->samples_per_pixel = texture_samples; + } + + return TRUE; +} + +CoglBool +_cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx, + CoglTexture *texture, + int texture_level, + int texture_level_width, + int texture_level_height, + CoglTexture *depth_texture, + CoglFramebufferConfig *config, + CoglOffscreenAllocateFlags flags, + CoglGLFramebuffer *gl_framebuffer) +{ + return try_creating_fbo (ctx, + texture, + texture_level, + texture_level_width, + texture_level_height, + depth_texture, + config, + flags, + gl_framebuffer); +} + +CoglBool +_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen, + CoglError **error) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen); + CoglContext *ctx = fb->context; + CoglOffscreenAllocateFlags flags; + CoglGLFramebuffer *gl_framebuffer = &offscreen->gl_framebuffer; + int level_width; + int level_height; + + _COGL_RETURN_VAL_IF_FAIL (offscreen->texture_level < + _cogl_texture_get_n_levels (offscreen->texture), + NULL); + + _cogl_texture_get_level_size (offscreen->texture, + offscreen->texture_level, + &level_width, + &level_height, + NULL); + + if (fb->config.depth_texture_enabled && + offscreen->depth_texture == NULL) + { + offscreen->depth_texture = + create_depth_texture (ctx, + level_width, + level_height); + + if (!cogl_texture_allocate (offscreen->depth_texture, error)) + { + cogl_object_unref (offscreen->depth_texture); + offscreen->depth_texture = NULL; + return FALSE; + } + + _cogl_texture_associate_framebuffer (offscreen->depth_texture, fb); + } + + /* XXX: The framebuffer_object spec isn't clear in defining whether attaching + * a texture as a renderbuffer with mipmap filtering enabled while the + * mipmaps have not been uploaded should result in an incomplete framebuffer + * object. (different drivers make different decisions) + * + * To avoid an error with drivers that do consider this a problem we + * explicitly set non mipmapped filters here. These will later be reset when + * the texture is actually used for rendering according to the filters set on + * the corresponding CoglPipeline. + */ + _cogl_texture_gl_flush_legacy_texobj_filters (offscreen->texture, + GL_NEAREST, GL_NEAREST); + + if (((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) && + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = 0, + gl_framebuffer)) || + + (ctx->have_last_offscreen_allocate_flags && + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = ctx->last_offscreen_allocate_flags, + gl_framebuffer)) || + + ( + /* NB: WebGL introduces a DEPTH_STENCIL_ATTACHMENT and doesn't + * need an extension to handle _FLAG_DEPTH_STENCIL */ +#ifndef HAVE_COGL_WEBGL + (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) || + _cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL)) && +#endif + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL, + gl_framebuffer)) || + + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH | + COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL, + gl_framebuffer) || + + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL, + gl_framebuffer) || + + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH, + gl_framebuffer) || + + try_creating_fbo (ctx, + offscreen->texture, + offscreen->texture_level, + level_width, + level_height, + offscreen->depth_texture, + &fb->config, + flags = 0, + gl_framebuffer)) + { + fb->samples_per_pixel = gl_framebuffer->samples_per_pixel; + + if (!offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) + { + /* Record that the last set of flags succeeded so that we can + try that set first next time */ + ctx->last_offscreen_allocate_flags = flags; + ctx->have_last_offscreen_allocate_flags = TRUE; + } + + /* Save the flags we managed to successfully allocate the + * renderbuffers with in case we need to make renderbuffers for a + * GLES2 context later */ + offscreen->allocation_flags = flags; + + return TRUE; + } + else + { + _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to create an OpenGL framebuffer object"); + return FALSE; + } +} + +void +_cogl_offscreen_gl_free (CoglOffscreen *offscreen) +{ + CoglContext *ctx = COGL_FRAMEBUFFER (offscreen)->context; + + delete_renderbuffers (ctx, offscreen->gl_framebuffer.renderbuffers); + + GE (ctx, glDeleteFramebuffers (1, &offscreen->gl_framebuffer.fbo_handle)); +} + +void +_cogl_framebuffer_gl_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha) +{ + CoglContext *ctx = framebuffer->context; + GLbitfield gl_buffers = 0; + + if (buffers & COGL_BUFFER_BIT_COLOR) + { + GE( ctx, glClearColor (red, green, blue, alpha) ); + gl_buffers |= GL_COLOR_BUFFER_BIT; + + if (ctx->current_gl_color_mask != framebuffer->color_mask) + { + CoglColorMask color_mask = framebuffer->color_mask; + GE( ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED), + !!(color_mask & COGL_COLOR_MASK_GREEN), + !!(color_mask & COGL_COLOR_MASK_BLUE), + !!(color_mask & COGL_COLOR_MASK_ALPHA))); + ctx->current_gl_color_mask = color_mask; + /* Make sure the ColorMask is updated when the next primitive is drawn */ + ctx->current_pipeline_changes_since_flush |= + COGL_PIPELINE_STATE_LOGIC_OPS; + ctx->current_pipeline_age--; + } + } + + if (buffers & COGL_BUFFER_BIT_DEPTH) + { + gl_buffers |= GL_DEPTH_BUFFER_BIT; + + if (ctx->depth_writing_enabled_cache != framebuffer->depth_writing_enabled) + { + GE( ctx, glDepthMask (framebuffer->depth_writing_enabled)); + + ctx->depth_writing_enabled_cache = framebuffer->depth_writing_enabled; + + /* Make sure the DepthMask is updated when the next primitive is drawn */ + ctx->current_pipeline_changes_since_flush |= + COGL_PIPELINE_STATE_DEPTH; + ctx->current_pipeline_age--; + } + } + + if (buffers & COGL_BUFFER_BIT_STENCIL) + gl_buffers |= GL_STENCIL_BUFFER_BIT; + + + GE (ctx, glClear (gl_buffers)); +} + +static inline void +_cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + if (G_LIKELY (!framebuffer->dirty_bitmasks)) + return; + + cogl_framebuffer_allocate (framebuffer, NULL); + + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS) && + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) + { + static const struct + { + GLenum attachment, pname; + size_t offset; + } params[] = + { + { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, + offsetof (CoglFramebufferBits, red) }, + { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, + offsetof (CoglFramebufferBits, green) }, + { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, + offsetof (CoglFramebufferBits, blue) }, + { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, + offsetof (CoglFramebufferBits, alpha) }, + { GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, + offsetof (CoglFramebufferBits, depth) }, + { GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, + offsetof (CoglFramebufferBits, stencil) }, + }; + int i; + + for (i = 0; i < G_N_ELEMENTS (params); i++) + { + int *value = + (int *) ((uint8_t *) &framebuffer->bits + params[i].offset); + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + params[i].attachment, + params[i].pname, + value) ); + } + } + else +#endif /* HAVE_COGL_GL */ + { + GE( ctx, glGetIntegerv (GL_RED_BITS, &framebuffer->bits.red) ); + GE( ctx, glGetIntegerv (GL_GREEN_BITS, &framebuffer->bits.green) ); + GE( ctx, glGetIntegerv (GL_BLUE_BITS, &framebuffer->bits.blue) ); + GE( ctx, glGetIntegerv (GL_ALPHA_BITS, &framebuffer->bits.alpha) ); + GE( ctx, glGetIntegerv (GL_DEPTH_BITS, &framebuffer->bits.depth) ); + GE( ctx, glGetIntegerv (GL_STENCIL_BITS, &framebuffer->bits.stencil) ); + } + + /* If we don't have alpha textures then the alpha bits are actually + * stored in the red component */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) && + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN && + framebuffer->internal_format == COGL_PIXEL_FORMAT_A_8) + { + framebuffer->bits.alpha = framebuffer->bits.red; + framebuffer->bits.red = 0; + } + + COGL_NOTE (OFFSCREEN, + "RGBA/D/S Bits for framebuffer[%p, %s]: %d, %d, %d, %d, %d, %d", + framebuffer, + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN + ? "offscreen" + : "onscreen", + framebuffer->bits.red, + framebuffer->bits.blue, + framebuffer->bits.green, + framebuffer->bits.alpha, + framebuffer->bits.depth, + framebuffer->bits.stencil); + + framebuffer->dirty_bitmasks = FALSE; +} + +void +_cogl_framebuffer_gl_query_bits (CoglFramebuffer *framebuffer, + CoglFramebufferBits *bits) +{ + _cogl_framebuffer_init_bits (framebuffer); + + /* TODO: cache these in some driver specific location not + * directly as part of CoglFramebuffer. */ + *bits = framebuffer->bits; +} + +void +_cogl_framebuffer_gl_finish (CoglFramebuffer *framebuffer) +{ + GE (framebuffer->context, glFinish ()); +} + +void +_cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers) +{ + CoglContext *ctx = framebuffer->context; + + if (ctx->glDiscardFramebuffer) + { + GLenum attachments[3]; + int i = 0; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + if (buffers & COGL_BUFFER_BIT_COLOR) + attachments[i++] = GL_COLOR; + if (buffers & COGL_BUFFER_BIT_DEPTH) + attachments[i++] = GL_DEPTH; + if (buffers & COGL_BUFFER_BIT_STENCIL) + attachments[i++] = GL_STENCIL; + } + else + { + if (buffers & COGL_BUFFER_BIT_COLOR) + attachments[i++] = GL_COLOR_ATTACHMENT0; + if (buffers & COGL_BUFFER_BIT_DEPTH) + attachments[i++] = GL_DEPTH_ATTACHMENT; + if (buffers & COGL_BUFFER_BIT_STENCIL) + attachments[i++] = GL_STENCIL_ATTACHMENT; + } + + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + GE (ctx, glDiscardFramebuffer (GL_FRAMEBUFFER, i, attachments)); + } +} + +void +_cogl_framebuffer_gl_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ + _cogl_flush_attributes_state (framebuffer, pipeline, flags, + attributes, n_attributes); + + GE (framebuffer->context, + glDrawArrays ((GLenum)mode, first_vertex, n_vertices)); +} + +static size_t +sizeof_index_type (CoglIndicesType type) +{ + switch (type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + return 1; + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + return 2; + case COGL_INDICES_TYPE_UNSIGNED_INT: + return 4; + } + g_return_val_if_reached (0); +} + +void +_cogl_framebuffer_gl_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ + CoglBuffer *buffer; + uint8_t *base; + size_t buffer_offset; + size_t index_size; + GLenum indices_gl_type = 0; + + _cogl_flush_attributes_state (framebuffer, pipeline, flags, + attributes, n_attributes); + + buffer = COGL_BUFFER (cogl_indices_get_buffer (indices)); + + /* Note: we don't try and catch errors with binding the index buffer + * here since OOM errors at this point indicate that nothing has yet + * been uploaded to the indices buffer which we consider to be a + * programmer error. + */ + base = _cogl_buffer_gl_bind (buffer, + COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, NULL); + buffer_offset = cogl_indices_get_offset (indices); + index_size = sizeof_index_type (cogl_indices_get_type (indices)); + + switch (cogl_indices_get_type (indices)) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + indices_gl_type = GL_UNSIGNED_BYTE; + break; + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + indices_gl_type = GL_UNSIGNED_SHORT; + break; + case COGL_INDICES_TYPE_UNSIGNED_INT: + indices_gl_type = GL_UNSIGNED_INT; + break; + } + + GE (framebuffer->context, + glDrawElements ((GLenum)mode, + n_vertices, + indices_gl_type, + base + buffer_offset + index_size * first_vertex)); + + _cogl_buffer_gl_unbind (buffer); +} + +static CoglBool +mesa_46631_slow_read_pixels_workaround (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error) +{ + CoglContext *ctx; + CoglPixelFormat format; + CoglBitmap *pbo; + int width; + int height; + CoglBool res; + uint8_t *dst; + const uint8_t *src; + + ctx = cogl_framebuffer_get_context (framebuffer); + + width = cogl_bitmap_get_width (bitmap); + height = cogl_bitmap_get_height (bitmap); + format = cogl_bitmap_get_format (bitmap); + + pbo = cogl_bitmap_new_with_size (ctx, width, height, format); + + /* Read into the pbo. We need to disable the flipping because the + blit fast path in the driver does not work with + GL_PACK_INVERT_MESA is set */ + res = _cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, + source | + COGL_READ_PIXELS_NO_FLIP, + pbo, + error); + if (!res) + { + cogl_object_unref (pbo); + return FALSE; + } + + /* Copy the pixels back into application's buffer */ + dst = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + error); + if (!dst) + { + cogl_object_unref (pbo); + return FALSE; + } + + src = _cogl_bitmap_map (pbo, + COGL_BUFFER_ACCESS_READ, + 0, /* hints */ + error); + if (src) + { + int src_rowstride = cogl_bitmap_get_rowstride (pbo); + int dst_rowstride = cogl_bitmap_get_rowstride (bitmap); + int to_copy = + _cogl_pixel_format_get_bytes_per_pixel (format) * width; + int y; + + /* If the framebuffer is onscreen we need to flip the + data while copying */ + if (!cogl_is_offscreen (framebuffer)) + { + src += src_rowstride * (height - 1); + src_rowstride = -src_rowstride; + } + + for (y = 0; y < height; y++) + { + memcpy (dst, src, to_copy); + dst += dst_rowstride; + src += src_rowstride; + } + + _cogl_bitmap_unmap (pbo); + } + else + res = FALSE; + + _cogl_bitmap_unmap (bitmap); + + cogl_object_unref (pbo); + + return res; +} + +CoglBool +_cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error) +{ + CoglContext *ctx = framebuffer->context; + int framebuffer_height = cogl_framebuffer_get_height (framebuffer); + int width = cogl_bitmap_get_width (bitmap); + int height = cogl_bitmap_get_height (bitmap); + CoglPixelFormat format = cogl_bitmap_get_format (bitmap); + CoglPixelFormat required_format; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + CoglBool pack_invert_set; + int status = FALSE; + + /* Workaround for cases where its faster to read into a temporary + * PBO. This is only worth doing if: + * + * • The GPU is an Intel GPU. In that case there is a known + * fast-path when reading into a PBO that will use the blitter + * instead of the Mesa fallback code. The driver bug will only be + * set if this is the case. + * • We're not already reading into a PBO. + * • The target format is BGRA. The fast-path blit does not get hit + * otherwise. + * • The size of the data is not trivially small. This isn't a + * requirement to hit the fast-path blit but intuitively it feels + * like if the amount of data is too small then the cost of + * allocating a PBO will outweigh the cost of temporarily + * converting the data to floats. + */ + if ((ctx->gpu.driver_bugs & + COGL_GPU_INFO_DRIVER_BUG_MESA_46631_SLOW_READ_PIXELS) && + (width > 8 || height > 8) && + (format & ~COGL_PREMULT_BIT) == COGL_PIXEL_FORMAT_BGRA_8888 && + cogl_bitmap_get_buffer (bitmap) == NULL) + { + CoglError *ignore_error = NULL; + + if (mesa_46631_slow_read_pixels_workaround (framebuffer, + x, y, + source, + bitmap, + &ignore_error)) + return TRUE; + else + cogl_error_free (ignore_error); + } + + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + + /* The y co-ordinate should be given in OpenGL's coordinate system + * so 0 is the bottom row + * + * NB: all offscreen rendering is done upside down so no conversion + * is necissary in this case. + */ + if (!cogl_is_offscreen (framebuffer)) + y = framebuffer_height - y - height; + + required_format = ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + &gl_intformat, + &gl_format, + &gl_type); + + /* NB: All offscreen rendering is done upside down so there is no need + * to flip in this case... */ + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_MESA_PACK_INVERT) && + (source & COGL_READ_PIXELS_NO_FLIP) == 0 && + !cogl_is_offscreen (framebuffer)) + { + GE (ctx, glPixelStorei (GL_PACK_INVERT_MESA, TRUE)); + pack_invert_set = TRUE; + } + else + pack_invert_set = FALSE; + + /* Under GLES only GL_RGBA with GL_UNSIGNED_BYTE as well as an + implementation specific format under + GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES and + GL_IMPLEMENTATION_COLOR_READ_TYPE_OES is supported. We could try + to be more clever and check if the requested type matches that + but we would need some reliable functions to convert from GL + types to Cogl types. For now, lets just always read in + GL_RGBA/GL_UNSIGNED_BYTE and convert if necessary. We also need + to use this intermediate buffer if the rowstride has padding + because GLES does not support setting GL_ROW_LENGTH */ + if ((!_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT) && + (gl_format != GL_RGBA || gl_type != GL_UNSIGNED_BYTE || + cogl_bitmap_get_rowstride (bitmap) != 4 * width)) || + (required_format & ~COGL_PREMULT_BIT) != (format & ~COGL_PREMULT_BIT)) + { + CoglBitmap *tmp_bmp; + CoglPixelFormat read_format; + int bpp, rowstride; + uint8_t *tmp_data; + CoglBool succeeded; + + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT)) + read_format = required_format; + else + { + read_format = COGL_PIXEL_FORMAT_RGBA_8888; + gl_format = GL_RGBA; + gl_type = GL_UNSIGNED_BYTE; + } + + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (read_format)) + read_format = ((read_format & ~COGL_PREMULT_BIT) | + (framebuffer->internal_format & COGL_PREMULT_BIT)); + + tmp_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + read_format, + error); + if (!tmp_bmp) + goto EXIT; + + bpp = _cogl_pixel_format_get_bytes_per_pixel (read_format); + rowstride = cogl_bitmap_get_rowstride (tmp_bmp); + + ctx->texture_driver->prep_gl_for_pixels_download (ctx, + rowstride, + width, + bpp); + + /* Note: we don't worry about catching errors here since we know + * we won't be lazily allocating storage for this buffer so it + * won't fail due to lack of memory. */ + tmp_data = _cogl_bitmap_gl_bind (tmp_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD, + NULL); + + GE( ctx, glReadPixels (x, y, width, height, + gl_format, gl_type, + tmp_data) ); + + _cogl_bitmap_gl_unbind (tmp_bmp); + + succeeded = _cogl_bitmap_convert_into_bitmap (tmp_bmp, bitmap, error); + + cogl_object_unref (tmp_bmp); + + if (!succeeded) + goto EXIT; + } + else + { + CoglBitmap *shared_bmp; + CoglPixelFormat bmp_format; + int bpp, rowstride; + CoglBool succeeded = FALSE; + uint8_t *pixels; + CoglError *internal_error = NULL; + + rowstride = cogl_bitmap_get_rowstride (bitmap); + + /* We match the premultiplied state of the target buffer to the + * premultiplied state of the framebuffer so that it will get + * converted to the right format below */ + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + bmp_format = ((format & ~COGL_PREMULT_BIT) | + (framebuffer->internal_format & COGL_PREMULT_BIT)); + else + bmp_format = format; + + if (bmp_format != format) + shared_bmp = _cogl_bitmap_new_shared (bitmap, + bmp_format, + width, height, + rowstride); + else + shared_bmp = cogl_object_ref (bitmap); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (bmp_format); + + ctx->texture_driver->prep_gl_for_pixels_download (ctx, + rowstride, + width, + bpp); + + pixels = _cogl_bitmap_gl_bind (shared_bmp, + COGL_BUFFER_ACCESS_WRITE, + 0, /* hints */ + &internal_error); + /* NB: _cogl_bitmap_gl_bind() can return NULL in sucessfull + * cases so we have to explicitly check the cogl error pointer + * to know if there was a problem */ + if (internal_error) + { + cogl_object_unref (shared_bmp); + _cogl_propagate_error (error, internal_error); + goto EXIT; + } + + GE( ctx, glReadPixels (x, y, + width, height, + gl_format, gl_type, + pixels) ); + + _cogl_bitmap_gl_unbind (shared_bmp); + + /* Convert to the premult format specified by the caller + in-place. This will do nothing if the premult status is already + correct. */ + if (_cogl_bitmap_convert_premult_status (shared_bmp, format, error)) + succeeded = TRUE; + + cogl_object_unref (shared_bmp); + + if (!succeeded) + goto EXIT; + } + + /* NB: All offscreen rendering is done upside down so there is no need + * to flip in this case... */ + if (!cogl_is_offscreen (framebuffer) && + (source & COGL_READ_PIXELS_NO_FLIP) == 0 && + !pack_invert_set) + { + uint8_t *temprow; + int rowstride; + uint8_t *pixels; + + rowstride = cogl_bitmap_get_rowstride (bitmap); + pixels = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_READ | + COGL_BUFFER_ACCESS_WRITE, + 0, /* hints */ + error); + + if (pixels == NULL) + goto EXIT; + + temprow = g_alloca (rowstride * sizeof (uint8_t)); + + /* vertically flip the buffer in-place */ + for (y = 0; y < height / 2; y++) + { + if (y != height - y - 1) /* skip center row */ + { + memcpy (temprow, + pixels + y * rowstride, rowstride); + memcpy (pixels + y * rowstride, + pixels + (height - y - 1) * rowstride, rowstride); + memcpy (pixels + (height - y - 1) * rowstride, + temprow, + rowstride); + } + } + + _cogl_bitmap_unmap (bitmap); + } + + status = TRUE; + +EXIT: + + /* Currently this function owns the pack_invert state and we don't want this + * to interfere with other Cogl components so all other code can assume that + * we leave the pack_invert state off. */ + if (pack_invert_set) + GE (ctx, glPixelStorei (GL_PACK_INVERT_MESA, FALSE)); + + return status; +} diff --git a/cogl/driver/gl/cogl-pipeline-fragend-fixed-private.h b/cogl/driver/gl/cogl-pipeline-fragend-fixed-private.h new file mode 100644 index 0000000..6f259f9 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-fragend-fixed-private.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H +#define __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineFragend _cogl_pipeline_fixed_fragend; + +#endif /* __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c new file mode 100644 index 0000000..7e461f9 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c @@ -0,0 +1,432 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-pipeline-opengl-private.h" + +#ifdef COGL_PIPELINE_FRAGEND_FIXED + +#include "cogl-context-private.h" +#include "cogl-object-private.h" + +#include "cogl-texture-private.h" +#include "cogl-blend-string.h" +#include "cogl-profile.h" +#include "cogl-program-private.h" + +#include +#include +#include + +#ifndef GL_TEXTURE_RECTANGLE_ARB +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#endif + +const CoglPipelineFragend _cogl_pipeline_fixed_fragend; + +static void +_cogl_disable_texture_unit (int unit_index) +{ + CoglTextureUnit *unit; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + unit = &g_array_index (ctx->texture_units, CoglTextureUnit, unit_index); + + if (unit->enabled_gl_target) + { + _cogl_set_active_texture_unit (unit_index); + GE (ctx, glDisable (unit->enabled_gl_target)); + unit->enabled_gl_target = 0; + } +} + +static int +get_max_texture_units (void) +{ + _COGL_GET_CONTEXT (ctx, 0); + + /* This function is called quite often so we cache the value to + avoid too many GL calls */ + if (ctx->max_texture_units == -1) + { + ctx->max_texture_units = 1; + GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_UNITS, + &ctx->max_texture_units)); + } + + return ctx->max_texture_units; +} + +static void +_cogl_pipeline_fragend_fixed_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference) +{ + _cogl_use_fragment_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED); +} + +static void +translate_sources (CoglPipeline *pipeline, + int n_sources, + CoglPipelineCombineSource *source_in, + GLenum *source_out) +{ + int i; + + /* The texture source numbers specified in the layer combine are the + layer numbers so we need to map these to unit indices */ + + for (i = 0; i < n_sources; i++) + switch (source_in[i]) + { + case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE: + source_out[i] = GL_TEXTURE; + break; + + case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT: + source_out[i] = GL_CONSTANT; + break; + + case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR: + source_out[i] = GL_PRIMARY_COLOR; + break; + + case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS: + source_out[i] = GL_PREVIOUS; + break; + + default: + { + int layer_num = source_in[i] - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0; + CoglPipelineGetLayerFlags flags = COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *layer = + _cogl_pipeline_get_layer_with_flags (pipeline, layer_num, flags); + + if (layer == NULL) + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + { + g_warning ("The application is trying to use a texture " + "combine with a layer number that does not exist"); + warning_seen = TRUE; + } + source_out[i] = GL_PREVIOUS; + } + else + source_out[i] = (_cogl_pipeline_layer_get_unit_index (layer) + + GL_TEXTURE0); + } + } +} + +static CoglBool +_cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference) +{ + CoglTextureUnit *unit = + _cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer)); + int unit_index = unit->index; + int n_rgb_func_args; + int n_alpha_func_args; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* XXX: Beware that since we are changing the active texture unit we + * must make sure we don't call into other Cogl components that may + * temporarily bind texture objects to query/modify parameters since + * they will end up binding texture unit 1. See + * _cogl_bind_gl_texture_transient for more details. + */ + _cogl_set_active_texture_unit (unit_index); + + if (G_UNLIKELY (unit_index >= get_max_texture_units ())) + { + _cogl_disable_texture_unit (unit_index); + /* TODO: although this isn't considered an error that + * warrants falling back to a different backend we + * should print a warning here. */ + return TRUE; + } + + /* Handle enabling or disabling the right texture type */ + if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE) + { + CoglTextureType texture_type = + _cogl_pipeline_layer_get_texture_type (layer); + GLenum gl_target; + + switch (texture_type) + { + case COGL_TEXTURE_TYPE_2D: + gl_target = GL_TEXTURE_2D; + break; + + case COGL_TEXTURE_TYPE_3D: + gl_target = GL_TEXTURE_3D; + break; + + case COGL_TEXTURE_TYPE_RECTANGLE: + gl_target = GL_TEXTURE_RECTANGLE_ARB; + break; + } + + _cogl_set_active_texture_unit (unit_index); + + /* The common GL code handles binding the right texture so we + just need to handle enabling and disabling it */ + + if (unit->enabled_gl_target != gl_target) + { + /* Disable the previous target if it's still enabled */ + if (unit->enabled_gl_target) + GE (ctx, glDisable (unit->enabled_gl_target)); + + /* Enable the new target */ + if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING))) + { + GE (ctx, glEnable (gl_target)); + unit->enabled_gl_target = gl_target; + } + } + } + else + { + /* Even though there may be no difference between the last flushed + * texture state and the current layers texture state it may be that the + * texture unit has been disabled for some time so we need to assert that + * it's enabled now. + */ + if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)) && + unit->enabled_gl_target == 0) + { + _cogl_set_active_texture_unit (unit_index); + GE (ctx, glEnable (unit->gl_target)); + unit->enabled_gl_target = unit->gl_target; + } + } + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE) + { + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_COMBINE); + CoglPipelineLayerBigState *big_state = authority->big_state; + GLenum sources[3]; + + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE)); + + /* Set the combiner functions... */ + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, + GL_COMBINE_RGB, + big_state->texture_combine_rgb_func)); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, + GL_COMBINE_ALPHA, + big_state->texture_combine_alpha_func)); + + /* + * Setup the function arguments... + */ + + /* For the RGB components... */ + n_rgb_func_args = + _cogl_get_n_args_for_combine_func (big_state->texture_combine_rgb_func); + + translate_sources (pipeline, + n_rgb_func_args, + big_state->texture_combine_rgb_src, + sources); + + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, + sources[0])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, + big_state->texture_combine_rgb_op[0])); + if (n_rgb_func_args > 1) + { + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_RGB, + sources[1])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB, + big_state->texture_combine_rgb_op[1])); + } + if (n_rgb_func_args > 2) + { + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC2_RGB, + sources[2])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_RGB, + big_state->texture_combine_rgb_op[2])); + } + + /* For the Alpha component */ + n_alpha_func_args = + _cogl_get_n_args_for_combine_func (big_state->texture_combine_alpha_func); + + translate_sources (pipeline, + n_alpha_func_args, + big_state->texture_combine_alpha_src, + sources); + + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, + sources[0])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, + big_state->texture_combine_alpha_op[0])); + if (n_alpha_func_args > 1) + { + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, + sources[1])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, + big_state->texture_combine_alpha_op[1])); + } + if (n_alpha_func_args > 2) + { + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC2_ALPHA, + sources[2])); + GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, + big_state->texture_combine_alpha_op[2])); + } + } + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT) + { + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority + (layer, COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT); + CoglPipelineLayerBigState *big_state = authority->big_state; + + GE (ctx, glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, + big_state->texture_combine_constant)); + } + + return TRUE; +} + +static CoglBool +get_highest_unit_index_cb (CoglPipelineLayer *layer, + void *user_data) +{ + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + int *highest_index = user_data; + + *highest_index = unit_index; + + return TRUE; +} + +static CoglBool +_cogl_pipeline_fragend_fixed_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + int highest_unit_index = -1; + int i; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _cogl_pipeline_foreach_layer_internal (pipeline, + get_highest_unit_index_cb, + &highest_unit_index); + + /* Disable additional texture units that may have previously been in use.. */ + for (i = highest_unit_index + 1; i < ctx->texture_units->len; i++) + _cogl_disable_texture_unit (i); + + if (pipelines_difference & COGL_PIPELINE_STATE_FOG) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG); + CoglPipelineFogState *fog_state = &authority->big_state->fog_state; + + if (fog_state->enabled) + { + GLfloat fogColor[4]; + GLenum gl_mode = GL_LINEAR; + + fogColor[0] = cogl_color_get_red_float (&fog_state->color); + fogColor[1] = cogl_color_get_green_float (&fog_state->color); + fogColor[2] = cogl_color_get_blue_float (&fog_state->color); + fogColor[3] = cogl_color_get_alpha_float (&fog_state->color); + + GE (ctx, glEnable (GL_FOG)); + + GE (ctx, glFogfv (GL_FOG_COLOR, fogColor)); + + if (ctx->driver == COGL_DRIVER_GLES1) + switch (fog_state->mode) + { + case COGL_FOG_MODE_LINEAR: + gl_mode = GL_LINEAR; + break; + case COGL_FOG_MODE_EXPONENTIAL: + gl_mode = GL_EXP; + break; + case COGL_FOG_MODE_EXPONENTIAL_SQUARED: + gl_mode = GL_EXP2; + break; + } + /* TODO: support other modes for GLES2 */ + + /* NB: GLES doesn't have glFogi */ + GE (ctx, glFogf (GL_FOG_MODE, gl_mode)); + GE (ctx, glHint (GL_FOG_HINT, GL_NICEST)); + + GE (ctx, glFogf (GL_FOG_DENSITY, fog_state->density)); + GE (ctx, glFogf (GL_FOG_START, fog_state->z_near)); + GE (ctx, glFogf (GL_FOG_END, fog_state->z_far)); + } + else + GE (ctx, glDisable (GL_FOG)); + } + + return TRUE; +} + +const CoglPipelineFragend _cogl_pipeline_fixed_fragend = +{ + _cogl_pipeline_fragend_fixed_start, + _cogl_pipeline_fragend_fixed_add_layer, + NULL, /* passthrough */ + _cogl_pipeline_fragend_fixed_end, + NULL, /* pipeline_change_notify */ + NULL, /* pipeline_set_parent_notify */ + NULL, /* layer_change_notify */ +}; + +#endif /* COGL_PIPELINE_FRAGEND_FIXED */ + diff --git a/cogl/driver/gl/cogl-pipeline-fragend-glsl-private.h b/cogl/driver/gl/cogl-pipeline-fragend-glsl-private.h new file mode 100644 index 0000000..72f5928 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-fragend-glsl-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H +#define __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineFragend _cogl_pipeline_glsl_fragend; + +GLuint +_cogl_pipeline_fragend_glsl_get_shader (CoglPipeline *pipeline); + +#endif /* __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c new file mode 100644 index 0000000..6fdb3a1 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c @@ -0,0 +1,1149 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-layer-private.h" +#include "cogl-blend-string.h" +#include "cogl-snippet-private.h" +#include "cogl-list.h" + +#ifdef COGL_PIPELINE_FRAGEND_GLSL + +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-shader-private.h" +#include "cogl-program-private.h" +#include "cogl-pipeline-cache.h" +#include "cogl-pipeline-fragend-glsl-private.h" +#include "cogl-glsl-shader-private.h" + +#include + +/* + * GL/GLES compatability defines for pipeline thingies: + */ + +/* This might not be defined on GLES */ +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif + +const CoglPipelineFragend _cogl_pipeline_glsl_backend; + +typedef struct _UnitState +{ + unsigned int sampled:1; + unsigned int combine_constant_used:1; +} UnitState; + +typedef struct _LayerData +{ + CoglList link; + + /* Layer index for the for the previous layer. This isn't + necessarily the same as this layer's index - 1 because the + indices can have gaps. If this is the first layer then it will be + -1 */ + int previous_layer_index; + + CoglPipelineLayer *layer; +} LayerData; + +typedef struct +{ + int ref_count; + + GLuint gl_shader; + GString *header, *source; + UnitState *unit_state; + + /* List of layers that we haven't generated code for yet. These are + in reverse order. As soon as we're about to generate code for + layer we'll remove it from the list so we don't generate it + again */ + CoglList layers; + + CoglPipelineCacheEntry *cache_entry; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static void +ensure_layer_generated (CoglPipeline *pipeline, + int layer_num); + +static CoglPipelineShaderState * +shader_state_new (int n_layers, + CoglPipelineCacheEntry *cache_entry) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + shader_state->unit_state = g_new0 (UnitState, n_layers); + shader_state->cache_entry = cache_entry; + + return shader_state; +} + +static CoglPipelineShaderState * +get_shader_state (CoglPipeline *pipeline) +{ + return cogl_object_get_user_data (COGL_OBJECT (pipeline), &shader_state_key); +} + +static void +destroy_shader_state (void *user_data, + void *instance) +{ + CoglPipelineShaderState *shader_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != instance) + shader_state->cache_entry->usage_count--; + + if (--shader_state->ref_count == 0) + { + if (shader_state->gl_shader) + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + + g_free (shader_state->unit_state); + + g_slice_free (CoglPipelineShaderState, shader_state); + } +} + +static void +set_shader_state (CoglPipeline *pipeline, CoglPipelineShaderState *shader_state) +{ + if (shader_state) + { + shader_state->ref_count++; + + /* If we're not setting the state on the template pipeline then + * mark it as a usage of the pipeline cache entry */ + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != pipeline) + shader_state->cache_entry->usage_count++; + } + + _cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + shader_state, + destroy_shader_state); +} + +static void +dirty_shader_state (CoglPipeline *pipeline) +{ + cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + NULL, + NULL); +} + +GLuint +_cogl_pipeline_fragend_glsl_get_shader (CoglPipeline *pipeline) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + + if (shader_state) + return shader_state->gl_shader; + else + return 0; +} + +static CoglPipelineSnippetList * +get_fragment_snippets (CoglPipeline *pipeline) +{ + pipeline = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + + return &pipeline->big_state->fragment_snippets; +} + +static CoglPipelineSnippetList * +get_layer_fragment_snippets (CoglPipelineLayer *layer) +{ + unsigned long state = COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS; + layer = _cogl_pipeline_layer_get_authority (layer, state); + + return &layer->big_state->fragment_snippets; +} + +static CoglBool +has_replace_hook (CoglPipelineLayer *layer, + CoglSnippetHook hook) +{ + GList *l; + + for (l = get_layer_fragment_snippets (layer)->entries; l; l = l->next) + { + CoglSnippet *snippet = l->data; + + if (snippet->hook == hook && snippet->replace) + return TRUE; + } + + return FALSE; +} + +static CoglBool +add_layer_declaration_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineShaderState *shader_state = user_data; + CoglTextureType texture_type = + _cogl_pipeline_layer_get_texture_type (layer); + const char *target_string; + + _cogl_gl_util_get_texture_target_string (texture_type, &target_string, NULL); + + g_string_append_printf (shader_state->header, + "uniform sampler%s cogl_sampler%i;\n", + target_string, + layer->index); + + return TRUE; +} + +static void +add_layer_declarations (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + /* We always emit sampler uniforms in case there will be custom + * layer snippets that want to sample arbitrary layers. */ + + _cogl_pipeline_foreach_layer_internal (pipeline, + add_layer_declaration_cb, + shader_state); +} + +static void +add_global_declarations (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + CoglSnippetHook hook = COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS; + CoglPipelineSnippetList *snippets = get_fragment_snippets (pipeline); + + /* Add the global data hooks. All of the code in these snippets is + * always added and only the declarations data is used */ + + _cogl_pipeline_snippet_generate_declarations (shader_state->header, + hook, + snippets); +} + +static void +_cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state; + CoglPipeline *authority; + CoglPipelineCacheEntry *cache_entry = NULL; + CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline); + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Now lookup our glsl backend private state */ + shader_state = get_shader_state (pipeline); + + if (shader_state == NULL) + { + /* If we don't have an associated glsl shader yet then find the + * glsl-authority (the oldest ancestor whose state will result in + * the same shader being generated as for this pipeline). + * + * We always make sure to associate new shader with the + * glsl-authority to maximize the chance that other pipelines can + * share it. + */ + authority = _cogl_pipeline_find_equivalent_parent + (pipeline, + _cogl_pipeline_get_state_for_fragment_codegen (ctx) & + ~COGL_PIPELINE_STATE_LAYERS, + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx)); + + shader_state = get_shader_state (authority); + + /* If we don't have an existing program associated with the + * glsl-authority then start generating code for a new shader... + */ + if (shader_state == NULL) + { + /* Check if there is already a similar cached pipeline whose + shader state we can share */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED + (COGL_DEBUG_DISABLE_PROGRAM_CACHES)))) + { + cache_entry = + _cogl_pipeline_cache_get_fragment_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (cache_entry->pipeline); + } + + if (shader_state) + shader_state->ref_count++; + else + shader_state = shader_state_new (n_layers, cache_entry); + + set_shader_state (authority, shader_state); + + shader_state->ref_count--; + + if (cache_entry) + set_shader_state (cache_entry->pipeline, shader_state); + } + + /* If the pipeline isn't actually its own glsl-authority + * then take a reference to the program state associated + * with the glsl-authority... */ + if (authority != pipeline) + set_shader_state (pipeline, shader_state); + } + + if (user_program) + { + /* If the user program contains a fragment shader then we don't need + to generate one */ + if (_cogl_program_has_fragment_shader (user_program)) + { + if (shader_state->gl_shader) + { + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + shader_state->gl_shader = 0; + } + return; + } + } + + if (shader_state->gl_shader) + return; + + /* If we make it here then we have a glsl_shader_state struct + without a gl_shader either because this is the first time we've + encountered it or because the user program has changed */ + + /* We reuse two grow-only GStrings for code-gen. One string + contains the uniform and attribute declarations while the + other contains the main function. We need two strings + because we need to dynamically declare attributes as the + add_layer callback is invoked */ + g_string_set_size (ctx->codegen_header_buffer, 0); + g_string_set_size (ctx->codegen_source_buffer, 0); + shader_state->header = ctx->codegen_header_buffer; + shader_state->source = ctx->codegen_source_buffer; + _cogl_list_init (&shader_state->layers); + + add_layer_declarations (pipeline, shader_state); + add_global_declarations (pipeline, shader_state); + + g_string_append (shader_state->source, + "void\n" + "cogl_generated_source ()\n" + "{\n"); + + for (i = 0; i < n_layers; i++) + { + shader_state->unit_state[i].sampled = FALSE; + shader_state->unit_state[i].combine_constant_used = FALSE; + } +} + +static void +add_constant_lookup (CoglPipelineShaderState *shader_state, + CoglPipeline *pipeline, + CoglPipelineLayer *layer, + const char *swizzle) +{ + g_string_append_printf (shader_state->header, + "_cogl_layer_constant_%i.%s", + layer->index, swizzle); +} + +static void +ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state, + CoglPipeline *pipeline, + CoglPipelineLayer *layer) +{ + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + CoglPipelineSnippetData snippet_data; + CoglTextureType texture_type; + const char *target_string, *tex_coord_swizzle; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (shader_state->unit_state[unit_index].sampled) + return; + + texture_type = + _cogl_pipeline_layer_get_texture_type (layer); + _cogl_gl_util_get_texture_target_string (texture_type, + &target_string, + &tex_coord_swizzle); + + shader_state->unit_state[unit_index].sampled = TRUE; + + g_string_append_printf (shader_state->header, + "vec4 cogl_texel%i;\n", + layer->index); + + g_string_append_printf (shader_state->source, + " cogl_texel%i = cogl_texture_lookup%i (" + "cogl_sampler%i, ", + layer->index, + layer->index, + layer->index); + + if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline, + layer->index)) + g_string_append_printf (shader_state->source, + "vec4 (cogl_point_coord, 0.0, 1.0)"); + else + g_string_append_printf (shader_state->source, + "cogl_tex_coord%i_in", + layer->index); + + g_string_append (shader_state->source, ");\n"); + + /* There's no need to generate the real texture lookup if it's going + to be replaced */ + if (!has_replace_hook (layer, COGL_SNIPPET_HOOK_TEXTURE_LOOKUP)) + { + g_string_append_printf (shader_state->header, + "vec4\n" + "cogl_real_texture_lookup%i (sampler%s tex,\n" + " vec4 coords)\n" + "{\n" + " return ", + layer->index, + target_string); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING))) + g_string_append (shader_state->header, + "vec4 (1.0, 1.0, 1.0, 1.0);\n"); + else + g_string_append_printf (shader_state->header, + "texture%s (tex, coords.%s);\n", + target_string, tex_coord_swizzle); + + g_string_append (shader_state->header, "}\n"); + } + + /* Wrap the texture lookup in any snippets that have been hooked */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = get_layer_fragment_snippets (layer); + snippet_data.hook = COGL_SNIPPET_HOOK_TEXTURE_LOOKUP; + snippet_data.chain_function = g_strdup_printf ("cogl_real_texture_lookup%i", + layer->index); + snippet_data.final_name = g_strdup_printf ("cogl_texture_lookup%i", + layer->index); + snippet_data.function_prefix = g_strdup_printf ("cogl_texture_lookup_hook%i", + layer->index); + snippet_data.return_type = "vec4"; + snippet_data.return_variable = "cogl_texel"; + snippet_data.arguments = "cogl_sampler, cogl_tex_coord"; + snippet_data.argument_declarations = + g_strdup_printf ("sampler%s cogl_sampler, vec4 cogl_tex_coord", + target_string); + snippet_data.source_buf = shader_state->header; + + _cogl_pipeline_snippet_generate_code (&snippet_data); + + g_free ((char *) snippet_data.chain_function); + g_free ((char *) snippet_data.final_name); + g_free ((char *) snippet_data.function_prefix); + g_free ((char *) snippet_data.argument_declarations); +} + +static void +add_arg (CoglPipelineShaderState *shader_state, + CoglPipeline *pipeline, + CoglPipelineLayer *layer, + int previous_layer_index, + CoglPipelineCombineSource src, + CoglPipelineCombineOp operand, + const char *swizzle) +{ + GString *shader_source = shader_state->header; + char alpha_swizzle[5] = "aaaa"; + + g_string_append_c (shader_source, '('); + + if (operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR || + operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA) + g_string_append_printf (shader_source, + "vec4(1.0, 1.0, 1.0, 1.0).%s - ", + swizzle); + + /* If the operand is reading from the alpha then replace the swizzle + with the same number of copies of the alpha */ + if (operand == COGL_PIPELINE_COMBINE_OP_SRC_ALPHA || + operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA) + { + alpha_swizzle[strlen (swizzle)] = '\0'; + swizzle = alpha_swizzle; + } + + switch (src) + { + case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE: + g_string_append_printf (shader_source, + "cogl_texel%i.%s", + layer->index, + swizzle); + break; + + case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT: + add_constant_lookup (shader_state, + pipeline, + layer, + swizzle); + break; + + case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS: + if (previous_layer_index >= 0) + { + g_string_append_printf (shader_source, + "cogl_layer%i.%s", + previous_layer_index, + swizzle); + break; + } + /* flow through */ + case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR: + g_string_append_printf (shader_source, "cogl_color_in.%s", swizzle); + break; + + default: + { + int layer_num = src - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0; + CoglPipelineGetLayerFlags flags = COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *other_layer = + _cogl_pipeline_get_layer_with_flags (pipeline, layer_num, flags); + + if (other_layer == NULL) + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + { + g_warning ("The application is trying to use a texture " + "combine with a layer number that does not exist"); + warning_seen = TRUE; + } + g_string_append_printf (shader_source, + "vec4 (1.0, 1.0, 1.0, 1.0).%s", + swizzle); + } + else + g_string_append_printf (shader_source, + "cogl_texel%i.%s", + other_layer->index, + swizzle); + } + break; + } + + g_string_append_c (shader_source, ')'); +} + +static void +ensure_arg_generated (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + int previous_layer_index, + CoglPipelineCombineSource src) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + + switch (src) + { + case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR: + /* This doesn't involve any other layers */ + break; + + case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT: + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + /* Create a sampler uniform for this layer if we haven't already */ + if (!shader_state->unit_state[unit_index].combine_constant_used) + { + g_string_append_printf (shader_state->header, + "uniform vec4 _cogl_layer_constant_%i;\n", + layer->index); + shader_state->unit_state[unit_index].combine_constant_used = TRUE; + } + } + break; + + case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS: + if (previous_layer_index >= 0) + ensure_layer_generated (pipeline, previous_layer_index); + break; + + case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE: + ensure_texture_lookup_generated (shader_state, + pipeline, + layer); + break; + + default: + if (src >= COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0) + { + int layer_num = src - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0; + CoglPipelineGetLayerFlags flags = COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *other_layer = + _cogl_pipeline_get_layer_with_flags (pipeline, layer_num, flags); + + if (other_layer) + ensure_texture_lookup_generated (shader_state, + pipeline, + other_layer); + } + break; + } +} + +static void +ensure_args_for_func (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + int previous_layer_index, + CoglPipelineCombineFunc function, + CoglPipelineCombineSource *src) +{ + int n_args = _cogl_get_n_args_for_combine_func (function); + int i; + + for (i = 0; i < n_args; i++) + ensure_arg_generated (pipeline, layer, previous_layer_index, src[i]); +} + +static void +append_masked_combine (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + int previous_layer_index, + const char *swizzle, + CoglPipelineCombineFunc function, + CoglPipelineCombineSource *src, + CoglPipelineCombineOp *op) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + GString *shader_source = shader_state->header; + + g_string_append_printf (shader_state->header, + " cogl_layer.%s = ", + swizzle); + + switch (function) + { + case COGL_PIPELINE_COMBINE_FUNC_REPLACE: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + break; + + case COGL_PIPELINE_COMBINE_FUNC_MODULATE: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + g_string_append (shader_source, " * "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], swizzle); + break; + + case COGL_PIPELINE_COMBINE_FUNC_ADD: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + g_string_append (shader_source, " + "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], swizzle); + break; + + case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + g_string_append (shader_source, " + "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], swizzle); + g_string_append_printf (shader_source, + " - vec4(0.5, 0.5, 0.5, 0.5).%s", + swizzle); + break; + + case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + g_string_append (shader_source, " - "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], swizzle); + break; + + case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE: + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], swizzle); + g_string_append (shader_source, " * "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[2], op[2], swizzle); + g_string_append (shader_source, " + "); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], swizzle); + g_string_append_printf (shader_source, + " * (vec4(1.0, 1.0, 1.0, 1.0).%s - ", + swizzle); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[2], op[2], swizzle); + g_string_append_c (shader_source, ')'); + break; + + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB: + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA: + g_string_append (shader_source, "vec4(4.0 * (("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], "r"); + g_string_append (shader_source, " - 0.5) * ("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], "r"); + g_string_append (shader_source, " - 0.5) + ("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], "g"); + g_string_append (shader_source, " - 0.5) * ("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], "g"); + g_string_append (shader_source, " - 0.5) + ("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[0], op[0], "b"); + g_string_append (shader_source, " - 0.5) * ("); + add_arg (shader_state, pipeline, layer, previous_layer_index, + src[1], op[1], "b"); + g_string_append_printf (shader_source, " - 0.5))).%s", swizzle); + break; + } + + g_string_append_printf (shader_source, ";\n"); +} + +static void +ensure_layer_generated (CoglPipeline *pipeline, + int layer_index) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + CoglPipelineLayer *combine_authority; + CoglPipelineLayerBigState *big_state; + CoglPipelineLayer *layer; + CoglPipelineSnippetData snippet_data; + LayerData *layer_data; + + /* Find the layer that corresponds to this layer_num */ + _cogl_list_for_each (layer_data, &shader_state->layers, link) + { + layer = layer_data->layer; + + if (layer->index == layer_index) + goto found; + } + + /* If we didn't find it then we can assume the layer has already + been generated */ + return; + + found: + + /* Remove the layer from the list so we don't generate it again */ + _cogl_list_remove (&layer_data->link); + + combine_authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_COMBINE); + big_state = combine_authority->big_state; + + /* Make a global variable for the result of the layer code */ + g_string_append_printf (shader_state->header, + "vec4 cogl_layer%i;\n", + layer_index); + + /* Skip the layer generation if there is a snippet that replaces the + default layer code. This is important because generating this + code may cause the code for other layers to be generated and + stored in the global variable. If this code isn't actually used + then the global variables would be uninitialised and they may be + used from other layers */ + if (!has_replace_hook (layer, COGL_SNIPPET_HOOK_LAYER_FRAGMENT)) + { + ensure_args_for_func (pipeline, + layer, + layer_data->previous_layer_index, + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src); + ensure_args_for_func (pipeline, + layer, + layer_data->previous_layer_index, + big_state->texture_combine_alpha_func, + big_state->texture_combine_alpha_src); + + g_string_append_printf (shader_state->header, + "vec4\n" + "cogl_real_generate_layer%i ()\n" + "{\n" + " vec4 cogl_layer;\n", + layer_index); + + if (!_cogl_pipeline_layer_needs_combine_separate (combine_authority) || + /* GL_DOT3_RGBA Is a bit weird as a GL_COMBINE_RGB function + * since if you use it, it overrides your ALPHA function... + */ + big_state->texture_combine_rgb_func == + COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA) + append_masked_combine (pipeline, + layer, + layer_data->previous_layer_index, + "rgba", + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src, + big_state->texture_combine_rgb_op); + else + { + append_masked_combine (pipeline, + layer, + layer_data->previous_layer_index, + "rgb", + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src, + big_state->texture_combine_rgb_op); + append_masked_combine (pipeline, + layer, + layer_data->previous_layer_index, + "a", + big_state->texture_combine_alpha_func, + big_state->texture_combine_alpha_src, + big_state->texture_combine_alpha_op); + } + + g_string_append (shader_state->header, + " return cogl_layer;\n" + "}\n"); + } + + /* Wrap the layer code in any snippets that have been hooked */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = get_layer_fragment_snippets (layer); + snippet_data.hook = COGL_SNIPPET_HOOK_LAYER_FRAGMENT; + snippet_data.chain_function = g_strdup_printf ("cogl_real_generate_layer%i", + layer_index); + snippet_data.final_name = g_strdup_printf ("cogl_generate_layer%i", + layer_index); + snippet_data.function_prefix = g_strdup_printf ("cogl_generate_layer%i", + layer_index); + snippet_data.return_type = "vec4"; + snippet_data.return_variable = "cogl_layer"; + snippet_data.source_buf = shader_state->header; + + _cogl_pipeline_snippet_generate_code (&snippet_data); + + g_free ((char *) snippet_data.chain_function); + g_free ((char *) snippet_data.final_name); + g_free ((char *) snippet_data.function_prefix); + + g_string_append_printf (shader_state->source, + " cogl_layer%i = cogl_generate_layer%i ();\n", + layer_index, + layer_index); + + g_slice_free (LayerData, layer_data); +} + +static CoglBool +_cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + LayerData *layer_data; + + if (!shader_state->source) + return TRUE; + + /* Store the layers in reverse order */ + layer_data = g_slice_new (LayerData); + layer_data->layer = layer; + + if (_cogl_list_empty (&shader_state->layers)) + { + layer_data->previous_layer_index = -1; + } + else + { + LayerData *first = + _cogl_container_of (shader_state->layers.next, LayerData, link); + layer_data->previous_layer_index = first->layer->index; + } + + _cogl_list_insert (&shader_state->layers, &layer_data->link); + + return TRUE; +} + +/* GLES2 and GL3 don't have alpha testing so we need to implement it + in the shader */ + +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + +static void +add_alpha_test_snippet (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + CoglPipelineAlphaFunc alpha_func; + + alpha_func = cogl_pipeline_get_alpha_test_function (pipeline); + + if (alpha_func == COGL_PIPELINE_ALPHA_FUNC_ALWAYS) + /* Do nothing */ + return; + + if (alpha_func == COGL_PIPELINE_ALPHA_FUNC_NEVER) + { + /* Always discard the fragment */ + g_string_append (shader_state->source, + " discard;\n"); + return; + } + + /* For all of the other alpha functions we need a uniform for the + reference */ + + g_string_append (shader_state->header, + "uniform float _cogl_alpha_test_ref;\n"); + + g_string_append (shader_state->source, + " if (cogl_color_out.a "); + + switch (alpha_func) + { + case COGL_PIPELINE_ALPHA_FUNC_LESS: + g_string_append (shader_state->source, ">="); + break; + case COGL_PIPELINE_ALPHA_FUNC_EQUAL: + g_string_append (shader_state->source, "!="); + break; + case COGL_PIPELINE_ALPHA_FUNC_LEQUAL: + g_string_append (shader_state->source, ">"); + break; + case COGL_PIPELINE_ALPHA_FUNC_GREATER: + g_string_append (shader_state->source, "<="); + break; + case COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL: + g_string_append (shader_state->source, "=="); + break; + case COGL_PIPELINE_ALPHA_FUNC_GEQUAL: + g_string_append (shader_state->source, "< "); + break; + + case COGL_PIPELINE_ALPHA_FUNC_ALWAYS: + case COGL_PIPELINE_ALPHA_FUNC_NEVER: + g_assert_not_reached (); + break; + } + + g_string_append (shader_state->source, + " _cogl_alpha_test_ref)\n discard;\n"); +} + +#endif /* HAVE_COGL_GLES2 */ + +static CoglBool +_cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (shader_state->source) + { + const char *source_strings[2]; + GLint lengths[2]; + GLint compile_status; + GLuint shader; + CoglPipelineSnippetData snippet_data; + + COGL_STATIC_COUNTER (fragend_glsl_compile_counter, + "glsl fragment compile counter", + "Increments each time a new GLSL " + "fragment shader is compiled", + 0 /* no application private data */); + COGL_COUNTER_INC (_cogl_uprof_context, fragend_glsl_compile_counter); + + /* We only need to generate code to calculate the fragment value + for the last layer. If the value of this layer depends on any + previous layers then it will recursively generate the code + for those layers */ + if (!_cogl_list_empty (&shader_state->layers)) + { + CoglPipelineLayer *last_layer; + LayerData *layer_data, *tmp; + + layer_data = _cogl_container_of (shader_state->layers.next, + LayerData, + link); + last_layer = layer_data->layer; + + ensure_layer_generated (pipeline, last_layer->index); + g_string_append_printf (shader_state->source, + " cogl_color_out = cogl_layer%i;\n", + last_layer->index); + + _cogl_list_for_each_safe (layer_data, + tmp, + &shader_state->layers, + link) + g_slice_free (LayerData, layer_data); + } + else + g_string_append (shader_state->source, + " cogl_color_out = cogl_color_in;\n"); + +#if defined(HAVE_COGL_GLES2) || defined (HAVE_COGL_GL) + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST)) + add_alpha_test_snippet (pipeline, shader_state); +#endif + + /* Close the function surrounding the generated fragment processing */ + g_string_append (shader_state->source, "}\n"); + + /* Add all of the hooks for fragment processing */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = get_fragment_snippets (pipeline); + snippet_data.hook = COGL_SNIPPET_HOOK_FRAGMENT; + snippet_data.chain_function = "cogl_generated_source"; + snippet_data.final_name = "main"; + snippet_data.function_prefix = "cogl_fragment_hook"; + snippet_data.source_buf = shader_state->source; + _cogl_pipeline_snippet_generate_code (&snippet_data); + + GE_RET( shader, ctx, glCreateShader (GL_FRAGMENT_SHADER) ); + + lengths[0] = shader_state->header->len; + source_strings[0] = shader_state->header->str; + lengths[1] = shader_state->source->len; + source_strings[1] = shader_state->source->str; + + _cogl_glsl_shader_set_source_with_boilerplate (ctx, + shader, GL_FRAGMENT_SHADER, + pipeline, + 2, /* count */ + source_strings, lengths); + + GE( ctx, glCompileShader (shader) ); + GE( ctx, glGetShaderiv (shader, GL_COMPILE_STATUS, &compile_status) ); + + if (!compile_status) + { + GLint len = 0; + char *shader_log; + + GE( ctx, glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len) ); + shader_log = g_alloca (len); + GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) ); + g_warning ("Shader compilation failed:\n%s", shader_log); + } + + shader_state->header = NULL; + shader_state->source = NULL; + shader_state->gl_shader = shader; + } + + return TRUE; +} + +static void +_cogl_pipeline_fragend_glsl_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & _cogl_pipeline_get_state_for_fragment_codegen (ctx))) + dirty_shader_state (pipeline); +} + +/* NB: layers are considered immutable once they have any dependants + * so although multiple pipelines can end up depending on a single + * static layer, we can guarantee that if a layer is being *changed* + * then it can only have one pipeline depending on it. + * + * XXX: Don't forget this is *pre* change, we can't read the new value + * yet! + */ +static void +_cogl_pipeline_fragend_glsl_layer_pre_change_notify ( + CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx))) + { + dirty_shader_state (owner); + return; + } + + /* TODO: we could be saving snippets of texture combine code along + * with each layer and then when a layer changes we would just free + * the snippet. */ +} + +const CoglPipelineFragend _cogl_pipeline_glsl_fragend = +{ + _cogl_pipeline_fragend_glsl_start, + _cogl_pipeline_fragend_glsl_add_layer, + NULL, /* passthrough */ + _cogl_pipeline_fragend_glsl_end, + _cogl_pipeline_fragend_glsl_pre_change_notify, + NULL, /* pipeline_set_parent_notify */ + _cogl_pipeline_fragend_glsl_layer_pre_change_notify +}; + +#endif /* COGL_PIPELINE_FRAGEND_GLSL */ + diff --git a/cogl/driver/gl/cogl-pipeline-opengl-private.h b/cogl/driver/gl/cogl-pipeline-opengl-private.h new file mode 100644 index 0000000..0a374be --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-opengl-private.h @@ -0,0 +1,158 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_OPENGL_PRIVATE_H +#define __COGL_PIPELINE_OPENGL_PRIVATE_H + +#include "cogl-pipeline-private.h" +#include "cogl-matrix-stack.h" + +/* + * cogl-pipeline.c owns the GPU's texture unit state so we have some + * private structures for describing the current state of a texture + * unit that we track in a per context array (ctx->texture_units) that + * grows according to the largest texture unit used so far... + * + * Roughly speaking the members in this structure are of two kinds: + * either they are a low level reflection of the state we send to + * OpenGL or they are for high level meta data assoicated with the + * texture unit when flushing CoglPipelineLayers that is typically + * used to optimize subsequent re-flushing of the same layer. + * + * The low level members are at the top, and the high level members + * start with the .layer member. + */ +typedef struct _CoglTextureUnit +{ + /* The base 0 texture unit index which can be used with + * glActiveTexture () */ + int index; + + /* The GL target currently glEnabled or 0 if nothing is + * enabled. This is only used by the fixed pipeline fragend */ + GLenum enabled_gl_target; + + /* The raw GL texture object name for which we called glBindTexture when + * we flushed the last layer. (NB: The CoglTexture associated + * with a layer may represent more than one GL texture) */ + GLuint gl_texture; + /* The target of the GL texture object. This is just used so that we + * can quickly determine the intended target to flush when + * dirty_gl_texture == TRUE */ + GLenum gl_target; + + /* Foreign textures are those not created or deleted by Cogl. If we ever + * call glBindTexture for a foreign texture then the next time we are + * asked to glBindTexture we can't try and optimize a redundant state + * change because we don't know if the original texture name was deleted + * and now we are being asked to bind a recycled name. */ + CoglBool is_foreign; + + /* We have many components in Cogl that need to temporarily bind arbitrary + * textures e.g. to query texture object parameters and since we don't + * want that to result in too much redundant reflushing of layer state + * when all that's needed is to re-bind the layer's gl_texture we use this + * to track when the unit->gl_texture state is out of sync with the GL + * texture object really bound too (GL_TEXTURE0+unit->index). + * + * XXX: as a further optimization cogl-pipeline.c uses a convention + * of always using texture unit 1 for these transient bindings so we + * can assume this is only ever TRUE for unit 1. + */ + CoglBool dirty_gl_texture; + + /* A matrix stack giving us the means to associate a texture + * transform matrix with the texture unit. */ + CoglMatrixStack *matrix_stack; + + /* + * Higher level layer state associated with the unit... + */ + + /* The CoglPipelineLayer whos state was flushed to update this + * texture unit last. + * + * This will be set to NULL if the layer is modified or freed which + * means when we come to flush a layer; if this pointer is still + * valid and == to the layer being flushed we don't need to update + * any texture unit state. */ + CoglPipelineLayer *layer; + + /* To help minimize the state changes required we track the + * difference flags associated with the layer whos state was last + * flushed to update this texture unit. + * + * Note: we track this explicitly because .layer may get invalidated + * if that layer is modified or deleted. Even if the layer is + * invalidated though these flags can be used to optimize the state + * flush of the next layer + */ + unsigned long layer_changes_since_flush; + + /* Whenever a CoglTexture's internal GL texture storage changes + * cogl-pipeline.c is notified with a call to + * _cogl_pipeline_texture_storage_change_notify which inturn sets + * this to TRUE for each texture unit that it is currently bound + * too. When we later come to flush some pipeline state then we will + * always check this to potentially force an update of the texture + * state even if the pipeline hasn't changed. */ + CoglBool texture_storage_changed; + +} CoglTextureUnit; + +CoglTextureUnit * +_cogl_get_texture_unit (int index_); + +void +_cogl_destroy_texture_units (void); + +void +_cogl_set_active_texture_unit (int unit_index); + +void +_cogl_bind_gl_texture_transient (GLenum gl_target, + GLuint gl_texture, + CoglBool is_foreign); + +void +_cogl_delete_gl_texture (GLuint gl_texture); + +void +_cogl_pipeline_flush_gl_state (CoglContext *context, + CoglPipeline *pipeline, + CoglFramebuffer *framebuffer, + CoglBool skip_gl_state, + CoglBool unknown_color_alpha); + +#endif /* __COGL_PIPELINE_OPENGL_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c new file mode 100644 index 0000000..c7b44ee --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-opengl.c @@ -0,0 +1,1484 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#include "config.h" + +#include "cogl-debug.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-context-private.h" +#include "cogl-texture-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-offscreen.h" +#include "cogl-texture-gl-private.h" + +#include "cogl-pipeline-progend-glsl-private.h" + +#include + +#include +#include + +/* + * GL/GLES compatability defines for pipeline thingies: + */ + +/* These aren't defined in the GLES headers */ +#ifndef GL_POINT_SPRITE +#define GL_POINT_SPRITE 0x8861 +#endif +#ifndef GL_COORD_REPLACE +#define GL_COORD_REPLACE 0x8862 +#endif +#ifndef GL_CLAMP_TO_BORDER +#define GL_CLAMP_TO_BORDER 0x812d +#endif +#ifndef GL_PROGRAM_POINT_SIZE +#define GL_PROGRAM_POINT_SIZE 0x8642 +#endif + +static void +texture_unit_init (CoglContext *ctx, + CoglTextureUnit *unit, + int index_) +{ + unit->index = index_; + unit->enabled_gl_target = 0; + unit->gl_texture = 0; + unit->gl_target = 0; + unit->is_foreign = FALSE; + unit->dirty_gl_texture = FALSE; + unit->matrix_stack = cogl_matrix_stack_new (ctx); + + unit->layer = NULL; + unit->layer_changes_since_flush = 0; + unit->texture_storage_changed = FALSE; +} + +static void +texture_unit_free (CoglTextureUnit *unit) +{ + if (unit->layer) + cogl_object_unref (unit->layer); + cogl_object_unref (unit->matrix_stack); +} + +CoglTextureUnit * +_cogl_get_texture_unit (int index_) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + if (ctx->texture_units->len < (index_ + 1)) + { + int i; + int prev_len = ctx->texture_units->len; + ctx->texture_units = g_array_set_size (ctx->texture_units, index_ + 1); + for (i = prev_len; i <= index_; i++) + { + CoglTextureUnit *unit = + &g_array_index (ctx->texture_units, CoglTextureUnit, i); + + texture_unit_init (ctx, unit, i); + } + } + + return &g_array_index (ctx->texture_units, CoglTextureUnit, index_); +} + +void +_cogl_destroy_texture_units (void) +{ + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (i = 0; i < ctx->texture_units->len; i++) + { + CoglTextureUnit *unit = + &g_array_index (ctx->texture_units, CoglTextureUnit, i); + texture_unit_free (unit); + } + g_array_free (ctx->texture_units, TRUE); +} + +void +_cogl_set_active_texture_unit (int unit_index) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->active_texture_unit != unit_index) + { + GE (ctx, glActiveTexture (GL_TEXTURE0 + unit_index)); + ctx->active_texture_unit = unit_index; + } +} + +/* Note: _cogl_bind_gl_texture_transient conceptually has slightly + * different semantics to OpenGL's glBindTexture because Cogl never + * cares about tracking multiple textures bound to different targets + * on the same texture unit. + * + * glBindTexture lets you bind multiple textures to a single texture + * unit if they are bound to different targets. So it does something + * like: + * unit->current_texture[target] = texture; + * + * Cogl only lets you associate one texture with the currently active + * texture unit, so the target is basically a redundant parameter + * that's implicitly set on that texture. + * + * Technically this is just a thin wrapper around glBindTexture so + * actually it does have the GL semantics but it seems worth + * mentioning the conceptual difference in case anyone wonders why we + * don't associate the gl_texture with a gl_target in the + * CoglTextureUnit. + */ +void +_cogl_bind_gl_texture_transient (GLenum gl_target, + GLuint gl_texture, + CoglBool is_foreign) +{ + CoglTextureUnit *unit; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* We choose to always make texture unit 1 active for transient + * binds so that in the common case where multitexturing isn't used + * we can simply ignore the state of this texture unit. Notably we + * didn't use a large texture unit (.e.g. (GL_MAX_TEXTURE_UNITS - 1) + * in case the driver doesn't have a sparse data structure for + * texture units. + */ + _cogl_set_active_texture_unit (1); + unit = _cogl_get_texture_unit (1); + + /* NB: If we have previously bound a foreign texture to this texture + * unit we don't know if that texture has since been deleted and we + * are seeing the texture name recycled */ + if (unit->gl_texture == gl_texture && + !unit->dirty_gl_texture && + !unit->is_foreign) + return; + + GE (ctx, glBindTexture (gl_target, gl_texture)); + + unit->dirty_gl_texture = TRUE; + unit->is_foreign = is_foreign; +} + +void +_cogl_delete_gl_texture (GLuint gl_texture) +{ + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (i = 0; i < ctx->texture_units->len; i++) + { + CoglTextureUnit *unit = + &g_array_index (ctx->texture_units, CoglTextureUnit, i); + + if (unit->gl_texture == gl_texture) + { + unit->gl_texture = 0; + unit->gl_target = 0; + unit->dirty_gl_texture = FALSE; + } + } + + GE (ctx, glDeleteTextures (1, &gl_texture)); +} + +/* Whenever the underlying GL texture storage of a CoglTexture is + * changed (e.g. due to migration out of a texture atlas) then we are + * notified. This lets us ensure that we reflush that texture's state + * if it is reused again with the same texture unit. + */ +void +_cogl_pipeline_texture_storage_change_notify (CoglTexture *texture) +{ + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (i = 0; i < ctx->texture_units->len; i++) + { + CoglTextureUnit *unit = + &g_array_index (ctx->texture_units, CoglTextureUnit, i); + + if (unit->layer && + _cogl_pipeline_layer_get_texture (unit->layer) == texture) + unit->texture_storage_changed = TRUE; + + /* NB: the texture may be bound to multiple texture units so + * we continue to check the rest */ + } +} + +static void +set_glsl_program (GLuint gl_program) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->current_gl_program != gl_program) + { + GLenum gl_error; + + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + ctx->glUseProgram (gl_program); + if (ctx->glGetError () == GL_NO_ERROR) + ctx->current_gl_program = gl_program; + else + { + GE( ctx, glUseProgram (0) ); + ctx->current_gl_program = 0; + } + } +} + +void +_cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If we're changing program type... */ + if (type != ctx->current_fragment_program_type) + { + /* ... disable the old type */ + switch (ctx->current_fragment_program_type) + { + case COGL_PIPELINE_PROGRAM_TYPE_GLSL: + /* If the program contains a vertex shader then we shouldn't + disable it */ + if (ctx->current_vertex_program_type != + COGL_PIPELINE_PROGRAM_TYPE_GLSL) + set_glsl_program (0); + break; + + case COGL_PIPELINE_PROGRAM_TYPE_ARBFP: +#ifdef HAVE_COGL_GL + GE( ctx, glDisable (GL_FRAGMENT_PROGRAM_ARB) ); +#endif + break; + + case COGL_PIPELINE_PROGRAM_TYPE_FIXED: + /* don't need to to anything */ + break; + } + + /* ... and enable the new type */ + switch (type) + { + case COGL_PIPELINE_PROGRAM_TYPE_ARBFP: +#ifdef HAVE_COGL_GL + GE( ctx, glEnable (GL_FRAGMENT_PROGRAM_ARB) ); +#endif + break; + + case COGL_PIPELINE_PROGRAM_TYPE_GLSL: + case COGL_PIPELINE_PROGRAM_TYPE_FIXED: + /* don't need to to anything */ + break; + } + } + + if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL) + { +#ifdef COGL_PIPELINE_FRAGEND_GLSL + set_glsl_program (gl_program); + +#else + + g_warning ("Unexpected use of GLSL fragend!"); + +#endif /* COGL_PIPELINE_FRAGEND_GLSL */ + } +#ifndef COGL_PIPELINE_FRAGEND_ARBFP + else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP) + g_warning ("Unexpected use of ARBFP fragend!"); +#endif /* COGL_PIPELINE_FRAGEND_ARBFP */ + + ctx->current_fragment_program_type = type; +} + +void +_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If we're changing program type... */ + if (type != ctx->current_vertex_program_type) + { + /* ... disable the old type */ + switch (ctx->current_vertex_program_type) + { + case COGL_PIPELINE_PROGRAM_TYPE_GLSL: + /* If the program contains a fragment shader then we shouldn't + disable it */ + if (ctx->current_fragment_program_type != + COGL_PIPELINE_PROGRAM_TYPE_GLSL) + set_glsl_program (0); + break; + + case COGL_PIPELINE_PROGRAM_TYPE_ARBFP: + /* It doesn't make sense to enable ARBfp for the vertex program */ + g_assert_not_reached (); + break; + + case COGL_PIPELINE_PROGRAM_TYPE_FIXED: + /* don't need to to anything */ + break; + } + + /* ... and enable the new type */ + switch (type) + { + case COGL_PIPELINE_PROGRAM_TYPE_ARBFP: + /* It doesn't make sense to enable ARBfp for the vertex program */ + g_assert_not_reached (); + break; + + case COGL_PIPELINE_PROGRAM_TYPE_GLSL: + case COGL_PIPELINE_PROGRAM_TYPE_FIXED: + /* don't need to to anything */ + break; + } + } + + if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL) + { +#ifdef COGL_PIPELINE_VERTEND_GLSL + set_glsl_program (gl_program); + +#else + + g_warning ("Unexpected use of GLSL vertend!"); + +#endif /* COGL_PIPELINE_VERTEND_GLSL */ + } +#ifndef COGL_PIPELINE_VERTEND_ARBFP + else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP) + g_warning ("Unexpected use of ARBFP vertend!"); +#endif /* COGL_PIPELINE_VERTEND_ARBFP */ + + ctx->current_vertex_program_type = type; +} + +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + +static CoglBool +blend_factor_uses_constant (GLenum blend_factor) +{ + return (blend_factor == GL_CONSTANT_COLOR || + blend_factor == GL_ONE_MINUS_CONSTANT_COLOR || + blend_factor == GL_CONSTANT_ALPHA || + blend_factor == GL_ONE_MINUS_CONSTANT_ALPHA); +} + +#endif + +static void +flush_depth_state (CoglContext *ctx, + CoglDepthState *depth_state) +{ + CoglBool depth_writing_enabled = depth_state->write_enabled; + + if (ctx->current_draw_buffer) + depth_writing_enabled &= ctx->current_draw_buffer->depth_writing_enabled; + + if (ctx->depth_test_enabled_cache != depth_state->test_enabled) + { + if (depth_state->test_enabled == TRUE) + GE (ctx, glEnable (GL_DEPTH_TEST)); + else + GE (ctx, glDisable (GL_DEPTH_TEST)); + ctx->depth_test_enabled_cache = depth_state->test_enabled; + } + + if (ctx->depth_test_function_cache != depth_state->test_function && + depth_state->test_enabled == TRUE) + { + GE (ctx, glDepthFunc (depth_state->test_function)); + ctx->depth_test_function_cache = depth_state->test_function; + } + + if (ctx->depth_writing_enabled_cache != depth_writing_enabled) + { + GE (ctx, glDepthMask (depth_writing_enabled ? + GL_TRUE : GL_FALSE)); + ctx->depth_writing_enabled_cache = depth_writing_enabled; + } + + if (ctx->driver != COGL_DRIVER_GLES1 && + (ctx->depth_range_near_cache != depth_state->range_near || + ctx->depth_range_far_cache != depth_state->range_far)) + { + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED)) + GE (ctx, glDepthRangef (depth_state->range_near, + depth_state->range_far)); + else + GE (ctx, glDepthRange (depth_state->range_near, + depth_state->range_far)); + + ctx->depth_range_near_cache = depth_state->range_near; + ctx->depth_range_far_cache = depth_state->range_far; + } +} + +UNIT_TEST (check_gl_blend_enable, + 0 /* no requirements */, + 0 /* no failure cases */) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + + /* By default blending should be disabled */ + g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1); + _cogl_framebuffer_flush_journal (test_fb); + + /* After drawing an opaque rectangle blending should still be + * disabled */ + g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0); + + cogl_pipeline_set_color4f (pipeline, 0, 0, 0, 0); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1); + _cogl_framebuffer_flush_journal (test_fb); + + /* After drawing a transparent rectangle blending should be enabled */ + g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 1); + + cogl_pipeline_set_blend (pipeline, "RGBA=ADD(SRC_COLOR, 0)", NULL); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1); + _cogl_framebuffer_flush_journal (test_fb); + + /* After setting a blend string that effectively disables blending + * then blending should be disabled */ + g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0); +} + +static void +_cogl_pipeline_flush_color_blend_alpha_depth_state ( + CoglPipeline *pipeline, + unsigned long pipelines_difference, + CoglBool with_color_attrib) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* On GLES2 we'll flush the color later */ + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && + !with_color_attrib) + { + if ((pipelines_difference & COGL_PIPELINE_STATE_COLOR) || + /* Assume if we were previously told to skip the color, then + * the current color needs updating... */ + ctx->current_pipeline_with_color_attrib) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR); + GE (ctx, glColor4ub (cogl_color_get_red_byte (&authority->color), + cogl_color_get_green_byte (&authority->color), + cogl_color_get_blue_byte (&authority->color), + cogl_color_get_alpha_byte (&authority->color))); + } + } + + if (pipelines_difference & COGL_PIPELINE_STATE_BLEND) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND); + CoglPipelineBlendState *blend_state = + &authority->big_state->blend_state; + + /* GLES 1 only has glBlendFunc */ + if (ctx->driver == COGL_DRIVER_GLES1) + { + GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb)); + } +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + else + { + if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) || + blend_factor_uses_constant (blend_state + ->blend_src_factor_alpha) || + blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) || + blend_factor_uses_constant (blend_state->blend_dst_factor_alpha)) + { + float red = + cogl_color_get_red_float (&blend_state->blend_constant); + float green = + cogl_color_get_green_float (&blend_state->blend_constant); + float blue = + cogl_color_get_blue_float (&blend_state->blend_constant); + float alpha = + cogl_color_get_alpha_float (&blend_state->blend_constant); + + + GE (ctx, glBlendColor (red, green, blue, alpha)); + } + + if (ctx->glBlendEquationSeparate && + blend_state->blend_equation_rgb != + blend_state->blend_equation_alpha) + GE (ctx, + glBlendEquationSeparate (blend_state->blend_equation_rgb, + blend_state->blend_equation_alpha)); + else + GE (ctx, glBlendEquation (blend_state->blend_equation_rgb)); + + if (ctx->glBlendFuncSeparate && + (blend_state->blend_src_factor_rgb != + blend_state->blend_src_factor_alpha || + (blend_state->blend_dst_factor_rgb != + blend_state->blend_dst_factor_alpha))) + GE (ctx, glBlendFuncSeparate (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb, + blend_state->blend_src_factor_alpha, + blend_state->blend_dst_factor_alpha)); + else + GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb)); + } +#endif + } + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST)) + { + /* Under GLES2 the alpha function is implemented as part of the + fragment shader */ + if (pipelines_difference & (COGL_PIPELINE_STATE_ALPHA_FUNC | + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE)) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_ALPHA_FUNC); + CoglPipelineAlphaFuncState *alpha_state = + &authority->big_state->alpha_state; + + /* NB: Currently the Cogl defines are compatible with the GL ones: */ + GE (ctx, glAlphaFunc (alpha_state->alpha_func, + alpha_state->alpha_func_reference)); + } + + /* Under GLES2 the lighting parameters are implemented as uniforms + in the progend */ + if (pipelines_difference & COGL_PIPELINE_STATE_LIGHTING) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_LIGHTING); + CoglPipelineLightingState *lighting_state = + &authority->big_state->lighting_state; + + GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, + lighting_state->ambient)); + GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, + lighting_state->diffuse)); + GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, + lighting_state->specular)); + GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_EMISSION, + lighting_state->emission)); + GE (ctx, glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, + &lighting_state->shininess)); + } + } + +#endif + + if (pipelines_difference & COGL_PIPELINE_STATE_DEPTH) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH); + CoglDepthState *depth_state = &authority->big_state->depth_state; + + flush_depth_state (ctx, depth_state); + } + + if (pipelines_difference & COGL_PIPELINE_STATE_LOGIC_OPS) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS); + CoglPipelineLogicOpsState *logic_ops_state = &authority->big_state->logic_ops_state; + CoglColorMask color_mask = logic_ops_state->color_mask; + + if (ctx->current_draw_buffer) + color_mask &= ctx->current_draw_buffer->color_mask; + + GE (ctx, glColorMask (!!(color_mask & COGL_COLOR_MASK_RED), + !!(color_mask & COGL_COLOR_MASK_GREEN), + !!(color_mask & COGL_COLOR_MASK_BLUE), + !!(color_mask & COGL_COLOR_MASK_ALPHA))); + ctx->current_gl_color_mask = color_mask; + } + + if (pipelines_difference & COGL_PIPELINE_STATE_CULL_FACE) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_CULL_FACE); + CoglPipelineCullFaceState *cull_face_state + = &authority->big_state->cull_face_state; + + if (cull_face_state->mode == COGL_PIPELINE_CULL_FACE_MODE_NONE) + GE( ctx, glDisable (GL_CULL_FACE) ); + else + { + CoglBool invert_winding; + + GE( ctx, glEnable (GL_CULL_FACE) ); + + switch (cull_face_state->mode) + { + case COGL_PIPELINE_CULL_FACE_MODE_NONE: + g_assert_not_reached (); + + case COGL_PIPELINE_CULL_FACE_MODE_FRONT: + GE( ctx, glCullFace (GL_FRONT) ); + break; + + case COGL_PIPELINE_CULL_FACE_MODE_BACK: + GE( ctx, glCullFace (GL_BACK) ); + break; + + case COGL_PIPELINE_CULL_FACE_MODE_BOTH: + GE( ctx, glCullFace (GL_FRONT_AND_BACK) ); + break; + } + + /* If we are painting to an offscreen framebuffer then we + need to invert the winding of the front face because + everything is painted upside down */ + invert_winding = cogl_is_offscreen (ctx->current_draw_buffer); + + switch (cull_face_state->front_winding) + { + case COGL_WINDING_CLOCKWISE: + GE( ctx, glFrontFace (invert_winding ? GL_CCW : GL_CW) ); + break; + + case COGL_WINDING_COUNTER_CLOCKWISE: + GE( ctx, glFrontFace (invert_winding ? GL_CW : GL_CCW) ); + break; + } + } + } + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_ENABLE_PROGRAM_POINT_SIZE) && + (pipelines_difference & COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE)) + { + unsigned long state = COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE; + CoglPipeline *authority = _cogl_pipeline_get_authority (pipeline, state); + + if (authority->big_state->per_vertex_point_size) + GE( ctx, glEnable (GL_PROGRAM_POINT_SIZE) ); + else + GE( ctx, glDisable (GL_PROGRAM_POINT_SIZE) ); + } +#endif + + if (pipeline->real_blend_enable != ctx->gl_blend_enable_cache) + { + if (pipeline->real_blend_enable) + GE (ctx, glEnable (GL_BLEND)); + else + GE (ctx, glDisable (GL_BLEND)); + /* XXX: we shouldn't update any other blend state if blending + * is disabled! */ + ctx->gl_blend_enable_cache = pipeline->real_blend_enable; + } +} + +static int +get_max_activateable_texture_units (void) +{ + _COGL_GET_CONTEXT (ctx, 0); + + if (G_UNLIKELY (ctx->max_activateable_texture_units == -1)) + { + GLint values[3]; + int n_values = 0; + int i; + +#ifdef HAVE_COGL_GL + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED)) + { + /* GL_MAX_TEXTURE_COORDS is provided for both GLSL and ARBfp. It + defines the number of texture coordinates that can be + uploaded (but doesn't necessarily relate to how many texture + images can be sampled) */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) || + cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) + /* Previously this code subtracted the value by one but there + was no explanation for why it did this and it doesn't seem + to make sense so it has been removed */ + GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_COORDS, + values + n_values++)); + + /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is defined for GLSL but + not ARBfp */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL)) + GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, + values + n_values++)); + } +#endif /* HAVE_COGL_GL */ + +#ifdef HAVE_COGL_GLES2 + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED) && + _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE)) + { + GE (ctx, glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, values + n_values)); + /* Two of the vertex attribs need to be used for the position + and color */ + values[n_values++] -= 2; + + GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, + values + n_values++)); + } +#endif + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) + { + /* GL_MAX_TEXTURE_UNITS defines the number of units that are + usable from the fixed function pipeline, therefore it isn't + available in GLES2. These are also tied to the number of + texture coordinates that can be uploaded so it should be less + than that available from the shader extensions */ + GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_UNITS, + values + n_values++)); + + } +#endif + + g_assert (n_values <= G_N_ELEMENTS (values) && + n_values > 0); + + /* Use the maximum value */ + ctx->max_activateable_texture_units = values[0]; + for (i = 1; i < n_values; i++) + ctx->max_activateable_texture_units = + MAX (values[i], ctx->max_activateable_texture_units); + } + + return ctx->max_activateable_texture_units; +} + +typedef struct +{ + int i; + unsigned long *layer_differences; +} CoglPipelineFlushLayerState; + +static CoglBool +flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglPipelineFlushLayerState *flush_state = user_data; + int unit_index = flush_state->i; + CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index); + unsigned long layers_difference = + flush_state->layer_differences[unit_index]; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* There may not be enough texture units so we can bail out if + * that's the case... + */ + if (G_UNLIKELY (unit_index >= get_max_activateable_texture_units ())) + { + static CoglBool shown_warning = FALSE; + + if (!shown_warning) + { + g_warning ("Your hardware does not have enough texture units" + "to handle this many texture layers"); + shown_warning = TRUE; + } + return FALSE; + } + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA) + { + CoglTexture *texture = _cogl_pipeline_layer_get_texture_real (layer); + GLuint gl_texture; + GLenum gl_target; + + if (texture == NULL) + switch (_cogl_pipeline_layer_get_texture_type (layer)) + { + case COGL_TEXTURE_TYPE_2D: + texture = COGL_TEXTURE (ctx->default_gl_texture_2d_tex); + break; + case COGL_TEXTURE_TYPE_3D: + texture = COGL_TEXTURE (ctx->default_gl_texture_3d_tex); + break; + case COGL_TEXTURE_TYPE_RECTANGLE: + texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex); + break; + } + + cogl_texture_get_gl_texture (texture, + &gl_texture, + &gl_target); + + _cogl_set_active_texture_unit (unit_index); + + /* NB: There are several Cogl components and some code in + * Clutter that will temporarily bind arbitrary GL textures to + * query and modify texture object parameters. If you look at + * _cogl_bind_gl_texture_transient() you can see we make sure + * that such code always binds to texture unit 1 which means we + * can't rely on the unit->gl_texture state if unit->index == 1. + * + * Because texture unit 1 is a bit special we actually defer any + * necessary glBindTexture for it until the end of + * _cogl_pipeline_flush_gl_state(). + * + * NB: we get notified whenever glDeleteTextures is used (see + * _cogl_delete_gl_texture()) where we invalidate + * unit->gl_texture references to deleted textures so it's safe + * to compare unit->gl_texture with gl_texture. (Without the + * hook it would be possible to delete a GL texture and create a + * new one with the same name and comparing unit->gl_texture and + * gl_texture wouldn't detect that.) + * + * NB: for foreign textures we don't know how the deletion of + * the GL texture objects correspond to the deletion of the + * CoglTextures so if there was previously a foreign texture + * associated with the texture unit then we can't assume that we + * aren't seeing a recycled texture name so we have to bind. + */ + if (unit->gl_texture != gl_texture || unit->is_foreign) + { + if (unit_index == 1) + unit->dirty_gl_texture = TRUE; + else + GE (ctx, glBindTexture (gl_target, gl_texture)); + unit->gl_texture = gl_texture; + unit->gl_target = gl_target; + } + + unit->is_foreign = _cogl_texture_is_foreign (texture); + + /* The texture_storage_changed boolean indicates if the + * CoglTexture's underlying GL texture storage has changed since + * it was flushed to the texture unit. We've just flushed the + * latest state so we can reset this. */ + unit->texture_storage_changed = FALSE; + } + + if ((layers_difference & COGL_PIPELINE_LAYER_STATE_SAMPLER) && + _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS)) + { + const CoglSamplerCacheEntry *sampler_state; + + sampler_state = _cogl_pipeline_layer_get_sampler_state (layer); + + GE( ctx, glBindSampler (unit_index, sampler_state->sampler_object) ); + } + + /* FIXME: If using GLSL the progend we will use gl_PointCoord + * instead of us needing to replace the texture coordinates but at + * this point we can't currently tell if we are using the fixed or + * glsl progend. + */ +#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GL) + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && + (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS)) + { + CoglPipelineState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, change); + CoglPipelineLayerBigState *big_state = authority->big_state; + + _cogl_set_active_texture_unit (unit_index); + + GE (ctx, glTexEnvi (GL_POINT_SPRITE, GL_COORD_REPLACE, + big_state->point_sprite_coords)); + } +#endif + + cogl_object_ref (layer); + if (unit->layer != NULL) + cogl_object_unref (unit->layer); + + unit->layer = layer; + unit->layer_changes_since_flush = 0; + + flush_state->i++; + + return TRUE; +} + +static void +_cogl_pipeline_flush_common_gl_state (CoglPipeline *pipeline, + unsigned long pipelines_difference, + unsigned long *layer_differences, + CoglBool with_color_attrib) +{ + CoglPipelineFlushLayerState state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _cogl_pipeline_flush_color_blend_alpha_depth_state (pipeline, + pipelines_difference, + with_color_attrib); + + state.i = 0; + state.layer_differences = layer_differences; + _cogl_pipeline_foreach_layer_internal (pipeline, + flush_layers_common_gl_state_cb, + &state); +} + +/* Re-assert the layer's wrap modes on the given CoglTexture. + * + * Note: we don't simply forward the wrap modes to layer->texture + * since the actual texture being used may have been overridden. + */ +static void +_cogl_pipeline_layer_forward_wrap_modes (CoglPipelineLayer *layer, + CoglTexture *texture) +{ + CoglSamplerCacheWrapMode wrap_mode_s, wrap_mode_t, wrap_mode_p; + GLenum gl_wrap_mode_s, gl_wrap_mode_t, gl_wrap_mode_p; + + if (texture == NULL) + return; + + _cogl_pipeline_layer_get_wrap_modes (layer, + &wrap_mode_s, + &wrap_mode_t, + &wrap_mode_p); + + /* Update the wrap mode on the texture object. The texture backend + should cache the value so that it will be a no-op if the object + already has the same wrap mode set. The backend is best placed to + do this because it knows how many of the coordinates will + actually be used (ie, a 1D texture only cares about the 's' + coordinate but a 3D texture would use all three). GL uses the + wrap mode as part of the texture object state but we are + pretending it's part of the per-layer environment state. This + will break if the application tries to use different modes in + different layers using the same texture. */ + + if (wrap_mode_s == COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC) + gl_wrap_mode_s = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_s = wrap_mode_s; + + if (wrap_mode_t == COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC) + gl_wrap_mode_t = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_t = wrap_mode_t; + + if (wrap_mode_p == COGL_SAMPLER_CACHE_WRAP_MODE_AUTOMATIC) + gl_wrap_mode_p = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_p = wrap_mode_p; + + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (texture, + gl_wrap_mode_s, + gl_wrap_mode_t, + gl_wrap_mode_p); +} + +/* OpenGL associates the min/mag filters and repeat modes with the + * texture object not the texture unit so we always have to re-assert + * the filter and repeat modes whenever we use a texture since it may + * be referenced by multiple pipelines with different modes. + * + * This function is bypassed in favour of sampler objects if + * GL_ARB_sampler_objects is advertised. This fallback won't work if + * the same texture is bound to multiple layers with different sampler + * state. + */ +static void +foreach_texture_unit_update_filter_and_wrap_modes (void) +{ + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + for (i = 0; i < ctx->texture_units->len; i++) + { + CoglTextureUnit *unit = + &g_array_index (ctx->texture_units, CoglTextureUnit, i); + + if (unit->layer) + { + CoglTexture *texture = _cogl_pipeline_layer_get_texture (unit->layer); + + if (texture != NULL) + { + CoglPipelineFilter min; + CoglPipelineFilter mag; + + _cogl_pipeline_layer_get_filters (unit->layer, &min, &mag); + _cogl_texture_gl_flush_legacy_texobj_filters (texture, min, mag); + + _cogl_pipeline_layer_forward_wrap_modes (unit->layer, texture); + } + } + } +} + +typedef struct +{ + int i; + unsigned long *layer_differences; +} CoglPipelineCompareLayersState; + +static CoglBool +compare_layer_differences_cb (CoglPipelineLayer *layer, void *user_data) +{ + CoglPipelineCompareLayersState *state = user_data; + CoglTextureUnit *unit = _cogl_get_texture_unit (state->i); + + if (unit->layer == layer) + state->layer_differences[state->i] = unit->layer_changes_since_flush; + else if (unit->layer) + { + state->layer_differences[state->i] = unit->layer_changes_since_flush; + state->layer_differences[state->i] |= + _cogl_pipeline_layer_compare_differences (layer, unit->layer); + } + else + state->layer_differences[state->i] = COGL_PIPELINE_LAYER_STATE_ALL_SPARSE; + + /* XXX: There is always a possibility that a CoglTexture's + * underlying GL texture storage has been changed since it was last + * bound to a texture unit which is why we have a callback into + * _cogl_pipeline_texture_storage_change_notify whenever a textures + * underlying GL texture storage changes which will set the + * unit->texture_intern_changed flag. If we see that's been set here + * then we force an update of the texture state... + */ + if (unit->texture_storage_changed) + state->layer_differences[state->i] |= + COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA; + + state->i++; + + return TRUE; +} + +typedef struct +{ + CoglFramebuffer *framebuffer; + const CoglPipelineVertend *vertend; + const CoglPipelineFragend *fragend; + CoglPipeline *pipeline; + unsigned long *layer_differences; + CoglBool error_adding_layer; + CoglBool added_layer; +} CoglPipelineAddLayerState; + +static CoglBool +vertend_add_layer_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineAddLayerState *state = user_data; + const CoglPipelineVertend *vertend = state->vertend; + CoglPipeline *pipeline = state->pipeline; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + /* Either generate per layer code snippets or setup the + * fixed function glTexEnv for each layer... */ + if (G_LIKELY (vertend->add_layer (pipeline, + layer, + state->layer_differences[unit_index], + state->framebuffer))) + state->added_layer = TRUE; + else + { + state->error_adding_layer = TRUE; + return FALSE; + } + + return TRUE; +} + +static CoglBool +fragend_add_layer_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineAddLayerState *state = user_data; + const CoglPipelineFragend *fragend = state->fragend; + CoglPipeline *pipeline = state->pipeline; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + /* Either generate per layer code snippets or setup the + * fixed function glTexEnv for each layer... */ + if (G_LIKELY (fragend->add_layer (pipeline, + layer, + state->layer_differences[unit_index]))) + state->added_layer = TRUE; + else + { + state->error_adding_layer = TRUE; + return FALSE; + } + + return TRUE; +} + +/* + * _cogl_pipeline_flush_gl_state: + * + * Details of override options: + * ->fallback_mask: is a bitmask of the pipeline layers that need to be + * replaced with the default, fallback textures. The fallback textures are + * fully transparent textures so they hopefully wont contribute to the + * texture combining. + * + * The intention of fallbacks is to try and preserve + * the number of layers the user is expecting so that texture coordinates + * they gave will mostly still correspond to the textures they intended, and + * have a fighting chance of looking close to their originally intended + * result. + * + * ->disable_mask: is a bitmask of the pipeline layers that will simply have + * texturing disabled. It's only really intended for disabling all layers + * > X; i.e. we'd expect to see a contiguous run of 0 starting from the LSB + * and at some point the remaining bits flip to 1. It might work to disable + * arbitrary layers; though I'm not sure a.t.m how OpenGL would take to + * that. + * + * The intention of the disable_mask is for emitting geometry when the user + * hasn't supplied enough texture coordinates for all the layers and it's + * not possible to auto generate default texture coordinates for those + * layers. + * + * ->layer0_override_texture: forcibly tells us to bind this GL texture name for + * layer 0 instead of plucking the gl_texture from the CoglTexture of layer + * 0. + * + * The intention of this is for any primitives that supports sliced textures. + * The code will can iterate each of the slices and re-flush the pipeline + * forcing the GL texture of each slice in turn. + * + * ->wrap_mode_overrides: overrides the wrap modes set on each + * layer. This is used to implement the automatic wrap mode. + * + * XXX: It might also help if we could specify a texture matrix for code + * dealing with slicing that would be multiplied with the users own matrix. + * + * Normaly texture coords in the range [0, 1] refer to the extents of the + * texture, but when your GL texture represents a slice of the real texture + * (from the users POV) then a texture matrix would be a neat way of + * transforming the mapping for each slice. + * + * Currently for textured rectangles we manually calculate the texture + * coords for each slice based on the users given coords, but this solution + * isn't ideal, and can't be used with CoglVertexBuffers. + */ +void +_cogl_pipeline_flush_gl_state (CoglContext *ctx, + CoglPipeline *pipeline, + CoglFramebuffer *framebuffer, + CoglBool with_color_attrib, + CoglBool unknown_color_alpha) +{ + CoglPipeline *current_pipeline = ctx->current_pipeline; + unsigned long pipelines_difference; + int n_layers; + unsigned long *layer_differences; + int i; + CoglTextureUnit *unit1; + const CoglPipelineProgend *progend; + + COGL_STATIC_TIMER (pipeline_flush_timer, + "Mainloop", /* parent */ + "Material Flush", + "The time spent flushing material state", + 0 /* no application private data */); + + COGL_TIMER_START (_cogl_uprof_context, pipeline_flush_timer); + + /* Bail out asap if we've been asked to re-flush the already current + * pipeline and we can see the pipeline hasn't changed */ + if (current_pipeline == pipeline && + ctx->current_pipeline_age == pipeline->age && + ctx->current_pipeline_with_color_attrib == with_color_attrib && + ctx->current_pipeline_unknown_color_alpha == unknown_color_alpha) + goto done; + else + { + /* Update derived state (currently just the 'real_blend_enable' + * state) and determine a mask of state that differs between the + * current pipeline and the one we are flushing. + * + * Note updating the derived state is done before doing any + * pipeline comparisons so that we can correctly compare the + * 'real_blend_enable' state itself. + */ + + if (current_pipeline == pipeline) + { + pipelines_difference = ctx->current_pipeline_changes_since_flush; + + if (pipelines_difference & COGL_PIPELINE_STATE_AFFECTS_BLENDING || + pipeline->unknown_color_alpha != unknown_color_alpha) + { + CoglBool save_real_blend_enable = pipeline->real_blend_enable; + + _cogl_pipeline_update_real_blend_enable (pipeline, + unknown_color_alpha); + + if (save_real_blend_enable != pipeline->real_blend_enable) + pipelines_difference |= COGL_PIPELINE_STATE_REAL_BLEND_ENABLE; + } + } + else if (current_pipeline) + { + pipelines_difference = ctx->current_pipeline_changes_since_flush; + + _cogl_pipeline_update_real_blend_enable (pipeline, + unknown_color_alpha); + + pipelines_difference |= + _cogl_pipeline_compare_differences (ctx->current_pipeline, + pipeline); + } + else + { + _cogl_pipeline_update_real_blend_enable (pipeline, + unknown_color_alpha); + + pipelines_difference = COGL_PIPELINE_STATE_ALL; + } + } + + /* Get a layer_differences mask for each layer to be flushed */ + n_layers = cogl_pipeline_get_n_layers (pipeline); + if (n_layers) + { + CoglPipelineCompareLayersState state; + layer_differences = g_alloca (sizeof (unsigned long) * n_layers); + memset (layer_differences, 0, sizeof (unsigned long) * n_layers); + state.i = 0; + state.layer_differences = layer_differences; + _cogl_pipeline_foreach_layer_internal (pipeline, + compare_layer_differences_cb, + &state); + } + else + layer_differences = NULL; + + /* First flush everything that's the same regardless of which + * pipeline backend is being used... + * + * 1) top level state: + * glColor (or skip if a vertex attribute is being used for color) + * blend state + * alpha test state (except for GLES 2.0) + * + * 2) then foreach layer: + * determine gl_target/gl_texture + * bind texture + * + * Note: After _cogl_pipeline_flush_common_gl_state you can expect + * all state of the layers corresponding texture unit to be + * updated. + */ + _cogl_pipeline_flush_common_gl_state (pipeline, + pipelines_difference, + layer_differences, + with_color_attrib); + + /* Now flush the fragment, vertex and program state according to the + * current progend backend. + * + * Note: Some backends may not support the current pipeline + * configuration and in that case it will report and error and we + * will look for a different backend. + * + * NB: if pipeline->progend != COGL_PIPELINE_PROGEND_UNDEFINED then + * we have previously managed to successfully flush this pipeline + * with the given progend so we will simply use that to avoid + * fallback code paths. + */ + if (pipeline->progend == COGL_PIPELINE_PROGEND_UNDEFINED) + _cogl_pipeline_set_progend (pipeline, COGL_PIPELINE_PROGEND_DEFAULT); + + for (i = pipeline->progend; + i < COGL_PIPELINE_N_PROGENDS; + i++, _cogl_pipeline_set_progend (pipeline, i)) + { + const CoglPipelineVertend *vertend; + const CoglPipelineFragend *fragend; + CoglPipelineAddLayerState state; + + progend = _cogl_pipeline_progends[i]; + + if (G_UNLIKELY (!progend->start (pipeline))) + continue; + + vertend = _cogl_pipeline_vertends[progend->vertend]; + + vertend->start (pipeline, + n_layers, + pipelines_difference); + + state.framebuffer = framebuffer; + state.vertend = vertend; + state.pipeline = pipeline; + state.layer_differences = layer_differences; + state.error_adding_layer = FALSE; + state.added_layer = FALSE; + + _cogl_pipeline_foreach_layer_internal (pipeline, + vertend_add_layer_cb, + &state); + + if (G_UNLIKELY (state.error_adding_layer)) + continue; + + if (G_UNLIKELY (!vertend->end (pipeline, pipelines_difference))) + continue; + + /* Now prepare the fragment processing state (fragend) + * + * NB: We can't combine the setup of the vertend and fragend + * since the backends that do code generation share + * ctx->codegen_source_buffer as a scratch buffer. + */ + + fragend = _cogl_pipeline_fragends[progend->fragend]; + state.fragend = fragend; + + fragend->start (pipeline, + n_layers, + pipelines_difference); + + _cogl_pipeline_foreach_layer_internal (pipeline, + fragend_add_layer_cb, + &state); + + if (G_UNLIKELY (state.error_adding_layer)) + continue; + + if (!state.added_layer) + { + if (fragend->passthrough && + G_UNLIKELY (!fragend->passthrough (pipeline))) + continue; + } + + if (G_UNLIKELY (!fragend->end (pipeline, pipelines_difference))) + continue; + + if (progend->end) + progend->end (pipeline, pipelines_difference); + break; + } + + /* FIXME: This reference is actually resulting in lots of + * copy-on-write reparenting because one-shot pipelines end up + * living for longer than necessary and so any later modification of + * the parent will cause a copy-on-write. + * + * XXX: The issue should largely go away when we switch to using + * weak pipelines for overrides. + */ + cogl_object_ref (pipeline); + if (ctx->current_pipeline != NULL) + cogl_object_unref (ctx->current_pipeline); + ctx->current_pipeline = pipeline; + ctx->current_pipeline_changes_since_flush = 0; + ctx->current_pipeline_with_color_attrib = with_color_attrib; + ctx->current_pipeline_unknown_color_alpha = unknown_color_alpha; + ctx->current_pipeline_age = pipeline->age; + +done: + + progend = _cogl_pipeline_progends[pipeline->progend]; + + /* We can't assume the color will be retained between flushes when + * using the glsl progend because the generic attribute values are + * not stored as part of the program object so they could be + * overridden by any attribute changes in another program */ + if (pipeline->progend == COGL_PIPELINE_PROGEND_GLSL && !with_color_attrib) + { + int attribute; + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR); + int name_index = COGL_ATTRIBUTE_COLOR_NAME_INDEX; + + attribute = + _cogl_pipeline_progend_glsl_get_attrib_location (pipeline, name_index); + if (attribute != -1) + GE (ctx, + glVertexAttrib4f (attribute, + cogl_color_get_red_float (&authority->color), + cogl_color_get_green_float (&authority->color), + cogl_color_get_blue_float (&authority->color), + cogl_color_get_alpha_float (&authority->color))); + } + + /* Give the progend a chance to update any uniforms that might not + * depend on the material state. This is used on GLES2 to update the + * matrices */ + if (progend->pre_paint) + progend->pre_paint (pipeline, framebuffer); + + /* Handle the fact that OpenGL associates texture filter and wrap + * modes with the texture objects not the texture units... */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS)) + foreach_texture_unit_update_filter_and_wrap_modes (); + + /* If this pipeline has more than one layer then we always need + * to make sure we rebind the texture for unit 1. + * + * NB: various components of Cogl may temporarily bind arbitrary + * textures to texture unit 1 so they can query and modify texture + * object parameters. cogl-pipeline.c (See + * _cogl_bind_gl_texture_transient) + */ + unit1 = _cogl_get_texture_unit (1); + if (cogl_pipeline_get_n_layers (pipeline) > 1 && unit1->dirty_gl_texture) + { + _cogl_set_active_texture_unit (1); + GE (ctx, glBindTexture (unit1->gl_target, unit1->gl_texture)); + unit1->dirty_gl_texture = FALSE; + } + + COGL_TIMER_STOP (_cogl_uprof_context, pipeline_flush_timer); +} + diff --git a/cogl/driver/gl/cogl-pipeline-progend-fixed-private.h b/cogl/driver/gl/cogl-pipeline-progend-fixed-private.h new file mode 100644 index 0000000..f97e16a --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-progend-fixed-private.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H +#define __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineProgend _cogl_pipeline_fixed_progend; + +#endif /* __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-progend-fixed.c b/cogl/driver/gl/cogl-pipeline-progend-fixed.c new file mode 100644 index 0000000..99f71bf --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-progend-fixed.c @@ -0,0 +1,112 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" + +#ifdef COGL_PIPELINE_PROGEND_FIXED + +#include "cogl-context.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" + +static CoglBool +_cogl_pipeline_progend_fixed_start (CoglPipeline *pipeline) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED))) + return FALSE; + + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) + return FALSE; + + /* Vertex snippets are only supported in the GLSL fragend */ + if (_cogl_pipeline_has_vertex_snippets (pipeline)) + return FALSE; + + /* Fragment snippets are only supported in the GLSL fragend */ + if (_cogl_pipeline_has_fragment_snippets (pipeline)) + return FALSE; + + /* If there is a user program then the appropriate backend for that + * language should handle it. */ + if (cogl_pipeline_get_user_program (pipeline)) + return FALSE; + + /* The fixed progend can't handle the per-vertex point size + * attribute */ + if (cogl_pipeline_get_per_vertex_point_size (pipeline)) + return FALSE; + + return TRUE; +} + +static void +_cogl_pipeline_progend_fixed_pre_paint (CoglPipeline *pipeline, + CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + if (ctx->current_projection_entry) + _cogl_matrix_entry_flush_to_gl_builtins (ctx, + ctx->current_projection_entry, + COGL_MATRIX_PROJECTION, + framebuffer, + FALSE /* enable flip */); + if (ctx->current_modelview_entry) + _cogl_matrix_entry_flush_to_gl_builtins (ctx, + ctx->current_modelview_entry, + COGL_MATRIX_MODELVIEW, + framebuffer, + FALSE /* enable flip */); +} + +const CoglPipelineProgend _cogl_pipeline_fixed_progend = + { + COGL_PIPELINE_VERTEND_FIXED, + COGL_PIPELINE_FRAGEND_FIXED, + _cogl_pipeline_progend_fixed_start, + NULL, /* end */ + NULL, /* pre_change_notify */ + NULL, /* layer_pre_change_notify */ + _cogl_pipeline_progend_fixed_pre_paint + }; + +#endif /* COGL_PIPELINE_PROGEND_FIXED */ diff --git a/cogl/driver/gl/cogl-pipeline-progend-glsl-private.h b/cogl/driver/gl/cogl-pipeline-progend-glsl-private.h new file mode 100644 index 0000000..d57519b --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-progend-glsl-private.h @@ -0,0 +1,47 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H +#define __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H + +#include "cogl-pipeline-private.h" +#include "cogl-attribute-private.h" + +extern const CoglPipelineProgend _cogl_pipeline_glsl_progend; + +int +_cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline, + int name_index); + +#endif /* __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/driver/gl/cogl-pipeline-progend-glsl.c new file mode 100644 index 0000000..8884ce6 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -0,0 +1,1074 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-offscreen.h" + +#ifdef COGL_PIPELINE_PROGEND_GLSL + +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-program-private.h" +#include "cogl-pipeline-fragend-glsl-private.h" +#include "cogl-pipeline-vertend-glsl-private.h" +#include "cogl-pipeline-cache.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-attribute-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-pipeline-progend-glsl-private.h" + +/* These are used to generalise updating some uniforms that are + required when building for drivers missing some fixed function + state that we use */ + +typedef void (* UpdateUniformFunc) (CoglPipeline *pipeline, + int uniform_location, + void *getter_func); + +static void update_float_uniform (CoglPipeline *pipeline, + int uniform_location, + void *getter_func); + +typedef struct +{ + const char *uniform_name; + void *getter_func; + UpdateUniformFunc update_func; + CoglPipelineState change; + + /* This builtin is only necessary if the following private feature + * is not implemented in the driver */ + CoglPrivateFeature feature_replacement; +} BuiltinUniformData; + +static BuiltinUniformData builtin_uniforms[] = + { + { "cogl_point_size_in", + cogl_pipeline_get_point_size, update_float_uniform, + COGL_PIPELINE_STATE_POINT_SIZE, + COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM }, + { "_cogl_alpha_test_ref", + cogl_pipeline_get_alpha_test_reference, update_float_uniform, + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE, + COGL_PRIVATE_FEATURE_ALPHA_TEST } + }; + +const CoglPipelineProgend _cogl_pipeline_glsl_progend; + +typedef struct _UnitState +{ + unsigned int dirty_combine_constant:1; + unsigned int dirty_texture_matrix:1; + + GLint combine_constant_uniform; + + GLint texture_matrix_uniform; +} UnitState; + +typedef struct +{ + unsigned int ref_count; + + /* Age that the user program had last time we generated a GL + program. If it's different then we need to relink the program */ + unsigned int user_program_age; + + GLuint program; + + unsigned long dirty_builtin_uniforms; + GLint builtin_uniform_locations[G_N_ELEMENTS (builtin_uniforms)]; + + GLint modelview_uniform; + GLint projection_uniform; + GLint mvp_uniform; + + CoglMatrixEntryCache projection_cache; + CoglMatrixEntryCache modelview_cache; + + /* We need to track the last pipeline that the program was used with + * so know if we need to update all of the uniforms */ + CoglPipeline *last_used_for_pipeline; + + /* Array of GL uniform locations indexed by Cogl's uniform + location. We are careful only to allocated this array if a custom + uniform is actually set */ + GArray *uniform_locations; + + /* Array of attribute locations. */ + GArray *attribute_locations; + + /* The 'flip' uniform is used to flip the geometry upside-down when + the framebuffer requires it only when there are vertex + snippets. Otherwise this is acheived using the projection + matrix */ + GLint flip_uniform; + int flushed_flip_state; + + UnitState *unit_state; + + CoglPipelineCacheEntry *cache_entry; +} CoglPipelineProgramState; + +static CoglUserDataKey program_state_key; + +static CoglPipelineProgramState * +get_program_state (CoglPipeline *pipeline) +{ + return cogl_object_get_user_data (COGL_OBJECT (pipeline), &program_state_key); +} + +#define UNIFORM_LOCATION_UNKNOWN -2 + +#define ATTRIBUTE_LOCATION_UNKNOWN -2 + +/* Under GLES2 the vertex attribute API needs to query the attribute + numbers because it can't used the fixed function API to set the + builtin attributes. We cache the attributes here because the + progend knows when the program is changed so it can clear the + cache. This should always be called after the pipeline is flushed + so they can assert that the gl program is valid */ + +/* All attributes names get internally mapped to a global set of + * sequential indices when they are setup which we need to need to + * then be able to map to a GL attribute location once we have + * a linked GLSL program */ + +int +_cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline, + int name_index) +{ + CoglPipelineProgramState *program_state = get_program_state (pipeline); + int *locations; + + _COGL_GET_CONTEXT (ctx, -1); + + _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1); + _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1); + + if (G_UNLIKELY (program_state->attribute_locations == NULL)) + program_state->attribute_locations = + g_array_new (FALSE, FALSE, sizeof (int)); + + if (G_UNLIKELY (program_state->attribute_locations->len <= name_index)) + { + int i = program_state->attribute_locations->len; + g_array_set_size (program_state->attribute_locations, name_index + 1); + for (; i < program_state->attribute_locations->len; i++) + g_array_index (program_state->attribute_locations, int, i) + = ATTRIBUTE_LOCATION_UNKNOWN; + } + + locations = &g_array_index (program_state->attribute_locations, int, 0); + + if (locations[name_index] == ATTRIBUTE_LOCATION_UNKNOWN) + { + CoglAttributeNameState *name_state = + g_array_index (ctx->attribute_name_index_map, + CoglAttributeNameState *, name_index); + + _COGL_RETURN_VAL_IF_FAIL (name_state != NULL, 0); + + GE_RET( locations[name_index], + ctx, glGetAttribLocation (program_state->program, + name_state->name) ); + } + + return locations[name_index]; +} + +static void +clear_attribute_cache (CoglPipelineProgramState *program_state) +{ + if (program_state->attribute_locations) + { + g_array_free (program_state->attribute_locations, TRUE); + program_state->attribute_locations = NULL; + } +} + +static void +clear_flushed_matrix_stacks (CoglPipelineProgramState *program_state) +{ + _cogl_matrix_entry_cache_destroy (&program_state->projection_cache); + _cogl_matrix_entry_cache_init (&program_state->projection_cache); + _cogl_matrix_entry_cache_destroy (&program_state->modelview_cache); + _cogl_matrix_entry_cache_init (&program_state->modelview_cache); +} + +static CoglPipelineProgramState * +program_state_new (int n_layers, + CoglPipelineCacheEntry *cache_entry) +{ + CoglPipelineProgramState *program_state; + + program_state = g_slice_new (CoglPipelineProgramState); + program_state->ref_count = 1; + program_state->program = 0; + program_state->unit_state = g_new (UnitState, n_layers); + program_state->uniform_locations = NULL; + program_state->attribute_locations = NULL; + program_state->cache_entry = cache_entry; + _cogl_matrix_entry_cache_init (&program_state->modelview_cache); + _cogl_matrix_entry_cache_init (&program_state->projection_cache); + + return program_state; +} + +static void +destroy_program_state (void *user_data, + void *instance) +{ + CoglPipelineProgramState *program_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If the program state was last used for this pipeline then clear + it so that if same address gets used again for a new pipeline + then we won't think it's the same pipeline and avoid updating the + uniforms */ + if (program_state->last_used_for_pipeline == instance) + program_state->last_used_for_pipeline = NULL; + + if (program_state->cache_entry && + program_state->cache_entry->pipeline != instance) + program_state->cache_entry->usage_count--; + + if (--program_state->ref_count == 0) + { + clear_attribute_cache (program_state); + + _cogl_matrix_entry_cache_destroy (&program_state->projection_cache); + _cogl_matrix_entry_cache_destroy (&program_state->modelview_cache); + + if (program_state->program) + GE( ctx, glDeleteProgram (program_state->program) ); + + g_free (program_state->unit_state); + + if (program_state->uniform_locations) + g_array_free (program_state->uniform_locations, TRUE); + + g_slice_free (CoglPipelineProgramState, program_state); + } +} + +static void +set_program_state (CoglPipeline *pipeline, + CoglPipelineProgramState *program_state) +{ + if (program_state) + { + program_state->ref_count++; + + /* If we're not setting the state on the template pipeline then + * mark it as a usage of the pipeline cache entry */ + if (program_state->cache_entry && + program_state->cache_entry->pipeline != pipeline) + program_state->cache_entry->usage_count++; + } + + _cogl_object_set_user_data (COGL_OBJECT (pipeline), + &program_state_key, + program_state, + destroy_program_state); +} + +static void +dirty_program_state (CoglPipeline *pipeline) +{ + cogl_object_set_user_data (COGL_OBJECT (pipeline), + &program_state_key, + NULL, + NULL); +} + +static void +link_program (GLint gl_program) +{ + GLint link_status; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE( ctx, glLinkProgram (gl_program) ); + + GE( ctx, glGetProgramiv (gl_program, GL_LINK_STATUS, &link_status) ); + + if (!link_status) + { + GLint log_length; + GLsizei out_log_length; + char *log; + + GE( ctx, glGetProgramiv (gl_program, GL_INFO_LOG_LENGTH, &log_length) ); + + log = g_malloc (log_length); + + GE( ctx, glGetProgramInfoLog (gl_program, log_length, + &out_log_length, log) ); + + g_warning ("Failed to link GLSL program:\n%.*s\n", + log_length, log); + + g_free (log); + } +} + +typedef struct +{ + int unit; + GLuint gl_program; + CoglBool update_all; + CoglPipelineProgramState *program_state; +} UpdateUniformsState; + +static CoglBool +get_uniform_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + UpdateUniformsState *state = user_data; + CoglPipelineProgramState *program_state = state->program_state; + UnitState *unit_state = &program_state->unit_state[state->unit]; + GLint uniform_location; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* We can reuse the source buffer to create the uniform name because + the program has now been linked */ + g_string_set_size (ctx->codegen_source_buffer, 0); + g_string_append_printf (ctx->codegen_source_buffer, + "cogl_sampler%i", layer_index); + + GE_RET( uniform_location, + ctx, glGetUniformLocation (state->gl_program, + ctx->codegen_source_buffer->str) ); + + /* We can set the uniform immediately because the samplers are the + unit index not the texture object number so it will never + change. Unfortunately GL won't let us use a constant instead of a + uniform */ + if (uniform_location != -1) + GE( ctx, glUniform1i (uniform_location, state->unit) ); + + g_string_set_size (ctx->codegen_source_buffer, 0); + g_string_append_printf (ctx->codegen_source_buffer, + "_cogl_layer_constant_%i", layer_index); + + GE_RET( uniform_location, + ctx, glGetUniformLocation (state->gl_program, + ctx->codegen_source_buffer->str) ); + + unit_state->combine_constant_uniform = uniform_location; + + g_string_set_size (ctx->codegen_source_buffer, 0); + g_string_append_printf (ctx->codegen_source_buffer, + "cogl_texture_matrix[%i]", layer_index); + + GE_RET( uniform_location, + ctx, glGetUniformLocation (state->gl_program, + ctx->codegen_source_buffer->str) ); + + unit_state->texture_matrix_uniform = uniform_location; + + state->unit++; + + return TRUE; +} + +static CoglBool +update_constants_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + UpdateUniformsState *state = user_data; + CoglPipelineProgramState *program_state = state->program_state; + UnitState *unit_state = &program_state->unit_state[state->unit++]; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (unit_state->combine_constant_uniform != -1 && + (state->update_all || unit_state->dirty_combine_constant)) + { + float constant[4]; + _cogl_pipeline_get_layer_combine_constant (pipeline, + layer_index, + constant); + GE (ctx, glUniform4fv (unit_state->combine_constant_uniform, + 1, constant)); + unit_state->dirty_combine_constant = FALSE; + } + + if (unit_state->texture_matrix_uniform != -1 && + (state->update_all || unit_state->dirty_texture_matrix)) + { + const CoglMatrix *matrix; + const float *array; + + matrix = _cogl_pipeline_get_layer_matrix (pipeline, layer_index); + array = cogl_matrix_get_array (matrix); + GE (ctx, glUniformMatrix4fv (unit_state->texture_matrix_uniform, + 1, FALSE, array)); + unit_state->dirty_texture_matrix = FALSE; + } + + return TRUE; +} + +static void +update_builtin_uniforms (CoglContext *context, + CoglPipeline *pipeline, + GLuint gl_program, + CoglPipelineProgramState *program_state) +{ + int i; + + if (program_state->dirty_builtin_uniforms == 0) + return; + + for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) + if (!_cogl_has_private_feature (context, + builtin_uniforms[i].feature_replacement) && + (program_state->dirty_builtin_uniforms & (1 << i)) && + program_state->builtin_uniform_locations[i] != -1) + builtin_uniforms[i].update_func (pipeline, + program_state + ->builtin_uniform_locations[i], + builtin_uniforms[i].getter_func); + + program_state->dirty_builtin_uniforms = 0; +} + +typedef struct +{ + CoglPipelineProgramState *program_state; + unsigned long *uniform_differences; + int n_differences; + CoglContext *ctx; + const CoglBoxedValue *values; + int value_index; +} FlushUniformsClosure; + +static CoglBool +flush_uniform_cb (int uniform_num, void *user_data) +{ + FlushUniformsClosure *data = user_data; + + if (COGL_FLAGS_GET (data->uniform_differences, uniform_num)) + { + GArray *uniform_locations; + GLint uniform_location; + + if (data->program_state->uniform_locations == NULL) + data->program_state->uniform_locations = + g_array_new (FALSE, FALSE, sizeof (GLint)); + + uniform_locations = data->program_state->uniform_locations; + + if (uniform_locations->len <= uniform_num) + { + unsigned int old_len = uniform_locations->len; + + g_array_set_size (uniform_locations, uniform_num + 1); + + while (old_len <= uniform_num) + { + g_array_index (uniform_locations, GLint, old_len) = + UNIFORM_LOCATION_UNKNOWN; + old_len++; + } + } + + uniform_location = g_array_index (uniform_locations, GLint, uniform_num); + + if (uniform_location == UNIFORM_LOCATION_UNKNOWN) + { + const char *uniform_name = + g_ptr_array_index (data->ctx->uniform_names, uniform_num); + + uniform_location = + data->ctx->glGetUniformLocation (data->program_state->program, + uniform_name); + g_array_index (uniform_locations, GLint, uniform_num) = + uniform_location; + } + + if (uniform_location != -1) + _cogl_boxed_value_set_uniform (data->ctx, + uniform_location, + data->values + data->value_index); + + data->n_differences--; + COGL_FLAGS_SET (data->uniform_differences, uniform_num, FALSE); + } + + data->value_index++; + + return data->n_differences > 0; +} + +static void +_cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline, + CoglPipelineProgramState * + program_state, + GLuint gl_program, + CoglBool program_changed) +{ + CoglPipelineUniformsState *uniforms_state; + FlushUniformsClosure data; + int n_uniform_longs; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS) + uniforms_state = &pipeline->big_state->uniforms_state; + else + uniforms_state = NULL; + + data.program_state = program_state; + data.ctx = ctx; + + n_uniform_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names); + + data.uniform_differences = g_newa (unsigned long, n_uniform_longs); + + /* Try to find a common ancestor for the values that were already + flushed on the pipeline that this program state was last used for + so we can avoid flushing those */ + + if (program_changed || program_state->last_used_for_pipeline == NULL) + { + if (program_changed) + { + /* The program has changed so all of the uniform locations + are invalid */ + if (program_state->uniform_locations) + g_array_set_size (program_state->uniform_locations, 0); + } + + /* We need to flush everything so mark all of the uniforms as + dirty */ + memset (data.uniform_differences, 0xff, + n_uniform_longs * sizeof (unsigned long)); + data.n_differences = G_MAXINT; + } + else if (program_state->last_used_for_pipeline) + { + int i; + + memset (data.uniform_differences, 0, + n_uniform_longs * sizeof (unsigned long)); + _cogl_pipeline_compare_uniform_differences + (data.uniform_differences, + program_state->last_used_for_pipeline, + pipeline); + + /* We need to be sure to flush any uniforms that have changed + since the last flush */ + if (uniforms_state) + _cogl_bitmask_set_flags (&uniforms_state->changed_mask, + data.uniform_differences); + + /* Count the number of differences. This is so we can stop early + when we've flushed all of them */ + data.n_differences = 0; + + for (i = 0; i < n_uniform_longs; i++) + data.n_differences += + _cogl_util_popcountl (data.uniform_differences[i]); + } + + while (pipeline && data.n_differences > 0) + { + if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS) + { + const CoglPipelineUniformsState *parent_uniforms_state = + &pipeline->big_state->uniforms_state; + + data.values = parent_uniforms_state->override_values; + data.value_index = 0; + + _cogl_bitmask_foreach (&parent_uniforms_state->override_mask, + flush_uniform_cb, + &data); + } + + pipeline = _cogl_pipeline_get_parent (pipeline); + } + + if (uniforms_state) + _cogl_bitmask_clear_all (&uniforms_state->changed_mask); +} + +static CoglBool +_cogl_pipeline_progend_glsl_start (CoglPipeline *pipeline) +{ + CoglHandle user_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL)) + return FALSE; + + user_program = cogl_pipeline_get_user_program (pipeline); + if (user_program && + _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL) + return FALSE; + + return TRUE; +} + +static void +_cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + CoglPipelineProgramState *program_state; + GLuint gl_program; + CoglBool program_changed = FALSE; + UpdateUniformsState state; + CoglProgram *user_program; + CoglPipelineCacheEntry *cache_entry = NULL; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + program_state = get_program_state (pipeline); + + user_program = cogl_pipeline_get_user_program (pipeline); + + if (program_state == NULL) + { + CoglPipeline *authority; + + /* Get the authority for anything affecting program state. This + should include both fragment codegen state and vertex codegen + state */ + authority = _cogl_pipeline_find_equivalent_parent + (pipeline, + (_cogl_pipeline_get_state_for_vertex_codegen (ctx) | + _cogl_pipeline_get_state_for_fragment_codegen (ctx)) & + ~COGL_PIPELINE_STATE_LAYERS, + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN); + + program_state = get_program_state (authority); + + if (program_state == NULL) + { + /* Check if there is already a similar cached pipeline whose + program state we can share */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED + (COGL_DEBUG_DISABLE_PROGRAM_CACHES)))) + { + cache_entry = + _cogl_pipeline_cache_get_combined_template (ctx->pipeline_cache, + authority); + + program_state = get_program_state (cache_entry->pipeline); + } + + if (program_state) + program_state->ref_count++; + else + program_state + = program_state_new (cogl_pipeline_get_n_layers (authority), + cache_entry); + + set_program_state (authority, program_state); + + program_state->ref_count--; + + if (cache_entry) + set_program_state (cache_entry->pipeline, program_state); + } + + if (authority != pipeline) + set_program_state (pipeline, program_state); + } + + /* If the program has changed since the last link then we do + * need to relink */ + if (program_state->program && user_program && + user_program->age != program_state->user_program_age) + { + GE( ctx, glDeleteProgram (program_state->program) ); + program_state->program = 0; + } + + if (program_state->program == 0) + { + GLuint backend_shader; + GSList *l; + + GE_RET( program_state->program, ctx, glCreateProgram () ); + + /* Attach all of the shader from the user program */ + if (user_program) + { + for (l = user_program->attached_shaders; l; l = l->next) + { + CoglShader *shader = l->data; + + _cogl_shader_compile_real (shader, pipeline); + + g_assert (shader->language == COGL_SHADER_LANGUAGE_GLSL); + + GE( ctx, glAttachShader (program_state->program, + shader->gl_handle) ); + } + + program_state->user_program_age = user_program->age; + } + + /* Attach any shaders from the GLSL backends */ + if ((backend_shader = _cogl_pipeline_fragend_glsl_get_shader (pipeline))) + GE( ctx, glAttachShader (program_state->program, backend_shader) ); + if ((backend_shader = _cogl_pipeline_vertend_glsl_get_shader (pipeline))) + GE( ctx, glAttachShader (program_state->program, backend_shader) ); + + /* XXX: OpenGL as a special case requires the vertex position to + * be bound to generic attribute 0 so for simplicity we + * unconditionally bind the cogl_position_in attribute here... + */ + GE( ctx, glBindAttribLocation (program_state->program, + 0, "cogl_position_in")); + + link_program (program_state->program); + + program_changed = TRUE; + } + + gl_program = program_state->program; + + _cogl_use_fragment_program (gl_program, COGL_PIPELINE_PROGRAM_TYPE_GLSL); + _cogl_use_vertex_program (gl_program, COGL_PIPELINE_PROGRAM_TYPE_GLSL); + + state.unit = 0; + state.gl_program = gl_program; + state.program_state = program_state; + + if (program_changed) + { + cogl_pipeline_foreach_layer (pipeline, + get_uniform_cb, + &state); + clear_attribute_cache (program_state); + + GE_RET (program_state->flip_uniform, + ctx, glGetUniformLocation (gl_program, "_cogl_flip_vector")); + program_state->flushed_flip_state = -1; + } + + state.unit = 0; + state.update_all = (program_changed || + program_state->last_used_for_pipeline != pipeline); + + cogl_pipeline_foreach_layer (pipeline, + update_constants_cb, + &state); + + if (program_changed) + { + int i; + + clear_flushed_matrix_stacks (program_state); + + for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) + if (!_cogl_has_private_feature + (ctx, builtin_uniforms[i].feature_replacement)) + GE_RET( program_state->builtin_uniform_locations[i], ctx, + glGetUniformLocation (gl_program, + builtin_uniforms[i].uniform_name) ); + + GE_RET( program_state->modelview_uniform, ctx, + glGetUniformLocation (gl_program, + "cogl_modelview_matrix") ); + + GE_RET( program_state->projection_uniform, ctx, + glGetUniformLocation (gl_program, + "cogl_projection_matrix") ); + + GE_RET( program_state->mvp_uniform, ctx, + glGetUniformLocation (gl_program, + "cogl_modelview_projection_matrix") ); + } + + if (program_changed || + program_state->last_used_for_pipeline != pipeline) + program_state->dirty_builtin_uniforms = ~(unsigned long) 0; + + update_builtin_uniforms (ctx, pipeline, gl_program, program_state); + + _cogl_pipeline_progend_glsl_flush_uniforms (pipeline, + program_state, + gl_program, + program_changed); + + if (user_program) + _cogl_program_flush_uniforms (user_program, + gl_program, + program_changed); + + /* We need to track the last pipeline that the program was used with + * so know if we need to update all of the uniforms */ + program_state->last_used_for_pipeline = pipeline; +} + +static void +_cogl_pipeline_progend_glsl_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & (_cogl_pipeline_get_state_for_vertex_codegen (ctx) | + _cogl_pipeline_get_state_for_fragment_codegen (ctx)))) + { + dirty_program_state (pipeline); + } + else + { + int i; + + for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) + if (!_cogl_has_private_feature + (ctx, builtin_uniforms[i].feature_replacement) && + (change & builtin_uniforms[i].change)) + { + CoglPipelineProgramState *program_state + = get_program_state (pipeline); + if (program_state) + program_state->dirty_builtin_uniforms |= 1 << i; + return; + } + } +} + +/* NB: layers are considered immutable once they have any dependants + * so although multiple pipelines can end up depending on a single + * static layer, we can guarantee that if a layer is being *changed* + * then it can only have one pipeline depending on it. + * + * XXX: Don't forget this is *pre* change, we can't read the new value + * yet! + */ +static void +_cogl_pipeline_progend_glsl_layer_pre_change_notify ( + CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & (_cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN))) + { + dirty_program_state (owner); + } + else if (change & COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT) + { + CoglPipelineProgramState *program_state = get_program_state (owner); + if (program_state) + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + program_state->unit_state[unit_index].dirty_combine_constant = TRUE; + } + } + else if (change & COGL_PIPELINE_LAYER_STATE_USER_MATRIX) + { + CoglPipelineProgramState *program_state = get_program_state (owner); + if (program_state) + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + program_state->unit_state[unit_index].dirty_texture_matrix = TRUE; + } + } +} + +static void +_cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline, + CoglFramebuffer *framebuffer) +{ + CoglBool needs_flip; + CoglMatrixEntry *projection_entry; + CoglMatrixEntry *modelview_entry; + CoglPipelineProgramState *program_state; + CoglBool modelview_changed; + CoglBool projection_changed; + CoglBool need_modelview; + CoglBool need_projection; + CoglMatrix modelview, projection; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + program_state = get_program_state (pipeline); + + projection_entry = ctx->current_projection_entry; + modelview_entry = ctx->current_modelview_entry; + + /* An initial pipeline is flushed while creating the context. At + this point there are no matrices selected so we can't do + anything */ + if (modelview_entry == NULL || projection_entry == NULL) + return; + + needs_flip = cogl_is_offscreen (ctx->current_draw_buffer); + + projection_changed = + _cogl_matrix_entry_cache_maybe_update (&program_state->projection_cache, + projection_entry, + (needs_flip && + program_state->flip_uniform == + -1)); + + modelview_changed = + _cogl_matrix_entry_cache_maybe_update (&program_state->modelview_cache, + modelview_entry, + /* never flip modelview */ + FALSE); + + if (modelview_changed || projection_changed) + { + if (program_state->mvp_uniform != -1) + need_modelview = need_projection = TRUE; + else + { + need_projection = (program_state->projection_uniform != -1 && + projection_changed); + need_modelview = (program_state->modelview_uniform != -1 && + modelview_changed); + } + + if (need_modelview) + cogl_matrix_entry_get (modelview_entry, &modelview); + if (need_projection) + { + if (needs_flip && program_state->flip_uniform == -1) + { + CoglMatrix tmp_matrix; + cogl_matrix_entry_get (projection_entry, &tmp_matrix); + cogl_matrix_multiply (&projection, + &ctx->y_flip_matrix, + &tmp_matrix); + } + else + cogl_matrix_entry_get (projection_entry, &projection); + } + + if (projection_changed && program_state->projection_uniform != -1) + GE (ctx, glUniformMatrix4fv (program_state->projection_uniform, + 1, /* count */ + FALSE, /* transpose */ + cogl_matrix_get_array (&projection))); + + if (modelview_changed && program_state->modelview_uniform != -1) + GE (ctx, glUniformMatrix4fv (program_state->modelview_uniform, + 1, /* count */ + FALSE, /* transpose */ + cogl_matrix_get_array (&modelview))); + + if (program_state->mvp_uniform != -1) + { + /* The journal usually uses an identity matrix for the + modelview so we can optimise this common case by + avoiding the matrix multiplication */ + if (cogl_matrix_entry_is_identity (modelview_entry)) + { + GE (ctx, + glUniformMatrix4fv (program_state->mvp_uniform, + 1, /* count */ + FALSE, /* transpose */ + cogl_matrix_get_array (&projection))); + } + else + { + CoglMatrix combined; + + cogl_matrix_multiply (&combined, + &projection, + &modelview); + GE (ctx, + glUniformMatrix4fv (program_state->mvp_uniform, + 1, /* count */ + FALSE, /* transpose */ + cogl_matrix_get_array (&combined))); + } + } + } + + if (program_state->flip_uniform != -1 + && program_state->flushed_flip_state != needs_flip) + { + static const float do_flip[4] = { 1.0f, -1.0f, 1.0f, 1.0f }; + static const float dont_flip[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + GE( ctx, glUniform4fv (program_state->flip_uniform, + 1, /* count */ + needs_flip ? do_flip : dont_flip) ); + program_state->flushed_flip_state = needs_flip; + } +} + +static void +update_float_uniform (CoglPipeline *pipeline, + int uniform_location, + void *getter_func) +{ + float (* float_getter_func) (CoglPipeline *) = getter_func; + float value; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + value = float_getter_func (pipeline); + GE( ctx, glUniform1f (uniform_location, value) ); +} + +const CoglPipelineProgend _cogl_pipeline_glsl_progend = + { + COGL_PIPELINE_VERTEND_GLSL, + COGL_PIPELINE_FRAGEND_GLSL, + _cogl_pipeline_progend_glsl_start, + _cogl_pipeline_progend_glsl_end, + _cogl_pipeline_progend_glsl_pre_change_notify, + _cogl_pipeline_progend_glsl_layer_pre_change_notify, + _cogl_pipeline_progend_glsl_pre_paint + }; + +#endif /* COGL_PIPELINE_PROGEND_GLSL */ diff --git a/cogl/driver/gl/cogl-pipeline-vertend-fixed-private.h b/cogl/driver/gl/cogl-pipeline-vertend-fixed-private.h new file mode 100644 index 0000000..97dee54 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-vertend-fixed-private.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H +#define __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineVertend _cogl_pipeline_fixed_vertend; + +#endif /* __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-vertend-fixed.c b/cogl/driver/gl/cogl-pipeline-vertend-fixed.c new file mode 100644 index 0000000..f34a012 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-vertend-fixed.c @@ -0,0 +1,121 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-framebuffer-private.h" + +#ifdef COGL_PIPELINE_VERTEND_FIXED + +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-program-private.h" + +const CoglPipelineVertend _cogl_pipeline_fixed_vertend; + +static void +_cogl_pipeline_vertend_fixed_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference) +{ + _cogl_use_vertex_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED); +} + +static CoglBool +_cogl_pipeline_vertend_fixed_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference, + CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index); + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_USER_MATRIX) + { + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_USER_MATRIX; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, state); + CoglMatrixEntry *matrix_entry; + + cogl_matrix_stack_set (unit->matrix_stack, + &authority->big_state->matrix); + + _cogl_set_active_texture_unit (unit_index); + + matrix_entry = unit->matrix_stack->last_entry; + _cogl_matrix_entry_flush_to_gl_builtins (ctx, matrix_entry, + COGL_MATRIX_TEXTURE, + framebuffer, + FALSE /* enable flip */); + } + + return TRUE; +} + +static CoglBool +_cogl_pipeline_vertend_fixed_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + if (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE); + + if (authority->big_state->point_size > 0.0f) + GE( ctx, glPointSize (authority->big_state->point_size) ); + } + + return TRUE; +} + +const CoglPipelineVertend _cogl_pipeline_fixed_vertend = +{ + _cogl_pipeline_vertend_fixed_start, + _cogl_pipeline_vertend_fixed_add_layer, + _cogl_pipeline_vertend_fixed_end, + NULL, /* pipeline_change_notify */ + NULL /* layer_change_notify */ +}; + +#endif /* COGL_PIPELINE_VERTEND_FIXED */ + diff --git a/cogl/driver/gl/cogl-pipeline-vertend-glsl-private.h b/cogl/driver/gl/cogl-pipeline-vertend-glsl-private.h new file mode 100644 index 0000000..4bd3823 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-vertend-glsl-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_VERTEND_GLSL_PRIVATE_H +#define __COGL_PIPELINE_VERTEND_GLSL_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineVertend _cogl_pipeline_glsl_vertend; + +GLuint +_cogl_pipeline_vertend_glsl_get_shader (CoglPipeline *pipeline); + +#endif /* __COGL_PIPELINE_VERTEND_GLSL_PRIVATE_H */ + diff --git a/cogl/driver/gl/cogl-pipeline-vertend-glsl.c b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c new file mode 100644 index 0000000..c9e6a28 --- /dev/null +++ b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c @@ -0,0 +1,680 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" + +#ifdef COGL_PIPELINE_VERTEND_GLSL + +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-program-private.h" +#include "cogl-pipeline-vertend-glsl-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-glsl-shader-private.h" + +const CoglPipelineVertend _cogl_pipeline_glsl_vertend; + +typedef struct +{ + unsigned int ref_count; + + GLuint gl_shader; + GString *header, *source; + + CoglPipelineCacheEntry *cache_entry; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static CoglPipelineShaderState * +shader_state_new (CoglPipelineCacheEntry *cache_entry) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + shader_state->cache_entry = cache_entry; + + return shader_state; +} + +static CoglPipelineShaderState * +get_shader_state (CoglPipeline *pipeline) +{ + return cogl_object_get_user_data (COGL_OBJECT (pipeline), &shader_state_key); +} + +static void +destroy_shader_state (void *user_data, + void *instance) +{ + CoglPipelineShaderState *shader_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != instance) + shader_state->cache_entry->usage_count--; + + if (--shader_state->ref_count == 0) + { + if (shader_state->gl_shader) + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + + g_slice_free (CoglPipelineShaderState, shader_state); + } +} + +static void +set_shader_state (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + if (shader_state) + { + shader_state->ref_count++; + + /* If we're not setting the state on the template pipeline then + * mark it as a usage of the pipeline cache entry */ + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != pipeline) + shader_state->cache_entry->usage_count++; + } + + _cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + shader_state, + destroy_shader_state); +} + +static void +dirty_shader_state (CoglPipeline *pipeline) +{ + cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + NULL, + NULL); +} + +GLuint +_cogl_pipeline_vertend_glsl_get_shader (CoglPipeline *pipeline) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + + if (shader_state) + return shader_state->gl_shader; + else + return 0; +} + +static CoglPipelineSnippetList * +get_vertex_snippets (CoglPipeline *pipeline) +{ + pipeline = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + + return &pipeline->big_state->vertex_snippets; +} + +static CoglPipelineSnippetList * +get_layer_vertex_snippets (CoglPipelineLayer *layer) +{ + unsigned long state = COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS; + layer = _cogl_pipeline_layer_get_authority (layer, state); + + return &layer->big_state->vertex_snippets; +} + +static CoglBool +add_layer_declaration_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineShaderState *shader_state = user_data; + CoglTextureType texture_type = + _cogl_pipeline_layer_get_texture_type (layer); + const char *target_string; + + _cogl_gl_util_get_texture_target_string (texture_type, &target_string, NULL); + + g_string_append_printf (shader_state->header, + "uniform sampler%s cogl_sampler%i;\n", + target_string, + layer->index); + + return TRUE; +} + +static void +add_layer_declarations (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + /* We always emit sampler uniforms in case there will be custom + * layer snippets that want to sample arbitrary layers. */ + + _cogl_pipeline_foreach_layer_internal (pipeline, + add_layer_declaration_cb, + shader_state); +} + +static void +add_global_declarations (CoglPipeline *pipeline, + CoglPipelineShaderState *shader_state) +{ + CoglSnippetHook hook = COGL_SNIPPET_HOOK_VERTEX_GLOBALS; + CoglPipelineSnippetList *snippets = get_vertex_snippets (pipeline); + + /* Add the global data hooks. All of the code in these snippets is + * always added and only the declarations data is used */ + + _cogl_pipeline_snippet_generate_declarations (shader_state->header, + hook, + snippets); +} + +static void +_cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state; + CoglPipelineCacheEntry *cache_entry = NULL; + CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Now lookup our glsl backend private state (allocating if + * necessary) */ + shader_state = get_shader_state (pipeline); + + if (shader_state == NULL) + { + CoglPipeline *authority; + + /* Get the authority for anything affecting vertex shader + state */ + authority = _cogl_pipeline_find_equivalent_parent + (pipeline, + _cogl_pipeline_get_state_for_vertex_codegen (ctx) & + ~COGL_PIPELINE_STATE_LAYERS, + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN); + + shader_state = get_shader_state (authority); + + if (shader_state == NULL) + { + /* Check if there is already a similar cached pipeline whose + shader state we can share */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED + (COGL_DEBUG_DISABLE_PROGRAM_CACHES)))) + { + cache_entry = + _cogl_pipeline_cache_get_vertex_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (cache_entry->pipeline); + } + + if (shader_state) + shader_state->ref_count++; + else + shader_state = shader_state_new (cache_entry); + + set_shader_state (authority, shader_state); + + shader_state->ref_count--; + + if (cache_entry) + set_shader_state (cache_entry->pipeline, shader_state); + } + + if (authority != pipeline) + set_shader_state (pipeline, shader_state); + } + + if (user_program) + { + /* If the user program contains a vertex shader then we don't need + to generate one */ + if (_cogl_program_has_vertex_shader (user_program)) + { + if (shader_state->gl_shader) + { + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + shader_state->gl_shader = 0; + } + return; + } + } + + if (shader_state->gl_shader) + return; + + /* If we make it here then we have a shader_state struct without a gl_shader + either because this is the first time we've encountered it or + because the user program has changed */ + + /* We reuse two grow-only GStrings for code-gen. One string + contains the uniform and attribute declarations while the + other contains the main function. We need two strings + because we need to dynamically declare attributes as the + add_layer callback is invoked */ + g_string_set_size (ctx->codegen_header_buffer, 0); + g_string_set_size (ctx->codegen_source_buffer, 0); + shader_state->header = ctx->codegen_header_buffer; + shader_state->source = ctx->codegen_source_buffer; + + add_layer_declarations (pipeline, shader_state); + add_global_declarations (pipeline, shader_state); + + g_string_append (shader_state->source, + "void\n" + "cogl_generated_source ()\n" + "{\n"); + + if (cogl_pipeline_get_per_vertex_point_size (pipeline)) + g_string_append (shader_state->header, + "attribute float cogl_point_size_in;\n"); + else if (!_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM)) + { + /* There is no builtin uniform for the point size on GLES2 so we + need to copy it from the custom uniform in the vertex shader + if we're not using per-vertex point sizes, however we'll only + do this if the point-size is non-zero. Toggle the point size + between zero and non-zero causes a state change which + generates a new program */ + if (cogl_pipeline_get_point_size (pipeline) > 0.0f) + { + g_string_append (shader_state->header, + "uniform float cogl_point_size_in;\n"); + g_string_append (shader_state->source, + " cogl_point_size_out = cogl_point_size_in;\n"); + } + } +} + +static CoglBool +_cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference, + CoglFramebuffer *framebuffer) +{ + CoglPipelineShaderState *shader_state; + CoglPipelineSnippetData snippet_data; + int layer_index = layer->index; + + _COGL_GET_CONTEXT (ctx, FALSE); + + shader_state = get_shader_state (pipeline); + + if (shader_state->source == NULL) + return TRUE; + + /* Transform the texture coordinates by the layer's user matrix. + * + * FIXME: this should avoid doing the transform if there is no user + * matrix set. This might need a separate layer state flag for + * whether there is a user matrix + * + * FIXME: we could be more clever here and try to detect if the + * fragment program is going to use the texture coordinates and + * avoid setting them if not + */ + + g_string_append_printf (shader_state->header, + "vec4\n" + "cogl_real_transform_layer%i (mat4 matrix, " + "vec4 tex_coord)\n" + "{\n" + " return matrix * tex_coord;\n" + "}\n", + layer_index); + + /* Wrap the layer code in any snippets that have been hooked */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = get_layer_vertex_snippets (layer); + snippet_data.hook = COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM; + snippet_data.chain_function = g_strdup_printf ("cogl_real_transform_layer%i", + layer_index); + snippet_data.final_name = g_strdup_printf ("cogl_transform_layer%i", + layer_index); + snippet_data.function_prefix = g_strdup_printf ("cogl_transform_layer%i", + layer_index); + snippet_data.return_type = "vec4"; + snippet_data.return_variable = "cogl_tex_coord"; + snippet_data.return_variable_is_argument = TRUE; + snippet_data.arguments = "cogl_matrix, cogl_tex_coord"; + snippet_data.argument_declarations = "mat4 cogl_matrix, vec4 cogl_tex_coord"; + snippet_data.source_buf = shader_state->header; + + _cogl_pipeline_snippet_generate_code (&snippet_data); + + g_free ((char *) snippet_data.chain_function); + g_free ((char *) snippet_data.final_name); + g_free ((char *) snippet_data.function_prefix); + + g_string_append_printf (shader_state->source, + " cogl_tex_coord%i_out = " + "cogl_transform_layer%i (cogl_texture_matrix%i,\n" + " " + " cogl_tex_coord%i_in);\n", + layer_index, + layer_index, + layer_index, + layer_index); + + return TRUE; +} + +static CoglBool +_cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state; + + _COGL_GET_CONTEXT (ctx, FALSE); + + shader_state = get_shader_state (pipeline); + + if (shader_state->source) + { + const char *source_strings[2]; + GLint lengths[2]; + GLint compile_status; + GLuint shader; + CoglPipelineSnippetData snippet_data; + CoglPipelineSnippetList *vertex_snippets; + CoglBool has_per_vertex_point_size = + cogl_pipeline_get_per_vertex_point_size (pipeline); + + COGL_STATIC_COUNTER (vertend_glsl_compile_counter, + "glsl vertex compile counter", + "Increments each time a new GLSL " + "vertex shader is compiled", + 0 /* no application private data */); + COGL_COUNTER_INC (_cogl_uprof_context, vertend_glsl_compile_counter); + + g_string_append (shader_state->header, + "void\n" + "cogl_real_vertex_transform ()\n" + "{\n" + " cogl_position_out = " + "cogl_modelview_projection_matrix * " + "cogl_position_in;\n" + "}\n"); + + g_string_append (shader_state->source, + " cogl_vertex_transform ();\n"); + + if (has_per_vertex_point_size) + { + g_string_append (shader_state->header, + "void\n" + "cogl_real_point_size_calculation ()\n" + "{\n" + " cogl_point_size_out = cogl_point_size_in;\n" + "}\n"); + g_string_append (shader_state->source, + " cogl_point_size_calculation ();\n"); + } + + g_string_append (shader_state->source, + " cogl_color_out = cogl_color_in;\n" + "}\n"); + + vertex_snippets = get_vertex_snippets (pipeline); + + /* Add hooks for the vertex transform part */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = vertex_snippets; + snippet_data.hook = COGL_SNIPPET_HOOK_VERTEX_TRANSFORM; + snippet_data.chain_function = "cogl_real_vertex_transform"; + snippet_data.final_name = "cogl_vertex_transform"; + snippet_data.function_prefix = "cogl_vertex_transform"; + snippet_data.source_buf = shader_state->header; + _cogl_pipeline_snippet_generate_code (&snippet_data); + + /* Add hooks for the point size calculation part */ + if (has_per_vertex_point_size) + { + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = vertex_snippets; + snippet_data.hook = COGL_SNIPPET_HOOK_POINT_SIZE; + snippet_data.chain_function = "cogl_real_point_size_calculation"; + snippet_data.final_name = "cogl_point_size_calculation"; + snippet_data.function_prefix = "cogl_point_size_calculation"; + snippet_data.source_buf = shader_state->header; + _cogl_pipeline_snippet_generate_code (&snippet_data); + } + + /* Add all of the hooks for vertex processing */ + memset (&snippet_data, 0, sizeof (snippet_data)); + snippet_data.snippets = vertex_snippets; + snippet_data.hook = COGL_SNIPPET_HOOK_VERTEX; + snippet_data.chain_function = "cogl_generated_source"; + snippet_data.final_name = "cogl_vertex_hook"; + snippet_data.function_prefix = "cogl_vertex_hook"; + snippet_data.source_buf = shader_state->source; + _cogl_pipeline_snippet_generate_code (&snippet_data); + + g_string_append (shader_state->source, + "void\n" + "main ()\n" + "{\n" + " cogl_vertex_hook ();\n"); + + /* If there are any snippets then we can't rely on the + projection matrix to flip the rendering for offscreen buffers + so we'll need to flip it using an extra statement and a + uniform */ + if (_cogl_pipeline_has_vertex_snippets (pipeline)) + { + g_string_append (shader_state->header, + "uniform vec4 _cogl_flip_vector;\n"); + g_string_append (shader_state->source, + " cogl_position_out *= _cogl_flip_vector;\n"); + } + + g_string_append (shader_state->source, + "}\n"); + + GE_RET( shader, ctx, glCreateShader (GL_VERTEX_SHADER) ); + + lengths[0] = shader_state->header->len; + source_strings[0] = shader_state->header->str; + lengths[1] = shader_state->source->len; + source_strings[1] = shader_state->source->str; + + _cogl_glsl_shader_set_source_with_boilerplate (ctx, + shader, GL_VERTEX_SHADER, + pipeline, + 2, /* count */ + source_strings, lengths); + + GE( ctx, glCompileShader (shader) ); + GE( ctx, glGetShaderiv (shader, GL_COMPILE_STATUS, &compile_status) ); + + if (!compile_status) + { + GLint len = 0; + char *shader_log; + + GE( ctx, glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len) ); + shader_log = g_alloca (len); + GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) ); + g_warning ("Shader compilation failed:\n%s", shader_log); + } + + shader_state->header = NULL; + shader_state->source = NULL; + shader_state->gl_shader = shader; + } + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM) && + (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE)) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE); + + if (authority->big_state->point_size > 0.0f) + GE( ctx, glPointSize (authority->big_state->point_size) ); + } +#endif /* HAVE_COGL_GL */ + + return TRUE; +} + +static void +_cogl_pipeline_vertend_glsl_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & _cogl_pipeline_get_state_for_vertex_codegen (ctx))) + dirty_shader_state (pipeline); +} + +/* NB: layers are considered immutable once they have any dependants + * so although multiple pipelines can end up depending on a single + * static layer, we can guarantee that if a layer is being *changed* + * then it can only have one pipeline depending on it. + * + * XXX: Don't forget this is *pre* change, we can't read the new value + * yet! + */ +static void +_cogl_pipeline_vertend_glsl_layer_pre_change_notify ( + CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + CoglPipelineShaderState *shader_state; + + shader_state = get_shader_state (owner); + if (!shader_state) + return; + + if ((change & COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN)) + { + dirty_shader_state (owner); + return; + } + + /* TODO: we could be saving snippets of texture combine code along + * with each layer and then when a layer changes we would just free + * the snippet. */ +} + +const CoglPipelineVertend _cogl_pipeline_glsl_vertend = + { + _cogl_pipeline_vertend_glsl_start, + _cogl_pipeline_vertend_glsl_add_layer, + _cogl_pipeline_vertend_glsl_end, + _cogl_pipeline_vertend_glsl_pre_change_notify, + _cogl_pipeline_vertend_glsl_layer_pre_change_notify + }; + +UNIT_TEST (check_point_size_shader, + 0 /* no requirements */, + 0 /* no failure cases */) +{ + CoglPipeline *pipelines[4]; + CoglPipelineShaderState *shader_states[G_N_ELEMENTS (pipelines)]; + int i; + + /* Default pipeline with zero point size */ + pipelines[0] = cogl_pipeline_new (test_ctx); + + /* Point size 1 */ + pipelines[1] = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_point_size (pipelines[1], 1.0f); + + /* Point size 2 */ + pipelines[2] = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_point_size (pipelines[2], 2.0f); + + /* Same as the first pipeline, but reached by restoring the old + * state from a copy */ + pipelines[3] = cogl_pipeline_copy (pipelines[1]); + cogl_pipeline_set_point_size (pipelines[3], 0.0f); + + /* Draw something with all of the pipelines to make sure their state + * is flushed */ + for (i = 0; i < G_N_ELEMENTS (pipelines); i++) + cogl_framebuffer_draw_rectangle (test_fb, + pipelines[i], + 0.0f, 0.0f, + 10.0f, 10.0f); + cogl_framebuffer_finish (test_fb); + + /* Get all of the shader states. These might be NULL if the driver + * is not using GLSL */ + for (i = 0; i < G_N_ELEMENTS (pipelines); i++) + shader_states[i] = get_shader_state (pipelines[i]); + + /* If the first two pipelines are using GLSL then they should have + * the same shader unless there is no builtin uniform for the point + * size */ + if (shader_states[0]) + { + if (_cogl_has_private_feature + (test_ctx, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM)) + g_assert (shader_states[0] == shader_states[1]); + else + g_assert (shader_states[0] != shader_states[1]); + } + + /* The second and third pipelines should always have the same shader + * state because only toggling between zero and non-zero should + * change the shader */ + g_assert (shader_states[1] == shader_states[2]); + + /* The fourth pipeline should be exactly the same as the first */ + g_assert (shader_states[0] == shader_states[3]); +} + +#endif /* COGL_PIPELINE_VERTEND_GLSL */ diff --git a/cogl/driver/gl/cogl-texture-2d-gl-private.h b/cogl/driver/gl/cogl-texture-2d-gl-private.h new file mode 100644 index 0000000..e5c6585 --- /dev/null +++ b/cogl/driver/gl/cogl-texture-2d-gl-private.h @@ -0,0 +1,119 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_TEXTURE_2D_GL_PRIVATE_H_ +#define _COGL_TEXTURE_2D_GL_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context-private.h" +#include "cogl-texture.h" + +void +_cogl_texture_2d_gl_free (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_gl_can_create (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format); + +void +_cogl_texture_2d_gl_init (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_gl_allocate (CoglTexture *tex, + CoglError **error); + +CoglTexture2D * +_cogl_texture_2d_gl_new_from_bitmap (CoglBitmap *bmp, + CoglPixelFormat internal_format, + CoglBool can_convert_in_place, + CoglError **error); + +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) +CoglTexture2D * +_cogl_egl_texture_2d_gl_new_from_image (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + EGLImageKHR image, + CoglError **error); +#endif + +void +_cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter); + +void +_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p); + +void +_cogl_texture_2d_gl_copy_from_framebuffer (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level); + +unsigned int +_cogl_texture_2d_gl_get_gl_handle (CoglTexture2D *tex_2d); + +void +_cogl_texture_2d_gl_generate_mipmap (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bitmap, + int dst_x, + int dst_y, + int level, + CoglError **error); + +void +_cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d, + CoglPixelFormat format, + int rowstride, + uint8_t *data); + +#endif /* _COGL_TEXTURE_2D_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c new file mode 100644 index 0000000..8675f52 --- /dev/null +++ b/cogl/driver/gl/cogl-texture-2d-gl.c @@ -0,0 +1,756 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2011,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#include + +#include + +#include "cogl-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d-gl.h" +#include "cogl-texture-2d-gl-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-error-private.h" +#include "cogl-util-gl-private.h" + +void +_cogl_texture_2d_gl_free (CoglTexture2D *tex_2d) +{ + if (!tex_2d->is_foreign && tex_2d->gl_texture) + _cogl_delete_gl_texture (tex_2d->gl_texture); +} + +CoglBool +_cogl_texture_2d_gl_can_create (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format) +{ + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + /* If NPOT textures aren't supported then the size must be a power + of two */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + (!_cogl_util_is_pot (width) || + !_cogl_util_is_pot (height))) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + /* Check that the driver can create a texture with that size */ + if (!ctx->texture_driver->size_supported (ctx, + GL_TEXTURE_2D, + gl_intformat, + gl_format, + gl_type, + width, + height)) + return FALSE; + + return TRUE; +} + +void +_cogl_texture_2d_gl_init (CoglTexture2D *tex_2d) +{ + tex_2d->gl_texture = 0; + + /* We default to GL_LINEAR for both filters */ + tex_2d->gl_legacy_texobj_min_filter = GL_LINEAR; + tex_2d->gl_legacy_texobj_mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_2d->gl_legacy_texobj_wrap_mode_s = GL_FALSE; + tex_2d->gl_legacy_texobj_wrap_mode_t = GL_FALSE; +} + +static CoglBool +allocate_with_size (CoglTexture2D *tex_2d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglPixelFormat internal_format; + int width = loader->src.sized.width; + int height = loader->src.sized.height; + CoglContext *ctx = tex->context; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + GLenum gl_error; + GLenum gl_texture; + + internal_format = + _cogl_texture_determine_internal_format (tex, COGL_PIXEL_FORMAT_ANY); + + if (!_cogl_texture_2d_gl_can_create (ctx, + width, + height, + internal_format)) + { + _cogl_set_error (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); + return FALSE; + } + + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + gl_texture = ctx->texture_driver->gen (ctx, GL_TEXTURE_2D, internal_format); + + tex_2d->gl_internal_format = gl_intformat; + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + gl_texture, + tex_2d->is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat, + width, height, 0, gl_format, gl_type, NULL); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + GE( ctx, glDeleteTextures (1, &gl_texture) ); + return FALSE; + } + + tex_2d->gl_texture = gl_texture; + tex_2d->gl_internal_format = gl_intformat; + + tex_2d->internal_format = internal_format; + + _cogl_texture_set_allocated (tex, internal_format, width, height); + + return TRUE; +} + +static CoglBool +allocate_from_bitmap (CoglTexture2D *tex_2d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglBitmap *bmp = loader->src.bitmap.bitmap; + CoglContext *ctx = _cogl_bitmap_get_context (bmp); + CoglPixelFormat internal_format; + int width = cogl_bitmap_get_width (bmp); + int height = cogl_bitmap_get_height (bmp); + CoglBool can_convert_in_place = loader->src.bitmap.can_convert_in_place; + CoglBitmap *upload_bmp; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + internal_format = + _cogl_texture_determine_internal_format (tex, cogl_bitmap_get_format (bmp)); + + if (!_cogl_texture_2d_gl_can_create (ctx, + width, + height, + internal_format)) + { + _cogl_set_error (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); + return FALSE; + } + + upload_bmp = _cogl_bitmap_convert_for_upload (bmp, + internal_format, + can_convert_in_place, + error); + if (upload_bmp == NULL) + return FALSE; + + ctx->driver_vtable->pixel_format_to_gl (ctx, + cogl_bitmap_get_format (upload_bmp), + NULL, /* internal format */ + &gl_format, + &gl_type); + ctx->driver_vtable->pixel_format_to_gl (ctx, + internal_format, + &gl_intformat, + NULL, + NULL); + + /* Keep a copy of the first pixel so that if glGenerateMipmap isn't + supported we can fallback to using GL_GENERATE_MIPMAP */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + CoglError *ignore = NULL; + uint8_t *data = _cogl_bitmap_map (upload_bmp, + COGL_BUFFER_ACCESS_READ, 0, + &ignore); + CoglPixelFormat format = cogl_bitmap_get_format (upload_bmp); + + tex_2d->first_pixel.gl_format = gl_format; + tex_2d->first_pixel.gl_type = gl_type; + + if (data) + { + memcpy (tex_2d->first_pixel.data, data, + _cogl_pixel_format_get_bytes_per_pixel (format)); + _cogl_bitmap_unmap (upload_bmp); + } + else + { + g_warning ("Failed to read first pixel of bitmap for " + "glGenerateMipmap fallback"); + cogl_error_free (ignore); + memset (tex_2d->first_pixel.data, 0, + _cogl_pixel_format_get_bytes_per_pixel (format)); + } + } + + tex_2d->gl_texture = + ctx->texture_driver->gen (ctx, GL_TEXTURE_2D, internal_format); + if (!ctx->texture_driver->upload_to_gl (ctx, + GL_TEXTURE_2D, + tex_2d->gl_texture, + FALSE, + upload_bmp, + gl_intformat, + gl_format, + gl_type, + error)) + { + cogl_object_unref (upload_bmp); + return FALSE; + } + + tex_2d->gl_internal_format = gl_intformat; + + cogl_object_unref (upload_bmp); + + tex_2d->internal_format = internal_format; + + _cogl_texture_set_allocated (tex, internal_format, width, height); + + return TRUE; +} + +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) +static CoglBool +allocate_from_egl_image (CoglTexture2D *tex_2d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglContext *ctx = tex->context; + CoglPixelFormat internal_format = loader->src.egl_image.format; + GLenum gl_error; + + tex_2d->gl_texture = + ctx->texture_driver->gen (ctx, GL_TEXTURE_2D, internal_format); + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + FALSE); + + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, loader->src.egl_image.image); + if (ctx->glGetError () != GL_NO_ERROR) + { + _cogl_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_BAD_PARAMETER, + "Could not create a CoglTexture2D from a given " + "EGLImage"); + GE( ctx, glDeleteTextures (1, &tex_2d->gl_texture) ); + return FALSE; + } + + tex_2d->internal_format = internal_format; + + _cogl_texture_set_allocated (tex, + internal_format, + loader->src.egl_image.width, + loader->src.egl_image.height); + + return TRUE; +} +#endif + +static CoglBool +allocate_from_gl_foreign (CoglTexture2D *tex_2d, + CoglTextureLoader *loader, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglContext *ctx = tex->context; + CoglPixelFormat format = loader->src.gl_foreign.format; + GLenum gl_error = 0; + GLint gl_compressed = GL_FALSE; + GLenum gl_int_format = 0; + + if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Foreign GL_TEXTURE_2D textures are not " + "supported by your system"); + return FALSE; + } + + /* Make sure binding succeeds */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + loader->src.gl_foreign.gl_handle, TRUE); + if (ctx->glGetError () != GL_NO_ERROR) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Failed to bind foreign GL_TEXTURE_2D texture"); + return FALSE; + } + + /* Obtain texture parameters + (only level 0 we are interested in) */ + +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS)) + { + GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, + GL_TEXTURE_COMPRESSED, + &gl_compressed) ); + + { + GLint val; + + GE( ctx, glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, + GL_TEXTURE_INTERNAL_FORMAT, + &val) ); + + gl_int_format = val; + } + + /* If we can query GL for the actual pixel format then we'll ignore + the passed in format and use that. */ + if (!ctx->driver_vtable->pixel_format_from_gl_internal (ctx, + gl_int_format, + &format)) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Unsupported internal format for foreign texture"); + return FALSE; + } + } + else +#endif + { + /* Otherwise we'll assume we can derive the GL format from the + passed in format */ + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + &gl_int_format, + NULL, + NULL); + } + + /* Compressed texture images not supported */ + if (gl_compressed == GL_TRUE) + { + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Compressed foreign textures aren't currently supported"); + return FALSE; + } + + /* Note: previously this code would query the texture object for + whether it has GL_GENERATE_MIPMAP enabled to determine whether to + auto-generate the mipmap. This doesn't make much sense any more + since Cogl switch to using glGenerateMipmap. Ideally I think + cogl_texture_2d_gl_new_from_foreign should take a flags parameter so + that the application can decide whether it wants + auto-mipmapping. To be compatible with existing code, Cogl now + disables its own auto-mipmapping but leaves the value of + GL_GENERATE_MIPMAP alone so that it would still work but without + the dirtiness tracking that Cogl would do. */ + + _cogl_texture_2d_set_auto_mipmap (COGL_TEXTURE (tex_2d), FALSE); + + /* Setup bitmap info */ + tex_2d->is_foreign = TRUE; + tex_2d->mipmaps_dirty = TRUE; + + tex_2d->gl_texture = loader->src.gl_foreign.gl_handle; + tex_2d->gl_internal_format = gl_int_format; + + /* Unknown filter */ + tex_2d->gl_legacy_texobj_min_filter = GL_FALSE; + tex_2d->gl_legacy_texobj_mag_filter = GL_FALSE; + + tex_2d->internal_format = format; + + _cogl_texture_set_allocated (tex, + format, + loader->src.gl_foreign.width, + loader->src.gl_foreign.height); + return TRUE; +} + +CoglBool +_cogl_texture_2d_gl_allocate (CoglTexture *tex, + CoglError **error) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + CoglTextureLoader *loader = tex->loader; + + _COGL_RETURN_VAL_IF_FAIL (loader, FALSE); + + switch (loader->src_type) + { + case COGL_TEXTURE_SOURCE_TYPE_SIZED: + return allocate_with_size (tex_2d, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_BITMAP: + return allocate_from_bitmap (tex_2d, loader, error); + case COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE: +#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) + return allocate_from_egl_image (tex_2d, loader, error); +#else + g_return_val_if_reached (FALSE); +#endif + case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN: + return allocate_from_gl_foreign (tex_2d, loader, error); + } + + g_return_val_if_reached (FALSE); +} + +void +_cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + CoglContext *ctx = tex->context; + + if (min_filter == tex_2d->gl_legacy_texobj_min_filter + && mag_filter == tex_2d->gl_legacy_texobj_mag_filter) + return; + + /* Store new values */ + tex_2d->gl_legacy_texobj_min_filter = min_filter; + tex_2d->gl_legacy_texobj_mag_filter = mag_filter; + + /* Apply new filters to the texture */ + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter) ); + GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter) ); +} + +void +_cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + CoglContext *ctx = tex->context; + + /* Only set the wrap mode if it's different from the current value + to avoid too many GL calls. Texture 2D doesn't make use of the r + coordinate so we can ignore its wrap mode */ + if (tex_2d->gl_legacy_texobj_wrap_mode_s != wrap_mode_s || + tex_2d->gl_legacy_texobj_wrap_mode_t != wrap_mode_t) + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + GE( ctx, glTexParameteri (GL_TEXTURE_2D, + GL_TEXTURE_WRAP_S, + wrap_mode_s) ); + GE( ctx, glTexParameteri (GL_TEXTURE_2D, + GL_TEXTURE_WRAP_T, + wrap_mode_t) ); + + tex_2d->gl_legacy_texobj_wrap_mode_s = wrap_mode_s; + tex_2d->gl_legacy_texobj_wrap_mode_t = wrap_mode_t; + } +} + +CoglTexture2D * +cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + int width, + int height, + CoglPixelFormat format) +{ + CoglTextureLoader *loader; + + /* NOTE: width, height and internal format are not queriable + * in GLES, hence such a function prototype. + */ + + /* Note: We always trust the given width and height without querying + * the texture object because the user may be creating a Cogl + * texture for a texture_from_pixmap object where glTexImage2D may + * not have been called and the texture_from_pixmap spec doesn't + * clarify that it is reliable to query back the size from OpenGL. + */ + + /* Assert it is a valid GL texture object */ + _COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), FALSE); + + /* Validate width and height */ + _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); + + loader = _cogl_texture_create_loader (); + loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN; + loader->src.gl_foreign.gl_handle = gl_handle; + loader->src.gl_foreign.width = width; + loader->src.gl_foreign.height = height; + loader->src.gl_foreign.format = format; + + return _cogl_texture_2d_create_base (ctx, width, height, format, loader); +} + +void +_cogl_texture_2d_gl_copy_from_framebuffer (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglContext *ctx = tex->context; + + /* Make sure the current framebuffers are bound, though we don't need to + * flush the clip state here since we aren't going to draw to the + * framebuffer. */ + _cogl_framebuffer_flush_state (ctx->current_draw_buffer, + src_fb, + COGL_FRAMEBUFFER_STATE_ALL & + ~COGL_FRAMEBUFFER_STATE_CLIP); + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + + ctx->glCopyTexSubImage2D (GL_TEXTURE_2D, + 0, /* level */ + dst_x, dst_y, + src_x, src_y, + width, height); +} + +unsigned int +_cogl_texture_2d_gl_get_gl_handle (CoglTexture2D *tex_2d) +{ + return tex_2d->gl_texture; +} + +void +_cogl_texture_2d_gl_generate_mipmap (CoglTexture2D *tex_2d) +{ + CoglContext *ctx = COGL_TEXTURE (tex_2d)->context; + + /* glGenerateMipmap is defined in the FBO extension. If it's not + available we'll fallback to temporarily enabling + GL_GENERATE_MIPMAP and reuploading the first pixel */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + _cogl_texture_gl_generate_mipmaps (COGL_TEXTURE (tex_2d)); +#if defined(HAVE_COGL_GLES) || defined(HAVE_COGL_GL) + else + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + + GE( ctx, glTexParameteri (GL_TEXTURE_2D, + GL_GENERATE_MIPMAP, + GL_TRUE) ); + GE( ctx, glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 1, 1, + tex_2d->first_pixel.gl_format, + tex_2d->first_pixel.gl_type, + tex_2d->first_pixel.data) ); + GE( ctx, glTexParameteri (GL_TEXTURE_2D, + GL_GENERATE_MIPMAP, + GL_FALSE) ); + } +#endif +} + +CoglBool +_cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bmp, + int dst_x, + int dst_y, + int level, + CoglError **error) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2d); + CoglContext *ctx = tex->context; + CoglBitmap *upload_bmp; + CoglPixelFormat upload_format; + GLenum gl_format; + GLenum gl_type; + CoglBool status = TRUE; + + upload_bmp = + _cogl_bitmap_convert_for_upload (bmp, + _cogl_texture_get_format (tex), + FALSE, /* can't convert in place */ + error); + if (upload_bmp == NULL) + return FALSE; + + upload_format = cogl_bitmap_get_format (upload_bmp); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + upload_format, + NULL, /* internal format */ + &gl_format, + &gl_type); + + /* If this touches the first pixel then we'll update our copy */ + if (dst_x == 0 && dst_y == 0 && + !cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + CoglError *ignore = NULL; + uint8_t *data = + _cogl_bitmap_map (upload_bmp, COGL_BUFFER_ACCESS_READ, 0, &ignore); + CoglPixelFormat bpp = + _cogl_pixel_format_get_bytes_per_pixel (upload_format); + + tex_2d->first_pixel.gl_format = gl_format; + tex_2d->first_pixel.gl_type = gl_type; + + if (data) + { + memcpy (tex_2d->first_pixel.data, + (data + + cogl_bitmap_get_rowstride (upload_bmp) * src_y + + bpp * src_x), + bpp); + _cogl_bitmap_unmap (bmp); + } + else + { + g_warning ("Failed to read first bitmap pixel for " + "glGenerateMipmap fallback"); + cogl_error_free (ignore); + memset (tex_2d->first_pixel.data, 0, bpp); + } + } + + status = ctx->texture_driver->upload_subregion_to_gl (ctx, + tex, + FALSE, + src_x, src_y, + dst_x, dst_y, + width, height, + level, + upload_bmp, + gl_format, + gl_type, + error); + + cogl_object_unref (upload_bmp); + + _cogl_texture_gl_maybe_update_max_level (tex, level); + + return status; +} + +void +_cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + CoglContext *ctx = COGL_TEXTURE (tex_2d)->context; + int bpp; + int width = COGL_TEXTURE (tex_2d)->width; + GLenum gl_format; + GLenum gl_type; + + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + + ctx->driver_vtable->pixel_format_to_gl (ctx, + format, + NULL, /* internal format */ + &gl_format, + &gl_type); + + ctx->texture_driver->prep_gl_for_pixels_download (ctx, + rowstride, + width, + bpp); + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + + ctx->texture_driver->gl_get_tex_image (ctx, + GL_TEXTURE_2D, + gl_format, + gl_type, + data); +} diff --git a/cogl/driver/gl/cogl-texture-gl-private.h b/cogl/driver/gl/cogl-texture-gl-private.h new file mode 100644 index 0000000..b5baac7 --- /dev/null +++ b/cogl/driver/gl/cogl-texture-gl-private.h @@ -0,0 +1,66 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _COGL_TEXTURE_GL_PRIVATE_H_ +#define _COGL_TEXTURE_GL_PRIVATE_H_ + +#include "cogl-context.h" + +void +_cogl_texture_gl_prep_alignment_for_pixels_upload (CoglContext *ctx, + int pixels_rowstride); + +void +_cogl_texture_gl_prep_alignment_for_pixels_download (CoglContext *ctx, + int bpp, + int width, + int rowstride); + +void +_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture, + unsigned int wrap_mode_s, + unsigned int wrap_mode_t, + unsigned int wrap_mode_p); + +void +_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture, + unsigned int min_filter, + unsigned int mag_filter); + +void +_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture, + int max_level); + +void +_cogl_texture_gl_generate_mipmaps (CoglTexture *texture); + +GLenum +_cogl_texture_gl_get_format (CoglTexture *texture); + +#endif /* _COGL_TEXTURE_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-texture-gl.c b/cogl/driver/gl/cogl-texture-gl.c new file mode 100644 index 0000000..2e281c0 --- /dev/null +++ b/cogl/driver/gl/cogl-texture-gl.c @@ -0,0 +1,158 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-texture-3d-private.h" +#include "cogl-util.h" +#include "cogl-pipeline-opengl-private.h" + +static inline int +calculate_alignment (int rowstride) +{ + int alignment = 1 << (_cogl_util_ffs (rowstride) - 1); + + return MIN (alignment, 8); +} + +void +_cogl_texture_gl_prep_alignment_for_pixels_upload (CoglContext *ctx, + int pixels_rowstride) +{ + GE( ctx, glPixelStorei (GL_UNPACK_ALIGNMENT, + calculate_alignment (pixels_rowstride)) ); +} + +void +_cogl_texture_gl_prep_alignment_for_pixels_download (CoglContext *ctx, + int bpp, + int width, + int rowstride) +{ + int alignment; + + /* If no padding is needed then we can always use an alignment of 1. + * We want to do this even though it is equivalent to the alignment + * of the rowstride because the Intel driver in Mesa currently has + * an optimisation when reading data into a PBO that only works if + * the alignment is exactly 1. + * + * https://bugs.freedesktop.org/show_bug.cgi?id=46632 + */ + + if (rowstride == bpp * width) + alignment = 1; + else + alignment = calculate_alignment (rowstride); + + GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, alignment) ); +} + +void +_cogl_texture_gl_flush_legacy_texobj_wrap_modes (CoglTexture *texture, + unsigned int wrap_mode_s, + unsigned int wrap_mode_t, + unsigned int wrap_mode_p) +{ + texture->vtable->gl_flush_legacy_texobj_wrap_modes (texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); +} + +void +_cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture, + unsigned int min_filter, + unsigned int mag_filter) +{ + texture->vtable->gl_flush_legacy_texobj_filters (texture, + min_filter, mag_filter); +} + +void +_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture, + int max_level) +{ + /* This isn't supported on GLES */ +#ifdef HAVE_COGL_GL + CoglContext *ctx = texture->context; + + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL) && + texture->max_level < max_level) + { + CoglContext *ctx = texture->context; + GLuint gl_handle; + GLenum gl_target; + + cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target); + + texture->max_level = max_level; + + _cogl_bind_gl_texture_transient (gl_target, + gl_handle, + _cogl_texture_is_foreign (texture)); + + GE( ctx, glTexParameteri (gl_target, + GL_TEXTURE_MAX_LEVEL, texture->max_level)); + } +#endif /* HAVE_COGL_GL */ +} + +void +_cogl_texture_gl_generate_mipmaps (CoglTexture *texture) +{ + CoglContext *ctx = texture->context; + int n_levels = _cogl_texture_get_n_levels (texture); + GLuint gl_handle; + GLenum gl_target; + + _cogl_texture_gl_maybe_update_max_level (texture, n_levels - 1); + + cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target); + + _cogl_bind_gl_texture_transient (gl_target, + gl_handle, + _cogl_texture_is_foreign (texture)); + GE( ctx, glGenerateMipmap (gl_target) ); +} + +GLenum +_cogl_texture_gl_get_format (CoglTexture *texture) +{ + return texture->vtable->get_gl_format (texture); +} diff --git a/cogl/driver/gl/cogl-util-gl-private.h b/cogl/driver/gl/cogl-util-gl-private.h new file mode 100644 index 0000000..dcc61c0 --- /dev/null +++ b/cogl/driver/gl/cogl-util-gl-private.h @@ -0,0 +1,93 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_UTIL_GL_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context.h" +#include "cogl-gl-header.h" +#include "cogl-texture.h" + +#ifdef COGL_GL_DEBUG + +const char * +_cogl_gl_error_to_string (GLenum error_code); + +#define GE(ctx, x) G_STMT_START { \ + GLenum __err; \ + (ctx)->x; \ + while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \ + { \ + g_warning ("%s: GL error (%d): %s\n", \ + G_STRLOC, \ + __err, \ + _cogl_gl_error_to_string (__err)); \ + } } G_STMT_END + +#define GE_RET(ret, ctx, x) G_STMT_START { \ + GLenum __err; \ + ret = (ctx)->x; \ + while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \ + { \ + g_warning ("%s: GL error (%d): %s\n", \ + G_STRLOC, \ + __err, \ + _cogl_gl_error_to_string (__err)); \ + } } G_STMT_END + +#else /* !COGL_GL_DEBUG */ + +#define GE(ctx, x) ((ctx)->x) +#define GE_RET(ret, ctx, x) (ret = ((ctx)->x)) + +#endif /* COGL_GL_DEBUG */ + +CoglBool +_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error); + +void +_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type, + const char **target_string_out, + const char **swizzle_out); + +/* Parses a GL version number stored in a string. @version_string must + * point to the beginning of the version number (ie, it can't point to + * the "OpenGL ES" part on GLES). The version number can be followed + * by the end of the string, a space or a full stop. Anything else + * will be treated as invalid. Returns TRUE and sets major_out and + * minor_out if it is succesfully parsed or FALSE otherwise. */ +CoglBool +_cogl_gl_util_parse_gl_version (const char *version_string, + int *major_out, + int *minor_out); + +#endif /* _COGL_UTIL_GL_PRIVATE_H_ */ diff --git a/cogl/driver/gl/cogl-util-gl.c b/cogl/driver/gl/cogl-util-gl.c new file mode 100644 index 0000000..814621a --- /dev/null +++ b/cogl/driver/gl/cogl-util-gl.c @@ -0,0 +1,181 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-types.h" +#include "cogl-context-private.h" +#include "cogl-error-private.h" +#include "cogl-util-gl-private.h" + +#ifdef COGL_GL_DEBUG +/* GL error to string conversion */ +static const struct { + GLuint error_code; + const char *error_string; +} gl_errors[] = { + { GL_NO_ERROR, "No error" }, + { GL_INVALID_ENUM, "Invalid enumeration value" }, + { GL_INVALID_VALUE, "Invalid value" }, + { GL_INVALID_OPERATION, "Invalid operation" }, +#ifdef HAVE_COGL_GL + { GL_STACK_OVERFLOW, "Stack overflow" }, + { GL_STACK_UNDERFLOW, "Stack underflow" }, +#endif + { GL_OUT_OF_MEMORY, "Out of memory" }, + +#ifdef GL_INVALID_FRAMEBUFFER_OPERATION_EXT + { GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "Invalid framebuffer operation" } +#endif +}; + +static const unsigned int n_gl_errors = G_N_ELEMENTS (gl_errors); + +const char * +_cogl_gl_error_to_string (GLenum error_code) +{ + int i; + + for (i = 0; i < n_gl_errors; i++) + { + if (gl_errors[i].error_code == error_code) + return gl_errors[i].error_string; + } + + return "Unknown GL error"; +} +#endif /* COGL_GL_DEBUG */ + +CoglBool +_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error) +{ + GLenum gl_error; + CoglBool out_of_memory = FALSE; + + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + { + if (gl_error == GL_OUT_OF_MEMORY) + out_of_memory = TRUE; +#ifdef COGL_GL_DEBUG + else + { + g_warning ("%s: GL error (%d): %s\n", + G_STRLOC, + gl_error, + _cogl_gl_error_to_string (gl_error)); + } +#endif + } + + if (out_of_memory) + { + _cogl_set_error (error, COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY, + "Out of memory"); + return TRUE; + } + + return FALSE; +} + +void +_cogl_gl_util_get_texture_target_string (CoglTextureType texture_type, + const char **target_string_out, + const char **swizzle_out) +{ + const char *target_string, *tex_coord_swizzle; + + switch (texture_type) + { +#if 0 /* TODO */ + case COGL_TEXTURE_TYPE_1D: + target_string = "1D"; + tex_coord_swizzle = "s"; + break; +#endif + + case COGL_TEXTURE_TYPE_2D: + target_string = "2D"; + tex_coord_swizzle = "st"; + break; + + case COGL_TEXTURE_TYPE_3D: + target_string = "3D"; + tex_coord_swizzle = "stp"; + break; + + case COGL_TEXTURE_TYPE_RECTANGLE: + target_string = "2DRect"; + tex_coord_swizzle = "st"; + break; + } + + if (target_string_out) + *target_string_out = target_string; + if (swizzle_out) + *swizzle_out = tex_coord_swizzle; +} + +CoglBool +_cogl_gl_util_parse_gl_version (const char *version_string, + int *major_out, + int *minor_out) +{ + const char *major_end, *minor_end; + int major = 0, minor = 0; + + /* Extract the major number */ + for (major_end = version_string; *major_end >= '0' + && *major_end <= '9'; major_end++) + major = (major * 10) + *major_end - '0'; + /* If there were no digits or the major number isn't followed by a + dot then it is invalid */ + if (major_end == version_string || *major_end != '.') + return FALSE; + + /* Extract the minor number */ + for (minor_end = major_end + 1; *minor_end >= '0' + && *minor_end <= '9'; minor_end++) + minor = (minor * 10) + *minor_end - '0'; + /* If there were no digits or there is an unexpected character then + it is invalid */ + if (minor_end == major_end + 1 + || (*minor_end && *minor_end != ' ' && *minor_end != '.')) + return FALSE; + + *major_out = major; + *minor_out = minor; + + return TRUE; +} diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c new file mode 100644 index 0000000..0bcb9ce --- /dev/null +++ b/cogl/driver/gl/gl/cogl-driver-gl.c @@ -0,0 +1,699 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" +#include "cogl-error-private.h" +#include "cogl-framebuffer-gl-private.h" +#include "cogl-texture-2d-gl-private.h" +#include "cogl-attribute-gl-private.h" +#include "cogl-clip-stack-gl-private.h" +#include "cogl-buffer-gl-private.h" + +static CoglBool +_cogl_driver_pixel_format_from_gl_internal (CoglContext *context, + GLenum gl_int_format, + CoglPixelFormat *out_format) +{ + /* It doesn't really matter we convert to exact same + format (some have no cogl match anyway) since format + is re-matched against cogl when getting or setting + texture image data. + */ + + switch (gl_int_format) + { + case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: + case GL_ALPHA12: case GL_ALPHA16: + /* Cogl only supports one single-component texture so if we have + * ended up with a red texture then it is probably being used as + * a component-alpha texture */ + case GL_RED: + + *out_format = COGL_PIXEL_FORMAT_A_8; + return TRUE; + + case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: + case GL_LUMINANCE12: case GL_LUMINANCE16: + + *out_format = COGL_PIXEL_FORMAT_G_8; + return TRUE; + + case GL_RG: + *out_format = COGL_PIXEL_FORMAT_RG_88; + return TRUE; + + case GL_RGB: case GL_RGB4: case GL_RGB5: case GL_RGB8: + case GL_RGB10: case GL_RGB12: case GL_RGB16: case GL_R3_G3_B2: + + *out_format = COGL_PIXEL_FORMAT_RGB_888; + return TRUE; + + case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: + case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: + + *out_format = COGL_PIXEL_FORMAT_RGBA_8888; + return TRUE; + } + + return FALSE; +} + +static CoglPixelFormat +_cogl_driver_pixel_format_to_gl (CoglContext *context, + CoglPixelFormat format, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype) +{ + CoglPixelFormat required_format; + GLenum glintformat; + GLenum glformat = 0; + GLenum gltype; + + required_format = format; + + /* Find GL equivalents */ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + /* If the driver doesn't natively support alpha textures then we + * will use a red component texture with a swizzle to implement + * the texture */ + if (_cogl_has_private_feature + (context, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) == 0) + { + glintformat = GL_RED; + glformat = GL_RED; + } + else + { + glintformat = GL_ALPHA; + glformat = GL_ALPHA; + } + gltype = GL_UNSIGNED_BYTE; + break; + case COGL_PIXEL_FORMAT_G_8: + glintformat = GL_LUMINANCE; + glformat = GL_LUMINANCE; + gltype = GL_UNSIGNED_BYTE; + break; + + case COGL_PIXEL_FORMAT_RG_88: + if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG)) + { + glintformat = GL_RG; + glformat = GL_RG; + } + else + { + /* If red-green textures aren't supported then we'll use RGB + * as an internal format. Note this should only end up + * mattering for downloading the data because Cogl will + * refuse to allocate a texture with RG components if RG + * textures aren't supported */ + glintformat = GL_RGB; + glformat = GL_RGB; + required_format = COGL_PIXEL_FORMAT_RGB_888; + } + gltype = GL_UNSIGNED_BYTE; + break; + + case COGL_PIXEL_FORMAT_RGB_888: + glintformat = GL_RGB; + glformat = GL_RGB; + gltype = GL_UNSIGNED_BYTE; + break; + case COGL_PIXEL_FORMAT_BGR_888: + glintformat = GL_RGB; + glformat = GL_BGR; + gltype = GL_UNSIGNED_BYTE; + break; + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_BYTE; + break; + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + glintformat = GL_RGBA; + glformat = GL_BGRA; + gltype = GL_UNSIGNED_BYTE; + break; + + /* The following two types of channel ordering + * have no GL equivalent unless defined using + * system word byte ordering */ + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + glintformat = GL_RGBA; + glformat = GL_BGRA; +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + gltype = GL_UNSIGNED_INT_8_8_8_8; +#else + gltype = GL_UNSIGNED_INT_8_8_8_8_REV; +#endif + break; + + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + gltype = GL_UNSIGNED_INT_8_8_8_8; +#else + gltype = GL_UNSIGNED_INT_8_8_8_8_REV; +#endif + break; + + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_INT_10_10_10_2; + break; + + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + glintformat = GL_RGBA; + glformat = GL_BGRA; + gltype = GL_UNSIGNED_INT_10_10_10_2; + break; + + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + glintformat = GL_RGBA; + glformat = GL_BGRA; + gltype = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + + /* The following three types of channel ordering + * are always defined using system word byte + * ordering (even according to GLES spec) */ + case COGL_PIXEL_FORMAT_RGB_565: + glintformat = GL_RGB; + glformat = GL_RGB; + gltype = GL_UNSIGNED_SHORT_5_6_5; + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_SHORT_4_4_4_4; + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_SHORT_5_5_5_1; + break; + + case COGL_PIXEL_FORMAT_DEPTH_16: + glintformat = GL_DEPTH_COMPONENT16; + glformat = GL_DEPTH_COMPONENT; + gltype = GL_UNSIGNED_SHORT; + break; + case COGL_PIXEL_FORMAT_DEPTH_32: + glintformat = GL_DEPTH_COMPONENT32; + glformat = GL_DEPTH_COMPONENT; + gltype = GL_UNSIGNED_INT; + break; + + case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: + glintformat = GL_DEPTH_STENCIL; + glformat = GL_DEPTH_STENCIL; + gltype = GL_UNSIGNED_INT_24_8; + break; + + case COGL_PIXEL_FORMAT_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + break; + } + + /* All of the pixel formats are handled above so if this hits then + we've been given an invalid pixel format */ + g_assert (glformat != 0); + + if (out_glintformat != NULL) + *out_glintformat = glintformat; + if (out_glformat != NULL) + *out_glformat = glformat; + if (out_gltype != NULL) + *out_gltype = gltype; + + return required_format; +} + +static CoglBool +_cogl_get_gl_version (CoglContext *ctx, + int *major_out, + int *minor_out) +{ + const char *version_string; + + /* Get the OpenGL version number */ + if ((version_string = _cogl_context_get_gl_version (ctx)) == NULL) + return FALSE; + + return _cogl_gl_util_parse_gl_version (version_string, major_out, minor_out); +} + +static CoglBool +check_gl_version (CoglContext *ctx, + char **gl_extensions, + CoglError **error) +{ + int major, minor; + + if (!_cogl_get_gl_version (ctx, &major, &minor)) + { + _cogl_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_UNKNOWN_VERSION, + "The OpenGL version could not be determined"); + return FALSE; + } + + /* GL 1.3 supports all of the required functionality in core */ + if (COGL_CHECK_GL_VERSION (major, minor, 1, 3)) + return TRUE; + + /* OpenGL 1.2 is only supported if we have the multitexturing + extension */ + if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions)) + { + _cogl_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_INVALID_VERSION, + "The OpenGL driver is missing " + "the GL_ARB_multitexture extension"); + return FALSE; + } + + /* OpenGL 1.2 is required */ + if (!COGL_CHECK_GL_VERSION (major, minor, 1, 2)) + { + _cogl_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_INVALID_VERSION, + "The OpenGL version of your driver (%i.%i) " + "is not compatible with Cogl", + major, minor); + return FALSE; + } + + return TRUE; +} + +static CoglBool +_cogl_driver_update_features (CoglContext *ctx, + CoglError **error) +{ + CoglFeatureFlags flags = 0; + unsigned long private_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)] = { 0 }; + char **gl_extensions; + int gl_major = 0, gl_minor = 0; + int i; + + /* We have to special case getting the pointer to the glGetString* + functions because we need to use them to determine what functions + we can expect */ + ctx->glGetString = + (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, + "glGetString", + TRUE); + ctx->glGetStringi = + (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, + "glGetStringi", + TRUE); + ctx->glGetIntegerv = + (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, + "glGetIntegerv", + TRUE); + + gl_extensions = _cogl_context_get_gl_extensions (ctx); + + if (!check_gl_version (ctx, gl_extensions, error)) + return FALSE; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS))) + { + char *all_extensions = g_strjoinv (" ", gl_extensions); + + COGL_NOTE (WINSYS, + "Checking features\n" + " GL_VENDOR: %s\n" + " GL_RENDERER: %s\n" + " GL_VERSION: %s\n" + " GL_EXTENSIONS: %s", + ctx->glGetString (GL_VENDOR), + ctx->glGetString (GL_RENDERER), + _cogl_context_get_gl_version (ctx), + all_extensions); + + g_free (all_extensions); + } + + _cogl_get_gl_version (ctx, &gl_major, &gl_minor); + + _cogl_gpu_info_init (ctx, &ctx->gpu); + + ctx->glsl_major = 1; + ctx->glsl_minor = 1; + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0)) + { + const char *glsl_version = + (char *)ctx->glGetString (GL_SHADING_LANGUAGE_VERSION); + _cogl_gl_util_parse_gl_version (glsl_version, + &ctx->glsl_major, + &ctx->glsl_minor); + } + + if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 2)) + /* We want to use version 120 if it is available so that the + * gl_PointCoord can be used. */ + ctx->glsl_version_to_use = 120; + else + ctx->glsl_version_to_use = 110; + + flags = (COGL_FEATURE_TEXTURE_READ_PIXELS + | COGL_FEATURE_UNSIGNED_INT_INDICES + | COGL_FEATURE_DEPTH_RANGE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_UNSIGNED_INT_INDICES, TRUE); + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_DEPTH_RANGE, TRUE); + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 1, 4)) + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_MIRRORED_REPEAT, TRUE); + + _cogl_feature_check_ext_functions (ctx, + gl_major, + gl_minor, + gl_extensions); + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) || + _cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions)) + { + flags |= COGL_FEATURE_TEXTURE_NPOT + | COGL_FEATURE_TEXTURE_NPOT_BASIC + | COGL_FEATURE_TEXTURE_NPOT_MIPMAP + | COGL_FEATURE_TEXTURE_NPOT_REPEAT; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT, TRUE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, TRUE); + } + + if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_MESA_PACK_INVERT, TRUE); + + if (ctx->glGenRenderbuffers) + { + flags |= COGL_FEATURE_OFFSCREEN; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS, + TRUE); + } + + if (ctx->glBlitFramebuffer) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE); + + if (ctx->glRenderbufferStorageMultisampleIMG) + { + flags |= COGL_FEATURE_OFFSCREEN_MULTISAMPLE; + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE, TRUE); + } + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0) || + _cogl_check_extension ("GL_ARB_depth_texture", gl_extensions)) + { + flags |= COGL_FEATURE_DEPTH_TEXTURE; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_DEPTH_TEXTURE, TRUE); + } + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 1) || + _cogl_check_extension ("GL_EXT_pixel_buffer_object", gl_extensions)) + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_PBOS, TRUE); + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 1, 4) || + _cogl_check_extension ("GL_EXT_blend_color", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE); + + if (ctx->glGenPrograms) + { + flags |= COGL_FEATURE_SHADERS_ARBFP; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_ARBFP, TRUE); + } + + if (ctx->glCreateProgram) + { + flags |= COGL_FEATURE_SHADERS_GLSL; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE); + } + else + { + /* If all of the old GLSL extensions are available then we can fake + * the GL 2.0 GLSL support by diverting to the old function names */ + if (ctx->glCreateProgramObject && /* GL_ARB_shader_objects */ + ctx->glVertexAttribPointer && /* GL_ARB_vertex_shader */ + _cogl_check_extension ("GL_ARB_fragment_shader", gl_extensions)) + { + ctx->glCreateShader = ctx->glCreateShaderObject; + ctx->glCreateProgram = ctx->glCreateProgramObject; + ctx->glDeleteShader = ctx->glDeleteObject; + ctx->glDeleteProgram = ctx->glDeleteObject; + ctx->glAttachShader = ctx->glAttachObject; + ctx->glUseProgram = ctx->glUseProgramObject; + ctx->glGetProgramInfoLog = ctx->glGetInfoLog; + ctx->glGetShaderInfoLog = ctx->glGetInfoLog; + ctx->glGetShaderiv = ctx->glGetObjectParameteriv; + ctx->glGetProgramiv = ctx->glGetObjectParameteriv; + ctx->glDetachShader = ctx->glDetachObject; + ctx->glGetAttachedShaders = ctx->glGetAttachedObjects; + /* FIXME: there doesn't seem to be an equivalent for glIsShader + * and glIsProgram. This doesn't matter for now because Cogl + * doesn't use these but if we add support for simulating a + * GLES2 context on top of regular GL then we'll need to do + * something here */ + + flags |= COGL_FEATURE_SHADERS_GLSL; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE); + } + } + + if ((COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) || + _cogl_check_extension ("GL_ARB_point_sprite", gl_extensions)) && + + /* If GLSL is supported then we only enable point sprite support + * too if we have glsl >= 1.2 otherwise we don't have the + * gl_PointCoord builtin which we depend on in the glsl backend. + */ + (!COGL_FLAGS_GET (ctx->features, COGL_FEATURE_ID_GLSL) || + COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 2))) + { + flags |= COGL_FEATURE_POINT_SPRITE; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_POINT_SPRITE, TRUE); + } + + if (ctx->glGenBuffers) + { + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_VBOS, TRUE); + flags |= (COGL_FEATURE_MAP_BUFFER_FOR_READ | + COGL_FEATURE_MAP_BUFFER_FOR_WRITE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, TRUE); + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); + } + + if (_cogl_check_extension ("GL_ARB_texture_rectangle", gl_extensions)) + { + flags |= COGL_FEATURE_TEXTURE_RECTANGLE; + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_RECTANGLE, TRUE); + } + + if (ctx->glTexImage3D) + { + flags |= COGL_FEATURE_TEXTURE_3D; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_3D, TRUE); + } + + if (ctx->glEGLImageTargetTexture2D) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, TRUE); + + if (_cogl_check_extension ("GL_EXT_packed_depth_stencil", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL, TRUE); + + if (ctx->glGenSamplers) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, TRUE); + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 3) || + _cogl_check_extension ("GL_ARB_texture_swizzle", gl_extensions) || + _cogl_check_extension ("GL_EXT_texture_swizzle", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE, TRUE); + + /* The per-vertex point size is only available via GLSL with the + * gl_PointSize builtin. This is only available in GL 2.0 (not the + * GLSL extensions) */ + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0)) + { + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, + TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_ENABLE_PROGRAM_POINT_SIZE, TRUE); + } + + if (ctx->driver == COGL_DRIVER_GL) + { + int max_clip_planes = 0; + + /* Features which are not available in GL 3 */ + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_QUADS, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE); + + GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) ); + if (max_clip_planes >= 4) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES, TRUE); + } + + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ANY_GL, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_FORMAT_CONVERSION, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL, TRUE); + + if (ctx->glFenceSync) + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_FENCE, TRUE); + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0) || + _cogl_check_extension ("GL_ARB_texture_rg", gl_extensions)) + COGL_FLAGS_SET (ctx->features, + COGL_FEATURE_ID_TEXTURE_RG, + TRUE); + + /* Cache features */ + for (i = 0; i < G_N_ELEMENTS (private_features); i++) + ctx->private_features[i] |= private_features[i]; + ctx->feature_flags |= flags; + + g_strfreev (gl_extensions); + + if (!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) && + !COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE)) + { + _cogl_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND, + "The GL_ARB_texture_swizzle extension is required " + "to use the GL3 driver"); + return FALSE; + } + + return TRUE; +} + +const CoglDriverVtable +_cogl_driver_gl = + { + _cogl_driver_pixel_format_from_gl_internal, + _cogl_driver_pixel_format_to_gl, + _cogl_driver_update_features, + _cogl_offscreen_gl_allocate, + _cogl_offscreen_gl_free, + _cogl_framebuffer_gl_flush_state, + _cogl_framebuffer_gl_clear, + _cogl_framebuffer_gl_query_bits, + _cogl_framebuffer_gl_finish, + _cogl_framebuffer_gl_discard_buffers, + _cogl_framebuffer_gl_draw_attributes, + _cogl_framebuffer_gl_draw_indexed_attributes, + _cogl_framebuffer_gl_read_pixels_into_bitmap, + _cogl_texture_2d_gl_free, + _cogl_texture_2d_gl_can_create, + _cogl_texture_2d_gl_init, + _cogl_texture_2d_gl_allocate, + _cogl_texture_2d_gl_copy_from_framebuffer, + _cogl_texture_2d_gl_get_gl_handle, + _cogl_texture_2d_gl_generate_mipmap, + _cogl_texture_2d_gl_copy_from_bitmap, + _cogl_texture_2d_gl_get_data, + _cogl_gl_flush_attributes_state, + _cogl_clip_stack_gl_flush, + _cogl_buffer_gl_create, + _cogl_buffer_gl_destroy, + _cogl_buffer_gl_map_range, + _cogl_buffer_gl_unmap, + _cogl_buffer_gl_set_data, + }; diff --git a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h new file mode 100644 index 0000000..f054aad --- /dev/null +++ b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H +#define __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineFragend _cogl_pipeline_arbfp_fragend; + +#endif /* __COGL_PIPELINE_ARBFP_PRIVATE_H */ + diff --git a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c new file mode 100644 index 0000000..16b13be --- /dev/null +++ b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c @@ -0,0 +1,990 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-pipeline-layer-private.h" + +#ifdef COGL_PIPELINE_FRAGEND_ARBFP + +#include "cogl-context-private.h" +#include "cogl-object-private.h" + +#include "cogl-texture-private.h" +#include "cogl-blend-string.h" +#include "cogl-journal-private.h" +#include "cogl-color-private.h" +#include "cogl-profile.h" +#include "cogl-program-private.h" + +#include +#include +#include + +/* This might not be defined on GLES */ +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif + +const CoglPipelineFragend _cogl_pipeline_arbfp_fragend; + +typedef struct _UnitState +{ + int constant_id; /* The program.local[] index */ + unsigned int dirty_combine_constant:1; + unsigned int has_combine_constant:1; + + unsigned int sampled:1; +} UnitState; + +typedef struct +{ + int ref_count; + + CoglHandle user_program; + /* XXX: only valid during codegen */ + GString *source; + GLuint gl_program; + UnitState *unit_state; + int next_constant_id; + + /* Age of the program the last time the uniforms were flushed. This + is used to detect when we need to flush all of the uniforms */ + unsigned int user_program_age; + + /* We need to track the last pipeline that an ARBfp program was used + * with so know if we need to update any program.local parameters. */ + CoglPipeline *last_used_for_pipeline; + + CoglPipelineCacheEntry *cache_entry; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static CoglPipelineShaderState * +shader_state_new (int n_layers, + CoglPipelineCacheEntry *cache_entry) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + shader_state->unit_state = g_new0 (UnitState, n_layers); + shader_state->cache_entry = cache_entry; + + return shader_state; +} + +static CoglPipelineShaderState * +get_shader_state (CoglPipeline *pipeline) +{ + return cogl_object_get_user_data (COGL_OBJECT (pipeline), &shader_state_key); +} + +static void +destroy_shader_state (void *user_data, + void *instance) +{ + CoglPipelineShaderState *shader_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If the shader state was last used for this pipeline then clear it + so that if same address gets used again for a new pipeline then + we won't think it's the same pipeline and avoid updating the + constants */ + if (shader_state->last_used_for_pipeline == instance) + shader_state->last_used_for_pipeline = NULL; + + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != instance) + shader_state->cache_entry->usage_count--; + + if (--shader_state->ref_count == 0) + { + if (shader_state->gl_program) + { + GE (ctx, glDeletePrograms (1, &shader_state->gl_program)); + shader_state->gl_program = 0; + } + + g_free (shader_state->unit_state); + + g_slice_free (CoglPipelineShaderState, shader_state); + } +} + +static void +set_shader_state (CoglPipeline *pipeline, CoglPipelineShaderState *shader_state) +{ + if (shader_state) + { + shader_state->ref_count++; + + /* If we're not setting the state on the template pipeline then + * mark it as a usage of the pipeline cache entry */ + if (shader_state->cache_entry && + shader_state->cache_entry->pipeline != pipeline) + shader_state->cache_entry->usage_count++; + } + + _cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + shader_state, + destroy_shader_state); +} + +static void +dirty_shader_state (CoglPipeline *pipeline) +{ + cogl_object_set_user_data (COGL_OBJECT (pipeline), + &shader_state_key, + NULL, + NULL); +} + +static void +_cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state; + CoglPipeline *authority; + CoglPipelineCacheEntry *cache_entry = NULL; + CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Now lookup our ARBfp backend private state */ + shader_state = get_shader_state (pipeline); + + /* If we have a valid shader_state then we are all set and don't + * need to generate a new program. */ + if (shader_state) + return; + + /* If we don't have an associated arbfp program yet then find the + * arbfp-authority (the oldest ancestor whose state will result in + * the same program being generated as for this pipeline). + * + * We always make sure to associate new programs with the + * arbfp-authority to maximize the chance that other pipelines can + * share it. + */ + authority = _cogl_pipeline_find_equivalent_parent + (pipeline, + _cogl_pipeline_get_state_for_fragment_codegen (ctx) & + ~COGL_PIPELINE_STATE_LAYERS, + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx)); + shader_state = get_shader_state (authority); + if (shader_state) + { + /* If we are going to share our program state with an arbfp-authority + * then add a reference to the program state associated with that + * arbfp-authority... */ + set_shader_state (pipeline, shader_state); + return; + } + + /* If we haven't yet found an existing program then before we resort to + * generating a new arbfp program we see if we can find a suitable + * program in the pipeline_cache. */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PROGRAM_CACHES)))) + { + cache_entry = + _cogl_pipeline_cache_get_fragment_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (cache_entry->pipeline); + + if (shader_state) + shader_state->ref_count++; + } + + /* If we still haven't got a shader state then we'll have to create + a new one */ + if (shader_state == NULL) + { + shader_state = shader_state_new (n_layers, cache_entry); + + shader_state->user_program = user_program; + if (user_program == COGL_INVALID_HANDLE) + { + /* We reuse a single grow-only GString for code-gen */ + g_string_set_size (ctx->codegen_source_buffer, 0); + shader_state->source = ctx->codegen_source_buffer; + g_string_append (shader_state->source, + "!!ARBfp1.0\n" + "TEMP output;\n" + "TEMP tmp0, tmp1, tmp2, tmp3, tmp4;\n" + "PARAM half = {.5, .5, .5, .5};\n" + "PARAM one = {1, 1, 1, 1};\n" + "PARAM two = {2, 2, 2, 2};\n" + "PARAM minus_one = {-1, -1, -1, -1};\n"); + } + } + + set_shader_state (pipeline, shader_state); + + shader_state->ref_count--; + + /* Since we have already resolved the arbfp-authority at this point + * we might as well also associate any program we find from the cache + * with the authority too... */ + if (authority != pipeline) + set_shader_state (authority, shader_state); + + /* If we found a template then we'll attach it to that too so that + next time a similar pipeline is used it can use the same state */ + if (cache_entry) + set_shader_state (cache_entry->pipeline, shader_state); +} + +static const char * +texture_type_to_arbfp_string (CoglTextureType texture_type) +{ + switch (texture_type) + { +#if 0 /* TODO */ + case COGL_TEXTURE_TYPE_1D: + return "1D"; +#endif + case COGL_TEXTURE_TYPE_2D: + return "2D"; + case COGL_TEXTURE_TYPE_3D: + return "3D"; + case COGL_TEXTURE_TYPE_RECTANGLE: + return "RECT"; + } + + g_warn_if_reached (); + + return "2D"; +} + +static void +setup_texture_source (CoglPipelineShaderState *shader_state, + int unit_index, + CoglTextureType texture_type) +{ + if (!shader_state->unit_state[unit_index].sampled) + { + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING))) + g_string_append_printf (shader_state->source, + "TEMP texel%d;\n" + "MOV texel%d, one;\n", + unit_index, + unit_index); + else + g_string_append_printf (shader_state->source, + "TEMP texel%d;\n" + "TEX texel%d,fragment.texcoord[%d]," + "texture[%d],%s;\n", + unit_index, + unit_index, + unit_index, + unit_index, + texture_type_to_arbfp_string (texture_type)); + shader_state->unit_state[unit_index].sampled = TRUE; + } +} + +typedef enum _CoglPipelineFragendARBfpArgType +{ + COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE, + COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT, + COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE +} CoglPipelineFragendARBfpArgType; + +typedef struct _CoglPipelineFragendARBfpArg +{ + const char *name; + + CoglPipelineFragendARBfpArgType type; + + /* for type = TEXTURE */ + int texture_unit; + CoglTextureType texture_type; + + /* for type = CONSTANT */ + int constant_id; + + const char *swizzle; + +} CoglPipelineFragendARBfpArg; + +static void +append_arg (GString *source, const CoglPipelineFragendARBfpArg *arg) +{ + switch (arg->type) + { + case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE: + g_string_append_printf (source, "texel%d%s", + arg->texture_unit, arg->swizzle); + break; + case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT: + g_string_append_printf (source, "program.local[%d]%s", + arg->constant_id, arg->swizzle); + break; + case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE: + g_string_append_printf (source, "%s%s", + arg->name, arg->swizzle); + break; + } +} + +/* Note: we are trying to avoid duplicating strings during codegen + * which is why we have the slightly awkward + * CoglPipelineFragendARBfpArg mechanism. */ +static void +setup_arg (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglBlendStringChannelMask mask, + int arg_index, + CoglPipelineCombineSource src, + GLint op, + CoglPipelineFragendARBfpArg *arg) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + static const char *tmp_name[3] = { "tmp0", "tmp1", "tmp2" }; + + switch (src) + { + case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE: + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE; + arg->name = "texel%d"; + arg->texture_unit = _cogl_pipeline_layer_get_unit_index (layer); + setup_texture_source (shader_state, + arg->texture_unit, + _cogl_pipeline_layer_get_texture_type (layer)); + break; + case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT: + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + UnitState *unit_state = &shader_state->unit_state[unit_index]; + + unit_state->constant_id = shader_state->next_constant_id++; + unit_state->has_combine_constant = TRUE; + unit_state->dirty_combine_constant = TRUE; + + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT; + arg->name = "program.local[%d]"; + arg->constant_id = unit_state->constant_id; + break; + } + case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR: + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE; + arg->name = "fragment.color.primary"; + break; + case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS: + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE; + if (_cogl_pipeline_layer_get_unit_index (layer) == 0) + arg->name = "fragment.color.primary"; + else + arg->name = "output"; + break; + default: /* Sample the texture attached to a specific layer */ + { + int layer_num = src - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0; + CoglPipelineGetLayerFlags flags = COGL_PIPELINE_GET_LAYER_NO_CREATE; + CoglPipelineLayer *other_layer = + _cogl_pipeline_get_layer_with_flags (pipeline, layer_num, flags); + + if (other_layer == NULL) + { + static CoglBool warning_seen = FALSE; + if (!warning_seen) + { + g_warning ("The application is trying to use a texture " + "combine with a layer number that does not exist"); + warning_seen = TRUE; + } + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE; + arg->name = "output"; + } + else + { + CoglTextureType texture_type; + + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE; + arg->name = "texture[%d]"; + arg->texture_unit = + _cogl_pipeline_layer_get_unit_index (other_layer); + texture_type = _cogl_pipeline_layer_get_texture_type (other_layer); + setup_texture_source (shader_state, + arg->texture_unit, + texture_type); + } + } + break; + } + + arg->swizzle = ""; + + switch (op) + { + case COGL_PIPELINE_COMBINE_OP_SRC_COLOR: + break; + case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR: + g_string_append_printf (shader_state->source, + "SUB tmp%d, one, ", + arg_index); + append_arg (shader_state->source, arg); + g_string_append_printf (shader_state->source, ";\n"); + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE; + arg->name = tmp_name[arg_index]; + arg->swizzle = ""; + break; + case COGL_PIPELINE_COMBINE_OP_SRC_ALPHA: + /* avoid a swizzle if we know RGB are going to be masked + * in the end anyway */ + if (mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + arg->swizzle = ".a"; + break; + case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA: + g_string_append_printf (shader_state->source, + "SUB tmp%d, one, ", + arg_index); + append_arg (shader_state->source, arg); + /* avoid a swizzle if we know RGB are going to be masked + * in the end anyway */ + if (mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA) + g_string_append_printf (shader_state->source, ".a;\n"); + else + g_string_append_printf (shader_state->source, ";\n"); + arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE; + arg->name = tmp_name[arg_index]; + break; + default: + g_error ("Unknown texture combine operator %d", op); + break; + } +} + +static CoglBool +fragend_arbfp_args_equal (CoglPipelineFragendARBfpArg *arg0, + CoglPipelineFragendARBfpArg *arg1) +{ + if (arg0->type != arg1->type) + return FALSE; + + if (arg0->name != arg1->name && + strcmp (arg0->name, arg1->name) != 0) + return FALSE; + + if (arg0->type == COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE && + arg0->texture_unit != arg1->texture_unit) + return FALSE; + /* Note we don't have to check the target; a texture unit can only + * have one target enabled at a time. */ + + if (arg0->type == COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT && + arg0->constant_id != arg1->constant_id) + return FALSE; + + if (arg0->swizzle != arg1->swizzle && + strcmp (arg0->swizzle, arg1->swizzle) != 0) + return FALSE; + + return TRUE; +} + +static void +append_function (CoglPipeline *pipeline, + CoglBlendStringChannelMask mask, + GLint function, + CoglPipelineFragendARBfpArg *args, + int n_args) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + const char *mask_name; + + switch (mask) + { + case COGL_BLEND_STRING_CHANNEL_MASK_RGB: + mask_name = ".rgb"; + break; + case COGL_BLEND_STRING_CHANNEL_MASK_ALPHA: + mask_name = ".a"; + break; + case COGL_BLEND_STRING_CHANNEL_MASK_RGBA: + mask_name = ""; + break; + default: + g_error ("Unknown channel mask %d", mask); + mask_name = ""; + } + + switch (function) + { + case COGL_PIPELINE_COMBINE_FUNC_ADD: + g_string_append_printf (shader_state->source, + "ADD_SAT output%s, ", + mask_name); + break; + case COGL_PIPELINE_COMBINE_FUNC_MODULATE: + /* Note: no need to saturate since we can assume operands + * have values in the range [0,1] */ + g_string_append_printf (shader_state->source, "MUL output%s, ", + mask_name); + break; + case COGL_PIPELINE_COMBINE_FUNC_REPLACE: + /* Note: no need to saturate since we can assume operand + * has a value in the range [0,1] */ + g_string_append_printf (shader_state->source, "MOV output%s, ", + mask_name); + break; + case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT: + g_string_append_printf (shader_state->source, + "SUB_SAT output%s, ", + mask_name); + break; + case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED: + g_string_append_printf (shader_state->source, "ADD tmp3%s, ", + mask_name); + append_arg (shader_state->source, &args[0]); + g_string_append (shader_state->source, ", "); + append_arg (shader_state->source, &args[1]); + g_string_append (shader_state->source, ";\n"); + g_string_append_printf (shader_state->source, + "SUB_SAT output%s, tmp3, half", + mask_name); + n_args = 0; + break; + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB: + /* These functions are the same except that GL_DOT3_RGB never + * updates the alpha channel. + * + * NB: GL_DOT3_RGBA is a bit special because it effectively forces + * an RGBA mask and we end up ignoring any separate alpha channel + * function. + */ + case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA: + { + const char *tmp4 = "tmp4"; + + /* The maths for this was taken from Mesa; + * apparently: + * + * tmp3 = 2*src0 - 1 + * tmp4 = 2*src1 - 1 + * output = DP3 (tmp3, tmp4) + * + * is the same as: + * + * output = 4 * DP3 (src0 - 0.5, src1 - 0.5) + */ + + g_string_append (shader_state->source, "MAD tmp3, two, "); + append_arg (shader_state->source, &args[0]); + g_string_append (shader_state->source, ", minus_one;\n"); + + if (!fragend_arbfp_args_equal (&args[0], &args[1])) + { + g_string_append (shader_state->source, "MAD tmp4, two, "); + append_arg (shader_state->source, &args[1]); + g_string_append (shader_state->source, ", minus_one;\n"); + } + else + tmp4 = "tmp3"; + + g_string_append_printf (shader_state->source, + "DP3_SAT output%s, tmp3, %s", + mask_name, tmp4); + n_args = 0; + } + break; + case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE: + /* Note: no need to saturate since we can assume operands + * have values in the range [0,1] */ + + /* NB: GL_INTERPOLATE = arg0*arg2 + arg1*(1-arg2) + * but LRP dst, a, b, c = b*a + c*(1-a) */ + g_string_append_printf (shader_state->source, "LRP output%s, ", + mask_name); + append_arg (shader_state->source, &args[2]); + g_string_append (shader_state->source, ", "); + append_arg (shader_state->source, &args[0]); + g_string_append (shader_state->source, ", "); + append_arg (shader_state->source, &args[1]); + n_args = 0; + break; + default: + g_error ("Unknown texture combine function %d", function); + g_string_append_printf (shader_state->source, "MUL_SAT output%s, ", + mask_name); + n_args = 2; + break; + } + + if (n_args > 0) + append_arg (shader_state->source, &args[0]); + if (n_args > 1) + { + g_string_append (shader_state->source, ", "); + append_arg (shader_state->source, &args[1]); + } + g_string_append (shader_state->source, ";\n"); +} + +static void +append_masked_combine (CoglPipeline *arbfp_authority, + CoglPipelineLayer *layer, + CoglBlendStringChannelMask mask, + CoglPipelineCombineFunc function, + CoglPipelineCombineSource *src, + CoglPipelineCombineOp *op) +{ + int i; + int n_args; + CoglPipelineFragendARBfpArg args[3]; + + n_args = _cogl_get_n_args_for_combine_func (function); + + for (i = 0; i < n_args; i++) + { + setup_arg (arbfp_authority, + layer, + mask, + i, + src[i], + op[i], + &args[i]); + } + + append_function (arbfp_authority, + mask, + function, + args, + n_args); +} + +static CoglBool +_cogl_pipeline_fragend_arbfp_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + CoglPipelineLayer *combine_authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_COMBINE); + CoglPipelineLayerBigState *big_state = combine_authority->big_state; + + /* Notes... + * + * We are ignoring the issue of texture indirection limits until + * someone complains (Ref Section 3.11.6 in the ARB_fragment_program + * spec) + * + * There always five TEMPs named tmp0, tmp1 and tmp2, tmp3 and tmp4 + * available and these constants: 'one' = {1, 1, 1, 1}, 'half' + * {.5, .5, .5, .5}, 'two' = {2, 2, 2, 2}, 'minus_one' = {-1, -1, + * -1, -1} + * + * tmp0-2 are intended for dealing with some of the texture combine + * operands (e.g. GL_ONE_MINUS_SRC_COLOR) tmp3/4 are for dealing + * with the GL_ADD_SIGNED texture combine and the GL_DOT3_RGB[A] + * functions. + * + * Each layer outputs to the TEMP called "output", and reads from + * output if it needs to refer to GL_PREVIOUS. (we detect if we are + * layer0 so we will read fragment.color for GL_PREVIOUS in that + * case) + * + * We aim to do all the channels together if the same function is + * used for RGB as for A. + * + * We aim to avoid string duplication / allocations during codegen. + * + * We are careful to only saturate when writing to output. + */ + + if (!shader_state->source) + return TRUE; + + if (!_cogl_pipeline_layer_needs_combine_separate (combine_authority)) + { + append_masked_combine (pipeline, + layer, + COGL_BLEND_STRING_CHANNEL_MASK_RGBA, + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src, + big_state->texture_combine_rgb_op); + } + else if (big_state->texture_combine_rgb_func == + COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA) + { + /* GL_DOT3_RGBA Is a bit weird as a GL_COMBINE_RGB function + * since if you use it, it overrides your ALPHA function... + */ + append_masked_combine (pipeline, + layer, + COGL_BLEND_STRING_CHANNEL_MASK_RGBA, + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src, + big_state->texture_combine_rgb_op); + } + else + { + append_masked_combine (pipeline, + layer, + COGL_BLEND_STRING_CHANNEL_MASK_RGB, + big_state->texture_combine_rgb_func, + big_state->texture_combine_rgb_src, + big_state->texture_combine_rgb_op); + append_masked_combine (pipeline, + layer, + COGL_BLEND_STRING_CHANNEL_MASK_ALPHA, + big_state->texture_combine_alpha_func, + big_state->texture_combine_alpha_src, + big_state->texture_combine_alpha_op); + } + + return TRUE; +} + +static CoglBool +_cogl_pipeline_fragend_arbfp_passthrough (CoglPipeline *pipeline) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + + if (!shader_state->source) + return TRUE; + + g_string_append (shader_state->source, + "MOV output, fragment.color.primary;\n"); + return TRUE; +} + +typedef struct _UpdateConstantsState +{ + int unit; + CoglBool update_all; + CoglPipelineShaderState *shader_state; +} UpdateConstantsState; + +static CoglBool +update_constants_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + UpdateConstantsState *state = user_data; + CoglPipelineShaderState *shader_state = state->shader_state; + UnitState *unit_state = &shader_state->unit_state[state->unit++]; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (unit_state->has_combine_constant && + (state->update_all || unit_state->dirty_combine_constant)) + { + float constant[4]; + _cogl_pipeline_get_layer_combine_constant (pipeline, + layer_index, + constant); + GE (ctx, glProgramLocalParameter4fv (GL_FRAGMENT_PROGRAM_ARB, + unit_state->constant_id, + constant)); + unit_state->dirty_combine_constant = FALSE; + } + return TRUE; +} + +static CoglBool +_cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline, + unsigned long pipelines_difference) +{ + CoglPipelineShaderState *shader_state = get_shader_state (pipeline); + GLuint gl_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (shader_state->source) + { + GLenum gl_error; + COGL_STATIC_COUNTER (fragend_arbfp_compile_counter, + "arbfp compile counter", + "Increments each time a new ARBfp " + "program is compiled", + 0 /* no application private data */); + + COGL_COUNTER_INC (_cogl_uprof_context, fragend_arbfp_compile_counter); + + g_string_append (shader_state->source, + "MOV result.color,output;\n"); + g_string_append (shader_state->source, "END\n"); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE))) + g_message ("pipeline program:\n%s", shader_state->source->str); + + GE (ctx, glGenPrograms (1, &shader_state->gl_program)); + + GE (ctx, glBindProgram (GL_FRAGMENT_PROGRAM_ARB, + shader_state->gl_program)); + + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + ctx->glProgramString (GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + shader_state->source->len, + shader_state->source->str); + if (ctx->glGetError () != GL_NO_ERROR) + { + g_warning ("\n%s\n%s", + shader_state->source->str, + ctx->glGetString (GL_PROGRAM_ERROR_STRING_ARB)); + } + + shader_state->source = NULL; + } + + if (shader_state->user_program != COGL_INVALID_HANDLE) + { + /* An arbfp program should contain exactly one shader which we + can use directly */ + CoglProgram *program = shader_state->user_program; + CoglShader *shader = program->attached_shaders->data; + + gl_program = shader->gl_handle; + } + else + gl_program = shader_state->gl_program; + + GE (ctx, glBindProgram (GL_FRAGMENT_PROGRAM_ARB, gl_program)); + _cogl_use_fragment_program (0, COGL_PIPELINE_PROGRAM_TYPE_ARBFP); + + if (shader_state->user_program == COGL_INVALID_HANDLE) + { + UpdateConstantsState state; + state.unit = 0; + state.shader_state = shader_state; + /* If this arbfp program was last used with a different pipeline + * then we need to ensure we update all program.local params */ + state.update_all = + pipeline != shader_state->last_used_for_pipeline; + cogl_pipeline_foreach_layer (pipeline, + update_constants_cb, + &state); + } + else + { + CoglProgram *program = shader_state->user_program; + CoglBool program_changed; + + /* If the shader has changed since it was last flushed then we + need to update all uniforms */ + program_changed = program->age != shader_state->user_program_age; + + _cogl_program_flush_uniforms (program, gl_program, program_changed); + + shader_state->user_program_age = program->age; + } + + /* We need to track what pipeline used this arbfp program last since + * we will need to update program.local params when switching + * between different pipelines. */ + shader_state->last_used_for_pipeline = pipeline; + + return TRUE; +} + +static void +_cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify ( + CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if ((change & _cogl_pipeline_get_state_for_fragment_codegen (ctx))) + dirty_shader_state (pipeline); +} + +/* NB: layers are considered immutable once they have any dependants + * so although multiple pipelines can end up depending on a single + * static layer, we can guarantee that if a layer is being *changed* + * then it can only have one pipeline depending on it. + * + * XXX: Don't forget this is *pre* change, we can't read the new value + * yet! + */ +static void +_cogl_pipeline_fragend_arbfp_layer_pre_change_notify ( + CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + CoglPipelineShaderState *shader_state = get_shader_state (owner); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!shader_state) + return; + + if ((change & _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx))) + { + dirty_shader_state (owner); + return; + } + + if (change & COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT) + { + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + shader_state->unit_state[unit_index].dirty_combine_constant = TRUE; + } + + /* TODO: we could be saving snippets of texture combine code along + * with each layer and then when a layer changes we would just free + * the snippet. */ + return; +} + +const CoglPipelineFragend _cogl_pipeline_arbfp_fragend = +{ + _cogl_pipeline_fragend_arbfp_start, + _cogl_pipeline_fragend_arbfp_add_layer, + _cogl_pipeline_fragend_arbfp_passthrough, + _cogl_pipeline_fragend_arbfp_end, + _cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify, + NULL, + _cogl_pipeline_fragend_arbfp_layer_pre_change_notify +}; + +#endif /* COGL_PIPELINE_FRAGEND_ARBFP */ + diff --git a/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h new file mode 100644 index 0000000..ba0c713 --- /dev/null +++ b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H +#define __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H + +#include "cogl-pipeline-private.h" + +extern const CoglPipelineProgend _cogl_pipeline_fixed_arbfp_progend; + +#endif /* __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H */ + diff --git a/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c new file mode 100644 index 0000000..956bffc --- /dev/null +++ b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c @@ -0,0 +1,121 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" + +#ifdef COGL_PIPELINE_PROGEND_FIXED_ARBFP + +#include "cogl-context.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-program-private.h" + +static CoglBool +_cogl_pipeline_progend_fixed_arbfp_start (CoglPipeline *pipeline) +{ + CoglHandle user_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED))) + return FALSE; + + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) + return FALSE; + + /* Vertex snippets are only supported in the GLSL fragend */ + if (_cogl_pipeline_has_vertex_snippets (pipeline)) + return FALSE; + + /* Validate that we can handle the fragment state using ARBfp + */ + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) + return FALSE; + + /* Fragment snippets are only supported in the GLSL fragend */ + if (_cogl_pipeline_has_fragment_snippets (pipeline)) + return FALSE; + + user_program = cogl_pipeline_get_user_program (pipeline); + if (user_program && + _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_ARBFP) + return FALSE; + + /* The ARBfp progend can't handle the per-vertex point size + * attribute */ + if (cogl_pipeline_get_per_vertex_point_size (pipeline)) + return FALSE; + + return TRUE; +} + +static void +_cogl_pipeline_progend_fixed_arbfp_pre_paint (CoglPipeline *pipeline, + CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + if (ctx->current_projection_entry) + _cogl_matrix_entry_flush_to_gl_builtins (ctx, + ctx->current_projection_entry, + COGL_MATRIX_PROJECTION, + framebuffer, + FALSE /* enable flip */); + if (ctx->current_modelview_entry) + _cogl_matrix_entry_flush_to_gl_builtins (ctx, + ctx->current_modelview_entry, + COGL_MATRIX_MODELVIEW, + framebuffer, + FALSE /* enable flip */); +} + +const CoglPipelineProgend _cogl_pipeline_fixed_arbfp_progend = + { + COGL_PIPELINE_VERTEND_FIXED, + COGL_PIPELINE_FRAGEND_ARBFP, + _cogl_pipeline_progend_fixed_arbfp_start, + NULL, /* end */ + NULL, /* pre_change_notify */ + NULL, /* layer_pre_change_notify */ + _cogl_pipeline_progend_fixed_arbfp_pre_paint + }; + +#endif /* COGL_PIPELINE_PROGEND_FIXED_ARBFP */ diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c new file mode 100644 index 0000000..109af81 --- /dev/null +++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c @@ -0,0 +1,555 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-bitmap.h" +#include "cogl-bitmap-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-primitives.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" + +#include +#include +#include + +#ifndef GL_TEXTURE_SWIZZLE_RGBA +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#endif + +static GLuint +_cogl_texture_driver_gen (CoglContext *ctx, + GLenum gl_target, + CoglPixelFormat internal_format) +{ + GLuint tex; + + GE (ctx, glGenTextures (1, &tex)); + + _cogl_bind_gl_texture_transient (gl_target, tex, FALSE); + + switch (gl_target) + { + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + /* In case automatic mipmap generation gets disabled for this + * texture but a minification filter depending on mipmap + * interpolation is selected then we initialize the max mipmap + * level to 0 so OpenGL will consider the texture storage to be + * "complete". + */ +#ifdef HAVE_COGL_GL + if (_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL)) + GE( ctx, glTexParameteri (gl_target, GL_TEXTURE_MAX_LEVEL, 0)); +#endif + + /* GL_TEXTURE_MAG_FILTER defaults to GL_LINEAR, no need to set it */ + GE( ctx, glTexParameteri (gl_target, + GL_TEXTURE_MIN_FILTER, + GL_LINEAR) ); + break; + + case GL_TEXTURE_RECTANGLE_ARB: + /* Texture rectangles already default to GL_LINEAR so nothing + needs to be done */ + break; + + default: + g_assert_not_reached(); + } + + /* If the driver doesn't support alpha textures directly then we'll + * fake them by setting the swizzle parameters */ + if (internal_format == COGL_PIXEL_FORMAT_A_8 && + !_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) && + _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE)) + { + static const GLint red_swizzle[] = { GL_ZERO, GL_ZERO, GL_ZERO, GL_RED }; + + GE( ctx, glTexParameteriv (gl_target, + GL_TEXTURE_SWIZZLE_RGBA, + red_swizzle) ); + } + + return tex; +} + +/* OpenGL - unlike GLES - can upload a sub region of pixel data from a larger + * source buffer */ +static void +prep_gl_for_pixels_upload_full (CoglContext *ctx, + int pixels_rowstride, + int image_height, + int pixels_src_x, + int pixels_src_y, + int pixels_bpp) +{ + GE( ctx, glPixelStorei (GL_UNPACK_ROW_LENGTH, + pixels_rowstride / pixels_bpp) ); + + GE( ctx, glPixelStorei (GL_UNPACK_SKIP_PIXELS, pixels_src_x) ); + GE( ctx, glPixelStorei (GL_UNPACK_SKIP_ROWS, pixels_src_y) ); + + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + GE( ctx, glPixelStorei (GL_UNPACK_IMAGE_HEIGHT, image_height) ); + + _cogl_texture_gl_prep_alignment_for_pixels_upload (ctx, pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_upload (CoglContext *ctx, + int pixels_rowstride, + int pixels_bpp) +{ + prep_gl_for_pixels_upload_full (ctx, pixels_rowstride, 0, 0, 0, pixels_bpp); +} + +/* OpenGL - unlike GLES - can download pixel data into a sub region of + * a larger destination buffer */ +static void +prep_gl_for_pixels_download_full (CoglContext *ctx, + int image_width, + int pixels_rowstride, + int image_height, + int pixels_src_x, + int pixels_src_y, + int pixels_bpp) +{ + GE( ctx, glPixelStorei (GL_PACK_ROW_LENGTH, pixels_rowstride / pixels_bpp) ); + + GE( ctx, glPixelStorei (GL_PACK_SKIP_PIXELS, pixels_src_x) ); + GE( ctx, glPixelStorei (GL_PACK_SKIP_ROWS, pixels_src_y) ); + + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + GE( ctx, glPixelStorei (GL_PACK_IMAGE_HEIGHT, image_height) ); + + _cogl_texture_gl_prep_alignment_for_pixels_download (ctx, + pixels_bpp, + image_width, + pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_download (CoglContext *ctx, + int image_width, + int pixels_rowstride, + int pixels_bpp) +{ + prep_gl_for_pixels_download_full (ctx, + pixels_rowstride, + image_width, + 0 /* image height */, + 0, 0, /* pixels_src_x/y */ + pixels_bpp); +} + +static CoglBool +_cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, + CoglTexture *texture, + CoglBool is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + int level, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + GLenum gl_target; + GLuint gl_handle; + uint8_t *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + GLenum gl_error; + CoglBool status = TRUE; + CoglError *internal_error = NULL; + int level_width; + int level_height; + + cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target); + + data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, &internal_error); + + /* NB: _cogl_bitmap_gl_bind() may return NULL when successfull so we + * have to explicitly check the cogl error pointer to catch + * problems... */ + if (internal_error) + { + _cogl_propagate_error (error, internal_error); + return FALSE; + } + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (ctx, + cogl_bitmap_get_rowstride (source_bmp), + 0, + src_x, + src_y, + bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_texture_get_level_size (texture, + level, + &level_width, + &level_height, + NULL); + + if (level_width == width && level_height == height) + { + /* GL gets upset if you use glTexSubImage2D to initialize the + * contents of a mipmap level so we make sure to use + * glTexImage2D if we are uploading a full mipmap level. + */ + ctx->glTexImage2D (gl_target, + level, + _cogl_texture_gl_get_format (texture), + width, + height, + 0, + source_gl_format, + source_gl_type, + data); + + } + else + { + /* GL gets upset if you use glTexSubImage2D to initialize the + * contents of a mipmap level so if this is the first time + * we've seen a request to upload to this level we call + * glTexImage2D first to assert that the storage for this + * level exists. + */ + if (texture->max_level < level) + { + ctx->glTexImage2D (gl_target, + level, + _cogl_texture_gl_get_format (texture), + level_width, + level_height, + 0, + source_gl_format, + source_gl_type, + NULL); + } + + ctx->glTexSubImage2D (gl_target, + level, + dst_x, dst_y, + width, height, + source_gl_format, + source_gl_type, + data); + } + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_bitmap_gl_unbind (source_bmp); + + return status; +} + +static CoglBool +_cogl_texture_driver_upload_to_gl (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + uint8_t *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + GLenum gl_error; + CoglBool status = TRUE; + CoglError *internal_error = NULL; + + data = _cogl_bitmap_gl_bind (source_bmp, + COGL_BUFFER_ACCESS_READ, + 0, /* hints */ + &internal_error); + + /* NB: _cogl_bitmap_gl_bind() may return NULL when successful so we + * have to explicitly check the cogl error pointer to catch + * problems... */ + if (internal_error) + { + _cogl_propagate_error (error, internal_error); + return FALSE; + } + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (ctx, + cogl_bitmap_get_rowstride (source_bmp), + 0, 0, 0, bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage2D (gl_target, 0, + internal_gl_format, + cogl_bitmap_get_width (source_bmp), + cogl_bitmap_get_height (source_bmp), + 0, + source_gl_format, + source_gl_type, + data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_bitmap_gl_unbind (source_bmp); + + return status; +} + +static CoglBool +_cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + uint8_t *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + GLenum gl_error; + CoglBool status = TRUE; + + data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error); + if (!data) + return FALSE; + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (ctx, + cogl_bitmap_get_rowstride (source_bmp), + (cogl_bitmap_get_height (source_bmp) / + depth), + 0, 0, bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage3D (gl_target, + 0, /* level */ + internal_gl_format, + cogl_bitmap_get_width (source_bmp), + height, + depth, + 0, + source_gl_format, + source_gl_type, + data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_bitmap_gl_unbind (source_bmp); + + return status; +} + +static CoglBool +_cogl_texture_driver_gl_get_tex_image (CoglContext *ctx, + GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + uint8_t *dest) +{ + GE (ctx, glGetTexImage (gl_target, + 0, /* level */ + dest_gl_format, + dest_gl_type, + (GLvoid *)dest)); + return TRUE; +} + +static CoglBool +_cogl_texture_driver_size_supported_3d (CoglContext *ctx, + GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height, + int depth) +{ + GLenum proxy_target; + GLint new_width = 0; + + if (gl_target == GL_TEXTURE_3D) + proxy_target = GL_PROXY_TEXTURE_3D; + else + /* Unknown target, assume it's not supported */ + return FALSE; + + /* Proxy texture allows for a quick check for supported size */ + GE( ctx, glTexImage3D (proxy_target, 0, GL_RGBA, + width, height, depth, 0 /* border */, + gl_format, gl_type, NULL) ); + + GE( ctx, glGetTexLevelParameteriv (proxy_target, 0, + GL_TEXTURE_WIDTH, &new_width) ); + + return new_width != 0; +} + +static CoglBool +_cogl_texture_driver_size_supported (CoglContext *ctx, + GLenum gl_target, + GLenum gl_intformat, + GLenum gl_format, + GLenum gl_type, + int width, + int height) +{ + GLenum proxy_target; + GLint new_width = 0; + + if (gl_target == GL_TEXTURE_2D) + proxy_target = GL_PROXY_TEXTURE_2D; +#if HAVE_COGL_GL + else if (gl_target == GL_TEXTURE_RECTANGLE_ARB) + proxy_target = GL_PROXY_TEXTURE_RECTANGLE_ARB; +#endif + else + /* Unknown target, assume it's not supported */ + return FALSE; + + /* Proxy texture allows for a quick check for supported size */ + GE( ctx, glTexImage2D (proxy_target, 0, gl_intformat, + width, height, 0 /* border */, + gl_format, gl_type, NULL) ); + + GE( ctx, glGetTexLevelParameteriv (proxy_target, 0, + GL_TEXTURE_WIDTH, &new_width) ); + + return new_width != 0; +} + +static void +_cogl_texture_driver_try_setting_gl_border_color + (CoglContext *ctx, + GLuint gl_target, + const GLfloat *transparent_color) +{ + /* Use a transparent border color so that we can leave the + color buffer alone when using texture co-ordinates + outside of the texture */ + GE( ctx, glTexParameterfv (gl_target, GL_TEXTURE_BORDER_COLOR, + transparent_color) ); +} + +static CoglBool +_cogl_texture_driver_allows_foreign_gl_target (CoglContext *ctx, + GLenum gl_target) +{ + /* GL_ARB_texture_rectangle textures are supported if they are + created from foreign because some chipsets have trouble with + GL_ARB_texture_non_power_of_two. There is no Cogl call to create + them directly to emphasize the fact that they don't work fully + (for example, no mipmapping and complicated shader support) */ + + /* Allow 2-dimensional or rectangle textures only */ + if (gl_target != GL_TEXTURE_2D && gl_target != GL_TEXTURE_RECTANGLE_ARB) + return FALSE; + + return TRUE; +} + +static CoglPixelFormat +_cogl_texture_driver_find_best_gl_get_data_format + (CoglContext *context, + CoglPixelFormat format, + GLenum *closest_gl_format, + GLenum *closest_gl_type) +{ + return context->driver_vtable->pixel_format_to_gl (context, + format, + NULL, /* don't need */ + closest_gl_format, + closest_gl_type); +} + +const CoglTextureDriver +_cogl_texture_driver_gl = + { + _cogl_texture_driver_gen, + _cogl_texture_driver_prep_gl_for_pixels_upload, + _cogl_texture_driver_upload_subregion_to_gl, + _cogl_texture_driver_upload_to_gl, + _cogl_texture_driver_upload_to_gl_3d, + _cogl_texture_driver_prep_gl_for_pixels_download, + _cogl_texture_driver_gl_get_tex_image, + _cogl_texture_driver_size_supported, + _cogl_texture_driver_size_supported_3d, + _cogl_texture_driver_try_setting_gl_border_color, + _cogl_texture_driver_allows_foreign_gl_target, + _cogl_texture_driver_find_best_gl_get_data_format + }; diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c new file mode 100644 index 0000000..f144ba3 --- /dev/null +++ b/cogl/driver/gl/gles/cogl-driver-gles.c @@ -0,0 +1,476 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" +#include "cogl-util-gl-private.h" +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" +#include "cogl-private.h" +#include "cogl-framebuffer-gl-private.h" +#include "cogl-texture-2d-gl-private.h" +#include "cogl-attribute-gl-private.h" +#include "cogl-clip-stack-gl-private.h" +#include "cogl-buffer-gl-private.h" + +#ifndef GL_UNSIGNED_INT_24_8 +#define GL_UNSIGNED_INT_24_8 0x84FA +#endif +#ifndef GL_DEPTH_STENCIL +#define GL_DEPTH_STENCIL 0x84F9 +#endif +#ifndef GL_RG +#define GL_RG 0x8227 +#endif +#ifndef GL_RG8 +#define GL_RG8 0x822B +#endif + +static CoglBool +_cogl_driver_pixel_format_from_gl_internal (CoglContext *context, + GLenum gl_int_format, + CoglPixelFormat *out_format) +{ + return TRUE; +} + +static CoglPixelFormat +_cogl_driver_pixel_format_to_gl (CoglContext *context, + CoglPixelFormat format, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype) +{ + CoglPixelFormat required_format; + GLenum glintformat; + GLenum glformat = 0; + GLenum gltype; + + required_format = format; + + /* Find GL equivalents */ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + glintformat = GL_ALPHA; + glformat = GL_ALPHA; + gltype = GL_UNSIGNED_BYTE; + break; + case COGL_PIXEL_FORMAT_G_8: + glintformat = GL_LUMINANCE; + glformat = GL_LUMINANCE; + gltype = GL_UNSIGNED_BYTE; + break; + + case COGL_PIXEL_FORMAT_RG_88: + if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG)) + { + glintformat = GL_RG8; + glformat = GL_RG; + } + else + { + /* If red-green textures aren't supported then we'll use RGB + * as an internal format. Note this should only end up + * mattering for downloading the data because Cogl will + * refuse to allocate a texture with RG components if RG + * textures aren't supported */ + glintformat = GL_RGB; + glformat = GL_RGB; + required_format = COGL_PIXEL_FORMAT_RGB_888; + } + gltype = GL_UNSIGNED_BYTE; + break; + + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + /* There is an extension to support this format */ + if (_cogl_has_private_feature + (context, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888)) + { + /* For some reason the extension says you have to specify + BGRA for the internal format too */ + glintformat = GL_BGRA_EXT; + glformat = GL_BGRA_EXT; + gltype = GL_UNSIGNED_BYTE; + required_format = format; + break; + } + /* flow through */ + + /* Just one 24-bit ordering supported */ + case COGL_PIXEL_FORMAT_RGB_888: + case COGL_PIXEL_FORMAT_BGR_888: + glintformat = GL_RGB; + glformat = GL_RGB; + gltype = GL_UNSIGNED_BYTE; + required_format = COGL_PIXEL_FORMAT_RGB_888; + break; + + /* Just one 32-bit ordering supported */ + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_BYTE; + required_format = COGL_PIXEL_FORMAT_RGBA_8888; + required_format |= (format & COGL_PREMULT_BIT); + break; + + /* The following three types of channel ordering + * are always defined using system word byte + * ordering (even according to GLES spec) */ + case COGL_PIXEL_FORMAT_RGB_565: + glintformat = GL_RGB; + glformat = GL_RGB; + gltype = GL_UNSIGNED_SHORT_5_6_5; + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_SHORT_4_4_4_4; + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + glintformat = GL_RGBA; + glformat = GL_RGBA; + gltype = GL_UNSIGNED_SHORT_5_5_5_1; + break; + + case COGL_PIXEL_FORMAT_DEPTH_16: + glintformat = GL_DEPTH_COMPONENT; + glformat = GL_DEPTH_COMPONENT; + gltype = GL_UNSIGNED_SHORT; + break; + case COGL_PIXEL_FORMAT_DEPTH_32: + glintformat = GL_DEPTH_COMPONENT; + glformat = GL_DEPTH_COMPONENT; + gltype = GL_UNSIGNED_INT; + break; + + case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: + glintformat = GL_DEPTH_STENCIL; + glformat = GL_DEPTH_STENCIL; + gltype = GL_UNSIGNED_INT_24_8; + break; + + case COGL_PIXEL_FORMAT_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + break; + } + + /* All of the pixel formats are handled above so if this hits then + we've been given an invalid pixel format */ + g_assert (glformat != 0); + + if (out_glintformat != NULL) + *out_glintformat = glintformat; + if (out_glformat != NULL) + *out_glformat = glformat; + if (out_gltype != NULL) + *out_gltype = gltype; + + return required_format; +} + +static CoglBool +_cogl_get_gl_version (CoglContext *ctx, + int *major_out, + int *minor_out) +{ + const char *version_string; + + /* Get the OpenGL version number */ + if ((version_string = _cogl_context_get_gl_version (ctx)) == NULL) + return FALSE; + + if (!g_str_has_prefix (version_string, "OpenGL ES ")) + return FALSE; + + return _cogl_gl_util_parse_gl_version (version_string + 10, + major_out, + minor_out); +} + +static CoglBool +_cogl_driver_update_features (CoglContext *context, + CoglError **error) +{ + unsigned long private_features + [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)] = { 0 }; + CoglFeatureFlags flags = 0; + char **gl_extensions; + int gl_major, gl_minor; + int i; + + /* We have to special case getting the pointer to the glGetString + function because we need to use it to determine what functions we + can expect */ + context->glGetString = + (void *) _cogl_renderer_get_proc_address (context->display->renderer, + "glGetString", + TRUE); + + gl_extensions = _cogl_context_get_gl_extensions (context); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS))) + { + char *all_extensions = g_strjoinv (" ", gl_extensions); + + COGL_NOTE (WINSYS, + "Checking features\n" + " GL_VENDOR: %s\n" + " GL_RENDERER: %s\n" + " GL_VERSION: %s\n" + " GL_EXTENSIONS: %s", + context->glGetString (GL_VENDOR), + context->glGetString (GL_RENDERER), + _cogl_context_get_gl_version (context), + all_extensions); + + g_free (all_extensions); + } + + context->glsl_major = 1; + context->glsl_minor = 0; + context->glsl_version_to_use = 100; + + _cogl_gpu_info_init (context, &context->gpu); + + if (!_cogl_get_gl_version (context, &gl_major, &gl_minor)) + { + gl_major = 1; + gl_minor = 1; + } + + _cogl_feature_check_ext_functions (context, + gl_major, + gl_minor, + gl_extensions); + +#ifdef HAVE_COGL_GLES + if (context->driver == COGL_DRIVER_GLES1) + { + int max_clip_planes; + GE( context, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) ); + if (max_clip_planes >= 4) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES, TRUE); + } +#endif + + if (context->driver == COGL_DRIVER_GLES2) + { + flags |= COGL_FEATURE_SHADERS_GLSL | COGL_FEATURE_OFFSCREEN; + /* Note GLES 2 core doesn't support mipmaps for npot textures or + * repeat modes other than CLAMP_TO_EDGE. */ + flags |= COGL_FEATURE_TEXTURE_NPOT_BASIC; + flags |= COGL_FEATURE_DEPTH_RANGE; + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_GLSL, TRUE); + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_RANGE, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_MIRRORED_REPEAT, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, TRUE); + + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE); + } + else if (context->driver == COGL_DRIVER_GLES1) + { + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE); + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM, TRUE); + } + + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_VBOS, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ANY_GL, TRUE); + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE); + + /* Both GLES 1.1 and GLES 2.0 support point sprites in core */ + flags |= COGL_FEATURE_POINT_SPRITE; + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_POINT_SPRITE, TRUE); + + if (context->glGenRenderbuffers) + { + flags |= COGL_FEATURE_OFFSCREEN; + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); + } + + if (context->glBlitFramebuffer) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE); + + if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions)) + { + flags |= COGL_FEATURE_UNSIGNED_INT_INDICES; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_UNSIGNED_INT_INDICES, TRUE); + } + + if (_cogl_check_extension ("GL_OES_depth_texture", gl_extensions)) + { + flags |= COGL_FEATURE_DEPTH_TEXTURE; + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_TEXTURE, TRUE); + } + + if (_cogl_check_extension ("GL_OES_texture_npot", gl_extensions)) + { + flags |= (COGL_FEATURE_TEXTURE_NPOT | + COGL_FEATURE_TEXTURE_NPOT_BASIC | + COGL_FEATURE_TEXTURE_NPOT_MIPMAP | + COGL_FEATURE_TEXTURE_NPOT_REPEAT); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, TRUE); + } + else if (_cogl_check_extension ("GL_IMG_texture_npot", gl_extensions)) + { + flags |= (COGL_FEATURE_TEXTURE_NPOT_BASIC | + COGL_FEATURE_TEXTURE_NPOT_MIPMAP); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE); + } + + if (context->glTexImage3D) + { + flags |= COGL_FEATURE_TEXTURE_3D; + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TEXTURE_3D, TRUE); + } + + if (context->glMapBuffer) + { + /* The GL_OES_mapbuffer extension doesn't support mapping for + read */ + flags |= COGL_FEATURE_MAP_BUFFER_FOR_WRITE; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); + } + + if (context->glEGLImageTargetTexture2D) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, TRUE); + + if (_cogl_check_extension ("GL_OES_packed_depth_stencil", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, TRUE); + + if (_cogl_check_extension ("GL_EXT_texture_format_BGRA8888", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, TRUE); + + if (_cogl_check_extension ("GL_EXT_unpack_subimage", gl_extensions)) + COGL_FLAGS_SET (private_features, + COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE); + + /* A nameless vendor implemented the extension, but got the case wrong + * per the spec. */ + if (_cogl_check_extension ("GL_OES_EGL_sync", gl_extensions) || + _cogl_check_extension ("GL_OES_egl_sync", gl_extensions)) + COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_OES_EGL_SYNC, TRUE); + + if (_cogl_check_extension ("GL_EXT_texture_rg", gl_extensions)) + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_TEXTURE_RG, + TRUE); + + /* Cache features */ + for (i = 0; i < G_N_ELEMENTS (private_features); i++) + context->private_features[i] |= private_features[i]; + context->feature_flags |= flags; + + g_strfreev (gl_extensions); + + return TRUE; +} + +const CoglDriverVtable +_cogl_driver_gles = + { + _cogl_driver_pixel_format_from_gl_internal, + _cogl_driver_pixel_format_to_gl, + _cogl_driver_update_features, + _cogl_offscreen_gl_allocate, + _cogl_offscreen_gl_free, + _cogl_framebuffer_gl_flush_state, + _cogl_framebuffer_gl_clear, + _cogl_framebuffer_gl_query_bits, + _cogl_framebuffer_gl_finish, + _cogl_framebuffer_gl_discard_buffers, + _cogl_framebuffer_gl_draw_attributes, + _cogl_framebuffer_gl_draw_indexed_attributes, + _cogl_framebuffer_gl_read_pixels_into_bitmap, + _cogl_texture_2d_gl_free, + _cogl_texture_2d_gl_can_create, + _cogl_texture_2d_gl_init, + _cogl_texture_2d_gl_allocate, + _cogl_texture_2d_gl_copy_from_framebuffer, + _cogl_texture_2d_gl_get_gl_handle, + _cogl_texture_2d_gl_generate_mipmap, + _cogl_texture_2d_gl_copy_from_bitmap, + NULL, /* texture_2d_get_data */ + _cogl_gl_flush_attributes_state, + _cogl_clip_stack_gl_flush, + _cogl_buffer_gl_create, + _cogl_buffer_gl_destroy, + _cogl_buffer_gl_map_range, + _cogl_buffer_gl_unmap, + _cogl_buffer_gl_set_data, + }; diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c new file mode 100644 index 0000000..f87f1e9 --- /dev/null +++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c @@ -0,0 +1,652 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-util.h" +#include "cogl-bitmap.h" +#include "cogl-bitmap-private.h" +#include "cogl-texture-private.h" +#include "cogl-pipeline.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-context-private.h" +#include "cogl-object-private.h" +#include "cogl-primitives.h" +#include "cogl-util-gl-private.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" + +#include +#include +#include + +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif +#ifndef GL_MAX_3D_TEXTURE_SIZE_OES +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#endif + +/* This extension isn't available for GLES 1.1 so these won't be + defined */ +#ifndef GL_UNPACK_ROW_LENGTH +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#endif +#ifndef GL_UNPACK_SKIP_ROWS +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#endif +#ifndef GL_UNPACK_SKIP_PIXELS +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#endif + +static GLuint +_cogl_texture_driver_gen (CoglContext *ctx, + GLenum gl_target, + CoglPixelFormat internal_format) +{ + GLuint tex; + + GE (ctx, glGenTextures (1, &tex)); + + _cogl_bind_gl_texture_transient (gl_target, tex, FALSE); + + switch (gl_target) + { + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + /* GL_TEXTURE_MAG_FILTER defaults to GL_LINEAR, no need to set it */ + GE( ctx, glTexParameteri (gl_target, + GL_TEXTURE_MIN_FILTER, + GL_LINEAR) ); + break; + + default: + g_assert_not_reached(); + } + + return tex; +} + +static void +prep_gl_for_pixels_upload_full (CoglContext *ctx, + int pixels_rowstride, + int pixels_src_x, + int pixels_src_y, + int pixels_bpp) +{ + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE)) + { + GE( ctx, glPixelStorei (GL_UNPACK_ROW_LENGTH, + pixels_rowstride / pixels_bpp) ); + + GE( ctx, glPixelStorei (GL_UNPACK_SKIP_PIXELS, pixels_src_x) ); + GE( ctx, glPixelStorei (GL_UNPACK_SKIP_ROWS, pixels_src_y) ); + } + else + { + g_assert (pixels_src_x == 0); + g_assert (pixels_src_y == 0); + } + + _cogl_texture_gl_prep_alignment_for_pixels_upload (ctx, pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_upload (CoglContext *ctx, + int pixels_rowstride, + int pixels_bpp) +{ + prep_gl_for_pixels_upload_full (ctx, + pixels_rowstride, + 0, 0, /* src_x/y */ + pixels_bpp); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_download (CoglContext *ctx, + int pixels_rowstride, + int image_width, + int pixels_bpp) +{ + _cogl_texture_gl_prep_alignment_for_pixels_download (ctx, + pixels_bpp, + image_width, + pixels_rowstride); +} + +static CoglBitmap * +prepare_bitmap_alignment_for_upload (CoglContext *ctx, + CoglBitmap *src_bmp, + CoglError **error) +{ + CoglPixelFormat format = cogl_bitmap_get_format (src_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + int src_rowstride = cogl_bitmap_get_rowstride (src_bmp); + int width = cogl_bitmap_get_width (src_bmp); + int alignment = 1; + + if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE) || + src_rowstride == 0) + return cogl_object_ref (src_bmp); + + /* Work out the alignment of the source rowstride */ + alignment = 1 << (_cogl_util_ffs (src_rowstride) - 1); + alignment = MIN (alignment, 8); + + /* If the aligned data equals the rowstride then we can upload from + the bitmap directly using GL_UNPACK_ALIGNMENT */ + if (((width * bpp + alignment - 1) & ~(alignment - 1)) == src_rowstride) + return cogl_object_ref (src_bmp); + /* Otherwise we need to copy the bitmap to pack the alignment + because GLES has no GL_ROW_LENGTH */ + else + return _cogl_bitmap_copy (src_bmp, error); +} + +static CoglBool +_cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, + CoglTexture *texture, + CoglBool is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + int level, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + GLenum gl_target; + GLuint gl_handle; + uint8_t *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + CoglBitmap *slice_bmp; + int rowstride; + GLenum gl_error; + CoglBool status = TRUE; + CoglError *internal_error = NULL; + int level_width; + int level_height; + + cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target); + + /* If we have the GL_EXT_unpack_subimage extension then we can + upload from subregions directly. Otherwise we may need to copy + the bitmap */ + if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE) && + (src_x != 0 || src_y != 0 || + width != cogl_bitmap_get_width (source_bmp) || + height != cogl_bitmap_get_height (source_bmp))) + { + slice_bmp = + _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + source_format, + error); + if (!slice_bmp) + return FALSE; + + if (!_cogl_bitmap_copy_subregion (source_bmp, + slice_bmp, + src_x, src_y, + 0, 0, /* dst_x/y */ + width, height, + error)) + { + cogl_object_unref (slice_bmp); + return FALSE; + } + + src_x = src_y = 0; + } + else + { + slice_bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error); + if (!slice_bmp) + return FALSE; + } + + rowstride = cogl_bitmap_get_rowstride (slice_bmp); + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (ctx, rowstride, src_x, src_y, bpp); + + data = _cogl_bitmap_gl_bind (slice_bmp, COGL_BUFFER_ACCESS_READ, 0, &internal_error); + + /* NB: _cogl_bitmap_gl_bind() may return NULL when successfull so we + * have to explicitly check the cogl error pointer to catch + * problems... */ + if (internal_error) + { + _cogl_propagate_error (error, internal_error); + cogl_object_unref (slice_bmp); + return FALSE; + } + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_texture_get_level_size (texture, + level, + &level_width, + &level_height, + NULL); + + if (level_width == width && level_height == height) + { + /* GL gets upset if you use glTexSubImage2D to define the + * contents of a mipmap level so we make sure to use + * glTexImage2D if we are uploading a full mipmap level. + */ + ctx->glTexImage2D (gl_target, + level, + _cogl_texture_gl_get_format (texture), + width, + height, + 0, + source_gl_format, + source_gl_type, + data); + } + else + { + /* GL gets upset if you use glTexSubImage2D to initialize the + * contents of a mipmap level so if this is the first time + * we've seen a request to upload to this level we call + * glTexImage2D first to assert that the storage for this + * level exists. + */ + if (texture->max_level < level) + { + ctx->glTexImage2D (gl_target, + level, + _cogl_texture_gl_get_format (texture), + level_width, + level_height, + 0, + source_gl_format, + source_gl_type, + NULL); + } + + ctx->glTexSubImage2D (gl_target, + level, + dst_x, dst_y, + width, height, + source_gl_format, + source_gl_type, + data); + } + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_bitmap_gl_unbind (slice_bmp); + + cogl_object_unref (slice_bmp); + + return status; +} + +static CoglBool +_cogl_texture_driver_upload_to_gl (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + int rowstride; + int bmp_width = cogl_bitmap_get_width (source_bmp); + int bmp_height = cogl_bitmap_get_height (source_bmp); + CoglBitmap *bmp; + uint8_t *data; + GLenum gl_error; + CoglError *internal_error = NULL; + CoglBool status = TRUE; + + bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error); + if (!bmp) + return FALSE; + + rowstride = cogl_bitmap_get_rowstride (bmp); + + /* Setup gl alignment to match rowstride and top-left corner */ + _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + data = _cogl_bitmap_gl_bind (bmp, + COGL_BUFFER_ACCESS_READ, + 0, /* hints */ + &internal_error); + + /* NB: _cogl_bitmap_gl_bind() may return NULL when successful so we + * have to explicitly check the cogl error pointer to catch + * problems... */ + if (internal_error) + { + cogl_object_unref (bmp); + _cogl_propagate_error (error, internal_error); + return FALSE; + } + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage2D (gl_target, 0, + internal_gl_format, + bmp_width, bmp_height, + 0, + source_gl_format, + source_gl_type, + data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + status = FALSE; + + _cogl_bitmap_gl_unbind (bmp); + + cogl_object_unref (bmp); + + return status; +} + +static CoglBool +_cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, + GLenum gl_target, + GLuint gl_handle, + CoglBool is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type, + CoglError **error) +{ + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + int rowstride = cogl_bitmap_get_rowstride (source_bmp); + int bmp_width = cogl_bitmap_get_width (source_bmp); + int bmp_height = cogl_bitmap_get_height (source_bmp); + uint8_t *data; + GLenum gl_error; + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + /* If the rowstride or image height can't be specified with just + GL_ALIGNMENT alone then we need to copy the bitmap because there + is no GL_ROW_LENGTH */ + if (rowstride / bpp != bmp_width || + height != bmp_height / depth) + { + CoglBitmap *bmp; + int image_height = bmp_height / depth; + CoglPixelFormat source_bmp_format = cogl_bitmap_get_format (source_bmp); + int i; + + _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, bmp_width * bpp, bpp); + + /* Initialize the texture with empty data and then upload each + image with a sub-region update */ + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage3D (gl_target, + 0, /* level */ + internal_gl_format, + bmp_width, + height, + depth, + 0, + source_gl_format, + source_gl_type, + NULL); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + return FALSE; + + bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + bmp_width, + height, + source_bmp_format, + error); + if (!bmp) + return FALSE; + + for (i = 0; i < depth; i++) + { + if (!_cogl_bitmap_copy_subregion (source_bmp, + bmp, + 0, image_height * i, + 0, 0, + bmp_width, + height, + error)) + { + cogl_object_unref (bmp); + return FALSE; + } + + data = _cogl_bitmap_gl_bind (bmp, + COGL_BUFFER_ACCESS_READ, 0, error); + if (!data) + { + cogl_object_unref (bmp); + return FALSE; + } + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexSubImage3D (gl_target, + 0, /* level */ + 0, /* xoffset */ + 0, /* yoffset */ + i, /* zoffset */ + bmp_width, /* width */ + height, /* height */ + 1, /* depth */ + source_gl_format, + source_gl_type, + data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + cogl_object_unref (bmp); + _cogl_bitmap_gl_unbind (bmp); + return FALSE; + } + + _cogl_bitmap_gl_unbind (bmp); + } + + cogl_object_unref (bmp); + } + else + { + data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error); + if (!data) + return FALSE; + + _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp); + + /* Clear any GL errors */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + ctx->glTexImage3D (gl_target, + 0, /* level */ + internal_gl_format, + bmp_width, + height, + depth, + 0, + source_gl_format, + source_gl_type, + data); + + if (_cogl_gl_util_catch_out_of_memory (ctx, error)) + { + _cogl_bitmap_gl_unbind (source_bmp); + return FALSE; + } + + _cogl_bitmap_gl_unbind (source_bmp); + } + + return TRUE; +} + +/* NB: GLES doesn't support glGetTexImage2D, so cogl-texture will instead + * fallback to a generic render + readpixels approach to downloading + * texture data. (See _cogl_texture_draw_and_read() ) */ +static CoglBool +_cogl_texture_driver_gl_get_tex_image (CoglContext *ctx, + GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + uint8_t *dest) +{ + return FALSE; +} + +static CoglBool +_cogl_texture_driver_size_supported_3d (CoglContext *ctx, + GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height, + int depth) +{ + GLint max_size; + + /* GLES doesn't support a proxy texture target so let's at least + check whether the size is greater than + GL_MAX_3D_TEXTURE_SIZE_OES */ + GE( ctx, glGetIntegerv (GL_MAX_3D_TEXTURE_SIZE_OES, &max_size) ); + + return width <= max_size && height <= max_size && depth <= max_size; +} + +static CoglBool +_cogl_texture_driver_size_supported (CoglContext *ctx, + GLenum gl_target, + GLenum gl_intformat, + GLenum gl_format, + GLenum gl_type, + int width, + int height) +{ + GLint max_size; + + /* GLES doesn't support a proxy texture target so let's at least + check whether the size is greater than GL_MAX_TEXTURE_SIZE */ + GE( ctx, glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size) ); + + return width <= max_size && height <= max_size; +} + +static void +_cogl_texture_driver_try_setting_gl_border_color + (CoglContext *ctx, + GLuint gl_target, + const GLfloat *transparent_color) +{ + /* FAIL! */ +} + +static CoglBool +_cogl_texture_driver_allows_foreign_gl_target (CoglContext *ctx, + GLenum gl_target) +{ + /* Allow 2-dimensional textures only */ + if (gl_target != GL_TEXTURE_2D) + return FALSE; + return TRUE; +} + +static CoglPixelFormat +_cogl_texture_driver_find_best_gl_get_data_format + (CoglContext *context, + CoglPixelFormat format, + GLenum *closest_gl_format, + GLenum *closest_gl_type) +{ + /* Find closest format that's supported by GL + (Can't use _cogl_pixel_format_to_gl since available formats + when reading pixels on GLES are severely limited) */ + *closest_gl_format = GL_RGBA; + *closest_gl_type = GL_UNSIGNED_BYTE; + return COGL_PIXEL_FORMAT_RGBA_8888; +} + +const CoglTextureDriver +_cogl_texture_driver_gles = + { + _cogl_texture_driver_gen, + _cogl_texture_driver_prep_gl_for_pixels_upload, + _cogl_texture_driver_upload_subregion_to_gl, + _cogl_texture_driver_upload_to_gl, + _cogl_texture_driver_upload_to_gl_3d, + _cogl_texture_driver_prep_gl_for_pixels_download, + _cogl_texture_driver_gl_get_tex_image, + _cogl_texture_driver_size_supported, + _cogl_texture_driver_size_supported_3d, + _cogl_texture_driver_try_setting_gl_border_color, + _cogl_texture_driver_allows_foreign_gl_target, + _cogl_texture_driver_find_best_gl_get_data_format + }; diff --git a/cogl/driver/nop/cogl-attribute-nop-private.h b/cogl/driver/nop/cogl-attribute-nop-private.h new file mode 100644 index 0000000..9c8547d --- /dev/null +++ b/cogl/driver/nop/cogl-attribute-nop-private.h @@ -0,0 +1,48 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_ATTRIBUTE_NOP_PRIVATE_H_ +#define _COGL_ATTRIBUTE_NOP_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context-private.h" + +void +_cogl_nop_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglFlushLayerState *layers_state, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes); + +#endif /* _COGL_ATTRIBUTE_NOP_PRIVATE_H_ */ diff --git a/cogl/driver/nop/cogl-attribute-nop.c b/cogl/driver/nop/cogl-attribute-nop.c new file mode 100644 index 0000000..5441d5b --- /dev/null +++ b/cogl/driver/nop/cogl-attribute-nop.c @@ -0,0 +1,49 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-types.h" +#include "cogl-framebuffer.h" +#include "cogl-attribute.h" +#include "cogl-attribute-private.h" +#include "cogl-attribute-nop-private.h" + +void +_cogl_nop_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglFlushLayerState *layers_state, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes) +{ +} diff --git a/cogl/driver/nop/cogl-clip-stack-nop-private.h b/cogl/driver/nop/cogl-clip-stack-nop-private.h new file mode 100644 index 0000000..4d8513b --- /dev/null +++ b/cogl/driver/nop/cogl-clip-stack-nop-private.h @@ -0,0 +1,44 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_CLIP_STACK_NOP_PRIVATE_H_ +#define _COGL_CLIP_STACK_NOP_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context-private.h" + +void +_cogl_clip_stack_nop_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer); + +#endif /* _COGL_CLIP_STACK_NOP_PRIVATE_H_ */ diff --git a/cogl/driver/nop/cogl-clip-stack-nop.c b/cogl/driver/nop/cogl-clip-stack-nop.c new file mode 100644 index 0000000..314e7e7 --- /dev/null +++ b/cogl/driver/nop/cogl-clip-stack-nop.c @@ -0,0 +1,43 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-clip-stack.h" +#include "cogl-clip-stack-nop-private.h" +#include "cogl-framebuffer-private.h" + +void +_cogl_clip_stack_nop_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer) +{ +} diff --git a/cogl/driver/nop/cogl-driver-nop.c b/cogl/driver/nop/cogl-driver-nop.c new file mode 100644 index 0000000..53f5975 --- /dev/null +++ b/cogl/driver/nop/cogl-driver-nop.c @@ -0,0 +1,86 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-context-private.h" +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" +#include "cogl-error-private.h" +#include "cogl-framebuffer-nop-private.h" +#include "cogl-texture-2d-nop-private.h" +#include "cogl-attribute-nop-private.h" +#include "cogl-clip-stack-nop-private.h" + +static CoglBool +_cogl_driver_update_features (CoglContext *ctx, + CoglError **error) +{ + /* _cogl_gpu_info_init (ctx, &ctx->gpu); */ + + memset (ctx->private_features, 0, sizeof (ctx->private_features)); + ctx->feature_flags = 0; + + return TRUE; +} + +const CoglDriverVtable +_cogl_driver_nop = + { + NULL, /* pixel_format_from_gl_internal */ + NULL, /* pixel_format_to_gl */ + _cogl_driver_update_features, + _cogl_offscreen_nop_allocate, + _cogl_offscreen_nop_free, + _cogl_framebuffer_nop_flush_state, + _cogl_framebuffer_nop_clear, + _cogl_framebuffer_nop_query_bits, + _cogl_framebuffer_nop_finish, + _cogl_framebuffer_nop_discard_buffers, + _cogl_framebuffer_nop_draw_attributes, + _cogl_framebuffer_nop_draw_indexed_attributes, + _cogl_framebuffer_nop_read_pixels_into_bitmap, + _cogl_texture_2d_nop_free, + _cogl_texture_2d_nop_can_create, + _cogl_texture_2d_nop_init, + _cogl_texture_2d_nop_allocate, + _cogl_texture_2d_nop_copy_from_framebuffer, + _cogl_texture_2d_nop_get_gl_handle, + _cogl_texture_2d_nop_generate_mipmap, + _cogl_texture_2d_nop_copy_from_bitmap, + NULL, /* texture_2d_get_data */ + _cogl_nop_flush_attributes_state, + _cogl_clip_stack_nop_flush, + }; diff --git a/cogl/driver/nop/cogl-framebuffer-nop-private.h b/cogl/driver/nop/cogl-framebuffer-nop-private.h new file mode 100644 index 0000000..1e9630f --- /dev/null +++ b/cogl/driver/nop/cogl-framebuffer-nop-private.h @@ -0,0 +1,100 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ +#define _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context-private.h" + +CoglBool +_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen, + CoglError **error); + +void +_cogl_offscreen_nop_free (CoglOffscreen *offscreen); + +void +_cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state); + +void +_cogl_framebuffer_nop_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha); + +void +_cogl_framebuffer_nop_query_bits (CoglFramebuffer *framebuffer, + CoglFramebufferBits *bits); + +void +_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer); + +void +_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers); + +void +_cogl_framebuffer_nop_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +void +_cogl_framebuffer_nop_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags); + +CoglBool +_cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error); + +#endif /* _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ */ diff --git a/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/driver/nop/cogl-framebuffer-nop.c new file mode 100644 index 0000000..8190784 --- /dev/null +++ b/cogl/driver/nop/cogl-framebuffer-nop.c @@ -0,0 +1,121 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-framebuffer-nop-private.h" + +#include +#include + +void +_cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer, + CoglFramebuffer *read_buffer, + CoglFramebufferState state) +{ +} + +CoglBool +_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen, + CoglError **error) +{ + return TRUE; +} + +void +_cogl_offscreen_nop_free (CoglOffscreen *offscreen) +{ +} + +void +_cogl_framebuffer_nop_clear (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha) +{ +} + +void +_cogl_framebuffer_nop_query_bits (CoglFramebuffer *framebuffer, + CoglFramebufferBits *bits) +{ + memset (bits, 0, sizeof (CoglFramebufferBits)); +} + +void +_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer) +{ +} + +void +_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers) +{ +} + +void +_cogl_framebuffer_nop_draw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ +} + +void +_cogl_framebuffer_nop_draw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + CoglAttribute **attributes, + int n_attributes, + CoglDrawFlags flags) +{ +} + +CoglBool +_cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap, + CoglError **error) +{ + return TRUE; +} diff --git a/cogl/driver/nop/cogl-texture-2d-nop-private.h b/cogl/driver/nop/cogl-texture-2d-nop-private.h new file mode 100644 index 0000000..51de1e3 --- /dev/null +++ b/cogl/driver/nop/cogl-texture-2d-nop-private.h @@ -0,0 +1,103 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef _COGL_TEXTURE_2D_NOP_PRIVATE_H_ +#define _COGL_TEXTURE_2D_NOP_PRIVATE_H_ + +#include "cogl-types.h" +#include "cogl-context-private.h" +#include "cogl-texture.h" + +void +_cogl_texture_2d_nop_free (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_nop_can_create (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format); + +void +_cogl_texture_2d_nop_init (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_nop_allocate (CoglTexture *tex, + CoglError **error); + +void +_cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter); + +void +_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p); + +void +_cogl_texture_2d_nop_copy_from_framebuffer (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level); + +unsigned int +_cogl_texture_2d_nop_get_gl_handle (CoglTexture2D *tex_2d); + +void +_cogl_texture_2d_nop_generate_mipmap (CoglTexture2D *tex_2d); + +CoglBool +_cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bitmap, + int dst_x, + int dst_y, + int level, + CoglError **error); + +void +_cogl_texture_2d_nop_get_data (CoglTexture2D *tex_2d, + CoglPixelFormat format, + size_t rowstride, + uint8_t *data); + +#endif /* _COGL_TEXTURE_2D_NOP_PRIVATE_H_ */ diff --git a/cogl/driver/nop/cogl-texture-2d-nop.c b/cogl/driver/nop/cogl-texture-2d-nop.c new file mode 100644 index 0000000..b521498 --- /dev/null +++ b/cogl/driver/nop/cogl-texture-2d-nop.c @@ -0,0 +1,132 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009,2010,2011,2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-texture-2d-nop-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-error-private.h" + +void +_cogl_texture_2d_nop_free (CoglTexture2D *tex_2d) +{ +} + +CoglBool +_cogl_texture_2d_nop_can_create (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format) +{ + return TRUE; +} + +void +_cogl_texture_2d_nop_init (CoglTexture2D *tex_2d) +{ +} + +CoglBool +_cogl_texture_2d_nop_allocate (CoglTexture *tex, + CoglError **error) +{ + return TRUE; +} + +void +_cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ +} + +void +_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ +} + +void +_cogl_texture_2d_nop_copy_from_framebuffer (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglFramebuffer *src_fb, + int dst_x, + int dst_y, + int level) +{ +} + +unsigned int +_cogl_texture_2d_nop_get_gl_handle (CoglTexture2D *tex_2d) +{ + return 0; +} + +void +_cogl_texture_2d_nop_generate_mipmap (CoglTexture2D *tex_2d) +{ +} + +CoglBool +_cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d, + int src_x, + int src_y, + int width, + int height, + CoglBitmap *bitmap, + int dst_x, + int dst_y, + int level, + CoglError **error) +{ + return TRUE; +} + +void +_cogl_texture_2d_nop_get_data (CoglTexture2D *tex_2d, + CoglPixelFormat format, + size_t rowstride, + uint8_t *data) +{ +} diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h new file mode 100644 index 0000000..dda08f7 --- /dev/null +++ b/cogl/gl-prototypes/cogl-all-functions.h @@ -0,0 +1,328 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 only but may also be + * extensions available for GLES2 and GL */ +#include "cogl-in-gles1-core-functions.h" + +/* The functions in this file are core to GLES2 only but + * may be extensions for GLES1 and GL */ +#include "cogl-in-gles2-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* These are fixed-function APIs core to GL and GLES1 */ +#include "cogl-fixed-functions.h" + +/* These are GLSL shader APIs core to GL 2.0 and GLES2 */ +#include "cogl-glsl-functions.h" + +/* These are the core GL functions which are only available in big + GL */ +COGL_EXT_BEGIN (only_in_big_gl, + 0, 0, + 0, /* not in GLES */ + "\0", + "\0") +COGL_EXT_FUNCTION (void, glGetTexLevelParameteriv, + (GLenum target, GLint level, + GLenum pname, GLint *params)) +COGL_EXT_FUNCTION (void, glGetTexImage, + (GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels)) +COGL_EXT_FUNCTION (void, glClipPlane, + (GLenum plane, const double *equation)) +COGL_EXT_FUNCTION (void, glDepthRange, + (double near_val, double far_val)) +COGL_EXT_FUNCTION (void, glDrawBuffer, + (GLenum mode)) +COGL_EXT_END () + + +/* GLES doesn't support mapping buffers in core so this has to be a + separate check */ +COGL_EXT_BEGIN (map_vbos, 1, 5, + 0, /* not in GLES core */ + "ARB\0OES\0", + "vertex_buffer_object\0mapbuffer\0") +COGL_EXT_FUNCTION (void *, glMapBuffer, + (GLenum target, + GLenum access)) +COGL_EXT_FUNCTION (GLboolean, glUnmapBuffer, + (GLenum target)) +COGL_EXT_END () + +COGL_EXT_BEGIN (texture_3d, 1, 2, + 0, /* not in either GLES */ + "OES\0", + "texture_3D\0") +COGL_EXT_FUNCTION (void, glTexImage3D, + (GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels)) +COGL_EXT_FUNCTION (void, glTexSubImage3D, + (GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels)) +COGL_EXT_END () + + + +COGL_EXT_BEGIN (offscreen_blit, 3, 0, + 0, /* not in either GLES */ + "EXT\0ANGLE\0", + "framebuffer_blit\0") +COGL_EXT_FUNCTION (void, glBlitFramebuffer, + (GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter)) +COGL_EXT_END () + +/* ARB_fragment_program */ +COGL_EXT_BEGIN (arbfp, 255, 255, + 0, /* not in either GLES */ + "ARB\0", + "fragment_program\0") +COGL_EXT_FUNCTION (void, glGenPrograms, + (GLsizei n, + GLuint *programs)) +COGL_EXT_FUNCTION (void, glDeletePrograms, + (GLsizei n, + GLuint *programs)) +COGL_EXT_FUNCTION (void, glBindProgram, + (GLenum target, + GLuint program)) +COGL_EXT_FUNCTION (void, glProgramString, + (GLenum target, + GLenum format, + GLsizei len, + const void *program)) +COGL_EXT_FUNCTION (void, glProgramLocalParameter4fv, + (GLenum target, + GLuint index, + GLfloat *params)) +COGL_EXT_END () + +COGL_EXT_BEGIN (EGL_image, 255, 255, + 0, /* not in either GLES */ + "OES\0", + "EGL_image\0") +COGL_EXT_FUNCTION (void, glEGLImageTargetTexture2D, + (GLenum target, + GLeglImageOES image)) +COGL_EXT_FUNCTION (void, glEGLImageTargetRenderbufferStorage, + (GLenum target, + GLeglImageOES image)) +COGL_EXT_END () + +COGL_EXT_BEGIN (framebuffer_discard, 255, 255, + 0, /* not in either GLES */ + "EXT\0", + "framebuffer_discard\0") +COGL_EXT_FUNCTION (void, glDiscardFramebuffer, + (GLenum target, + GLsizei numAttachments, + const GLenum *attachments)) +COGL_EXT_END () + +COGL_EXT_BEGIN (IMG_multisampled_render_to_texture, 255, 255, + 0, /* not in either GLES */ + "\0", + "IMG_multisampled_render_to_texture\0") +COGL_EXT_FUNCTION (void, glRenderbufferStorageMultisampleIMG, + (GLenum target, + GLsizei samples, + GLenum internal_format, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG, + (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples)) +COGL_EXT_END () + +COGL_EXT_BEGIN (ARB_sampler_objects, 3, 3, + 0, /* not in either GLES */ + "ARB:\0", + "sampler_objects\0") +COGL_EXT_FUNCTION (void, glGenSamplers, + (GLsizei count, + GLuint *samplers)) +COGL_EXT_FUNCTION (void, glDeleteSamplers, + (GLsizei count, + const GLuint *samplers)) +COGL_EXT_FUNCTION (void, glBindSampler, + (GLuint unit, + GLuint sampler)) +COGL_EXT_FUNCTION (void, glSamplerParameteri, + (GLuint sampler, + GLenum pname, + GLint param)) +COGL_EXT_END () + +/* These only list functions that come from the old GLSL extensions. + * Functions that are common to the extensions and GLSL 2.0 should + * instead be listed in cogl-glsl-functions.h */ +COGL_EXT_BEGIN (shader_objects, 255, 255, + 0, /* not in either GLES */ + "ARB\0", + "shader_objects\0") +COGL_EXT_FUNCTION (GLuint, glCreateProgramObject, + (void)) +COGL_EXT_FUNCTION (GLuint, glCreateShaderObject, + (GLenum shaderType)) +COGL_EXT_FUNCTION (void, glDeleteObject, + (GLuint obj)) +COGL_EXT_FUNCTION (void, glAttachObject, + (GLuint container, GLuint obj)) +COGL_EXT_FUNCTION (void, glUseProgramObject, + (GLuint programObj)) +COGL_EXT_FUNCTION (void, glGetInfoLog, + (GLuint obj, + GLsizei maxLength, + GLsizei *length, + char *infoLog)) +COGL_EXT_FUNCTION (void, glGetObjectParameteriv, + (GLuint obj, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (void, glDetachObject, + (GLuint container, GLuint obj)) +COGL_EXT_FUNCTION (void, glGetAttachedObjects, + (GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders)) +COGL_EXT_END () + +COGL_EXT_BEGIN (only_gl3, 3, 0, + 0, /* not in either GLES */ + "\0", + "\0") +COGL_EXT_FUNCTION (const GLubyte *, glGetStringi, + (GLenum name, GLuint index)) +COGL_EXT_END () + +COGL_EXT_BEGIN (vertex_array_object, 3, 0, + 0, /* not in either GLES */ + "ARB\0OES\0", + "vertex_array_object\0") +COGL_EXT_FUNCTION (void, glBindVertexArray, + (GLuint array)) +COGL_EXT_FUNCTION (void, glDeleteVertexArrays, + (GLsizei n, + const GLuint *arrays)) +COGL_EXT_FUNCTION (void, glGenVertexArrays, + (GLsizei n, + GLuint *arrays)) +COGL_EXT_END () + +COGL_EXT_BEGIN (map_region, 3, 0, + 0, /* not in either GLES */ + "ARB:\0", + "map_buffer_range\0") +COGL_EXT_FUNCTION (GLvoid *, glMapBufferRange, + (GLenum target, + GLintptr offset, + GLsizeiptr length, + GLbitfield access)) +COGL_EXT_END () + +#ifdef GL_ARB_sync +COGL_EXT_BEGIN (sync, 3, 2, + 0, /* not in either GLES */ + "ARB:\0", + "sync\0") +COGL_EXT_FUNCTION (GLsync, glFenceSync, + (GLenum condition, GLbitfield flags)) +COGL_EXT_FUNCTION (GLenum, glClientWaitSync, + (GLsync sync, GLbitfield flags, GLuint64 timeout)) +COGL_EXT_FUNCTION (void, glDeleteSync, + (GLsync sync)) +COGL_EXT_END () +#endif + +COGL_EXT_BEGIN (draw_buffers, 2, 0, + COGL_EXT_IN_GLES3, + "ARB\0EXT\0", + "draw_buffers\0") +COGL_EXT_FUNCTION (void, glDrawBuffers, + (GLsizei n, const GLenum *bufs)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-core-functions.h b/cogl/gl-prototypes/cogl-core-functions.h new file mode 100644 index 0000000..f37041b --- /dev/null +++ b/cogl/gl-prototypes/cogl-core-functions.h @@ -0,0 +1,198 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These are the core GL functions which we assume will always be + available */ +COGL_EXT_BEGIN (core, + 0, 0, + COGL_EXT_IN_GLES | COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glBindTexture, + (GLenum target, GLuint texture)) +COGL_EXT_FUNCTION (void, glBlendFunc, + (GLenum sfactor, GLenum dfactor)) +COGL_EXT_FUNCTION (void, glClear, + (GLbitfield mask)) +COGL_EXT_FUNCTION (void, glClearColor, + (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha)) +COGL_EXT_FUNCTION (void, glClearStencil, + (GLint s)) +COGL_EXT_FUNCTION (void, glColorMask, + (GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha)) +COGL_EXT_FUNCTION (void, glCopyTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glDeleteTextures, + (GLsizei n, const GLuint* textures)) +COGL_EXT_FUNCTION (void, glDepthFunc, + (GLenum func)) +COGL_EXT_FUNCTION (void, glDepthMask, + (GLboolean flag)) +COGL_EXT_FUNCTION (void, glDisable, + (GLenum cap)) +COGL_EXT_FUNCTION (void, glDrawArrays, + (GLenum mode, GLint first, GLsizei count)) +COGL_EXT_FUNCTION (void, glDrawElements, + (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid* indices)) +COGL_EXT_FUNCTION (void, glEnable, + (GLenum cap)) +COGL_EXT_FUNCTION (void, glFinish, + (void)) +COGL_EXT_FUNCTION (void, glFlush, + (void)) +COGL_EXT_FUNCTION (void, glFrontFace, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glCullFace, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glGenTextures, + (GLsizei n, GLuint* textures)) +COGL_EXT_FUNCTION (GLenum, glGetError, + (void)) +COGL_EXT_FUNCTION (void, glGetIntegerv, + (GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glGetBooleanv, + (GLenum pname, GLboolean* params)) +COGL_EXT_FUNCTION (void, glGetFloatv, + (GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (const GLubyte*, glGetString, + (GLenum name)) +COGL_EXT_FUNCTION (void, glHint, + (GLenum target, GLenum mode)) +COGL_EXT_FUNCTION (GLboolean, glIsTexture, + (GLuint texture)) +COGL_EXT_FUNCTION (void, glPixelStorei, + (GLenum pname, GLint param)) +COGL_EXT_FUNCTION (void, glReadPixels, + (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glScissor, + (GLint x, GLint y, GLsizei width, GLsizei height)) +COGL_EXT_FUNCTION (void, glStencilFunc, + (GLenum func, GLint ref, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilMask, + (GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilOp, + (GLenum fail, GLenum zfail, GLenum zpass)) +COGL_EXT_FUNCTION (void, glTexImage2D, + (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glTexParameterf, + (GLenum target, GLenum pname, GLfloat param)) +COGL_EXT_FUNCTION (void, glTexParameterfv, + (GLenum target, GLenum pname, const GLfloat* params)) +COGL_EXT_FUNCTION (void, glTexParameteri, + (GLenum target, GLenum pname, GLint param)) +COGL_EXT_FUNCTION (void, glTexParameteriv, + (GLenum target, GLenum pname, const GLint* params)) +COGL_EXT_FUNCTION (void, glGetTexParameterfv, + (GLenum target, GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (void, glGetTexParameteriv, + (GLenum target, GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glCopyTexImage2D, + (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border)) +COGL_EXT_FUNCTION (void, glViewport, + (GLint x, GLint y, GLsizei width, GLsizei height)) +COGL_EXT_FUNCTION (GLboolean, glIsEnabled, (GLenum cap)) +COGL_EXT_FUNCTION (void, glLineWidth, (GLfloat width)) +COGL_EXT_FUNCTION (void, glPolygonOffset, (GLfloat factor, GLfloat units)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-fixed-functions.h b/cogl/gl-prototypes/cogl-fixed-functions.h new file mode 100644 index 0000000..ce7b4e0 --- /dev/null +++ b/cogl/gl-prototypes/cogl-fixed-functions.h @@ -0,0 +1,119 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These are the core GL functions which are available when the API + supports fixed-function (ie, GL and GLES1.1) */ +COGL_EXT_BEGIN (fixed_function_core, + 0, 0, + COGL_EXT_IN_GLES, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glAlphaFunc, + (GLenum func, GLclampf ref)) +COGL_EXT_FUNCTION (void, glFogf, + (GLenum pname, GLfloat param)) +COGL_EXT_FUNCTION (void, glFogfv, + (GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glLoadMatrixf, + (const GLfloat *m)) +COGL_EXT_FUNCTION (void, glMaterialfv, + (GLenum face, GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glPointSize, + (GLfloat size)) +COGL_EXT_FUNCTION (void, glTexEnvfv, + (GLenum target, GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glColor4ub, + (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) +COGL_EXT_FUNCTION (void, glColor4f, + (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) +COGL_EXT_FUNCTION (void, glColorPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glDisableClientState, + (GLenum array)) +COGL_EXT_FUNCTION (void, glEnableClientState, + (GLenum array)) +COGL_EXT_FUNCTION (void, glLoadIdentity, + (void)) +COGL_EXT_FUNCTION (void, glMatrixMode, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glNormal3f, + (GLfloat x, GLfloat y, GLfloat z)) +COGL_EXT_FUNCTION (void, glNormalPointer, + (GLenum type, GLsizei stride, const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glMultiTexCoord4f, + (GLfloat s, GLfloat t, GLfloat r, GLfloat q)) +COGL_EXT_FUNCTION (void, glTexCoordPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glTexEnvi, + (GLenum target, + GLenum pname, + GLint param)) +COGL_EXT_FUNCTION (void, glVertex4f, + (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) +COGL_EXT_FUNCTION (void, glVertexPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-gles1-functions.h b/cogl/gl-prototypes/cogl-gles1-functions.h new file mode 100644 index 0000000..774b9b3 --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles1-functions.h @@ -0,0 +1,43 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* The functions in this file are core to GLES1 only but + * may be extensions for GLES2 and GL */ +#include "cogl-in-gles1-core-functions.h" + +/* These are fixed-function APIs core to GL and GLES1 */ +#include "cogl-fixed-functions.h" diff --git a/cogl/gl-prototypes/cogl-gles2-functions.h b/cogl/gl-prototypes/cogl-gles2-functions.h new file mode 100644 index 0000000..aeb57a4 --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles2-functions.h @@ -0,0 +1,43 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* The functions in this file are core to GLES2 only but + * may be extensions for GLES1 and GL */ +#include "cogl-in-gles2-core-functions.h" + +/* These are APIs for using GLSL used by GL and GLES2 */ +#include "cogl-glsl-functions.h" diff --git a/cogl/gl-prototypes/cogl-glsl-functions.h b/cogl/gl-prototypes/cogl-glsl-functions.h new file mode 100644 index 0000000..980f8ad --- /dev/null +++ b/cogl/gl-prototypes/cogl-glsl-functions.h @@ -0,0 +1,286 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* This lists functions that are unique to GL 2.0 or GLES 2.0 and are + * not in the old GLSL extensions */ +COGL_EXT_BEGIN (shaders_glsl_2_only, 2, 0, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (GLuint, glCreateProgram, + (void)) +COGL_EXT_FUNCTION (GLuint, glCreateShader, + (GLenum shaderType)) +COGL_EXT_FUNCTION (void, glDeleteShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glAttachShader, + (GLuint program, + GLuint shader)) +COGL_EXT_FUNCTION (void, glUseProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glDeleteProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glGetShaderInfoLog, + (GLuint shader, + GLsizei maxLength, + GLsizei *length, + char *infoLog)) +COGL_EXT_FUNCTION (void, glGetProgramInfoLog, + (GLuint program, + GLsizei bufSize, + GLsizei *length, + char *infoLog)) +COGL_EXT_FUNCTION (void, glGetShaderiv, + (GLuint shader, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (void, glGetProgramiv, + (GLuint program, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (void, glDetachShader, + (GLuint program, GLuint shader)) +COGL_EXT_FUNCTION (void, glGetAttachedShaders, + (GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders)) +COGL_EXT_FUNCTION (GLboolean, glIsShader, + (GLuint shader)) +COGL_EXT_FUNCTION (GLboolean, glIsProgram, + (GLuint program)) +COGL_EXT_END () + +/* These functions are provided by GL_ARB_shader_objects or are in GL + * 2.0 core */ +COGL_EXT_BEGIN (shader_objects_or_gl2, 2, 0, + COGL_EXT_IN_GLES2, + "ARB\0", + "shader_objects\0") +COGL_EXT_FUNCTION (void, glShaderSource, + (GLuint shader, + GLsizei count, + const char * const *string, + const GLint *length)) +COGL_EXT_FUNCTION (void, glCompileShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glLinkProgram, + (GLuint program)) +COGL_EXT_FUNCTION (GLint, glGetUniformLocation, + (GLuint program, + const char *name)) +COGL_EXT_FUNCTION (void, glUniform1f, + (GLint location, + GLfloat v0)) +COGL_EXT_FUNCTION (void, glUniform2f, + (GLint location, + GLfloat v0, + GLfloat v1)) +COGL_EXT_FUNCTION (void, glUniform3f, + (GLint location, + GLfloat v0, + GLfloat v1, + GLfloat v2)) +COGL_EXT_FUNCTION (void, glUniform4f, + (GLint location, + GLfloat v0, + GLfloat v1, + GLfloat v2, + GLfloat v3)) +COGL_EXT_FUNCTION (void, glUniform1fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform2fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform3fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform4fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform1i, + (GLint location, + GLint v0)) +COGL_EXT_FUNCTION (void, glUniform2i, + (GLint location, + GLint v0, + GLint v1)) +COGL_EXT_FUNCTION (void, glUniform3i, + (GLint location, + GLint v0, + GLint v1, + GLint v2)) +COGL_EXT_FUNCTION (void, glUniform4i, + (GLint location, + GLint v0, + GLint v1, + GLint v2, + GLint v3)) +COGL_EXT_FUNCTION (void, glUniform1iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform2iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform3iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform4iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniformMatrix2fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) +COGL_EXT_FUNCTION (void, glUniformMatrix3fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) +COGL_EXT_FUNCTION (void, glUniformMatrix4fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) + +COGL_EXT_FUNCTION (void, glGetUniformfv, + (GLuint program, + GLint location, + GLfloat *params)) +COGL_EXT_FUNCTION (void, glGetUniformiv, + (GLuint program, + GLint location, + GLint *params)) +COGL_EXT_FUNCTION (void, glGetActiveUniform, + (GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + GLchar* name)) +COGL_EXT_FUNCTION (void, glGetShaderSource, + (GLuint shader, + GLsizei bufsize, + GLsizei* length, + GLchar* source)) +COGL_EXT_FUNCTION (void, glValidateProgram, (GLuint program)) +COGL_EXT_END () + +/* These functions are provided by GL_ARB_vertex_shader or are in GL + * 2.0 core */ +COGL_EXT_BEGIN (vertex_shaders, 2, 0, + COGL_EXT_IN_GLES2, + "ARB\0", + "vertex_shader\0") +COGL_EXT_FUNCTION (void, glVertexAttribPointer, + (GLuint index, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glEnableVertexAttribArray, + (GLuint index)) +COGL_EXT_FUNCTION (void, glDisableVertexAttribArray, + (GLuint index)) +COGL_EXT_FUNCTION (void, glVertexAttrib1f, (GLuint indx, GLfloat x)) +COGL_EXT_FUNCTION (void, glVertexAttrib1fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y)) +COGL_EXT_FUNCTION (void, glVertexAttrib2fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib3f, + (GLuint indx, GLfloat x, GLfloat y, GLfloat z)) +COGL_EXT_FUNCTION (void, glVertexAttrib3fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib4f, + (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) +COGL_EXT_FUNCTION (void, glVertexAttrib4fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glGetVertexAttribfv, + (GLuint index, GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (void, glGetVertexAttribiv, + (GLuint index, GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glGetVertexAttribPointerv, + (GLuint index, GLenum pname, GLvoid** pointer)) +COGL_EXT_FUNCTION (GLint, glGetAttribLocation, + (GLuint program, const char *name)) +COGL_EXT_FUNCTION (void, glBindAttribLocation, + (GLuint program, + GLuint index, + const GLchar* name)) +COGL_EXT_FUNCTION (void, glGetActiveAttrib, + (GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + GLchar* name)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-in-gles-core-functions.h b/cogl/gl-prototypes/cogl-in-gles-core-functions.h new file mode 100644 index 0000000..5679e72 --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles-core-functions.h @@ -0,0 +1,148 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +COGL_EXT_BEGIN (only_in_both_gles, + 4, 1, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "ARB\0", + "ES2_compatibility\0") +COGL_EXT_FUNCTION (void, glDepthRangef, + (GLfloat near_val, GLfloat far_val)) +COGL_EXT_FUNCTION (void, glClearDepthf, + (GLclampf depth)) +COGL_EXT_END () + +COGL_EXT_BEGIN (only_in_both_gles_and_gl_1_3, + 1, 3, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glCompressedTexImage2D, + (GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const GLvoid* data)) +COGL_EXT_FUNCTION (void, glCompressedTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const GLvoid* data)) +COGL_EXT_FUNCTION (void, glSampleCoverage, + (GLclampf value, GLboolean invert)) +COGL_EXT_END () + +COGL_EXT_BEGIN (only_in_both_gles_and_gl_1_5, + 1, 5, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glGetBufferParameteriv, + (GLenum target, GLenum pname, GLint* params)) +COGL_EXT_END () + +COGL_EXT_BEGIN (vbos, 1, 5, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "ARB\0", + "vertex_buffer_object\0") +COGL_EXT_FUNCTION (void, glGenBuffers, + (GLsizei n, + GLuint *buffers)) +COGL_EXT_FUNCTION (void, glBindBuffer, + (GLenum target, + GLuint buffer)) +COGL_EXT_FUNCTION (void, glBufferData, + (GLenum target, + GLsizeiptr size, + const GLvoid *data, + GLenum usage)) +COGL_EXT_FUNCTION (void, glBufferSubData, + (GLenum target, + GLintptr offset, + GLsizeiptr size, + const GLvoid *data)) +COGL_EXT_FUNCTION (void, glDeleteBuffers, + (GLsizei n, + const GLuint *buffers)) +COGL_EXT_FUNCTION (GLboolean, glIsBuffer, + (GLuint buffer)) +COGL_EXT_END () + +/* Available in GL 1.3, the multitexture extension or GLES. These are + required */ +COGL_EXT_BEGIN (multitexture_part0, 1, 3, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "ARB\0", + "multitexture\0") +COGL_EXT_FUNCTION (void, glActiveTexture, + (GLenum texture)) +COGL_EXT_END () + diff --git a/cogl/gl-prototypes/cogl-in-gles1-core-functions.h b/cogl/gl-prototypes/cogl-in-gles1-core-functions.h new file mode 100644 index 0000000..20dc1a8 --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles1-core-functions.h @@ -0,0 +1,78 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These functions are only available in GLES and are used as + replacements for some GL equivalents that only accept double + arguments */ +COGL_EXT_BEGIN (only_in_gles1, + 255, 255, + COGL_EXT_IN_GLES, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glClipPlanef, + (GLenum plane, const GLfloat *equation)) +COGL_EXT_END () + +COGL_EXT_BEGIN (multitexture_part1, 1, 3, + COGL_EXT_IN_GLES, + "ARB\0", + "multitexture\0") +COGL_EXT_FUNCTION (void, glClientActiveTexture, + (GLenum texture)) +COGL_EXT_END () + diff --git a/cogl/gl-prototypes/cogl-in-gles2-core-functions.h b/cogl/gl-prototypes/cogl-in-gles2-core-functions.h new file mode 100644 index 0000000..1e2f79e --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles2-core-functions.h @@ -0,0 +1,186 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +COGL_EXT_BEGIN (offscreen, + 3, 0, + COGL_EXT_IN_GLES2, + /* for some reason the ARB version of this + extension doesn't have an ARB suffix for the + functions */ + "ARB:\0EXT\0OES\0", + "framebuffer_object\0") +COGL_EXT_FUNCTION (void, glGenRenderbuffers, + (GLsizei n, + GLuint *renderbuffers)) +COGL_EXT_FUNCTION (void, glDeleteRenderbuffers, + (GLsizei n, + const GLuint *renderbuffers)) +COGL_EXT_FUNCTION (void, glBindRenderbuffer, + (GLenum target, + GLuint renderbuffer)) +COGL_EXT_FUNCTION (void, glRenderbufferStorage, + (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glGenFramebuffers, + (GLsizei n, + GLuint *framebuffers)) +COGL_EXT_FUNCTION (void, glBindFramebuffer, + (GLenum target, + GLuint framebuffer)) +COGL_EXT_FUNCTION (void, glFramebufferTexture2D, + (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level)) +COGL_EXT_FUNCTION (void, glFramebufferRenderbuffer, + (GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer)) +COGL_EXT_FUNCTION (GLboolean, glIsRenderbuffer, + (GLuint renderbuffer)) +COGL_EXT_FUNCTION (GLenum, glCheckFramebufferStatus, + (GLenum target)) +COGL_EXT_FUNCTION (void, glDeleteFramebuffers, + (GLsizei n, + const GLuint *framebuffers)) +COGL_EXT_FUNCTION (void, glGenerateMipmap, + (GLenum target)) +COGL_EXT_FUNCTION (void, glGetFramebufferAttachmentParameteriv, + (GLenum target, + GLenum attachment, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (void, glGetRenderbufferParameteriv, + (GLenum target, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (GLboolean, glIsFramebuffer, + (GLuint framebuffer)) +COGL_EXT_END () + +COGL_EXT_BEGIN (blending, 1, 2, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glBlendEquation, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glBlendColor, + (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha)) +COGL_EXT_END () + +/* Optional, declared in 1.4 or GLES 1.2 */ +COGL_EXT_BEGIN (blend_func_separate, 1, 4, + COGL_EXT_IN_GLES2, + "EXT\0", + "blend_func_separate\0") +COGL_EXT_FUNCTION (void, glBlendFuncSeparate, + (GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha)) +COGL_EXT_END () + +/* Optional, declared in 2.0 */ +COGL_EXT_BEGIN (blend_equation_separate, 2, 0, + COGL_EXT_IN_GLES2, + "EXT\0", + "blend_equation_separate\0") +COGL_EXT_FUNCTION (void, glBlendEquationSeparate, + (GLenum modeRGB, + GLenum modeAlpha)) +COGL_EXT_END () + +COGL_EXT_BEGIN (gles2_only_api, + 4, 1, + COGL_EXT_IN_GLES2, + "ARB:\0", + "ES2_compatibility\0") +COGL_EXT_FUNCTION (void, glReleaseShaderCompiler, (void)) +COGL_EXT_FUNCTION (void, glGetShaderPrecisionFormat, + (GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision)) +COGL_EXT_FUNCTION (void, glShaderBinary, + (GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const GLvoid* binary, + GLsizei length)) +COGL_EXT_END () + +/* GL and GLES 2.0 apis */ +COGL_EXT_BEGIN (two_point_zero_api, + 2, 0, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glStencilFuncSeparate, + (GLenum face, GLenum func, GLint ref, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilMaskSeparate, + (GLenum face, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilOpSeparate, + (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)) +COGL_EXT_END () diff --git a/cogl/stb_image.c b/cogl/stb_image.c new file mode 100644 index 0000000..861c751 --- /dev/null +++ b/cogl/stb_image.c @@ -0,0 +1,3892 @@ +/* stbi-1.18 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c + when you control the images you're loading + + QUICK NOTES: + Primarily of interest to game developers and other people who can + avoid problematic images and only need the trivial interface + + JPEG baseline (no JPEG progressive, no oddball channel decimations) + PNG 8-bit only + BMP non-1bpp, non-RLE + TGA (not sure what subset, if a subset) + PSD (composited view only, no extra channels) + HDR (radiance rgbE format) + writes BMP,TGA (define STBI_NO_WRITE to remove code) + decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code) + supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD) + + TODO: + stbi_info_* + + history: + 1.18 fix a threading bug (local mutable static) + 1.17 support interlaced PNG + 1.16 major bugfix - convert_format converted one too many pixels + 1.15 initialize some fields for thread safety + 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including) + 1.13 threadsafe + 1.12 const qualifiers in the API + 1.11 Support installable IDCT, colorspace conversion routines + 1.10 Fixes for 64-bit (don't use "unsigned long") + optimized upsampling by Fabian "ryg" Giesen + 1.09 Fix format-conversion for PSD code (bad global variables!) + 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz + 1.07 attempt to fix C++ warning/errors again + 1.06 attempt to fix C++ warning/errors again + 1.05 fix TGA loading to return correct *comp and use good luminance calc + 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free + 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR + 1.02 support for (subset of) HDR files, float interface for preferred access to them + 1.01 fix bug: possible bug in handling right-side up bmps... not sure + fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all + 1.00 interface to zlib that skips zlib header + 0.99 correct handling of alpha in palette + 0.98 TGA loader by lonesock; dynamically add loaders (untested) + 0.97 jpeg errors on too large a file; also catch another malloc failure + 0.96 fix detection of invalid v value - particleman@mollyrocket forum + 0.95 during header scan, seek to markers in case of padding + 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same + 0.93 handle jpegtran output; verbose errors + 0.92 read 4,8,16,24,32-bit BMP files of several formats + 0.91 output 24-bit Windows 3.0 BMP files + 0.90 fix a few more warnings; bump version number to approach 1.0 + 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd + 0.60 fix compiling as c++ + 0.59 fix warnings: merge Dave Moore's -Wall fixes + 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian + 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less + than 16 available + 0.56 fix bug: zlib uncompressed mode len vs. nlen + 0.55 fix bug: restart_interval not initialized to 0 + 0.54 allow NULL for 'int *comp' + 0.53 fix bug in png 3->4; speedup png decoding + 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments + 0.51 obey req_comp requests, 1-component jpegs return as 1-component, + on 'test' only check type, not whether we support this variant +*/ + +#include + +#ifndef STBI_INCLUDE_STB_IMAGE_H +#define STBI_INCLUDE_STB_IMAGE_H + +//// begin header file //////////////////////////////////////////////////// +// +// Limitations: +// - no progressive/interlaced support (jpeg, png) +// - 8-bit samples only (jpeg, png) +// - not threadsafe +// - channel subsampling of at most 2 in each dimension (jpeg) +// - no delayed line count (jpeg) -- IJG doesn't support either +// +// Basic usage (see HDR discussion below): +// int x,y,n; +// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); +// // ... process data if not NULL ... +// // ... x = width, y = height, n = # 8-bit components per pixel ... +// // ... replace '0' with '1'..'4' to force that many components per pixel +// stbi_image_free(data) +// +// Standard parameters: +// int *x -- outputs image width in pixels +// int *y -- outputs image height in pixels +// int *comp -- outputs # of image components in image file +// int req_comp -- if non-zero, # of image components requested in result +// +// The return value from an image loader is an 'unsigned char *' which points +// to the pixel data. The pixel data consists of *y scanlines of *x pixels, +// with each pixel consisting of N interleaved 8-bit components; the first +// pixel pointed to is top-left-most in the image. There is no padding between +// image scanlines or between pixels, regardless of format. The number of +// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise. +// If req_comp is non-zero, *comp has the number of components that _would_ +// have been output otherwise. E.g. if you set req_comp to 4, you will always +// get RGBA output, but you can check *comp to easily see if it's opaque. +// +// An output image with N components has the following components interleaved +// in this order in each pixel: +// +// N=#comp components +// 1 grey +// 2 grey, alpha +// 3 red, green, blue +// 4 red, green, blue, alpha +// +// If image loading fails for any reason, the return value will be NULL, +// and *x, *y, *comp will be unchanged. The function stbi_failure_reason() +// can be queried for an extremely brief, end-user unfriendly explanation +// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid +// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly +// more user-friendly ones. +// +// Paletted PNG and BMP images are automatically depalettized. +// +// +// =========================================================================== +// +// HDR image support (disable by defining STBI_NO_HDR) +// +// stb_image now supports loading HDR images in general, and currently +// the Radiance .HDR file format, although the support is provided +// generically. You can still load any file through the existing interface; +// if you attempt to load an HDR file, it will be automatically remapped to +// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; +// both of these constants can be reconfigured through this interface: +// +// stbi_hdr_to_ldr_gamma(2.2f); +// stbi_hdr_to_ldr_scale(1.0f); +// +// (note, do not use _inverse_ constants; stbi_image will invert them +// appropriately). +// +// Additionally, there is a new, parallel interface for loading files as +// (linear) floats to preserve the full dynamic range: +// +// float *data = stbi_loadf(filename, &x, &y, &n, 0); +// +// If you load LDR images through this interface, those images will +// be promoted to floating point values, run through the inverse of +// constants corresponding to the above: +// +// stbi_ldr_to_hdr_scale(1.0f); +// stbi_ldr_to_hdr_gamma(2.2f); +// +// Finally, given a filename (or an open file or memory block--see header +// file for details) containing image data, you can query for the "most +// appropriate" interface to use (that is, whether the image is HDR or +// not), using: +// +// stbi_is_hdr(char *filename); + +#ifndef STBI_NO_STDIO +#include +#endif + +#define STBI_VERSION 1 + +enum +{ + STBI_default = 0, // only used for req_comp + + STBI_grey = 1, + STBI_grey_alpha = 2, + STBI_rgb = 3, + STBI_rgb_alpha = 4, +}; + +typedef unsigned char stbi_uc; + +#ifdef __cplusplus +extern "C" { +#endif + +// WRITING API + +#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO) +// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding) +// (you must include the appropriate extension in the filename). +// returns TRUE on success, FALSE if couldn't open file, error writing file +extern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data); +extern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data); +#endif + +// PRIMARY API - works on images of any type + +// load image by filename, open file, or memory buffer +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +// for stbi_load_from_file, file pointer is left pointing immediately after image + +#ifndef STBI_NO_HDR +#ifndef STBI_NO_STDIO +extern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp); +extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif +extern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); + +extern void stbi_hdr_to_ldr_gamma(float gamma); +extern void stbi_hdr_to_ldr_scale(float scale); + +extern void stbi_ldr_to_hdr_gamma(float gamma); +extern void stbi_ldr_to_hdr_scale(float scale); + +#endif // STBI_NO_HDR + +// get a VERY brief reason for failure +// NOT THREADSAFE +extern char *stbi_failure_reason (void); + +// free the loaded image -- this is just free() +extern void stbi_image_free (void *retval_from_stbi_load); + +// get image dimensions & components without fully decoding +extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); +extern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); +#ifndef STBI_NO_STDIO +extern int stbi_info (char const *filename, int *x, int *y, int *comp); +extern int stbi_is_hdr (char const *filename); +extern int stbi_is_hdr_from_file(FILE *f); +#endif + +// ZLIB client - used by PNG, available for other purposes + +extern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); +extern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); +extern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + +extern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); +extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + +// TYPE-SPECIFIC ACCESS + +// is it a jpeg? +extern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len); +extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern int stbi_jpeg_test_file (FILE *f); +extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); + +extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp); +extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif + +// is it a png? +extern int stbi_png_test_memory (stbi_uc const *buffer, int len); +extern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info (char const *filename, int *x, int *y, int *comp); +extern int stbi_png_test_file (FILE *f); +extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif + +// is it a bmp? +extern int stbi_bmp_test_memory (stbi_uc const *buffer, int len); + +extern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_bmp_test_file (FILE *f); +extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it a tga? +extern int stbi_tga_test_memory (stbi_uc const *buffer, int len); + +extern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_tga_test_file (FILE *f); +extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it a psd? +extern int stbi_psd_test_memory (stbi_uc const *buffer, int len); + +extern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_psd_test_file (FILE *f); +extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it an hdr? +extern int stbi_hdr_test_memory (stbi_uc const *buffer, int len); + +extern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp); +extern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_hdr_test_file (FILE *f); +extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// define new loaders +typedef struct +{ + int (*test_memory)(stbi_uc const *buffer, int len); + stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp); + #ifndef STBI_NO_STDIO + int (*test_file)(FILE *f); + stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp); + #endif +} stbi_loader; + +// register a loader by filling out the above structure (you must defined ALL functions) +// returns 1 if added or already added, 0 if not added (too many loaders) +// NOT THREADSAFE +extern int stbi_register_loader(stbi_loader *loader); + +// define faster low-level operations (typically SIMD support) +#if STBI_SIMD +typedef void (*stbi_idct_8x8)(uint8_t *out, int out_stride, short data[64], unsigned short *dequantize); +// compute an integer IDCT on "input" +// input[x] = data[x] * dequantize[x] +// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride' +// CLAMP results to 0..255 +typedef void (*stbi_YCbCr_to_RGB_run)(uint8_t *output, uint8_t const *y, uint8_t const *cb, uint8_t const *cr, int count, int step); +// compute a conversion from YCbCr to RGB +// 'count' pixels +// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B +// y: Y input channel +// cb: Cb input channel; scale/biased to be 0..255 +// cr: Cr input channel; scale/biased to be 0..255 + +extern void stbi_install_idct(stbi_idct_8x8 func); +extern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func); +#endif // STBI_SIMD + +#ifdef __cplusplus +} +#endif + +// +// +//// end header file ///////////////////////////////////////////////////// +#endif // STBI_INCLUDE_STB_IMAGE_H + +#ifndef STBI_HEADER_FILE_ONLY + +#ifndef STBI_NO_HDR +#include // ldexp +#include // strcmp +#endif + +#ifndef STBI_NO_STDIO +#include +#endif +#include +#include +#include +#include + +#ifndef _MSC_VER + #ifdef __cplusplus + #define __forceinline inline + #else + #define __forceinline + #endif +#endif + + +// should produce compiler error if size is wrong +typedef unsigned char validate_uint32_t[sizeof(uint32_t)==4]; + +#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE) +#define STBI_NO_WRITE +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// Generic API that works on all image types +// + +// this is not threadsafe +static char *failure_reason; + +char *stbi_failure_reason(void) +{ + return failure_reason; +} + +static int e(char *str) +{ + failure_reason = str; + return 0; +} + +#ifdef STBI_NO_FAILURE_STRINGS + #define e(x,y) 0 +#elif defined(STBI_FAILURE_USERMSG) + #define e(x,y) e(y) +#else + #define e(x,y) e(x) +#endif + +#define epf(x,y) ((float *) (e(x,y)?NULL:NULL)) +#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL)) + +void stbi_image_free(void *retval_from_stbi_load) +{ + free(retval_from_stbi_load); +} + +#define MAX_LOADERS 32 +stbi_loader *loaders[MAX_LOADERS]; +static int max_loaders = 0; + +int stbi_register_loader(stbi_loader *loader) +{ + int i; + for (i=0; i < MAX_LOADERS; ++i) { + // already present? + if (loaders[i] == loader) + return 1; + // end of the list? + if (loaders[i] == NULL) { + loaders[i] = loader; + max_loaders = i+1; + return 1; + } + } + // no room for it + return 0; +} + +#ifndef STBI_NO_HDR +static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp); +static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp); +#endif + +#ifndef STBI_NO_STDIO +unsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = fopen(filename, "rb"); + unsigned char *result; + if (!f) return epuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + int i; + if (stbi_jpeg_test_file(f)) + return stbi_jpeg_load_from_file(f,x,y,comp,req_comp); + if (stbi_png_test_file(f)) + return stbi_png_load_from_file(f,x,y,comp,req_comp); + if (stbi_bmp_test_file(f)) + return stbi_bmp_load_from_file(f,x,y,comp,req_comp); + if (stbi_psd_test_file(f)) + return stbi_psd_load_from_file(f,x,y,comp,req_comp); + #ifndef STBI_NO_HDR + if (stbi_hdr_test_file(f)) { + float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp); + return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + for (i=0; i < max_loaders; ++i) + if (loaders[i]->test_file(f)) + return loaders[i]->load_from_file(f,x,y,comp,req_comp); + // test tga last because it's a crappy test! + if (stbi_tga_test_file(f)) + return stbi_tga_load_from_file(f,x,y,comp,req_comp); + return epuc("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +unsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + int i; + if (stbi_jpeg_test_memory(buffer,len)) + return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_png_test_memory(buffer,len)) + return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_bmp_test_memory(buffer,len)) + return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_psd_test_memory(buffer,len)) + return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp); + #ifndef STBI_NO_HDR + if (stbi_hdr_test_memory(buffer, len)) { + float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); + return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + for (i=0; i < max_loaders; ++i) + if (loaders[i]->test_memory(buffer,len)) + return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp); + // test tga last because it's a crappy test! + if (stbi_tga_test_memory(buffer,len)) + return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp); + return epuc("unknown image type", "Image not of any known type, or corrupt"); +} + +#ifndef STBI_NO_HDR + +#ifndef STBI_NO_STDIO +float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = fopen(filename, "rb"); + float *result; + if (!f) return epf("can't fopen", "Unable to open file"); + result = stbi_loadf_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + #ifndef STBI_NO_HDR + if (stbi_hdr_test_file(f)) + return stbi_hdr_load_from_file(f,x,y,comp,req_comp); + #endif + data = stbi_load_from_file(f, x, y, comp, req_comp); + if (data) + return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return epf("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + #ifndef STBI_NO_HDR + if (stbi_hdr_test_memory(buffer, len)) + return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); + #endif + data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp); + if (data) + return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return epf("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is +// defined, for API simplicity; if STBI_NO_HDR is defined, it always +// reports false! + +int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) +{ + #ifndef STBI_NO_HDR + return stbi_hdr_test_memory(buffer, len); + #else + return 0; + #endif +} + +#ifndef STBI_NO_STDIO +extern int stbi_is_hdr (char const *filename) +{ + FILE *f = fopen(filename, "rb"); + int result=0; + if (f) { + result = stbi_is_hdr_from_file(f); + fclose(f); + } + return result; +} + +extern int stbi_is_hdr_from_file(FILE *f) +{ + #ifndef STBI_NO_HDR + return stbi_hdr_test_file(f); + #else + return 0; + #endif +} + +#endif + +// @TODO: get image dimensions & components without fully decoding +#ifndef STBI_NO_STDIO +extern int stbi_info (char const *filename, int *x, int *y, int *comp); +extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_HDR +static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f; +static float l2h_gamma=2.2f, l2h_scale=1.0f; + +void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; } +void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; } + +void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; } +void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; } +#endif + + +////////////////////////////////////////////////////////////////////////////// +// +// Common code used by all image loaders +// + +enum +{ + SCAN_load=0, + SCAN_type, + SCAN_header, +}; + +typedef struct +{ + uint32_t img_x, img_y; + int img_n, img_out_n; + + #ifndef STBI_NO_STDIO + FILE *img_file; + #endif + uint8_t *img_buffer, *img_buffer_end; +} stbi; + +#ifndef STBI_NO_STDIO +static void start_file(stbi *s, FILE *f) +{ + s->img_file = f; +} +#endif + +static void start_mem(stbi *s, uint8_t const *buffer, int len) +{ +#ifndef STBI_NO_STDIO + s->img_file = NULL; +#endif + s->img_buffer = (uint8_t *) buffer; + s->img_buffer_end = (uint8_t *) buffer+len; +} + +__forceinline static int get8(stbi *s) +{ +#ifndef STBI_NO_STDIO + if (s->img_file) { + int c = fgetc(s->img_file); + return c == EOF ? 0 : c; + } +#endif + if (s->img_buffer < s->img_buffer_end) + return *s->img_buffer++; + return 0; +} + +__forceinline static int at_eof(stbi *s) +{ +#ifndef STBI_NO_STDIO + if (s->img_file) + return feof(s->img_file); +#endif + return s->img_buffer >= s->img_buffer_end; +} + +__forceinline static uint8_t get8u(stbi *s) +{ + return (uint8_t) get8(s); +} + +static void skip(stbi *s, int n) +{ +#ifndef STBI_NO_STDIO + if (s->img_file) + fseek(s->img_file, n, SEEK_CUR); + else +#endif + s->img_buffer += n; +} + +static int get16(stbi *s) +{ + int z = get8(s); + return (z << 8) + get8(s); +} + +static uint32_t get32(stbi *s) +{ + uint32_t z = get16(s); + return (z << 16) + get16(s); +} + +static int get16le(stbi *s) +{ + int z = get8(s); + return z + (get8(s) << 8); +} + +static uint32_t get32le(stbi *s) +{ + uint32_t z = get16le(s); + return z + (get16le(s) << 16); +} + +static void getn(stbi *s, stbi_uc *buffer, int n) +{ +#ifndef STBI_NO_STDIO + if (s->img_file) { + fread(buffer, 1, n, s->img_file); + return; + } +#endif + memcpy(buffer, s->img_buffer, n); + s->img_buffer += n; +} + +////////////////////////////////////////////////////////////////////////////// +// +// generic converter from built-in img_n to req_comp +// individual types do this automatically as much as possible (e.g. jpeg +// does all cases internally since it needs to colorspace convert anyway, +// and it never has alpha, so very few cases ). png can automatically +// interleave an alpha=255 channel, but falls back to this for other cases +// +// assume data buffer is malloced, so malloc a new one and free that one +// only failure mode is malloc failing + +static uint8_t compute_y(int r, int g, int b) +{ + return (uint8_t) (((r*77) + (g*150) + (29*b)) >> 8); +} + +static unsigned char *convert_format(unsigned char *data, + int img_n, + int req_comp, + unsigned int x, + unsigned int y) +{ + int i,j; + unsigned char *good; + + if (req_comp == img_n) return data; + assert(req_comp >= 1 && req_comp <= 4); + + good = (unsigned char *) malloc(req_comp * x * y); + if (good == NULL) { + free(data); + return epuc("outofmem", "Out of memory"); + } + + for (j=0; j < (int) y; ++j) { + unsigned char *src = data + j * x * img_n ; + unsigned char *dest = good + j * x * req_comp; + + #define COMBO(a,b) ((a)*8+(b)) + #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch(COMBO(img_n, req_comp)) { + CASE(1,2) dest[0]=src[0], dest[1]=255; break; + CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break; + CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break; + CASE(2,1) dest[0]=src[0]; break; + CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break; + CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break; + CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break; + CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break; + CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break; + CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break; + CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break; + CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break; + default: assert(0); + } + #undef CASE + } + + free(data); + return good; +} + +#ifndef STBI_NO_HDR +static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp) +{ + int i,k,n; + float *output = (float *) malloc(x * y * comp * sizeof(float)); + if (output == NULL) { free(data); return epf("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale; + } + if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f; + } + free(data); + return output; +} + +#define float2int(x) ((int) (x)) +static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp) +{ + int i,k,n; + stbi_uc *output = (stbi_uc *) malloc(x * y * comp); + if (output == NULL) { free(data); return epuc("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = float2int(z); + } + if (k < comp) { + float z = data[i*comp+k] * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = float2int(z); + } + } + free(data); + return output; +} +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// "baseline" JPEG/JFIF decoder (not actually fully baseline implementation) +// +// simple implementation +// - channel subsampling of at most 2 in each dimension +// - doesn't support delayed output of y-dimension +// - simple interface (only one output format: 8-bit interleaved RGB) +// - doesn't try to recover corrupt jpegs +// - doesn't allow partial loading, loading multiple at once +// - still fast on x86 (copying globals into locals doesn't help x86) +// - allocates lots of intermediate memory (full size of all components) +// - non-interleaved case requires this anyway +// - allows good upsampling (see next) +// high-quality +// - upsampled channels are bilinearly interpolated, even across blocks +// - quality integer IDCT derived from IJG's 'slow' +// performance +// - fast huffman; reasonable integer IDCT +// - uses a lot of intermediate memory, could cache poorly +// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4 +// stb_jpeg: 1.34 seconds (MSVC6, default release build) +// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro) +// IJL11.dll: 1.08 seconds (compiled by intel) +// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG) +// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro) + +// huffman decoding acceleration +#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache + +typedef struct +{ + uint8_t fast[1 << FAST_BITS]; + // weirdly, repacking this into AoS is a 10% speed loss, instead of a win + uint16_t code[256]; + uint8_t values[256]; + uint8_t size[257]; + unsigned int maxcode[18]; + int delta[17]; // old 'firstsymbol' - old 'firstcode' +} huffman; + +typedef struct +{ + #if STBI_SIMD + unsigned short dequant2[4][64]; + #endif + stbi s; + huffman huff_dc[4]; + huffman huff_ac[4]; + uint8_t dequant[4][64]; + +// sizes for components, interleaved MCUs + int img_h_max, img_v_max; + int img_mcu_x, img_mcu_y; + int img_mcu_w, img_mcu_h; + +// definition of jpeg image component + struct + { + int id; + int h,v; + int tq; + int hd,ha; + int dc_pred; + + int x,y,w2,h2; + uint8_t *data; + void *raw_data; + uint8_t *linebuf; + } img_comp[4]; + + uint32_t code_buffer; // jpeg entropy-coded buffer + int code_bits; // number of valid bits + unsigned char marker; // marker seen while filling entropy buffer + int nomore; // flag if we saw a marker so must stop + + int scan_n, order[4]; + int restart_interval, todo; +} jpeg; + +static int build_huffman(huffman *h, int *count) +{ + int i,j,k=0,code; + // build size list for each symbol (from JPEG spec) + for (i=0; i < 16; ++i) + for (j=0; j < count[i]; ++j) + h->size[k++] = (uint8_t) (i+1); + h->size[k] = 0; + + // compute actual symbols (from jpeg spec) + code = 0; + k = 0; + for(j=1; j <= 16; ++j) { + // compute delta to add to code to compute symbol id + h->delta[j] = k - code; + if (h->size[k] == j) { + while (h->size[k] == j) + h->code[k++] = (uint16_t) (code++); + if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG"); + } + // compute largest code + 1 for this size, preshifted as needed later + h->maxcode[j] = code << (16-j); + code <<= 1; + } + h->maxcode[j] = 0xffffffff; + + // build non-spec acceleration table; 255 is flag for not-accelerated + memset(h->fast, 255, 1 << FAST_BITS); + for (i=0; i < k; ++i) { + int s = h->size[i]; + if (s <= FAST_BITS) { + int c = h->code[i] << (FAST_BITS-s); + int m = 1 << (FAST_BITS-s); + for (j=0; j < m; ++j) { + h->fast[c+j] = (uint8_t) i; + } + } + } + return 1; +} + +static void grow_buffer_unsafe(jpeg *j) +{ + do { + int b = j->nomore ? 0 : get8(&j->s); + if (b == 0xff) { + int c = get8(&j->s); + if (c != 0) { + j->marker = (unsigned char) c; + j->nomore = 1; + return; + } + } + j->code_buffer = (j->code_buffer << 8) | b; + j->code_bits += 8; + } while (j->code_bits <= 24); +} + +// (1 << n) - 1 +static uint32_t bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; + +// decode a jpeg huffman value from the bitstream +__forceinline static int decode(jpeg *j, huffman *h) +{ + unsigned int temp; + int c,k; + + if (j->code_bits < 16) grow_buffer_unsafe(j); + + // look at the top FAST_BITS and determine what symbol ID it is, + // if the code is <= FAST_BITS + c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1); + k = h->fast[c]; + if (k < 255) { + if (h->size[k] > j->code_bits) + return -1; + j->code_bits -= h->size[k]; + return h->values[k]; + } + + // naive test is to shift the code_buffer down so k bits are + // valid, then test against maxcode. To speed this up, we've + // preshifted maxcode left so that it has (16-k) 0s at the + // end; in other words, regardless of the number of bits, it + // wants to be compared against something shifted to have 16; + // that way we don't need to shift inside the loop. + if (j->code_bits < 16) + temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff; + else + temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff; + for (k=FAST_BITS+1 ; ; ++k) + if (temp < h->maxcode[k]) + break; + if (k == 17) { + // error! code not found + j->code_bits -= 16; + return -1; + } + + if (k > j->code_bits) + return -1; + + // convert the huffman code to the symbol id + c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k]; + assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]); + + // convert the id to a symbol + j->code_bits -= k; + return h->values[c]; +} + +// combined JPEG 'receive' and JPEG 'extend', since baseline +// always extends everything it receives. +__forceinline static int extend_receive(jpeg *j, int n) +{ + unsigned int m = 1 << (n-1); + unsigned int k; + if (j->code_bits < n) grow_buffer_unsafe(j); + k = (j->code_buffer >> (j->code_bits - n)) & bmask[n]; + j->code_bits -= n; + // the following test is probably a random branch that won't + // predict well. I tried to table accelerate it but failed. + // maybe it's compiling as a conditional move? + if (k < m) + return (-1 << n) + k + 1; + else + return k; +} + +// given a value that's at position X in the zigzag stream, +// where does it appear in the 8x8 matrix coded as row-major? +static uint8_t dezigzag[64+15] = +{ + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, + // let corrupt input sample past end + 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63 +}; + +// decode one 64-entry block-- +static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b) +{ + int diff,dc,k; + int t = decode(j, hdc); + if (t < 0) return e("bad huffman code","Corrupt JPEG"); + + // 0 all the ac values now so we can do it 32-bits at a time + memset(data,0,64*sizeof(data[0])); + + diff = t ? extend_receive(j, t) : 0; + dc = j->img_comp[b].dc_pred + diff; + j->img_comp[b].dc_pred = dc; + data[0] = (short) dc; + + // decode AC components, see JPEG spec + k = 1; + do { + int r,s; + int rs = decode(j, hac); + if (rs < 0) return e("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (rs != 0xf0) break; // end block + k += 16; + } else { + k += r; + // decode into unzigzag'd location + data[dezigzag[k++]] = (short) extend_receive(j,s); + } + } while (k < 64); + return 1; +} + +// take a -128..127 value and clamp it and convert to 0..255 +__forceinline static uint8_t clamp(int x) +{ + x += 128; + // trick to use a single test to catch both cases + if ((unsigned int) x > 255) { + if (x < 0) return 0; + if (x > 255) return 255; + } + return (uint8_t) x; +} + +#define f2f(x) (int) (((x) * 4096 + 0.5)) +#define fsh(x) ((x) << 12) + +// derived from jidctint -- DCT_ISLOW +#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ + int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ + p2 = s2; \ + p3 = s6; \ + p1 = (p2+p3) * f2f(0.5411961f); \ + t2 = p1 + p3*f2f(-1.847759065f); \ + t3 = p1 + p2*f2f( 0.765366865f); \ + p2 = s0; \ + p3 = s4; \ + t0 = fsh(p2+p3); \ + t1 = fsh(p2-p3); \ + x0 = t0+t3; \ + x3 = t0-t3; \ + x1 = t1+t2; \ + x2 = t1-t2; \ + t0 = s7; \ + t1 = s5; \ + t2 = s3; \ + t3 = s1; \ + p3 = t0+t2; \ + p4 = t1+t3; \ + p1 = t0+t3; \ + p2 = t1+t2; \ + p5 = (p3+p4)*f2f( 1.175875602f); \ + t0 = t0*f2f( 0.298631336f); \ + t1 = t1*f2f( 2.053119869f); \ + t2 = t2*f2f( 3.072711026f); \ + t3 = t3*f2f( 1.501321110f); \ + p1 = p5 + p1*f2f(-0.899976223f); \ + p2 = p5 + p2*f2f(-2.562915447f); \ + p3 = p3*f2f(-1.961570560f); \ + p4 = p4*f2f(-0.390180644f); \ + t3 += p1+p4; \ + t2 += p2+p3; \ + t1 += p2+p4; \ + t0 += p1+p3; + +#if !STBI_SIMD +// .344 seconds on 3*anemones.jpg +static void idct_block(uint8_t *out, int out_stride, short data[64], uint8_t *dequantize) +{ + int i,val[64],*v=val; + uint8_t *o,*dq = dequantize; + short *d = data; + + // columns + for (i=0; i < 8; ++i,++d,++dq, ++v) { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 + && d[40]==0 && d[48]==0 && d[56]==0) { + // no shortcut 0 seconds + // (1|2|3|4|5|6|7)==0 0 seconds + // all separate -0.047 seconds + // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds + int dcterm = d[0] * dq[0] << 2; + v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; + } else { + IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24], + d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56]) + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + x0 += 512; x1 += 512; x2 += 512; x3 += 512; + v[ 0] = (x0+t3) >> 10; + v[56] = (x0-t3) >> 10; + v[ 8] = (x1+t2) >> 10; + v[48] = (x1-t2) >> 10; + v[16] = (x2+t1) >> 10; + v[40] = (x2-t1) >> 10; + v[24] = (x3+t0) >> 10; + v[32] = (x3-t0) >> 10; + } + } + + for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { + // no fast case since the first 1D IDCT spread components out + IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536; + o[0] = clamp((x0+t3) >> 17); + o[7] = clamp((x0-t3) >> 17); + o[1] = clamp((x1+t2) >> 17); + o[6] = clamp((x1-t2) >> 17); + o[2] = clamp((x2+t1) >> 17); + o[5] = clamp((x2-t1) >> 17); + o[3] = clamp((x3+t0) >> 17); + o[4] = clamp((x3-t0) >> 17); + } +} +#else +static void idct_block(uint8_t *out, int out_stride, short data[64], unsigned short *dequantize) +{ + int i,val[64],*v=val; + uint8_t *o; + unsigned short *dq = dequantize; + short *d = data; + + // columns + for (i=0; i < 8; ++i,++d,++dq, ++v) { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 + && d[40]==0 && d[48]==0 && d[56]==0) { + // no shortcut 0 seconds + // (1|2|3|4|5|6|7)==0 0 seconds + // all separate -0.047 seconds + // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds + int dcterm = d[0] * dq[0] << 2; + v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; + } else { + IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24], + d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56]) + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + x0 += 512; x1 += 512; x2 += 512; x3 += 512; + v[ 0] = (x0+t3) >> 10; + v[56] = (x0-t3) >> 10; + v[ 8] = (x1+t2) >> 10; + v[48] = (x1-t2) >> 10; + v[16] = (x2+t1) >> 10; + v[40] = (x2-t1) >> 10; + v[24] = (x3+t0) >> 10; + v[32] = (x3-t0) >> 10; + } + } + + for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { + // no fast case since the first 1D IDCT spread components out + IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536; + o[0] = clamp((x0+t3) >> 17); + o[7] = clamp((x0-t3) >> 17); + o[1] = clamp((x1+t2) >> 17); + o[6] = clamp((x1-t2) >> 17); + o[2] = clamp((x2+t1) >> 17); + o[5] = clamp((x2-t1) >> 17); + o[3] = clamp((x3+t0) >> 17); + o[4] = clamp((x3-t0) >> 17); + } +} +static stbi_idct_8x8 stbi_idct_installed = idct_block; + +extern void stbi_install_idct(stbi_idct_8x8 func) +{ + stbi_idct_installed = func; +} +#endif + +#define MARKER_none 0xff +// if there's a pending marker from the entropy stream, return that +// otherwise, fetch from the stream and get a marker. if there's no +// marker, return 0xff, which is never a valid marker value +static uint8_t get_marker(jpeg *j) +{ + uint8_t x; + if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; } + x = get8u(&j->s); + if (x != 0xff) return MARKER_none; + while (x == 0xff) + x = get8u(&j->s); + return x; +} + +// in each scan, we'll have scan_n components, and the order +// of the components is specified by order[] +#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) + +// after a restart interval, reset the entropy decoder and +// the dc prediction +static void reset(jpeg *j) +{ + j->code_bits = 0; + j->code_buffer = 0; + j->nomore = 0; + j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0; + j->marker = MARKER_none; + j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; + // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, + // since we don't even allow 1<<30 pixels +} + +static int parse_entropy_coded_data(jpeg *z) +{ + reset(z); + if (z->scan_n == 1) { + int i,j; + #if STBI_SIMD + __declspec(align(16)) + #endif + short data[64]; + int n = z->order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0; + #if STBI_SIMD + stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]); + #else + idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]); + #endif + // every data block is an MCU, so countdown the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) grow_buffer_unsafe(z); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!RESTART(z->marker)) return 1; + reset(z); + } + } + } + } else { // interleaved! + int i,j,k,x,y; + short data[64]; + for (j=0; j < z->img_mcu_y; ++j) { + for (i=0; i < z->img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < z->scan_n; ++k) { + int n = z->order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < z->img_comp[n].v; ++y) { + for (x=0; x < z->img_comp[n].h; ++x) { + int x2 = (i*z->img_comp[n].h + x)*8; + int y2 = (j*z->img_comp[n].v + y)*8; + if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0; + #if STBI_SIMD + stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]); + #else + idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]); + #endif + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) grow_buffer_unsafe(z); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!RESTART(z->marker)) return 1; + reset(z); + } + } + } + } + return 1; +} + +static int process_marker(jpeg *z, int m) +{ + int L; + switch (m) { + case MARKER_none: // no marker found + return e("expected marker","Corrupt JPEG"); + + case 0xC2: // SOF - progressive + return e("progressive jpeg","JPEG format not supported (progressive)"); + + case 0xDD: // DRI - specify restart interval + if (get16(&z->s) != 4) return e("bad DRI len","Corrupt JPEG"); + z->restart_interval = get16(&z->s); + return 1; + + case 0xDB: // DQT - define quantization table + L = get16(&z->s)-2; + while (L > 0) { + int q = get8(&z->s); + int p = q >> 4; + int t = q & 15,i; + if (p != 0) return e("bad DQT type","Corrupt JPEG"); + if (t > 3) return e("bad DQT table","Corrupt JPEG"); + for (i=0; i < 64; ++i) + z->dequant[t][dezigzag[i]] = get8u(&z->s); + #if STBI_SIMD + for (i=0; i < 64; ++i) + z->dequant2[t][i] = z->dequant[t][i]; + #endif + L -= 65; + } + return L==0; + + case 0xC4: // DHT - define huffman table + L = get16(&z->s)-2; + while (L > 0) { + uint8_t *v; + int sizes[16],i,m=0; + int q = get8(&z->s); + int tc = q >> 4; + int th = q & 15; + if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG"); + for (i=0; i < 16; ++i) { + sizes[i] = get8(&z->s); + m += sizes[i]; + } + L -= 17; + if (tc == 0) { + if (!build_huffman(z->huff_dc+th, sizes)) return 0; + v = z->huff_dc[th].values; + } else { + if (!build_huffman(z->huff_ac+th, sizes)) return 0; + v = z->huff_ac[th].values; + } + for (i=0; i < m; ++i) + v[i] = get8u(&z->s); + L -= m; + } + return L==0; + } + // check for comment block or APP blocks + if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { + skip(&z->s, get16(&z->s)-2); + return 1; + } + return 0; +} + +// after we see SOS +static int process_scan_header(jpeg *z) +{ + int i; + int Ls = get16(&z->s); + z->scan_n = get8(&z->s); + if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e("bad SOS component count","Corrupt JPEG"); + if (Ls != 6+2*z->scan_n) return e("bad SOS len","Corrupt JPEG"); + for (i=0; i < z->scan_n; ++i) { + int id = get8(&z->s), which; + int q = get8(&z->s); + for (which = 0; which < z->s.img_n; ++which) + if (z->img_comp[which].id == id) + break; + if (which == z->s.img_n) return 0; + z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG"); + z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG"); + z->order[i] = which; + } + if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG"); + get8(&z->s); // should be 63, but might be 0 + if (get8(&z->s) != 0) return e("bad SOS","Corrupt JPEG"); + + return 1; +} + +static int process_frame_header(jpeg *z, int scan) +{ + stbi *s = &z->s; + int Lf,p,i,q, h_max=1,v_max=1,c; + Lf = get16(s); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG + p = get8(s); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline + s->img_y = get16(s); if (s->img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG + s->img_x = get16(s); if (s->img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires + c = get8(s); + if (c != 3 && c != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires + s->img_n = c; + for (i=0; i < c; ++i) { + z->img_comp[i].data = NULL; + z->img_comp[i].linebuf = NULL; + } + + if (Lf != 8+3*s->img_n) return e("bad SOF len","Corrupt JPEG"); + + for (i=0; i < s->img_n; ++i) { + z->img_comp[i].id = get8(s); + if (z->img_comp[i].id != i+1) // JFIF requires + if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files! + return e("bad component ID","Corrupt JPEG"); + q = get8(s); + z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e("bad H","Corrupt JPEG"); + z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e("bad V","Corrupt JPEG"); + z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG"); + } + + if (scan != SCAN_load) return 1; + + if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode"); + + for (i=0; i < s->img_n; ++i) { + if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; + if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; + } + + // compute interleaved mcu info + z->img_h_max = h_max; + z->img_v_max = v_max; + z->img_mcu_w = h_max * 8; + z->img_mcu_h = v_max * 8; + z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; + z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; + + for (i=0; i < s->img_n; ++i) { + // number of effective pixels (e.g. for non-interleaved MCU) + z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; + z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; + // to simplify generation, we'll allocate enough memory to decode + // the bogus oversized data from using interleaved MCUs and their + // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't + // discard the extra data until colorspace conversion + z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; + z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; + z->img_comp[i].raw_data = malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15); + if (z->img_comp[i].raw_data == NULL) { + for(--i; i >= 0; --i) { + free(z->img_comp[i].raw_data); + z->img_comp[i].data = NULL; + } + return e("outofmem", "Out of memory"); + } + // align blocks for installable-idct using mmx/sse + z->img_comp[i].data = (uint8_t*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); + z->img_comp[i].linebuf = NULL; + } + + return 1; +} + +// use comparisons since in some cases we handle more than one case (e.g. SOF) +#define DNL(x) ((x) == 0xdc) +#define SOI(x) ((x) == 0xd8) +#define EOI(x) ((x) == 0xd9) +#define SOF(x) ((x) == 0xc0 || (x) == 0xc1) +#define SOS(x) ((x) == 0xda) + +static int decode_jpeg_header(jpeg *z, int scan) +{ + int m; + z->marker = MARKER_none; // initialize cached marker to empty + m = get_marker(z); + if (!SOI(m)) return e("no SOI","Corrupt JPEG"); + if (scan == SCAN_type) return 1; + m = get_marker(z); + while (!SOF(m)) { + if (!process_marker(z,m)) return 0; + m = get_marker(z); + while (m == MARKER_none) { + // some files have extra padding after their blocks, so ok, we'll scan + if (at_eof(&z->s)) return e("no SOF", "Corrupt JPEG"); + m = get_marker(z); + } + } + if (!process_frame_header(z, scan)) return 0; + return 1; +} + +static int decode_jpeg_image(jpeg *j) +{ + int m; + j->restart_interval = 0; + if (!decode_jpeg_header(j, SCAN_load)) return 0; + m = get_marker(j); + while (!EOI(m)) { + if (SOS(m)) { + if (!process_scan_header(j)) return 0; + if (!parse_entropy_coded_data(j)) return 0; + } else { + if (!process_marker(j, m)) return 0; + } + m = get_marker(j); + } + return 1; +} + +// static jfif-centered resampling (across block boundaries) + +typedef uint8_t *(*resample_row_func)(uint8_t *out, uint8_t *in0, uint8_t *in1, + int w, int hs); + +#define div4(x) ((uint8_t) ((x) >> 2)) + +static uint8_t *resample_row_1(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) +{ + return in_near; +} + +static uint8_t* resample_row_v_2(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) +{ + // need to generate two samples vertically for every one in input + int i; + for (i=0; i < w; ++i) + out[i] = div4(3*in_near[i] + in_far[i] + 2); + return out; +} + +static uint8_t* resample_row_h_2(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) +{ + // need to generate two samples horizontally for every one in input + int i; + uint8_t *input = in_near; + if (w == 1) { + // if only one sample, can't do any interpolation + out[0] = out[1] = input[0]; + return out; + } + + out[0] = input[0]; + out[1] = div4(input[0]*3 + input[1] + 2); + for (i=1; i < w-1; ++i) { + int n = 3*input[i]+2; + out[i*2+0] = div4(n+input[i-1]); + out[i*2+1] = div4(n+input[i+1]); + } + out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2); + out[i*2+1] = input[w-1]; + return out; +} + +#define div16(x) ((uint8_t) ((x) >> 4)) + +static uint8_t *resample_row_hv_2(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) +{ + // need to generate 2x2 samples for every one in input + int i,t0,t1; + if (w == 1) { + out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2); + return out; + } + + t1 = 3*in_near[0] + in_far[0]; + out[0] = div4(t1+2); + for (i=1; i < w; ++i) { + t0 = t1; + t1 = 3*in_near[i]+in_far[i]; + out[i*2-1] = div16(3*t0 + t1 + 8); + out[i*2 ] = div16(3*t1 + t0 + 8); + } + out[w*2-1] = div4(t1+2); + return out; +} + +static uint8_t *resample_row_generic(uint8_t *out, uint8_t *in_near, uint8_t *in_far, int w, int hs) +{ + // resample with nearest-neighbor + int i,j; + for (i=0; i < w; ++i) + for (j=0; j < hs; ++j) + out[i*hs+j] = in_near[i]; + return out; +} + +#define float2fixed(x) ((int) ((x) * 65536 + 0.5)) + +// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro) +// VC6 without processor=Pro is generating multiple LEAs per multiply! +static void YCbCr_to_RGB_row(uint8_t *out, const uint8_t *y, const uint8_t *pcb, const uint8_t *pcr, int count, int step) +{ + int i; + for (i=0; i < count; ++i) { + int y_fixed = (y[i] << 16) + 32768; // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr*float2fixed(1.40200f); + g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f); + b = y_fixed + cb*float2fixed(1.77200f); + r >>= 16; + g >>= 16; + b >>= 16; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (uint8_t)r; + out[1] = (uint8_t)g; + out[2] = (uint8_t)b; + out[3] = 255; + out += step; + } +} + +#if STBI_SIMD +static stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row; + +void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func) +{ + stbi_YCbCr_installed = func; +} +#endif + + +// clean up the temporary component buffers +static void cleanup_jpeg(jpeg *j) +{ + int i; + for (i=0; i < j->s.img_n; ++i) { + if (j->img_comp[i].data) { + free(j->img_comp[i].raw_data); + j->img_comp[i].data = NULL; + } + if (j->img_comp[i].linebuf) { + free(j->img_comp[i].linebuf); + j->img_comp[i].linebuf = NULL; + } + } +} + +typedef struct +{ + resample_row_func resample; + uint8_t *line0,*line1; + int hs,vs; // expansion factor in each axis + int w_lores; // horizontal pixels pre-expansion + int ystep; // how far through vertical expansion we are + int ypos; // which pre-expansion row we're on +} stbi_resample; + +static uint8_t *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) +{ + int n, decode_n; + // validate req_comp + if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); + z->s.img_n = 0; + + // load a jpeg image from whichever source + if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; } + + // determine actual number of components to generate + n = req_comp ? req_comp : z->s.img_n; + + if (z->s.img_n == 3 && n < 3) + decode_n = 1; + else + decode_n = z->s.img_n; + + // resample and color-convert + { + int k; + unsigned int i,j; + uint8_t *output; + uint8_t *coutput[4]; + + stbi_resample res_comp[4]; + + for (k=0; k < decode_n; ++k) { + stbi_resample *r = &res_comp[k]; + + // allocate line buffer big enough for upsampling off the edges + // with upsample factor of 4 + z->img_comp[k].linebuf = (uint8_t *) malloc(z->s.img_x + 3); + if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } + + r->hs = z->img_h_max / z->img_comp[k].h; + r->vs = z->img_v_max / z->img_comp[k].v; + r->ystep = r->vs >> 1; + r->w_lores = (z->s.img_x + r->hs-1) / r->hs; + r->ypos = 0; + r->line0 = r->line1 = z->img_comp[k].data; + + if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; + else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2; + else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2; + else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2; + else r->resample = resample_row_generic; + } + + // can't error after this so, this is safe + output = (uint8_t *) malloc(n * z->s.img_x * z->s.img_y + 1); + if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } + + // now go ahead and resample + for (j=0; j < z->s.img_y; ++j) { + uint8_t *out = output + n * z->s.img_x * j; + for (k=0; k < decode_n; ++k) { + stbi_resample *r = &res_comp[k]; + int y_bot = r->ystep >= (r->vs >> 1); + coutput[k] = r->resample(z->img_comp[k].linebuf, + y_bot ? r->line1 : r->line0, + y_bot ? r->line0 : r->line1, + r->w_lores, r->hs); + if (++r->ystep >= r->vs) { + r->ystep = 0; + r->line0 = r->line1; + if (++r->ypos < z->img_comp[k].y) + r->line1 += z->img_comp[k].w2; + } + } + if (n >= 3) { + uint8_t *y = coutput[0]; + if (z->s.img_n == 3) { + #if STBI_SIMD + stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n); + #else + YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n); + #endif + } else + for (i=0; i < z->s.img_x; ++i) { + out[0] = out[1] = out[2] = y[i]; + out[3] = 255; // not used if n==3 + out += n; + } + } else { + uint8_t *y = coutput[0]; + if (n == 1) + for (i=0; i < z->s.img_x; ++i) out[i] = y[i]; + else + for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255; + } + } + cleanup_jpeg(z); + *out_x = z->s.img_x; + *out_y = z->s.img_y; + if (comp) *comp = z->s.img_n; // report original components, not output + return output; + } +} + +#ifndef STBI_NO_STDIO +unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + jpeg j; + start_file(&j.s, f); + return load_jpeg_image(&j, x,y,comp,req_comp); +} + +unsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return data; +} +#endif + +unsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + jpeg j; + start_mem(&j.s, buffer,len); + return load_jpeg_image(&j, x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +int stbi_jpeg_test_file(FILE *f) +{ + int n,r; + jpeg j; + n = ftell(f); + start_file(&j.s, f); + r = decode_jpeg_header(&j, SCAN_type); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_jpeg_test_memory(stbi_uc const *buffer, int len) +{ + jpeg j; + start_mem(&j.s, buffer,len); + return decode_jpeg_header(&j, SCAN_type); +} + +// @TODO: +#ifndef STBI_NO_STDIO +extern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp); +extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); + +// public domain zlib decode v0.2 Sean Barrett 2006-11-18 +// simple implementation +// - all input must be provided in an upfront buffer +// - all output is written to a single output buffer (can malloc/realloc) +// performance +// - fast huffman + +// fast-way is faster to check than jpeg huffman, but slow way is slower +#define ZFAST_BITS 9 // accelerate all cases in default tables +#define ZFAST_MASK ((1 << ZFAST_BITS) - 1) + +// zlib-style huffman encoding +// (jpegs packs from left, zlib from right, so can't share code) +typedef struct +{ + uint16_t fast[1 << ZFAST_BITS]; + uint16_t firstcode[16]; + int maxcode[17]; + uint16_t firstsymbol[16]; + uint8_t size[288]; + uint16_t value[288]; +} zhuffman; + +__forceinline static int bitreverse16(int n) +{ + n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); + n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); + n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); + n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); + return n; +} + +__forceinline static int bit_reverse(int v, int bits) +{ + assert(bits <= 16); + // to bit reverse n bits, reverse 16 and shift + // e.g. 11 bits, bit reverse and shift away 5 + return bitreverse16(v) >> (16-bits); +} + +static int zbuild_huffman(zhuffman *z, uint8_t *sizelist, int num) +{ + int i,k=0; + int code, next_code[16], sizes[17]; + + // DEFLATE spec for generating codes + memset(sizes, 0, sizeof(sizes)); + memset(z->fast, 255, sizeof(z->fast)); + for (i=0; i < num; ++i) + ++sizes[sizelist[i]]; + sizes[0] = 0; + for (i=1; i < 16; ++i) + assert(sizes[i] <= (1 << i)); + code = 0; + for (i=1; i < 16; ++i) { + next_code[i] = code; + z->firstcode[i] = (uint16_t) code; + z->firstsymbol[i] = (uint16_t) k; + code = (code + sizes[i]); + if (sizes[i]) + if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG"); + z->maxcode[i] = code << (16-i); // preshift for inner loop + code <<= 1; + k += sizes[i]; + } + z->maxcode[16] = 0x10000; // sentinel + for (i=0; i < num; ++i) { + int s = sizelist[i]; + if (s) { + int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; + z->size[c] = (uint8_t)s; + z->value[c] = (uint16_t)i; + if (s <= ZFAST_BITS) { + int k = bit_reverse(next_code[s],s); + while (k < (1 << ZFAST_BITS)) { + z->fast[k] = (uint16_t) c; + k += (1 << s); + } + } + ++next_code[s]; + } + } + return 1; +} + +// zlib-from-memory implementation for PNG reading +// because PNG allows splitting the zlib stream arbitrarily, +// and it's annoying structurally to have PNG call ZLIB call PNG, +// we require PNG read all the IDATs and combine them into a single +// memory buffer + +typedef struct +{ + uint8_t *zbuffer, *zbuffer_end; + int num_bits; + uint32_t code_buffer; + + char *zout; + char *zout_start; + char *zout_end; + int z_expandable; + + zhuffman z_length, z_distance; +} zbuf; + +__forceinline static int zget8(zbuf *z) +{ + if (z->zbuffer >= z->zbuffer_end) return 0; + return *z->zbuffer++; +} + +static void fill_bits(zbuf *z) +{ + do { + assert(z->code_buffer < (1U << z->num_bits)); + z->code_buffer |= zget8(z) << z->num_bits; + z->num_bits += 8; + } while (z->num_bits <= 24); +} + +__forceinline static unsigned int zreceive(zbuf *z, int n) +{ + unsigned int k; + if (z->num_bits < n) fill_bits(z); + k = z->code_buffer & ((1 << n) - 1); + z->code_buffer >>= n; + z->num_bits -= n; + return k; +} + +__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z) +{ + int b,s,k; + if (a->num_bits < 16) fill_bits(a); + b = z->fast[a->code_buffer & ZFAST_MASK]; + if (b < 0xffff) { + s = z->size[b]; + a->code_buffer >>= s; + a->num_bits -= s; + return z->value[b]; + } + + // not resolved by fast table, so compute it the slow way + // use jpeg approach, which requires MSbits at top + k = bit_reverse(a->code_buffer, 16); + for (s=ZFAST_BITS+1; ; ++s) + if (k < z->maxcode[s]) + break; + if (s == 16) return -1; // invalid code! + // code size is s, so: + b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; + assert(z->size[b] == s); + a->code_buffer >>= s; + a->num_bits -= s; + return z->value[b]; +} + +static int expand(zbuf *z, int n) // need to make room for n bytes +{ + char *q; + int cur, limit; + if (!z->z_expandable) return e("output buffer limit","Corrupt PNG"); + cur = (int) (z->zout - z->zout_start); + limit = (int) (z->zout_end - z->zout_start); + while (cur + n > limit) + limit *= 2; + q = (char *) realloc(z->zout_start, limit); + if (q == NULL) return e("outofmem", "Out of memory"); + z->zout_start = q; + z->zout = q + cur; + z->zout_end = q + limit; + return 1; +} + +static int length_base[31] = { + 3,4,5,6,7,8,9,10,11,13, + 15,17,19,23,27,31,35,43,51,59, + 67,83,99,115,131,163,195,227,258,0,0 }; + +static int length_extra[31]= +{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; + +static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, +257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; + +static int dist_extra[32] = +{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +static int parse_huffman_block(zbuf *a) +{ + for(;;) { + int z = zhuffman_decode(a, &a->z_length); + if (z < 256) { + if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes + if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0; + *a->zout++ = (char) z; + } else { + uint8_t *p; + int len,dist; + if (z == 256) return 1; + z -= 257; + len = length_base[z]; + if (length_extra[z]) len += zreceive(a, length_extra[z]); + z = zhuffman_decode(a, &a->z_distance); + if (z < 0) return e("bad huffman code","Corrupt PNG"); + dist = dist_base[z]; + if (dist_extra[z]) dist += zreceive(a, dist_extra[z]); + if (a->zout - a->zout_start < dist) return e("bad dist","Corrupt PNG"); + if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0; + p = (uint8_t *) (a->zout - dist); + while (len--) + *a->zout++ = *p++; + } + } +} + +static int compute_huffman_codes(zbuf *a) +{ + static uint8_t length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; + zhuffman z_codelength; + uint8_t lencodes[286+32+137];//padding for maximum single op + uint8_t codelength_sizes[19]; + int i,n; + + int hlit = zreceive(a,5) + 257; + int hdist = zreceive(a,5) + 1; + int hclen = zreceive(a,4) + 4; + + memset(codelength_sizes, 0, sizeof(codelength_sizes)); + for (i=0; i < hclen; ++i) { + int s = zreceive(a,3); + codelength_sizes[length_dezigzag[i]] = (uint8_t) s; + } + if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; + + n = 0; + while (n < hlit + hdist) { + int c = zhuffman_decode(a, &z_codelength); + assert(c >= 0 && c < 19); + if (c < 16) + lencodes[n++] = (uint8_t) c; + else if (c == 16) { + c = zreceive(a,2)+3; + memset(lencodes+n, lencodes[n-1], c); + n += c; + } else if (c == 17) { + c = zreceive(a,3)+3; + memset(lencodes+n, 0, c); + n += c; + } else { + assert(c == 18); + c = zreceive(a,7)+11; + memset(lencodes+n, 0, c); + n += c; + } + } + if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); + if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; + if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; + return 1; +} + +static int parse_uncompressed_block(zbuf *a) +{ + uint8_t header[4]; + int len,nlen,k; + if (a->num_bits & 7) + zreceive(a, a->num_bits & 7); // discard + // drain the bit-packed data into header + k = 0; + while (a->num_bits > 0) { + header[k++] = (uint8_t) (a->code_buffer & 255); // wtf this warns? + a->code_buffer >>= 8; + a->num_bits -= 8; + } + assert(a->num_bits == 0); + // now fill header the normal way + while (k < 4) + header[k++] = (uint8_t) zget8(a); + len = header[1] * 256 + header[0]; + nlen = header[3] * 256 + header[2]; + if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG"); + if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG"); + if (a->zout + len > a->zout_end) + if (!expand(a, len)) return 0; + memcpy(a->zout, a->zbuffer, len); + a->zbuffer += len; + a->zout += len; + return 1; +} + +static int parse_zlib_header(zbuf *a) +{ + int cmf = zget8(a); + int cm = cmf & 15; + /* int cinfo = cmf >> 4; */ + int flg = zget8(a); + if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec + if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png + if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png + // window = 1 << (8 + cinfo)... but who cares, we fully buffer output + return 1; +} + +// @TODO: should statically initialize these for optimal thread safety +static uint8_t default_length[288], default_distance[32]; +static void init_defaults(void) +{ + int i; // use <= to match clearly with spec + for (i=0; i <= 143; ++i) default_length[i] = 8; + for ( ; i <= 255; ++i) default_length[i] = 9; + for ( ; i <= 279; ++i) default_length[i] = 7; + for ( ; i <= 287; ++i) default_length[i] = 8; + + for (i=0; i <= 31; ++i) default_distance[i] = 5; +} + +int stbi_png_partial; // a quick hack to only allow decoding some of a PNG... I should implement real streaming support instead +static int parse_zlib(zbuf *a, int parse_header) +{ + int final, type; + if (parse_header) + if (!parse_zlib_header(a)) return 0; + a->num_bits = 0; + a->code_buffer = 0; + do { + final = zreceive(a,1); + type = zreceive(a,2); + if (type == 0) { + if (!parse_uncompressed_block(a)) return 0; + } else if (type == 3) { + return 0; + } else { + if (type == 1) { + // use fixed code lengths + if (!default_distance[31]) init_defaults(); + if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0; + if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0; + } else { + if (!compute_huffman_codes(a)) return 0; + } + if (!parse_huffman_block(a)) return 0; + } + if (stbi_png_partial && a->zout - a->zout_start > 65536) + break; + } while (!final); + return 1; +} + +static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header) +{ + a->zout_start = obuf; + a->zout = obuf; + a->zout_end = obuf + olen; + a->z_expandable = exp; + + return parse_zlib(a, parse_header); +} + +char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) +{ + zbuf a; + char *p = (char *) malloc(initial_size); + if (p == NULL) return NULL; + a.zbuffer = (uint8_t *) buffer; + a.zbuffer_end = (uint8_t *) buffer + len; + if (do_zlib(&a, p, initial_size, 1, 1)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + free(a.zout_start); + return NULL; + } +} + +char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) +{ + return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); +} + +int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) +{ + zbuf a; + a.zbuffer = (uint8_t *) ibuffer; + a.zbuffer_end = (uint8_t *) ibuffer + ilen; + if (do_zlib(&a, obuffer, olen, 0, 1)) + return (int) (a.zout - a.zout_start); + else + return -1; +} + +char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) +{ + zbuf a; + char *p = (char *) malloc(16384); + if (p == NULL) return NULL; + a.zbuffer = (uint8_t *) buffer; + a.zbuffer_end = (uint8_t *) buffer+len; + if (do_zlib(&a, p, 16384, 1, 0)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + free(a.zout_start); + return NULL; + } +} + +int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) +{ + zbuf a; + a.zbuffer = (uint8_t *) ibuffer; + a.zbuffer_end = (uint8_t *) ibuffer + ilen; + if (do_zlib(&a, obuffer, olen, 0, 0)) + return (int) (a.zout - a.zout_start); + else + return -1; +} + +// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 +// simple implementation +// - only 8-bit samples +// - no CRC checking +// - allocates lots of intermediate memory +// - avoids problem of streaming data between subsystems +// - avoids explicit window management +// performance +// - uses stb_zlib, a PD zlib implementation with fast huffman decoding + + +typedef struct +{ + uint32_t length; + uint32_t type; +} chunk; + +#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d)) + +static chunk get_chunk_header(stbi *s) +{ + chunk c; + c.length = get32(s); + c.type = get32(s); + return c; +} + +static int check_png_header(stbi *s) +{ + static uint8_t png_sig[8] = { 137,80,78,71,13,10,26,10 }; + int i; + for (i=0; i < 8; ++i) + if (get8(s) != png_sig[i]) return e("bad png sig","Not a PNG"); + return 1; +} + +typedef struct +{ + stbi s; + uint8_t *idata, *expanded, *out; +} png; + + +enum { + F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4, + F_avg_first, F_paeth_first, +}; + +static uint8_t first_row_filter[5] = +{ + F_none, F_sub, F_none, F_avg_first, F_paeth_first +}; + +static int paeth(int a, int b, int c) +{ + int p = a + b - c; + int pa = abs(p-a); + int pb = abs(p-b); + int pc = abs(p-c); + if (pa <= pb && pa <= pc) return a; + if (pb <= pc) return b; + return c; +} + +// create the png data from post-deflated data +static int create_png_image_raw(png *a, uint8_t *raw, uint32_t raw_len, int out_n, uint32_t x, uint32_t y) +{ + stbi *s = &a->s; + uint32_t i,j,stride = x*out_n; + int k; + int img_n = s->img_n; // copy it into a local for later + assert(out_n == s->img_n || out_n == s->img_n+1); + if (stbi_png_partial) y = 1; + a->out = (uint8_t *) malloc(x * y * out_n); + if (!a->out) return e("outofmem", "Out of memory"); + if (!stbi_png_partial) { + if (s->img_x == x && s->img_y == y) { + if (raw_len != (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG"); + } else { // interlaced: + if (raw_len < (img_n * x + 1) * y) return e("not enough pixels","Corrupt PNG"); + } + } + for (j=0; j < y; ++j) { + uint8_t *cur = a->out + stride*j; + uint8_t *prior = cur - stride; + int filter = *raw++; + if (filter > 4) return e("invalid filter","Corrupt PNG"); + // if first row, use special filter that doesn't sample previous row + if (j == 0) filter = first_row_filter[filter]; + // handle first pixel explicitly + for (k=0; k < img_n; ++k) { + switch(filter) { + case F_none : cur[k] = raw[k]; break; + case F_sub : cur[k] = raw[k]; break; + case F_up : cur[k] = raw[k] + prior[k]; break; + case F_avg : cur[k] = raw[k] + (prior[k]>>1); break; + case F_paeth : cur[k] = (uint8_t) (raw[k] + paeth(0,prior[k],0)); break; + case F_avg_first : cur[k] = raw[k]; break; + case F_paeth_first: cur[k] = raw[k]; break; + } + } + if (img_n != out_n) cur[img_n] = 255; + raw += img_n; + cur += out_n; + prior += out_n; + // this is a little gross, so that we don't switch per-pixel or per-component + if (img_n == out_n) { + #define CASE(f) \ + case f: \ + for (i=x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \ + for (k=0; k < img_n; ++k) + switch(filter) { + CASE(F_none) cur[k] = raw[k]; break; + CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break; + CASE(F_up) cur[k] = raw[k] + prior[k]; break; + CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break; + CASE(F_paeth) cur[k] = (uint8_t) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break; + CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break; + CASE(F_paeth_first) cur[k] = (uint8_t) (raw[k] + paeth(cur[k-img_n],0,0)); break; + } + #undef CASE + } else { + assert(img_n+1 == out_n); + #define CASE(f) \ + case f: \ + for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \ + for (k=0; k < img_n; ++k) + switch(filter) { + CASE(F_none) cur[k] = raw[k]; break; + CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break; + CASE(F_up) cur[k] = raw[k] + prior[k]; break; + CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break; + CASE(F_paeth) cur[k] = (uint8_t) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break; + CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break; + CASE(F_paeth_first) cur[k] = (uint8_t) (raw[k] + paeth(cur[k-out_n],0,0)); break; + } + #undef CASE + } + } + return 1; +} + +static int create_png_image(png *a, uint8_t *raw, uint32_t raw_len, int out_n, int interlaced) +{ + uint8_t *final; + int p; + int save; + if (!interlaced) + return create_png_image_raw(a, raw, raw_len, out_n, a->s.img_x, a->s.img_y); + save = stbi_png_partial; + stbi_png_partial = 0; + + // de-interlacing + final = (uint8_t *) malloc(a->s.img_x * a->s.img_y * out_n); + for (p=0; p < 7; ++p) { + int xorig[] = { 0,4,0,2,0,1,0 }; + int yorig[] = { 0,0,4,0,2,0,1 }; + int xspc[] = { 8,8,4,4,2,2,1 }; + int yspc[] = { 8,8,8,4,4,2,2 }; + int i,j,x,y; + // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1 + x = (a->s.img_x - xorig[p] + xspc[p]-1) / xspc[p]; + y = (a->s.img_y - yorig[p] + yspc[p]-1) / yspc[p]; + if (x && y) { + if (!create_png_image_raw(a, raw, raw_len, out_n, x, y)) { + free(final); + return 0; + } + for (j=0; j < y; ++j) + for (i=0; i < x; ++i) + memcpy(final + (j*yspc[p]+yorig[p])*a->s.img_x*out_n + (i*xspc[p]+xorig[p])*out_n, + a->out + (j*x+i)*out_n, out_n); + free(a->out); + raw += (x*out_n+1)*y; + raw_len -= (x*out_n+1)*y; + } + } + a->out = final; + + stbi_png_partial = save; + return 1; +} + +static int compute_transparency(png *z, uint8_t tc[3], int out_n) +{ + stbi *s = &z->s; + uint32_t i, pixel_count = s->img_x * s->img_y; + uint8_t *p = z->out; + + // compute color-based transparency, assuming we've + // already got 255 as the alpha value in the output + assert(out_n == 2 || out_n == 4); + + if (out_n == 2) { + for (i=0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 255); + p += 2; + } + } else { + for (i=0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int expand_palette(png *a, uint8_t *palette, int len, int pal_img_n) +{ + uint32_t i, pixel_count = a->s.img_x * a->s.img_y; + uint8_t *p, *temp_out, *orig = a->out; + + p = (uint8_t *) malloc(pixel_count * pal_img_n); + if (p == NULL) return e("outofmem", "Out of memory"); + + // between here and free(out) below, exitting would leak + temp_out = p; + + if (pal_img_n == 3) { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p += 3; + } + } else { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p[3] = palette[n+3]; + p += 4; + } + } + free(a->out); + a->out = temp_out; + return 1; +} + +static int parse_png_file(png *z, int scan, int req_comp) +{ + uint8_t palette[1024], pal_img_n=0; + uint8_t has_trans=0, tc[3]; + uint32_t ioff=0, idata_limit=0, i, pal_len=0; + int first=1,k,interlace=0; + stbi *s = &z->s; + + if (!check_png_header(s)) return 0; + + if (scan == SCAN_type) return 1; + + for(;;first=0) { + chunk c = get_chunk_header(s); + if (first && c.type != PNG_TYPE('I','H','D','R')) + return e("first not IHDR","Corrupt PNG"); + switch (c.type) { + case PNG_TYPE('I','H','D','R'): { + int depth,color,comp,filter; + if (!first) return e("multiple IHDR","Corrupt PNG"); + if (c.length != 13) return e("bad IHDR len","Corrupt PNG"); + s->img_x = get32(s); if (s->img_x > (1 << 24)) return e("too large","Very large image (corrupt?)"); + s->img_y = get32(s); if (s->img_y > (1 << 24)) return e("too large","Very large image (corrupt?)"); + depth = get8(s); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only"); + color = get8(s); if (color > 6) return e("bad ctype","Corrupt PNG"); + if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG"); + comp = get8(s); if (comp) return e("bad comp method","Corrupt PNG"); + filter= get8(s); if (filter) return e("bad filter method","Corrupt PNG"); + interlace = get8(s); if (interlace>1) return e("bad interlace method","Corrupt PNG"); + if (!s->img_x || !s->img_y) return e("0-pixel image","Corrupt PNG"); + if (!pal_img_n) { + s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); + if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e("too large", "Image too large to decode"); + if (scan == SCAN_header) return 1; + } else { + // if paletted, then pal_n is our final components, and + // img_n is # components to decompress/filter. + s->img_n = 1; + if ((1 << 30) / s->img_x / 4 < s->img_y) return e("too large","Corrupt PNG"); + // if SCAN_header, have to scan to see if we have a tRNS + } + break; + } + + case PNG_TYPE('P','L','T','E'): { + if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG"); + pal_len = c.length / 3; + if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG"); + for (i=0; i < pal_len; ++i) { + palette[i*4+0] = get8u(s); + palette[i*4+1] = get8u(s); + palette[i*4+2] = get8u(s); + palette[i*4+3] = 255; + } + break; + } + + case PNG_TYPE('t','R','N','S'): { + if (z->idata) return e("tRNS after IDAT","Corrupt PNG"); + if (pal_img_n) { + if (scan == SCAN_header) { s->img_n = 4; return 1; } + if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG"); + if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG"); + pal_img_n = 4; + for (i=0; i < c.length; ++i) + palette[i*4+3] = get8u(s); + } else { + if (!(s->img_n & 1)) return e("tRNS with alpha","Corrupt PNG"); + if (c.length != (uint32_t) s->img_n*2) return e("bad tRNS len","Corrupt PNG"); + has_trans = 1; + for (k=0; k < s->img_n; ++k) + tc[k] = (uint8_t) get16(s); // non 8-bit images will be larger + } + break; + } + + case PNG_TYPE('I','D','A','T'): { + if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG"); + if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; } + if (ioff + c.length > idata_limit) { + uint8_t *p; + if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; + while (ioff + c.length > idata_limit) + idata_limit *= 2; + p = (uint8_t *) realloc(z->idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory"); + z->idata = p; + } + #ifndef STBI_NO_STDIO + if (s->img_file) + { + if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e("outofdata","Corrupt PNG"); + } + else + #endif + { + memcpy(z->idata+ioff, s->img_buffer, c.length); + s->img_buffer += c.length; + } + ioff += c.length; + break; + } + + case PNG_TYPE('I','E','N','D'): { + uint32_t raw_len; + if (scan != SCAN_load) return 1; + if (z->idata == NULL) return e("no IDAT","Corrupt PNG"); + z->expanded = (uint8_t *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len); + if (z->expanded == NULL) return 0; // zlib should set error + free(z->idata); z->idata = NULL; + if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) + s->img_out_n = s->img_n+1; + else + s->img_out_n = s->img_n; + if (!create_png_image(z, z->expanded, raw_len, s->img_out_n, interlace)) return 0; + if (has_trans) + if (!compute_transparency(z, tc, s->img_out_n)) return 0; + if (pal_img_n) { + // pal_img_n == 3 or 4 + s->img_n = pal_img_n; // record the actual colors we had + s->img_out_n = pal_img_n; + if (req_comp >= 3) s->img_out_n = req_comp; + if (!expand_palette(z, palette, pal_len, s->img_out_n)) + return 0; + } + free(z->expanded); z->expanded = NULL; + return 1; + } + + default: + // if critical, fail + if ((c.type & (1 << 29)) == 0) { + #ifndef STBI_NO_FAILURE_STRINGS + // not threadsafe + static char invalid_chunk[] = "XXXX chunk not known"; + invalid_chunk[0] = (uint8_t) (c.type >> 24); + invalid_chunk[1] = (uint8_t) (c.type >> 16); + invalid_chunk[2] = (uint8_t) (c.type >> 8); + invalid_chunk[3] = (uint8_t) (c.type >> 0); + #endif + return e(invalid_chunk, "PNG not supported: unknown chunk type"); + } + skip(s, c.length); + break; + } + // end of chunk, read and skip CRC + get32(s); + } +} + +static unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp) +{ + unsigned char *result=NULL; + p->expanded = NULL; + p->idata = NULL; + p->out = NULL; + if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); + if (parse_png_file(p, SCAN_load, req_comp)) { + result = p->out; + p->out = NULL; + if (req_comp && req_comp != p->s.img_out_n) { + result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y); + p->s.img_out_n = req_comp; + if (result == NULL) return result; + } + *x = p->s.img_x; + *y = p->s.img_y; + if (n) *n = p->s.img_n; + } + free(p->out); p->out = NULL; + free(p->expanded); p->expanded = NULL; + free(p->idata); p->idata = NULL; + + return result; +} + +#ifndef STBI_NO_STDIO +unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + png p; + start_file(&p.s, f); + return do_png(&p, x,y,comp,req_comp); +} + +unsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_png_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return data; +} +#endif + +unsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + png p; + start_mem(&p.s, buffer,len); + return do_png(&p, x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +int stbi_png_test_file(FILE *f) +{ + png p; + int n,r; + n = ftell(f); + start_file(&p.s, f); + r = parse_png_file(&p, SCAN_type,STBI_default); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_png_test_memory(stbi_uc const *buffer, int len) +{ + png p; + start_mem(&p.s, buffer, len); + return parse_png_file(&p, SCAN_type,STBI_default); +} + +// TODO: load header from png +#ifndef STBI_NO_STDIO +int stbi_png_info (char const *filename, int *x, int *y, int *comp) +{ + png p; + FILE *f = fopen(filename, "rb"); + if (!f) return 0; + start_file(&p.s, f); + if (parse_png_file(&p, SCAN_header, 0)) { + if(x) *x = p.s.img_x; + if(y) *y = p.s.img_y; + if (comp) *comp = p.s.img_n; + fclose(f); + return 1; + } + fclose(f); + return 0; +} + +extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp); + +// Microsoft/Windows BMP image + +static int bmp_test(stbi *s) +{ + int sz; + if (get8(s) != 'B') return 0; + if (get8(s) != 'M') return 0; + get32le(s); // discard filesize + get16le(s); // discard reserved + get16le(s); // discard reserved + get32le(s); // discard data offset + sz = get32le(s); + if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1; + return 0; +} + +#ifndef STBI_NO_STDIO +int stbi_bmp_test_file (FILE *f) +{ + stbi s; + int r,n = ftell(f); + start_file(&s,f); + r = bmp_test(&s); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_bmp_test_memory (stbi_uc const *buffer, int len) +{ + stbi s; + start_mem(&s, buffer, len); + return bmp_test(&s); +} + +// returns 0..31 for the highest set bit +static int high_bit(unsigned int z) +{ + int n=0; + if (z == 0) return -1; + if (z >= 0x10000) n += 16, z >>= 16; + if (z >= 0x00100) n += 8, z >>= 8; + if (z >= 0x00010) n += 4, z >>= 4; + if (z >= 0x00004) n += 2, z >>= 2; + if (z >= 0x00002) n += 1, z >>= 1; + return n; +} + +static int bitcount(unsigned int a) +{ + a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 + a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 + a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits + a = (a + (a >> 8)); // max 16 per 8 bits + a = (a + (a >> 16)); // max 32 per 8 bits + return a & 0xff; +} + +static int shiftsigned(int v, int shift, int bits) +{ + int result; + int z=0; + + if (shift < 0) v <<= -shift; + else v >>= shift; + result = v; + + z = bits; + while (z < 8) { + result += v >> z; + z += bits; + } + return result; +} + +static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp) +{ + uint8_t *out; + unsigned int mr=0,mg=0,mb=0,ma=0; + stbi_uc pal[256][4]; + int psize=0,i,j,compress=0,width; + int bpp, flip_vertically, pad, target, offset, hsz; + if (get8(s) != 'B' || get8(s) != 'M') return epuc("not BMP", "Corrupt BMP"); + get32le(s); // discard filesize + get16le(s); // discard reserved + get16le(s); // discard reserved + offset = get32le(s); + hsz = get32le(s); + if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown"); + failure_reason = "bad BMP"; + if (hsz == 12) { + s->img_x = get16le(s); + s->img_y = get16le(s); + } else { + s->img_x = get32le(s); + s->img_y = get32le(s); + } + if (get16le(s) != 1) return 0; + bpp = get16le(s); + if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit"); + flip_vertically = ((int) s->img_y) > 0; + s->img_y = abs((int) s->img_y); + if (hsz == 12) { + if (bpp < 24) + psize = (offset - 14 - 24) / 3; + } else { + compress = get32le(s); + if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE"); + get32le(s); // discard sizeof + get32le(s); // discard hres + get32le(s); // discard vres + get32le(s); // discard colorsused + get32le(s); // discard max important + if (hsz == 40 || hsz == 56) { + if (hsz == 56) { + get32le(s); + get32le(s); + get32le(s); + get32le(s); + } + if (bpp == 16 || bpp == 32) { + mr = mg = mb = 0; + if (compress == 0) { + if (bpp == 32) { + mr = 0xff << 16; + mg = 0xff << 8; + mb = 0xff << 0; + ma = 0xff << 24; + } else { + mr = 31 << 10; + mg = 31 << 5; + mb = 31 << 0; + } + } else if (compress == 3) { + mr = get32le(s); + mg = get32le(s); + mb = get32le(s); + // not documented, but generated by photoshop and handled by mspaint + if (mr == mg && mg == mb) { + // ?!?!? + return NULL; + } + } else + return NULL; + } + } else { + assert(hsz == 108); + mr = get32le(s); + mg = get32le(s); + mb = get32le(s); + ma = get32le(s); + get32le(s); // discard color space + for (i=0; i < 12; ++i) + get32le(s); // discard color space parameters + } + if (bpp < 16) + psize = (offset - 14 - hsz) >> 2; + } + s->img_n = ma ? 4 : 3; + if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 + target = req_comp; + else + target = s->img_n; // if they want monochrome, we'll post-convert + out = (stbi_uc *) malloc(target * s->img_x * s->img_y); + if (!out) return epuc("outofmem", "Out of memory"); + if (bpp < 16) { + int z=0; + if (psize == 0 || psize > 256) { free(out); return epuc("invalid", "Corrupt BMP"); } + for (i=0; i < psize; ++i) { + pal[i][2] = get8(s); + pal[i][1] = get8(s); + pal[i][0] = get8(s); + if (hsz != 12) get8(s); + pal[i][3] = 255; + } + skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4)); + if (bpp == 4) width = (s->img_x + 1) >> 1; + else if (bpp == 8) width = s->img_x; + else { free(out); return epuc("bad bpp", "Corrupt BMP"); } + pad = (-width)&3; + for (j=0; j < (int) s->img_y; ++j) { + for (i=0; i < (int) s->img_x; i += 2) { + int v=get8(s),v2=0; + if (bpp == 4) { + v2 = v & 15; + v >>= 4; + } + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) s->img_x) break; + v = (bpp == 8) ? get8(s) : v2; + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + } + skip(s, pad); + } + } else { + int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; + int z = 0; + int easy=0; + skip(s, offset - 14 - hsz); + if (bpp == 24) width = 3 * s->img_x; + else if (bpp == 16) width = 2*s->img_x; + else /* bpp = 32 and pad = 0 */ width=0; + pad = (-width) & 3; + if (bpp == 24) { + easy = 1; + } else if (bpp == 32) { + if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000) + easy = 2; + } + if (!easy) { + if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP"); + // right shift amt to put high bit in position #7 + rshift = high_bit(mr)-7; rcount = bitcount(mr); + gshift = high_bit(mg)-7; gcount = bitcount(mr); + bshift = high_bit(mb)-7; bcount = bitcount(mr); + ashift = high_bit(ma)-7; acount = bitcount(mr); + } + for (j=0; j < (int) s->img_y; ++j) { + if (easy) { + for (i=0; i < (int) s->img_x; ++i) { + int a; + out[z+2] = get8(s); + out[z+1] = get8(s); + out[z+0] = get8(s); + z += 3; + a = (easy == 2 ? get8(s) : 255); + if (target == 4) out[z++] = a; + } + } else { + for (i=0; i < (int) s->img_x; ++i) { + uint32_t v = (bpp == 16 ? get16le(s) : get32le(s)); + int a; + out[z++] = shiftsigned(v & mr, rshift, rcount); + out[z++] = shiftsigned(v & mg, gshift, gcount); + out[z++] = shiftsigned(v & mb, bshift, bcount); + a = (ma ? shiftsigned(v & ma, ashift, acount) : 255); + if (target == 4) out[z++] = a; + } + } + skip(s, pad); + } + } + if (flip_vertically) { + stbi_uc t; + for (j=0; j < (int) s->img_y>>1; ++j) { + stbi_uc *p1 = out + j *s->img_x*target; + stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; + for (i=0; i < (int) s->img_x*target; ++i) { + t = p1[i], p1[i] = p2[i], p2[i] = t; + } + } + } + + if (req_comp && req_comp != target) { + out = convert_format(out, target, req_comp, s->img_x, s->img_y); + if (out == NULL) return out; // convert_format frees input on failure + } + + *x = s->img_x; + *y = s->img_y; + if (comp) *comp = target; + return out; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_bmp_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_file(&s, f); + return bmp_load(&s, x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_mem(&s, buffer, len); + return bmp_load(&s, x,y,comp,req_comp); +} + +// Targa Truevision - TGA +// by Jonathan Dummer + +static int tga_test(stbi *s) +{ + int sz; + get8u(s); // discard Offset + sz = get8u(s); // color type + if( sz > 1 ) return 0; // only RGB or indexed allowed + sz = get8u(s); // image type + if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE + get16(s); // discard palette start + get16(s); // discard palette length + get8(s); // discard bits per palette color entry + get16(s); // discard x origin + get16(s); // discard y origin + if( get16(s) < 1 ) return 0; // test width + if( get16(s) < 1 ) return 0; // test height + sz = get8(s); // bits per pixel + if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed + return 1; // seems to have passed everything +} + +#ifndef STBI_NO_STDIO +int stbi_tga_test_file (FILE *f) +{ + stbi s; + int r,n = ftell(f); + start_file(&s, f); + r = tga_test(&s); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_tga_test_memory (stbi_uc const *buffer, int len) +{ + stbi s; + start_mem(&s, buffer, len); + return tga_test(&s); +} + +static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp) +{ + // read in the TGA header stuff + int tga_offset = get8u(s); + int tga_indexed = get8u(s); + int tga_image_type = get8u(s); + int tga_is_RLE = 0; + int tga_palette_start = get16le(s); + int tga_palette_len = get16le(s); + int tga_palette_bits = get8u(s); + int tga_x_origin = get16le(s); + int tga_y_origin = get16le(s); + int tga_width = get16le(s); + int tga_height = get16le(s); + int tga_bits_per_pixel = get8u(s); + int tga_inverted = get8u(s); + // image data + unsigned char *tga_data; + unsigned char *tga_palette = NULL; + int i, j; + unsigned char raw_data[4]; + unsigned char trans_data[4]; + int RLE_count = 0; + int RLE_repeating = 0; + int read_next_pixel = 1; + // do a tiny bit of precessing + if( tga_image_type >= 8 ) + { + tga_image_type -= 8; + tga_is_RLE = 1; + } + /* int tga_alpha_bits = tga_inverted & 15; */ + tga_inverted = 1 - ((tga_inverted >> 5) & 1); + + // error check + if( //(tga_indexed) || + (tga_width < 1) || (tga_height < 1) || + (tga_image_type < 1) || (tga_image_type > 3) || + ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) && + (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32)) + ) + { + return NULL; + } + + // If I'm paletted, then I'll use the number of bits from the palette + if( tga_indexed ) + { + tga_bits_per_pixel = tga_palette_bits; + } + + // tga info + *x = tga_width; + *y = tga_height; + if( (req_comp < 1) || (req_comp > 4) ) + { + // just use whatever the file was + req_comp = tga_bits_per_pixel / 8; + *comp = req_comp; + } else + { + // force a new number of components + *comp = tga_bits_per_pixel/8; + } + tga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp ); + + // skip to the data's starting position (offset usually = 0) + skip(s, tga_offset ); + // do I need to load a palette? + if( tga_indexed ) + { + // any data to skip? (offset usually = 0) + skip(s, tga_palette_start ); + // load the palette + tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 ); + getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 ); + } + // load the data + for( i = 0; i < tga_width * tga_height; ++i ) + { + // if I'm in RLE mode, do I need to get a RLE chunk? + if( tga_is_RLE ) + { + if( RLE_count == 0 ) + { + // yep, get the next byte as a RLE command + int RLE_cmd = get8u(s); + RLE_count = 1 + (RLE_cmd & 127); + RLE_repeating = RLE_cmd >> 7; + read_next_pixel = 1; + } else if( !RLE_repeating ) + { + read_next_pixel = 1; + } + } else + { + read_next_pixel = 1; + } + // OK, if I need to read a pixel, do it now + if( read_next_pixel ) + { + // load however much data we did have + if( tga_indexed ) + { + // read in 1 byte, then perform the lookup + int pal_idx = get8u(s); + if( pal_idx >= tga_palette_len ) + { + // invalid index + pal_idx = 0; + } + pal_idx *= tga_bits_per_pixel / 8; + for( j = 0; j*8 < tga_bits_per_pixel; ++j ) + { + raw_data[j] = tga_palette[pal_idx+j]; + } + } else + { + // read in the data raw + for( j = 0; j*8 < tga_bits_per_pixel; ++j ) + { + raw_data[j] = get8u(s); + } + } + // convert raw to the intermediate format + switch( tga_bits_per_pixel ) + { + case 8: + // Luminous => RGBA + trans_data[0] = raw_data[0]; + trans_data[1] = raw_data[0]; + trans_data[2] = raw_data[0]; + trans_data[3] = 255; + break; + case 16: + // Luminous,Alpha => RGBA + trans_data[0] = raw_data[0]; + trans_data[1] = raw_data[0]; + trans_data[2] = raw_data[0]; + trans_data[3] = raw_data[1]; + break; + case 24: + // BGR => RGBA + trans_data[0] = raw_data[2]; + trans_data[1] = raw_data[1]; + trans_data[2] = raw_data[0]; + trans_data[3] = 255; + break; + case 32: + // BGRA => RGBA + trans_data[0] = raw_data[2]; + trans_data[1] = raw_data[1]; + trans_data[2] = raw_data[0]; + trans_data[3] = raw_data[3]; + break; + default: + trans_data[0] = trans_data[1] = 0; + trans_data[2] = trans_data[3] = 0; + break; + } + // clear the reading flag for the next pixel + read_next_pixel = 0; + } // end of reading a pixel + // convert to final format + switch( req_comp ) + { + case 1: + // RGBA => Luminance + tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); + break; + case 2: + // RGBA => Luminance,Alpha + tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); + tga_data[i*req_comp+1] = trans_data[3]; + break; + case 3: + // RGBA => RGB + tga_data[i*req_comp+0] = trans_data[0]; + tga_data[i*req_comp+1] = trans_data[1]; + tga_data[i*req_comp+2] = trans_data[2]; + break; + case 4: + // RGBA => RGBA + tga_data[i*req_comp+0] = trans_data[0]; + tga_data[i*req_comp+1] = trans_data[1]; + tga_data[i*req_comp+2] = trans_data[2]; + tga_data[i*req_comp+3] = trans_data[3]; + break; + } + // in case we're in RLE mode, keep counting down + --RLE_count; + } + // do I need to invert the image? + if( tga_inverted ) + { + for( j = 0; j*2 < tga_height; ++j ) + { + int index1 = j * tga_width * req_comp; + int index2 = (tga_height - 1 - j) * tga_width * req_comp; + for( i = tga_width * req_comp; i > 0; --i ) + { + unsigned char temp = tga_data[index1]; + tga_data[index1] = tga_data[index2]; + tga_data[index2] = temp; + ++index1; + ++index2; + } + } + } + // clear my palette, if I had one + if( tga_palette != NULL ) + { + free( tga_palette ); + } + // the things I do to get rid of an error message, and yet keep + // Microsoft's C compilers happy... [8^( + tga_palette_start = tga_palette_len = tga_palette_bits = + tga_x_origin = tga_y_origin = 0; + // OK, done + return tga_data; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_tga_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_file(&s, f); + return tga_load(&s, x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_mem(&s, buffer, len); + return tga_load(&s, x,y,comp,req_comp); +} + + +// ************************************************************************************************* +// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB + +static int psd_test(stbi *s) +{ + if (get32(s) != 0x38425053) return 0; // "8BPS" + else return 1; +} + +#ifndef STBI_NO_STDIO +int stbi_psd_test_file(FILE *f) +{ + stbi s; + int r,n = ftell(f); + start_file(&s, f); + r = psd_test(&s); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_psd_test_memory(stbi_uc const *buffer, int len) +{ + stbi s; + start_mem(&s, buffer, len); + return psd_test(&s); +} + +static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp) +{ + int pixelCount; + int channelCount, compression; + int channel, i, count, len; + int w,h; + uint8_t *out; + + // Check identifier + if (get32(s) != 0x38425053) // "8BPS" + return epuc("not PSD", "Corrupt PSD image"); + + // Check file type version. + if (get16(s) != 1) + return epuc("wrong version", "Unsupported version of PSD image"); + + // Skip 6 reserved bytes. + skip(s, 6 ); + + // Read the number of channels (R, G, B, A, etc). + channelCount = get16(s); + if (channelCount < 0 || channelCount > 16) + return epuc("wrong channel count", "Unsupported number of channels in PSD image"); + + // Read the rows and columns of the image. + h = get32(s); + w = get32(s); + + // Make sure the depth is 8 bits. + if (get16(s) != 8) + return epuc("unsupported bit depth", "PSD bit depth is not 8 bit"); + + // Make sure the color mode is RGB. + // Valid options are: + // 0: Bitmap + // 1: Grayscale + // 2: Indexed color + // 3: RGB color + // 4: CMYK color + // 7: Multichannel + // 8: Duotone + // 9: Lab color + if (get16(s) != 3) + return epuc("wrong color format", "PSD is not in RGB color format"); + + // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) + skip(s,get32(s) ); + + // Skip the image resources. (resolution, pen tool paths, etc) + skip(s, get32(s) ); + + // Skip the reserved data. + skip(s, get32(s) ); + + // Find out if the data is compressed. + // Known values: + // 0: no compression + // 1: RLE compressed + compression = get16(s); + if (compression > 1) + return epuc("bad compression", "PSD has an unknown compression format"); + + // Create the destination image. + out = (stbi_uc *) malloc(4 * w*h); + if (!out) return epuc("outofmem", "Out of memory"); + pixelCount = w*h; + + // Initialize the data to zero. + //memset( out, 0, pixelCount * 4 ); + + // Finally, the image data. + if (compression) { + // RLE as used by .PSD and .TIFF + // Loop until you get the number of unpacked bytes you are expecting: + // Read the next source byte into n. + // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. + // Else if n is 128, noop. + // Endloop + + // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data, + // which we're going to just skip. + skip(s, h * channelCount * 2 ); + + // Read the RLE data by channel. + for (channel = 0; channel < 4; channel++) { + uint8_t *p; + + p = out+channel; + if (channel >= channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4; + } else { + // Read the RLE data. + count = 0; + while (count < pixelCount) { + len = get8(s); + if (len == 128) { + // No-op. + } else if (len < 128) { + // Copy next len+1 bytes literally. + len++; + count += len; + while (len) { + *p = get8(s); + p += 4; + len--; + } + } else if (len > 128) { + uint32_t val; + // Next -len+1 bytes in the dest are replicated from next source byte. + // (Interpret len as a negative 8-bit int.) + len ^= 0x0FF; + len += 2; + val = get8(s); + count += len; + while (len) { + *p = val; + p += 4; + len--; + } + } + } + } + } + + } else { + // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) + // where each channel consists of an 8-bit value for each pixel in the image. + + // Read the data by channel. + for (channel = 0; channel < 4; channel++) { + uint8_t *p; + + p = out + channel; + if (channel > channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4; + } else { + // Read the data. + count = 0; + for (i = 0; i < pixelCount; i++) + *p = get8(s), p += 4; + } + } + } + + if (req_comp && req_comp != 4) { + out = convert_format(out, 4, req_comp, w, h); + if (out == NULL) return out; // convert_format frees input on failure + } + + if (comp) *comp = channelCount; + *y = h; + *x = w; + + return out; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_psd_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_psd_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_file(&s, f); + return psd_load(&s, x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_mem(&s, buffer, len); + return psd_load(&s, x,y,comp,req_comp); +} + + +// ************************************************************************************************* +// Radiance RGBE HDR loader +// originally by Nicolas Schulz +#ifndef STBI_NO_HDR +static int hdr_test(stbi *s) +{ + char *signature = "#?RADIANCE\n"; + int i; + for (i=0; signature[i]; ++i) + if (get8(s) != signature[i]) + return 0; + return 1; +} + +int stbi_hdr_test_memory(stbi_uc const *buffer, int len) +{ + stbi s; + start_mem(&s, buffer, len); + return hdr_test(&s); +} + +#ifndef STBI_NO_STDIO +int stbi_hdr_test_file(FILE *f) +{ + stbi s; + int r,n = ftell(f); + start_file(&s, f); + r = hdr_test(&s); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +#define HDR_BUFLEN 1024 +static char *hdr_gettoken(stbi *z, char *buffer) +{ + int len=0; + char c = '\2'; + + c = get8(z); + + while (!at_eof(z) && c != '\n') { + buffer[len++] = c; + if (len == HDR_BUFLEN-1) { + // flush to end of line + while (!at_eof(z) && get8(z) != '\n') + ; + break; + } + c = get8(z); + } + + buffer[len] = 0; + return buffer; +} + +static void hdr_convert(float *output, stbi_uc *input, int req_comp) +{ + if( input[3] != 0 ) { + float f1; + // Exponent + f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); + if (req_comp <= 2) + output[0] = (input[0] + input[1] + input[2]) * f1 / 3; + else { + output[0] = input[0] * f1; + output[1] = input[1] * f1; + output[2] = input[2] * f1; + } + if (req_comp == 2) output[1] = 1; + if (req_comp == 4) output[3] = 1; + } else { + switch (req_comp) { + case 4: output[3] = 1; /* fallthrough */ + case 3: output[0] = output[1] = output[2] = 0; + break; + case 2: output[1] = 1; /* fallthrough */ + case 1: output[0] = 0; + break; + } + } +} + + +static float *hdr_load(stbi *s, int *x, int *y, int *comp, int req_comp) +{ + char buffer[HDR_BUFLEN]; + char *token; + int valid = 0; + int width, height; + stbi_uc *scanline; + float *hdr_data; + int len; + unsigned char count, value; + int i, j, k, c1,c2, z; + + + // Check identifier + if (strcmp(hdr_gettoken(s,buffer), "#?RADIANCE") != 0) + return epf("not HDR", "Corrupt HDR image"); + + // Parse header + while(1) { + token = hdr_gettoken(s,buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) return epf("unsupported format", "Unsupported HDR format"); + + // Parse width and height + // can't use sscanf() if we're not using stdio! + token = hdr_gettoken(s,buffer); + if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); + token += 3; + height = strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); + token += 3; + width = strtol(token, NULL, 10); + + *x = width; + *y = height; + + *comp = 3; + if (req_comp == 0) req_comp = 3; + + // Read data + hdr_data = (float *) malloc(height * width * req_comp * sizeof(float)); + + // Load image data + // image data is stored as some number of sca + if( width < 8 || width >= 32768) { + // Read flat data + for (j=0; j < height; ++j) { + for (i=0; i < width; ++i) { + stbi_uc rgbe[4]; + main_decode_loop: + getn(s, rgbe, 4); + hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); + } + } + } else { + // Read RLE-encoded data + scanline = NULL; + + for (j = 0; j < height; ++j) { + c1 = get8(s); + c2 = get8(s); + len = get8(s); + if (c1 != 2 || c2 != 2 || (len & 0x80)) { + // not run-length encoded, so we have to actually use THIS data as a decoded + // pixel (note this can't be a valid pixel--one of RGB must be >= 128) + stbi_uc rgbe[4] = { c1,c2,len, get8(s) }; + hdr_convert(hdr_data, rgbe, req_comp); + i = 1; + j = 0; + free(scanline); + goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format + } + len <<= 8; + len |= get8(s); + if (len != width) { free(hdr_data); free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); } + if (scanline == NULL) scanline = (stbi_uc *) malloc(width * 4); + + for (k = 0; k < 4; ++k) { + i = 0; + while (i < width) { + count = get8(s); + if (count > 128) { + // Run + value = get8(s); + count -= 128; + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = value; + } else { + // Dump + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = get8(s); + } + } + } + for (i=0; i < width; ++i) + hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); + } + free(scanline); + } + + return hdr_data; +} + +#ifndef STBI_NO_STDIO +float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_file(&s,f); + return hdr_load(&s,x,y,comp,req_comp); +} +#endif + +float *stbi_hdr_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi s; + start_mem(&s,buffer, len); + return hdr_load(&s,x,y,comp,req_comp); +} + +#endif // STBI_NO_HDR + +/////////////////////// write image /////////////////////// + +#ifndef STBI_NO_WRITE + +static void write8(FILE *f, int x) { uint8_t z = (uint8_t) x; fwrite(&z,1,1,f); } + +static void writefv(FILE *f, char *fmt, va_list v) +{ + while (*fmt) { + switch (*fmt++) { + case ' ': break; + case '1': { uint8_t x = va_arg(v, int); write8(f,x); break; } + case '2': { int16_t x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; } + case '4': { int32_t x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; } + default: + assert(0); + va_end(v); + return; + } + } +} + +static void writef(FILE *f, char *fmt, ...) +{ + va_list v; + va_start(v, fmt); + writefv(f,fmt,v); + va_end(v); +} + +static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad) +{ + uint8_t bg[3] = { 255, 0, 255}, px[3]; + uint32_t zero = 0; + int i,j,k, j_end; + + if (vdir < 0) + j_end = -1, j = y-1; + else + j_end = y, j = 0; + + for (; j != j_end; j += vdir) { + for (i=0; i < x; ++i) { + uint8_t *d = (uint8_t *) data + (j*x+i)*comp; + if (write_alpha < 0) + fwrite(&d[comp-1], 1, 1, f); + switch (comp) { + case 1: + case 2: writef(f, "111", d[0],d[0],d[0]); + break; + case 4: + if (!write_alpha) { + for (k=0; k < 3; ++k) + px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255; + writef(f, "111", px[1-rgb_dir],px[1],px[1+rgb_dir]); + break; + } + /* FALLTHROUGH */ + case 3: + writef(f, "111", d[1-rgb_dir],d[1],d[1+rgb_dir]); + break; + } + if (write_alpha > 0) + fwrite(&d[comp-1], 1, 1, f); + } + fwrite(&zero,scanline_pad,1,f); + } +} + +static int outfile(char const *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, char *fmt, ...) +{ + FILE *f = fopen(filename, "wb"); + if (f) { + va_list v; + va_start(v, fmt); + writefv(f, fmt, v); + va_end(v); + write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad); + fclose(f); + } + return f != NULL; +} + +int stbi_write_bmp(char const *filename, int x, int y, int comp, void *data) +{ + int pad = (-x*3) & 3; + return outfile(filename,-1,-1,x,y,comp,data,0,pad, + "11 4 22 4" "4 44 22 444444", + 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header + 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header +} + +int stbi_write_tga(char const *filename, int x, int y, int comp, void *data) +{ + int has_alpha = !(comp & 1); + return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0, + "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha); +} + +// any other image formats that do interleaved rgb data? +// PNG: requires adler32,crc32 -- significant amount of code +// PSD: no, channels output separately +// TIFF: no, stripwise-interleaved... i think + +#endif // STBI_NO_WRITE + +#endif // STBI_HEADER_FILE_ONLY + diff --git a/cogl/winsys/cogl-texture-pixmap-x11-private.h b/cogl/winsys/cogl-texture-pixmap-x11-private.h new file mode 100644 index 0000000..948e67b --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11-private.h @@ -0,0 +1,85 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H +#define __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H + +#include +#include +#include + +#include + +#ifdef COGL_HAS_GLX_SUPPORT +#include +#endif + +#include "cogl-object-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-pixmap-x11.h" + +typedef struct _CoglDamageRectangle CoglDamageRectangle; + +struct _CoglDamageRectangle +{ + unsigned int x1; + unsigned int y1; + unsigned int x2; + unsigned int y2; +}; + +struct _CoglTexturePixmapX11 +{ + CoglTexture _parent; + + Pixmap pixmap; + CoglTexture *tex; + + unsigned int depth; + Visual *visual; + + XImage *image; + + XShmSegmentInfo shm_info; + + Damage damage; + CoglTexturePixmapX11ReportLevel damage_report_level; + CoglBool damage_owned; + CoglDamageRectangle damage_rect; + + void *winsys; + + /* During the pre_paint method, this will be set to TRUE if we + should use the winsys texture, otherwise we will use the regular + texture */ + CoglBool use_winsys_texture; +}; + +#endif /* __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H */ diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c new file mode 100644 index 0000000..6c1edeb --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11.c @@ -0,0 +1,1101 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * + * Authors: + * Neil Roberts + * Johan Bilien + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-util.h" +#include "cogl-texture-pixmap-x11.h" +#include "cogl-texture-pixmap-x11-private.h" +#include "cogl-bitmap-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-driver.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-2d-sliced.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-context-private.h" +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-object-private.h" +#include "cogl-winsys-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-xlib.h" +#include "cogl-error-private.h" +#include "cogl-texture-gl-private.h" +#include "cogl-private.h" +#include "cogl-gtype-private.h" + +#include +#include + +#include +#include +#include + +#include +#include + +static void _cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap); + +COGL_TEXTURE_DEFINE (TexturePixmapX11, texture_pixmap_x11); +COGL_GTYPE_DEFINE_CLASS (TexturePixmapX11, texture_pixmap_x11); + +static const CoglTextureVtable cogl_texture_pixmap_x11_vtable; + +uint32_t +cogl_texture_pixmap_x11_error_quark (void) +{ + return g_quark_from_static_string ("cogl-texture-pixmap-error-quark"); +} + +static void +cogl_damage_rectangle_union (CoglDamageRectangle *damage_rect, + int x, + int y, + int width, + int height) +{ + /* If the damage region is empty then we'll just copy the new + rectangle directly */ + if (damage_rect->x1 == damage_rect->x2 || + damage_rect->y1 == damage_rect->y2) + { + damage_rect->x1 = x; + damage_rect->y1 = y; + damage_rect->x2 = x + width; + damage_rect->y2 = y + height; + } + else + { + if (damage_rect->x1 > x) + damage_rect->x1 = x; + if (damage_rect->y1 > y) + damage_rect->y1 = y; + if (damage_rect->x2 < x + width) + damage_rect->x2 = x + width; + if (damage_rect->y2 < y + height) + damage_rect->y2 = y + height; + } +} + +static CoglBool +cogl_damage_rectangle_is_whole (const CoglDamageRectangle *damage_rect, + unsigned int width, + unsigned int height) +{ + return (damage_rect->x1 == 0 && damage_rect->y1 == 0 + && damage_rect->x2 == width && damage_rect->y2 == height); +} + +static const CoglWinsysVtable * +_cogl_texture_pixmap_x11_get_winsys (CoglTexturePixmapX11 *tex_pixmap) +{ + /* FIXME: A CoglContext should be reachable from a CoglTexture + * pointer */ + _COGL_GET_CONTEXT (ctx, NULL); + + return ctx->display->renderer->winsys_vtable; +} + +static void +process_damage_event (CoglTexturePixmapX11 *tex_pixmap, + XDamageNotifyEvent *damage_event) +{ + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + Display *display; + enum { DO_NOTHING, NEEDS_SUBTRACT, NEED_BOUNDING_BOX } handle_mode; + const CoglWinsysVtable *winsys; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + display = cogl_xlib_renderer_get_display (ctxt->display->renderer); + + COGL_NOTE (TEXTURE_PIXMAP, "Damage event received for %p", tex_pixmap); + + switch (tex_pixmap->damage_report_level) + { + case COGL_TEXTURE_PIXMAP_X11_DAMAGE_RAW_RECTANGLES: + /* For raw rectangles we don't need do look at the damage region + at all because the damage area is directly given in the event + struct and the reporting of events is not affected by + clearing the damage region */ + handle_mode = DO_NOTHING; + break; + + case COGL_TEXTURE_PIXMAP_X11_DAMAGE_DELTA_RECTANGLES: + case COGL_TEXTURE_PIXMAP_X11_DAMAGE_NON_EMPTY: + /* For delta rectangles and non empty we'll query the damage + region for the bounding box */ + handle_mode = NEED_BOUNDING_BOX; + break; + + case COGL_TEXTURE_PIXMAP_X11_DAMAGE_BOUNDING_BOX: + /* For bounding box we need to clear the damage region but we + don't actually care what it was because the damage event + itself contains the bounding box of the region */ + handle_mode = NEEDS_SUBTRACT; + break; + + default: + g_assert_not_reached (); + } + + /* If the damage already covers the whole rectangle then we don't + need to request the bounding box of the region because we're + going to update the whole texture anyway. */ + if (cogl_damage_rectangle_is_whole (&tex_pixmap->damage_rect, + tex->width, + tex->height)) + { + if (handle_mode != DO_NOTHING) + XDamageSubtract (display, tex_pixmap->damage, None, None); + } + else if (handle_mode == NEED_BOUNDING_BOX) + { + XserverRegion parts; + int r_count; + XRectangle r_bounds; + XRectangle *r_damage; + + /* We need to extract the damage region so we can get the + bounding box */ + + parts = XFixesCreateRegion (display, 0, 0); + XDamageSubtract (display, tex_pixmap->damage, None, parts); + r_damage = XFixesFetchRegionAndBounds (display, + parts, + &r_count, + &r_bounds); + cogl_damage_rectangle_union (&tex_pixmap->damage_rect, + r_bounds.x, + r_bounds.y, + r_bounds.width, + r_bounds.height); + if (r_damage) + XFree (r_damage); + + XFixesDestroyRegion (display, parts); + } + else + { + if (handle_mode == NEEDS_SUBTRACT) + /* We still need to subtract from the damage region but we + don't care what the region actually was */ + XDamageSubtract (display, tex_pixmap->damage, None, None); + + cogl_damage_rectangle_union (&tex_pixmap->damage_rect, + damage_event->area.x, + damage_event->area.y, + damage_event->area.width, + damage_event->area.height); + } + + if (tex_pixmap->winsys) + { + /* If we're using the texture from pixmap extension then there's no + point in getting the region and we can just mark that the texture + needs updating */ + winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + winsys->texture_pixmap_x11_damage_notify (tex_pixmap); + } +} + +static CoglFilterReturn +_cogl_texture_pixmap_x11_filter (XEvent *event, void *data) +{ + CoglTexturePixmapX11 *tex_pixmap = data; + int damage_base; + + _COGL_GET_CONTEXT (ctxt, COGL_FILTER_CONTINUE); + + damage_base = _cogl_xlib_get_damage_base (); + if (event->type == damage_base + XDamageNotify) + { + XDamageNotifyEvent *damage_event = (XDamageNotifyEvent *) event; + + if (damage_event->damage == tex_pixmap->damage) + process_damage_event (tex_pixmap, damage_event); + } + + return COGL_FILTER_CONTINUE; +} + +static void +set_damage_object_internal (CoglContext *ctx, + CoglTexturePixmapX11 *tex_pixmap, + Damage damage, + CoglTexturePixmapX11ReportLevel report_level) +{ + Display *display = cogl_xlib_renderer_get_display (ctx->display->renderer); + + if (tex_pixmap->damage) + { + cogl_xlib_renderer_remove_filter (ctx->display->renderer, + _cogl_texture_pixmap_x11_filter, + tex_pixmap); + + if (tex_pixmap->damage_owned) + { + XDamageDestroy (display, tex_pixmap->damage); + tex_pixmap->damage_owned = FALSE; + } + } + + tex_pixmap->damage = damage; + tex_pixmap->damage_report_level = report_level; + + if (damage) + cogl_xlib_renderer_add_filter (ctx->display->renderer, + _cogl_texture_pixmap_x11_filter, + tex_pixmap); +} + +CoglTexturePixmapX11 * +cogl_texture_pixmap_x11_new (CoglContext *ctxt, + uint32_t pixmap, + CoglBool automatic_updates, + CoglError **error) +{ + CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1); + Display *display = cogl_xlib_renderer_get_display (ctxt->display->renderer); + Window pixmap_root_window; + int pixmap_x, pixmap_y; + unsigned int pixmap_width, pixmap_height; + unsigned int pixmap_border_width; + CoglPixelFormat internal_format; + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + XWindowAttributes window_attributes; + int damage_base; + const CoglWinsysVtable *winsys; + + if (!XGetGeometry (display, pixmap, &pixmap_root_window, + &pixmap_x, &pixmap_y, + &pixmap_width, &pixmap_height, + &pixmap_border_width, &tex_pixmap->depth)) + { + g_free (tex_pixmap); + _cogl_set_error (error, + COGL_TEXTURE_PIXMAP_X11_ERROR, + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, + "Unable to query pixmap size"); + return NULL; + } + + /* Note: the detailed pixel layout doesn't matter here, we are just + * interested in RGB vs RGBA... */ + internal_format = (tex_pixmap->depth >= 32 + ? COGL_PIXEL_FORMAT_RGBA_8888_PRE + : COGL_PIXEL_FORMAT_RGB_888); + + _cogl_texture_init (tex, ctxt, pixmap_width, pixmap_height, + internal_format, + NULL, /* no loader */ + &cogl_texture_pixmap_x11_vtable); + + tex_pixmap->pixmap = pixmap; + tex_pixmap->image = NULL; + tex_pixmap->shm_info.shmid = -1; + tex_pixmap->tex = NULL; + tex_pixmap->damage_owned = FALSE; + tex_pixmap->damage = 0; + + /* We need a visual to use for shared memory images so we'll query + it from the pixmap's root window */ + if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes)) + { + g_free (tex_pixmap); + _cogl_set_error (error, + COGL_TEXTURE_PIXMAP_X11_ERROR, + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, + "Unable to query root window attributes"); + return NULL; + } + + tex_pixmap->visual = window_attributes.visual; + + /* If automatic updates are requested and the Xlib connection + supports damage events then we'll register a damage object on the + pixmap */ + damage_base = _cogl_xlib_get_damage_base (); + if (automatic_updates && damage_base >= 0) + { + Damage damage = XDamageCreate (display, + pixmap, + XDamageReportBoundingBox); + set_damage_object_internal (ctxt, + tex_pixmap, + damage, + COGL_TEXTURE_PIXMAP_X11_DAMAGE_BOUNDING_BOX); + tex_pixmap->damage_owned = TRUE; + } + + /* Assume the entire pixmap is damaged to begin with */ + tex_pixmap->damage_rect.x1 = 0; + tex_pixmap->damage_rect.x2 = pixmap_width; + tex_pixmap->damage_rect.y1 = 0; + tex_pixmap->damage_rect.y2 = pixmap_height; + + winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + if (winsys->texture_pixmap_x11_create) + { + tex_pixmap->use_winsys_texture = + winsys->texture_pixmap_x11_create (tex_pixmap); + } + else + tex_pixmap->use_winsys_texture = FALSE; + + if (!tex_pixmap->use_winsys_texture) + tex_pixmap->winsys = NULL; + + _cogl_texture_set_allocated (tex, internal_format, + pixmap_width, pixmap_height); + + return _cogl_texture_pixmap_x11_object_new (tex_pixmap); +} + +static CoglBool +_cogl_texture_pixmap_x11_allocate (CoglTexture *tex, + CoglError **error) +{ + return TRUE; +} + +/* Tries to allocate enough shared mem to handle a full size + * update size of the X Pixmap. */ +static void +try_alloc_shm (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + XImage *dummy_image; + Display *display; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + display = cogl_xlib_renderer_get_display (ctx->display->renderer); + + if (!XShmQueryExtension (display)) + return; + + /* We are creating a dummy_image so we can have Xlib calculate + * image->bytes_per_line - including any magic padding it may + * want - for the largest possible ximage we might need to use + * when handling updates to the texture. + * + * Note: we pass a NULL shminfo here, but that has no bearing + * on the setup of the XImage, except that ximage->obdata will + * == NULL. + */ + dummy_image = + XShmCreateImage (display, + tex_pixmap->visual, + tex_pixmap->depth, + ZPixmap, + NULL, + NULL, /* shminfo, */ + tex->width, + tex->height); + if (!dummy_image) + goto failed_image_create; + + tex_pixmap->shm_info.shmid = shmget (IPC_PRIVATE, + dummy_image->bytes_per_line + * dummy_image->height, + IPC_CREAT | 0777); + if (tex_pixmap->shm_info.shmid == -1) + goto failed_shmget; + + tex_pixmap->shm_info.shmaddr = shmat (tex_pixmap->shm_info.shmid, 0, 0); + if (tex_pixmap->shm_info.shmaddr == (void *) -1) + goto failed_shmat; + + tex_pixmap->shm_info.readOnly = False; + + if (XShmAttach (display, &tex_pixmap->shm_info) == 0) + goto failed_xshmattach; + + XDestroyImage (dummy_image); + + return; + + failed_xshmattach: + g_warning ("XShmAttach failed"); + shmdt (tex_pixmap->shm_info.shmaddr); + + failed_shmat: + g_warning ("shmat failed"); + shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0); + + failed_shmget: + g_warning ("shmget failed"); + XDestroyImage (dummy_image); + + failed_image_create: + tex_pixmap->shm_info.shmid = -1; +} + +void +cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *tex_pixmap, + int x, + int y, + int width, + int height) +{ + /* We'll queue the update for both the GLX texture and the regular + texture because we can't determine which will be needed until we + actually render something */ + + if (tex_pixmap->winsys) + { + const CoglWinsysVtable *winsys; + winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + winsys->texture_pixmap_x11_damage_notify (tex_pixmap); + } + + cogl_damage_rectangle_union (&tex_pixmap->damage_rect, + x, y, width, height); +} + +CoglBool +cogl_texture_pixmap_x11_is_using_tfp_extension (CoglTexturePixmapX11 *tex_pixmap) +{ + return !!tex_pixmap->winsys; +} + +void +cogl_texture_pixmap_x11_set_damage_object (CoglTexturePixmapX11 *tex_pixmap, + uint32_t damage, + CoglTexturePixmapX11ReportLevel + report_level) +{ + int damage_base; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + damage_base = _cogl_xlib_get_damage_base (); + if (damage_base >= 0) + set_damage_object_internal (ctxt, tex_pixmap, damage, report_level); +} + +static CoglTexture * +create_fallback_texture (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + CoglError *skip_error = NULL; + + if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) || + (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + /* First try creating a fast-path non-sliced texture */ + tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, + width, height)); + + _cogl_texture_set_internal_format (tex, internal_format); + + /* TODO: instead of allocating storage here it would be better + * if we had some api that let us just check that the size is + * supported by the hardware so storage could be allocated + * lazily when uploading data. */ + if (!cogl_texture_allocate (tex, &skip_error)) + { + cogl_error_free (skip_error); + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + CoglTexture2DSliced *tex_2ds = + cogl_texture_2d_sliced_new_with_size (ctx, + width, + height, + COGL_TEXTURE_MAX_WASTE); + tex = COGL_TEXTURE (tex_2ds); + + _cogl_texture_set_internal_format (tex, internal_format); + } + + return tex; +} + +static void +_cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + Display *display; + Visual *visual; + CoglPixelFormat image_format; + XImage *image; + int src_x, src_y; + int x, y, width, height; + int bpp; + int offset; + CoglError *ignore = NULL; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + display = cogl_xlib_renderer_get_display (ctx->display->renderer); + visual = tex_pixmap->visual; + + /* If the damage region is empty then there's nothing to do */ + if (tex_pixmap->damage_rect.x2 == tex_pixmap->damage_rect.x1) + return; + + x = tex_pixmap->damage_rect.x1; + y = tex_pixmap->damage_rect.y1; + width = tex_pixmap->damage_rect.x2 - x; + height = tex_pixmap->damage_rect.y2 - y; + + /* We lazily create the texture the first time it is needed in case + this texture can be entirely handled using the GLX texture + instead */ + if (tex_pixmap->tex == NULL) + { + CoglPixelFormat texture_format; + + texture_format = (tex_pixmap->depth >= 32 + ? COGL_PIXEL_FORMAT_RGBA_8888_PRE + : COGL_PIXEL_FORMAT_RGB_888); + + tex_pixmap->tex = create_fallback_texture (ctx, + tex->width, + tex->height, + texture_format); + } + + if (tex_pixmap->image == NULL) + { + /* If we also haven't got a shm segment then this must be the + first time we've tried to update, so lets try allocating shm + first */ + if (tex_pixmap->shm_info.shmid == -1) + try_alloc_shm (tex_pixmap); + + if (tex_pixmap->shm_info.shmid == -1) + { + COGL_NOTE (TEXTURE_PIXMAP, "Updating %p using XGetImage", tex_pixmap); + + /* We'll fallback to using a regular XImage. We'll download + the entire area instead of a sub region because presumably + if this is the first update then the entire pixmap is + needed anyway and it saves trying to manually allocate an + XImage at the right size */ + tex_pixmap->image = XGetImage (display, + tex_pixmap->pixmap, + 0, 0, + tex->width, tex->height, + AllPlanes, ZPixmap); + image = tex_pixmap->image; + src_x = x; + src_y = y; + } + else + { + COGL_NOTE (TEXTURE_PIXMAP, "Updating %p using XShmGetImage", + tex_pixmap); + + /* Create a temporary image using the beginning of the + shared memory segment and the right size for the region + we want to update. We need to reallocate the XImage every + time because there is no XShmGetSubImage. */ + image = XShmCreateImage (display, + tex_pixmap->visual, + tex_pixmap->depth, + ZPixmap, + NULL, + &tex_pixmap->shm_info, + width, + height); + image->data = tex_pixmap->shm_info.shmaddr; + src_x = 0; + src_y = 0; + + XShmGetImage (display, tex_pixmap->pixmap, image, x, y, AllPlanes); + } + } + else + { + COGL_NOTE (TEXTURE_PIXMAP, "Updating %p using XGetSubImage", tex_pixmap); + + image = tex_pixmap->image; + src_x = x; + src_y = y; + + XGetSubImage (display, + tex_pixmap->pixmap, + x, y, width, height, + AllPlanes, ZPixmap, + image, + x, y); + } + + image_format = + _cogl_util_pixel_format_from_masks (visual->red_mask, + visual->green_mask, + visual->blue_mask, + image->depth, + image->bits_per_pixel, + image->byte_order == LSBFirst); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (image_format); + offset = image->bytes_per_line * src_y + bpp * src_x; + + _cogl_texture_set_region (tex_pixmap->tex, + width, + height, + image_format, + image->bytes_per_line, + ((const uint8_t *) image->data) + offset, + x, y, + 0, /* level */ + &ignore); + + /* If we have a shared memory segment then the XImage would be a + temporary one with no data allocated so we can just XFree it */ + if (tex_pixmap->shm_info.shmid != -1) + XFree (image); + + memset (&tex_pixmap->damage_rect, 0, sizeof (CoglDamageRectangle)); +} + +static void +_cogl_texture_pixmap_x11_set_use_winsys_texture (CoglTexturePixmapX11 *tex_pixmap, + CoglBool new_value) +{ + if (tex_pixmap->use_winsys_texture != new_value) + { + /* Notify cogl-pipeline.c that the texture's underlying GL texture + * storage is changing so it knows it may need to bind a new texture + * if the CoglTexture is reused with the same texture unit. */ + _cogl_pipeline_texture_storage_change_notify (COGL_TEXTURE (tex_pixmap)); + + tex_pixmap->use_winsys_texture = new_value; + } +} + +static void +_cogl_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, + CoglBool needs_mipmap) +{ + if (tex_pixmap->winsys) + { + const CoglWinsysVtable *winsys = + _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + + if (winsys->texture_pixmap_x11_update (tex_pixmap, needs_mipmap)) + { + _cogl_texture_pixmap_x11_set_use_winsys_texture (tex_pixmap, TRUE); + return; + } + } + + /* If it didn't work then fallback to using XGetImage. This may be + temporary */ + _cogl_texture_pixmap_x11_set_use_winsys_texture (tex_pixmap, FALSE); + + _cogl_texture_pixmap_x11_update_image_texture (tex_pixmap); +} + +static CoglTexture * +_cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexture *tex; + int i; + + /* We try getting the texture twice, once without flushing the + updates and once with. If pre_paint has been called already then + we should have a good idea of which texture to use so we don't + want to mess with that by ensuring the updates. However, if we + couldn't find a texture then we'll just make a best guess by + flushing without expecting mipmap support and try again. This + would happen for example if an application calls + get_gl_texture before the first paint */ + + for (i = 0; i < 2; i++) + { + if (tex_pixmap->use_winsys_texture) + { + const CoglWinsysVtable *winsys = + _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + tex = winsys->texture_pixmap_x11_get_texture (tex_pixmap); + } + else + tex = tex_pixmap->tex; + + if (tex) + return tex; + + _cogl_texture_pixmap_x11_update (tex_pixmap, FALSE); + } + + g_assert_not_reached (); + + return NULL; +} + +static CoglBool +_cogl_texture_pixmap_x11_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + int level, + CoglBitmap *bmp, + CoglError **error) +{ + /* This doesn't make much sense for texture from pixmap so it's not + supported */ + _cogl_set_error (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Explicitly setting a region of a TFP texture unsupported"); + return FALSE; +} + +static CoglBool +_cogl_texture_pixmap_x11_get_data (CoglTexture *tex, + CoglPixelFormat format, + int rowstride, + uint8_t *data) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + return cogl_texture_get_data (child_tex, format, rowstride, data); +} + +typedef struct _NormalizeCoordsWrapperData +{ + int width; + int height; + CoglMetaTextureCallback callback; + void *user_data; +} NormalizeCoordsWrapperData; + +static void +normalize_coords_wrapper_cb (CoglTexture *child_texture, + const float *child_texture_coords, + const float *meta_coords, + void *user_data) +{ + NormalizeCoordsWrapperData *data = user_data; + float normalized_coords[4]; + + normalized_coords[0] = meta_coords[0] / data->width; + normalized_coords[1] = meta_coords[1] / data->height; + normalized_coords[2] = meta_coords[2] / data->width; + normalized_coords[3] = meta_coords[3] / data->height; + + data->callback (child_texture, + child_texture_coords, normalized_coords, + data->user_data); +} + +static void +_cogl_texture_pixmap_x11_foreach_sub_texture_in_region + (CoglTexture *tex, + float virtual_tx_1, + float virtual_ty_1, + float virtual_tx_2, + float virtual_ty_2, + CoglMetaTextureCallback callback, + void *user_data) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + + /* tfp textures may be implemented in terms of a + * CoglTextureRectangle texture which uses un-normalized texture + * coordinates but we want to consistently deal with normalized + * texture coordinates with CoglTexturePixmapX11... */ + if (cogl_is_texture_rectangle (child_tex)) + { + NormalizeCoordsWrapperData data; + int width = tex->width; + int height = tex->height; + + virtual_tx_1 *= width; + virtual_ty_1 *= height; + virtual_tx_2 *= width; + virtual_ty_2 *= height; + + data.width = width; + data.height = height; + data.callback = callback; + data.user_data = user_data; + + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex), + virtual_tx_1, + virtual_ty_1, + virtual_tx_2, + virtual_ty_2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + normalize_coords_wrapper_cb, + &data); + } + else + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex), + virtual_tx_1, + virtual_ty_1, + virtual_tx_2, + virtual_ty_2, + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + callback, + user_data); +} + +static int +_cogl_texture_pixmap_x11_get_max_waste (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return cogl_texture_get_max_waste (child_tex); +} + +static CoglBool +_cogl_texture_pixmap_x11_is_sliced (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return cogl_texture_is_sliced (child_tex); +} + +static CoglBool +_cogl_texture_pixmap_x11_can_hardware_repeat (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return _cogl_texture_can_hardware_repeat (child_tex); +} + +static void +_cogl_texture_pixmap_x11_transform_coords_to_gl (CoglTexture *tex, + float *s, + float *t) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_transform_coords_to_gl (child_tex, s, t); +} + +static CoglTransformResult +_cogl_texture_pixmap_x11_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + return _cogl_texture_transform_quad_coords_to_gl (child_tex, coords); +} + +static CoglBool +_cogl_texture_pixmap_x11_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + return cogl_texture_get_gl_texture (child_tex, + out_gl_handle, + out_gl_target); +} + +static void +_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_gl_flush_legacy_texobj_filters (child_tex, + min_filter, mag_filter); +} + +static void +_cogl_texture_pixmap_x11_pre_paint (CoglTexture *tex, + CoglTexturePrePaintFlags flags) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex; + + _cogl_texture_pixmap_x11_update (tex_pixmap, + !!(flags & COGL_TEXTURE_NEEDS_MIPMAP)); + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + _cogl_texture_pre_paint (child_tex, flags); +} + +static void +_cogl_texture_pixmap_x11_ensure_non_quad_rendering (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_ensure_non_quad_rendering (child_tex); +} + +static void +_cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_gl_flush_legacy_texobj_wrap_modes (child_tex, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); +} + +static CoglPixelFormat +_cogl_texture_pixmap_x11_get_format (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + return _cogl_texture_get_format (child_tex); +} + +static GLenum +_cogl_texture_pixmap_x11_get_gl_format (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return _cogl_texture_gl_get_format (child_tex); +} + +static CoglTextureType +_cogl_texture_pixmap_x11_get_type (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglTexture *child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + return _cogl_texture_get_type (child_tex); +} + +static void +_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) +{ + Display *display; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + display = cogl_xlib_renderer_get_display (ctxt->display->renderer); + + set_damage_object_internal (ctxt, tex_pixmap, 0, 0); + + if (tex_pixmap->image) + XDestroyImage (tex_pixmap->image); + + if (tex_pixmap->shm_info.shmid != -1) + { + XShmDetach (display, &tex_pixmap->shm_info); + shmdt (tex_pixmap->shm_info.shmaddr); + shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0); + } + + if (tex_pixmap->tex) + cogl_object_unref (tex_pixmap->tex); + + if (tex_pixmap->winsys) + { + const CoglWinsysVtable *winsys = + _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); + winsys->texture_pixmap_x11_free (tex_pixmap); + } + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_pixmap)); +} + +static const CoglTextureVtable +cogl_texture_pixmap_x11_vtable = + { + FALSE, /* not primitive */ + _cogl_texture_pixmap_x11_allocate, + _cogl_texture_pixmap_x11_set_region, + _cogl_texture_pixmap_x11_get_data, + _cogl_texture_pixmap_x11_foreach_sub_texture_in_region, + _cogl_texture_pixmap_x11_get_max_waste, + _cogl_texture_pixmap_x11_is_sliced, + _cogl_texture_pixmap_x11_can_hardware_repeat, + _cogl_texture_pixmap_x11_transform_coords_to_gl, + _cogl_texture_pixmap_x11_transform_quad_coords_to_gl, + _cogl_texture_pixmap_x11_get_gl_texture, + _cogl_texture_pixmap_x11_gl_flush_legacy_texobj_filters, + _cogl_texture_pixmap_x11_pre_paint, + _cogl_texture_pixmap_x11_ensure_non_quad_rendering, + _cogl_texture_pixmap_x11_gl_flush_legacy_texobj_wrap_modes, + _cogl_texture_pixmap_x11_get_format, + _cogl_texture_pixmap_x11_get_gl_format, + _cogl_texture_pixmap_x11_get_type, + NULL, /* is_foreign */ + NULL /* set_auto_mipmap */ + }; diff --git a/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/winsys/cogl-texture-pixmap-x11.h new file mode 100644 index 0000000..35155cd --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11.h @@ -0,0 +1,238 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_TEXTURE_PIXMAP_X11_H +#define __COGL_TEXTURE_PIXMAP_X11_H + +/* NB: this is a top-level header that can be included directly but we + * want to be careful not to define __COGL_H_INSIDE__ when this is + * included internally while building Cogl itself since + * __COGL_H_INSIDE__ is used in headers to guard public vs private api + * definitions + */ +#ifndef COGL_COMPILATION + +/* Note: When building Cogl .gir we explicitly define + * __COGL_H_INSIDE__ */ +#ifndef __COGL_H_INSIDE__ +#define __COGL_H_INSIDE__ +#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* COGL_COMPILATION */ + +#include + +#ifdef COGL_HAS_GTYPE_SUPPORT +#include +#endif + +COGL_BEGIN_DECLS + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +/** + * SECTION:cogl-texture-pixmap-x11 + * @short_description: Functions for creating and manipulating 2D meta + * textures derived from X11 pixmaps. + * + * These functions allow high-level meta textures (See the + * #CoglMetaTexture interface) that derive their contents from an X11 + * pixmap. + */ + +typedef struct _CoglTexturePixmapX11 CoglTexturePixmapX11; + +#define COGL_TEXTURE_PIXMAP_X11(X) ((CoglTexturePixmapX11 *)X) + +#ifdef COGL_HAS_GTYPE_SUPPORT +/** + * cogl_texture_pixmap_x11_get_gtype: + * + * Returns: a #GType that can be used with the GLib type system. + */ +GType cogl_texture_pixmap_x11_get_gtype (void); +#endif + +typedef enum +{ + COGL_TEXTURE_PIXMAP_X11_DAMAGE_RAW_RECTANGLES, + COGL_TEXTURE_PIXMAP_X11_DAMAGE_DELTA_RECTANGLES, + COGL_TEXTURE_PIXMAP_X11_DAMAGE_BOUNDING_BOX, + COGL_TEXTURE_PIXMAP_X11_DAMAGE_NON_EMPTY +} CoglTexturePixmapX11ReportLevel; + +/** + * COGL_TEXTURE_PIXMAP_X11_ERROR: + * + * #CoglError domain for texture-pixmap-x11 errors. + * + * Since: 1.10 + */ +#define COGL_TEXTURE_PIXMAP_X11_ERROR (cogl_texture_pixmap_x11_error_quark ()) + +/** + * CoglTexturePixmapX11Error: + * @COGL_TEXTURE_PIXMAP_X11_ERROR_X11: An X11 protocol error + * + * Error codes that can be thrown when performing texture-pixmap-x11 + * operations. + * + * Since: 1.10 + */ +typedef enum { + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, +} CoglTexturePixmapX11Error; + +uint32_t cogl_texture_pixmap_x11_error_quark (void); + +/** + * cogl_texture_pixmap_x11_new: + * @context: A #CoglContext + * @pixmap: A X11 pixmap ID + * @automatic_updates: Whether to automatically copy the contents of + * the pixmap to the texture. + * @error: A #CoglError for exceptions + * + * Creates a texture that contains the contents of @pixmap. If + * @automatic_updates is %TRUE then Cogl will attempt to listen for + * damage events on the pixmap and automatically update the texture + * when it changes. + * + * Return value: a new #CoglTexturePixmapX11 instance + * + * Since: 1.10 + * Stability: Unstable + */ +CoglTexturePixmapX11 * +cogl_texture_pixmap_x11_new (CoglContext *context, + uint32_t pixmap, + CoglBool automatic_updates, + CoglError **error); + +/** + * cogl_texture_pixmap_x11_update_area: + * @texture: A #CoglTexturePixmapX11 instance + * @x: x coordinate of the area to update + * @y: y coordinate of the area to update + * @width: width of the area to update + * @height: height of the area to update + * + * Forces an update of the given @texture so that it is refreshed with + * the contents of the pixmap that was given to + * cogl_texture_pixmap_x11_new(). + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *texture, + int x, + int y, + int width, + int height); + +/** + * cogl_texture_pixmap_x11_is_using_tfp_extension: + * @texture: A #CoglTexturePixmapX11 instance + * + * Checks whether the given @texture is using the + * GLX_EXT_texture_from_pixmap or similar extension to copy the + * contents of the pixmap to the texture. This extension is usually + * implemented as zero-copy operation so it implies the updates are + * working efficiently. + * + * Return value: %TRUE if the texture is using an efficient extension + * and %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_texture_pixmap_x11_is_using_tfp_extension (CoglTexturePixmapX11 *texture); + +/** + * cogl_texture_pixmap_x11_set_damage_object: + * @texture: A #CoglTexturePixmapX11 instance + * @damage: A X11 Damage object or 0 + * @report_level: The report level which describes how to interpret + * the damage events. This should match the level that the damage + * object was created with. + * + * Sets the damage object that will be used to track automatic updates + * to the @texture. Damage tracking can be disabled by passing 0 for + * @damage. Otherwise this damage will replace the one used if %TRUE + * was passed for automatic_updates to cogl_texture_pixmap_x11_new(). + * + * Note that Cogl will subtract from the damage region as it processes + * damage events. + * + * Since: 1.4 + * Stability: Unstable + */ +void +cogl_texture_pixmap_x11_set_damage_object (CoglTexturePixmapX11 *texture, + uint32_t damage, + CoglTexturePixmapX11ReportLevel + report_level); + +/** + * cogl_is_texture_pixmap_x11: + * @object: A pointer to a #CoglObject + * + * Checks whether @object points to a #CoglTexturePixmapX11 instance. + * + * Return value: %TRUE if the object is a #CoglTexturePixmapX11, and + * %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +CoglBool +cogl_is_texture_pixmap_x11 (void *object); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +COGL_END_DECLS + +/* The gobject introspection scanner seems to parse public headers in + * isolation which means we need to be extra careful about how we + * define and undefine __COGL_H_INSIDE__ used to detect when internal + * headers are incorrectly included by developers. In the gobject + * introspection case we have to manually define __COGL_H_INSIDE__ as + * a commandline argument for the scanner which means we must be + * careful not to undefine it in a header... + */ +#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#undef __COGL_H_INSIDE__ +#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ +#endif + +#endif /* __COGL_TEXTURE_PIXMAP_X11_H */ diff --git a/cogl/winsys/cogl-winsys-egl-android-private.h b/cogl/winsys/cogl-winsys-egl-android-private.h new file mode 100644 index 0000000..b866c87 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-android-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_ANDROID_PRIVATE_H +#define __COGL_WINSYS_EGL_ANDROID_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_android_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_ANDROID_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-android.c b/cogl/winsys/cogl-winsys-egl-android.c new file mode 100644 index 0000000..cf4a133 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-android.c @@ -0,0 +1,253 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-winsys-egl-android-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-renderer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-private.h" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglDisplayAndroid +{ + int egl_surface_width; + int egl_surface_height; + CoglBool have_onscreen; +} CoglDisplayAndroid; + +static ANativeWindow *android_native_window; + +void +cogl_android_set_native_window (ANativeWindow *window) +{ + _cogl_init (); + + android_native_window = window; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + eglTerminate (egl_renderer->edpy); + + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + + egl_renderer->edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayAndroid *android_display = egl_display->platform; + const char *error_message; + EGLint format; + + if (android_native_window == NULL) + { + error_message = "No ANativeWindow window specified with " + "cogl_android_set_native_window()"; + goto fail; + } + + /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is + * guaranteed to be accepted by ANativeWindow_setBuffersGeometry (). + * As soon as we picked a EGLConfig, we can safely reconfigure the + * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ + eglGetConfigAttrib (egl_renderer->edpy, + egl_display->egl_config, + EGL_NATIVE_VISUAL_ID, &format); + + ANativeWindow_setBuffersGeometry (android_native_window, + 0, + 0, + format); + + egl_display->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) android_native_window, + NULL); + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!_cogl_winsys_egl_make_current (display, + egl_display->egl_surface, + egl_display->egl_surface, + egl_display->egl_context)) + { + error_message = "Unable to eglMakeCurrent with egl surface"; + goto fail; + } + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_WIDTH, + &android_display->egl_surface_width); + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_HEIGHT, + &android_display->egl_surface_height); + + return TRUE; + + fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayAndroid *android_display; + + android_display = g_slice_new0 (CoglDisplayAndroid); + egl_display->platform = android_display; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayAndroid, egl_display->platform); +} + +static CoglBool +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayAndroid *android_display = egl_display->platform; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (android_display->have_onscreen) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "EGL platform only supports a single onscreen window"); + return FALSE; + } + + egl_onscreen->egl_surface = egl_display->egl_surface; + + _cogl_framebuffer_winsys_update_size (framebuffer, + android_display->egl_surface_width, + android_display->egl_surface_height); + + android_display->have_onscreen = TRUE; + + return TRUE; +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .onscreen_init = _cogl_winsys_egl_onscreen_init, + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_android_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_ANDROID winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + vtable = *_cogl_winsys_egl_get_vtable (); + + vtable.id = COGL_WINSYS_ID_EGL_ANDROID; + vtable.name = "EGL_ANDROID"; + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-egl-feature-functions.h b/cogl/winsys/cogl-winsys-egl-feature-functions.h new file mode 100644 index 0000000..17a99f2 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h @@ -0,0 +1,149 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This can be included multiple times with different definitions for + * the COGL_WINSYS_FEATURE_* functions. + */ + +/* Macro prototypes: + * COGL_WINSYS_FEATURE_BEGIN (name, namespaces, extension_names, + * implied_private_egl_feature_flags) + * COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name, + * (arguments)) + * ... + * COGL_WINSYS_FEATURE_END () + * + * Note: You can list multiple namespace and extension names if the + * corresponding _FEATURE_FUNCTIONS have the same semantics accross + * the different extension variants. + * + * XXX: NB: Don't add a trailing semicolon when using these macros + */ + +COGL_WINSYS_FEATURE_BEGIN (swap_region, + "NOK\0", + "swap_region\0", + COGL_EGL_WINSYS_FEATURE_SWAP_REGION) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersRegion, + (EGLDisplay dpy, + EGLSurface surface, + EGLint numRects, + const EGLint *rects)) +COGL_WINSYS_FEATURE_END () +/* XXX: These macros can't handle falling back to looking for + * EGL_KHR_image if EGL_KHR_image_base and EGL_KHR_image_pixmap aren't + * found... */ +#ifdef EGL_KHR_image_base +COGL_WINSYS_FEATURE_BEGIN (image_base, + "KHR\0", + "image_base\0", + 0) +COGL_WINSYS_FEATURE_FUNCTION (EGLImageKHR, eglCreateImage, + (EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint *attrib_list)) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglDestroyImage, + (EGLDisplay dpy, + EGLImageKHR image)) +COGL_WINSYS_FEATURE_END () +#endif +COGL_WINSYS_FEATURE_BEGIN (image_pixmap, + "KHR\0", + "image_pixmap\0", + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP) +COGL_WINSYS_FEATURE_END () +#ifdef EGL_WL_bind_wayland_display +COGL_WINSYS_FEATURE_BEGIN (bind_wayland_display, + "WL\0", + "bind_wayland_display\0", + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER) +COGL_WINSYS_FEATURE_FUNCTION (EGLImageKHR, eglBindWaylandDisplay, + (EGLDisplay dpy, + struct wl_display *wayland_display)) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglUnbindWaylandDisplay, + (EGLDisplay dpy, + struct wl_display *wayland_display)) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglQueryWaylandBuffer, + (EGLDisplay dpy, + struct wl_resource *buffer, + EGLint attribute, EGLint *value)) +COGL_WINSYS_FEATURE_END () +#endif /* EGL_WL_bind_wayland_display */ + +COGL_WINSYS_FEATURE_BEGIN (create_context, + "KHR\0", + "create_context\0", + COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (buffer_age, + "EXT\0", + "buffer_age\0", + COGL_EGL_WINSYS_FEATURE_BUFFER_AGE) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (swap_buffers_with_damage, + "EXT\0", + "swap_buffers_with_damage\0", + 0) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersWithDamage, + (EGLDisplay dpy, + EGLSurface surface, + const EGLint *rects, + EGLint n_rects)) +COGL_WINSYS_FEATURE_END () + +#if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) +COGL_WINSYS_FEATURE_BEGIN (fence_sync, + "KHR\0", + "fence_sync\0", + COGL_EGL_WINSYS_FEATURE_FENCE_SYNC) +COGL_WINSYS_FEATURE_FUNCTION (EGLSyncKHR, eglCreateSync, + (EGLDisplay dpy, + EGLenum type, + const EGLint *attrib_list)) +COGL_WINSYS_FEATURE_FUNCTION (EGLint, eglClientWaitSync, + (EGLDisplay dpy, + EGLSyncKHR sync, + EGLint flags, + EGLTimeKHR timeout)) +COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglDestroySync, + (EGLDisplay dpy, + EGLSyncKHR sync)) +COGL_WINSYS_FEATURE_END () +#endif + +COGL_WINSYS_FEATURE_BEGIN (surfaceless_context, + "KHR\0", + "surfaceless_context\0", + COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) +COGL_WINSYS_FEATURE_END () diff --git a/cogl/winsys/cogl-winsys-egl-gdl-private.h b/cogl/winsys/cogl-winsys-egl-gdl-private.h new file mode 100644 index 0000000..b7fc75c --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-gdl-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_GDL_PRIVATE_H +#define __COGL_WINSYS_EGL_GDL_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_gdl_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_GDL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-gdl.c b/cogl/winsys/cogl-winsys-egl-gdl.c new file mode 100644 index 0000000..e5a0765 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-gdl.c @@ -0,0 +1,380 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-winsys-egl-gdl-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-renderer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-swap-chain-private.h" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglRendererGDL +{ + CoglBool gdl_initialized; +} CoglRendererGDL; + +typedef struct _CoglDisplayGDL +{ + int egl_surface_width; + int egl_surface_height; + CoglBool have_onscreen; +} CoglDisplayGDL; + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererGDL *gdl_renderer = egl_renderer->platform; + + if (gdl_renderer->gdl_initialized) + gdl_close (); + + eglTerminate (egl_renderer->edpy); + + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + CoglRendererGDL *gdl_renderer; + gdl_ret_t rc = GDL_SUCCESS; + gdl_display_info_t gdl_display_info; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + + gdl_renderer = g_slice_new0 (CoglRendererGDL); + egl_renderer->platform = gdl_renderer; + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + + egl_renderer->edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + /* Check we can talk to the GDL library */ + rc = gdl_init (NULL); + if (rc != GDL_SUCCESS) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "GDL initialize failed. %s", + gdl_get_error_string (rc)); + goto error; + } + + rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &gdl_display_info); + if (rc != GDL_SUCCESS) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "GDL failed to get display information: %s", + gdl_get_error_string (rc)); + gdl_close (); + goto error; + } + + gdl_close (); + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayGDL *gdl_display = egl_display->platform; + const char *error_message; + + egl_display->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) display->gdl_plane, + NULL); + + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!_cogl_winsys_egl_make_current (display, + egl_display->egl_surface, + egl_display->egl_surface, + egl_display->egl_context)) + { + error_message = "Unable to eglMakeCurrent with egl surface"; + goto fail; + } + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_WIDTH, + &gdl_display->egl_surface_width); + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_HEIGHT, + &gdl_display->egl_surface_height); + + return TRUE; + + fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static CoglBool +gdl_plane_init (CoglDisplay *display, CoglError **error) +{ + CoglBool ret = TRUE; + gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB; + gdl_pixel_format_t pixfmt = GDL_PF_ARGB_32; + gdl_rectangle_t dstRect; + gdl_display_info_t display_info; + gdl_ret_t rc = GDL_SUCCESS; + + if (!display->gdl_plane) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, + "No GDL plane specified with " + "cogl_gdl_display_set_plane"); + return FALSE; + } + + rc = gdl_init (NULL); + if (rc != GDL_SUCCESS) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, + "GDL initialize failed. %s", gdl_get_error_string (rc)); + return FALSE; + } + + rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &display_info); + if (rc != GDL_SUCCESS) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, + "GDL failed to get display infomation: %s", + gdl_get_error_string (rc)); + gdl_close (); + return FALSE; + } + + dstRect.origin.x = 0; + dstRect.origin.y = 0; + dstRect.width = display_info.tvmode.width; + dstRect.height = display_info.tvmode.height; + + /* Configure the plane attribute. */ + rc = gdl_plane_reset (display->gdl_plane); + if (rc == GDL_SUCCESS) + rc = gdl_plane_config_begin (display->gdl_plane); + + if (rc == GDL_SUCCESS) + rc = gdl_plane_set_attr (GDL_PLANE_SRC_COLOR_SPACE, &colorSpace); + + if (rc == GDL_SUCCESS) + rc = gdl_plane_set_attr (GDL_PLANE_PIXEL_FORMAT, &pixfmt); + + if (rc == GDL_SUCCESS) + rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect); + + /* Default to triple buffering if the swap_chain doesn't have an explicit + * length */ + if (rc == GDL_SUCCESS) + { + if (display->onscreen_template->config.swap_chain && + display->onscreen_template->config.swap_chain->length != -1) + rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, + display->onscreen_template-> + config.swap_chain->length); + else + rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 3); + } + + if (rc == GDL_SUCCESS) + rc = gdl_plane_config_end (GDL_FALSE); + else + gdl_plane_config_end (GDL_TRUE); + + if (rc != GDL_SUCCESS) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, + "GDL configuration failed: %s.", gdl_get_error_string (rc)); + ret = FALSE; + } + + gdl_close (); + + return ret; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayGDL *gdl_display; + + gdl_display = g_slice_new0 (CoglDisplayGDL); + egl_display->platform = gdl_display; + + if (!gdl_plane_init (display, error)) + return FALSE; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayGDL, egl_display->platform); +} + +static void +_cogl_winsys_egl_cleanup_context (CoglDisplay *display) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + + if (egl_display->egl_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_display->egl_surface); + egl_display->egl_surface = EGL_NO_SURFACE; + } +} + +static CoglBool +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayGDL *gdl_display = egl_display->platform; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (gdl_display->have_onscreen) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "EGL platform only supports a single onscreen window"); + return FALSE; + } + + egl_onscreen->egl_surface = egl_display->egl_surface; + + _cogl_framebuffer_winsys_update_size (framebuffer, + gdl_display->egl_surface_width, + gdl_display->egl_surface_height); + gdl_display->have_onscreen = TRUE; + + return TRUE; +} + +static int +_cogl_winsys_egl_add_config_attributes (CoglDisplay *display, + CoglFramebufferConfig *config, + EGLint *attributes) +{ + int i = 0; + + /* XXX: Why does the GDL platform choose these by default? */ + attributes[i++] = EGL_BIND_TO_TEXTURE_RGBA; + attributes[i++] = EGL_TRUE; + attributes[i++] = EGL_BIND_TO_TEXTURE_RGB; + attributes[i++] = EGL_TRUE; + + return i; +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .cleanup_context = _cogl_winsys_egl_cleanup_context, + .onscreen_init = _cogl_winsys_egl_onscreen_init, + .add_config_attributes = _cogl_winsys_egl_add_config_attributes + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_gdl_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_GDL winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + vtable = *_cogl_winsys_egl_get_vtable (); + + vtable.id = COGL_WINSYS_ID_EGL_GDL; + vtable.name = "EGL_GDL"; + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-egl-kms-private.h b/cogl/winsys/cogl-winsys-egl-kms-private.h new file mode 100644 index 0000000..dea05db --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-kms-private.h @@ -0,0 +1,41 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_WINSYS_EGL_KMS_PRIVATE_H +#define __COGL_WINSYS_EGL_KMS_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_kms_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_KMS_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c new file mode 100644 index 0000000..9be1df1 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-kms.c @@ -0,0 +1,1261 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Rob Bradford + * Kristian Høgsberg (from eglkms.c) + * Benjamin Franzke (from eglkms.c) + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cogl-winsys-egl-kms-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-renderer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-kms-renderer.h" +#include "cogl-kms-display.h" +#include "cogl-version.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +static const CoglWinsysVtable *parent_vtable; + +typedef struct _CoglRendererKMS +{ + int fd; + int opened_fd; + struct gbm_device *gbm; + CoglClosure *swap_notify_idle; +} CoglRendererKMS; + +typedef struct _CoglOutputKMS +{ + drmModeConnector *connector; + drmModeEncoder *encoder; + drmModeCrtc *saved_crtc; + drmModeModeInfo *modes; + int n_modes; + drmModeModeInfo mode; +} CoglOutputKMS; + +typedef struct _CoglDisplayKMS +{ + GList *outputs; + GList *crtcs; + + int width, height; + CoglBool pending_set_crtc; + struct gbm_surface *dummy_gbm_surface; + + CoglOnscreen *onscreen; +} CoglDisplayKMS; + +typedef struct _CoglFlipKMS +{ + CoglOnscreen *onscreen; + int pending; +} CoglFlipKMS; + +typedef struct _CoglOnscreenKMS +{ + struct gbm_surface *surface; + uint32_t current_fb_id; + uint32_t next_fb_id; + struct gbm_bo *current_bo; + struct gbm_bo *next_bo; + CoglBool pending_swap_notify; +} CoglOnscreenKMS; + +static const char device_name[] = "/dev/dri/card0"; + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + eglTerminate (egl_renderer->edpy); + + if (kms_renderer->opened_fd >= 0) + close (kms_renderer->opened_fd); + + g_slice_free (CoglRendererKMS, kms_renderer); + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static void +flush_pending_swap_notify_cb (void *data, + void *user_data) +{ + CoglFramebuffer *framebuffer = data; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + + if (kms_onscreen->pending_swap_notify) + { + CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos); + + _cogl_onscreen_notify_frame_sync (onscreen, info); + _cogl_onscreen_notify_complete (onscreen, info); + kms_onscreen->pending_swap_notify = FALSE; + + cogl_object_unref (info); + } + } +} + +static void +flush_pending_swap_notify_idle (void *user_data) +{ + CoglContext *context = user_data; + CoglRendererEGL *egl_renderer = context->display->renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + /* This needs to be disconnected before invoking the callbacks in + * case the callbacks cause it to be queued again */ + _cogl_closure_disconnect (kms_renderer->swap_notify_idle); + kms_renderer->swap_notify_idle = NULL; + + g_list_foreach (context->framebuffers, + flush_pending_swap_notify_cb, + NULL); +} + +static void +free_current_bo (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + if (kms_onscreen->current_fb_id) + { + drmModeRmFB (kms_renderer->fd, + kms_onscreen->current_fb_id); + kms_onscreen->current_fb_id = 0; + } + if (kms_onscreen->current_bo) + { + gbm_surface_release_buffer (kms_onscreen->surface, + kms_onscreen->current_bo); + kms_onscreen->current_bo = NULL; + } +} + +static void +queue_swap_notify_for_onscreen (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + /* We only want to notify that the swap is complete when the + * application calls cogl_context_dispatch so instead of + * immediately notifying we queue an idle callback */ + if (!kms_renderer->swap_notify_idle) + { + kms_renderer->swap_notify_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_swap_notify_idle, + context, + NULL); + } + + kms_onscreen->pending_swap_notify = TRUE; +} + +static void +page_flip_handler (int fd, + unsigned int frame, + unsigned int sec, + unsigned int usec, + void *data) +{ + CoglFlipKMS *flip = data; + + /* We're only ready to dispatch a swap notification once all outputs + * have flipped... */ + flip->pending--; + if (flip->pending == 0) + { + CoglOnscreen *onscreen = flip->onscreen; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + queue_swap_notify_for_onscreen (onscreen); + + free_current_bo (onscreen); + + kms_onscreen->current_fb_id = kms_onscreen->next_fb_id; + kms_onscreen->next_fb_id = 0; + + kms_onscreen->current_bo = kms_onscreen->next_bo; + kms_onscreen->next_bo = NULL; + + cogl_object_unref (flip->onscreen); + + g_slice_free (CoglFlipKMS, flip); + } +} + +static void +handle_drm_event (CoglRendererKMS *kms_renderer) +{ + drmEventContext evctx; + + memset (&evctx, 0, sizeof evctx); + evctx.version = DRM_EVENT_CONTEXT_VERSION; + evctx.page_flip_handler = page_flip_handler; + drmHandleEvent (kms_renderer->fd, &evctx); +} + +static void +dispatch_kms_events (void *user_data, int revents) +{ + CoglRenderer *renderer = user_data; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + if (!revents) + return; + + handle_drm_event (kms_renderer); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + CoglRendererKMS *kms_renderer; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + egl_renderer->platform = g_slice_new0 (CoglRendererKMS); + kms_renderer = egl_renderer->platform; + + kms_renderer->fd = -1; + kms_renderer->opened_fd = -1; + + if (renderer->kms_fd >= 0) + { + kms_renderer->fd = renderer->kms_fd; + } + else + { + kms_renderer->opened_fd = open (device_name, O_RDWR); + kms_renderer->fd = kms_renderer->opened_fd; + if (kms_renderer->fd < 0) + { + /* Probably permissions error */ + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Couldn't open %s", device_name); + return FALSE; + } + } + + kms_renderer->gbm = gbm_create_device (kms_renderer->fd); + if (kms_renderer->gbm == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Couldn't create gbm device"); + goto close_fd; + } + + egl_renderer->edpy = eglGetDisplay ((EGLNativeDisplayType)kms_renderer->gbm); + if (egl_renderer->edpy == EGL_NO_DISPLAY) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Couldn't get eglDisplay"); + goto destroy_gbm_device; + } + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto egl_terminate; + + _cogl_poll_renderer_add_fd (renderer, + kms_renderer->fd, + COGL_POLL_FD_EVENT_IN, + NULL, /* no prepare callback */ + dispatch_kms_events, + renderer); + + return TRUE; + +egl_terminate: + eglTerminate (egl_renderer->edpy); +destroy_gbm_device: + gbm_device_destroy (kms_renderer->gbm); +close_fd: + if (kms_renderer->opened_fd >= 0) + close (kms_renderer->opened_fd); + + _cogl_winsys_renderer_disconnect (renderer); + + return FALSE; +} + +static CoglBool +is_connector_excluded (int id, + int *excluded_connectors, + int n_excluded_connectors) +{ + int i; + for (i = 0; i < n_excluded_connectors; i++) + if (excluded_connectors[i] == id) + return TRUE; + return FALSE; +} + +static drmModeConnector * +find_connector (int fd, + drmModeRes *resources, + int *excluded_connectors, + int n_excluded_connectors) +{ + int i; + + for (i = 0; i < resources->count_connectors; i++) + { + drmModeConnector *connector = + drmModeGetConnector (fd, resources->connectors[i]); + + if (connector && + connector->connection == DRM_MODE_CONNECTED && + connector->count_modes > 0 && + !is_connector_excluded (connector->connector_id, + excluded_connectors, + n_excluded_connectors)) + return connector; + drmModeFreeConnector(connector); + } + return NULL; +} + +static CoglBool +find_mirror_modes (drmModeModeInfo *modes0, + int n_modes0, + drmModeModeInfo *modes1, + int n_modes1, + drmModeModeInfo *mode1_out, + drmModeModeInfo *mode0_out) +{ + int i; + for (i = 0; i < n_modes0; i++) + { + int j; + drmModeModeInfo *mode0 = &modes0[i]; + for (j = 0; j < n_modes1; j++) + { + drmModeModeInfo *mode1 = &modes1[j]; + if (mode1->hdisplay == mode0->hdisplay && + mode1->vdisplay == mode0->vdisplay) + { + *mode0_out = *mode0; + *mode1_out = *mode1; + return TRUE; + } + } + } + return FALSE; +} + +static drmModeModeInfo builtin_1024x768 = +{ + 63500, /* clock */ + 1024, 1072, 1176, 1328, 0, + 768, 771, 775, 798, 0, + 59920, + DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, + 0, + "1024x768" +}; + +static CoglBool +is_panel (int type) +{ + return (type == DRM_MODE_CONNECTOR_LVDS || + type == DRM_MODE_CONNECTOR_eDP); +} + +static CoglOutputKMS * +find_output (int _index, + int fd, + drmModeRes *resources, + int *excluded_connectors, + int n_excluded_connectors, + CoglError **error) +{ + char *connector_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d", _index); + char *mode_env_name; + drmModeConnector *connector; + drmModeEncoder *encoder; + CoglOutputKMS *output; + drmModeModeInfo *modes; + int n_modes; + + if (getenv (connector_env_name)) + { + unsigned long id = strtoul (getenv (connector_env_name), NULL, 10); + connector = drmModeGetConnector (fd, id); + } + else + connector = NULL; + g_free (connector_env_name); + + if (connector == NULL) + connector = find_connector (fd, resources, + excluded_connectors, n_excluded_connectors); + if (connector == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "No currently active connector found"); + return NULL; + } + + /* XXX: At this point it seems connector->encoder_id may be an invalid id of 0 + * even though the connector is marked as connected. Referencing ->encoders[0] + * seems more reliable. */ + encoder = drmModeGetEncoder (fd, connector->encoders[0]); + + output = g_slice_new0 (CoglOutputKMS); + output->connector = connector; + output->encoder = encoder; + output->saved_crtc = drmModeGetCrtc (fd, encoder->crtc_id); + + if (is_panel (connector->connector_type)) + { + n_modes = connector->count_modes + 1; + modes = g_new (drmModeModeInfo, n_modes); + memcpy (modes, connector->modes, + sizeof (drmModeModeInfo) * connector->count_modes); + /* TODO: parse EDID */ + modes[n_modes - 1] = builtin_1024x768; + } + else + { + n_modes = connector->count_modes; + modes = g_new (drmModeModeInfo, n_modes); + memcpy (modes, connector->modes, + sizeof (drmModeModeInfo) * n_modes); + } + + mode_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d_MODE", _index); + if (getenv (mode_env_name)) + { + const char *name = getenv (mode_env_name); + int i; + CoglBool found = FALSE; + drmModeModeInfo mode; + + for (i = 0; i < n_modes; i++) + { + if (strcmp (modes[i].name, name) == 0) + { + found = TRUE; + break; + } + } + if (!found) + { + g_free (mode_env_name); + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "COGL_KMS_CONNECTOR%d_MODE of %s could not be found", + _index, name); + return NULL; + } + n_modes = 1; + mode = modes[i]; + g_free (modes); + modes = g_new (drmModeModeInfo, 1); + modes[0] = mode; + } + g_free (mode_env_name); + + output->modes = modes; + output->n_modes = n_modes; + + return output; +} + +static void +setup_crtc_modes (CoglDisplay *display, int fb_id) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + GList *l; + + for (l = kms_display->crtcs; l; l = l->next) + { + CoglKmsCrtc *crtc = l->data; + + int ret = drmModeSetCrtc (kms_renderer->fd, + crtc->id, + fb_id, crtc->x, crtc->y, + crtc->connectors, crtc->count, + crtc->count ? &crtc->mode : NULL); + if (ret) + g_warning ("Failed to set crtc mode %s: %m", crtc->mode.name); + } +} + +static void +flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + GList *l; + + for (l = kms_display->crtcs; l; l = l->next) + { + CoglKmsCrtc *crtc = l->data; + int ret; + + if (crtc->count == 0 || crtc->ignore) + continue; + + ret = drmModePageFlip (kms_renderer->fd, + crtc->id, fb_id, + DRM_MODE_PAGE_FLIP_EVENT, flip); + + if (ret) + { + g_warning ("Failed to flip: %m"); + continue; + } + + flip->pending++; + } +} + +static void +crtc_free (CoglKmsCrtc *crtc) +{ + g_free (crtc->connectors); + g_slice_free (CoglKmsCrtc, crtc); +} + +static CoglKmsCrtc * +crtc_copy (CoglKmsCrtc *from) +{ + CoglKmsCrtc *new; + + new = g_slice_new (CoglKmsCrtc); + + *new = *from; + new->connectors = g_memdup (from->connectors, from->count * sizeof(uint32_t)); + + return new; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + drmModeRes *resources; + CoglOutputKMS *output0, *output1; + CoglBool mirror; + CoglKmsCrtc *crtc0, *crtc1; + + kms_display = g_slice_new0 (CoglDisplayKMS); + egl_display->platform = kms_display; + + resources = drmModeGetResources (kms_renderer->fd); + if (!resources) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "drmModeGetResources failed"); + return FALSE; + } + + output0 = find_output (0, + kms_renderer->fd, + resources, + NULL, + 0, /* n excluded connectors */ + error); + kms_display->outputs = g_list_append (kms_display->outputs, output0); + if (!output0) + return FALSE; + + if (getenv ("COGL_KMS_MIRROR")) + mirror = TRUE; + else + mirror = FALSE; + + if (mirror) + { + int exclude_connector = output0->connector->connector_id; + output1 = find_output (1, + kms_renderer->fd, + resources, + &exclude_connector, + 1, /* n excluded connectors */ + error); + if (!output1) + return FALSE; + + kms_display->outputs = g_list_append (kms_display->outputs, output1); + + if (!find_mirror_modes (output0->modes, output0->n_modes, + output1->modes, output1->n_modes, + &output0->mode, + &output1->mode)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to find matching modes for mirroring"); + return FALSE; + } + } + else + { + output0->mode = output0->modes[0]; + output1 = NULL; + } + + crtc0 = g_slice_new (CoglKmsCrtc); + crtc0->id = output0->encoder->crtc_id; + crtc0->x = 0; + crtc0->y = 0; + crtc0->mode = output0->mode; + crtc0->connectors = g_new (uint32_t, 1); + crtc0->connectors[0] = output0->connector->connector_id; + crtc0->count = 1; + kms_display->crtcs = g_list_prepend (kms_display->crtcs, crtc0); + + if (output1) + { + crtc1 = g_slice_new (CoglKmsCrtc); + crtc1->id = output1->encoder->crtc_id; + crtc1->x = 0; + crtc1->y = 0; + crtc1->mode = output1->mode; + crtc1->connectors = g_new (uint32_t, 1); + crtc1->connectors[0] = output1->connector->connector_id; + crtc1->count = 1; + kms_display->crtcs = g_list_prepend (kms_display->crtcs, crtc1); + } + + kms_display->width = output0->mode.hdisplay; + kms_display->height = output0->mode.vdisplay; + + /* We defer setting the crtc modes until the first swap_buffers request of a + * CoglOnscreen framebuffer. */ + kms_display->pending_set_crtc = TRUE; + + return TRUE; +} + +static void +output_free (int fd, CoglOutputKMS *output) +{ + if (output->modes) + g_free (output->modes); + + if (output->encoder) + drmModeFreeEncoder (output->encoder); + + if (output->connector) + { + if (output->saved_crtc) + { + int ret = drmModeSetCrtc (fd, + output->saved_crtc->crtc_id, + output->saved_crtc->buffer_id, + output->saved_crtc->x, + output->saved_crtc->y, + &output->connector->connector_id, 1, + &output->saved_crtc->mode); + if (ret) + g_warning (G_STRLOC ": Error restoring saved CRTC"); + } + drmModeFreeConnector (output->connector); + } + + g_slice_free (CoglOutputKMS, output); +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + GList *l; + + for (l = kms_display->outputs; l; l = l->next) + output_free (kms_renderer->fd, l->data); + g_list_free (kms_display->outputs); + kms_display->outputs = NULL; + + g_list_free_full (kms_display->crtcs, (GDestroyNotify) crtc_free); + + g_slice_free (CoglDisplayKMS, egl_display->platform); +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + if ((egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) == 0) + { + kms_display->dummy_gbm_surface = + gbm_surface_create (kms_renderer->gbm, + 16, 16, + GBM_FORMAT_XRGB8888, + GBM_BO_USE_RENDERING); + if (!kms_display->dummy_gbm_surface) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to create dummy GBM surface"); + return FALSE; + } + + egl_display->dummy_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) + kms_display->dummy_gbm_surface, + NULL); + if (egl_display->dummy_surface == EGL_NO_SURFACE) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to create dummy EGL surface"); + return FALSE; + } + } + + if (!_cogl_winsys_egl_make_current (display, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->egl_context)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to make context current"); + return FALSE; + } + + return TRUE; +} + +static void +_cogl_winsys_egl_cleanup_context (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (egl_display->dummy_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface); + egl_display->dummy_surface = EGL_NO_SURFACE; + } + + if (kms_display->dummy_gbm_surface != NULL) + { + gbm_surface_destroy (kms_display->dummy_gbm_surface); + kms_display->dummy_gbm_surface = NULL; + } +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + uint32_t handle, stride; + CoglFlipKMS *flip; + + /* If we already have a pending swap then block until it completes */ + while (kms_onscreen->next_fb_id != 0) + handle_drm_event (kms_renderer); + + parent_vtable->onscreen_swap_buffers_with_damage (onscreen, + rectangles, + n_rectangles); + + /* Now we need to set the CRTC to whatever is the front buffer */ + kms_onscreen->next_bo = gbm_surface_lock_front_buffer (kms_onscreen->surface); + +#if (COGL_VERSION_ENCODE (COGL_GBM_MAJOR, COGL_GBM_MINOR, COGL_GBM_MICRO) >= \ + COGL_VERSION_ENCODE (8, 1, 0)) + stride = gbm_bo_get_stride (kms_onscreen->next_bo); +#else + stride = gbm_bo_get_pitch (kms_onscreen->next_bo); +#endif + handle = gbm_bo_get_handle (kms_onscreen->next_bo).u32; + + if (drmModeAddFB (kms_renderer->fd, + kms_display->width, + kms_display->height, + 24, /* depth */ + 32, /* bpp */ + stride, + handle, + &kms_onscreen->next_fb_id)) + { + g_warning ("Failed to create new back buffer handle: %m"); + gbm_surface_release_buffer (kms_onscreen->surface, + kms_onscreen->next_bo); + kms_onscreen->next_bo = NULL; + kms_onscreen->next_fb_id = 0; + return; + } + + /* If this is the first framebuffer to be presented then we now setup the + * crtc modes, else we flip from the previous buffer */ + if (kms_display->pending_set_crtc) + { + setup_crtc_modes (context->display, kms_onscreen->next_fb_id); + kms_display->pending_set_crtc = FALSE; + } + + flip = g_slice_new0 (CoglFlipKMS); + flip->onscreen = onscreen; + + flip_all_crtcs (context->display, flip, kms_onscreen->next_fb_id); + + if (flip->pending == 0) + { + drmModeRmFB (kms_renderer->fd, kms_onscreen->next_fb_id); + gbm_surface_release_buffer (kms_onscreen->surface, + kms_onscreen->next_bo); + kms_onscreen->next_bo = NULL; + kms_onscreen->next_fb_id = 0; + g_slice_free (CoglFlipKMS, flip); + flip = NULL; + + queue_swap_notify_for_onscreen (onscreen); + } + else + { + /* Ensure the onscreen remains valid while it has any pending flips... */ + cogl_object_ref (flip->onscreen); + } +} + +static CoglBool +_cogl_winsys_egl_context_init (CoglContext *context, + CoglError **error) +{ + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, TRUE); + /* TODO: remove this deprecated feature */ + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, + TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT, + TRUE); + + return TRUE; +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + CoglOnscreenEGL *egl_onscreen; + CoglOnscreenKMS *kms_onscreen; + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); + + if (kms_display->onscreen) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Cannot have multiple onscreens in the KMS platform"); + return FALSE; + } + + kms_display->onscreen = onscreen; + + onscreen->winsys = g_slice_new0 (CoglOnscreenEGL); + egl_onscreen = onscreen->winsys; + + kms_onscreen = g_slice_new0 (CoglOnscreenKMS); + egl_onscreen->platform = kms_onscreen; + + kms_onscreen->surface = + gbm_surface_create (kms_renderer->gbm, + kms_display->width, + kms_display->height, + GBM_BO_FORMAT_XRGB8888, + GBM_BO_USE_SCANOUT | + GBM_BO_USE_RENDERING); + + if (!kms_onscreen->surface) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Failed to allocate surface"); + return FALSE; + } + + egl_onscreen->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) kms_onscreen->surface, + NULL); + if (egl_onscreen->egl_surface == EGL_NO_SURFACE) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Failed to allocate surface"); + return FALSE; + } + + _cogl_framebuffer_winsys_update_size (framebuffer, + kms_display->width, + kms_display->height); + + return TRUE; +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen; + + /* If we never successfully allocated then there's nothing to do */ + if (egl_onscreen == NULL) + return; + + kms_display->onscreen = NULL; + + kms_onscreen = egl_onscreen->platform; + + /* flip state takes a reference on the onscreen so there should + * never be outstanding flips when we reach here. */ + g_return_if_fail (kms_onscreen->next_fb_id == 0); + + free_current_bo (onscreen); + + if (egl_onscreen->egl_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface); + egl_onscreen->egl_surface = EGL_NO_SURFACE; + } + + if (kms_onscreen->surface) + { + gbm_surface_destroy (kms_onscreen->surface); + kms_onscreen->surface = NULL; + } + + g_slice_free (CoglOnscreenKMS, kms_onscreen); + g_slice_free (CoglOnscreenEGL, onscreen->winsys); + onscreen->winsys = NULL; +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .cleanup_context = _cogl_winsys_egl_cleanup_context, + .context_init = _cogl_winsys_egl_context_init + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_kms_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_KMS winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + parent_vtable = _cogl_winsys_egl_get_vtable (); + vtable = *parent_vtable; + + vtable.id = COGL_WINSYS_ID_EGL_KMS; + vtable.name = "EGL_KMS"; + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable.onscreen_init = _cogl_winsys_onscreen_init; + vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; + + /* The KMS winsys doesn't support swap region */ + vtable.onscreen_swap_region = NULL; + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + + vtable_inited = TRUE; + } + + return &vtable; +} + +void +cogl_kms_renderer_set_kms_fd (CoglRenderer *renderer, + int fd) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->kms_fd = fd; +} + +struct gbm_device * +cogl_kms_renderer_get_gbm (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + if (renderer->connected) + { + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + return kms_renderer->gbm; + } + else + return NULL; +} + +int +cogl_kms_renderer_get_kms_fd (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), -1); + + if (renderer->connected) + { + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + return kms_renderer->fd; + } + else + return -1; +} + +void +cogl_kms_display_queue_modes_reset (CoglDisplay *display) +{ + if (display->setup) + { + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + kms_display->pending_set_crtc = TRUE; + } +} + +CoglBool +cogl_kms_display_set_layout (CoglDisplay *display, + int width, + int height, + CoglKmsCrtc **crtcs, + int n_crtcs, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + GList *crtc_list; + int i; + + if ((width != kms_display->width || + height != kms_display->height) && + kms_display->onscreen) + { + CoglOnscreenEGL *egl_onscreen = kms_display->onscreen->winsys; + CoglOnscreenKMS *kms_onscreen = egl_onscreen->platform; + struct gbm_surface *new_surface; + EGLSurface new_egl_surface; + + /* Need to drop the GBM surface and create a new one */ + + new_surface = gbm_surface_create (kms_renderer->gbm, + width, height, + GBM_BO_FORMAT_XRGB8888, + GBM_BO_USE_SCANOUT | + GBM_BO_USE_RENDERING); + + if (!new_surface) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Failed to allocate new surface"); + return FALSE; + } + + new_egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) new_surface, + NULL); + if (new_egl_surface == EGL_NO_SURFACE) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Failed to allocate new surface"); + gbm_surface_destroy (new_surface); + return FALSE; + } + + eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface); + gbm_surface_destroy (kms_onscreen->surface); + + kms_onscreen->surface = new_surface; + egl_onscreen->egl_surface = new_egl_surface; + + _cogl_framebuffer_winsys_update_size (COGL_FRAMEBUFFER (kms_display->onscreen), width, height); + } + + kms_display->width = width; + kms_display->height = height; + + g_list_free_full (kms_display->crtcs, (GDestroyNotify) crtc_free); + + crtc_list = NULL; + for (i = 0; i < n_crtcs; i++) + { + crtc_list = g_list_prepend (crtc_list, crtc_copy (crtcs[i])); + } + crtc_list = g_list_reverse (crtc_list); + kms_display->crtcs = crtc_list; + + kms_display->pending_set_crtc = TRUE; + + return TRUE; +} + + +void +cogl_kms_display_set_ignore_crtc (CoglDisplay *display, + uint32_t id, + CoglBool ignore) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display = egl_display->platform; + GList *l; + + for (l = kms_display->crtcs; l; l = l->next) + { + CoglKmsCrtc *crtc = l->data; + if (crtc->id == id) + { + crtc->ignore = ignore; + break; + } + } +} diff --git a/cogl/winsys/cogl-winsys-egl-null-private.h b/cogl/winsys/cogl-winsys-egl-null-private.h new file mode 100644 index 0000000..aa1119f --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-null-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_NULL_PRIVATE_H +#define __COGL_WINSYS_EGL_NULL_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_null_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_NULL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-null.c b/cogl/winsys/cogl-winsys-egl-null.c new file mode 100644 index 0000000..962d6d1 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-null.c @@ -0,0 +1,246 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-winsys-egl-null-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-renderer-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglDisplayNull +{ + int egl_surface_width; + int egl_surface_height; + CoglBool have_onscreen; +} CoglDisplayNull; + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + eglTerminate (egl_renderer->edpy); + + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + + egl_renderer->edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayNull *null_display = egl_display->platform; + const char *error_message; + + egl_display->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) NULL, + NULL); + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!_cogl_winsys_egl_make_current (display, + egl_display->egl_surface, + egl_display->egl_surface, + egl_display->egl_context)) + { + error_message = "Unable to eglMakeCurrent with egl surface"; + goto fail; + } + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_WIDTH, + &null_display->egl_surface_width); + + eglQuerySurface (egl_renderer->edpy, + egl_display->egl_surface, + EGL_HEIGHT, + &null_display->egl_surface_height); + + return TRUE; + + fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayNull *null_display; + + null_display = g_slice_new0 (CoglDisplayNull); + egl_display->platform = null_display; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayNull, egl_display->platform); +} + +static void +_cogl_winsys_egl_cleanup_context (CoglDisplay *display) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + + if (egl_display->egl_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_display->egl_surface); + egl_display->egl_surface = EGL_NO_SURFACE; + } +} + +static CoglBool +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayNull *null_display = egl_display->platform; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (null_display->have_onscreen) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "EGL platform only supports a single onscreen window"); + return FALSE; + } + + egl_onscreen->egl_surface = egl_display->egl_surface; + + _cogl_framebuffer_winsys_update_size (framebuffer, + null_display->egl_surface_width, + null_display->egl_surface_height); + null_display->have_onscreen = TRUE; + + return TRUE; +} + +static void +_cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayNull *null_display = egl_display->platform; + + null_display->have_onscreen = FALSE; +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .cleanup_context = _cogl_winsys_egl_cleanup_context, + .onscreen_init = _cogl_winsys_egl_onscreen_init, + .onscreen_deinit = _cogl_winsys_egl_onscreen_deinit + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_null_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_NULL winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + vtable = *_cogl_winsys_egl_get_vtable (); + + vtable.id = COGL_WINSYS_ID_EGL_NULL; + vtable.name = "EGL_NULL"; + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h new file mode 100644 index 0000000..5d21b4f --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-private.h @@ -0,0 +1,203 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_PRIVATE_H +#define __COGL_WINSYS_EGL_PRIVATE_H + +#include "cogl-defines.h" +#include "cogl-winsys-private.h" +#include "cogl-context.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" + +/* XXX: depending on what version of Mesa you have then + * eglQueryWaylandBuffer may take a wl_buffer or wl_resource argument + * and the EGL header will only forward declare the corresponding + * type. + * + * The use of wl_buffer has been deprecated and so internally we + * assume that eglQueryWaylandBuffer takes a wl_resource but for + * compatibility we forward declare wl_resource in case we are + * building with EGL headers that still use wl_buffer. + * + * Placing the forward declaration here means it comes before we + * #include cogl-winsys-egl-feature-functions.h bellow which + * declares lots of function pointers for accessing EGL extensions + * and cogl-winsys-egl.c will include this header before it also + * includes cogl-winsys-egl-feature-functions.h that may depend + * on this type. + */ +#ifdef EGL_WL_bind_wayland_display +struct wl_resource; +#endif + +typedef struct _CoglWinsysEGLVtable +{ + CoglBool + (* display_setup) (CoglDisplay *display, + CoglError **error); + void + (* display_destroy) (CoglDisplay *display); + + CoglBool + (* context_created) (CoglDisplay *display, + CoglError **error); + + void + (* cleanup_context) (CoglDisplay *display); + + CoglBool + (* context_init) (CoglContext *context, CoglError **error); + + void + (* context_deinit) (CoglContext *context); + + CoglBool + (* onscreen_init) (CoglOnscreen *onscreen, + EGLConfig config, + CoglError **error); + void + (* onscreen_deinit) (CoglOnscreen *onscreen); + + int + (* add_config_attributes) (CoglDisplay *display, + CoglFramebufferConfig *config, + EGLint *attributes); +} CoglWinsysEGLVtable; + +typedef enum _CoglEGLWinsysFeature +{ + COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0, + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1, + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2, + COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT =1L<<3, + COGL_EGL_WINSYS_FEATURE_BUFFER_AGE =1L<<4, + COGL_EGL_WINSYS_FEATURE_FENCE_SYNC =1L<<5, + COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT =1L<<6 +} CoglEGLWinsysFeature; + +typedef struct _CoglRendererEGL +{ + CoglEGLWinsysFeature private_features; + + EGLDisplay edpy; + + EGLint egl_version_major; + EGLint egl_version_minor; + + CoglClosure *resize_notify_idle; + + /* Data specific to the EGL platform */ + void *platform; + /* vtable for platform specific parts */ + const CoglWinsysEGLVtable *platform_vtable; + + /* Function pointers for EGL specific extensions */ +#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d) + +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + ret (APIENTRY * pf_ ## name) args; + +#define COGL_WINSYS_FEATURE_END() + +#include "cogl-winsys-egl-feature-functions.h" + +#undef COGL_WINSYS_FEATURE_BEGIN +#undef COGL_WINSYS_FEATURE_FUNCTION +#undef COGL_WINSYS_FEATURE_END +} CoglRendererEGL; + +typedef struct _CoglDisplayEGL +{ + EGLContext egl_context; + EGLSurface dummy_surface; + EGLSurface egl_surface; + + EGLConfig egl_config; + CoglBool found_egl_config; + + EGLSurface current_read_surface; + EGLSurface current_draw_surface; + EGLContext current_context; + + /* Platform specific display data */ + void *platform; +} CoglDisplayEGL; + +typedef struct _CoglContextEGL +{ + EGLSurface saved_draw_surface; + EGLSurface saved_read_surface; +} CoglContextEGL; + +typedef struct _CoglOnscreenEGL +{ + EGLSurface egl_surface; + + CoglBool pending_resize_notify; + + /* Platform specific data */ + void *platform; +} CoglOnscreenEGL; + +const CoglWinsysVtable * +_cogl_winsys_egl_get_vtable (void); + +EGLBoolean +_cogl_winsys_egl_make_current (CoglDisplay *display, + EGLSurface draw, + EGLSurface read, + EGLContext context); + +#ifdef EGL_KHR_image_base +EGLImageKHR +_cogl_egl_create_image (CoglContext *ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint *attribs); + +void +_cogl_egl_destroy_image (CoglContext *ctx, + EGLImageKHR image); +#endif + +#ifdef EGL_WL_bind_wayland_display +CoglBool +_cogl_egl_query_wayland_buffer (CoglContext *ctx, + struct wl_resource *buffer, + int attribute, + int *value); +#endif + +CoglBool +_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, + CoglError **error); + +#endif /* __COGL_WINSYS_EGL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-wayland-private.h b/cogl/winsys/cogl-winsys-egl-wayland-private.h new file mode 100644 index 0000000..55012c8 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-wayland-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H +#define __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_wayland_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c new file mode 100644 index 0000000..93a8451 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-wayland.c @@ -0,0 +1,844 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "cogl-winsys-egl-wayland-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-renderer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-wayland-renderer.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" +#include "cogl-frame-info-private.h" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +static const CoglWinsysVtable *parent_vtable; + +typedef struct _CoglRendererWayland +{ + struct wl_display *wayland_display; + struct wl_compositor *wayland_compositor; + struct wl_shell *wayland_shell; + struct wl_registry *wayland_registry; + int fd; +} CoglRendererWayland; + +typedef struct _CoglDisplayWayland +{ + struct wl_surface *dummy_wayland_surface; + struct wl_egl_window *dummy_wayland_egl_native_window; +} CoglDisplayWayland; + +typedef struct _CoglOnscreenWayland +{ + struct wl_egl_window *wayland_egl_native_window; + struct wl_surface *wayland_surface; + struct wl_shell_surface *wayland_shell_surface; + + /* Resizing a wayland framebuffer doesn't take affect + * until the next swap buffers request, so we have to + * track the resize geometry until then... */ + int pending_width; + int pending_height; + int pending_dx; + int pending_dy; + CoglBool has_pending; + + CoglBool shell_surface_type_set; + + CoglList frame_callbacks; +} CoglOnscreenWayland; + +typedef struct +{ + CoglList link; + CoglFrameInfo *frame_info; + struct wl_callback *callback; + CoglOnscreen *onscreen; +} FrameCallbackData; + +static void +registry_handle_global_cb (void *data, + struct wl_registry *registry, + uint32_t id, + const char *interface, + uint32_t version) +{ + CoglRendererEGL *egl_renderer = (CoglRendererEGL *)data; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + + if (strcmp (interface, "wl_compositor") == 0) + wayland_renderer->wayland_compositor = + wl_registry_bind (registry, id, &wl_compositor_interface, 1); + else if (strcmp(interface, "wl_shell") == 0) + wayland_renderer->wayland_shell = + wl_registry_bind (registry, id, &wl_shell_interface, 1); +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + + if (egl_renderer->edpy) + eglTerminate (egl_renderer->edpy); + + if (wayland_renderer->wayland_display) + { + _cogl_poll_renderer_remove_fd (renderer, wayland_renderer->fd); + + if (renderer->foreign_wayland_display == NULL) + wl_display_disconnect (wayland_renderer->wayland_display); + } + + g_slice_free (CoglRendererWayland, egl_renderer->platform); + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static const struct wl_registry_listener registry_listener = { + registry_handle_global_cb, +}; + +static int64_t +prepare_wayland_display_events (void *user_data) +{ + CoglRenderer *renderer = user_data; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + int flush_ret; + + flush_ret = wl_display_flush (wayland_renderer->wayland_display); + + if (flush_ret == -1) + { + /* If the socket buffer became full then we need to wake up the + * main loop once it is writable again */ + if (errno == EAGAIN) + { + _cogl_poll_renderer_modify_fd (renderer, + wayland_renderer->fd, + COGL_POLL_FD_EVENT_IN | + COGL_POLL_FD_EVENT_OUT); + } + else if (errno != EINTR) + { + /* If the flush failed for some other reason then it's + * likely that it's going to consistently fail so we'll stop + * waiting on the file descriptor instead of making the + * application take up 100% CPU. FIXME: it would be nice if + * there was some way to report this to the application so + * that it can quit or recover */ + _cogl_poll_renderer_remove_fd (renderer, wayland_renderer->fd); + } + } + + /* Calling this here is a bit dodgy because Cogl usually tries to + * say that it won't do any event processing until + * cogl_poll_renderer_dispatch is called. However Wayland doesn't + * seem to provide any way to query whether the event queue is empty + * and we would need to do that in order to force the main loop to + * wake up to call it from dispatch. */ + wl_display_dispatch_pending (wayland_renderer->wayland_display); + + return -1; +} + +static void +dispatch_wayland_display_events (void *user_data, int revents) +{ + CoglRenderer *renderer = user_data; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + + if ((revents & COGL_POLL_FD_EVENT_IN)) + { + if (wl_display_dispatch (wayland_renderer->wayland_display) == -1 && + errno != EAGAIN && + errno != EINTR) + goto socket_error; + } + + if ((revents & COGL_POLL_FD_EVENT_OUT)) + { + int ret = wl_display_flush (wayland_renderer->wayland_display); + + if (ret == -1) + { + if (errno != EAGAIN && errno != EINTR) + goto socket_error; + } + else + { + /* There is no more data to write so we don't need to wake + * up when the write buffer is emptied anymore */ + _cogl_poll_renderer_modify_fd (renderer, + wayland_renderer->fd, + COGL_POLL_FD_EVENT_IN); + } + } + + return; + + socket_error: + /* If there was an error on the wayland socket then it's likely that + * it's going to consistently fail so we'll stop waiting on the file + * descriptor instead of making the application take up 100% CPU. + * FIXME: it would be nice if there was some way to report this to + * the application so that it can quit or recover */ + _cogl_poll_renderer_remove_fd (renderer, wayland_renderer->fd); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + CoglRendererWayland *wayland_renderer; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + wayland_renderer = g_slice_new0 (CoglRendererWayland); + egl_renderer->platform = wayland_renderer; + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + + if (renderer->foreign_wayland_display) + { + wayland_renderer->wayland_display = renderer->foreign_wayland_display; + } + else + { + wayland_renderer->wayland_display = wl_display_connect (NULL); + if (!wayland_renderer->wayland_display) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to connect wayland display"); + goto error; + } + } + + wayland_renderer->wayland_registry = + wl_display_get_registry (wayland_renderer->wayland_display); + + wl_registry_add_listener (wayland_renderer->wayland_registry, + ®istry_listener, + egl_renderer); + + /* + * Ensure that that we've received the messages setting up the + * compostor and shell object. + */ + wl_display_roundtrip (wayland_renderer->wayland_display); + if (!wayland_renderer->wayland_compositor || !wayland_renderer->wayland_shell) + { + _cogl_set_error (error, + COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Unable to find wl_compositor or wl_shell"); + goto error; + } + + egl_renderer->edpy = + eglGetDisplay ((EGLNativeDisplayType) wayland_renderer->wayland_display); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + wayland_renderer->fd = wl_display_get_fd (wayland_renderer->wayland_display); + + if (renderer->wayland_enable_event_dispatch) + _cogl_poll_renderer_add_fd (renderer, + wayland_renderer->fd, + COGL_POLL_FD_EVENT_IN, + prepare_wayland_display_events, + dispatch_wayland_display_events, + renderer); + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayWayland *wayland_display; + + wayland_display = g_slice_new0 (CoglDisplayWayland); + egl_display->platform = wayland_display; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayWayland, egl_display->platform); +} + +static CoglBool +make_dummy_surface (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayWayland *wayland_display = egl_display->platform; + const char *error_message; + + wayland_display->dummy_wayland_surface = + wl_compositor_create_surface (wayland_renderer->wayland_compositor); + if (!wayland_display->dummy_wayland_surface) + { + error_message= "Failed to create a dummy wayland surface"; + goto fail; + } + + wayland_display->dummy_wayland_egl_native_window = + wl_egl_window_create (wayland_display->dummy_wayland_surface, + 1, + 1); + if (!wayland_display->dummy_wayland_egl_native_window) + { + error_message= "Failed to create a dummy wayland native egl surface"; + goto fail; + } + + egl_display->dummy_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) + wayland_display->dummy_wayland_egl_native_window, + NULL); + if (egl_display->dummy_surface == EGL_NO_SURFACE) + { + error_message= "Unable to create dummy window surface"; + goto fail; + } + + return TRUE; + + fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + + if ((egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) == 0 && + !make_dummy_surface(display, error)) + return FALSE; + + if (!_cogl_winsys_egl_make_current (display, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->egl_context)) + { + _cogl_set_error (error, + COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", + "Unable to eglMakeCurrent with dummy surface"); + } + + return TRUE; +} + +static void +_cogl_winsys_egl_cleanup_context (CoglDisplay *display) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayWayland *wayland_display = egl_display->platform; + + if (egl_display->dummy_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface); + egl_display->dummy_surface = EGL_NO_SURFACE; + } + + if (wayland_display->dummy_wayland_egl_native_window) + { + wl_egl_window_destroy (wayland_display->dummy_wayland_egl_native_window); + wayland_display->dummy_wayland_egl_native_window = NULL; + } + + if (wayland_display->dummy_wayland_surface) + { + wl_surface_destroy (wayland_display->dummy_wayland_surface); + wayland_display->dummy_wayland_surface = NULL; + } +} + +static CoglBool +_cogl_winsys_egl_context_init (CoglContext *context, + CoglError **error) +{ + context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, + TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT, + TRUE); + + /* We'll manually handle queueing dirty events when the surface is + * first shown or when it is resized. Note that this is slightly + * different from the emulated behaviour that CoglFramebuffer would + * provide if we didn't set this flag because we want to emit the + * event on show instead of on allocation. The Wayland protocol + * delays setting the surface type until the next buffer is attached + * so attaching a buffer before setting the type would not cause + * anything to be displayed */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + return TRUE; +} + +static CoglBool +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + CoglError **error) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen; + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + + wayland_onscreen = g_slice_new0 (CoglOnscreenWayland); + egl_onscreen->platform = wayland_onscreen; + + _cogl_list_init (&wayland_onscreen->frame_callbacks); + + if (onscreen->foreign_surface) + wayland_onscreen->wayland_surface = onscreen->foreign_surface; + else + wayland_onscreen->wayland_surface = + wl_compositor_create_surface (wayland_renderer->wayland_compositor); + + if (!wayland_onscreen->wayland_surface) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Error while creating wayland surface for CoglOnscreen"); + return FALSE; + } + + wayland_onscreen->wayland_egl_native_window = + wl_egl_window_create (wayland_onscreen->wayland_surface, + cogl_framebuffer_get_width (framebuffer), + cogl_framebuffer_get_height (framebuffer)); + if (!wayland_onscreen->wayland_egl_native_window) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Error while creating wayland egl native window " + "for CoglOnscreen"); + return FALSE; + } + + egl_onscreen->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_config, + (EGLNativeWindowType) + wayland_onscreen->wayland_egl_native_window, + NULL); + + if (!onscreen->foreign_surface) + wayland_onscreen->wayland_shell_surface = + wl_shell_get_shell_surface (wayland_renderer->wayland_shell, + wayland_onscreen->wayland_surface); + + return TRUE; +} + +static void +free_frame_callback_data (FrameCallbackData *callback_data) +{ + cogl_object_unref (callback_data->frame_info); + wl_callback_destroy (callback_data->callback); + _cogl_list_remove (&callback_data->link); + g_slice_free (FrameCallbackData, callback_data); +} + +static void +_cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + FrameCallbackData *frame_callback_data, *tmp; + + _cogl_list_for_each_safe (frame_callback_data, + tmp, + &wayland_onscreen->frame_callbacks, + link) + free_frame_callback_data (frame_callback_data); + + if (wayland_onscreen->wayland_egl_native_window) + { + wl_egl_window_destroy (wayland_onscreen->wayland_egl_native_window); + wayland_onscreen->wayland_egl_native_window = NULL; + } + + if (!onscreen->foreign_surface) + { + /* NB: The wayland protocol docs explicitly state that + * "wl_shell_surface_destroy() must be called before destroying + * the wl_surface object." ... */ + if (wayland_onscreen->wayland_shell_surface) + { + wl_shell_surface_destroy (wayland_onscreen->wayland_shell_surface); + wayland_onscreen->wayland_shell_surface = NULL; + } + + if (wayland_onscreen->wayland_surface) + { + wl_surface_destroy (wayland_onscreen->wayland_surface); + wayland_onscreen->wayland_surface = NULL; + } + } + + g_slice_free (CoglOnscreenWayland, wayland_onscreen); +} + +static void +flush_pending_resize (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + + if (wayland_onscreen->has_pending) + { + wl_egl_window_resize (wayland_onscreen->wayland_egl_native_window, + wayland_onscreen->pending_width, + wayland_onscreen->pending_height, + wayland_onscreen->pending_dx, + wayland_onscreen->pending_dy); + + _cogl_framebuffer_winsys_update_size (COGL_FRAMEBUFFER (onscreen), + wayland_onscreen->pending_width, + wayland_onscreen->pending_height); + + _cogl_onscreen_queue_full_dirty (onscreen); + + wayland_onscreen->pending_dx = 0; + wayland_onscreen->pending_dy = 0; + wayland_onscreen->has_pending = FALSE; + } +} + +static void +frame_cb (void *data, + struct wl_callback *callback, + uint32_t time) +{ + FrameCallbackData *callback_data = data; + CoglFrameInfo *info = callback_data->frame_info; + CoglOnscreen *onscreen = callback_data->onscreen; + + g_assert (callback_data->callback == callback); + + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info); + _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info); + + free_frame_callback_data (callback_data); +} + +static const struct wl_callback_listener +frame_listener = +{ + frame_cb +}; + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + FrameCallbackData *frame_callback_data = g_slice_new (FrameCallbackData); + + flush_pending_resize (onscreen); + + /* Before calling the winsys function, + * cogl_onscreen_swap_buffers_with_damage() will have pushed the + * frame info object onto the end of the pending frames. We can grab + * it out of the queue now because we don't care about the order and + * we will just directly queue the event corresponding to the exact + * frame that Wayland reports as completed. This will steal the + * reference */ + frame_callback_data->frame_info = + g_queue_pop_tail (&onscreen->pending_frame_infos); + frame_callback_data->onscreen = onscreen; + + frame_callback_data->callback = + wl_surface_frame (wayland_onscreen->wayland_surface); + wl_callback_add_listener (frame_callback_data->callback, + &frame_listener, + frame_callback_data); + + _cogl_list_insert (&wayland_onscreen->frame_callbacks, + &frame_callback_data->link); + + parent_vtable->onscreen_swap_buffers_with_damage (onscreen, + rectangles, + n_rectangles); +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + + /* The first time the onscreen is shown we will set it to toplevel + * so that it will appear on the screen. If the surface is foreign + * then we won't have the shell surface and we'll just let the + * application deal with setting the surface type. */ + if (visibility && + wayland_onscreen->wayland_shell_surface && + !wayland_onscreen->shell_surface_type_set) + { + wl_shell_surface_set_toplevel (wayland_onscreen->wayland_shell_surface); + wayland_onscreen->shell_surface_type_set = TRUE; + _cogl_onscreen_queue_full_dirty (onscreen); + } + + /* FIXME: We should also do something here to hide the surface when + * visilibity == FALSE. It sounds like there are currently ongoing + * discussions about adding support for hiding surfaces in the + * Wayland protocol so we might as well wait until then to add that + * here. */ +} + +void +cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer, + struct wl_display *display) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->foreign_wayland_display = display; +} + +void +cogl_wayland_renderer_set_event_dispatch_enabled (CoglRenderer *renderer, + CoglBool enable) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->wayland_enable_event_dispatch = enable; +} + +struct wl_display * +cogl_wayland_renderer_get_display (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + + if (renderer->foreign_wayland_display) + return renderer->foreign_wayland_display; + else if (renderer->connected) + { + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + return wayland_renderer->wayland_display; + } + else + return NULL; +} + +struct wl_surface * +cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen; + CoglOnscreenWayland *wayland_onscreen; + + cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL); + + egl_onscreen = onscreen->winsys; + wayland_onscreen = egl_onscreen->platform; + + return wayland_onscreen->wayland_surface; +} + +struct wl_shell_surface * +cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen; + CoglOnscreenWayland *wayland_onscreen; + + cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL); + + egl_onscreen = onscreen->winsys; + wayland_onscreen = egl_onscreen->platform; + + return wayland_onscreen->wayland_shell_surface; +} + +void +cogl_wayland_onscreen_set_foreign_surface (CoglOnscreen *onscreen, + struct wl_surface *surface) +{ + CoglFramebuffer *fb; + + fb = COGL_FRAMEBUFFER (onscreen); + _COGL_RETURN_IF_FAIL (!fb->allocated); + + onscreen->foreign_surface = surface; +} + +void +cogl_wayland_onscreen_resize (CoglOnscreen *onscreen, + int width, + int height, + int offset_x, + int offset_y) +{ + CoglFramebuffer *fb; + + fb = COGL_FRAMEBUFFER (onscreen); + if (fb->allocated) + { + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + + if (cogl_framebuffer_get_width (fb) != width || + cogl_framebuffer_get_height (fb) != height || + offset_x || + offset_y) + { + wayland_onscreen->pending_width = width; + wayland_onscreen->pending_height = height; + wayland_onscreen->pending_dx += offset_x; + wayland_onscreen->pending_dy += offset_y; + wayland_onscreen->has_pending = TRUE; + + /* If nothing has been drawn to the framebuffer since the + * last swap then wl_egl_window_resize will take effect + * immediately. Otherwise it might not take effect until the + * next swap, depending on the version of Mesa. To keep + * consistent behaviour we'll delay the resize until the + * next swap unless we're sure nothing has been drawn */ + if (!fb->mid_scene) + flush_pending_resize (onscreen); + } + } + else + _cogl_framebuffer_winsys_update_size (fb, width, height); +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .cleanup_context = _cogl_winsys_egl_cleanup_context, + .context_init = _cogl_winsys_egl_context_init, + .onscreen_init = _cogl_winsys_egl_onscreen_init, + .onscreen_deinit = _cogl_winsys_egl_onscreen_deinit + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_wayland_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_WAYLAND winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + parent_vtable = _cogl_winsys_egl_get_vtable (); + vtable = *parent_vtable; + + vtable.id = COGL_WINSYS_ID_EGL_WAYLAND; + vtable.name = "EGL_WAYLAND"; + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + + vtable.onscreen_set_visibility = + _cogl_winsys_onscreen_set_visibility; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-egl-x11-private.h b/cogl/winsys/cogl-winsys-egl-x11-private.h new file mode 100644 index 0000000..206d485 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-x11-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_EGL_X11_PRIVATE_H +#define __COGL_WINSYS_EGL_X11_PRIVATE_H + +#include "cogl-winsys-private.h" + +const CoglWinsysVtable * +_cogl_winsys_egl_xlib_get_vtable (void); + +#endif /* __COGL_WINSYS_EGL_X11_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c new file mode 100644 index 0000000..26c9606 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-x11.c @@ -0,0 +1,874 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-winsys-egl-x11-private.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-xlib-renderer-private.h" +#include "cogl-xlib-renderer.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" + +#include "cogl-texture-pixmap-x11-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" + +#define COGL_ONSCREEN_X11_EVENT_MASK (StructureNotifyMask | ExposureMask) + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglDisplayXlib +{ + Window dummy_xwin; +} CoglDisplayXlib; + +typedef struct _CoglOnscreenXlib +{ + Window xwin; + CoglBool is_foreign_xwin; +} CoglOnscreenXlib; + +#ifdef EGL_KHR_image_pixmap +typedef struct _CoglTexturePixmapEGL +{ + EGLImageKHR image; + CoglTexture *texture; +} CoglTexturePixmapEGL; +#endif + +static CoglOnscreen * +find_onscreen_for_xid (CoglContext *context, uint32_t xid) +{ + GList *l; + + for (l = context->framebuffers; l; l = l->next) + { + CoglFramebuffer *framebuffer = l->data; + CoglOnscreenEGL *egl_onscreen; + CoglOnscreenXlib *xlib_onscreen; + + if (!framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + continue; + + egl_onscreen = COGL_ONSCREEN (framebuffer)->winsys; + xlib_onscreen = egl_onscreen->platform; + if (xlib_onscreen->xwin == (Window)xid) + return COGL_ONSCREEN (framebuffer); + } + + return NULL; +} + +static void +flush_pending_resize_notifications_cb (void *data, + void *user_data) +{ + CoglFramebuffer *framebuffer = data; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (egl_onscreen->pending_resize_notify) + { + _cogl_onscreen_notify_resize (onscreen); + egl_onscreen->pending_resize_notify = FALSE; + } + } +} + +static void +flush_pending_resize_notifications_idle (void *user_data) +{ + CoglContext *context = user_data; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + /* This needs to be disconnected before invoking the callbacks in + * case the callbacks cause it to be queued again */ + _cogl_closure_disconnect (egl_renderer->resize_notify_idle); + egl_renderer->resize_notify_idle = NULL; + + g_list_foreach (context->framebuffers, + flush_pending_resize_notifications_cb, + NULL); +} + +static void +notify_resize (CoglContext *context, + Window drawable, + int width, + int height) +{ + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreen *onscreen = find_onscreen_for_xid (context, drawable); + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglOnscreenEGL *egl_onscreen; + + if (!onscreen) + return; + + egl_onscreen = onscreen->winsys; + + _cogl_framebuffer_winsys_update_size (framebuffer, width, height); + + /* We only want to notify that a resize happened when the + * application calls cogl_context_dispatch so instead of immediately + * notifying we queue an idle callback */ + if (!egl_renderer->resize_notify_idle) + { + egl_renderer->resize_notify_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_resize_notifications_idle, + context, + NULL); + } + + egl_onscreen->pending_resize_notify = TRUE; +} + +static CoglFilterReturn +event_filter_cb (XEvent *xevent, void *data) +{ + CoglContext *context = data; + + if (xevent->type == ConfigureNotify) + { + notify_resize (context, + xevent->xconfigure.window, + xevent->xconfigure.width, + xevent->xconfigure.height); + } + else if (xevent->type == Expose) + { + CoglOnscreen *onscreen = + find_onscreen_for_xid (context, xevent->xexpose.window); + + if (onscreen) + { + CoglOnscreenDirtyInfo info; + + info.x = xevent->xexpose.x; + info.y = xevent->xexpose.y; + info.width = xevent->xexpose.width; + info.height = xevent->xexpose.height; + + _cogl_onscreen_queue_dirty (onscreen, &info); + } + } + + return COGL_FILTER_CONTINUE; +} + +static XVisualInfo * +get_visual_info (CoglDisplay *display, EGLConfig egl_config) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglRendererEGL *egl_renderer = display->renderer->winsys; + XVisualInfo visinfo_template; + int template_mask = 0; + XVisualInfo *visinfo = NULL; + int visinfos_count; + EGLint visualid, red_size, green_size, blue_size, alpha_size; + + eglGetConfigAttrib (egl_renderer->edpy, egl_config, + EGL_NATIVE_VISUAL_ID, &visualid); + + if (visualid != 0) + { + visinfo_template.visualid = visualid; + template_mask |= VisualIDMask; + } + else + { + /* some EGL drivers don't implement the EGL_NATIVE_VISUAL_ID + * attribute, so attempt to find the closest match. */ + + eglGetConfigAttrib (egl_renderer->edpy, egl_config, + EGL_RED_SIZE, &red_size); + eglGetConfigAttrib (egl_renderer->edpy, egl_config, + EGL_GREEN_SIZE, &green_size); + eglGetConfigAttrib (egl_renderer->edpy, egl_config, + EGL_BLUE_SIZE, &blue_size); + eglGetConfigAttrib (egl_renderer->edpy, egl_config, + EGL_ALPHA_SIZE, &alpha_size); + + visinfo_template.depth = red_size + green_size + blue_size + alpha_size; + template_mask |= VisualDepthMask; + + visinfo_template.screen = DefaultScreen (xlib_renderer->xdpy); + template_mask |= VisualScreenMask; + } + + visinfo = XGetVisualInfo (xlib_renderer->xdpy, + template_mask, + &visinfo_template, + &visinfos_count); + + return visinfo; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + _cogl_xlib_renderer_disconnect (renderer); + + eglTerminate (egl_renderer->edpy); + + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer; + CoglXlibRenderer *xlib_renderer; + + renderer->winsys = g_slice_new0 (CoglRendererEGL); + egl_renderer = renderer->winsys; + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable; + + if (!_cogl_xlib_renderer_connect (renderer, error)) + goto error; + + egl_renderer->edpy = + eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +_cogl_winsys_egl_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayXlib *xlib_display; + + xlib_display = g_slice_new0 (CoglDisplayXlib); + egl_display->platform = xlib_display; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayXlib, egl_display->platform); +} + +static CoglBool +_cogl_winsys_egl_context_init (CoglContext *context, + CoglError **error) +{ + cogl_xlib_renderer_add_filter (context->display->renderer, + event_filter_cb, + context); + + context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, + TRUE); + + /* We'll manually handle queueing dirty events in response to + * Expose events from X */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + return TRUE; +} + +static void +_cogl_winsys_egl_context_deinit (CoglContext *context) +{ + cogl_xlib_renderer_remove_filter (context->display->renderer, + event_filter_cb, + context); +} + +static CoglBool +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglOnscreenXlib *xlib_onscreen; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + Window xwin; + + /* FIXME: We need to explicitly Select for ConfigureNotify events. + * For foreign windows we need to be careful not to mess up any + * existing event mask. + * We need to document that for windows we create then toolkits + * must be careful not to clear event mask bits that we select. + */ + + /* XXX: Note we ignore the user's original width/height when + * given a foreign X window. */ + if (onscreen->foreign_xid) + { + Status status; + CoglXlibTrapState state; + XWindowAttributes attr; + int xerror; + + xwin = onscreen->foreign_xid; + + _cogl_xlib_renderer_trap_errors (display->renderer, &state); + + status = XGetWindowAttributes (xlib_renderer->xdpy, xwin, &attr); + xerror = _cogl_xlib_renderer_untrap_errors (display->renderer, + &state); + if (status == 0 || xerror) + { + char message[1000]; + XGetErrorText (xlib_renderer->xdpy, xerror, + message, sizeof (message)); + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to query geometry of foreign " + "xid 0x%08lX: %s", + xwin, message); + return FALSE; + } + + _cogl_framebuffer_winsys_update_size (framebuffer, + attr.width, attr.height); + + /* Make sure the app selects for the events we require... */ + onscreen->foreign_update_mask_callback (onscreen, + COGL_ONSCREEN_X11_EVENT_MASK, + onscreen-> + foreign_update_mask_data); + } + else + { + int width; + int height; + CoglXlibTrapState state; + XVisualInfo *xvisinfo; + XSetWindowAttributes xattr; + unsigned long mask; + int xerror; + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + + _cogl_xlib_renderer_trap_errors (display->renderer, &state); + + xvisinfo = get_visual_info (display, egl_config); + if (xvisinfo == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to retrieve the X11 visual of context's " + "fbconfig"); + return FALSE; + } + + /* window attributes */ + xattr.background_pixel = + WhitePixel (xlib_renderer->xdpy, + DefaultScreen (xlib_renderer->xdpy)); + xattr.border_pixel = 0; + /* XXX: is this an X resource that we are leaking‽... */ + xattr.colormap = + XCreateColormap (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + xvisinfo->visual, + AllocNone); + xattr.event_mask = COGL_ONSCREEN_X11_EVENT_MASK; + + mask = CWBorderPixel | CWColormap | CWEventMask; + + xwin = XCreateWindow (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + 0, 0, + width, height, + 0, + xvisinfo->depth, + InputOutput, + xvisinfo->visual, + mask, &xattr); + + XFree (xvisinfo); + + XSync (xlib_renderer->xdpy, False); + xerror = + _cogl_xlib_renderer_untrap_errors (display->renderer, &state); + if (xerror) + { + char message[1000]; + XGetErrorText (xlib_renderer->xdpy, xerror, + message, sizeof (message)); + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "X error while creating Window for CoglOnscreen: %s", + message); + return FALSE; + } + } + + xlib_onscreen = g_slice_new (CoglOnscreenXlib); + egl_onscreen->platform = xlib_onscreen; + + xlib_onscreen->xwin = xwin; + xlib_onscreen->is_foreign_xwin = onscreen->foreign_xid ? TRUE : FALSE; + + egl_onscreen->egl_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_config, + (EGLNativeWindowType) xlib_onscreen->xwin, + NULL); + + return TRUE; +} + +static void +_cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglRenderer *renderer = context->display->renderer; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglXlibTrapState old_state; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform; + + _cogl_xlib_renderer_trap_errors (renderer, &old_state); + + if (!xlib_onscreen->is_foreign_xwin && xlib_onscreen->xwin != None) + { + XDestroyWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); + xlib_onscreen->xwin = None; + } + else + xlib_onscreen->xwin = None; + + XSync (xlib_renderer->xdpy, False); + + if (_cogl_xlib_renderer_untrap_errors (renderer, + &old_state) != Success) + g_warning ("X Error while destroying X window"); + + g_slice_free (CoglOnscreenXlib, xlib_onscreen); +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglOnscreenEGL *onscreen_egl = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen_egl->platform; + + if (visibility) + XMapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); + else + XUnmapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); +} + +static void +_cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen, + CoglBool resizable) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform; + + XSizeHints *size_hints = XAllocSizeHints (); + + if (resizable) + { + /* TODO: Add cogl_onscreen_request_minimum_size () */ + size_hints->min_width = 1; + size_hints->min_height = 1; + + size_hints->max_width = INT_MAX; + size_hints->max_height = INT_MAX; + } + else + { + int width = cogl_framebuffer_get_width (framebuffer); + int height = cogl_framebuffer_get_height (framebuffer); + + size_hints->min_width = width; + size_hints->min_height = height; + + size_hints->max_width = width; + size_hints->max_height = height; + } + + XSetWMNormalHints (xlib_renderer->xdpy, xlib_onscreen->xwin, size_hints); + + XFree (size_hints); +} + +static uint32_t +_cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform; + + return xlib_onscreen->xwin; +} + +static CoglBool +_cogl_winsys_egl_context_created (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglDisplayEGL *egl_display = display->winsys; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglDisplayXlib *xlib_display = egl_display->platform; + XVisualInfo *xvisinfo; + XSetWindowAttributes attrs; + const char *error_message; + + xvisinfo = get_visual_info (display, egl_display->egl_config); + if (xvisinfo == NULL) + { + error_message = "Unable to find suitable X visual"; + goto fail; + } + + attrs.override_redirect = True; + attrs.colormap = XCreateColormap (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + xvisinfo->visual, + AllocNone); + attrs.border_pixel = 0; + + if ((egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) == 0) + { + xlib_display->dummy_xwin = + XCreateWindow (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + -100, -100, 1, 1, + 0, + xvisinfo->depth, + CopyFromParent, + xvisinfo->visual, + CWOverrideRedirect | + CWColormap | + CWBorderPixel, + &attrs); + + egl_display->dummy_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (EGLNativeWindowType) xlib_display->dummy_xwin, + NULL); + + if (egl_display->dummy_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create an EGL surface"; + XFree (xvisinfo); + goto fail; + } + } + + XFree (xvisinfo); + + if (!_cogl_winsys_egl_make_current (display, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->egl_context)) + { + if (egl_display->dummy_surface == EGL_NO_SURFACE) + error_message = "Unable to eglMakeCurrent with no surface"; + else + error_message = "Unable to eglMakeCurrent with dummy surface"; + goto fail; + } + + return TRUE; + +fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static void +_cogl_winsys_egl_cleanup_context (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayXlib *xlib_display = egl_display->platform; + CoglRenderer *renderer = display->renderer; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (egl_display->dummy_surface != EGL_NO_SURFACE) + { + eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface); + egl_display->dummy_surface = EGL_NO_SURFACE; + } + + if (xlib_display->dummy_xwin) + { + XDestroyWindow (xlib_renderer->xdpy, xlib_display->dummy_xwin); + xlib_display->dummy_xwin = None; + } +} + +/* XXX: This is a particularly hacky _cogl_winsys interface... */ +static XVisualInfo * +_cogl_winsys_xlib_get_visual_info (void) +{ + CoglDisplayEGL *egl_display; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (ctx->display->winsys, FALSE); + + egl_display = ctx->display->winsys; + + if (!egl_display->found_egl_config) + return NULL; + + return get_visual_info (ctx->display, egl_display->egl_config); +} + +#ifdef EGL_KHR_image_pixmap + +static CoglBool +_cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + CoglContext *ctx = tex->context; + CoglTexturePixmapEGL *egl_tex_pixmap; + EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + CoglPixelFormat texture_format; + CoglRendererEGL *egl_renderer; + + egl_renderer = ctx->display->renderer->winsys; + + if (!(egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP) || + !_cogl_has_private_feature + (ctx, COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE)) + { + tex_pixmap->winsys = NULL; + return FALSE; + } + + egl_tex_pixmap = g_new0 (CoglTexturePixmapEGL, 1); + + egl_tex_pixmap->image = + _cogl_egl_create_image (ctx, + EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer)tex_pixmap->pixmap, + attribs); + if (egl_tex_pixmap->image == EGL_NO_IMAGE_KHR) + { + g_free (egl_tex_pixmap); + return FALSE; + } + + texture_format = (tex_pixmap->depth >= 32 ? + COGL_PIXEL_FORMAT_RGBA_8888_PRE : + COGL_PIXEL_FORMAT_RGB_888); + + egl_tex_pixmap->texture = COGL_TEXTURE ( + _cogl_egl_texture_2d_new_from_image (ctx, + tex->width, + tex->height, + texture_format, + egl_tex_pixmap->image, + NULL)); + + tex_pixmap->winsys = egl_tex_pixmap; + + return TRUE; +} + +static void +_cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapEGL *egl_tex_pixmap; + + /* FIXME: It should be possible to get to a CoglContext from any + * CoglTexture pointer. */ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!tex_pixmap->winsys) + return; + + egl_tex_pixmap = tex_pixmap->winsys; + + if (egl_tex_pixmap->texture) + cogl_object_unref (egl_tex_pixmap->texture); + + if (egl_tex_pixmap->image != EGL_NO_IMAGE_KHR) + _cogl_egl_destroy_image (ctx, egl_tex_pixmap->image); + + tex_pixmap->winsys = NULL; + g_free (egl_tex_pixmap); +} + +static CoglBool +_cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, + CoglBool needs_mipmap) +{ + if (needs_mipmap) + return FALSE; + + return TRUE; +} + +static void +_cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap) +{ +} + +static CoglTexture * +_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapEGL *egl_tex_pixmap = tex_pixmap->winsys; + + return egl_tex_pixmap->texture; +} + +#endif /* EGL_KHR_image_pixmap */ + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .context_created = _cogl_winsys_egl_context_created, + .cleanup_context = _cogl_winsys_egl_cleanup_context, + .context_init = _cogl_winsys_egl_context_init, + .context_deinit = _cogl_winsys_egl_context_deinit, + .onscreen_init = _cogl_winsys_egl_onscreen_init, + .onscreen_deinit = _cogl_winsys_egl_onscreen_deinit + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_xlib_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + if (!vtable_inited) + { + /* The EGL_X11 winsys is a subclass of the EGL winsys so we + start by copying its vtable */ + + vtable = *_cogl_winsys_egl_get_vtable (); + + vtable.id = COGL_WINSYS_ID_EGL_XLIB; + vtable.name = "EGL_XLIB"; + vtable.constraints |= (COGL_RENDERER_CONSTRAINT_USES_X11 | + COGL_RENDERER_CONSTRAINT_USES_XLIB); + + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + + vtable.onscreen_set_visibility = + _cogl_winsys_onscreen_set_visibility; + vtable.onscreen_set_resizable = + _cogl_winsys_onscreen_set_resizable; + + vtable.onscreen_x11_get_window_xid = + _cogl_winsys_onscreen_x11_get_window_xid; + + vtable.xlib_get_visual_info = _cogl_winsys_xlib_get_visual_info; + +#ifdef EGL_KHR_image_pixmap + /* X11 tfp support... */ + /* XXX: instead of having a rather monolithic winsys vtable we could + * perhaps look for a way to separate these... */ + vtable.texture_pixmap_x11_create = + _cogl_winsys_texture_pixmap_x11_create; + vtable.texture_pixmap_x11_free = + _cogl_winsys_texture_pixmap_x11_free; + vtable.texture_pixmap_x11_update = + _cogl_winsys_texture_pixmap_x11_update; + vtable.texture_pixmap_x11_damage_notify = + _cogl_winsys_texture_pixmap_x11_damage_notify; + vtable.texture_pixmap_x11_get_texture = + _cogl_winsys_texture_pixmap_x11_get_texture; +#endif /* EGL_KHR_image_pixmap) */ + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c new file mode 100644 index 0000000..2f15c5c --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl.c @@ -0,0 +1,1083 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010,2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-i18n-private.h" +#include "cogl-util.h" +#include "cogl-winsys-egl-private.h" +#include "cogl-winsys-private.h" +#include "cogl-feature-private.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer.h" +#include "cogl-onscreen-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-renderer-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-gles2-context-private.h" +#include "cogl-error-private.h" +#include "cogl-egl.h" + +#include "cogl-private.h" + +#include +#include +#include +#include +#include + + +#ifndef EGL_KHR_create_context +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_OPENGL_ES3_BIT_KHR 0x0040 +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#endif + + +#define MAX_EGL_CONFIG_ATTRIBS 30 + +/* Define a set of arrays containing the functions required from GL + for each winsys feature */ +#define COGL_WINSYS_FEATURE_BEGIN(name, namespaces, extension_names, \ + egl_private_flags) \ + static const CoglFeatureFunction \ + cogl_egl_feature_ ## name ## _funcs[] = { +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglRendererEGL, pf_ ## name) }, +#define COGL_WINSYS_FEATURE_END() \ + { NULL, 0 }, \ + }; +#include "cogl-winsys-egl-feature-functions.h" + +/* Define an array of features */ +#undef COGL_WINSYS_FEATURE_BEGIN +#define COGL_WINSYS_FEATURE_BEGIN(name, namespaces, extension_names, \ + egl_private_flags) \ + { 255, 255, 0, namespaces, extension_names, \ + 0, egl_private_flags, \ + 0, \ + cogl_egl_feature_ ## name ## _funcs }, +#undef COGL_WINSYS_FEATURE_FUNCTION +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) +#undef COGL_WINSYS_FEATURE_END +#define COGL_WINSYS_FEATURE_END() + +static const CoglFeatureData winsys_feature_data[] = + { +#include "cogl-winsys-egl-feature-functions.h" + }; + +static const char * +get_error_string (void) +{ + switch (eglGetError()){ + case EGL_BAD_DISPLAY: + return "Invalid display"; + case EGL_NOT_INITIALIZED: + return "Display not initialized"; + case EGL_BAD_ALLOC: + return "Not enough resources to allocate context"; + case EGL_BAD_ATTRIBUTE: + return "Invalid attribute"; + case EGL_BAD_CONFIG: + return "Invalid config"; + case EGL_BAD_CONTEXT: + return "Invalid context"; + case EGL_BAD_CURRENT_SURFACE: + return "Invalid current surface"; + case EGL_BAD_MATCH: + return "Bad match"; + case EGL_BAD_NATIVE_PIXMAP: + return "Invalid native pixmap"; + case EGL_BAD_NATIVE_WINDOW: + return "Invalid native window"; + case EGL_BAD_PARAMETER: + return "Invalid parameter"; + case EGL_BAD_SURFACE: + return "Invalid surface"; + default: + g_assert_not_reached (); + } +} + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + void *ptr = NULL; + + if (!in_core) + ptr = eglGetProcAddress (name); + + /* eglGetProcAddress doesn't support fetching core API so we need to + get that separately with GModule */ + if (ptr == NULL) + g_module_symbol (renderer->libgl_module, name, &ptr); + + return ptr; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + /* This function must be overridden by a platform winsys */ + g_assert_not_reached (); +} + +/* Updates all the function pointers */ +static void +check_egl_extensions (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + const char *egl_extensions; + char **split_extensions; + int i; + + egl_extensions = eglQueryString (egl_renderer->edpy, EGL_EXTENSIONS); + split_extensions = g_strsplit (egl_extensions, " ", 0 /* max_tokens */); + + COGL_NOTE (WINSYS, " EGL Extensions: %s", egl_extensions); + + egl_renderer->private_features = 0; + for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++) + if (_cogl_feature_check (renderer, + "EGL", winsys_feature_data + i, 0, 0, + COGL_DRIVER_GL, /* the driver isn't used */ + split_extensions, + egl_renderer)) + { + egl_renderer->private_features |= + winsys_feature_data[i].feature_flags_private; + } + + g_strfreev (split_extensions); +} + +CoglBool +_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, + CoglError **error) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (!eglInitialize (egl_renderer->edpy, + &egl_renderer->egl_version_major, + &egl_renderer->egl_version_minor)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Couldn't initialize EGL"); + return FALSE; + } + + check_egl_extensions (renderer); + + return TRUE; +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + /* This function must be overridden by a platform winsys */ + g_assert_not_reached (); +} + +static void +egl_attributes_from_framebuffer_config (CoglDisplay *display, + CoglFramebufferConfig *config, + EGLint *attributes) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + int i = 0; + + /* Let the platform add attributes first */ + if (egl_renderer->platform_vtable->add_config_attributes) + i = egl_renderer->platform_vtable->add_config_attributes (display, + config, + attributes); + + if (config->need_stencil) + { + attributes[i++] = EGL_STENCIL_SIZE; + attributes[i++] = 2; + } + + attributes[i++] = EGL_RED_SIZE; + attributes[i++] = 1; + attributes[i++] = EGL_GREEN_SIZE; + attributes[i++] = 1; + attributes[i++] = EGL_BLUE_SIZE; + attributes[i++] = 1; + + attributes[i++] = EGL_ALPHA_SIZE; + attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE; + + attributes[i++] = EGL_DEPTH_SIZE; + attributes[i++] = 1; + + attributes[i++] = EGL_BUFFER_SIZE; + attributes[i++] = EGL_DONT_CARE; + + attributes[i++] = EGL_RENDERABLE_TYPE; + attributes[i++] = ((renderer->driver == COGL_DRIVER_GL || + renderer->driver == COGL_DRIVER_GL3) ? + EGL_OPENGL_BIT : + renderer->driver == COGL_DRIVER_GLES1 ? + EGL_OPENGL_ES_BIT : + EGL_OPENGL_ES2_BIT); + + attributes[i++] = EGL_SURFACE_TYPE; + attributes[i++] = EGL_WINDOW_BIT; + + if (config->samples_per_pixel) + { + attributes[i++] = EGL_SAMPLE_BUFFERS; + attributes[i++] = 1; + attributes[i++] = EGL_SAMPLES; + attributes[i++] = config->samples_per_pixel; + } + + attributes[i++] = EGL_NONE; + + g_assert (i < MAX_EGL_CONFIG_ATTRIBS); +} + +EGLBoolean +_cogl_winsys_egl_make_current (CoglDisplay *display, + EGLSurface draw, + EGLSurface read, + EGLContext context) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + EGLBoolean ret; + + if (egl_display->current_draw_surface == draw && + egl_display->current_read_surface == read && + egl_display->current_context == context) + return EGL_TRUE; + + ret = eglMakeCurrent (egl_renderer->edpy, + draw, + read, + context); + + egl_display->current_draw_surface = draw; + egl_display->current_read_surface = read; + egl_display->current_context = context; + + return ret; +} + +static void +cleanup_context (CoglDisplay *display) +{ + CoglRenderer *renderer = display->renderer; + CoglDisplayEGL *egl_display = display->winsys; + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (egl_display->egl_context != EGL_NO_CONTEXT) + { + _cogl_winsys_egl_make_current (display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + eglDestroyContext (egl_renderer->edpy, egl_display->egl_context); + egl_display->egl_context = EGL_NO_CONTEXT; + } + + if (egl_renderer->platform_vtable->cleanup_context) + egl_renderer->platform_vtable->cleanup_context (display); +} + +static CoglBool +try_create_context (CoglDisplay *display, + CoglError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglDisplayEGL *egl_display = display->winsys; + CoglRendererEGL *egl_renderer = renderer->winsys; + EGLDisplay edpy; + EGLConfig config; + EGLint config_count = 0; + EGLBoolean status; + EGLint attribs[9]; + EGLint cfg_attribs[MAX_EGL_CONFIG_ATTRIBS]; + const char *error_message; + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context == NULL, TRUE); + + if (renderer->driver == COGL_DRIVER_GL || + renderer->driver == COGL_DRIVER_GL3) + eglBindAPI (EGL_OPENGL_API); + + egl_attributes_from_framebuffer_config (display, + &display->onscreen_template->config, + cfg_attribs); + + edpy = egl_renderer->edpy; + + status = eglChooseConfig (edpy, + cfg_attribs, + &config, 1, + &config_count); + if (status != EGL_TRUE || config_count == 0) + { + error_message = "Unable to find a usable EGL configuration"; + goto fail; + } + + egl_display->egl_config = config; + + if (display->renderer->driver == COGL_DRIVER_GL3) + { + if (!(egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT)) + { + error_message = "Driver does not support GL 3 contexts"; + goto fail; + } + + /* Try to get a core profile 3.1 context with no deprecated features */ + attribs[0] = EGL_CONTEXT_MAJOR_VERSION_KHR; + attribs[1] = 3; + attribs[2] = EGL_CONTEXT_MINOR_VERSION_KHR; + attribs[3] = 1; + attribs[4] = EGL_CONTEXT_FLAGS_KHR; + attribs[5] = EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + attribs[6] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR; + attribs[7] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; + attribs[8] = EGL_NONE; + } + else if (display->renderer->driver == COGL_DRIVER_GLES2) + { + attribs[0] = EGL_CONTEXT_CLIENT_VERSION; + attribs[1] = 2; + attribs[2] = EGL_NONE; + } + else + attribs[0] = EGL_NONE; + + egl_display->egl_context = eglCreateContext (edpy, + config, + EGL_NO_CONTEXT, + attribs); + + if (egl_display->egl_context == EGL_NO_CONTEXT) + { + error_message = "Unable to create a suitable EGL context"; + goto fail; + } + + if (egl_renderer->platform_vtable->context_created && + !egl_renderer->platform_vtable->context_created (display, error)) + return FALSE; + + return TRUE; + +fail: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + + cleanup_context (display); + + return FALSE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + CoglRendererEGL *egl_renderer = display->renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + + _COGL_RETURN_IF_FAIL (egl_display != NULL); + + cleanup_context (display); + + if (egl_renderer->platform_vtable->display_destroy) + egl_renderer->platform_vtable->display_destroy (display); + + g_slice_free (CoglDisplayEGL, display->winsys); + display->winsys = NULL; +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayEGL *egl_display; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); + + egl_display = g_slice_new0 (CoglDisplayEGL); + display->winsys = egl_display; + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT + if (display->wayland_compositor_display) + { + struct wl_display *wayland_display = display->wayland_compositor_display; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + + if (egl_renderer->pf_eglBindWaylandDisplay) + egl_renderer->pf_eglBindWaylandDisplay (egl_renderer->edpy, + wayland_display); + } +#endif + + if (egl_renderer->platform_vtable->display_setup && + !egl_renderer->platform_vtable->display_setup (display, error)) + goto error; + + if (!try_create_context (display, error)) + goto error; + + egl_display->found_egl_config = TRUE; + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + CoglRenderer *renderer = context->display->renderer; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglRendererEGL *egl_renderer = renderer->winsys; + + context->winsys = g_new0 (CoglContextEGL, 1); + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); + + memset (context->winsys_features, 0, sizeof (context->winsys_features)); + + check_egl_extensions (renderer); + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + if (egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_SWAP_REGION) + { + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION, TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, TRUE); + } + + if ((egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_FENCE_SYNC) && + _cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_OES_EGL_SYNC)) + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_FENCE, TRUE); + + if (egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_BUFFER_AGE) + { + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_BUFFER_AGE, + TRUE); + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE); + } + + /* NB: We currently only support creating standalone GLES2 contexts + * for offscreen rendering and so we need a dummy (non-visible) + * surface to be able to bind those contexts */ + if (egl_display->dummy_surface != EGL_NO_SURFACE && + context->driver == COGL_DRIVER_GLES2) + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_GLES2_CONTEXT, TRUE); + + if (egl_renderer->platform_vtable->context_init && + !egl_renderer->platform_vtable->context_init (context, error)) + return FALSE; + + return TRUE; +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (egl_renderer->platform_vtable->context_deinit) + egl_renderer->platform_vtable->context_deinit (context); + + g_free (context->winsys); +} + +typedef struct _CoglGLES2ContextEGL +{ + EGLContext egl_context; + EGLSurface dummy_surface; +} CoglGLES2ContextEGL; + +static void * +_cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error) +{ + CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; + CoglDisplayEGL *egl_display = ctx->display->winsys; + EGLint attribs[3]; + EGLContext egl_context; + + attribs[0] = EGL_CONTEXT_CLIENT_VERSION; + attribs[1] = 2; + attribs[2] = EGL_NONE; + + egl_context = eglCreateContext (egl_renderer->edpy, + egl_display->egl_config, + egl_display->egl_context, + attribs); + if (egl_context == EGL_NO_CONTEXT) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, + "%s", get_error_string ()); + return NULL; + } + + return (void *)egl_context; +} + +static void +_cogl_winsys_destroy_gles2_context (CoglGLES2Context *gles2_ctx) +{ + CoglContext *context = gles2_ctx->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + EGLContext egl_context = gles2_ctx->winsys; + + _COGL_RETURN_IF_FAIL (egl_display->current_context != egl_context); + + eglDestroyContext (egl_renderer->edpy, egl_context); +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayEGL *egl_display = display->winsys; + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + EGLint attributes[MAX_EGL_CONFIG_ATTRIBS]; + EGLConfig egl_config; + EGLint config_count = 0; + EGLBoolean status; + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); + + egl_attributes_from_framebuffer_config (display, + &framebuffer->config, + attributes); + + status = eglChooseConfig (egl_renderer->edpy, + attributes, + &egl_config, 1, + &config_count); + if (status != EGL_TRUE || config_count == 0) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Failed to find a suitable EGL configuration"); + return FALSE; + } + + /* Update the real number of samples_per_pixel now that we have + * found an egl_config... */ + if (framebuffer->config.samples_per_pixel) + { + EGLint samples; + status = eglGetConfigAttrib (egl_renderer->edpy, + egl_config, + EGL_SAMPLES, &samples); + g_return_val_if_fail (status == EGL_TRUE, TRUE); + framebuffer->samples_per_pixel = samples; + } + + onscreen->winsys = g_slice_new0 (CoglOnscreenEGL); + + if (egl_renderer->platform_vtable->onscreen_init && + !egl_renderer->platform_vtable->onscreen_init (onscreen, + egl_config, + error)) + { + g_slice_free (CoglOnscreenEGL, onscreen->winsys); + return FALSE; + } + + return TRUE; +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + /* If we never successfully allocated then there's nothing to do */ + if (egl_onscreen == NULL) + return; + + if (egl_onscreen->egl_surface != EGL_NO_SURFACE) + { + /* Cogl always needs a valid context bound to something so if we + * are destroying the onscreen that is currently bound we'll + * switch back to the dummy drawable. */ + if (egl_display->dummy_surface != EGL_NO_SURFACE && + (egl_display->current_draw_surface == egl_onscreen->egl_surface || + egl_display->current_read_surface == egl_onscreen->egl_surface)) + { + _cogl_winsys_egl_make_current (context->display, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->current_context); + } + + if (eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface) + == EGL_FALSE) + g_warning ("Failed to destroy EGL surface"); + egl_onscreen->egl_surface = EGL_NO_SURFACE; + } + + if (egl_renderer->platform_vtable->onscreen_deinit) + egl_renderer->platform_vtable->onscreen_deinit (onscreen); + + g_slice_free (CoglOnscreenEGL, onscreen->winsys); + onscreen->winsys = NULL; +} + +static CoglBool +bind_onscreen_with_context (CoglOnscreen *onscreen, + EGLContext egl_context) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = fb->context; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + CoglBool status = _cogl_winsys_egl_make_current (context->display, + egl_onscreen->egl_surface, + egl_onscreen->egl_surface, + egl_context); + if (status) + { + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (fb->config.swap_throttled) + eglSwapInterval (egl_renderer->edpy, 1); + else + eglSwapInterval (egl_renderer->edpy, 0); + } + + return status; +} + +static CoglBool +bind_onscreen (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = fb->context; + CoglDisplayEGL *egl_display = context->display->winsys; + + return bind_onscreen_with_context (onscreen, egl_display->egl_context); +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + bind_onscreen (onscreen); +} + +#ifndef EGL_BUFFER_AGE_EXT +#define EGL_BUFFER_AGE_EXT 0x313D +#endif + +static int +_cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + EGLSurface surface = egl_onscreen->egl_surface; + int age; + + if (!(egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_BUFFER_AGE)) + return 0; + + eglQuerySurface (egl_renderer->edpy, surface, EGL_BUFFER_AGE_EXT, &age); + + return age; +} + +static void +_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, + const int *user_rectangles, + int n_rectangles) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + int framebuffer_height = cogl_framebuffer_get_height (framebuffer); + int *rectangles = g_alloca (sizeof (int) * n_rectangles * 4); + int i; + + /* eglSwapBuffersRegion expects rectangles relative to the + * bottom left corner but we are given rectangles relative to + * the top left so we need to flip them... */ + memcpy (rectangles, user_rectangles, sizeof (int) * n_rectangles * 4); + for (i = 0; i < n_rectangles; i++) + { + int *rect = &rectangles[4 * i]; + rect[1] = framebuffer_height - rect[1] - rect[3]; + } + + /* At least for eglSwapBuffers the EGL spec says that the surface to + swap must be bound to the current context. It looks like Mesa + also validates that this is the case for eglSwapBuffersRegion so + we must bind here too */ + _cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen), + COGL_FRAMEBUFFER (onscreen), + COGL_FRAMEBUFFER_STATE_BIND); + + if (egl_renderer->pf_eglSwapBuffersRegion (egl_renderer->edpy, + egl_onscreen->egl_surface, + n_rectangles, + rectangles) == EGL_FALSE) + g_warning ("Error reported by eglSwapBuffersRegion"); +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + /* The specification for EGL (at least in 1.4) says that the surface + needs to be bound to the current context for the swap to work + although it may change in future. Mesa explicitly checks for this + and just returns an error if this is not the case so we can't + just pretend this isn't in the spec. */ + _cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen), + COGL_FRAMEBUFFER (onscreen), + COGL_FRAMEBUFFER_STATE_BIND); + + if (n_rectangles && egl_renderer->pf_eglSwapBuffersWithDamage) + { + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + size_t size = n_rectangles * sizeof (int) * 4; + int *flipped = alloca (size); + int i; + + memcpy (flipped, rectangles, size); + for (i = 0; i < n_rectangles; i++) + { + const int *rect = rectangles + 4 * i; + int *flip_rect = flipped + 4 * i; + flip_rect[1] = fb->height - rect[1] - rect[3]; + } + + if (egl_renderer->pf_eglSwapBuffersWithDamage (egl_renderer->edpy, + egl_onscreen->egl_surface, + flipped, + n_rectangles) == EGL_FALSE) + g_warning ("Error reported by eglSwapBuffersWithDamage"); + } + else + eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (egl_display->current_draw_surface != egl_onscreen->egl_surface) + return; + + egl_display->current_draw_surface = EGL_NO_SURFACE; + + _cogl_winsys_onscreen_bind (onscreen); +} + +static void +_cogl_winsys_save_context (CoglContext *ctx) +{ + CoglContextEGL *egl_context = ctx->winsys; + CoglDisplayEGL *egl_display = ctx->display->winsys; + + egl_context->saved_draw_surface = egl_display->current_draw_surface; + egl_context->saved_read_surface = egl_display->current_read_surface; +} + +static CoglBool +_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error) +{ + CoglContext *ctx = gles2_ctx->context; + CoglDisplayEGL *egl_display = ctx->display->winsys; + CoglBool status; + + if (gles2_ctx->write_buffer && + cogl_is_onscreen (gles2_ctx->write_buffer)) + status = + bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer), + gles2_ctx->winsys); + else + status = _cogl_winsys_egl_make_current (ctx->display, + egl_display->dummy_surface, + egl_display->dummy_surface, + gles2_ctx->winsys); + + if (!status) + { + _cogl_set_error (error, + COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_MAKE_CURRENT, + "Failed to make gles2 context current"); + return FALSE; + } + + return TRUE; +} + +static void +_cogl_winsys_restore_context (CoglContext *ctx) +{ + CoglContextEGL *egl_context = ctx->winsys; + CoglDisplayEGL *egl_display = ctx->display->winsys; + + _cogl_winsys_egl_make_current (ctx->display, + egl_context->saved_draw_surface, + egl_context->saved_read_surface, + egl_display->egl_context); +} + +#if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) +static void * +_cogl_winsys_fence_add (CoglContext *context) +{ + CoglRendererEGL *renderer = context->display->renderer->winsys; + void *ret; + + if (renderer->pf_eglCreateSync) + ret = renderer->pf_eglCreateSync (renderer->edpy, + EGL_SYNC_FENCE_KHR, + NULL); + else + ret = NULL; + + return ret; +} + +static CoglBool +_cogl_winsys_fence_is_complete (CoglContext *context, void *fence) +{ + CoglRendererEGL *renderer = context->display->renderer->winsys; + EGLint ret; + + ret = renderer->pf_eglClientWaitSync (renderer->edpy, + fence, + EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, + 0); + return (ret == EGL_CONDITION_SATISFIED_KHR); +} + +static void +_cogl_winsys_fence_destroy (CoglContext *context, void *fence) +{ + CoglRendererEGL *renderer = context->display->renderer->winsys; + + renderer->pf_eglDestroySync (renderer->edpy, fence); +} +#endif + +static CoglWinsysVtable _cogl_winsys_vtable = + { + .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL | + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, + + /* This winsys is only used as a base for the EGL-platform + winsys's so it does not have an ID or a name */ + + .renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address, + .renderer_connect = _cogl_winsys_renderer_connect, + .renderer_disconnect = _cogl_winsys_renderer_disconnect, + .display_setup = _cogl_winsys_display_setup, + .display_destroy = _cogl_winsys_display_destroy, + .context_init = _cogl_winsys_context_init, + .context_deinit = _cogl_winsys_context_deinit, + .context_create_gles2_context = + _cogl_winsys_context_create_gles2_context, + .destroy_gles2_context = _cogl_winsys_destroy_gles2_context, + .onscreen_init = _cogl_winsys_onscreen_init, + .onscreen_deinit = _cogl_winsys_onscreen_deinit, + .onscreen_bind = _cogl_winsys_onscreen_bind, + .onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage, + .onscreen_swap_region = _cogl_winsys_onscreen_swap_region, + .onscreen_get_buffer_age = _cogl_winsys_onscreen_get_buffer_age, + .onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled, + + /* CoglGLES2Context related methods */ + .save_context = _cogl_winsys_save_context, + .set_gles2_context = _cogl_winsys_set_gles2_context, + .restore_context = _cogl_winsys_restore_context, + +#if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) + .fence_add = _cogl_winsys_fence_add, + .fence_is_complete = _cogl_winsys_fence_is_complete, + .fence_destroy = _cogl_winsys_fence_destroy, +#endif + }; + +/* XXX: we use a function because no doubt someone will complain + * about using c99 member initializers because they aren't portable + * to windows. We want to avoid having to rigidly follow the real + * order of members since some members are #ifdefd and we'd have + * to mirror the #ifdefing to add padding etc. For any winsys that + * can assume the platform has a sane compiler then we can just use + * c99 initializers for insane platforms they can initialize + * the members by name in a function. + */ +const CoglWinsysVtable * +_cogl_winsys_egl_get_vtable (void) +{ + return &_cogl_winsys_vtable; +} + +#ifdef EGL_KHR_image_base +EGLImageKHR +_cogl_egl_create_image (CoglContext *ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint *attribs) +{ + CoglDisplayEGL *egl_display = ctx->display->winsys; + CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; + EGLContext egl_ctx; + + _COGL_RETURN_VAL_IF_FAIL (egl_renderer->pf_eglCreateImage, EGL_NO_IMAGE_KHR); + + /* The EGL_KHR_image_pixmap spec explicitly states that EGL_NO_CONTEXT must + * always be used in conjunction with the EGL_NATIVE_PIXMAP_KHR target */ +#ifdef EGL_KHR_image_pixmap + if (target == EGL_NATIVE_PIXMAP_KHR) + egl_ctx = EGL_NO_CONTEXT; + else +#endif + egl_ctx = egl_display->egl_context; + + return egl_renderer->pf_eglCreateImage (egl_renderer->edpy, + egl_ctx, + target, + buffer, + attribs); +} + +void +_cogl_egl_destroy_image (CoglContext *ctx, + EGLImageKHR image) +{ + CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; + + _COGL_RETURN_IF_FAIL (egl_renderer->pf_eglDestroyImage); + + egl_renderer->pf_eglDestroyImage (egl_renderer->edpy, image); +} +#endif + +#ifdef EGL_WL_bind_wayland_display +CoglBool +_cogl_egl_query_wayland_buffer (CoglContext *ctx, + struct wl_resource *buffer, + int attribute, + int *value) +{ + CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; + + _COGL_RETURN_VAL_IF_FAIL (egl_renderer->pf_eglQueryWaylandBuffer, FALSE); + + return egl_renderer->pf_eglQueryWaylandBuffer (egl_renderer->edpy, + buffer, + attribute, + value); +} +#endif + +EGLDisplay +cogl_egl_context_get_egl_display (CoglContext *context) +{ + CoglRendererEGL *egl_renderer = context->display->renderer->winsys; + + return egl_renderer->edpy; +} + +EGLContext +cogl_egl_context_get_egl_context (CoglContext *context) +{ + CoglDisplayEGL *egl_display = context->display->winsys; + + return egl_display->egl_context; +} diff --git a/cogl/winsys/cogl-winsys-glx-feature-functions.h b/cogl/winsys/cogl-winsys-glx-feature-functions.h new file mode 100644 index 0000000..1e2cec1 --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx-feature-functions.h @@ -0,0 +1,209 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +/* This can be included multiple times with different definitions for + * the COGL_WINSYS_FEATURE_* functions. + */ + +/* Macro prototypes: + * COGL_WINSYS_FEATURE_BEGIN (major_glx_version, minor_glx_version, + * name, namespaces, extension_names, + * implied_legacy_feature_flags, + * implied_winsys_feature) + * COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name, + * (arguments)) + * ... + * COGL_WINSYS_FEATURE_END () + * + * Note: You can list multiple namespace and extension names if the + * corresponding _FEATURE_FUNCTIONS have the same semantics accross + * the different extension variants. + * + * XXX: NB: Don't add a trailing semicolon when using these macros + */ + +/* Base functions that we assume are always available */ +COGL_WINSYS_FEATURE_BEGIN (0, 0, /* always available */ + base_glx_functions, + "\0", + "\0", + 0, /* no implied public feature */ + 0 /* no winsys feature */) +COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyContext, + (Display *dpy, GLXContext ctx)) +COGL_WINSYS_FEATURE_FUNCTION (void, glXSwapBuffers, + (Display *dpy, GLXDrawable drawable)) +COGL_WINSYS_FEATURE_FUNCTION (Bool, glXIsDirect, + (Display *dpy, GLXContext ctx)) +COGL_WINSYS_FEATURE_FUNCTION (int, glXGetFBConfigAttrib, + (Display *dpy, GLXFBConfig config, + int attribute, int *value)) +COGL_WINSYS_FEATURE_FUNCTION (GLXWindow, glXCreateWindow, + (Display *dpy, GLXFBConfig config, + Window win, const int *attribList)) +COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyWindow, + (Display *dpy, GLXWindow window)) +COGL_WINSYS_FEATURE_FUNCTION (GLXPixmap, glXCreatePixmap, + (Display *dpy, GLXFBConfig config, + Pixmap pixmap, const int *attribList)) +COGL_WINSYS_FEATURE_FUNCTION (void, glXDestroyPixmap, + (Display *dpy, GLXPixmap pixmap)) +COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateNewContext, + (Display *dpy, GLXFBConfig config, + int renderType, GLXContext shareList, + Bool direct)) +COGL_WINSYS_FEATURE_FUNCTION (Bool, glXMakeContextCurrent, + (Display *dpy, GLXDrawable draw, + GLXDrawable read, GLXContext ctx)) +COGL_WINSYS_FEATURE_FUNCTION (void, glXSelectEvent, + (Display *dpy, GLXDrawable drawable, + unsigned long mask)) +COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXGetFBConfigs, + (Display *dpy, int screen, int *nelements)) +COGL_WINSYS_FEATURE_FUNCTION (GLXFBConfig *, glXChooseFBConfig, + (Display *dpy, int screen, + const int *attrib_list, int *nelements)) +COGL_WINSYS_FEATURE_FUNCTION (XVisualInfo *, glXGetVisualFromFBConfig, + (Display *dpy, GLXFBConfig config)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + texture_from_pixmap, + "EXT\0", + "texture_from_pixmap\0", + 0, + COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP) +COGL_WINSYS_FEATURE_FUNCTION (void, glXBindTexImage, + (Display *display, + GLXDrawable drawable, + int buffer, + int *attribList)) +COGL_WINSYS_FEATURE_FUNCTION (void, glXReleaseTexImage, + (Display *display, + GLXDrawable drawable, + int buffer)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + video_sync, + "SGI\0", + "video_sync\0", + 0, + COGL_WINSYS_FEATURE_VBLANK_COUNTER) +COGL_WINSYS_FEATURE_FUNCTION (int, glXGetVideoSync, + (unsigned int *count)) +COGL_WINSYS_FEATURE_FUNCTION (int, glXWaitVideoSync, + (int divisor, + int remainder, + unsigned int *count)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + swap_control, + "SGI\0", + "swap_control\0", + 0, + COGL_WINSYS_FEATURE_SWAP_THROTTLE) +COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval, + (int interval)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + sync_control, + "OML\0", + "sync_control\0", + 0, + 0) +COGL_WINSYS_FEATURE_FUNCTION (Bool, glXGetSyncValues, + (Display* dpy, + GLXDrawable drawable, + int64_t* ust, + int64_t* msc, + int64_t* sbc)) +COGL_WINSYS_FEATURE_FUNCTION (Bool, glXWaitForMsc, + (Display* dpy, + GLXDrawable drawable, + int64_t target_msc, + int64_t divisor, + int64_t remainder, + int64_t* ust, + int64_t* msc, + int64_t* sbc)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + copy_sub_buffer, + "MESA\0", + "copy_sub_buffer\0", + 0, +/* We initially assumed that copy_sub_buffer is synchronized on + * which is only the case for a subset of GPUs for example it is not + * synchronized on INTEL gen6 and gen7, so we remove this assumption + * for now + */ +#if 0 + COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED) +#endif + 0) +COGL_WINSYS_FEATURE_FUNCTION (void, glXCopySubBuffer, + (Display *dpy, + GLXDrawable drawable, + int x, int y, int width, int height)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + swap_event, + "INTEL\0", + "swap_event\0", + 0, + COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + create_context, + "ARB\0", + "create_context", + 0, + 0) +COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateContextAttribs, + (Display *dpy, + GLXFBConfig config, + GLXContext share_context, + Bool direct, + const int *attrib_list)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (255, 255, + buffer_age, + "EXT\0", + "buffer_age\0", + 0, + COGL_WINSYS_FEATURE_BUFFER_AGE) +COGL_WINSYS_FEATURE_END () diff --git a/cogl/winsys/cogl-winsys-glx-private.h b/cogl/winsys/cogl-winsys-glx-private.h new file mode 100644 index 0000000..9fb386f --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx-private.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_GLX_PRIVATE_H +#define __COGL_WINSYS_GLX_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_glx_get_vtable (void); + +#endif /* __COGL_WINSYS_GLX_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c new file mode 100644 index 0000000..3095acf --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx.c @@ -0,0 +1,2718 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010,2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-i18n-private.h" +#include "cogl-util.h" +#include "cogl-winsys-private.h" +#include "cogl-feature-private.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer.h" +#include "cogl-swap-chain-private.h" +#include "cogl-renderer-private.h" +#include "cogl-glx-renderer-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-glx-display-private.h" +#include "cogl-private.h" +#include "cogl-texture-2d-private.h" +#include "cogl-texture-rectangle-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-frame-info-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-xlib-renderer.h" +#include "cogl-util.h" +#include "cogl-winsys-glx-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" +#include "cogl-version.h" +#include "cogl-glx.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define COGL_ONSCREEN_X11_EVENT_MASK (StructureNotifyMask | ExposureMask) +#define MAX_GLX_CONFIG_ATTRIBS 30 + +typedef struct _CoglContextGLX +{ + GLXDrawable current_drawable; +} CoglContextGLX; + +typedef struct _CoglOnscreenXlib +{ + Window xwin; + int x, y; + CoglBool is_foreign_xwin; + CoglOutput *output; +} CoglOnscreenXlib; + +typedef struct _CoglOnscreenGLX +{ + CoglOnscreenXlib _parent; + GLXDrawable glxwin; + uint32_t last_swap_vsync_counter; + CoglBool pending_sync_notify; + CoglBool pending_complete_notify; + CoglBool pending_resize_notify; +} CoglOnscreenGLX; + +typedef struct _CoglTexturePixmapGLX +{ + GLXPixmap glx_pixmap; + CoglBool has_mipmap_space; + CoglBool can_mipmap; + + CoglTexture *glx_tex; + + CoglBool bind_tex_image_queued; + CoglBool pixmap_bound; +} CoglTexturePixmapGLX; + +/* Define a set of arrays containing the functions required from GL + for each winsys feature */ +#define COGL_WINSYS_FEATURE_BEGIN(major_version, minor_version, \ + name, namespaces, extension_names, \ + feature_flags, \ + winsys_feature) \ + static const CoglFeatureFunction \ + cogl_glx_feature_ ## name ## _funcs[] = { +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglGLXRenderer, name) }, +#define COGL_WINSYS_FEATURE_END() \ + { NULL, 0 }, \ + }; +#include "cogl-winsys-glx-feature-functions.h" + +/* Define an array of features */ +#undef COGL_WINSYS_FEATURE_BEGIN +#define COGL_WINSYS_FEATURE_BEGIN(major_version, minor_version, \ + name, namespaces, extension_names, \ + feature_flags, \ + winsys_feature) \ + { major_version, minor_version, \ + 0, namespaces, extension_names, \ + feature_flags, \ + 0, \ + winsys_feature, \ + cogl_glx_feature_ ## name ## _funcs }, +#undef COGL_WINSYS_FEATURE_FUNCTION +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) +#undef COGL_WINSYS_FEATURE_END +#define COGL_WINSYS_FEATURE_END() + +static const CoglFeatureData winsys_feature_data[] = + { +#include "cogl-winsys-glx-feature-functions.h" + }; + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + + /* The GLX_ARB_get_proc_address extension documents that this should + * work for core functions too so we don't need to do anything + * special with in_core */ + + return glx_renderer->glXGetProcAddress ((const GLubyte *) name); +} + +static CoglOnscreen * +find_onscreen_for_xid (CoglContext *context, uint32_t xid) +{ + GList *l; + + for (l = context->framebuffers; l; l = l->next) + { + CoglFramebuffer *framebuffer = l->data; + CoglOnscreenXlib *xlib_onscreen; + + if (framebuffer->type != COGL_FRAMEBUFFER_TYPE_ONSCREEN) + continue; + + /* Does the GLXEvent have the GLXDrawable or the X Window? */ + xlib_onscreen = COGL_ONSCREEN (framebuffer)->winsys; + if (xlib_onscreen->xwin == (Window)xid) + return COGL_ONSCREEN (framebuffer); + } + + return NULL; +} + +static void +ensure_ust_type (CoglRenderer *renderer, + GLXDrawable drawable) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + int64_t ust; + int64_t msc; + int64_t sbc; + struct timeval tv; + struct timespec ts; + int64_t current_system_time; + int64_t current_monotonic_time; + + if (glx_renderer->ust_type != COGL_GLX_UST_IS_UNKNOWN) + return; + + glx_renderer->ust_type = COGL_GLX_UST_IS_OTHER; + + if (glx_renderer->glXGetSyncValues == NULL) + goto out; + + if (!glx_renderer->glXGetSyncValues (xlib_renderer->xdpy, drawable, + &ust, &msc, &sbc)) + goto out; + + /* This is the time source that existing (buggy) linux drm drivers + * use */ + gettimeofday (&tv, NULL); + current_system_time = (tv.tv_sec * G_GINT64_CONSTANT (1000000)) + tv.tv_usec; + + if (current_system_time > ust - 1000000 && + current_system_time < ust + 1000000) + { + glx_renderer->ust_type = COGL_GLX_UST_IS_GETTIMEOFDAY; + goto out; + } + + /* This is the time source that the newer (fixed) linux drm + * drivers use (Linux >= 3.8) */ + clock_gettime (CLOCK_MONOTONIC, &ts); + current_monotonic_time = (ts.tv_sec * G_GINT64_CONSTANT (1000000)) + + (ts.tv_nsec / G_GINT64_CONSTANT (1000)); + + if (current_monotonic_time > ust - 1000000 && + current_monotonic_time < ust + 1000000) + { + glx_renderer->ust_type = COGL_GLX_UST_IS_MONOTONIC_TIME; + goto out; + } + + out: + COGL_NOTE (WINSYS, "Classified OML system time as: %s", + glx_renderer->ust_type == COGL_GLX_UST_IS_GETTIMEOFDAY ? "gettimeofday" : + (glx_renderer->ust_type == COGL_GLX_UST_IS_MONOTONIC_TIME ? "monotonic" : + "other")); + return; +} + +static int64_t +ust_to_nanoseconds (CoglRenderer *renderer, + GLXDrawable drawable, + int64_t ust) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + + ensure_ust_type (renderer, drawable); + + switch (glx_renderer->ust_type) + { + case COGL_GLX_UST_IS_UNKNOWN: + g_assert_not_reached (); + break; + case COGL_GLX_UST_IS_GETTIMEOFDAY: + case COGL_GLX_UST_IS_MONOTONIC_TIME: + return 1000 * ust; + case COGL_GLX_UST_IS_OTHER: + /* In this case the scale of UST is undefined so we can't easily + * scale to nanoseconds. + * + * For example the driver may be reporting the rdtsc CPU counter + * as UST values and so the scale would need to be determined + * empirically. + * + * Potentially we could block for a known duration within + * ensure_ust_type() to measure the timescale of UST but for now + * we just ignore unknown time sources */ + return 0; + } + + return 0; +} + +static int64_t +_cogl_winsys_get_clock_time (CoglContext *context) +{ + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + + /* We don't call ensure_ust_type() because we don't have a drawable + * to work with. cogl_get_clock_time() is documented to only work + * once a valid, non-zero, timestamp has been retrieved from Cogl. + */ + + switch (glx_renderer->ust_type) + { + case COGL_GLX_UST_IS_UNKNOWN: + case COGL_GLX_UST_IS_OTHER: + return 0; + case COGL_GLX_UST_IS_GETTIMEOFDAY: + { + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec * G_GINT64_CONSTANT (1000000000) + + tv.tv_usec * G_GINT64_CONSTANT (1000); + } + case COGL_GLX_UST_IS_MONOTONIC_TIME: + { + struct timespec ts; + + clock_gettime (CLOCK_MONOTONIC, &ts); + return ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; + } + } + + g_assert_not_reached(); + return 0; +} + +static void +flush_pending_notifications_cb (void *data, + void *user_data) +{ + CoglFramebuffer *framebuffer = data; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglBool pending_sync_notify = glx_onscreen->pending_sync_notify; + CoglBool pending_complete_notify = glx_onscreen->pending_complete_notify; + + /* If swap_region is called then notifying the sync event could + * potentially immediately queue a subsequent pending notify so + * we need to clear the flag before invoking the callback */ + glx_onscreen->pending_sync_notify = FALSE; + glx_onscreen->pending_complete_notify = FALSE; + + if (pending_sync_notify) + { + CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos); + + _cogl_onscreen_notify_frame_sync (onscreen, info); + } + + if (pending_complete_notify) + { + CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos); + + _cogl_onscreen_notify_complete (onscreen, info); + + cogl_object_unref (info); + } + + if (glx_onscreen->pending_resize_notify) + { + _cogl_onscreen_notify_resize (onscreen); + glx_onscreen->pending_resize_notify = FALSE; + } + } +} + +static void +flush_pending_notifications_idle (void *user_data) +{ + CoglContext *context = user_data; + CoglRenderer *renderer = context->display->renderer; + CoglGLXRenderer *glx_renderer = renderer->winsys; + + /* This needs to be disconnected before invoking the callbacks in + * case the callbacks cause it to be queued again */ + _cogl_closure_disconnect (glx_renderer->flush_notifications_idle); + glx_renderer->flush_notifications_idle = NULL; + + g_list_foreach (context->framebuffers, + flush_pending_notifications_cb, + NULL); +} + +static void +set_sync_pending (CoglOnscreen *onscreen) +{ + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglGLXRenderer *glx_renderer = renderer->winsys; + + /* We only want to dispatch sync events when the application calls + * cogl_context_dispatch so instead of immediately notifying we + * queue an idle callback */ + if (!glx_renderer->flush_notifications_idle) + { + glx_renderer->flush_notifications_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_notifications_idle, + context, + NULL); + } + + glx_onscreen->pending_sync_notify = TRUE; +} + +static void +set_complete_pending (CoglOnscreen *onscreen) +{ + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglRenderer *renderer = context->display->renderer; + CoglGLXRenderer *glx_renderer = renderer->winsys; + + /* We only want to notify swap completion when the application calls + * cogl_context_dispatch so instead of immediately notifying we + * queue an idle callback */ + if (!glx_renderer->flush_notifications_idle) + { + glx_renderer->flush_notifications_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_notifications_idle, + context, + NULL); + } + + glx_onscreen->pending_complete_notify = TRUE; +} + +static void +notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event) +{ + CoglOnscreen *onscreen = find_onscreen_for_xid (context, (uint32_t)swap_event->drawable); + CoglOnscreenGLX *glx_onscreen; + + if (!onscreen) + return; + glx_onscreen = onscreen->winsys; + + /* We only want to notify that the swap is complete when the + application calls cogl_context_dispatch so instead of immediately + notifying we'll set a flag to remember to notify later */ + set_sync_pending (onscreen); + + if (swap_event->ust != 0) + { + CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos); + + info->presentation_time = + ust_to_nanoseconds (context->display->renderer, + glx_onscreen->glxwin, + swap_event->ust); + } + + set_complete_pending (onscreen); +} + +static void +update_output (CoglOnscreen *onscreen) +{ + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglOutput *output; + int width, height; + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + output = _cogl_xlib_renderer_output_for_rectangle (display->renderer, + xlib_onscreen->x, + xlib_onscreen->y, + width, height); + if (xlib_onscreen->output != output) + { + if (xlib_onscreen->output) + cogl_object_unref (xlib_onscreen->output); + + xlib_onscreen->output = output; + + if (output) + cogl_object_ref (xlib_onscreen->output); + } +} + +static void +notify_resize (CoglContext *context, + XConfigureEvent *configure_event) +{ + CoglOnscreen *onscreen = find_onscreen_for_xid (context, + configure_event->window); + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglRenderer *renderer = context->display->renderer; + CoglGLXRenderer *glx_renderer = renderer->winsys; + CoglOnscreenGLX *glx_onscreen; + CoglOnscreenXlib *xlib_onscreen; + + if (!onscreen) + return; + + glx_onscreen = onscreen->winsys; + xlib_onscreen = onscreen->winsys; + + _cogl_framebuffer_winsys_update_size (framebuffer, + configure_event->width, + configure_event->height); + + /* We only want to notify that a resize happened when the + * application calls cogl_context_dispatch so instead of immediately + * notifying we queue an idle callback */ + if (!glx_renderer->flush_notifications_idle) + { + glx_renderer->flush_notifications_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_notifications_idle, + context, + NULL); + } + + glx_onscreen->pending_resize_notify = TRUE; + + if (!xlib_onscreen->is_foreign_xwin) + { + int x, y; + + if (configure_event->send_event) + { + x = configure_event->x; + y = configure_event->y; + } + else + { + Window child; + XTranslateCoordinates (configure_event->display, + configure_event->window, + DefaultRootWindow (configure_event->display), + 0, 0, &x, &y, &child); + } + + xlib_onscreen->x = x; + xlib_onscreen->y = y; + + update_output (onscreen); + } +} + +static CoglFilterReturn +glx_event_filter_cb (XEvent *xevent, void *data) +{ + CoglContext *context = data; +#ifdef GLX_INTEL_swap_event + CoglGLXRenderer *glx_renderer; +#endif + + if (xevent->type == ConfigureNotify) + { + notify_resize (context, + &xevent->xconfigure); + + /* we let ConfigureNotify pass through */ + return COGL_FILTER_CONTINUE; + } + +#ifdef GLX_INTEL_swap_event + glx_renderer = context->display->renderer->winsys; + + if (xevent->type == (glx_renderer->glx_event_base + GLX_BufferSwapComplete)) + { + GLXBufferSwapComplete *swap_event = (GLXBufferSwapComplete *) xevent; + + notify_swap_buffers (context, swap_event); + + /* remove SwapComplete events from the queue */ + return COGL_FILTER_REMOVE; + } +#endif /* GLX_INTEL_swap_event */ + + if (xevent->type == Expose) + { + CoglOnscreen *onscreen = + find_onscreen_for_xid (context, xevent->xexpose.window); + + if (onscreen) + { + CoglOnscreenDirtyInfo info; + + info.x = xevent->xexpose.x; + info.y = xevent->xexpose.y; + info.width = xevent->xexpose.width; + info.height = xevent->xexpose.height; + + _cogl_onscreen_queue_dirty (onscreen, &info); + } + + return COGL_FILTER_CONTINUE; + } + + return COGL_FILTER_CONTINUE; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + + _cogl_xlib_renderer_disconnect (renderer); + + if (glx_renderer->libgl_module) + g_module_close (glx_renderer->libgl_module); + + g_slice_free (CoglGLXRenderer, renderer->winsys); +} + +static CoglBool +update_all_outputs (CoglRenderer *renderer) +{ + GList *l; + + _COGL_GET_CONTEXT (context, FALSE); + + if (context->display == NULL) /* during connection */ + return FALSE; + + if (context->display->renderer != renderer) + return FALSE; + + for (l = context->framebuffers; l; l = l->next) + { + CoglFramebuffer *framebuffer = l->data; + + if (framebuffer->type != COGL_FRAMEBUFFER_TYPE_ONSCREEN) + continue; + + update_output (COGL_ONSCREEN (framebuffer)); + } + + return TRUE; +} + +static void +_cogl_winsys_renderer_outputs_changed (CoglRenderer *renderer) +{ + update_all_outputs (renderer); +} + +static CoglBool +resolve_core_glx_functions (CoglRenderer *renderer, + CoglError **error) +{ + CoglGLXRenderer *glx_renderer; + + glx_renderer = renderer->winsys; + + if (!g_module_symbol (glx_renderer->libgl_module, "glXQueryExtension", + (void **) &glx_renderer->glXQueryExtension) || + !g_module_symbol (glx_renderer->libgl_module, "glXQueryVersion", + (void **) &glx_renderer->glXQueryVersion) || + !g_module_symbol (glx_renderer->libgl_module, "glXQueryExtensionsString", + (void **) &glx_renderer->glXQueryExtensionsString) || + (!g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddress", + (void **) &glx_renderer->glXGetProcAddress) && + !g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB", + (void **) &glx_renderer->glXGetProcAddress)) || + !g_module_symbol (glx_renderer->libgl_module, "glXQueryDrawable", + (void **) &glx_renderer->glXQueryDrawable)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to resolve required GLX symbol"); + return FALSE; + } + + return TRUE; +} + +static void +update_base_winsys_features (CoglRenderer *renderer) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + const char *glx_extensions; + int default_screen; + char **split_extensions; + int i; + + default_screen = DefaultScreen (xlib_renderer->xdpy); + glx_extensions = + glx_renderer->glXQueryExtensionsString (xlib_renderer->xdpy, + default_screen); + + COGL_NOTE (WINSYS, " GLX Extensions: %s", glx_extensions); + + split_extensions = g_strsplit (glx_extensions, " ", 0 /* max_tokens */); + + for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++) + if (_cogl_feature_check (renderer, + "GLX", winsys_feature_data + i, + glx_renderer->glx_major, + glx_renderer->glx_minor, + COGL_DRIVER_GL, /* the driver isn't used */ + split_extensions, + glx_renderer)) + { + glx_renderer->legacy_feature_flags |= + winsys_feature_data[i].feature_flags; + if (winsys_feature_data[i].winsys_feature) + COGL_FLAGS_SET (glx_renderer->base_winsys_features, + winsys_feature_data[i].winsys_feature, + TRUE); + } + + g_strfreev (split_extensions); + + /* Note: the GLX_SGI_video_sync spec explicitly states this extension + * only works for direct contexts. */ + if (!glx_renderer->is_direct) + { + glx_renderer->glXGetVideoSync = NULL; + glx_renderer->glXWaitVideoSync = NULL; + COGL_FLAGS_SET (glx_renderer->base_winsys_features, + COGL_WINSYS_FEATURE_VBLANK_COUNTER, + FALSE); + } + + COGL_FLAGS_SET (glx_renderer->base_winsys_features, + COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, + TRUE); + + if (glx_renderer->glXWaitVideoSync || + glx_renderer->glXWaitForMsc) + COGL_FLAGS_SET (glx_renderer->base_winsys_features, + COGL_WINSYS_FEATURE_VBLANK_WAIT, + TRUE); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + CoglGLXRenderer *glx_renderer; + CoglXlibRenderer *xlib_renderer; + + renderer->winsys = g_slice_new0 (CoglGLXRenderer); + + glx_renderer = renderer->winsys; + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + if (!_cogl_xlib_renderer_connect (renderer, error)) + goto error; + + if (renderer->driver != COGL_DRIVER_GL && + renderer->driver != COGL_DRIVER_GL3) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "GLX Backend can only be used in conjunction with OpenGL"); + goto error; + } + + glx_renderer->libgl_module = g_module_open (COGL_GL_LIBNAME, + G_MODULE_BIND_LAZY); + + if (glx_renderer->libgl_module == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to dynamically open the OpenGL library"); + goto error; + } + + if (!resolve_core_glx_functions (renderer, error)) + goto error; + + if (!glx_renderer->glXQueryExtension (xlib_renderer->xdpy, + &glx_renderer->glx_error_base, + &glx_renderer->glx_event_base)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "XServer appears to lack required GLX support"); + goto error; + } + + /* XXX: Note: For a long time Mesa exported a hybrid GLX, exporting + * extensions specified to require GLX 1.3, but still reporting 1.2 + * via glXQueryVersion. */ + if (!glx_renderer->glXQueryVersion (xlib_renderer->xdpy, + &glx_renderer->glx_major, + &glx_renderer->glx_minor) + || !(glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 2)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "XServer appears to lack required GLX 1.2 support"); + goto error; + } + + update_base_winsys_features (renderer); + + glx_renderer->dri_fd = -1; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static CoglBool +update_winsys_features (CoglContext *context, CoglError **error) +{ + CoglGLXDisplay *glx_display = context->display->winsys; + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + + _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + memcpy (context->winsys_features, + glx_renderer->base_winsys_features, + sizeof (context->winsys_features)); + + context->feature_flags |= glx_renderer->legacy_feature_flags; + + context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, TRUE); + + if (glx_renderer->glXCopySubBuffer || context->glBlitFramebuffer) + { + CoglGpuInfo *info = &context->gpu; + CoglGpuInfoArchitecture arch = info->architecture; + + COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_REGION, TRUE); + + /* + * "The "drisw" binding in Mesa for loading sofware renderers is + * broken, and neither glBlitFramebuffer nor glXCopySubBuffer + * work correctly." + * - ajax + * - https://bugzilla.gnome.org/show_bug.cgi?id=674208 + * + * This is broken in software Mesa at least as of 7.10 and got + * fixed in Mesa 10.1 + */ + + if (info->driver_package == COGL_GPU_INFO_DRIVER_PACKAGE_MESA && + info->driver_package_version < COGL_VERSION_ENCODE (10, 1, 0) && + (arch == COGL_GPU_INFO_ARCHITECTURE_LLVMPIPE || + arch == COGL_GPU_INFO_ARCHITECTURE_SOFTPIPE || + arch == COGL_GPU_INFO_ARCHITECTURE_SWRAST)) + { + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION, FALSE); + } + } + + /* Note: glXCopySubBuffer and glBlitFramebuffer won't be throttled + * by the SwapInterval so we have to throttle swap_region requests + * manually... */ + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION) && + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT)) + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, TRUE); + + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + { + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, TRUE); + /* TODO: remove this deprecated feature */ + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, + TRUE); + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_PRESENTATION_TIME, + TRUE); + } + + /* We'll manually handle queueing dirty events in response to + * Expose events from X */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) + COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE); + + return TRUE; +} + +static void +glx_attributes_from_framebuffer_config (CoglDisplay *display, + CoglFramebufferConfig *config, + int *attributes) +{ + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + int i = 0; + + attributes[i++] = GLX_DRAWABLE_TYPE; + attributes[i++] = GLX_WINDOW_BIT; + + attributes[i++] = GLX_RENDER_TYPE; + attributes[i++] = GLX_RGBA_BIT; + + attributes[i++] = GLX_DOUBLEBUFFER; + attributes[i++] = GL_TRUE; + + attributes[i++] = GLX_RED_SIZE; + attributes[i++] = 1; + attributes[i++] = GLX_GREEN_SIZE; + attributes[i++] = 1; + attributes[i++] = GLX_BLUE_SIZE; + attributes[i++] = 1; + attributes[i++] = GLX_ALPHA_SIZE; + attributes[i++] = config->swap_chain->has_alpha ? 1 : GLX_DONT_CARE; + attributes[i++] = GLX_DEPTH_SIZE; + attributes[i++] = 1; + attributes[i++] = GLX_STENCIL_SIZE; + attributes[i++] = config->need_stencil ? 1: GLX_DONT_CARE; + + if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 4 && + config->samples_per_pixel) + { + attributes[i++] = GLX_SAMPLE_BUFFERS; + attributes[i++] = 1; + attributes[i++] = GLX_SAMPLES; + attributes[i++] = config->samples_per_pixel; + } + + attributes[i++] = None; + + g_assert (i < MAX_GLX_CONFIG_ATTRIBS); +} + +/* It seems the GLX spec never defined an invalid GLXFBConfig that + * we could overload as an indication of error, so we have to return + * an explicit boolean status. */ +static CoglBool +find_fbconfig (CoglDisplay *display, + CoglFramebufferConfig *config, + GLXFBConfig *config_ret, + CoglError **error) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + GLXFBConfig *configs = NULL; + int n_configs; + static int attributes[MAX_GLX_CONFIG_ATTRIBS]; + CoglBool ret = TRUE; + int xscreen_num = DefaultScreen (xlib_renderer->xdpy); + + glx_attributes_from_framebuffer_config (display, config, attributes); + + configs = glx_renderer->glXChooseFBConfig (xlib_renderer->xdpy, + xscreen_num, + attributes, + &n_configs); + if (!configs || n_configs == 0) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to find any compatible fbconfigs"); + ret = FALSE; + goto done; + } + + if (config->swap_chain->has_alpha) + { + int i; + + for (i = 0; i < n_configs; i++) + { + XVisualInfo *vinfo; + + vinfo = glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy, + configs[i]); + if (vinfo == NULL) + continue; + + if (vinfo->depth == 32 && + (vinfo->red_mask | vinfo->green_mask | vinfo->blue_mask) + != 0xffffffff) + { + COGL_NOTE (WINSYS, "Found an ARGB FBConfig [index:%d]", i); + *config_ret = configs[i]; + goto done; + } + } + + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find fbconfig with rgba visual"); + ret = FALSE; + goto done; + } + else + { + COGL_NOTE (WINSYS, "Using the first available FBConfig"); + *config_ret = configs[0]; + } + +done: + XFree (configs); + return ret; +} + +static GLXContext +create_gl3_context (CoglDisplay *display, + GLXFBConfig fb_config) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + + /* We want a core profile 3.1 context with no deprecated features */ + static const int attrib_list[] = + { + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + GLX_CONTEXT_MINOR_VERSION_ARB, 1, + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + None + }; + + /* Make sure that the display supports the GLX_ARB_create_context + extension */ + if (glx_renderer->glXCreateContextAttribs == NULL) + return NULL; + + return glx_renderer->glXCreateContextAttribs (xlib_renderer->xdpy, + fb_config, + NULL /* share_context */, + True, /* direct */ + attrib_list); +} + +static CoglBool +create_context (CoglDisplay *display, CoglError **error) +{ + CoglGLXDisplay *glx_display = display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + CoglBool support_transparent_windows = + display->onscreen_template->config.swap_chain->has_alpha; + GLXFBConfig config; + CoglError *fbconfig_error = NULL; + XSetWindowAttributes attrs; + XVisualInfo *xvisinfo; + GLXDrawable dummy_drawable; + CoglXlibTrapState old_state; + + _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context == NULL, TRUE); + + glx_display->found_fbconfig = + find_fbconfig (display, &display->onscreen_template->config, &config, + &fbconfig_error); + if (!glx_display->found_fbconfig) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find suitable fbconfig for the GLX context: %s", + fbconfig_error->message); + cogl_error_free (fbconfig_error); + return FALSE; + } + + glx_display->fbconfig = config; + glx_display->fbconfig_has_rgba_visual = support_transparent_windows; + + COGL_NOTE (WINSYS, "Creating GLX Context (display: %p)", + xlib_renderer->xdpy); + + if (display->renderer->driver == COGL_DRIVER_GL3) + glx_display->glx_context = create_gl3_context (display, config); + else + glx_display->glx_context = + glx_renderer->glXCreateNewContext (xlib_renderer->xdpy, + config, + GLX_RGBA_TYPE, + NULL, + True); + + if (glx_display->glx_context == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to create suitable GL context"); + return FALSE; + } + + glx_renderer->is_direct = + glx_renderer->glXIsDirect (xlib_renderer->xdpy, glx_display->glx_context); + + COGL_NOTE (WINSYS, "Setting %s context", + glx_renderer->is_direct ? "direct" : "indirect"); + + /* XXX: GLX doesn't let us make a context current without a window + * so we create a dummy window that we can use while no CoglOnscreen + * framebuffer is in use. + */ + + xvisinfo = glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy, + config); + if (xvisinfo == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to retrieve the X11 visual"); + return FALSE; + } + + _cogl_xlib_renderer_trap_errors (display->renderer, &old_state); + + attrs.override_redirect = True; + attrs.colormap = XCreateColormap (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + xvisinfo->visual, + AllocNone); + attrs.border_pixel = 0; + + glx_display->dummy_xwin = + XCreateWindow (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + -100, -100, 1, 1, + 0, + xvisinfo->depth, + CopyFromParent, + xvisinfo->visual, + CWOverrideRedirect | CWColormap | CWBorderPixel, + &attrs); + + /* Try and create a GLXWindow to use with extensions dependent on + * GLX versions >= 1.3 that don't accept regular X Windows as GLX + * drawables. */ + if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 3) + { + glx_display->dummy_glxwin = + glx_renderer->glXCreateWindow (xlib_renderer->xdpy, + config, + glx_display->dummy_xwin, + NULL); + } + + if (glx_display->dummy_glxwin) + dummy_drawable = glx_display->dummy_glxwin; + else + dummy_drawable = glx_display->dummy_xwin; + + COGL_NOTE (WINSYS, "Selecting dummy 0x%x for the GLX context", + (unsigned int) dummy_drawable); + + glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, + dummy_drawable, + dummy_drawable, + glx_display->glx_context); + + XFree (xvisinfo); + + if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to select the newly created GLX context"); + return FALSE; + } + + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + CoglGLXDisplay *glx_display = display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + + _COGL_RETURN_IF_FAIL (glx_display != NULL); + + if (glx_display->glx_context) + { + glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, + None, None, NULL); + glx_renderer->glXDestroyContext (xlib_renderer->xdpy, + glx_display->glx_context); + glx_display->glx_context = NULL; + } + + if (glx_display->dummy_glxwin) + { + glx_renderer->glXDestroyWindow (xlib_renderer->xdpy, + glx_display->dummy_glxwin); + glx_display->dummy_glxwin = None; + } + + if (glx_display->dummy_xwin) + { + XDestroyWindow (xlib_renderer->xdpy, glx_display->dummy_xwin); + glx_display->dummy_xwin = None; + } + + g_slice_free (CoglGLXDisplay, display->winsys); + display->winsys = NULL; +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglGLXDisplay *glx_display; + int i; + + _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); + + glx_display = g_slice_new0 (CoglGLXDisplay); + display->winsys = glx_display; + + if (!create_context (display, error)) + goto error; + + for (i = 0; i < COGL_GLX_N_CACHED_CONFIGS; i++) + glx_display->glx_cached_configs[i].depth = -1; + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + context->winsys = g_new0 (CoglContextGLX, 1); + + cogl_xlib_renderer_add_filter (context->display->renderer, + glx_event_filter_cb, + context); + return update_winsys_features (context, error); +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ + cogl_xlib_renderer_remove_filter (context->display->renderer, + glx_event_filter_cb, + context); + g_free (context->winsys); +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglGLXDisplay *glx_display = display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + Window xwin; + CoglOnscreenXlib *xlib_onscreen; + CoglOnscreenGLX *glx_onscreen; + GLXFBConfig fbconfig; + CoglError *fbconfig_error = NULL; + + _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); + + if (!find_fbconfig (display, &framebuffer->config, + &fbconfig, + &fbconfig_error)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find suitable fbconfig for the GLX context: %s", + fbconfig_error->message); + cogl_error_free (fbconfig_error); + return FALSE; + } + + /* Update the real number of samples_per_pixel now that we have + * found an fbconfig... */ + if (framebuffer->config.samples_per_pixel) + { + int samples; + int status = glx_renderer->glXGetFBConfigAttrib (xlib_renderer->xdpy, + fbconfig, + GLX_SAMPLES, + &samples); + g_return_val_if_fail (status == Success, TRUE); + framebuffer->samples_per_pixel = samples; + } + + /* FIXME: We need to explicitly Select for ConfigureNotify events. + * For foreign windows we need to be careful not to mess up any + * existing event mask. + * We need to document that for windows we create then toolkits + * must be careful not to clear event mask bits that we select. + */ + + /* XXX: Note we ignore the user's original width/height when + * given a foreign X window. */ + if (onscreen->foreign_xid) + { + Status status; + CoglXlibTrapState state; + XWindowAttributes attr; + int xerror; + + xwin = onscreen->foreign_xid; + + _cogl_xlib_renderer_trap_errors (display->renderer, &state); + + status = XGetWindowAttributes (xlib_renderer->xdpy, xwin, &attr); + XSync (xlib_renderer->xdpy, False); + xerror = _cogl_xlib_renderer_untrap_errors (display->renderer, &state); + if (status == 0 || xerror) + { + char message[1000]; + XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof(message)); + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to query geometry of foreign xid 0x%08lX: %s", + xwin, message); + return FALSE; + } + + _cogl_framebuffer_winsys_update_size (framebuffer, + attr.width, attr.height); + + /* Make sure the app selects for the events we require... */ + onscreen->foreign_update_mask_callback (onscreen, + COGL_ONSCREEN_X11_EVENT_MASK, + onscreen->foreign_update_mask_data); + } + else + { + int width; + int height; + CoglXlibTrapState state; + XVisualInfo *xvisinfo; + XSetWindowAttributes xattr; + unsigned long mask; + int xerror; + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + + _cogl_xlib_renderer_trap_errors (display->renderer, &state); + + xvisinfo = glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy, + fbconfig); + if (xvisinfo == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to retrieve the X11 visual of context's " + "fbconfig"); + return FALSE; + } + + /* window attributes */ + xattr.background_pixel = WhitePixel (xlib_renderer->xdpy, + DefaultScreen (xlib_renderer->xdpy)); + xattr.border_pixel = 0; + /* XXX: is this an X resource that we are leaking‽... */ + xattr.colormap = XCreateColormap (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + xvisinfo->visual, + AllocNone); + xattr.event_mask = COGL_ONSCREEN_X11_EVENT_MASK; + + mask = CWBorderPixel | CWColormap | CWEventMask; + + xwin = XCreateWindow (xlib_renderer->xdpy, + DefaultRootWindow (xlib_renderer->xdpy), + 0, 0, + width, height, + 0, + xvisinfo->depth, + InputOutput, + xvisinfo->visual, + mask, &xattr); + + XFree (xvisinfo); + + XSync (xlib_renderer->xdpy, False); + xerror = _cogl_xlib_renderer_untrap_errors (display->renderer, &state); + if (xerror) + { + char message[1000]; + XGetErrorText (xlib_renderer->xdpy, xerror, + message, sizeof (message)); + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "X error while creating Window for CoglOnscreen: %s", + message); + return FALSE; + } + } + + onscreen->winsys = g_slice_new0 (CoglOnscreenGLX); + xlib_onscreen = onscreen->winsys; + glx_onscreen = onscreen->winsys; + + xlib_onscreen->xwin = xwin; + xlib_onscreen->is_foreign_xwin = onscreen->foreign_xid ? TRUE : FALSE; + + /* Try and create a GLXWindow to use with extensions dependent on + * GLX versions >= 1.3 that don't accept regular X Windows as GLX + * drawables. */ + if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 3) + { + glx_onscreen->glxwin = + glx_renderer->glXCreateWindow (xlib_renderer->xdpy, + fbconfig, + xlib_onscreen->xwin, + NULL); + } + +#ifdef GLX_INTEL_swap_event + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + { + GLXDrawable drawable = + glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + + /* similarly to above, we unconditionally select this event + * because we rely on it to advance the master clock, and + * drive redraw/relayout, animations and event handling. + */ + glx_renderer->glXSelectEvent (xlib_renderer->xdpy, + drawable, + GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK); + } +#endif /* GLX_INTEL_swap_event */ + + return TRUE; +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglContextGLX *glx_context = context->winsys; + CoglGLXDisplay *glx_display = context->display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglXlibTrapState old_state; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + GLXDrawable drawable; + + /* If we never successfully allocated then there's nothing to do */ + if (glx_onscreen == NULL) + return; + + if (xlib_onscreen->output != NULL) + { + cogl_object_unref (xlib_onscreen->output); + xlib_onscreen->output = NULL; + } + + _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state); + + drawable = + glx_onscreen->glxwin == None ? xlib_onscreen->xwin : glx_onscreen->glxwin; + + /* Cogl always needs a valid context bound to something so if we are + * destroying the onscreen that is currently bound we'll switch back + * to the dummy drawable. Although the documentation for + * glXDestroyWindow states that a currently bound window won't + * actually be destroyed until it is unbound, it looks like this + * doesn't work if the X window itself is destroyed */ + if (drawable == glx_context->current_drawable) + { + GLXDrawable dummy_drawable = (glx_display->dummy_glxwin == None ? + glx_display->dummy_xwin : + glx_display->dummy_glxwin); + + glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, + dummy_drawable, + dummy_drawable, + glx_display->glx_context); + glx_context->current_drawable = dummy_drawable; + } + + if (glx_onscreen->glxwin != None) + { + glx_renderer->glXDestroyWindow (xlib_renderer->xdpy, + glx_onscreen->glxwin); + glx_onscreen->glxwin = None; + } + + if (!xlib_onscreen->is_foreign_xwin && xlib_onscreen->xwin != None) + { + XDestroyWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); + xlib_onscreen->xwin = None; + } + else + xlib_onscreen->xwin = None; + + XSync (xlib_renderer->xdpy, False); + + _cogl_xlib_renderer_untrap_errors (context->display->renderer, &old_state); + + g_slice_free (CoglOnscreenGLX, onscreen->winsys); + onscreen->winsys = NULL; +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextGLX *glx_context = context->winsys; + CoglGLXDisplay *glx_display = context->display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglXlibTrapState old_state; + GLXDrawable drawable; + + drawable = + glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + + if (glx_context->current_drawable == drawable) + return; + + _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state); + + COGL_NOTE (WINSYS, + "MakeContextCurrent dpy: %p, window: 0x%x (%s), context: %p", + xlib_renderer->xdpy, + (unsigned int) drawable, + xlib_onscreen->is_foreign_xwin ? "foreign" : "native", + glx_display->glx_context); + + glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, + drawable, + drawable, + glx_display->glx_context); + + /* In case we are using GLX_SGI_swap_control for vblank syncing + * we need call glXSwapIntervalSGI here to make sure that it + * affects the current drawable. + * + * Note: we explicitly set to 0 when we aren't using the swap + * interval to synchronize since some drivers have a default + * swap interval of 1. Sadly some drivers even ignore requests + * to disable the swap interval. + * + * NB: glXSwapIntervalSGI applies to the context not the + * drawable which is why we can't just do this once when the + * framebuffer is allocated. + * + * FIXME: We should check for GLX_EXT_swap_control which allows + * per framebuffer swap intervals. GLX_MESA_swap_control also + * allows per-framebuffer swap intervals but the semantics tend + * to be more muddled since Mesa drivers tend to expose both the + * MESA and SGI extensions which should technically be mutually + * exclusive. + */ + if (glx_renderer->glXSwapInterval) + { + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + if (fb->config.swap_throttled) + glx_renderer->glXSwapInterval (1); + else + glx_renderer->glXSwapInterval (0); + } + + XSync (xlib_renderer->xdpy, False); + + /* FIXME: We should be reporting a CoglError here + */ + if (_cogl_xlib_renderer_untrap_errors (context->display->renderer, + &old_state)) + { + g_warning ("X Error received while making drawable 0x%08lX current", + drawable); + return; + } + + glx_context->current_drawable = drawable; +} + +static void +_cogl_winsys_wait_for_gpu (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *ctx = framebuffer->context; + + ctx->glFinish (); +} + +static void +_cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *ctx = framebuffer->context; + CoglGLXRenderer *glx_renderer; + CoglXlibRenderer *xlib_renderer; + + glx_renderer = ctx->display->renderer->winsys; + xlib_renderer = _cogl_xlib_renderer_get_data (ctx->display->renderer); + + if (glx_renderer->glXWaitForMsc || + glx_renderer->glXGetVideoSync) + { + CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos); + + if (glx_renderer->glXWaitForMsc) + { + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + Drawable drawable = glx_onscreen->glxwin; + int64_t ust; + int64_t msc; + int64_t sbc; + + glx_renderer->glXGetSyncValues (xlib_renderer->xdpy, drawable, + &ust, &msc, &sbc); + glx_renderer->glXWaitForMsc (xlib_renderer->xdpy, drawable, + 0, 2, (msc + 1) % 2, + &ust, &msc, &sbc); + info->presentation_time = ust_to_nanoseconds (ctx->display->renderer, + drawable, + ust); + } + else + { + uint32_t current_count; + struct timespec ts; + + glx_renderer->glXGetVideoSync (¤t_count); + glx_renderer->glXWaitVideoSync (2, + (current_count + 1) % 2, + ¤t_count); + + clock_gettime (CLOCK_MONOTONIC, &ts); + info->presentation_time = + ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; + } + } +} + +static uint32_t +_cogl_winsys_get_vsync_counter (CoglContext *ctx) +{ + uint32_t video_sync_count; + CoglGLXRenderer *glx_renderer; + + glx_renderer = ctx->display->renderer->winsys; + + glx_renderer->glXGetVideoSync (&video_sync_count); + + return video_sync_count; +} + +#ifndef GLX_BACK_BUFFER_AGE_EXT +#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 +#endif + +static int +_cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + GLXDrawable drawable = glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + unsigned int age; + + if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) + return 0; + + glx_renderer->glXQueryDrawable (xlib_renderer->xdpy, drawable, GLX_BACK_BUFFER_AGE_EXT, &age); + + return age; +} + +static void +set_frame_info_output (CoglOnscreen *onscreen, + CoglOutput *output) +{ + CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos); + + info->output = output; + + if (output) + { + float refresh_rate = cogl_output_get_refresh_rate (output); + if (refresh_rate != 0.0) + info->refresh_rate = refresh_rate; + } +} + +static void +_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, + const int *user_rectangles, + int n_rectangles) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + GLXDrawable drawable = + glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + uint32_t end_frame_vsync_counter = 0; + CoglBool have_counter; + CoglBool can_wait; + int x_min = 0, x_max = 0, y_min = 0, y_max = 0; + + /* + * We assume that glXCopySubBuffer is synchronized which means it won't prevent multiple + * blits per retrace if they can all be performed in the blanking period. If that's the + * case then we still want to use the vblank sync menchanism but + * we only need it to throttle redraws. + */ + CoglBool blit_sub_buffer_is_synchronized = + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED); + + int framebuffer_width = cogl_framebuffer_get_width (framebuffer); + int framebuffer_height = cogl_framebuffer_get_height (framebuffer); + int *rectangles = g_alloca (sizeof (int) * n_rectangles * 4); + int i; + + /* glXCopySubBuffer expects rectangles relative to the bottom left corner but + * we are given rectangles relative to the top left so we need to flip + * them... */ + memcpy (rectangles, user_rectangles, sizeof (int) * n_rectangles * 4); + for (i = 0; i < n_rectangles; i++) + { + int *rect = &rectangles[4 * i]; + + if (i == 0) + { + x_min = rect[0]; + x_max = rect[0] + rect[2]; + y_min = rect[1]; + y_max = rect[1] + rect[3]; + } + else + { + x_min = MIN (x_min, rect[0]); + x_max = MAX (x_max, rect[0] + rect[2]); + y_min = MIN (y_min, rect[1]); + y_max = MAX (y_max, rect[1] + rect[3]); + } + + rect[1] = framebuffer_height - rect[1] - rect[3]; + + } + + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + + if (framebuffer->config.swap_throttled) + { + have_counter = + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_COUNTER); + can_wait = _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT); + } + else + { + have_counter = FALSE; + can_wait = FALSE; + } + + /* We need to ensure that all the rendering is done, otherwise + * redraw operations that are slower than the framerate can + * queue up in the pipeline during a heavy animation, causing a + * larger and larger backlog of rendering visible as lag to the + * user. + * + * For an exaggerated example consider rendering at 60fps (so 16ms + * per frame) and you have a really slow frame that takes 160ms to + * render, even though painting the scene and issuing the commands + * to the GPU takes no time at all. If all we did was use the + * video_sync extension to throttle the painting done by the CPU + * then every 16ms we would have another frame queued up even though + * the GPU has only rendered one tenth of the current frame. By the + * time the GPU would get to the 2nd frame there would be 9 frames + * waiting to be rendered. + * + * The problem is that we don't currently have a good way to throttle + * the GPU, only the CPU so we have to resort to synchronizing the + * GPU with the CPU to throttle it. + * + * Note: since calling glFinish() and synchronizing the CPU with + * the GPU is far from ideal, we hope that this is only a short + * term solution. + * - One idea is to using sync objects to track render + * completion so we can throttle the backlog (ideally with an + * additional extension that lets us get notifications in our + * mainloop instead of having to busy wait for the + * completion.) + * - Another option is to support clipped redraws by reusing the + * contents of old back buffers such that we can flip instead + * of using a blit and then we can use GLX_INTEL_swap_events + * to throttle. For this though we would still probably want an + * additional extension so we can report the limited region of + * the window damage to X/compositors. + */ + _cogl_winsys_wait_for_gpu (onscreen); + + if (blit_sub_buffer_is_synchronized && have_counter && can_wait) + { + end_frame_vsync_counter = _cogl_winsys_get_vsync_counter (context); + + /* If we have the GLX_SGI_video_sync extension then we can + * be a bit smarter about how we throttle blits by avoiding + * any waits if we can see that the video sync count has + * already progressed. */ + if (glx_onscreen->last_swap_vsync_counter == end_frame_vsync_counter) + _cogl_winsys_wait_for_vblank (onscreen); + } + else if (can_wait) + _cogl_winsys_wait_for_vblank (onscreen); + + if (glx_renderer->glXCopySubBuffer) + { + Display *xdpy = xlib_renderer->xdpy; + int i; + for (i = 0; i < n_rectangles; i++) + { + int *rect = &rectangles[4 * i]; + glx_renderer->glXCopySubBuffer (xdpy, drawable, + rect[0], rect[1], rect[2], rect[3]); + } + } + else if (context->glBlitFramebuffer) + { + int i; + /* XXX: checkout how this state interacts with the code to use + * glBlitFramebuffer in Neil's texture atlasing branch */ + + /* glBlitFramebuffer is affected by the scissor so we need to + * ensure we have flushed an empty clip stack to get rid of it. + * We also mark that the clip state is dirty so that it will be + * flushed to the correct state the next time something is + * drawn */ + _cogl_clip_stack_flush (NULL, framebuffer); + context->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; + + context->glDrawBuffer (GL_FRONT); + for (i = 0; i < n_rectangles; i++) + { + int *rect = &rectangles[4 * i]; + int x2 = rect[0] + rect[2]; + int y2 = rect[1] + rect[3]; + context->glBlitFramebuffer (rect[0], rect[1], x2, y2, + rect[0], rect[1], x2, y2, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + context->glDrawBuffer (GL_BACK); + } + + /* NB: unlike glXSwapBuffers, glXCopySubBuffer and + * glBlitFramebuffer don't issue an implicit glFlush() so we + * have to flush ourselves if we want the request to complete in + * a finite amount of time since otherwise the driver can batch + * the command indefinitely. */ + context->glFlush (); + + /* NB: It's important we save the counter we read before acting on + * the swap request since if we are mixing and matching different + * swap methods between frames we don't want to read the timer e.g. + * after calling glFinish() some times and not for others. + * + * In other words; this way we consistently save the time at the end + * of the applications frame such that the counter isn't muddled by + * the varying costs of different swap methods. + */ + if (have_counter) + glx_onscreen->last_swap_vsync_counter = end_frame_vsync_counter; + + if (!xlib_onscreen->is_foreign_xwin) + { + CoglOutput *output; + + x_min = CLAMP (x_min, 0, framebuffer_width); + x_max = CLAMP (x_max, 0, framebuffer_width); + y_min = CLAMP (y_min, 0, framebuffer_width); + y_max = CLAMP (y_max, 0, framebuffer_height); + + output = + _cogl_xlib_renderer_output_for_rectangle (context->display->renderer, + xlib_onscreen->x + x_min, + xlib_onscreen->y + y_min, + x_max - x_min, + y_max - y_min); + + set_frame_info_output (onscreen, output); + } + + /* XXX: we don't get SwapComplete events based on how we implement + * the _swap_region() API but if cogl-onscreen.c knows we are + * handling _SYNC and _COMPLETE events in the winsys then we need to + * send fake events in this case. + */ + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + { + set_sync_pending (onscreen); + set_complete_pending (onscreen); + } +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglBool have_counter; + GLXDrawable drawable; + + /* XXX: theoretically this shouldn't be necessary but at least with + * the Intel drivers we have see that if we don't call + * glXMakeContextCurrent for the drawable we are swapping then + * we get a BadDrawable error from the X server. */ + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + + drawable = glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + + if (framebuffer->config.swap_throttled) + { + uint32_t end_frame_vsync_counter = 0; + + have_counter = + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_COUNTER); + + /* If the swap_region API is also being used then we need to track + * the vsync counter for each swap request so we can manually + * throttle swap_region requests. */ + if (have_counter) + end_frame_vsync_counter = _cogl_winsys_get_vsync_counter (context); + + if (!glx_renderer->glXSwapInterval) + { + CoglBool can_wait = + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT); + + /* If we are going to wait for VBLANK manually, we not only + * need to flush out pending drawing to the GPU before we + * sleep, we need to wait for it to finish. Otherwise, we + * may end up with the situation: + * + * - We finish drawing - GPU drawing continues + * - We go to sleep - GPU drawing continues + * VBLANK - We call glXSwapBuffers - GPU drawing continues + * - GPU drawing continues + * - Swap buffers happens + * + * Producing a tear. Calling glFinish() first will cause us + * to properly wait for the next VBLANK before we swap. This + * obviously does not happen when we use _GLX_SWAP and let + * the driver do the right thing + */ + _cogl_winsys_wait_for_gpu (onscreen); + + if (have_counter && can_wait) + { + if (glx_onscreen->last_swap_vsync_counter == + end_frame_vsync_counter) + _cogl_winsys_wait_for_vblank (onscreen); + } + else if (can_wait) + _cogl_winsys_wait_for_vblank (onscreen); + } + } + else + have_counter = FALSE; + + glx_renderer->glXSwapBuffers (xlib_renderer->xdpy, drawable); + + if (have_counter) + glx_onscreen->last_swap_vsync_counter = + _cogl_winsys_get_vsync_counter (context); + + set_frame_info_output (onscreen, xlib_onscreen->output); +} + +static uint32_t +_cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen) +{ + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + return xlib_onscreen->xwin; +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextGLX *glx_context = context->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + GLXDrawable drawable = + glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; + + if (glx_context->current_drawable != drawable) + return; + + glx_context->current_drawable = 0; + _cogl_winsys_onscreen_bind (onscreen); +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + + if (visibility) + XMapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); + else + XUnmapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin); +} + +static void +_cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen, + CoglBool resizable) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + + XSizeHints *size_hints = XAllocSizeHints (); + + if (resizable) + { + /* TODO: Add cogl_onscreen_request_minimum_size () */ + size_hints->min_width = 1; + size_hints->min_height = 1; + + size_hints->max_width = INT_MAX; + size_hints->max_height = INT_MAX; + } + else + { + int width = cogl_framebuffer_get_width (framebuffer); + int height = cogl_framebuffer_get_height (framebuffer); + + size_hints->min_width = width; + size_hints->min_height = height; + + size_hints->max_width = width; + size_hints->max_height = height; + } + + XSetWMNormalHints (xlib_renderer->xdpy, xlib_onscreen->xwin, size_hints); + + XFree (size_hints); +} + +/* XXX: This is a particularly hacky _cogl_winsys interface... */ +static XVisualInfo * +_cogl_winsys_xlib_get_visual_info (void) +{ + CoglGLXDisplay *glx_display; + CoglXlibRenderer *xlib_renderer; + CoglGLXRenderer *glx_renderer; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (ctx->display->winsys, FALSE); + + glx_display = ctx->display->winsys; + xlib_renderer = _cogl_xlib_renderer_get_data (ctx->display->renderer); + glx_renderer = ctx->display->renderer->winsys; + + if (!glx_display->found_fbconfig) + return NULL; + + return glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy, + glx_display->fbconfig); +} + +static CoglBool +get_fbconfig_for_depth (CoglContext *context, + unsigned int depth, + GLXFBConfig *fbconfig_ret, + CoglBool *can_mipmap_ret) +{ + CoglXlibRenderer *xlib_renderer; + CoglGLXRenderer *glx_renderer; + CoglGLXDisplay *glx_display; + Display *dpy; + GLXFBConfig *fbconfigs; + int n_elements, i; + int db, stencil, alpha, mipmap, rgba, value; + int spare_cache_slot = 0; + CoglBool found = FALSE; + + xlib_renderer = _cogl_xlib_renderer_get_data (context->display->renderer); + glx_renderer = context->display->renderer->winsys; + glx_display = context->display->winsys; + + /* Check if we've already got a cached config for this depth */ + for (i = 0; i < COGL_GLX_N_CACHED_CONFIGS; i++) + if (glx_display->glx_cached_configs[i].depth == -1) + spare_cache_slot = i; + else if (glx_display->glx_cached_configs[i].depth == depth) + { + *fbconfig_ret = glx_display->glx_cached_configs[i].fb_config; + *can_mipmap_ret = glx_display->glx_cached_configs[i].can_mipmap; + return glx_display->glx_cached_configs[i].found; + } + + dpy = xlib_renderer->xdpy; + + fbconfigs = glx_renderer->glXGetFBConfigs (dpy, DefaultScreen (dpy), + &n_elements); + + db = G_MAXSHORT; + stencil = G_MAXSHORT; + mipmap = 0; + rgba = 0; + + for (i = 0; i < n_elements; i++) + { + XVisualInfo *vi; + int visual_depth; + + vi = glx_renderer->glXGetVisualFromFBConfig (dpy, fbconfigs[i]); + if (vi == NULL) + continue; + + visual_depth = vi->depth; + + XFree (vi); + + if (visual_depth != depth) + continue; + + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_ALPHA_SIZE, + &alpha); + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_BUFFER_SIZE, + &value); + if (value != depth && (value - alpha) != depth) + continue; + + if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 4) + { + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_SAMPLES, + &value); + if (value > 1) + continue; + } + + value = 0; + if (depth == 32) + { + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_BIND_TO_TEXTURE_RGBA_EXT, + &value); + if (value) + rgba = 1; + } + + if (!value) + { + if (rgba) + continue; + + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_BIND_TO_TEXTURE_RGB_EXT, + &value); + if (!value) + continue; + } + + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_DOUBLEBUFFER, + &value); + if (value > db) + continue; + + db = value; + + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_STENCIL_SIZE, + &value); + if (value > stencil) + continue; + + stencil = value; + + /* glGenerateMipmap is defined in the offscreen extension */ + if (cogl_has_feature (context, COGL_FEATURE_ID_OFFSCREEN)) + { + glx_renderer->glXGetFBConfigAttrib (dpy, + fbconfigs[i], + GLX_BIND_TO_MIPMAP_TEXTURE_EXT, + &value); + + if (value < mipmap) + continue; + + mipmap = value; + } + + *fbconfig_ret = fbconfigs[i]; + *can_mipmap_ret = mipmap; + found = TRUE; + } + + if (n_elements) + XFree (fbconfigs); + + glx_display->glx_cached_configs[spare_cache_slot].depth = depth; + glx_display->glx_cached_configs[spare_cache_slot].found = found; + glx_display->glx_cached_configs[spare_cache_slot].fb_config = *fbconfig_ret; + glx_display->glx_cached_configs[spare_cache_slot].can_mipmap = mipmap; + + return found; +} + +static CoglBool +should_use_rectangle (CoglContext *context) +{ + + if (context->rectangle_state == COGL_WINSYS_RECTANGLE_STATE_UNKNOWN) + { + if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RECTANGLE)) + { + const char *rect_env; + + /* Use the rectangle only if it is available and either: + + the COGL_PIXMAP_TEXTURE_RECTANGLE environment variable is + set to 'force' + + *or* + + the env var is set to 'allow' or not set and NPOTs textures + are not available */ + + context->rectangle_state = + cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_NPOT) ? + COGL_WINSYS_RECTANGLE_STATE_DISABLE : + COGL_WINSYS_RECTANGLE_STATE_ENABLE; + + if ((rect_env = g_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) || + /* For compatibility, we'll also look at the old Clutter + environment variable */ + (rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE"))) + { + if (g_ascii_strcasecmp (rect_env, "force") == 0) + context->rectangle_state = + COGL_WINSYS_RECTANGLE_STATE_ENABLE; + else if (g_ascii_strcasecmp (rect_env, "disable") == 0) + context->rectangle_state = + COGL_WINSYS_RECTANGLE_STATE_DISABLE; + else if (g_ascii_strcasecmp (rect_env, "allow")) + g_warning ("Unknown value for COGL_PIXMAP_TEXTURE_RECTANGLE, " + "should be 'force' or 'disable'"); + } + } + else + context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_DISABLE; + } + + return context->rectangle_state == COGL_WINSYS_RECTANGLE_STATE_ENABLE; +} + +static CoglBool +try_create_glx_pixmap (CoglContext *context, + CoglTexturePixmapX11 *tex_pixmap, + CoglBool mipmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + CoglRenderer *renderer; + CoglXlibRenderer *xlib_renderer; + CoglGLXRenderer *glx_renderer; + Display *dpy; + /* We have to initialize this *opaque* variable because gcc tries to + * be too smart for its own good and warns that the variable may be + * used uninitialized otherwise. */ + GLXFBConfig fb_config = (GLXFBConfig)0; + int attribs[7]; + int i = 0; + GLenum target; + CoglXlibTrapState trap_state; + + unsigned int depth = tex_pixmap->depth; + Visual* visual = tex_pixmap->visual; + + renderer = context->display->renderer; + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + glx_renderer = renderer->winsys; + dpy = xlib_renderer->xdpy; + + if (!get_fbconfig_for_depth (context, depth, &fb_config, + &glx_tex_pixmap->can_mipmap)) + { + COGL_NOTE (TEXTURE_PIXMAP, "No suitable FBConfig found for depth %i", + depth); + return FALSE; + } + + if (should_use_rectangle (context)) + { + target = GLX_TEXTURE_RECTANGLE_EXT; + glx_tex_pixmap->can_mipmap = FALSE; + } + else + target = GLX_TEXTURE_2D_EXT; + + if (!glx_tex_pixmap->can_mipmap) + mipmap = FALSE; + + attribs[i++] = GLX_TEXTURE_FORMAT_EXT; + + /* Check whether an alpha channel is used by comparing the total + * number of 1-bits in color masks against the color depth requested + * by the client. + */ + if (_cogl_util_popcountl (visual->red_mask | + visual->green_mask | + visual->blue_mask) == depth) + attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT; + else + attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT; + + attribs[i++] = GLX_MIPMAP_TEXTURE_EXT; + attribs[i++] = mipmap; + + attribs[i++] = GLX_TEXTURE_TARGET_EXT; + attribs[i++] = target; + + attribs[i++] = None; + + /* We need to trap errors from glXCreatePixmap because it can + * sometimes fail during normal usage. For example on NVidia it gets + * upset if you try to create two GLXPixmaps for the same drawable. + */ + + _cogl_xlib_renderer_trap_errors (renderer, &trap_state); + + glx_tex_pixmap->glx_pixmap = + glx_renderer->glXCreatePixmap (dpy, + fb_config, + tex_pixmap->pixmap, + attribs); + glx_tex_pixmap->has_mipmap_space = mipmap; + + XSync (dpy, False); + + if (_cogl_xlib_renderer_untrap_errors (renderer, &trap_state)) + { + COGL_NOTE (TEXTURE_PIXMAP, "Failed to create pixmap for %p", tex_pixmap); + _cogl_xlib_renderer_trap_errors (renderer, &trap_state); + glx_renderer->glXDestroyPixmap (dpy, glx_tex_pixmap->glx_pixmap); + XSync (dpy, False); + _cogl_xlib_renderer_untrap_errors (renderer, &trap_state); + + glx_tex_pixmap->glx_pixmap = None; + return FALSE; + } + + return TRUE; +} + +static CoglBool +_cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap; + CoglContext *ctx = COGL_TEXTURE (tex_pixmap)->context; + + if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP)) + { + tex_pixmap->winsys = NULL; + return FALSE; + } + + glx_tex_pixmap = g_new0 (CoglTexturePixmapGLX, 1); + + glx_tex_pixmap->glx_pixmap = None; + glx_tex_pixmap->can_mipmap = FALSE; + glx_tex_pixmap->has_mipmap_space = FALSE; + + glx_tex_pixmap->glx_tex = NULL; + + glx_tex_pixmap->bind_tex_image_queued = TRUE; + glx_tex_pixmap->pixmap_bound = FALSE; + + tex_pixmap->winsys = glx_tex_pixmap; + + if (!try_create_glx_pixmap (ctx, tex_pixmap, FALSE)) + { + tex_pixmap->winsys = NULL; + g_free (glx_tex_pixmap); + return FALSE; + } + + return TRUE; +} + +static void +free_glx_pixmap (CoglContext *context, + CoglTexturePixmapGLX *glx_tex_pixmap) +{ + CoglXlibTrapState trap_state; + CoglRenderer *renderer; + CoglXlibRenderer *xlib_renderer; + CoglGLXRenderer *glx_renderer; + + renderer = context->display->renderer; + xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + glx_renderer = renderer->winsys; + + if (glx_tex_pixmap->pixmap_bound) + glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy, + glx_tex_pixmap->glx_pixmap, + GLX_FRONT_LEFT_EXT); + + /* FIXME - we need to trap errors and synchronize here because + * of ordering issues between the XPixmap destruction and the + * GLXPixmap destruction. + * + * If the X pixmap is destroyed, the GLX pixmap is destroyed as + * well immediately, and thus, when Cogl calls glXDestroyPixmap() + * it'll cause a BadDrawable error. + * + * this is technically a bug in the X server, which should not + * destroy either pixmaps until the call to glXDestroyPixmap(); so + * at some point we should revisit this code and remove the + * trap+sync after verifying that the destruction is indeed safe. + * + * for reference, see: + * http://bugzilla.clutter-project.org/show_bug.cgi?id=2324 + */ + _cogl_xlib_renderer_trap_errors (renderer, &trap_state); + glx_renderer->glXDestroyPixmap (xlib_renderer->xdpy, + glx_tex_pixmap->glx_pixmap); + XSync (xlib_renderer->xdpy, False); + _cogl_xlib_renderer_untrap_errors (renderer, &trap_state); + + glx_tex_pixmap->glx_pixmap = None; + glx_tex_pixmap->pixmap_bound = FALSE; +} + +static void +_cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap; + + if (!tex_pixmap->winsys) + return; + + glx_tex_pixmap = tex_pixmap->winsys; + + free_glx_pixmap (COGL_TEXTURE (tex_pixmap)->context, glx_tex_pixmap); + + if (glx_tex_pixmap->glx_tex) + cogl_object_unref (glx_tex_pixmap->glx_tex); + + tex_pixmap->winsys = NULL; + g_free (glx_tex_pixmap); +} + +static CoglBool +_cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, + CoglBool needs_mipmap) +{ + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + CoglContext *ctx = COGL_TEXTURE (tex_pixmap)->context; + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + CoglGLXRenderer *glx_renderer; + + /* If we don't have a GLX pixmap then fallback */ + if (glx_tex_pixmap->glx_pixmap == None) + return FALSE; + + glx_renderer = ctx->display->renderer->winsys; + + /* Lazily create a texture to hold the pixmap */ + if (glx_tex_pixmap->glx_tex == NULL) + { + CoglPixelFormat texture_format; + CoglError *error = NULL; + + texture_format = (tex_pixmap->depth >= 32 ? + COGL_PIXEL_FORMAT_RGBA_8888_PRE : + COGL_PIXEL_FORMAT_RGB_888); + + if (should_use_rectangle (ctx)) + { + glx_tex_pixmap->glx_tex = COGL_TEXTURE ( + cogl_texture_rectangle_new_with_size (ctx, + tex->width, + tex->height)); + + _cogl_texture_set_internal_format (tex, texture_format); + + if (cogl_texture_allocate (glx_tex_pixmap->glx_tex, &error)) + COGL_NOTE (TEXTURE_PIXMAP, "Created a texture rectangle for %p", + tex_pixmap); + else + { + COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a " + "texture rectangle could not be created: %s", + tex_pixmap, error->message); + cogl_error_free (error); + free_glx_pixmap (ctx, glx_tex_pixmap); + return FALSE; + } + } + else + { + glx_tex_pixmap->glx_tex = COGL_TEXTURE ( + cogl_texture_2d_new_with_size (ctx, + tex->width, + tex->height)); + + _cogl_texture_set_internal_format (tex, texture_format); + + if (cogl_texture_allocate (glx_tex_pixmap->glx_tex, &error)) + COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p", + tex_pixmap); + else + { + COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a " + "texture 2d could not be created: %s", + tex_pixmap, error->message); + cogl_error_free (error); + free_glx_pixmap (ctx, glx_tex_pixmap); + return FALSE; + } + } + } + + if (needs_mipmap) + { + /* If we can't support mipmapping then temporarily fallback */ + if (!glx_tex_pixmap->can_mipmap) + return FALSE; + + /* Recreate the GLXPixmap if it wasn't previously created with a + * mipmap tree */ + if (!glx_tex_pixmap->has_mipmap_space) + { + free_glx_pixmap (ctx, glx_tex_pixmap); + + COGL_NOTE (TEXTURE_PIXMAP, "Recreating GLXPixmap with mipmap " + "support for %p", tex_pixmap); + if (!try_create_glx_pixmap (ctx, tex_pixmap, TRUE)) + + { + /* If the pixmap failed then we'll permanently fallback + * to using XImage. This shouldn't happen. */ + COGL_NOTE (TEXTURE_PIXMAP, "Falling back to XGetImage " + "updates for %p because creating the GLXPixmap " + "with mipmap support failed", tex_pixmap); + + if (glx_tex_pixmap->glx_tex) + cogl_object_unref (glx_tex_pixmap->glx_tex); + return FALSE; + } + + glx_tex_pixmap->bind_tex_image_queued = TRUE; + } + } + + if (glx_tex_pixmap->bind_tex_image_queued) + { + GLuint gl_handle, gl_target; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (ctx->display->renderer); + + cogl_texture_get_gl_texture (glx_tex_pixmap->glx_tex, + &gl_handle, &gl_target); + + COGL_NOTE (TEXTURE_PIXMAP, "Rebinding GLXPixmap for %p", tex_pixmap); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, FALSE); + + if (glx_tex_pixmap->pixmap_bound) + glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy, + glx_tex_pixmap->glx_pixmap, + GLX_FRONT_LEFT_EXT); + + glx_renderer->glXBindTexImage (xlib_renderer->xdpy, + glx_tex_pixmap->glx_pixmap, + GLX_FRONT_LEFT_EXT, + NULL); + + /* According to the recommended usage in the spec for + * GLX_EXT_texture_pixmap we should release the texture after + * we've finished drawing with it and it is undefined what + * happens if you render to a pixmap that is bound to a texture. + * However that would require the texture backend to know when + * Cogl has finished painting and it may be more expensive to + * keep unbinding the texture. Leaving it bound appears to work + * on Mesa and NVidia drivers and it is also what Compiz does so + * it is probably ok */ + + glx_tex_pixmap->bind_tex_image_queued = FALSE; + glx_tex_pixmap->pixmap_bound = TRUE; + + _cogl_texture_2d_externally_modified (glx_tex_pixmap->glx_tex); + } + + return TRUE; +} + +static void +_cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + + glx_tex_pixmap->bind_tex_image_queued = TRUE; +} + +static CoglTexture * +_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + + return glx_tex_pixmap->glx_tex; +} + +static CoglWinsysVtable _cogl_winsys_vtable = + { + .id = COGL_WINSYS_ID_GLX, + .name = "GLX", + .constraints = (COGL_RENDERER_CONSTRAINT_USES_X11 | + COGL_RENDERER_CONSTRAINT_USES_XLIB), + + .renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address, + .renderer_connect = _cogl_winsys_renderer_connect, + .renderer_disconnect = _cogl_winsys_renderer_disconnect, + .renderer_outputs_changed = _cogl_winsys_renderer_outputs_changed, + .display_setup = _cogl_winsys_display_setup, + .display_destroy = _cogl_winsys_display_destroy, + .context_init = _cogl_winsys_context_init, + .context_deinit = _cogl_winsys_context_deinit, + .context_get_clock_time = _cogl_winsys_get_clock_time, + .xlib_get_visual_info = _cogl_winsys_xlib_get_visual_info, + .onscreen_init = _cogl_winsys_onscreen_init, + .onscreen_deinit = _cogl_winsys_onscreen_deinit, + .onscreen_bind = _cogl_winsys_onscreen_bind, + .onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage, + .onscreen_swap_region = _cogl_winsys_onscreen_swap_region, + .onscreen_get_buffer_age = _cogl_winsys_onscreen_get_buffer_age, + .onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled, + .onscreen_x11_get_window_xid = + _cogl_winsys_onscreen_x11_get_window_xid, + .onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility, + .onscreen_set_resizable = + _cogl_winsys_onscreen_set_resizable, + + /* X11 tfp support... */ + /* XXX: instead of having a rather monolithic winsys vtable we could + * perhaps look for a way to separate these... */ + .texture_pixmap_x11_create = + _cogl_winsys_texture_pixmap_x11_create, + .texture_pixmap_x11_free = + _cogl_winsys_texture_pixmap_x11_free, + .texture_pixmap_x11_update = + _cogl_winsys_texture_pixmap_x11_update, + .texture_pixmap_x11_damage_notify = + _cogl_winsys_texture_pixmap_x11_damage_notify, + .texture_pixmap_x11_get_texture = + _cogl_winsys_texture_pixmap_x11_get_texture, + }; + +/* XXX: we use a function because no doubt someone will complain + * about using c99 member initializers because they aren't portable + * to windows. We want to avoid having to rigidly follow the real + * order of members since some members are #ifdefd and we'd have + * to mirror the #ifdefing to add padding etc. For any winsys that + * can assume the platform has a sane compiler then we can just use + * c99 initializers for insane platforms they can initialize + * the members by name in a function. + */ +const CoglWinsysVtable * +_cogl_winsys_glx_get_vtable (void) +{ + return &_cogl_winsys_vtable; +} + +GLXContext +cogl_glx_context_get_glx_context (CoglContext *context) +{ + CoglGLXDisplay *glx_display = context->display->winsys; + + return glx_display->glx_context; +} diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h new file mode 100644 index 0000000..d6ff165 --- /dev/null +++ b/cogl/winsys/cogl-winsys-private.h @@ -0,0 +1,204 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_PRIVATE_H +#define __COGL_WINSYS_PRIVATE_H + +#include "cogl-renderer.h" +#include "cogl-onscreen.h" +#include "cogl-gles2.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include "cogl-texture-pixmap-x11-private.h" +#endif + +#ifdef COGL_HAS_XLIB_SUPPORT +#include +#include "cogl-texture-pixmap-x11-private.h" +#endif + +#ifdef COGL_HAS_EGL_SUPPORT +#include "cogl-egl-private.h" +#endif + +#include "cogl-poll.h" + +uint32_t +_cogl_winsys_error_quark (void); + +#define COGL_WINSYS_ERROR (_cogl_winsys_error_quark ()) + +typedef enum { /*< prefix=COGL_WINSYS_ERROR >*/ + COGL_WINSYS_ERROR_INIT, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + COGL_WINSYS_ERROR_MAKE_CURRENT, + COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, +} CoglWinsysError; + +typedef enum +{ + COGL_WINSYS_RECTANGLE_STATE_UNKNOWN, + COGL_WINSYS_RECTANGLE_STATE_DISABLE, + COGL_WINSYS_RECTANGLE_STATE_ENABLE +} CoglWinsysRectangleState; + +typedef struct _CoglWinsysVtable +{ + CoglWinsysID id; + CoglRendererConstraint constraints; + + const char *name; + + /* Required functions */ + + CoglFuncPtr + (*renderer_get_proc_address) (CoglRenderer *renderer, + const char *name, + CoglBool in_core); + + CoglBool + (*renderer_connect) (CoglRenderer *renderer, CoglError **error); + + void + (*renderer_disconnect) (CoglRenderer *renderer); + + void + (*renderer_outputs_changed) (CoglRenderer *renderer); + + CoglBool + (*display_setup) (CoglDisplay *display, CoglError **error); + + void + (*display_destroy) (CoglDisplay *display); + + CoglBool + (*context_init) (CoglContext *context, CoglError **error); + + void + (*context_deinit) (CoglContext *context); + + void * + (*context_create_gles2_context) (CoglContext *ctx, CoglError **error); + + CoglBool + (*onscreen_init) (CoglOnscreen *onscreen, CoglError **error); + + void + (*onscreen_deinit) (CoglOnscreen *onscreen); + + void + (*onscreen_bind) (CoglOnscreen *onscreen); + + void + (*onscreen_swap_buffers_with_damage) (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles); + + void + (*onscreen_update_swap_throttled) (CoglOnscreen *onscreen); + + void + (*onscreen_set_visibility) (CoglOnscreen *onscreen, + CoglBool visibility); + + /* Optional functions */ + + int64_t + (*context_get_clock_time) (CoglContext *context); + + void + (*onscreen_swap_region) (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles); + + void + (*onscreen_set_resizable) (CoglOnscreen *onscreen, CoglBool resizable); + + int + (*onscreen_get_buffer_age) (CoglOnscreen *onscreen); + +#ifdef COGL_HAS_XLIB_SUPPORT + XVisualInfo * + (*xlib_get_visual_info) (void); +#endif + + uint32_t + (*onscreen_x11_get_window_xid) (CoglOnscreen *onscreen); + +#ifdef COGL_HAS_WIN32_SUPPORT + HWND + (*onscreen_win32_get_window) (CoglOnscreen *onscreen); +#endif + +#ifdef COGL_HAS_XLIB_SUPPORT + CoglBool + (*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap); + void + (*texture_pixmap_x11_free) (CoglTexturePixmapX11 *tex_pixmap); + + CoglBool + (*texture_pixmap_x11_update) (CoglTexturePixmapX11 *tex_pixmap, + CoglBool needs_mipmap); + + void + (*texture_pixmap_x11_damage_notify) (CoglTexturePixmapX11 *tex_pixmap); + + CoglTexture * + (*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap); +#endif + + void + (*save_context) (CoglContext *ctx); + + CoglBool + (*set_gles2_context) (CoglGLES2Context *gles2_ctx, CoglError **error); + + void + (*restore_context) (CoglContext *ctx); + + void + (*destroy_gles2_context) (CoglGLES2Context *gles2_ctx); + + void * + (*fence_add) (CoglContext *ctx); + + CoglBool + (*fence_is_complete) (CoglContext *ctx, void *fence); + + void + (*fence_destroy) (CoglContext *ctx, void *fence); + +} CoglWinsysVtable; + +CoglBool +_cogl_winsys_has_feature (CoglWinsysFeature feature); + +#endif /* __COGL_WINSYS_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-sdl-private.h b/cogl/winsys/cogl-winsys-sdl-private.h new file mode 100644 index 0000000..4fffa6d --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl-private.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_SDL_PRIVATE_H +#define __COGL_WINSYS_SDL_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_sdl_get_vtable (void); + +#endif /* __COGL_WINSYS_SDL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c new file mode 100644 index 0000000..322ca1b --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl.c @@ -0,0 +1,490 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011,2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-renderer-private.h" +#include "cogl-display-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-context-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-winsys-sdl-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" + +typedef struct _CoglRendererSdl +{ + CoglClosure *resize_notify_idle; +} CoglRendererSdl; + +typedef struct _CoglDisplaySdl +{ + SDL_Surface *surface; + CoglOnscreen *onscreen; + Uint32 video_mode_flags; +} CoglDisplaySdl; + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + CoglFuncPtr ptr; + + /* XXX: It's not totally clear whether it's safe to call this for + * core functions. From the code it looks like the implementations + * will fall back to using some form of dlsym if the winsys + * GetProcAddress function returns NULL. Presumably this will work + * in most cases apart from EGL platforms that return invalid + * pointers for core functions. It's awkward for this code to get a + * handle to the GL module that SDL has chosen to load so just + * calling SDL_GL_GetProcAddress is probably the best we can do + * here. */ + +#ifdef COGL_HAS_SDL_GLES_SUPPORT + if (renderer->driver != COGL_DRIVER_GL) + return SDL_GLES_GetProcAddress (name); +#endif + + return SDL_GL_GetProcAddress (name); +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + SDL_Quit (); + + g_slice_free (CoglRendererSdl, renderer->winsys); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ +#ifdef USING_EMSCRIPTEN + if (renderer->driver != COGL_DRIVER_GLES2) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The SDL winsys with emscripten only supports " + "the GLES2 driver"); + return FALSE; + } +#elif !defined (COGL_HAS_SDL_GLES_SUPPORT) + if (renderer->driver != COGL_DRIVER_GL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The SDL winsys only supports the GL driver"); + return FALSE; + } +#endif + + if (SDL_Init (SDL_INIT_VIDEO) == -1) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "SDL_Init failed: %s", + SDL_GetError ()); + return FALSE; + } + + renderer->winsys = g_slice_new0 (CoglRendererSdl); + + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + CoglDisplaySdl *sdl_display = display->winsys; + + _COGL_RETURN_IF_FAIL (sdl_display != NULL); + + /* No need to destroy the surface - it is freed by SDL_Quit */ + + g_slice_free (CoglDisplaySdl, display->winsys); + display->winsys = NULL; +} + +static void +set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config) +{ + SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 1); + + SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, + config->need_stencil ? 1 : 0); + + if (config->swap_chain->length >= 0) + SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, + config->swap_chain->length > 1 ? 1 : 0); + + SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, + config->swap_chain->has_alpha ? 1 : 0); +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplaySdl *sdl_display; + + _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); + + sdl_display = g_slice_new0 (CoglDisplaySdl); + display->winsys = sdl_display; + + set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config); + + switch (display->renderer->driver) + { + case COGL_DRIVER_GL: + sdl_display->video_mode_flags = SDL_OPENGL; + break; + + case COGL_DRIVER_GL3: + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The SDL winsys does not support GL 3"); + goto error; + +#ifdef COGL_HAS_SDL_GLES_SUPPORT + case COGL_DRIVER_GLES2: + sdl_display->video_mode_flags = SDL_OPENGLES; + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0); + break; + + case COGL_DRIVER_GLES1: + sdl_display->video_mode_flags = SDL_OPENGLES; + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 1); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 1); + break; + +#elif defined (USING_EMSCRIPTEN) + case COGL_DRIVER_GLES2: + sdl_display->video_mode_flags = SDL_OPENGL; + break; +#endif + + default: + g_assert_not_reached (); + } + + /* There's no way to know what size the application will need until + it creates the first onscreen but we need to set the video mode + now so that we can get a GL context. We'll have to just guess at + a size an resize it later */ + sdl_display->surface = SDL_SetVideoMode (640, 480, /* width/height */ + 0, /* bitsperpixel */ + sdl_display->video_mode_flags); + + if (sdl_display->surface == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "SDL_SetVideoMode failed: %s", + SDL_GetError ()); + goto error; + } + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static void +flush_pending_resize_notification_idle (void *user_data) +{ + CoglContext *context = user_data; + CoglRenderer *renderer = context->display->renderer; + CoglRendererSdl *sdl_renderer = renderer->winsys; + CoglDisplaySdl *sdl_display = context->display->winsys; + CoglOnscreen *onscreen = sdl_display->onscreen; + + /* This needs to be disconnected before invoking the callbacks in + * case the callbacks cause it to be queued again */ + _cogl_closure_disconnect (sdl_renderer->resize_notify_idle); + sdl_renderer->resize_notify_idle = NULL; + + _cogl_onscreen_notify_resize (onscreen); +} + +static CoglFilterReturn +sdl_event_filter_cb (SDL_Event *event, void *data) +{ + CoglContext *context = data; + CoglDisplay *display = context->display; + CoglDisplaySdl *sdl_display = display->winsys; + CoglFramebuffer *framebuffer; + + if (!sdl_display->onscreen) + return COGL_FILTER_CONTINUE; + + framebuffer = COGL_FRAMEBUFFER (sdl_display->onscreen); + + if (event->type == SDL_VIDEORESIZE) + { + CoglRenderer *renderer = display->renderer; + CoglRendererSdl *sdl_renderer = renderer->winsys; + float width = event->resize.w; + float height = event->resize.h; + + sdl_display->surface = SDL_SetVideoMode (width, height, + 0, /* bitsperpixel */ + sdl_display->video_mode_flags); + + _cogl_framebuffer_winsys_update_size (framebuffer, width, height); + + /* We only want to notify that a resize happened when the + * application calls cogl_context_dispatch so instead of + * immediately notifying we queue an idle callback */ + if (!sdl_renderer->resize_notify_idle) + { + sdl_renderer->resize_notify_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_resize_notification_idle, + context, + NULL); + } + + return COGL_FILTER_CONTINUE; + } + else if (event->type == SDL_VIDEOEXPOSE) + { + CoglOnscreenDirtyInfo info; + + /* Sadly SDL doesn't seem to report the rectangle of the expose + * event so we'll just queue the whole window */ + info.x = 0; + info.y = 0; + info.width = framebuffer->width; + info.height = framebuffer->height; + + _cogl_onscreen_queue_dirty (COGL_ONSCREEN (framebuffer), &info); + } + + return COGL_FILTER_CONTINUE; +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + CoglRenderer *renderer = context->display->renderer; + + if (G_UNLIKELY (renderer->sdl_event_type_set == FALSE)) + g_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() " + "must be called during initialization"); + + _cogl_renderer_add_native_filter (renderer, + (CoglNativeFilterFunc)sdl_event_filter_cb, + context); + + /* We'll manually handle queueing dirty events in response to + * SDL_VIDEOEXPOSE events */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + return _cogl_context_update_features (context, error); +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglDisplay *display = context->display; + CoglDisplaySdl *sdl_display = display->winsys; + + sdl_display->onscreen = NULL; +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplaySdl *sdl_display = display->winsys; + CoglBool flags_changed = FALSE; + int width, height; + + if (sdl_display->onscreen) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "SDL winsys only supports a single onscreen window"); + return FALSE; + } + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + + if (cogl_onscreen_get_resizable (onscreen)) + { + sdl_display->video_mode_flags |= SDL_RESIZABLE; + flags_changed = TRUE; + } + + /* Try to update the video size using the onscreen size */ + if (width != sdl_display->surface->w || + height != sdl_display->surface->h || + flags_changed) + { + sdl_display->surface = SDL_SetVideoMode (width, height, + 0, /* bitsperpixel */ + sdl_display->video_mode_flags); + + if (sdl_display->surface == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "SDL_SetVideoMode failed: %s", + SDL_GetError ()); + return FALSE; + } + } + + _cogl_framebuffer_winsys_update_size (framebuffer, + sdl_display->surface->w, + sdl_display->surface->h); + + sdl_display->onscreen = onscreen; + + return TRUE; +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + SDL_GL_SwapBuffers (); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + /* SDL doesn't appear to provide a way to set this */ +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + /* SDL doesn't appear to provide a way to set this */ +} + +static void +_cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen, + CoglBool resizable) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplaySdl *sdl_display = display->winsys; + int width, height; + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + + if (resizable) + sdl_display->video_mode_flags |= SDL_RESIZABLE; + else + sdl_display->video_mode_flags &= ~SDL_RESIZABLE; + + sdl_display->surface = SDL_SetVideoMode (width, height, + 0, /* bitsperpixel */ + sdl_display->video_mode_flags); +} + +const CoglWinsysVtable * +_cogl_winsys_sdl_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + /* It would be nice if we could use C99 struct initializers here + like the GLX backend does. However this code is more likely to be + compiled using Visual Studio which (still!) doesn't support them + so we initialize it in code instead */ + + if (!vtable_inited) + { + memset (&vtable, 0, sizeof (vtable)); + + vtable.id = COGL_WINSYS_ID_SDL; + vtable.name = "SDL"; + vtable.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address; + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + vtable.display_setup = _cogl_winsys_display_setup; + vtable.display_destroy = _cogl_winsys_display_destroy; + vtable.context_init = _cogl_winsys_context_init; + vtable.context_deinit = _cogl_winsys_context_deinit; + vtable.onscreen_init = _cogl_winsys_onscreen_init; + vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; + vtable.onscreen_bind = _cogl_winsys_onscreen_bind; + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + vtable.onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled; + vtable.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility; + vtable.onscreen_set_resizable = _cogl_winsys_onscreen_set_resizable; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c new file mode 100644 index 0000000..c6661d9 --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl2.c @@ -0,0 +1,638 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011, 2012, 2013 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-renderer-private.h" +#include "cogl-display-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-context-private.h" +#include "cogl-onscreen-private.h" +#include "cogl-winsys-sdl-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" +#include "cogl-sdl.h" + +typedef struct _CoglContextSdl2 +{ + SDL_Window *current_window; +} CoglContextSdl2; + +typedef struct _CoglRendererSdl2 +{ + CoglClosure *resize_notify_idle; +} CoglRendererSdl2; + +typedef struct _CoglDisplaySdl2 +{ + SDL_Window *dummy_window; + SDL_GLContext *context; +} CoglDisplaySdl2; + +typedef struct _CoglOnscreenSdl2 +{ + SDL_Window *window; + CoglBool pending_resize_notify; +} CoglOnscreenSdl2; + +/* The key used to store a pointer to the CoglOnscreen in an + * SDL_Window */ +#define COGL_SDL_WINDOW_DATA_KEY "cogl-onscreen" + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + /* XXX: It's not totally clear whether it's safe to call this for + * core functions. From the code it looks like the implementations + * will fall back to using some form of dlsym if the winsys + * GetProcAddress function returns NULL. Presumably this will work + * in most cases apart from EGL platforms that return invalid + * pointers for core functions. It's awkward for this code to get a + * handle to the GL module that SDL has chosen to load so just + * calling SDL_GL_GetProcAddress is probably the best we can do + * here. */ + return SDL_GL_GetProcAddress (name); +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + SDL_VideoQuit (); + + g_slice_free (CoglRendererSdl2, renderer->winsys); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + if (SDL_VideoInit (NULL) < 0) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "SDL_Init failed: %s", + SDL_GetError ()); + return FALSE; + } + + renderer->winsys = g_slice_new0 (CoglRendererSdl2); + + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + CoglDisplaySdl2 *sdl_display = display->winsys; + + _COGL_RETURN_IF_FAIL (sdl_display != NULL); + + if (sdl_display->context) + SDL_GL_DeleteContext (sdl_display->context); + + if (sdl_display->dummy_window) + SDL_DestroyWindow (sdl_display->dummy_window); + + g_slice_free (CoglDisplaySdl2, display->winsys); + display->winsys = NULL; +} + +static void +set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config) +{ + SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1); + SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 1); + + SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, + config->need_stencil ? 1 : 0); + + if (config->swap_chain->length >= 0) + SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, + config->swap_chain->length > 1 ? 1 : 0); + + SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, + config->swap_chain->has_alpha ? 1 : 0); +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplaySdl2 *sdl_display; + const char * (* get_string_func) (GLenum name); + const char *gl_version; + + _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); + + sdl_display = g_slice_new0 (CoglDisplaySdl2); + display->winsys = sdl_display; + + set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config); + + if (display->renderer->driver == COGL_DRIVER_GLES1) + { + SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 1); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 1); + } + else if (display->renderer->driver == COGL_DRIVER_GLES2) + { + SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0); + } + else if (display->renderer->driver == COGL_DRIVER_GL3) + { + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 1); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_CORE); + SDL_GL_SetAttribute (SDL_GL_CONTEXT_FLAGS, + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); + } + + /* Create a dummy 1x1 window that never gets display so that we can + * create a GL context */ + sdl_display->dummy_window = SDL_CreateWindow ("", + 0, 0, /* x/y */ + 1, 1, /* w/h */ + SDL_WINDOW_OPENGL | + SDL_WINDOW_HIDDEN); + if (sdl_display->dummy_window == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "SDL_CreateWindow failed: %s", + SDL_GetError ()); + goto error; + } + + sdl_display->context = SDL_GL_CreateContext (sdl_display->dummy_window); + + if (sdl_display->context == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "SDL_GL_CreateContext failed: %s", + SDL_GetError ()); + goto error; + } + + /* SDL doesn't seem to provide a way to select between GL and GLES + * and instead it will just pick one itself. We can at least try to + * verify that it picked the one we were expecting by looking at the + * GL version string */ + get_string_func = SDL_GL_GetProcAddress ("glGetString"); + gl_version = get_string_func (GL_VERSION); + + switch (display->renderer->driver) + { + case COGL_DRIVER_GL: + case COGL_DRIVER_GL3: + /* The first character of the version string will be a digit if + * it's normal GL */ + if (!g_ascii_isdigit (gl_version[0])) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The GL driver was requested but SDL is using GLES"); + goto error; + } + + if (display->renderer->driver == COGL_DRIVER_GL3 && + gl_version[0] < '3') + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The GL3 driver was requested but SDL is using " + "GL %c", gl_version[0]); + goto error; + } + break; + + case COGL_DRIVER_GLES2: + if (!g_str_has_prefix (gl_version, "OpenGL ES 2") && + !g_str_has_prefix (gl_version, "OpenGL ES 3")) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The GLES2 driver was requested but SDL is " + "not using GLES2 or GLES3"); + goto error; + } + break; + + case COGL_DRIVER_GLES1: + if (!g_str_has_prefix (gl_version, "OpenGL ES 1")) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The GLES1 driver was requested but SDL is " + "not using GLES1"); + goto error; + } + break; + + default: + g_assert_not_reached (); + } + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static void +flush_pending_notifications_cb (void *data, + void *user_data) +{ + CoglFramebuffer *framebuffer = data; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + if (sdl_onscreen->pending_resize_notify) + { + _cogl_onscreen_notify_resize (onscreen); + sdl_onscreen->pending_resize_notify = FALSE; + } + } +} + +static void +flush_pending_resize_notifications_idle (void *user_data) +{ + CoglContext *context = user_data; + CoglRenderer *renderer = context->display->renderer; + CoglRendererSdl2 *sdl_renderer = renderer->winsys; + + /* This needs to be disconnected before invoking the callbacks in + * case the callbacks cause it to be queued again */ + _cogl_closure_disconnect (sdl_renderer->resize_notify_idle); + sdl_renderer->resize_notify_idle = NULL; + + g_list_foreach (context->framebuffers, + flush_pending_notifications_cb, + NULL); +} + +static CoglFilterReturn +sdl_window_event_filter (SDL_WindowEvent *event, + CoglContext *context) +{ + SDL_Window *window; + CoglFramebuffer *framebuffer; + + window = SDL_GetWindowFromID (event->windowID); + + if (window == NULL) + return COGL_FILTER_CONTINUE; + + framebuffer = SDL_GetWindowData (window, COGL_SDL_WINDOW_DATA_KEY); + + if (framebuffer == NULL || framebuffer->context != context) + return COGL_FILTER_CONTINUE; + + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) + { + CoglDisplay *display = context->display; + CoglRenderer *renderer = display->renderer; + CoglRendererSdl2 *sdl_renderer = renderer->winsys; + float width = event->data1; + float height = event->data2; + CoglOnscreenSdl2 *sdl_onscreen; + + _cogl_framebuffer_winsys_update_size (framebuffer, width, height); + + /* We only want to notify that a resize happened when the + * application calls cogl_context_dispatch so instead of + * immediately notifying we queue an idle callback */ + if (!sdl_renderer->resize_notify_idle) + { + sdl_renderer->resize_notify_idle = + _cogl_poll_renderer_add_idle (renderer, + flush_pending_resize_notifications_idle, + context, + NULL); + } + + sdl_onscreen = COGL_ONSCREEN (framebuffer)->winsys; + sdl_onscreen->pending_resize_notify = TRUE; + } + else if (event->event == SDL_WINDOWEVENT_EXPOSED) + { + CoglOnscreenDirtyInfo info; + + /* Sadly SDL doesn't seem to report the rectangle of the expose + * event so we'll just queue the whole window */ + info.x = 0; + info.y = 0; + info.width = framebuffer->width; + info.height = framebuffer->height; + + _cogl_onscreen_queue_dirty (COGL_ONSCREEN (framebuffer), &info); + } + + return COGL_FILTER_CONTINUE; +} + +static CoglFilterReturn +sdl_event_filter_cb (SDL_Event *event, void *data) +{ + CoglContext *context = data; + + switch (event->type) + { + case SDL_WINDOWEVENT: + return sdl_window_event_filter (&event->window, context); + + default: + return COGL_FILTER_CONTINUE; + } +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + CoglRenderer *renderer = context->display->renderer; + + context->winsys = g_new0 (CoglContextSdl2, 1); + + if (G_UNLIKELY (renderer->sdl_event_type_set == FALSE)) + g_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() " + "must be called during initialization"); + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + if (SDL_GL_GetSwapInterval () != -1) + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, + TRUE); + + /* We'll manually handle queueing dirty events in response to + * SDL_WINDOWEVENT_EXPOSED events */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + _cogl_renderer_add_native_filter (renderer, + (CoglNativeFilterFunc) sdl_event_filter_cb, + context); + + return TRUE; +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ + CoglRenderer *renderer = context->display->renderer; + + _cogl_renderer_remove_native_filter (renderer, + (CoglNativeFilterFunc) + sdl_event_filter_cb, + context); + + g_free (context->winsys); +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = fb->context; + CoglContextSdl2 *sdl_context = context->winsys; + CoglDisplaySdl2 *sdl_display = context->display->winsys; + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + if (sdl_context->current_window == sdl_onscreen->window) + return; + + SDL_GL_MakeCurrent (sdl_onscreen->window, sdl_display->context); + + sdl_context->current_window = sdl_onscreen->window; + + /* It looks like SDL just directly calls a glXSwapInterval function + * when this is called. This may be provided by either the EXT + * extension, the SGI extension or the Mesa extension. The SGI + * extension is per context so we can't just do this once when the + * framebuffer is allocated. See the comments in the GLX winsys for + * more info. */ + if (COGL_FLAGS_GET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE)) + { + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + + SDL_GL_SetSwapInterval (fb->config.swap_throttled ? 1 : 0); + } +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + if (sdl_onscreen->window != NULL) + { + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextSdl2 *sdl_context = context->winsys; + + if (sdl_context->current_window == sdl_onscreen->window) + { + CoglDisplaySdl2 *sdl_display = context->display->winsys; + + /* SDL explicitly unbinds the context when the currently + * bound window is destroyed. Cogl always needs a context + * bound so that for example it can create texture resources + * at any time even without flushing a framebuffer. + * Therefore we'll bind the dummy window. */ + SDL_GL_MakeCurrent (sdl_display->dummy_window, + sdl_display->context); + sdl_context->current_window = sdl_display->dummy_window; + } + + SDL_DestroyWindow (sdl_onscreen->window); + sdl_onscreen->window = NULL; + } + + g_slice_free (CoglOnscreenSdl2, sdl_onscreen); + onscreen->winsys = NULL; +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglOnscreenSdl2 *sdl_onscreen; + SDL_Window *window; + int width, height; + SDL_WindowFlags flags; + + width = cogl_framebuffer_get_width (framebuffer); + height = cogl_framebuffer_get_height (framebuffer); + + flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN; + + /* The resizable property on SDL window apparently can only be set + * on creation */ + if (onscreen->resizable) + flags |= SDL_WINDOW_RESIZABLE; + + window = SDL_CreateWindow ("" /* title */, + 0, 0, /* x/y */ + width, height, + flags); + + if (window == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "SDL_CreateWindow failed: %s", + SDL_GetError ()); + return FALSE; + } + + SDL_SetWindowData (window, COGL_SDL_WINDOW_DATA_KEY, onscreen); + + onscreen->winsys = g_slice_new (CoglOnscreenSdl2); + sdl_onscreen = onscreen->winsys; + sdl_onscreen->window = window; + + return TRUE; +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + SDL_GL_SwapWindow (sdl_onscreen->window); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextSdl2 *sdl_context = context->winsys; + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + if (sdl_context->current_window != sdl_onscreen->window) + return; + + sdl_context->current_window = NULL; + _cogl_winsys_onscreen_bind (onscreen); +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys; + + if (visibility) + SDL_ShowWindow (sdl_onscreen->window); + else + SDL_HideWindow (sdl_onscreen->window); +} + +SDL_Window * +cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen) +{ + CoglOnscreenSdl2 *sdl_onscreen; + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_onscreen (onscreen), NULL); + + if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL)) + return NULL; + + sdl_onscreen = onscreen->winsys; + + return sdl_onscreen->window; +} + +const CoglWinsysVtable * +_cogl_winsys_sdl_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + /* It would be nice if we could use C99 struct initializers here + like the GLX backend does. However this code is more likely to be + compiled using Visual Studio which (still!) doesn't support them + so we initialize it in code instead */ + + if (!vtable_inited) + { + memset (&vtable, 0, sizeof (vtable)); + + vtable.id = COGL_WINSYS_ID_SDL; + vtable.name = "SDL"; + vtable.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address; + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + vtable.display_setup = _cogl_winsys_display_setup; + vtable.display_destroy = _cogl_winsys_display_destroy; + vtable.context_init = _cogl_winsys_context_init; + vtable.context_deinit = _cogl_winsys_context_deinit; + vtable.onscreen_init = _cogl_winsys_onscreen_init; + vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; + vtable.onscreen_bind = _cogl_winsys_onscreen_bind; + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + vtable.onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled; + vtable.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-stub-private.h b/cogl/winsys/cogl-winsys-stub-private.h new file mode 100644 index 0000000..4aaf798 --- /dev/null +++ b/cogl/winsys/cogl-winsys-stub-private.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_STUB_PRIVATE_H +#define __COGL_WINSYS_STUB_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_stub_get_vtable (void); + +#endif /* __COGL_WINSYS_STUB_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-stub.c b/cogl/winsys/cogl-winsys-stub.c new file mode 100644 index 0000000..4fc8c90 --- /dev/null +++ b/cogl/winsys/cogl-winsys-stub.c @@ -0,0 +1,197 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Robert Bragg + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-renderer-private.h" +#include "cogl-display-private.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-private.h" +#include "cogl-winsys-stub-private.h" + +#include + +static int _cogl_winsys_stub_dummy_ptr; + +/* This provides a NOP winsys. This can be useful for debugging or for + * integrating with toolkits that already have window system + * integration code. + */ + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + static GModule *module = NULL; + + /* this should find the right function if the program is linked against a + * library providing it */ + if (G_UNLIKELY (module == NULL)) + module = g_module_open (NULL, 0); + + if (module) + { + void *symbol; + + if (g_module_symbol (module, name, &symbol)) + return symbol; + } + + return NULL; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + renderer->winsys = NULL; +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + renderer->winsys = &_cogl_winsys_stub_dummy_ptr; + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + display->winsys = NULL; +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + display->winsys = &_cogl_winsys_stub_dummy_ptr; + return TRUE; +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + context->winsys = &_cogl_winsys_stub_dummy_ptr; + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + memset (context->winsys_features, 0, sizeof (context->winsys_features)); + + return TRUE; +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ + context->winsys = NULL; +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + return TRUE; +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ +} + +const CoglWinsysVtable * +_cogl_winsys_stub_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + /* It would be nice if we could use C99 struct initializers here + like the GLX backend does. However this code is more likely to be + compiled using Visual Studio which (still!) doesn't support them + so we initialize it in code instead */ + + if (!vtable_inited) + { + memset (&vtable, 0, sizeof (vtable)); + + vtable.id = COGL_WINSYS_ID_STUB; + vtable.name = "STUB"; + vtable.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address; + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + vtable.display_setup = _cogl_winsys_display_setup; + vtable.display_destroy = _cogl_winsys_display_destroy; + vtable.context_init = _cogl_winsys_context_init; + vtable.context_deinit = _cogl_winsys_context_deinit; + + vtable.onscreen_init = _cogl_winsys_onscreen_init; + vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; + vtable.onscreen_bind = _cogl_winsys_onscreen_bind; + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + vtable.onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled; + vtable.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys-wgl-feature-functions.h b/cogl/winsys/cogl-winsys-wgl-feature-functions.h new file mode 100644 index 0000000..c45e79a --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl-feature-functions.h @@ -0,0 +1,44 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +/* See cogl-winsys-glx-feature-functions.h for a description of how + this file is used */ + +COGL_WINSYS_FEATURE_BEGIN (swap_control, + "EXT\0", + "swap_control\0", + 0, + 0, + COGL_WINSYS_FEATURE_SWAP_THROTTLE) +COGL_WINSYS_FEATURE_FUNCTION (int, wglSwapInterval, + (int interval)) +COGL_WINSYS_FEATURE_END () diff --git a/cogl/winsys/cogl-winsys-wgl-private.h b/cogl/winsys/cogl-winsys-wgl-private.h new file mode 100644 index 0000000..7ad5773 --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl-private.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2012 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifndef __COGL_WINSYS_WGL_PRIVATE_H +#define __COGL_WINSYS_WGL_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_wgl_get_vtable (void); + +#endif /* __COGL_WINSYS_WGL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-wgl.c b/cogl/winsys/cogl-winsys-wgl.c new file mode 100644 index 0000000..d3c7c53 --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl.c @@ -0,0 +1,993 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-winsys-private.h" +#include "cogl-context-private.h" +#include "cogl-framebuffer.h" +#include "cogl-onscreen-private.h" +#include "cogl-swap-chain-private.h" +#include "cogl-renderer-private.h" +#include "cogl-display-private.h" +#include "cogl-onscreen-template-private.h" +#include "cogl-private.h" +#include "cogl-feature-private.h" +#include "cogl-win32-renderer.h" +#include "cogl-winsys-wgl-private.h" +#include "cogl-error-private.h" +#include "cogl-poll-private.h" + +/* This magic handle will cause g_poll to wakeup when there is a + * pending message */ +#define WIN32_MSG_HANDLE 19981206 + +typedef struct _CoglRendererWgl +{ + GModule *gl_module; + + /* Function pointers for GLX specific extensions */ +#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d, e, f) + +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + ret (APIENTRY * pf_ ## name) args; + +#define COGL_WINSYS_FEATURE_END() + +#include "cogl-winsys-wgl-feature-functions.h" + +#undef COGL_WINSYS_FEATURE_BEGIN +#undef COGL_WINSYS_FEATURE_FUNCTION +#undef COGL_WINSYS_FEATURE_END +} CoglRendererWgl; + +typedef struct _CoglDisplayWgl +{ + ATOM window_class; + HGLRC wgl_context; + HWND dummy_hwnd; + HDC dummy_dc; +} CoglDisplayWgl; + +typedef struct _CoglOnscreenWin32 +{ + HWND hwnd; + CoglBool is_foreign_hwnd; +} CoglOnscreenWin32; + +typedef struct _CoglContextWgl +{ + HDC current_dc; +} CoglContextWgl; + +typedef struct _CoglOnscreenWgl +{ + CoglOnscreenWin32 _parent; + + HDC client_dc; + +} CoglOnscreenWgl; + +/* Define a set of arrays containing the functions required from GL + for each winsys feature */ +#define COGL_WINSYS_FEATURE_BEGIN(name, namespaces, extension_names, \ + feature_flags, feature_flags_private, \ + winsys_feature) \ + static const CoglFeatureFunction \ + cogl_wgl_feature_ ## name ## _funcs[] = { +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglRendererWgl, pf_ ## name) }, +#define COGL_WINSYS_FEATURE_END() \ + { NULL, 0 }, \ + }; +#include "cogl-winsys-wgl-feature-functions.h" + +/* Define an array of features */ +#undef COGL_WINSYS_FEATURE_BEGIN +#define COGL_WINSYS_FEATURE_BEGIN(name, namespaces, extension_names, \ + feature_flags, feature_flags_private, \ + winsys_feature) \ + { 255, 255, 0, namespaces, extension_names, \ + feature_flags, feature_flags_private, \ + winsys_feature, \ + cogl_wgl_feature_ ## name ## _funcs }, +#undef COGL_WINSYS_FEATURE_FUNCTION +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) +#undef COGL_WINSYS_FEATURE_END +#define COGL_WINSYS_FEATURE_END() + +static const CoglFeatureData winsys_feature_data[] = + { +#include "cogl-winsys-wgl-feature-functions.h" + }; + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name, + CoglBool in_core) +{ + CoglRendererWgl *wgl_renderer = renderer->winsys; + void *proc = wglGetProcAddress ((LPCSTR) name); + + /* The documentation for wglGetProcAddress implies that it only + returns pointers to extension functions so if it fails we'll try + resolving the symbol directly from the the GL library. We could + completely avoid using wglGetProcAddress if in_core is TRUE but + on WGL any function that is in GL > 1.1 is considered an + extension and is not directly exported from opengl32.dll. + Therefore we currently just assume wglGetProcAddress will return + NULL for GL 1.1 functions and we can fallback to querying them + directly from the library */ + + if (proc == NULL) + { + if (wgl_renderer->gl_module == NULL) + wgl_renderer->gl_module = g_module_open ("opengl32", 0); + + if (wgl_renderer->gl_module) + g_module_symbol (wgl_renderer->gl_module, name, &proc); + } + + return proc; +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererWgl *wgl_renderer = renderer->winsys; + + if (renderer->win32_enable_event_retrieval) + _cogl_poll_renderer_remove_fd (renderer, WIN32_MSG_HANDLE); + + if (wgl_renderer->gl_module) + g_module_close (wgl_renderer->gl_module); + + g_slice_free (CoglRendererWgl, renderer->winsys); +} + +static CoglOnscreen * +find_onscreen_for_hwnd (CoglContext *context, HWND hwnd) +{ + CoglDisplayWgl *display_wgl = context->display->winsys; + GList *l; + + /* If the hwnd has Cogl's window class then we can lookup the + onscreen pointer directly by reading the extra window data */ + if (GetClassLongPtr (hwnd, GCW_ATOM) == display_wgl->window_class) + { + CoglOnscreen *onscreen = (CoglOnscreen *) GetWindowLongPtr (hwnd, 0); + + if (onscreen) + return onscreen; + } + + for (l = context->framebuffers; l; l = l->next) + { + CoglFramebuffer *framebuffer = l->data; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + CoglOnscreenWin32 *win32_onscreen = + COGL_ONSCREEN (framebuffer)->winsys; + + if (win32_onscreen->hwnd == hwnd) + return COGL_ONSCREEN (framebuffer); + } + } + + return NULL; +} + +static CoglFilterReturn +win32_event_filter_cb (MSG *msg, void *data) +{ + CoglContext *context = data; + + if (msg->message == WM_SIZE) + { + CoglOnscreen *onscreen = + find_onscreen_for_hwnd (context, msg->hwnd); + + if (onscreen) + { + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + /* Ignore size changes resulting from the stage being + minimized - otherwise it will think the window has been + resized to 0,0 */ + if (msg->wParam != SIZE_MINIMIZED) + { + WORD new_width = LOWORD (msg->lParam); + WORD new_height = HIWORD (msg->lParam); + _cogl_framebuffer_winsys_update_size (framebuffer, + new_width, + new_height); + } + } + } + else if (msg->message == WM_PAINT) + { + CoglOnscreen *onscreen = + find_onscreen_for_hwnd (context, msg->hwnd); + RECT rect; + + if (onscreen && GetUpdateRect (msg->hwnd, &rect, FALSE)) + { + CoglOnscreenDirtyInfo info; + + /* Apparently this removes the dirty region from the window + * so that it won't be included in the next WM_PAINT + * message. This is also what SDL does to emit dirty + * events */ + ValidateRect (msg->hwnd, &rect); + + info.x = rect.left; + info.y = rect.top; + info.width = rect.right - rect.left; + info.height = rect.bottom - rect.top; + + _cogl_onscreen_queue_dirty (onscreen, &info); + } + } + + return COGL_FILTER_CONTINUE; +} + +static CoglBool +check_messages (void *user_data) +{ + MSG msg; + + return PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE; +} + +static void +dispatch_messages (void *user_data) +{ + MSG msg; + + while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE)) + /* This should cause the message to be sent to our window proc */ + DispatchMessageW (&msg); +} + +static CoglBool +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + CoglError **error) +{ + renderer->winsys = g_slice_new0 (CoglRendererWgl); + + if (renderer->win32_enable_event_retrieval) + { + /* We'll add a magic handle that will cause a GLib main loop to + * wake up when there are messages. This will only work if the + * application is using GLib but it shouldn't matter if it + * doesn't work in other cases because the application shouldn't + * be using the cogl_poll_* functions on non-Unix systems + * anyway */ + _cogl_poll_renderer_add_fd (renderer, + WIN32_MSG_HANDLE, + COGL_POLL_FD_EVENT_IN, + check_messages, + dispatch_messages, + renderer); + } + + return TRUE; +} + +static LRESULT CALLBACK +window_proc (HWND hwnd, UINT umsg, + WPARAM wparam, LPARAM lparam) +{ + CoglBool message_handled = FALSE; + CoglOnscreen *onscreen; + + /* It's not clear what the best thing to do with messages sent to + the window proc is. We want the application to forward on all + messages through Cogl so that it can have a chance to process + them which might mean that that in it's GetMessage loop it could + call cogl_win32_renderer_handle_event for every message. However + the message loop would usually call DispatchMessage as well which + mean this window proc would be invoked and Cogl would see the + message twice. However we can't just ignore messages in the + window proc because some messages are sent directly from windows + without going through the message queue. This function therefore + just forwards on all messages directly. This means that the + application is not expected to forward on messages if it has let + Cogl create the window itself because it will already see them + via the window proc. This limits the kinds of messages that Cogl + can handle to ones that are sent to the windows it creates, but I + think that is a reasonable restriction */ + + /* Convert the message to a MSG struct and pass it through the Cogl + message handling mechanism */ + + /* This window proc is only called for messages created with Cogl's + window class so we should be able to work out the corresponding + window class by looking in the extra window data. Windows will + send some extra messages before we get a chance to set this value + so we have to ignore these */ + onscreen = (CoglOnscreen *) GetWindowLongPtr (hwnd, 0); + + if (onscreen != NULL) + { + CoglRenderer *renderer; + DWORD message_pos; + MSG msg; + + msg.hwnd = hwnd; + msg.message = umsg; + msg.wParam = wparam; + msg.lParam = lparam; + msg.time = GetMessageTime (); + /* Neither MAKE_POINTS nor GET_[XY]_LPARAM is defined in MinGW + headers so we need to convert to a signed type explicitly */ + message_pos = GetMessagePos (); + msg.pt.x = (SHORT) LOWORD (message_pos); + msg.pt.y = (SHORT) HIWORD (message_pos); + + renderer = COGL_FRAMEBUFFER (onscreen)->context->display->renderer; + + message_handled = + cogl_win32_renderer_handle_event (renderer, &msg); + } + + if (!message_handled) + return DefWindowProcW (hwnd, umsg, wparam, lparam); + else + return 0; +} + +static CoglBool +pixel_format_is_better (const PIXELFORMATDESCRIPTOR *pfa, + const PIXELFORMATDESCRIPTOR *pfb) +{ + /* Always prefer a format with a stencil buffer */ + if (pfa->cStencilBits == 0) + { + if (pfb->cStencilBits > 0) + return TRUE; + } + else if (pfb->cStencilBits == 0) + return FALSE; + + /* Prefer a bigger color buffer */ + if (pfb->cColorBits > pfa->cColorBits) + return TRUE; + else if (pfb->cColorBits < pfa->cColorBits) + return FALSE; + + /* Prefer a bigger depth buffer */ + return pfb->cDepthBits > pfa->cDepthBits; +} + +static int +choose_pixel_format (CoglFramebufferConfig *config, + HDC dc, PIXELFORMATDESCRIPTOR *pfd) +{ + int i, num_formats, best_pf = 0; + PIXELFORMATDESCRIPTOR best_pfd; + + num_formats = DescribePixelFormat (dc, 0, sizeof (best_pfd), NULL); + + /* XXX: currently we don't support multisampling on windows... */ + if (config->samples_per_pixel) + return best_pf; + + for (i = 1; i <= num_formats; i++) + { + memset (pfd, 0, sizeof (*pfd)); + + if (DescribePixelFormat (dc, i, sizeof (best_pfd), pfd) && + /* Check whether this format is useable by Cogl */ + ((pfd->dwFlags & (PFD_SUPPORT_OPENGL | + PFD_DRAW_TO_WINDOW | + PFD_DOUBLEBUFFER | + PFD_GENERIC_FORMAT)) == + (PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW)) && + pfd->iPixelType == PFD_TYPE_RGBA && + pfd->cColorBits >= 16 && pfd->cColorBits <= 32 && + pfd->cDepthBits >= 16 && pfd->cDepthBits <= 32 && + /* Check whether this is a better format than one we've + already found */ + (best_pf == 0 || pixel_format_is_better (&best_pfd, pfd))) + { + if (config->swap_chain->has_alpha && pfd->cAlphaBits == 0) + continue; + if (config->need_stencil && pfd->cStencilBits == 0) + continue; + + best_pf = i; + best_pfd = *pfd; + } + } + + *pfd = best_pfd; + + return best_pf; +} + +static CoglBool +create_window_class (CoglDisplay *display, CoglError **error) +{ + CoglDisplayWgl *wgl_display = display->winsys; + char *class_name_ascii, *src; + WCHAR *class_name_wchar, *dst; + WNDCLASSW wndclass; + + /* We create a window class per display so that we have an + opportunity to clean up the class when the display is + destroyed */ + + /* Generate a unique name containing the address of the display */ + class_name_ascii = g_strdup_printf ("CoglWindow0x%0*" G_GINTPTR_MODIFIER "x", + sizeof (guintptr) * 2, + (guintptr) display); + /* Convert it to WCHARs */ + class_name_wchar = g_malloc ((strlen (class_name_ascii) + 1) * + sizeof (WCHAR)); + for (src = class_name_ascii, dst = class_name_wchar; + *src; + src++, dst++) + *dst = *src; + *dst = L'\0'; + + memset (&wndclass, 0, sizeof (wndclass)); + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = window_proc; + /* We reserve extra space in the window data for a pointer back to + the CoglOnscreen */ + wndclass.cbWndExtra = sizeof (LONG_PTR); + wndclass.hInstance = GetModuleHandleW (NULL); + wndclass.hIcon = LoadIconW (NULL, (LPWSTR) IDI_APPLICATION); + wndclass.hCursor = LoadCursorW (NULL, (LPWSTR) IDC_ARROW); + wndclass.hbrBackground = NULL; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = class_name_wchar; + wgl_display->window_class = RegisterClassW (&wndclass); + + g_free (class_name_wchar); + g_free (class_name_ascii); + + if (wgl_display->window_class == 0) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to register window class"); + return FALSE; + } + + return TRUE; +} + +static CoglBool +create_context (CoglDisplay *display, CoglError **error) +{ + CoglDisplayWgl *wgl_display = display->winsys; + + _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context == NULL, FALSE); + + /* Cogl assumes that there is always a GL context selected; in order + * to make sure that a WGL context exists and is made current, we + * use a small dummy window that never gets shown to which we can + * always fall back if no onscreen is available + */ + if (wgl_display->dummy_hwnd == NULL) + { + wgl_display->dummy_hwnd = + CreateWindowW ((LPWSTR) MAKEINTATOM (wgl_display->window_class), + L".", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + 1, 1, + NULL, NULL, + GetModuleHandle (NULL), + NULL); + + if (wgl_display->dummy_hwnd == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to create dummy window"); + return FALSE; + } + } + + if (wgl_display->dummy_dc == NULL) + { + PIXELFORMATDESCRIPTOR pfd; + int pf; + + wgl_display->dummy_dc = GetDC (wgl_display->dummy_hwnd); + + pf = choose_pixel_format (&display->onscreen_template->config, + wgl_display->dummy_dc, &pfd); + + if (pf == 0 || !SetPixelFormat (wgl_display->dummy_dc, pf, &pfd)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find suitable GL pixel format"); + ReleaseDC (wgl_display->dummy_hwnd, wgl_display->dummy_dc); + wgl_display->dummy_dc = NULL; + return FALSE; + } + } + + if (wgl_display->wgl_context == NULL) + { + wgl_display->wgl_context = wglCreateContext (wgl_display->dummy_dc); + + if (wgl_display->wgl_context == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to create suitable GL context"); + return FALSE; + } + } + + COGL_NOTE (WINSYS, "Selecting dummy 0x%x for the WGL context", + (unsigned int) wgl_display->dummy_hwnd); + + wglMakeCurrent (wgl_display->dummy_dc, wgl_display->wgl_context); + + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + CoglDisplayWgl *wgl_display = display->winsys; + + _COGL_RETURN_IF_FAIL (wgl_display != NULL); + + if (wgl_display->wgl_context) + { + wglMakeCurrent (NULL, NULL); + wglDeleteContext (wgl_display->wgl_context); + } + + if (wgl_display->dummy_dc) + ReleaseDC (wgl_display->dummy_hwnd, wgl_display->dummy_dc); + + if (wgl_display->dummy_hwnd) + DestroyWindow (wgl_display->dummy_hwnd); + + if (wgl_display->window_class) + UnregisterClassW ((LPWSTR) MAKEINTATOM (wgl_display->window_class), + GetModuleHandleW (NULL)); + + g_slice_free (CoglDisplayWgl, display->winsys); + display->winsys = NULL; +} + +static CoglBool +_cogl_winsys_display_setup (CoglDisplay *display, + CoglError **error) +{ + CoglDisplayWgl *wgl_display; + + _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); + + wgl_display = g_slice_new0 (CoglDisplayWgl); + display->winsys = wgl_display; + + if (!create_window_class (display, error)) + goto error; + + if (!create_context (display, error)) + goto error; + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static const char * +get_wgl_extensions_string (HDC dc) +{ + const char * (APIENTRY *pf_wglGetExtensionsStringARB) (HDC); + const char * (APIENTRY *pf_wglGetExtensionsStringEXT) (void); + + _COGL_GET_CONTEXT (ctx, NULL); + + /* According to the docs for these two extensions, you are supposed + to use wglGetProcAddress to detect their availability so + presumably it will return NULL if they are not available */ + + pf_wglGetExtensionsStringARB = + (void *) wglGetProcAddress ("wglGetExtensionsStringARB"); + + if (pf_wglGetExtensionsStringARB) + return pf_wglGetExtensionsStringARB (dc); + + pf_wglGetExtensionsStringEXT = + (void *) wglGetProcAddress ("wglGetExtensionsStringEXT"); + + if (pf_wglGetExtensionsStringEXT) + return pf_wglGetExtensionsStringEXT (); + + /* The WGL_EXT_swap_control is also advertised as a GL extension as + GL_EXT_SWAP_CONTROL so if the extension to get the list of WGL + extensions isn't supported then we can at least fake it to + support the swap control extension */ + { + char **extensions = _cogl_context_get_gl_extensions (ctx); + CoglBool have_ext = _cogl_check_extension ("WGL_EXT_swap_control", + extensions); + g_strfreev (extensions); + if (have_ext) + return "WGL_EXT_swap_control"; + } + + return NULL; +} + +static CoglBool +update_winsys_features (CoglContext *context, CoglError **error) +{ + CoglDisplayWgl *wgl_display = context->display->winsys; + CoglRendererWgl *wgl_renderer = context->display->renderer->winsys; + const char *wgl_extensions; + int i; + + _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context, FALSE); + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + memset (context->winsys_features, 0, sizeof (context->winsys_features)); + + context->feature_flags |= COGL_FEATURE_ONSCREEN_MULTIPLE; + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, + TRUE); + + wgl_extensions = get_wgl_extensions_string (wgl_display->dummy_dc); + + if (wgl_extensions) + { + char **split_extensions = + g_strsplit (wgl_extensions, " ", 0 /* max_tokens */); + + COGL_NOTE (WINSYS, " WGL Extensions: %s", wgl_extensions); + + for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++) + if (_cogl_feature_check (context->display->renderer, + "WGL", winsys_feature_data + i, 0, 0, + COGL_DRIVER_GL, + split_extensions, + wgl_renderer)) + { + context->feature_flags |= winsys_feature_data[i].feature_flags; + if (winsys_feature_data[i].winsys_feature) + COGL_FLAGS_SET (context->winsys_features, + winsys_feature_data[i].winsys_feature, + TRUE); + } + + g_strfreev (split_extensions); + } + + /* We'll manually handle queueing dirty events in response to + * WM_PAINT messages */ + COGL_FLAGS_SET (context->private_features, + COGL_PRIVATE_FEATURE_DIRTY_EVENTS, + TRUE); + + return TRUE; +} + +static CoglBool +_cogl_winsys_context_init (CoglContext *context, CoglError **error) +{ + context->winsys = g_new0 (CoglContextWgl, 1); + + cogl_win32_renderer_add_filter (context->display->renderer, + win32_event_filter_cb, + context); + + return update_winsys_features (context, error); +} + +static void +_cogl_winsys_context_deinit (CoglContext *context) +{ + cogl_win32_renderer_remove_filter (context->display->renderer, + win32_event_filter_cb, + context); + + g_free (context->winsys); +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb; + CoglContext *context; + CoglContextWgl *wgl_context; + CoglDisplayWgl *wgl_display; + CoglOnscreenWgl *wgl_onscreen; + CoglRendererWgl *wgl_renderer; + + /* The glx backend tries to bind the dummy context if onscreen == + NULL, but this isn't really going to work because before checking + whether onscreen == NULL it reads the pointer to get the + context */ + _COGL_RETURN_IF_FAIL (onscreen != NULL); + + fb = COGL_FRAMEBUFFER (onscreen); + context = fb->context; + wgl_context = context->winsys; + wgl_display = context->display->winsys; + wgl_onscreen = onscreen->winsys; + wgl_renderer = context->display->renderer->winsys; + + if (wgl_context->current_dc == wgl_onscreen->client_dc) + return; + + wglMakeCurrent (wgl_onscreen->client_dc, wgl_display->wgl_context); + + /* According to the specs for WGL_EXT_swap_control SwapInterval() + * applies to the current window not the context so we apply it here + * to ensure its up-to-date even for new windows. + */ + if (wgl_renderer->pf_wglSwapInterval) + { + if (fb->config.swap_throttled) + wgl_renderer->pf_wglSwapInterval (1); + else + wgl_renderer->pf_wglSwapInterval (0); + } + + wgl_context->current_dc = wgl_onscreen->client_dc; +} + +static void +_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextWgl *wgl_context = context->winsys; + CoglOnscreenWin32 *win32_onscreen = onscreen->winsys; + CoglOnscreenWgl *wgl_onscreen = onscreen->winsys; + + /* If we never successfully allocated then there's nothing to do */ + if (wgl_onscreen == NULL) + return; + + if (wgl_onscreen->client_dc) + { + if (wgl_context->current_dc == wgl_onscreen->client_dc) + _cogl_winsys_onscreen_bind (NULL); + + ReleaseDC (win32_onscreen->hwnd, wgl_onscreen->client_dc); + } + + if (!win32_onscreen->is_foreign_hwnd && win32_onscreen->hwnd) + { + /* Drop the pointer to the onscreen in the window so that any + further messages won't be processed */ + SetWindowLongPtrW (win32_onscreen->hwnd, 0, (LONG_PTR) 0); + DestroyWindow (win32_onscreen->hwnd); + } + + g_slice_free (CoglOnscreenWgl, onscreen->winsys); + onscreen->winsys = NULL; +} + +static CoglBool +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + CoglError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplayWgl *wgl_display = display->winsys; + CoglOnscreenWgl *wgl_onscreen; + CoglOnscreenWin32 *win32_onscreen; + PIXELFORMATDESCRIPTOR pfd; + int pf; + HWND hwnd; + + _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context, FALSE); + + /* XXX: Note we ignore the user's original width/height when given a + * foreign window. */ + if (onscreen->foreign_hwnd) + { + RECT client_rect; + + hwnd = onscreen->foreign_hwnd; + + GetClientRect (hwnd, &client_rect); + + _cogl_framebuffer_winsys_update_size (framebuffer, + client_rect.right, + client_rect.bottom); + } + else + { + int width, height; + + width = COGL_FRAMEBUFFER (onscreen)->width; + height = COGL_FRAMEBUFFER (onscreen)->height; + + /* The size of the window passed to CreateWindow for some reason + includes the window decorations so we need to compensate for + that */ + width += GetSystemMetrics (SM_CXSIZEFRAME) * 2; + height += (GetSystemMetrics (SM_CYSIZEFRAME) * 2 + + GetSystemMetrics (SM_CYCAPTION)); + + hwnd = CreateWindowW ((LPWSTR) MAKEINTATOM (wgl_display->window_class), + L".", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, /* xpos */ + CW_USEDEFAULT, /* ypos */ + width, + height, + NULL, /* parent */ + NULL, /* menu */ + GetModuleHandle (NULL), + NULL /* lparam for the WM_CREATE message */); + + if (hwnd == NULL) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to create window"); + return FALSE; + } + + /* Store a pointer back to the onscreen in the window extra data + so we can refer back to it quickly */ + SetWindowLongPtrW (hwnd, 0, (LONG_PTR) onscreen); + } + + onscreen->winsys = g_slice_new0 (CoglOnscreenWgl); + win32_onscreen = onscreen->winsys; + wgl_onscreen = onscreen->winsys; + + win32_onscreen->hwnd = hwnd; + + wgl_onscreen->client_dc = GetDC (hwnd); + + /* Use the same pixel format as the dummy DC from the renderer */ + pf = choose_pixel_format (&framebuffer->config, + wgl_onscreen->client_dc, &pfd); + + if (pf == 0 || !SetPixelFormat (wgl_onscreen->client_dc, pf, &pfd)) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Error setting pixel format on the window"); + + _cogl_winsys_onscreen_deinit (onscreen); + + return FALSE; + } + + return TRUE; +} + +static void +_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglOnscreenWgl *wgl_onscreen = onscreen->winsys; + + SwapBuffers (wgl_onscreen->client_dc); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextWgl *wgl_context = context->winsys; + CoglOnscreenWgl *wgl_onscreen = onscreen->winsys; + + if (wgl_context->current_dc != wgl_onscreen->client_dc) + return; + + /* This will cause it to rebind the context and update the swap interval */ + wgl_context->current_dc = NULL; + _cogl_winsys_onscreen_bind (onscreen); +} + +static HWND +_cogl_winsys_onscreen_win32_get_window (CoglOnscreen *onscreen) +{ + CoglOnscreenWin32 *win32_onscreen = onscreen->winsys; + return win32_onscreen->hwnd; +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + CoglBool visibility) +{ + CoglOnscreenWin32 *win32_onscreen = onscreen->winsys; + + ShowWindow (win32_onscreen->hwnd, visibility ? SW_SHOW : SW_HIDE); +} + +const CoglWinsysVtable * +_cogl_winsys_wgl_get_vtable (void) +{ + static CoglBool vtable_inited = FALSE; + static CoglWinsysVtable vtable; + + /* It would be nice if we could use C99 struct initializers here + like the GLX backend does. However this code is more likely to be + compiled using Visual Studio which (still!) doesn't support them + so we initialize it in code instead */ + + if (!vtable_inited) + { + memset (&vtable, 0, sizeof (vtable)); + + vtable.id = COGL_WINSYS_ID_WGL; + vtable.name = "WGL"; + vtable.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address; + vtable.renderer_connect = _cogl_winsys_renderer_connect; + vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; + vtable.display_setup = _cogl_winsys_display_setup; + vtable.display_destroy = _cogl_winsys_display_destroy; + vtable.context_init = _cogl_winsys_context_init; + vtable.context_deinit = _cogl_winsys_context_deinit; + vtable.onscreen_init = _cogl_winsys_onscreen_init; + vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; + vtable.onscreen_bind = _cogl_winsys_onscreen_bind; + vtable.onscreen_swap_buffers_with_damage = + _cogl_winsys_onscreen_swap_buffers_with_damage; + vtable.onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled; + vtable.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility; + vtable.onscreen_win32_get_window = _cogl_winsys_onscreen_win32_get_window; + + vtable_inited = TRUE; + } + + return &vtable; +} diff --git a/cogl/winsys/cogl-winsys.c b/cogl/winsys/cogl-winsys.c new file mode 100644 index 0000000..fccb94c --- /dev/null +++ b/cogl/winsys/cogl-winsys.c @@ -0,0 +1,52 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" + +#include + +uint32_t +_cogl_winsys_error_quark (void) +{ + return g_quark_from_static_string ("cogl-winsys-error-quark"); +} + +/* FIXME: we should distinguish renderer and context features */ +CoglBool +_cogl_winsys_has_feature (CoglWinsysFeature feature) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + return COGL_FLAGS_GET (ctx->winsys_features, feature); +} diff --git a/config-custom.h b/config-custom.h new file mode 100644 index 0000000..137b51f --- /dev/null +++ b/config-custom.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * A Low Level GPU Graphics and Utilities API + * + * Copyright (C) 2011 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* The contents of this file get #included by config.h so it is + intended for extra configuration that needs to be included by all + Cogl source files. */ + +/* The windows headers #define 'near' and 'far' to be blank. We + commonly want to use these variable names for doing perspective + transformation so rather than having to workaround this mis-feature + in Windows in the code we just #undef them here. We need to do this + after including windows.h */ +#ifdef _WIN32 +#include +#undef near +#undef far +#endif /* _WIN32 */ diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..c9613b7 --- /dev/null +++ b/config.h.in @@ -0,0 +1,598 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* define if asm blocks can use numeric local labels */ +#undef ASM_NUMERIC_LABELS + +/* Can use Cogl 2.0 API internally */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API + +/* Can use experimental API internally */ +#undef COGL_ENABLE_EXPERIMENTAL_API + +/* The major version for libgbm */ +#undef COGL_GBM_MAJOR + +/* The micro version for libgbm */ +#undef COGL_GBM_MICRO + +/* The minor version for libgbm */ +#undef COGL_GBM_MINOR + +/* Cogl supports OpenGL using the WGL API */ +#undef COGL_HAS_WGL_SUPPORT + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Whether to enable building unit tests */ +#undef ENABLE_UNIT_TESTS + +/* The prefix for our gettext translation domains. */ +#undef GETTEXT_PACKAGE + +/* Define to the GLIB binary age */ +#undef GLIB_BINARY_AGE + +/* Byte contents of gmutex */ +#undef GLIB_BYTE_CONTENTS_GMUTEX + +/* Define to the GLIB interface age */ +#undef GLIB_INTERFACE_AGE + +/* The size of gmutex, as computed by sizeof. */ +#undef GLIB_SIZEOF_GMUTEX + +/* The size of system_thread, as computed by sizeof. */ +#undef GLIB_SIZEOF_SYSTEM_THREAD + +/* alpha atomic implementation */ +#undef G_ATOMIC_ALPHA + +/* arm atomic implementation */ +#undef G_ATOMIC_ARM + +/* cris atomic implementation */ +#undef G_ATOMIC_CRIS + +/* crisv32 atomic implementation */ +#undef G_ATOMIC_CRISV32 + +/* i486 atomic implementation */ +#undef G_ATOMIC_I486 + +/* ia64 atomic implementation */ +#undef G_ATOMIC_IA64 + +/* powerpc atomic implementation */ +#undef G_ATOMIC_POWERPC + +/* s390 atomic implementation */ +#undef G_ATOMIC_S390 + +/* sparcv9 atomic implementation */ +#undef G_ATOMIC_SPARCV9 + +/* x86_64 atomic implementation */ +#undef G_ATOMIC_X86_64 + +/* Have inline keyword */ +#undef G_HAVE_INLINE + +/* Have __inline keyword */ +#undef G_HAVE___INLINE + +/* Have __inline__ keyword */ +#undef G_HAVE___INLINE__ + +/* Source file containing theread implementation */ +#undef G_THREAD_SOURCE + +/* A 'va_copy' style function */ +#undef G_VA_COPY + +/* 'va_lists' cannot be copies as values */ +#undef G_VA_COPY_AS_ARRAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Whether we have cairo or not */ +#undef HAVE_CAIRO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CE4100_LIBGDL_H + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Define to 1 if you have the `chown' function. */ +#undef HAVE_CHOWN + +/* Have GL for rendering */ +#undef HAVE_COGL_GL + +/* Have GLES 1.1 for rendering */ +#undef HAVE_COGL_GLES + +/* Have GLES 2.0 for rendering */ +#undef HAVE_COGL_GLES2 + +/* Have WebGL for rendering */ +#undef HAVE_COGL_WEBGL + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Defined if the GL library should not be dlopened */ +#undef HAVE_DIRECTLY_LINKED_GL_LIBRARY + +/* Define to 1 if you have the header file. */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_EGL_EGLEXT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_EGL_EGL_H + +/* Define to 1 if you have the `endmntent' function. */ +#undef HAVE_ENDMNTENT + +/* Define to 1 if you have the `fchmod' function. */ +#undef HAVE_FCHMOD + +/* Define to 1 if you have the `fchown' function. */ +#undef HAVE_FCHOWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fdwalk' function. */ +#undef HAVE_FDWALK + +/* Define to 1 if you have the `ffs' function. */ +#undef HAVE_FFS + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Has the __FLOAT_WORD_ORDER macro */ +#undef HAVE_FLOAT_WORD_ORDER + +/* Define to 1 if you have the header file. */ +#undef HAVE_FSTAB_H + +/* we have the futex(2) system call */ +#undef HAVE_FUTEX + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getc_unlocked' function. */ +#undef HAVE_GETC_UNLOCKED + +/* Define to 1 if you have the `getfsstat' function. */ +#undef HAVE_GETFSSTAT + +/* Define to 1 if you have the `getgrgid' function. */ +#undef HAVE_GETGRGID + +/* Define to 1 if you have the `getmntent_r' function. */ +#undef HAVE_GETMNTENT_R + +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the `getvfsstat' function. */ +#undef HAVE_GETVFSSTAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_GLES_EGL_H + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* define to use system printf */ +#undef HAVE_GOOD_PRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_GRP_H + +/* Define to 1 if you have the `hasmntopt' function. */ +#undef HAVE_HASMNTOPT + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* define to support printing 64-bit integers with format I64 */ +#undef HAVE_INT64_AND_I64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `lchmod' function. */ +#undef HAVE_LCHMOD + +/* Define to 1 if you have the `lchown' function. */ +#undef HAVE_LCHOWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGDL_H + +/* Define to 1 if you have the `GL' library (-lGL). */ +#undef HAVE_LIBGL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `link' function. */ +#undef HAVE_LINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MAGIC_H + +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* define if system printf can print long long */ +#undef HAVE_LONG_LONG_FORMAT + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MNTENT_H + +/* Have non-POSIX function getgrgid_r */ +#undef HAVE_NONPOSIX_GETGRGID_R + +/* Have non-POSIX function getpwuid_r */ +#undef HAVE_NONPOSIX_GETPWUID_R + +/* Define to 1 if you have the `on_exit' function. */ +#undef HAVE_ON_EXIT + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Have POSIX function getgrgid_r */ +#undef HAVE_POSIX_GETGRGID_R + +/* Have POSIX function getpwuid_r */ +#undef HAVE_POSIX_GETPWUID_R + +/* Have function pthread_attr_setstacksize */ +#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SCHED_H + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setmntent' function. */ +#undef HAVE_SETMNTENT + +/* Define to 1 if you have the `sincos' function. */ +#undef HAVE_SINCOS + +/* Define to 1 if you have the `splice' function. */ +#undef HAVE_SPLICE + +/* Whether _Static_assert can be used or not */ +#undef HAVE_STATIC_ASSERT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + +/* Define to 1 if `f_bavail' is a member of `struct statfs'. */ +#undef HAVE_STRUCT_STATFS_F_BAVAIL + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +#undef HAVE_STRUCT_STATFS_F_FSTYPENAME + +/* Define to 1 if `f_basetype' is a member of `struct statvfs'. */ +#undef HAVE_STRUCT_STATVFS_F_BASETYPE + +/* Define to 1 if `f_fstypename' is a member of `struct statvfs'. */ +#undef HAVE_STRUCT_STATVFS_F_FSTYPENAME + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMENSEC + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLKSIZE + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + +/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_CTIMENSEC + +/* Define to 1 if `st_ctim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC + +/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_MTIMENSEC + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC + +/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ +#undef HAVE_STRUCT_TM_TM_GMTOFF + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +#undef HAVE_STRUCT_TM___TM_GMTOFF + +/* Define to 1 if you have the `symlink' function. */ +#undef HAVE_SYMLINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MKDEV_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MNTCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MNTTAB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VFSTAB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VMOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unsetenv' function. */ +#undef HAVE_UNSETENV + +/* Define to 1 if you have the `utimes' function. */ +#undef HAVE_UTIMES + +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H + +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Have Win32 atomic intrinsics */ +#undef HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS + +/* Have a working bcopy */ +#undef HAVE_WORKING_BCOPY + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* global 'sys_errlist' not found */ +#undef NO_SYS_ERRLIST + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Maximum POSIX RT priority */ +#undef POSIX_MAX_PRIORITY + +/* Minimum POSIX RT priority */ +#undef POSIX_MIN_PRIORITY + +/* The POSIX RT yield function */ +#undef POSIX_YIELD_FUNC + +/* The size of `char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* The size of `__int64', as computed by sizeof. */ +#undef SIZEOF___INT64 + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Use GdkPixbuf for loading image data */ +#undef USE_GDKPIXBUF + +/* Use internal image decoding for loading image data */ +#undef USE_INTERNAL + +/* Use Core Graphics (Quartz) for loading image data */ +#undef USE_QUARTZ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Cogl is being compiled with emscripten */ +#undef USING_EMSCRIPTEN + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +#include "config-custom.h" diff --git a/config.h.win32 b/config.h.win32 new file mode 100644 index 0000000..7957691 --- /dev/null +++ b/config.h.win32 @@ -0,0 +1,638 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* define if asm blocks can use numeric local labels */ +/* #undef ASM_NUMERIC_LABELS */ + +/* Can use Cogl 2.0 API internally */ +#define COGL_ENABLE_EXPERIMENTAL_2_0_API 1 + +/* Can use experimental API internally */ +#define COGL_ENABLE_EXPERIMENTAL_API 1 + +/* The major version for libgbm */ +/* #undef COGL_GBM_MAJOR */ + +/* The micro version for libgbm */ +/* #undef COGL_GBM_MICRO */ + +/* The minor version for libgbm */ +/* #undef COGL_GBM_MINOR */ + +/* Cogl supports OpenGL using the WGL API */ +#define COGL_HAS_WGL_SUPPORT 1 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#define ENABLE_NLS 1 + +/* The prefix for our gettext translation domains. */ +#define GETTEXT_PACKAGE "cogl" + +/* Define to the GLIB binary age */ +/* #undef GLIB_BINARY_AGE */ + +/* Byte contents of gmutex */ +/* #undef GLIB_BYTE_CONTENTS_GMUTEX */ + +/* Define to the GLIB interface age */ +/* #undef GLIB_INTERFACE_AGE */ + +/* The size of gmutex, as computed by sizeof. */ +/* #undef GLIB_SIZEOF_GMUTEX */ + +/* The size of system_thread, as computed by sizeof. */ +/* #undef GLIB_SIZEOF_SYSTEM_THREAD */ + +/* alpha atomic implementation */ +/* #undef G_ATOMIC_ALPHA */ + +/* arm atomic implementation */ +/* #undef G_ATOMIC_ARM */ + +/* cris atomic implementation */ +/* #undef G_ATOMIC_CRIS */ + +/* crisv32 atomic implementation */ +/* #undef G_ATOMIC_CRISV32 */ + +/* i486 atomic implementation */ +/* #undef G_ATOMIC_I486 */ + +/* ia64 atomic implementation */ +/* #undef G_ATOMIC_IA64 */ + +/* powerpc atomic implementation */ +/* #undef G_ATOMIC_POWERPC */ + +/* s390 atomic implementation */ +/* #undef G_ATOMIC_S390 */ + +/* sparcv9 atomic implementation */ +/* #undef G_ATOMIC_SPARCV9 */ + +/* x86_64 atomic implementation */ +/* #undef G_ATOMIC_X86_64 */ + +/* Have inline keyword */ +/* #undef G_HAVE_INLINE */ + +/* Have __inline keyword */ +/* #undef G_HAVE___INLINE */ + +/* Have __inline__ keyword */ +/* #undef G_HAVE___INLINE__ */ + +/* Source file containing theread implementation */ +/* #undef G_THREAD_SOURCE */ + +/* A 'va_copy' style function */ +/* #undef G_VA_COPY */ + +/* 'va_lists' cannot be copies as values */ +/* #undef G_VA_COPY_AS_ARRAY */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the `atexit' function. */ +/* #undef HAVE_ATEXIT */ + +/* Whether we have cairo or not */ +#define HAVE_CAIRO 1 + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_CE4100_LIBGDL_H*/ + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/*#undef HAVE_CFLOCALECOPYCURRENT*/ + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/*#undef HAVE_CFPREFERENCESCOPYAPPVALUE*/ + +/* Define to 1 if you have the `chown' function. */ +/* #undef HAVE_CHOWN */ + +/* Have GL for rendering */ +#define HAVE_COGL_GL 1 + +/* Have GLES 1.1 for rendering */ +/*#undef HAVE_COGL_GLES*/ + +/* Have GLES 2.0 for rendering */ +/*#undef HAVE_COGL_GLES2*/ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#define HAVE_DCGETTEXT 1 + +/* Defined if the GL library shouldn't be dlopened */ +#define HAVE_DIRECTLY_LINKED_GL_LIBRARY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_DLFCN_H*/ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_EGL_EGLEXT_H*/ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_EGL_EGL_H*/ + +/* Define to 1 if you have the `endmntent' function. */ +/* #undef HAVE_ENDMNTENT */ + +/* Define to 1 if you have the `fchmod' function. */ +/* #undef HAVE_FCHMOD */ + +/* Define to 1 if you have the `fchown' function. */ +/* #undef HAVE_FCHOWN */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdwalk' function. */ +/* #undef HAVE_FDWALK */ + +/* Define to 1 if you have the `ffs' function. */ +/*#undef HAVE_FFS*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FSTAB_H */ + +/* we have the futex(2) system call */ +/* #undef HAVE_FUTEX */ + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getc_unlocked' function. */ +/* #undef HAVE_GETC_UNLOCKED */ + +/* Define to 1 if you have the `getfsstat' function. */ +/* #undef HAVE_GETFSSTAT */ + +/* Define to 1 if you have the `getgrgid' function. */ +/* #undef HAVE_GETGRGID */ + +/* Define to 1 if you have the `getmntent_r' function. */ +/* #undef HAVE_GETMNTENT_R */ + +/* Define to 1 if you have the `getpwuid' function. */ +/* #undef HAVE_GETPWUID */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define to 1 if you have the `getvfsstat' function. */ +/* #undef HAVE_GETVFSSTAT */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_GLES_EGL_H*/ + +/* Define to 1 if you have the `gmtime_r' function. */ +/* #undef HAVE_GMTIME_R */ + +/* define to use system printf */ +/* #undef HAVE_GOOD_PRINTF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GRP_H */ + +/* Define to 1 if you have the `hasmntopt' function. */ +/* #undef HAVE_HASMNTOPT */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* define to support printing 64-bit integers with format I64 */ +#define HAVE_INT64_AND_I64 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_INTTYPES_H 1 +#endif + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +/* #undef HAVE_LCHOWN */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_LIBGDL_H*/ + +/* Define to 1 if you have the `GL' library (-lGL). */ +#define HAVE_LIBGL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +/* #undef HAVE_LINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MAGIC_H */ + +/* Define to 1 if you have the `localtime_r' function. */ +/* #undef HAVE_LOCALTIME_R */ + +/* define if system printf can print long long */ +#define HAVE_LONG_LONG_FORMAT 1 + +/* Define to 1 if you have the `lstat' function. */ +/* #undef HAVE_LSTAT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memmem' function. */ +/* #undef HAVE_MEMMEM */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MNTENT_H */ + +/* Have non-POSIX function getgrgid_r */ +/* #undef HAVE_NONPOSIX_GETGRGID_R */ + +/* Have non-POSIX function getpwuid_r */ +/* #undef HAVE_NONPOSIX_GETPWUID_R */ + +/* Define to 1 if you have the `on_exit' function. */ +/* #undef HAVE_ON_EXIT */ + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Have POSIX function getgrgid_r */ +/* #undef HAVE_POSIX_GETGRGID_R */ + +/* Have POSIX function getpwuid_r */ +/* #undef HAVE_POSIX_GETPWUID_R */ + +/* Have function pthread_attr_setstacksize */ +/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have the `readlink' function. */ +/* #undef HAVE_READLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SCHED_H */ + +/* Define to 1 if you have the `setenv' function. */ +/* #undef HAVE_SETENV */ + +/* Define to 1 if you have the `setmntent' function. */ +/* #undef HAVE_SETMNTENT */ + +/* Define to 1 if you have the `splice' function. */ +/* #undef HAVE_SPLICE */ + +/* Whether _Static_assert can be used or not */ +/* #undef HAVE_STATIC_ASSERT */ + +/* Define to 1 if you have the header file. */ +#if ((_MSC_VER >= 1600) || !defined(_MSC_VER)) +#define HAVE_STDINT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `stpcpy' function. */ +/* #undef HAVE_STPCPY */ + +/* Define to 1 if you have the `strcasecmp' function. */ +#if defined(_MSC_VER) +#define strcasecmp _stricmp +#endif /* _MSC_VER uses _stricmp, which is identical to strcasecmp */ + +#if !defined(__DMC__) +#define HAVE_STRCASECMP 1 +#endif /* _MSC_VER or __gcc__ */ + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_STRINGS_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_STRNCASECMP 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_STRNCASECMP */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the `strsignal' function. */ +/* #undef HAVE_STRSIGNAL */ + +/* Define to 1 if `f_bavail' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_BAVAIL */ + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FSTYPENAME */ + +/* Define to 1 if `f_basetype' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_BASETYPE */ + +/* Define to 1 if `f_fstypename' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_FSTYPENAME */ + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */ + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLOCKS */ + +/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_CTIMENSEC */ + +/* Define to 1 if `st_ctim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC */ + +/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMENSEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */ + +/* Define to 1 if `tm_gmtoff' is a a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM___TM_GMTOFF */ + +/* Define to 1 if you have the `symlink' function. */ +/* #undef HAVE_SYMLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MNTCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MNTTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the header file. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_SYS_PARAM_H 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_SYS_PARAM_H */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RESOURCE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATVFS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIMES_H */ + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_SYS_TIME_H 1 +#else /* _MSC_VER */ +/* #undef HAVE_SYS_TIME_H */ +#endif /* _MSC_VER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFSTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VMOUNT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_WAIT_H */ + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_UNISTD_H 1 +#endif + +/* Define to 1 if you have the `unsetenv' function. */ +/* #undef HAVE_UNSETENV */ + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 if you have the header file. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_VALUES_H 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_VALUES_H */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the `vasprintf' function. */ +#define HAVE_VASPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#ifndef _MSC_VER +#define HAVE_VSNPRINTF 1 +#ifdef __DMC__ +#define vsnprintf _vsnprintf +#endif +#else /* _MSC_VER */ +#if (_MSC_VER >= 1500) +#define HAVE_VSNPRINTF 1 +#endif /* VS 2008+ has vsnprintf */ +/* #undef HAVE_VSNPRINTF */ +#endif /* _MSC_VER */ + +/* Have Win32 atomic intrinsics */ +#define HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS 1 + +/* Have a working bcopy */ +/* #undef HAVE_WORKING_BCOPY */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#ifdef _MSC_VER +#define NO_MINUS_C_MINUS_O 1 +#endif + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "cogl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "cogl 1.18.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "cogl" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.18.2" + +/* Maximum POSIX RT priority */ +/* #undef POSIX_MAX_PRIORITY */ + +/* Minimum POSIX RT priority */ +/* #undef POSIX_MIN_PRIORITY */ + +/* The POSIX RT yield function */ +/* #undef POSIX_YIELD_FUNC */ + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long long', as computed by sizeof. */ +#ifndef _MSC_VER +#define SIZEOF_LONG_LONG 8 +#else /* _MSC_VER */ +#define SIZEOF_LONG_LONG 0 +#endif /* _MSC_VER */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `void *', as computed by sizeof. */ +#ifdef _MSC_VER +#if (defined(_M_X64) || defined(_M_AMD64)) +#define SIZEOF_VOID_P 8 +#elif (defined(_M_IX86)) +#define SIZEOF_VOID_P 4 +#endif +#else +#define SIZEOF_VOID_P 4 +#endif + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Use GdkPixbuf for loading image data */ +#define USE_GDKPIXBUF 1 + +/* Use internal image decoding for loading image data */ +/*#undef USE_INTERNAL*/ + +/* Use Core Graphics (Quartz) for loading image data */ +/*#undef USE_QUARTZ*/ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + + +#include "config-custom.h" diff --git a/config.h.win32.in b/config.h.win32.in new file mode 100644 index 0000000..9915845 --- /dev/null +++ b/config.h.win32.in @@ -0,0 +1,638 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* define if asm blocks can use numeric local labels */ +/* #undef ASM_NUMERIC_LABELS */ + +/* Can use Cogl 2.0 API internally */ +#define COGL_ENABLE_EXPERIMENTAL_2_0_API 1 + +/* Can use experimental API internally */ +#define COGL_ENABLE_EXPERIMENTAL_API 1 + +/* The major version for libgbm */ +/* #undef COGL_GBM_MAJOR */ + +/* The micro version for libgbm */ +/* #undef COGL_GBM_MICRO */ + +/* The minor version for libgbm */ +/* #undef COGL_GBM_MINOR */ + +/* Cogl supports OpenGL using the WGL API */ +#define COGL_HAS_WGL_SUPPORT 1 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#define ENABLE_NLS 1 + +/* The prefix for our gettext translation domains. */ +#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@" + +/* Define to the GLIB binary age */ +/* #undef GLIB_BINARY_AGE */ + +/* Byte contents of gmutex */ +/* #undef GLIB_BYTE_CONTENTS_GMUTEX */ + +/* Define to the GLIB interface age */ +/* #undef GLIB_INTERFACE_AGE */ + +/* The size of gmutex, as computed by sizeof. */ +/* #undef GLIB_SIZEOF_GMUTEX */ + +/* The size of system_thread, as computed by sizeof. */ +/* #undef GLIB_SIZEOF_SYSTEM_THREAD */ + +/* alpha atomic implementation */ +/* #undef G_ATOMIC_ALPHA */ + +/* arm atomic implementation */ +/* #undef G_ATOMIC_ARM */ + +/* cris atomic implementation */ +/* #undef G_ATOMIC_CRIS */ + +/* crisv32 atomic implementation */ +/* #undef G_ATOMIC_CRISV32 */ + +/* i486 atomic implementation */ +/* #undef G_ATOMIC_I486 */ + +/* ia64 atomic implementation */ +/* #undef G_ATOMIC_IA64 */ + +/* powerpc atomic implementation */ +/* #undef G_ATOMIC_POWERPC */ + +/* s390 atomic implementation */ +/* #undef G_ATOMIC_S390 */ + +/* sparcv9 atomic implementation */ +/* #undef G_ATOMIC_SPARCV9 */ + +/* x86_64 atomic implementation */ +/* #undef G_ATOMIC_X86_64 */ + +/* Have inline keyword */ +/* #undef G_HAVE_INLINE */ + +/* Have __inline keyword */ +/* #undef G_HAVE___INLINE */ + +/* Have __inline__ keyword */ +/* #undef G_HAVE___INLINE__ */ + +/* Source file containing theread implementation */ +/* #undef G_THREAD_SOURCE */ + +/* A 'va_copy' style function */ +/* #undef G_VA_COPY */ + +/* 'va_lists' cannot be copies as values */ +/* #undef G_VA_COPY_AS_ARRAY */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the `atexit' function. */ +/* #undef HAVE_ATEXIT */ + +/* Whether we have cairo or not */ +#define HAVE_CAIRO 1 + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_CE4100_LIBGDL_H*/ + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/*#undef HAVE_CFLOCALECOPYCURRENT*/ + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/*#undef HAVE_CFPREFERENCESCOPYAPPVALUE*/ + +/* Define to 1 if you have the `chown' function. */ +/* #undef HAVE_CHOWN */ + +/* Have GL for rendering */ +#define HAVE_COGL_GL 1 + +/* Have GLES 1.1 for rendering */ +/*#undef HAVE_COGL_GLES*/ + +/* Have GLES 2.0 for rendering */ +/*#undef HAVE_COGL_GLES2*/ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#define HAVE_DCGETTEXT 1 + +/* Defined if the GL library shouldn't be dlopened */ +#define HAVE_DIRECTLY_LINKED_GL_LIBRARY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_DLFCN_H*/ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_EGL_EGLEXT_H*/ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_EGL_EGL_H*/ + +/* Define to 1 if you have the `endmntent' function. */ +/* #undef HAVE_ENDMNTENT */ + +/* Define to 1 if you have the `fchmod' function. */ +/* #undef HAVE_FCHMOD */ + +/* Define to 1 if you have the `fchown' function. */ +/* #undef HAVE_FCHOWN */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdwalk' function. */ +/* #undef HAVE_FDWALK */ + +/* Define to 1 if you have the `ffs' function. */ +/*#undef HAVE_FFS*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FSTAB_H */ + +/* we have the futex(2) system call */ +/* #undef HAVE_FUTEX */ + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getc_unlocked' function. */ +/* #undef HAVE_GETC_UNLOCKED */ + +/* Define to 1 if you have the `getfsstat' function. */ +/* #undef HAVE_GETFSSTAT */ + +/* Define to 1 if you have the `getgrgid' function. */ +/* #undef HAVE_GETGRGID */ + +/* Define to 1 if you have the `getmntent_r' function. */ +/* #undef HAVE_GETMNTENT_R */ + +/* Define to 1 if you have the `getpwuid' function. */ +/* #undef HAVE_GETPWUID */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define to 1 if you have the `getvfsstat' function. */ +/* #undef HAVE_GETVFSSTAT */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_GLES_EGL_H*/ + +/* Define to 1 if you have the `gmtime_r' function. */ +/* #undef HAVE_GMTIME_R */ + +/* define to use system printf */ +/* #undef HAVE_GOOD_PRINTF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GRP_H */ + +/* Define to 1 if you have the `hasmntopt' function. */ +/* #undef HAVE_HASMNTOPT */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* define to support printing 64-bit integers with format I64 */ +#define HAVE_INT64_AND_I64 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_INTTYPES_H 1 +#endif + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +/* #undef HAVE_LCHOWN */ + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_LIBGDL_H*/ + +/* Define to 1 if you have the `GL' library (-lGL). */ +#define HAVE_LIBGL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +/* #undef HAVE_LINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MAGIC_H */ + +/* Define to 1 if you have the `localtime_r' function. */ +/* #undef HAVE_LOCALTIME_R */ + +/* define if system printf can print long long */ +#define HAVE_LONG_LONG_FORMAT 1 + +/* Define to 1 if you have the `lstat' function. */ +/* #undef HAVE_LSTAT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memmem' function. */ +/* #undef HAVE_MEMMEM */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MNTENT_H */ + +/* Have non-POSIX function getgrgid_r */ +/* #undef HAVE_NONPOSIX_GETGRGID_R */ + +/* Have non-POSIX function getpwuid_r */ +/* #undef HAVE_NONPOSIX_GETPWUID_R */ + +/* Define to 1 if you have the `on_exit' function. */ +/* #undef HAVE_ON_EXIT */ + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Have POSIX function getgrgid_r */ +/* #undef HAVE_POSIX_GETGRGID_R */ + +/* Have POSIX function getpwuid_r */ +/* #undef HAVE_POSIX_GETPWUID_R */ + +/* Have function pthread_attr_setstacksize */ +/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have the `readlink' function. */ +/* #undef HAVE_READLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SCHED_H */ + +/* Define to 1 if you have the `setenv' function. */ +/* #undef HAVE_SETENV */ + +/* Define to 1 if you have the `setmntent' function. */ +/* #undef HAVE_SETMNTENT */ + +/* Define to 1 if you have the `splice' function. */ +/* #undef HAVE_SPLICE */ + +/* Whether _Static_assert can be used or not */ +/* #undef HAVE_STATIC_ASSERT */ + +/* Define to 1 if you have the header file. */ +#if ((_MSC_VER >= 1600) || !defined(_MSC_VER)) +#define HAVE_STDINT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `stpcpy' function. */ +/* #undef HAVE_STPCPY */ + +/* Define to 1 if you have the `strcasecmp' function. */ +#if defined(_MSC_VER) +#define strcasecmp _stricmp +#endif /* _MSC_VER uses _stricmp, which is identical to strcasecmp */ + +#if !defined(__DMC__) +#define HAVE_STRCASECMP 1 +#endif /* _MSC_VER or __gcc__ */ + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_STRINGS_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_STRNCASECMP 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_STRNCASECMP */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the `strsignal' function. */ +/* #undef HAVE_STRSIGNAL */ + +/* Define to 1 if `f_bavail' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_BAVAIL */ + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FSTYPENAME */ + +/* Define to 1 if `f_basetype' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_BASETYPE */ + +/* Define to 1 if `f_fstypename' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_FSTYPENAME */ + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */ + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLOCKS */ + +/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_CTIMENSEC */ + +/* Define to 1 if `st_ctim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC */ + +/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMENSEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */ + +/* Define to 1 if `tm_gmtoff' is a a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM___TM_GMTOFF */ + +/* Define to 1 if you have the `symlink' function. */ +/* #undef HAVE_SYMLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MNTCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MNTTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the header file. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_SYS_PARAM_H 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_SYS_PARAM_H */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RESOURCE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATVFS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIMES_H */ + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_SYS_TIME_H 1 +#else /* _MSC_VER */ +/* #undef HAVE_SYS_TIME_H */ +#endif /* _MSC_VER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFSTAB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VMOUNT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_WAIT_H */ + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_UNISTD_H 1 +#endif + +/* Define to 1 if you have the `unsetenv' function. */ +/* #undef HAVE_UNSETENV */ + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 if you have the header file. */ +#if !defined(_MSC_VER) && !defined(__DMC__) +#define HAVE_VALUES_H 1 +#else /* _MSC_VER or __DMC__ */ +/* #undef HAVE_VALUES_H */ +#endif /* _MSC_VER or __DMC__ */ + +/* Define to 1 if you have the `vasprintf' function. */ +#define HAVE_VASPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#ifndef _MSC_VER +#define HAVE_VSNPRINTF 1 +#ifdef __DMC__ +#define vsnprintf _vsnprintf +#endif +#else /* _MSC_VER */ +#if (_MSC_VER >= 1500) +#define HAVE_VSNPRINTF 1 +#endif /* VS 2008+ has vsnprintf */ +/* #undef HAVE_VSNPRINTF */ +#endif /* _MSC_VER */ + +/* Have Win32 atomic intrinsics */ +#define HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS 1 + +/* Have a working bcopy */ +/* #undef HAVE_WORKING_BCOPY */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#ifdef _MSC_VER +#define NO_MINUS_C_MINUS_O 1 +#endif + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "cogl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "cogl @COGL_1_VERSION@" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "cogl" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@COGL_1_VERSION@" + +/* Maximum POSIX RT priority */ +/* #undef POSIX_MAX_PRIORITY */ + +/* Minimum POSIX RT priority */ +/* #undef POSIX_MIN_PRIORITY */ + +/* The POSIX RT yield function */ +/* #undef POSIX_YIELD_FUNC */ + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `long long', as computed by sizeof. */ +#ifndef _MSC_VER +#define SIZEOF_LONG_LONG 8 +#else /* _MSC_VER */ +#define SIZEOF_LONG_LONG 0 +#endif /* _MSC_VER */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `void *', as computed by sizeof. */ +#ifdef _MSC_VER +#if (defined(_M_X64) || defined(_M_AMD64)) +#define SIZEOF_VOID_P 8 +#elif (defined(_M_IX86)) +#define SIZEOF_VOID_P 4 +#endif +#else +#define SIZEOF_VOID_P 4 +#endif + +/* The size of `__int64', as computed by sizeof. */ +#define SIZEOF___INT64 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Use GdkPixbuf for loading image data */ +#define USE_GDKPIXBUF 1 + +/* Use internal image decoding for loading image data */ +/*#undef USE_INTERNAL*/ + +/* Use Core Graphics (Quartz) for loading image data */ +/*#undef USE_QUARTZ*/ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + + +#include "config-custom.h" diff --git a/configure b/configure new file mode 100755 index 0000000..c1f749a --- /dev/null +++ b/configure @@ -0,0 +1,31884 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for cogl 1.18.2. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='cogl' +PACKAGE_TARNAME='cogl' +PACKAGE_VERSION='1.18.2' +PACKAGE_STRING='cogl 1.18.2' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="cogl/cogl.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +gt_needs= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +MAINTAINER_CFLAGS +COGL_EXTRA_LDFLAGS +COGL_EXTRA_CFLAGS +COGL_GL_HEADER_INCLUDES +COGL_DEFINES +XMKMF +HAVE_INTROSPECTION_FALSE +HAVE_INTROSPECTION_TRUE +INTROSPECTION_MAKEFILE +INTROSPECTION_LIBS +INTROSPECTION_CFLAGS +INTROSPECTION_TYPELIBDIR +INTROSPECTION_GIRDIR +INTROSPECTION_GENERATE +INTROSPECTION_COMPILER +INTROSPECTION_SCANNER +BUILD_COGL_GST_FALSE +BUILD_COGL_GST_TRUE +COGL_GST_DEP_LIBS +COGL_GST_DEP_CFLAGS +COGL_GST_PKG_REQUIRES +BUILD_COGL_PATH_FALSE +BUILD_COGL_PATH_TRUE +BUILD_COGL_PANGO_FALSE +BUILD_COGL_PANGO_TRUE +COGL_PANGO_DEP_LIBS +COGL_PANGO_DEP_CFLAGS +COGL_PANGO_PKG_REQUIRES +COGL_DEP_GL_LIBS +COGL_DEP_GL_CFLAGS +COGL_DEP_LIBS +COGL_DEP_CFLAGS +COGL_PKG_REQUIRES +ALL_LINGUAS +GETTEXT_PACKAGE +POSUB +LTLIBINTL +LIBINTL +INTLLIBS +LTLIBICONV +LIBICONV +INTL_MACOSX_LIBS +XGETTEXT_EXTRA_OPTIONS +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +GETTEXT_MACRO_VERSION +USE_NLS +GDKPIXBUF_PREFIX +GLIB_PREFIX +BUILD_GTK_DOC_FALSE +BUILD_GTK_DOC_TRUE +GTK_DOC_USE_REBASE_FALSE +GTK_DOC_USE_REBASE_TRUE +GTK_DOC_USE_LIBTOOL_FALSE +GTK_DOC_USE_LIBTOOL_TRUE +GTK_DOC_BUILD_PDF_FALSE +GTK_DOC_BUILD_PDF_TRUE +GTK_DOC_BUILD_HTML_FALSE +GTK_DOC_BUILD_HTML_TRUE +ENABLE_GTK_DOC_FALSE +ENABLE_GTK_DOC_TRUE +GTKDOC_DEPS_LIBS +GTKDOC_DEPS_CFLAGS +HTML_DIR +GTKDOC_MKPDF +GTKDOC_REBASE +GTKDOC_CHECK +SUPPORT_XLIB_FALSE +SUPPORT_XLIB_TRUE +SUPPORT_X11_FALSE +SUPPORT_X11_TRUE +X11_TESTS_FALSE +X11_TESTS_TRUE +DUMMY_LIBS +DUMMY_CFLAGS +SUPPORT_EGL_FALSE +SUPPORT_EGL_TRUE +SUPPORT_EGL_PLATFORM_XLIB_FALSE +SUPPORT_EGL_PLATFORM_XLIB_TRUE +SUPPORT_EGL_PLATFORM_ANDROID_FALSE +SUPPORT_EGL_PLATFORM_ANDROID_TRUE +SUPPORT_WAYLAND_EGL_SERVER_FALSE +SUPPORT_WAYLAND_EGL_SERVER_TRUE +WAYLAND_SERVER_LIBS +WAYLAND_SERVER_CFLAGS +SUPPORT_EGL_PLATFORM_KMS_FALSE +SUPPORT_EGL_PLATFORM_KMS_TRUE +SUPPORT_EGL_PLATFORM_WAYLAND_FALSE +SUPPORT_EGL_PLATFORM_WAYLAND_TRUE +WAYLAND_CLIENT_LIBS +WAYLAND_CLIENT_CFLAGS +SUPPORT_EGL_PLATFORM_GDL_FALSE +SUPPORT_EGL_PLATFORM_GDL_TRUE +SUPPORT_EGL_PLATFORM_POWERVR_NULL_FALSE +SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE +SUPPORT_SDL2_FALSE +SUPPORT_SDL2_TRUE +SDL2_LIBS +SDL2_CFLAGS +SUPPORT_SDL_FALSE +SUPPORT_SDL_TRUE +SDL_LIBS +SDL_CFLAGS +SUPPORT_WGL_FALSE +SUPPORT_WGL_TRUE +SUPPORT_GLX_FALSE +SUPPORT_GLX_TRUE +BUILD_COGL_GLES2_FALSE +BUILD_COGL_GLES2_TRUE +COGL_DEFAULT_DRIVER +HAVE_GLES2 +COGL_GLES2_LIBNAME +HAVE_GLES1 +COGL_GLES1_LIBNAME +HAVE_GL +COGL_GL_LIBNAME +HAVE_COGL_DEFAULT_DRIVER_FALSE +HAVE_COGL_DEFAULT_DRIVER_TRUE +COGL_DRIVER_GLES_SUPPORTED_FALSE +COGL_DRIVER_GLES_SUPPORTED_TRUE +COGL_DRIVER_GL_SUPPORTED_FALSE +COGL_DRIVER_GL_SUPPORTED_TRUE +COGL_EGL_INCLUDES +INSTALL_EXAMPLES_FALSE +INSTALL_EXAMPLES_TRUE +GSTREAMER_PREFIX +plugindir +G_THREAD_LIBS_EXTRA +G_THREAD_LIBS_FOR_GTHREAD +G_THREAD_LIBS +G_THREAD_CFLAGS +GTHREAD_COMPILE_IMPL_DEFINES +GLIB_DEBUG_FLAGS +G_MODULE_NEED_USCORE +G_MODULE_BROKEN_RTLD_GLOBAL +G_MODULE_HAVE_DLERROR +G_MODULE_LDFLAGS +G_MODULE_PLUGIN_LIBS +G_MODULE_LIBS_EXTRA +G_MODULE_LIBS +G_MODULE_IMPL +G_MODULE_SUPPORTED +LIB_EXE_MACHINE_FLAG +GLIB_BINARY_AGE +GLIB_INTERFACE_AGE +GLIB_VERSION +GLIB_MICRO_VERSION +GLIB_MINOR_VERSION +GLIB_MAJOR_VERSION +USE_GLIB_FALSE +USE_GLIB_TRUE +GLIB_COMPILE_RESOURCES +GLIB_MKENUMS +GOBJECT_QUERY +GLIB_GENMARSHAL +GLIB_LIBS +GLIB_CFLAGS +PROFILE_FALSE +PROFILE_TRUE +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +UNIT_TESTS_FALSE +UNIT_TESTS_TRUE +COGL_DEBUG_CFLAGS +USING_EMSCRIPTEN_FALSE +USING_EMSCRIPTEN_TRUE +ENABLE_INSTALLED_TESTS_FALSE +ENABLE_INSTALLED_TESTS_TRUE +OS_QUARTZ_FALSE +OS_QUARTZ_TRUE +OS_WIN32_FALSE +OS_WIN32_TRUE +LIBM +CXXCPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +COGL_RELEASE_STATUS +COGL_LT_RELEASE +COGL_LT_AGE +COGL_LT_REVISION +COGL_LT_CURRENT +COGL_1_VERSION +COGL_1_MICRO_VERSION +COGL_1_MINOR_VERSION +COGL_API_VERSION_AM +COGL_API_VERSION +COGL_VERSION +COGL_MICRO_VERSION +COGL_MINOR_VERSION +COGL_MAJOR_VERSION +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +WAYLAND_SERVER_REQ_VERSION +WAYLAND_REQ_VERSION +UPROF_REQ_VERSION +GI_REQ_VERSION +GTK_DOC_REQ_VERSION +XFIXES_REQ_VERSION +XCOMPOSITE_REQ_VERSION +PANGOCAIRO_REQ_VERSION +CAIRO_REQ_VERSION +GDK_PIXBUF_REQ_VERSION +GLIB_REQ_VERSION +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_silent_rules +enable_static +enable_shared +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_installed_tests +enable_emscripten +enable_standalone +enable_debug +enable_unit_tests +enable_cairo +enable_profile +enable_maintainer_flags +enable_deprecated +enable_glibtest +enable_glib +enable_cogl_pango +enable_cogl_gst +enable_cogl_path +enable_gdk_pixbuf +enable_quartz_image +enable_examples_install +enable_gles1 +enable_gles2 +enable_gl +with_gl_libname +with_gles1_libname +with_gles2_libname +with_default_driver +enable_cogl_gles2 +enable_glx +enable_wgl +enable_sdl +enable_sdl2 +enable_null_egl_platform +enable_gdl_egl_platform +enable_wayland_egl_platform +enable_kms_egl_platform +enable_wayland_egl_server +enable_android_egl_platform +enable_xlib_egl_platform +with_html_dir +enable_gtk_doc +enable_gtk_doc_html +enable_gtk_doc_pdf +enable_nls +enable_rpath +with_libiconv_prefix +with_libintl_prefix +enable_introspection +with_x +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +SDL_CFLAGS +SDL_LIBS +SDL2_CFLAGS +SDL2_LIBS +WAYLAND_CLIENT_CFLAGS +WAYLAND_CLIENT_LIBS +WAYLAND_SERVER_CFLAGS +WAYLAND_SERVER_LIBS +DUMMY_CFLAGS +DUMMY_LIBS +GTKDOC_DEPS_CFLAGS +GTKDOC_DEPS_LIBS +COGL_DEP_CFLAGS +COGL_DEP_LIBS +COGL_DEP_GL_CFLAGS +COGL_DEP_GL_LIBS +COGL_PANGO_DEP_CFLAGS +COGL_PANGO_DEP_LIBS +COGL_GST_DEP_CFLAGS +COGL_GST_DEP_LIBS +XMKMF' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures cogl 1.18.2 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/cogl] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cogl 1.18.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-static[=PKGS] build static libraries [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-installed-tests + Install test programs (default: no) + --enable-emscripten=[no/yes] + Support building for emscripten + --enable-standalone=[no/yes] + Build Cogl without any external depedency + [default=no] + --enable-debug=[no/yes] Control Cogl debugging level [default=no] + --enable-unit-tests=[no/yes] + Build Cogl unit tests [default=yes] + --enable-cairo=[no/yes] Control Cairo usage in Cogl debugging code + [default=auto] + --enable-profile=[no/yes] + Turn on uprof profiling support. yes; All UProf + profiling probe points are compiled in and may be + runtime enabled. no; No profiling support will built + into cogl. [default=no] + --enable-maintainer-flags=[no/yes/error] + Use strict compiler flags [default=no] + --enable-deprecated=[no/yes] + Whether deprecated symbols should be disabled when + compiling Cogl [default=yes] + --disable-glibtest do not try to compile and run a test GLIB program + --enable-glib=[no/yes] Enable glib support [default=yes] + --enable-cogl-pango=[no/yes] + Enable pango support [default=yes] + --enable-cogl-gst=[no/yes] + Enable gstreamer support [default=no] + --enable-cogl-path=[no/yes] + Enable 2D path support [default=yes] + --enable-gdk-pixbuf=[no/yes] + Enable image loading via gdk-pixbuf [default=yes] + --enable-quartz-image=[no/yes] + Enable image loading via quartz [default=no] + --enable-examples-install=[no/yes] + Enable installation of examples [default=no] + --enable-gles1=[no/yes] Enable support for OpenGL-ES 1.1 [default=no] + --enable-gles2=[no/yes] Enable support for OpenGL-ES 2.0 [default=no] + --enable-gl=[no/yes] Enable support for OpenGL [default=yes] + --enable-cogl-gles2=[no/yes] + Enable libcogl-gles2 frontend api for OpenGL-ES 2.0 + [default=auto] + --enable-glx=[no/yes] Enable support GLX [default=auto] + --enable-wgl=[no/yes] Enable support for WGL [default=auto] + --enable-sdl=[no/yes] Enable support SDL [default=no] + --enable-sdl2=[no/yes] Enable SDL2 support [default=no] + --enable-null-egl-platform=[no/yes] + Enable support for the NULL egl platform + [default=no] + --enable-gdl-egl-platform=[no/yes] + Enable support for the GDL egl platform [default=no] + --enable-wayland-egl-platform=[no/yes] + Enable support for the Wayland egl platform + [default=no] + --enable-kms-egl-platform=[no/yes] + Enable support for the KMS egl platform [default=no] + --enable-wayland-egl-server=[no/yes] + Enable server side wayland support [default=no] + --enable-android-egl-platform=[no/yes] + Enable support for the Android egl platform + [default=no] + --enable-xlib-egl-platform=[no/yes] + Enable support for the Xlib egl platform + [default=auto] + --enable-gtk-doc use gtk-doc to build documentation [[default=no]] + --enable-gtk-doc-html build documentation in html format [[default=yes]] + --enable-gtk-doc-pdf build documentation in pdf format [[default=no]] + --disable-nls do not use Native Language Support + --disable-rpath do not hardcode runtime library paths + --enable-introspection=[no/auto/yes] + Enable introspection for this build + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-gl-libname override the name of the GL library to dlopen + --with-gles1-libname override the name of the GLESv1 library to dlopen + --with-gles2-libname override the name of the GLESv2 library to dlopen + --with-default-driver specify a default cogl driver + --with-html-dir=PATH path to installed docs + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + --with-x use the X Window System + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + SDL_CFLAGS C compiler flags for SDL, overriding pkg-config + SDL_LIBS linker flags for SDL, overriding pkg-config + SDL2_CFLAGS C compiler flags for SDL2, overriding pkg-config + SDL2_LIBS linker flags for SDL2, overriding pkg-config + WAYLAND_CLIENT_CFLAGS + C compiler flags for WAYLAND_CLIENT, overriding pkg-config + WAYLAND_CLIENT_LIBS + linker flags for WAYLAND_CLIENT, overriding pkg-config + WAYLAND_SERVER_CFLAGS + C compiler flags for WAYLAND_SERVER, overriding pkg-config + WAYLAND_SERVER_LIBS + linker flags for WAYLAND_SERVER, overriding pkg-config + DUMMY_CFLAGS + C compiler flags for DUMMY, overriding pkg-config + DUMMY_LIBS linker flags for DUMMY, overriding pkg-config + GTKDOC_DEPS_CFLAGS + C compiler flags for GTKDOC_DEPS, overriding pkg-config + GTKDOC_DEPS_LIBS + linker flags for GTKDOC_DEPS, overriding pkg-config + COGL_DEP_CFLAGS + C compiler flags for COGL_DEP, overriding pkg-config + COGL_DEP_LIBS + linker flags for COGL_DEP, overriding pkg-config + COGL_DEP_GL_CFLAGS + C compiler flags for COGL_DEP_GL, overriding pkg-config + COGL_DEP_GL_LIBS + linker flags for COGL_DEP_GL, overriding pkg-config + COGL_PANGO_DEP_CFLAGS + C compiler flags for COGL_PANGO_DEP, overriding pkg-config + COGL_PANGO_DEP_LIBS + linker flags for COGL_PANGO_DEP, overriding pkg-config + COGL_GST_DEP_CFLAGS + C compiler flags for COGL_GST_DEP, overriding pkg-config + COGL_GST_DEP_LIBS + linker flags for COGL_GST_DEP, overriding pkg-config + XMKMF Path to xmkmf, Makefile generator for X Window System + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +cogl configure 1.18.2 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cogl $as_me 1.18.2, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +gt_needs="$gt_needs " +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_aux_dir= +for ac_dir in build "$srcdir"/build; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build \"$srcdir\"/build" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +ac_config_headers="$ac_config_headers config.h" + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + + + + + + + + + + + + + + + +GLIB_REQ_VERSION=2.32.0 + +GDK_PIXBUF_REQ_VERSION=2.0 + +CAIRO_REQ_VERSION=1.10 + +PANGOCAIRO_REQ_VERSION=1.20 + +XCOMPOSITE_REQ_VERSION=0.4 + +XFIXES_REQ_VERSION=3 + +GTK_DOC_REQ_VERSION=1.13 + +GI_REQ_VERSION=0.9.5 + +UPROF_REQ_VERSION=0.3 + +WAYLAND_REQ_VERSION=1.0.0 + +WAYLAND_SERVER_REQ_VERSION=1.1.90 + + +# Save this value here, since automake will set cflags later and we +# want to know if the user specified custom cflags or not. +cflags_set=${CFLAGS+set} + +am__api_version='1.14' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='cogl' + VERSION='1.18.2' + + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar plaintar pax cpio none' + +# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5 +$as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; } + if test $am_uid -le $am_max_uid; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + _am_tools=none + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5 +$as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; } + if test $am_gid -le $am_max_gid; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + _am_tools=none + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 +$as_echo_n "checking how to create a ustar tar archive... " >&6; } + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_ustar-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x ustar -w "$$tardir"' + am__tar_='pax -L -x ustar -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H ustar -L' + am__tar_='find "$tardir" -print | cpio -o -H ustar -L' + am__untar='cpio -i -H ustar -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_ustar}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 + (cat conftest.dir/file) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + if ${am_cv_prog_tar_ustar+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_prog_tar_ustar=$_am_tool +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 +$as_echo "$am_cv_prog_tar_ustar" >&6; } + + + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + + + +COGL_MAJOR_VERSION=2 + +COGL_MINOR_VERSION=0 + +COGL_MICRO_VERSION=0 + +COGL_VERSION=2.0.0 + +COGL_API_VERSION=2.0 + +COGL_API_VERSION_AM=$COGL_MAJOR_VERSION\_0 + + +COGL_1_MINOR_VERSION=18 + +COGL_1_MICRO_VERSION=2 + +COGL_1_VERSION=1.18.2 + + + +COGL_LT_CURRENT=22 + +COGL_LT_REVISION=0 + +COGL_LT_AGE=2 + +COGL_LT_RELEASE=2.0.0 + + + +COGL_RELEASE_STATUS=release + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 +$as_echo_n "checking for library containing strerror... " >&6; } +if ${ac_cv_search_strerror+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (); +int +main () +{ +return strerror (); + ; + return 0; +} +_ACEOF +for ac_lib in '' cposix; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_strerror=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_strerror+:} false; then : + break +fi +done +if ${ac_cv_search_strerror+:} false; then : + +else + ac_cv_search_strerror=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 +$as_echo "$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Static_assert" >&5 +$as_echo_n "checking for _Static_assert... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +_Static_assert (1, ""); +int +main () +{ +(void) 0 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_STATIC_ASSERT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf + + + + + +# Set options +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=no +fi + + + + + + + + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec_CXX='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + gnu*) + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } + test "$ld_shlibs_CXX" = no && can_build_shared=no + + GCC_CXX="$GXX" + LD_CXX="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink || + test "$inherit_rpath_CXX" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + +: ${CONFIG_LT=./config.lt} +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_LT" >&5 +$as_echo "$as_me: creating $CONFIG_LT" >&6;} +as_write_fail=0 +cat >"$CONFIG_LT" <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>"$CONFIG_LT" <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## --------------------------------- ## +## Main body of "$CONFIG_LT" script. ## +## --------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x "$CONFIG_LT" + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $0 [OPTIONS] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +cogl config.lt 1.18.2 +configured by $0, generated by GNU Autoconf 2.69. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $# != 0 +do + case $1 in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) as_fn_error $? "unrecognized option: $1 +Try \`$0 --help' for more information." "$LINENO" 5 ;; + + *) as_fn_error $? "unrecognized argument: $1 +Try \`$0 --help' for more information." "$LINENO" 5 ;; + esac + shift +done + +if $lt_cl_silent; then + exec 6>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + + +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5 +$as_echo "$as_me: creating $ofile" >&6;} + + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + +as_fn_exit 0 +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec 5>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec 5>>config.log +$lt_cl_success || as_fn_exit 1 + + +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5 +$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; } +if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmw $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char _mwvalidcheckl (); +int +main () +{ +return _mwvalidcheckl (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_mw__mwvalidcheckl=yes +else + ac_cv_lib_mw__mwvalidcheckl=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 +$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; } +if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then : + LIBM="-lmw" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 +$as_echo_n "checking for cos in -lm... " >&6; } +if ${ac_cv_lib_m_cos+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cos (); +int +main () +{ +return cos (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_cos=yes +else + ac_cv_lib_m_cos=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 +$as_echo "$ac_cv_lib_m_cos" >&6; } +if test "x$ac_cv_lib_m_cos" = xyes; then : + LIBM="$LIBM -lm" +fi + + ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 +$as_echo_n "checking for cos in -lm... " >&6; } +if ${ac_cv_lib_m_cos+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char cos (); +int +main () +{ +return cos (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_cos=yes +else + ac_cv_lib_m_cos=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 +$as_echo "$ac_cv_lib_m_cos" >&6; } +if test "x$ac_cv_lib_m_cos" = xyes; then : + LIBM="-lm" +fi + + ;; +esac + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if building for some Win32 platform" >&5 +$as_echo_n "checking if building for some Win32 platform... " >&6; } +case $host in #( + *-*-mingw*|*-*-cygwin*) : + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -no-undefined" + platform_win32=yes + ;; #( + *) : + platform_win32=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 +$as_echo "$platform_win32" >&6; } + if test "$platform_win32" = "yes"; then + OS_WIN32_TRUE= + OS_WIN32_FALSE='#' +else + OS_WIN32_TRUE='#' + OS_WIN32_FALSE= +fi + + +ac_fn_c_check_header_mongrel "$LINENO" "OpenGL/gl.h" "ac_cv_header_OpenGL_gl_h" "$ac_includes_default" +if test "x$ac_cv_header_OpenGL_gl_h" = xyes; then : + platform_quartz=yes +else + platform_quartz=no +fi + + + if test "$platform_quartz" = "yes"; then + OS_QUARTZ_TRUE= + OS_QUARTZ_FALSE='#' +else + OS_QUARTZ_TRUE='#' + OS_QUARTZ_FALSE= +fi + + + + + +# Check whether --enable-installed_tests was given. +if test "${enable_installed_tests+set}" = set; then : + enableval=$enable_installed_tests; +else + enable_installed_tests=no +fi + + if test x$enable_installed_tests = xyes; then + ENABLE_INSTALLED_TESTS_TRUE= + ENABLE_INSTALLED_TESTS_FALSE='#' +else + ENABLE_INSTALLED_TESTS_TRUE='#' + ENABLE_INSTALLED_TESTS_FALSE= +fi + + + + +# Check whether --enable-emscripten was given. +if test "${enable_emscripten+set}" = set; then : + enableval=$enable_emscripten; +else + enable_emscripten=no + +fi + +if test "x$enable_emscripten" = "xyes"; then : + + enable_standalone=yes + enable_sdl=yes + enable_gles2=yes + enable_gl=no + +$as_echo "#define USING_EMSCRIPTEN 1" >>confdefs.h + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EMSCRIPTEN_SUPPORT" + + +fi + if test "$enable_emscripten" = "yes"; then + USING_EMSCRIPTEN_TRUE= + USING_EMSCRIPTEN_FALSE='#' +else + USING_EMSCRIPTEN_TRUE='#' + USING_EMSCRIPTEN_FALSE= +fi + + + + +# Check whether --enable-standalone was given. +if test "${enable_standalone+set}" = set; then : + enableval=$enable_standalone; +else + enable_standalone=no + +fi + +if test "x$enable_standalone" = "xyes"; then : + + enable_cairo=no + enable_glib=no + enable_cogl_pango=no + enable_nls=no + enable_gdk_pixbuf=no + + +fi + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +else + enable_debug=no + +fi + +case $enable_debug in #( + yes) : + + test "$cflags_set" = set || CFLAGS="$CFLAGS -g -O0" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_ENABLE_DEBUG" + ;; #( + no) : + + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" + ;; #( + *) : + as_fn_error $? "Unknown argument for --enable-debug" "$LINENO" 5 + ;; +esac + + + +# Check whether --enable-unit-tests was given. +if test "${enable_unit_tests+set}" = set; then : + enableval=$enable_unit_tests; +else + enable_unit_tests=yes + +fi + +if test "x$enable_unit_tests" = "xyes"; then : + + +$as_echo "#define ENABLE_UNIT_TESTS 1" >>confdefs.h + + + +fi + if test "x$enable_unit_tests" = "xyes"; then + UNIT_TESTS_TRUE= + UNIT_TESTS_FALSE='#' +else + UNIT_TESTS_TRUE='#' + UNIT_TESTS_FALSE= +fi + + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"CAIRO\""; } >&5 + ($PKG_CONFIG --exists --print-errors "CAIRO") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + cairo >= 1.10 +else + have_cairo=yes +fi +# Check whether --enable-cairo was given. +if test "${enable_cairo+set}" = set; then : + enableval=$enable_cairo; +else + + if test "x$enable_debug" = "xyes"; then : + enable_cairo=$have_cairo +else + enable_cairo=no +fi + + +fi + +if test "x$enable_cairo" = "xyes" && test "x$enable_debug" = "xyes"; then : + + if test "x$have_cairo" != "xyes"; then : + as_fn_error $? "Could not find Cairo" "$LINENO" 5 +fi + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES cairo >= 1.10" + +$as_echo "#define HAVE_CAIRO 1" >>confdefs.h + + +fi + + +# Check whether --enable-profile was given. +if test "${enable_profile+set}" = set; then : + enableval=$enable_profile; +else + enable_profile=no +fi + +if test "x$enable_profile" = "xyes"; then : + + if test "x$GCC" = "xyes"; then : + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES uprof-0.3" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_ENABLE_PROFILE" + if test "x$enable_debug" = "xyes"; then : + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DUPROF_DEBUG" +fi + +else + + as_fn_error $? "--enable-profile is currently only supported if using GCC" "$LINENO" 5 + +fi + +fi + if test "x$enable_profile" != "xno"; then + PROFILE_TRUE= + PROFILE_FALSE='#' +else + PROFILE_TRUE='#' + PROFILE_FALSE= +fi + + + + +# use strict compiler flags only when building from git; the rules for +# distcheck will take care of turning this on when making a release + +# Check whether --enable-maintainer-flags was given. +if test "${enable_maintainer_flags+set}" = set; then : + enableval=$enable_maintainer_flags; +else + enable_maintainer_flags=no + +fi + + +MAINTAINER_COMPILER_FLAGS="-Wall -Wcast-align -Wuninitialized + -Wno-strict-aliasing -Wempty-body -Wformat + -Wformat-security -Winit-self -Wundef + -Wdeclaration-after-statement -Wvla + -Wpointer-arith -Wmissing-declarations" + +case $enable_maintainer_flags in #( + yes) : + + + list=$MAINTAINER_COMPILER_FLAGS + flags_supported="" + flags_unsupported="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported compiler flags" >&5 +$as_echo_n "checking for supported compiler flags... " >&6; } + for each in $list + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $each" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + flags_supported="$flags_supported $each" + else + flags_unsupported="$flags_unsupported $each" + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flags_supported" >&5 +$as_echo "$flags_supported" >&6; } + if test "X$flags_unsupported" != X ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unsupported compiler flags: $flags_unsupported" >&5 +$as_echo "$as_me: WARNING: unsupported compiler flags: $flags_unsupported" >&2;} + fi + MAINTAINER_CFLAGS="$MAINTAINER_CFLAGS $flags_supported" + + ;; #( + no) : + + ;; #( + error) : + + MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror" + + list=$MAINTAINER_COMPILER_FLAGS + flags_supported="" + flags_unsupported="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported compiler flags" >&5 +$as_echo_n "checking for supported compiler flags... " >&6; } + for each in $list + do + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $each" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + flags_supported="$flags_supported $each" + else + flags_unsupported="$flags_unsupported $each" + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flags_supported" >&5 +$as_echo "$flags_supported" >&6; } + if test "X$flags_unsupported" != X ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unsupported compiler flags: $flags_unsupported" >&5 +$as_echo "$as_me: WARNING: unsupported compiler flags: $flags_unsupported" >&2;} + fi + MAINTAINER_CFLAGS="$MAINTAINER_CFLAGS $flags_supported" + + ;; #( + *) : + as_fn_error $? "Invalid option for --enable-maintainer-flags" "$LINENO" 5 + ;; #( + *) : + ;; +esac + +# strip leading spaces +COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${MAINTAINER_CFLAGS#* }" + + + +# disable deprecated options from Glib only when building from git; +# the rules for distcheck will take care of turning this on when +# making a release + + +# Check whether --enable-deprecated was given. +if test "${enable_deprecated+set}" = set; then : + enableval=$enable_deprecated; +else + enable_deprecated=yes +fi + + +case $enable_deprecated in #( + no) : + + DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES" + ;; #( + yes) : + + DEPRECATED_CFLAGS="" + ;; #( + *) : + as_fn_error $? "Unknown argument for --enable-deprecated" "$LINENO" 5 + ;; +esac + +# strip leading spaces +COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${DEPRECATED_CFLAGS#* }" + + +if test "x$enable_standalone" = "xno"; then : + + # Check whether --enable-glibtest was given. +if test "${enable_glibtest+set}" = set; then : + enableval=$enable_glibtest; +else + enable_glibtest=yes +fi + + + pkg_config_args=glib-2.0 + for module in . gobject gthread gmodule-no-export + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + gio*) + pkg_config_args="$pkg_config_args $module-2.0" + ;; + esac + done + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.16 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + + no_glib="" + + if test "x$PKG_CONFIG" = x ; then + no_glib=yes + PKG_CONFIG=no + fi + + min_glib_version=2.32.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 +$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" + rm -f conf.glibtest + if test "$cross_compiling" = yes; then : + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + unsigned int major, minor, micro; + + fclose (fopen ("conf.glibtest", "w")); + + if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + no_glib=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; } + have_glib=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed." +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + GLIB_COMPILE_RESOURCES="" + have_glib=no + fi + + + + + + + rm -f conf.glibtest + + # Check whether --enable-glib was given. +if test "${enable_glib+set}" = set; then : + enableval=$enable_glib; +else + enable_glib=yes + +fi + + + if test "x$have_glib" = "xno" && test "x$enable_glib" = "xyes"; then : + as_fn_error $? "gobject-2.0 is required" "$LINENO" 5 +fi + +else + enable_glib=no + +fi + + if test "x$enable_glib" = "xyes"; then + USE_GLIB_TRUE= + USE_GLIB_FALSE='#' +else + USE_GLIB_TRUE='#' + USE_GLIB_FALSE= +fi + + +if test "x$enable_glib" = "xyes"; then : + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GTYPE_SUPPORT" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0" + +else + + + + + + + + + + +GLIB_MAJOR_VERSION=2 +GLIB_MINOR_VERSION=30 +GLIB_MICRO_VERSION=2 +GLIB_INTERFACE_AGE=0 +GLIB_BINARY_AGE=3002 +GLIB_VERSION=2.30.2 + + + + + + + + + +$as_echo "#define GLIB_INTERFACE_AGE 0" >>confdefs.h + + +$as_echo "#define GLIB_BINARY_AGE 3002" >>confdefs.h + + +enable_included_printf=no + +$as_echo "#define HAVE_GOOD_PRINTF 1" >>confdefs.h + + +glib_win32_static_compilation=no + +want_threads=yes + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32" >&5 +$as_echo_n "checking for Win32... " >&6; } +LIB_EXE_MACHINE_FLAG=X86 +case "$host" in + *-*-mingw*) + glib_native_win32=yes + glib_pid_type='void *' + glib_cv_stack_grows=no + # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf + # don't seem to be quite good enough, at least not in mingw-runtime-3.14. + # (Sorry, I don't know exactly what is the problem, but it is related to + # floating point formatting and decimal point vs. comma.) + # The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't + # rigorous enough to notice, though. + # So preset the autoconf cache variables. + ac_cv_func_vsnprintf_c99=no + ac_cv_func_snprintf_c99=no + case "$host" in + x86_64-*-*) + LIB_EXE_MACHINE_FLAG=X64 + ;; + esac + ;; + *) + glib_native_win32=no + glib_pid_type=int + ;; +esac +case $host in + *-*-linux*) + glib_os_linux=yes + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_native_win32" >&5 +$as_echo "$glib_native_win32" >&6; } + + + +glib_have_carbon=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mac OS X Carbon support" >&5 +$as_echo_n "checking for Mac OS X Carbon support... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + glib_have_carbon=yes +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_have_carbon" >&5 +$as_echo "$glib_have_carbon" >&6; } + +for ac_header in limits.h float.h values.h alloca.h sys/poll.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_func in atexit on_exit memmove +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 +$as_echo_n "checking size of char... " >&6; } +if ${ac_cv_sizeof_char+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_char" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (char) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_char=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 +$as_echo "$ac_cv_sizeof_char" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if ${ac_cv_sizeof_short+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if ${ac_cv_sizeof_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +$as_echo_n "checking size of void *... " >&6; } +if ${ac_cv_sizeof_void_p+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_void_p" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (void *) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_void_p=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +$as_echo "$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 +$as_echo_n "checking size of long long... " >&6; } +if ${ac_cv_sizeof_long_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 +$as_echo "$ac_cv_sizeof_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5 +$as_echo_n "checking size of __int64... " >&6; } +if ${ac_cv_sizeof___int64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64" "$ac_includes_default"; then : + +else + if test "$ac_cv_type___int64" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__int64) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof___int64=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int64" >&5 +$as_echo "$ac_cv_sizeof___int64" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___INT64 $ac_cv_sizeof___int64 +_ACEOF + + + +if test x$ac_cv_sizeof_long = x8 || test x$ac_cv_sizeof_long_long = x8 || test x$ac_cv_sizeof___int64 = x8 ; then + : +else + as_fn_error $? " +*** GLib requires a 64 bit type. You might want to consider +*** using the GNU C compiler. +" "$LINENO" 5 +fi + +if test x$glib_native_win32 != xyes && test x$ac_cv_sizeof_long_long = x8; then + # long long is a 64 bit integer. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for format to printf and scanf a guint64" >&5 +$as_echo_n "checking for format to printf and scanf a guint64... " >&6; } + if ${glib_cv_long_long_format+:} false; then : + $as_echo_n "(cached) " >&6 +else + + for format in ll q I64; do + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int main() + { + long long b, a = -0x3AFAFAFAFAFAFAFALL; + char buffer[1000]; + sprintf (buffer, "%${format}u", a); + sscanf (buffer, "%${format}u", &b); + exit (b!=a); + } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_long_long_format=${format} + break +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + done +fi + + if test -n "$glib_cv_long_long_format"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: %${glib_cv_long_long_format}u" >&5 +$as_echo "%${glib_cv_long_long_format}u" >&6; } + +$as_echo "#define HAVE_LONG_LONG_FORMAT 1" >>confdefs.h + + if test x"$glib_cv_long_long_format" = xI64; then + +$as_echo "#define HAVE_INT64_AND_I64 1" >>confdefs.h + + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } + fi +elif test x$ac_cv_sizeof___int64 = x8; then + # __int64 is a 64 bit integer. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for format to printf and scanf a guint64" >&5 +$as_echo_n "checking for format to printf and scanf a guint64... " >&6; } + # We know this is MSVCRT.DLL, and what the formats are + glib_cv_long_long_format=I64 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: %${glib_cv_long_long_format}u" >&5 +$as_echo "%${glib_cv_long_long_format}u" >&6; } + +$as_echo "#define HAVE_LONG_LONG_FORMAT 1" >>confdefs.h + + +$as_echo "#define HAVE_INT64_AND_I64 1" >>confdefs.h + +fi + +# check additional type sizes +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if ${ac_cv_sizeof_size_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the appropriate definition for size_t" >&5 +$as_echo_n "checking for the appropriate definition for size_t... " >&6; } + +case $ac_cv_sizeof_size_t in + $ac_cv_sizeof_short) + glib_size_type=short + ;; + $ac_cv_sizeof_int) + glib_size_type=int + ;; + $ac_cv_sizeof_long) + glib_size_type=long + ;; + $ac_cv_sizeof_long_long) + glib_size_type='long long' + ;; + $ac_cv_sizeof__int64) + glib_size_type='__int64' + ;; + *) as_fn_error $? "No type matching size_t in size" "$LINENO" 5 + ;; +esac + +if test $ac_cv_sizeof_size_t = $ac_cv_sizeof_int && + test $ac_cv_sizeof_size_t = $ac_cv_sizeof_long ; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined(_AIX) && !defined(__GNUC__) +#pragma options langlvl=stdc89 +#endif +#include +int main () +{ + size_t s = 1; + unsigned int *size_int = &s; + return (int)*size_int; +} + +_ACEOF +rm -f conftest.$ac_objext +glib_ac_compile_save="$ac_compile" +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext' +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + { ac_try='(if test -s conftest.err; then false ; else true; fi)' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + glib_size_type=int +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined(_AIX) && !defined(__GNUC__) +#pragma options langlvl=stdc89 +#endif +#include +int main () +{ + size_t s = 1; + unsigned long *size_long = &s; + return (int)*size_long; +} + +_ACEOF +rm -f conftest.$ac_objext +glib_ac_compile_save="$ac_compile" +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext' +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + { ac_try='(if test -s conftest.err; then false ; else true; fi)' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + glib_size_type=long +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +ac_compile="$glib_ac_compile_save" +rm -f conftest.$ac_objext conftest.err conftest.$ac_ext +fi +ac_compile="$glib_ac_compile_save" +rm -f conftest.$ac_objext conftest.err conftest.$ac_ext +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsigned $glib_size_type" >&5 +$as_echo "unsigned $glib_size_type" >&6; } + +# Check for some functions +for ac_func in lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +# Check for high-resolution sleep functions +for ac_func in splice +do : + ac_fn_c_check_func "$LINENO" "splice" "ac_cv_func_splice" +if test "x$ac_cv_func_splice" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SPLICE 1 +_ACEOF + +fi +done + + +# Check if bcopy can be used for overlapping copies, if memmove isn't found. +# The check is borrowed from the PERL Configure script. +if test "$ac_cv_func_memmove" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether bcopy can handle overlapping copies" >&5 +$as_echo_n "checking whether bcopy can handle overlapping copies... " >&6; } +if ${glib_cv_working_bcopy+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int main() { + char buf[128], abc[128], *b; + int len, off, align; + bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); + for (align = 7; align >= 0; align--) { + for (len = 36; len; len--) { + b = buf+align; bcopy(abc, b, len); + for (off = 1; off <= len; off++) { + bcopy(b, b+off, len); bcopy(b+off, b, len); + if (bcmp(b, abc, len)) return(1); + } + } + } + return(0); + } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_working_bcopy=yes +else + glib_cv_working_bcopy=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_working_bcopy" >&5 +$as_echo "$glib_cv_working_bcopy" >&6; } + + if test "x${glib_cv_working_bcopy+set}" != "xset" ; then + as_fn_error $? "glib_cv_working_bcopy must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "$glib_cv_working_bcopy" = "yes"; then + +$as_echo "#define HAVE_WORKING_BCOPY 1" >>confdefs.h + + fi +fi + +# Check for sys_errlist +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys_errlist" >&5 +$as_echo_n "checking for sys_errlist... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +extern char *sys_errlist[]; +extern int sys_nerr; +sys_errlist[sys_nerr-1][0] = 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_ok=yes +else + glib_ok=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_ok" >&5 +$as_echo "$glib_ok" >&6; } +if test "$glib_ok" = "no"; then + +$as_echo "#define NO_SYS_ERRLIST 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an implementation of va_copy()" >&5 +$as_echo_n "checking for an implementation of va_copy()... " >&6; } +if ${glib_cv_va_copy+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_cv_va_copy=yes +else + glib_cv_va_copy=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_va_copy" >&5 +$as_echo "$glib_cv_va_copy" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an implementation of __va_copy()" >&5 +$as_echo_n "checking for an implementation of __va_copy()... " >&6; } +if ${glib_cv___va_copy+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + __va_copy (args2, args1); + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_cv___va_copy=yes +else + glib_cv___va_copy=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv___va_copy" >&5 +$as_echo "$glib_cv___va_copy" >&6; } + +if test "x$glib_cv_va_copy" = "xyes"; then + g_va_copy_func=va_copy +else if test "x$glib_cv___va_copy" = "xyes"; then + g_va_copy_func=__va_copy +fi +fi + +if test -n "$g_va_copy_func"; then + +cat >>confdefs.h <<_ACEOF +#define G_VA_COPY $g_va_copy_func +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_lists can be copied by value" >&5 +$as_echo_n "checking whether va_lists can be copied by value... " >&6; } +if ${glib_cv_va_val_copy+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + glib_cv_va_val_copy=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + void f (int i, ...) { + va_list args1, args2; + va_start (args1, i); + args2 = args1; + if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) + exit (1); + va_end (args1); va_end (args2); + } + int main() { + f (0, 42); + return 0; + } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_va_val_copy=yes +else + glib_cv_va_val_copy=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_va_val_copy" >&5 +$as_echo "$glib_cv_va_val_copy" >&6; } + +if test "x$glib_cv_va_val_copy" = "xno"; then + +$as_echo "#define G_VA_COPY_AS_ARRAY 1" >>confdefs.h + +fi + +G_MODULE_LIBS= +G_MODULE_LIBS_EXTRA= +G_MODULE_PLUGIN_LIBS= +if test x"$glib_native_win32" = xyes; then + G_MODULE_LDFLAGS= +else + export SED + G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` +fi +G_MODULE_NEED_USCORE=0 +G_MODULE_BROKEN_RTLD_GLOBAL=0 +G_MODULE_HAVE_DLERROR=0 +if test -z "$G_MODULE_IMPL"; then + case "$host" in + *-*-mingw*|*-*-cygwin*) G_MODULE_IMPL=G_MODULE_IMPL_WIN32 ;; + esac +fi +if test -z "$G_MODULE_IMPL"; then + case "$host" in + *-*-aix*) G_MODULE_IMPL=G_MODULE_IMPL_AR ;; + esac +fi +if test -z "$G_MODULE_IMPL"; then + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + ac_fn_c_check_func "$LINENO" "dlsym" "ac_cv_func_dlsym" +if test "x$ac_cv_func_dlsym" = xyes; then : + G_MODULE_IMPL=G_MODULE_IMPL_DL +fi + +fi + +fi +if test -z "$G_MODULE_IMPL" && test "x$glib_native_beos" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for load_image in -lroot" >&5 +$as_echo_n "checking for load_image in -lroot... " >&6; } +if ${ac_cv_lib_root_load_image+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lroot $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char load_image (); +int +main () +{ +return load_image (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_root_load_image=yes +else + ac_cv_lib_root_load_image=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_root_load_image" >&5 +$as_echo "$ac_cv_lib_root_load_image" >&6; } +if test "x$ac_cv_lib_root_load_image" = xyes; then : + G_MODULE_LIBS="-lbe -lroot -lglib-2.0 " + G_MODULE_LIBS_EXTRA="-L\$(top_builddir_full)/.libs" + G_MODULE_PLUGIN_LIBS="-L\$(top_builddir_full)/gmodule/.libs -lgmodule" + G_MODULE_IMPL=G_MODULE_IMPL_BEOS +fi + +fi +if test -z "$G_MODULE_IMPL"; then + ac_fn_c_check_func "$LINENO" "NSLinkModule" "ac_cv_func_NSLinkModule" +if test "x$ac_cv_func_NSLinkModule" = xyes; then : + G_MODULE_IMPL=G_MODULE_IMPL_DYLD + G_MODULE_NEED_USCORE=1 +fi + +fi +if test -z "$G_MODULE_IMPL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5 +$as_echo_n "checking for dlsym in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlsym+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlsym (); +int +main () +{ +return dlsym (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlsym=yes +else + ac_cv_lib_dl_dlsym=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5 +$as_echo "$ac_cv_lib_dl_dlsym" >&6; } +if test "x$ac_cv_lib_dl_dlsym" = xyes; then : + G_MODULE_LIBS=-ldl + G_MODULE_IMPL=G_MODULE_IMPL_DL +fi + +fi + +fi +if test -z "$G_MODULE_IMPL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + G_MODULE_LIBS=-ldld + G_MODULE_IMPL=G_MODULE_IMPL_DLD +fi + +fi +if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then + LIBS_orig="$LIBS" + LDFLAGS_orig="$LDFLAGS" + LIBS="$G_MODULE_LIBS $LIBS" + LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS" + echo "void glib_plugin_test(void) { }" > plugin.c + ${SHELL} ./libtool --mode=compile ${CC} -shared \ + -export-dynamic -o plugin.o plugin.c 2>&1 >/dev/null + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTLD_GLOBAL brokenness" >&5 +$as_echo_n "checking for RTLD_GLOBAL brokenness... " >&6; } +if ${glib_cv_rtldglobal_broken+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + glib_cv_rtldglobal_broken=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef RTLD_GLOBAL +# define RTLD_GLOBAL 0 +#endif +#ifndef RTLD_LAZY +# define RTLD_LAZY 0 +#endif +int glib_plugin_test; +int main () { + void *handle, *global, *local; + global = &glib_plugin_test; + handle = dlopen ("./.libs/plugin.o", RTLD_GLOBAL | RTLD_LAZY); + if (!handle) return 0; + local = dlsym (handle, "glib_plugin_test"); + return global == local; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_rtldglobal_broken=no +else + glib_cv_rtldglobal_broken=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f plugin.c plugin.o plugin.lo .libs/plugin.o + rmdir .libs 2>/dev/null + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_rtldglobal_broken" >&5 +$as_echo "$glib_cv_rtldglobal_broken" >&6; } + if test "x$glib_cv_rtldglobal_broken" = "xyes"; then + G_MODULE_BROKEN_RTLD_GLOBAL=1 + else + G_MODULE_BROKEN_RTLD_GLOBAL=0 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for preceeding underscore in symbols" >&5 +$as_echo_n "checking for preceeding underscore in symbols... " >&6; } +if ${glib_cv_uscore+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int glib_underscore_test (void) { return 42; } + int main() { + void *f1 = (void*)0, *f2 = (void*)0, *handle; + handle = dlopen ((void*)0, 0); + if (handle) { + f1 = dlsym (handle, "glib_underscore_test"); + f2 = dlsym (handle, "_glib_underscore_test"); + } return (!f2 || f1); + } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_uscore=yes +else + glib_cv_uscore=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f plugin.c plugin.$ac_objext plugin.lo + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_uscore" >&5 +$as_echo "$glib_cv_uscore" >&6; } + if test "x${glib_cv_uscore+set}" != "xset" ; then + as_fn_error $? "glib_cv_uscore must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "x$glib_cv_uscore" = "xyes"; then + G_MODULE_NEED_USCORE=1 + else + G_MODULE_NEED_USCORE=0 + fi + + LDFLAGS="$LDFLAGS_orig" + ac_fn_c_check_func "$LINENO" "dlerror" "ac_cv_func_dlerror" +if test "x$ac_cv_func_dlerror" = xyes; then : + G_MODULE_HAVE_DLERROR=1 +else + G_MODULE_HAVE_DLERROR=0 +fi + + LIBS="$LIBS_orig" +fi +if test -z "$G_MODULE_IMPL"; then + G_MODULE_IMPL=0 + G_MODULE_SUPPORTED=false +else + G_MODULE_SUPPORTED=true +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the suffix of module shared libraries" >&5 +$as_echo_n "checking for the suffix of module shared libraries... " >&6; } +export SED +shrext_cmds=`./libtool --config | grep '^shrext_cmds='` +eval $shrext_cmds +module=yes eval std_shrext=$shrext_cmds +# chop the initial dot +glib_gmodule_suffix=`echo $std_shrext | sed 's/^\.//'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: .$glib_gmodule_suffix" >&5 +$as_echo ".$glib_gmodule_suffix" >&6; } +# any reason it may fail? +if test "x$glib_gmodule_suffix" = x; then + as_fn_error $? "Cannot determine shared library suffix from libtool" "$LINENO" 5 +fi + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __inline" >&5 +$as_echo_n "checking for __inline... " >&6; } +if ${glib_cv_has__inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + __inline int foo () { return 0; } + int main () { return foo (); } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glib_cv_has__inline=yes + +else + glib_cv_has__inline=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_has__inline" >&5 +$as_echo "$glib_cv_has__inline" >&6; } +case x$glib_cv_has__inline in +xyes) +$as_echo "#define G_HAVE___INLINE 1" >>confdefs.h + +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __inline__" >&5 +$as_echo_n "checking for __inline__... " >&6; } +if ${glib_cv_has__inline__+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + __inline__ int foo () { return 0; } + int main () { return foo (); } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glib_cv_has__inline__=yes + +else + glib_cv_has__inline__=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_has__inline__" >&5 +$as_echo "$glib_cv_has__inline__" >&6; } +case x$glib_cv_has__inline__ in +xyes) +$as_echo "#define G_HAVE___INLINE__ 1" >>confdefs.h + +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${glib_cv_hasinline+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #undef inline + inline int foo () { return 0; } + int main () { return foo (); } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glib_cv_hasinline=yes + +else + glib_cv_hasinline=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_hasinline" >&5 +$as_echo "$glib_cv_hasinline" >&6; } +case x$glib_cv_hasinline in +xyes) +$as_echo "#define G_HAVE_INLINE 1" >>confdefs.h + +esac + +# if we can use inline functions in headers +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if inline functions in headers work" >&5 +$as_echo_n "checking if inline functions in headers work... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__) +# undef inline +# define inline __inline__ +#elif !defined (G_HAVE_INLINE) +# undef inline +# if defined (G_HAVE___INLINE__) +# define inline __inline__ +# elif defined (G_HAVE___INLINE) +# define inline __inline +# endif +#endif + +int glib_test_func2 (int); + +static inline int +glib_test_func1 (void) { + return glib_test_func2 (1); +} + +int +main (void) { + int i = 1; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + g_can_inline=yes +else + g_can_inline=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $g_can_inline" >&5 +$as_echo "$g_can_inline" >&6; } + +# check for flavours of varargs macros +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 varargs macros in C" >&5 +$as_echo_n "checking for ISO C99 varargs macros in C... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +int a(int p1, int p2, int p3); +#define call_a(...) a(1,__VA_ARGS__) +call_a(2,3); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + g_have_iso_c_varargs=yes +else + g_have_iso_c_varargs=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $g_have_iso_c_varargs" >&5 +$as_echo "$g_have_iso_c_varargs" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 varargs macros in C++" >&5 +$as_echo_n "checking for ISO C99 varargs macros in C++... " >&6; } +if test "$CXX" = ""; then + g_have_iso_cxx_varargs=no +else + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +int a(int p1, int p2, int p3); +#define call_a(...) a(1,__VA_ARGS__) +call_a(2,3); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + g_have_iso_cxx_varargs=yes +else + g_have_iso_cxx_varargs=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $g_have_iso_cxx_varargs" >&5 +$as_echo "$g_have_iso_cxx_varargs" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUC varargs macros" >&5 +$as_echo_n "checking for GNUC varargs macros... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +int a(int p1, int p2, int p3); +#define call_a(params...) a(1,params) +call_a(2,3); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + g_have_gnuc_varargs=yes +else + g_have_gnuc_varargs=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $g_have_gnuc_varargs" >&5 +$as_echo "$g_have_gnuc_varargs" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EILSEQ" >&5 +$as_echo_n "checking for EILSEQ... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + +int error = EILSEQ; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_eilseq=yes +else + have_eilseq=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext; +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_eilseq" >&5 +$as_echo "$have_eilseq" >&6; } + +# check for GNUC visibility support +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUC visibility attribute" >&5 +$as_echo_n "checking for GNUC visibility attribute... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +void +__attribute__ ((visibility ("hidden"))) + f_hidden (void) +{ +} +void +__attribute__ ((visibility ("internal"))) + f_internal (void) +{ +} +void +__attribute__ ((visibility ("protected"))) + f_protected (void) +{ +} +void +__attribute__ ((visibility ("default"))) + f_default (void) +{ +} +int main (int argc, char **argv) +{ + f_hidden(); + f_internal(); + f_protected(); + f_default(); + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext +glib_ac_compile_save="$ac_compile" +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext' +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + { ac_try='(if test -s conftest.err; then false ; else true; fi)' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + g_have_gnuc_visibility=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +g_have_gnuc_visibility=no +fi +ac_compile="$glib_ac_compile_save" +rm -f conftest.$ac_objext conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $g_have_gnuc_visibility" >&5 +$as_echo "$g_have_gnuc_visibility" >&6; } + +# check for bytesex stuff + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + +if test x$ac_cv_c_bigendian = xuniversal ; then +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +#if __BYTE_ORDER == __BIG_ENDIAN +#else +#error Not a big endian. +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +#if __BYTE_ORDER == __LITTLE_ENDIAN +#else +#error Not a little endian. +#endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=no + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not determine endianness." >&5 +$as_echo "$as_me: WARNING: Could not determine endianness." >&2;} +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + +# check for header files +for ac_header in dirent.h float.h limits.h pwd.h grp.h sys/param.h sys/poll.h sys/resource.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/time.h sys/times.h sys/wait.h unistd.h values.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/select.h sys/types.h stdint.h inttypes.h sched.h malloc.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/uio.h sys/mkdev.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in linux/magic.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "linux/magic.h" "ac_cv_header_linux_magic_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_magic_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_MAGIC_H 1 +_ACEOF + +fi + +done + + +for ac_header in sys/mount.h sys/sysctl.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#if HAVE_SYS_PARAM_H + #include + #endif + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# check for structure fields +ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimensec" "ac_cv_member_struct_stat_st_mtimensec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_mtimensec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.tv_nsec" "ac_cv_member_struct_stat_st_mtim_tv_nsec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_mtim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimensec" "ac_cv_member_struct_stat_st_ctimensec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_ctimensec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_CTIMENSEC 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_ctim.tv_nsec" "ac_cv_member_struct_stat_st_ctim_tv_nsec" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_ctim_tv_nsec" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC 1 +_ACEOF + + +fi + +ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "#include +#include +#include +#ifdef HAVE_SYS_STATFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +" +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "#include +#include +#include +#ifdef HAVE_SYS_STATFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +" +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct statfs" "f_fstypename" "ac_cv_member_struct_statfs_f_fstypename" "#include +#include +#include +#ifdef HAVE_SYS_STATFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +" +if test "x$ac_cv_member_struct_statfs_f_fstypename" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATFS_F_FSTYPENAME 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct statfs" "f_bavail" "ac_cv_member_struct_statfs_f_bavail" "#include +#include +#include +#ifdef HAVE_SYS_STATFS_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +" +if test "x$ac_cv_member_struct_statfs_f_bavail" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATFS_F_BAVAIL 1 +_ACEOF + + +fi + +# struct statvfs.f_basetype is available on Solaris but not for Linux. +ac_fn_c_check_member "$LINENO" "struct statvfs" "f_basetype" "ac_cv_member_struct_statvfs_f_basetype" "#include +" +if test "x$ac_cv_member_struct_statvfs_f_basetype" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATVFS_F_BASETYPE 1 +_ACEOF + + +fi + +ac_fn_c_check_member "$LINENO" "struct statvfs" "f_fstypename" "ac_cv_member_struct_statvfs_f_fstypename" "#include +" +if test "x$ac_cv_member_struct_statvfs_f_fstypename" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATVFS_F_FSTYPENAME 1 +_ACEOF + + +fi + +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_TM_TM_GMTOFF 1 +_ACEOF + + +fi +ac_fn_c_check_member "$LINENO" "struct tm" "__tm_gmtoff" "ac_cv_member_struct_tm___tm_gmtoff" "#include +" +if test "x$ac_cv_member_struct_tm___tm_gmtoff" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_TM___TM_GMTOFF 1 +_ACEOF + + +fi + + + +THREAD_NO_IMPLEMENTATION="You do not have any known thread system on your + computer. GLib will not have a default thread implementation." + +FLAG_DOES_NOT_WORK="I can't find the MACRO to enable thread safety on your + platform (normally it's "_REENTRANT"). I'll not use any flag on + compilation now, but then your programs might not work. + Please provide information on how it is done on your system." + +LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation + " + +LIBS_NOT_FOUND_2=". Please choose another thread implementation or + provide information on your thread implementation. + You can also run 'configure --disable-threads' + to compile without thread support." + +FUNC_NO_GETPWUID_R="the 'g_get_(user_name|real_name|home_dir|tmp_dir)' + functions will not be MT-safe during their first call because + there is no working 'getpwuid_r' on your system." + +FUNC_NO_LOCALTIME_R="the 'g_date_set_time' function will not be MT-safe + because there is no 'localtime_r' on your system." + +POSIX_NO_YIELD="I can not find a yield functions for your platform. A rather + crude surrogate will be used. If you happen to know a + yield function for your system, please inform the GLib + developers." + +POSIX_NO_PRIORITIES="I can not find the minimal and maximal priorities for + threads on your system. Thus threads can only have the default + priority. If you happen to know these main/max + priorities, please inform the GLib developers." + +AIX_COMPILE_INFO="AIX's C compiler needs to be called by a different name, when + linking threaded applications. As GLib cannot do that + automatically, you will get an linkg error everytime you are + not using the right compiler. In that case you have to relink + with the right compiler. Ususally just '_r' is appended + to the compiler name." + + +# have_threads=no means no thread support +# have_threads=none means no default thread implementation + +have_threads=no +if test "x$want_threads" = xyes || test "x$want_threads" = xposix \ + || test "x$want_threads" = xdce; then + # -D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE is for DG/UX + # -U_OSF_SOURCE is for Digital UNIX 4.0d + GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE" + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + if test "x$have_threads" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_threads=posix +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "x$have_threads" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_mutex_t m; + pthread_mutex_init (&m, pthread_mutexattr_default); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_threads=dce +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # Tru64Unix requires -pthread to find pthread.h. See #103020 + CPPFLAGS="$CPPFLAGS -pthread" + if test "x$have_threads" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_threads=posix +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + CPPFLAGS="$glib_save_CPPFLAGS" +fi +if test "x$want_threads" = xyes || test "x$want_threads" = xwin32; then + case $host in + *-*-mingw*) + have_threads=win32 + ;; + esac +fi +if test "x$want_threads" = xnone; then + have_threads=none +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread implementation" >&5 +$as_echo_n "checking for thread implementation... " >&6; } + +if test "x$have_threads" = xno && test "x$want_threads" != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none available" >&5 +$as_echo "none available" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $THREAD_NO_IMPLEMENTATION" >&5 +$as_echo "$as_me: WARNING: $THREAD_NO_IMPLEMENTATION" >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_threads" >&5 +$as_echo "$have_threads" >&6; } +fi + + + +G_THREAD_LIBS= +G_THREAD_LIBS_EXTRA= +G_THREAD_CFLAGS= + + + +if test x"$have_threads" != xno; then + + if test x"$have_threads" = xposix; then + # First we test for posix, whether -pthread or -pthreads do the trick as + # both CPPFLAG and LIBS. + # One of them does for most gcc versions and some other platforms/compilers + # too and could be considered as the canonical way to go. + case $host in + *-*-cygwin*|*-*-darwin*) + # skip cygwin and darwin -pthread or -pthreads test + ;; + *-solaris*) + # These compiler/linker flags work with both Sun Studio and gcc + # Sun Studio expands -mt to -D_REENTRANT and -lthread + # gcc expands -pthreads to -D_REENTRANT -D_PTHREADS -lpthread + G_THREAD_CFLAGS="-D_REENTRANT -D_PTHREADS" + G_THREAD_LIBS="-lpthread -lthread" + ;; + *) + for flag in pthread pthreads mt; do + glib_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -$flag" + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int check_me = 0; +void* func(void* data) {check_me = 42; return &check_me;} +int main() + { pthread_t t; + void *ret; + pthread_create (&t, 0, func, 0); + pthread_join (t, &ret); + return (check_me != 42 || ret != &check_me); +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_flag_works=yes +else + glib_flag_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int check_me = 0; +void* func(void* data) {check_me = 42; return &check_me;} +int main() + { pthread_t t; + void *ret; + pthread_create (&t, 0, func, 0); + pthread_join (t, &ret); + return (check_me != 42 || ret != &check_me); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_flag_works=yes +else + glib_flag_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$glib_save_CFLAGS" + if test $glib_flag_works = yes ; then + G_THREAD_CFLAGS=-$flag + G_THREAD_LIBS=-$flag + break; + fi + done + ;; + esac + fi + + if test x"$G_THREAD_CFLAGS" = x; then + + # The canonical -pthread[s] does not work. Try something different. + + case $host in + *-aix*) + if test x"$GCC" = xyes; then + # GCC 3.0 and above needs -pthread. + # Should be coverd by the case above. + # GCC 2.x and below needs -mthreads + G_THREAD_CFLAGS="-mthreads" + G_THREAD_LIBS=$G_THREAD_CFLAGS + else + # We are probably using the aix compiler. Normaly a + # program would have to be compiled with the _r variant + # of the corresponding compiler, but we as GLib cannot + # do that: but the good news is that for compiling the + # only difference is the added -D_THREAD_SAFE compile + # option. This is according to the "C for AIX User's + # Guide". + G_THREAD_CFLAGS="-D_THREAD_SAFE" + fi + ;; + *-dg-dgux*) # DG/UX + G_THREAD_CFLAGS="-D_REENTRANT -D_POSIX4A_DRAFT10_SOURCE" + ;; + *-osf*) + # So we are using dce threads. posix threads are already + # catched above. + G_THREAD_CFLAGS="-threads" + G_THREAD_LIBS=$G_THREAD_CFLAGS + ;; + *-sysv5uw7*) # UnixWare 7 + # We are not using gcc with -pthread. Catched above. + G_THREAD_CFLAGS="-Kthread" + G_THREAD_LIBS=$G_THREAD_CFLAGS + ;; + *-mingw*) + # No flag needed when using MSVCRT.DLL + G_THREAD_CFLAGS="" + ;; + *) + G_THREAD_CFLAGS="-D_REENTRANT" # good default guess otherwise + ;; + esac + + fi + + # if we are not finding the localtime_r function, then we probably are + # not using the proper multithread flag + + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS" + + # First we test, whether localtime_r is declared in time.h + # directly. Then we test whether a macro localtime_r exists, in + # which case localtime_r in the test program is replaced and thus + # if we still find localtime_r in the output, it is not defined as + # a macro. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "[^a-zA-Z1-9_]localtime_r[^a-zA-Z1-9_]" >/dev/null 2>&1; then : + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + localtime_r(a,b) +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "[^a-zA-Z1-9_]localtime_r[^a-zA-Z1-9_]" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $FLAG_DOES_NOT_WORK" >&5 +$as_echo "$as_me: WARNING: $FLAG_DOES_NOT_WORK" >&2;} +fi +rm -f conftest* + +fi +rm -f conftest* + + + CPPFLAGS="$glib_save_CPPFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking thread related cflags" >&5 +$as_echo_n "checking thread related cflags... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $G_THREAD_CFLAGS" >&5 +$as_echo "$G_THREAD_CFLAGS" >&6; } + CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS" +fi + + +mutex_has_default=no +case $have_threads in + posix|dce) + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + if test x"$G_THREAD_LIBS" = x; then + case $host in + *-aix*) + # We are not using gcc (would have set G_THREAD_LIBS) and thus + # probably using the aix compiler. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $AIX_COMPILE_INFO" >&5 +$as_echo "$as_me: WARNING: $AIX_COMPILE_INFO" >&2;} + ;; + *) + G_THREAD_LIBS=error + glib_save_LIBS="$LIBS" + for thread_lib in "" pthread pthread32 pthreads thread dce; do + if test x"$thread_lib" = x; then + add_thread_lib="" + IN="" + else + add_thread_lib="-l$thread_lib" + IN=" in -l$thread_lib" + fi + if test x"$have_threads" = xposix; then + defattr=0 + else + defattr=pthread_attr_default + fi + + LIBS="$add_thread_lib $glib_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create/pthread_join$IN" >&5 +$as_echo_n "checking for pthread_create/pthread_join$IN... " >&6; } + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int check_me = 0; +void* func(void* data) {check_me = 42; return &check_me;} +int main() + { pthread_t t; + void *ret; + pthread_create (&t, $defattr, func, 0); + pthread_join (t, &ret); + return (check_me != 42 || ret != &check_me); +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_result=yes +else + glib_result=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +int check_me = 0; +void* func(void* data) {check_me = 42; return &check_me;} +int main() + { pthread_t t; + void *ret; + pthread_create (&t, $defattr, func, 0); + pthread_join (t, &ret); + return (check_me != 42 || ret != &check_me); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_result=yes +else + glib_result=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_result" >&5 +$as_echo "$glib_result" >&6; } + + if test "$glib_result" = "yes" ; then + G_THREAD_LIBS="$add_thread_lib" + break + fi + done + if test "x$G_THREAD_LIBS" = xerror; then + as_fn_error $? "$LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2" "$LINENO" 5 + fi + LIBS="$glib_save_LIBS" + ;; + esac + fi + + glib_save_LIBS="$LIBS" + for thread_lib in "" rt rte; do + if test x"$thread_lib" = x; then + add_thread_lib="" + IN="" + else + add_thread_lib="-l$thread_lib" + IN=" in -l$thread_lib" + fi + LIBS="$add_thread_lib $glib_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_get_priority_min$IN" >&5 +$as_echo_n "checking for sched_get_priority_min$IN... " >&6; } + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main() { + errno = 0; + return sched_get_priority_min(SCHED_OTHER)==-1 + && errno != 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_result=yes +else + glib_result=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main() { + errno = 0; + return sched_get_priority_min(SCHED_OTHER)==-1 + && errno != 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_result=yes +else + glib_result=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_result" >&5 +$as_echo "$glib_result" >&6; } + + if test "$glib_result" = "yes" ; then + G_THREAD_LIBS="$G_THREAD_LIBS $add_thread_lib" + posix_priority_min="sched_get_priority_min(SCHED_OTHER)" + posix_priority_max="sched_get_priority_max(SCHED_OTHER)" + break + fi + done + LIBS="$glib_save_LIBS" + mutex_has_default=yes + mutex_default_type='pthread_mutex_t' + mutex_default_init='PTHREAD_MUTEX_INITIALIZER' + mutex_header_file='pthread.h' + if test "x$have_threads" = "xposix"; then + g_threads_impl="POSIX" + else + g_threads_impl="DCE" + have_threads="posix" + fi + + CPPFLAGS="$glib_save_CPPFLAGS" + ;; + win32) + g_threads_impl="WIN32" + ;; + none|no) + g_threads_impl="NONE" + ;; + *) + g_threads_impl="NONE" + G_THREAD_LIBS=error + ;; +esac + +if test "x$G_THREAD_LIBS" = xerror; then + as_fn_error $? "$LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking thread related libraries" >&5 +$as_echo_n "checking thread related libraries... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $G_THREAD_LIBS" >&5 +$as_echo "$G_THREAD_LIBS" >&6; } + + +if test x"$have_threads" != xno; then + glib_save_LIBS="$LIBS" + # we are not doing the following for now, as this might require glib + # to always be linked with the thread libs on some platforms. + # LIBS="$LIBS $G_THREAD_LIBS" + for ac_func in localtime_r gmtime_r +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + if test "$ac_cv_header_pwd_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix getpwuid_r" >&5 +$as_echo_n "checking for posix getpwuid_r... " >&6; } +if ${ac_cv_func_posix_getpwuid_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main () { + char buffer[10000]; + struct passwd pwd, *pwptr = &pwd; + int error; + errno = 0; + error = getpwuid_r (0, &pwd, buffer, + sizeof (buffer), &pwptr); + return (error < 0 && errno == ENOSYS) + || error == ENOSYS; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_posix_getpwuid_r=yes +else + ac_cv_func_posix_getpwuid_r=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_posix_getpwuid_r" >&5 +$as_echo "$ac_cv_func_posix_getpwuid_r" >&6; } + if test "x${ac_cv_func_posix_getpwuid_r+set}" != "xset" ; then + as_fn_error $? "ac_cv_func_posix_getpwuid_r must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "$ac_cv_func_posix_getpwuid_r" = yes; then + +$as_echo "#define HAVE_POSIX_GETPWUID_R 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nonposix getpwuid_r" >&5 +$as_echo_n "checking for nonposix getpwuid_r... " >&6; } +if ${ac_cv_func_nonposix_getpwuid_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char buffer[10000]; + struct passwd pwd; + getpwuid_r (0, &pwd, buffer, + sizeof (buffer)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_nonposix_getpwuid_r=yes +else + ac_cv_func_nonposix_getpwuid_r=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_nonposix_getpwuid_r" >&5 +$as_echo "$ac_cv_func_nonposix_getpwuid_r" >&6; } + if test "x${ac_cv_func_nonposix_getpwuid_r+set}" != "xset" ; then + as_fn_error $? "ac_cv_func_nonposix_getpwuid_r must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then + +$as_echo "#define HAVE_NONPOSIX_GETPWUID_R 1" >>confdefs.h + + fi + fi + fi + if test "$ac_cv_header_grp_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix getgrgid_r" >&5 +$as_echo_n "checking for posix getgrgid_r... " >&6; } +if ${ac_cv_func_posix_getgrgid_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main () { + char buffer[10000]; + struct group grp, *grpptr = &grp; + int error; + errno = 0; + error = getgrgid_r (0, &grp, buffer, + sizeof (buffer), &grpptr); + return (error < 0 && errno == ENOSYS) + || error == ENOSYS; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_posix_getgrgid_r=yes +else + ac_cv_func_posix_getgrgid_r=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_posix_getgrgid_r" >&5 +$as_echo "$ac_cv_func_posix_getgrgid_r" >&6; } + if test "x${ac_cv_func_posix_getgrgid_r+set}" != "xset" ; then + as_fn_error $? "ac_cv_func_posix_getgrgid_r must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "$ac_cv_func_posix_getgrgid_r" = yes; then + +$as_echo "#define HAVE_POSIX_GETGRGID_R 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nonposix getgrgid_r" >&5 +$as_echo_n "checking for nonposix getgrgid_r... " >&6; } +if ${ac_cv_func_nonposix_getgrgid_r+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char buffer[10000]; + struct group grp; + getgrgid_r (0, &grp, buffer, + sizeof (buffer)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_nonposix_getgrgid_r=yes +else + ac_cv_func_nonposix_getgrgid_r=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_nonposix_getgrgid_r" >&5 +$as_echo "$ac_cv_func_nonposix_getgrgid_r" >&6; } + if test "x${ac_cv_func_nonposix_getgrgid_r+set}" != "xset" ; then + as_fn_error $? "ac_cv_func_nonposix_getgrgid_r must be set in cache file when cross-compiling." "$LINENO" 5 +fi + + if test "$ac_cv_func_nonposix_getgrgid_r" = yes; then + +$as_echo "#define HAVE_NONPOSIX_GETGRGID_R 1" >>confdefs.h + + fi + fi + fi + LIBS="$G_THREAD_LIBS $LIBS" + if test x"$have_threads" = xposix; then + glib_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 +$as_echo_n "checking size of pthread_t... " >&6; } +if ${glib_cv_sizeof_system_thread+:} false; then : + $as_echo_n "(cached) " >&6 +else + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if ac_fn_c_compute_int "$LINENO" "(long) (sizeof (pthread_t))" "glib_cv_sizeof_system_thread" "#include +"; then : + +else + as_fn_error $? "cannot compute sizeof (pthread_t), 77" "$LINENO" 5 +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_sizeof_system_thread" >&5 +$as_echo "$glib_cv_sizeof_system_thread" >&6; } +cat >>confdefs.h <<_ACEOF +#define GLIB_SIZEOF_SYSTEM_THREAD $glib_cv_sizeof_system_thread +_ACEOF + + + # This is not AC_CHECK_FUNC to also work with function + # name mangling in header files. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setstacksize" >&5 +$as_echo_n "checking for pthread_attr_setstacksize... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_attr_t t; pthread_attr_setstacksize(&t,0) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minimal/maximal thread priority" >&5 +$as_echo_n "checking for minimal/maximal thread priority... " >&6; } + if test x"$posix_priority_min" = x; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + PX_PRIO_MIN +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "PX_PRIO_MIN" >/dev/null 2>&1; then : + +else + + posix_priority_min=PX_PRIO_MIN + posix_priority_max=PX_PRIO_MAX +fi +rm -f conftest* + + fi + if test x"$posix_priority_min" = x; then + # AIX + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + PTHREAD_PRIO_MIN +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "PTHREAD_PRIO_MIN" >/dev/null 2>&1; then : + +else + + posix_priority_min=PTHREAD_PRIO_MIN + posix_priority_max=PTHREAD_PRIO_MAX +fi +rm -f conftest* + + fi + if test x"$posix_priority_min" = x; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + PRI_OTHER_MIN +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "PRI_OTHER_MIN" >/dev/null 2>&1; then : + +else + + posix_priority_min=PRI_OTHER_MIN + posix_priority_max=PRI_OTHER_MAX +fi +rm -f conftest* + + fi + if test x"$posix_priority_min" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found" >&5 +$as_echo "none found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $POSIX_NO_PRIORITIES" >&5 +$as_echo "$as_me: WARNING: $POSIX_NO_PRIORITIES" >&2;} + posix_priority_min=-1 + posix_priority_max=-1 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $posix_priority_min/$posix_priority_max" >&5 +$as_echo "$posix_priority_min/$posix_priority_max" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setschedparam" >&5 +$as_echo_n "checking for pthread_setschedparam... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +pthread_t t; pthread_setschedparam(t, 0, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define POSIX_MIN_PRIORITY $posix_priority_min +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define POSIX_MAX_PRIORITY $posix_priority_max +_ACEOF + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $POSIX_NO_PRIORITIES" >&5 +$as_echo "$as_me: WARNING: $POSIX_NO_PRIORITIES" >&2;} +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + posix_yield_func=none + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix yield function" >&5 +$as_echo_n "checking for posix yield function... " >&6; } + for yield_func in sched_yield pthread_yield_np pthread_yield \ + thr_yield; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +$yield_func() + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + posix_yield_func="$yield_func" + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + if test x"$posix_yield_func" = xnone; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found" >&5 +$as_echo "none found" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $POSIX_NO_YIELD" >&5 +$as_echo "$as_me: WARNING: $POSIX_NO_YIELD" >&2;} + posix_yield_func="g_usleep(1000)" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $posix_yield_func" >&5 +$as_echo "$posix_yield_func" >&6; } + posix_yield_func="$posix_yield_func()" + fi + +cat >>confdefs.h <<_ACEOF +#define POSIX_YIELD_FUNC $posix_yield_func +_ACEOF + + CPPFLAGS="$glib_save_CPPFLAGS" + + elif test x"$have_threads" = xwin32; then + # It's a pointer to a private struct + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of struct _GThreadData *" >&5 +$as_echo_n "checking size of struct _GThreadData *... " >&6; } +if ${glib_cv_sizeof_system_thread+:} false; then : + $as_echo_n "(cached) " >&6 +else + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if ac_fn_c_compute_int "$LINENO" "(long) (sizeof (struct _GThreadData *))" "glib_cv_sizeof_system_thread" "$ac_includes_default"; then : + +else + as_fn_error $? "cannot compute sizeof (struct _GThreadData *), 77" "$LINENO" 5 +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_sizeof_system_thread" >&5 +$as_echo "$glib_cv_sizeof_system_thread" >&6; } +cat >>confdefs.h <<_ACEOF +#define GLIB_SIZEOF_SYSTEM_THREAD $glib_cv_sizeof_system_thread +_ACEOF + + + fi + + LIBS="$glib_save_LIBS" + + # now spit out all the warnings. + if test "$ac_cv_func_posix_getpwuid_r" != "yes" && + test "$ac_cv_func_nonposix_getpwuid_r" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $FUNC_NO_GETPWUID_R" >&5 +$as_echo "$as_me: WARNING: $FUNC_NO_GETPWUID_R" >&2;} + fi + if test "$ac_cv_func_localtime_r" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $FUNC_NO_LOCALTIME_R" >&5 +$as_echo "$as_me: WARNING: $FUNC_NO_LOCALTIME_R" >&2;} + fi +fi + +if test x"$glib_cv_sizeof_system_thread" = x; then + # use a pointer as a fallback. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +$as_echo_n "checking size of void *... " >&6; } +if ${glib_cv_sizeof_system_thread+:} false; then : + $as_echo_n "(cached) " >&6 +else + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if ac_fn_c_compute_int "$LINENO" "(long) (sizeof (void *))" "glib_cv_sizeof_system_thread" "$ac_includes_default"; then : + +else + as_fn_error $? "cannot compute sizeof (void *), 77" "$LINENO" 5 +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_sizeof_system_thread" >&5 +$as_echo "$glib_cv_sizeof_system_thread" >&6; } +cat >>confdefs.h <<_ACEOF +#define GLIB_SIZEOF_SYSTEM_THREAD $glib_cv_sizeof_system_thread +_ACEOF + + +fi + +# +# Hack to deal with: +# +# a) GCC < 3.3 for Linux doesn't include -lpthread when +# building shared libraries with linux. +# b) FreeBSD doesn't do this either. +# +case $host in + *-*-freebsd*|*-*-linux*) + G_THREAD_LIBS_FOR_GTHREAD="`echo $G_THREAD_LIBS | sed s/-pthread/-lpthread/`" + ;; + *-*-openbsd*) + LDFLAGS="$LDFLAGS -pthread" + ;; + *) + G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define G_THREAD_SOURCE "gthread-$have_threads.c" +_ACEOF + + + + + + +if test $mutex_has_default = yes ; then + glib_save_CPPFLAGS="$CPPFLAGS" + glib_save_LIBS="$LIBS" + LIBS="$G_THREAD_LIBS $LIBS" + CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of $mutex_default_type" >&5 +$as_echo_n "checking size of $mutex_default_type... " >&6; } +if ${glib_cv_sizeof_gmutex+:} false; then : + $as_echo_n "(cached) " >&6 +else + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if ac_fn_c_compute_int "$LINENO" "(long) (sizeof ($mutex_default_type))" "glib_cv_sizeof_gmutex" "#include <$mutex_header_file> +"; then : + +else + as_fn_error $? "cannot compute sizeof ($mutex_default_type), 77" "$LINENO" 5 +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_sizeof_gmutex" >&5 +$as_echo "$glib_cv_sizeof_gmutex" >&6; } +cat >>confdefs.h <<_ACEOF +#define GLIB_SIZEOF_GMUTEX $glib_cv_sizeof_gmutex +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking byte contents of $mutex_default_init" >&5 +$as_echo_n "checking byte contents of $mutex_default_init... " >&6; } +if ${glib_cv_byte_contents_gmutex+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + glib_cv_byte_contents_gmutex=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include <$mutex_header_file> +main() +{ + static $mutex_default_type tv = $mutex_default_init; + char *p = (char*) &tv; + int i; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + for (i = 0; i < $glib_cv_sizeof_gmutex; i++) + fprintf(f, "%s%d", i?",":"", *(p++)); + fprintf(f, "\n"); + exit(0); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + glib_cv_byte_contents_gmutex=`cat conftestval` +else + glib_cv_byte_contents_gmutex=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_byte_contents_gmutex" >&5 +$as_echo "$glib_cv_byte_contents_gmutex" >&6; } + +cat >>confdefs.h <<_ACEOF +#define GLIB_BYTE_CONTENTS_GMUTEX $glib_cv_byte_contents_gmutex +_ACEOF + + + if test x"$glib_cv_byte_contents_gmutex" = xno; then + mutex_has_default=no + fi + CPPFLAGS="$glib_save_CPPFLAGS" + LIBS="$glib_save_LIBS" +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use assembler code for atomic operations" >&5 +$as_echo_n "checking whether to use assembler code for atomic operations... " >&6; } + case $host_cpu in + i386) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } + glib_memory_barrier_needed=no + ;; + i?86) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: i486" >&5 +$as_echo "i486" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_I486 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + sparc*) + SPARCV9_WARNING="Try to rerun configure with CFLAGS='-mcpu=v9', + when you are using a sparc with v9 instruction set (most + sparcs nowadays). This will make the code for atomic + operations much faster. The resulting code will not run + on very old sparcs though." + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + main () + { + int tmp1, tmp2, tmp3; + __asm__ __volatile__("casx [%2], %0, %1" + : "=&r" (tmp1), "=&r" (tmp2) : "r" (&tmp3)); + } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: sparcv9" >&5 +$as_echo "sparcv9" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_SPARCV9 1 +_ACEOF + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $SPARCV9_WARNING" >&5 +$as_echo "$as_me: WARNING: $SPARCV9_WARNING" >&2;} +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + glib_memory_barrier_needed=yes + ;; + alpha*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: alpha" >&5 +$as_echo "alpha" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_ALPHA 1 +_ACEOF + + glib_memory_barrier_needed=yes + ;; + x86_64) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: x86_64" >&5 +$as_echo "x86_64" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_X86_64 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + powerpc*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: powerpc" >&5 +$as_echo "powerpc" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_POWERPC 1 +_ACEOF + + glib_memory_barrier_needed=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether asm supports numbered local labels" >&5 +$as_echo_n "checking whether asm supports numbered local labels... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + __asm__ __volatile__ ("1: nop\n" + " bne- 1b") + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +cat >>confdefs.h <<_ACEOF +#define ASM_NUMERIC_LABELS 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + ia64) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ia64" >&5 +$as_echo "ia64" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_IA64 1 +_ACEOF + + glib_memory_barrier_needed=yes + ;; + s390|s390x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: s390" >&5 +$as_echo "s390" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_S390 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + arm*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: arm" >&5 +$as_echo "arm" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_ARM 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + crisv32*|etraxfs*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: crisv32" >&5 +$as_echo "crisv32" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_CRISV32 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + cris*|etrax*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cris" >&5 +$as_echo "cris" >&6; } + +cat >>confdefs.h <<_ACEOF +#define G_ATOMIC_CRIS 1 +_ACEOF + + glib_memory_barrier_needed=no + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } + glib_memory_barrier_needed=yes + ;; + esac + +glib_cv_gcc_has_builtin_atomic_operations=no +if test x"$GCC" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC supports built-in atomic intrinsics" >&5 +$as_echo_n "checking whether GCC supports built-in atomic intrinsics... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +int i; + __sync_synchronize (); + __sync_bool_compare_and_swap (&i, 0, 1); + __sync_fetch_and_add (&i, 1); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_cv_gcc_has_builtin_atomic_operations=yes +else + glib_cv_gcc_has_builtin_atomic_operations=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_gcc_has_builtin_atomic_operations" >&5 +$as_echo "$glib_cv_gcc_has_builtin_atomic_operations" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32 atomic intrinsics" >&5 +$as_echo_n "checking for Win32 atomic intrinsics... " >&6; } +glib_cv_has_win32_atomic_operations=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +int i; _InterlockedExchangeAdd (&i, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + glib_cv_has_win32_atomic_operations=yes +else + glib_cv_has_win32_atomic_operations=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_has_win32_atomic_operations" >&5 +$as_echo "$glib_cv_has_win32_atomic_operations" >&6; } +if test "x$glib_cv_has_win32_atomic_operations" = xyes; then + +$as_echo "#define HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for futex(2) system call" >&5 +$as_echo_n "checking for futex(2) system call... " >&6; } +if ${glib_cv_futex+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + +int +main (void) +{ + /* it is not like this actually runs or anything... */ + syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT); + return 0; +} + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glib_cv_futex=yes +else + glib_cv_futex=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glib_cv_futex" >&5 +$as_echo "$glib_cv_futex" >&6; } +if test x"$glib_cv_futex" = xyes; then + +$as_echo "#define HAVE_FUTEX 1" >>confdefs.h + +fi + +ac_config_commands="$ac_config_commands deps/glib/glibconfig.h" + + + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/glib" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/glib" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/gmodule" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/gmodule" + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib," + enable_nls=no + + +fi + + +if test "x$enable_glib" != "xyes"; then : + + if test "x$enable_cogl_pango" = "xyes"; then : + as_fn_error $? "--enable-cogl-pango conflicts with --disable-glib" "$LINENO" 5 +fi + enable_cogl_pango=no + + +fi + +# Check whether --enable-cogl-pango was given. +if test "${enable_cogl_pango+set}" = set; then : + enableval=$enable_cogl_pango; +else + enable_cogl_pango=yes + +fi + +if test "x$enable_cogl_pango" = "xyes"; then : + + COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= 1.20" + + +fi + + +if test "x$enable_glib" != "xyes"; then : + + if test "x$enable_cogl_gst" = "xyes"; then : + as_fn_error $? "--enable-cogl-gst conflicts with --disable-glib" "$LINENO" 5 +fi + enable_cogl_gst=no + + +fi + +# Check whether --enable-cogl-gst was given. +if test "${enable_cogl_gst+set}" = set; then : + enableval=$enable_cogl_gst; +else + enable_cogl_gst=no + +fi + +if test "x$enable_cogl_gst" = "xyes"; then : + + COGL_GST_PKG_REQUIRES="$COGL_GST_PKG_REQUIRES gstreamer-1.0 gstreamer-fft-1.0 \ + gstreamer-audio-1.0 gstreamer-base-1.0 \ + gstreamer-video-1.0 gstreamer-plugins-base-1.0 \ + gstreamer-tag-1.0 gstreamer-controller-1.0" + + GST_MAJORMINOR=1.0 + + plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" + + + GSTREAMER_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-1.0`" + + + +fi + + +# Check whether --enable-cogl-path was given. +if test "${enable_cogl_path+set}" = set; then : + enableval=$enable_cogl_path; +else + enable_cogl_path=yes + +fi + +if test "x$enable_cogl_path" = "xyes"; then : + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_COGL_PATH_SUPPORT" + + +fi + +# Check whether --enable-gdk-pixbuf was given. +if test "${enable_gdk_pixbuf+set}" = set; then : + enableval=$enable_gdk_pixbuf; +else + if test "x$enable_glib" = "xyes"; then : + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gdk-pixbuf-2.0 >= 2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gdk-pixbuf-2.0 >= 2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + enable_gdk_pixbuf=yes +else + enable_gdk_pixbuf=no +fi +fi + +fi + + +# Check whether --enable-quartz-image was given. +if test "${enable_quartz_image+set}" = set; then : + enableval=$enable_quartz_image; +else + enable_quartz_image=no + +fi + + +if test "x$enable_gdk_pixbuf" = "xyes"; then : + + if test "x$enable_glib" != "xyes"; then : + as_fn_error $? "--disable-glib conflicts with --enable-gdk-pixbuf" "$LINENO" 5 +fi + +$as_echo "#define USE_GDKPIXBUF 1" >>confdefs.h + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gdk-pixbuf-2.0 >= 2.0" + COGL_IMAGE_BACKEND="gdk-pixbuf" + +elif test "x$enable_quartz_image" = "xyes"; then : + + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS Quartz Core Graphics," + +$as_echo "#define USE_QUARTZ 1" >>confdefs.h + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -framework ApplicationServices" + COGL_IMAGE_BACKEND="quartz" + +else + + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS fallback image decoding (stb_image)," + +$as_echo "#define USE_INTERNAL 1" >>confdefs.h + + COGL_IMAGE_BACKEND="stb_image" + + +fi + +# Check whether --enable-examples-install was given. +if test "${enable_examples_install+set}" = set; then : + enableval=$enable_examples_install; +else + enable_examples_install=no + +fi + + if test "x$enable_examples_install" = "xyes"; then + INSTALL_EXAMPLES_TRUE= + INSTALL_EXAMPLES_FALSE='#' +else + INSTALL_EXAMPLES_TRUE='#' + INSTALL_EXAMPLES_FALSE= +fi + + + +EGL_CHECKED=no + +GL_LIBRARY_DIRECTLY_LINKED=no + +enabled_drivers="" + +HAVE_GLES1=0 +# Check whether --enable-gles1 was given. +if test "${enable_gles1+set}" = set; then : + enableval=$enable_gles1; +else + enable_gles1=no + +fi + +if test "x$enable_gles1" = "xyes"; then : + + if test "x$platform_win32" = "xyes"; then : + as_fn_error $? "GLES 1 not available for win32" "$LINENO" 5 +fi + + enabled_drivers="$enabled_drivers gles1" + + cogl_gl_headers="GLES/gl.h GLES/glext.h" + + +$as_echo "#define HAVE_COGL_GLES 1" >>confdefs.h + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES1" + HAVE_GLES1=1 + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glesv1_cm\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glesv1_cm") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv1_cm" + COGL_GLES1_LIBNAME="libGLESv1_CM.so" + +else + + # We have to check the two headers independently as GLES/glext.h + # needs to include GLES/gl.h to have the GL types defined (eg. + # GLenum). + ac_fn_c_check_header_mongrel "$LINENO" "GLES/gl.h" "ac_cv_header_GLES_gl_h" "$ac_includes_default" +if test "x$ac_cv_header_GLES_gl_h" = xyes; then : + +else + as_fn_error $? "Unable to locate GLES/gl.h" "$LINENO" 5 +fi + + + ac_fn_c_check_header_compile "$LINENO" "GLES/glext.h" "ac_cv_header_GLES_glext_h" "#include +" +if test "x$ac_cv_header_GLES_glext_h" = xyes; then : + +else + as_fn_error $? "Unable to locate GLES/glext.h" "$LINENO" 5 +fi + + + + # Early implementations provided only a GLES/egl.h while Khronos's + # implementer guide now states EGL/egl.h is the One. Some + # implementations keep a GLES/egl.h wrapper around EGL/egl.h for + # backward compatibility while others provide EGL/egl.h only. + for ac_header in GLES/egl.h EGL/egl.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + if test "x$ac_cv_header_GLES_egl_h" = "xyes"; then : + COGL_EGL_INCLUDES="#include " +elif test "x$ac_cv_header_EGL_egl_h" = "xyes"; then : + + COGL_EGL_INCLUDES="#include " + +else + as_fn_error $? "Unable to locate EGL header" "$LINENO" 5 +fi + + + for ac_header in EGL/eglext.h +do : + ac_fn_c_check_header_compile "$LINENO" "EGL/eglext.h" "ac_cv_header_EGL_eglext_h" "$COGL_EGL_INCLUDES +" +if test "x$ac_cv_header_EGL_eglext_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EGL_EGLEXT_H 1 +_ACEOF + COGL_EGL_INCLUDES="$COGL_EGL_INCLUDE +#include " +fi + +done + + + # Check for a GLES 1.x Common Profile library with/without EGL. + # + # Note: historically GLES 1 libraries shipped with the + # EGL and GLES symbols all bundled in one library. Now + # the Khronos Implementers Guide defines two naming + # schemes: -lGLES_CM should be used for a library that + # bundles the GLES and EGL API together and -lGLESv1_CM + # would be used for a standalone GLES API. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eglInitialize in -lGLES_CM" >&5 +$as_echo_n "checking for eglInitialize in -lGLES_CM... " >&6; } +if ${ac_cv_lib_GLES_CM_eglInitialize+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGLES_CM $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char eglInitialize (); +int +main () +{ +return eglInitialize (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GLES_CM_eglInitialize=yes +else + ac_cv_lib_GLES_CM_eglInitialize=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLES_CM_eglInitialize" >&5 +$as_echo "$ac_cv_lib_GLES_CM_eglInitialize" >&6; } +if test "x$ac_cv_lib_GLES_CM_eglInitialize" = xyes; then : + COGL_GLES1_LIBNAME="libGLES_CM.so" +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glFlush in -lGLESv1_CM" >&5 +$as_echo_n "checking for glFlush in -lGLESv1_CM... " >&6; } +if ${ac_cv_lib_GLESv1_CM_glFlush+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGLESv1_CM $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glFlush (); +int +main () +{ +return glFlush (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GLESv1_CM_glFlush=yes +else + ac_cv_lib_GLESv1_CM_glFlush=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLESv1_CM_glFlush" >&5 +$as_echo "$ac_cv_lib_GLESv1_CM_glFlush" >&6; } +if test "x$ac_cv_lib_GLESv1_CM_glFlush" = xyes; then : + COGL_GLES1_LIBNAME="libGLESv1_CM.so" + NEED_SEPARATE_EGL=yes + +else + as_fn_error $? "Unable to locate required GLES 1.x Common Profile library" "$LINENO" 5 +fi + + +fi + + + EGL_CHECKED=yes + +fi + +fi + +HAVE_GLES2=0 +# Check whether --enable-gles2 was given. +if test "${enable_gles2+set}" = set; then : + enableval=$enable_gles2; +else + enable_gles2=no + +fi + +if test "x$enable_gles2" = "xyes"; then : + + if test "x$platform_win32" = "xyes"; then : + as_fn_error $? "GLES 2 not available for win32" "$LINENO" 5 +fi + + enabled_drivers="$enabled_drivers gles2" + + cogl_gl_headers="GLES2/gl2.h GLES2/gl2ext.h" + +$as_echo "#define HAVE_COGL_GLES2 1" >>confdefs.h + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES2" + HAVE_GLES2=1 + + if test "x$enable_emscripten" = "xyes"; then : + + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GLES2_LIBNAME="" + +$as_echo "#define HAVE_COGL_WEBGL 1" >>confdefs.h + + +else + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glesv2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glesv2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv2" + COGL_GLES2_LIBNAME="libGLESv2.so" + +else + + # We have to check the two headers independently as GLES2/gl2ext.h + # needs to include GLES2/gl2.h to have the GL types defined (eg. + # GLenum). + ac_fn_c_check_header_mongrel "$LINENO" "GLES2/gl2.h" "ac_cv_header_GLES2_gl2_h" "$ac_includes_default" +if test "x$ac_cv_header_GLES2_gl2_h" = xyes; then : + +else + as_fn_error $? "Unable to locate GLES2/gl2.h" "$LINENO" 5 +fi + + + ac_fn_c_check_header_compile "$LINENO" "GLES2/gl2ext.h" "ac_cv_header_GLES2_gl2ext_h" "#include +" +if test "x$ac_cv_header_GLES2_gl2ext_h" = xyes; then : + +else + as_fn_error $? "Unable to locate GLES2/gl2ext.h" "$LINENO" 5 +fi + + + + COGL_GLES2_LIBNAME="libGLESv2.so" + +fi + +fi + +fi + +HAVE_GL=0 +# Check whether --enable-gl was given. +if test "${enable_gl+set}" = set; then : + enableval=$enable_gl; +else + enable_gl=yes + +fi + +if test "x$enable_gl" = "xyes"; then : + + enabled_drivers="$enabled_drivers gl" + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + ALLOW_GLX=yes +fi + + cogl_gl_headers="GL/gl.h" + + if test "x$platform_quartz" = "xyes"; then : + + cogl_gl_headers="OpenGL/gl.h" + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -framework OpenGL" + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GL_LIBNAME="" + +elif test "x$platform_win32" = "xyes"; then : + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lopengl32 -lgdi32 -lwinmm" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -D_WIN32_WINNT=0x0500" + ALLOW_WGL=yes + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GL_LIBNAME="" + +else + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL gl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glGetString in -lGL" >&5 +$as_echo_n "checking for glGetString in -lGL... " >&6; } +if ${ac_cv_lib_GL_glGetString+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGL $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glGetString (); +int +main () +{ +return glGetString (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GL_glGetString=yes +else + ac_cv_lib_GL_glGetString=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glGetString" >&5 +$as_echo "$ac_cv_lib_GL_glGetString" >&6; } +if test "x$ac_cv_lib_GL_glGetString" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGL 1 +_ACEOF + + LIBS="-lGL $LIBS" + +else + as_fn_error $? "Unable to locate required GL library" "$LINENO" 5 +fi + + +fi + COGL_GL_LIBNAME="libGL.so.1" + +fi + + +$as_echo "#define HAVE_COGL_GL 1" >>confdefs.h + + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GL" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GL" + HAVE_GL=1 + +fi + + if test "x$enable_gl" = "xyes"; then + COGL_DRIVER_GL_SUPPORTED_TRUE= + COGL_DRIVER_GL_SUPPORTED_FALSE='#' +else + COGL_DRIVER_GL_SUPPORTED_TRUE='#' + COGL_DRIVER_GL_SUPPORTED_FALSE= +fi + + if test "x$enable_gles1" = "xyes" || test "x$enable_gles2" = "xyes"; then + COGL_DRIVER_GLES_SUPPORTED_TRUE= + COGL_DRIVER_GLES_SUPPORTED_FALSE='#' +else + COGL_DRIVER_GLES_SUPPORTED_TRUE='#' + COGL_DRIVER_GLES_SUPPORTED_FALSE= +fi + + + +# Check whether --with-gl-libname was given. +if test "${with_gl_libname+set}" = set; then : + withval=$with_gl_libname; COGL_GL_LIBNAME="$withval" +fi + + +# Check whether --with-gles1-libname was given. +if test "${with_gles1_libname+set}" = set; then : + withval=$with_gles1_libname; COGL_GLES1_LIBNAME="$withval" +fi + + +# Check whether --with-gles2-libname was given. +if test "${with_gles2_libname+set}" = set; then : + withval=$with_gles2_libname; COGL_GLES2_LIBNAME="$withval" +fi + + +# Check whether --with-default-driver was given. +if test "${with_default_driver+set}" = set; then : + withval=$with_default_driver; COGL_DEFAULT_DRIVER="${withval}" +else + COGL_DEFAULT_DRIVER="" +fi + + + if test "x$COGL_DEFAULT_DRIVER" != "x" ; then + HAVE_COGL_DEFAULT_DRIVER_TRUE= + HAVE_COGL_DEFAULT_DRIVER_FALSE='#' +else + HAVE_COGL_DEFAULT_DRIVER_TRUE='#' + HAVE_COGL_DEFAULT_DRIVER_FALSE= +fi + + + + + + + + + + + +if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then + +$as_echo "#define HAVE_DIRECTLY_LINKED_GL_LIBRARY 1" >>confdefs.h + +fi + +# Check whether --enable-cogl-gles2 was given. +if test "${enable_cogl_gles2+set}" = set; then : + enableval=$enable_cogl_gles2; +else + + if test "x$HAVE_GLES2" = "x1"; then : + enable_cogl_gles2=yes +else + enable_cogl_gles2=no +fi + + +fi + +if test "x$enable_cogl_gles2" = "xyes"; then : + + if test "x$HAVE_GLES2" != "x1"; then : + + as_fn_error $? "libcogl-gles2 is currently only supported on systems with a native GLES 2.0 library" "$LINENO" 5 + +fi + +fi + if test "x$enable_cogl_gles2" = "xyes"; then + BUILD_COGL_GLES2_TRUE= + BUILD_COGL_GLES2_FALSE='#' +else + BUILD_COGL_GLES2_TRUE='#' + BUILD_COGL_GLES2_FALSE= +fi + + + + +# Check whether --enable-glx was given. +if test "${enable_glx+set}" = set; then : + enableval=$enable_glx; +else + if test "x$ALLOW_GLX" = "xyes"; then : + enable_glx=yes +else + enable_glx=no +fi + +fi + +if test "x$enable_glx" = "xyes"; then : + + if test "x$ALLOW_GLX" != "xyes"; then : + as_fn_error $? "GLX not supported with this configuration" "$LINENO" 5 +fi + + NEED_XLIB=yes + SUPPORT_GLX=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS glx" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLX_SUPPORT" + +fi + if test "x$SUPPORT_GLX" = "xyes"; then + SUPPORT_GLX_TRUE= + SUPPORT_GLX_FALSE='#' +else + SUPPORT_GLX_TRUE='#' + SUPPORT_GLX_FALSE= +fi + + +# Check whether --enable-wgl was given. +if test "${enable_wgl+set}" = set; then : + enableval=$enable_wgl; +else + if test "x$ALLOW_WGL" = "xyes"; then : + enable_wgl=yes +else + enable_wgl=no +fi + +fi + +if test "x$enable_wgl" = "xyes"; then : + + if test "x$ALLOW_WGL" != "xyes"; then : + as_fn_error $? "WGL not supported with this configuration" "$LINENO" 5 +fi + + SUPPORT_WGL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS wgl" + + +$as_echo "#define COGL_HAS_WGL_SUPPORT 1" >>confdefs.h + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_WIN32_SUPPORT" + +fi + if test "x$SUPPORT_WGL" = "xyes"; then + SUPPORT_WGL_TRUE= + SUPPORT_WGL_FALSE='#' +else + SUPPORT_WGL_TRUE='#' + SUPPORT_WGL_FALSE= +fi + + +# Check whether --enable-sdl was given. +if test "${enable_sdl+set}" = set; then : + enableval=$enable_sdl; +else + enable_sdl=no +fi + +if test "x$enable_sdl" = "xyes"; then : + + if test "x$enable_emscripten" = "xno"; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL" >&5 +$as_echo_n "checking for SDL... " >&6; } + +if test -n "$SDL_CFLAGS"; then + pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SDL_LIBS"; then + pkg_cv_SDL_LIBS="$SDL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl" 2>&1` + else + SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SDL_PKG_ERRORS" >&5 + + + ac_fn_c_check_header_mongrel "$LINENO" "SDL/SDL.h" "ac_cv_header_SDL_SDL_h" "$ac_includes_default" +if test "x$ac_cv_header_SDL_SDL_h" = xyes; then : + +else + as_fn_error $? "SDL support requested but SDL not found" "$LINENO" 5 +fi + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + ac_fn_c_check_header_mongrel "$LINENO" "SDL/SDL.h" "ac_cv_header_SDL_SDL_h" "$ac_includes_default" +if test "x$ac_cv_header_SDL_SDL_h" = xyes; then : + +else + as_fn_error $? "SDL support requested but SDL not found" "$LINENO" 5 +fi + + + +else + SDL_CFLAGS=$pkg_cv_SDL_CFLAGS + SDL_LIBS=$pkg_cv_SDL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl" + +fi + +fi + + SUPPORT_SDL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + + if test "x$enable_emscripten" = "xyes"; then : + + SUPPORTED_SDL_GL_APIS="webgl" + SUPPORT_SDL_WEBGL=yes + SUPPORT_SDL_GLES=no + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_WEBGL_SUPPORT" + +else + + cogl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" + ac_fn_c_check_decl "$LINENO" "SDL_OPENGLES" "ac_cv_have_decl_SDL_OPENGLES" "#include +" +if test "x$ac_cv_have_decl_SDL_OPENGLES" = xyes; then : + SUPPORT_SDL_GLES=yes +else + SUPPORT_SDL_GLES=no +fi + + ac_fn_c_check_decl "$LINENO" "SDL_GL_CONTEXT_MAJOR_VERSION" "ac_cv_have_decl_SDL_GL_CONTEXT_MAJOR_VERSION" "#include +" +if test "x$ac_cv_have_decl_SDL_GL_CONTEXT_MAJOR_VERSION" = xyes; then : + +else + SUPPORT_SDL_GLES=no +fi + + ac_fn_c_check_decl "$LINENO" "SDL_GL_CONTEXT_MINOR_VERSION" "ac_cv_have_decl_SDL_GL_CONTEXT_MINOR_VERSION" "#include +" +if test "x$ac_cv_have_decl_SDL_GL_CONTEXT_MINOR_VERSION" = xyes; then : + +else + SUPPORT_SDL_GLES=no +fi + + CPPFLAGS="$cogl_save_CPPFLAGS" + + if test "x$SUPPORT_SDL_GLES" = "xyes"; then : + + SUPPORTED_SDL_GL_APIS="gles1 gles2" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_GLES_SUPPORT" + +else + SUPPORTED_SDL_GL_APIS="gl" +fi + +fi + +else + SUPPORT_SDL=no +fi + if test "x$SUPPORT_SDL" = "xyes"; then + SUPPORT_SDL_TRUE= + SUPPORT_SDL_FALSE='#' +else + SUPPORT_SDL_TRUE='#' + SUPPORT_SDL_FALSE= +fi + + +# Check whether --enable-sdl2 was given. +if test "${enable_sdl2+set}" = set; then : + enableval=$enable_sdl2; +else + enable_sdl2=no +fi + +if test "x$enable_sdl2" = "xyes"; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL2" >&5 +$as_echo_n "checking for SDL2... " >&6; } + +if test -n "$SDL2_CFLAGS"; then + pkg_cv_SDL2_CFLAGS="$SDL2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SDL2_CFLAGS=`$PKG_CONFIG --cflags "sdl2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SDL2_LIBS"; then + pkg_cv_SDL2_LIBS="$SDL2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sdl2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SDL2_LIBS=`$PKG_CONFIG --libs "sdl2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SDL2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl2" 2>&1` + else + SDL2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SDL2_PKG_ERRORS" >&5 + + as_fn_error $? "SDL2 support requested but SDL2 not found" "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "SDL2 support requested but SDL2 not found" "$LINENO" 5 +else + SDL2_CFLAGS=$pkg_cv_SDL2_CFLAGS + SDL2_LIBS=$pkg_cv_SDL2_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + SUPPORT_SDL2=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl2" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl2" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + +else + SUPPORT_SDL2=no +fi + if test "x$SUPPORT_SDL2" = "xyes"; then + SUPPORT_SDL2_TRUE= + SUPPORT_SDL2_FALSE='#' +else + SUPPORT_SDL2_TRUE='#' + SUPPORT_SDL2_FALSE= +fi + + +if test "x$SUPPORT_SDL2" = "xyes" -a "x$SUPPORT_SDL" = "xyes"; then : + as_fn_error $? "The SDL1 and SDL2 winsyses are currently mutually exclusive" "$LINENO" 5 +fi + +EGL_PLATFORM_COUNT=0 + +# Check whether --enable-null-egl-platform was given. +if test "${enable_null_egl_platform+set}" = set; then : + enableval=$enable_null_egl_platform; +else + enable_null_egl_platform=no + +fi + +if test "x$enable_null_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS null" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT" + +fi + if test "x$enable_null_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE= + SUPPORT_EGL_PLATFORM_POWERVR_NULL_FALSE='#' +else + SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE='#' + SUPPORT_EGL_PLATFORM_POWERVR_NULL_FALSE= +fi + + +# Check whether --enable-gdl-egl-platform was given. +if test "${enable_gdl_egl_platform+set}" = set; then : + enableval=$enable_gdl_egl_platform; +else + enable_gdl_egl_platform=no + +fi + +if test "x$enable_gdl_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS gdl" + + for ac_header in libgdl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libgdl.h" "ac_cv_header_libgdl_h" "$ac_includes_default" +if test "x$ac_cv_header_libgdl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGDL_H 1 +_ACEOF + +else + + for ac_header in CE4100/libgdl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "CE4100/libgdl.h" "ac_cv_header_CE4100_libgdl_h" "$ac_includes_default" +if test "x$ac_cv_header_CE4100_libgdl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CE4100_LIBGDL_H 1 +_ACEOF + + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I/usr/include/CE4100" + +else + as_fn_error $? "libgdl.h not found" "$LINENO" 5 +fi + +done + + +fi + +done + + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lgdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_GDL_SUPPORT" + +fi + if test "x$enable_gdl_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_GDL_TRUE= + SUPPORT_EGL_PLATFORM_GDL_FALSE='#' +else + SUPPORT_EGL_PLATFORM_GDL_TRUE='#' + SUPPORT_EGL_PLATFORM_GDL_FALSE= +fi + + +# Check whether --enable-wayland-egl-platform was given. +if test "${enable_wayland_egl_platform+set}" = set; then : + enableval=$enable_wayland_egl_platform; +else + enable_wayland_egl_platform=no + +fi + +if test "x$enable_wayland_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS wayland" + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WAYLAND_CLIENT" >&5 +$as_echo_n "checking for WAYLAND_CLIENT... " >&6; } + +if test -n "$WAYLAND_CLIENT_CFLAGS"; then + pkg_cv_WAYLAND_CLIENT_CFLAGS="$WAYLAND_CLIENT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-egl >= 1.0.0 wayland-client >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-egl >= 1.0.0 wayland-client >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WAYLAND_CLIENT_CFLAGS=`$PKG_CONFIG --cflags "wayland-egl >= 1.0.0 wayland-client >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$WAYLAND_CLIENT_LIBS"; then + pkg_cv_WAYLAND_CLIENT_LIBS="$WAYLAND_CLIENT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-egl >= 1.0.0 wayland-client >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-egl >= 1.0.0 wayland-client >= 1.0.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WAYLAND_CLIENT_LIBS=`$PKG_CONFIG --libs "wayland-egl >= 1.0.0 wayland-client >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + WAYLAND_CLIENT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "wayland-egl >= 1.0.0 wayland-client >= 1.0.0" 2>&1` + else + WAYLAND_CLIENT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "wayland-egl >= 1.0.0 wayland-client >= 1.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$WAYLAND_CLIENT_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (wayland-egl >= 1.0.0 wayland-client >= 1.0.0) were not met: + +$WAYLAND_CLIENT_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables WAYLAND_CLIENT_CFLAGS +and WAYLAND_CLIENT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables WAYLAND_CLIENT_CFLAGS +and WAYLAND_CLIENT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + WAYLAND_CLIENT_CFLAGS=$pkg_cv_WAYLAND_CLIENT_CFLAGS + WAYLAND_CLIENT_LIBS=$pkg_cv_WAYLAND_CLIENT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-egl >= 1.0.0" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-client >= 1.0.0" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT" + +fi + if test "x$enable_wayland_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_WAYLAND_TRUE= + SUPPORT_EGL_PLATFORM_WAYLAND_FALSE='#' +else + SUPPORT_EGL_PLATFORM_WAYLAND_TRUE='#' + SUPPORT_EGL_PLATFORM_WAYLAND_FALSE= +fi + + + +# Check whether --enable-kms-egl-platform was given. +if test "${enable_kms_egl_platform+set}" = set; then : + enableval=$enable_kms_egl_platform; +else + enable_kms_egl_platform=no + +fi + +if test "x$enable_kms_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS kms" + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gbm") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gbm" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES libdrm" + +else + as_fn_error $? "Unable to locate required libgbm library for the KMS egl platform" "$LINENO" 5 +fi + + GBM_VERSION=`$PKG_CONFIG --modversion gbm` + GBM_MAJOR=`echo $GBM_VERSION | cut -d'.' -f1` + GBM_MINOR=`echo $GBM_VERSION | cut -d'.' -f2` + GBM_MICRO=`echo $GBM_VERSION | cut -d'.' -f3 | sed 's/-.*//'` + + +cat >>confdefs.h <<_ACEOF +#define COGL_GBM_MAJOR $GBM_MAJOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define COGL_GBM_MINOR $GBM_MINOR +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define COGL_GBM_MICRO $GBM_MICRO +_ACEOF + + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_KMS_SUPPORT" + +fi + if test "x$enable_kms_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_KMS_TRUE= + SUPPORT_EGL_PLATFORM_KMS_FALSE='#' +else + SUPPORT_EGL_PLATFORM_KMS_TRUE='#' + SUPPORT_EGL_PLATFORM_KMS_FALSE= +fi + + +# Check whether --enable-wayland-egl-server was given. +if test "${enable_wayland_egl_server+set}" = set; then : + enableval=$enable_wayland_egl_server; +else + enable_wayland_egl_server=no + +fi + +if test "x$enable_wayland_egl_server" = "xyes"; then : + + NEED_EGL=yes + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WAYLAND_SERVER" >&5 +$as_echo_n "checking for WAYLAND_SERVER... " >&6; } + +if test -n "$WAYLAND_SERVER_CFLAGS"; then + pkg_cv_WAYLAND_SERVER_CFLAGS="$WAYLAND_SERVER_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-server >= 1.1.90\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-server >= 1.1.90") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WAYLAND_SERVER_CFLAGS=`$PKG_CONFIG --cflags "wayland-server >= 1.1.90" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$WAYLAND_SERVER_LIBS"; then + pkg_cv_WAYLAND_SERVER_LIBS="$WAYLAND_SERVER_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-server >= 1.1.90\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-server >= 1.1.90") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WAYLAND_SERVER_LIBS=`$PKG_CONFIG --libs "wayland-server >= 1.1.90" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + WAYLAND_SERVER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "wayland-server >= 1.1.90" 2>&1` + else + WAYLAND_SERVER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "wayland-server >= 1.1.90" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$WAYLAND_SERVER_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (wayland-server >= 1.1.90) were not met: + +$WAYLAND_SERVER_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables WAYLAND_SERVER_CFLAGS +and WAYLAND_SERVER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables WAYLAND_SERVER_CFLAGS +and WAYLAND_SERVER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + WAYLAND_SERVER_CFLAGS=$pkg_cv_WAYLAND_SERVER_CFLAGS + WAYLAND_SERVER_LIBS=$pkg_cv_WAYLAND_SERVER_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-server >= 1.1.90" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT" + +fi + if test "x$enable_wayland_egl_server" = "xyes"; then + SUPPORT_WAYLAND_EGL_SERVER_TRUE= + SUPPORT_WAYLAND_EGL_SERVER_FALSE='#' +else + SUPPORT_WAYLAND_EGL_SERVER_TRUE='#' + SUPPORT_WAYLAND_EGL_SERVER_FALSE= +fi + + +# Check whether --enable-android-egl-platform was given. +if test "${enable_android_egl_platform+set}" = set; then : + enableval=$enable_android_egl_platform; +else + enable_android_egl_platform=no + +fi + +if test "x$enable_android_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS android" + + ac_fn_c_check_header_mongrel "$LINENO" "android/native_window.h" "ac_cv_header_android_native_window_h" "$ac_includes_default" +if test "x$ac_cv_header_android_native_window_h" = xyes; then : + +else + as_fn_error $? "Unable to locate android/native_window.h" "$LINENO" 5 +fi + + + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT" + +fi + if test "x$enable_android_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_ANDROID_TRUE= + SUPPORT_EGL_PLATFORM_ANDROID_FALSE='#' +else + SUPPORT_EGL_PLATFORM_ANDROID_TRUE='#' + SUPPORT_EGL_PLATFORM_ANDROID_FALSE= +fi + + +# Check whether --enable-xlib-egl-platform was given. +if test "${enable_xlib_egl_platform+set}" = set; then : + enableval=$enable_xlib_egl_platform; +else + if test "x$enable_gles1" = "xyes" -o \ + "x$enable_gles2" = "xyes" && \ + test "x$SUPPORT_SDL_GLES" != "xyes" && \ + test "x$SUPPORT_SDL_WEBGL" != "xyes" && \ + test "x$SUPPORT_SDL2" != "xyes" && \ + test $EGL_PLATFORM_COUNT -eq 0; then : + enable_xlib_egl_platform=yes +else + enable_xlib_egl_platform=no +fi + +fi + +if test "x$enable_xlib_egl_platform" = "xyes"; then : + + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + NEED_XLIB=yes + EGL_PLATFORMS="$EGL_PLATFORMS xlib" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT" + +fi + if test "x$enable_xlib_egl_platform" = "xyes"; then + SUPPORT_EGL_PLATFORM_XLIB_TRUE= + SUPPORT_EGL_PLATFORM_XLIB_FALSE='#' +else + SUPPORT_EGL_PLATFORM_XLIB_TRUE='#' + SUPPORT_EGL_PLATFORM_XLIB_FALSE= +fi + + +if test "x$NEED_EGL" = "xyes" && test "x$EGL_CHECKED" != "xyes"; then : + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"egl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "egl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES egl" +else + + for ac_header in EGL/egl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "EGL/egl.h" "ac_cv_header_EGL_egl_h" "$ac_includes_default" +if test "x$ac_cv_header_EGL_egl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EGL_EGL_H 1 +_ACEOF + +else + as_fn_error $? "Unable to locate required EGL headers" "$LINENO" 5 +fi + +done + + for ac_header in EGL/eglext.h +do : + ac_fn_c_check_header_compile "$LINENO" "EGL/eglext.h" "ac_cv_header_EGL_eglext_h" "#include +" +if test "x$ac_cv_header_EGL_eglext_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EGL_EGLEXT_H 1 +_ACEOF + +else + as_fn_error $? "Unable to locate required EGL headers" "$LINENO" 5 +fi + +done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eglInitialize in -lEGL" >&5 +$as_echo_n "checking for eglInitialize in -lEGL... " >&6; } +if ${ac_cv_lib_EGL_eglInitialize+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lEGL $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char eglInitialize (); +int +main () +{ +return eglInitialize (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_EGL_eglInitialize=yes +else + ac_cv_lib_EGL_eglInitialize=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_EGL_eglInitialize" >&5 +$as_echo "$ac_cv_lib_EGL_eglInitialize" >&6; } +if test "x$ac_cv_lib_EGL_eglInitialize" = xyes; then : + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lEGL" +else + as_fn_error $? "Unable to locate required EGL library" "$LINENO" 5 +fi + + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lEGL" + + +fi + + COGL_EGL_INCLUDES="#include +#include " + + +fi + +if test "x$NEED_EGL" = "xyes"; then : + + SUPPORT_EGL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS egl" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_SUPPORT" + +fi + + if test "x$SUPPORT_EGL" = "xyes"; then + SUPPORT_EGL_TRUE= + SUPPORT_EGL_FALSE='#' +else + SUPPORT_EGL_TRUE='#' + SUPPORT_EGL_FALSE= +fi + + +if test "x$NEED_XLIB" = "xyes"; then : + + X11_MODULES="x11 xext xfixes >= 3 xdamage xcomposite >= 0.4 xrandr >= 1.2" + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DUMMY" >&5 +$as_echo_n "checking for DUMMY... " >&6; } + +if test -n "$DUMMY_CFLAGS"; then + pkg_cv_DUMMY_CFLAGS="$DUMMY_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$X11_MODULES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$X11_MODULES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DUMMY_CFLAGS=`$PKG_CONFIG --cflags "$X11_MODULES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$DUMMY_LIBS"; then + pkg_cv_DUMMY_LIBS="$DUMMY_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$X11_MODULES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$X11_MODULES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DUMMY_LIBS=`$PKG_CONFIG --libs "$X11_MODULES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + DUMMY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$X11_MODULES" 2>&1` + else + DUMMY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$X11_MODULES" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$DUMMY_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($X11_MODULES) were not met: + +$DUMMY_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables DUMMY_CFLAGS +and DUMMY_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables DUMMY_CFLAGS +and DUMMY_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + DUMMY_CFLAGS=$pkg_cv_DUMMY_CFLAGS + DUMMY_LIBS=$pkg_cv_DUMMY_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES $X11_MODULES" +fi + SUPPORT_X11=yes + SUPPORT_XLIB=yes + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11_SUPPORT" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB_SUPPORT" + +fi + + if test "x$SUPPORT_X11" = "xyes"; then + X11_TESTS_TRUE= + X11_TESTS_FALSE='#' +else + X11_TESTS_TRUE='#' + X11_TESTS_FALSE= +fi + + if test "x$SUPPORT_X11" = "xyes"; then + SUPPORT_X11_TRUE= + SUPPORT_X11_FALSE='#' +else + SUPPORT_X11_TRUE='#' + SUPPORT_X11_FALSE= +fi + + if test "x$SUPPORT_XLIB" = "xyes"; then + SUPPORT_XLIB_TRUE= + SUPPORT_XLIB_FALSE='#' +else + SUPPORT_XLIB_TRUE='#' + SUPPORT_XLIB_FALSE= +fi + + +# gtkdocize greps for ^GTK_DOC_CHECK and parses it, so you need to have +# it on it's own line. + + + + + # Extract the first word of "gtkdoc-check", so it can be a program name with args. +set dummy gtkdoc-check; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GTKDOC_CHECK+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GTKDOC_CHECK in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTKDOC_CHECK="$GTKDOC_CHECK" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTKDOC_CHECK="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GTKDOC_CHECK=$ac_cv_path_GTKDOC_CHECK +if test -n "$GTKDOC_CHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_CHECK" >&5 +$as_echo "$GTKDOC_CHECK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + for ac_prog in gtkdoc-rebase +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GTKDOC_REBASE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GTKDOC_REBASE in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTKDOC_REBASE="$GTKDOC_REBASE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTKDOC_REBASE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GTKDOC_REBASE=$ac_cv_path_GTKDOC_REBASE +if test -n "$GTKDOC_REBASE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_REBASE" >&5 +$as_echo "$GTKDOC_REBASE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$GTKDOC_REBASE" && break +done +test -n "$GTKDOC_REBASE" || GTKDOC_REBASE="true" + + # Extract the first word of "gtkdoc-mkpdf", so it can be a program name with args. +set dummy gtkdoc-mkpdf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GTKDOC_MKPDF+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GTKDOC_MKPDF in + [\\/]* | ?:[\\/]*) + ac_cv_path_GTKDOC_MKPDF="$GTKDOC_MKPDF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GTKDOC_MKPDF="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GTKDOC_MKPDF=$ac_cv_path_GTKDOC_MKPDF +if test -n "$GTKDOC_MKPDF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTKDOC_MKPDF" >&5 +$as_echo "$GTKDOC_MKPDF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + +# Check whether --with-html-dir was given. +if test "${with_html_dir+set}" = set; then : + withval=$with_html_dir; +else + with_html_dir='${datadir}/gtk-doc/html' +fi + + HTML_DIR="$with_html_dir" + + + # Check whether --enable-gtk-doc was given. +if test "${enable_gtk_doc+set}" = set; then : + enableval=$enable_gtk_doc; +else + enable_gtk_doc=no +fi + + + if test x$enable_gtk_doc = xyes; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-doc >= 1.13\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk-doc >= 1.13") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + : +else + as_fn_error $? "You need to have gtk-doc >= 1.13 installed to build $PACKAGE_NAME" "$LINENO" 5 +fi + if test "x$PACKAGE_NAME" != "xglib"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTKDOC_DEPS" >&5 +$as_echo_n "checking for GTKDOC_DEPS... " >&6; } + +if test -n "$GTKDOC_DEPS_CFLAGS"; then + pkg_cv_GTKDOC_DEPS_CFLAGS="$GTKDOC_DEPS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTKDOC_DEPS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GTKDOC_DEPS_LIBS"; then + pkg_cv_GTKDOC_DEPS_LIBS="$GTKDOC_DEPS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTKDOC_DEPS_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + else + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTKDOC_DEPS_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + GTKDOC_DEPS_CFLAGS=$pkg_cv_GTKDOC_DEPS_CFLAGS + GTKDOC_DEPS_LIBS=$pkg_cv_GTKDOC_DEPS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build gtk-doc documentation" >&5 +$as_echo_n "checking whether to build gtk-doc documentation... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk_doc" >&5 +$as_echo "$enable_gtk_doc" >&6; } + + # Check whether --enable-gtk-doc-html was given. +if test "${enable_gtk_doc_html+set}" = set; then : + enableval=$enable_gtk_doc_html; +else + enable_gtk_doc_html=yes +fi + + # Check whether --enable-gtk-doc-pdf was given. +if test "${enable_gtk_doc_pdf+set}" = set; then : + enableval=$enable_gtk_doc_pdf; +else + enable_gtk_doc_pdf=no +fi + + + if test -z "$GTKDOC_MKPDF"; then + enable_gtk_doc_pdf=no + fi + + if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 + fi + + + if test x$enable_gtk_doc = xyes; then + ENABLE_GTK_DOC_TRUE= + ENABLE_GTK_DOC_FALSE='#' +else + ENABLE_GTK_DOC_TRUE='#' + ENABLE_GTK_DOC_FALSE= +fi + + if test x$enable_gtk_doc_html = xyes; then + GTK_DOC_BUILD_HTML_TRUE= + GTK_DOC_BUILD_HTML_FALSE='#' +else + GTK_DOC_BUILD_HTML_TRUE='#' + GTK_DOC_BUILD_HTML_FALSE= +fi + + if test x$enable_gtk_doc_pdf = xyes; then + GTK_DOC_BUILD_PDF_TRUE= + GTK_DOC_BUILD_PDF_FALSE='#' +else + GTK_DOC_BUILD_PDF_TRUE='#' + GTK_DOC_BUILD_PDF_FALSE= +fi + + if test -n "$LIBTOOL"; then + GTK_DOC_USE_LIBTOOL_TRUE= + GTK_DOC_USE_LIBTOOL_FALSE='#' +else + GTK_DOC_USE_LIBTOOL_TRUE='#' + GTK_DOC_USE_LIBTOOL_FALSE= +fi + + if test -n "$GTKDOC_REBASE"; then + GTK_DOC_USE_REBASE_TRUE= + GTK_DOC_USE_REBASE_FALSE='#' +else + GTK_DOC_USE_REBASE_TRUE='#' + GTK_DOC_USE_REBASE_FALSE= +fi + + + + if test "x$enable_gtk_doc" = "xyes"; then + BUILD_GTK_DOC_TRUE= + BUILD_GTK_DOC_FALSE='#' +else + BUILD_GTK_DOC_TRUE='#' + BUILD_GTK_DOC_FALSE= +fi + + +GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" +GDKPIXBUF_PREFIX="`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`" + + + + + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.17 + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 +$as_echo_n "checking for ld used by GCC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${acl_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${acl_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if ${acl_cv_rpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + + acl_libdirstem=lib + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBICONV_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if eval \${$gt_func_gnugettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libc=yes" +else + eval "$gt_func_gnugettext_libc=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if ${am_cv_func_iconv_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +else + am_cv_func_iconv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then : + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + LIBINTL_PREFIX="$basedir" + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if eval \${$gt_func_gnugettext_libintl+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libintl=yes" +else + eval "$gt_func_gnugettext_libintl=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + +$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + +GETTEXT_PACKAGE="cogl" + + +cat >>confdefs.h <<_ACEOF +#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linguas" >&5 +$as_echo_n "checking for linguas... " >&6; } + podir="$srcdir/po" + linguas=`cd $podir && ls *.po 2>/dev/null | awk 'BEGIN { FS="."; ORS=" " } { print $1 }'` + if test -f "$podir/LINGUAS.ignore"; then + ALL_LINGUAS=""; + ignore_linguas=`sed -n -e 's/^\s\+\|\s\+$//g' -e '/^#/b' -e '/\S/!b' \ + -e 's/\s\+/\n/g' -e p "$podir/LINGUAS.ignore"`; + for lang in $linguas; do + if ! echo "$ignore_linguas" | grep -q "^${lang}$"; then + ALL_LINGUAS="$ALL_LINGUAS $lang"; + fi; + done; + else + ALL_LINGUAS="$linguas"; + fi; + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALL_LINGUAS" >&5 +$as_echo "$ALL_LINGUAS" >&6; } + + + + +if test -n "$COGL_PKG_REQUIRES"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COGL_DEP" >&5 +$as_echo_n "checking for COGL_DEP... " >&6; } + +if test -n "$COGL_DEP_CFLAGS"; then + pkg_cv_COGL_DEP_CFLAGS="$COGL_DEP_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_DEP_CFLAGS=`$PKG_CONFIG --cflags "$COGL_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COGL_DEP_LIBS"; then + pkg_cv_COGL_DEP_LIBS="$COGL_DEP_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_DEP_LIBS=`$PKG_CONFIG --libs "$COGL_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COGL_DEP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$COGL_PKG_REQUIRES" 2>&1` + else + COGL_DEP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$COGL_PKG_REQUIRES" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COGL_DEP_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($COGL_PKG_REQUIRES) were not met: + +$COGL_DEP_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COGL_DEP_CFLAGS +and COGL_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COGL_DEP_CFLAGS +and COGL_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COGL_DEP_CFLAGS=$pkg_cv_COGL_DEP_CFLAGS + COGL_DEP_LIBS=$pkg_cv_COGL_DEP_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + if test -n "$COGL_PKG_REQUIRES_GL"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COGL_DEP_GL" >&5 +$as_echo_n "checking for COGL_DEP_GL... " >&6; } + +if test -n "$COGL_DEP_GL_CFLAGS"; then + pkg_cv_COGL_DEP_GL_CFLAGS="$COGL_DEP_GL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PKG_REQUIRES_GL\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PKG_REQUIRES_GL") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_DEP_GL_CFLAGS=`$PKG_CONFIG --cflags "$COGL_PKG_REQUIRES_GL" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COGL_DEP_GL_LIBS"; then + pkg_cv_COGL_DEP_GL_LIBS="$COGL_DEP_GL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PKG_REQUIRES_GL\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PKG_REQUIRES_GL") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_DEP_GL_LIBS=`$PKG_CONFIG --libs "$COGL_PKG_REQUIRES_GL" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COGL_DEP_GL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$COGL_PKG_REQUIRES_GL" 2>&1` + else + COGL_DEP_GL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$COGL_PKG_REQUIRES_GL" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COGL_DEP_GL_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($COGL_PKG_REQUIRES_GL) were not met: + +$COGL_DEP_GL_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COGL_DEP_GL_CFLAGS +and COGL_DEP_GL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COGL_DEP_GL_CFLAGS +and COGL_DEP_GL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COGL_DEP_GL_CFLAGS=$pkg_cv_COGL_DEP_GL_CFLAGS + COGL_DEP_GL_LIBS=$pkg_cv_COGL_DEP_GL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + gl_libs="" + for x in $COGL_DEP_GL_LIBS; do + case $x in #( + -lGL) : + ;; #( + -lGLESv2) : + ;; #( + -lGLESv1_CM) : + ;; #( + *) : + gl_libs="$gl_libs $x" ;; #( + *) : + ;; +esac + done + COGL_DEP_CFLAGS="$COGL_DEP_CFLAGS $COGL_DEP_CFLAGS_GL" + COGL_DEP_LIBS="$COGL_DEP_LIBS $gl_libs" + fi +fi + + +if test "x$enable_cogl_pango" = "xyes"; then : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COGL_PANGO_DEP" >&5 +$as_echo_n "checking for COGL_PANGO_DEP... " >&6; } + +if test -n "$COGL_PANGO_DEP_CFLAGS"; then + pkg_cv_COGL_PANGO_DEP_CFLAGS="$COGL_PANGO_DEP_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PANGO_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PANGO_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_PANGO_DEP_CFLAGS=`$PKG_CONFIG --cflags "$COGL_PANGO_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COGL_PANGO_DEP_LIBS"; then + pkg_cv_COGL_PANGO_DEP_LIBS="$COGL_PANGO_DEP_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_PANGO_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_PANGO_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_PANGO_DEP_LIBS=`$PKG_CONFIG --libs "$COGL_PANGO_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COGL_PANGO_DEP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$COGL_PANGO_PKG_REQUIRES" 2>&1` + else + COGL_PANGO_DEP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$COGL_PANGO_PKG_REQUIRES" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COGL_PANGO_DEP_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($COGL_PANGO_PKG_REQUIRES) were not met: + +$COGL_PANGO_DEP_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COGL_PANGO_DEP_CFLAGS +and COGL_PANGO_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COGL_PANGO_DEP_CFLAGS +and COGL_PANGO_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COGL_PANGO_DEP_CFLAGS=$pkg_cv_COGL_PANGO_DEP_CFLAGS + COGL_PANGO_DEP_LIBS=$pkg_cv_COGL_PANGO_DEP_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +fi + if test "x$enable_cogl_pango" = "xyes"; then + BUILD_COGL_PANGO_TRUE= + BUILD_COGL_PANGO_FALSE='#' +else + BUILD_COGL_PANGO_TRUE='#' + BUILD_COGL_PANGO_FALSE= +fi + + + if test "x$enable_cogl_path" = "xyes"; then + BUILD_COGL_PATH_TRUE= + BUILD_COGL_PATH_FALSE='#' +else + BUILD_COGL_PATH_TRUE='#' + BUILD_COGL_PATH_FALSE= +fi + + + + +if test "x$enable_cogl_gst" = "xyes"; then : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for COGL_GST_DEP" >&5 +$as_echo_n "checking for COGL_GST_DEP... " >&6; } + +if test -n "$COGL_GST_DEP_CFLAGS"; then + pkg_cv_COGL_GST_DEP_CFLAGS="$COGL_GST_DEP_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_GST_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_GST_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_GST_DEP_CFLAGS=`$PKG_CONFIG --cflags "$COGL_GST_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COGL_GST_DEP_LIBS"; then + pkg_cv_COGL_GST_DEP_LIBS="$COGL_GST_DEP_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$COGL_GST_PKG_REQUIRES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$COGL_GST_PKG_REQUIRES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COGL_GST_DEP_LIBS=`$PKG_CONFIG --libs "$COGL_GST_PKG_REQUIRES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COGL_GST_DEP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$COGL_GST_PKG_REQUIRES" 2>&1` + else + COGL_GST_DEP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$COGL_GST_PKG_REQUIRES" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COGL_GST_DEP_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements ($COGL_GST_PKG_REQUIRES) were not met: + +$COGL_GST_DEP_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables COGL_GST_DEP_CFLAGS +and COGL_GST_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables COGL_GST_DEP_CFLAGS +and COGL_GST_DEP_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + COGL_GST_DEP_CFLAGS=$pkg_cv_COGL_GST_DEP_CFLAGS + COGL_GST_DEP_LIBS=$pkg_cv_COGL_GST_DEP_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +fi + if test "x$enable_cogl_gst" = "xyes"; then + BUILD_COGL_GST_TRUE= + BUILD_COGL_GST_FALSE='#' +else + BUILD_COGL_GST_TRUE='#' + BUILD_COGL_GST_FALSE= +fi + + + + + + +if test "x$enable_glib" = "xyes"; then : + + + + + # Check whether --enable-introspection was given. +if test "${enable_introspection+set}" = set; then : + enableval=$enable_introspection; +else + enable_introspection=auto +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5 +$as_echo_n "checking for gobject-introspection... " >&6; } + + case $enable_introspection in #( + no) : + found_introspection="no (disabled, use --enable-introspection to enable)" + ;; #( + yes) : + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + : +else + as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5 +fi + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.5") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + found_introspection=yes +else + as_fn_error $? "You need to have gobject-introspection >= 0.9.5 installed to build cogl" "$LINENO" 5 +fi + ;; #( + auto) : + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.5") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + found_introspection=yes +else + found_introspection=no +fi + enable_introspection=$found_introspection + ;; #( + *) : + as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5 +$as_echo "$found_introspection" >&6; } + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + + + + + + + + + + if test "x$found_introspection" = "xyes"; then + HAVE_INTROSPECTION_TRUE= + HAVE_INTROSPECTION_FALSE='#' +else + HAVE_INTROSPECTION_TRUE='#' + HAVE_INTROSPECTION_FALSE= +fi + + + + +else + + enable_introspection="no" + if 0; then + HAVE_INTROSPECTION_TRUE= + HAVE_INTROSPECTION_FALSE='#' +else + HAVE_INTROSPECTION_TRUE='#' + HAVE_INTROSPECTION_FALSE= +fi + + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } + + +# Check whether --with-x was given. +if test "${with_x+set}" = set; then : + withval=$with_x; +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + case $x_includes,$x_libraries in #( + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + $as_echo_n "(cached) " >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -f -r conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + cat >Imakefile <<'_ACEOF' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' +_ACEOF + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib la dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ac_x_includes= ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /usr/lib64 | /lib | /lib64) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -f -r conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Xlib.h. + # First, try using that file with no special directory specified. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # We can compile using X headers with no special include directory. +ac_x_includes= +else + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Xlib.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.i conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lX11 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +XrmInitialize () + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + LIBS=$ac_save_LIBS +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib la dll; do + if test -r "$ac_dir/libX11.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac +fi +;; #( + *) have_x=yes;; + esac + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +for ac_header in fcntl.h limits.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default" +if test "x$ac_cv_header_endian_h" = xyes; then : + ac_fn_c_check_decl "$LINENO" "__FLOAT_WORD_ORDER" "ac_cv_have_decl___FLOAT_WORD_ORDER" "$ac_includes_default" +if test "x$ac_cv_have_decl___FLOAT_WORD_ORDER" = xyes; then : + +$as_echo "#define HAVE_FLOAT_WORD_ORDER 1" >>confdefs.h + +fi + +fi + + + + +if test "x$enable_emscripten" = "xno"; then : + for ac_func in ffs +do : + ac_fn_c_check_func "$LINENO" "ffs" "ac_cv_func_ffs" +if test "x$ac_cv_func_ffs" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FFS 1 +_ACEOF + +fi +done + +fi + +for ac_func in memmem +do : + ac_fn_c_check_func "$LINENO" "memmem" "ac_cv_func_memmem" +if test "x$ac_cv_func_memmem" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMMEM 1 +_ACEOF + +fi +done + + +save_libs="$LIBS" +LIBS="$LIBS $LIBM" +for ac_func in sincos +do : + ac_fn_c_check_func "$LINENO" "sincos" "ac_cv_func_sincos" +if test "x$ac_cv_func_sincos" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SINCOS 1 +_ACEOF + +fi +done + +LIBS="$save_libs" + + +have_poll_h=no +if test "x$enable_emscripten" = "xno"; then : + + ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" +if test "x$ac_cv_header_poll_h" = xyes; then : + + if ac_fn_c_compute_int "$LINENO" "POLLIN" "COGL_SYSDEF_POLLIN" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLIN" "$LINENO" 5 +fi + + if ac_fn_c_compute_int "$LINENO" "POLLPRI" "COGL_SYSDEF_POLLPRI" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLPRI" "$LINENO" 5 +fi + + if ac_fn_c_compute_int "$LINENO" "POLLOUT" "COGL_SYSDEF_POLLOUT" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLOUT" "$LINENO" 5 +fi + + if ac_fn_c_compute_int "$LINENO" "POLLERR" "COGL_SYSDEF_POLLERR" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLERR" "$LINENO" 5 +fi + + if ac_fn_c_compute_int "$LINENO" "POLLHUP" "COGL_SYSDEF_POLLHUP" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLHUP" "$LINENO" 5 +fi + + if ac_fn_c_compute_int "$LINENO" "POLLNVAL" "COGL_SYSDEF_POLLNVAL" "#include "; then : + +else + as_fn_error $? "Unable to get value of POLLNVAL" "$LINENO" 5 +fi + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_POLL_SUPPORT" + have_poll_h=yes + +fi + + + +fi + +if test "x$have_poll_h" = "xno"; then : + + COGL_SYSDEF_POLLIN=1 + COGL_SYSDEF_POLLPRI=2 + COGL_SYSDEF_POLLOUT=4 + COGL_SYSDEF_POLLERR=8 + COGL_SYSDEF_POLLHUP=16 + COGL_SYSDEF_POLLNVAL=32 + +fi + +COGL_DEFINES_EXTRA="$COGL_DEFINES_EXTRA +#define COGL_SYSDEF_POLLIN $COGL_SYSDEF_POLLIN +#define COGL_SYSDEF_POLLPRI $COGL_SYSDEF_POLLPRI +#define COGL_SYSDEF_POLLOUT $COGL_SYSDEF_POLLOUT +#define COGL_SYSDEF_POLLERR $COGL_SYSDEF_POLLERR +#define COGL_SYSDEF_POLLHUP $COGL_SYSDEF_POLLHUP +#define COGL_SYSDEF_POLLNVAL $COGL_SYSDEF_POLLNVAL +" + +COGL_DEFINES="$COGL_DEFINES_EXTRA" +for x in $COGL_DEFINES_SYMBOLS; do + COGL_DEFINES="$COGL_DEFINES +#define $x 1" +done; + + + +if test "x$cogl_gl_headers" = "x"; then : + as_fn_error $? "Internal error: no GL header set" "$LINENO" 5 +fi +COGL_GL_HEADER_INCLUDES="" +for x in $cogl_gl_headers; do + COGL_GL_HEADER_INCLUDES="$COGL_GL_HEADER_INCLUDES +#include <$x>" +done; + + + + +$as_echo "#define COGL_ENABLE_EXPERIMENTAL_2_0_API 1" >>confdefs.h + + +$as_echo "#define COGL_ENABLE_EXPERIMENTAL_API 1" >>confdefs.h + + + + + + + + + + + +# just for compatability with the clutter build... +MAINTAINER_CFLAGS= + + +ac_config_files="$ac_config_files Makefile README config.h.win32 build/Makefile build/win32/Makefile build/win32/vs9/Makefile build/win32/vs10/Makefile deps/Makefile deps/glib/Makefile deps/gmodule/Makefile deps/gmodule/gmoduleconf.h test-fixtures/Makefile cogl/Makefile cogl/cogl-1.0.pc cogl/cogl-2.0-experimental.pc cogl/cogl-defines.h cogl/cogl-defines.h.win32 cogl/cogl-defines.h.win32_SDL cogl/cogl-gl-header.h cogl/cogl-egl-defines.h cogl/cogl.rc cogl-pango/Makefile cogl-pango/cogl-pango-1.0.pc cogl-pango/cogl-pango-2.0-experimental.pc cogl-pango/cogl-pango.rc cogl-path/Makefile cogl-path/cogl-path-1.0.pc cogl-path/cogl-path-2.0-experimental.pc cogl-gst/Makefile cogl-gst/cogl-gst-1.0.pc cogl-gst/cogl-gst-2.0-experimental.pc cogl-gles2/Makefile cogl-gles2/cogl-gles2-1.0.pc cogl-gles2/cogl-gles2-2.0-experimental.pc doc/Makefile doc/reference/Makefile doc/reference/cogl/Makefile doc/reference/cogl/cogl-docs.xml doc/reference/cogl-2.0-experimental/Makefile doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml doc/reference/cogl-gst/Makefile doc/reference/cogl-gst/cogl-gst-docs.xml examples/Makefile tests/Makefile tests/config.env tests/conform/Makefile tests/unit/Makefile tests/micro-perf/Makefile tests/data/Makefile po/Makefile.in" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then + as_fn_error $? "conditional \"OS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${OS_QUARTZ_TRUE}" && test -z "${OS_QUARTZ_FALSE}"; then + as_fn_error $? "conditional \"OS_QUARTZ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_INSTALLED_TESTS_TRUE}" && test -z "${ENABLE_INSTALLED_TESTS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_INSTALLED_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USING_EMSCRIPTEN_TRUE}" && test -z "${USING_EMSCRIPTEN_FALSE}"; then + as_fn_error $? "conditional \"USING_EMSCRIPTEN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${UNIT_TESTS_TRUE}" && test -z "${UNIT_TESTS_FALSE}"; then + as_fn_error $? "conditional \"UNIT_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${PROFILE_TRUE}" && test -z "${PROFILE_FALSE}"; then + as_fn_error $? "conditional \"PROFILE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_GLIB_TRUE}" && test -z "${USE_GLIB_FALSE}"; then + as_fn_error $? "conditional \"USE_GLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${INSTALL_EXAMPLES_TRUE}" && test -z "${INSTALL_EXAMPLES_FALSE}"; then + as_fn_error $? "conditional \"INSTALL_EXAMPLES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${COGL_DRIVER_GL_SUPPORTED_TRUE}" && test -z "${COGL_DRIVER_GL_SUPPORTED_FALSE}"; then + as_fn_error $? "conditional \"COGL_DRIVER_GL_SUPPORTED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${COGL_DRIVER_GLES_SUPPORTED_TRUE}" && test -z "${COGL_DRIVER_GLES_SUPPORTED_FALSE}"; then + as_fn_error $? "conditional \"COGL_DRIVER_GLES_SUPPORTED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_COGL_DEFAULT_DRIVER_TRUE}" && test -z "${HAVE_COGL_DEFAULT_DRIVER_FALSE}"; then + as_fn_error $? "conditional \"HAVE_COGL_DEFAULT_DRIVER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_COGL_GLES2_TRUE}" && test -z "${BUILD_COGL_GLES2_FALSE}"; then + as_fn_error $? "conditional \"BUILD_COGL_GLES2\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_GLX_TRUE}" && test -z "${SUPPORT_GLX_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_GLX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_WGL_TRUE}" && test -z "${SUPPORT_WGL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_WGL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_SDL_TRUE}" && test -z "${SUPPORT_SDL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_SDL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_SDL2_TRUE}" && test -z "${SUPPORT_SDL2_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_SDL2\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_POWERVR_NULL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_POWERVR_NULL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_GDL_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_GDL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_GDL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_WAYLAND_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_WAYLAND_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_WAYLAND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_KMS_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_KMS_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_KMS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_WAYLAND_EGL_SERVER_TRUE}" && test -z "${SUPPORT_WAYLAND_EGL_SERVER_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_WAYLAND_EGL_SERVER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_ANDROID_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_ANDROID_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_ANDROID\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_PLATFORM_XLIB_TRUE}" && test -z "${SUPPORT_EGL_PLATFORM_XLIB_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL_PLATFORM_XLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_EGL_TRUE}" && test -z "${SUPPORT_EGL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_EGL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X11_TESTS_TRUE}" && test -z "${X11_TESTS_FALSE}"; then + as_fn_error $? "conditional \"X11_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_X11_TRUE}" && test -z "${SUPPORT_X11_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_X11\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_XLIB_TRUE}" && test -z "${SUPPORT_XLIB_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_XLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GTK_DOC_BUILD_HTML_TRUE}" && test -z "${GTK_DOC_BUILD_HTML_FALSE}"; then + as_fn_error $? "conditional \"GTK_DOC_BUILD_HTML\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GTK_DOC_BUILD_PDF_TRUE}" && test -z "${GTK_DOC_BUILD_PDF_FALSE}"; then + as_fn_error $? "conditional \"GTK_DOC_BUILD_PDF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GTK_DOC_USE_LIBTOOL_TRUE}" && test -z "${GTK_DOC_USE_LIBTOOL_FALSE}"; then + as_fn_error $? "conditional \"GTK_DOC_USE_LIBTOOL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GTK_DOC_USE_REBASE_TRUE}" && test -z "${GTK_DOC_USE_REBASE_FALSE}"; then + as_fn_error $? "conditional \"GTK_DOC_USE_REBASE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_GTK_DOC_TRUE}" && test -z "${BUILD_GTK_DOC_FALSE}"; then + as_fn_error $? "conditional \"BUILD_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_COGL_PANGO_TRUE}" && test -z "${BUILD_COGL_PANGO_FALSE}"; then + as_fn_error $? "conditional \"BUILD_COGL_PANGO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_COGL_PATH_TRUE}" && test -z "${BUILD_COGL_PATH_FALSE}"; then + as_fn_error $? "conditional \"BUILD_COGL_PATH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_COGL_GST_TRUE}" && test -z "${BUILD_COGL_GST_FALSE}"; then + as_fn_error $? "conditional \"BUILD_COGL_GST\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then + as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then + as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cogl $as_me 1.18.2, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +cogl config.status 1.18.2 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + +ac_aux_dir='$ac_aux_dir' + + + + +# Note that if two cases are the same, case goes with the first one. +# Note also that this is inside an AC_OUTPUT_COMMAND. We do not depend +# on variable expansion in case labels. Look at the generated config.status +# for a hint. + +if test "x${ac_cv_working_alloca_h+set}" = xset ; then + glib_header_alloca_h="$ac_cv_working_alloca_h" +else + glib_header_alloca_h="$ac_cv_header_alloca_h" +fi + +case xyes in +x$ac_cv_header_float_h) + glib_float_h=yes + glib_mf=FLT_MIN glib_Mf=FLT_MAX + glib_md=DBL_MIN glib_Md=DBL_MAX + ;; +x$ac_cv_header_values_h) + glib_values_h=yes + glib_mf=MINFLOAT glib_Mf=MAXFLOAT + glib_md=MINDOUBLE glib_Md=MAXDOUBLE + ;; +esac + +case xyes in +x$ac_cv_header_limits_h) + glib_limits_h=yes + glib_ms=SHRT_MIN glib_Ms=SHRT_MAX glib_Mus=USHRT_MAX + glib_mi=INT_MIN glib_Mi=INT_MAX glib_Mui=UINT_MAX + glib_ml=LONG_MIN glib_Ml=LONG_MAX glib_Mul=ULONG_MAX + ;; +x$ac_cv_header_values_h) + glib_values_h=yes + glib_ms=MINSHORT glib_Ms=MAXSHORT glib_Mus="(((gushort)G_MAXSHORT)*2+1)" + glib_mi=MININT glib_Mi=MAXINT glib_Mui="(((guint)G_MAXINT)*2+1)" + glib_ml=MINLONG glib_Ml=MAXLONG glib_Mul="(((gulong)G_MAXLONG)*2+1)" + ;; +esac + +if test x$ac_cv_header_sys_poll_h = xyes ; then + glib_sys_poll_h=yes +fi + +if test x$enable_included_printf = xyes ; then + glib_included_printf=yes +fi + +case x2 in +x$ac_cv_sizeof_short) + gint16=short + gint16_modifier='"h"' + gint16_format='"hi"' + guint16_format='"hu"' + ;; +x$ac_cv_sizeof_int) + gint16=int + gint16_modifier='""' + gint16_format='"i"' + guint16_format='"u"' + ;; +esac +case x4 in +x$ac_cv_sizeof_short) + gint32=short + gint32_modifier='"h"' + gint32_format='"hi"' + guint32_format='"hu"' + ;; +x$ac_cv_sizeof_int) + gint32=int + gint32_modifier='""' + gint32_format='"i"' + guint32_format='"u"' + ;; +x$ac_cv_sizeof_long) + gint32=long + gint32_modifier='"l"' + gint32_format='"li"' + guint32_format='"lu"' + ;; +esac +case x8 in +x$ac_cv_sizeof_int) + gint64=int + gint64_modifier='""' + gint64_format='"i"' + guint64_format='"u"' + glib_extension= + gint64_constant='(val)' + guint64_constant='(val)' + ;; +x$ac_cv_sizeof_long) + gint64=long + gint64_modifier='"l"' + gint64_format='"li"' + guint64_format='"lu"' + glib_extension= + gint64_constant='(val##L)' + guint64_constant='(val##UL)' + ;; +x$ac_cv_sizeof_long_long) + gint64='long long' + if test -n "$glib_cv_long_long_format"; then + gint64_modifier='"'$glib_cv_long_long_format'"' + gint64_format='"'$glib_cv_long_long_format'i"' + guint64_format='"'$glib_cv_long_long_format'u"' + fi + glib_extension='G_GNUC_EXTENSION ' + gint64_constant='(G_GNUC_EXTENSION (val##LL))' + guint64_constant='(G_GNUC_EXTENSION (val##ULL))' + ;; +x$ac_cv_sizeof___int64) + gint64='__int64' + if test -n "$glib_cv_long_long_format"; then + gint64_modifier='"'$glib_cv_long_long_format'"' + gint64_format='"'$glib_cv_long_long_format'i"' + guint64_format='"'$glib_cv_long_long_format'u"' + fi + glib_extension= + gint64_constant='(val##i64)' + guint64_constant='(val##ui64)' + ;; +esac +glib_size_t=$ac_cv_sizeof_size_t +glib_size_type_define="$glib_size_type" +glib_void_p=$ac_cv_sizeof_void_p +glib_long=$ac_cv_sizeof_long + +case "$glib_size_type" in +short) + gsize_modifier='"h"' + gsize_format='"hu"' + gssize_format='"hi"' + glib_msize_type='SHRT' + ;; +int) + gsize_modifier='""' + gsize_format='"u"' + gssize_format='"i"' + glib_msize_type='INT' + ;; +long) + gsize_modifier='"l"' + gsize_format='"lu"' + gssize_format='"li"' + glib_msize_type='LONG' + ;; +"long long"|__int64) + gsize_modifier='"I64"' + gsize_format='"I64u"' + gssize_format='"I64i"' + glib_msize_type='INT64' + ;; +esac + +gintbits=`expr $ac_cv_sizeof_int \* 8 2>/dev/null` +glongbits=`expr $ac_cv_sizeof_long \* 8 2>/dev/null` +gsizebits=`expr $ac_cv_sizeof_size_t \* 8 2>/dev/null` + +case x"$ac_cv_sizeof_void_p" in +x$ac_cv_sizeof_int) + glib_intptr_type_define=int + gintptr_modifier='""' + gintptr_format='"i"' + guintptr_format='"u"' + glib_gpi_cast='' + glib_gpui_cast='' + ;; +x$ac_cv_sizeof_long) + glib_intptr_type_define=long + gintptr_modifier='"l"' + gintptr_format='"li"' + guintptr_format='"lu"' + glib_gpi_cast='(glong)' + glib_gpui_cast='(gulong)' + ;; +x$ac_cv_sizeof_long_long) + glib_intptr_type_define='long long' + gintptr_modifier='"I64"' + gintptr_format='"I64i"' + guintptr_format='"I64u"' + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; +x$ac_cv_sizeof___int64) + glib_intptr_type_define=__int64 + gintptr_modifier='"I64"' + gintptr_format='"I64i"' + guintptr_format='"I64u"' + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; +*) + glib_unknown_void_p=yes + ;; +esac + + +case xyes in +x$ac_cv_func_atexit) + glib_atexit=" +#ifdef NeXT /* @#%@! NeXTStep */ +# define g_ATEXIT(proc) (!atexit (proc)) +#else +# define g_ATEXIT(proc) (atexit (proc)) +#endif" + ;; +x$ac_cv_func_on_exit) + glib_atexit=" +#define g_ATEXIT(proc) (on_exit ((void (*)(int, void*))(proc), NULL))" + ;; +esac + +case xyes in +x$ac_cv_func_memmove) + glib_memmove=' +#define g_memmove(dest,src,len) G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END' + ;; +x$glib_cv_working_bcopy) + glib_memmove=" +/* memmove isn't available, but bcopy can copy overlapping memory regions */ +#define g_memmove(d,s,n) G_STMT_START { bcopy ((s), (d), (n)); } G_STMT_END" + ;; +*) + glib_memmove=" +/* memmove isn't found and bcopy can't copy overlapping memory regions, + * so we have to roll our own copy routine. */ +void g_memmove (void* dest, const void * src, unsigned long len);" + ;; +esac + +glib_defines=" +#define GLIB_MAJOR_VERSION $GLIB_MAJOR_VERSION +#define GLIB_MINOR_VERSION $GLIB_MINOR_VERSION +#define GLIB_MICRO_VERSION $GLIB_MICRO_VERSION +" + +case xyes in +x$glib_cv_va_copy) glib_vacopy='#define G_VA_COPY va_copy' ;; +x$glib_cv___va_copy) glib_vacopy='#define G_VA_COPY __va_copy' ;; +*) glib_vacopy='' +esac + +if test x$glib_cv_va_val_copy = xno; then + glib_vacopy="\$glib_vacopy +#define G_VA_COPY_AS_ARRAY 1" +fi + +if test x$glib_cv_hasinline = xyes; then + glib_inline='#define G_HAVE_INLINE 1' +fi +if test x$glib_cv_has__inline = xyes; then + glib_inline="\$glib_inline +#define G_HAVE___INLINE 1" +fi +if test x$glib_cv_has__inline__ = xyes; then + glib_inline="\$glib_inline +#define G_HAVE___INLINE__ 1" +fi + +g_have_gnuc_varargs=$g_have_gnuc_varargs +g_have_iso_c_varargs=$g_have_iso_c_varargs +g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs + +g_can_inline=$g_can_inline +g_have_gnuc_visibility=$g_have_gnuc_visibility +g_have_sunstudio_visibility=$g_have_sunstudio_visibility + +if test x$ac_cv_c_bigendian = xyes; then + g_byte_order=G_BIG_ENDIAN + g_bs_native=BE + g_bs_alien=LE +else + g_byte_order=G_LITTLE_ENDIAN + g_bs_native=LE + g_bs_alien=BE +fi + +g_pollin=$glib_cv_value_POLLIN +g_pollout=$glib_cv_value_POLLOUT +g_pollpri=$glib_cv_value_POLLPRI +g_pollhup=$glib_cv_value_POLLHUP +g_pollerr=$glib_cv_value_POLLERR +g_pollnval=$glib_cv_value_POLLNVAL + +g_af_unix=$glib_cv_value_AF_UNIX +g_af_inet=$glib_cv_value_AF_INET +g_af_inet6=$glib_cv_value_AF_INET6 + +g_msg_peek=$glib_cv_value_MSG_PEEK +g_msg_oob=$glib_cv_value_MSG_OOB +g_msg_dontroute=$glib_cv_value_MSG_DONTROUTE + +g_have_eilseq=$have_eilseq + +case x$have_threads in +xno) g_enable_threads_def="#undef";; +*) g_enable_threads_def="#define";; +esac + +g_threads_impl_def=$g_threads_impl + +g_mutex_has_default="$mutex_has_default" +g_mutex_sizeof="$glib_cv_sizeof_gmutex" +g_system_thread_sizeof="$glib_cv_sizeof_system_thread" +g_mutex_contents="$glib_cv_byte_contents_gmutex" + +g_memory_barrier_needed="$glib_memory_barrier_needed" +g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations" + +g_module_suffix="$glib_gmodule_suffix" + +g_pid_type="$glib_pid_type" +case $host in + *-*-beos*) + glib_os="#define G_OS_BEOS" + ;; + *-*-cygwin*) + glib_os="#define G_OS_UNIX +#define G_PLATFORM_WIN32 +#define G_WITH_CYGWIN" + ;; + *-*-mingw*) + glib_os="#define G_OS_WIN32 +#define G_PLATFORM_WIN32" + ;; + *) + glib_os="#define G_OS_UNIX" + ;; +esac +glib_static_compilation="" +if test x$glib_win32_static_compilation = xyes; then + glib_static_compilation="#define GLIB_STATIC_COMPILATION 1 +#define GOBJECT_STATIC_COMPILATION 1" +fi + +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "deps/glib/glibconfig.h") CONFIG_COMMANDS="$CONFIG_COMMANDS deps/glib/glibconfig.h" ;; + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "README") CONFIG_FILES="$CONFIG_FILES README" ;; + "config.h.win32") CONFIG_FILES="$CONFIG_FILES config.h.win32" ;; + "build/Makefile") CONFIG_FILES="$CONFIG_FILES build/Makefile" ;; + "build/win32/Makefile") CONFIG_FILES="$CONFIG_FILES build/win32/Makefile" ;; + "build/win32/vs9/Makefile") CONFIG_FILES="$CONFIG_FILES build/win32/vs9/Makefile" ;; + "build/win32/vs10/Makefile") CONFIG_FILES="$CONFIG_FILES build/win32/vs10/Makefile" ;; + "deps/Makefile") CONFIG_FILES="$CONFIG_FILES deps/Makefile" ;; + "deps/glib/Makefile") CONFIG_FILES="$CONFIG_FILES deps/glib/Makefile" ;; + "deps/gmodule/Makefile") CONFIG_FILES="$CONFIG_FILES deps/gmodule/Makefile" ;; + "deps/gmodule/gmoduleconf.h") CONFIG_FILES="$CONFIG_FILES deps/gmodule/gmoduleconf.h" ;; + "test-fixtures/Makefile") CONFIG_FILES="$CONFIG_FILES test-fixtures/Makefile" ;; + "cogl/Makefile") CONFIG_FILES="$CONFIG_FILES cogl/Makefile" ;; + "cogl/cogl-1.0.pc") CONFIG_FILES="$CONFIG_FILES cogl/cogl-1.0.pc" ;; + "cogl/cogl-2.0-experimental.pc") CONFIG_FILES="$CONFIG_FILES cogl/cogl-2.0-experimental.pc" ;; + "cogl/cogl-defines.h") CONFIG_FILES="$CONFIG_FILES cogl/cogl-defines.h" ;; + "cogl/cogl-defines.h.win32") CONFIG_FILES="$CONFIG_FILES cogl/cogl-defines.h.win32" ;; + "cogl/cogl-defines.h.win32_SDL") CONFIG_FILES="$CONFIG_FILES cogl/cogl-defines.h.win32_SDL" ;; + "cogl/cogl-gl-header.h") CONFIG_FILES="$CONFIG_FILES cogl/cogl-gl-header.h" ;; + "cogl/cogl-egl-defines.h") CONFIG_FILES="$CONFIG_FILES cogl/cogl-egl-defines.h" ;; + "cogl/cogl.rc") CONFIG_FILES="$CONFIG_FILES cogl/cogl.rc" ;; + "cogl-pango/Makefile") CONFIG_FILES="$CONFIG_FILES cogl-pango/Makefile" ;; + "cogl-pango/cogl-pango-1.0.pc") CONFIG_FILES="$CONFIG_FILES cogl-pango/cogl-pango-1.0.pc" ;; + "cogl-pango/cogl-pango-2.0-experimental.pc") CONFIG_FILES="$CONFIG_FILES cogl-pango/cogl-pango-2.0-experimental.pc" ;; + "cogl-pango/cogl-pango.rc") CONFIG_FILES="$CONFIG_FILES cogl-pango/cogl-pango.rc" ;; + "cogl-path/Makefile") CONFIG_FILES="$CONFIG_FILES cogl-path/Makefile" ;; + "cogl-path/cogl-path-1.0.pc") CONFIG_FILES="$CONFIG_FILES cogl-path/cogl-path-1.0.pc" ;; + "cogl-path/cogl-path-2.0-experimental.pc") CONFIG_FILES="$CONFIG_FILES cogl-path/cogl-path-2.0-experimental.pc" ;; + "cogl-gst/Makefile") CONFIG_FILES="$CONFIG_FILES cogl-gst/Makefile" ;; + "cogl-gst/cogl-gst-1.0.pc") CONFIG_FILES="$CONFIG_FILES cogl-gst/cogl-gst-1.0.pc" ;; + "cogl-gst/cogl-gst-2.0-experimental.pc") CONFIG_FILES="$CONFIG_FILES cogl-gst/cogl-gst-2.0-experimental.pc" ;; + "cogl-gles2/Makefile") CONFIG_FILES="$CONFIG_FILES cogl-gles2/Makefile" ;; + "cogl-gles2/cogl-gles2-1.0.pc") CONFIG_FILES="$CONFIG_FILES cogl-gles2/cogl-gles2-1.0.pc" ;; + "cogl-gles2/cogl-gles2-2.0-experimental.pc") CONFIG_FILES="$CONFIG_FILES cogl-gles2/cogl-gles2-2.0-experimental.pc" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/reference/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/Makefile" ;; + "doc/reference/cogl/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl/Makefile" ;; + "doc/reference/cogl/cogl-docs.xml") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl/cogl-docs.xml" ;; + "doc/reference/cogl-2.0-experimental/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl-2.0-experimental/Makefile" ;; + "doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml" ;; + "doc/reference/cogl-gst/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl-gst/Makefile" ;; + "doc/reference/cogl-gst/cogl-gst-docs.xml") CONFIG_FILES="$CONFIG_FILES doc/reference/cogl-gst/cogl-gst-docs.xml" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/config.env") CONFIG_FILES="$CONFIG_FILES tests/config.env" ;; + "tests/conform/Makefile") CONFIG_FILES="$CONFIG_FILES tests/conform/Makefile" ;; + "tests/unit/Makefile") CONFIG_FILES="$CONFIG_FILES tests/unit/Makefile" ;; + "tests/micro-perf/Makefile") CONFIG_FILES="$CONFIG_FILES tests/micro-perf/Makefile" ;; + "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "deps/glib/glibconfig.h":C) + outfile=deps/glib/glibconfig.h-tmp + cat > $outfile <<\_______EOF +/* glibconfig.h + * + * This is a generated file. Please modify 'configure.ac' + */ + +#ifndef __G_LIBCONFIG_H__ +#define __G_LIBCONFIG_H__ + +#include + +_______EOF + + if test x$glib_limits_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_float_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_values_h = xyes; then + echo '#include ' >> $outfile + fi + if test "$glib_header_alloca_h" = "yes"; then + echo '#define GLIB_HAVE_ALLOCA_H' >> $outfile + fi + if test x$glib_sys_poll_h = xyes; then + echo '#define GLIB_HAVE_SYS_POLL_H' >> $outfile + fi + if test x$glib_included_printf != xyes; then + echo " +/* Specifies that GLib's g_print*() functions wrap the + * system printf functions. This is useful to know, for example, + * when using glibc's register_printf_function(). + */" >> $outfile + echo '#define GLIB_USING_SYSTEM_PRINTF' >> $outfile + fi + + cat >> $outfile <<_______EOF + +G_BEGIN_DECLS + +#define G_MINFLOAT $glib_mf +#define G_MAXFLOAT $glib_Mf +#define G_MINDOUBLE $glib_md +#define G_MAXDOUBLE $glib_Md +#define G_MINSHORT $glib_ms +#define G_MAXSHORT $glib_Ms +#define G_MAXUSHORT $glib_Mus +#define G_MININT $glib_mi +#define G_MAXINT $glib_Mi +#define G_MAXUINT $glib_Mui +#define G_MINLONG $glib_ml +#define G_MAXLONG $glib_Ml +#define G_MAXULONG $glib_Mul + +_______EOF + + + ### this should always be true in a modern C/C++ compiler + cat >>$outfile <<_______EOF +typedef signed char gint8; +typedef unsigned char guint8; +_______EOF + + + if test -n "$gint16"; then + cat >>$outfile <<_______EOF +typedef signed $gint16 gint16; +typedef unsigned $gint16 guint16; +#define G_GINT16_MODIFIER $gint16_modifier +#define G_GINT16_FORMAT $gint16_format +#define G_GUINT16_FORMAT $guint16_format +_______EOF + fi + + + if test -n "$gint32"; then + cat >>$outfile <<_______EOF +typedef signed $gint32 gint32; +typedef unsigned $gint32 guint32; +#define G_GINT32_MODIFIER $gint32_modifier +#define G_GINT32_FORMAT $gint32_format +#define G_GUINT32_FORMAT $guint32_format +_______EOF + fi + + cat >>$outfile <<_______EOF +#define G_HAVE_GINT64 1 /* deprecated, always true */ + +${glib_extension}typedef signed $gint64 gint64; +${glib_extension}typedef unsigned $gint64 guint64; + +#define G_GINT64_CONSTANT(val) $gint64_constant +#define G_GUINT64_CONSTANT(val) $guint64_constant +_______EOF + + if test x$gint64_format != x ; then + cat >>$outfile <<_______EOF +#define G_GINT64_MODIFIER $gint64_modifier +#define G_GINT64_FORMAT $gint64_format +#define G_GUINT64_FORMAT $guint64_format +_______EOF + else + cat >>$outfile <<_______EOF +#undef G_GINT64_MODIFIER +#undef G_GINT64_FORMAT +#undef G_GUINT64_FORMAT +_______EOF + fi + + cat >>$outfile <<_______EOF + +#define GLIB_SIZEOF_VOID_P $glib_void_p +#define GLIB_SIZEOF_LONG $glib_long +#define GLIB_SIZEOF_SIZE_T $glib_size_t + +_______EOF + + cat >>$outfile <<_______EOF +typedef signed $glib_size_type_define gssize; +typedef unsigned $glib_size_type_define gsize; +#define G_GSIZE_MODIFIER $gsize_modifier +#define G_GSSIZE_FORMAT $gssize_format +#define G_GSIZE_FORMAT $gsize_format + +#define G_MAXSIZE G_MAXU$glib_msize_type +#define G_MINSSIZE G_MIN$glib_msize_type +#define G_MAXSSIZE G_MAX$glib_msize_type + +typedef gint64 goffset; +#define G_MINOFFSET G_MININT64 +#define G_MAXOFFSET G_MAXINT64 + +#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER +#define G_GOFFSET_FORMAT G_GINT64_FORMAT +#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val) + +_______EOF + + if test -z "$glib_unknown_void_p"; then + cat >>$outfile <<_______EOF + +#define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p)) +#define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p)) + +#define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i)) +#define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u)) + +typedef signed $glib_intptr_type_define gintptr; +typedef unsigned $glib_intptr_type_define guintptr; + +#define G_GINTPTR_MODIFIER $gintptr_modifier +#define G_GINTPTR_FORMAT $gintptr_format +#define G_GUINTPTR_FORMAT $guintptr_format +_______EOF + else + echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile + fi + + + + cat >>$outfile <<_______EOF +$glib_atexit +$glib_memmove +$glib_defines +$glib_os +$glib_static_compilation + +$glib_vacopy + +#ifdef __cplusplus +#define G_HAVE_INLINE 1 +#else /* !__cplusplus */ +$glib_inline +#endif /* !__cplusplus */ + +#ifdef __cplusplus +#define G_CAN_INLINE 1 +_______EOF + + if test x$g_can_inline = xyes ; then + cat >>$outfile <<_______EOF +#else /* !__cplusplus */ +#define G_CAN_INLINE 1 +_______EOF + fi + + cat >>$outfile <<_______EOF +#endif + +_______EOF + + if test x$g_have_iso_c_varargs = xyes ; then + cat >>$outfile <<_______EOF +#ifndef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif +_______EOF + fi + if test x$g_have_iso_cxx_varargs = xyes ; then + cat >>$outfile <<_______EOF +#ifdef __cplusplus +# define G_HAVE_ISO_VARARGS 1 +#endif +_______EOF + fi + if test x$g_have_gnuc_varargs = xyes ; then + cat >>$outfile <<_______EOF + +/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi + * is passed ISO vararg support is turned off, and there is no work + * around to turn it on, so we unconditionally turn it off. + */ +#if __GNUC__ == 2 && __GNUC_MINOR__ == 95 +# undef G_HAVE_ISO_VARARGS +#endif + +#define G_HAVE_GNUC_VARARGS 1 +_______EOF + fi + + echo >>$outfile + if test x$g_have_eilseq = xno; then + cat >>$outfile <<_______EOF +#ifndef EILSEQ +/* On some systems, like SunOS and NetBSD, EILSEQ is not defined. + * The correspondence between this and the corresponding definition + * in libiconv is essential. + */ +# define EILSEQ ENOENT +#endif +_______EOF + + fi + + if test x$g_have_gnuc_visibility = xyes; then + cat >>$outfile <<_______EOF +#define G_HAVE_GNUC_VISIBILITY 1 +_______EOF + fi + cat >>$outfile <<_______EOF +#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +#define G_GNUC_INTERNAL __hidden +#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#else +#define G_GNUC_INTERNAL +#endif +_______EOF + + + echo >>$outfile + if test x$g_mutex_has_default = xyes; then + cat >>$outfile <<_______EOF +$g_enable_threads_def G_THREADS_ENABLED +#define G_THREADS_IMPL_$g_threads_impl_def +typedef struct _GStaticMutex GStaticMutex; +struct _GStaticMutex +{ + struct _GMutex *runtime_mutex; + union { + char pad[$g_mutex_sizeof]; + double dummy_double; + void *dummy_pointer; + long dummy_long; + } static_mutex; +}; +#define G_STATIC_MUTEX_INIT { NULL, { { $g_mutex_contents} } } +#define g_static_mutex_get_mutex(mutex) \\ + (g_thread_use_default_impl ? ((GMutex*)(gpointer) ((mutex)->static_mutex.pad)) : \\ + g_static_mutex_get_mutex_impl_shortcut (&((mutex)->runtime_mutex))) +_______EOF + else + cat >>$outfile <<_______EOF +$g_enable_threads_def G_THREADS_ENABLED +#define G_THREADS_IMPL_$g_threads_impl_def +typedef struct _GMutex* GStaticMutex; +#define G_STATIC_MUTEX_INIT NULL +#define g_static_mutex_get_mutex(mutex) \\ + (g_static_mutex_get_mutex_impl_shortcut (mutex)) +_______EOF + fi + + cat >>$outfile <<_______EOF +/* This represents a system thread as used by the implementation. An + * alien implementaion, as loaded by g_thread_init can only count on + * "sizeof (gpointer)" bytes to store their info. We however need more + * for some of our native implementations. */ +typedef union _GSystemThread GSystemThread; +union _GSystemThread +{ + char data[$g_system_thread_sizeof]; + double dummy_double; + void *dummy_pointer; + long dummy_long; +}; +_______EOF + if test x"$g_memory_barrier_needed" != xno; then + echo >>$outfile + echo "#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1" >>$outfile + fi + if test x"$g_gcc_atomic_ops" != xno; then + echo >>$outfile + echo "#define G_ATOMIC_OP_USE_GCC_BUILTINS 1" >>$outfile + fi + echo >>$outfile + g_bit_sizes="16 32 64" + for bits in $g_bit_sizes; do + cat >>$outfile <<_______EOF +#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val)) +#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val)) +#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val)) +#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val)) +_______EOF + done + + cat >>$outfile <<_______EOF +#define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val)) +#define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val)) +#define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val)) +#define GULONG_TO_BE(val) ((gulong) GUINT${glongbits}_TO_BE (val)) +#define GINT_TO_LE(val) ((gint) GINT${gintbits}_TO_LE (val)) +#define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val)) +#define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val)) +#define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val)) +#define GSIZE_TO_LE(val) ((gsize) GUINT${gsizebits}_TO_LE (val)) +#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val)) +#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val)) +#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val)) +#define G_BYTE_ORDER $g_byte_order + +#define G_MODULE_SUFFIX "$g_module_suffix" + +/* A GPid is an abstraction for a process "handle". It is *not* an + * abstraction for a process identifier in general. GPid is used in + * GLib only for descendant processes spawned with the g_spawn* + * functions. On POSIX there is no "process handle" concept as such, + * but on Windows a GPid is a handle to a process, a kind of pointer, + * not a process identifier. + */ +typedef $g_pid_type GPid; + +G_END_DECLS + +#endif /* GLIBCONFIG_H */ +_______EOF + + + if cmp -s $outfile deps/glib/glibconfig.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: deps/glib/glibconfig.h is unchanged" >&5 +$as_echo "$as_me: deps/glib/glibconfig.h is unchanged" >&6;} + rm -f $outfile + else + mv $outfile deps/glib/glibconfig.h + fi + ;; + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo "" +echo "Cogl - $COGL_1_VERSION/$COGL_VERSION (${COGL_RELEASE_STATUS})" + +# Global flags +echo "" +echo " • Global:" +echo " Prefix: ${prefix}" +if test "x$COGL_DEFAULT_DRIVER" != "x"; then +echo " Default driver: ${COGL_DEFAULT_DRIVER}" +fi + +echo "" +# Features +echo " • Features:" +echo " Drivers: ${enabled_drivers}" +if test "x$GL_LIBRARY_DIRECTLY_LINKED" != xyes; then : + for driver in $enabled_drivers; do + driver=`echo $driver | tr "gles" "GLES"` + libname=`eval echo \\$COGL_${driver}_LIBNAME` + echo " Library name for $driver: $libname" + done +fi +echo " GL Window System APIs:${GL_WINSYS_APIS}" +if test "x$SUPPORT_EGL" = "xyes"; then +echo " EGL Platforms:${EGL_PLATFORMS}" +echo " Wayland compositor support: ${enable_wayland_egl_server}" +fi +if test "x$SUPPORT_SDL" = "xyes"; then +echo " Supported SDL GL APIs: ${SUPPORTED_SDL_GL_APIS}" +fi +echo " Building for emscripten environment: $enable_emscripten" +echo " Build libcogl-gles2 GLES 2.0 frontend api: ${enable_cogl_gles2}" +echo " Image backend: ${COGL_IMAGE_BACKEND}" +echo " Cogl Pango: ${enable_cogl_pango}" +echo " Cogl Gstreamer: ${enable_cogl_gst}" +echo " Cogl Path: ${enable_cogl_path}" + +# Compiler/Debug related flags +echo "" +echo " • Build options:" +echo " Debugging: ${enable_debug}" +echo " Profiling: ${enable_profile}" +echo " Enable deprecated symbols: ${enable_deprecated}" +echo " Compiler flags: ${CFLAGS} ${COGL_EXTRA_CFLAGS}" +echo " Linker flags: ${LDFLAGS} ${COGL_EXTRA_LDFLAGS}" + +# Miscellaneous +echo "" +echo " • Extra:" +echo " Build API reference: ${enable_gtk_doc}" +echo " Build introspection data: ${enable_introspection}" +echo " Build unit tests: ${enable_unit_tests}" +echo " Enable internationalization: ${USE_NLS}" + +echo "" + +# General warning about experimental features +if test "x$EXPERIMENTAL_CONFIG" = "xyes"; then +echo "" +echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠" +echo " *WARNING*" +echo "" +echo " The stability of your build might be affected by one or more" +echo " experimental configuration options." +echo +echo " experimental options: $EXPERIMENTAL_OPTIONS" +echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠" +echo "" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..0359625 --- /dev/null +++ b/configure.ac @@ -0,0 +1,1572 @@ +AC_PREREQ(2.59) + +dnl ================================================================ +dnl XXX: If you are making a release then you need to check these +dnl sections: +dnl » API versions (Only the 1.x version needs to change) +dnl (the pretty numbers that the users see) +dnl +dnl » Interface version details for libtool +dnl (the shared library versioning information) +dnl +dnl » Source code release status +dnl (mark the source code as being part of a "release" or from "git") +dnl ================================================================ + +dnl ================================================================ +dnl API versions (i.e. the pretty numbers that users see) +dnl ================================================================ +m4_define([cogl_major_version], [2]) +m4_define([cogl_minor_version], [0]) +m4_define([cogl_micro_version], [0]) +m4_define([cogl_version], + [cogl_major_version.cogl_minor_version.cogl_micro_version]) + +dnl Since the core Cogl library has to also maintain support for the +dnl Cogl 1.x API for Clutter then we track the 1.x version separately. +m4_define([cogl_1_minor_version], [18]) +m4_define([cogl_1_micro_version], [2]) +m4_define([cogl_1_version], [1.cogl_1_minor_version.cogl_1_micro_version]) + +dnl ================================================================ +dnl Interface version details for libtool +dnl ================================================================ +# Note: we don't automatically deduce the libtool version info from +# the pretty version number that users sees. This is because we want +# to update the pretty version number before making a release since it +# can affect the name of our pkg-config file and the naming or +# location of other installed files which we want to be able to verify +# as correct well before making a release. +# +# For reference on how the various numbers should be updated at +# release time these rules are adapted from the libtool info pages: +# +# 1. Update the version information only immediately before a public +# release. +# +# 2. If the library source code has changed at all since the last +# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). +# +# 3. If any interfaces have been added, removed, or changed since the +# last update, increment CURRENT, and set REVISION to 0. +# +# 4. If any interfaces have been added since the last public release, +# then increment AGE. +# +# 5. If any interfaces have been removed since the last public release, +# then set AGE to 0. +m4_define([cogl_lt_current], 22) +m4_define([cogl_lt_revision], 0) +m4_define([cogl_lt_age], 2) +# We do also tell libtool the pretty version: +m4_define([cogl_lt_release], [cogl_version]) + + +dnl ================================================================ +dnl Source code release status +dnl ================================================================ +# Finally we explicitly track when we are building development source +# from Git vs building source corresponding to a release. As with the +# libtool version info we don't automatically derive this from the +# pretty version number because we want to test the results of +# updating the version number in advance of a release. +# +# Possible status values are: git, snapshot or release +# +m4_define([cogl_release_status], [release]) + +AC_INIT(cogl, [cogl_1_version]) +AC_CONFIG_SRCDIR(cogl/cogl.h) +AC_CONFIG_AUX_DIR([build]) +AC_CONFIG_MACRO_DIR([build/autotools]) +AC_CONFIG_HEADERS(config.h) +AC_GNU_SOURCE + +dnl ================================================================ +dnl Required versions for dependencies +dnl ================================================================ +m4_define([glib_req_version], [2.32.0]) +m4_define([pangocairo_req_version], [1.20]) +m4_define([gi_req_version], [0.9.5]) +m4_define([gdk_pixbuf_req_version], [2.0]) +m4_define([uprof_req_version], [0.3]) +m4_define([gtk_doc_req_version], [1.13]) +m4_define([xfixes_req_version], [3]) +m4_define([xcomposite_req_version], [0.4]) +m4_define([xrandr_req_version], [1.2]) +m4_define([cairo_req_version], [1.10]) +m4_define([wayland_req_version], [1.0.0]) +m4_define([wayland_server_req_version], [1.1.90]) + +dnl These variables get copied into the generated README +AC_SUBST([GLIB_REQ_VERSION], [glib_req_version]) +AC_SUBST([GDK_PIXBUF_REQ_VERSION], [gdk_pixbuf_req_version]) +AC_SUBST([CAIRO_REQ_VERSION], [cairo_req_version]) +AC_SUBST([PANGOCAIRO_REQ_VERSION], [pangocairo_req_version]) +AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version]) +AC_SUBST([XFIXES_REQ_VERSION], [xfixes_req_version]) +AC_SUBST([GTK_DOC_REQ_VERSION], [gtk_doc_req_version]) +AC_SUBST([GI_REQ_VERSION], [gi_req_version]) +AC_SUBST([UPROF_REQ_VERSION], [uprof_req_version]) +AC_SUBST([WAYLAND_REQ_VERSION], [wayland_req_version]) +AC_SUBST([WAYLAND_SERVER_REQ_VERSION], [wayland_server_req_version]) + +# Save this value here, since automake will set cflags later and we +# want to know if the user specified custom cflags or not. +cflags_set=${CFLAGS+set} + +AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip + dist-xz tar-ustar]) +AM_SILENT_RULES([yes]) + +AH_BOTTOM([#include "config-custom.h"]) + +dnl ================================================================ +dnl Export the API versioning +dnl ================================================================ +AC_SUBST([COGL_MAJOR_VERSION],[cogl_major_version]) +AC_SUBST([COGL_MINOR_VERSION],[cogl_minor_version]) +AC_SUBST([COGL_MICRO_VERSION],[cogl_micro_version]) +AC_SUBST([COGL_VERSION],[cogl_version]) +AC_SUBST([COGL_API_VERSION],[cogl_major_version.0]) +AC_SUBST([COGL_API_VERSION_AM],[$COGL_MAJOR_VERSION\_0]) + +AC_SUBST([COGL_1_MINOR_VERSION],[cogl_1_minor_version]) +AC_SUBST([COGL_1_MICRO_VERSION],[cogl_1_micro_version]) +AC_SUBST([COGL_1_VERSION],[cogl_1_version]) + + +dnl ================================================================ +dnl Export the libtool versioning +dnl ================================================================ +AC_SUBST([COGL_LT_CURRENT], [cogl_lt_current]) +AC_SUBST([COGL_LT_REVISION], [cogl_lt_revision]) +AC_SUBST([COGL_LT_AGE], [cogl_lt_age]) +AC_SUBST([COGL_LT_RELEASE], [cogl_lt_release]) + + +dnl ================================================================ +dnl Export the source code release status +dnl ================================================================ +AC_SUBST([COGL_RELEASE_STATUS], [cogl_release_status]) + +dnl ================================================================ +dnl Compiler stuff. +dnl ================================================================ +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AM_PROG_CC_C_O +AC_ISC_POSIX +AC_C_CONST + +dnl ============================================================ +dnl Compiler features +dnl ============================================================ +AC_MSG_CHECKING([for _Static_assert]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Static_assert (1, "");], + [(void) 0])], + [AC_DEFINE([HAVE_STATIC_ASSERT], [1], + [Whether _Static_assert can be used or not]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + +dnl ================================================================ +dnl Libtool stuff. +dnl ================================================================ +dnl AC_PROG_LIBTOOL +dnl LIBTOOL="$LIBTOOL --preserve-dup-deps" +LT_PREREQ([2.2.6]) +LT_INIT([disable-static]) +dnl when using libtool 2.x create libtool early, because it's used in the +dnl internal glib configure (as-glibconfig.m4) +m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) + +dnl ================================================================ +dnl Find an appropriate libm, for sin() etc. +dnl ================================================================ +LT_LIB_M +AC_SUBST(LIBM) + +dnl ================================================================ +dnl See what platform we are building for +dnl ================================================================ +AC_CANONICAL_HOST +AC_MSG_CHECKING([if building for some Win32 platform]) +AS_CASE([$host], + [*-*-mingw*|*-*-cygwin*], + [ + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -no-undefined" + platform_win32=yes + ], + + [platform_win32=no] +) +AC_MSG_RESULT([$platform_win32]) +AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"]) + +AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no]) +AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"]) + +dnl ================================================================ +dnl Handle extra configure options +dnl ================================================================ + + +dnl ============================================================ +dnl Installed tests +dnl ============================================================ + +AC_ARG_ENABLE(installed_tests, + AS_HELP_STRING([--enable-installed-tests], + [Install test programs (default: no)]),, + [enable_installed_tests=no]) +AM_CONDITIONAL(ENABLE_INSTALLED_TESTS, test x$enable_installed_tests = xyes) + + +dnl ============================================================ +dnl Emscripten support +dnl ============================================================ + +AC_ARG_ENABLE( + [emscripten], + [AC_HELP_STRING([--enable-emscripten=@<:@no/yes@:>@], [Support building for emscripten])], + [], + enable_emscripten=no +) +AS_IF([test "x$enable_emscripten" = "xyes"], + [ + enable_standalone=yes + enable_sdl=yes + enable_gles2=yes + enable_gl=no + AC_DEFINE([USING_EMSCRIPTEN], 1, [Cogl is being compiled with emscripten]) + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EMSCRIPTEN_SUPPORT" + ] +) +AM_CONDITIONAL(USING_EMSCRIPTEN, [test "$enable_emscripten" = "yes"]) + + +dnl ============================================================ +dnl Standalone cogl +dnl ============================================================ + +AC_ARG_ENABLE( + [standalone], + [AC_HELP_STRING([--enable-standalone=@<:@no/yes@:>@], [Build Cogl without any external depedency @<:@default=no@:>@])], + [], + enable_standalone=no +) +AS_IF([test "x$enable_standalone" = "xyes"], + [ + enable_cairo=no + enable_glib=no + enable_cogl_pango=no + enable_nls=no + enable_gdk_pixbuf=no + ] +) + +dnl ============================================================ +dnl Enable debugging +dnl ============================================================ +m4_define([debug_default], [m4_if(cogl_release_status, [git], [yes], [no])]) +AC_ARG_ENABLE( + [debug], + [AC_HELP_STRING([--enable-debug=@<:@no/yes@:>@], [Control Cogl debugging level @<:@default=]debug_default[@:>@])], + [], + enable_debug=debug_default +) +AS_CASE( + [$enable_debug], + [yes], + [ + test "$cflags_set" = set || CFLAGS="$CFLAGS -g -O0" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_ENABLE_DEBUG" + ], + [no], + [ + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" + ], + [AC_MSG_ERROR([Unknown argument for --enable-debug])] +) + +AC_SUBST(COGL_DEBUG_CFLAGS) + +AC_ARG_ENABLE( + [unit-tests], + [AC_HELP_STRING([--enable-unit-tests=@<:@no/yes@:>@], [Build Cogl unit tests @<:@default=yes@:>@])], + [], + enable_unit_tests=yes +) +AS_IF([test "x$enable_unit_tests" = "xyes"], + [ + AC_DEFINE([ENABLE_UNIT_TESTS], [1], [Whether to enable building unit tests]) + ] +) +AM_CONDITIONAL(UNIT_TESTS, test "x$enable_unit_tests" = "xyes") + +dnl ============================================================ +dnl Enable cairo usage for debugging +dnl (debugging code can use cairo to dump the atlas) +dnl ============================================================ + +PKG_CHECK_EXISTS([CAIRO], [cairo >= cairo_req_version], [have_cairo=yes]) +AC_ARG_ENABLE( + [cairo], + [AC_HELP_STRING([--enable-cairo=@<:@no/yes@:>@], [Control Cairo usage in Cogl debugging code @<:@default=auto@:>@])], + [], + [ + AS_IF([test "x$enable_debug" = "xyes"], + [enable_cairo=$have_cairo], + [enable_cairo=no]) + ] +) +AS_IF([test "x$enable_cairo" = "xyes" && test "x$enable_debug" = "xyes"], + [ + AS_IF([test "x$have_cairo" != "xyes"], + [AC_MSG_ERROR([Could not find Cairo])]) + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES cairo >= cairo_req_version" + AC_DEFINE([HAVE_CAIRO], [1], [Whether we have cairo or not]) + ]) + + +dnl ============================================================ +dnl Enable profiling +dnl ============================================================ +AC_ARG_ENABLE(profile, + [AC_HELP_STRING([--enable-profile=@<:@no/yes@:>@], + [Turn on uprof profiling support. yes; All UProf profiling probe points are compiled in and may be runtime enabled. no; No profiling support will built into cogl. @<:@default=no@:>@])], + [], + [enable_profile=no]) +AS_IF([test "x$enable_profile" = "xyes"], + [ + AS_IF([test "x$GCC" = "xyes"], + [ + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES uprof-0.3" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_ENABLE_PROFILE" + AS_IF([test "x$enable_debug" = "xyes"], [COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DUPROF_DEBUG"]) + ], + [ + AC_MSG_ERROR([--enable-profile is currently only supported if using GCC]) + ]) + ]) +AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno") + + +dnl ============================================================ +dnl Enable strict compiler flags +dnl ============================================================ + +# use strict compiler flags only when building from git; the rules for +# distcheck will take care of turning this on when making a release +m4_define([maintainer_default], [m4_if(cogl_release_status, [git], [yes], [no])]) +AC_ARG_ENABLE( + [maintainer-flags], + [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@], [Use strict compiler flags @<:@default=]maintainer_default[@:>@])], + [], + enable_maintainer_flags=maintainer_default +) + +MAINTAINER_COMPILER_FLAGS="-Wall -Wcast-align -Wuninitialized + -Wno-strict-aliasing -Wempty-body -Wformat + -Wformat-security -Winit-self -Wundef + -Wdeclaration-after-statement -Wvla + -Wpointer-arith -Wmissing-declarations" + +AS_CASE( + [$enable_maintainer_flags], + [yes], + [ + AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS]) + ], + [no], + [ + ], + [error], + [ + MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror" + AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS]) + ], + [*], + [AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])] +) + +# strip leading spaces +COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${MAINTAINER_CFLAGS#* }" + + +dnl ============================================================ +dnl Enable deprecation guards +dnl ============================================================ + +# disable deprecated options from Glib only when building from git; +# the rules for distcheck will take care of turning this on when +# making a release +m4_define([deprecated_default], + [m4_if(cogl_release_status, [git], [no], [yes])]) + +AC_ARG_ENABLE([deprecated], + [AS_HELP_STRING([--enable-deprecated=@<:@no/yes@:>@], + [Whether deprecated symbols should be disabled when compiling Cogl @<:@default=]deprecated_default[@:>@])], + [], + [enable_deprecated=deprecated_default]) + +AS_CASE([$enable_deprecated], + + [no], + [ + DEPRECATED_CFLAGS="-DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES" + ], + + [yes], + [ + DEPRECATED_CFLAGS="" + ], + + [AC_MSG_ERROR([Unknown argument for --enable-deprecated])] +) + +# strip leading spaces +COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS ${DEPRECATED_CFLAGS#* }" + +dnl ================================================================ +dnl Check for dependency packages. +dnl ================================================================ + +dnl ============================================================ +dnl Should glib be used? +dnl ============================================================ +AS_IF([test "x$enable_standalone" = "xno"], + [ + AM_PATH_GLIB_2_0([glib_req_version], + [have_glib=yes], [have_glib=no], + [gobject gthread gmodule-no-export]) + AC_ARG_ENABLE( + [glib], + [AC_HELP_STRING([--enable-glib=@<:@no/yes@:>@], [Enable glib support @<:@default=yes@:>@])], + [], + enable_glib=yes + ) + + AS_IF([test "x$have_glib" = "xno" && test "x$enable_glib" = "xyes"], + [AC_MSG_ERROR([gobject-2.0 is required])]) + ], + [enable_glib=no] +) + +AM_CONDITIONAL([USE_GLIB], [test "x$enable_glib" = "xyes"]) + +AS_IF([test "x$enable_glib" = "xyes"], + [ + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GTYPE_SUPPORT" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0" + ], + [ + AS_GLIBCONFIG([deps/glib]) + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/glib" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/glib" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/gmodule" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/gmodule" + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib," + enable_nls=no + ] +) + +dnl ============================================================ +dnl Should cogl-pango be built? +dnl ============================================================ + +AS_IF([test "x$enable_glib" != "xyes"], + [ + AS_IF([test "x$enable_cogl_pango" = "xyes"], + AC_MSG_ERROR([--enable-cogl-pango conflicts with --disable-glib])) + enable_cogl_pango=no + ] +) + +AC_ARG_ENABLE( + [cogl-pango], + [AC_HELP_STRING([--enable-cogl-pango=@<:@no/yes@:>@], [Enable pango support @<:@default=yes@:>@])], + [], + enable_cogl_pango=yes +) +AS_IF([test "x$enable_cogl_pango" = "xyes"], + [ + COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= pangocairo_req_version" + ] +) + +dnl ============================================================ +dnl Should cogl-gst be built? +dnl ============================================================ + +AS_IF([test "x$enable_glib" != "xyes"], + [ + AS_IF([test "x$enable_cogl_gst" = "xyes"], + AC_MSG_ERROR([--enable-cogl-gst conflicts with --disable-glib])) + enable_cogl_gst=no + ] +) + +AC_ARG_ENABLE( + [cogl-gst], + [AC_HELP_STRING([--enable-cogl-gst=@<:@no/yes@:>@], [Enable gstreamer support @<:@default=no@:>@])], + [], + enable_cogl_gst=no +) +AS_IF([test "x$enable_cogl_gst" = "xyes"], + [ + COGL_GST_PKG_REQUIRES="$COGL_GST_PKG_REQUIRES gstreamer-1.0 gstreamer-fft-1.0 \ + gstreamer-audio-1.0 gstreamer-base-1.0 \ + gstreamer-video-1.0 gstreamer-plugins-base-1.0 \ + gstreamer-tag-1.0 gstreamer-controller-1.0" + + GST_MAJORMINOR=1.0 + + dnl define location of gstreamer plugin directory + plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" + AC_SUBST(plugindir) + + dnl For the gtk doc generation + GSTREAMER_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-1.0`" + AC_SUBST(GSTREAMER_PREFIX) + ] +) + +dnl ============================================================ +dnl Should cogl-path be built? +dnl ============================================================ + +AC_ARG_ENABLE( + [cogl-path], + [AC_HELP_STRING([--enable-cogl-path=@<:@no/yes@:>@], [Enable 2D path support @<:@default=yes@:>@])], + [], + enable_cogl_path=yes +) +AS_IF([test "x$enable_cogl_path" = "xyes"], + [ + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_COGL_PATH_SUPPORT" + ] +) + +dnl ============================================================ +dnl Choose image loading backend +dnl ============================================================ +AC_ARG_ENABLE( + [gdk-pixbuf], + [AC_HELP_STRING([--enable-gdk-pixbuf=@<:@no/yes@:>@], [Enable image loading via gdk-pixbuf @<:@default=yes@:>@])], + [], + [AS_IF([test "x$enable_glib" = "xyes"], + [PKG_CHECK_EXISTS([gdk-pixbuf-2.0 >= gdk_pixbuf_req_version], + [enable_gdk_pixbuf=yes], + [enable_gdk_pixbuf=no])])] +) + +AC_ARG_ENABLE( + [quartz-image], + [AC_HELP_STRING([--enable-quartz-image=@<:@no/yes@:>@], [Enable image loading via quartz @<:@default=no@:>@])], + [], + enable_quartz_image=no +) + +AS_IF( + [test "x$enable_gdk_pixbuf" = "xyes"], + [ + AS_IF([test "x$enable_glib" != "xyes"], + [AC_MSG_ERROR([--disable-glib conflicts with --enable-gdk-pixbuf])]) + AC_DEFINE([USE_GDKPIXBUF], 1, [Use GdkPixbuf for loading image data]) + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gdk-pixbuf-2.0 >= gdk_pixbuf_req_version" + COGL_IMAGE_BACKEND="gdk-pixbuf" + ], + [test "x$enable_quartz_image" = "xyes"], + [ + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS Quartz Core Graphics," + AC_DEFINE([USE_QUARTZ], 1, + [Use Core Graphics (Quartz) for loading image data]) + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -framework ApplicationServices" + COGL_IMAGE_BACKEND="quartz" + ], + [ + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS fallback image decoding (stb_image)," + AC_DEFINE([USE_INTERNAL], 1, + [Use internal image decoding for loading image data]) + COGL_IMAGE_BACKEND="stb_image" + ] +) + +dnl ============================================================ +dnl Should examples be installed? +dnl ============================================================ +AC_ARG_ENABLE( + [examples-install], + [AC_HELP_STRING([--enable-examples-install=@<:@no/yes@:>@], [Enable installation of examples @<:@default=no@:>@])], + [], + enable_examples_install=no +) +AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_examples_install" = "xyes"]) + +dnl ============================================================ +dnl Determine which drivers and window systems we can support +dnl ============================================================ + +dnl ======================================================== +dnl Drivers first... +dnl ======================================================== +EGL_CHECKED=no + +dnl This gets set to yes if Cogl directly links to the GL library API +dnl so it doesn't need to be dlopened. This currently happens on OSX +dnl and WGL where it's not clear if window system API can be separated +dnl from the GL API. +GL_LIBRARY_DIRECTLY_LINKED=no + +enabled_drivers="" + +HAVE_GLES1=0 +AC_ARG_ENABLE( + [gles1], + [AC_HELP_STRING([--enable-gles1=@<:@no/yes@:>@], [Enable support for OpenGL-ES 1.1 @<:@default=no@:>@])], + [], + enable_gles1=no +) +AS_IF([test "x$enable_gles1" = "xyes"], + [ + AS_IF([test "x$platform_win32" = "xyes"], + [AC_MSG_ERROR([GLES 1 not available for win32])]) + + enabled_drivers="$enabled_drivers gles1" + + cogl_gl_headers="GLES/gl.h GLES/glext.h" + + AC_DEFINE([HAVE_COGL_GLES], 1, [Have GLES 1.1 for rendering]) + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES1" + HAVE_GLES1=1 + + PKG_CHECK_EXISTS([glesv1_cm], + [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv1_cm" + COGL_GLES1_LIBNAME="libGLESv1_CM.so" + ], + [ + # We have to check the two headers independently as GLES/glext.h + # needs to include GLES/gl.h to have the GL types defined (eg. + # GLenum). + AC_CHECK_HEADER([GLES/gl.h], + [], + [AC_MSG_ERROR([Unable to locate GLES/gl.h])]) + AC_CHECK_HEADER([GLES/glext.h], + [], + [AC_MSG_ERROR([Unable to locate GLES/glext.h])], + [#include ]) + + # Early implementations provided only a GLES/egl.h while Khronos's + # implementer guide now states EGL/egl.h is the One. Some + # implementations keep a GLES/egl.h wrapper around EGL/egl.h for + # backward compatibility while others provide EGL/egl.h only. + AC_CHECK_HEADERS([GLES/egl.h EGL/egl.h]) + + AS_IF([test "x$ac_cv_header_GLES_egl_h" = "xyes"], + [COGL_EGL_INCLUDES="#include "], + [test "x$ac_cv_header_EGL_egl_h" = "xyes"], + [ + COGL_EGL_INCLUDES="#include " + ], + [AC_MSG_ERROR([Unable to locate EGL header])]) + AC_SUBST([COGL_EGL_INCLUDES]) + + AC_CHECK_HEADERS([EGL/eglext.h], + [COGL_EGL_INCLUDES="$COGL_EGL_INCLUDE +#include "], + [], + [$COGL_EGL_INCLUDES]) + + # Check for a GLES 1.x Common Profile library with/without EGL. + # + # Note: historically GLES 1 libraries shipped with the + # EGL and GLES symbols all bundled in one library. Now + # the Khronos Implementers Guide defines two naming + # schemes: -lGLES_CM should be used for a library that + # bundles the GLES and EGL API together and -lGLESv1_CM + # would be used for a standalone GLES API. + AC_CHECK_LIB(GLES_CM, [eglInitialize], + [COGL_GLES1_LIBNAME="libGLES_CM.so"], + [ + AC_CHECK_LIB(GLESv1_CM, [glFlush], + [COGL_GLES1_LIBNAME="libGLESv1_CM.so" + NEED_SEPARATE_EGL=yes + ], + [AC_MSG_ERROR([Unable to locate required GLES 1.x Common Profile library])]) + ]) + + EGL_CHECKED=yes + ]) + ]) + +HAVE_GLES2=0 +AC_ARG_ENABLE( + [gles2], + [AC_HELP_STRING([--enable-gles2=@<:@no/yes@:>@], [Enable support for OpenGL-ES 2.0 @<:@default=no@:>@])], + [], + enable_gles2=no +) +AS_IF([test "x$enable_gles2" = "xyes"], + [ + AS_IF([test "x$platform_win32" = "xyes"], + [AC_MSG_ERROR([GLES 2 not available for win32])]) + + enabled_drivers="$enabled_drivers gles2" + + cogl_gl_headers="GLES2/gl2.h GLES2/gl2ext.h" + AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GLES 2.0 for rendering]) + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES2" + HAVE_GLES2=1 + + AS_IF([test "x$enable_emscripten" = "xyes"], + [ + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GLES2_LIBNAME="" + AC_DEFINE([HAVE_COGL_WEBGL], 1, [Have WebGL for rendering]) + ], + + [ + PKG_CHECK_EXISTS([glesv2], + [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv2" + COGL_GLES2_LIBNAME="libGLESv2.so" + ], + [ + # We have to check the two headers independently as GLES2/gl2ext.h + # needs to include GLES2/gl2.h to have the GL types defined (eg. + # GLenum). + AC_CHECK_HEADER([GLES2/gl2.h], + [], + [AC_MSG_ERROR([Unable to locate GLES2/gl2.h])]) + AC_CHECK_HEADER([GLES2/gl2ext.h], + [], + [AC_MSG_ERROR([Unable to locate GLES2/gl2ext.h])], + [#include ]) + + COGL_GLES2_LIBNAME="libGLESv2.so" + ]) + ]) + ]) + +HAVE_GL=0 +AC_ARG_ENABLE( + [gl], + [AC_HELP_STRING([--enable-gl=@<:@no/yes@:>@], [Enable support for OpenGL @<:@default=yes@:>@])], + [], + [enable_gl=yes] +) +AS_IF([test "x$enable_gl" = "xyes"], + [ + enabled_drivers="$enabled_drivers gl" + + PKG_CHECK_EXISTS([x11], [ALLOW_GLX=yes]) + + cogl_gl_headers="GL/gl.h" + + AS_IF([test "x$platform_quartz" = "xyes"], + [ + cogl_gl_headers="OpenGL/gl.h" + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -framework OpenGL" + dnl The GL API is being directly linked in so there is + dnl no need to dlopen it separately + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GL_LIBNAME="" + ], + + [test "x$platform_win32" = "xyes"], + [ + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lopengl32 -lgdi32 -lwinmm" + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -D_WIN32_WINNT=0x0500" + ALLOW_WGL=yes + dnl The GL API is being directly linked in so there is + dnl no need to dlopen it separately + GL_LIBRARY_DIRECTLY_LINKED=yes + COGL_GL_LIBNAME="" + ], + + [ + PKG_CHECK_EXISTS([gl], + dnl We don't want to use COGL_PKG_REQUIRES here because we don't want to + dnl directly link against libGL + [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL gl"], + [AC_CHECK_LIB(GL, [glGetString], + , + [AC_MSG_ERROR([Unable to locate required GL library])]) + ]) + COGL_GL_LIBNAME="libGL.so.1" + ]) + + AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering]) + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GL" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GL" + HAVE_GL=1 + ]) + +AM_CONDITIONAL([COGL_DRIVER_GL_SUPPORTED], [test "x$enable_gl" = "xyes"]) +AM_CONDITIONAL([COGL_DRIVER_GLES_SUPPORTED], + [test "x$enable_gles1" = "xyes" || test "x$enable_gles2" = "xyes"]) + +dnl Allow the GL library names and default driver to be overridden with configure options +AC_ARG_WITH([gl-libname], + [AS_HELP_STRING([--with-gl-libname], + override the name of the GL library to dlopen)], + [COGL_GL_LIBNAME="$withval"]) +AC_ARG_WITH([gles1-libname], + [AS_HELP_STRING([--with-gles1-libname], + override the name of the GLESv1 library to dlopen)], + [COGL_GLES1_LIBNAME="$withval"]) +AC_ARG_WITH([gles2-libname], + [AS_HELP_STRING([--with-gles2-libname], + override the name of the GLESv2 library to dlopen)], + [COGL_GLES2_LIBNAME="$withval"]) +AC_ARG_WITH([default-driver], + [AS_HELP_STRING([--with-default-driver], + specify a default cogl driver)], + [COGL_DEFAULT_DRIVER="${withval}"], + [COGL_DEFAULT_DRIVER="" ]) + +AM_CONDITIONAL(HAVE_COGL_DEFAULT_DRIVER, + [ test "x$COGL_DEFAULT_DRIVER" != "x" ]) + + +AC_SUBST([COGL_GL_LIBNAME]) +AC_SUBST([HAVE_GL]) +AC_SUBST([COGL_GLES1_LIBNAME]) +AC_SUBST([HAVE_GLES1]) +AC_SUBST([COGL_GLES2_LIBNAME]) +AC_SUBST([HAVE_GLES2]) +AC_SUBST([COGL_DEFAULT_DRIVER]) + +if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then + AC_DEFINE([HAVE_DIRECTLY_LINKED_GL_LIBRARY], [1], + [Defined if the GL library should not be dlopened]) +fi + +AC_ARG_ENABLE( + [cogl-gles2], + [AC_HELP_STRING([--enable-cogl-gles2=@<:@no/yes@:>@], + [Enable libcogl-gles2 frontend api for OpenGL-ES 2.0 @<:@default=auto@:>@])], + [], + [ + AS_IF([test "x$HAVE_GLES2" = "x1"], + [enable_cogl_gles2=yes], + [enable_cogl_gles2=no]) + ] +) +AS_IF([test "x$enable_cogl_gles2" = "xyes"], + [ + AS_IF([test "x$HAVE_GLES2" != "x1"], + [ + AC_MSG_ERROR([libcogl-gles2 is currently only supported on systems with a native GLES 2.0 library]) + ]) + ]) +AM_CONDITIONAL([BUILD_COGL_GLES2], [test "x$enable_cogl_gles2" = "xyes"]) + + +dnl ======================================================== +dnl Check window system integration libraries... +dnl ======================================================== + +AC_ARG_ENABLE( + [glx], + [AC_HELP_STRING([--enable-glx=@<:@no/yes@:>@], [Enable support GLX @<:@default=auto@:>@])], + [], + [AS_IF([test "x$ALLOW_GLX" = "xyes"], [enable_glx=yes], [enable_glx=no])] +) +AS_IF([test "x$enable_glx" = "xyes"], + [ + AS_IF([test "x$ALLOW_GLX" != "xyes"], + [AC_MSG_ERROR([GLX not supported with this configuration])]) + + NEED_XLIB=yes + SUPPORT_GLX=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS glx" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLX_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_GLX, [test "x$SUPPORT_GLX" = "xyes"]) + +AC_ARG_ENABLE( + [wgl], + [AC_HELP_STRING([--enable-wgl=@<:@no/yes@:>@], [Enable support for WGL @<:@default=auto@:>@])], + [], + [AS_IF([test "x$ALLOW_WGL" = "xyes"], [enable_wgl=yes], [enable_wgl=no])] +) +AS_IF([test "x$enable_wgl" = "xyes"], + [ + AS_IF([test "x$ALLOW_WGL" != "xyes"], + [AC_MSG_ERROR([WGL not supported with this configuration])]) + + SUPPORT_WGL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS wgl" + + AC_DEFINE([COGL_HAS_WGL_SUPPORT], [1], [Cogl supports OpenGL using the WGL API]) + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_WIN32_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_WGL, [test "x$SUPPORT_WGL" = "xyes"]) + +AC_ARG_ENABLE( + [sdl], + [AC_HELP_STRING([--enable-sdl=@<:@no/yes@:>@], [Enable support SDL @<:@default=no@:>@])], + [], + [enable_sdl=no]) +AS_IF([test "x$enable_sdl" = "xyes"], + [ + AS_IF([test "x$enable_emscripten" = "xno"], + [ + PKG_CHECK_MODULES([SDL], + [sdl], + [ + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl" + ], + [ + AC_CHECK_HEADER([SDL/SDL.h], + [], + [AC_MSG_ERROR([SDL support requested but SDL not found])]) + ]) + ]) + + SUPPORT_SDL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + + dnl If we are building with emscripten then that simply implies we are + dnl using SDL in conjunction with WebGL (GLES2) + AS_IF([test "x$enable_emscripten" = "xyes"], + [ + SUPPORTED_SDL_GL_APIS="webgl" + SUPPORT_SDL_WEBGL=yes + SUPPORT_SDL_GLES=no + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_WEBGL_SUPPORT" + ], + [ + dnl WebOS has a specially patched version of SDL to add + dnl support for creating a GLES1/2 context. This tries to + dnl detect that patch so we can use it if the GLES2 driver is + dnl selected. + cogl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" + AC_CHECK_DECL([SDL_OPENGLES], + [SUPPORT_SDL_GLES=yes], + [SUPPORT_SDL_GLES=no], + [#include ]) + AC_CHECK_DECL([SDL_GL_CONTEXT_MAJOR_VERSION], [], [SUPPORT_SDL_GLES=no], + [#include ]) + AC_CHECK_DECL([SDL_GL_CONTEXT_MINOR_VERSION], [], [SUPPORT_SDL_GLES=no], + [#include ]) + CPPFLAGS="$cogl_save_CPPFLAGS" + + AS_IF([test "x$SUPPORT_SDL_GLES" = "xyes"], + [ + SUPPORTED_SDL_GL_APIS="gles1 gles2" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_GLES_SUPPORT" + ], + [ SUPPORTED_SDL_GL_APIS="gl" ]) + ]) + ], + [SUPPORT_SDL=no]) +AM_CONDITIONAL(SUPPORT_SDL, [test "x$SUPPORT_SDL" = "xyes"]) + +AC_ARG_ENABLE( + [sdl2], + [AC_HELP_STRING([--enable-sdl2=@<:@no/yes@:>@], [Enable SDL2 support @<:@default=no@:>@])], + [], + [enable_sdl2=no]) +AS_IF([test "x$enable_sdl2" = "xyes"], + [ + PKG_CHECK_MODULES([SDL2], + [sdl2], + [], + [AC_MSG_ERROR([SDL2 support requested but SDL2 not found])]) + + SUPPORT_SDL2=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl2" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl2" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + ], + [SUPPORT_SDL2=no]) +AM_CONDITIONAL(SUPPORT_SDL2, [test "x$SUPPORT_SDL2" = "xyes"]) + +AS_IF([test "x$SUPPORT_SDL2" = "xyes" -a "x$SUPPORT_SDL" = "xyes"], + [AC_MSG_ERROR([The SDL1 and SDL2 winsyses are currently mutually exclusive])]) + +EGL_PLATFORM_COUNT=0 + +AC_ARG_ENABLE( + [null-egl-platform], + [AC_HELP_STRING([--enable-null-egl-platform=@<:@no/yes@:>@], [Enable support for the NULL egl platform @<:@default=no@:>@])], + [], + enable_null_egl_platform=no +) +AS_IF([test "x$enable_null_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS null" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, + [test "x$enable_null_egl_platform" = "xyes"]) + +AC_ARG_ENABLE( + [gdl-egl-platform], + [AC_HELP_STRING([--enable-gdl-egl-platform=@<:@no/yes@:>@], [Enable support for the GDL egl platform @<:@default=no@:>@])], + [], + enable_gdl_egl_platform=no +) +AS_IF([test "x$enable_gdl_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS gdl" + + AC_CHECK_HEADERS( + [libgdl.h], + [], + [ + AC_CHECK_HEADERS( + [CE4100/libgdl.h], + [ + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I/usr/include/CE4100" + ], + [AC_MSG_ERROR([libgdl.h not found])]) + ]) + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lgdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_GDL_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_GDL, + [test "x$enable_gdl_egl_platform" = "xyes"]) + +AC_ARG_ENABLE( + [wayland-egl-platform], + [AC_HELP_STRING([--enable-wayland-egl-platform=@<:@no/yes@:>@], [Enable support for the Wayland egl platform @<:@default=no@:>@])], + [], + enable_wayland_egl_platform=no +) +AS_IF([test "x$enable_wayland_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS wayland" + + PKG_CHECK_MODULES(WAYLAND_CLIENT, + [wayland-egl >= wayland_req_version wayland-client >= wayland_req_version]) + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-egl >= wayland_req_version" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-client >= wayland_req_version" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_WAYLAND, + [test "x$enable_wayland_egl_platform" = "xyes"]) + + +AC_ARG_ENABLE( + [kms-egl-platform], + [AC_HELP_STRING([--enable-kms-egl-platform=@<:@no/yes@:>@], [Enable support for the KMS egl platform @<:@default=no@:>@])], + [], + enable_kms_egl_platform=no +) +AS_IF([test "x$enable_kms_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS kms" + + PKG_CHECK_EXISTS([gbm], + [ + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gbm" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES libdrm" + ], + [AC_MSG_ERROR([Unable to locate required libgbm library for the KMS egl platform])]) + + GBM_VERSION=`$PKG_CONFIG --modversion gbm` + GBM_MAJOR=`echo $GBM_VERSION | cut -d'.' -f1` + GBM_MINOR=`echo $GBM_VERSION | cut -d'.' -f2` + GBM_MICRO=`echo $GBM_VERSION | cut -d'.' -f3 | sed 's/-.*//'` + + AC_DEFINE_UNQUOTED([COGL_GBM_MAJOR], [$GBM_MAJOR], [The major version for libgbm]) + AC_DEFINE_UNQUOTED([COGL_GBM_MINOR], [$GBM_MINOR], [The minor version for libgbm]) + AC_DEFINE_UNQUOTED([COGL_GBM_MICRO], [$GBM_MICRO], [The micro version for libgbm]) + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_KMS_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_KMS, + [test "x$enable_kms_egl_platform" = "xyes"]) + +AC_ARG_ENABLE( + [wayland-egl-server], + [AC_HELP_STRING([--enable-wayland-egl-server=@<:@no/yes@:>@], [Enable server side wayland support @<:@default=no@:>@])], + [], + enable_wayland_egl_server=no +) +AS_IF([test "x$enable_wayland_egl_server" = "xyes"], + [ + NEED_EGL=yes + + PKG_CHECK_MODULES(WAYLAND_SERVER, + [wayland-server >= wayland_server_req_version]) + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-server >= wayland_server_req_version" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_WAYLAND_EGL_SERVER, + [test "x$enable_wayland_egl_server" = "xyes"]) + +dnl Android EGL platform +AC_ARG_ENABLE( + [android-egl-platform], + [AC_HELP_STRING([--enable-android-egl-platform=@<:@no/yes@:>@], [Enable support for the Android egl platform @<:@default=no@:>@])], + [], + enable_android_egl_platform=no +) +AS_IF([test "x$enable_android_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + EGL_PLATFORMS="$EGL_PLATFORMS android" + + AC_CHECK_HEADER([android/native_window.h], + [], + [AC_MSG_ERROR([Unable to locate android/native_window.h])]) + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_ANDROID, + [test "x$enable_android_egl_platform" = "xyes"]) + +dnl This should go last, since it's the default fallback and we need +dnl to check the value of $EGL_PLATFORM_COUNT here. +AC_ARG_ENABLE( + [xlib-egl-platform], + [AC_HELP_STRING([--enable-xlib-egl-platform=@<:@no/yes@:>@], [Enable support for the Xlib egl platform @<:@default=auto@:>@])], + [], + AS_IF([test "x$enable_gles1" = "xyes" -o \ + "x$enable_gles2" = "xyes" && \ + test "x$SUPPORT_SDL_GLES" != "xyes" && \ + test "x$SUPPORT_SDL_WEBGL" != "xyes" && \ + test "x$SUPPORT_SDL2" != "xyes" && \ + test $EGL_PLATFORM_COUNT -eq 0], + [enable_xlib_egl_platform=yes], [enable_xlib_egl_platform=no]) +) +AS_IF([test "x$enable_xlib_egl_platform" = "xyes"], + [ + EGL_PLATFORM_COUNT=$((EGL_PLATFORM_COUNT+1)) + NEED_EGL=yes + NEED_XLIB=yes + EGL_PLATFORMS="$EGL_PLATFORMS xlib" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT" + ]) +AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_XLIB, + [test "x$enable_xlib_egl_platform" = "xyes"]) + +AS_IF([test "x$NEED_EGL" = "xyes" && test "x$EGL_CHECKED" != "xyes"], + [ + PKG_CHECK_EXISTS([egl], + [COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES egl"], + [ + AC_CHECK_HEADERS( + [EGL/egl.h], + [], + [AC_MSG_ERROR([Unable to locate required EGL headers])]) + AC_CHECK_HEADERS( + [EGL/eglext.h], + [], + [AC_MSG_ERROR([Unable to locate required EGL headers])], + [#include ]) + + AC_CHECK_LIB(EGL, [eglInitialize], + [COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lEGL"], + [AC_MSG_ERROR([Unable to locate required EGL library])]) + + COGL_EXTRA_LDFLAGS="$COGL_EXTRA_LDFLAGS -lEGL" + ] + ) + + COGL_EGL_INCLUDES="#include +#include " + AC_SUBST([COGL_EGL_INCLUDES]) + ]) + +AS_IF([test "x$NEED_EGL" = "xyes"], + [ + SUPPORT_EGL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS egl" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_EGL_SUPPORT" + ]) + +AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "xyes"]) + +dnl ======================================================== +dnl Check X11 dependencies if required +dnl ======================================================== +AS_IF([test "x$NEED_XLIB" = "xyes"], + [ + X11_MODULES="x11 xext xfixes >= xfixes_req_version xdamage xcomposite >= xcomposite_req_version xrandr >= xrandr_req_version" + PKG_CHECK_MODULES(DUMMY, [$X11_MODULES], + [COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES $X11_MODULES"]) + SUPPORT_X11=yes + SUPPORT_XLIB=yes + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11_SUPPORT" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB" + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB_SUPPORT" + ]) + +AM_CONDITIONAL(X11_TESTS, [test "x$SUPPORT_X11" = "xyes"]) +AM_CONDITIONAL(SUPPORT_X11, [test "x$SUPPORT_X11" = "xyes"]) +AM_CONDITIONAL(SUPPORT_XLIB, [test "x$SUPPORT_XLIB" = "xyes"]) + +dnl ================================================================ +dnl Documentation stuff. +dnl ================================================================ +# gtkdocize greps for ^GTK_DOC_CHECK and parses it, so you need to have +# it on it's own line. +m4_ifdef([GTK_DOC_CHECK], [ +GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl]) +]) +AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes"]) + +GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" +GDKPIXBUF_PREFIX="`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`" +AC_SUBST(GLIB_PREFIX) +AC_SUBST(GDKPIXBUF_PREFIX) + +dnl ================================================================ +dnl I18n stuff. +dnl ================================================================ +AM_GNU_GETTEXT_VERSION([0.17]) +AM_GNU_GETTEXT([external]) + +GETTEXT_PACKAGE="cogl" +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, + "$GETTEXT_PACKAGE", + [The prefix for our gettext translation domains.]) +AS_ALL_LINGUAS + + +AC_SUBST(COGL_PKG_REQUIRES) +if test -n "$COGL_PKG_REQUIRES"; then + PKG_CHECK_MODULES(COGL_DEP, [$COGL_PKG_REQUIRES]) + + if test -n "$COGL_PKG_REQUIRES_GL"; then + PKG_CHECK_MODULES(COGL_DEP_GL, [$COGL_PKG_REQUIRES_GL]) + + dnl Strip out the GL libraries from the GL pkg-config files so we can + dnl dynamically load them instead + gl_libs="" + for x in $COGL_DEP_GL_LIBS; do + AS_CASE([$x], + [-lGL], [], + [-lGLESv2], [], + [-lGLESv1_CM], [], + [*], [gl_libs="$gl_libs $x"]) + done + COGL_DEP_CFLAGS="$COGL_DEP_CFLAGS $COGL_DEP_CFLAGS_GL" + COGL_DEP_LIBS="$COGL_DEP_LIBS $gl_libs" + fi +fi +AC_SUBST(COGL_PANGO_PKG_REQUIRES) + +AS_IF([test "x$enable_cogl_pango" = "xyes"], + [PKG_CHECK_MODULES(COGL_PANGO_DEP, [$COGL_PANGO_PKG_REQUIRES])] +) +AM_CONDITIONAL([BUILD_COGL_PANGO], [test "x$enable_cogl_pango" = "xyes"]) + +AM_CONDITIONAL([BUILD_COGL_PATH], [test "x$enable_cogl_path" = "xyes"]) + +AC_SUBST(COGL_GST_PKG_REQUIRES) + +AS_IF([test "x$enable_cogl_gst" = "xyes"], + [PKG_CHECK_MODULES(COGL_GST_DEP, [$COGL_GST_PKG_REQUIRES])] +) +AM_CONDITIONAL([BUILD_COGL_GST], [test "x$enable_cogl_gst" = "xyes"]) + + + +dnl ================================================================ +dnl Misc program dependencies. +dnl ================================================================ +AC_PROG_INSTALL + +dnl ================================================================ +dnl GObject-Introspection check +dnl ================================================================ +AS_IF([test "x$enable_glib" = "xyes"], + [ + GOBJECT_INTROSPECTION_CHECK([gi_req_version]) + ], + [ + enable_introspection="no" + AM_CONDITIONAL([HAVE_INTROSPECTION], 0) + ] +) + +dnl ================================================================ +dnl Checks for header files. +dnl ================================================================ +AC_PATH_X +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h limits.h unistd.h) +AC_CHECK_HEADER([endian.h], + [AC_CHECK_DECL([__FLOAT_WORD_ORDER], + AC_DEFINE([HAVE_FLOAT_WORD_ORDER], [1], + [Has the __FLOAT_WORD_ORDER macro]))]) + +dnl ================================================================ +dnl Checks for library functions. +dnl ================================================================ + +dnl The 'ffs' function is part of C99 so it isn't always +dnl available. Cogl has a fallback if needed. +dnl +dnl XXX: ffs isnt available with the emscripten toolchain currently +dnl but the check passes so we manually skip the check in this case +AS_IF([test "x$enable_emscripten" = "xno"], + [AC_CHECK_FUNCS([ffs])]) + +dnl 'memmem' is a GNU extension but we have a simple fallback +AC_CHECK_FUNCS([memmem]) + +dnl This is used in the cogl-gles2-gears example but it is a GNU extension +save_libs="$LIBS" +LIBS="$LIBS $LIBM" +AC_CHECK_FUNCS([sincos]) +LIBS="$save_libs" + +dnl ================================================================ +dnl Platform values +dnl ================================================================ + +dnl These are values from system headers that we want to copy into the +dnl public Cogl headers without having to include the system header +dnl +dnl XXX: poll(2) can't currently be used with emscripten even though +dnl poll.h is in the toolchain headers so we manually skip the check +dnl in this case +have_poll_h=no +AS_IF([test "x$enable_emscripten" = "xno"], + [ + AC_CHECK_HEADER(poll.h, + [ + AC_COMPUTE_INT(COGL_SYSDEF_POLLIN, POLLIN, [#include ], + AC_MSG_ERROR([Unable to get value of POLLIN])) + AC_COMPUTE_INT(COGL_SYSDEF_POLLPRI, POLLPRI, [#include ], + AC_MSG_ERROR([Unable to get value of POLLPRI])) + AC_COMPUTE_INT(COGL_SYSDEF_POLLOUT, POLLOUT, [#include ], + AC_MSG_ERROR([Unable to get value of POLLOUT])) + AC_COMPUTE_INT(COGL_SYSDEF_POLLERR, POLLERR, [#include ], + AC_MSG_ERROR([Unable to get value of POLLERR])) + AC_COMPUTE_INT(COGL_SYSDEF_POLLHUP, POLLHUP, [#include ], + AC_MSG_ERROR([Unable to get value of POLLHUP])) + AC_COMPUTE_INT(COGL_SYSDEF_POLLNVAL, POLLNVAL, [#include ], + AC_MSG_ERROR([Unable to get value of POLLNVAL])) + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_POLL_SUPPORT" + have_poll_h=yes + ]) + ]) + +AS_IF([test "x$have_poll_h" = "xno"], + [ + COGL_SYSDEF_POLLIN=1 + COGL_SYSDEF_POLLPRI=2 + COGL_SYSDEF_POLLOUT=4 + COGL_SYSDEF_POLLERR=8 + COGL_SYSDEF_POLLHUP=16 + COGL_SYSDEF_POLLNVAL=32 + ]) + +COGL_DEFINES_EXTRA="$COGL_DEFINES_EXTRA +#define COGL_SYSDEF_POLLIN $COGL_SYSDEF_POLLIN +#define COGL_SYSDEF_POLLPRI $COGL_SYSDEF_POLLPRI +#define COGL_SYSDEF_POLLOUT $COGL_SYSDEF_POLLOUT +#define COGL_SYSDEF_POLLERR $COGL_SYSDEF_POLLERR +#define COGL_SYSDEF_POLLHUP $COGL_SYSDEF_POLLHUP +#define COGL_SYSDEF_POLLNVAL $COGL_SYSDEF_POLLNVAL +" + +dnl ================================================================ +dnl What needs to be substituted in other files +dnl ================================================================ +COGL_DEFINES="$COGL_DEFINES_EXTRA" +for x in $COGL_DEFINES_SYMBOLS; do + COGL_DEFINES="$COGL_DEFINES +#define $x 1" +done; +AC_SUBST(COGL_DEFINES) +AM_SUBST_NOTMAKE(COGL_DEFINES) + +AS_IF([test "x$cogl_gl_headers" = "x"], + [AC_MSG_ERROR([Internal error: no GL header set])]) +dnl cogl_gl_headers is a space separate list of headers to +dnl include. We'll now convert them to a single variable with a +dnl #include line for each header +COGL_GL_HEADER_INCLUDES="" +for x in $cogl_gl_headers; do + COGL_GL_HEADER_INCLUDES="$COGL_GL_HEADER_INCLUDES +#include <$x>" +done; +AC_SUBST(COGL_GL_HEADER_INCLUDES) +AM_SUBST_NOTMAKE(COGL_GL_HEADER_INCLUDES) + +AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], + [Can use Cogl 2.0 API internally]) +AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_API], [1], + [Can use experimental API internally]) + +AC_SUBST(COGL_DEP_CFLAGS) +AC_SUBST(COGL_DEP_LIBS) +AC_SUBST(COGL_PANGO_DEP_CFLAGS) +AC_SUBST(COGL_PANGO_DEP_LIBS) +AC_SUBST(COGL_GST_DEP_CFLAGS) +AC_SUBST(COGL_GST_DEP_LIBS) +AC_SUBST(COGL_EXTRA_CFLAGS) +AC_SUBST(COGL_EXTRA_LDFLAGS) + +# just for compatability with the clutter build... +MAINTAINER_CFLAGS= +AC_SUBST(MAINTAINER_CFLAGS) + +AC_OUTPUT( +Makefile +README +config.h.win32 +build/Makefile +build/win32/Makefile +build/win32/vs9/Makefile +build/win32/vs10/Makefile +deps/Makefile +deps/glib/Makefile +deps/gmodule/Makefile +deps/gmodule/gmoduleconf.h +test-fixtures/Makefile +cogl/Makefile +cogl/cogl-1.0.pc +cogl/cogl-2.0-experimental.pc +cogl/cogl-defines.h +cogl/cogl-defines.h.win32 +cogl/cogl-defines.h.win32_SDL +cogl/cogl-gl-header.h +cogl/cogl-egl-defines.h +cogl/cogl.rc +cogl-pango/Makefile +cogl-pango/cogl-pango-1.0.pc +cogl-pango/cogl-pango-2.0-experimental.pc +cogl-pango/cogl-pango.rc +cogl-path/Makefile +cogl-path/cogl-path-1.0.pc +cogl-path/cogl-path-2.0-experimental.pc +cogl-gst/Makefile +cogl-gst/cogl-gst-1.0.pc +cogl-gst/cogl-gst-2.0-experimental.pc +cogl-gles2/Makefile +cogl-gles2/cogl-gles2-1.0.pc +cogl-gles2/cogl-gles2-2.0-experimental.pc +doc/Makefile +doc/reference/Makefile +doc/reference/cogl/Makefile +doc/reference/cogl/cogl-docs.xml +doc/reference/cogl-2.0-experimental/Makefile +doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml +doc/reference/cogl-gst/Makefile +doc/reference/cogl-gst/cogl-gst-docs.xml +examples/Makefile +tests/Makefile +tests/config.env +tests/conform/Makefile +tests/unit/Makefile +tests/micro-perf/Makefile +tests/data/Makefile +po/Makefile.in +) + +dnl ================================================================ +dnl Dah Da! +dnl ================================================================ +echo "" +echo "Cogl - $COGL_1_VERSION/$COGL_VERSION (${COGL_RELEASE_STATUS})" + +# Global flags +echo "" +echo " • Global:" +echo " Prefix: ${prefix}" +if test "x$COGL_DEFAULT_DRIVER" != "x"; then +echo " Default driver: ${COGL_DEFAULT_DRIVER}" +fi + +echo "" +# Features +echo " • Features:" +echo " Drivers: ${enabled_drivers}" +AS_IF([test "x$GL_LIBRARY_DIRECTLY_LINKED" != xyes], + [for driver in $enabled_drivers; do + driver=`echo $driver | tr "[gles]" "[GLES]"` + libname=`eval echo \\$COGL_${driver}_LIBNAME` + echo " Library name for $driver: $libname" + done]) +echo " GL Window System APIs:${GL_WINSYS_APIS}" +if test "x$SUPPORT_EGL" = "xyes"; then +echo " EGL Platforms:${EGL_PLATFORMS}" +echo " Wayland compositor support: ${enable_wayland_egl_server}" +fi +if test "x$SUPPORT_SDL" = "xyes"; then +echo " Supported SDL GL APIs: ${SUPPORTED_SDL_GL_APIS}" +fi +echo " Building for emscripten environment: $enable_emscripten" +echo " Build libcogl-gles2 GLES 2.0 frontend api: ${enable_cogl_gles2}" +echo " Image backend: ${COGL_IMAGE_BACKEND}" +echo " Cogl Pango: ${enable_cogl_pango}" +echo " Cogl Gstreamer: ${enable_cogl_gst}" +echo " Cogl Path: ${enable_cogl_path}" + +# Compiler/Debug related flags +echo "" +echo " • Build options:" +echo " Debugging: ${enable_debug}" +echo " Profiling: ${enable_profile}" +echo " Enable deprecated symbols: ${enable_deprecated}" +echo " Compiler flags: ${CFLAGS} ${COGL_EXTRA_CFLAGS}" +echo " Linker flags: ${LDFLAGS} ${COGL_EXTRA_LDFLAGS}" + +# Miscellaneous +echo "" +echo " • Extra:" +echo " Build API reference: ${enable_gtk_doc}" +echo " Build introspection data: ${enable_introspection}" +echo " Build unit tests: ${enable_unit_tests}" +echo " Enable internationalization: ${USE_NLS}" + +echo "" + +# General warning about experimental features +if test "x$EXPERIMENTAL_CONFIG" = "xyes"; then +echo "" +echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠" +echo " *WARNING*" +echo "" +echo " The stability of your build might be affected by one or more" +echo " experimental configuration options." +echo +echo " experimental options: $EXPERIMENTAL_OPTIONS" +echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠" +echo "" +fi diff --git a/deps/Makefile.am b/deps/Makefile.am new file mode 100644 index 0000000..2cd3cb5 --- /dev/null +++ b/deps/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = + +if !USE_GLIB +SUBDIRS += glib gmodule +endif diff --git a/deps/Makefile.in b/deps/Makefile.in new file mode 100644 index 0000000..5a74f22 --- /dev/null +++ b/deps/Makefile.in @@ -0,0 +1,752 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@USE_GLIB_FALSE@am__append_1 = glib gmodule +subdir = deps +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = glib gmodule +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = $(am__append_1) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign deps/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign deps/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/deps/glib/COPYING b/deps/glib/COPYING new file mode 100644 index 0000000..bf50f20 --- /dev/null +++ b/deps/glib/COPYING @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/deps/glib/Makefile.am b/deps/glib/Makefile.am new file mode 100644 index 0000000..9a4544f --- /dev/null +++ b/deps/glib/Makefile.am @@ -0,0 +1,75 @@ + +noinst_LTLIBRARIES = libglib.la + +libglib_la_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/deps \ + -Wall \ + $(NULL) + +libglib_la_SOURCES = \ + galloca.h \ + garray.c \ + garray.h \ + gatomic.c \ + gatomic.h \ + gbacktrace.h \ + gbitlock.c \ + gbitlock.h \ + gconvert.c \ + gconvert.h \ + gdatasetprivate.h \ + gdataset.c \ + gdataset.h \ + gdebug.h \ + gerror.c \ + gerror.h \ + gfileutils.c \ + gfileutils.h \ + ghash.c \ + ghash.h \ + ghook.c \ + ghook.h \ + gi18n-lib.h \ + glibintl.h \ + glib.h \ + glib-object.h \ + glib_trace.h \ + glist.c \ + glist.h \ + gmacros.h \ + gmain.c \ + gmain.h \ + gmem.c \ + gmem.h \ + gmessages.c \ + gmessages.h \ + gprintf.c \ + gprintf.h \ + gprintfint.h \ + gqsort.c \ + gqsort.h \ + gquark.h \ + gqueue.c \ + gqueue.h \ + gslice.c \ + gslice.h \ + gslist.c \ + gslist.h \ + gstdio.c \ + gstdio.h \ + gstrfuncs.c \ + gstrfuncs.h \ + gstring.c \ + gstring.h \ + gtestutils.c \ + gtestutils.h \ + gthread.c \ + gthread.h \ + gtypes.h \ + gunicode.h \ + gutils.c \ + gutils.h \ + $(NULL) + +EXTRA_DIST = README diff --git a/deps/glib/Makefile.in b/deps/glib/Makefile.in new file mode 100644 index 0000000..bf7cae9 --- /dev/null +++ b/deps/glib/Makefile.in @@ -0,0 +1,991 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = deps/glib +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp COPYING README +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libglib_la_LIBADD = +am_libglib_la_OBJECTS = libglib_la-garray.lo libglib_la-gatomic.lo \ + libglib_la-gbitlock.lo libglib_la-gconvert.lo \ + libglib_la-gdataset.lo libglib_la-gerror.lo \ + libglib_la-gfileutils.lo libglib_la-ghash.lo \ + libglib_la-ghook.lo libglib_la-glist.lo libglib_la-gmain.lo \ + libglib_la-gmem.lo libglib_la-gmessages.lo \ + libglib_la-gprintf.lo libglib_la-gqsort.lo \ + libglib_la-gqueue.lo libglib_la-gslice.lo libglib_la-gslist.lo \ + libglib_la-gstdio.lo libglib_la-gstrfuncs.lo \ + libglib_la-gstring.lo libglib_la-gtestutils.lo \ + libglib_la-gthread.lo libglib_la-gutils.lo +libglib_la_OBJECTS = $(am_libglib_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libglib_la_SOURCES) +DIST_SOURCES = $(libglib_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libglib.la +libglib_la_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/deps \ + -Wall \ + $(NULL) + +libglib_la_SOURCES = \ + galloca.h \ + garray.c \ + garray.h \ + gatomic.c \ + gatomic.h \ + gbacktrace.h \ + gbitlock.c \ + gbitlock.h \ + gconvert.c \ + gconvert.h \ + gdatasetprivate.h \ + gdataset.c \ + gdataset.h \ + gdebug.h \ + gerror.c \ + gerror.h \ + gfileutils.c \ + gfileutils.h \ + ghash.c \ + ghash.h \ + ghook.c \ + ghook.h \ + gi18n-lib.h \ + glibintl.h \ + glib.h \ + glib-object.h \ + glib_trace.h \ + glist.c \ + glist.h \ + gmacros.h \ + gmain.c \ + gmain.h \ + gmem.c \ + gmem.h \ + gmessages.c \ + gmessages.h \ + gprintf.c \ + gprintf.h \ + gprintfint.h \ + gqsort.c \ + gqsort.h \ + gquark.h \ + gqueue.c \ + gqueue.h \ + gslice.c \ + gslice.h \ + gslist.c \ + gslist.h \ + gstdio.c \ + gstdio.h \ + gstrfuncs.c \ + gstrfuncs.h \ + gstring.c \ + gstring.h \ + gtestutils.c \ + gtestutils.h \ + gthread.c \ + gthread.h \ + gtypes.h \ + gunicode.h \ + gutils.c \ + gutils.h \ + $(NULL) + +EXTRA_DIST = README +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign deps/glib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign deps/glib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libglib.la: $(libglib_la_OBJECTS) $(libglib_la_DEPENDENCIES) $(EXTRA_libglib_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libglib_la_OBJECTS) $(libglib_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-garray.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gatomic.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gbitlock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gconvert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gdataset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gfileutils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-ghash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-ghook.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-glist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gmain.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gmem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gmessages.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gqsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gqueue.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gslice.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gslist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gstdio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gstrfuncs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gstring.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gtestutils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gthread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libglib_la-gutils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libglib_la-garray.lo: garray.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-garray.lo -MD -MP -MF $(DEPDIR)/libglib_la-garray.Tpo -c -o libglib_la-garray.lo `test -f 'garray.c' || echo '$(srcdir)/'`garray.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-garray.Tpo $(DEPDIR)/libglib_la-garray.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='garray.c' object='libglib_la-garray.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-garray.lo `test -f 'garray.c' || echo '$(srcdir)/'`garray.c + +libglib_la-gatomic.lo: gatomic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gatomic.lo -MD -MP -MF $(DEPDIR)/libglib_la-gatomic.Tpo -c -o libglib_la-gatomic.lo `test -f 'gatomic.c' || echo '$(srcdir)/'`gatomic.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gatomic.Tpo $(DEPDIR)/libglib_la-gatomic.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gatomic.c' object='libglib_la-gatomic.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gatomic.lo `test -f 'gatomic.c' || echo '$(srcdir)/'`gatomic.c + +libglib_la-gbitlock.lo: gbitlock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gbitlock.lo -MD -MP -MF $(DEPDIR)/libglib_la-gbitlock.Tpo -c -o libglib_la-gbitlock.lo `test -f 'gbitlock.c' || echo '$(srcdir)/'`gbitlock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gbitlock.Tpo $(DEPDIR)/libglib_la-gbitlock.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gbitlock.c' object='libglib_la-gbitlock.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gbitlock.lo `test -f 'gbitlock.c' || echo '$(srcdir)/'`gbitlock.c + +libglib_la-gconvert.lo: gconvert.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gconvert.lo -MD -MP -MF $(DEPDIR)/libglib_la-gconvert.Tpo -c -o libglib_la-gconvert.lo `test -f 'gconvert.c' || echo '$(srcdir)/'`gconvert.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gconvert.Tpo $(DEPDIR)/libglib_la-gconvert.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gconvert.c' object='libglib_la-gconvert.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gconvert.lo `test -f 'gconvert.c' || echo '$(srcdir)/'`gconvert.c + +libglib_la-gdataset.lo: gdataset.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gdataset.lo -MD -MP -MF $(DEPDIR)/libglib_la-gdataset.Tpo -c -o libglib_la-gdataset.lo `test -f 'gdataset.c' || echo '$(srcdir)/'`gdataset.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gdataset.Tpo $(DEPDIR)/libglib_la-gdataset.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gdataset.c' object='libglib_la-gdataset.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gdataset.lo `test -f 'gdataset.c' || echo '$(srcdir)/'`gdataset.c + +libglib_la-gerror.lo: gerror.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gerror.lo -MD -MP -MF $(DEPDIR)/libglib_la-gerror.Tpo -c -o libglib_la-gerror.lo `test -f 'gerror.c' || echo '$(srcdir)/'`gerror.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gerror.Tpo $(DEPDIR)/libglib_la-gerror.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gerror.c' object='libglib_la-gerror.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gerror.lo `test -f 'gerror.c' || echo '$(srcdir)/'`gerror.c + +libglib_la-gfileutils.lo: gfileutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gfileutils.lo -MD -MP -MF $(DEPDIR)/libglib_la-gfileutils.Tpo -c -o libglib_la-gfileutils.lo `test -f 'gfileutils.c' || echo '$(srcdir)/'`gfileutils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gfileutils.Tpo $(DEPDIR)/libglib_la-gfileutils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gfileutils.c' object='libglib_la-gfileutils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gfileutils.lo `test -f 'gfileutils.c' || echo '$(srcdir)/'`gfileutils.c + +libglib_la-ghash.lo: ghash.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-ghash.lo -MD -MP -MF $(DEPDIR)/libglib_la-ghash.Tpo -c -o libglib_la-ghash.lo `test -f 'ghash.c' || echo '$(srcdir)/'`ghash.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-ghash.Tpo $(DEPDIR)/libglib_la-ghash.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ghash.c' object='libglib_la-ghash.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-ghash.lo `test -f 'ghash.c' || echo '$(srcdir)/'`ghash.c + +libglib_la-ghook.lo: ghook.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-ghook.lo -MD -MP -MF $(DEPDIR)/libglib_la-ghook.Tpo -c -o libglib_la-ghook.lo `test -f 'ghook.c' || echo '$(srcdir)/'`ghook.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-ghook.Tpo $(DEPDIR)/libglib_la-ghook.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ghook.c' object='libglib_la-ghook.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-ghook.lo `test -f 'ghook.c' || echo '$(srcdir)/'`ghook.c + +libglib_la-glist.lo: glist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-glist.lo -MD -MP -MF $(DEPDIR)/libglib_la-glist.Tpo -c -o libglib_la-glist.lo `test -f 'glist.c' || echo '$(srcdir)/'`glist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-glist.Tpo $(DEPDIR)/libglib_la-glist.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glist.c' object='libglib_la-glist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-glist.lo `test -f 'glist.c' || echo '$(srcdir)/'`glist.c + +libglib_la-gmain.lo: gmain.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gmain.lo -MD -MP -MF $(DEPDIR)/libglib_la-gmain.Tpo -c -o libglib_la-gmain.lo `test -f 'gmain.c' || echo '$(srcdir)/'`gmain.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gmain.Tpo $(DEPDIR)/libglib_la-gmain.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gmain.c' object='libglib_la-gmain.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gmain.lo `test -f 'gmain.c' || echo '$(srcdir)/'`gmain.c + +libglib_la-gmem.lo: gmem.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gmem.lo -MD -MP -MF $(DEPDIR)/libglib_la-gmem.Tpo -c -o libglib_la-gmem.lo `test -f 'gmem.c' || echo '$(srcdir)/'`gmem.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gmem.Tpo $(DEPDIR)/libglib_la-gmem.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gmem.c' object='libglib_la-gmem.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gmem.lo `test -f 'gmem.c' || echo '$(srcdir)/'`gmem.c + +libglib_la-gmessages.lo: gmessages.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gmessages.lo -MD -MP -MF $(DEPDIR)/libglib_la-gmessages.Tpo -c -o libglib_la-gmessages.lo `test -f 'gmessages.c' || echo '$(srcdir)/'`gmessages.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gmessages.Tpo $(DEPDIR)/libglib_la-gmessages.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gmessages.c' object='libglib_la-gmessages.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gmessages.lo `test -f 'gmessages.c' || echo '$(srcdir)/'`gmessages.c + +libglib_la-gprintf.lo: gprintf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gprintf.lo -MD -MP -MF $(DEPDIR)/libglib_la-gprintf.Tpo -c -o libglib_la-gprintf.lo `test -f 'gprintf.c' || echo '$(srcdir)/'`gprintf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gprintf.Tpo $(DEPDIR)/libglib_la-gprintf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gprintf.c' object='libglib_la-gprintf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gprintf.lo `test -f 'gprintf.c' || echo '$(srcdir)/'`gprintf.c + +libglib_la-gqsort.lo: gqsort.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gqsort.lo -MD -MP -MF $(DEPDIR)/libglib_la-gqsort.Tpo -c -o libglib_la-gqsort.lo `test -f 'gqsort.c' || echo '$(srcdir)/'`gqsort.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gqsort.Tpo $(DEPDIR)/libglib_la-gqsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gqsort.c' object='libglib_la-gqsort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gqsort.lo `test -f 'gqsort.c' || echo '$(srcdir)/'`gqsort.c + +libglib_la-gqueue.lo: gqueue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gqueue.lo -MD -MP -MF $(DEPDIR)/libglib_la-gqueue.Tpo -c -o libglib_la-gqueue.lo `test -f 'gqueue.c' || echo '$(srcdir)/'`gqueue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gqueue.Tpo $(DEPDIR)/libglib_la-gqueue.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gqueue.c' object='libglib_la-gqueue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gqueue.lo `test -f 'gqueue.c' || echo '$(srcdir)/'`gqueue.c + +libglib_la-gslice.lo: gslice.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gslice.lo -MD -MP -MF $(DEPDIR)/libglib_la-gslice.Tpo -c -o libglib_la-gslice.lo `test -f 'gslice.c' || echo '$(srcdir)/'`gslice.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gslice.Tpo $(DEPDIR)/libglib_la-gslice.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gslice.c' object='libglib_la-gslice.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gslice.lo `test -f 'gslice.c' || echo '$(srcdir)/'`gslice.c + +libglib_la-gslist.lo: gslist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gslist.lo -MD -MP -MF $(DEPDIR)/libglib_la-gslist.Tpo -c -o libglib_la-gslist.lo `test -f 'gslist.c' || echo '$(srcdir)/'`gslist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gslist.Tpo $(DEPDIR)/libglib_la-gslist.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gslist.c' object='libglib_la-gslist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gslist.lo `test -f 'gslist.c' || echo '$(srcdir)/'`gslist.c + +libglib_la-gstdio.lo: gstdio.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gstdio.lo -MD -MP -MF $(DEPDIR)/libglib_la-gstdio.Tpo -c -o libglib_la-gstdio.lo `test -f 'gstdio.c' || echo '$(srcdir)/'`gstdio.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gstdio.Tpo $(DEPDIR)/libglib_la-gstdio.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstdio.c' object='libglib_la-gstdio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gstdio.lo `test -f 'gstdio.c' || echo '$(srcdir)/'`gstdio.c + +libglib_la-gstrfuncs.lo: gstrfuncs.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gstrfuncs.lo -MD -MP -MF $(DEPDIR)/libglib_la-gstrfuncs.Tpo -c -o libglib_la-gstrfuncs.lo `test -f 'gstrfuncs.c' || echo '$(srcdir)/'`gstrfuncs.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gstrfuncs.Tpo $(DEPDIR)/libglib_la-gstrfuncs.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstrfuncs.c' object='libglib_la-gstrfuncs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gstrfuncs.lo `test -f 'gstrfuncs.c' || echo '$(srcdir)/'`gstrfuncs.c + +libglib_la-gstring.lo: gstring.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gstring.lo -MD -MP -MF $(DEPDIR)/libglib_la-gstring.Tpo -c -o libglib_la-gstring.lo `test -f 'gstring.c' || echo '$(srcdir)/'`gstring.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gstring.Tpo $(DEPDIR)/libglib_la-gstring.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstring.c' object='libglib_la-gstring.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gstring.lo `test -f 'gstring.c' || echo '$(srcdir)/'`gstring.c + +libglib_la-gtestutils.lo: gtestutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gtestutils.lo -MD -MP -MF $(DEPDIR)/libglib_la-gtestutils.Tpo -c -o libglib_la-gtestutils.lo `test -f 'gtestutils.c' || echo '$(srcdir)/'`gtestutils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gtestutils.Tpo $(DEPDIR)/libglib_la-gtestutils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gtestutils.c' object='libglib_la-gtestutils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gtestutils.lo `test -f 'gtestutils.c' || echo '$(srcdir)/'`gtestutils.c + +libglib_la-gthread.lo: gthread.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gthread.lo -MD -MP -MF $(DEPDIR)/libglib_la-gthread.Tpo -c -o libglib_la-gthread.lo `test -f 'gthread.c' || echo '$(srcdir)/'`gthread.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gthread.Tpo $(DEPDIR)/libglib_la-gthread.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gthread.c' object='libglib_la-gthread.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gthread.lo `test -f 'gthread.c' || echo '$(srcdir)/'`gthread.c + +libglib_la-gutils.lo: gutils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libglib_la-gutils.lo -MD -MP -MF $(DEPDIR)/libglib_la-gutils.Tpo -c -o libglib_la-gutils.lo `test -f 'gutils.c' || echo '$(srcdir)/'`gutils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libglib_la-gutils.Tpo $(DEPDIR)/libglib_la-gutils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gutils.c' object='libglib_la-gutils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libglib_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libglib_la-gutils.lo `test -f 'gutils.c' || echo '$(srcdir)/'`gutils.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/deps/glib/README b/deps/glib/README new file mode 100644 index 0000000..312dbaf --- /dev/null +++ b/deps/glib/README @@ -0,0 +1,14 @@ +These are files striped from glib 2.30.2 to build a standalone cogl. A few +changes were done on those imported files: + +- the needed functions in gconvert.[ch] have been stubbed (don't want any of the + charset conversions in error messages in standalone mode, +- gmain.c has been stipped to only have the one used function + (g_get_current_time()), +- gtestutils.c has also being stripped down to what cogl uses to reduce what it + pulls in, +- gmessage.c has seen the charset conversions and invalid unicode caracters + escaping stripped. +- charset conversion in error messages has been removed in gstrfuncs.c +- g_string_append_uri_escaped() has been removed from gstrinc.c +- remove g_get_codeset() from gutils.c diff --git a/deps/glib/galloca.h b/deps/glib/galloca.h new file mode 100644 index 0000000..8876836 --- /dev/null +++ b/deps/glib/galloca.h @@ -0,0 +1,110 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_ALLOCA_H__ +#define __G_ALLOCA_H__ + +#include + +#ifdef __GNUC__ +/* GCC does the right thing */ +# undef alloca +# define alloca(size) __builtin_alloca (size) +#elif defined (GLIB_HAVE_ALLOCA_H) +/* a native and working alloca.h is there */ +# include +#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ +# if defined(_MSC_VER) || defined(__DMC__) +# include +# define alloca _alloca +# else /* !_MSC_VER && !__DMC__ */ +# ifdef _AIX +# pragma alloca +# else /* !_AIX */ +# ifndef alloca /* predefined by HP cc +Olibcalls */ +G_BEGIN_DECLS +char *alloca (); +G_END_DECLS +# endif /* !alloca */ +# endif /* !_AIX */ +# endif /* !_MSC_VER && !__DMC__ */ +#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ + +/** + * g_alloca: + * @size: number of bytes to allocate. + * + * Allocates @size bytes on the stack; these bytes will be freed when the current + * stack frame is cleaned up. This macro essentially just wraps the alloca() + * function present on most UNIX variants. + * Thus it provides the same advantages and pitfalls as alloca(): + * + * + * + alloca() is very fast, as on most systems it's implemented by just adjusting + * the stack pointer register. + * + * + * + It doesn't cause any memory fragmentation, within its scope, separate alloca() + * blocks just build up and are released together at function end. + * + * + * - Allocation sizes have to fit into the current stack frame. For instance in a + * threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes, + * so be sparse with alloca() uses. + * + * + * - Allocation failure due to insufficient stack space is not indicated with a %NULL + * return like e.g. with malloc(). Instead, most systems probably handle it the same + * way as out of stack space situations from infinite function recursion, i.e. + * with a segmentation fault. + * + * + * - Special care has to be taken when mixing alloca() with GNU C variable sized arrays. + * Stack space allocated with alloca() in the same scope as a variable sized array + * will be freed together with the variable sized array upon exit of that scope, and + * not upon exit of the enclosing function scope. + * + * + * + * Returns: space for @size bytes, allocated on the stack + */ +#define g_alloca(size) alloca (size) +/** + * g_newa: + * @struct_type: Type of memory chunks to be allocated + * @n_structs: Number of chunks to be allocated + * + * Wraps g_alloca() in a more typesafe manner. + * + * Returns: Pointer to stack space for @n_structs chunks of type @struct_type + */ +#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs))) + +#endif /* __G_ALLOCA_H__ */ diff --git a/deps/glib/garray.c b/deps/glib/garray.c new file mode 100644 index 0000000..c3d07f2 --- /dev/null +++ b/deps/glib/garray.c @@ -0,0 +1,1624 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include +#include + +#include "garray.h" + +#include "gmem.h" +#include "gatomic.h" +#include "gmessages.h" +#include "gqsort.h" + + +/** + * SECTION:arrays + * @title: Arrays + * @short_description: arrays of arbitrary elements which grow + * automatically as elements are added + * + * Arrays are similar to standard C arrays, except that they grow + * automatically as elements are added. + * + * Array elements can be of any size (though all elements of one array + * are the same size), and the array can be automatically cleared to + * '0's and zero-terminated. + * + * To create a new array use g_array_new(). + * + * To add elements to an array, use g_array_append_val(), + * g_array_append_vals(), g_array_prepend_val(), and + * g_array_prepend_vals(). + * + * To access an element of an array, use g_array_index(). + * + * To set the size of an array, use g_array_set_size(). + * + * To free an array, use g_array_free(). + * + * + * Using a #GArray to store #gint values + * + * GArray *garray; + * gint i; + * /* We create a new array to store gint values. + * We don't want it zero-terminated or cleared to 0's. */ + * garray = g_array_new (FALSE, FALSE, sizeof (gint)); + * for (i = 0; i < 10000; i++) + * g_array_append_val (garray, i); + * for (i = 0; i < 10000; i++) + * if (g_array_index (garray, gint, i) != i) + * g_print ("ERROR: got %d instead of %d\n", + * g_array_index (garray, gint, i), i); + * g_array_free (garray, TRUE); + * + * + **/ + +#define MIN_ARRAY_SIZE 16 + +typedef struct _GRealArray GRealArray; + +/** + * GArray: + * @data: a pointer to the element data. The data may be moved as + * elements are added to the #GArray. + * @len: the number of elements in the #GArray not including the + * possible terminating zero element. + * + * Contains the public fields of an Array. + **/ +struct _GRealArray +{ + guint8 *data; + guint len; + guint alloc; + guint elt_size; + guint zero_terminated : 1; + guint clear : 1; + gint ref_count; +}; + +/** + * g_array_index: + * @a: a #GArray. + * @t: the type of the elements. + * @i: the index of the element to return. + * @Returns: the element of the #GArray at the index given by @i. + * + * Returns the element of a #GArray at the given index. The return + * value is cast to the given type. + * + * + * Getting a pointer to an element in a #GArray + * + * EDayViewEvent *event; + * /* This gets a pointer to the 4th element + * in the array of EDayViewEvent structs. */ + * event = &g_array_index (events, EDayViewEvent, 3); + * + * + **/ + +#define g_array_elt_len(array,i) ((array)->elt_size * (i)) +#define g_array_elt_pos(array,i) ((array)->data + g_array_elt_len((array),(i))) +#define g_array_elt_zero(array, pos, len) \ + (memset (g_array_elt_pos ((array), pos), 0, g_array_elt_len ((array), len))) +#define g_array_zero_terminate(array) G_STMT_START{ \ + if ((array)->zero_terminated) \ + g_array_elt_zero ((array), (array)->len, 1); \ +}G_STMT_END + +static guint g_nearest_pow (gint num) G_GNUC_CONST; +static void g_array_maybe_expand (GRealArray *array, + gint len); + +/** + * g_array_new: + * @zero_terminated: %TRUE if the array should have an extra element at + * the end which is set to 0. + * @clear_: %TRUE if #GArray elements should be automatically cleared + * to 0 when they are allocated. + * @element_size: the size of each element in bytes. + * @Returns: the new #GArray. + * + * Creates a new #GArray with a reference count of 1. + **/ +GArray* +g_array_new (gboolean zero_terminated, + gboolean clear, + guint elt_size) +{ + return (GArray*) g_array_sized_new (zero_terminated, clear, elt_size, 0); +} + +/** + * g_array_sized_new: + * @zero_terminated: %TRUE if the array should have an extra element at + * the end with all bits cleared. + * @clear_: %TRUE if all bits in the array should be cleared to 0 on + * allocation. + * @element_size: size of each element in the array. + * @reserved_size: number of elements preallocated. + * @Returns: the new #GArray. + * + * Creates a new #GArray with @reserved_size elements preallocated and + * a reference count of 1. This avoids frequent reallocation, if you + * are going to add many elements to the array. Note however that the + * size of the array is still 0. + **/ +GArray* g_array_sized_new (gboolean zero_terminated, + gboolean clear, + guint elt_size, + guint reserved_size) +{ + GRealArray *array = g_slice_new (GRealArray); + + array->data = NULL; + array->len = 0; + array->alloc = 0; + array->zero_terminated = (zero_terminated ? 1 : 0); + array->clear = (clear ? 1 : 0); + array->elt_size = elt_size; + array->ref_count = 1; + + if (array->zero_terminated || reserved_size != 0) + { + g_array_maybe_expand (array, reserved_size); + g_array_zero_terminate(array); + } + + return (GArray*) array; +} + +/** + * g_array_ref: + * @array: A #GArray. + * + * Atomically increments the reference count of @array by one. This + * function is MT-safe and may be called from any thread. + * + * Returns: The passed in #GArray. + * + * Since: 2.22 + **/ +GArray * +g_array_ref (GArray *array) +{ + GRealArray *rarray = (GRealArray*) array; + g_return_val_if_fail (array, NULL); + + g_atomic_int_inc (&rarray->ref_count); + + return array; +} + +/** + * g_array_unref: + * @array: A #GArray. + * + * Atomically decrements the reference count of @array by one. If the + * reference count drops to 0, all memory allocated by the array is + * released. This function is MT-safe and may be called from any + * thread. + * + * Since: 2.22 + **/ +void +g_array_unref (GArray *array) +{ + GRealArray *rarray = (GRealArray*) array; + g_return_if_fail (array); + + if (g_atomic_int_dec_and_test (&rarray->ref_count)) + g_array_free (array, TRUE); +} + +/** + * g_array_get_element_size: + * @array: A #GArray. + * + * Gets the size of the elements in @array. + * + * Returns: Size of each element, in bytes. + * + * Since: 2.22 + **/ +guint +g_array_get_element_size (GArray *array) +{ + GRealArray *rarray = (GRealArray*) array; + + g_return_val_if_fail (array, 0); + + return rarray->elt_size; +} + +/** + * g_array_free: + * @array: a #GArray. + * @free_segment: if %TRUE the actual element data is freed as well. + * @Returns: the element data if @free_segment is %FALSE, otherwise + * %NULL. The element data should be freed using g_free(). + * + * Frees the memory allocated for the #GArray. If @free_segment is + * %TRUE it frees the memory block holding the elements as well and + * also each element if @array has a @element_free_func set. Pass + * %FALSE if you want to free the #GArray wrapper but preserve the + * underlying array for use elsewhere. If the reference count of @array + * is greater than one, the #GArray wrapper is preserved but the size + * of @array will be set to zero. + * + * If array elements contain dynamically-allocated memory, + * they should be freed separately. + **/ +gchar* +g_array_free (GArray *farray, + gboolean free_segment) +{ + GRealArray *array = (GRealArray*) farray; + gchar* segment; + gboolean preserve_wrapper; + + g_return_val_if_fail (array, NULL); + + /* if others are holding a reference, preserve the wrapper but do free/return the data */ + preserve_wrapper = FALSE; + if (g_atomic_int_get (&array->ref_count) > 1) + preserve_wrapper = TRUE; + + if (free_segment) + { + g_free (array->data); + segment = NULL; + } + else + segment = (gchar*) array->data; + + if (preserve_wrapper) + { + array->data = NULL; + array->len = 0; + array->alloc = 0; + } + else + { + g_slice_free1 (sizeof (GRealArray), array); + } + + return segment; +} + +/** + * g_array_append_vals: + * @array: a #GArray. + * @data: a pointer to the elements to append to the end of the array. + * @len: the number of elements to append. + * @Returns: the #GArray. + * + * Adds @len elements onto the end of the array. + **/ +/** + * g_array_append_val: + * @a: a #GArray. + * @v: the value to append to the #GArray. + * @Returns: the #GArray. + * + * Adds the value on to the end of the array. The array will grow in + * size automatically if necessary. + * + * g_array_append_val() is a macro which uses a reference + * to the value parameter @v. This means that you cannot use it with + * literal values such as "27". You must use variables. + **/ +GArray* +g_array_append_vals (GArray *farray, + gconstpointer data, + guint len) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + g_array_maybe_expand (array, len); + + memcpy (g_array_elt_pos (array, array->len), data, + g_array_elt_len (array, len)); + + array->len += len; + + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_prepend_vals: + * @array: a #GArray. + * @data: a pointer to the elements to prepend to the start of the + * array. + * @len: the number of elements to prepend. + * @Returns: the #GArray. + * + * Adds @len elements onto the start of the array. + * + * This operation is slower than g_array_append_vals() since the + * existing elements in the array have to be moved to make space for + * the new elements. + **/ +/** + * g_array_prepend_val: + * @a: a #GArray. + * @v: the value to prepend to the #GArray. + * @Returns: the #GArray. + * + * Adds the value on to the start of the array. The array will grow in + * size automatically if necessary. + * + * This operation is slower than g_array_append_val() since the + * existing elements in the array have to be moved to make space for + * the new element. + * + * g_array_prepend_val() is a macro which uses a reference + * to the value parameter @v. This means that you cannot use it with + * literal values such as "27". You must use variables. + **/ +GArray* +g_array_prepend_vals (GArray *farray, + gconstpointer data, + guint len) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + g_array_maybe_expand (array, len); + + g_memmove (g_array_elt_pos (array, len), g_array_elt_pos (array, 0), + g_array_elt_len (array, array->len)); + + memcpy (g_array_elt_pos (array, 0), data, g_array_elt_len (array, len)); + + array->len += len; + + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_insert_vals: + * @array: a #GArray. + * @index_: the index to place the elements at. + * @data: a pointer to the elements to insert. + * @len: the number of elements to insert. + * @Returns: the #GArray. + * + * Inserts @len elements into a #GArray at the given index. + **/ +/** + * g_array_insert_val: + * @a: a #GArray. + * @i: the index to place the element at. + * @v: the value to insert into the array. + * @Returns: the #GArray. + * + * Inserts an element into an array at the given index. + * + * g_array_insert_val() is a macro which uses a reference + * to the value parameter @v. This means that you cannot use it with + * literal values such as "27". You must use variables. + **/ +GArray* +g_array_insert_vals (GArray *farray, + guint index_, + gconstpointer data, + guint len) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + g_array_maybe_expand (array, len); + + g_memmove (g_array_elt_pos (array, len + index_), + g_array_elt_pos (array, index_), + g_array_elt_len (array, array->len - index_)); + + memcpy (g_array_elt_pos (array, index_), data, g_array_elt_len (array, len)); + + array->len += len; + + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_set_size: + * @array: a #GArray. + * @length: the new size of the #GArray. + * @Returns: the #GArray. + * + * Sets the size of the array, expanding it if necessary. If the array + * was created with @clear_ set to %TRUE, the new elements are set to 0. + **/ +GArray* +g_array_set_size (GArray *farray, + guint length) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + if (length > array->len) + { + g_array_maybe_expand (array, length - array->len); + + if (array->clear) + g_array_elt_zero (array, array->len, length - array->len); + } + else if (G_UNLIKELY (g_mem_gc_friendly) && length < array->len) + g_array_elt_zero (array, length, array->len - length); + + array->len = length; + + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_remove_index: + * @array: a #GArray. + * @index_: the index of the element to remove. + * @Returns: the #GArray. + * + * Removes the element at the given index from a #GArray. The following + * elements are moved down one place. + **/ +GArray* +g_array_remove_index (GArray *farray, + guint index_) +{ + GRealArray* array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + g_return_val_if_fail (index_ < array->len, NULL); + + if (index_ != array->len - 1) + g_memmove (g_array_elt_pos (array, index_), + g_array_elt_pos (array, index_ + 1), + g_array_elt_len (array, array->len - index_ - 1)); + + array->len -= 1; + + if (G_UNLIKELY (g_mem_gc_friendly)) + g_array_elt_zero (array, array->len, 1); + else + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_remove_index_fast: + * @array: a @GArray. + * @index_: the index of the element to remove. + * @Returns: the #GArray. + * + * Removes the element at the given index from a #GArray. The last + * element in the array is used to fill in the space, so this function + * does not preserve the order of the #GArray. But it is faster than + * g_array_remove_index(). + **/ +GArray* +g_array_remove_index_fast (GArray *farray, + guint index_) +{ + GRealArray* array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + + g_return_val_if_fail (index_ < array->len, NULL); + + if (index_ != array->len - 1) + memcpy (g_array_elt_pos (array, index_), + g_array_elt_pos (array, array->len - 1), + g_array_elt_len (array, 1)); + + array->len -= 1; + + if (G_UNLIKELY (g_mem_gc_friendly)) + g_array_elt_zero (array, array->len, 1); + else + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_remove_range: + * @array: a @GArray. + * @index_: the index of the first element to remove. + * @length: the number of elements to remove. + * @Returns: the #GArray. + * + * Removes the given number of elements starting at the given index + * from a #GArray. The following elements are moved to close the gap. + * + * Since: 2.4 + **/ +GArray* +g_array_remove_range (GArray *farray, + guint index_, + guint length) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_val_if_fail (array, NULL); + g_return_val_if_fail (index_ < array->len, NULL); + g_return_val_if_fail (index_ + length <= array->len, NULL); + + if (index_ + length != array->len) + g_memmove (g_array_elt_pos (array, index_), + g_array_elt_pos (array, index_ + length), + (array->len - (index_ + length)) * array->elt_size); + + array->len -= length; + if (G_UNLIKELY (g_mem_gc_friendly)) + g_array_elt_zero (array, array->len, length); + else + g_array_zero_terminate (array); + + return farray; +} + +/** + * g_array_sort: + * @array: a #GArray. + * @compare_func: comparison function. + * + * Sorts a #GArray using @compare_func which should be a qsort()-style + * comparison function (returns less than zero for first arg is less + * than second arg, zero for equal, greater zero if first arg is + * greater than second arg). + * + * If two array elements compare equal, their order in the sorted array + * is undefined. If you want equal elements to keep their order – i.e. + * you want a stable sort – you can write a comparison function that, + * if two elements would otherwise compare equal, compares them by + * their addresses. + **/ +void +g_array_sort (GArray *farray, + GCompareFunc compare_func) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_if_fail (array != NULL); + + qsort (array->data, + array->len, + array->elt_size, + compare_func); +} + +/** + * g_array_sort_with_data: + * @array: a #GArray. + * @compare_func: comparison function. + * @user_data: data to pass to @compare_func. + * + * Like g_array_sort(), but the comparison function receives an extra + * user data argument. + **/ +void +g_array_sort_with_data (GArray *farray, + GCompareDataFunc compare_func, + gpointer user_data) +{ + GRealArray *array = (GRealArray*) farray; + + g_return_if_fail (array != NULL); + + g_qsort_with_data (array->data, + array->len, + array->elt_size, + compare_func, + user_data); +} + +/* Returns the smallest power of 2 greater than n, or n if + * such power does not fit in a guint + */ +static guint +g_nearest_pow (gint num) +{ + guint n = 1; + + while (n < num && n > 0) + n <<= 1; + + return n ? n : num; +} + +static void +g_array_maybe_expand (GRealArray *array, + gint len) +{ + guint want_alloc = g_array_elt_len (array, array->len + len + + array->zero_terminated); + + if (want_alloc > array->alloc) + { + want_alloc = g_nearest_pow (want_alloc); + want_alloc = MAX (want_alloc, MIN_ARRAY_SIZE); + + array->data = g_realloc (array->data, want_alloc); + + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (array->data + array->alloc, 0, want_alloc - array->alloc); + + array->alloc = want_alloc; + } +} + +/** + * SECTION:arrays_pointer + * @title: Pointer Arrays + * @short_description: arrays of pointers to any type of data, which + * grow automatically as new elements are added + * + * Pointer Arrays are similar to Arrays but are used only for storing + * pointers. + * + * If you remove elements from the array, elements at the + * end of the array are moved into the space previously occupied by the + * removed element. This means that you should not rely on the index of + * particular elements remaining the same. You should also be careful + * when deleting elements while iterating over the array. + * + * To create a pointer array, use g_ptr_array_new(). + * + * To add elements to a pointer array, use g_ptr_array_add(). + * + * To remove elements from a pointer array, use g_ptr_array_remove(), + * g_ptr_array_remove_index() or g_ptr_array_remove_index_fast(). + * + * To access an element of a pointer array, use g_ptr_array_index(). + * + * To set the size of a pointer array, use g_ptr_array_set_size(). + * + * To free a pointer array, use g_ptr_array_free(). + * + * + * Using a #GPtrArray + * + * GPtrArray *gparray; + * gchar *string1 = "one", *string2 = "two", *string3 = "three"; + * + * gparray = g_ptr_array_new (); + * g_ptr_array_add (gparray, (gpointer) string1); + * g_ptr_array_add (gparray, (gpointer) string2); + * g_ptr_array_add (gparray, (gpointer) string3); + * + * if (g_ptr_array_index (gparray, 0) != (gpointer) string1) + * g_print ("ERROR: got %p instead of %p\n", + * g_ptr_array_index (gparray, 0), string1); + * + * g_ptr_array_free (gparray, TRUE); + * + * + **/ + +typedef struct _GRealPtrArray GRealPtrArray; + +/** + * GPtrArray: + * @pdata: points to the array of pointers, which may be moved when the + * array grows. + * @len: number of pointers in the array. + * + * Contains the public fields of a pointer array. + **/ +struct _GRealPtrArray +{ + gpointer *pdata; + guint len; + guint alloc; + gint ref_count; + GDestroyNotify element_free_func; +}; + +/** + * g_ptr_array_index: + * @array: a #GPtrArray. + * @index_: the index of the pointer to return. + * @Returns: the pointer at the given index. + * + * Returns the pointer at the given index of the pointer array. + **/ + +static void g_ptr_array_maybe_expand (GRealPtrArray *array, + gint len); + +/** + * g_ptr_array_new: + * @Returns: the new #GPtrArray. + * + * Creates a new #GPtrArray with a reference count of 1. + **/ +GPtrArray* +g_ptr_array_new (void) +{ + return g_ptr_array_sized_new (0); +} + +/** + * g_ptr_array_sized_new: + * @reserved_size: number of pointers preallocated. + * @Returns: the new #GPtrArray. + * + * Creates a new #GPtrArray with @reserved_size pointers preallocated + * and a reference count of 1. This avoids frequent reallocation, if + * you are going to add many pointers to the array. Note however that + * the size of the array is still 0. + **/ +GPtrArray* +g_ptr_array_sized_new (guint reserved_size) +{ + GRealPtrArray *array = g_slice_new (GRealPtrArray); + + array->pdata = NULL; + array->len = 0; + array->alloc = 0; + array->ref_count = 1; + array->element_free_func = NULL; + + if (reserved_size != 0) + g_ptr_array_maybe_expand (array, reserved_size); + + return (GPtrArray*) array; +} + +/** + * g_ptr_array_new_with_free_func: + * @element_free_func: A function to free elements with destroy @array or %NULL. + * + * Creates a new #GPtrArray with a reference count of 1 and use @element_free_func + * for freeing each element when the array is destroyed either via + * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment + * set to %TRUE or when removing elements. + * + * Returns: A new #GPtrArray. + * + * Since: 2.22 + **/ +GPtrArray * +g_ptr_array_new_with_free_func (GDestroyNotify element_free_func) +{ + GPtrArray *array; + + array = g_ptr_array_new (); + g_ptr_array_set_free_func (array, element_free_func); + return array; +} + +/** + * g_ptr_array_new_full: + * @reserved_size: number of pointers preallocated. + * @element_free_func: A function to free elements with destroy @array or %NULL. + * + * Creates a new #GPtrArray with @reserved_size pointers preallocated + * and a reference count of 1. This avoids frequent reallocation, if + * you are going to add many pointers to the array. Note however that + * the size of the array is still 0. It also set @element_free_func + * for freeing each element when the array is destroyed either via + * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment + * set to %TRUE or when removing elements. + * + * Returns: A new #GPtrArray. + * + * Since: 2.30 + **/ +GPtrArray * +g_ptr_array_new_full (guint reserved_size, + GDestroyNotify element_free_func) +{ + GPtrArray *array; + + array = g_ptr_array_sized_new (reserved_size); + g_ptr_array_set_free_func (array, element_free_func); + return array; +} + +/** + * g_ptr_array_set_free_func: + * @array: A #GPtrArray. + * @element_free_func: A function to free elements with destroy @array or %NULL. + * + * Sets a function for freeing each element when @array is destroyed + * either via g_ptr_array_unref(), when g_ptr_array_free() is called + * with @free_segment set to %TRUE or when removing elements. + * + * Since: 2.22 + **/ +void +g_ptr_array_set_free_func (GPtrArray *array, + GDestroyNotify element_free_func) +{ + GRealPtrArray* rarray = (GRealPtrArray*) array; + + g_return_if_fail (array); + + rarray->element_free_func = element_free_func; +} + +/** + * g_ptr_array_ref: + * @array: A #GArray. + * + * Atomically increments the reference count of @array by one. This + * function is MT-safe and may be called from any thread. + * + * Returns: The passed in #GPtrArray. + * + * Since: 2.22 + **/ +GPtrArray * +g_ptr_array_ref (GPtrArray *array) +{ + GRealPtrArray *rarray = (GRealPtrArray*) array; + + g_return_val_if_fail (array, NULL); + + g_atomic_int_inc (&rarray->ref_count); + + return array; +} + +/** + * g_ptr_array_unref: + * @array: A #GPtrArray. + * + * Atomically decrements the reference count of @array by one. If the + * reference count drops to 0, the effect is the same as calling + * g_ptr_array_free() with @free_segment set to %TRUE. This function + * is MT-safe and may be called from any thread. + * + * Since: 2.22 + **/ +void +g_ptr_array_unref (GPtrArray *array) +{ + GRealPtrArray *rarray = (GRealPtrArray*) array; + g_return_if_fail (array); + + if (g_atomic_int_dec_and_test (&rarray->ref_count)) + g_ptr_array_free (array, TRUE); +} + +/** + * g_ptr_array_free: + * @array: a #GPtrArray. + * @free_seg: if %TRUE the actual pointer array is freed as well. + * @Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL. + * The pointer array should be freed using g_free(). + * + * Frees the memory allocated for the #GPtrArray. If @free_seg is %TRUE + * it frees the memory block holding the elements as well. Pass %FALSE + * if you want to free the #GPtrArray wrapper but preserve the + * underlying array for use elsewhere. If the reference count of @array + * is greater than one, the #GPtrArray wrapper is preserved but the + * size of @array will be set to zero. + * + * If array contents point to dynamically-allocated + * memory, they should be freed separately if @free_seg is %TRUE and no + * #GDestroyNotify function has been set for @array. + **/ +gpointer* +g_ptr_array_free (GPtrArray *farray, + gboolean free_segment) +{ + GRealPtrArray *array = (GRealPtrArray*) farray; + gpointer* segment; + gboolean preserve_wrapper; + + g_return_val_if_fail (array, NULL); + + /* if others are holding a reference, preserve the wrapper but do free/return the data */ + preserve_wrapper = FALSE; + if (g_atomic_int_get (&array->ref_count) > 1) + preserve_wrapper = TRUE; + + if (free_segment) + { + if (array->element_free_func != NULL) + g_ptr_array_foreach (farray, (GFunc) array->element_free_func, NULL); + g_free (array->pdata); + segment = NULL; + } + else + segment = array->pdata; + + if (preserve_wrapper) + { + array->pdata = NULL; + array->len = 0; + array->alloc = 0; + } + else + { + g_slice_free1 (sizeof (GRealPtrArray), array); + } + + return segment; +} + +static void +g_ptr_array_maybe_expand (GRealPtrArray *array, + gint len) +{ + if ((array->len + len) > array->alloc) + { + guint old_alloc = array->alloc; + array->alloc = g_nearest_pow (array->len + len); + array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE); + array->pdata = g_realloc (array->pdata, sizeof (gpointer) * array->alloc); + if (G_UNLIKELY (g_mem_gc_friendly)) + for ( ; old_alloc < array->alloc; old_alloc++) + array->pdata [old_alloc] = NULL; + } +} + +/** + * g_ptr_array_set_size: + * @array: a #GPtrArray. + * @length: the new length of the pointer array. + * + * Sets the size of the array. When making the array larger, + * newly-added elements will be set to %NULL. When making it smaller, + * if @array has a non-%NULL #GDestroyNotify function then it will be + * called for the removed elements. + **/ +void +g_ptr_array_set_size (GPtrArray *farray, + gint length) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + + g_return_if_fail (array); + + if (length > array->len) + { + int i; + g_ptr_array_maybe_expand (array, (length - array->len)); + /* This is not + * memset (array->pdata + array->len, 0, + * sizeof (gpointer) * (length - array->len)); + * to make it really portable. Remember (void*)NULL needn't be + * bitwise zero. It of course is silly not to use memset (..,0,..). + */ + for (i = array->len; i < length; i++) + array->pdata[i] = NULL; + } + else if (length < array->len) + g_ptr_array_remove_range (farray, length, array->len - length); + + array->len = length; +} + +/** + * g_ptr_array_remove_index: + * @array: a #GPtrArray. + * @index_: the index of the pointer to remove. + * @Returns: the pointer which was removed. + * + * Removes the pointer at the given index from the pointer array. The + * following elements are moved down one place. If @array has a + * non-%NULL #GDestroyNotify function it is called for the removed + * element. + **/ +gpointer +g_ptr_array_remove_index (GPtrArray *farray, + guint index_) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + gpointer result; + + g_return_val_if_fail (array, NULL); + + g_return_val_if_fail (index_ < array->len, NULL); + + result = array->pdata[index_]; + + if (array->element_free_func != NULL) + array->element_free_func (array->pdata[index_]); + + if (index_ != array->len - 1) + g_memmove (array->pdata + index_, array->pdata + index_ + 1, + sizeof (gpointer) * (array->len - index_ - 1)); + + array->len -= 1; + + if (G_UNLIKELY (g_mem_gc_friendly)) + array->pdata[array->len] = NULL; + + return result; +} + +/** + * g_ptr_array_remove_index_fast: + * @array: a #GPtrArray. + * @index_: the index of the pointer to remove. + * @Returns: the pointer which was removed. + * + * Removes the pointer at the given index from the pointer array. The + * last element in the array is used to fill in the space, so this + * function does not preserve the order of the array. But it is faster + * than g_ptr_array_remove_index(). If @array has a non-%NULL + * #GDestroyNotify function it is called for the removed element. + **/ +gpointer +g_ptr_array_remove_index_fast (GPtrArray *farray, + guint index_) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + gpointer result; + + g_return_val_if_fail (array, NULL); + + g_return_val_if_fail (index_ < array->len, NULL); + + result = array->pdata[index_]; + + if (array->element_free_func != NULL) + array->element_free_func (array->pdata[index_]); + + if (index_ != array->len - 1) + array->pdata[index_] = array->pdata[array->len - 1]; + + array->len -= 1; + + if (G_UNLIKELY (g_mem_gc_friendly)) + array->pdata[array->len] = NULL; + + return result; +} + +/** + * g_ptr_array_remove_range: + * @array: a @GPtrArray. + * @index_: the index of the first pointer to remove. + * @length: the number of pointers to remove. + * + * Removes the given number of pointers starting at the given index + * from a #GPtrArray. The following elements are moved to close the + * gap. If @array has a non-%NULL #GDestroyNotify function it is called + * for the removed elements. + * + * Since: 2.4 + **/ +void +g_ptr_array_remove_range (GPtrArray *farray, + guint index_, + guint length) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + guint n; + + g_return_if_fail (array); + g_return_if_fail (index_ < array->len); + g_return_if_fail (index_ + length <= array->len); + + if (array->element_free_func != NULL) + { + for (n = index_; n < index_ + length; n++) + array->element_free_func (array->pdata[n]); + } + + if (index_ + length != array->len) + { + g_memmove (&array->pdata[index_], + &array->pdata[index_ + length], + (array->len - (index_ + length)) * sizeof (gpointer)); + } + + array->len -= length; + if (G_UNLIKELY (g_mem_gc_friendly)) + { + guint i; + for (i = 0; i < length; i++) + array->pdata[array->len + i] = NULL; + } +} + +/** + * g_ptr_array_remove: + * @array: a #GPtrArray. + * @data: the pointer to remove. + * @Returns: %TRUE if the pointer is removed. %FALSE if the pointer is + * not found in the array. + * + * Removes the first occurrence of the given pointer from the pointer + * array. The following elements are moved down one place. If @array + * has a non-%NULL #GDestroyNotify function it is called for the + * removed element. + * + * It returns %TRUE if the pointer was removed, or %FALSE if the + * pointer was not found. + **/ +gboolean +g_ptr_array_remove (GPtrArray *farray, + gpointer data) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + guint i; + + g_return_val_if_fail (array, FALSE); + + for (i = 0; i < array->len; i += 1) + { + if (array->pdata[i] == data) + { + g_ptr_array_remove_index (farray, i); + return TRUE; + } + } + + return FALSE; +} + +/** + * g_ptr_array_remove_fast: + * @array: a #GPtrArray. + * @data: the pointer to remove. + * @Returns: %TRUE if the pointer was found in the array. + * + * Removes the first occurrence of the given pointer from the pointer + * array. The last element in the array is used to fill in the space, + * so this function does not preserve the order of the array. But it is + * faster than g_ptr_array_remove(). If @array has a non-%NULL + * #GDestroyNotify function it is called for the removed element. + * + * It returns %TRUE if the pointer was removed, or %FALSE if the + * pointer was not found. + **/ +gboolean +g_ptr_array_remove_fast (GPtrArray *farray, + gpointer data) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + guint i; + + g_return_val_if_fail (array, FALSE); + + for (i = 0; i < array->len; i += 1) + { + if (array->pdata[i] == data) + { + g_ptr_array_remove_index_fast (farray, i); + return TRUE; + } + } + + return FALSE; +} + +/** + * g_ptr_array_add: + * @array: a #GPtrArray. + * @data: the pointer to add. + * + * Adds a pointer to the end of the pointer array. The array will grow + * in size automatically if necessary. + **/ +void +g_ptr_array_add (GPtrArray *farray, + gpointer data) +{ + GRealPtrArray* array = (GRealPtrArray*) farray; + + g_return_if_fail (array); + + g_ptr_array_maybe_expand (array, 1); + + array->pdata[array->len++] = data; +} + +/** + * g_ptr_array_sort: + * @array: a #GPtrArray. + * @compare_func: comparison function. + * + * Sorts the array, using @compare_func which should be a qsort()-style + * comparison function (returns less than zero for first arg is less + * than second arg, zero for equal, greater than zero if irst arg is + * greater than second arg). + * + * If two array elements compare equal, their order in the sorted array + * is undefined. If you want equal elements to keep their order – i.e. + * you want a stable sort – you can write a comparison function that, + * if two elements would otherwise compare equal, compares them by + * their addresses. + * + * The comparison function for g_ptr_array_sort() doesn't + * take the pointers from the array as arguments, it takes pointers to + * the pointers in the array. + **/ +void +g_ptr_array_sort (GPtrArray *array, + GCompareFunc compare_func) +{ + g_return_if_fail (array != NULL); + + qsort (array->pdata, + array->len, + sizeof (gpointer), + compare_func); +} + +/** + * g_ptr_array_sort_with_data: + * @array: a #GPtrArray. + * @compare_func: comparison function. + * @user_data: data to pass to @compare_func. + * + * Like g_ptr_array_sort(), but the comparison function has an extra + * user data argument. + * + * The comparison function for g_ptr_array_sort_with_data() + * doesn't take the pointers from the array as arguments, it takes + * pointers to the pointers in the array. + **/ +void +g_ptr_array_sort_with_data (GPtrArray *array, + GCompareDataFunc compare_func, + gpointer user_data) +{ + g_return_if_fail (array != NULL); + + g_qsort_with_data (array->pdata, + array->len, + sizeof (gpointer), + compare_func, + user_data); +} + +/** + * g_ptr_array_foreach: + * @array: a #GPtrArray + * @func: the function to call for each array element + * @user_data: user data to pass to the function + * + * Calls a function for each element of a #GPtrArray. + * + * Since: 2.4 + **/ +void +g_ptr_array_foreach (GPtrArray *array, + GFunc func, + gpointer user_data) +{ + guint i; + + g_return_if_fail (array); + + for (i = 0; i < array->len; i++) + (*func) (array->pdata[i], user_data); +} + +/** + * SECTION:arrays_byte + * @title: Byte Arrays + * @short_description: arrays of bytes, which grow automatically as + * elements are added + * + * #GByteArray is based on #GArray, to provide arrays of bytes which + * grow automatically as elements are added. + * + * To create a new #GByteArray use g_byte_array_new(). + * + * To add elements to a #GByteArray, use g_byte_array_append(), and + * g_byte_array_prepend(). + * + * To set the size of a #GByteArray, use g_byte_array_set_size(). + * + * To free a #GByteArray, use g_byte_array_free(). + * + * + * Using a #GByteArray + * + * GByteArray *gbarray; + * gint i; + * + * gbarray = g_byte_array_new (); + * for (i = 0; i < 10000; i++) + * g_byte_array_append (gbarray, (guint8*) "abcd", 4); + * + * for (i = 0; i < 10000; i++) + * { + * g_assert (gbarray->data[4*i] == 'a'); + * g_assert (gbarray->data[4*i+1] == 'b'); + * g_assert (gbarray->data[4*i+2] == 'c'); + * g_assert (gbarray->data[4*i+3] == 'd'); + * } + * + * g_byte_array_free (gbarray, TRUE); + * + * + **/ + +/** + * GByteArray: + * @data: a pointer to the element data. The data may be moved as + * elements are added to the #GByteArray. + * @len: the number of elements in the #GByteArray. + * + * The GByteArray struct allows access to the + * public fields of a GByteArray. + **/ + +/** + * g_byte_array_new: + * @Returns: the new #GByteArray. + * + * Creates a new #GByteArray with a reference count of 1. + **/ +GByteArray* g_byte_array_new (void) +{ + return (GByteArray*) g_array_sized_new (FALSE, FALSE, 1, 0); +} + +/** + * g_byte_array_sized_new: + * @reserved_size: number of bytes preallocated. + * @Returns: the new #GByteArray. + * + * Creates a new #GByteArray with @reserved_size bytes preallocated. + * This avoids frequent reallocation, if you are going to add many + * bytes to the array. Note however that the size of the array is still + * 0. + **/ +GByteArray* g_byte_array_sized_new (guint reserved_size) +{ + return (GByteArray*) g_array_sized_new (FALSE, FALSE, 1, reserved_size); +} + +/** + * g_byte_array_free: + * @array: a #GByteArray. + * @free_segment: if %TRUE the actual byte data is freed as well. + * @Returns: the element data if @free_segment is %FALSE, otherwise + * %NULL. The element data should be freed using g_free(). + * + * Frees the memory allocated by the #GByteArray. If @free_segment is + * %TRUE it frees the actual byte data. If the reference count of + * @array is greater than one, the #GByteArray wrapper is preserved but + * the size of @array will be set to zero. + **/ +guint8* g_byte_array_free (GByteArray *array, + gboolean free_segment) +{ + return (guint8*) g_array_free ((GArray*) array, free_segment); +} + +/** + * g_byte_array_ref: + * @array: A #GByteArray. + * + * Atomically increments the reference count of @array by one. This + * function is MT-safe and may be called from any thread. + * + * Returns: The passed in #GByteArray. + * + * Since: 2.22 + **/ +GByteArray * +g_byte_array_ref (GByteArray *array) +{ + return (GByteArray *) g_array_ref ((GArray *) array); +} + +/** + * g_byte_array_unref: + * @array: A #GByteArray. + * + * Atomically decrements the reference count of @array by one. If the + * reference count drops to 0, all memory allocated by the array is + * released. This function is MT-safe and may be called from any + * thread. + * + * Since: 2.22 + **/ +void +g_byte_array_unref (GByteArray *array) +{ + g_array_unref ((GArray *) array); +} + +/** + * g_byte_array_append: + * @array: a #GByteArray. + * @data: the byte data to be added. + * @len: the number of bytes to add. + * @Returns: the #GByteArray. + * + * Adds the given bytes to the end of the #GByteArray. The array will + * grow in size automatically if necessary. + **/ +GByteArray* g_byte_array_append (GByteArray *array, + const guint8 *data, + guint len) +{ + g_array_append_vals ((GArray*) array, (guint8*)data, len); + + return array; +} + +/** + * g_byte_array_prepend: + * @array: a #GByteArray. + * @data: the byte data to be added. + * @len: the number of bytes to add. + * @Returns: the #GByteArray. + * + * Adds the given data to the start of the #GByteArray. The array will + * grow in size automatically if necessary. + **/ +GByteArray* g_byte_array_prepend (GByteArray *array, + const guint8 *data, + guint len) +{ + g_array_prepend_vals ((GArray*) array, (guint8*)data, len); + + return array; +} + +/** + * g_byte_array_set_size: + * @array: a #GByteArray. + * @length: the new size of the #GByteArray. + * @Returns: the #GByteArray. + * + * Sets the size of the #GByteArray, expanding it if necessary. + **/ +GByteArray* g_byte_array_set_size (GByteArray *array, + guint length) +{ + g_array_set_size ((GArray*) array, length); + + return array; +} + +/** + * g_byte_array_remove_index: + * @array: a #GByteArray. + * @index_: the index of the byte to remove. + * @Returns: the #GByteArray. + * + * Removes the byte at the given index from a #GByteArray. The + * following bytes are moved down one place. + **/ +GByteArray* g_byte_array_remove_index (GByteArray *array, + guint index_) +{ + g_array_remove_index ((GArray*) array, index_); + + return array; +} + +/** + * g_byte_array_remove_index_fast: + * @array: a #GByteArray. + * @index_: the index of the byte to remove. + * @Returns: the #GByteArray. + * + * Removes the byte at the given index from a #GByteArray. The last + * element in the array is used to fill in the space, so this function + * does not preserve the order of the #GByteArray. But it is faster + * than g_byte_array_remove_index(). + **/ +GByteArray* g_byte_array_remove_index_fast (GByteArray *array, + guint index_) +{ + g_array_remove_index_fast ((GArray*) array, index_); + + return array; +} + +/** + * g_byte_array_remove_range: + * @array: a @GByteArray. + * @index_: the index of the first byte to remove. + * @length: the number of bytes to remove. + * @Returns: the #GByteArray. + * + * Removes the given number of bytes starting at the given index from a + * #GByteArray. The following elements are moved to close the gap. + * + * Since: 2.4 + **/ +GByteArray* +g_byte_array_remove_range (GByteArray *array, + guint index_, + guint length) +{ + g_return_val_if_fail (array, NULL); + g_return_val_if_fail (index_ < array->len, NULL); + g_return_val_if_fail (index_ + length <= array->len, NULL); + + return (GByteArray *)g_array_remove_range ((GArray*) array, index_, length); +} + +/** + * g_byte_array_sort: + * @array: a #GByteArray. + * @compare_func: comparison function. + * + * Sorts a byte array, using @compare_func which should be a + * qsort()-style comparison function (returns less than zero for first + * arg is less than second arg, zero for equal, greater than zero if + * first arg is greater than second arg). + * + * If two array elements compare equal, their order in the sorted array + * is undefined. If you want equal elements to keep their order – i.e. + * you want a stable sort – you can write a comparison function that, + * if two elements would otherwise compare equal, compares them by + * their addresses. + **/ +void +g_byte_array_sort (GByteArray *array, + GCompareFunc compare_func) +{ + g_array_sort ((GArray *) array, compare_func); +} + +/** + * g_byte_array_sort_with_data: + * @array: a #GByteArray. + * @compare_func: comparison function. + * @user_data: data to pass to @compare_func. + * + * Like g_byte_array_sort(), but the comparison function takes an extra + * user data argument. + **/ +void +g_byte_array_sort_with_data (GByteArray *array, + GCompareDataFunc compare_func, + gpointer user_data) +{ + g_array_sort_with_data ((GArray *) array, compare_func, user_data); +} diff --git a/deps/glib/garray.h b/deps/glib/garray.h new file mode 100644 index 0000000..8221806 --- /dev/null +++ b/deps/glib/garray.h @@ -0,0 +1,181 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_ARRAY_H__ +#define __G_ARRAY_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GArray GArray; +typedef struct _GByteArray GByteArray; +typedef struct _GPtrArray GPtrArray; + +struct _GArray +{ + gchar *data; + guint len; +}; + +struct _GByteArray +{ + guint8 *data; + guint len; +}; + +struct _GPtrArray +{ + gpointer *pdata; + guint len; +}; + +/* Resizable arrays. remove fills any cleared spot and shortens the + * array, while preserving the order. remove_fast will distort the + * order by moving the last element to the position of the removed. + */ + +#define g_array_append_val(a,v) g_array_append_vals (a, &(v), 1) +#define g_array_prepend_val(a,v) g_array_prepend_vals (a, &(v), 1) +#define g_array_insert_val(a,i,v) g_array_insert_vals (a, i, &(v), 1) +#define g_array_index(a,t,i) (((t*) (void *) (a)->data) [(i)]) + +GArray* g_array_new (gboolean zero_terminated, + gboolean clear_, + guint element_size); +GArray* g_array_sized_new (gboolean zero_terminated, + gboolean clear_, + guint element_size, + guint reserved_size); +gchar* g_array_free (GArray *array, + gboolean free_segment); +GArray *g_array_ref (GArray *array); +void g_array_unref (GArray *array); +guint g_array_get_element_size (GArray *array); +GArray* g_array_append_vals (GArray *array, + gconstpointer data, + guint len); +GArray* g_array_prepend_vals (GArray *array, + gconstpointer data, + guint len); +GArray* g_array_insert_vals (GArray *array, + guint index_, + gconstpointer data, + guint len); +GArray* g_array_set_size (GArray *array, + guint length); +GArray* g_array_remove_index (GArray *array, + guint index_); +GArray* g_array_remove_index_fast (GArray *array, + guint index_); +GArray* g_array_remove_range (GArray *array, + guint index_, + guint length); +void g_array_sort (GArray *array, + GCompareFunc compare_func); +void g_array_sort_with_data (GArray *array, + GCompareDataFunc compare_func, + gpointer user_data); + +/* Resizable pointer array. This interface is much less complicated + * than the above. Add appends a pointer. Remove fills any cleared + * spot and shortens the array. remove_fast will again distort order. + */ +#define g_ptr_array_index(array,index_) ((array)->pdata)[index_] +GPtrArray* g_ptr_array_new (void); +GPtrArray* g_ptr_array_new_with_free_func (GDestroyNotify element_free_func); +GPtrArray* g_ptr_array_sized_new (guint reserved_size); +GPtrArray* g_ptr_array_new_full (guint reserved_size, + GDestroyNotify element_free_func); +gpointer* g_ptr_array_free (GPtrArray *array, + gboolean free_seg); +GPtrArray* g_ptr_array_ref (GPtrArray *array); +void g_ptr_array_unref (GPtrArray *array); +void g_ptr_array_set_free_func (GPtrArray *array, + GDestroyNotify element_free_func); +void g_ptr_array_set_size (GPtrArray *array, + gint length); +gpointer g_ptr_array_remove_index (GPtrArray *array, + guint index_); +gpointer g_ptr_array_remove_index_fast (GPtrArray *array, + guint index_); +gboolean g_ptr_array_remove (GPtrArray *array, + gpointer data); +gboolean g_ptr_array_remove_fast (GPtrArray *array, + gpointer data); +void g_ptr_array_remove_range (GPtrArray *array, + guint index_, + guint length); +void g_ptr_array_add (GPtrArray *array, + gpointer data); +void g_ptr_array_sort (GPtrArray *array, + GCompareFunc compare_func); +void g_ptr_array_sort_with_data (GPtrArray *array, + GCompareDataFunc compare_func, + gpointer user_data); +void g_ptr_array_foreach (GPtrArray *array, + GFunc func, + gpointer user_data); + + +/* Byte arrays, an array of guint8. Implemented as a GArray, + * but type-safe. + */ + +GByteArray* g_byte_array_new (void); +GByteArray* g_byte_array_sized_new (guint reserved_size); +guint8* g_byte_array_free (GByteArray *array, + gboolean free_segment); +GByteArray *g_byte_array_ref (GByteArray *array); +void g_byte_array_unref (GByteArray *array); +GByteArray* g_byte_array_append (GByteArray *array, + const guint8 *data, + guint len); +GByteArray* g_byte_array_prepend (GByteArray *array, + const guint8 *data, + guint len); +GByteArray* g_byte_array_set_size (GByteArray *array, + guint length); +GByteArray* g_byte_array_remove_index (GByteArray *array, + guint index_); +GByteArray* g_byte_array_remove_index_fast (GByteArray *array, + guint index_); +GByteArray* g_byte_array_remove_range (GByteArray *array, + guint index_, + guint length); +void g_byte_array_sort (GByteArray *array, + GCompareFunc compare_func); +void g_byte_array_sort_with_data (GByteArray *array, + GCompareDataFunc compare_func, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_ARRAY_H__ */ diff --git a/deps/glib/gatomic.c b/deps/glib/gatomic.c new file mode 100644 index 0000000..1e83f19 --- /dev/null +++ b/deps/glib/gatomic.c @@ -0,0 +1,848 @@ +/* + * Copyright © 2011 Ryan Lortie + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * licence, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + * + * Author: Ryan Lortie + */ + +#include "config.h" + +#include "gatomic.h" + +/** + * SECTION:atomic_operations + * @title: Atomic Operations + * @short_description: basic atomic integer and pointer operations + * @see_also: #GMutex + * + * The following is a collection of compiler macros to provide atomic + * access to integer and pointer-sized values. + * + * The macros that have 'int' in the name will operate on pointers to + * #gint and #guint. The macros with 'pointer' in the name will operate + * on pointers to any pointer-sized value, including #gsize. There is + * no support for 64bit operations on platforms with 32bit pointers + * because it is not generally possible to perform these operations + * atomically. + * + * The get, set and exchange operations for integers and pointers + * nominally operate on #gint and #gpointer, respectively. Of the + * arithmetic operations, the 'add' operation operates on (and returns) + * signed integer values (#gint and #gssize) and the 'and', 'or', and + * 'xor' operations operate on (and return) unsigned integer values + * (#guint and #gsize). + * + * All of the operations act as a full compiler and (where appropriate) + * hardware memory barrier. Acquire and release or producer and + * consumer barrier semantics are not available through this API. + * + * On GCC, these macros are implemented using GCC intrinsic operations. + * On non-GCC compilers they will evaluate to function calls to + * functions implemented by GLib. + * + * If GLib itself was compiled with GCC then these functions will again + * be implemented by the GCC intrinsics. On Windows without GCC, the + * interlocked API is used to implement the functions. + * + * With non-GCC compilers on non-Windows systems, the functions are + * currently incapable of implementing true atomic operations -- + * instead, they fallback to holding a global lock while performing the + * operation. This provides atomicity between the threads of one + * process, but not between separate processes. For this reason, one + * should exercise caution when attempting to use these options on + * shared memory regions. + * + * It is very important that all accesses to a particular integer or + * pointer be performed using only this API and that different sizes of + * operation are not mixed or used on overlapping memory regions. Never + * read or assign directly from or to a value -- always use this API. + * + * For simple reference counting purposes you should use + * g_atomic_int_inc() and g_atomic_int_dec_and_test(). Other uses that + * fall outside of simple reference counting patterns are prone to + * subtle bugs and occasionally undefined behaviour. It is also worth + * noting that since all of these operations require global + * synchronisation of the entire machine, they can be quite slow. In + * the case of performing multiple atomic operations it can often be + * faster to simply acquire a mutex lock around the critical area, + * perform the operations normally and then release the lock. + **/ + +#ifdef G_ATOMIC_OP_USE_GCC_BUILTINS + +#ifndef __GNUC__ +#error Using GCC builtin atomic ops, but not compiling with GCC? +#endif + +/** + * g_atomic_int_get: + * @atomic: a pointer to a #gint or #guint + * + * Gets the current value of @atomic. + * + * This call acts as a full compiler and hardware + * memory barrier (before the get). + * + * Returns: the value of the integer + * + * Since: 2.4 + **/ +gint +(g_atomic_int_get) (volatile gint *atomic) +{ + return g_atomic_int_get (atomic); +} + +/** + * g_atomic_int_set: + * @atomic: a pointer to a #gint or #guint + * @newval: a new value to store + * + * Sets the value of @atomic to @newval. + * + * This call acts as a full compiler and hardware + * memory barrier (after the set). + * + * Since: 2.4 + */ +void +(g_atomic_int_set) (volatile gint *atomic, + gint newval) +{ + g_atomic_int_set (atomic, newval); +} + +/** + * g_atomic_int_inc: + * @atomic: a pointer to a #gint or #guint + * + * Increments the value of @atomic by 1. + * + * Think of this operation as an atomic version of + * { *@atomic += 1; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Since: 2.4 + **/ +void +(g_atomic_int_inc) (volatile gint *atomic) +{ + g_atomic_int_inc (atomic); +} + +/** + * g_atomic_int_dec_and_test: + * @atomic: a pointer to a #gint or #guint + * + * Decrements the value of @atomic by 1. + * + * Think of this operation as an atomic version of + * { *@atomic -= 1; return (*@atomic == 0); } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: %TRUE if the resultant value is zero + * + * Since: 2.4 + **/ +gboolean +(g_atomic_int_dec_and_test) (volatile gint *atomic) +{ + return g_atomic_int_dec_and_test (atomic); +} + +/** + * g_atomic_int_compare_and_exchange: + * @atomic: a pointer to a #gint or #guint + * @oldval: the value to compare with + * @newval: the value to conditionally replace with + * + * Compares @atomic to @oldval and, if equal, sets it to @newval. + * If @atomic was not equal to @oldval then no change occurs. + * + * This compare and exchange is done atomically. + * + * Think of this operation as an atomic version of + * { if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: %TRUE if the exchange took place + * + * Since: 2.4 + **/ +gboolean +(g_atomic_int_compare_and_exchange) (volatile gint *atomic, + gint oldval, + gint newval) +{ + return g_atomic_int_compare_and_exchange (atomic, oldval, newval); +} + +/** + * g_atomic_int_add: + * @atomic: a pointer to a #gint or #guint + * @val: the value to add + * + * Atomically adds @val to the value of @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic += @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Before version 2.30, this function did not return a value + * (but g_atomic_int_exchange_and_add() did, and had the same meaning). + * + * Returns: the value of @atomic before the add, signed + * + * Since: 2.4 + **/ +gint +(g_atomic_int_add) (volatile gint *atomic, + gint val) +{ + return g_atomic_int_add (atomic, val); +} + +/** + * g_atomic_int_and: + * @atomic: a pointer to a #gint or #guint + * @val: the value to 'and' + * + * Performs an atomic bitwise 'and' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * This call acts as a full compiler and hardware memory barrier. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic &= @val; return tmp; } + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +guint +(g_atomic_int_and) (volatile guint *atomic, + guint val) +{ + return g_atomic_int_and (atomic, val); +} + +/** + * g_atomic_int_or: + * @atomic: a pointer to a #gint or #guint + * @val: the value to 'or' + * + * Performs an atomic bitwise 'or' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic |= @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +guint +(g_atomic_int_or) (volatile guint *atomic, + guint val) +{ + return g_atomic_int_or (atomic, val); +} + +/** + * g_atomic_int_xor: + * @atomic: a pointer to a #gint or #guint + * @val: the value to 'xor' + * + * Performs an atomic bitwise 'xor' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic ^= @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +guint +(g_atomic_int_xor) (volatile guint *atomic, + guint val) +{ + return g_atomic_int_xor (atomic, val); +} + + +/** + * g_atomic_pointer_get: + * @atomic: a pointer to a #gpointer-sized value + * + * Gets the current value of @atomic. + * + * This call acts as a full compiler and hardware + * memory barrier (before the get). + * + * Returns: the value of the pointer + * + * Since: 2.4 + **/ +gpointer +(g_atomic_pointer_get) (volatile void *atomic) +{ + return g_atomic_pointer_get ((volatile gpointer *) atomic); +} + +/** + * g_atomic_pointer_set: + * @atomic: a pointer to a #gpointer-sized value + * @newval: a new value to store + * + * Sets the value of @atomic to @newval. + * + * This call acts as a full compiler and hardware + * memory barrier (after the set). + * + * Since: 2.4 + **/ +void +(g_atomic_pointer_set) (volatile void *atomic, + gpointer newval) +{ + g_atomic_pointer_set ((volatile gpointer *) atomic, newval); +} + +/** + * g_atomic_pointer_compare_and_exchange: + * @atomic: a pointer to a #gpointer-sized value + * @oldval: the value to compare with + * @newval: the value to conditionally replace with + * + * Compares @atomic to @oldval and, if equal, sets it to @newval. + * If @atomic was not equal to @oldval then no change occurs. + * + * This compare and exchange is done atomically. + * + * Think of this operation as an atomic version of + * { if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: %TRUE if the exchange took place + * + * Since: 2.4 + **/ +gboolean +(g_atomic_pointer_compare_and_exchange) (volatile void *atomic, + gpointer oldval, + gpointer newval) +{ + return g_atomic_pointer_compare_and_exchange ((volatile gpointer *) atomic, + oldval, newval); +} + +/** + * g_atomic_pointer_add: + * @atomic: a pointer to a #gpointer-sized value + * @val: the value to add + * + * Atomically adds @val to the value of @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic += @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the add, signed + * + * Since: 2.30 + **/ +gssize +(g_atomic_pointer_add) (volatile void *atomic, + gssize val) +{ + return g_atomic_pointer_add ((volatile gpointer *) atomic, val); +} + +/** + * g_atomic_pointer_and: + * @atomic: a pointer to a #gpointer-sized value + * @val: the value to 'and' + * + * Performs an atomic bitwise 'and' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic &= @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +gsize +(g_atomic_pointer_and) (volatile void *atomic, + gsize val) +{ + return g_atomic_pointer_and ((volatile gpointer *) atomic, val); +} + +/** + * g_atomic_pointer_or: + * @atomic: a pointer to a #gpointer-sized value + * @val: the value to 'or' + * + * Performs an atomic bitwise 'or' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic |= @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +gsize +(g_atomic_pointer_or) (volatile void *atomic, + gsize val) +{ + return g_atomic_pointer_or ((volatile gpointer *) atomic, val); +} + +/** + * g_atomic_pointer_xor: + * @atomic: a pointer to a #gpointer-sized value + * @val: the value to 'xor' + * + * Performs an atomic bitwise 'xor' of the value of @atomic and @val, + * storing the result back in @atomic. + * + * Think of this operation as an atomic version of + * { tmp = *atomic; *@atomic ^= @val; return tmp; } + * + * This call acts as a full compiler and hardware memory barrier. + * + * Returns: the value of @atomic before the operation, unsigned + * + * Since: 2.30 + **/ +gsize +(g_atomic_pointer_xor) (volatile void *atomic, + gsize val) +{ + return g_atomic_pointer_xor ((volatile gpointer *) atomic, val); +} + +#elif defined (G_PLATFORM_WIN32) && defined(HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS) + +#include +#if !defined(_M_AMD64) && !defined (_M_IA64) && !defined(_M_X64) +#define InterlockedAnd _InterlockedAnd +#define InterlockedOr _InterlockedOr +#define InterlockedXor _InterlockedXor +#endif + +/* + * http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx + */ +gint +(g_atomic_int_get) (volatile gint *atomic) +{ + MemoryBarrier (); + return *atomic; +} + +void +(g_atomic_int_set) (volatile gint *atomic, + gint newval) +{ + *atomic = newval; + MemoryBarrier (); +} + +void +(g_atomic_int_inc) (volatile gint *atomic) +{ + InterlockedIncrement (atomic); +} + +gboolean +(g_atomic_int_dec_and_test) (volatile gint *atomic) +{ + return InterlockedDecrement (atomic) == 0; +} + +gboolean +(g_atomic_int_compare_and_exchange) (volatile gint *atomic, + gint oldval, + gint newval) +{ + return InterlockedCompareExchange (atomic, newval, oldval) == oldval; +} + +gint +(g_atomic_int_add) (volatile gint *atomic, + gint val) +{ + return InterlockedExchangeAdd (atomic, val); +} + +guint +(g_atomic_int_and) (volatile guint *atomic, + guint val) +{ + return InterlockedAnd (atomic, val); +} + +guint +(g_atomic_int_or) (volatile guint *atomic, + guint val) +{ + return InterlockedOr (atomic, val); +} + +guint +(g_atomic_int_xor) (volatile guint *atomic, + guint val) +{ + return InterlockedXor (atomic, val); +} + + +gpointer +(g_atomic_pointer_get) (volatile void *atomic) +{ + volatile gpointer *ptr = atomic; + + MemoryBarrier (); + return *ptr; +} + +void +(g_atomic_pointer_set) (volatile void *atomic, + gpointer newval) +{ + volatile gpointer *ptr = atomic; + + *ptr = newval; + MemoryBarrier (); +} + +gboolean +(g_atomic_pointer_compare_and_exchange) (volatile void *atomic, + gpointer oldval, + gpointer newval) +{ + return InterlockedCompareExchangePointer (atomic, newval, oldval) == oldval; +} + +gssize +(g_atomic_pointer_add) (volatile void *atomic, + gssize val) +{ +#if GLIB_SIZEOF_VOID_P == 8 + return InterlockedExchangeAdd64 (atomic, val); +#else + return InterlockedExchangeAdd (atomic, val); +#endif +} + +gsize +(g_atomic_pointer_and) (volatile void *atomic, + gsize val) +{ +#if GLIB_SIZEOF_VOID_P == 8 + return InterlockedAnd64 (atomic, val); +#else + return InterlockedAnd (atomic, val); +#endif +} + +gsize +(g_atomic_pointer_or) (volatile void *atomic, + gsize val) +{ +#if GLIB_SIZEOF_VOID_P == 8 + return InterlockedOr64 (atomic, val); +#else + return InterlockedOr (atomic, val); +#endif +} + +gsize +(g_atomic_pointer_xor) (volatile void *atomic, + gsize val) +{ +#if GLIB_SIZEOF_VOID_P == 8 + return InterlockedXor64 (atomic, val); +#else + return InterlockedXor (atomic, val); +#endif +} + +#else + +#include "gthread.h" + +static GStaticMutex g_atomic_lock; + +gint +(g_atomic_int_get) (volatile gint *atomic) +{ + gint value; + + g_static_mutex_lock (&g_atomic_lock); + value = *atomic; + g_static_mutex_unlock (&g_atomic_lock); + + return value; +} + +void +(g_atomic_int_set) (volatile gint *atomic, + gint value) +{ + g_static_mutex_lock (&g_atomic_lock); + *atomic = value; + g_static_mutex_unlock (&g_atomic_lock); +} + +void +(g_atomic_int_inc) (volatile gint *atomic) +{ + g_static_mutex_lock (&g_atomic_lock); + (*atomic)++; + g_static_mutex_unlock (&g_atomic_lock); +} + +gboolean +(g_atomic_int_dec_and_test) (volatile gint *atomic) +{ + gboolean is_zero; + + g_static_mutex_lock (&g_atomic_lock); + is_zero = --(*atomic) == 0; + g_static_mutex_unlock (&g_atomic_lock); + + return is_zero; +} + +gboolean +(g_atomic_int_compare_and_exchange) (volatile gint *atomic, + gint oldval, + gint newval) +{ + gboolean success; + + g_static_mutex_lock (&g_atomic_lock); + + if ((success = (*atomic == oldval))) + *atomic = newval; + + g_static_mutex_unlock (&g_atomic_lock); + + return success; +} + +gint +(g_atomic_int_add) (volatile gint *atomic, + gint val) +{ + gint oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *atomic; + *atomic = oldval + val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +guint +(g_atomic_int_and) (volatile guint *atomic, + guint val) +{ + guint oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *atomic; + *atomic = oldval & val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +guint +(g_atomic_int_or) (volatile guint *atomic, + guint val) +{ + guint oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *atomic; + *atomic = oldval | val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +guint +(g_atomic_int_xor) (volatile guint *atomic, + guint val) +{ + guint oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *atomic; + *atomic = oldval ^ val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + + +gpointer +(g_atomic_pointer_get) (volatile void *atomic) +{ + volatile gpointer *ptr = atomic; + gpointer value; + + g_static_mutex_lock (&g_atomic_lock); + value = *ptr; + g_static_mutex_unlock (&g_atomic_lock); + + return value; +} + +void +(g_atomic_pointer_set) (volatile void *atomic, + gpointer newval) +{ + volatile gpointer *ptr = atomic; + + g_static_mutex_lock (&g_atomic_lock); + *ptr = newval; + g_static_mutex_unlock (&g_atomic_lock); +} + +gboolean +(g_atomic_pointer_compare_and_exchange) (volatile void *atomic, + gpointer oldval, + gpointer newval) +{ + volatile gpointer *ptr = atomic; + gboolean success; + + g_static_mutex_lock (&g_atomic_lock); + + if ((success = (*ptr == oldval))) + *ptr = newval; + + g_static_mutex_unlock (&g_atomic_lock); + + return success; +} + +gssize +(g_atomic_pointer_add) (volatile void *atomic, + gssize val) +{ + volatile gssize *ptr = atomic; + gssize oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *ptr; + *ptr = oldval + val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +gsize +(g_atomic_pointer_and) (volatile void *atomic, + gsize val) +{ + volatile gsize *ptr = atomic; + gsize oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *ptr; + *ptr = oldval & val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +gsize +(g_atomic_pointer_or) (volatile void *atomic, + gsize val) +{ + volatile gsize *ptr = atomic; + gsize oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *ptr; + *ptr = oldval | val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +gsize +(g_atomic_pointer_xor) (volatile void *atomic, + gsize val) +{ + volatile gsize *ptr = atomic; + gsize oldval; + + g_static_mutex_lock (&g_atomic_lock); + oldval = *ptr; + *ptr = oldval ^ val; + g_static_mutex_unlock (&g_atomic_lock); + + return oldval; +} + +#endif + +/** + * g_atomic_int_exchange_and_add: + * @atomic: a pointer to a #gint + * @val: the value to add + * + * This function existed before g_atomic_int_add() returned the prior + * value of the integer (which it now does). It is retained only for + * compatibility reasons. Don't use this function in new code. + * + * Returns: the value of @atomic before the add, signed + * Since: 2.4 + * Deprecated: 2.30: Use g_atomic_int_add() instead. + **/ +gint +g_atomic_int_exchange_and_add (volatile gint *atomic, + gint val) +{ + return (g_atomic_int_add) (atomic, val); +} diff --git a/deps/glib/gatomic.h b/deps/glib/gatomic.h new file mode 100644 index 0000000..b06b527 --- /dev/null +++ b/deps/glib/gatomic.h @@ -0,0 +1,217 @@ +/* + * Copyright © 2011 Ryan Lortie + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * licence, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + * + * Author: Ryan Lortie + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_ATOMIC_H__ +#define __G_ATOMIC_H__ + +#include + +G_BEGIN_DECLS + +gint g_atomic_int_get (volatile gint *atomic); +void g_atomic_int_set (volatile gint *atomic, + gint newval); +void g_atomic_int_inc (volatile gint *atomic); +gboolean g_atomic_int_dec_and_test (volatile gint *atomic); +gboolean g_atomic_int_compare_and_exchange (volatile gint *atomic, + gint oldval, + gint newval); +gint g_atomic_int_add (volatile gint *atomic, + gint val); +guint g_atomic_int_and (volatile guint *atomic, + guint val); +guint g_atomic_int_or (volatile guint *atomic, + guint val); +guint g_atomic_int_xor (volatile guint *atomic, + guint val); + +gpointer g_atomic_pointer_get (volatile void *atomic); +void g_atomic_pointer_set (volatile void *atomic, + gpointer newval); +gboolean g_atomic_pointer_compare_and_exchange (volatile void *atomic, + gpointer oldval, + gpointer newval); +gssize g_atomic_pointer_add (volatile void *atomic, + gssize val); +gsize g_atomic_pointer_and (volatile void *atomic, + gsize val); +gsize g_atomic_pointer_or (volatile void *atomic, + gsize val); +gsize g_atomic_pointer_xor (volatile void *atomic, + gsize val); + +#ifndef G_DISABLE_DEPRECATED +gint g_atomic_int_exchange_and_add (volatile gint *atomic, + gint val); +#endif + +G_END_DECLS + +#if defined(__GNUC__) && defined(G_ATOMIC_OP_USE_GCC_BUILTINS) + +#define g_atomic_int_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ + __sync_synchronize (); \ + (gint) *(atomic); \ + })) +#define g_atomic_int_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (newval) : 0); \ + *(atomic) = (newval); \ + __sync_synchronize (); \ + })) +#define g_atomic_int_inc(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ + (void) __sync_fetch_and_add ((atomic), 1); \ + })) +#define g_atomic_int_dec_and_test(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ + __sync_fetch_and_sub ((atomic), 1) == 1; \ + })) +#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \ + (gboolean) __sync_bool_compare_and_swap ((atomic), (oldval), (newval)); \ + })) +#define g_atomic_int_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 0); \ + (gint) __sync_fetch_and_add ((atomic), (val)); \ + })) +#define g_atomic_int_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 0); \ + (guint) __sync_fetch_and_and ((atomic), (val)); \ + })) +#define g_atomic_int_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 0); \ + (guint) __sync_fetch_and_or ((atomic), (val)); \ + })) +#define g_atomic_int_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \ + (void) (0 ? *(atomic) ^ (val) : 0); \ + (guint) __sync_fetch_and_xor ((atomic), (val)); \ + })) + +#define g_atomic_pointer_get(atomic) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + __sync_synchronize (); \ + (gpointer) *(atomic); \ + })) +#define g_atomic_pointer_set(atomic, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + *(atomic) = (__typeof__ (*(atomic))) (gsize) (newval); \ + __sync_synchronize (); \ + })) +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + (gboolean) __sync_bool_compare_and_swap ((atomic), (oldval), (newval)); \ + })) +#define g_atomic_pointer_add(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + (void) (0 ? (val) ^ (val) : 0); \ + (gssize) __sync_fetch_and_add ((atomic), (val)); \ + })) +#define g_atomic_pointer_and(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + (void) (0 ? (val) ^ (val) : 0); \ + (gsize) __sync_fetch_and_and ((atomic), (val)); \ + })) +#define g_atomic_pointer_or(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + (void) (0 ? (val) ^ (val) : 0); \ + (gsize) __sync_fetch_and_or ((atomic), (val)); \ + })) +#define g_atomic_pointer_xor(atomic, val) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ + (void) (0 ? (gpointer) *(atomic) : 0); \ + (void) (0 ? (val) ^ (val) : 0); \ + (gsize) __sync_fetch_and_xor ((atomic), (val)); \ + })) + +#else /* defined(__GNUC__) && defined(G_ATOMIC_OP_USE_GCC_BUILTINS) */ + +#define g_atomic_int_get(atomic) \ + (g_atomic_int_get ((gint *) (atomic))) +#define g_atomic_int_set(atomic, newval) \ + (g_atomic_int_set ((gint *) (atomic), (gint) (newval))) +#define g_atomic_int_compare_and_exchange(atomic, oldval, newval) \ + (g_atomic_int_compare_and_exchange ((gint *) (atomic), (oldval), (newval))) +#define g_atomic_int_add(atomic, val) \ + (g_atomic_int_add ((gint *) (atomic), (val))) +#define g_atomic_int_and(atomic, val) \ + (g_atomic_int_and ((gint *) (atomic), (val))) +#define g_atomic_int_or(atomic, val) \ + (g_atomic_int_or ((gint *) (atomic), (val))) +#define g_atomic_int_xor(atomic, val) \ + (g_atomic_int_xor ((gint *) (atomic), (val))) +#define g_atomic_int_inc(atomic) \ + (g_atomic_int_inc ((gint *) (atomic))) +#define g_atomic_int_dec_and_test(atomic) \ + (g_atomic_int_dec_and_test ((gint *) (atomic))) + +#define g_atomic_pointer_get(atomic) \ + (g_atomic_pointer_get (atomic)) +#define g_atomic_pointer_set(atomic, newval) \ + (g_atomic_pointer_set ((atomic), (gpointer) (newval))) +#define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ + (g_atomic_pointer_compare_and_exchange ((atomic), (gpointer) (oldval), (gpointer) (newval))) +#define g_atomic_pointer_add(atomic, val) \ + (g_atomic_pointer_add ((atomic), (gssize) (val))) +#define g_atomic_pointer_and(atomic, val) \ + (g_atomic_pointer_and ((atomic), (gsize) (val))) +#define g_atomic_pointer_or(atomic, val) \ + (g_atomic_pointer_or ((atomic), (gsize) (val))) +#define g_atomic_pointer_xor(atomic, val) \ + (g_atomic_pointer_xor ((atomic), (gsize) (val))) + +#endif /* defined(__GNUC__) && defined(G_ATOMIC_OP_USE_GCC_BUILTINS) */ + +#endif /* __G_ATOMIC_H__ */ diff --git a/deps/glib/gbacktrace.h b/deps/glib/gbacktrace.h new file mode 100644 index 0000000..e5bb39c --- /dev/null +++ b/deps/glib/gbacktrace.h @@ -0,0 +1,61 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_BACKTRACE_H__ +#define __G_BACKTRACE_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * G_BREAKPOINT: + * + * Inserts a breakpoint instruction into the code. + * + * On x86 and alpha systems this is implemented as a soft interrupt + * and on other architectures it raises a %SIGTRAP signal. + */ +#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2 +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END +#elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86) +# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END +#elif defined (_MSC_VER) +# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END +#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END +#else /* !__i386__ && !__alpha__ */ +# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END +#endif /* __i386__ */ + +G_END_DECLS + +#endif /* __G_BACKTRACE_H__ */ diff --git a/deps/glib/gbitlock.c b/deps/glib/gbitlock.c new file mode 100644 index 0000000..a9f7a5e --- /dev/null +++ b/deps/glib/gbitlock.c @@ -0,0 +1,535 @@ +/* + * Copyright © 2008 Ryan Lortie + * Copyright © 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the licence, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ryan Lortie + */ + +#include "gbitlock.h" + +#include +#include +#include +#include + +#include "gthreadprivate.h" +#include "config.h" + + +#ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION +#undef HAVE_FUTEX +#endif + +#ifndef HAVE_FUTEX +static GSList *g_futex_address_list = NULL; +static GMutex *g_futex_mutex = NULL; +#endif + +void +_g_futex_thread_init (void) { +#ifndef HAVE_FUTEX + g_futex_mutex = g_mutex_new (); +#endif +} + +#ifdef HAVE_FUTEX +/* + * We have headers for futex(2) on the build machine. This does not + * imply that every system that ever runs the resulting glib will have + * kernel support for futex, but you'd have to have a pretty old + * kernel in order for that not to be the case. + * + * If anyone actually gets bit by this, please file a bug. :) + */ +#include +#include +#include + +/* < private > + * g_futex_wait: + * @address: a pointer to an integer + * @value: the value that should be at @address + * + * Atomically checks that the value stored at @address is equal to + * @value and then blocks. If the value stored at @address is not + * equal to @value then this function returns immediately. + * + * To unblock, call g_futex_wake() on @address. + * + * This call may spuriously unblock (for example, in response to the + * process receiving a signal) but this is not guaranteed. Unlike the + * Linux system call of a similar name, there is no guarantee that a + * waiting process will unblock due to a g_futex_wake() call in a + * separate process. + */ +static void +g_futex_wait (const volatile gint *address, + gint value) +{ + syscall (__NR_futex, address, (gsize) FUTEX_WAIT, (gsize) value, NULL); +} + +/* < private > + * g_futex_wake: + * @address: a pointer to an integer + * + * Nominally, wakes one thread that is blocked in g_futex_wait() on + * @address (if any thread is currently waiting). + * + * As mentioned in the documention for g_futex_wait(), spurious + * wakeups may occur. As such, this call may result in more than one + * thread being woken up. + */ +static void +g_futex_wake (const volatile gint *address) +{ + syscall (__NR_futex, address, (gsize) FUTEX_WAKE, (gsize) 1, NULL); +} + +#else + +/* emulate futex(2) */ +typedef struct +{ + const volatile gint *address; + gint ref_count; + GCond *wait_queue; +} WaitAddress; + +static WaitAddress * +g_futex_find_address (const volatile gint *address) +{ + GSList *node; + + for (node = g_futex_address_list; node; node = node->next) + { + WaitAddress *waiter = node->data; + + if (waiter->address == address) + return waiter; + } + + return NULL; +} + +static void +g_futex_wait (const volatile gint *address, + gint value) +{ + g_mutex_lock (g_futex_mutex); + if G_LIKELY (g_atomic_int_get (address) == value) + { + WaitAddress *waiter; + + if ((waiter = g_futex_find_address (address)) == NULL) + { + waiter = g_slice_new (WaitAddress); + waiter->address = address; + waiter->wait_queue = g_cond_new (); + waiter->ref_count = 0; + g_futex_address_list = + g_slist_prepend (g_futex_address_list, waiter); + } + + waiter->ref_count++; + g_cond_wait (waiter->wait_queue, g_futex_mutex); + + if (!--waiter->ref_count) + { + g_futex_address_list = + g_slist_remove (g_futex_address_list, waiter); + g_cond_free (waiter->wait_queue); + g_slice_free (WaitAddress, waiter); + } + } + g_mutex_unlock (g_futex_mutex); +} + +static void +g_futex_wake (const volatile gint *address) +{ + WaitAddress *waiter; + + /* need to lock here for two reasons: + * 1) need to acquire/release lock to ensure waiter is not in + * the process of registering a wait + * 2) need to -stay- locked until the end to ensure a wake() + * in another thread doesn't cause 'waiter' to stop existing + */ + g_mutex_lock (g_futex_mutex); + if ((waiter = g_futex_find_address (address))) + g_cond_signal (waiter->wait_queue); + g_mutex_unlock (g_futex_mutex); +} +#endif + +#define CONTENTION_CLASSES 11 +static volatile gint g_bit_lock_contended[CONTENTION_CLASSES]; + +#if (defined (i386) || defined (__amd64__)) + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + #define USE_ASM_GOTO 1 + #endif +#endif + +/** + * g_bit_lock: + * @address: a pointer to an integer + * @lock_bit: a bit value between 0 and 31 + * + * Sets the indicated @lock_bit in @address. If the bit is already + * set, this call will block until g_bit_unlock() unsets the + * corresponding bit. + * + * Attempting to lock on two different bits within the same integer is + * not supported and will very probably cause deadlocks. + * + * The value of the bit that is set is (1u << @bit). If @bit is not + * between 0 and 31 then the result is undefined. + * + * This function accesses @address atomically. All other accesses to + * @address must be atomic in order for this function to work + * reliably. + * + * Since: 2.24 + **/ +void +g_bit_lock (volatile gint *address, + gint lock_bit) +{ +#ifdef USE_ASM_GOTO + retry: + asm volatile goto ("lock bts %1, (%0)\n" + "jc %l[contended]" + : /* no output */ + : "r" (address), "r" (lock_bit) + : "cc", "memory" + : contended); + return; + + contended: + { + guint mask = 1u << lock_bit; + guint v; + + v = g_atomic_int_get (address); + if (v & mask) + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + + g_atomic_int_add (&g_bit_lock_contended[class], +1); + g_futex_wait (address, v); + g_atomic_int_add (&g_bit_lock_contended[class], -1); + } + } + goto retry; +#else + guint mask = 1u << lock_bit; + guint v; + + retry: + v = g_atomic_int_or (address, mask); + if (v & mask) + /* already locked */ + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + + g_atomic_int_add (&g_bit_lock_contended[class], +1); + g_futex_wait (address, v); + g_atomic_int_add (&g_bit_lock_contended[class], -1); + + goto retry; + } +#endif +} + +/** + * g_bit_trylock: + * @address: a pointer to an integer + * @lock_bit: a bit value between 0 and 31 + * @returns: %TRUE if the lock was acquired + * + * Sets the indicated @lock_bit in @address, returning %TRUE if + * successful. If the bit is already set, returns %FALSE immediately. + * + * Attempting to lock on two different bits within the same integer is + * not supported. + * + * The value of the bit that is set is (1u << @bit). If @bit is not + * between 0 and 31 then the result is undefined. + * + * This function accesses @address atomically. All other accesses to + * @address must be atomic in order for this function to work + * reliably. + * + * Since: 2.24 + **/ +gboolean +g_bit_trylock (volatile gint *address, + gint lock_bit) +{ +#ifdef USE_ASM_GOTO + gboolean result; + + asm volatile ("lock bts %2, (%1)\n" + "setnc %%al\n" + "movzx %%al, %0" + : "=r" (result) + : "r" (address), "r" (lock_bit) + : "cc", "memory"); + + return result; +#else + guint mask = 1u << lock_bit; + guint v; + + v = g_atomic_int_or (address, mask); + + return ~v & mask; +#endif +} + +/** + * g_bit_unlock: + * @address: a pointer to an integer + * @lock_bit: a bit value between 0 and 31 + * + * Clears the indicated @lock_bit in @address. If another thread is + * currently blocked in g_bit_lock() on this same bit then it will be + * woken up. + * + * This function accesses @address atomically. All other accesses to + * @address must be atomic in order for this function to work + * reliably. + * + * Since: 2.24 + **/ +void +g_bit_unlock (volatile gint *address, + gint lock_bit) +{ +#ifdef USE_ASM_GOTO + asm volatile ("lock btr %1, (%0)" + : /* no output */ + : "r" (address), "r" (lock_bit) + : "cc", "memory"); +#else + guint mask = 1u << lock_bit; + + g_atomic_int_and (address, ~mask); +#endif + + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + + if (g_atomic_int_get (&g_bit_lock_contended[class])) + g_futex_wake (address); + } +} + + +/* We emulate pointer-sized futex(2) because the kernel API only + * supports integers. + * + * We assume that the 'interesting' part is always the lower order bits. + * This assumption holds because pointer bitlocks are restricted to + * using the low order bits of the pointer as the lock. + * + * On 32 bits, there is nothing to do since the pointer size is equal to + * the integer size. On little endian the lower-order bits don't move, + * so do nothing. Only on 64bit big endian do we need to do a bit of + * pointer arithmetic: the low order bits are shifted by 4 bytes. We + * have a helper function that always does the right thing here. + * + * Since we always consider the low-order bits of the integer value, a + * simple cast from (gsize) to (guint) always takes care of that. + * + * After that, pointer-sized futex becomes as simple as: + * + * g_futex_wait (g_futex_int_address (address), (guint) value); + * + * and + * + * g_futex_wake (g_futex_int_address (int_address)); + */ +static const volatile gint * +g_futex_int_address (const volatile void *address) +{ + const volatile gint *int_address = address; + +#if G_BYTE_ORDER == G_BIG_ENDIAN && GLIB_SIZEOF_VOID_P == 8 + int_address++; +#endif + + return int_address; +} + +/** + * g_pointer_bit_lock: + * @address: a pointer to a #gpointer-sized value + * @lock_bit: a bit value between 0 and 31 + * + * This is equivalent to g_bit_lock, but working on pointers (or other + * pointer-sized values). + * + * For portability reasons, you may only lock on the bottom 32 bits of + * the pointer. + * + * Since: 2.30 + **/ +void +(g_pointer_bit_lock) (volatile void *address, + gint lock_bit) +{ + g_return_if_fail (lock_bit < 32); + + { +#ifdef USE_ASM_GOTO + retry: + asm volatile goto ("lock bts %1, (%0)\n" + "jc %l[contended]" + : /* no output */ + : "r" (address), "r" ((gsize) lock_bit) + : "cc", "memory" + : contended); + return; + + contended: + { + volatile gsize *pointer_address = address; + gsize mask = 1u << lock_bit; + gsize v; + + v = (gsize) g_atomic_pointer_get (pointer_address); + if (v & mask) + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + + g_atomic_int_add (&g_bit_lock_contended[class], +1); + g_futex_wait (g_futex_int_address (address), v); + g_atomic_int_add (&g_bit_lock_contended[class], -1); + } + } + goto retry; +#else + volatile gsize *pointer_address = address; + gsize mask = 1u << lock_bit; + gsize v; + + retry: + v = g_atomic_pointer_or (pointer_address, mask); + if (v & mask) + /* already locked */ + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + + g_atomic_int_add (&g_bit_lock_contended[class], +1); + g_futex_wait (g_futex_int_address (address), (guint) v); + g_atomic_int_add (&g_bit_lock_contended[class], -1); + + goto retry; + } +#endif + } +} + +/** + * g_pointer_bit_trylock: + * @address: a pointer to a #gpointer-sized value + * @lock_bit: a bit value between 0 and 31 + * @returns: %TRUE if the lock was acquired + * + * This is equivalent to g_bit_trylock, but working on pointers (or + * other pointer-sized values). + * + * For portability reasons, you may only lock on the bottom 32 bits of + * the pointer. + * + * Since: 2.30 + **/ +gboolean +(g_pointer_bit_trylock) (volatile void *address, + gint lock_bit) +{ + g_return_val_if_fail (lock_bit < 32, FALSE); + + { +#ifdef USE_ASM_GOTO + gboolean result; + + asm volatile ("lock bts %2, (%1)\n" + "setnc %%al\n" + "movzx %%al, %0" + : "=r" (result) + : "r" (address), "r" ((gsize) lock_bit) + : "cc", "memory"); + + return result; +#else + volatile gsize *pointer_address = address; + gsize mask = 1u << lock_bit; + gsize v; + + g_return_val_if_fail (lock_bit < 32, FALSE); + + v = g_atomic_pointer_or (pointer_address, mask); + + return ~v & mask; +#endif + } +} + +/** + * g_pointer_bit_unlock: + * @address: a pointer to a #gpointer-sized value + * @lock_bit: a bit value between 0 and 31 + * + * This is equivalent to g_bit_unlock, but working on pointers (or other + * pointer-sized values). + * + * For portability reasons, you may only lock on the bottom 32 bits of + * the pointer. + * + * Since: 2.30 + **/ +void +(g_pointer_bit_unlock) (volatile void *address, + gint lock_bit) +{ + g_return_if_fail (lock_bit < 32); + + { +#ifdef USE_ASM_GOTO + asm volatile ("lock btr %1, (%0)" + : /* no output */ + : "r" (address), "r" ((gsize) lock_bit) + : "cc", "memory"); +#else + volatile gsize *pointer_address = address; + gsize mask = 1u << lock_bit; + + g_atomic_pointer_and (pointer_address, ~mask); +#endif + + { + guint class = ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended); + if (g_atomic_int_get (&g_bit_lock_contended[class])) + g_futex_wake (g_futex_int_address (address)); + } + } +} diff --git a/deps/glib/gbitlock.h b/deps/glib/gbitlock.h new file mode 100644 index 0000000..ea9cb41 --- /dev/null +++ b/deps/glib/gbitlock.h @@ -0,0 +1,72 @@ +/* + * Copyright © 2008 Ryan Lortie + * Copyright © 2010 Codethink Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the licence, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ryan Lortie + */ + +#ifndef __G_BITLOCK_H__ +#define __G_BITLOCK_H__ + +#include + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +void g_bit_lock (volatile gint *address, + gint lock_bit); +gboolean g_bit_trylock (volatile gint *address, + gint lock_bit); +void g_bit_unlock (volatile gint *address, + gint lock_bit); + +void g_pointer_bit_lock (volatile void *address, + gint lock_bit); +gboolean g_pointer_bit_trylock (volatile void *address, + gint lock_bit); +void g_pointer_bit_unlock (volatile void *address, + gint lock_bit); + +#ifdef __GNUC__ + +#define g_pointer_bit_lock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + g_pointer_bit_lock ((address), (lock_bit)); \ + })) + +#define g_pointer_bit_trylock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + g_pointer_bit_trylock ((address), (lock_bit)); \ + })) + +#define g_pointer_bit_unlock(address, lock_bit) \ + (G_GNUC_EXTENSION ({ \ + G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \ + g_pointer_bit_unlock ((address), (lock_bit)); \ + })) + +#endif + +G_END_DECLS + +#endif /* __G_BITLOCK_H_ */ diff --git a/deps/glib/gconvert.c b/deps/glib/gconvert.c new file mode 100644 index 0000000..c269f74 --- /dev/null +++ b/deps/glib/gconvert.c @@ -0,0 +1,31 @@ +#include "gstrfuncs.h" +#include "gconvert.h" + +gchar* +g_convert_with_fallback (const gchar *str, + gssize len, + const gchar *to_codeset, + const gchar *from_codeset, + const gchar *fallback, + gsize *bytes_read, + gsize *bytes_written, + GError **error) +{ + return g_strdup(str); +} + +gchar* +g_locale_to_utf8 (const gchar *opsysstring, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) +{ + return g_strdup(opsysstring); +} + +gchar * +g_filename_display_name (const gchar *filename) +{ + return g_strdup(filename); +} diff --git a/deps/glib/gconvert.h b/deps/glib/gconvert.h new file mode 100644 index 0000000..a2c33ad --- /dev/null +++ b/deps/glib/gconvert.h @@ -0,0 +1,94 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * This file has been hacked up to contain a few stubs to get a + * standalone glib that does not care about string charset conversions + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_CONVERT_H__ +#define __G_CONVERT_H__ + +#include + +G_BEGIN_DECLS + +/** + * GConvertError: + * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character + * sets is not supported. + * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input. + * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason. + * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input. + * @G_CONVERT_ERROR_BAD_URI: URI is invalid. + * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path. + * + * Error codes returned by character set conversion routines. + */ +typedef enum +{ + G_CONVERT_ERROR_NO_CONVERSION, + G_CONVERT_ERROR_ILLEGAL_SEQUENCE, + G_CONVERT_ERROR_FAILED, + G_CONVERT_ERROR_PARTIAL_INPUT, + G_CONVERT_ERROR_BAD_URI, + G_CONVERT_ERROR_NOT_ABSOLUTE_PATH +} GConvertError; + +/** + * G_CONVERT_ERROR: + * + * Error domain for character set conversions. Errors in this domain will + * be from the #GConvertError enumeration. See #GError for information on + * error domains. + */ +#define G_CONVERT_ERROR g_convert_error_quark() +GQuark g_convert_error_quark (void); + +gchar* g_convert_with_fallback (const gchar *str, + gssize len, + const gchar *to_codeset, + const gchar *from_codeset, + const gchar *fallback, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; + +gchar* g_locale_to_utf8 (const gchar *opsysstring, + gssize len, + gsize *bytes_read, + gsize *bytes_written, + GError **error) G_GNUC_MALLOC; + +gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; + +G_END_DECLS + +#endif /* __G_CONVERT_H__ */ diff --git a/deps/glib/gdataset.c b/deps/glib/gdataset.c new file mode 100644 index 0000000..715b31d --- /dev/null +++ b/deps/glib/gdataset.c @@ -0,0 +1,1361 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * gdataset.c: Generic dataset mechanism, similar to GtkObject data. + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe ; except for g_data*_foreach() + */ + +#include "config.h" + +#include + +#include "gdataset.h" +#include "gbitlock.h" + +#include "gdatasetprivate.h" +#include "ghash.h" +#include "gquark.h" +#include "gstrfuncs.h" +#include "gtestutils.h" +#include "gthread.h" +#include "glib_trace.h" + +/** + * SECTION:datasets + * @title: Datasets + * @short_description: associate groups of data elements with + * particular memory locations + * + * Datasets associate groups of data elements with particular memory + * locations. These are useful if you need to associate data with a + * structure returned from an external library. Since you cannot modify + * the structure, you use its location in memory as the key into a + * dataset, where you can associate any number of data elements with it. + * + * There are two forms of most of the dataset functions. The first form + * uses strings to identify the data elements associated with a + * location. The second form uses #GQuark identifiers, which are + * created with a call to g_quark_from_string() or + * g_quark_from_static_string(). The second form is quicker, since it + * does not require looking up the string in the hash table of #GQuark + * identifiers. + * + * There is no function to create a dataset. It is automatically + * created as soon as you add elements to it. + * + * To add data elements to a dataset use g_dataset_id_set_data(), + * g_dataset_id_set_data_full(), g_dataset_set_data() and + * g_dataset_set_data_full(). + * + * To get data elements from a dataset use g_dataset_id_get_data() and + * g_dataset_get_data(). + * + * To iterate over all data elements in a dataset use + * g_dataset_foreach() (not thread-safe). + * + * To remove data elements from a dataset use + * g_dataset_id_remove_data() and g_dataset_remove_data(). + * + * To destroy a dataset, use g_dataset_destroy(). + **/ + +/** + * SECTION:datalist + * @title: Keyed Data Lists + * @short_description: lists of data elements which are accessible by a + * string or GQuark identifier + * + * Keyed data lists provide lists of arbitrary data elements which can + * be accessed either with a string or with a #GQuark corresponding to + * the string. + * + * The #GQuark methods are quicker, since the strings have to be + * converted to #GQuarks anyway. + * + * Data lists are used for associating arbitrary data with #GObjects, + * using g_object_set_data() and related functions. + * + * To create a datalist, use g_datalist_init(). + * + * To add data elements to a datalist use g_datalist_id_set_data(), + * g_datalist_id_set_data_full(), g_datalist_set_data() and + * g_datalist_set_data_full(). + * + * To get data elements from a datalist use g_datalist_id_get_data() + * and g_datalist_get_data(). + * + * To iterate over all data elements in a datalist use + * g_datalist_foreach() (not thread-safe). + * + * To remove data elements from a datalist use + * g_datalist_id_remove_data() and g_datalist_remove_data(). + * + * To remove all data elements from a datalist, use g_datalist_clear(). + **/ + +/** + * GData: + * + * The #GData struct is an opaque data structure to represent a Keyed Data List. It should + * only be accessed via the following functions. + **/ + +/** + * GDestroyNotify: + * @data: the data element. + * + * Specifies the type of function which is called when a data element + * is destroyed. It is passed the pointer to the data element and + * should free any memory and resources allocated for it. + **/ + +/* --- defines --- */ +#define G_QUARK_BLOCK_SIZE (2048) + +#define G_DATALIST_FLAGS_MASK_INTERNAL 0x7 + +/* datalist pointer accesses have to be carried out atomically */ +#define G_DATALIST_GET_POINTER(datalist) \ + ((GData*) ((gsize) g_atomic_pointer_get (datalist) & ~(gsize) G_DATALIST_FLAGS_MASK_INTERNAL)) + +#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \ + gpointer _oldv, _newv; \ + do { \ + _oldv = g_atomic_pointer_get (datalist); \ + _newv = (gpointer) (((gsize) _oldv & G_DATALIST_FLAGS_MASK_INTERNAL) | (gsize) pointer); \ + } while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, _oldv, _newv)); \ +} G_STMT_END + +/* --- structures --- */ +typedef struct { + GQuark key; + gpointer data; + GDestroyNotify destroy; +} GDataElt; + +typedef struct _GDataset GDataset; +struct _GData +{ + guint32 len; /* Number of elements */ + guint32 alloc; /* Number of allocated elements */ + GDataElt data[1]; /* Flexible array */ +}; + +struct _GDataset +{ + gconstpointer location; + GData *datalist; +}; + + +/* --- prototypes --- */ +static inline GDataset* g_dataset_lookup (gconstpointer dataset_location); +static inline void g_datalist_clear_i (GData **datalist); +static void g_dataset_destroy_internal (GDataset *dataset); +static inline gpointer g_data_set_internal (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func, + GDataset *dataset); +static void g_data_initialize (void); +static inline GQuark g_quark_new (gchar *string); + + +/* Locking model: + * Each standalone GDataList is protected by a bitlock in the datalist pointer, + * which protects that modification of the non-flags part of the datalist pointer + * and the contents of the datalist. + * + * For GDataSet we have a global lock g_dataset_global that protects + * the global dataset hash and cache, and additionally it protects the + * datalist such that we can avoid to use the bit lock in a few places + * where it is easy. + */ + +/* --- variables --- */ +G_LOCK_DEFINE_STATIC (g_dataset_global); +static GHashTable *g_dataset_location_ht = NULL; +static GDataset *g_dataset_cached = NULL; /* should this be + threadspecific? */ +G_LOCK_DEFINE_STATIC (g_quark_global); +static GHashTable *g_quark_ht = NULL; +static gchar **g_quarks = NULL; +static int g_quark_seq_id = 0; + +/* --- functions --- */ + +#define DATALIST_LOCK_BIT 2 + +static void +g_datalist_lock (GData **datalist) +{ + g_pointer_bit_lock ((void **)datalist, DATALIST_LOCK_BIT); +} + +static void +g_datalist_unlock (GData **datalist) +{ + g_pointer_bit_unlock ((void **)datalist, DATALIST_LOCK_BIT); +} + +/* Called with the datalist lock held, or the dataset global + * lock for dataset lists + */ +static void +g_datalist_clear_i (GData **datalist) +{ + GData *data; + gint i; + + data = G_DATALIST_GET_POINTER (datalist); + G_DATALIST_SET_POINTER (datalist, NULL); + + if (data) + { + G_UNLOCK (g_dataset_global); + for (i = 0; i < data->len; i++) + { + if (data->data[i].data && data->data[i].destroy) + data->data[i].destroy (data->data[i].data); + } + G_LOCK (g_dataset_global); + + g_free (data); + } + +} + +/** + * g_datalist_clear: + * @datalist: a datalist. + * + * Frees all the data elements of the datalist. + * The data elements' destroy functions are called + * if they have been set. + **/ +void +g_datalist_clear (GData **datalist) +{ + GData *data; + gint i; + + g_return_if_fail (datalist != NULL); + + g_datalist_lock (datalist); + + data = G_DATALIST_GET_POINTER (datalist); + G_DATALIST_SET_POINTER (datalist, NULL); + + g_datalist_unlock (datalist); + + if (data) + { + for (i = 0; i < data->len; i++) + { + if (data->data[i].data && data->data[i].destroy) + data->data[i].destroy (data->data[i].data); + } + + g_free (data); + } +} + +/* HOLDS: g_dataset_global_lock */ +static inline GDataset* +g_dataset_lookup (gconstpointer dataset_location) +{ + register GDataset *dataset; + + if (g_dataset_cached && g_dataset_cached->location == dataset_location) + return g_dataset_cached; + + dataset = g_hash_table_lookup (g_dataset_location_ht, dataset_location); + if (dataset) + g_dataset_cached = dataset; + + return dataset; +} + +/* HOLDS: g_dataset_global_lock */ +static void +g_dataset_destroy_internal (GDataset *dataset) +{ + register gconstpointer dataset_location; + + dataset_location = dataset->location; + while (dataset) + { + if (G_DATALIST_GET_POINTER(&dataset->datalist) == NULL) + { + if (dataset == g_dataset_cached) + g_dataset_cached = NULL; + g_hash_table_remove (g_dataset_location_ht, dataset_location); + g_slice_free (GDataset, dataset); + break; + } + + g_datalist_clear_i (&dataset->datalist); + dataset = g_dataset_lookup (dataset_location); + } +} + +/** + * g_dataset_destroy: + * @dataset_location: the location identifying the dataset. + * + * Destroys the dataset, freeing all memory allocated, and calling any + * destroy functions set for data elements. + */ +void +g_dataset_destroy (gconstpointer dataset_location) +{ + g_return_if_fail (dataset_location != NULL); + + G_LOCK (g_dataset_global); + if (g_dataset_location_ht) + { + register GDataset *dataset; + + dataset = g_dataset_lookup (dataset_location); + if (dataset) + g_dataset_destroy_internal (dataset); + } + G_UNLOCK (g_dataset_global); +} + +/* HOLDS: g_dataset_global_lock if dataset != null */ +static inline gpointer +g_data_set_internal (GData **datalist, + GQuark key_id, + gpointer new_data, + GDestroyNotify new_destroy_func, + GDataset *dataset) +{ + GData *d, *old_d; + GDataElt old, *data, *data_last, *data_end; + + g_datalist_lock (datalist); + + d = G_DATALIST_GET_POINTER (datalist); + + if (new_data == NULL) /* remove */ + { + if (d) + { + data = d->data; + data_last = data + d->len - 1; + while (data <= data_last) + { + if (data->key == key_id) + { + old = *data; + if (data != data_last) + *data = *data_last; + d->len--; + + /* We don't bother to shrink, but if all data are now gone + * we at least free the memory + */ + if (d->len == 0) + { + G_DATALIST_SET_POINTER (datalist, NULL); + g_free (d); + /* datalist may be situated in dataset, so must not be + * unlocked after we free it + */ + g_datalist_unlock (datalist); + + /* the dataset destruction *must* be done + * prior to invocation of the data destroy function + */ + if (dataset) + g_dataset_destroy_internal (dataset); + } + else + { + g_datalist_unlock (datalist); + } + + /* We found and removed an old value + * the GData struct *must* already be unlinked + * when invoking the destroy function. + * we use (new_data==NULL && new_destroy_func!=NULL) as + * a special hint combination to "steal" + * data without destroy notification + */ + if (old.destroy && !new_destroy_func) + { + if (dataset) + G_UNLOCK (g_dataset_global); + old.destroy (old.data); + if (dataset) + G_LOCK (g_dataset_global); + old.data = NULL; + } + + return old.data; + } + data++; + } + } + } + else + { + old.data = NULL; + if (d) + { + data = d->data; + data_end = data + d->len; + while (data < data_end) + { + if (data->key == key_id) + { + if (!data->destroy) + { + data->data = new_data; + data->destroy = new_destroy_func; + g_datalist_unlock (datalist); + } + else + { + old = *data; + data->data = new_data; + data->destroy = new_destroy_func; + + g_datalist_unlock (datalist); + + /* We found and replaced an old value + * the GData struct *must* already be unlinked + * when invoking the destroy function. + */ + if (dataset) + G_UNLOCK (g_dataset_global); + old.destroy (old.data); + if (dataset) + G_LOCK (g_dataset_global); + } + return NULL; + } + data++; + } + } + + /* The key was not found, insert it */ + old_d = d; + if (d == NULL) + { + d = g_malloc (sizeof (GData)); + d->len = 0; + d->alloc = 1; + } + else if (d->len == d->alloc) + { + d->alloc = d->alloc * 2; + d = g_realloc (d, sizeof (GData) + (d->alloc - 1) * sizeof (GDataElt)); + } + if (old_d != d) + G_DATALIST_SET_POINTER (datalist, d); + + d->data[d->len].key = key_id; + d->data[d->len].data = new_data; + d->data[d->len].destroy = new_destroy_func; + d->len++; + } + + g_datalist_unlock (datalist); + + return NULL; + +} + +/** + * g_dataset_id_set_data_full: + * @dataset_location: the location identifying the dataset. + * @key_id: the #GQuark id to identify the data element. + * @data: the data element. + * @destroy_func: the function to call when the data element is + * removed. This function will be called with the data + * element and can be used to free any memory allocated + * for it. + * + * Sets the data element associated with the given #GQuark id, and also + * the function to call when the data element is destroyed. Any + * previous data with the same key is removed, and its destroy function + * is called. + **/ +/** + * g_dataset_set_data_full: + * @l: the location identifying the dataset. + * @k: the string to identify the data element. + * @d: the data element. + * @f: the function to call when the data element is removed. This + * function will be called with the data element and can be used to + * free any memory allocated for it. + * + * Sets the data corresponding to the given string identifier, and the + * function to call when the data element is destroyed. + **/ +/** + * g_dataset_id_set_data: + * @l: the location identifying the dataset. + * @k: the #GQuark id to identify the data element. + * @d: the data element. + * + * Sets the data element associated with the given #GQuark id. Any + * previous data with the same key is removed, and its destroy function + * is called. + **/ +/** + * g_dataset_set_data: + * @l: the location identifying the dataset. + * @k: the string to identify the data element. + * @d: the data element. + * + * Sets the data corresponding to the given string identifier. + **/ +/** + * g_dataset_id_remove_data: + * @l: the location identifying the dataset. + * @k: the #GQuark id identifying the data element. + * + * Removes a data element from a dataset. The data element's destroy + * function is called if it has been set. + **/ +/** + * g_dataset_remove_data: + * @l: the location identifying the dataset. + * @k: the string identifying the data element. + * + * Removes a data element corresponding to a string. Its destroy + * function is called if it has been set. + **/ +void +g_dataset_id_set_data_full (gconstpointer dataset_location, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func) +{ + register GDataset *dataset; + + g_return_if_fail (dataset_location != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); + if (!key_id) + { + if (data) + g_return_if_fail (key_id > 0); + else + return; + } + + G_LOCK (g_dataset_global); + if (!g_dataset_location_ht) + g_data_initialize (); + + dataset = g_dataset_lookup (dataset_location); + if (!dataset) + { + dataset = g_slice_new (GDataset); + dataset->location = dataset_location; + g_datalist_init (&dataset->datalist); + g_hash_table_insert (g_dataset_location_ht, + (gpointer) dataset->location, + dataset); + } + + g_data_set_internal (&dataset->datalist, key_id, data, destroy_func, dataset); + G_UNLOCK (g_dataset_global); +} + +/** + * g_datalist_id_set_data_full: + * @datalist: a datalist. + * @key_id: the #GQuark to identify the data element. + * @data: the data element or %NULL to remove any previous element + * corresponding to @key_id. + * @destroy_func: the function to call when the data element is + * removed. This function will be called with the data + * element and can be used to free any memory allocated + * for it. If @data is %NULL, then @destroy_func must + * also be %NULL. + * + * Sets the data corresponding to the given #GQuark id, and the + * function to be called when the element is removed from the datalist. + * Any previous data with the same key is removed, and its destroy + * function is called. + **/ +/** + * g_datalist_set_data_full: + * @dl: a datalist. + * @k: the string to identify the data element. + * @d: the data element, or %NULL to remove any previous element + * corresponding to @k. + * @f: the function to call when the data element is removed. This + * function will be called with the data element and can be used to + * free any memory allocated for it. If @d is %NULL, then @f must + * also be %NULL. + * + * Sets the data element corresponding to the given string identifier, + * and the function to be called when the data element is removed. + **/ +/** + * g_datalist_id_set_data: + * @dl: a datalist. + * @q: the #GQuark to identify the data element. + * @d: the data element, or %NULL to remove any previous element + * corresponding to @q. + * + * Sets the data corresponding to the given #GQuark id. Any previous + * data with the same key is removed, and its destroy function is + * called. + **/ +/** + * g_datalist_set_data: + * @dl: a datalist. + * @k: the string to identify the data element. + * @d: the data element, or %NULL to remove any previous element + * corresponding to @k. + * + * Sets the data element corresponding to the given string identifier. + **/ +/** + * g_datalist_id_remove_data: + * @dl: a datalist. + * @q: the #GQuark identifying the data element. + * + * Removes an element, using its #GQuark identifier. + **/ +/** + * g_datalist_remove_data: + * @dl: a datalist. + * @k: the string identifying the data element. + * + * Removes an element using its string identifier. The data element's + * destroy function is called if it has been set. + **/ +void +g_datalist_id_set_data_full (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func) +{ + g_return_if_fail (datalist != NULL); + if (!data) + g_return_if_fail (destroy_func == NULL); + if (!key_id) + { + if (data) + g_return_if_fail (key_id > 0); + else + return; + } + + g_data_set_internal (datalist, key_id, data, destroy_func, NULL); +} + +/** + * g_dataset_id_remove_no_notify: + * @dataset_location: the location identifying the dataset. + * @key_id: the #GQuark ID identifying the data element. + * @Returns: the data previously stored at @key_id, or %NULL if none. + * + * Removes an element, without calling its destroy notification + * function. + **/ +/** + * g_dataset_remove_no_notify: + * @l: the location identifying the dataset. + * @k: the string identifying the data element. + * + * Removes an element, without calling its destroy notifier. + **/ +gpointer +g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id) +{ + gpointer ret_data = NULL; + + g_return_val_if_fail (dataset_location != NULL, NULL); + + G_LOCK (g_dataset_global); + if (key_id && g_dataset_location_ht) + { + GDataset *dataset; + + dataset = g_dataset_lookup (dataset_location); + if (dataset) + ret_data = g_data_set_internal (&dataset->datalist, key_id, NULL, (GDestroyNotify) 42, dataset); + } + G_UNLOCK (g_dataset_global); + + return ret_data; +} + +/** + * g_datalist_id_remove_no_notify: + * @datalist: a datalist. + * @key_id: the #GQuark identifying a data element. + * @Returns: the data previously stored at @key_id, or %NULL if none. + * + * Removes an element, without calling its destroy notification + * function. + **/ +/** + * g_datalist_remove_no_notify: + * @dl: a datalist. + * @k: the string identifying the data element. + * + * Removes an element, without calling its destroy notifier. + **/ +gpointer +g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id) +{ + gpointer ret_data = NULL; + + g_return_val_if_fail (datalist != NULL, NULL); + + if (key_id) + ret_data = g_data_set_internal (datalist, key_id, NULL, (GDestroyNotify) 42, NULL); + + return ret_data; +} + +/** + * g_dataset_id_get_data: + * @dataset_location: the location identifying the dataset. + * @key_id: the #GQuark id to identify the data element. + * @Returns: the data element corresponding to the #GQuark, or %NULL if + * it is not found. + * + * Gets the data element corresponding to a #GQuark. + **/ +/** + * g_dataset_get_data: + * @l: the location identifying the dataset. + * @k: the string identifying the data element. + * @Returns: the data element corresponding to the string, or %NULL if + * it is not found. + * + * Gets the data element corresponding to a string. + **/ +gpointer +g_dataset_id_get_data (gconstpointer dataset_location, + GQuark key_id) +{ + gpointer retval = NULL; + + g_return_val_if_fail (dataset_location != NULL, NULL); + + G_LOCK (g_dataset_global); + if (key_id && g_dataset_location_ht) + { + GDataset *dataset; + + dataset = g_dataset_lookup (dataset_location); + if (dataset) + retval = g_datalist_id_get_data (&dataset->datalist, key_id); + } + G_UNLOCK (g_dataset_global); + + return retval; +} + +/** + * g_datalist_id_get_data: + * @datalist: a datalist. + * @key_id: the #GQuark identifying a data element. + * @Returns: the data element, or %NULL if it is not found. + * + * Retrieves the data element corresponding to @key_id. + **/ +gpointer +g_datalist_id_get_data (GData **datalist, + GQuark key_id) +{ + gpointer res = NULL; + + g_return_val_if_fail (datalist != NULL, NULL); + if (key_id) + { + GData *d; + GDataElt *data, *data_end; + + g_datalist_lock (datalist); + + d = G_DATALIST_GET_POINTER (datalist); + if (d) + { + data = d->data; + data_end = data + d->len; + while (data < data_end) + { + if (data->key == key_id) + { + res = data->data; + break; + } + data++; + } + } + + g_datalist_unlock (datalist); + } + + return res; +} + +/** + * g_datalist_get_data: + * @datalist: a datalist. + * @key: the string identifying a data element. + * @Returns: the data element, or %NULL if it is not found. + * + * Gets a data element, using its string identifer. This is slower than + * g_datalist_id_get_data() because it compares strings. + **/ +gpointer +g_datalist_get_data (GData **datalist, + const gchar *key) +{ + gpointer res = NULL; + GData *d; + GDataElt *data, *data_end; + + g_return_val_if_fail (datalist != NULL, NULL); + + g_datalist_lock (datalist); + + d = G_DATALIST_GET_POINTER (datalist); + if (d) + { + data = d->data; + data_end = data + d->len; + while (data < data_end) + { + if (strcmp (g_quark_to_string (data->key), key) == 0) + { + res = data->data; + break; + } + data++; + } + } + + g_datalist_unlock (datalist); + + return res; +} + +/** + * GDataForeachFunc: + * @key_id: the #GQuark id to identifying the data element. + * @data: the data element. + * @user_data: user data passed to g_dataset_foreach(). + * + * Specifies the type of function passed to g_dataset_foreach(). It is + * called with each #GQuark id and associated data element, together + * with the @user_data parameter supplied to g_dataset_foreach(). + **/ + +/** + * g_dataset_foreach: + * @dataset_location: the location identifying the dataset. + * @func: the function to call for each data element. + * @user_data: user data to pass to the function. + * + * Calls the given function for each data element which is associated + * with the given location. Note that this function is NOT thread-safe. + * So unless @datalist can be protected from any modifications during + * invocation of this function, it should not be called. + **/ +void +g_dataset_foreach (gconstpointer dataset_location, + GDataForeachFunc func, + gpointer user_data) +{ + register GDataset *dataset; + + g_return_if_fail (dataset_location != NULL); + g_return_if_fail (func != NULL); + + G_LOCK (g_dataset_global); + if (g_dataset_location_ht) + { + dataset = g_dataset_lookup (dataset_location); + G_UNLOCK (g_dataset_global); + if (dataset) + g_datalist_foreach (&dataset->datalist, func, user_data); + } + else + { + G_UNLOCK (g_dataset_global); + } +} + +/** + * g_datalist_foreach: + * @datalist: a datalist. + * @func: the function to call for each data element. + * @user_data: user data to pass to the function. + * + * Calls the given function for each data element of the datalist. The + * function is called with each data element's #GQuark id and data, + * together with the given @user_data parameter. Note that this + * function is NOT thread-safe. So unless @datalist can be protected + * from any modifications during invocation of this function, it should + * not be called. + **/ +void +g_datalist_foreach (GData **datalist, + GDataForeachFunc func, + gpointer user_data) +{ + GData *d; + int i, j, len; + GQuark *keys; + + g_return_if_fail (datalist != NULL); + g_return_if_fail (func != NULL); + + d = G_DATALIST_GET_POINTER (datalist); + if (d == NULL) + return; + + /* We make a copy of the keys so that we can handle it changing + in the callback */ + len = d->len; + keys = g_new (GQuark, len); + for (i = 0; i < len; i++) + keys[i] = d->data[i].key; + + for (i = 0; i < len; i++) + { + /* A previous callback might have removed a later item, so always check that + it still exists before calling */ + d = G_DATALIST_GET_POINTER (datalist); + + if (d == NULL) + break; + for (j = 0; j < d->len; j++) + { + if (d->data[j].key == keys[i]) { + func (d->data[i].key, d->data[i].data, user_data); + break; + } + } + } + g_free (keys); +} + +/** + * g_datalist_init: + * @datalist: a pointer to a pointer to a datalist. + * + * Resets the datalist to %NULL. It does not free any memory or call + * any destroy functions. + **/ +void +g_datalist_init (GData **datalist) +{ + g_return_if_fail (datalist != NULL); + + g_atomic_pointer_set (datalist, NULL); +} + +/** + * g_datalist_set_flags: + * @datalist: pointer to the location that holds a list + * @flags: the flags to turn on. The values of the flags are + * restricted by %G_DATALIST_FLAGS_MASK (currently + * 3; giving two possible boolean flags). + * A value for @flags that doesn't fit within the mask is + * an error. + * + * Turns on flag values for a data list. This function is used + * to keep a small number of boolean flags in an object with + * a data list without using any additional space. It is + * not generally useful except in circumstances where space + * is very tight. (It is used in the base #GObject type, for + * example.) + * + * Since: 2.8 + **/ +void +g_datalist_set_flags (GData **datalist, + guint flags) +{ + g_return_if_fail (datalist != NULL); + g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0); + + g_atomic_pointer_or (datalist, (gsize)flags); +} + +/** + * g_datalist_unset_flags: + * @datalist: pointer to the location that holds a list + * @flags: the flags to turn off. The values of the flags are + * restricted by %G_DATALIST_FLAGS_MASK (currently + * 3: giving two possible boolean flags). + * A value for @flags that doesn't fit within the mask is + * an error. + * + * Turns off flag values for a data list. See g_datalist_unset_flags() + * + * Since: 2.8 + **/ +void +g_datalist_unset_flags (GData **datalist, + guint flags) +{ + g_return_if_fail (datalist != NULL); + g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0); + + g_atomic_pointer_and (datalist, ~(gsize)flags); +} + +/** + * g_datalist_get_flags: + * @datalist: pointer to the location that holds a list + * + * Gets flags values packed in together with the datalist. + * See g_datalist_set_flags(). + * + * Return value: the flags of the datalist + * + * Since: 2.8 + **/ +guint +g_datalist_get_flags (GData **datalist) +{ + g_return_val_if_fail (datalist != NULL, 0); + + return G_DATALIST_GET_FLAGS (datalist); /* atomic macro */ +} + +/* HOLDS: g_dataset_global_lock */ +static void +g_data_initialize (void) +{ + g_return_if_fail (g_dataset_location_ht == NULL); + + g_dataset_location_ht = g_hash_table_new (g_direct_hash, NULL); + g_dataset_cached = NULL; +} + +/** + * SECTION:quarks + * @title: Quarks + * @short_description: a 2-way association between a string and a + * unique integer identifier + * + * Quarks are associations between strings and integer identifiers. + * Given either the string or the #GQuark identifier it is possible to + * retrieve the other. + * + * Quarks are used for both Datasets and Keyed Data Lists. + * + * To create a new quark from a string, use g_quark_from_string() or + * g_quark_from_static_string(). + * + * To find the string corresponding to a given #GQuark, use + * g_quark_to_string(). + * + * To find the #GQuark corresponding to a given string, use + * g_quark_try_string(). + * + * Another use for the string pool maintained for the quark functions + * is string interning, using g_intern_string() or + * g_intern_static_string(). An interned string is a canonical + * representation for a string. One important advantage of interned + * strings is that they can be compared for equality by a simple + * pointer comparison, rather than using strcmp(). + **/ + +/** + * GQuark: + * + * A GQuark is a non-zero integer which uniquely identifies a + * particular string. A GQuark value of zero is associated to %NULL. + **/ + +/** + * g_quark_try_string: + * @string: (allow-none): a string. + * @Returns: the #GQuark associated with the string, or 0 if @string is + * %NULL or there is no #GQuark associated with it. + * + * Gets the #GQuark associated with the given string, or 0 if string is + * %NULL or it has no associated #GQuark. + * + * If you want the GQuark to be created if it doesn't already exist, + * use g_quark_from_string() or g_quark_from_static_string(). + **/ +GQuark +g_quark_try_string (const gchar *string) +{ + GQuark quark = 0; + + if (string == NULL) + return 0; + + G_LOCK (g_quark_global); + if (g_quark_ht) + quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string)); + G_UNLOCK (g_quark_global); + + return quark; +} + +#define QUARK_STRING_BLOCK_SIZE (4096 - sizeof (gsize)) +static char *quark_block = NULL; +static int quark_block_offset = 0; + +/* HOLDS: g_quark_global_lock */ +static char * +quark_strdup(const gchar *string) +{ + gchar *copy; + gsize len; + + len = strlen (string) + 1; + + /* For strings longer than half the block size, fall back + to strdup so that we fill our blocks at least 50%. */ + if (len > QUARK_STRING_BLOCK_SIZE / 2) + return g_strdup (string); + + if (quark_block == NULL || + QUARK_STRING_BLOCK_SIZE - quark_block_offset < len) + { + quark_block = g_malloc (QUARK_STRING_BLOCK_SIZE); + quark_block_offset = 0; + } + + copy = quark_block + quark_block_offset; + memcpy (copy, string, len); + quark_block_offset += len; + + return copy; +} + +/* HOLDS: g_quark_global_lock */ +static inline GQuark +g_quark_from_string_internal (const gchar *string, + gboolean duplicate) +{ + GQuark quark = 0; + + if (g_quark_ht) + quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string)); + + if (!quark) + { + quark = g_quark_new (duplicate ? quark_strdup (string) : (gchar *)string); + TRACE(GLIB_QUARK_NEW(string, quark)); + } + + return quark; +} + +/** + * g_quark_from_string: + * @string: (allow-none): a string. + * @Returns: the #GQuark identifying the string, or 0 if @string is + * %NULL. + * + * Gets the #GQuark identifying the given string. If the string does + * not currently have an associated #GQuark, a new #GQuark is created, + * using a copy of the string. + **/ +GQuark +g_quark_from_string (const gchar *string) +{ + GQuark quark; + + if (!string) + return 0; + + G_LOCK (g_quark_global); + quark = g_quark_from_string_internal (string, TRUE); + G_UNLOCK (g_quark_global); + + return quark; +} + +/** + * g_quark_from_static_string: + * @string: (allow-none): a string. + * @Returns: the #GQuark identifying the string, or 0 if @string is + * %NULL. + * + * Gets the #GQuark identifying the given (static) string. If the + * string does not currently have an associated #GQuark, a new #GQuark + * is created, linked to the given string. + * + * Note that this function is identical to g_quark_from_string() except + * that if a new #GQuark is created the string itself is used rather + * than a copy. This saves memory, but can only be used if the string + * will always exist. It can be used with + * statically allocated strings in the main program, but not with + * statically allocated memory in dynamically loaded modules, if you + * expect to ever unload the module again (e.g. do not use this + * function in GTK+ theme engines). + **/ +GQuark +g_quark_from_static_string (const gchar *string) +{ + GQuark quark; + + if (!string) + return 0; + + G_LOCK (g_quark_global); + quark = g_quark_from_string_internal (string, FALSE); + G_UNLOCK (g_quark_global); + + return quark; +} + +/** + * g_quark_to_string: + * @quark: a #GQuark. + * @Returns: the string associated with the #GQuark. + * + * Gets the string associated with the given #GQuark. + **/ +const gchar * +g_quark_to_string (GQuark quark) +{ + gchar* result = NULL; + gchar **quarks; + gint quark_seq_id; + + quark_seq_id = g_atomic_int_get (&g_quark_seq_id); + quarks = g_atomic_pointer_get (&g_quarks); + + if (quark < quark_seq_id) + result = quarks[quark]; + + return result; +} + +/* HOLDS: g_quark_global_lock */ +static inline GQuark +g_quark_new (gchar *string) +{ + GQuark quark; + gchar **g_quarks_new; + + if (g_quark_seq_id % G_QUARK_BLOCK_SIZE == 0) + { + g_quarks_new = g_new (gchar*, g_quark_seq_id + G_QUARK_BLOCK_SIZE); + if (g_quark_seq_id != 0) + memcpy (g_quarks_new, g_quarks, sizeof (char *) * g_quark_seq_id); + memset (g_quarks_new + g_quark_seq_id, 0, sizeof (char *) * G_QUARK_BLOCK_SIZE); + /* This leaks the old quarks array. Its unfortunate, but it allows + us to do lockless lookup of the arrays, and there shouldn't be that + many quarks in an app */ + g_atomic_pointer_set (&g_quarks, g_quarks_new); + } + if (!g_quark_ht) + { + g_assert (g_quark_seq_id == 0); + g_quark_ht = g_hash_table_new (g_str_hash, g_str_equal); + g_quarks[g_quark_seq_id] = NULL; + g_atomic_int_inc (&g_quark_seq_id); + } + + quark = g_quark_seq_id; + g_atomic_pointer_set (&g_quarks[quark], string); + g_hash_table_insert (g_quark_ht, string, GUINT_TO_POINTER (quark)); + g_atomic_int_inc (&g_quark_seq_id); + + return quark; +} + +/** + * g_intern_string: + * @string: (allow-none): a string + * + * Returns a canonical representation for @string. Interned strings can + * be compared for equality by comparing the pointers, instead of using strcmp(). + * + * Returns: a canonical representation for the string + * + * Since: 2.10 + */ +const gchar * +g_intern_string (const gchar *string) +{ + const gchar *result; + GQuark quark; + + if (!string) + return NULL; + + G_LOCK (g_quark_global); + quark = g_quark_from_string_internal (string, TRUE); + result = g_quarks[quark]; + G_UNLOCK (g_quark_global); + + return result; +} + +/** + * g_intern_static_string: + * @string: (allow-none): a static string + * + * Returns a canonical representation for @string. Interned strings can + * be compared for equality by comparing the pointers, instead of using strcmp(). + * g_intern_static_string() does not copy the string, therefore @string must + * not be freed or modified. + * + * Returns: a canonical representation for the string + * + * Since: 2.10 + */ +const gchar * +g_intern_static_string (const gchar *string) +{ + GQuark quark; + const gchar *result; + + if (!string) + return NULL; + + G_LOCK (g_quark_global); + quark = g_quark_from_string_internal (string, FALSE); + result = g_quarks[quark]; + G_UNLOCK (g_quark_global); + + return result; +} diff --git a/deps/glib/gdataset.h b/deps/glib/gdataset.h new file mode 100644 index 0000000..4451c38 --- /dev/null +++ b/deps/glib/gdataset.h @@ -0,0 +1,122 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_DATASET_H__ +#define __G_DATASET_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GData GData; + +typedef void (*GDataForeachFunc) (GQuark key_id, + gpointer data, + gpointer user_data); + +/* Keyed Data List + */ +void g_datalist_init (GData **datalist); +void g_datalist_clear (GData **datalist); +gpointer g_datalist_id_get_data (GData **datalist, + GQuark key_id); +void g_datalist_id_set_data_full (GData **datalist, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); +gpointer g_datalist_id_remove_no_notify (GData **datalist, + GQuark key_id); +void g_datalist_foreach (GData **datalist, + GDataForeachFunc func, + gpointer user_data); + +/** + * G_DATALIST_FLAGS_MASK: + * + * A bitmask that restricts the possible flags passed to + * g_datalist_set_flags(). Passing a flags value where + * flags & ~G_DATALIST_FLAGS_MASK != 0 is an error. + */ +#define G_DATALIST_FLAGS_MASK 0x3 + +void g_datalist_set_flags (GData **datalist, + guint flags); +void g_datalist_unset_flags (GData **datalist, + guint flags); +guint g_datalist_get_flags (GData **datalist); + +#define g_datalist_id_set_data(dl, q, d) \ + g_datalist_id_set_data_full ((dl), (q), (d), NULL) +#define g_datalist_id_remove_data(dl, q) \ + g_datalist_id_set_data ((dl), (q), NULL) +#define g_datalist_set_data_full(dl, k, d, f) \ + g_datalist_id_set_data_full ((dl), g_quark_from_string (k), (d), (f)) +#define g_datalist_remove_no_notify(dl, k) \ + g_datalist_id_remove_no_notify ((dl), g_quark_try_string (k)) +#define g_datalist_set_data(dl, k, d) \ + g_datalist_set_data_full ((dl), (k), (d), NULL) +#define g_datalist_remove_data(dl, k) \ + g_datalist_id_set_data ((dl), g_quark_try_string (k), NULL) + + +/* Location Associated Keyed Data + */ +void g_dataset_destroy (gconstpointer dataset_location); +gpointer g_dataset_id_get_data (gconstpointer dataset_location, + GQuark key_id); +gpointer g_datalist_get_data (GData **datalist, + const gchar *key); +void g_dataset_id_set_data_full (gconstpointer dataset_location, + GQuark key_id, + gpointer data, + GDestroyNotify destroy_func); +gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location, + GQuark key_id); +void g_dataset_foreach (gconstpointer dataset_location, + GDataForeachFunc func, + gpointer user_data); +#define g_dataset_id_set_data(l, k, d) \ + g_dataset_id_set_data_full ((l), (k), (d), NULL) +#define g_dataset_id_remove_data(l, k) \ + g_dataset_id_set_data ((l), (k), NULL) +#define g_dataset_get_data(l, k) \ + (g_dataset_id_get_data ((l), g_quark_try_string (k))) +#define g_dataset_set_data_full(l, k, d, f) \ + g_dataset_id_set_data_full ((l), g_quark_from_string (k), (d), (f)) +#define g_dataset_remove_no_notify(l, k) \ + g_dataset_id_remove_no_notify ((l), g_quark_try_string (k)) +#define g_dataset_set_data(l, k, d) \ + g_dataset_set_data_full ((l), (k), (d), NULL) +#define g_dataset_remove_data(l, k) \ + g_dataset_id_set_data ((l), g_quark_try_string (k), NULL) + +G_END_DECLS + +#endif /* __G_DATASET_H__ */ diff --git a/deps/glib/gdatasetprivate.h b/deps/glib/gdatasetprivate.h new file mode 100644 index 0000000..80d0ccf --- /dev/null +++ b/deps/glib/gdatasetprivate.h @@ -0,0 +1,44 @@ +/* GLIB - Library of useful routines for C programming + * gdataset-private.h: Internal macros for accessing dataset values + * Copyright (C) 2005 Red Hat + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DATASETPRIVATE_H__ +#define __G_DATASETPRIVATE_H__ + +#include + +G_BEGIN_DECLS + +/* GET_FLAGS is implemented via atomic pointer access, to allow memory + * barriers to take effect without acquiring the global dataset mutex. + */ +#define G_DATALIST_GET_FLAGS(datalist) \ + ((gsize) g_atomic_pointer_get (datalist) & G_DATALIST_FLAGS_MASK) + + +G_END_DECLS + +#endif /* __G_DATASETPRIVATE_H__ */ diff --git a/deps/glib/gdebug.h b/deps/glib/gdebug.h new file mode 100644 index 0000000..dea3dde --- /dev/null +++ b/deps/glib/gdebug.h @@ -0,0 +1,59 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_DEBUG_H__ +#define __G_DEBUG_H__ + +G_BEGIN_DECLS + +typedef enum { + G_DEBUG_FATAL_WARNINGS = 1 << 0, + G_DEBUG_FATAL_CRITICALS = 1 << 1 +} GDebugFlag; + + +#ifdef G_ENABLE_DEBUG + +#define G_NOTE(type, action) G_STMT_START { \ + if (!_g_debug_initialized) \ + { _g_debug_init (); } \ + if (_g_debug_flags & G_DEBUG_##type) \ + { action; }; } G_STMT_END + +#else /* !G_ENABLE_DEBUG */ + +#define G_NOTE(type, action) + +#endif /* G_ENABLE_DEBUG */ + +GLIB_VAR gboolean _g_debug_initialized; +GLIB_VAR guint _g_debug_flags; + +G_GNUC_INTERNAL void _g_debug_init (void); + +G_END_DECLS + +#endif /* __G_DEBUG_H__ */ diff --git a/deps/glib/gerror.c b/deps/glib/gerror.c new file mode 100644 index 0000000..015d709 --- /dev/null +++ b/deps/glib/gerror.c @@ -0,0 +1,711 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/** + * SECTION:error_reporting + * @Title: Error Reporting + * @Short_description: a system for reporting errors + * + * GLib provides a standard method of reporting errors from a called + * function to the calling code. (This is the same problem solved by + * exceptions in other languages.) It's important to understand that + * this method is both a data type (the #GError + * object) and a set of rules. If you use #GError + * incorrectly, then your code will not properly interoperate with other + * code that uses #GError, and users of your API will probably get confused. + * + * First and foremost: #GError should only be used to report + * recoverable runtime errors, never to report programming + * errors. If the programmer has screwed up, then you should + * use g_warning(), g_return_if_fail(), g_assert(), g_error(), or some + * similar facility. (Incidentally, remember that the g_error() function + * should only be used for programming errors, it + * should not be used to print any error reportable via #GError.) + * + * Examples of recoverable runtime errors are "file not found" or + * "failed to parse input." Examples of programming errors are "NULL + * passed to strcmp()" or "attempted to free the same pointer twice." + * These two kinds of errors are fundamentally different: runtime errors + * should be handled or reported to the user, programming errors should + * be eliminated by fixing the bug in the program. This is why most + * functions in GLib and GTK+ do not use the #GError facility. + * + * Functions that can fail take a return location for a #GError as their + * last argument. For example: + * |[ + * gboolean g_file_get_contents (const gchar *filename, + * gchar **contents, + * gsize *length, + * GError **error); + * ]| + * If you pass a non-%NULL value for the error + * argument, it should point to a location where an error can be placed. + * For example: + * |[ + * gchar *contents; + * GError *err = NULL; + * g_file_get_contents ("foo.txt", &contents, NULL, &err); + * g_assert ((contents == NULL && err != NULL) || (contents != NULL && err == NULL)); + * if (err != NULL) + * { + * /* Report error to user, and free error */ + * g_assert (contents == NULL); + * fprintf (stderr, "Unable to read file: %s\n", err->message); + * g_error_free (err); + * } + * else + * { + * /* Use file contents */ + * g_assert (contents != NULL); + * } + * ]| + * Note that err != NULL in this example is a + * reliable indicator of whether + * g_file_get_contents() failed. Additionally, g_file_get_contents() + * returns a boolean which indicates whether it was successful. + * + * Because g_file_get_contents() returns %FALSE on failure, if you + * are only interested in whether it failed and don't need to display + * an error message, you can pass %NULL for the error + * argument: + * |[ + * if (g_file_get_contents ("foo.txt", &contents, NULL, NULL)) /* ignore errors */ + * /* no error occurred */ ; + * else + * /* error */ ; + * ]| + * + * The #GError object contains three fields: domain + * indicates the module the error-reporting function is located in, + * code indicates the specific error that occurred, + * and message is a user-readable error message with + * as many details as possible. Several functions are provided to deal + * with an error received from a called function: g_error_matches() + * returns %TRUE if the error matches a given domain and code, + * g_propagate_error() copies an error into an error location (so the + * calling function will receive it), and g_clear_error() clears an + * error location by freeing the error and resetting the location to + * %NULL. To display an error to the user, simply display + * error->message, perhaps along with additional + * context known only to the calling function (the file being opened, + * or whatever -- though in the g_file_get_contents() case, + * error->message already contains a filename). + * + * When implementing a function that can report errors, the basic + * tool is g_set_error(). Typically, if a fatal error occurs you + * want to g_set_error(), then return immediately. g_set_error() + * does nothing if the error location passed to it is %NULL. + * Here's an example: + * |[ + * gint + * foo_open_file (GError **error) + * { + * gint fd; + * + * fd = open ("file.txt", O_RDONLY); + * + * if (fd < 0) + * { + * g_set_error (error, + * FOO_ERROR, /* error domain */ + * FOO_ERROR_BLAH, /* error code */ + * "Failed to open file: %s", /* error message format string */ + * g_strerror (errno)); + * return -1; + * } + * else + * return fd; + * } + * ]| + * + * Things are somewhat more complicated if you yourself call another + * function that can report a #GError. If the sub-function indicates + * fatal errors in some way other than reporting a #GError, such as + * by returning %TRUE on success, you can simply do the following: + * |[ + * gboolean + * my_function_that_can_fail (GError **err) + * { + * g_return_val_if_fail (err == NULL || *err == NULL, FALSE); + * + * if (!sub_function_that_can_fail (err)) + * { + * /* assert that error was set by the sub-function */ + * g_assert (err == NULL || *err != NULL); + * return FALSE; + * } + * + * /* otherwise continue, no error occurred */ + * g_assert (err == NULL || *err == NULL); + * } + * ]| + * + * If the sub-function does not indicate errors other than by + * reporting a #GError, you need to create a temporary #GError + * since the passed-in one may be %NULL. g_propagate_error() is + * intended for use in this case. + * |[ + * gboolean + * my_function_that_can_fail (GError **err) + * { + * GError *tmp_error; + * + * g_return_val_if_fail (err == NULL || *err == NULL, FALSE); + * + * tmp_error = NULL; + * sub_function_that_can_fail (&tmp_error); + * + * if (tmp_error != NULL) + * { + * /* store tmp_error in err, if err != NULL, + * * otherwise call g_error_free() on tmp_error + * */ + * g_propagate_error (err, tmp_error); + * return FALSE; + * } + * + * /* otherwise continue, no error occurred */ + * } + * ]| + * + * Error pileups are always a bug. For example, this code is incorrect: + * |[ + * gboolean + * my_function_that_can_fail (GError **err) + * { + * GError *tmp_error; + * + * g_return_val_if_fail (err == NULL || *err == NULL, FALSE); + * + * tmp_error = NULL; + * sub_function_that_can_fail (&tmp_error); + * other_function_that_can_fail (&tmp_error); + * + * if (tmp_error != NULL) + * { + * g_propagate_error (err, tmp_error); + * return FALSE; + * } + * } + * ]| + * tmp_error should be checked immediately after + * sub_function_that_can_fail(), and either cleared or propagated + * upward. The rule is: after each error, you must either + * handle the error, or return it to the calling function. + * Note that passing %NULL for the error location is the equivalent + * of handling an error by always doing nothing about it. So the + * following code is fine, assuming errors in sub_function_that_can_fail() + * are not fatal to my_function_that_can_fail(): + * |[ + * gboolean + * my_function_that_can_fail (GError **err) + * { + * GError *tmp_error; + * + * g_return_val_if_fail (err == NULL || *err == NULL, FALSE); + * + * sub_function_that_can_fail (NULL); /* ignore errors */ + * + * tmp_error = NULL; + * other_function_that_can_fail (&tmp_error); + * + * if (tmp_error != NULL) + * { + * g_propagate_error (err, tmp_error); + * return FALSE; + * } + * } + * ]| + * + * Note that passing %NULL for the error location + * ignores errors; it's equivalent to + * try { sub_function_that_can_fail (); } catch (...) {} + * in C++. It does not mean to leave errors + * unhandled; it means to handle them by doing nothing. + * + * Error domains and codes are conventionally named as follows: + * + * + * The error domain is called + * <NAMESPACE>_<MODULE>_ERROR, + * for example %G_SPAWN_ERROR or %G_THREAD_ERROR: + * |[ + * #define G_SPAWN_ERROR g_spawn_error_quark () + * + * GQuark + * g_spawn_error_quark (void) + * { + * return g_quark_from_static_string ("g-spawn-error-quark"); + * } + * ]| + * + * + * The quark function for the error domain is called + * <namespace>_<module>_error_quark, + * for example g_spawn_error_quark() or %g_thread_error_quark(). + * + * + * The error codes are in an enumeration called + * <Namespace><Module>Error; + * for example,#GThreadError or #GSpawnError. + * + * + * Members of the error code enumeration are called + * <NAMESPACE>_<MODULE>_ERROR_<CODE>, + * for example %G_SPAWN_ERROR_FORK or %G_THREAD_ERROR_AGAIN. + * + * + * If there's a "generic" or "unknown" error code for unrecoverable + * errors it doesn't make sense to distinguish with specific codes, + * it should be called <NAMESPACE>_<MODULE>_ERROR_FAILED, + * for example %G_SPAWN_ERROR_FAILED or %G_THREAD_ERROR_FAILED. + * + * + * + * Summary of rules for use of #GError: + * + * + * Do not report programming errors via #GError. + * + * + * The last argument of a function that returns an error should + * be a location where a #GError can be placed (i.e. "#GError** error"). + * If #GError is used with varargs, the #GError** should be the last + * argument before the "...". + * + * + * The caller may pass %NULL for the #GError** if they are not interested + * in details of the exact error that occurred. + * + * + * If %NULL is passed for the #GError** argument, then errors should + * not be returned to the caller, but your function should still + * abort and return if an error occurs. That is, control flow should + * not be affected by whether the caller wants to get a #GError. + * + * + * If a #GError is reported, then your function by definition + * had a fatal failure and did not complete whatever + * it was supposed to do. If the failure was not fatal, + * then you handled it and you should not report it. If it was fatal, + * then you must report it and discontinue whatever you were doing + * immediately. + * + * + * A #GError* must be initialized to %NULL before passing its address + * to a function that can report errors. + * + * + * "Piling up" errors is always a bug. That is, if you assign a + * new #GError to a #GError* that is non-%NULL, thus overwriting + * the previous error, it indicates that you should have aborted + * the operation instead of continuing. If you were able to continue, + * you should have cleared the previous error with g_clear_error(). + * g_set_error() will complain if you pile up errors. + * + * + * By convention, if you return a boolean value indicating success + * then %TRUE means success and %FALSE means failure. If %FALSE is + * returned, the error must be set to a non-%NULL + * value. + * + * + * A %NULL return value is also frequently used to mean that an error + * occurred. You should make clear in your documentation whether %NULL + * is a valid return value in non-error cases; if %NULL is a valid value, + * then users must check whether an error was returned to see if the + * function succeeded. + * + * + * When implementing a function that can report errors, you may want + * to add a check at the top of your function that the error return + * location is either %NULL or contains a %NULL error (e.g. + * g_return_if_fail (error == NULL || *error == NULL);). + * + * + */ + +#include "config.h" + +#include "gerror.h" + +#include "gstrfuncs.h" +#include "gtestutils.h" + +/** + * g_error_new_valist: + * @domain: error domain + * @code: error code + * @format: printf()-style format for error message + * @args: #va_list of parameters for the message format + * + * Creates a new #GError with the given @domain and @code, + * and a message formatted with @format. + * + * Returns: a new #GError + * + * Since: 2.22 + */ +GError* +g_error_new_valist (GQuark domain, + gint code, + const gchar *format, + va_list args) +{ + GError *error; + + error = g_slice_new (GError); + + error->domain = domain; + error->code = code; + error->message = g_strdup_vprintf (format, args); + + return error; +} + +/** + * g_error_new: + * @domain: error domain + * @code: error code + * @format: printf()-style format for error message + * @...: parameters for message format + * + * Creates a new #GError with the given @domain and @code, + * and a message formatted with @format. + * + * Return value: a new #GError + */ +GError* +g_error_new (GQuark domain, + gint code, + const gchar *format, + ...) +{ + GError* error; + va_list args; + + g_return_val_if_fail (format != NULL, NULL); + g_return_val_if_fail (domain != 0, NULL); + + va_start (args, format); + error = g_error_new_valist (domain, code, format, args); + va_end (args); + + return error; +} + +/** + * g_error_new_literal: + * @domain: error domain + * @code: error code + * @message: error message + * + * Creates a new #GError; unlike g_error_new(), @message is + * not a printf()-style format string. Use this function if + * @message contains text you don't have control over, + * that could include printf() escape sequences. + * + * Return value: a new #GError + **/ +GError* +g_error_new_literal (GQuark domain, + gint code, + const gchar *message) +{ + GError* err; + + g_return_val_if_fail (message != NULL, NULL); + g_return_val_if_fail (domain != 0, NULL); + + err = g_slice_new (GError); + + err->domain = domain; + err->code = code; + err->message = g_strdup (message); + + return err; +} + +/** + * g_error_free: + * @error: a #GError + * + * Frees a #GError and associated resources. + */ +void +g_error_free (GError *error) +{ + g_return_if_fail (error != NULL); + + g_free (error->message); + + g_slice_free (GError, error); +} + +/** + * g_error_copy: + * @error: a #GError + * + * Makes a copy of @error. + * + * Return value: a new #GError + */ +GError* +g_error_copy (const GError *error) +{ + GError *copy; + + g_return_val_if_fail (error != NULL, NULL); + + copy = g_slice_new (GError); + + *copy = *error; + + copy->message = g_strdup (error->message); + + return copy; +} + +/** + * g_error_matches: + * @error: a #GError or %NULL + * @domain: an error domain + * @code: an error code + * + * Returns %TRUE if @error matches @domain and @code, %FALSE + * otherwise. In particular, when @error is %NULL, %FALSE will + * be returned. + * + * Return value: whether @error has @domain and @code + */ +gboolean +g_error_matches (const GError *error, + GQuark domain, + gint code) +{ + return error && + error->domain == domain && + error->code == code; +} + +#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \ + "This indicates a bug in someone's code. You must ensure an error is NULL before it's set.\n" \ + "The overwriting error message was: %s" + +/** + * g_set_error: + * @err: a return location for a #GError, or %NULL + * @domain: error domain + * @code: error code + * @format: printf()-style format + * @...: args for @format + * + * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err + * must be %NULL. A new #GError is created and assigned to *@err. + */ +void +g_set_error (GError **err, + GQuark domain, + gint code, + const gchar *format, + ...) +{ + GError *new; + + va_list args; + + if (err == NULL) + return; + + va_start (args, format); + new = g_error_new_valist (domain, code, format, args); + va_end (args); + + if (*err == NULL) + *err = new; + else + g_warning (ERROR_OVERWRITTEN_WARNING, new->message); +} + +/** + * g_set_error_literal: + * @err: a return location for a #GError, or %NULL + * @domain: error domain + * @code: error code + * @message: error message + * + * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err + * must be %NULL. A new #GError is created and assigned to *@err. + * Unlike g_set_error(), @message is not a printf()-style format string. + * Use this function if @message contains text you don't have control over, + * that could include printf() escape sequences. + * + * Since: 2.18 + */ +void +g_set_error_literal (GError **err, + GQuark domain, + gint code, + const gchar *message) +{ + GError *new; + + if (err == NULL) + return; + + new = g_error_new_literal (domain, code, message); + if (*err == NULL) + *err = new; + else + g_warning (ERROR_OVERWRITTEN_WARNING, new->message); +} + +/** + * g_propagate_error: + * @dest: error return location + * @src: error to move into the return location + * + * If @dest is %NULL, free @src; otherwise, moves @src into *@dest. + * The error variable @dest points to must be %NULL. + */ +void +g_propagate_error (GError **dest, + GError *src) +{ + g_return_if_fail (src != NULL); + + if (dest == NULL) + { + if (src) + g_error_free (src); + return; + } + else + { + if (*dest != NULL) + g_warning (ERROR_OVERWRITTEN_WARNING, src->message); + else + *dest = src; + } +} + +/** + * g_clear_error: + * @err: a #GError return location + * + * If @err is %NULL, does nothing. If @err is non-%NULL, + * calls g_error_free() on *@err and sets *@err to %NULL. + */ +void +g_clear_error (GError **err) +{ + if (err && *err) + { + g_error_free (*err); + *err = NULL; + } +} + +static void +g_error_add_prefix (gchar **string, + const gchar *format, + va_list ap) +{ + gchar *oldstring; + gchar *prefix; + + prefix = g_strdup_vprintf (format, ap); + oldstring = *string; + *string = g_strconcat (prefix, oldstring, NULL); + g_free (oldstring); + g_free (prefix); +} + +/** + * g_prefix_error: + * @err: a return location for a #GError, or %NULL + * @format: printf()-style format string + * @...: arguments to @format + * + * Formats a string according to @format and + * prefix it to an existing error message. If + * @err is %NULL (ie: no error variable) then do + * nothing. + * + * If *@err is %NULL (ie: an error variable is + * present but there is no error condition) then + * also do nothing. Whether or not it makes + * sense to take advantage of this feature is up + * to you. + * + * Since: 2.16 + */ +void +g_prefix_error (GError **err, + const gchar *format, + ...) +{ + if (err && *err) + { + va_list ap; + + va_start (ap, format); + g_error_add_prefix (&(*err)->message, format, ap); + va_end (ap); + } +} + +/** + * g_propagate_prefixed_error: + * @dest: error return location + * @src: error to move into the return location + * @format: printf()-style format string + * @...: arguments to @format + * + * If @dest is %NULL, free @src; otherwise, + * moves @src into *@dest. *@dest must be %NULL. + * After the move, add a prefix as with + * g_prefix_error(). + * + * Since: 2.16 + **/ +void +g_propagate_prefixed_error (GError **dest, + GError *src, + const gchar *format, + ...) +{ + g_propagate_error (dest, src); + + if (dest && *dest) + { + va_list ap; + + va_start (ap, format); + g_error_add_prefix (&(*dest)->message, format, ap); + va_end (ap); + } +} diff --git a/deps/glib/gerror.h b/deps/glib/gerror.h new file mode 100644 index 0000000..871f310 --- /dev/null +++ b/deps/glib/gerror.h @@ -0,0 +1,107 @@ +/* gerror.h - Error reporting system + * + * Copyright 2000 Red Hat, Inc. + * + * The Gnome Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Gnome Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_ERROR_H__ +#define __G_ERROR_H__ + +#include + +#include + +G_BEGIN_DECLS + +/** + * GError: + * @domain: error domain, e.g. #G_FILE_ERROR + * @code: error code, e.g. %G_FILE_ERROR_NOENT + * @message: human-readable informative error message + * + * The GError structure contains + * information about an error that has occurred. + */ +typedef struct _GError GError; + +struct _GError +{ + GQuark domain; + gint code; + gchar *message; +}; + +GError* g_error_new (GQuark domain, + gint code, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); + +GError* g_error_new_literal (GQuark domain, + gint code, + const gchar *message); +GError* g_error_new_valist (GQuark domain, + gint code, + const gchar *format, + va_list args); + +void g_error_free (GError *error); +GError* g_error_copy (const GError *error); + +gboolean g_error_matches (const GError *error, + GQuark domain, + gint code); + +/* if (err) *err = g_error_new(domain, code, format, ...), also has + * some sanity checks. + */ +void g_set_error (GError **err, + GQuark domain, + gint code, + const gchar *format, + ...) G_GNUC_PRINTF (4, 5); + +void g_set_error_literal (GError **err, + GQuark domain, + gint code, + const gchar *message); + +/* if (dest) *dest = src; also has some sanity checks. + */ +void g_propagate_error (GError **dest, + GError *src); + +/* if (err && *err) { g_error_free(*err); *err = NULL; } */ +void g_clear_error (GError **err); + +/* if (err) prefix the formatted string to the ->message */ +void g_prefix_error (GError **err, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); + +/* g_propagate_error then g_error_prefix on dest */ +void g_propagate_prefixed_error (GError **dest, + GError *src, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); + +G_END_DECLS + +#endif /* __G_ERROR_H__ */ diff --git a/deps/glib/gfileutils.c b/deps/glib/gfileutils.c new file mode 100644 index 0000000..062c691 --- /dev/null +++ b/deps/glib/gfileutils.c @@ -0,0 +1,2328 @@ +/* gfileutils.c - File utility functions + * + * Copyright 2000 Red Hat, Inc. + * + * GLib is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GLib; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" +#include "glibconfig.h" + +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef G_OS_WIN32 +#include +#include +#endif /* G_OS_WIN32 */ + +#ifndef S_ISLNK +#define S_ISLNK(x) 0 +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#include "gfileutils.h" + +#include "gstdio.h" +#include "glibintl.h" +#include "gconvert.h" +#include "gmain.h" + +#ifdef HAVE_LINUX_MAGIC_H /* for btrfs check */ +#include +#include +#endif + +/** + * g_mkdir_with_parents: + * @pathname: a pathname in the GLib file name encoding + * @mode: permissions to use for newly created directories + * + * Create a directory if it doesn't already exist. Create intermediate + * parent directories as needed, too. + * + * Returns: 0 if the directory already exists, or was successfully + * created. Returns -1 if an error occurred, with errno set. + * + * Since: 2.8 + */ +int +g_mkdir_with_parents (const gchar *pathname, + int mode) +{ + gchar *fn, *p; + + if (pathname == NULL || *pathname == '\0') + { + errno = EINVAL; + return -1; + } + + fn = g_strdup (pathname); + + if (g_path_is_absolute (fn)) + p = (gchar *) g_path_skip_root (fn); + else + p = fn; + + do + { + while (*p && !G_IS_DIR_SEPARATOR (*p)) + p++; + + if (!*p) + p = NULL; + else + *p = '\0'; + + if (!g_file_test (fn, G_FILE_TEST_EXISTS)) + { + if (g_mkdir (fn, mode) == -1 && errno != EEXIST) + { + int errno_save = errno; + g_free (fn); + errno = errno_save; + return -1; + } + } + else if (!g_file_test (fn, G_FILE_TEST_IS_DIR)) + { + g_free (fn); + errno = ENOTDIR; + return -1; + } + if (p) + { + *p++ = G_DIR_SEPARATOR; + while (*p && G_IS_DIR_SEPARATOR (*p)) + p++; + } + } + while (p); + + g_free (fn); + + return 0; +} + +/** + * g_file_test: + * @filename: a filename to test in the GLib file name encoding + * @test: bitfield of #GFileTest flags + * + * Returns %TRUE if any of the tests in the bitfield @test are + * %TRUE. For example, (G_FILE_TEST_EXISTS | + * G_FILE_TEST_IS_DIR) will return %TRUE if the file exists; + * the check whether it's a directory doesn't matter since the existence + * test is %TRUE. With the current set of available tests, there's no point + * passing in more than one test at a time. + * + * Apart from %G_FILE_TEST_IS_SYMLINK all tests follow symbolic links, + * so for a symbolic link to a regular file g_file_test() will return + * %TRUE for both %G_FILE_TEST_IS_SYMLINK and %G_FILE_TEST_IS_REGULAR. + * + * Note, that for a dangling symbolic link g_file_test() will return + * %TRUE for %G_FILE_TEST_IS_SYMLINK and %FALSE for all other flags. + * + * You should never use g_file_test() to test whether it is safe + * to perform an operation, because there is always the possibility + * of the condition changing before you actually perform the operation. + * For example, you might think you could use %G_FILE_TEST_IS_SYMLINK + * to know whether it is safe to write to a file without being + * tricked into writing into a different location. It doesn't work! + * |[ + * /* DON'T DO THIS */ + * if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) + * { + * fd = g_open (filename, O_WRONLY); + * /* write to fd */ + * } + * ]| + * + * Another thing to note is that %G_FILE_TEST_EXISTS and + * %G_FILE_TEST_IS_EXECUTABLE are implemented using the access() + * system call. This usually doesn't matter, but if your program + * is setuid or setgid it means that these tests will give you + * the answer for the real user ID and group ID, rather than the + * effective user ID and group ID. + * + * On Windows, there are no symlinks, so testing for + * %G_FILE_TEST_IS_SYMLINK will always return %FALSE. Testing for + * %G_FILE_TEST_IS_EXECUTABLE will just check that the file exists and + * its name indicates that it is executable, checking for well-known + * extensions and those listed in the %PATHEXT environment variable. + * + * Return value: whether a test was %TRUE + **/ +gboolean +g_file_test (const gchar *filename, + GFileTest test) +{ +#ifdef G_OS_WIN32 +/* stuff missing in std vc6 api */ +# ifndef INVALID_FILE_ATTRIBUTES +# define INVALID_FILE_ATTRIBUTES -1 +# endif +# ifndef FILE_ATTRIBUTE_DEVICE +# define FILE_ATTRIBUTE_DEVICE 64 +# endif + int attributes; + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + + if (wfilename == NULL) + return FALSE; + + attributes = GetFileAttributesW (wfilename); + + g_free (wfilename); + + if (attributes == INVALID_FILE_ATTRIBUTES) + return FALSE; + + if (test & G_FILE_TEST_EXISTS) + return TRUE; + + if (test & G_FILE_TEST_IS_REGULAR) + { + if ((attributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0) + return TRUE; + } + + if (test & G_FILE_TEST_IS_DIR) + { + if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) + return TRUE; + } + + /* "while" so that we can exit this "loop" with a simple "break" */ + while (test & G_FILE_TEST_IS_EXECUTABLE) + { + const gchar *lastdot = strrchr (filename, '.'); + const gchar *pathext = NULL, *p; + int extlen; + + if (lastdot == NULL) + break; + + if (_stricmp (lastdot, ".exe") == 0 || + _stricmp (lastdot, ".cmd") == 0 || + _stricmp (lastdot, ".bat") == 0 || + _stricmp (lastdot, ".com") == 0) + return TRUE; + + /* Check if it is one of the types listed in %PATHEXT% */ + + pathext = g_getenv ("PATHEXT"); + if (pathext == NULL) + break; + + pathext = g_utf8_casefold (pathext, -1); + + lastdot = g_utf8_casefold (lastdot, -1); + extlen = strlen (lastdot); + + p = pathext; + while (TRUE) + { + const gchar *q = strchr (p, ';'); + if (q == NULL) + q = p + strlen (p); + if (extlen == q - p && + memcmp (lastdot, p, extlen) == 0) + { + g_free ((gchar *) pathext); + g_free ((gchar *) lastdot); + return TRUE; + } + if (*q) + p = q + 1; + else + break; + } + + g_free ((gchar *) pathext); + g_free ((gchar *) lastdot); + break; + } + + return FALSE; +#else + if ((test & G_FILE_TEST_EXISTS) && (access (filename, F_OK) == 0)) + return TRUE; + + if ((test & G_FILE_TEST_IS_EXECUTABLE) && (access (filename, X_OK) == 0)) + { + if (getuid () != 0) + return TRUE; + + /* For root, on some POSIX systems, access (filename, X_OK) + * will succeed even if no executable bits are set on the + * file. We fall through to a stat test to avoid that. + */ + } + else + test &= ~G_FILE_TEST_IS_EXECUTABLE; + + if (test & G_FILE_TEST_IS_SYMLINK) + { + struct stat s; + + if ((lstat (filename, &s) == 0) && S_ISLNK (s.st_mode)) + return TRUE; + } + + if (test & (G_FILE_TEST_IS_REGULAR | + G_FILE_TEST_IS_DIR | + G_FILE_TEST_IS_EXECUTABLE)) + { + struct stat s; + + if (stat (filename, &s) == 0) + { + if ((test & G_FILE_TEST_IS_REGULAR) && S_ISREG (s.st_mode)) + return TRUE; + + if ((test & G_FILE_TEST_IS_DIR) && S_ISDIR (s.st_mode)) + return TRUE; + + /* The extra test for root when access (file, X_OK) succeeds. + */ + if ((test & G_FILE_TEST_IS_EXECUTABLE) && + ((s.st_mode & S_IXOTH) || + (s.st_mode & S_IXUSR) || + (s.st_mode & S_IXGRP))) + return TRUE; + } + } + + return FALSE; +#endif +} + +GQuark +g_file_error_quark (void) +{ + return g_quark_from_static_string ("g-file-error-quark"); +} + +/** + * g_file_error_from_errno: + * @err_no: an "errno" value + * + * Gets a #GFileError constant based on the passed-in @errno. + * For example, if you pass in %EEXIST this function returns + * #G_FILE_ERROR_EXIST. Unlike @errno values, you can portably + * assume that all #GFileError values will exist. + * + * Normally a #GFileError value goes into a #GError returned + * from a function that manipulates files. So you would use + * g_file_error_from_errno() when constructing a #GError. + * + * Return value: #GFileError corresponding to the given @errno + **/ +GFileError +g_file_error_from_errno (gint err_no) +{ + switch (err_no) + { +#ifdef EEXIST + case EEXIST: + return G_FILE_ERROR_EXIST; + break; +#endif + +#ifdef EISDIR + case EISDIR: + return G_FILE_ERROR_ISDIR; + break; +#endif + +#ifdef EACCES + case EACCES: + return G_FILE_ERROR_ACCES; + break; +#endif + +#ifdef ENAMETOOLONG + case ENAMETOOLONG: + return G_FILE_ERROR_NAMETOOLONG; + break; +#endif + +#ifdef ENOENT + case ENOENT: + return G_FILE_ERROR_NOENT; + break; +#endif + +#ifdef ENOTDIR + case ENOTDIR: + return G_FILE_ERROR_NOTDIR; + break; +#endif + +#ifdef ENXIO + case ENXIO: + return G_FILE_ERROR_NXIO; + break; +#endif + +#ifdef ENODEV + case ENODEV: + return G_FILE_ERROR_NODEV; + break; +#endif + +#ifdef EROFS + case EROFS: + return G_FILE_ERROR_ROFS; + break; +#endif + +#ifdef ETXTBSY + case ETXTBSY: + return G_FILE_ERROR_TXTBSY; + break; +#endif + +#ifdef EFAULT + case EFAULT: + return G_FILE_ERROR_FAULT; + break; +#endif + +#ifdef ELOOP + case ELOOP: + return G_FILE_ERROR_LOOP; + break; +#endif + +#ifdef ENOSPC + case ENOSPC: + return G_FILE_ERROR_NOSPC; + break; +#endif + +#ifdef ENOMEM + case ENOMEM: + return G_FILE_ERROR_NOMEM; + break; +#endif + +#ifdef EMFILE + case EMFILE: + return G_FILE_ERROR_MFILE; + break; +#endif + +#ifdef ENFILE + case ENFILE: + return G_FILE_ERROR_NFILE; + break; +#endif + +#ifdef EBADF + case EBADF: + return G_FILE_ERROR_BADF; + break; +#endif + +#ifdef EINVAL + case EINVAL: + return G_FILE_ERROR_INVAL; + break; +#endif + +#ifdef EPIPE + case EPIPE: + return G_FILE_ERROR_PIPE; + break; +#endif + +#ifdef EAGAIN + case EAGAIN: + return G_FILE_ERROR_AGAIN; + break; +#endif + +#ifdef EINTR + case EINTR: + return G_FILE_ERROR_INTR; + break; +#endif + +#ifdef EIO + case EIO: + return G_FILE_ERROR_IO; + break; +#endif + +#ifdef EPERM + case EPERM: + return G_FILE_ERROR_PERM; + break; +#endif + +#ifdef ENOSYS + case ENOSYS: + return G_FILE_ERROR_NOSYS; + break; +#endif + + default: + return G_FILE_ERROR_FAILED; + break; + } +} + +static gboolean +get_contents_stdio (const gchar *display_filename, + FILE *f, + gchar **contents, + gsize *length, + GError **error) +{ + gchar buf[4096]; + gsize bytes; + gchar *str = NULL; + gsize total_bytes = 0; + gsize total_allocated = 0; + gchar *tmp; + + g_assert (f != NULL); + + while (!feof (f)) + { + gint save_errno; + + bytes = fread (buf, 1, sizeof (buf), f); + save_errno = errno; + + while ((total_bytes + bytes + 1) > total_allocated) + { + if (str) + total_allocated *= 2; + else + total_allocated = MIN (bytes + 1, sizeof (buf)); + + tmp = g_try_realloc (str, total_allocated); + + if (tmp == NULL) + { + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_NOMEM, + _("Could not allocate %lu bytes to read file \"%s\""), + (gulong) total_allocated, + display_filename); + + goto error; + } + + str = tmp; + } + + if (ferror (f)) + { + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Error reading file '%s': %s"), + display_filename, + g_strerror (save_errno)); + + goto error; + } + + memcpy (str + total_bytes, buf, bytes); + + if (total_bytes + bytes < total_bytes) + { + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_FAILED, + _("File \"%s\" is too large"), + display_filename); + + goto error; + } + + total_bytes += bytes; + } + + fclose (f); + + if (total_allocated == 0) + { + str = g_new (gchar, 1); + total_bytes = 0; + } + + str[total_bytes] = '\0'; + + if (length) + *length = total_bytes; + + *contents = str; + + return TRUE; + + error: + + g_free (str); + fclose (f); + + return FALSE; +} + +#ifndef G_OS_WIN32 + +static gboolean +get_contents_regfile (const gchar *display_filename, + struct stat *stat_buf, + gint fd, + gchar **contents, + gsize *length, + GError **error) +{ + gchar *buf; + gsize bytes_read; + gsize size; + gsize alloc_size; + + size = stat_buf->st_size; + + alloc_size = size + 1; + buf = g_try_malloc (alloc_size); + + if (buf == NULL) + { + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_NOMEM, + _("Could not allocate %lu bytes to read file \"%s\""), + (gulong) alloc_size, + display_filename); + + goto error; + } + + bytes_read = 0; + while (bytes_read < size) + { + gssize rc; + + rc = read (fd, buf + bytes_read, size - bytes_read); + + if (rc < 0) + { + if (errno != EINTR) + { + int save_errno = errno; + + g_free (buf); + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to read from file '%s': %s"), + display_filename, + g_strerror (save_errno)); + + goto error; + } + } + else if (rc == 0) + break; + else + bytes_read += rc; + } + + buf[bytes_read] = '\0'; + + if (length) + *length = bytes_read; + + *contents = buf; + + close (fd); + + return TRUE; + + error: + + close (fd); + + return FALSE; +} + +static gboolean +get_contents_posix (const gchar *filename, + gchar **contents, + gsize *length, + GError **error) +{ + struct stat stat_buf; + gint fd; + gchar *display_filename = g_filename_display_name (filename); + + /* O_BINARY useful on Cygwin */ + fd = open (filename, O_RDONLY|O_BINARY); + + if (fd < 0) + { + int save_errno = errno; + + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to open file '%s': %s"), + display_filename, + g_strerror (save_errno)); + g_free (display_filename); + + return FALSE; + } + + /* I don't think this will ever fail, aside from ENOMEM, but. */ + if (fstat (fd, &stat_buf) < 0) + { + int save_errno = errno; + + close (fd); + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to get attributes of file '%s': fstat() failed: %s"), + display_filename, + g_strerror (save_errno)); + g_free (display_filename); + + return FALSE; + } + + if (stat_buf.st_size > 0 && S_ISREG (stat_buf.st_mode)) + { + gboolean retval = get_contents_regfile (display_filename, + &stat_buf, + fd, + contents, + length, + error); + g_free (display_filename); + + return retval; + } + else + { + FILE *f; + gboolean retval; + + f = fdopen (fd, "r"); + + if (f == NULL) + { + int save_errno = errno; + + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to open file '%s': fdopen() failed: %s"), + display_filename, + g_strerror (save_errno)); + g_free (display_filename); + + return FALSE; + } + + retval = get_contents_stdio (display_filename, f, contents, length, error); + g_free (display_filename); + + return retval; + } +} + +#else /* G_OS_WIN32 */ + +static gboolean +get_contents_win32 (const gchar *filename, + gchar **contents, + gsize *length, + GError **error) +{ + FILE *f; + gboolean retval; + gchar *display_filename = g_filename_display_name (filename); + int save_errno; + + f = g_fopen (filename, "rb"); + save_errno = errno; + + if (f == NULL) + { + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to open file '%s': %s"), + display_filename, + g_strerror (save_errno)); + g_free (display_filename); + + return FALSE; + } + + retval = get_contents_stdio (display_filename, f, contents, length, error); + g_free (display_filename); + + return retval; +} + +#endif + +/** + * g_file_get_contents: + * @filename: (type filename): name of a file to read contents from, in the GLib file name encoding + * @contents: (out) (array length=length) (element-type guint8): location to store an allocated string, use g_free() to free + * the returned string + * @length: (allow-none): location to store length in bytes of the contents, or %NULL + * @error: return location for a #GError, or %NULL + * + * Reads an entire file into allocated memory, with good error + * checking. + * + * If the call was successful, it returns %TRUE and sets @contents to the file + * contents and @length to the length of the file contents in bytes. The string + * stored in @contents will be nul-terminated, so for text files you can pass + * %NULL for the @length argument. If the call was not successful, it returns + * %FALSE and sets @error. The error domain is #G_FILE_ERROR. Possible error + * codes are those in the #GFileError enumeration. In the error case, + * @contents is set to %NULL and @length is set to zero. + * + * Return value: %TRUE on success, %FALSE if an error occurred + **/ +gboolean +g_file_get_contents (const gchar *filename, + gchar **contents, + gsize *length, + GError **error) +{ + g_return_val_if_fail (filename != NULL, FALSE); + g_return_val_if_fail (contents != NULL, FALSE); + + *contents = NULL; + if (length) + *length = 0; + +#ifdef G_OS_WIN32 + return get_contents_win32 (filename, contents, length, error); +#else + return get_contents_posix (filename, contents, length, error); +#endif +} + +static gboolean +rename_file (const char *old_name, + const char *new_name, + GError **err) +{ + errno = 0; + if (g_rename (old_name, new_name) == -1) + { + int save_errno = errno; + gchar *display_old_name = g_filename_display_name (old_name); + gchar *display_new_name = g_filename_display_name (new_name); + + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to rename file '%s' to '%s': g_rename() failed: %s"), + display_old_name, + display_new_name, + g_strerror (save_errno)); + + g_free (display_old_name); + g_free (display_new_name); + + return FALSE; + } + + return TRUE; +} + +static gchar * +write_to_temp_file (const gchar *contents, + gssize length, + const gchar *dest_file, + GError **err) +{ + gchar *tmp_name; + gchar *display_name; + gchar *retval; + FILE *file; + gint fd; + int save_errno; + + retval = NULL; + + tmp_name = g_strdup_printf ("%s.XXXXXX", dest_file); + + errno = 0; + fd = g_mkstemp_full (tmp_name, O_RDWR | O_BINARY, 0666); + save_errno = errno; + + display_name = g_filename_display_name (tmp_name); + + if (fd == -1) + { + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to create file '%s': %s"), + display_name, g_strerror (save_errno)); + + goto out; + } + + errno = 0; + file = fdopen (fd, "wb"); + if (!file) + { + save_errno = errno; + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to open file '%s' for writing: fdopen() failed: %s"), + display_name, + g_strerror (save_errno)); + + close (fd); + g_unlink (tmp_name); + + goto out; + } + + if (length > 0) + { + gsize n_written; + + errno = 0; + + n_written = fwrite (contents, 1, length, file); + + if (n_written < length) + { + save_errno = errno; + + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to write file '%s': fwrite() failed: %s"), + display_name, + g_strerror (save_errno)); + + fclose (file); + g_unlink (tmp_name); + + goto out; + } + } + + errno = 0; + if (fflush (file) != 0) + { + save_errno = errno; + + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to write file '%s': fflush() failed: %s"), + display_name, + g_strerror (save_errno)); + + fclose (file); + g_unlink (tmp_name); + + goto out; + } + +#ifdef BTRFS_SUPER_MAGIC + { + struct statfs buf; + + /* On Linux, on btrfs, skip the fsync since rename-over-existing is + * guaranteed to be atomic and this is the only case in which we + * would fsync() anyway. + */ + + if (fstatfs (fd, &buf) == 0 && buf.f_type == BTRFS_SUPER_MAGIC) + goto no_fsync; + } +#endif + +#ifdef HAVE_FSYNC + { + struct stat statbuf; + + errno = 0; + /* If the final destination exists and is > 0 bytes, we want to sync the + * newly written file to ensure the data is on disk when we rename over + * the destination. Otherwise if we get a system crash we can lose both + * the new and the old file on some filesystems. (I.E. those that don't + * guarantee the data is written to the disk before the metadata.) + */ + if (g_lstat (dest_file, &statbuf) == 0 && + statbuf.st_size > 0 && + fsync (fileno (file)) != 0) + { + save_errno = errno; + + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to write file '%s': fsync() failed: %s"), + display_name, + g_strerror (save_errno)); + + fclose (file); + g_unlink (tmp_name); + + goto out; + } + } +#endif + +#ifdef BTRFS_SUPER_MAGIC + no_fsync: +#endif + + errno = 0; + if (fclose (file) == EOF) + { + save_errno = errno; + + g_set_error (err, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to close file '%s': fclose() failed: %s"), + display_name, + g_strerror (save_errno)); + + fclose (file); + g_unlink (tmp_name); + + goto out; + } + + retval = g_strdup (tmp_name); + + out: + g_free (tmp_name); + g_free (display_name); + + return retval; +} + +/** + * g_file_set_contents: + * @filename: (type filename): name of a file to write @contents to, in the GLib file name + * encoding + * @contents: (array length=length) (element-type guint8): string to write to the file + * @length: length of @contents, or -1 if @contents is a nul-terminated string + * @error: return location for a #GError, or %NULL + * + * Writes all of @contents to a file named @filename, with good error checking. + * If a file called @filename already exists it will be overwritten. + * + * This write is atomic in the sense that it is first written to a temporary + * file which is then renamed to the final name. Notes: + * + * + * On Unix, if @filename already exists hard links to @filename will break. + * Also since the file is recreated, existing permissions, access control + * lists, metadata etc. may be lost. If @filename is a symbolic link, + * the link itself will be replaced, not the linked file. + * + * + * On Windows renaming a file will not remove an existing file with the + * new name, so on Windows there is a race condition between the existing + * file being removed and the temporary file being renamed. + * + * + * On Windows there is no way to remove a file that is open to some + * process, or mapped into memory. Thus, this function will fail if + * @filename already exists and is open. + * + * + * + * If the call was successful, it returns %TRUE. If the call was not successful, + * it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR. + * Possible error codes are those in the #GFileError enumeration. + * + * Note that the name for the temporary file is constructed by appending up + * to 7 characters to @filename. + * + * Return value: %TRUE on success, %FALSE if an error occurred + * + * Since: 2.8 + **/ +gboolean +g_file_set_contents (const gchar *filename, + const gchar *contents, + gssize length, + GError **error) +{ + gchar *tmp_filename; + gboolean retval; + GError *rename_error = NULL; + + g_return_val_if_fail (filename != NULL, FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + g_return_val_if_fail (contents != NULL || length == 0, FALSE); + g_return_val_if_fail (length >= -1, FALSE); + + if (length == -1) + length = strlen (contents); + + tmp_filename = write_to_temp_file (contents, length, filename, error); + + if (!tmp_filename) + { + retval = FALSE; + goto out; + } + + if (!rename_file (tmp_filename, filename, &rename_error)) + { +#ifndef G_OS_WIN32 + + g_unlink (tmp_filename); + g_propagate_error (error, rename_error); + retval = FALSE; + goto out; + +#else /* G_OS_WIN32 */ + + /* Renaming failed, but on Windows this may just mean + * the file already exists. So if the target file + * exists, try deleting it and do the rename again. + */ + if (!g_file_test (filename, G_FILE_TEST_EXISTS)) + { + g_unlink (tmp_filename); + g_propagate_error (error, rename_error); + retval = FALSE; + goto out; + } + + g_error_free (rename_error); + + if (g_unlink (filename) == -1) + { + gchar *display_filename = g_filename_display_name (filename); + + int save_errno = errno; + + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Existing file '%s' could not be removed: g_unlink() failed: %s"), + display_filename, + g_strerror (save_errno)); + + g_free (display_filename); + g_unlink (tmp_filename); + retval = FALSE; + goto out; + } + + if (!rename_file (tmp_filename, filename, error)) + { + g_unlink (tmp_filename); + retval = FALSE; + goto out; + } + +#endif + } + + retval = TRUE; + + out: + g_free (tmp_filename); + return retval; +} + +/* + * get_tmp_file based on the mkstemp implementation from the GNU C library. + * Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc. + */ +typedef gint (*GTmpFileCallback) (gchar *, gint, gint); + +static gint +get_tmp_file (gchar *tmpl, + GTmpFileCallback f, + int flags, + int mode) +{ + char *XXXXXX; + int count, fd; + static const char letters[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + static const int NLETTERS = sizeof (letters) - 1; + glong value; + GTimeVal tv; + static int counter = 0; + + g_return_val_if_fail (tmpl != NULL, -1); + + /* find the last occurrence of "XXXXXX" */ + XXXXXX = g_strrstr (tmpl, "XXXXXX"); + + if (!XXXXXX || strncmp (XXXXXX, "XXXXXX", 6)) + { + errno = EINVAL; + return -1; + } + + /* Get some more or less random data. */ + g_get_current_time (&tv); + value = (tv.tv_usec ^ tv.tv_sec) + counter++; + + for (count = 0; count < 100; value += 7777, ++count) + { + glong v = value; + + /* Fill in the random bits. */ + XXXXXX[0] = letters[v % NLETTERS]; + v /= NLETTERS; + XXXXXX[1] = letters[v % NLETTERS]; + v /= NLETTERS; + XXXXXX[2] = letters[v % NLETTERS]; + v /= NLETTERS; + XXXXXX[3] = letters[v % NLETTERS]; + v /= NLETTERS; + XXXXXX[4] = letters[v % NLETTERS]; + v /= NLETTERS; + XXXXXX[5] = letters[v % NLETTERS]; + + fd = f (tmpl, flags, mode); + + if (fd >= 0) + return fd; + else if (errno != EEXIST) + /* Any other error will apply also to other names we might + * try, and there are 2^32 or so of them, so give up now. + */ + return -1; + } + + /* We got out of the loop because we ran out of combinations to try. */ + errno = EEXIST; + return -1; +} + +gint +wrap_mkdir (gchar *tmpl, + int flags G_GNUC_UNUSED, + int mode) +{ + /* tmpl is in UTF-8 on Windows, thus use g_mkdir() */ + return g_mkdir (tmpl, mode); +} + +/** + * g_mkdtemp_full: + * @tmpl: (type filename): template directory name + * @mode: permissions to create the temporary directory with + * + * Creates a temporary directory. See the mkdtemp() documentation + * on most UNIX-like systems. + * + * The parameter is a string that should follow the rules for + * mkdtemp() templates, i.e. contain the string "XXXXXX". + * g_mkdtemp() is slightly more flexible than mkdtemp() in that the + * sequence does not have to occur at the very end of the template + * and you can pass a @mode. The X string will be modified to form + * the name of a directory that didn't exist. The string should be + * in the GLib file name encoding. Most importantly, on Windows it + * should be in UTF-8. + * + * Return value: A pointer to @tmpl, which has been modified + * to hold the directory name. In case of errors, %NULL is + * returned, and %errno will be set. + * + * Since: 2.26 + */ +gchar * +g_mkdtemp_full (gchar *tmpl, + gint mode) +{ + if (get_tmp_file (tmpl, wrap_mkdir, 0, mode) == -1) + return NULL; + else + return tmpl; +} + +/** + * g_mkdtemp: + * @tmpl: (type filename): template directory name + * + * Creates a temporary directory. See the mkdtemp() documentation + * on most UNIX-like systems. + * + * The parameter is a string that should follow the rules for + * mkdtemp() templates, i.e. contain the string "XXXXXX". + * g_mkdtemp() is slightly more flexible than mkdtemp() in that the + * sequence does not have to occur at the very end of the template + * and you can pass a @mode and additional @flags. The X string will + * be modified to form the name of a directory that didn't exist. + * The string should be in the GLib file name encoding. Most importantly, + * on Windows it should be in UTF-8. + * + * Return value: A pointer to @tmpl, which has been modified + * to hold the directory name. In case of errors, %NULL is + * returned and %errno will be set. + * + * Since: 2.26 + */ +gchar * +g_mkdtemp (gchar *tmpl) +{ + return g_mkdtemp_full (tmpl, 0700); +} + +/** + * g_mkstemp_full: + * @tmpl: (type filename): template filename + * @flags: flags to pass to an open() call in addition to O_EXCL + * and O_CREAT, which are passed automatically + * @mode: permissions to create the temporary file with + * + * Opens a temporary file. See the mkstemp() documentation + * on most UNIX-like systems. + * + * The parameter is a string that should follow the rules for + * mkstemp() templates, i.e. contain the string "XXXXXX". + * g_mkstemp_full() is slightly more flexible than mkstemp() + * in that the sequence does not have to occur at the very end of the + * template and you can pass a @mode and additional @flags. The X + * string will be modified to form the name of a file that didn't exist. + * The string should be in the GLib file name encoding. Most importantly, + * on Windows it should be in UTF-8. + * + * Return value: A file handle (as from open()) to the file + * opened for reading and writing. The file handle should be + * closed with close(). In case of errors, -1 is returned + * and %errno will be set. + * + * Since: 2.22 + */ +gint +g_mkstemp_full (gchar *tmpl, + gint flags, + gint mode) +{ + /* tmpl is in UTF-8 on Windows, thus use g_open() */ + return get_tmp_file (tmpl, (GTmpFileCallback) g_open, + flags | O_CREAT | O_EXCL, mode); +} + +/** + * g_mkstemp: + * @tmpl: (type filename): template filename + * + * Opens a temporary file. See the mkstemp() documentation + * on most UNIX-like systems. + * + * The parameter is a string that should follow the rules for + * mkstemp() templates, i.e. contain the string "XXXXXX". + * g_mkstemp() is slightly more flexible than mkstemp() in that the + * sequence does not have to occur at the very end of the template. + * The X string will be modified to form the name of a file that + * didn't exist. The string should be in the GLib file name encoding. + * Most importantly, on Windows it should be in UTF-8. + * + * Return value: A file handle (as from open()) to the file + * opened for reading and writing. The file is opened in binary + * mode on platforms where there is a difference. The file handle + * should be closed with close(). In case of errors, -1 is + * returned and %errno will be set. + */ +gint +g_mkstemp (gchar *tmpl) +{ + return g_mkstemp_full (tmpl, O_RDWR | O_BINARY, 0600); +} + +static gint +g_get_tmp_name (const gchar *tmpl, + gchar **name_used, + GTmpFileCallback f, + gint flags, + gint mode, + GError **error) +{ + int retval; + const char *tmpdir; + const char *sep; + char *fulltemplate; + const char *slash; + + if (tmpl == NULL) + tmpl = ".XXXXXX"; + + if ((slash = strchr (tmpl, G_DIR_SEPARATOR)) != NULL +#ifdef G_OS_WIN32 + || (strchr (tmpl, '/') != NULL && (slash = "/")) +#endif + ) + { + gchar *display_tmpl = g_filename_display_name (tmpl); + char c[2]; + c[0] = *slash; + c[1] = '\0'; + + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_FAILED, + _("Template '%s' invalid, should not contain a '%s'"), + display_tmpl, c); + g_free (display_tmpl); + + return -1; + } + + if (strstr (tmpl, "XXXXXX") == NULL) + { + gchar *display_tmpl = g_filename_display_name (tmpl); + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_FAILED, + _("Template '%s' doesn't contain XXXXXX"), + display_tmpl); + g_free (display_tmpl); + return -1; + } + + tmpdir = g_get_tmp_dir (); + + if (G_IS_DIR_SEPARATOR (tmpdir [strlen (tmpdir) - 1])) + sep = ""; + else + sep = G_DIR_SEPARATOR_S; + + fulltemplate = g_strconcat (tmpdir, sep, tmpl, NULL); + + retval = get_tmp_file (fulltemplate, f, flags, mode); + if (retval == -1) + { + int save_errno = errno; + gchar *display_fulltemplate = g_filename_display_name (fulltemplate); + + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to create file '%s': %s"), + display_fulltemplate, g_strerror (save_errno)); + g_free (display_fulltemplate); + g_free (fulltemplate); + return -1; + } + + *name_used = fulltemplate; + + return retval; +} + +/** + * g_file_open_tmp: + * @tmpl: (type filename) (allow-none): Template for file name, as in + * g_mkstemp(), basename only, or %NULL for a default template + * @name_used: (out) (type filename): location to store actual name used, + * or %NULL + * @error: return location for a #GError + * + * Opens a file for writing in the preferred directory for temporary + * files (as returned by g_get_tmp_dir()). + * + * @tmpl should be a string in the GLib file name encoding containing + * a sequence of six 'X' characters, as the parameter to g_mkstemp(). + * However, unlike these functions, the template should only be a + * basename, no directory components are allowed. If template is + * %NULL, a default template is used. + * + * Note that in contrast to g_mkstemp() (and mkstemp()) @tmpl is not + * modified, and might thus be a read-only literal string. + * + * Upon success, and if @name_used is non-%NULL, the actual name used + * is returned in @name_used. This string should be freed with g_free() + * when not needed any longer. The returned name is in the GLib file + * name encoding. + * + * Return value: A file handle (as from open()) to the file opened for + * reading and writing. The file is opened in binary mode on platforms + * where there is a difference. The file handle should be closed with + * close(). In case of errors, -1 is returned and @error will be set. + */ +gint +g_file_open_tmp (const gchar *tmpl, + gchar **name_used, + GError **error) +{ + gchar *fulltemplate; + gint result; + + result = g_get_tmp_name (tmpl, &fulltemplate, + (GTmpFileCallback) g_open, + O_CREAT | O_EXCL | O_RDWR | O_BINARY, + 0600, + error); + if (result != -1) + { + if (name_used) + *name_used = fulltemplate; + else + g_free (fulltemplate); + } + + return result; +} + +/** + * g_dir_make_tmp: + * @tmpl: (type filename) (allow-none): Template for directory name, + * as in g_mkdtemp(), basename only, or %NULL for a default template + * @error: return location for a #GError + * + * Creates a subdirectory in the preferred directory for temporary + * files (as returned by g_get_tmp_dir()). + * + * @tmpl should be a string in the GLib file name encoding containing + * a sequence of six 'X' characters, as the parameter to g_mkstemp(). + * However, unlike these functions, the template should only be a + * basename, no directory components are allowed. If template is + * %NULL, a default template is used. + * + * Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not + * modified, and might thus be a read-only literal string. + * + * Return value: (type filename): The actual name used. This string + * should be freed with g_free() when not needed any longer and is + * is in the GLib file name encoding. In case of errors, %NULL is + * returned and @error will be set. + * + * Since: 2.30 + */ +gchar * +g_dir_make_tmp (const gchar *tmpl, + GError **error) +{ + gchar *fulltemplate; + + if (g_get_tmp_name (tmpl, &fulltemplate, wrap_mkdir, 0, 0700, error) == -1) + return NULL; + else + return fulltemplate; +} + +static gchar * +g_build_path_va (const gchar *separator, + const gchar *first_element, + va_list *args, + gchar **str_array) +{ + GString *result; + gint separator_len = strlen (separator); + gboolean is_first = TRUE; + gboolean have_leading = FALSE; + const gchar *single_element = NULL; + const gchar *next_element; + const gchar *last_trailing = NULL; + gint i = 0; + + result = g_string_new (NULL); + + if (str_array) + next_element = str_array[i++]; + else + next_element = first_element; + + while (TRUE) + { + const gchar *element; + const gchar *start; + const gchar *end; + + if (next_element) + { + element = next_element; + if (str_array) + next_element = str_array[i++]; + else + next_element = va_arg (*args, gchar *); + } + else + break; + + /* Ignore empty elements */ + if (!*element) + continue; + + start = element; + + if (separator_len) + { + while (strncmp (start, separator, separator_len) == 0) + start += separator_len; + } + + end = start + strlen (start); + + if (separator_len) + { + while (end >= start + separator_len && + strncmp (end - separator_len, separator, separator_len) == 0) + end -= separator_len; + + last_trailing = end; + while (last_trailing >= element + separator_len && + strncmp (last_trailing - separator_len, separator, separator_len) == 0) + last_trailing -= separator_len; + + if (!have_leading) + { + /* If the leading and trailing separator strings are in the + * same element and overlap, the result is exactly that element + */ + if (last_trailing <= start) + single_element = element; + + g_string_append_len (result, element, start - element); + have_leading = TRUE; + } + else + single_element = NULL; + } + + if (end == start) + continue; + + if (!is_first) + g_string_append (result, separator); + + g_string_append_len (result, start, end - start); + is_first = FALSE; + } + + if (single_element) + { + g_string_free (result, TRUE); + return g_strdup (single_element); + } + else + { + if (last_trailing) + g_string_append (result, last_trailing); + + return g_string_free (result, FALSE); + } +} + +/** + * g_build_pathv: + * @separator: a string used to separator the elements of the path. + * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements. + * + * Behaves exactly like g_build_path(), but takes the path elements + * as a string array, instead of varargs. This function is mainly + * meant for language bindings. + * + * Return value: a newly-allocated string that must be freed with g_free(). + * + * Since: 2.8 + */ +gchar * +g_build_pathv (const gchar *separator, + gchar **args) +{ + if (!args) + return NULL; + + return g_build_path_va (separator, NULL, NULL, args); +} + + +/** + * g_build_path: + * @separator: a string used to separator the elements of the path. + * @first_element: the first element in the path + * @...: remaining elements in path, terminated by %NULL + * + * Creates a path from a series of elements using @separator as the + * separator between elements. At the boundary between two elements, + * any trailing occurrences of separator in the first element, or + * leading occurrences of separator in the second element are removed + * and exactly one copy of the separator is inserted. + * + * Empty elements are ignored. + * + * The number of leading copies of the separator on the result is + * the same as the number of leading copies of the separator on + * the first non-empty element. + * + * The number of trailing copies of the separator on the result is + * the same as the number of trailing copies of the separator on + * the last non-empty element. (Determination of the number of + * trailing copies is done without stripping leading copies, so + * if the separator is ABA, ABABA + * has 1 trailing copy.) + * + * However, if there is only a single non-empty element, and there + * are no characters in that element not part of the leading or + * trailing separators, then the result is exactly the original value + * of that element. + * + * Other than for determination of the number of leading and trailing + * copies of the separator, elements consisting only of copies + * of the separator are ignored. + * + * Return value: a newly-allocated string that must be freed with g_free(). + **/ +gchar * +g_build_path (const gchar *separator, + const gchar *first_element, + ...) +{ + gchar *str; + va_list args; + + g_return_val_if_fail (separator != NULL, NULL); + + va_start (args, first_element); + str = g_build_path_va (separator, first_element, &args, NULL); + va_end (args); + + return str; +} + +#ifdef G_OS_WIN32 + +static gchar * +g_build_pathname_va (const gchar *first_element, + va_list *args, + gchar **str_array) +{ + /* Code copied from g_build_pathv(), and modified to use two + * alternative single-character separators. + */ + GString *result; + gboolean is_first = TRUE; + gboolean have_leading = FALSE; + const gchar *single_element = NULL; + const gchar *next_element; + const gchar *last_trailing = NULL; + gchar current_separator = '\\'; + gint i = 0; + + result = g_string_new (NULL); + + if (str_array) + next_element = str_array[i++]; + else + next_element = first_element; + + while (TRUE) + { + const gchar *element; + const gchar *start; + const gchar *end; + + if (next_element) + { + element = next_element; + if (str_array) + next_element = str_array[i++]; + else + next_element = va_arg (*args, gchar *); + } + else + break; + + /* Ignore empty elements */ + if (!*element) + continue; + + start = element; + + if (TRUE) + { + while (start && + (*start == '\\' || *start == '/')) + { + current_separator = *start; + start++; + } + } + + end = start + strlen (start); + + if (TRUE) + { + while (end >= start + 1 && + (end[-1] == '\\' || end[-1] == '/')) + { + current_separator = end[-1]; + end--; + } + + last_trailing = end; + while (last_trailing >= element + 1 && + (last_trailing[-1] == '\\' || last_trailing[-1] == '/')) + last_trailing--; + + if (!have_leading) + { + /* If the leading and trailing separator strings are in the + * same element and overlap, the result is exactly that element + */ + if (last_trailing <= start) + single_element = element; + + g_string_append_len (result, element, start - element); + have_leading = TRUE; + } + else + single_element = NULL; + } + + if (end == start) + continue; + + if (!is_first) + g_string_append_len (result, ¤t_separator, 1); + + g_string_append_len (result, start, end - start); + is_first = FALSE; + } + + if (single_element) + { + g_string_free (result, TRUE); + return g_strdup (single_element); + } + else + { + if (last_trailing) + g_string_append (result, last_trailing); + + return g_string_free (result, FALSE); + } +} + +#endif + +/** + * g_build_filenamev: + * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements. + * + * Behaves exactly like g_build_filename(), but takes the path elements + * as a string array, instead of varargs. This function is mainly + * meant for language bindings. + * + * Return value: a newly-allocated string that must be freed with g_free(). + * + * Since: 2.8 + */ +gchar * +g_build_filenamev (gchar **args) +{ + gchar *str; + +#ifndef G_OS_WIN32 + str = g_build_path_va (G_DIR_SEPARATOR_S, NULL, NULL, args); +#else + str = g_build_pathname_va (NULL, NULL, args); +#endif + + return str; +} + +/** + * g_build_filename: + * @first_element: the first element in the path + * @...: remaining elements in path, terminated by %NULL + * + * Creates a filename from a series of elements using the correct + * separator for filenames. + * + * On Unix, this function behaves identically to g_build_path + * (G_DIR_SEPARATOR_S, first_element, ....). + * + * On Windows, it takes into account that either the backslash + * (\ or slash (/) can be used + * as separator in filenames, but otherwise behaves as on Unix. When + * file pathname separators need to be inserted, the one that last + * previously occurred in the parameters (reading from left to right) + * is used. + * + * No attempt is made to force the resulting filename to be an absolute + * path. If the first element is a relative path, the result will + * be a relative path. + * + * Return value: a newly-allocated string that must be freed with g_free(). + **/ +gchar * +g_build_filename (const gchar *first_element, + ...) +{ + gchar *str; + va_list args; + + va_start (args, first_element); +#ifndef G_OS_WIN32 + str = g_build_path_va (G_DIR_SEPARATOR_S, first_element, &args, NULL); +#else + str = g_build_pathname_va (first_element, &args, NULL); +#endif + va_end (args); + + return str; +} + +#define KILOBYTE_FACTOR (G_GOFFSET_CONSTANT (1000)) +#define MEGABYTE_FACTOR (KILOBYTE_FACTOR * KILOBYTE_FACTOR) +#define GIGABYTE_FACTOR (MEGABYTE_FACTOR * KILOBYTE_FACTOR) +#define TERABYTE_FACTOR (GIGABYTE_FACTOR * KILOBYTE_FACTOR) +#define PETABYTE_FACTOR (TERABYTE_FACTOR * KILOBYTE_FACTOR) +#define EXABYTE_FACTOR (PETABYTE_FACTOR * KILOBYTE_FACTOR) + +#define KIBIBYTE_FACTOR (G_GOFFSET_CONSTANT (1024)) +#define MEBIBYTE_FACTOR (KIBIBYTE_FACTOR * KIBIBYTE_FACTOR) +#define GIBIBYTE_FACTOR (MEBIBYTE_FACTOR * KIBIBYTE_FACTOR) +#define TEBIBYTE_FACTOR (GIBIBYTE_FACTOR * KIBIBYTE_FACTOR) +#define PEBIBYTE_FACTOR (TEBIBYTE_FACTOR * KIBIBYTE_FACTOR) +#define EXBIBYTE_FACTOR (PEBIBYTE_FACTOR * KIBIBYTE_FACTOR) + +/** + * g_format_size: + * @size: a size in bytes + * + * Formats a size (for example the size of a file) into a human readable + * string. Sizes are rounded to the nearest size prefix (kB, MB, GB) + * and are displayed rounded to the nearest tenth. E.g. the file size + * 3292528 bytes will be converted into the string "3.2 MB". + * + * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes). + * + * This string should be freed with g_free() when not needed any longer. + * + * See g_format_size_full() for more options about how the size might be + * formatted. + * + * Returns: a newly-allocated formatted string containing a human readable + * file size. + * + * Since: 2.30 + **/ +gchar * +g_format_size (guint64 size) +{ + return g_format_size_full (size, G_FORMAT_SIZE_DEFAULT); +} + +/** + * g_format_size_full: + * @size: a size in bytes + * @flags: #GFormatSizeFlags to modify the output + * + * Formats a size. + * + * This function is similar to g_format_size() but allows for flags that + * modify the output. See #GFormatSizeFlags. + * + * Returns: a newly-allocated formatted string containing a human + * readable file size. + * + * Since: 2.30 + **/ +/** + * GFormatSizeFlags: + * @G_FORMAT_SIZE_DEFAULT: behave the same as g_format_size() + * @G_FORMAT_SIZE_LONG_FORMAT: include the exact number of bytes as part + * of the returned string. For example, + * "45.6 kB (45,612 bytes)". + * @G_FORMAT_SIZE_IEC_UNITS: use IEC (base 1024) units with "KiB"-style + * suffixes. IEC units should only be used + * for reporting things with a strong "power + * of 2" basis, like RAM sizes or RAID stripe + * sizes. Network and storage sizes should + * be reported in the normal SI units. + * + * Flags to modify the format of the string returned by + * g_format_size_full(). + **/ +gchar * +g_format_size_full (guint64 size, + GFormatSizeFlags flags) +{ + GString *string; + + string = g_string_new (NULL); + + if (flags & G_FORMAT_SIZE_IEC_UNITS) + { + if (size < KIBIBYTE_FACTOR) + { + g_string_printf (string, + g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes", (guint) size), + (guint) size); + flags &= ~G_FORMAT_SIZE_LONG_FORMAT; + } + + else if (size < MEBIBYTE_FACTOR) + g_string_printf (string, _("%.1f KiB"), (gdouble) size / (gdouble) KIBIBYTE_FACTOR); + + else if (size < GIBIBYTE_FACTOR) + g_string_printf (string, _("%.1f MiB"), (gdouble) size / (gdouble) MEBIBYTE_FACTOR); + + else if (size < TEBIBYTE_FACTOR) + g_string_printf (string, _("%.1f GiB"), (gdouble) size / (gdouble) GIBIBYTE_FACTOR); + + else if (size < PEBIBYTE_FACTOR) + g_string_printf (string, _("%.1f TiB"), (gdouble) size / (gdouble) TEBIBYTE_FACTOR); + + else if (size < EXBIBYTE_FACTOR) + g_string_printf (string, _("%.1f PiB"), (gdouble) size / (gdouble) PEBIBYTE_FACTOR); + + else + g_string_printf (string, _("%.1f EiB"), (gdouble) size / (gdouble) EXBIBYTE_FACTOR); + } + else + { + if (size < KILOBYTE_FACTOR) + { + g_string_printf (string, + g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes", (guint) size), + (guint) size); + flags &= ~G_FORMAT_SIZE_LONG_FORMAT; + } + + else if (size < MEGABYTE_FACTOR) + g_string_printf (string, _("%.1f kB"), (gdouble) size / (gdouble) KILOBYTE_FACTOR); + + else if (size < GIGABYTE_FACTOR) + g_string_printf (string, _("%.1f MB"), (gdouble) size / (gdouble) MEGABYTE_FACTOR); + + else if (size < TERABYTE_FACTOR) + g_string_printf (string, _("%.1f GB"), (gdouble) size / (gdouble) GIGABYTE_FACTOR); + + else if (size < PETABYTE_FACTOR) + g_string_printf (string, _("%.1f TB"), (gdouble) size / (gdouble) TERABYTE_FACTOR); + + else if (size < EXABYTE_FACTOR) + g_string_printf (string, _("%.1f PB"), (gdouble) size / (gdouble) PETABYTE_FACTOR); + + else + g_string_printf (string, _("%.1f EB"), (gdouble) size / (gdouble) EXABYTE_FACTOR); + } + + if (flags & G_FORMAT_SIZE_LONG_FORMAT) + { + /* First problem: we need to use the number of bytes to decide on + * the plural form that is used for display, but the number of + * bytes potentially exceeds the size of a guint (which is what + * ngettext() takes). + * + * From a pragmatic standpoint, it seems that all known languages + * base plural forms on one or both of the following: + * + * - the lowest digits of the number + * + * - if the number if greater than some small value + * + * Here's how we fake it: Draw an arbitrary line at one thousand. + * If the number is below that, then fine. If it is above it, + * then we take the modulus of the number by one thousand (in + * order to keep the lowest digits) and add one thousand to that + * (in order to ensure that 1001 is not treated the same as 1). + */ + guint plural_form = size < 1000 ? size : size % 1000 + 1000; + + /* Second problem: we need to translate the string "%u byte" and + * "%u bytes" for pluralisation, but the correct number format to + * use for a gsize is different depending on which architecture + * we're on. + * + * Solution: format the number separately and use "%s bytes" on + * all platforms. + */ + const gchar *translated_format; + gchar *formatted_number; + + /* Translators: the %s in "%s bytes" will always be replaced by a number. */ + translated_format = g_dngettext(GETTEXT_PACKAGE, "%s byte", "%s bytes", plural_form); + + /* XXX: Windows doesn't support the "'" format modifier, so we + * must not use it there. Instead, just display the number + * without separation. Bug #655336 is open until a solution is + * found. + */ +#ifndef G_OS_WIN32 + formatted_number = g_strdup_printf ("%'"G_GUINT64_FORMAT, size); +#else + formatted_number = g_strdup_printf ("%"G_GUINT64_FORMAT, size); +#endif + + g_string_append (string, " ("); + g_string_append_printf (string, translated_format, formatted_number); + g_free (formatted_number); + g_string_append (string, ")"); + } + + return g_string_free (string, FALSE); +} + +/** + * g_format_size_for_display: + * @size: a size in bytes. + * + * Formats a size (for example the size of a file) into a human readable string. + * Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed + * rounded to the nearest tenth. E.g. the file size 3292528 bytes will be + * converted into the string "3.1 MB". + * + * The prefix units base is 1024 (i.e. 1 KB is 1024 bytes). + * + * This string should be freed with g_free() when not needed any longer. + * + * Returns: a newly-allocated formatted string containing a human readable + * file size. + * + * Deprecated:2.30: This function is broken due to its use of SI + * suffixes to denote IEC units. Use g_format_size() + * instead. + * Since: 2.16 + **/ +char * +g_format_size_for_display (goffset size) +{ + if (size < (goffset) KIBIBYTE_FACTOR) + return g_strdup_printf (g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes",(guint) size), (guint) size); + else + { + gdouble displayed_size; + + if (size < (goffset) MEBIBYTE_FACTOR) + { + displayed_size = (gdouble) size / (gdouble) KIBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f KB"), displayed_size); + } + else if (size < (goffset) GIBIBYTE_FACTOR) + { + displayed_size = (gdouble) size / (gdouble) MEBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f MB"), displayed_size); + } + else if (size < (goffset) TEBIBYTE_FACTOR) + { + displayed_size = (gdouble) size / (gdouble) GIBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f GB"), displayed_size); + } + else if (size < (goffset) PEBIBYTE_FACTOR) + { + displayed_size = (gdouble) size / (gdouble) TEBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f TB"), displayed_size); + } + else if (size < (goffset) EXBIBYTE_FACTOR) + { + displayed_size = (gdouble) size / (gdouble) PEBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f PB"), displayed_size); + } + else + { + displayed_size = (gdouble) size / (gdouble) EXBIBYTE_FACTOR; + return g_strdup_printf (_("%.1f EB"), displayed_size); + } + } +} + + +/** + * g_file_read_link: + * @filename: the symbolic link + * @error: return location for a #GError + * + * Reads the contents of the symbolic link @filename like the POSIX + * readlink() function. The returned string is in the encoding used + * for filenames. Use g_filename_to_utf8() to convert it to UTF-8. + * + * Returns: A newly-allocated string with the contents of the symbolic link, + * or %NULL if an error occurred. + * + * Since: 2.4 + */ +gchar * +g_file_read_link (const gchar *filename, + GError **error) +{ +#ifdef HAVE_READLINK + gchar *buffer; + guint size; + gint read_size; + + size = 256; + buffer = g_malloc (size); + + while (TRUE) + { + read_size = readlink (filename, buffer, size); + if (read_size < 0) { + int save_errno = errno; + gchar *display_filename = g_filename_display_name (filename); + + g_free (buffer); + g_set_error (error, + G_FILE_ERROR, + g_file_error_from_errno (save_errno), + _("Failed to read the symbolic link '%s': %s"), + display_filename, + g_strerror (save_errno)); + g_free (display_filename); + + return NULL; + } + + if (read_size < size) + { + buffer[read_size] = 0; + return buffer; + } + + size *= 2; + buffer = g_realloc (buffer, size); + } +#else + g_set_error_literal (error, + G_FILE_ERROR, + G_FILE_ERROR_INVAL, + _("Symbolic links not supported")); + + return NULL; +#endif +} + +/* NOTE : Keep this part last to ensure nothing in this file uses the + * below binary compatibility versions. + */ +#if defined (G_OS_WIN32) && !defined (_WIN64) + +/* Binary compatibility versions. Will be called by code compiled + * against quite old (pre-2.8, I think) headers only, not from more + * recently compiled code. + */ + +#undef g_file_test + +gboolean +g_file_test (const gchar *filename, + GFileTest test) +{ + gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL); + gboolean retval; + + if (utf8_filename == NULL) + return FALSE; + + retval = g_file_test_utf8 (utf8_filename, test); + + g_free (utf8_filename); + + return retval; +} + +#undef g_file_get_contents + +gboolean +g_file_get_contents (const gchar *filename, + gchar **contents, + gsize *length, + GError **error) +{ + gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error); + gboolean retval; + + if (utf8_filename == NULL) + return FALSE; + + retval = g_file_get_contents_utf8 (utf8_filename, contents, length, error); + + g_free (utf8_filename); + + return retval; +} + +#undef g_mkstemp + +gint +g_mkstemp (gchar *tmpl) +{ + /* This is the backward compatibility system codepage version, + * thus use normal open(). + */ + return get_tmp_file (tmpl, (GTmpFileCallback) open, + O_RDWR | O_CREAT | O_EXCL, 0600); +} + +#undef g_file_open_tmp + +gint +g_file_open_tmp (const gchar *tmpl, + gchar **name_used, + GError **error) +{ + gchar *utf8_tmpl = g_locale_to_utf8 (tmpl, -1, NULL, NULL, error); + gchar *utf8_name_used; + gint retval; + + if (utf8_tmpl == NULL) + return -1; + + retval = g_file_open_tmp_utf8 (utf8_tmpl, &utf8_name_used, error); + + if (retval == -1) + return -1; + + if (name_used) + *name_used = g_locale_from_utf8 (utf8_name_used, -1, NULL, NULL, NULL); + + g_free (utf8_name_used); + + return retval; +} + +#endif diff --git a/deps/glib/gfileutils.h b/deps/glib/gfileutils.h new file mode 100644 index 0000000..4b0c48e --- /dev/null +++ b/deps/glib/gfileutils.h @@ -0,0 +1,150 @@ +/* gfileutils.h - File utility functions + * + * Copyright 2000 Red Hat, Inc. + * + * GLib is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GLib; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_FILEUTILS_H__ +#define __G_FILEUTILS_H__ + +#include + +G_BEGIN_DECLS + +#define G_FILE_ERROR g_file_error_quark () + +typedef enum +{ + G_FILE_ERROR_EXIST, + G_FILE_ERROR_ISDIR, + G_FILE_ERROR_ACCES, + G_FILE_ERROR_NAMETOOLONG, + G_FILE_ERROR_NOENT, + G_FILE_ERROR_NOTDIR, + G_FILE_ERROR_NXIO, + G_FILE_ERROR_NODEV, + G_FILE_ERROR_ROFS, + G_FILE_ERROR_TXTBSY, + G_FILE_ERROR_FAULT, + G_FILE_ERROR_LOOP, + G_FILE_ERROR_NOSPC, + G_FILE_ERROR_NOMEM, + G_FILE_ERROR_MFILE, + G_FILE_ERROR_NFILE, + G_FILE_ERROR_BADF, + G_FILE_ERROR_INVAL, + G_FILE_ERROR_PIPE, + G_FILE_ERROR_AGAIN, + G_FILE_ERROR_INTR, + G_FILE_ERROR_IO, + G_FILE_ERROR_PERM, + G_FILE_ERROR_NOSYS, + G_FILE_ERROR_FAILED +} GFileError; + +/* For backward-compat reasons, these are synced to an old + * anonymous enum in libgnome. But don't use that enum + * in new code. + */ +typedef enum +{ + G_FILE_TEST_IS_REGULAR = 1 << 0, + G_FILE_TEST_IS_SYMLINK = 1 << 1, + G_FILE_TEST_IS_DIR = 1 << 2, + G_FILE_TEST_IS_EXECUTABLE = 1 << 3, + G_FILE_TEST_EXISTS = 1 << 4 +} GFileTest; + +GQuark g_file_error_quark (void); +/* So other code can generate a GFileError */ +GFileError g_file_error_from_errno (gint err_no); + +#ifndef __GTK_DOC_IGNORE__ +#ifdef G_OS_WIN32 +#define g_file_test g_file_test_utf8 +#define g_file_get_contents g_file_get_contents_utf8 +#define g_mkstemp g_mkstemp_utf8 +#define g_file_open_tmp g_file_open_tmp_utf8 +#endif +#endif + +gboolean g_file_test (const gchar *filename, + GFileTest test); +gboolean g_file_get_contents (const gchar *filename, + gchar **contents, + gsize *length, + GError **error); +gboolean g_file_set_contents (const gchar *filename, + const gchar *contents, + gssize length, + GError **error); +gchar *g_file_read_link (const gchar *filename, + GError **error); + +/* Wrapper / workalike for mkdtemp() */ +gchar *g_mkdtemp (gchar *tmpl); +gchar *g_mkdtemp_full (gchar *tmpl, + gint mode); + +/* Wrapper / workalike for mkstemp() */ +gint g_mkstemp (gchar *tmpl); +gint g_mkstemp_full (gchar *tmpl, + gint flags, + gint mode); + +/* Wrappers for g_mkstemp and g_mkdtemp() */ +gint g_file_open_tmp (const gchar *tmpl, + gchar **name_used, + GError **error); +gchar *g_dir_make_tmp (const gchar *tmpl, + GError **error); + +typedef enum +{ + G_FORMAT_SIZE_DEFAULT = 0, + G_FORMAT_SIZE_LONG_FORMAT = 1 << 0, + G_FORMAT_SIZE_IEC_UNITS = 1 << 1 +} GFormatSizeFlags; + +gchar * g_format_size_full (guint64 size, + GFormatSizeFlags flags); +gchar * g_format_size (guint64 size); + +#ifndef G_DISABLE_DEPRECATED +char *g_format_size_for_display (goffset size); +#endif + +gchar *g_build_path (const gchar *separator, + const gchar *first_element, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +gchar *g_build_pathv (const gchar *separator, + gchar **args) G_GNUC_MALLOC; + +gchar *g_build_filename (const gchar *first_element, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC; + +int g_mkdir_with_parents (const gchar *pathname, + int mode); + +G_END_DECLS + +#endif /* __G_FILEUTILS_H__ */ diff --git a/deps/glib/ghash.c b/deps/glib/ghash.c new file mode 100644 index 0000000..02c0d7b --- /dev/null +++ b/deps/glib/ghash.c @@ -0,0 +1,1575 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include /* memset */ + +#include "ghash.h" + +#include "gstrfuncs.h" +#include "gatomic.h" +#include "gtestutils.h" + + +/** + * SECTION:hash_tables + * @title: Hash Tables + * @short_description: associations between keys and values so that + * given a key the value can be found quickly + * + * A #GHashTable provides associations between keys and values which is + * optimized so that given a key, the associated value can be found + * very quickly. + * + * Note that neither keys nor values are copied when inserted into the + * #GHashTable, so they must exist for the lifetime of the #GHashTable. + * This means that the use of static strings is OK, but temporary + * strings (i.e. those created in buffers and those returned by GTK+ + * widgets) should be copied with g_strdup() before being inserted. + * + * If keys or values are dynamically allocated, you must be careful to + * ensure that they are freed when they are removed from the + * #GHashTable, and also when they are overwritten by new insertions + * into the #GHashTable. It is also not advisable to mix static strings + * and dynamically-allocated strings in a #GHashTable, because it then + * becomes difficult to determine whether the string should be freed. + * + * To create a #GHashTable, use g_hash_table_new(). + * + * To insert a key and value into a #GHashTable, use + * g_hash_table_insert(). + * + * To lookup a value corresponding to a given key, use + * g_hash_table_lookup() and g_hash_table_lookup_extended(). + * + * g_hash_table_lookup_extended() can also be used to simply + * check if a key is present in the hash table. + * + * To remove a key and value, use g_hash_table_remove(). + * + * To call a function for each key and value pair use + * g_hash_table_foreach() or use a iterator to iterate over the + * key/value pairs in the hash table, see #GHashTableIter. + * + * To destroy a #GHashTable use g_hash_table_destroy(). + * + * + * Using a GHashTable as a set + * + * A common use-case for hash tables is to store information about + * a set of keys, without associating any particular value with each + * key. GHashTable optimizes one way of doing so: If you store only + * key-value pairs where key == value, then GHashTable does not + * allocate memory to store the values, which can be a considerable + * space saving, if your set is large. + * + * + * GHashTable * + * set_new (GHashFunc hash_func, + * GEqualFunc equal_func, + * GDestroyNotify destroy) + * { + * return g_hash_table_new_full (hash_func, equal_func, destroy, NULL); + * } + * + * void + * set_insert (GHashTable *set, + * gpointer element) + * { + * g_hash_table_insert (set, element, element); + * } + * + * gboolean + * set_contains (GHashTable *set, + * gpointer element) + * { + * return g_hash_table_lookup_extended (set, element, NULL, NULL); + * } + * + * gboolean + * set_remove (GHashTable *set, + * gpointer element) + * { + * return g_hash_table_remove (set, element); + * } + * + * + */ + +/** + * GHashTable: + * + * The #GHashTable struct is an opaque data structure to represent a + * Hash Table. It should only be + * accessed via the following functions. + **/ + +/** + * GHashFunc: + * @key: a key. + * @Returns: the hash value corresponding to the key. + * + * Specifies the type of the hash function which is passed to + * g_hash_table_new() when a #GHashTable is created. + * + * The function is passed a key and should return a #guint hash value. + * The functions g_direct_hash(), g_int_hash() and g_str_hash() provide + * hash functions which can be used when the key is a #gpointer, #gint, + * and #gchar* respectively. + * + * The hash values should be evenly + * distributed over a fairly large range? The modulus is taken with the + * hash table size (a prime number) to find the 'bucket' to place each + * key into. The function should also be very fast, since it is called + * for each key lookup. + **/ + +/** + * GHFunc: + * @key: a key. + * @value: the value corresponding to the key. + * @user_data: user data passed to g_hash_table_foreach(). + * + * Specifies the type of the function passed to g_hash_table_foreach(). + * It is called with each key/value pair, together with the @user_data + * parameter which is passed to g_hash_table_foreach(). + **/ + +/** + * GHRFunc: + * @key: a key. + * @value: the value associated with the key. + * @user_data: user data passed to g_hash_table_remove(). + * @Returns: %TRUE if the key/value pair should be removed from the + * #GHashTable. + * + * Specifies the type of the function passed to + * g_hash_table_foreach_remove(). It is called with each key/value + * pair, together with the @user_data parameter passed to + * g_hash_table_foreach_remove(). It should return %TRUE if the + * key/value pair should be removed from the #GHashTable. + **/ + +/** + * GEqualFunc: + * @a: a value. + * @b: a value to compare with. + * @Returns: %TRUE if @a = @b; %FALSE otherwise. + * + * Specifies the type of a function used to test two values for + * equality. The function should return %TRUE if both values are equal + * and %FALSE otherwise. + **/ + +/** + * GHashTableIter: + * + * A GHashTableIter structure represents an iterator that can be used + * to iterate over the elements of a #GHashTable. GHashTableIter + * structures are typically allocated on the stack and then initialized + * with g_hash_table_iter_init(). + **/ + +#define HASH_TABLE_MIN_SHIFT 3 /* 1 << 3 == 8 buckets */ + +#define UNUSED_HASH_VALUE 0 +#define TOMBSTONE_HASH_VALUE 1 +#define HASH_IS_UNUSED(h_) ((h_) == UNUSED_HASH_VALUE) +#define HASH_IS_TOMBSTONE(h_) ((h_) == TOMBSTONE_HASH_VALUE) +#define HASH_IS_REAL(h_) ((h_) >= 2) + +struct _GHashTable +{ + gint size; + gint mod; + guint mask; + gint nnodes; + gint noccupied; /* nnodes + tombstones */ + + gpointer *keys; + guint *hashes; + gpointer *values; + + GHashFunc hash_func; + GEqualFunc key_equal_func; + gint ref_count; +#ifndef G_DISABLE_ASSERT + /* + * Tracks the structure of the hash table, not its contents: is only + * incremented when a node is added or removed (is not incremented + * when the key or data of a node is modified). + */ + int version; +#endif + GDestroyNotify key_destroy_func; + GDestroyNotify value_destroy_func; +}; + +typedef struct +{ + GHashTable *hash_table; + gpointer dummy1; + gpointer dummy2; + int position; + gboolean dummy3; + int version; +} RealIter; + +/* Each table size has an associated prime modulo (the first prime + * lower than the table size) used to find the initial bucket. Probing + * then works modulo 2^n. The prime modulo is necessary to get a + * good distribution with poor hash functions. */ +static const gint prime_mod [] = +{ + 1, /* For 1 << 0 */ + 2, + 3, + 7, + 13, + 31, + 61, + 127, + 251, + 509, + 1021, + 2039, + 4093, + 8191, + 16381, + 32749, + 65521, /* For 1 << 16 */ + 131071, + 262139, + 524287, + 1048573, + 2097143, + 4194301, + 8388593, + 16777213, + 33554393, + 67108859, + 134217689, + 268435399, + 536870909, + 1073741789, + 2147483647 /* For 1 << 31 */ +}; + +static void +g_hash_table_set_shift (GHashTable *hash_table, gint shift) +{ + gint i; + guint mask = 0; + + hash_table->size = 1 << shift; + hash_table->mod = prime_mod [shift]; + + for (i = 0; i < shift; i++) + { + mask <<= 1; + mask |= 1; + } + + hash_table->mask = mask; +} + +static gint +g_hash_table_find_closest_shift (gint n) +{ + gint i; + + for (i = 0; n; i++) + n >>= 1; + + return i; +} + +static void +g_hash_table_set_shift_from_size (GHashTable *hash_table, gint size) +{ + gint shift; + + shift = g_hash_table_find_closest_shift (size); + shift = MAX (shift, HASH_TABLE_MIN_SHIFT); + + g_hash_table_set_shift (hash_table, shift); +} + +/* + * g_hash_table_lookup_node: + * @hash_table: our #GHashTable + * @key: the key to lookup against + * @hash_return: key hash return location + * Return value: index of the described node + * + * Performs a lookup in the hash table, preserving extra information + * usually needed for insertion. + * + * This function first computes the hash value of the key using the + * user's hash function. + * + * If an entry in the table matching @key is found then this function + * returns the index of that entry in the table, and if not, the + * index of an unused node (empty or tombstone) where the key can be + * inserted. + * + * The computed hash value is returned in the variable pointed to + * by @hash_return. This is to save insertions from having to compute + * the hash record again for the new record. + */ +static inline guint +g_hash_table_lookup_node (GHashTable *hash_table, + gconstpointer key, + guint *hash_return) +{ + guint node_index; + guint node_hash; + guint hash_value; + guint first_tombstone = 0; + gboolean have_tombstone = FALSE; + guint step = 0; + + hash_value = hash_table->hash_func (key); + if (G_UNLIKELY (!HASH_IS_REAL (hash_value))) + hash_value = 2; + + *hash_return = hash_value; + + node_index = hash_value % hash_table->mod; + node_hash = hash_table->hashes[node_index]; + + while (!HASH_IS_UNUSED (node_hash)) + { + /* We first check if our full hash values + * are equal so we can avoid calling the full-blown + * key equality function in most cases. + */ + if (node_hash == hash_value) + { + gpointer node_key = hash_table->keys[node_index]; + + if (hash_table->key_equal_func) + { + if (hash_table->key_equal_func (node_key, key)) + return node_index; + } + else if (node_key == key) + { + return node_index; + } + } + else if (HASH_IS_TOMBSTONE (node_hash) && !have_tombstone) + { + first_tombstone = node_index; + have_tombstone = TRUE; + } + + step++; + node_index += step; + node_index &= hash_table->mask; + node_hash = hash_table->hashes[node_index]; + } + + if (have_tombstone) + return first_tombstone; + + return node_index; +} + +/* + * g_hash_table_remove_node: + * @hash_table: our #GHashTable + * @node: pointer to node to remove + * @notify: %TRUE if the destroy notify handlers are to be called + * + * Removes a node from the hash table and updates the node count. + * The node is replaced by a tombstone. No table resize is performed. + * + * If @notify is %TRUE then the destroy notify functions are called + * for the key and value of the hash node. + */ +static void +g_hash_table_remove_node (GHashTable *hash_table, + int i, + gboolean notify) +{ + gpointer key; + gpointer value; + + key = hash_table->keys[i]; + value = hash_table->values[i]; + + /* Erect tombstone */ + hash_table->hashes[i] = TOMBSTONE_HASH_VALUE; + + /* Be GC friendly */ + hash_table->keys[i] = NULL; + hash_table->values[i] = NULL; + + hash_table->nnodes--; + + if (notify && hash_table->key_destroy_func) + hash_table->key_destroy_func (key); + + if (notify && hash_table->value_destroy_func) + hash_table->value_destroy_func (value); + +} + +/* + * g_hash_table_remove_all_nodes: + * @hash_table: our #GHashTable + * @notify: %TRUE if the destroy notify handlers are to be called + * + * Removes all nodes from the table. Since this may be a precursor to + * freeing the table entirely, no resize is performed. + * + * If @notify is %TRUE then the destroy notify functions are called + * for the key and value of the hash node. + */ +static void +g_hash_table_remove_all_nodes (GHashTable *hash_table, + gboolean notify) +{ + int i; + gpointer key; + gpointer value; + + hash_table->nnodes = 0; + hash_table->noccupied = 0; + + if (!notify || + (hash_table->key_destroy_func == NULL && + hash_table->value_destroy_func == NULL)) + { + memset (hash_table->hashes, 0, hash_table->size * sizeof (guint)); + memset (hash_table->keys, 0, hash_table->size * sizeof (gpointer)); + memset (hash_table->values, 0, hash_table->size * sizeof (gpointer)); + + return; + } + + for (i = 0; i < hash_table->size; i++) + { + if (HASH_IS_REAL (hash_table->hashes[i])) + { + key = hash_table->keys[i]; + value = hash_table->values[i]; + + hash_table->hashes[i] = UNUSED_HASH_VALUE; + hash_table->keys[i] = NULL; + hash_table->values[i] = NULL; + + if (hash_table->key_destroy_func != NULL) + hash_table->key_destroy_func (key); + + if (hash_table->value_destroy_func != NULL) + hash_table->value_destroy_func (value); + } + else if (HASH_IS_TOMBSTONE (hash_table->hashes[i])) + { + hash_table->hashes[i] = UNUSED_HASH_VALUE; + } + } +} + +/* + * g_hash_table_resize: + * @hash_table: our #GHashTable + * + * Resizes the hash table to the optimal size based on the number of + * nodes currently held. If you call this function then a resize will + * occur, even if one does not need to occur. Use + * g_hash_table_maybe_resize() instead. + * + * This function may "resize" the hash table to its current size, with + * the side effect of cleaning up tombstones and otherwise optimizing + * the probe sequences. + */ +static void +g_hash_table_resize (GHashTable *hash_table) +{ + gpointer *new_keys; + gpointer *new_values; + guint *new_hashes; + gint old_size; + gint i; + + old_size = hash_table->size; + g_hash_table_set_shift_from_size (hash_table, hash_table->nnodes * 2); + + new_keys = g_new0 (gpointer, hash_table->size); + if (hash_table->keys == hash_table->values) + new_values = new_keys; + else + new_values = g_new0 (gpointer, hash_table->size); + new_hashes = g_new0 (guint, hash_table->size); + + for (i = 0; i < old_size; i++) + { + guint node_hash = hash_table->hashes[i]; + guint hash_val; + guint step = 0; + + if (!HASH_IS_REAL (node_hash)) + continue; + + hash_val = node_hash % hash_table->mod; + + while (!HASH_IS_UNUSED (new_hashes[hash_val])) + { + step++; + hash_val += step; + hash_val &= hash_table->mask; + } + + new_hashes[hash_val] = hash_table->hashes[i]; + new_keys[hash_val] = hash_table->keys[i]; + new_values[hash_val] = hash_table->values[i]; + } + + if (hash_table->keys != hash_table->values) + g_free (hash_table->values); + + g_free (hash_table->keys); + g_free (hash_table->hashes); + + hash_table->keys = new_keys; + hash_table->values = new_values; + hash_table->hashes = new_hashes; + + hash_table->noccupied = hash_table->nnodes; +} + +/* + * g_hash_table_maybe_resize: + * @hash_table: our #GHashTable + * + * Resizes the hash table, if needed. + * + * Essentially, calls g_hash_table_resize() if the table has strayed + * too far from its ideal size for its number of nodes. + */ +static inline void +g_hash_table_maybe_resize (GHashTable *hash_table) +{ + gint noccupied = hash_table->noccupied; + gint size = hash_table->size; + + if ((size > hash_table->nnodes * 4 && size > 1 << HASH_TABLE_MIN_SHIFT) || + (size <= noccupied + (noccupied / 16))) + g_hash_table_resize (hash_table); +} + +/** + * g_hash_table_new: + * @hash_func: a function to create a hash value from a key. + * Hash values are used to determine where keys are stored within the + * #GHashTable data structure. The g_direct_hash(), g_int_hash(), + * g_int64_hash(), g_double_hash() and g_str_hash() functions are provided + * for some common types of keys. + * If hash_func is %NULL, g_direct_hash() is used. + * @key_equal_func: a function to check two keys for equality. This is + * used when looking up keys in the #GHashTable. The g_direct_equal(), + * g_int_equal(), g_int64_equal(), g_double_equal() and g_str_equal() + * functions are provided for the most common types of keys. + * If @key_equal_func is %NULL, keys are compared directly in a similar + * fashion to g_direct_equal(), but without the overhead of a function call. + * + * Creates a new #GHashTable with a reference count of 1. + * + * Return value: a new #GHashTable. + **/ +GHashTable* +g_hash_table_new (GHashFunc hash_func, + GEqualFunc key_equal_func) +{ + return g_hash_table_new_full (hash_func, key_equal_func, NULL, NULL); +} + + +/** + * g_hash_table_new_full: + * @hash_func: a function to create a hash value from a key. + * @key_equal_func: a function to check two keys for equality. + * @key_destroy_func: a function to free the memory allocated for the key + * used when removing the entry from the #GHashTable or %NULL if you + * don't want to supply such a function. + * @value_destroy_func: a function to free the memory allocated for the + * value used when removing the entry from the #GHashTable or %NULL if + * you don't want to supply such a function. + * + * Creates a new #GHashTable like g_hash_table_new() with a reference count + * of 1 and allows to specify functions to free the memory allocated for the + * key and value that get called when removing the entry from the #GHashTable. + * + * Return value: a new #GHashTable. + **/ +GHashTable* +g_hash_table_new_full (GHashFunc hash_func, + GEqualFunc key_equal_func, + GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func) +{ + GHashTable *hash_table; + + hash_table = g_slice_new (GHashTable); + g_hash_table_set_shift (hash_table, HASH_TABLE_MIN_SHIFT); + hash_table->nnodes = 0; + hash_table->noccupied = 0; + hash_table->hash_func = hash_func ? hash_func : g_direct_hash; + hash_table->key_equal_func = key_equal_func; + hash_table->ref_count = 1; +#ifndef G_DISABLE_ASSERT + hash_table->version = 0; +#endif + hash_table->key_destroy_func = key_destroy_func; + hash_table->value_destroy_func = value_destroy_func; + hash_table->keys = g_new0 (gpointer, hash_table->size); + hash_table->values = hash_table->keys; + hash_table->hashes = g_new0 (guint, hash_table->size); + + return hash_table; +} + +/** + * g_hash_table_iter_init: + * @iter: an uninitialized #GHashTableIter. + * @hash_table: a #GHashTable. + * + * Initializes a key/value pair iterator and associates it with + * @hash_table. Modifying the hash table after calling this function + * invalidates the returned iterator. + * |[ + * GHashTableIter iter; + * gpointer key, value; + * + * g_hash_table_iter_init (&iter, hash_table); + * while (g_hash_table_iter_next (&iter, &key, &value)) + * { + * /* do something with key and value */ + * } + * ]| + * + * Since: 2.16 + **/ +void +g_hash_table_iter_init (GHashTableIter *iter, + GHashTable *hash_table) +{ + RealIter *ri = (RealIter *) iter; + + g_return_if_fail (iter != NULL); + g_return_if_fail (hash_table != NULL); + + ri->hash_table = hash_table; + ri->position = -1; +#ifndef G_DISABLE_ASSERT + ri->version = hash_table->version; +#endif +} + +/** + * g_hash_table_iter_next: + * @iter: an initialized #GHashTableIter. + * @key: a location to store the key, or %NULL. + * @value: a location to store the value, or %NULL. + * + * Advances @iter and retrieves the key and/or value that are now + * pointed to as a result of this advancement. If %FALSE is returned, + * @key and @value are not set, and the iterator becomes invalid. + * + * Return value: %FALSE if the end of the #GHashTable has been reached. + * + * Since: 2.16 + **/ +gboolean +g_hash_table_iter_next (GHashTableIter *iter, + gpointer *key, + gpointer *value) +{ + RealIter *ri = (RealIter *) iter; + gint position; + + g_return_val_if_fail (iter != NULL, FALSE); +#ifndef G_DISABLE_ASSERT + g_return_val_if_fail (ri->version == ri->hash_table->version, FALSE); +#endif + g_return_val_if_fail (ri->position < ri->hash_table->size, FALSE); + + position = ri->position; + + do + { + position++; + if (position >= ri->hash_table->size) + { + ri->position = position; + return FALSE; + } + } + while (!HASH_IS_REAL (ri->hash_table->hashes[position])); + + if (key != NULL) + *key = ri->hash_table->keys[position]; + if (value != NULL) + *value = ri->hash_table->values[position]; + + ri->position = position; + return TRUE; +} + +/** + * g_hash_table_iter_get_hash_table: + * @iter: an initialized #GHashTableIter. + * + * Returns the #GHashTable associated with @iter. + * + * Return value: the #GHashTable associated with @iter. + * + * Since: 2.16 + **/ +GHashTable * +g_hash_table_iter_get_hash_table (GHashTableIter *iter) +{ + g_return_val_if_fail (iter != NULL, NULL); + + return ((RealIter *) iter)->hash_table; +} + +static void +iter_remove_or_steal (RealIter *ri, gboolean notify) +{ + g_return_if_fail (ri != NULL); +#ifndef G_DISABLE_ASSERT + g_return_if_fail (ri->version == ri->hash_table->version); +#endif + g_return_if_fail (ri->position >= 0); + g_return_if_fail (ri->position < ri->hash_table->size); + + g_hash_table_remove_node (ri->hash_table, ri->position, notify); + +#ifndef G_DISABLE_ASSERT + ri->version++; + ri->hash_table->version++; +#endif +} + +/** + * g_hash_table_iter_remove: + * @iter: an initialized #GHashTableIter. + * + * Removes the key/value pair currently pointed to by the iterator + * from its associated #GHashTable. Can only be called after + * g_hash_table_iter_next() returned %TRUE, and cannot be called more + * than once for the same key/value pair. + * + * If the #GHashTable was created using g_hash_table_new_full(), the + * key and value are freed using the supplied destroy functions, otherwise + * you have to make sure that any dynamically allocated values are freed + * yourself. + * + * Since: 2.16 + **/ +void +g_hash_table_iter_remove (GHashTableIter *iter) +{ + iter_remove_or_steal ((RealIter *) iter, TRUE); +} + +/* + * g_hash_table_insert_node: + * @hash_table: our #GHashTable + * @node_index: pointer to node to insert/replace + * @key_hash: key hash + * @key: key to replace with, or %NULL + * @value: value to replace with + * @keep_new_key: whether to replace the key in the node with @key + * @reusing_key: whether @key was taken out of the existing node + * + * Inserts a value at @node_index in the hash table and updates it. + * + * If @key has been taken out of the existing node (ie it is not + * passed in via a g_hash_table_insert/replace) call, then @reusing_key + * should be %TRUE. + */ +static void +g_hash_table_insert_node (GHashTable *hash_table, + guint node_index, + guint key_hash, + gpointer key, + gpointer value, + gboolean keep_new_key, + gboolean reusing_key) +{ + guint old_hash; + gpointer old_key; + gpointer old_value; + + if (G_UNLIKELY (hash_table->keys == hash_table->values && key != value)) + hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size); + + old_hash = hash_table->hashes[node_index]; + old_key = hash_table->keys[node_index]; + old_value = hash_table->values[node_index]; + + if (HASH_IS_REAL (old_hash)) + { + if (keep_new_key) + hash_table->keys[node_index] = key; + hash_table->values[node_index] = value; + } + else + { + hash_table->keys[node_index] = key; + hash_table->values[node_index] = value; + hash_table->hashes[node_index] = key_hash; + + hash_table->nnodes++; + + if (HASH_IS_UNUSED (old_hash)) + { + /* We replaced an empty node, and not a tombstone */ + hash_table->noccupied++; + g_hash_table_maybe_resize (hash_table); + } + +#ifndef G_DISABLE_ASSERT + hash_table->version++; +#endif + } + + if (HASH_IS_REAL (old_hash)) + { + if (hash_table->key_destroy_func && !reusing_key) + hash_table->key_destroy_func (keep_new_key ? old_key : key); + if (hash_table->value_destroy_func) + hash_table->value_destroy_func (old_value); + } +} + +/** + * g_hash_table_iter_replace: + * @iter: an initialized #GHashTableIter. + * @value: the value to replace with + * + * Replaces the value currently pointed to by the iterator + * from its associated #GHashTable. Can only be called after + * g_hash_table_iter_next() returned %TRUE. + * + * If you supplied a @value_destroy_func when creating the #GHashTable, + * the old value is freed using that function. + * + * Since: 2.29.9 + **/ +void +g_hash_table_iter_replace (GHashTableIter *iter, + gpointer value) +{ + RealIter *ri; + guint node_hash; + gpointer key; + + ri = (RealIter *) iter; + + g_return_if_fail (ri != NULL); +#ifndef G_DISABLE_ASSERT + g_return_if_fail (ri->version == ri->hash_table->version); +#endif + g_return_if_fail (ri->position >= 0); + g_return_if_fail (ri->position < ri->hash_table->size); + + node_hash = ri->hash_table->hashes[ri->position]; + key = ri->hash_table->keys[ri->position]; + + g_hash_table_insert_node (ri->hash_table, ri->position, node_hash, key, value, TRUE, TRUE); + +#ifndef G_DISABLE_ASSERT + ri->version++; + ri->hash_table->version++; +#endif +} + +/** + * g_hash_table_iter_steal: + * @iter: an initialized #GHashTableIter. + * + * Removes the key/value pair currently pointed to by the iterator + * from its associated #GHashTable, without calling the key and value + * destroy functions. Can only be called after + * g_hash_table_iter_next() returned %TRUE, and cannot be called more + * than once for the same key/value pair. + * + * Since: 2.16 + **/ +void +g_hash_table_iter_steal (GHashTableIter *iter) +{ + iter_remove_or_steal ((RealIter *) iter, FALSE); +} + + +/** + * g_hash_table_ref: + * @hash_table: a valid #GHashTable. + * + * Atomically increments the reference count of @hash_table by one. + * This function is MT-safe and may be called from any thread. + * + * Return value: the passed in #GHashTable. + * + * Since: 2.10 + **/ +GHashTable* +g_hash_table_ref (GHashTable *hash_table) +{ + g_return_val_if_fail (hash_table != NULL, NULL); + + g_atomic_int_inc (&hash_table->ref_count); + + return hash_table; +} + +/** + * g_hash_table_unref: + * @hash_table: a valid #GHashTable. + * + * Atomically decrements the reference count of @hash_table by one. + * If the reference count drops to 0, all keys and values will be + * destroyed, and all memory allocated by the hash table is released. + * This function is MT-safe and may be called from any thread. + * + * Since: 2.10 + **/ +void +g_hash_table_unref (GHashTable *hash_table) +{ + g_return_if_fail (hash_table != NULL); + + if (g_atomic_int_dec_and_test (&hash_table->ref_count)) + { + g_hash_table_remove_all_nodes (hash_table, TRUE); + if (hash_table->keys != hash_table->values) + g_free (hash_table->values); + g_free (hash_table->keys); + g_free (hash_table->hashes); + g_slice_free (GHashTable, hash_table); + } +} + +/** + * g_hash_table_destroy: + * @hash_table: a #GHashTable. + * + * Destroys all keys and values in the #GHashTable and decrements its + * reference count by 1. If keys and/or values are dynamically allocated, + * you should either free them first or create the #GHashTable with destroy + * notifiers using g_hash_table_new_full(). In the latter case the destroy + * functions you supplied will be called on all keys and values during the + * destruction phase. + **/ +void +g_hash_table_destroy (GHashTable *hash_table) +{ + g_return_if_fail (hash_table != NULL); + + g_hash_table_remove_all (hash_table); + g_hash_table_unref (hash_table); +} + +/** + * g_hash_table_lookup: + * @hash_table: a #GHashTable. + * @key: the key to look up. + * + * Looks up a key in a #GHashTable. Note that this function cannot + * distinguish between a key that is not present and one which is present + * and has the value %NULL. If you need this distinction, use + * g_hash_table_lookup_extended(). + * + * Return value: the associated value, or %NULL if the key is not found. + **/ +gpointer +g_hash_table_lookup (GHashTable *hash_table, + gconstpointer key) +{ + guint node_index; + guint node_hash; + + g_return_val_if_fail (hash_table != NULL, NULL); + + node_index = g_hash_table_lookup_node (hash_table, key, &node_hash); + + return HASH_IS_REAL (hash_table->hashes[node_index]) + ? hash_table->values[node_index] + : NULL; +} + +/** + * g_hash_table_lookup_extended: + * @hash_table: a #GHashTable + * @lookup_key: the key to look up + * @orig_key: return location for the original key, or %NULL + * @value: return location for the value associated with the key, or %NULL + * + * Looks up a key in the #GHashTable, returning the original key and the + * associated value and a #gboolean which is %TRUE if the key was found. This + * is useful if you need to free the memory allocated for the original key, + * for example before calling g_hash_table_remove(). + * + * You can actually pass %NULL for @lookup_key to test + * whether the %NULL key exists, provided the hash and equal functions + * of @hash_table are %NULL-safe. + * + * Return value: %TRUE if the key was found in the #GHashTable. + **/ +gboolean +g_hash_table_lookup_extended (GHashTable *hash_table, + gconstpointer lookup_key, + gpointer *orig_key, + gpointer *value) +{ + guint node_index; + guint node_hash; + + g_return_val_if_fail (hash_table != NULL, FALSE); + + node_index = g_hash_table_lookup_node (hash_table, lookup_key, &node_hash); + + if (!HASH_IS_REAL (hash_table->hashes[node_index])) + return FALSE; + + if (orig_key) + *orig_key = hash_table->keys[node_index]; + + if (value) + *value = hash_table->values[node_index]; + + return TRUE; +} + +/* + * g_hash_table_insert_internal: + * @hash_table: our #GHashTable + * @key: the key to insert + * @value: the value to insert + * @keep_new_key: if %TRUE and this key already exists in the table + * then call the destroy notify function on the old key. If %FALSE + * then call the destroy notify function on the new key. + * + * Implements the common logic for the g_hash_table_insert() and + * g_hash_table_replace() functions. + * + * Do a lookup of @key. If it is found, replace it with the new + * @value (and perhaps the new @key). If it is not found, create a + * new node. + */ +static void +g_hash_table_insert_internal (GHashTable *hash_table, + gpointer key, + gpointer value, + gboolean keep_new_key) +{ + guint key_hash; + guint node_index; + + g_return_if_fail (hash_table != NULL); + + node_index = g_hash_table_lookup_node (hash_table, key, &key_hash); + + g_hash_table_insert_node (hash_table, node_index, key_hash, key, value, keep_new_key, FALSE); +} + +/** + * g_hash_table_insert: + * @hash_table: a #GHashTable. + * @key: a key to insert. + * @value: the value to associate with the key. + * + * Inserts a new key and value into a #GHashTable. + * + * If the key already exists in the #GHashTable its current value is replaced + * with the new value. If you supplied a @value_destroy_func when creating the + * #GHashTable, the old value is freed using that function. If you supplied + * a @key_destroy_func when creating the #GHashTable, the passed key is freed + * using that function. + **/ +void +g_hash_table_insert (GHashTable *hash_table, + gpointer key, + gpointer value) +{ + g_hash_table_insert_internal (hash_table, key, value, FALSE); +} + +/** + * g_hash_table_replace: + * @hash_table: a #GHashTable. + * @key: a key to insert. + * @value: the value to associate with the key. + * + * Inserts a new key and value into a #GHashTable similar to + * g_hash_table_insert(). The difference is that if the key already exists + * in the #GHashTable, it gets replaced by the new key. If you supplied a + * @value_destroy_func when creating the #GHashTable, the old value is freed + * using that function. If you supplied a @key_destroy_func when creating the + * #GHashTable, the old key is freed using that function. + **/ +void +g_hash_table_replace (GHashTable *hash_table, + gpointer key, + gpointer value) +{ + g_hash_table_insert_internal (hash_table, key, value, TRUE); +} + +/* + * g_hash_table_remove_internal: + * @hash_table: our #GHashTable + * @key: the key to remove + * @notify: %TRUE if the destroy notify handlers are to be called + * Return value: %TRUE if a node was found and removed, else %FALSE + * + * Implements the common logic for the g_hash_table_remove() and + * g_hash_table_steal() functions. + * + * Do a lookup of @key and remove it if it is found, calling the + * destroy notify handlers only if @notify is %TRUE. + */ +static gboolean +g_hash_table_remove_internal (GHashTable *hash_table, + gconstpointer key, + gboolean notify) +{ + guint node_index; + guint node_hash; + + g_return_val_if_fail (hash_table != NULL, FALSE); + + node_index = g_hash_table_lookup_node (hash_table, key, &node_hash); + + if (!HASH_IS_REAL (hash_table->hashes[node_index])) + return FALSE; + + g_hash_table_remove_node (hash_table, node_index, notify); + g_hash_table_maybe_resize (hash_table); + +#ifndef G_DISABLE_ASSERT + hash_table->version++; +#endif + + return TRUE; +} + +/** + * g_hash_table_remove: + * @hash_table: a #GHashTable. + * @key: the key to remove. + * + * Removes a key and its associated value from a #GHashTable. + * + * If the #GHashTable was created using g_hash_table_new_full(), the + * key and value are freed using the supplied destroy functions, otherwise + * you have to make sure that any dynamically allocated values are freed + * yourself. + * + * Return value: %TRUE if the key was found and removed from the #GHashTable. + **/ +gboolean +g_hash_table_remove (GHashTable *hash_table, + gconstpointer key) +{ + return g_hash_table_remove_internal (hash_table, key, TRUE); +} + +/** + * g_hash_table_steal: + * @hash_table: a #GHashTable. + * @key: the key to remove. + * + * Removes a key and its associated value from a #GHashTable without + * calling the key and value destroy functions. + * + * Return value: %TRUE if the key was found and removed from the #GHashTable. + **/ +gboolean +g_hash_table_steal (GHashTable *hash_table, + gconstpointer key) +{ + return g_hash_table_remove_internal (hash_table, key, FALSE); +} + +/** + * g_hash_table_remove_all: + * @hash_table: a #GHashTable + * + * Removes all keys and their associated values from a #GHashTable. + * + * If the #GHashTable was created using g_hash_table_new_full(), the keys + * and values are freed using the supplied destroy functions, otherwise you + * have to make sure that any dynamically allocated values are freed + * yourself. + * + * Since: 2.12 + **/ +void +g_hash_table_remove_all (GHashTable *hash_table) +{ + g_return_if_fail (hash_table != NULL); + +#ifndef G_DISABLE_ASSERT + if (hash_table->nnodes != 0) + hash_table->version++; +#endif + + g_hash_table_remove_all_nodes (hash_table, TRUE); + g_hash_table_maybe_resize (hash_table); +} + +/** + * g_hash_table_steal_all: + * @hash_table: a #GHashTable. + * + * Removes all keys and their associated values from a #GHashTable + * without calling the key and value destroy functions. + * + * Since: 2.12 + **/ +void +g_hash_table_steal_all (GHashTable *hash_table) +{ + g_return_if_fail (hash_table != NULL); + +#ifndef G_DISABLE_ASSERT + if (hash_table->nnodes != 0) + hash_table->version++; +#endif + + g_hash_table_remove_all_nodes (hash_table, FALSE); + g_hash_table_maybe_resize (hash_table); +} + +/* + * g_hash_table_foreach_remove_or_steal: + * @hash_table: our #GHashTable + * @func: the user's callback function + * @user_data: data for @func + * @notify: %TRUE if the destroy notify handlers are to be called + * + * Implements the common logic for g_hash_table_foreach_remove() and + * g_hash_table_foreach_steal(). + * + * Iterates over every node in the table, calling @func with the key + * and value of the node (and @user_data). If @func returns %TRUE the + * node is removed from the table. + * + * If @notify is true then the destroy notify handlers will be called + * for each removed node. + */ +static guint +g_hash_table_foreach_remove_or_steal (GHashTable *hash_table, + GHRFunc func, + gpointer user_data, + gboolean notify) +{ + guint deleted = 0; + gint i; +#ifndef G_DISABLE_ASSERT + gint version = hash_table->version; +#endif + + for (i = 0; i < hash_table->size; i++) + { + guint node_hash = hash_table->hashes[i]; + gpointer node_key = hash_table->keys[i]; + gpointer node_value = hash_table->values[i]; + + if (HASH_IS_REAL (node_hash) && + (* func) (node_key, node_value, user_data)) + { + g_hash_table_remove_node (hash_table, i, notify); + deleted++; + } + +#ifndef G_DISABLE_ASSERT + g_return_val_if_fail (version == hash_table->version, 0); +#endif + } + + g_hash_table_maybe_resize (hash_table); + +#ifndef G_DISABLE_ASSERT + if (deleted > 0) + hash_table->version++; +#endif + + return deleted; +} + +/** + * g_hash_table_foreach_remove: + * @hash_table: a #GHashTable. + * @func: the function to call for each key/value pair. + * @user_data: user data to pass to the function. + * + * Calls the given function for each key/value pair in the #GHashTable. + * If the function returns %TRUE, then the key/value pair is removed from the + * #GHashTable. If you supplied key or value destroy functions when creating + * the #GHashTable, they are used to free the memory allocated for the removed + * keys and values. + * + * See #GHashTableIter for an alternative way to loop over the + * key/value pairs in the hash table. + * + * Return value: the number of key/value pairs removed. + **/ +guint +g_hash_table_foreach_remove (GHashTable *hash_table, + GHRFunc func, + gpointer user_data) +{ + g_return_val_if_fail (hash_table != NULL, 0); + g_return_val_if_fail (func != NULL, 0); + + return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, TRUE); +} + +/** + * g_hash_table_foreach_steal: + * @hash_table: a #GHashTable. + * @func: the function to call for each key/value pair. + * @user_data: user data to pass to the function. + * + * Calls the given function for each key/value pair in the #GHashTable. + * If the function returns %TRUE, then the key/value pair is removed from the + * #GHashTable, but no key or value destroy functions are called. + * + * See #GHashTableIter for an alternative way to loop over the + * key/value pairs in the hash table. + * + * Return value: the number of key/value pairs removed. + **/ +guint +g_hash_table_foreach_steal (GHashTable *hash_table, + GHRFunc func, + gpointer user_data) +{ + g_return_val_if_fail (hash_table != NULL, 0); + g_return_val_if_fail (func != NULL, 0); + + return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, FALSE); +} + +/** + * g_hash_table_foreach: + * @hash_table: a #GHashTable. + * @func: the function to call for each key/value pair. + * @user_data: user data to pass to the function. + * + * Calls the given function for each of the key/value pairs in the + * #GHashTable. The function is passed the key and value of each + * pair, and the given @user_data parameter. The hash table may not + * be modified while iterating over it (you can't add/remove + * items). To remove all items matching a predicate, use + * g_hash_table_foreach_remove(). + * + * See g_hash_table_find() for performance caveats for linear + * order searches in contrast to g_hash_table_lookup(). + **/ +void +g_hash_table_foreach (GHashTable *hash_table, + GHFunc func, + gpointer user_data) +{ + gint i; +#ifndef G_DISABLE_ASSERT + gint version = hash_table->version; +#endif + + g_return_if_fail (hash_table != NULL); + g_return_if_fail (func != NULL); + + for (i = 0; i < hash_table->size; i++) + { + guint node_hash = hash_table->hashes[i]; + gpointer node_key = hash_table->keys[i]; + gpointer node_value = hash_table->values[i]; + + if (HASH_IS_REAL (node_hash)) + (* func) (node_key, node_value, user_data); + +#ifndef G_DISABLE_ASSERT + g_return_if_fail (version == hash_table->version); +#endif + } +} + +/** + * g_hash_table_find: + * @hash_table: a #GHashTable. + * @predicate: function to test the key/value pairs for a certain property. + * @user_data: user data to pass to the function. + * + * Calls the given function for key/value pairs in the #GHashTable until + * @predicate returns %TRUE. The function is passed the key and value of + * each pair, and the given @user_data parameter. The hash table may not + * be modified while iterating over it (you can't add/remove items). + * + * Note, that hash tables are really only optimized for forward lookups, + * i.e. g_hash_table_lookup(). + * So code that frequently issues g_hash_table_find() or + * g_hash_table_foreach() (e.g. in the order of once per every entry in a + * hash table) should probably be reworked to use additional or different + * data structures for reverse lookups (keep in mind that an O(n) find/foreach + * operation issued for all n values in a hash table ends up needing O(n*n) + * operations). + * + * Return value: The value of the first key/value pair is returned, + * for which @predicate evaluates to %TRUE. If no pair with the + * requested property is found, %NULL is returned. + * + * Since: 2.4 + **/ +gpointer +g_hash_table_find (GHashTable *hash_table, + GHRFunc predicate, + gpointer user_data) +{ + gint i; +#ifndef G_DISABLE_ASSERT + gint version = hash_table->version; +#endif + gboolean match; + + g_return_val_if_fail (hash_table != NULL, NULL); + g_return_val_if_fail (predicate != NULL, NULL); + + match = FALSE; + + for (i = 0; i < hash_table->size; i++) + { + guint node_hash = hash_table->hashes[i]; + gpointer node_key = hash_table->keys[i]; + gpointer node_value = hash_table->values[i]; + + if (HASH_IS_REAL (node_hash)) + match = predicate (node_key, node_value, user_data); + +#ifndef G_DISABLE_ASSERT + g_return_val_if_fail (version == hash_table->version, NULL); +#endif + + if (match) + return node_value; + } + + return NULL; +} + +/** + * g_hash_table_size: + * @hash_table: a #GHashTable. + * + * Returns the number of elements contained in the #GHashTable. + * + * Return value: the number of key/value pairs in the #GHashTable. + **/ +guint +g_hash_table_size (GHashTable *hash_table) +{ + g_return_val_if_fail (hash_table != NULL, 0); + + return hash_table->nnodes; +} + +/** + * g_hash_table_get_keys: + * @hash_table: a #GHashTable + * + * Retrieves every key inside @hash_table. The returned data is valid + * until @hash_table is modified. + * + * Return value: a #GList containing all the keys inside the hash + * table. The content of the list is owned by the hash table and + * should not be modified or freed. Use g_list_free() when done + * using the list. + * + * Since: 2.14 + */ +GList * +g_hash_table_get_keys (GHashTable *hash_table) +{ + gint i; + GList *retval; + + g_return_val_if_fail (hash_table != NULL, NULL); + + retval = NULL; + for (i = 0; i < hash_table->size; i++) + { + if (HASH_IS_REAL (hash_table->hashes[i])) + retval = g_list_prepend (retval, hash_table->keys[i]); + } + + return retval; +} + +/** + * g_hash_table_get_values: + * @hash_table: a #GHashTable + * + * Retrieves every value inside @hash_table. The returned data is + * valid until @hash_table is modified. + * + * Return value: a #GList containing all the values inside the hash + * table. The content of the list is owned by the hash table and + * should not be modified or freed. Use g_list_free() when done + * using the list. + * + * Since: 2.14 + */ +GList * +g_hash_table_get_values (GHashTable *hash_table) +{ + gint i; + GList *retval; + + g_return_val_if_fail (hash_table != NULL, NULL); + + retval = NULL; + for (i = 0; i < hash_table->size; i++) + { + if (HASH_IS_REAL (hash_table->hashes[i])) + retval = g_list_prepend (retval, hash_table->values[i]); + } + + return retval; +} diff --git a/deps/glib/ghash.h b/deps/glib/ghash.h new file mode 100644 index 0000000..3bc8226 --- /dev/null +++ b/deps/glib/ghash.h @@ -0,0 +1,168 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_HASH_H__ +#define __G_HASH_H__ + +#include +#include + +G_BEGIN_DECLS + +typedef struct _GHashTable GHashTable; + +typedef gboolean (*GHRFunc) (gpointer key, + gpointer value, + gpointer user_data); + +typedef struct _GHashTableIter GHashTableIter; + +struct _GHashTableIter +{ + /*< private >*/ + gpointer dummy1; + gpointer dummy2; + gpointer dummy3; + int dummy4; + gboolean dummy5; + gpointer dummy6; +}; + +/* Hash tables + */ +GHashTable* g_hash_table_new (GHashFunc hash_func, + GEqualFunc key_equal_func); +GHashTable* g_hash_table_new_full (GHashFunc hash_func, + GEqualFunc key_equal_func, + GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func); +void g_hash_table_destroy (GHashTable *hash_table); +void g_hash_table_insert (GHashTable *hash_table, + gpointer key, + gpointer value); +void g_hash_table_replace (GHashTable *hash_table, + gpointer key, + gpointer value); +gboolean g_hash_table_remove (GHashTable *hash_table, + gconstpointer key); +void g_hash_table_remove_all (GHashTable *hash_table); +gboolean g_hash_table_steal (GHashTable *hash_table, + gconstpointer key); +void g_hash_table_steal_all (GHashTable *hash_table); +gpointer g_hash_table_lookup (GHashTable *hash_table, + gconstpointer key); +gboolean g_hash_table_lookup_extended (GHashTable *hash_table, + gconstpointer lookup_key, + gpointer *orig_key, + gpointer *value); +void g_hash_table_foreach (GHashTable *hash_table, + GHFunc func, + gpointer user_data); +gpointer g_hash_table_find (GHashTable *hash_table, + GHRFunc predicate, + gpointer user_data); +guint g_hash_table_foreach_remove (GHashTable *hash_table, + GHRFunc func, + gpointer user_data); +guint g_hash_table_foreach_steal (GHashTable *hash_table, + GHRFunc func, + gpointer user_data); +guint g_hash_table_size (GHashTable *hash_table); +GList * g_hash_table_get_keys (GHashTable *hash_table); +GList * g_hash_table_get_values (GHashTable *hash_table); + +void g_hash_table_iter_init (GHashTableIter *iter, + GHashTable *hash_table); +gboolean g_hash_table_iter_next (GHashTableIter *iter, + gpointer *key, + gpointer *value); +GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter); +void g_hash_table_iter_remove (GHashTableIter *iter); +void g_hash_table_iter_replace (GHashTableIter *iter, + gpointer value); +void g_hash_table_iter_steal (GHashTableIter *iter); + +/* keeping hash tables alive */ +GHashTable* g_hash_table_ref (GHashTable *hash_table); +void g_hash_table_unref (GHashTable *hash_table); + +#ifndef G_DISABLE_DEPRECATED + +/** + * g_hash_table_freeze: + * @hash_table: a #GHashTable + * + * This function is deprecated and will be removed in the next major + * release of GLib. It does nothing. + **/ +#define g_hash_table_freeze(hash_table) ((void)0) + +/** + * g_hash_table_thaw: + * @hash_table: a #GHashTable + * + * This function is deprecated and will be removed in the next major + * release of GLib. It does nothing. + **/ +#define g_hash_table_thaw(hash_table) ((void)0) + +#endif /* G_DISABLE_DEPRECATED */ + +/* Hash Functions + */ +gboolean g_str_equal (gconstpointer v1, + gconstpointer v2); +guint g_str_hash (gconstpointer v); + +gboolean g_int_equal (gconstpointer v1, + gconstpointer v2); +guint g_int_hash (gconstpointer v); + +gboolean g_int64_equal (gconstpointer v1, + gconstpointer v2); +guint g_int64_hash (gconstpointer v); + +gboolean g_double_equal (gconstpointer v1, + gconstpointer v2); +guint g_double_hash (gconstpointer v); + +/* This "hash" function will just return the key's address as an + * unsigned integer. Useful for hashing on plain addresses or + * simple integer values. + * Passing NULL into g_hash_table_new() as GHashFunc has the + * same effect as passing g_direct_hash(). + */ +guint g_direct_hash (gconstpointer v) G_GNUC_CONST; +gboolean g_direct_equal (gconstpointer v1, + gconstpointer v2) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_HASH_H__ */ diff --git a/deps/glib/ghook.c b/deps/glib/ghook.c new file mode 100644 index 0000000..1406b58 --- /dev/null +++ b/deps/glib/ghook.c @@ -0,0 +1,636 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * GHook: Callback maintenance functions + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include "ghook.h" + +#include "gtestutils.h" + + +/* --- functions --- */ +static void +default_finalize_hook (GHookList *hook_list, + GHook *hook) +{ + GDestroyNotify destroy = hook->destroy; + + if (destroy) + { + hook->destroy = NULL; + destroy (hook->data); + } +} + +void +g_hook_list_init (GHookList *hook_list, + guint hook_size) +{ + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_size >= sizeof (GHook)); + + hook_list->seq_id = 1; + hook_list->hook_size = hook_size; + hook_list->is_setup = TRUE; + hook_list->hooks = NULL; + hook_list->dummy3 = NULL; + hook_list->finalize_hook = default_finalize_hook; + hook_list->dummy[0] = NULL; + hook_list->dummy[1] = NULL; +} + +void +g_hook_list_clear (GHookList *hook_list) +{ + g_return_if_fail (hook_list != NULL); + + if (hook_list->is_setup) + { + GHook *hook; + + hook_list->is_setup = FALSE; + + hook = hook_list->hooks; + if (!hook) + { + /* destroy hook_list->hook_memchunk */ + } + else + do + { + GHook *tmp; + + g_hook_ref (hook_list, hook); + g_hook_destroy_link (hook_list, hook); + tmp = hook->next; + g_hook_unref (hook_list, hook); + hook = tmp; + } + while (hook); + } +} + +GHook* +g_hook_alloc (GHookList *hook_list) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (hook_list->is_setup, NULL); + + hook = g_slice_alloc0 (hook_list->hook_size); + hook->data = NULL; + hook->next = NULL; + hook->prev = NULL; + hook->flags = G_HOOK_FLAG_ACTIVE; + hook->ref_count = 0; + hook->hook_id = 0; + hook->func = NULL; + hook->destroy = NULL; + + return hook; +} + +void +g_hook_free (GHookList *hook_list, + GHook *hook) +{ + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + g_return_if_fail (hook != NULL); + g_return_if_fail (G_HOOK_IS_UNLINKED (hook)); + g_return_if_fail (!G_HOOK_IN_CALL (hook)); + + if(hook_list->finalize_hook != NULL) + hook_list->finalize_hook (hook_list, hook); + g_slice_free1 (hook_list->hook_size, hook); +} + +void +g_hook_destroy_link (GHookList *hook_list, + GHook *hook) +{ + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook != NULL); + + hook->flags &= ~G_HOOK_FLAG_ACTIVE; + if (hook->hook_id) + { + hook->hook_id = 0; + g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */ + } +} + +gboolean +g_hook_destroy (GHookList *hook_list, + gulong hook_id) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, FALSE); + g_return_val_if_fail (hook_id > 0, FALSE); + + hook = g_hook_get (hook_list, hook_id); + if (hook) + { + g_hook_destroy_link (hook_list, hook); + return TRUE; + } + + return FALSE; +} + +void +g_hook_unref (GHookList *hook_list, + GHook *hook) +{ + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook != NULL); + g_return_if_fail (hook->ref_count > 0); + + hook->ref_count--; + if (!hook->ref_count) + { + g_return_if_fail (hook->hook_id == 0); + g_return_if_fail (!G_HOOK_IN_CALL (hook)); + + if (hook->prev) + hook->prev->next = hook->next; + else + hook_list->hooks = hook->next; + if (hook->next) + { + hook->next->prev = hook->prev; + hook->next = NULL; + } + hook->prev = NULL; + + if (!hook_list->is_setup) + { + hook_list->is_setup = TRUE; + g_hook_free (hook_list, hook); + hook_list->is_setup = FALSE; + + if (!hook_list->hooks) + { + /* destroy hook_list->hook_memchunk */ + } + } + else + g_hook_free (hook_list, hook); + } +} + +GHook * +g_hook_ref (GHookList *hook_list, + GHook *hook) +{ + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (hook != NULL, NULL); + g_return_val_if_fail (hook->ref_count > 0, NULL); + + hook->ref_count++; + + return hook; +} + +void +g_hook_prepend (GHookList *hook_list, + GHook *hook) +{ + g_return_if_fail (hook_list != NULL); + + g_hook_insert_before (hook_list, hook_list->hooks, hook); +} + +void +g_hook_insert_before (GHookList *hook_list, + GHook *sibling, + GHook *hook) +{ + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + g_return_if_fail (hook != NULL); + g_return_if_fail (G_HOOK_IS_UNLINKED (hook)); + g_return_if_fail (hook->ref_count == 0); + + hook->hook_id = hook_list->seq_id++; + hook->ref_count = 1; /* counterpart to g_hook_destroy_link */ + + if (sibling) + { + if (sibling->prev) + { + hook->prev = sibling->prev; + hook->prev->next = hook; + hook->next = sibling; + sibling->prev = hook; + } + else + { + hook_list->hooks = hook; + hook->next = sibling; + sibling->prev = hook; + } + } + else + { + if (hook_list->hooks) + { + sibling = hook_list->hooks; + while (sibling->next) + sibling = sibling->next; + hook->prev = sibling; + sibling->next = hook; + } + else + hook_list->hooks = hook; + } +} + +void +g_hook_list_invoke (GHookList *hook_list, + gboolean may_recurse) +{ + GHook *hook; + + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + + hook = g_hook_first_valid (hook_list, may_recurse); + while (hook) + { + GHookFunc func; + gboolean was_in_call; + + func = (GHookFunc) hook->func; + + was_in_call = G_HOOK_IN_CALL (hook); + hook->flags |= G_HOOK_FLAG_IN_CALL; + func (hook->data); + if (!was_in_call) + hook->flags &= ~G_HOOK_FLAG_IN_CALL; + + hook = g_hook_next_valid (hook_list, hook, may_recurse); + } +} + +void +g_hook_list_invoke_check (GHookList *hook_list, + gboolean may_recurse) +{ + GHook *hook; + + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + + hook = g_hook_first_valid (hook_list, may_recurse); + while (hook) + { + GHookCheckFunc func; + gboolean was_in_call; + gboolean need_destroy; + + func = (GHookCheckFunc) hook->func; + + was_in_call = G_HOOK_IN_CALL (hook); + hook->flags |= G_HOOK_FLAG_IN_CALL; + need_destroy = !func (hook->data); + if (!was_in_call) + hook->flags &= ~G_HOOK_FLAG_IN_CALL; + if (need_destroy) + g_hook_destroy_link (hook_list, hook); + + hook = g_hook_next_valid (hook_list, hook, may_recurse); + } +} + +void +g_hook_list_marshal_check (GHookList *hook_list, + gboolean may_recurse, + GHookCheckMarshaller marshaller, + gpointer data) +{ + GHook *hook; + + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + g_return_if_fail (marshaller != NULL); + + hook = g_hook_first_valid (hook_list, may_recurse); + while (hook) + { + gboolean was_in_call; + gboolean need_destroy; + + was_in_call = G_HOOK_IN_CALL (hook); + hook->flags |= G_HOOK_FLAG_IN_CALL; + need_destroy = !marshaller (hook, data); + if (!was_in_call) + hook->flags &= ~G_HOOK_FLAG_IN_CALL; + if (need_destroy) + g_hook_destroy_link (hook_list, hook); + + hook = g_hook_next_valid (hook_list, hook, may_recurse); + } +} + +void +g_hook_list_marshal (GHookList *hook_list, + gboolean may_recurse, + GHookMarshaller marshaller, + gpointer data) +{ + GHook *hook; + + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + g_return_if_fail (marshaller != NULL); + + hook = g_hook_first_valid (hook_list, may_recurse); + while (hook) + { + gboolean was_in_call; + + was_in_call = G_HOOK_IN_CALL (hook); + hook->flags |= G_HOOK_FLAG_IN_CALL; + marshaller (hook, data); + if (!was_in_call) + hook->flags &= ~G_HOOK_FLAG_IN_CALL; + + hook = g_hook_next_valid (hook_list, hook, may_recurse); + } +} + +GHook* +g_hook_first_valid (GHookList *hook_list, + gboolean may_be_in_call) +{ + g_return_val_if_fail (hook_list != NULL, NULL); + + if (hook_list->is_setup) + { + GHook *hook; + + hook = hook_list->hooks; + if (hook) + { + g_hook_ref (hook_list, hook); + if (G_HOOK_IS_VALID (hook) && (may_be_in_call || !G_HOOK_IN_CALL (hook))) + return hook; + else + return g_hook_next_valid (hook_list, hook, may_be_in_call); + } + } + + return NULL; +} + +GHook* +g_hook_next_valid (GHookList *hook_list, + GHook *hook, + gboolean may_be_in_call) +{ + GHook *ohook = hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + + if (!hook) + return NULL; + + hook = hook->next; + while (hook) + { + if (G_HOOK_IS_VALID (hook) && (may_be_in_call || !G_HOOK_IN_CALL (hook))) + { + g_hook_ref (hook_list, hook); + g_hook_unref (hook_list, ohook); + + return hook; + } + hook = hook->next; + } + g_hook_unref (hook_list, ohook); + + return NULL; +} + +GHook* +g_hook_get (GHookList *hook_list, + gulong hook_id) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (hook_id > 0, NULL); + + hook = hook_list->hooks; + while (hook) + { + if (hook->hook_id == hook_id) + return hook; + hook = hook->next; + } + + return NULL; +} + +GHook* +g_hook_find (GHookList *hook_list, + gboolean need_valids, + GHookFindFunc func, + gpointer data) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (func != NULL, NULL); + + hook = hook_list->hooks; + while (hook) + { + GHook *tmp; + + /* test only non-destroyed hooks */ + if (!hook->hook_id) + { + hook = hook->next; + continue; + } + + g_hook_ref (hook_list, hook); + + if (func (hook, data) && hook->hook_id && (!need_valids || G_HOOK_ACTIVE (hook))) + { + g_hook_unref (hook_list, hook); + + return hook; + } + + tmp = hook->next; + g_hook_unref (hook_list, hook); + hook = tmp; + } + + return NULL; +} + +GHook* +g_hook_find_data (GHookList *hook_list, + gboolean need_valids, + gpointer data) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + + hook = hook_list->hooks; + while (hook) + { + /* test only non-destroyed hooks */ + if (hook->data == data && + hook->hook_id && + (!need_valids || G_HOOK_ACTIVE (hook))) + return hook; + + hook = hook->next; + } + + return NULL; +} + +GHook* +g_hook_find_func (GHookList *hook_list, + gboolean need_valids, + gpointer func) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (func != NULL, NULL); + + hook = hook_list->hooks; + while (hook) + { + /* test only non-destroyed hooks */ + if (hook->func == func && + hook->hook_id && + (!need_valids || G_HOOK_ACTIVE (hook))) + return hook; + + hook = hook->next; + } + + return NULL; +} + +GHook* +g_hook_find_func_data (GHookList *hook_list, + gboolean need_valids, + gpointer func, + gpointer data) +{ + GHook *hook; + + g_return_val_if_fail (hook_list != NULL, NULL); + g_return_val_if_fail (func != NULL, NULL); + + hook = hook_list->hooks; + while (hook) + { + /* test only non-destroyed hooks */ + if (hook->data == data && + hook->func == func && + hook->hook_id && + (!need_valids || G_HOOK_ACTIVE (hook))) + return hook; + + hook = hook->next; + } + + return NULL; +} + +void +g_hook_insert_sorted (GHookList *hook_list, + GHook *hook, + GHookCompareFunc func) +{ + GHook *sibling; + + g_return_if_fail (hook_list != NULL); + g_return_if_fail (hook_list->is_setup); + g_return_if_fail (hook != NULL); + g_return_if_fail (G_HOOK_IS_UNLINKED (hook)); + g_return_if_fail (hook->func != NULL); + g_return_if_fail (func != NULL); + + /* first non-destroyed hook */ + sibling = hook_list->hooks; + while (sibling && !sibling->hook_id) + sibling = sibling->next; + + while (sibling) + { + GHook *tmp; + + g_hook_ref (hook_list, sibling); + if (func (hook, sibling) <= 0 && sibling->hook_id) + { + g_hook_unref (hook_list, sibling); + break; + } + + /* next non-destroyed hook */ + tmp = sibling->next; + while (tmp && !tmp->hook_id) + tmp = tmp->next; + + g_hook_unref (hook_list, sibling); + sibling = tmp; + } + + g_hook_insert_before (hook_list, sibling, hook); +} + +gint +g_hook_compare_ids (GHook *new_hook, + GHook *sibling) +{ + if (new_hook->hook_id < sibling->hook_id) + return -1; + else if (new_hook->hook_id > sibling->hook_id) + return 1; + + return 0; +} diff --git a/deps/glib/ghook.h b/deps/glib/ghook.h new file mode 100644 index 0000000..5577fc3 --- /dev/null +++ b/deps/glib/ghook.h @@ -0,0 +1,181 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_HOOK_H__ +#define __G_HOOK_H__ + +#include + +G_BEGIN_DECLS + + +/* --- typedefs --- */ +typedef struct _GHook GHook; +typedef struct _GHookList GHookList; + +typedef gint (*GHookCompareFunc) (GHook *new_hook, + GHook *sibling); +typedef gboolean (*GHookFindFunc) (GHook *hook, + gpointer data); +typedef void (*GHookMarshaller) (GHook *hook, + gpointer marshal_data); +typedef gboolean (*GHookCheckMarshaller) (GHook *hook, + gpointer marshal_data); +typedef void (*GHookFunc) (gpointer data); +typedef gboolean (*GHookCheckFunc) (gpointer data); +typedef void (*GHookFinalizeFunc) (GHookList *hook_list, + GHook *hook); +typedef enum +{ + G_HOOK_FLAG_ACTIVE = 1 << 0, + G_HOOK_FLAG_IN_CALL = 1 << 1, + G_HOOK_FLAG_MASK = 0x0f +} GHookFlagMask; +#define G_HOOK_FLAG_USER_SHIFT (4) + + +/* --- structures --- */ +struct _GHookList +{ + gulong seq_id; + guint hook_size : 16; + guint is_setup : 1; + GHook *hooks; + gpointer dummy3; + GHookFinalizeFunc finalize_hook; + gpointer dummy[2]; +}; +struct _GHook +{ + gpointer data; + GHook *next; + GHook *prev; + guint ref_count; + gulong hook_id; + guint flags; + gpointer func; + GDestroyNotify destroy; +}; + + +/* --- macros --- */ +#define G_HOOK(hook) ((GHook*) (hook)) +#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags) +#define G_HOOK_ACTIVE(hook) ((G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_ACTIVE) != 0) +#define G_HOOK_IN_CALL(hook) ((G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_IN_CALL) != 0) +#define G_HOOK_IS_VALID(hook) (G_HOOK (hook)->hook_id != 0 && \ + (G_HOOK_FLAGS (hook) & \ + G_HOOK_FLAG_ACTIVE)) +#define G_HOOK_IS_UNLINKED(hook) (G_HOOK (hook)->next == NULL && \ + G_HOOK (hook)->prev == NULL && \ + G_HOOK (hook)->hook_id == 0 && \ + G_HOOK (hook)->ref_count == 0) + + +/* --- prototypes --- */ +/* callback maintenance functions */ +void g_hook_list_init (GHookList *hook_list, + guint hook_size); +void g_hook_list_clear (GHookList *hook_list); +GHook* g_hook_alloc (GHookList *hook_list); +void g_hook_free (GHookList *hook_list, + GHook *hook); +GHook * g_hook_ref (GHookList *hook_list, + GHook *hook); +void g_hook_unref (GHookList *hook_list, + GHook *hook); +gboolean g_hook_destroy (GHookList *hook_list, + gulong hook_id); +void g_hook_destroy_link (GHookList *hook_list, + GHook *hook); +void g_hook_prepend (GHookList *hook_list, + GHook *hook); +void g_hook_insert_before (GHookList *hook_list, + GHook *sibling, + GHook *hook); +void g_hook_insert_sorted (GHookList *hook_list, + GHook *hook, + GHookCompareFunc func); +GHook* g_hook_get (GHookList *hook_list, + gulong hook_id); +GHook* g_hook_find (GHookList *hook_list, + gboolean need_valids, + GHookFindFunc func, + gpointer data); +GHook* g_hook_find_data (GHookList *hook_list, + gboolean need_valids, + gpointer data); +GHook* g_hook_find_func (GHookList *hook_list, + gboolean need_valids, + gpointer func); +GHook* g_hook_find_func_data (GHookList *hook_list, + gboolean need_valids, + gpointer func, + gpointer data); +/* return the first valid hook, and increment its reference count */ +GHook* g_hook_first_valid (GHookList *hook_list, + gboolean may_be_in_call); +/* return the next valid hook with incremented reference count, and + * decrement the reference count of the original hook + */ +GHook* g_hook_next_valid (GHookList *hook_list, + GHook *hook, + gboolean may_be_in_call); +/* GHookCompareFunc implementation to insert hooks sorted by their id */ +gint g_hook_compare_ids (GHook *new_hook, + GHook *sibling); +/* convenience macros */ +#define g_hook_append( hook_list, hook ) \ + g_hook_insert_before ((hook_list), NULL, (hook)) +/* invoke all valid hooks with the (*GHookFunc) signature. + */ +void g_hook_list_invoke (GHookList *hook_list, + gboolean may_recurse); +/* invoke all valid hooks with the (*GHookCheckFunc) signature, + * and destroy the hook if FALSE is returned. + */ +void g_hook_list_invoke_check (GHookList *hook_list, + gboolean may_recurse); +/* invoke a marshaller on all valid hooks. + */ +void g_hook_list_marshal (GHookList *hook_list, + gboolean may_recurse, + GHookMarshaller marshaller, + gpointer marshal_data); +void g_hook_list_marshal_check (GHookList *hook_list, + gboolean may_recurse, + GHookCheckMarshaller marshaller, + gpointer marshal_data); + +G_END_DECLS + +#endif /* __G_HOOK_H__ */ diff --git a/deps/glib/gi18n-lib.h b/deps/glib/gi18n-lib.h new file mode 100644 index 0000000..ca002a7 --- /dev/null +++ b/deps/glib/gi18n-lib.h @@ -0,0 +1,38 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_I18N_LIB_H__ +#define __G_I18N_LIB_H__ + +#include + +#include +#include + +#ifndef GETTEXT_PACKAGE +#error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h? +#endif + +#define _(String) ((char *) g_dgettext (GETTEXT_PACKAGE, String)) +#define Q_(String) g_dpgettext (GETTEXT_PACKAGE, String, 0) +#define N_(String) (String) +#define C_(Context,String) g_dpgettext (GETTEXT_PACKAGE, Context "\004" String, strlen (Context) + 1) +#define NC_(Context, String) (String) + +#endif /* __G_I18N_LIB_H__ */ diff --git a/deps/glib/glib-object.h b/deps/glib/glib-object.h new file mode 100644 index 0000000..88a6582 --- /dev/null +++ b/deps/glib/glib-object.h @@ -0,0 +1,6 @@ +#ifndef __GLIB_OBJECT_H__ +#define __GLIB_OBJECT_H__ + +#include "glib.h" + +#endif /* __GLIB_OBJECT_H__ */ diff --git a/deps/glib/glib.h b/deps/glib/glib.h new file mode 100644 index 0000000..2b06acb --- /dev/null +++ b/deps/glib/glib.h @@ -0,0 +1,29 @@ +#ifndef __GLIB_H__ +#define __GLIB_H__ + +#define __GLIB_H_INSIDE__ + +#include "gtypes.h" +#include "glibconfig.h" +#include "gmacros.h" +#include "gquark.h" +#include "gstrfuncs.h" +#include "gmessages.h" +#include "gmem.h" +#include "galloca.h" +#include "gslice.h" +#include "gstring.h" +#include "ghook.h" +#include "garray.h" +#include "gslist.h" +#include "glist.h" +#include "gqueue.h" +#include "gtestutils.h" +#include "gqsort.h" +#include "gatomic.h" +#include "gthread.h" +#include "ghash.h" +#include "gfileutils.h" +#include "gconvert.h" + +#endif /* __GLIB_H__ */ diff --git a/deps/glib/glib_trace.h b/deps/glib/glib_trace.h new file mode 100644 index 0000000..789e88d --- /dev/null +++ b/deps/glib/glib_trace.h @@ -0,0 +1,43 @@ +/* GLIB - Library of useful routines for C programming + * + * Copyright (C) 2009,2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Alexander Larsson + */ + +#ifndef __GLIBTRACE_H__ +#define __GLIBTRACE_H__ + +#ifndef SIZEOF_CHAR +#error "config.h must be included prior to glib_trace.h" +#endif + +#ifdef HAVE_DTRACE + +/* include the generated probes header and put markers in code */ +#include "glib_probes.h" +#define TRACE(probe) probe + +#else + +/* Wrap the probe to allow it to be removed when no systemtap available */ +#define TRACE(probe) + +#endif + +#endif /* __GLIBTRACE_H__ */ diff --git a/deps/glib/glibintl.h b/deps/glib/glibintl.h new file mode 100644 index 0000000..9dc9a0f --- /dev/null +++ b/deps/glib/glibintl.h @@ -0,0 +1,42 @@ +#ifndef __GLIBINTL_H__ +#define __GLIBINTL_H__ + +#ifndef SIZEOF_CHAR +#error "config.h must be included prior to glibintl.h" +#endif + +const gchar * glib_gettext (const gchar *str) G_GNUC_FORMAT(1); +const gchar * glib_pgettext (const gchar *msgctxtid, + gsize msgidoffset) G_GNUC_FORMAT(1); + +#ifdef ENABLE_NLS + +#include +#define _(String) glib_gettext(String) +/* Split out this in the code, but keep it in the same domain for now */ +#define P_(String) glib_gettext(String) +#define C_(Context,String) glib_pgettext (Context "\004" String, strlen (Context) + 1) + +#ifdef gettext_noop +#define N_(String) gettext_noop(String) +#else +#define N_(String) (String) +#endif +#else /* NLS is disabled */ +#define _(String) (String) +#define N_(String) (String) +#define P_(String) (String) +#define C_(Context,String) (String) +#define textdomain(String) ((String) ? (String) : "messages") +#define gettext(String) (String) +#define dgettext(Domain,String) (String) +#define dcgettext(Domain,String,Type) (String) +#define dngettext(Domain,String1,String2,N) ((N) == 1 ? (String1) : (String2)) +#define bindtextdomain(Domain,Directory) +#define bind_textdomain_codeset(Domain,Codeset) +#endif + +/* not really I18N-related, but also a string marker macro */ +#define I_(string) g_intern_static_string (string) + +#endif /* __GLIBINTL_H__ */ diff --git a/deps/glib/glist.c b/deps/glib/glist.c new file mode 100644 index 0000000..1e3dd86 --- /dev/null +++ b/deps/glib/glist.c @@ -0,0 +1,1170 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include "glist.h" + +#include "gtestutils.h" + +/** + * SECTION:linked_lists_double + * @title: Doubly-Linked Lists + * @short_description: linked lists containing integer values or + * pointers to data, with the ability to iterate + * over the list in both directions + * + * The #GList structure and its associated functions provide a standard + * doubly-linked list data structure. + * + * Each element in the list contains a piece of data, together with + * pointers which link to the previous and next elements in the list. + * Using these pointers it is possible to move through the list in both + * directions (unlike the Singly-Linked Lists which + * only allows movement through the list in the forward direction). + * + * The data contained in each element can be either integer values, by + * using one of the Type + * Conversion Macros, or simply pointers to any type of data. + * + * List elements are allocated from the slice allocator, which is more + * efficient than allocating elements individually. + * + * Note that most of the #GList functions expect to be passed a pointer + * to the first element in the list. The functions which insert + * elements return the new start of the list, which may have changed. + * + * There is no function to create a #GList. %NULL is considered to be + * the empty list so you simply set a #GList* to %NULL. + * + * To add elements, use g_list_append(), g_list_prepend(), + * g_list_insert() and g_list_insert_sorted(). + * + * To remove elements, use g_list_remove(). + * + * To find elements in the list use g_list_first(), g_list_last(), + * g_list_next(), g_list_previous(), g_list_nth(), g_list_nth_data(), + * g_list_find() and g_list_find_custom(). + * + * To find the index of an element use g_list_position() and + * g_list_index(). + * + * To call a function for each element in the list use g_list_foreach(). + * + * To free the entire list, use g_list_free(). + **/ + +/** + * GList: + * @data: holds the element's data, which can be a pointer to any kind + * of data, or any integer value using the Type Conversion + * Macros. + * @next: contains the link to the next element in the list. + * @prev: contains the link to the previous element in the list. + * + * The #GList struct is used for each element in a doubly-linked list. + **/ + +/** + * g_list_previous: + * @list: an element in a #GList. + * @Returns: the previous element, or %NULL if there are no previous + * elements. + * + * A convenience macro to get the previous element in a #GList. + **/ + +/** + * g_list_next: + * @list: an element in a #GList. + * @Returns: the next element, or %NULL if there are no more elements. + * + * A convenience macro to get the next element in a #GList. + **/ + + + +/** + * g_list_push_allocator: + * @allocator: the #GAllocator to use when allocating #GList elements. + * + * Sets the allocator to use to allocate #GList elements. Use + * g_list_pop_allocator() to restore the previous allocator. + * + * Note that this function is not available if GLib has been compiled + * with + * + * Deprecated:2.10: It does nothing, since #GList has been converted + * to the slice + * allocator + **/ +void g_list_push_allocator (gpointer dummy) { /* present for binary compat only */ } + +/** + * g_list_pop_allocator: + * + * Restores the previous #GAllocator, used when allocating #GList + * elements. + * + * Note that this function is not available if GLib has been compiled + * with + * + * Deprecated:2.10: It does nothing, since #GList has been converted + * to the slice + * allocator + **/ +void g_list_pop_allocator (void) { /* present for binary compat only */ } + +#define _g_list_alloc() g_slice_new (GList) +#define _g_list_alloc0() g_slice_new0 (GList) +#define _g_list_free1(list) g_slice_free (GList, list) + +/** + * g_list_alloc: + * @Returns: a pointer to the newly-allocated #GList element. + * + * Allocates space for one #GList element. It is called by + * g_list_append(), g_list_prepend(), g_list_insert() and + * g_list_insert_sorted() and so is rarely used on its own. + **/ +GList* +g_list_alloc (void) +{ + return _g_list_alloc0 (); +} + +/** + * g_list_free: + * @list: a #GList + * + * Frees all of the memory used by a #GList. + * The freed elements are returned to the slice allocator. + * + * + * If list elements contain dynamically-allocated memory, + * you should either use g_list_free_full() or free them manually + * first. + * + */ +void +g_list_free (GList *list) +{ + g_slice_free_chain (GList, list, next); +} + +/** + * g_list_free_1: + * @list: a #GList element + * + * Frees one #GList element. + * It is usually used after g_list_remove_link(). + */ +/** + * g_list_free1: + * + * Another name for g_list_free_1(). + **/ +void +g_list_free_1 (GList *list) +{ + _g_list_free1 (list); +} + +/** + * g_list_free_full: + * @list: a pointer to a #GList + * @free_func: the function to be called to free each element's data + * + * Convenience method, which frees all the memory used by a #GList, and + * calls the specified destroy function on every element's data. + * + * Since: 2.28 + */ +void +g_list_free_full (GList *list, + GDestroyNotify free_func) +{ + g_list_foreach (list, (GFunc) free_func, NULL); + g_list_free (list); +} + +/** + * g_list_append: + * @list: a pointer to a #GList + * @data: the data for the new element + * + * Adds a new element on to the end of the list. + * + * + * The return value is the new start of the list, which + * may have changed, so make sure you store the new value. + * + * + * + * Note that g_list_append() has to traverse the entire list + * to find the end, which is inefficient when adding multiple + * elements. A common idiom to avoid the inefficiency is to prepend + * the elements and reverse the list when all elements have been added. + * + * + * |[ + * /* Notice that these are initialized to the empty list. */ + * GList *list = NULL, *number_list = NULL; + * + * /* This is a list of strings. */ + * list = g_list_append (list, "first"); + * list = g_list_append (list, "second"); + * + * /* This is a list of integers. */ + * number_list = g_list_append (number_list, GINT_TO_POINTER (27)); + * number_list = g_list_append (number_list, GINT_TO_POINTER (14)); + * ]| + * + * Returns: the new start of the #GList + */ +GList* +g_list_append (GList *list, + gpointer data) +{ + GList *new_list; + GList *last; + + new_list = _g_list_alloc (); + new_list->data = data; + new_list->next = NULL; + + if (list) + { + last = g_list_last (list); + /* g_assert (last != NULL); */ + last->next = new_list; + new_list->prev = last; + + return list; + } + else + { + new_list->prev = NULL; + return new_list; + } +} + +/** + * g_list_prepend: + * @list: a pointer to a #GList + * @data: the data for the new element + * + * Adds a new element on to the start of the list. + * + * + * The return value is the new start of the list, which + * may have changed, so make sure you store the new value. + * + * + * |[ + * /* Notice that it is initialized to the empty list. */ + * GList *list = NULL; + * list = g_list_prepend (list, "last"); + * list = g_list_prepend (list, "first"); + * ]| + * + * Returns: the new start of the #GList + */ +GList* +g_list_prepend (GList *list, + gpointer data) +{ + GList *new_list; + + new_list = _g_list_alloc (); + new_list->data = data; + new_list->next = list; + + if (list) + { + new_list->prev = list->prev; + if (list->prev) + list->prev->next = new_list; + list->prev = new_list; + } + else + new_list->prev = NULL; + + return new_list; +} + +/** + * g_list_insert: + * @list: a pointer to a #GList + * @data: the data for the new element + * @position: the position to insert the element. If this is + * negative, or is larger than the number of elements in the + * list, the new element is added on to the end of the list. + * + * Inserts a new element into the list at the given position. + * + * Returns: the new start of the #GList + */ +GList* +g_list_insert (GList *list, + gpointer data, + gint position) +{ + GList *new_list; + GList *tmp_list; + + if (position < 0) + return g_list_append (list, data); + else if (position == 0) + return g_list_prepend (list, data); + + tmp_list = g_list_nth (list, position); + if (!tmp_list) + return g_list_append (list, data); + + new_list = _g_list_alloc (); + new_list->data = data; + new_list->prev = tmp_list->prev; + if (tmp_list->prev) + tmp_list->prev->next = new_list; + new_list->next = tmp_list; + tmp_list->prev = new_list; + + if (tmp_list == list) + return new_list; + else + return list; +} + +/** + * g_list_insert_before: + * @list: a pointer to a #GList + * @sibling: the list element before which the new element + * is inserted or %NULL to insert at the end of the list + * @data: the data for the new element + * + * Inserts a new element into the list before the given position. + * + * Returns: the new start of the #GList + */ +GList* +g_list_insert_before (GList *list, + GList *sibling, + gpointer data) +{ + if (!list) + { + list = g_list_alloc (); + list->data = data; + g_return_val_if_fail (sibling == NULL, list); + return list; + } + else if (sibling) + { + GList *node; + + node = _g_list_alloc (); + node->data = data; + node->prev = sibling->prev; + node->next = sibling; + sibling->prev = node; + if (node->prev) + { + node->prev->next = node; + return list; + } + else + { + g_return_val_if_fail (sibling == list, node); + return node; + } + } + else + { + GList *last; + + last = list; + while (last->next) + last = last->next; + + last->next = _g_list_alloc (); + last->next->data = data; + last->next->prev = last; + last->next->next = NULL; + + return list; + } +} + +/** + * g_list_concat: + * @list1: a #GList + * @list2: the #GList to add to the end of the first #GList + * + * Adds the second #GList onto the end of the first #GList. + * Note that the elements of the second #GList are not copied. + * They are used directly. + * + * Returns: the start of the new #GList + */ +GList * +g_list_concat (GList *list1, GList *list2) +{ + GList *tmp_list; + + if (list2) + { + tmp_list = g_list_last (list1); + if (tmp_list) + tmp_list->next = list2; + else + list1 = list2; + list2->prev = tmp_list; + } + + return list1; +} + +/** + * g_list_remove: + * @list: a #GList + * @data: the data of the element to remove + * + * Removes an element from a #GList. + * If two elements contain the same data, only the first is removed. + * If none of the elements contain the data, the #GList is unchanged. + * + * Returns: the new start of the #GList + */ +GList* +g_list_remove (GList *list, + gconstpointer data) +{ + GList *tmp; + + tmp = list; + while (tmp) + { + if (tmp->data != data) + tmp = tmp->next; + else + { + if (tmp->prev) + tmp->prev->next = tmp->next; + if (tmp->next) + tmp->next->prev = tmp->prev; + + if (list == tmp) + list = list->next; + + _g_list_free1 (tmp); + + break; + } + } + return list; +} + +/** + * g_list_remove_all: + * @list: a #GList + * @data: data to remove + * + * Removes all list nodes with data equal to @data. + * Returns the new head of the list. Contrast with + * g_list_remove() which removes only the first node + * matching the given data. + * + * Returns: new head of @list + */ +GList* +g_list_remove_all (GList *list, + gconstpointer data) +{ + GList *tmp = list; + + while (tmp) + { + if (tmp->data != data) + tmp = tmp->next; + else + { + GList *next = tmp->next; + + if (tmp->prev) + tmp->prev->next = next; + else + list = next; + if (next) + next->prev = tmp->prev; + + _g_list_free1 (tmp); + tmp = next; + } + } + return list; +} + +static inline GList* +_g_list_remove_link (GList *list, + GList *link) +{ + if (link) + { + if (link->prev) + link->prev->next = link->next; + if (link->next) + link->next->prev = link->prev; + + if (link == list) + list = list->next; + + link->next = NULL; + link->prev = NULL; + } + + return list; +} + +/** + * g_list_remove_link: + * @list: a #GList + * @llink: an element in the #GList + * + * Removes an element from a #GList, without freeing the element. + * The removed element's prev and next links are set to %NULL, so + * that it becomes a self-contained list with one element. + * + * Returns: the new start of the #GList, without the element + */ +GList* +g_list_remove_link (GList *list, + GList *llink) +{ + return _g_list_remove_link (list, llink); +} + +/** + * g_list_delete_link: + * @list: a #GList + * @link_: node to delete from @list + * + * Removes the node link_ from the list and frees it. + * Compare this to g_list_remove_link() which removes the node + * without freeing it. + * + * Returns: the new head of @list + */ +GList* +g_list_delete_link (GList *list, + GList *link_) +{ + list = _g_list_remove_link (list, link_); + _g_list_free1 (link_); + + return list; +} + +/** + * g_list_copy: + * @list: a #GList + * + * Copies a #GList. + * + * + * Note that this is a "shallow" copy. If the list elements + * consist of pointers to data, the pointers are copied but + * the actual data is not. + * + * + * Returns: a copy of @list + */ +GList* +g_list_copy (GList *list) +{ + GList *new_list = NULL; + + if (list) + { + GList *last; + + new_list = _g_list_alloc (); + new_list->data = list->data; + new_list->prev = NULL; + last = new_list; + list = list->next; + while (list) + { + last->next = _g_list_alloc (); + last->next->prev = last; + last = last->next; + last->data = list->data; + list = list->next; + } + last->next = NULL; + } + + return new_list; +} + +/** + * g_list_reverse: + * @list: a #GList + * + * Reverses a #GList. + * It simply switches the next and prev pointers of each element. + * + * Returns: the start of the reversed #GList + */ +GList* +g_list_reverse (GList *list) +{ + GList *last; + + last = NULL; + while (list) + { + last = list; + list = last->next; + last->next = last->prev; + last->prev = list; + } + + return last; +} + +/** + * g_list_nth: + * @list: a #GList + * @n: the position of the element, counting from 0 + * + * Gets the element at the given position in a #GList. + * + * Returns: the element, or %NULL if the position is off + * the end of the #GList + */ +GList* +g_list_nth (GList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list; +} + +/** + * g_list_nth_prev: + * @list: a #GList + * @n: the position of the element, counting from 0 + * + * Gets the element @n places before @list. + * + * Returns: the element, or %NULL if the position is + * off the end of the #GList + */ +GList* +g_list_nth_prev (GList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->prev; + + return list; +} + +/** + * g_list_nth_data: + * @list: a #GList + * @n: the position of the element + * + * Gets the data of the element at the given position. + * + * Returns: the element's data, or %NULL if the position + * is off the end of the #GList + */ +gpointer +g_list_nth_data (GList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list ? list->data : NULL; +} + +/** + * g_list_find: + * @list: a #GList + * @data: the element data to find + * + * Finds the element in a #GList which + * contains the given data. + * + * Returns: the found #GList element, + * or %NULL if it is not found + */ +GList* +g_list_find (GList *list, + gconstpointer data) +{ + while (list) + { + if (list->data == data) + break; + list = list->next; + } + + return list; +} + +/** + * g_list_find_custom: + * @list: a #GList + * @data: user data passed to the function + * @func: the function to call for each element. + * It should return 0 when the desired element is found + * + * Finds an element in a #GList, using a supplied function to + * find the desired element. It iterates over the list, calling + * the given function which should return 0 when the desired + * element is found. The function takes two #gconstpointer arguments, + * the #GList element's data as the first argument and the + * given user data. + * + * Returns: the found #GList element, or %NULL if it is not found + */ +GList* +g_list_find_custom (GList *list, + gconstpointer data, + GCompareFunc func) +{ + g_return_val_if_fail (func != NULL, list); + + while (list) + { + if (! func (list->data, data)) + return list; + list = list->next; + } + + return NULL; +} + + +/** + * g_list_position: + * @list: a #GList + * @llink: an element in the #GList + * + * Gets the position of the given element + * in the #GList (starting from 0). + * + * Returns: the position of the element in the #GList, + * or -1 if the element is not found + */ +gint +g_list_position (GList *list, + GList *llink) +{ + gint i; + + i = 0; + while (list) + { + if (list == llink) + return i; + i++; + list = list->next; + } + + return -1; +} + +/** + * g_list_index: + * @list: a #GList + * @data: the data to find + * + * Gets the position of the element containing + * the given data (starting from 0). + * + * Returns: the index of the element containing the data, + * or -1 if the data is not found + */ +gint +g_list_index (GList *list, + gconstpointer data) +{ + gint i; + + i = 0; + while (list) + { + if (list->data == data) + return i; + i++; + list = list->next; + } + + return -1; +} + +/** + * g_list_last: + * @list: a #GList + * + * Gets the last element in a #GList. + * + * Returns: the last element in the #GList, + * or %NULL if the #GList has no elements + */ +GList* +g_list_last (GList *list) +{ + if (list) + { + while (list->next) + list = list->next; + } + + return list; +} + +/** + * g_list_first: + * @list: a #GList + * + * Gets the first element in a #GList. + * + * Returns: the first element in the #GList, + * or %NULL if the #GList has no elements + */ +GList* +g_list_first (GList *list) +{ + if (list) + { + while (list->prev) + list = list->prev; + } + + return list; +} + +/** + * g_list_length: + * @list: a #GList + * + * Gets the number of elements in a #GList. + * + * + * This function iterates over the whole list to + * count its elements. + * + * + * Returns: the number of elements in the #GList + */ +guint +g_list_length (GList *list) +{ + guint length; + + length = 0; + while (list) + { + length++; + list = list->next; + } + + return length; +} + +/** + * g_list_foreach: + * @list: a #GList + * @func: the function to call with each element's data + * @user_data: user data to pass to the function + * + * Calls a function for each element of a #GList. + */ +/** + * GFunc: + * @data: the element's data. + * @user_data: user data passed to g_list_foreach() or + * g_slist_foreach(). + * + * Specifies the type of functions passed to g_list_foreach() and + * g_slist_foreach(). + **/ +void +g_list_foreach (GList *list, + GFunc func, + gpointer user_data) +{ + while (list) + { + GList *next = list->next; + (*func) (list->data, user_data); + list = next; + } +} + +static GList* +g_list_insert_sorted_real (GList *list, + gpointer data, + GFunc func, + gpointer user_data) +{ + GList *tmp_list = list; + GList *new_list; + gint cmp; + + g_return_val_if_fail (func != NULL, list); + + if (!list) + { + new_list = _g_list_alloc0 (); + new_list->data = data; + return new_list; + } + + cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); + + while ((tmp_list->next) && (cmp > 0)) + { + tmp_list = tmp_list->next; + + cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); + } + + new_list = _g_list_alloc0 (); + new_list->data = data; + + if ((!tmp_list->next) && (cmp > 0)) + { + tmp_list->next = new_list; + new_list->prev = tmp_list; + return list; + } + + if (tmp_list->prev) + { + tmp_list->prev->next = new_list; + new_list->prev = tmp_list->prev; + } + new_list->next = tmp_list; + tmp_list->prev = new_list; + + if (tmp_list == list) + return new_list; + else + return list; +} + +/** + * g_list_insert_sorted: + * @list: a pointer to a #GList + * @data: the data for the new element + * @func: the function to compare elements in the list. It should + * return a number > 0 if the first parameter comes after the + * second parameter in the sort order. + * + * Inserts a new element into the list, using the given comparison + * function to determine its position. + * + * Returns: the new start of the #GList + */ +GList* +g_list_insert_sorted (GList *list, + gpointer data, + GCompareFunc func) +{ + return g_list_insert_sorted_real (list, data, (GFunc) func, NULL); +} + +/** + * g_list_insert_sorted_with_data: + * @list: a pointer to a #GList + * @data: the data for the new element + * @func: the function to compare elements in the list. + * It should return a number > 0 if the first parameter + * comes after the second parameter in the sort order. + * @user_data: user data to pass to comparison function. + * + * Inserts a new element into the list, using the given comparison + * function to determine its position. + * + * Returns: the new start of the #GList + * + * Since: 2.10 + */ +GList* +g_list_insert_sorted_with_data (GList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) +{ + return g_list_insert_sorted_real (list, data, (GFunc) func, user_data); +} + +static GList * +g_list_sort_merge (GList *l1, + GList *l2, + GFunc compare_func, + gpointer user_data) +{ + GList list, *l, *lprev; + gint cmp; + + l = &list; + lprev = NULL; + + while (l1 && l2) + { + cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data); + + if (cmp <= 0) + { + l->next = l1; + l1 = l1->next; + } + else + { + l->next = l2; + l2 = l2->next; + } + l = l->next; + l->prev = lprev; + lprev = l; + } + l->next = l1 ? l1 : l2; + l->next->prev = l; + + return list.next; +} + +static GList* +g_list_sort_real (GList *list, + GFunc compare_func, + gpointer user_data) +{ + GList *l1, *l2; + + if (!list) + return NULL; + if (!list->next) + return list; + + l1 = list; + l2 = list->next; + + while ((l2 = l2->next) != NULL) + { + if ((l2 = l2->next) == NULL) + break; + l1 = l1->next; + } + l2 = l1->next; + l1->next = NULL; + + return g_list_sort_merge (g_list_sort_real (list, compare_func, user_data), + g_list_sort_real (l2, compare_func, user_data), + compare_func, + user_data); +} + +/** + * g_list_sort: + * @list: a #GList + * @compare_func: the comparison function used to sort the #GList. + * This function is passed the data from 2 elements of the #GList + * and should return 0 if they are equal, a negative value if the + * first element comes before the second, or a positive value if + * the first element comes after the second. + * + * Sorts a #GList using the given comparison function. + * + * Returns: the start of the sorted #GList + */ +/** + * GCompareFunc: + * @a: a value. + * @b: a value to compare with. + * @Returns: negative value if @a < @b; zero if @a = @b; positive + * value if @a > @b. + * + * Specifies the type of a comparison function used to compare two + * values. The function should return a negative integer if the first + * value comes before the second, 0 if they are equal, or a positive + * integer if the first value comes after the second. + **/ +GList * +g_list_sort (GList *list, + GCompareFunc compare_func) +{ + return g_list_sort_real (list, (GFunc) compare_func, NULL); + +} + +/** + * g_list_sort_with_data: + * @list: a #GList + * @compare_func: comparison function + * @user_data: user data to pass to comparison function + * + * Like g_list_sort(), but the comparison function accepts + * a user data argument. + * + * Returns: the new head of @list + */ +/** + * GCompareDataFunc: + * @a: a value. + * @b: a value to compare with. + * @user_data: user data to pass to comparison function. + * @Returns: negative value if @a < @b; zero if @a = @b; positive + * value if @a > @b. + * + * Specifies the type of a comparison function used to compare two + * values. The function should return a negative integer if the first + * value comes before the second, 0 if they are equal, or a positive + * integer if the first value comes after the second. + **/ +GList * +g_list_sort_with_data (GList *list, + GCompareDataFunc compare_func, + gpointer user_data) +{ + return g_list_sort_real (list, (GFunc) compare_func, user_data); +} diff --git a/deps/glib/glist.h b/deps/glib/glist.h new file mode 100644 index 0000000..275005c --- /dev/null +++ b/deps/glib/glist.h @@ -0,0 +1,122 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_LIST_H__ +#define __G_LIST_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GList GList; + +struct _GList +{ + gpointer data; + GList *next; + GList *prev; +}; + +/* Doubly linked lists + */ +GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT; +void g_list_free (GList *list); +void g_list_free_1 (GList *list); +#define g_list_free1 g_list_free_1 +void g_list_free_full (GList *list, + GDestroyNotify free_func); +GList* g_list_append (GList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_prepend (GList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_insert (GList *list, + gpointer data, + gint position) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_insert_sorted (GList *list, + gpointer data, + GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_insert_sorted_with_data (GList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_insert_before (GList *list, + GList *sibling, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_concat (GList *list1, + GList *list2) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_remove (GList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_remove_all (GList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_remove_link (GList *list, + GList *llink) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_delete_link (GList *list, + GList *link_) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_nth (GList *list, + guint n); +GList* g_list_nth_prev (GList *list, + guint n); +GList* g_list_find (GList *list, + gconstpointer data); +GList* g_list_find_custom (GList *list, + gconstpointer data, + GCompareFunc func); +gint g_list_position (GList *list, + GList *llink); +gint g_list_index (GList *list, + gconstpointer data); +GList* g_list_last (GList *list); +GList* g_list_first (GList *list); +guint g_list_length (GList *list); +void g_list_foreach (GList *list, + GFunc func, + gpointer user_data); +GList* g_list_sort (GList *list, + GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; +GList* g_list_sort_with_data (GList *list, + GCompareDataFunc compare_func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +gpointer g_list_nth_data (GList *list, + guint n); + + +#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL) +#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) + +#ifndef G_DISABLE_DEPRECATED +void g_list_push_allocator (gpointer allocator); +void g_list_pop_allocator (void); +#endif + +G_END_DECLS + +#endif /* __G_LIST_H__ */ diff --git a/deps/glib/gmacros.h b/deps/glib/gmacros.h new file mode 100644 index 0000000..50a03ed --- /dev/null +++ b/deps/glib/gmacros.h @@ -0,0 +1,290 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* This file must not include any other glib header file and must thus + * not refer to variables from glibconfig.h + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_MACROS_H__ +#define __G_MACROS_H__ + +/* We include stddef.h to get the system's definition of NULL + */ +#include + +/* Here we provide G_GNUC_EXTENSION as an alias for __extension__, + * where this is valid. This allows for warningless compilation of + * "long long" types even in the presence of '-ansi -pedantic'. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +# define G_GNUC_EXTENSION __extension__ +#else +# define G_GNUC_EXTENSION +#endif + +/* Provide macros to feature the GCC function attribute. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define G_GNUC_PURE \ + __attribute__((__pure__)) +#define G_GNUC_MALLOC \ + __attribute__((__malloc__)) +#else +#define G_GNUC_PURE +#define G_GNUC_MALLOC +#endif + +#if __GNUC__ >= 4 +#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define G_GNUC_NULL_TERMINATED +#endif + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) +#else +#define G_GNUC_ALLOC_SIZE(x) +#define G_GNUC_ALLOC_SIZE2(x,y) +#endif + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define G_GNUC_PRINTF( format_idx, arg_idx ) \ + __attribute__((__format__ (__printf__, format_idx, arg_idx))) +#define G_GNUC_SCANF( format_idx, arg_idx ) \ + __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +#define G_GNUC_FORMAT( arg_idx ) \ + __attribute__((__format_arg__ (arg_idx))) +#define G_GNUC_NORETURN \ + __attribute__((__noreturn__)) +#define G_GNUC_CONST \ + __attribute__((__const__)) +#define G_GNUC_UNUSED \ + __attribute__((__unused__)) +#define G_GNUC_NO_INSTRUMENT \ + __attribute__((__no_instrument_function__)) +#else /* !__GNUC__ */ +#define G_GNUC_PRINTF( format_idx, arg_idx ) +#define G_GNUC_SCANF( format_idx, arg_idx ) +#define G_GNUC_FORMAT( arg_idx ) +#define G_GNUC_NORETURN +#define G_GNUC_CONST +#define G_GNUC_UNUSED +#define G_GNUC_NO_INSTRUMENT +#endif /* !__GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define G_GNUC_DEPRECATED \ + __attribute__((__deprecated__)) +#else +#define G_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define G_GNUC_DEPRECATED_FOR(f) \ + __attribute__((deprecated("Use " #f " instead"))) +#else +#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# define G_GNUC_MAY_ALIAS __attribute__((may_alias)) +#else +# define G_GNUC_MAY_ALIAS +#endif + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define G_GNUC_WARN_UNUSED_RESULT \ + __attribute__((warn_unused_result)) +#else +#define G_GNUC_WARN_UNUSED_RESULT +#endif /* __GNUC__ */ + +#ifndef G_DISABLE_DEPRECATED +/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with + * macros, so we can refer to them as strings unconditionally. + * usage not-recommended since gcc-3.0 + */ +#if defined (__GNUC__) && (__GNUC__ < 3) +#define G_GNUC_FUNCTION __FUNCTION__ +#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else /* !__GNUC__ */ +#define G_GNUC_FUNCTION "" +#define G_GNUC_PRETTY_FUNCTION "" +#endif /* !__GNUC__ */ +#endif /* !G_DISABLE_DEPRECATED */ + +#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) +#define G_STRINGIFY_ARG(contents) #contents + +#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */ +#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2 +#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2) +#ifdef __COUNTER__ +#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] +#else +#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] +#endif +#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1])) +#endif + +/* Provide a string identifying the current code position */ +#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus) +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" +#else +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) +#endif + +/* Provide a string identifying the current function, non-concatenatable */ +#if defined (__GNUC__) +# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L +# define G_STRFUNC ((const char*) (__func__)) +#else +# define G_STRFUNC ((const char*) ("???")) +#endif + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +# define G_BEGIN_DECLS extern "C" { +# define G_END_DECLS } +#else +# define G_BEGIN_DECLS +# define G_END_DECLS +#endif + +/* Provide definitions for some commonly used macros. + * Some of them are only provided if they haven't already + * been defined. It is assumed that if they are already + * defined then the current definition is correct. + */ +#ifndef NULL +# ifdef __cplusplus +# define NULL (0L) +# else /* !__cplusplus */ +# define NULL ((void*) 0) +# endif /* !__cplusplus */ +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +#undef CLAMP +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) + +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) + +/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT + */ +#define GPOINTER_TO_SIZE(p) ((gsize) (p)) +#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s)) + +/* Provide convenience macros for handling structure + * fields through their offsets. + */ + +#if defined(__GNUC__) && __GNUC__ >= 4 +# define G_STRUCT_OFFSET(struct_type, member) \ + ((glong) offsetof (struct_type, member)) +#else +# define G_STRUCT_OFFSET(struct_type, member) \ + ((glong) ((guint8*) &((struct_type*) 0)->member)) +#endif + +#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) +#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +/* Provide simple macro statement wrappers: + * G_STMT_START { statements; } G_STMT_END; + * This can be used as a single statement, like: + * if (x) G_STMT_START { ... } G_STMT_END; else ... + * This intentionally does not use compiler extensions like GCC's '({...})' to + * avoid portability issue or side effects when compiled with different compilers. + */ +#if !(defined (G_STMT_START) && defined (G_STMT_END)) +# define G_STMT_START do +# define G_STMT_END while (0) +#endif + +/* Deprecated -- do not use. */ +#ifndef G_DISABLE_DEPRECATED +#ifdef G_DISABLE_CONST_RETURNS +#define G_CONST_RETURN +#else +#define G_CONST_RETURN const +#endif +#endif + +/* + * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments in g_return_if_fail (). + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _G_BOOLEAN_EXPR(expr) \ + G_GNUC_EXTENSION ({ \ + int _g_boolean_var_; \ + if (expr) \ + _g_boolean_var_ = 1; \ + else \ + _g_boolean_var_ = 0; \ + _g_boolean_var_; \ +}) +#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) +#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0)) +#else +#define G_LIKELY(expr) (expr) +#define G_UNLIKELY(expr) (expr) +#endif + +#endif /* __G_MACROS_H__ */ diff --git a/deps/glib/gmain.c b/deps/glib/gmain.c new file mode 100644 index 0000000..7831c49 --- /dev/null +++ b/deps/glib/gmain.c @@ -0,0 +1,88 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * gmain.c: Main loop abstraction, timeouts, and idle functions + * Copyright 1998 Owen Taylor + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" +#include "glibconfig.h" + +#ifdef HAVE_SYS_TIME_H +#include +#endif /* HAVE_SYS_TIME_H */ + +#ifdef G_OS_WIN32 +#define STRICT +#include +#endif /* G_OS_WIN32 */ + +#include "gmessages.h" +#include "gmain.h" + +/** + * g_get_current_time: + * @result: #GTimeVal structure in which to store current time. + * + * Equivalent to the UNIX gettimeofday() function, but portable. + * + * You may find g_get_real_time() to be more convenient. + **/ +void +g_get_current_time (GTimeVal *result) +{ +#ifndef G_OS_WIN32 + struct timeval r; + + g_return_if_fail (result != NULL); + + /*this is required on alpha, there the timeval structs are int's + not longs and a cast only would fail horribly*/ + gettimeofday (&r, NULL); + result->tv_sec = r.tv_sec; + result->tv_usec = r.tv_usec; +#else + FILETIME ft; + guint64 time64; + + g_return_if_fail (result != NULL); + + GetSystemTimeAsFileTime (&ft); + memmove (&time64, &ft, sizeof (FILETIME)); + + /* Convert from 100s of nanoseconds since 1601-01-01 + * to Unix epoch. Yes, this is Y2038 unsafe. + */ + time64 -= G_GINT64_CONSTANT (116444736000000000); + time64 /= 10; + + result->tv_sec = time64 / 1000000; + result->tv_usec = time64 % 1000000; +#endif +} diff --git a/deps/glib/gmain.h b/deps/glib/gmain.h new file mode 100644 index 0000000..293f33c --- /dev/null +++ b/deps/glib/gmain.h @@ -0,0 +1,37 @@ +/* gmain.h - the GLib Main loop + * Copyright (C) 1998-2000 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_MAIN_H__ +#define __G_MAIN_H__ + +#include + +G_BEGIN_DECLS + +/* Miscellaneous functions + */ +void g_get_current_time (GTimeVal *result); + +G_END_DECLS + +#endif /* __G_MAIN_H__ */ diff --git a/deps/glib/gmem.c b/deps/glib/gmem.c new file mode 100644 index 0000000..a657f73 --- /dev/null +++ b/deps/glib/gmem.c @@ -0,0 +1,1397 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include "gmem.h" + +#include +#include +#include + +#include "gbacktrace.h" +#include "gtestutils.h" +#include "gthread.h" +#include "glib_trace.h" + + +#define MEM_PROFILE_TABLE_SIZE 4096 + + +/* notes on macros: + * having G_DISABLE_CHECKS defined disables use of glib_mem_profiler_table and + * g_mem_profile(). + * REALLOC_0_WORKS is defined if g_realloc (NULL, x) works. + * SANE_MALLOC_PROTOS is defined if the systems malloc() and friends functions + * match the corresponding GLib prototypes, keep configure.ac and gmem.h in sync here. + * g_mem_gc_friendly is TRUE, freed memory should be 0-wiped. + */ + +/* --- prototypes --- */ +static gboolean g_mem_initialized = FALSE; +static void g_mem_init_nomessage (void); + + +/* --- malloc wrappers --- */ +#ifndef REALLOC_0_WORKS +static gpointer +standard_realloc (gpointer mem, + gsize n_bytes) +{ + if (!mem) + return malloc (n_bytes); + else + return realloc (mem, n_bytes); +} +#endif /* !REALLOC_0_WORKS */ + +#ifdef SANE_MALLOC_PROTOS +# define standard_malloc malloc +# ifdef REALLOC_0_WORKS +# define standard_realloc realloc +# endif /* REALLOC_0_WORKS */ +# define standard_free free +# define standard_calloc calloc +# define standard_try_malloc malloc +# define standard_try_realloc realloc +#else /* !SANE_MALLOC_PROTOS */ +static gpointer +standard_malloc (gsize n_bytes) +{ + return malloc (n_bytes); +} +# ifdef REALLOC_0_WORKS +static gpointer +standard_realloc (gpointer mem, + gsize n_bytes) +{ + return realloc (mem, n_bytes); +} +# endif /* REALLOC_0_WORKS */ +static void +standard_free (gpointer mem) +{ + free (mem); +} +static gpointer +standard_calloc (gsize n_blocks, + gsize n_bytes) +{ + return calloc (n_blocks, n_bytes); +} +#define standard_try_malloc standard_malloc +#define standard_try_realloc standard_realloc +#endif /* !SANE_MALLOC_PROTOS */ + + +/* --- variables --- */ +static GMemVTable glib_mem_vtable = { + standard_malloc, + standard_realloc, + standard_free, + standard_calloc, + standard_try_malloc, + standard_try_realloc, +}; + +/** + * SECTION:memory + * @Short_Description: general memory-handling + * @Title: Memory Allocation + * + * These functions provide support for allocating and freeing memory. + * + * + * If any call to allocate memory fails, the application is terminated. + * This also means that there is no need to check if the call succeeded. + * + * + * + * It's important to match g_malloc() with g_free(), plain malloc() with free(), + * and (if you're using C++) new with delete and new[] with delete[]. Otherwise + * bad things can happen, since these allocators may use different memory + * pools (and new/delete call constructors and destructors). See also + * g_mem_set_vtable(). + * + */ + +/* --- functions --- */ +/** + * g_malloc: + * @n_bytes: the number of bytes to allocate + * + * Allocates @n_bytes bytes of memory. + * If @n_bytes is 0 it returns %NULL. + * + * Returns: a pointer to the allocated memory + */ +gpointer +g_malloc (gsize n_bytes) +{ + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + { + gpointer mem; + + mem = glib_mem_vtable.malloc (n_bytes); + TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 0, 0)); + if (mem) + return mem; + + g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_bytes); + } + + TRACE(GLIB_MEM_ALLOC((void*) NULL, (int) n_bytes, 0, 0)); + + return NULL; +} + +/** + * g_malloc0: + * @n_bytes: the number of bytes to allocate + * + * Allocates @n_bytes bytes of memory, initialized to 0's. + * If @n_bytes is 0 it returns %NULL. + * + * Returns: a pointer to the allocated memory + */ +gpointer +g_malloc0 (gsize n_bytes) +{ + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + { + gpointer mem; + + mem = glib_mem_vtable.calloc (1, n_bytes); + TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 1, 0)); + if (mem) + return mem; + + g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_bytes); + } + + TRACE(GLIB_MEM_ALLOC((void*) NULL, (int) n_bytes, 1, 0)); + + return NULL; +} + +/** + * g_realloc: + * @mem: the memory to reallocate + * @n_bytes: new size of the memory in bytes + * + * Reallocates the memory pointed to by @mem, so that it now has space for + * @n_bytes bytes of memory. It returns the new address of the memory, which may + * have been moved. @mem may be %NULL, in which case it's considered to + * have zero-length. @n_bytes may be 0, in which case %NULL will be returned + * and @mem will be freed unless it is %NULL. + * + * Returns: the new address of the allocated memory + */ +gpointer +g_realloc (gpointer mem, + gsize n_bytes) +{ + gpointer newmem; + + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + { + newmem = glib_mem_vtable.realloc (mem, n_bytes); + TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 0)); + if (newmem) + return newmem; + + g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_bytes); + } + + if (mem) + glib_mem_vtable.free (mem); + + TRACE (GLIB_MEM_REALLOC((void*) NULL, (void*)mem, 0, 0)); + + return NULL; +} + +/** + * g_free: + * @mem: the memory to free + * + * Frees the memory pointed to by @mem. + * If @mem is %NULL it simply returns. + */ +void +g_free (gpointer mem) +{ + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (mem)) + glib_mem_vtable.free (mem); + TRACE(GLIB_MEM_FREE((void*) mem)); +} + +/** + * g_try_malloc: + * @n_bytes: number of bytes to allocate. + * + * Attempts to allocate @n_bytes, and returns %NULL on failure. + * Contrast with g_malloc(), which aborts the program on failure. + * + * Returns: the allocated memory, or %NULL. + */ +gpointer +g_try_malloc (gsize n_bytes) +{ + gpointer mem; + + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + mem = glib_mem_vtable.try_malloc (n_bytes); + else + mem = NULL; + + TRACE (GLIB_MEM_ALLOC((void*) mem, (unsigned int) n_bytes, 0, 1)); + + return mem; +} + +/** + * g_try_malloc0: + * @n_bytes: number of bytes to allocate + * + * Attempts to allocate @n_bytes, initialized to 0's, and returns %NULL on + * failure. Contrast with g_malloc0(), which aborts the program on failure. + * + * Since: 2.8 + * Returns: the allocated memory, or %NULL + */ +gpointer +g_try_malloc0 (gsize n_bytes) +{ + gpointer mem; + + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + mem = glib_mem_vtable.try_malloc (n_bytes); + else + mem = NULL; + + if (mem) + memset (mem, 0, n_bytes); + + return mem; +} + +/** + * g_try_realloc: + * @mem: previously-allocated memory, or %NULL. + * @n_bytes: number of bytes to allocate. + * + * Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL + * on failure. Contrast with g_realloc(), which aborts the program + * on failure. If @mem is %NULL, behaves the same as g_try_malloc(). + * + * Returns: the allocated memory, or %NULL. + */ +gpointer +g_try_realloc (gpointer mem, + gsize n_bytes) +{ + gpointer newmem; + + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + if (G_LIKELY (n_bytes)) + newmem = glib_mem_vtable.try_realloc (mem, n_bytes); + else + { + newmem = NULL; + if (mem) + glib_mem_vtable.free (mem); + } + + TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 1)); + + return newmem; +} + + +#define SIZE_OVERFLOWS(a,b) (G_UNLIKELY ((b) > 0 && (a) > G_MAXSIZE / (b))) + +/** + * g_malloc_n: + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_malloc(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: a pointer to the allocated memory + */ +gpointer +g_malloc_n (gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + { + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + + g_error ("%s: overflow allocating %"G_GSIZE_FORMAT"*%"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_blocks, n_block_bytes); + } + + return g_malloc (n_blocks * n_block_bytes); +} + +/** + * g_malloc0_n: + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: a pointer to the allocated memory + */ +gpointer +g_malloc0_n (gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + { + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + + g_error ("%s: overflow allocating %"G_GSIZE_FORMAT"*%"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_blocks, n_block_bytes); + } + + return g_malloc0 (n_blocks * n_block_bytes); +} + +/** + * g_realloc_n: + * @mem: the memory to reallocate + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_realloc(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: the new address of the allocated memory + */ +gpointer +g_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + { + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + + g_error ("%s: overflow allocating %"G_GSIZE_FORMAT"*%"G_GSIZE_FORMAT" bytes", + G_STRLOC, n_blocks, n_block_bytes); + } + + return g_realloc (mem, n_blocks * n_block_bytes); +} + +/** + * g_try_malloc_n: + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_try_malloc(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: the allocated memory, or %NULL. + */ +gpointer +g_try_malloc_n (gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + return NULL; + + return g_try_malloc (n_blocks * n_block_bytes); +} + +/** + * g_try_malloc0_n: + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_try_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: the allocated memory, or %NULL + */ +gpointer +g_try_malloc0_n (gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + return NULL; + + return g_try_malloc0 (n_blocks * n_block_bytes); +} + +/** + * g_try_realloc_n: + * @mem: previously-allocated memory, or %NULL. + * @n_blocks: the number of blocks to allocate + * @n_block_bytes: the size of each block in bytes + * + * This function is similar to g_try_realloc(), allocating (@n_blocks * @n_block_bytes) bytes, + * but care is taken to detect possible overflow during multiplication. + * + * Since: 2.24 + * Returns: the allocated memory, or %NULL. + */ +gpointer +g_try_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) + return NULL; + + return g_try_realloc (mem, n_blocks * n_block_bytes); +} + + + +static gpointer +fallback_calloc (gsize n_blocks, + gsize n_block_bytes) +{ + gsize l = n_blocks * n_block_bytes; + gpointer mem = glib_mem_vtable.malloc (l); + + if (mem) + memset (mem, 0, l); + + return mem; +} + +static gboolean vtable_set = FALSE; + +/** + * g_mem_is_system_malloc + * + * Checks whether the allocator used by g_malloc() is the system's + * malloc implementation. If it returns %TRUE memory allocated with + * malloc() can be used interchangeable with memory allocated using g_malloc(). + * This function is useful for avoiding an extra copy of allocated memory returned + * by a non-GLib-based API. + * + * A different allocator can be set using g_mem_set_vtable(). + * + * Return value: if %TRUE, malloc() and g_malloc() can be mixed. + **/ +gboolean +g_mem_is_system_malloc (void) +{ + return !vtable_set; +} + +/** + * g_mem_set_vtable: + * @vtable: table of memory allocation routines. + * + * Sets the #GMemVTable to use for memory allocation. You can use this to provide + * custom memory allocation routines. This function must be called + * before using any other GLib functions. The @vtable only needs to + * provide malloc(), realloc(), and free() functions; GLib can provide default + * implementations of the others. The malloc() and realloc() implementations + * should return %NULL on failure, GLib will handle error-checking for you. + * @vtable is copied, so need not persist after this function has been called. + */ +void +g_mem_set_vtable (GMemVTable *vtable) +{ + if (!vtable_set) + { + if (vtable->malloc && vtable->realloc && vtable->free) + { + glib_mem_vtable.malloc = vtable->malloc; + glib_mem_vtable.realloc = vtable->realloc; + glib_mem_vtable.free = vtable->free; + glib_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc; + glib_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : glib_mem_vtable.malloc; + glib_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : glib_mem_vtable.realloc; + vtable_set = TRUE; + } + else + g_warning (G_STRLOC ": memory allocation vtable lacks one of malloc(), realloc() or free()"); + } + else + g_warning (G_STRLOC ": memory allocation vtable can only be set once at startup"); +} + + +/* --- memory profiling and checking --- */ +#ifdef G_DISABLE_CHECKS +/** + * glib_mem_profiler_table: + * + * A #GMemVTable containing profiling variants of the memory + * allocation functions. Use them together with g_mem_profile() + * in order to get information about the memory allocation pattern + * of your program. + */ +GMemVTable *glib_mem_profiler_table = &glib_mem_vtable; +void +g_mem_profile (void) +{ +} +#else /* !G_DISABLE_CHECKS */ +typedef enum { + PROFILER_FREE = 0, + PROFILER_ALLOC = 1, + PROFILER_RELOC = 2, + PROFILER_ZINIT = 4 +} ProfilerJob; +static guint *profile_data = NULL; +static gsize profile_allocs = 0; +static gsize profile_zinit = 0; +static gsize profile_frees = 0; +static GMutex *gmem_profile_mutex = NULL; +#ifdef G_ENABLE_DEBUG +static volatile gsize g_trap_free_size = 0; +static volatile gsize g_trap_realloc_size = 0; +static volatile gsize g_trap_malloc_size = 0; +#endif /* G_ENABLE_DEBUG */ + +#define PROFILE_TABLE(f1,f2,f3) ( ( ((f3) << 2) | ((f2) << 1) | (f1) ) * (MEM_PROFILE_TABLE_SIZE + 1)) + +static void +profiler_log (ProfilerJob job, + gsize n_bytes, + gboolean success) +{ + g_mutex_lock (gmem_profile_mutex); + if (!profile_data) + { + profile_data = standard_calloc ((MEM_PROFILE_TABLE_SIZE + 1) * 8, + sizeof (profile_data[0])); + if (!profile_data) /* memory system kiddin' me, eh? */ + { + g_mutex_unlock (gmem_profile_mutex); + return; + } + } + + if (n_bytes < MEM_PROFILE_TABLE_SIZE) + profile_data[n_bytes + PROFILE_TABLE ((job & PROFILER_ALLOC) != 0, + (job & PROFILER_RELOC) != 0, + success != 0)] += 1; + else + profile_data[MEM_PROFILE_TABLE_SIZE + PROFILE_TABLE ((job & PROFILER_ALLOC) != 0, + (job & PROFILER_RELOC) != 0, + success != 0)] += 1; + if (success) + { + if (job & PROFILER_ALLOC) + { + profile_allocs += n_bytes; + if (job & PROFILER_ZINIT) + profile_zinit += n_bytes; + } + else + profile_frees += n_bytes; + } + g_mutex_unlock (gmem_profile_mutex); +} + +static void +profile_print_locked (guint *local_data, + gboolean success) +{ + gboolean need_header = TRUE; + guint i; + + for (i = 0; i <= MEM_PROFILE_TABLE_SIZE; i++) + { + glong t_malloc = local_data[i + PROFILE_TABLE (1, 0, success)]; + glong t_realloc = local_data[i + PROFILE_TABLE (1, 1, success)]; + glong t_free = local_data[i + PROFILE_TABLE (0, 0, success)]; + glong t_refree = local_data[i + PROFILE_TABLE (0, 1, success)]; + + if (!t_malloc && !t_realloc && !t_free && !t_refree) + continue; + else if (need_header) + { + need_header = FALSE; + g_print (" blocks of | allocated | freed | allocated | freed | n_bytes \n"); + g_print (" n_bytes | n_times by | n_times by | n_times by | n_times by | remaining \n"); + g_print (" | malloc() | free() | realloc() | realloc() | \n"); + g_print ("===========|============|============|============|============|===========\n"); + } + if (i < MEM_PROFILE_TABLE_SIZE) + g_print ("%10u | %10ld | %10ld | %10ld | %10ld |%+11ld\n", + i, t_malloc, t_free, t_realloc, t_refree, + (t_malloc - t_free + t_realloc - t_refree) * i); + else if (i >= MEM_PROFILE_TABLE_SIZE) + g_print (" >%6u | %10ld | %10ld | %10ld | %10ld | ***\n", + i, t_malloc, t_free, t_realloc, t_refree); + } + if (need_header) + g_print (" --- none ---\n"); +} + +/** + * g_mem_profile: + * @void: + * + * Outputs a summary of memory usage. + * + * It outputs the frequency of allocations of different sizes, + * the total number of bytes which have been allocated, + * the total number of bytes which have been freed, + * and the difference between the previous two values, i.e. the number of bytes + * still in use. + * + * Note that this function will not output anything unless you have + * previously installed the #glib_mem_profiler_table with g_mem_set_vtable(). + */ + +void +g_mem_profile (void) +{ + guint local_data[(MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])]; + gsize local_allocs; + gsize local_zinit; + gsize local_frees; + + if (G_UNLIKELY (!g_mem_initialized)) + g_mem_init_nomessage(); + + g_mutex_lock (gmem_profile_mutex); + + local_allocs = profile_allocs; + local_zinit = profile_zinit; + local_frees = profile_frees; + + if (!profile_data) + { + g_mutex_unlock (gmem_profile_mutex); + return; + } + + memcpy (local_data, profile_data, + (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])); + + g_mutex_unlock (gmem_profile_mutex); + + g_print ("GLib Memory statistics (successful operations):\n"); + profile_print_locked (local_data, TRUE); + g_print ("GLib Memory statistics (failing operations):\n"); + profile_print_locked (local_data, FALSE); + g_print ("Total bytes: allocated=%"G_GSIZE_FORMAT", " + "zero-initialized=%"G_GSIZE_FORMAT" (%.2f%%), " + "freed=%"G_GSIZE_FORMAT" (%.2f%%), " + "remaining=%"G_GSIZE_FORMAT"\n", + local_allocs, + local_zinit, + ((gdouble) local_zinit) / local_allocs * 100.0, + local_frees, + ((gdouble) local_frees) / local_allocs * 100.0, + local_allocs - local_frees); +} + +static gpointer +profiler_try_malloc (gsize n_bytes) +{ + gsize *p; + +#ifdef G_ENABLE_DEBUG + if (g_trap_malloc_size == n_bytes) + G_BREAKPOINT (); +#endif /* G_ENABLE_DEBUG */ + + p = standard_malloc (sizeof (gsize) * 2 + n_bytes); + + if (p) + { + p[0] = 0; /* free count */ + p[1] = n_bytes; /* length */ + profiler_log (PROFILER_ALLOC, n_bytes, TRUE); + p += 2; + } + else + profiler_log (PROFILER_ALLOC, n_bytes, FALSE); + + return p; +} + +static gpointer +profiler_malloc (gsize n_bytes) +{ + gpointer mem = profiler_try_malloc (n_bytes); + + if (!mem) + g_mem_profile (); + + return mem; +} + +static gpointer +profiler_calloc (gsize n_blocks, + gsize n_block_bytes) +{ + gsize l = n_blocks * n_block_bytes; + gsize *p; + +#ifdef G_ENABLE_DEBUG + if (g_trap_malloc_size == l) + G_BREAKPOINT (); +#endif /* G_ENABLE_DEBUG */ + + p = standard_calloc (1, sizeof (gsize) * 2 + l); + + if (p) + { + p[0] = 0; /* free count */ + p[1] = l; /* length */ + profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, TRUE); + p += 2; + } + else + { + profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, FALSE); + g_mem_profile (); + } + + return p; +} + +static void +profiler_free (gpointer mem) +{ + gsize *p = mem; + + p -= 2; + if (p[0]) /* free count */ + { + g_warning ("free(%p): memory has been freed %"G_GSIZE_FORMAT" times already", + p + 2, p[0]); + profiler_log (PROFILER_FREE, + p[1], /* length */ + FALSE); + } + else + { +#ifdef G_ENABLE_DEBUG + if (g_trap_free_size == p[1]) + G_BREAKPOINT (); +#endif /* G_ENABLE_DEBUG */ + + profiler_log (PROFILER_FREE, + p[1], /* length */ + TRUE); + memset (p + 2, 0xaa, p[1]); + + /* for all those that miss standard_free (p); in this place, yes, + * we do leak all memory when profiling, and that is intentional + * to catch double frees. patch submissions are futile. + */ + } + p[0] += 1; +} + +static gpointer +profiler_try_realloc (gpointer mem, + gsize n_bytes) +{ + gsize *p = mem; + + p -= 2; + +#ifdef G_ENABLE_DEBUG + if (g_trap_realloc_size == n_bytes) + G_BREAKPOINT (); +#endif /* G_ENABLE_DEBUG */ + + if (mem && p[0]) /* free count */ + { + g_warning ("realloc(%p, %"G_GSIZE_FORMAT"): " + "memory has been freed %"G_GSIZE_FORMAT" times already", + p + 2, (gsize) n_bytes, p[0]); + profiler_log (PROFILER_ALLOC | PROFILER_RELOC, n_bytes, FALSE); + + return NULL; + } + else + { + p = standard_realloc (mem ? p : NULL, sizeof (gsize) * 2 + n_bytes); + + if (p) + { + if (mem) + profiler_log (PROFILER_FREE | PROFILER_RELOC, p[1], TRUE); + p[0] = 0; + p[1] = n_bytes; + profiler_log (PROFILER_ALLOC | PROFILER_RELOC, p[1], TRUE); + p += 2; + } + else + profiler_log (PROFILER_ALLOC | PROFILER_RELOC, n_bytes, FALSE); + + return p; + } +} + +static gpointer +profiler_realloc (gpointer mem, + gsize n_bytes) +{ + mem = profiler_try_realloc (mem, n_bytes); + + if (!mem) + g_mem_profile (); + + return mem; +} + +static GMemVTable profiler_table = { + profiler_malloc, + profiler_realloc, + profiler_free, + profiler_calloc, + profiler_try_malloc, + profiler_try_realloc, +}; +GMemVTable *glib_mem_profiler_table = &profiler_table; + +#endif /* !G_DISABLE_CHECKS */ + +/* --- MemChunks --- */ +/** + * SECTION:allocators + * @title: Memory Allocators + * @short_description: deprecated way to allocate chunks of memory for + * GList, GSList and GNode + * + * Prior to 2.10, #GAllocator was used as an efficient way to allocate + * small pieces of memory for use with the #GList, #GSList and #GNode + * data structures. Since 2.10, it has been completely replaced by the + * slice allocator and + * deprecated. + **/ + +/** + * SECTION:memory_chunks + * @title: Memory Chunks + * @short_description: deprecated way to allocate groups of equal-sized + * chunks of memory + * + * Memory chunks provide an space-efficient way to allocate equal-sized + * pieces of memory, called atoms. However, due to the administrative + * overhead (in particular for #G_ALLOC_AND_FREE, and when used from + * multiple threads), they are in practise often slower than direct use + * of g_malloc(). Therefore, memory chunks have been deprecated in + * favor of the slice + * allocator, which has been added in 2.10. All internal uses of + * memory chunks in GLib have been converted to the + * g_slice API. + * + * There are two types of memory chunks, #G_ALLOC_ONLY, and + * #G_ALLOC_AND_FREE. #G_ALLOC_ONLY + * chunks only allow allocation of atoms. The atoms can never be freed + * individually. The memory chunk can only be free in its entirety. + * #G_ALLOC_AND_FREE chunks do + * allow atoms to be freed individually. The disadvantage of this is + * that the memory chunk has to keep track of which atoms have been + * freed. This results in more memory being used and a slight + * degradation in performance. + * + * To create a memory chunk use g_mem_chunk_new() or the convenience + * macro g_mem_chunk_create(). + * + * To allocate a new atom use g_mem_chunk_alloc(), + * g_mem_chunk_alloc0(), or the convenience macros g_chunk_new() or + * g_chunk_new0(). + * + * To free an atom use g_mem_chunk_free(), or the convenience macro + * g_chunk_free(). (Atoms can only be freed if the memory chunk is + * created with the type set to #G_ALLOC_AND_FREE.) + * + * To free any blocks of memory which are no longer being used, use + * g_mem_chunk_clean(). To clean all memory chunks, use g_blow_chunks(). + * + * To reset the memory chunk, freeing all of the atoms, use + * g_mem_chunk_reset(). + * + * To destroy a memory chunk, use g_mem_chunk_destroy(). + * + * To help debug memory chunks, use g_mem_chunk_info() and + * g_mem_chunk_print(). + * + * + * Using a #GMemChunk + * + * GMemChunk *mem_chunk; + * gchar *mem[10000]; + * gint i; + * + * /* Create a GMemChunk with atoms 50 bytes long, and memory + * blocks holding 100 bytes. Note that this means that only 2 atoms + * fit into each memory block and so isn't very efficient. */ + * mem_chunk = g_mem_chunk_new ("test mem chunk", 50, 100, G_ALLOC_AND_FREE); + * /* Now allocate 10000 atoms. */ + * for (i = 0; i < 10000; i++) + * { + * mem[i] = g_chunk_new (gchar, mem_chunk); + * /* Fill in the atom memory with some junk. */ + * for (j = 0; j < 50; j++) + * mem[i][j] = i * j; + * } + * /* Now free all of the atoms. Note that since we are going to + * destroy the GMemChunk, this wouldn't normally be used. */ + * for (i = 0; i < 10000; i++) + * { + * g_mem_chunk_free (mem_chunk, mem[i]); + * } + * /* We are finished with the GMemChunk, so we destroy it. */ + * g_mem_chunk_destroy (mem_chunk); + * + * + * + * + * Using a #GMemChunk with data structures + * + * GMemChunk *array_mem_chunk; + * GRealArray *array; + * /* Create a GMemChunk to hold GRealArray structures, using + * the g_mem_chunk_create() convenience macro. We want 1024 atoms in each + * memory block, and we want to be able to free individual atoms. */ + * array_mem_chunk = g_mem_chunk_create (GRealArray, 1024, G_ALLOC_AND_FREE); + * /* Allocate one atom, using the g_chunk_new() convenience macro. */ + * array = g_chunk_new (GRealArray, array_mem_chunk); + * /* We can now use array just like a normal pointer to a structure. */ + * array->data = NULL; + * array->len = 0; + * array->alloc = 0; + * array->zero_terminated = (zero_terminated ? 1 : 0); + * array->clear = (clear ? 1 : 0); + * array->elt_size = elt_size; + * /* We can free the element, so it can be reused. */ + * g_chunk_free (array, array_mem_chunk); + * /* We destroy the GMemChunk when we are finished with it. */ + * g_mem_chunk_destroy (array_mem_chunk); + * + * + **/ + +#ifndef G_ALLOC_AND_FREE + +/** + * GAllocator: + * + * The #GAllocator struct contains private data. and should only be + * accessed using the following functions. + **/ +typedef struct _GAllocator GAllocator; + +/** + * GMemChunk: + * + * The #GMemChunk struct is an opaque data structure representing a + * memory chunk. It should be accessed only through the use of the + * following functions. + **/ +typedef struct _GMemChunk GMemChunk; + +/** + * G_ALLOC_ONLY: + * + * Specifies the type of a #GMemChunk. Used in g_mem_chunk_new() and + * g_mem_chunk_create() to specify that atoms will never be freed + * individually. + **/ +#define G_ALLOC_ONLY 1 + +/** + * G_ALLOC_AND_FREE: + * + * Specifies the type of a #GMemChunk. Used in g_mem_chunk_new() and + * g_mem_chunk_create() to specify that atoms will be freed + * individually. + **/ +#define G_ALLOC_AND_FREE 2 +#endif + +struct _GMemChunk { + guint alloc_size; /* the size of an atom */ +}; + +/** + * g_mem_chunk_new: + * @name: a string to identify the #GMemChunk. It is not copied so it + * should be valid for the lifetime of the #GMemChunk. It is + * only used in g_mem_chunk_print(), which is used for debugging. + * @atom_size: the size, in bytes, of each element in the #GMemChunk. + * @area_size: the size, in bytes, of each block of memory allocated to + * contain the atoms. + * @type: the type of the #GMemChunk. #G_ALLOC_AND_FREE is used if the + * atoms will be freed individually. #G_ALLOC_ONLY should be + * used if atoms will never be freed individually. + * #G_ALLOC_ONLY is quicker, since it does not need to track + * free atoms, but it obviously wastes memory if you no longer + * need many of the atoms. + * @Returns: the new #GMemChunk. + * + * Creates a new #GMemChunk. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +GMemChunk* +g_mem_chunk_new (const gchar *name, + gint atom_size, + gsize area_size, + gint type) +{ + GMemChunk *mem_chunk; + g_return_val_if_fail (atom_size > 0, NULL); + + mem_chunk = g_slice_new (GMemChunk); + mem_chunk->alloc_size = atom_size; + return mem_chunk; +} + +/** + * g_mem_chunk_destroy: + * @mem_chunk: a #GMemChunk. + * + * Frees all of the memory allocated for a #GMemChunk. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void +g_mem_chunk_destroy (GMemChunk *mem_chunk) +{ + g_return_if_fail (mem_chunk != NULL); + + g_slice_free (GMemChunk, mem_chunk); +} + +/** + * g_mem_chunk_alloc: + * @mem_chunk: a #GMemChunk. + * @Returns: a pointer to the allocated atom. + * + * Allocates an atom of memory from a #GMemChunk. + * + * Deprecated:2.10: Use g_slice_alloc() instead + **/ +gpointer +g_mem_chunk_alloc (GMemChunk *mem_chunk) +{ + g_return_val_if_fail (mem_chunk != NULL, NULL); + + return g_slice_alloc (mem_chunk->alloc_size); +} + +/** + * g_mem_chunk_alloc0: + * @mem_chunk: a #GMemChunk. + * @Returns: a pointer to the allocated atom. + * + * Allocates an atom of memory from a #GMemChunk, setting the memory to + * 0. + * + * Deprecated:2.10: Use g_slice_alloc0() instead + **/ +gpointer +g_mem_chunk_alloc0 (GMemChunk *mem_chunk) +{ + g_return_val_if_fail (mem_chunk != NULL, NULL); + + return g_slice_alloc0 (mem_chunk->alloc_size); +} + +/** + * g_mem_chunk_free: + * @mem_chunk: a #GMemChunk. + * @mem: a pointer to the atom to free. + * + * Frees an atom in a #GMemChunk. This should only be called if the + * #GMemChunk was created with #G_ALLOC_AND_FREE. Otherwise it will + * simply return. + * + * Deprecated:2.10: Use g_slice_free1() instead + **/ +void +g_mem_chunk_free (GMemChunk *mem_chunk, + gpointer mem) +{ + g_return_if_fail (mem_chunk != NULL); + + g_slice_free1 (mem_chunk->alloc_size, mem); +} + +/** + * g_mem_chunk_clean: + * @mem_chunk: a #GMemChunk. + * + * Frees any blocks in a #GMemChunk which are no longer being used. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void g_mem_chunk_clean (GMemChunk *mem_chunk) {} + +/** + * g_mem_chunk_reset: + * @mem_chunk: a #GMemChunk. + * + * Resets a GMemChunk to its initial state. It frees all of the + * currently allocated blocks of memory. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void g_mem_chunk_reset (GMemChunk *mem_chunk) {} + + +/** + * g_mem_chunk_print: + * @mem_chunk: a #GMemChunk. + * + * Outputs debugging information for a #GMemChunk. It outputs the name + * of the #GMemChunk (set with g_mem_chunk_new()), the number of bytes + * used, and the number of blocks of memory allocated. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void g_mem_chunk_print (GMemChunk *mem_chunk) {} + + +/** + * g_mem_chunk_info: + * + * Outputs debugging information for all #GMemChunk objects currently + * in use. It outputs the number of #GMemChunk objects currently + * allocated, and calls g_mem_chunk_print() to output information on + * each one. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void g_mem_chunk_info (void) {} + +/** + * g_blow_chunks: + * + * Calls g_mem_chunk_clean() on all #GMemChunk objects. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void g_blow_chunks (void) {} + +/** + * g_chunk_new0: + * @type: the type of the #GMemChunk atoms, typically a structure name. + * @chunk: a #GMemChunk. + * @Returns: a pointer to the allocated atom, cast to a pointer to + * @type. + * + * A convenience macro to allocate an atom of memory from a #GMemChunk. + * It calls g_mem_chunk_alloc0() and casts the returned atom to a + * pointer to the given type, avoiding a type cast in the source code. + * + * Deprecated:2.10: Use g_slice_new0() instead + **/ + +/** + * g_chunk_free: + * @mem: a pointer to the atom to be freed. + * @mem_chunk: a #GMemChunk. + * + * A convenience macro to free an atom of memory from a #GMemChunk. It + * simply switches the arguments and calls g_mem_chunk_free() It is + * included simply to complement the other convenience macros, + * g_chunk_new() and g_chunk_new0(). + * + * Deprecated:2.10: Use g_slice_free() instead + **/ + +/** + * g_chunk_new: + * @type: the type of the #GMemChunk atoms, typically a structure name. + * @chunk: a #GMemChunk. + * @Returns: a pointer to the allocated atom, cast to a pointer to + * @type. + * + * A convenience macro to allocate an atom of memory from a #GMemChunk. + * It calls g_mem_chunk_alloc() and casts the returned atom to a + * pointer to the given type, avoiding a type cast in the source code. + * + * Deprecated:2.10: Use g_slice_new() instead + **/ + +/** + * g_mem_chunk_create: + * @type: the type of the atoms, typically a structure name. + * @pre_alloc: the number of atoms to store in each block of memory. + * @alloc_type: the type of the #GMemChunk. #G_ALLOC_AND_FREE is used + * if the atoms will be freed individually. #G_ALLOC_ONLY + * should be used if atoms will never be freed + * individually. #G_ALLOC_ONLY is quicker, since it does + * not need to track free atoms, but it obviously wastes + * memory if you no longer need many of the atoms. + * @Returns: the new #GMemChunk. + * + * A convenience macro for creating a new #GMemChunk. It calls + * g_mem_chunk_new(), using the given type to create the #GMemChunk + * name. The atom size is determined using + * sizeof(), and the area size is calculated by + * multiplying the @pre_alloc parameter with the atom size. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ + + +/** + * g_allocator_new: + * @name: the name of the #GAllocator. This name is used to set the + * name of the #GMemChunk used by the #GAllocator, and is only + * used for debugging. + * @n_preallocs: the number of elements in each block of memory + * allocated. Larger blocks mean less calls to + * g_malloc(), but some memory may be wasted. (GLib uses + * 128 elements per block by default.) The value must be + * between 1 and 65535. + * @Returns: a new #GAllocator. + * + * Creates a new #GAllocator. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +GAllocator* +g_allocator_new (const gchar *name, + guint n_preallocs) +{ + static struct _GAllocator { + gchar *name; + guint16 n_preallocs; + guint is_unused : 1; + guint type : 4; + GAllocator *last; + GMemChunk *mem_chunk; + gpointer free_list; + } dummy = { + "GAllocator is deprecated", 1, TRUE, 0, NULL, NULL, NULL, + }; + /* some (broken) GAllocator uses depend on non-NULL allocators */ + return (void*) &dummy; +} + +/** + * g_allocator_free: + * @allocator: a #GAllocator. + * + * Frees all of the memory allocated by the #GAllocator. + * + * Deprecated:2.10: Use the slice + * allocator instead + **/ +void +g_allocator_free (GAllocator *allocator) +{ +} + +#ifdef ENABLE_GC_FRIENDLY_DEFAULT +gboolean g_mem_gc_friendly = TRUE; +#else +/** + * g_mem_gc_friendly: + * + * This variable is %TRUE if the G_DEBUG environment variable + * includes the key gc-friendly. + */ +gboolean g_mem_gc_friendly = FALSE; +#endif + +static void +g_mem_init_nomessage (void) +{ + gchar buffer[1024]; + const gchar *val; + const GDebugKey keys[] = { + { "gc-friendly", 1 }, + }; + gint flags; + if (g_mem_initialized) + return; + /* don't use g_malloc/g_message here */ + val = _g_getenv_nomalloc ("G_DEBUG", buffer); + flags = !val ? 0 : g_parse_debug_string (val, keys, G_N_ELEMENTS (keys)); + if (flags & 1) /* gc-friendly */ + { + g_mem_gc_friendly = TRUE; + } + g_mem_initialized = TRUE; +} + +void +_g_mem_thread_init_noprivate_nomessage (void) +{ + /* we may only create mutexes here, locking/ + * unlocking a mutex does not yet work. + */ + g_mem_init_nomessage(); +#ifndef G_DISABLE_CHECKS + gmem_profile_mutex = g_mutex_new (); +#endif +} diff --git a/deps/glib/gmem.h b/deps/glib/gmem.h new file mode 100644 index 0000000..a8ff4ac --- /dev/null +++ b/deps/glib/gmem.h @@ -0,0 +1,309 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_MEM_H__ +#define __G_MEM_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * GMemVTable: + * @malloc: function to use for allocating memory. + * @realloc: function to use for reallocating memory. + * @free: function to use to free memory. + * @calloc: function to use for allocating zero-filled memory. + * @try_malloc: function to use for allocating memory without a default error handler. + * @try_realloc: function to use for reallocating memory without a default error handler. + * + * A set of functions used to perform memory allocation. The same #GMemVTable must + * be used for all allocations in the same program; a call to g_mem_set_vtable(), + * if it exists, should be prior to any use of GLib. + */ +typedef struct _GMemVTable GMemVTable; + + +#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG +/** + * G_MEM_ALIGN: + * + * Indicates the number of bytes to which memory will be aligned on the + * current platform. + */ +# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P +#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ +# define G_MEM_ALIGN GLIB_SIZEOF_LONG +#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */ + + +/* Memory allocation functions + */ + +void g_free (gpointer mem); + +gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_realloc (gpointer mem, + gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; +gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_try_realloc (gpointer mem, + gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT; + +gpointer g_malloc_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +gpointer g_malloc0_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +gpointer g_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; +gpointer g_try_malloc_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +gpointer g_try_malloc0_n (gsize n_blocks, + gsize n_block_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE2(1,2); +gpointer g_try_realloc_n (gpointer mem, + gsize n_blocks, + gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; + + +/* Optimise: avoid the call to the (slower) _n function if we can + * determine at compile-time that no overflow happens. + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# define _G_NEW(struct_type, n_structs, func) \ + (struct_type *) (G_GNUC_EXTENSION ({ \ + gsize __n = (gsize) (n_structs); \ + gsize __s = sizeof (struct_type); \ + gpointer __p; \ + if (__s == 1) \ + __p = g_##func (__n); \ + else if (__builtin_constant_p (__n) && \ + (__s == 0 || __n <= G_MAXSIZE / __s)) \ + __p = g_##func (__n * __s); \ + else \ + __p = g_##func##_n (__n, __s); \ + __p; \ + })) +# define _G_RENEW(struct_type, mem, n_structs, func) \ + (struct_type *) (G_GNUC_EXTENSION ({ \ + gsize __n = (gsize) (n_structs); \ + gsize __s = sizeof (struct_type); \ + gpointer __p = (gpointer) (mem); \ + if (__s == 1) \ + __p = g_##func (__p, __n); \ + else if (__builtin_constant_p (__n) && \ + (__s == 0 || __n <= G_MAXSIZE / __s)) \ + __p = g_##func (__p, __n * __s); \ + else \ + __p = g_##func##_n (__p, __n, __s); \ + __p; \ + })) + +#else + +/* Unoptimised version: always call the _n() function. */ + +#define _G_NEW(struct_type, n_structs, func) \ + ((struct_type *) g_##func##_n ((n_structs), sizeof (struct_type))) +#define _G_RENEW(struct_type, mem, n_structs, func) \ + ((struct_type *) g_##func##_n (mem, (n_structs), sizeof (struct_type))) + +#endif + +/** + * g_new: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Allocates @n_structs elements of type @struct_type. + * The returned pointer is cast to a pointer to the given type. + * If @n_structs is 0 it returns %NULL. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Since the returned pointer is already casted to the right type, + * it is normally unnecessary to cast it explicitly, and doing + * so might hide memory allocation errors. + * + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc) +/** + * g_new0: + * @struct_type: the type of the elements to allocate. + * @n_structs: the number of elements to allocate. + * + * Allocates @n_structs elements of type @struct_type, initialized to 0's. + * The returned pointer is cast to a pointer to the given type. + * If @n_structs is 0 it returns %NULL. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Since the returned pointer is already casted to the right type, + * it is normally unnecessary to cast it explicitly, and doing + * so might hide memory allocation errors. + * + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type. + */ +#define g_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, malloc0) +/** + * g_renew: + * @struct_type: the type of the elements to allocate + * @mem: the currently allocated memory + * @n_structs: the number of elements to allocate + * + * Reallocates the memory pointed to by @mem, so that it now has space for + * @n_structs elements of type @struct_type. It returns the new address of + * the memory, which may have been moved. + * Care is taken to avoid overflow when calculating the size of the allocated block. + * + * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type + */ +#define g_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, realloc) +/** + * g_try_new: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Attempts to allocate @n_structs elements of type @struct_type, and returns + * %NULL on failure. Contrast with g_new(), which aborts the program on failure. + * The returned pointer is cast to a pointer to the given type. + * The function returns %NULL when @n_structs is 0 of if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_try_new(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc) +/** + * g_try_new0: + * @struct_type: the type of the elements to allocate + * @n_structs: the number of elements to allocate + * + * Attempts to allocate @n_structs elements of type @struct_type, initialized + * to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts + * the program on failure. + * The returned pointer is cast to a pointer to the given type. + * The function returns %NULL when @n_structs is 0 of if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the allocated memory, cast to a pointer to @struct_type + */ +#define g_try_new0(struct_type, n_structs) _G_NEW (struct_type, n_structs, try_malloc0) +/** + * g_try_renew: + * @struct_type: the type of the elements to allocate + * @mem: the currently allocated memory + * @n_structs: the number of elements to allocate + * + * Attempts to reallocate the memory pointed to by @mem, so that it now has + * space for @n_structs elements of type @struct_type, and returns %NULL on + * failure. Contrast with g_renew(), which aborts the program on failure. + * It returns the new address of the memory, which may have been moved. + * The function returns %NULL if an overflow occurs. + * + * Since: 2.8 + * Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type + */ +#define g_try_renew(struct_type, mem, n_structs) _G_RENEW (struct_type, mem, n_structs, try_realloc) + + +/* Memory allocation virtualization for debugging purposes + * g_mem_set_vtable() has to be the very first GLib function called + * if being used + */ +struct _GMemVTable { + gpointer (*malloc) (gsize n_bytes); + gpointer (*realloc) (gpointer mem, + gsize n_bytes); + void (*free) (gpointer mem); + /* optional; set to NULL if not used ! */ + gpointer (*calloc) (gsize n_blocks, + gsize n_block_bytes); + gpointer (*try_malloc) (gsize n_bytes); + gpointer (*try_realloc) (gpointer mem, + gsize n_bytes); +}; +void g_mem_set_vtable (GMemVTable *vtable); +gboolean g_mem_is_system_malloc (void); + +GLIB_VAR gboolean g_mem_gc_friendly; + +/* Memory profiler and checker, has to be enabled via g_mem_set_vtable() + */ +GLIB_VAR GMemVTable *glib_mem_profiler_table; +void g_mem_profile (void); + + +/* deprecated memchunks and allocators */ +#if !defined (G_DISABLE_DEPRECATED) || defined (GTK_COMPILATION) || defined (GDK_COMPILATION) +typedef struct _GAllocator GAllocator; +typedef struct _GMemChunk GMemChunk; +#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \ + g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \ + sizeof (type), \ + sizeof (type) * (pre_alloc), \ + (alloc_type)) \ +) +#define g_chunk_new(type, chunk) ( \ + (type *) g_mem_chunk_alloc (chunk) \ +) +#define g_chunk_new0(type, chunk) ( \ + (type *) g_mem_chunk_alloc0 (chunk) \ +) +#define g_chunk_free(mem, mem_chunk) G_STMT_START { \ + g_mem_chunk_free ((mem_chunk), (mem)); \ +} G_STMT_END +#define G_ALLOC_ONLY 1 +#define G_ALLOC_AND_FREE 2 +GMemChunk* g_mem_chunk_new (const gchar *name, + gint atom_size, + gsize area_size, + gint type); +void g_mem_chunk_destroy (GMemChunk *mem_chunk); +gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); +gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); +void g_mem_chunk_free (GMemChunk *mem_chunk, + gpointer mem); +void g_mem_chunk_clean (GMemChunk *mem_chunk); +void g_mem_chunk_reset (GMemChunk *mem_chunk); +void g_mem_chunk_print (GMemChunk *mem_chunk); +void g_mem_chunk_info (void); +void g_blow_chunks (void); +GAllocator*g_allocator_new (const gchar *name, + guint n_preallocs); +void g_allocator_free (GAllocator *allocator); +#define G_ALLOCATOR_LIST (1) +#define G_ALLOCATOR_SLIST (2) +#define G_ALLOCATOR_NODE (3) +#endif /* G_DISABLE_DEPRECATED */ + +G_END_DECLS + +#endif /* __G_MEM_H__ */ diff --git a/deps/glib/gmessages.c b/deps/glib/gmessages.c new file mode 100644 index 0000000..30a48eb --- /dev/null +++ b/deps/glib/gmessages.c @@ -0,0 +1,1084 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +/** + * SECTION:warnings + * @Title: Message Output and Debugging Functions + * @Short_description: functions to output messages and help debug applications + * + * These functions provide support for outputting messages. + * + * The g_return family of macros (g_return_if_fail(), + * g_return_val_if_fail(), g_return_if_reached(), g_return_val_if_reached()) + * should only be used for programming errors, a typical use case is + * checking for invalid parameters at the beginning of a public function. + * They should not be used if you just mean "if (error) return", they + * should only be used if you mean "if (bug in program) return". + * The program behavior is generally considered undefined after one + * of these checks fails. They are not intended for normal control + * flow, only to give a perhaps-helpful warning before giving up. + */ + +#include "config.h" + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include + +#include "gmessages.h" + +#include "gbacktrace.h" +#include "gconvert.h" +#include "gdebug.h" +#include "gmem.h" +#include "gprintfint.h" +#include "gtestutils.h" +#include "gthread.h" +#include "gthreadprivate.h" +#include "gstrfuncs.h" +#include "gstring.h" + +#ifdef G_OS_WIN32 +#include /* For getpid() */ +#include +# define STRICT /* Strict typing, please */ +# define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */ +# include +# undef STRICT +#endif + + +/* --- structures --- */ +typedef struct _GLogDomain GLogDomain; +typedef struct _GLogHandler GLogHandler; +struct _GLogDomain +{ + gchar *log_domain; + GLogLevelFlags fatal_mask; + GLogHandler *handlers; + GLogDomain *next; +}; +struct _GLogHandler +{ + guint id; + GLogLevelFlags log_level; + GLogFunc log_func; + gpointer data; + GLogHandler *next; +}; + + +/* --- variables --- */ +static GMutex *g_messages_lock = NULL; +static GLogDomain *g_log_domains = NULL; +static GLogLevelFlags g_log_always_fatal = G_LOG_FATAL_MASK; +static GPrintFunc glib_print_func = NULL; +static GPrintFunc glib_printerr_func = NULL; +static GPrivate *g_log_depth = NULL; +static GLogLevelFlags g_log_msg_prefix = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_DEBUG; +static GLogFunc default_log_func = g_log_default_handler; +static gpointer default_log_data = NULL; +static GTestLogFatalFunc fatal_log_func = NULL; +static gpointer fatal_log_data; + +/* --- functions --- */ +#ifdef G_OS_WIN32 +# define STRICT +# include +# undef STRICT +static gboolean win32_keep_fatal_message = FALSE; + +/* This default message will usually be overwritten. */ +/* Yes, a fixed size buffer is bad. So sue me. But g_error() is never + * called with huge strings, is it? + */ +static gchar fatal_msg_buf[1000] = "Unspecified fatal error encountered, aborting."; +static gchar *fatal_msg_ptr = fatal_msg_buf; + +#undef write +static inline int +dowrite (int fd, + const void *buf, + unsigned int len) +{ + if (win32_keep_fatal_message) + { + memcpy (fatal_msg_ptr, buf, len); + fatal_msg_ptr += len; + *fatal_msg_ptr = 0; + return len; + } + + write (fd, buf, len); + + return len; +} +#define write(fd, buf, len) dowrite(fd, buf, len) + +#endif + +static void +write_string (int fd, + const gchar *string) +{ + write (fd, string, strlen (string)); +} + +static void +g_messages_prefixed_init (void) +{ + static gboolean initialized = FALSE; + + if (!initialized) + { + const gchar *val; + + initialized = TRUE; + val = g_getenv ("G_MESSAGES_PREFIXED"); + + if (val) + { + const GDebugKey keys[] = { + { "error", G_LOG_LEVEL_ERROR }, + { "critical", G_LOG_LEVEL_CRITICAL }, + { "warning", G_LOG_LEVEL_WARNING }, + { "message", G_LOG_LEVEL_MESSAGE }, + { "info", G_LOG_LEVEL_INFO }, + { "debug", G_LOG_LEVEL_DEBUG } + }; + + g_log_msg_prefix = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys)); + } + } +} + +static GLogDomain* +g_log_find_domain_L (const gchar *log_domain) +{ + register GLogDomain *domain; + + domain = g_log_domains; + while (domain) + { + if (strcmp (domain->log_domain, log_domain) == 0) + return domain; + domain = domain->next; + } + return NULL; +} + +static GLogDomain* +g_log_domain_new_L (const gchar *log_domain) +{ + register GLogDomain *domain; + + domain = g_new (GLogDomain, 1); + domain->log_domain = g_strdup (log_domain); + domain->fatal_mask = G_LOG_FATAL_MASK; + domain->handlers = NULL; + + domain->next = g_log_domains; + g_log_domains = domain; + + return domain; +} + +static void +g_log_domain_check_free_L (GLogDomain *domain) +{ + if (domain->fatal_mask == G_LOG_FATAL_MASK && + domain->handlers == NULL) + { + register GLogDomain *last, *work; + + last = NULL; + + work = g_log_domains; + while (work) + { + if (work == domain) + { + if (last) + last->next = domain->next; + else + g_log_domains = domain->next; + g_free (domain->log_domain); + g_free (domain); + break; + } + last = work; + work = last->next; + } + } +} + +static GLogFunc +g_log_domain_get_handler_L (GLogDomain *domain, + GLogLevelFlags log_level, + gpointer *data) +{ + if (domain && log_level) + { + register GLogHandler *handler; + + handler = domain->handlers; + while (handler) + { + if ((handler->log_level & log_level) == log_level) + { + *data = handler->data; + return handler->log_func; + } + handler = handler->next; + } + } + + *data = default_log_data; + return default_log_func; +} + +GLogLevelFlags +g_log_set_always_fatal (GLogLevelFlags fatal_mask) +{ + GLogLevelFlags old_mask; + + /* restrict the global mask to levels that are known to glib + * since this setting applies to all domains + */ + fatal_mask &= (1 << G_LOG_LEVEL_USER_SHIFT) - 1; + /* force errors to be fatal */ + fatal_mask |= G_LOG_LEVEL_ERROR; + /* remove bogus flag */ + fatal_mask &= ~G_LOG_FLAG_FATAL; + + g_mutex_lock (g_messages_lock); + old_mask = g_log_always_fatal; + g_log_always_fatal = fatal_mask; + g_mutex_unlock (g_messages_lock); + + return old_mask; +} + +GLogLevelFlags +g_log_set_fatal_mask (const gchar *log_domain, + GLogLevelFlags fatal_mask) +{ + GLogLevelFlags old_flags; + register GLogDomain *domain; + + if (!log_domain) + log_domain = ""; + + /* force errors to be fatal */ + fatal_mask |= G_LOG_LEVEL_ERROR; + /* remove bogus flag */ + fatal_mask &= ~G_LOG_FLAG_FATAL; + + g_mutex_lock (g_messages_lock); + + domain = g_log_find_domain_L (log_domain); + if (!domain) + domain = g_log_domain_new_L (log_domain); + old_flags = domain->fatal_mask; + + domain->fatal_mask = fatal_mask; + g_log_domain_check_free_L (domain); + + g_mutex_unlock (g_messages_lock); + + return old_flags; +} + +guint +g_log_set_handler (const gchar *log_domain, + GLogLevelFlags log_levels, + GLogFunc log_func, + gpointer user_data) +{ + static guint handler_id = 0; + GLogDomain *domain; + GLogHandler *handler; + + g_return_val_if_fail ((log_levels & G_LOG_LEVEL_MASK) != 0, 0); + g_return_val_if_fail (log_func != NULL, 0); + + if (!log_domain) + log_domain = ""; + + handler = g_new (GLogHandler, 1); + + g_mutex_lock (g_messages_lock); + + domain = g_log_find_domain_L (log_domain); + if (!domain) + domain = g_log_domain_new_L (log_domain); + + handler->id = ++handler_id; + handler->log_level = log_levels; + handler->log_func = log_func; + handler->data = user_data; + handler->next = domain->handlers; + domain->handlers = handler; + + g_mutex_unlock (g_messages_lock); + + return handler_id; +} + +GLogFunc +g_log_set_default_handler (GLogFunc log_func, + gpointer user_data) +{ + GLogFunc old_log_func; + + g_mutex_lock (g_messages_lock); + old_log_func = default_log_func; + default_log_func = log_func; + default_log_data = user_data; + g_mutex_unlock (g_messages_lock); + + return old_log_func; +} + +/** + * g_test_log_set_fatal_handler: + * @log_func: the log handler function. + * @user_data: data passed to the log handler. + * + * Installs a non-error fatal log handler which can be + * used to decide whether log messages which are counted + * as fatal abort the program. + * + * The use case here is that you are running a test case + * that depends on particular libraries or circumstances + * and cannot prevent certain known critical or warning + * messages. So you install a handler that compares the + * domain and message to precisely not abort in such a case. + * + * Note that the handler is reset at the beginning of + * any test case, so you have to set it inside each test + * function which needs the special behavior. + * + * This handler has no effect on g_error messages. + * + * Since: 2.22 + **/ +void +g_test_log_set_fatal_handler (GTestLogFatalFunc log_func, + gpointer user_data) +{ + g_mutex_lock (g_messages_lock); + fatal_log_func = log_func; + fatal_log_data = user_data; + g_mutex_unlock (g_messages_lock); +} + +void +g_log_remove_handler (const gchar *log_domain, + guint handler_id) +{ + register GLogDomain *domain; + + g_return_if_fail (handler_id > 0); + + if (!log_domain) + log_domain = ""; + + g_mutex_lock (g_messages_lock); + domain = g_log_find_domain_L (log_domain); + if (domain) + { + GLogHandler *work, *last; + + last = NULL; + work = domain->handlers; + while (work) + { + if (work->id == handler_id) + { + if (last) + last->next = work->next; + else + domain->handlers = work->next; + g_log_domain_check_free_L (domain); + g_mutex_unlock (g_messages_lock); + g_free (work); + return; + } + last = work; + work = last->next; + } + } + g_mutex_unlock (g_messages_lock); + g_warning ("%s: could not find handler with id `%d' for domain \"%s\"", + G_STRLOC, handler_id, log_domain); +} + +void +g_logv (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + va_list args1) +{ + gboolean was_fatal = (log_level & G_LOG_FLAG_FATAL) != 0; + gboolean was_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0; + gint i; + + log_level &= G_LOG_LEVEL_MASK; + if (!log_level) + return; + + for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i)) + { + register GLogLevelFlags test_level; + + test_level = 1 << i; + if (log_level & test_level) + { + guint depth = GPOINTER_TO_UINT (g_private_get (g_log_depth)); + GLogDomain *domain; + GLogFunc log_func; + GLogLevelFlags domain_fatal_mask; + gpointer data = NULL; + gboolean masquerade_fatal = FALSE; + + if (was_fatal) + test_level |= G_LOG_FLAG_FATAL; + if (was_recursion) + test_level |= G_LOG_FLAG_RECURSION; + + /* check recursion and lookup handler */ + g_mutex_lock (g_messages_lock); + domain = g_log_find_domain_L (log_domain ? log_domain : ""); + if (depth) + test_level |= G_LOG_FLAG_RECURSION; + depth++; + domain_fatal_mask = domain ? domain->fatal_mask : G_LOG_FATAL_MASK; + if ((domain_fatal_mask | g_log_always_fatal) & test_level) + test_level |= G_LOG_FLAG_FATAL; + if (test_level & G_LOG_FLAG_RECURSION) + log_func = _g_log_fallback_handler; + else + log_func = g_log_domain_get_handler_L (domain, test_level, &data); + domain = NULL; + g_mutex_unlock (g_messages_lock); + + g_private_set (g_log_depth, GUINT_TO_POINTER (depth)); + + /* had to defer debug initialization until we can keep track of recursion */ + if (!(test_level & G_LOG_FLAG_RECURSION) && !_g_debug_initialized) + { + GLogLevelFlags orig_test_level = test_level; + + _g_debug_init (); + if ((domain_fatal_mask | g_log_always_fatal) & test_level) + test_level |= G_LOG_FLAG_FATAL; + if (test_level != orig_test_level) + { + /* need a relookup, not nice, but not too bad either */ + g_mutex_lock (g_messages_lock); + domain = g_log_find_domain_L (log_domain ? log_domain : ""); + log_func = g_log_domain_get_handler_L (domain, test_level, &data); + domain = NULL; + g_mutex_unlock (g_messages_lock); + } + } + + if (test_level & G_LOG_FLAG_RECURSION) + { + /* we use a stack buffer of fixed size, since we're likely + * in an out-of-memory situation + */ + gchar buffer[1025]; + gsize size G_GNUC_UNUSED; + va_list args2; + + G_VA_COPY (args2, args1); + size = _g_vsnprintf (buffer, 1024, format, args2); + va_end (args2); + + log_func (log_domain, test_level, buffer, data); + } + else + { + gchar *msg; + va_list args2; + + G_VA_COPY (args2, args1); + msg = g_strdup_vprintf (format, args2); + va_end (args2); + + log_func (log_domain, test_level, msg, data); + + if ((test_level & G_LOG_FLAG_FATAL) + && !(test_level & G_LOG_LEVEL_ERROR)) + { + masquerade_fatal = fatal_log_func + && !fatal_log_func (log_domain, test_level, msg, fatal_log_data); + } + + g_free (msg); + } + + if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal) + { +#ifdef G_OS_WIN32 + gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL); + + MessageBox (NULL, locale_msg, NULL, + MB_ICONERROR|MB_SETFOREGROUND); + if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION)) + G_BREAKPOINT (); + else + abort (); +#else + if (!(test_level & G_LOG_FLAG_RECURSION)) + G_BREAKPOINT (); + else + abort (); +#endif /* !G_OS_WIN32 */ + } + + depth--; + g_private_set (g_log_depth, GUINT_TO_POINTER (depth)); + } + } +} + +void +g_log (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + ...) +{ + va_list args; + + va_start (args, format); + g_logv (log_domain, log_level, format, args); + va_end (args); +} + +void +g_return_if_fail_warning (const char *log_domain, + const char *pretty_function, + const char *expression) +{ + g_log (log_domain, + G_LOG_LEVEL_CRITICAL, + "%s: assertion `%s' failed", + pretty_function, + expression); +} + +void +g_warn_message (const char *domain, + const char *file, + int line, + const char *func, + const char *warnexpr) +{ + char *s, lstr[32]; + g_snprintf (lstr, 32, "%d", line); + if (warnexpr) + s = g_strconcat ("(", file, ":", lstr, "):", + func, func[0] ? ":" : "", + " runtime check failed: (", warnexpr, ")", NULL); + else + s = g_strconcat ("(", file, ":", lstr, "):", + func, func[0] ? ":" : "", + " ", "code should not be reached", NULL); + g_log (domain, G_LOG_LEVEL_WARNING, "%s", s); + g_free (s); +} + +void +g_assert_warning (const char *log_domain, + const char *file, + const int line, + const char *pretty_function, + const char *expression) +{ + g_log (log_domain, + G_LOG_LEVEL_ERROR, + expression + ? "file %s: line %d (%s): assertion failed: (%s)" + : "file %s: line %d (%s): should not be reached", + file, + line, + pretty_function, + expression); + abort (); +} + +#define CHAR_IS_SAFE(wc) (!((wc < 0x20 && wc != '\t' && wc != '\n' && wc != '\r') || \ + (wc == 0x7f) || \ + (wc >= 0x80 && wc < 0xa0))) + +/* For a radix of 8 we need at most 3 output bytes for 1 input + * byte. Additionally we might need up to 2 output bytes for the + * readix prefix and 1 byte for the trailing NULL. + */ +#define FORMAT_UNSIGNED_BUFSIZE ((GLIB_SIZEOF_LONG * 3) + 3) + +static void +format_unsigned (gchar *buf, + gulong num, + guint radix) +{ + gulong tmp; + gchar c; + gint i, n; + + /* we may not call _any_ GLib functions here (or macros like g_return_if_fail()) */ + + if (radix != 8 && radix != 10 && radix != 16) + { + *buf = '\000'; + return; + } + + if (!num) + { + *buf++ = '0'; + *buf = '\000'; + return; + } + + if (radix == 16) + { + *buf++ = '0'; + *buf++ = 'x'; + } + else if (radix == 8) + { + *buf++ = '0'; + } + + n = 0; + tmp = num; + while (tmp) + { + tmp /= radix; + n++; + } + + i = n; + + /* Again we can't use g_assert; actually this check should _never_ fail. */ + if (n > FORMAT_UNSIGNED_BUFSIZE - 3) + { + *buf = '\000'; + return; + } + + while (num) + { + i--; + c = (num % radix); + if (c < 10) + buf[i] = c + '0'; + else + buf[i] = c + 'a' - 10; + num /= radix; + } + + buf[n] = '\000'; +} + +/* string size big enough to hold level prefix */ +#define STRING_BUFFER_SIZE (FORMAT_UNSIGNED_BUFSIZE + 32) + +#define ALERT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING) + +static int +mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE], + GLogLevelFlags log_level) +{ + gboolean to_stdout = TRUE; + + /* we may not call _any_ GLib functions here */ + + switch (log_level & G_LOG_LEVEL_MASK) + { + case G_LOG_LEVEL_ERROR: + strcpy (level_prefix, "ERROR"); + to_stdout = FALSE; + break; + case G_LOG_LEVEL_CRITICAL: + strcpy (level_prefix, "CRITICAL"); + to_stdout = FALSE; + break; + case G_LOG_LEVEL_WARNING: + strcpy (level_prefix, "WARNING"); + to_stdout = FALSE; + break; + case G_LOG_LEVEL_MESSAGE: + strcpy (level_prefix, "Message"); + to_stdout = FALSE; + break; + case G_LOG_LEVEL_INFO: + strcpy (level_prefix, "INFO"); + break; + case G_LOG_LEVEL_DEBUG: + strcpy (level_prefix, "DEBUG"); + break; + default: + if (log_level) + { + strcpy (level_prefix, "LOG-"); + format_unsigned (level_prefix + 4, log_level & G_LOG_LEVEL_MASK, 16); + } + else + strcpy (level_prefix, "LOG"); + break; + } + if (log_level & G_LOG_FLAG_RECURSION) + strcat (level_prefix, " (recursed)"); + if (log_level & ALERT_LEVELS) + strcat (level_prefix, " **"); + +#ifdef G_OS_WIN32 + win32_keep_fatal_message = (log_level & G_LOG_FLAG_FATAL) != 0; +#endif + return to_stdout ? 1 : 2; +} + +void +_g_log_fallback_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + gchar level_prefix[STRING_BUFFER_SIZE]; +#ifndef G_OS_WIN32 + gchar pid_string[FORMAT_UNSIGNED_BUFSIZE]; +#endif + int fd; + + /* we cannot call _any_ GLib functions in this fallback handler, + * which is why we skip UTF-8 conversion, etc. + * since we either recursed or ran out of memory, we're in a pretty + * pathologic situation anyways, what we can do is giving the + * the process ID unconditionally however. + */ + + fd = mklevel_prefix (level_prefix, log_level); + if (!message) + message = "(NULL) message"; + +#ifndef G_OS_WIN32 + format_unsigned (pid_string, getpid (), 10); +#endif + + if (log_domain) + write_string (fd, "\n"); + else + write_string (fd, "\n** "); + +#ifndef G_OS_WIN32 + write_string (fd, "(process:"); + write_string (fd, pid_string); + write_string (fd, "): "); +#endif + + if (log_domain) + { + write_string (fd, log_domain); + write_string (fd, "-"); + } + write_string (fd, level_prefix); + write_string (fd, ": "); + write_string (fd, message); +} + +void +g_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + gchar level_prefix[STRING_BUFFER_SIZE], *string; + GString *gstring; + int fd; + + /* we can be called externally with recursion for whatever reason */ + if (log_level & G_LOG_FLAG_RECURSION) + { + _g_log_fallback_handler (log_domain, log_level, message, unused_data); + return; + } + + g_messages_prefixed_init (); + + fd = mklevel_prefix (level_prefix, log_level); + + gstring = g_string_new (NULL); + if (log_level & ALERT_LEVELS) + g_string_append (gstring, "\n"); + if (!log_domain) + g_string_append (gstring, "** "); + + if ((g_log_msg_prefix & log_level) == log_level) + { + const gchar *prg_name = g_get_prgname (); + + if (!prg_name) + g_string_append_printf (gstring, "(process:%lu): ", (gulong)getpid ()); + else + g_string_append_printf (gstring, "(%s:%lu): ", prg_name, (gulong)getpid ()); + } + + if (log_domain) + { + g_string_append (gstring, log_domain); + g_string_append_c (gstring, '-'); + } + g_string_append (gstring, level_prefix); + + g_string_append (gstring, ": "); + if (!message) + g_string_append (gstring, "(NULL) message"); + else + { + GString *msg; + + msg = g_string_new (message); + + g_string_append (gstring, msg->str); /* assume UTF-8 */ + + g_string_free (msg, TRUE); + } + g_string_append (gstring, "\n"); + + string = g_string_free (gstring, FALSE); + + write_string (fd, string); + g_free (string); +} + +/** + * g_set_print_handler: + * @func: the new print handler + * + * Sets the print handler. + * + * Any messages passed to g_print() will be output via + * the new handler. The default handler simply outputs + * the message to stdout. By providing your own handler + * you can redirect the output, to a GTK+ widget or a + * log file for example. + * + * Returns: the old print handler + */ +GPrintFunc +g_set_print_handler (GPrintFunc func) +{ + GPrintFunc old_print_func; + + g_mutex_lock (g_messages_lock); + old_print_func = glib_print_func; + glib_print_func = func; + g_mutex_unlock (g_messages_lock); + + return old_print_func; +} + +/** + * g_print: + * @format: the message format. See the printf() documentation + * @...: the parameters to insert into the format string + * + * Outputs a formatted message via the print handler. + * The default print handler simply outputs the message to stdout. + * + * g_print() should not be used from within libraries for debugging + * messages, since it may be redirected by applications to special + * purpose message windows or even files. Instead, libraries should + * use g_log(), or the convenience functions g_message(), g_warning() + * and g_error(). + */ +void +g_print (const gchar *format, + ...) +{ + va_list args; + gchar *string; + GPrintFunc local_glib_print_func; + + g_return_if_fail (format != NULL); + + va_start (args, format); + string = g_strdup_vprintf (format, args); + va_end (args); + + g_mutex_lock (g_messages_lock); + local_glib_print_func = glib_print_func; + g_mutex_unlock (g_messages_lock); + + if (local_glib_print_func) + local_glib_print_func (string); + else + { + fputs (string, stdout); /* assume UTF-8 */ + fflush (stdout); + } + g_free (string); +} + +/** + * g_set_printerr_handler: + * @func: the new error message handler + * + * Sets the handler for printing error messages. + * + * Any messages passed to g_printerr() will be output via + * the new handler. The default handler simply outputs the + * message to stderr. By providing your own handler you can + * redirect the output, to a GTK+ widget or a log file for + * example. + * + * Returns: the old error message handler + */ +GPrintFunc +g_set_printerr_handler (GPrintFunc func) +{ + GPrintFunc old_printerr_func; + + g_mutex_lock (g_messages_lock); + old_printerr_func = glib_printerr_func; + glib_printerr_func = func; + g_mutex_unlock (g_messages_lock); + + return old_printerr_func; +} + +/** + * g_printerr: + * @format: the message format. See the printf() documentation + * @...: the parameters to insert into the format string + * + * Outputs a formatted message via the error message handler. + * The default handler simply outputs the message to stderr. + * + * g_printerr() should not be used from within libraries. + * Instead g_log() should be used, or the convenience functions + * g_message(), g_warning() and g_error(). + */ +void +g_printerr (const gchar *format, + ...) +{ + va_list args; + gchar *string; + GPrintFunc local_glib_printerr_func; + + g_return_if_fail (format != NULL); + + va_start (args, format); + string = g_strdup_vprintf (format, args); + va_end (args); + + g_mutex_lock (g_messages_lock); + local_glib_printerr_func = glib_printerr_func; + g_mutex_unlock (g_messages_lock); + + if (local_glib_printerr_func) + local_glib_printerr_func (string); + else + { + fputs (string, stderr); /* assume UTF-8 */ + fflush (stderr); + } + g_free (string); +} + +gsize +g_printf_string_upper_bound (const gchar *format, + va_list args) +{ + gchar c; + return _g_vsnprintf (&c, 1, format, args) + 1; +} + +void +_g_messages_thread_init_nomessage (void) +{ + g_messages_lock = g_mutex_new (); + g_log_depth = g_private_new (NULL); + g_messages_prefixed_init (); + _g_debug_init (); +} + +gboolean _g_debug_initialized = FALSE; +guint _g_debug_flags = 0; + +void +_g_debug_init (void) +{ + const gchar *val; + + _g_debug_initialized = TRUE; + + val = g_getenv ("G_DEBUG"); + if (val != NULL) + { + const GDebugKey keys[] = { + {"fatal_warnings", G_DEBUG_FATAL_WARNINGS}, + {"fatal_criticals", G_DEBUG_FATAL_CRITICALS} + }; + + _g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys)); + } + + if (_g_debug_flags & G_DEBUG_FATAL_WARNINGS) + { + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + } + + if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS) + { + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + } +} diff --git a/deps/glib/gmessages.h b/deps/glib/gmessages.h new file mode 100644 index 0000000..c5220e3 --- /dev/null +++ b/deps/glib/gmessages.h @@ -0,0 +1,405 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_MESSAGES_H__ +#define __G_MESSAGES_H__ + +#include +#include +#include + +/* Suppress warnings when GCC is in -pedantic mode and not -std=c99 + */ +#if (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) +#pragma GCC system_header +#endif + +G_BEGIN_DECLS + +/* calculate a string size, guaranteed to fit format + args. + */ +gsize g_printf_string_upper_bound (const gchar* format, + va_list args); + +/* Log level shift offset for user defined + * log levels (0-7 are used by GLib). + */ +#define G_LOG_LEVEL_USER_SHIFT (8) + +/* Glib log levels and flags. + */ +typedef enum +{ + /* log flags */ + G_LOG_FLAG_RECURSION = 1 << 0, + G_LOG_FLAG_FATAL = 1 << 1, + + /* GLib log levels */ + G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */ + G_LOG_LEVEL_CRITICAL = 1 << 3, + G_LOG_LEVEL_WARNING = 1 << 4, + G_LOG_LEVEL_MESSAGE = 1 << 5, + G_LOG_LEVEL_INFO = 1 << 6, + G_LOG_LEVEL_DEBUG = 1 << 7, + + G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) +} GLogLevelFlags; + +/* GLib log levels that are considered fatal by default */ +#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR) + +typedef void (*GLogFunc) (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data); + +/* Logging mechanism + */ +guint g_log_set_handler (const gchar *log_domain, + GLogLevelFlags log_levels, + GLogFunc log_func, + gpointer user_data); +void g_log_remove_handler (const gchar *log_domain, + guint handler_id); +void g_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data); +GLogFunc g_log_set_default_handler (GLogFunc log_func, + gpointer user_data); +void g_log (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + ...) G_GNUC_PRINTF (3, 4); +void g_logv (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *format, + va_list args); +GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain, + GLogLevelFlags fatal_mask); +GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); + +/* internal */ +G_GNUC_INTERNAL void _g_log_fallback_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data); + +/* Internal functions, used to implement the following macros */ +void g_return_if_fail_warning (const char *log_domain, + const char *pretty_function, + const char *expression); +void g_warn_message (const char *domain, + const char *file, + int line, + const char *func, + const char *warnexpr); +#ifndef G_DISABLE_DEPRECATED +void g_assert_warning (const char *log_domain, + const char *file, + const int line, + const char *pretty_function, + const char *expression) G_GNUC_NORETURN; +#endif /* !G_DISABLE_DEPRECATED */ + + +#ifndef G_LOG_DOMAIN +#define G_LOG_DOMAIN ((gchar*) 0) +#endif /* G_LOG_DOMAIN */ +#ifdef G_HAVE_ISO_VARARGS +/* for(;;) ; so that GCC knows that control doesn't go past g_error(). + * Put space before ending semicolon to avoid C++ build warnings. + */ +#define g_error(...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_ERROR, \ + __VA_ARGS__); \ + for (;;) ; \ + } G_STMT_END + +#define g_message(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_MESSAGE, \ + __VA_ARGS__) +#define g_critical(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + __VA_ARGS__) +#define g_warning(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_WARNING, \ + __VA_ARGS__) +#define g_debug(...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + __VA_ARGS__) +#elif defined(G_HAVE_GNUC_VARARGS) +#define g_error(format...) G_STMT_START { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_ERROR, \ + format); \ + for (;;) ; \ + } G_STMT_END + +#define g_message(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_MESSAGE, \ + format) +#define g_critical(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + format) +#define g_warning(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_WARNING, \ + format) +#define g_debug(format...) g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + format) +#else /* no varargs macros */ +static void +g_error (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); + va_end (args); + + for(;;) ; +} +static void +g_message (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args); + va_end (args); +} +static void +g_critical (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args); + va_end (args); +} +static void +g_warning (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args); + va_end (args); +} +static void +g_debug (const gchar *format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args); + va_end (args); +} +#endif /* !__GNUC__ */ + +/** + * GPrintFunc: + * @string: the message to output + * + * Specifies the type of the print handler functions. + * These are called with the complete formatted string to output. + */ +typedef void (*GPrintFunc) (const gchar *string); +void g_print (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); +GPrintFunc g_set_print_handler (GPrintFunc func); +void g_printerr (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); +GPrintFunc g_set_printerr_handler (GPrintFunc func); + +/** + * g_warn_if_reached: + * + * Logs a critical warning. + * + * Since: 2.16 + */ +#define g_warn_if_reached() \ + do { \ + g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); \ + } while (0) + +/** + * g_warn_if_fail: + * @expr: the expression to check + * + * Logs a warning if the expression is not true. + * + * Since: 2.16 + */ +#define g_warn_if_fail(expr) \ + do { \ + if G_LIKELY (expr) ; \ + else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); \ + } while (0) + +#ifdef G_DISABLE_CHECKS + +/** + * g_return_if_fail: + * @expr: the expression to check + * + * Verifies that the expression evaluates to %TRUE. If the expression + * evaluates to %FALSE, a critical message is logged and the current + * function returns. This can only be used in functions which do not + * return a value. + * + * If G_DISABLE_CHECKS is defined then the check is not performed. You + * should therefore not depend on any side effects of @expr. + */ +#define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END + +/** + * g_return_val_if_fail: + * @expr: the expression to check + * @val: the value to return from the current function + * if the expression is not true + * + * Verifies that the expression evaluates to %TRUE. If the expression + * evaluates to %FALSE, a critical message is logged and @val is + * returned from the current function. + * + * If G_DISABLE_CHECKS is defined then the check is not performed. You + * should therefore not depend on any side effects of @expr. + */ +#define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END + +/** + * g_return_if_reached: + * + * Logs a critical message and returns from the current function. + * This can only be used in functions which do not return a value. + */ +#define g_return_if_reached() G_STMT_START{ return; }G_STMT_END + +/** + * g_return_val_if_reached: + * @val: the value to return from the current function + * + * Logs a critical message and returns @val. + */ +#define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END + +#else /* !G_DISABLE_CHECKS */ + +#ifdef __GNUC__ + +#define g_return_if_fail(expr) G_STMT_START{ \ + if G_LIKELY(expr) { } else \ + { \ + g_return_if_fail_warning (G_LOG_DOMAIN, \ + __PRETTY_FUNCTION__, \ + #expr); \ + return; \ + }; }G_STMT_END + +#define g_return_val_if_fail(expr,val) G_STMT_START{ \ + if G_LIKELY(expr) { } else \ + { \ + g_return_if_fail_warning (G_LOG_DOMAIN, \ + __PRETTY_FUNCTION__, \ + #expr); \ + return (val); \ + }; }G_STMT_END + +#define g_return_if_reached() G_STMT_START{ \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + __PRETTY_FUNCTION__); \ + return; }G_STMT_END + +#define g_return_val_if_reached(val) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d (%s): should not be reached", \ + __FILE__, \ + __LINE__, \ + __PRETTY_FUNCTION__); \ + return (val); }G_STMT_END + +#else /* !__GNUC__ */ + +#define g_return_if_fail(expr) G_STMT_START{ \ + if (expr) { } else \ + { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #expr); \ + return; \ + }; }G_STMT_END + +#define g_return_val_if_fail(expr, val) G_STMT_START{ \ + if (expr) { } else \ + { \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #expr); \ + return (val); \ + }; }G_STMT_END + +#define g_return_if_reached() G_STMT_START{ \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d: should not be reached", \ + __FILE__, \ + __LINE__); \ + return; }G_STMT_END + +#define g_return_val_if_reached(val) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, \ + G_LOG_LEVEL_CRITICAL, \ + "file %s: line %d: should not be reached", \ + __FILE__, \ + __LINE__); \ + return (val); }G_STMT_END + +#endif /* !__GNUC__ */ + +#endif /* !G_DISABLE_CHECKS */ + +G_END_DECLS + +#endif /* __G_MESSAGES_H__ */ diff --git a/deps/glib/gprintf.c b/deps/glib/gprintf.c new file mode 100644 index 0000000..346fd95 --- /dev/null +++ b/deps/glib/gprintf.c @@ -0,0 +1,340 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "gprintf.h" +#include "gprintfint.h" + + +/** + * g_printf: + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @...: the arguments to insert in the output. + * + * An implementation of the standard printf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_printf (gchar const *format, + ...) +{ + va_list args; + gint retval; + + va_start (args, format); + retval = g_vprintf (format, args); + va_end (args); + + return retval; +} + +/** + * g_fprintf: + * @file: the stream to write to. + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @...: the arguments to insert in the output. + * + * An implementation of the standard fprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_fprintf (FILE *file, + gchar const *format, + ...) +{ + va_list args; + gint retval; + + va_start (args, format); + retval = g_vfprintf (file, format, args); + va_end (args); + + return retval; +} + +/** + * g_sprintf: + * @string: A pointer to a memory buffer to contain the resulting string. It + * is up to the caller to ensure that the allocated buffer is large + * enough to hold the formatted result + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @...: the arguments to insert in the output. + * + * An implementation of the standard sprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Note that it is usually better to use g_snprintf(), to avoid the + * risk of buffer overflow. + * + * See also g_strdup_printf(). + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_sprintf (gchar *string, + gchar const *format, + ...) +{ + va_list args; + gint retval; + + va_start (args, format); + retval = g_vsprintf (string, format, args); + va_end (args); + + return retval; +} + +/** + * g_snprintf: + * @string: the buffer to hold the output. + * @n: the maximum number of bytes to produce (including the + * terminating nul character). + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @...: the arguments to insert in the output. + * + * A safer form of the standard sprintf() function. The output is guaranteed + * to not exceed @n characters (including the terminating nul character), so + * it is easy to ensure that a buffer overflow cannot occur. + * + * See also g_strdup_printf(). + * + * In versions of GLib prior to 1.2.3, this function may return -1 if the + * output was truncated, and the truncated string may not be nul-terminated. + * In versions prior to 1.3.12, this function returns the length of the output + * string. + * + * The return value of g_snprintf() conforms to the snprintf() + * function as standardized in ISO C99. Note that this is different from + * traditional snprintf(), which returns the length of the output string. + * + * The format string may contain positional parameters, as specified in + * the Single Unix Specification. + * + * Returns: the number of bytes which would be produced if the buffer + * was large enough. + **/ +gint +g_snprintf (gchar *string, + gulong n, + gchar const *format, + ...) +{ + va_list args; + gint retval; + + va_start (args, format); + retval = g_vsnprintf (string, n, format, args); + va_end (args); + + return retval; +} + +/** + * g_vprintf: + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @args: the list of arguments to insert in the output. + * + * An implementation of the standard vprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_vprintf (gchar const *format, + va_list args) +{ + g_return_val_if_fail (format != NULL, -1); + + return _g_vprintf (format, args); +} + +/** + * g_vfprintf: + * @file: the stream to write to. + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @args: the list of arguments to insert in the output. + * + * An implementation of the standard fprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_vfprintf (FILE *file, + gchar const *format, + va_list args) +{ + g_return_val_if_fail (format != NULL, -1); + + return _g_vfprintf (file, format, args); +} + +/** + * g_vsprintf: + * @string: the buffer to hold the output. + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @args: the list of arguments to insert in the output. + * + * An implementation of the standard vsprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * + * Returns: the number of bytes printed. + * + * Since: 2.2 + **/ +gint +g_vsprintf (gchar *string, + gchar const *format, + va_list args) +{ + g_return_val_if_fail (string != NULL, -1); + g_return_val_if_fail (format != NULL, -1); + + return _g_vsprintf (string, format, args); +} + +/** + * g_vsnprintf: + * @string: the buffer to hold the output. + * @n: the maximum number of bytes to produce (including the + * terminating nul character). + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @args: the list of arguments to insert in the output. + * + * A safer form of the standard vsprintf() function. The output is guaranteed + * to not exceed @n characters (including the terminating nul character), so + * it is easy to ensure that a buffer overflow cannot occur. + * + * See also g_strdup_vprintf(). + * + * In versions of GLib prior to 1.2.3, this function may return -1 if the + * output was truncated, and the truncated string may not be nul-terminated. + * In versions prior to 1.3.12, this function returns the length of the output + * string. + * + * The return value of g_vsnprintf() conforms to the vsnprintf() function + * as standardized in ISO C99. Note that this is different from traditional + * vsnprintf(), which returns the length of the output string. + * + * The format string may contain positional parameters, as specified in + * the Single Unix Specification. + * + * Returns: the number of bytes which would be produced if the buffer + * was large enough. + */ +gint +g_vsnprintf (gchar *string, + gulong n, + gchar const *format, + va_list args) +{ + g_return_val_if_fail (n == 0 || string != NULL, -1); + g_return_val_if_fail (format != NULL, -1); + + return _g_vsnprintf (string, n, format, args); +} + +/** + * g_vasprintf: + * @string: the return location for the newly-allocated string. + * @format: a standard printf() format string, but notice + * string precision pitfalls. + * @args: the list of arguments to insert in the output. + * + * An implementation of the GNU vasprintf() function which supports + * positional parameters, as specified in the Single Unix Specification. + * This function is similar to g_vsprintf(), except that it allocates a + * string to hold the output, instead of putting the output in a buffer + * you allocate in advance. + * + * Returns: the number of bytes printed. + * + * Since: 2.4 + **/ +gint +g_vasprintf (gchar **string, + gchar const *format, + va_list args) +{ + gint len; + g_return_val_if_fail (string != NULL, -1); + +#if !defined(HAVE_GOOD_PRINTF) + + len = _g_gnulib_vasprintf (string, format, args); + if (len < 0) + *string = NULL; + +#elif defined (HAVE_VASPRINTF) + + len = vasprintf (string, format, args); + if (len < 0) + *string = NULL; + else if (!g_mem_is_system_malloc ()) + { + /* vasprintf returns malloc-allocated memory */ + gchar *string1 = g_strndup (*string, len); + free (*string); + *string = string1; + } + +#else + + { + va_list args2; + + G_VA_COPY (args2, args); + + *string = g_new (gchar, g_printf_string_upper_bound (format, args)); + + len = _g_vsprintf (*string, format, args2); + va_end (args2); + } +#endif + + return len; +} diff --git a/deps/glib/gprintf.h b/deps/glib/gprintf.h new file mode 100644 index 0000000..d96870f --- /dev/null +++ b/deps/glib/gprintf.h @@ -0,0 +1,52 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_PRINTF_H__ +#define __G_PRINTF_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +gint g_printf (gchar const *format, + ...) G_GNUC_PRINTF (1, 2); +gint g_fprintf (FILE *file, + gchar const *format, + ...) G_GNUC_PRINTF (2, 3); +gint g_sprintf (gchar *string, + gchar const *format, + ...) G_GNUC_PRINTF (2, 3); + +gint g_vprintf (gchar const *format, + va_list args); +gint g_vfprintf (FILE *file, + gchar const *format, + va_list args); +gint g_vsprintf (gchar *string, + gchar const *format, + va_list args); +gint g_vasprintf (gchar **string, + gchar const *format, + va_list args); + +G_END_DECLS + +#endif /* __G_PRINTF_H__ */ diff --git a/deps/glib/gprintfint.h b/deps/glib/gprintfint.h new file mode 100644 index 0000000..0c975a1 --- /dev/null +++ b/deps/glib/gprintfint.h @@ -0,0 +1,59 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 2002. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_PRINTFINT_H__ +#define __G_PRINTFINT_H__ + +#ifdef HAVE_GOOD_PRINTF + +#define _g_printf printf +#define _g_fprintf fprintf +#define _g_sprintf sprintf +#define _g_snprintf snprintf + +#define _g_vprintf vprintf +#define _g_vfprintf vfprintf +#define _g_vsprintf vsprintf +#define _g_vsnprintf vsnprintf + +#else + +#include "gnulib/printf.h" + +#define _g_printf _g_gnulib_printf +#define _g_fprintf _g_gnulib_fprintf +#define _g_sprintf _g_gnulib_sprintf +#define _g_snprintf _g_gnulib_snprintf + +#define _g_vprintf _g_gnulib_vprintf +#define _g_vfprintf _g_gnulib_vfprintf +#define _g_vsprintf _g_gnulib_vsprintf +#define _g_vsnprintf _g_gnulib_vsnprintf + +#endif + +#endif /* __G_PRINTF_H__ */ + diff --git a/deps/glib/gqsort.c b/deps/glib/gqsort.c new file mode 100644 index 0000000..db4bed2 --- /dev/null +++ b/deps/glib/gqsort.c @@ -0,0 +1,300 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1991, 1992, 1996, 1997,1999,2004 Free Software Foundation, Inc. + * Copyright (C) 2000 Eazel, Inc. + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * This file was originally part of the GNU C Library, and was modified to allow + * user data to be passed in to the sorting function. + * + * Written by Douglas C. Schmidt (schmidt@ics.uci.edu). + * Modified by Maciej Stachowiak (mjs@eazel.com) + * + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with GLib + * at ftp://ftp.gtk.org/pub/gtk/. + */ + +#include "config.h" + +#include +#include +#include + +#include "gqsort.h" + +#include "gtestutils.h" + +#ifdef HAVE_QSORT_R + +/** + * g_qsort_with_data: + * @pbase: start of array to sort + * @total_elems: elements in the array + * @size: size of each element + * @compare_func: function to compare elements + * @user_data: data to pass to @compare_func + * + * This is just like the standard C qsort() function, but + * the comparison routine accepts a user data argument. + */ +void +g_qsort_with_data (gconstpointer pbase, + gint total_elems, + gsize size, + GCompareDataFunc compare_func, + gpointer user_data) +{ + qsort_r ((gpointer)pbase, total_elems, size, compare_func, user_data); +} + +#else + +/* Byte-wise swap two items of size SIZE. */ +#define SWAP(a, b, size) \ + do \ + { \ + register size_t __size = (size); \ + register char *__a = (a), *__b = (b); \ + do \ + { \ + char __tmp = *__a; \ + *__a++ = *__b; \ + *__b++ = __tmp; \ + } while (--__size > 0); \ + } while (0) + +/* Discontinue quicksort algorithm when partition gets below this size. + This particular magic number was chosen to work best on a Sun 4/260. */ +#define MAX_THRESH 4 + +/* Stack node declarations used to store unfulfilled partition obligations. */ +typedef struct + { + char *lo; + char *hi; + } stack_node; + +/* The next 4 #defines implement a very fast in-line stack abstraction. */ +/* The stack needs log (total_elements) entries (we could even subtract + log(MAX_THRESH)). Since total_elements has type size_t, we get as + upper bound for log (total_elements): + bits per byte (CHAR_BIT) * sizeof(size_t). */ +#define STACK_SIZE (CHAR_BIT * sizeof(size_t)) +#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) +#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi))) +#define STACK_NOT_EMPTY (stack < top) + + +/* Order size using quicksort. This implementation incorporates + four optimizations discussed in Sedgewick: + + 1. Non-recursive, using an explicit stack of pointer that store the + next array partition to sort. To save time, this maximum amount + of space required to store an array of SIZE_MAX is allocated on the + stack. Assuming a 32-bit (64 bit) integer for size_t, this needs + only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes). + Pretty cheap, actually. + + 2. Chose the pivot element using a median-of-three decision tree. + This reduces the probability of selecting a bad pivot value and + eliminates certain extraneous comparisons. + + 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving + insertion sort to order the MAX_THRESH items within each partition. + This is a big win, since insertion sort is faster for small, mostly + sorted array segments. + + 4. The larger of the two sub-partitions is always pushed onto the + stack first, with the algorithm then concentrating on the + smaller partition. This *guarantees* no more than log (total_elems) + stack size is needed (actually O(1) in this case)! */ + +void +g_qsort_with_data (gconstpointer pbase, + gint total_elems, + gsize size, + GCompareDataFunc compare_func, + gpointer user_data) +{ + register char *base_ptr = (char *) pbase; + + const size_t max_thresh = MAX_THRESH * size; + + g_return_if_fail (total_elems >= 0); + g_return_if_fail (pbase != NULL || total_elems == 0); + g_return_if_fail (compare_func != NULL); + + if (total_elems == 0) + /* Avoid lossage with unsigned arithmetic below. */ + return; + + if (total_elems > MAX_THRESH) + { + char *lo = base_ptr; + char *hi = &lo[size * (total_elems - 1)]; + stack_node stack[STACK_SIZE]; + stack_node *top = stack; + + PUSH (NULL, NULL); + + while (STACK_NOT_EMPTY) + { + char *left_ptr; + char *right_ptr; + + /* Select median value from among LO, MID, and HI. Rearrange + LO and HI so the three values are sorted. This lowers the + probability of picking a pathological pivot value and + skips a comparison for both the LEFT_PTR and RIGHT_PTR in + the while loops. */ + + char *mid = lo + size * ((hi - lo) / size >> 1); + + if ((*compare_func) ((void *) mid, (void *) lo, user_data) < 0) + SWAP (mid, lo, size); + if ((*compare_func) ((void *) hi, (void *) mid, user_data) < 0) + SWAP (mid, hi, size); + else + goto jump_over; + if ((*compare_func) ((void *) mid, (void *) lo, user_data) < 0) + SWAP (mid, lo, size); + jump_over:; + + left_ptr = lo + size; + right_ptr = hi - size; + + /* Here's the famous ``collapse the walls'' section of quicksort. + Gotta like those tight inner loops! They are the main reason + that this algorithm runs much faster than others. */ + do + { + while ((*compare_func) ((void *) left_ptr, (void *) mid, user_data) < 0) + left_ptr += size; + + while ((*compare_func) ((void *) mid, (void *) right_ptr, user_data) < 0) + right_ptr -= size; + + if (left_ptr < right_ptr) + { + SWAP (left_ptr, right_ptr, size); + if (mid == left_ptr) + mid = right_ptr; + else if (mid == right_ptr) + mid = left_ptr; + left_ptr += size; + right_ptr -= size; + } + else if (left_ptr == right_ptr) + { + left_ptr += size; + right_ptr -= size; + break; + } + } + while (left_ptr <= right_ptr); + + /* Set up pointers for next iteration. First determine whether + left and right partitions are below the threshold size. If so, + ignore one or both. Otherwise, push the larger partition's + bounds on the stack and continue sorting the smaller one. */ + + if ((size_t) (right_ptr - lo) <= max_thresh) + { + if ((size_t) (hi - left_ptr) <= max_thresh) + /* Ignore both small partitions. */ + POP (lo, hi); + else + /* Ignore small left partition. */ + lo = left_ptr; + } + else if ((size_t) (hi - left_ptr) <= max_thresh) + /* Ignore small right partition. */ + hi = right_ptr; + else if ((right_ptr - lo) > (hi - left_ptr)) + { + /* Push larger left partition indices. */ + PUSH (lo, right_ptr); + lo = left_ptr; + } + else + { + /* Push larger right partition indices. */ + PUSH (left_ptr, hi); + hi = right_ptr; + } + } + } + + /* Once the BASE_PTR array is partially sorted by quicksort the rest + is completely sorted using insertion sort, since this is efficient + for partitions below MAX_THRESH size. BASE_PTR points to the beginning + of the array to sort, and END_PTR points at the very last element in + the array (*not* one beyond it!). */ + +#define min(x, y) ((x) < (y) ? (x) : (y)) + + { + char *const end_ptr = &base_ptr[size * (total_elems - 1)]; + char *tmp_ptr = base_ptr; + char *thresh = min(end_ptr, base_ptr + max_thresh); + register char *run_ptr; + + /* Find smallest element in first threshold and place it at the + array's beginning. This is the smallest array element, + and the operation speeds up insertion sort's inner loop. */ + + for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) + if ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) < 0) + tmp_ptr = run_ptr; + + if (tmp_ptr != base_ptr) + SWAP (tmp_ptr, base_ptr, size); + + /* Insertion sort, running from left-hand-side up to right-hand-side. */ + + run_ptr = base_ptr + size; + while ((run_ptr += size) <= end_ptr) + { + tmp_ptr = run_ptr - size; + while ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) < 0) + tmp_ptr -= size; + + tmp_ptr += size; + if (tmp_ptr != run_ptr) + { + char *trav; + + trav = run_ptr + size; + while (--trav >= run_ptr) + { + char c = *trav; + char *hi, *lo; + + for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) + *hi = *lo; + *hi = c; + } + } + } + } +} + +#endif /* HAVE_QSORT_R */ diff --git a/deps/glib/gqsort.h b/deps/glib/gqsort.h new file mode 100644 index 0000000..3a47a58 --- /dev/null +++ b/deps/glib/gqsort.h @@ -0,0 +1,46 @@ + /* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_QSORT_H__ +#define __G_QSORT_H__ + +#include + +G_BEGIN_DECLS + +void g_qsort_with_data (gconstpointer pbase, + gint total_elems, + gsize size, + GCompareDataFunc compare_func, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_QSORT_H__ */ diff --git a/deps/glib/gquark.h b/deps/glib/gquark.h new file mode 100644 index 0000000..324c956 --- /dev/null +++ b/deps/glib/gquark.h @@ -0,0 +1,52 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_QUARK_H__ +#define __G_QUARK_H__ + +#include + +G_BEGIN_DECLS + +typedef guint32 GQuark; + +/* Quarks (string<->id association) + */ +GQuark g_quark_try_string (const gchar *string); +GQuark g_quark_from_static_string (const gchar *string); +GQuark g_quark_from_string (const gchar *string); +const gchar * g_quark_to_string (GQuark quark) G_GNUC_CONST; + +const gchar * g_intern_string (const gchar *string); +const gchar * g_intern_static_string (const gchar *string); + +G_END_DECLS + +#endif /* __G_QUARK_H__ */ diff --git a/deps/glib/gqueue.c b/deps/glib/gqueue.c new file mode 100644 index 0000000..e6bf411 --- /dev/null +++ b/deps/glib/gqueue.c @@ -0,0 +1,1047 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * GQueue: Double ended queue implementation, piggy backed on GList. + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * MT safe + */ + +/** + * SECTION:queue + * @Title: Double-ended Queues + * @Short_description: double-ended queue data structure + * + * The #GQueue structure and its associated functions provide a standard + * queue data structure. Internally, GQueue uses the same data structure + * as #GList to store elements. + * + * The data contained in each element can be either integer values, by + * using one of the Type + * Conversion Macros, or simply pointers to any type of data. + * + * To create a new GQueue, use g_queue_new(). + * + * To initialize a statically-allocated GQueue, use #G_QUEUE_INIT or + * g_queue_init(). + * + * To add elements, use g_queue_push_head(), g_queue_push_head_link(), + * g_queue_push_tail() and g_queue_push_tail_link(). + * + * To remove elements, use g_queue_pop_head() and g_queue_pop_tail(). + * + * To free the entire queue, use g_queue_free(). + */ +#include "config.h" + +#include "gqueue.h" + +#include "gtestutils.h" + +/** + * g_queue_new: + * + * Creates a new #GQueue. + * + * Returns: a new #GQueue. + **/ +GQueue* +g_queue_new (void) +{ + return g_slice_new0 (GQueue); +} + +/** + * g_queue_free: + * @queue: a #GQueue. + * + * Frees the memory allocated for the #GQueue. Only call this function if + * @queue was created with g_queue_new(). If queue elements contain + * dynamically-allocated memory, they should be freed first. + **/ +void +g_queue_free (GQueue *queue) +{ + g_return_if_fail (queue != NULL); + + g_list_free (queue->head); + g_slice_free (GQueue, queue); +} + +/** + * g_queue_init: + * @queue: an uninitialized #GQueue + * + * A statically-allocated #GQueue must be initialized with this function + * before it can be used. Alternatively you can initialize it with + * #G_QUEUE_INIT. It is not necessary to initialize queues created with + * g_queue_new(). + * + * Since: 2.14 + **/ +void +g_queue_init (GQueue *queue) +{ + g_return_if_fail (queue != NULL); + + queue->head = queue->tail = NULL; + queue->length = 0; +} + +/** + * g_queue_clear: + * @queue: a #GQueue + * + * Removes all the elements in @queue. If queue elements contain + * dynamically-allocated memory, they should be freed first. + * + * Since: 2.14 + */ +void +g_queue_clear (GQueue *queue) +{ + g_return_if_fail (queue != NULL); + + g_list_free (queue->head); + g_queue_init (queue); +} + +/** + * g_queue_is_empty: + * @queue: a #GQueue. + * + * Returns %TRUE if the queue is empty. + * + * Returns: %TRUE if the queue is empty. + **/ +gboolean +g_queue_is_empty (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, TRUE); + + return queue->head == NULL; +} + +/** + * g_queue_get_length: + * @queue: a #GQueue + * + * Returns the number of items in @queue. + * + * Return value: The number of items in @queue. + * + * Since: 2.4 + **/ +guint +g_queue_get_length (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, 0); + + return queue->length; +} + +/** + * g_queue_reverse: + * @queue: a #GQueue + * + * Reverses the order of the items in @queue. + * + * Since: 2.4 + **/ +void +g_queue_reverse (GQueue *queue) +{ + g_return_if_fail (queue != NULL); + + queue->tail = queue->head; + queue->head = g_list_reverse (queue->head); +} + +/** + * g_queue_copy: + * @queue: a #GQueue + * + * Copies a @queue. Note that is a shallow copy. If the elements in the + * queue consist of pointers to data, the pointers are copied, but the + * actual data is not. + * + * Return value: A copy of @queue + * + * Since: 2.4 + **/ +GQueue * +g_queue_copy (GQueue *queue) +{ + GQueue *result; + GList *list; + + g_return_val_if_fail (queue != NULL, NULL); + + result = g_queue_new (); + + for (list = queue->head; list != NULL; list = list->next) + g_queue_push_tail (result, list->data); + + return result; +} + +/** + * g_queue_foreach: + * @queue: a #GQueue + * @func: the function to call for each element's data + * @user_data: user data to pass to @func + * + * Calls @func for each element in the queue passing @user_data to the + * function. + * + * Since: 2.4 + **/ +void +g_queue_foreach (GQueue *queue, + GFunc func, + gpointer user_data) +{ + GList *list; + + g_return_if_fail (queue != NULL); + g_return_if_fail (func != NULL); + + list = queue->head; + while (list) + { + GList *next = list->next; + func (list->data, user_data); + list = next; + } +} + +/** + * g_queue_find: + * @queue: a #GQueue + * @data: data to find + * + * Finds the first link in @queue which contains @data. + * + * Return value: The first link in @queue which contains @data. + * + * Since: 2.4 + **/ +GList * +g_queue_find (GQueue *queue, + gconstpointer data) +{ + g_return_val_if_fail (queue != NULL, NULL); + + return g_list_find (queue->head, data); +} + +/** + * g_queue_find_custom: + * @queue: a #GQueue + * @data: user data passed to @func + * @func: a #GCompareFunc to call for each element. It should return 0 + * when the desired element is found + * + * Finds an element in a #GQueue, using a supplied function to find the + * desired element. It iterates over the queue, calling the given function + * which should return 0 when the desired element is found. The function + * takes two gconstpointer arguments, the #GQueue element's data as the + * first argument and the given user data as the second argument. + * + * Return value: The found link, or %NULL if it wasn't found + * + * Since: 2.4 + **/ +GList * +g_queue_find_custom (GQueue *queue, + gconstpointer data, + GCompareFunc func) +{ + g_return_val_if_fail (queue != NULL, NULL); + g_return_val_if_fail (func != NULL, NULL); + + return g_list_find_custom (queue->head, data, func); +} + +/** + * g_queue_sort: + * @queue: a #GQueue + * @compare_func: the #GCompareDataFunc used to sort @queue. This function + * is passed two elements of the queue and should return 0 if they are + * equal, a negative value if the first comes before the second, and + * a positive value if the second comes before the first. + * @user_data: user data passed to @compare_func + * + * Sorts @queue using @compare_func. + * + * Since: 2.4 + **/ +void +g_queue_sort (GQueue *queue, + GCompareDataFunc compare_func, + gpointer user_data) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (compare_func != NULL); + + queue->head = g_list_sort_with_data (queue->head, compare_func, user_data); + queue->tail = g_list_last (queue->head); +} + +/** + * g_queue_push_head: + * @queue: a #GQueue. + * @data: the data for the new element. + * + * Adds a new element at the head of the queue. + **/ +void +g_queue_push_head (GQueue *queue, + gpointer data) +{ + g_return_if_fail (queue != NULL); + + queue->head = g_list_prepend (queue->head, data); + if (!queue->tail) + queue->tail = queue->head; + queue->length++; +} + +/** + * g_queue_push_nth: + * @queue: a #GQueue + * @data: the data for the new element + * @n: the position to insert the new element. If @n is negative or + * larger than the number of elements in the @queue, the element is + * added to the end of the queue. + * + * Inserts a new element into @queue at the given position + * + * Since: 2.4 + **/ +void +g_queue_push_nth (GQueue *queue, + gpointer data, + gint n) +{ + g_return_if_fail (queue != NULL); + + if (n < 0 || n >= queue->length) + { + g_queue_push_tail (queue, data); + return; + } + + g_queue_insert_before (queue, g_queue_peek_nth_link (queue, n), data); +} + +/** + * g_queue_push_head_link: + * @queue: a #GQueue. + * @link_: a single #GList element, not a list with + * more than one element. + * + * Adds a new element at the head of the queue. + **/ +void +g_queue_push_head_link (GQueue *queue, + GList *link) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (link != NULL); + g_return_if_fail (link->prev == NULL); + g_return_if_fail (link->next == NULL); + + link->next = queue->head; + if (queue->head) + queue->head->prev = link; + else + queue->tail = link; + queue->head = link; + queue->length++; +} + +/** + * g_queue_push_tail: + * @queue: a #GQueue. + * @data: the data for the new element. + * + * Adds a new element at the tail of the queue. + **/ +void +g_queue_push_tail (GQueue *queue, + gpointer data) +{ + g_return_if_fail (queue != NULL); + + queue->tail = g_list_append (queue->tail, data); + if (queue->tail->next) + queue->tail = queue->tail->next; + else + queue->head = queue->tail; + queue->length++; +} + +/** + * g_queue_push_tail_link: + * @queue: a #GQueue. + * @link_: a single #GList element, not a list with + * more than one element. + * + * Adds a new element at the tail of the queue. + **/ +void +g_queue_push_tail_link (GQueue *queue, + GList *link) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (link != NULL); + g_return_if_fail (link->prev == NULL); + g_return_if_fail (link->next == NULL); + + link->prev = queue->tail; + if (queue->tail) + queue->tail->next = link; + else + queue->head = link; + queue->tail = link; + queue->length++; +} + +/** + * g_queue_push_nth_link: + * @queue: a #GQueue + * @n: the position to insert the link. If this is negative or larger than + * the number of elements in @queue, the link is added to the end of + * @queue. + * @link_: the link to add to @queue + * + * Inserts @link into @queue at the given position. + * + * Since: 2.4 + **/ +void +g_queue_push_nth_link (GQueue *queue, + gint n, + GList *link_) +{ + GList *next; + GList *prev; + + g_return_if_fail (queue != NULL); + g_return_if_fail (link_ != NULL); + + if (n < 0 || n >= queue->length) + { + g_queue_push_tail_link (queue, link_); + return; + } + + g_assert (queue->head); + g_assert (queue->tail); + + next = g_queue_peek_nth_link (queue, n); + prev = next->prev; + + if (prev) + prev->next = link_; + next->prev = link_; + + link_->next = next; + link_->prev = prev; + + if (queue->head->prev) + queue->head = queue->head->prev; + + if (queue->tail->next) + queue->tail = queue->tail->next; + + queue->length++; +} + +/** + * g_queue_pop_head: + * @queue: a #GQueue. + * + * Removes the first element of the queue. + * + * Returns: the data of the first element in the queue, or %NULL if the queue + * is empty. + **/ +gpointer +g_queue_pop_head (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + if (queue->head) + { + GList *node = queue->head; + gpointer data = node->data; + + queue->head = node->next; + if (queue->head) + queue->head->prev = NULL; + else + queue->tail = NULL; + g_list_free_1 (node); + queue->length--; + + return data; + } + + return NULL; +} + +/** + * g_queue_pop_head_link: + * @queue: a #GQueue. + * + * Removes the first element of the queue. + * + * Returns: the #GList element at the head of the queue, or %NULL if the queue + * is empty. + **/ +GList* +g_queue_pop_head_link (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + if (queue->head) + { + GList *node = queue->head; + + queue->head = node->next; + if (queue->head) + { + queue->head->prev = NULL; + node->next = NULL; + } + else + queue->tail = NULL; + queue->length--; + + return node; + } + + return NULL; +} + +/** + * g_queue_peek_head_link: + * @queue: a #GQueue + * + * Returns the first link in @queue + * + * Return value: the first link in @queue, or %NULL if @queue is empty + * + * Since: 2.4 + **/ +GList* +g_queue_peek_head_link (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + return queue->head; +} + +/** + * g_queue_peek_tail_link: + * @queue: a #GQueue + * + * Returns the last link @queue. + * + * Return value: the last link in @queue, or %NULL if @queue is empty + * + * Since: 2.4 + **/ +GList* +g_queue_peek_tail_link (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + return queue->tail; +} + +/** + * g_queue_pop_tail: + * @queue: a #GQueue. + * + * Removes the last element of the queue. + * + * Returns: the data of the last element in the queue, or %NULL if the queue + * is empty. + **/ +gpointer +g_queue_pop_tail (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + if (queue->tail) + { + GList *node = queue->tail; + gpointer data = node->data; + + queue->tail = node->prev; + if (queue->tail) + queue->tail->next = NULL; + else + queue->head = NULL; + queue->length--; + g_list_free_1 (node); + + return data; + } + + return NULL; +} + +/** + * g_queue_pop_nth: + * @queue: a #GQueue + * @n: the position of the element. + * + * Removes the @n'th element of @queue. + * + * Return value: the element's data, or %NULL if @n is off the end of @queue. + * + * Since: 2.4 + **/ +gpointer +g_queue_pop_nth (GQueue *queue, + guint n) +{ + GList *nth_link; + gpointer result; + + g_return_val_if_fail (queue != NULL, NULL); + + if (n >= queue->length) + return NULL; + + nth_link = g_queue_peek_nth_link (queue, n); + result = nth_link->data; + + g_queue_delete_link (queue, nth_link); + + return result; +} + +/** + * g_queue_pop_tail_link: + * @queue: a #GQueue. + * + * Removes the last element of the queue. + * + * Returns: the #GList element at the tail of the queue, or %NULL if the queue + * is empty. + **/ +GList* +g_queue_pop_tail_link (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + if (queue->tail) + { + GList *node = queue->tail; + + queue->tail = node->prev; + if (queue->tail) + { + queue->tail->next = NULL; + node->prev = NULL; + } + else + queue->head = NULL; + queue->length--; + + return node; + } + + return NULL; +} + +/** + * g_queue_pop_nth_link: + * @queue: a #GQueue + * @n: the link's position + * + * Removes and returns the link at the given position. + * + * Return value: The @n'th link, or %NULL if @n is off the end of @queue. + * + * Since: 2.4 + **/ +GList* +g_queue_pop_nth_link (GQueue *queue, + guint n) +{ + GList *link; + + g_return_val_if_fail (queue != NULL, NULL); + + if (n >= queue->length) + return NULL; + + link = g_queue_peek_nth_link (queue, n); + g_queue_unlink (queue, link); + + return link; +} + +/** + * g_queue_peek_nth_link: + * @queue: a #GQueue + * @n: the position of the link + * + * Returns the link at the given position + * + * Return value: The link at the @n'th position, or %NULL if @n is off the + * end of the list + * + * Since: 2.4 + **/ +GList * +g_queue_peek_nth_link (GQueue *queue, + guint n) +{ + GList *link; + gint i; + + g_return_val_if_fail (queue != NULL, NULL); + + if (n >= queue->length) + return NULL; + + if (n > queue->length / 2) + { + n = queue->length - n - 1; + + link = queue->tail; + for (i = 0; i < n; ++i) + link = link->prev; + } + else + { + link = queue->head; + for (i = 0; i < n; ++i) + link = link->next; + } + + return link; +} + +/** + * g_queue_link_index: + * @queue: a #GQueue + * @link_: A #GList link + * + * Returns the position of @link_ in @queue. + * + * Return value: The position of @link_, or -1 if the link is + * not part of @queue + * + * Since: 2.4 + **/ +gint +g_queue_link_index (GQueue *queue, + GList *link_) +{ + g_return_val_if_fail (queue != NULL, -1); + + return g_list_position (queue->head, link_); +} + +/** + * g_queue_unlink + * @queue: a #GQueue + * @link_: a #GList link that must be part of @queue + * + * Unlinks @link_ so that it will no longer be part of @queue. The link is + * not freed. + * + * @link_ must be part of @queue, + * + * Since: 2.4 + **/ +void +g_queue_unlink (GQueue *queue, + GList *link_) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (link_ != NULL); + + if (link_ == queue->tail) + queue->tail = queue->tail->prev; + + queue->head = g_list_remove_link (queue->head, link_); + queue->length--; +} + +/** + * g_queue_delete_link: + * @queue: a #GQueue + * @link_: a #GList link that must be part of @queue + * + * Removes @link_ from @queue and frees it. + * + * @link_ must be part of @queue. + * + * Since: 2.4 + **/ +void +g_queue_delete_link (GQueue *queue, + GList *link_) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (link_ != NULL); + + g_queue_unlink (queue, link_); + g_list_free (link_); +} + +/** + * g_queue_peek_head: + * @queue: a #GQueue. + * + * Returns the first element of the queue. + * + * Returns: the data of the first element in the queue, or %NULL if the queue + * is empty. + **/ +gpointer +g_queue_peek_head (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + return queue->head ? queue->head->data : NULL; +} + +/** + * g_queue_peek_tail: + * @queue: a #GQueue. + * + * Returns the last element of the queue. + * + * Returns: the data of the last element in the queue, or %NULL if the queue + * is empty. + **/ +gpointer +g_queue_peek_tail (GQueue *queue) +{ + g_return_val_if_fail (queue != NULL, NULL); + + return queue->tail ? queue->tail->data : NULL; +} + +/** + * g_queue_peek_nth: + * @queue: a #GQueue + * @n: the position of the element. + * + * Returns the @n'th element of @queue. + * + * Return value: The data for the @n'th element of @queue, or %NULL if @n is + * off the end of @queue. + * + * Since: 2.4 + **/ +gpointer +g_queue_peek_nth (GQueue *queue, + guint n) +{ + GList *link; + + g_return_val_if_fail (queue != NULL, NULL); + + link = g_queue_peek_nth_link (queue, n); + + if (link) + return link->data; + + return NULL; +} + +/** + * g_queue_index: + * @queue: a #GQueue + * @data: the data to find. + * + * Returns the position of the first element in @queue which contains @data. + * + * Return value: The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data. + * + * Since: 2.4 + **/ +gint +g_queue_index (GQueue *queue, + gconstpointer data) +{ + g_return_val_if_fail (queue != NULL, -1); + + return g_list_index (queue->head, data); +} + +/** + * g_queue_remove: + * @queue: a #GQueue + * @data: data to remove. + * + * Removes the first element in @queue that contains @data. + * + * Return value: %TRUE if @data was found and removed from @queue + * + * Since: 2.4 + **/ +gboolean +g_queue_remove (GQueue *queue, + gconstpointer data) +{ + GList *link; + + g_return_val_if_fail (queue != NULL, FALSE); + + link = g_list_find (queue->head, data); + + if (link) + g_queue_delete_link (queue, link); + + return (link != NULL); +} + +/** + * g_queue_remove_all: + * @queue: a #GQueue + * @data: data to remove + * + * Remove all elements whose data equals @data from @queue. + * + * Return value: the number of elements removed from @queue + * + * Since: 2.4 + **/ +guint +g_queue_remove_all (GQueue *queue, + gconstpointer data) +{ + GList *list; + guint old_length; + + g_return_val_if_fail (queue != NULL, 0); + + old_length = queue->length; + + list = queue->head; + while (list) + { + GList *next = list->next; + + if (list->data == data) + g_queue_delete_link (queue, list); + + list = next; + } + + return (old_length - queue->length); +} + +/** + * g_queue_insert_before: + * @queue: a #GQueue + * @sibling: a #GList link that must be part of @queue + * @data: the data to insert + * + * Inserts @data into @queue before @sibling. + * + * @sibling must be part of @queue. + * + * Since: 2.4 + **/ +void +g_queue_insert_before (GQueue *queue, + GList *sibling, + gpointer data) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (sibling != NULL); + + queue->head = g_list_insert_before (queue->head, sibling, data); + queue->length++; +} + +/** + * g_queue_insert_after: + * @queue: a #GQueue + * @sibling: a #GList link that must be part of @queue + * @data: the data to insert + * + * Inserts @data into @queue after @sibling + * + * @sibling must be part of @queue + * + * Since: 2.4 + **/ +void +g_queue_insert_after (GQueue *queue, + GList *sibling, + gpointer data) +{ + g_return_if_fail (queue != NULL); + g_return_if_fail (sibling != NULL); + + if (sibling == queue->tail) + g_queue_push_tail (queue, data); + else + g_queue_insert_before (queue, sibling->next, data); +} + +/** + * g_queue_insert_sorted: + * @queue: a #GQueue + * @data: the data to insert + * @func: the #GCompareDataFunc used to compare elements in the queue. It is + * called with two elements of the @queue and @user_data. It should + * return 0 if the elements are equal, a negative value if the first + * element comes before the second, and a positive value if the second + * element comes before the first. + * @user_data: user data passed to @func. + * + * Inserts @data into @queue using @func to determine the new position. + * + * Since: 2.4 + **/ +void +g_queue_insert_sorted (GQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data) +{ + GList *list; + + g_return_if_fail (queue != NULL); + + list = queue->head; + while (list && func (list->data, data, user_data) < 0) + list = list->next; + + if (list) + g_queue_insert_before (queue, list, data); + else + g_queue_push_tail (queue, data); +} diff --git a/deps/glib/gqueue.h b/deps/glib/gqueue.h new file mode 100644 index 0000000..591a09a --- /dev/null +++ b/deps/glib/gqueue.h @@ -0,0 +1,150 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_QUEUE_H__ +#define __G_QUEUE_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GQueue GQueue; + +/** + * GQueue: + * @head: a pointer to the first element of the queue + * @tail: a pointer to the last element of the queue + * @length: the number of elements in the queue + * + * Contains the public fields of a + * Queue. + */ +struct _GQueue +{ + GList *head; + GList *tail; + guint length; +}; + +/** + * G_QUEUE_INIT: + * + * A statically-allocated #GQueue must be initialized with this + * macro before it can be used. This macro can be used to initialize + * a variable, but it cannot be assigned to a variable. In that case + * you have to use g_queue_init(). + * + * |[ + * GQueue my_queue = G_QUEUE_INIT; + * ]| + * + * Since: 2.14 + */ +#define G_QUEUE_INIT { NULL, NULL, 0 } + +/* Queues + */ +GQueue* g_queue_new (void); +void g_queue_free (GQueue *queue); +void g_queue_init (GQueue *queue); +void g_queue_clear (GQueue *queue); +gboolean g_queue_is_empty (GQueue *queue); +guint g_queue_get_length (GQueue *queue); +void g_queue_reverse (GQueue *queue); +GQueue * g_queue_copy (GQueue *queue); +void g_queue_foreach (GQueue *queue, + GFunc func, + gpointer user_data); +GList * g_queue_find (GQueue *queue, + gconstpointer data); +GList * g_queue_find_custom (GQueue *queue, + gconstpointer data, + GCompareFunc func); +void g_queue_sort (GQueue *queue, + GCompareDataFunc compare_func, + gpointer user_data); + +void g_queue_push_head (GQueue *queue, + gpointer data); +void g_queue_push_tail (GQueue *queue, + gpointer data); +void g_queue_push_nth (GQueue *queue, + gpointer data, + gint n); +gpointer g_queue_pop_head (GQueue *queue); +gpointer g_queue_pop_tail (GQueue *queue); +gpointer g_queue_pop_nth (GQueue *queue, + guint n); +gpointer g_queue_peek_head (GQueue *queue); +gpointer g_queue_peek_tail (GQueue *queue); +gpointer g_queue_peek_nth (GQueue *queue, + guint n); +gint g_queue_index (GQueue *queue, + gconstpointer data); +gboolean g_queue_remove (GQueue *queue, + gconstpointer data); +guint g_queue_remove_all (GQueue *queue, + gconstpointer data); +void g_queue_insert_before (GQueue *queue, + GList *sibling, + gpointer data); +void g_queue_insert_after (GQueue *queue, + GList *sibling, + gpointer data); +void g_queue_insert_sorted (GQueue *queue, + gpointer data, + GCompareDataFunc func, + gpointer user_data); + +void g_queue_push_head_link (GQueue *queue, + GList *link_); +void g_queue_push_tail_link (GQueue *queue, + GList *link_); +void g_queue_push_nth_link (GQueue *queue, + gint n, + GList *link_); +GList* g_queue_pop_head_link (GQueue *queue); +GList* g_queue_pop_tail_link (GQueue *queue); +GList* g_queue_pop_nth_link (GQueue *queue, + guint n); +GList* g_queue_peek_head_link (GQueue *queue); +GList* g_queue_peek_tail_link (GQueue *queue); +GList* g_queue_peek_nth_link (GQueue *queue, + guint n); +gint g_queue_link_index (GQueue *queue, + GList *link_); +void g_queue_unlink (GQueue *queue, + GList *link_); +void g_queue_delete_link (GQueue *queue, + GList *link_); + +G_END_DECLS + +#endif /* __G_QUEUE_H__ */ diff --git a/deps/glib/gslice.c b/deps/glib/gslice.c new file mode 100644 index 0000000..2160772 --- /dev/null +++ b/deps/glib/gslice.c @@ -0,0 +1,1495 @@ +/* GLIB sliced memory - fast concurrent memory chunk allocator + * Copyright (C) 2005 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +/* MT safe */ + +#include "config.h" +#include "glibconfig.h" + +#if defined HAVE_POSIX_MEMALIGN && defined POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS +# define HAVE_COMPLIANT_POSIX_MEMALIGN 1 +#endif + +#if defined(HAVE_COMPLIANT_POSIX_MEMALIGN) && !defined(_XOPEN_SOURCE) +#define _XOPEN_SOURCE 600 /* posix_memalign() */ +#endif +#include /* posix_memalign() */ +#include +#include + +#ifdef HAVE_UNISTD_H +#include /* sysconf() */ +#endif +#ifdef G_OS_WIN32 +#include +#include +#endif + +#include /* fputs/fprintf */ + +#include "gslice.h" + +#include "gmain.h" +#include "gmem.h" /* gslice.h */ +#include "gstrfuncs.h" +#include "gutils.h" +#include "gtestutils.h" +#include "gthread.h" +#include "gthreadprivate.h" +#include "glib_trace.h" + +/* the GSlice allocator is split up into 4 layers, roughly modelled after the slab + * allocator and magazine extensions as outlined in: + * + [Bonwick94] Jeff Bonwick, The slab allocator: An object-caching kernel + * memory allocator. USENIX 1994, http://citeseer.ist.psu.edu/bonwick94slab.html + * + [Bonwick01] Bonwick and Jonathan Adams, Magazines and vmem: Extending the + * slab allocator to many cpu's and arbitrary resources. + * USENIX 2001, http://citeseer.ist.psu.edu/bonwick01magazines.html + * the layers are: + * - the thread magazines. for each (aligned) chunk size, a magazine (a list) + * of recently freed and soon to be allocated chunks is maintained per thread. + * this way, most alloc/free requests can be quickly satisfied from per-thread + * free lists which only require one g_private_get() call to retrive the + * thread handle. + * - the magazine cache. allocating and freeing chunks to/from threads only + * occours at magazine sizes from a global depot of magazines. the depot + * maintaines a 15 second working set of allocated magazines, so full + * magazines are not allocated and released too often. + * the chunk size dependent magazine sizes automatically adapt (within limits, + * see [3]) to lock contention to properly scale performance across a variety + * of SMP systems. + * - the slab allocator. this allocator allocates slabs (blocks of memory) close + * to the system page size or multiples thereof which have to be page aligned. + * the blocks are divided into smaller chunks which are used to satisfy + * allocations from the upper layers. the space provided by the reminder of + * the chunk size division is used for cache colorization (random distribution + * of chunk addresses) to improve processor cache utilization. multiple slabs + * with the same chunk size are kept in a partially sorted ring to allow O(1) + * freeing and allocation of chunks (as long as the allocation of an entirely + * new slab can be avoided). + * - the page allocator. on most modern systems, posix_memalign(3) or + * memalign(3) should be available, so this is used to allocate blocks with + * system page size based alignments and sizes or multiples thereof. + * if no memalign variant is provided, valloc() is used instead and + * block sizes are limited to the system page size (no multiples thereof). + * as a fallback, on system without even valloc(), a malloc(3)-based page + * allocator with alloc-only behaviour is used. + * + * NOTES: + * [1] some systems memalign(3) implementations may rely on boundary tagging for + * the handed out memory chunks. to avoid excessive page-wise fragmentation, + * we reserve 2 * sizeof (void*) per block size for the systems memalign(3), + * specified in NATIVE_MALLOC_PADDING. + * [2] using the slab allocator alone already provides for a fast and efficient + * allocator, it doesn't properly scale beyond single-threaded uses though. + * also, the slab allocator implements eager free(3)-ing, i.e. does not + * provide any form of caching or working set maintenance. so if used alone, + * it's vulnerable to trashing for sequences of balanced (alloc, free) pairs + * at certain thresholds. + * [3] magazine sizes are bound by an implementation specific minimum size and + * a chunk size specific maximum to limit magazine storage sizes to roughly + * 16KB. + * [4] allocating ca. 8 chunks per block/page keeps a good balance between + * external and internal fragmentation (<= 12.5%). [Bonwick94] + */ + +/* --- macros and constants --- */ +#define LARGEALIGNMENT (256) +#define P2ALIGNMENT (2 * sizeof (gsize)) /* fits 2 pointers (assumed to be 2 * GLIB_SIZEOF_SIZE_T below) */ +#define ALIGN(size, base) ((base) * (gsize) (((size) + (base) - 1) / (base))) +#define NATIVE_MALLOC_PADDING P2ALIGNMENT /* per-page padding left for native malloc(3) see [1] */ +#define SLAB_INFO_SIZE P2ALIGN (sizeof (SlabInfo) + NATIVE_MALLOC_PADDING) +#define MAX_MAGAZINE_SIZE (256) /* see [3] and allocator_get_magazine_threshold() for this */ +#define MIN_MAGAZINE_SIZE (4) +#define MAX_STAMP_COUNTER (7) /* distributes the load of gettimeofday() */ +#define MAX_SLAB_CHUNK_SIZE(al) (((al)->max_page_size - SLAB_INFO_SIZE) / 8) /* we want at last 8 chunks per page, see [4] */ +#define MAX_SLAB_INDEX(al) (SLAB_INDEX (al, MAX_SLAB_CHUNK_SIZE (al)) + 1) +#define SLAB_INDEX(al, asize) ((asize) / P2ALIGNMENT - 1) /* asize must be P2ALIGNMENT aligned */ +#define SLAB_CHUNK_SIZE(al, ix) (((ix) + 1) * P2ALIGNMENT) +#define SLAB_BPAGE_SIZE(al,csz) (8 * (csz) + SLAB_INFO_SIZE) + +/* optimized version of ALIGN (size, P2ALIGNMENT) */ +#if GLIB_SIZEOF_SIZE_T * 2 == 8 /* P2ALIGNMENT */ +#define P2ALIGN(size) (((size) + 0x7) & ~(gsize) 0x7) +#elif GLIB_SIZEOF_SIZE_T * 2 == 16 /* P2ALIGNMENT */ +#define P2ALIGN(size) (((size) + 0xf) & ~(gsize) 0xf) +#else +#define P2ALIGN(size) ALIGN (size, P2ALIGNMENT) +#endif + +/* special helpers to avoid gmessage.c dependency */ +static void mem_error (const char *format, ...) G_GNUC_PRINTF (1,2); +#define mem_assert(cond) do { if (G_LIKELY (cond)) ; else mem_error ("assertion failed: %s", #cond); } while (0) + +/* --- structures --- */ +typedef struct _ChunkLink ChunkLink; +typedef struct _SlabInfo SlabInfo; +typedef struct _CachedMagazine CachedMagazine; +struct _ChunkLink { + ChunkLink *next; + ChunkLink *data; +}; +struct _SlabInfo { + ChunkLink *chunks; + guint n_allocated; + SlabInfo *next, *prev; +}; +typedef struct { + ChunkLink *chunks; + gsize count; /* approximative chunks list length */ +} Magazine; +typedef struct { + Magazine *magazine1; /* array of MAX_SLAB_INDEX (allocator) */ + Magazine *magazine2; /* array of MAX_SLAB_INDEX (allocator) */ +} ThreadMemory; +typedef struct { + gboolean always_malloc; + gboolean bypass_magazines; + gboolean debug_blocks; + gsize working_set_msecs; + guint color_increment; +} SliceConfig; +typedef struct { + /* const after initialization */ + gsize min_page_size, max_page_size; + SliceConfig config; + gsize max_slab_chunk_size_for_magazine_cache; + /* magazine cache */ + GMutex *magazine_mutex; + ChunkLink **magazines; /* array of MAX_SLAB_INDEX (allocator) */ + guint *contention_counters; /* array of MAX_SLAB_INDEX (allocator) */ + gint mutex_counter; + guint stamp_counter; + guint last_stamp; + /* slab allocator */ + GMutex *slab_mutex; + SlabInfo **slab_stack; /* array of MAX_SLAB_INDEX (allocator) */ + guint color_accu; +} Allocator; + +/* --- g-slice prototypes --- */ +static gpointer slab_allocator_alloc_chunk (gsize chunk_size); +static void slab_allocator_free_chunk (gsize chunk_size, + gpointer mem); +static void private_thread_memory_cleanup (gpointer data); +static gpointer allocator_memalign (gsize alignment, + gsize memsize); +static void allocator_memfree (gsize memsize, + gpointer mem); +static inline void magazine_cache_update_stamp (void); +static inline gsize allocator_get_magazine_threshold (Allocator *allocator, + guint ix); + +/* --- g-slice memory checker --- */ +static void smc_notify_alloc (void *pointer, + size_t size); +static int smc_notify_free (void *pointer, + size_t size); + +/* --- variables --- */ +static GPrivate *private_thread_memory = NULL; +static gsize sys_page_size = 0; +static Allocator allocator[1] = { { 0, }, }; +static SliceConfig slice_config = { + FALSE, /* always_malloc */ + FALSE, /* bypass_magazines */ + FALSE, /* debug_blocks */ + 15 * 1000, /* working_set_msecs */ + 1, /* color increment, alt: 0x7fffffff */ +}; +static GMutex *smc_tree_mutex = NULL; /* mutex for G_SLICE=debug-blocks */ + +/* --- auxiliary funcitons --- */ +void +g_slice_set_config (GSliceConfig ckey, + gint64 value) +{ + g_return_if_fail (sys_page_size == 0); + switch (ckey) + { + case G_SLICE_CONFIG_ALWAYS_MALLOC: + slice_config.always_malloc = value != 0; + break; + case G_SLICE_CONFIG_BYPASS_MAGAZINES: + slice_config.bypass_magazines = value != 0; + break; + case G_SLICE_CONFIG_WORKING_SET_MSECS: + slice_config.working_set_msecs = value; + break; + case G_SLICE_CONFIG_COLOR_INCREMENT: + slice_config.color_increment = value; + default: ; + } +} + +gint64 +g_slice_get_config (GSliceConfig ckey) +{ + switch (ckey) + { + case G_SLICE_CONFIG_ALWAYS_MALLOC: + return slice_config.always_malloc; + case G_SLICE_CONFIG_BYPASS_MAGAZINES: + return slice_config.bypass_magazines; + case G_SLICE_CONFIG_WORKING_SET_MSECS: + return slice_config.working_set_msecs; + case G_SLICE_CONFIG_CHUNK_SIZES: + return MAX_SLAB_INDEX (allocator); + case G_SLICE_CONFIG_COLOR_INCREMENT: + return slice_config.color_increment; + default: + return 0; + } +} + +gint64* +g_slice_get_config_state (GSliceConfig ckey, + gint64 address, + guint *n_values) +{ + guint i = 0; + g_return_val_if_fail (n_values != NULL, NULL); + *n_values = 0; + switch (ckey) + { + gint64 array[64]; + case G_SLICE_CONFIG_CONTENTION_COUNTER: + array[i++] = SLAB_CHUNK_SIZE (allocator, address); + array[i++] = allocator->contention_counters[address]; + array[i++] = allocator_get_magazine_threshold (allocator, address); + *n_values = i; + return g_memdup (array, sizeof (array[0]) * *n_values); + default: + return NULL; + } +} + +static void +slice_config_init (SliceConfig *config) +{ + /* don't use g_malloc/g_message here */ + gchar buffer[1024]; + const gchar *val = _g_getenv_nomalloc ("G_SLICE", buffer); + const GDebugKey keys[] = { + { "always-malloc", 1 << 0 }, + { "debug-blocks", 1 << 1 }, + }; + gint flags = !val ? 0 : g_parse_debug_string (val, keys, G_N_ELEMENTS (keys)); + *config = slice_config; + if (flags & (1 << 0)) /* always-malloc */ + config->always_malloc = TRUE; + if (flags & (1 << 1)) /* debug-blocks */ + config->debug_blocks = TRUE; +} + +static void +g_slice_init_nomessage (void) +{ + /* we may not use g_error() or friends here */ + mem_assert (sys_page_size == 0); + mem_assert (MIN_MAGAZINE_SIZE >= 4); + +#ifdef G_OS_WIN32 + { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + sys_page_size = system_info.dwPageSize; + } +#else + sys_page_size = sysconf (_SC_PAGESIZE); /* = sysconf (_SC_PAGE_SIZE); = getpagesize(); */ +#endif + mem_assert (sys_page_size >= 2 * LARGEALIGNMENT); + mem_assert ((sys_page_size & (sys_page_size - 1)) == 0); + slice_config_init (&allocator->config); + allocator->min_page_size = sys_page_size; +#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN + /* allow allocation of pages up to 8KB (with 8KB alignment). + * this is useful because many medium to large sized structures + * fit less than 8 times (see [4]) into 4KB pages. + * we allow very small page sizes here, to reduce wastage in + * threads if only small allocations are required (this does + * bear the risk of incresing allocation times and fragmentation + * though). + */ + allocator->min_page_size = MAX (allocator->min_page_size, 4096); + allocator->max_page_size = MAX (allocator->min_page_size, 8192); + allocator->min_page_size = MIN (allocator->min_page_size, 128); +#else + /* we can only align to system page size */ + allocator->max_page_size = sys_page_size; +#endif + if (allocator->config.always_malloc) + { + allocator->contention_counters = NULL; + allocator->magazines = NULL; + allocator->slab_stack = NULL; + } + else + { + allocator->contention_counters = g_new0 (guint, MAX_SLAB_INDEX (allocator)); + allocator->magazines = g_new0 (ChunkLink*, MAX_SLAB_INDEX (allocator)); + allocator->slab_stack = g_new0 (SlabInfo*, MAX_SLAB_INDEX (allocator)); + } + + allocator->magazine_mutex = NULL; /* _g_slice_thread_init_nomessage() */ + allocator->mutex_counter = 0; + allocator->stamp_counter = MAX_STAMP_COUNTER; /* force initial update */ + allocator->last_stamp = 0; + allocator->slab_mutex = NULL; /* _g_slice_thread_init_nomessage() */ + allocator->color_accu = 0; + magazine_cache_update_stamp(); + /* values cached for performance reasons */ + allocator->max_slab_chunk_size_for_magazine_cache = MAX_SLAB_CHUNK_SIZE (allocator); + if (allocator->config.always_malloc || allocator->config.bypass_magazines) + allocator->max_slab_chunk_size_for_magazine_cache = 0; /* non-optimized cases */ + /* at this point, g_mem_gc_friendly() should be initialized, this + * should have been accomplished by the above g_malloc/g_new calls + */ +} + +static inline guint +allocator_categorize (gsize aligned_chunk_size) +{ + /* speed up the likely path */ + if (G_LIKELY (aligned_chunk_size && aligned_chunk_size <= allocator->max_slab_chunk_size_for_magazine_cache)) + return 1; /* use magazine cache */ + + /* the above will fail (max_slab_chunk_size_for_magazine_cache == 0) if the + * allocator is still uninitialized, or if we are not configured to use the + * magazine cache. + */ + if (!sys_page_size) + g_slice_init_nomessage (); + if (!allocator->config.always_malloc && + aligned_chunk_size && + aligned_chunk_size <= MAX_SLAB_CHUNK_SIZE (allocator)) + { + if (allocator->config.bypass_magazines) + return 2; /* use slab allocator, see [2] */ + return 1; /* use magazine cache */ + } + return 0; /* use malloc() */ +} + +void +_g_slice_thread_init_nomessage (void) +{ + /* we may not use g_error() or friends here */ + if (!sys_page_size) + g_slice_init_nomessage(); + else + { + /* g_slice_init_nomessage() has been called already, probably due + * to a g_slice_alloc1() before g_thread_init(). + */ + } + private_thread_memory = g_private_new (private_thread_memory_cleanup); + allocator->magazine_mutex = g_mutex_new(); + allocator->slab_mutex = g_mutex_new(); + if (allocator->config.debug_blocks) + smc_tree_mutex = g_mutex_new(); +} + +static inline void +g_mutex_lock_a (GMutex *mutex, + guint *contention_counter) +{ + gboolean contention = FALSE; + if (!g_mutex_trylock (mutex)) + { + g_mutex_lock (mutex); + contention = TRUE; + } + if (contention) + { + allocator->mutex_counter++; + if (allocator->mutex_counter >= 1) /* quickly adapt to contention */ + { + allocator->mutex_counter = 0; + *contention_counter = MIN (*contention_counter + 1, MAX_MAGAZINE_SIZE); + } + } + else /* !contention */ + { + allocator->mutex_counter--; + if (allocator->mutex_counter < -11) /* moderately recover magazine sizes */ + { + allocator->mutex_counter = 0; + *contention_counter = MAX (*contention_counter, 1) - 1; + } + } +} + +static inline ThreadMemory* +thread_memory_from_self (void) +{ + ThreadMemory *tmem = g_private_get (private_thread_memory); + if (G_UNLIKELY (!tmem)) + { + static ThreadMemory *single_thread_memory = NULL; /* remember single-thread info for multi-threaded case */ + if (single_thread_memory && g_thread_supported ()) + { + g_mutex_lock (allocator->slab_mutex); + if (single_thread_memory) + { + /* GSlice has been used before g_thread_init(), and now + * we are running threaded. to cope with it, use the saved + * thread memory structure from when we weren't threaded. + */ + tmem = single_thread_memory; + single_thread_memory = NULL; /* slab_mutex protected when multi-threaded */ + } + g_mutex_unlock (allocator->slab_mutex); + } + if (!tmem) + { + const guint n_magazines = MAX_SLAB_INDEX (allocator); + tmem = g_malloc0 (sizeof (ThreadMemory) + sizeof (Magazine) * 2 * n_magazines); + tmem->magazine1 = (Magazine*) (tmem + 1); + tmem->magazine2 = &tmem->magazine1[n_magazines]; + } + /* g_private_get/g_private_set works in the single-threaded xor the multi- + * threaded case. but not *across* g_thread_init(), after multi-thread + * initialization it returns NULL for previously set single-thread data. + */ + g_private_set (private_thread_memory, tmem); + /* save single-thread thread memory structure, in case we need to + * pick it up again after multi-thread initialization happened. + */ + if (!single_thread_memory && !g_thread_supported ()) + single_thread_memory = tmem; /* no slab_mutex created yet */ + } + return tmem; +} + +static inline ChunkLink* +magazine_chain_pop_head (ChunkLink **magazine_chunks) +{ + /* magazine chains are linked via ChunkLink->next. + * each ChunkLink->data of the toplevel chain may point to a subchain, + * linked via ChunkLink->next. ChunkLink->data of the subchains just + * contains uninitialized junk. + */ + ChunkLink *chunk = (*magazine_chunks)->data; + if (G_UNLIKELY (chunk)) + { + /* allocating from freed list */ + (*magazine_chunks)->data = chunk->next; + } + else + { + chunk = *magazine_chunks; + *magazine_chunks = chunk->next; + } + return chunk; +} + +#if 0 /* useful for debugging */ +static guint +magazine_count (ChunkLink *head) +{ + guint count = 0; + if (!head) + return 0; + while (head) + { + ChunkLink *child = head->data; + count += 1; + for (child = head->data; child; child = child->next) + count += 1; + head = head->next; + } + return count; +} +#endif + +static inline gsize +allocator_get_magazine_threshold (Allocator *allocator, + guint ix) +{ + /* the magazine size calculated here has a lower bound of MIN_MAGAZINE_SIZE, + * which is required by the implementation. also, for moderately sized chunks + * (say >= 64 bytes), magazine sizes shouldn't be much smaller then the number + * of chunks available per page/2 to avoid excessive traffic in the magazine + * cache for small to medium sized structures. + * the upper bound of the magazine size is effectively provided by + * MAX_MAGAZINE_SIZE. for larger chunks, this number is scaled down so that + * the content of a single magazine doesn't exceed ca. 16KB. + */ + gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix); + guint threshold = MAX (MIN_MAGAZINE_SIZE, allocator->max_page_size / MAX (5 * chunk_size, 5 * 32)); + guint contention_counter = allocator->contention_counters[ix]; + if (G_UNLIKELY (contention_counter)) /* single CPU bias */ + { + /* adapt contention counter thresholds to chunk sizes */ + contention_counter = contention_counter * 64 / chunk_size; + threshold = MAX (threshold, contention_counter); + } + return threshold; +} + +/* --- magazine cache --- */ +static inline void +magazine_cache_update_stamp (void) +{ + if (allocator->stamp_counter >= MAX_STAMP_COUNTER) + { + GTimeVal tv; + g_get_current_time (&tv); + allocator->last_stamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; /* milli seconds */ + allocator->stamp_counter = 0; + } + else + allocator->stamp_counter++; +} + +static inline ChunkLink* +magazine_chain_prepare_fields (ChunkLink *magazine_chunks) +{ + ChunkLink *chunk1; + ChunkLink *chunk2; + ChunkLink *chunk3; + ChunkLink *chunk4; + /* checked upon initialization: mem_assert (MIN_MAGAZINE_SIZE >= 4); */ + /* ensure a magazine with at least 4 unused data pointers */ + chunk1 = magazine_chain_pop_head (&magazine_chunks); + chunk2 = magazine_chain_pop_head (&magazine_chunks); + chunk3 = magazine_chain_pop_head (&magazine_chunks); + chunk4 = magazine_chain_pop_head (&magazine_chunks); + chunk4->next = magazine_chunks; + chunk3->next = chunk4; + chunk2->next = chunk3; + chunk1->next = chunk2; + return chunk1; +} + +/* access the first 3 fields of a specially prepared magazine chain */ +#define magazine_chain_prev(mc) ((mc)->data) +#define magazine_chain_stamp(mc) ((mc)->next->data) +#define magazine_chain_uint_stamp(mc) GPOINTER_TO_UINT ((mc)->next->data) +#define magazine_chain_next(mc) ((mc)->next->next->data) +#define magazine_chain_count(mc) ((mc)->next->next->next->data) + +static void +magazine_cache_trim (Allocator *allocator, + guint ix, + guint stamp) +{ + /* g_mutex_lock (allocator->mutex); done by caller */ + /* trim magazine cache from tail */ + ChunkLink *current = magazine_chain_prev (allocator->magazines[ix]); + ChunkLink *trash = NULL; + while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs) + { + /* unlink */ + ChunkLink *prev = magazine_chain_prev (current); + ChunkLink *next = magazine_chain_next (current); + magazine_chain_next (prev) = next; + magazine_chain_prev (next) = prev; + /* clear special fields, put on trash stack */ + magazine_chain_next (current) = NULL; + magazine_chain_count (current) = NULL; + magazine_chain_stamp (current) = NULL; + magazine_chain_prev (current) = trash; + trash = current; + /* fixup list head if required */ + if (current == allocator->magazines[ix]) + { + allocator->magazines[ix] = NULL; + break; + } + current = prev; + } + g_mutex_unlock (allocator->magazine_mutex); + /* free trash */ + if (trash) + { + const gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix); + g_mutex_lock (allocator->slab_mutex); + while (trash) + { + current = trash; + trash = magazine_chain_prev (current); + magazine_chain_prev (current) = NULL; /* clear special field */ + while (current) + { + ChunkLink *chunk = magazine_chain_pop_head (¤t); + slab_allocator_free_chunk (chunk_size, chunk); + } + } + g_mutex_unlock (allocator->slab_mutex); + } +} + +static void +magazine_cache_push_magazine (guint ix, + ChunkLink *magazine_chunks, + gsize count) /* must be >= MIN_MAGAZINE_SIZE */ +{ + ChunkLink *current = magazine_chain_prepare_fields (magazine_chunks); + ChunkLink *next, *prev; + g_mutex_lock (allocator->magazine_mutex); + /* add magazine at head */ + next = allocator->magazines[ix]; + if (next) + prev = magazine_chain_prev (next); + else + next = prev = current; + magazine_chain_next (prev) = current; + magazine_chain_prev (next) = current; + magazine_chain_prev (current) = prev; + magazine_chain_next (current) = next; + magazine_chain_count (current) = (gpointer) count; + /* stamp magazine */ + magazine_cache_update_stamp(); + magazine_chain_stamp (current) = GUINT_TO_POINTER (allocator->last_stamp); + allocator->magazines[ix] = current; + /* free old magazines beyond a certain threshold */ + magazine_cache_trim (allocator, ix, allocator->last_stamp); + /* g_mutex_unlock (allocator->mutex); was done by magazine_cache_trim() */ +} + +static ChunkLink* +magazine_cache_pop_magazine (guint ix, + gsize *countp) +{ + g_mutex_lock_a (allocator->magazine_mutex, &allocator->contention_counters[ix]); + if (!allocator->magazines[ix]) + { + guint magazine_threshold = allocator_get_magazine_threshold (allocator, ix); + gsize i, chunk_size = SLAB_CHUNK_SIZE (allocator, ix); + ChunkLink *chunk, *head; + g_mutex_unlock (allocator->magazine_mutex); + g_mutex_lock (allocator->slab_mutex); + head = slab_allocator_alloc_chunk (chunk_size); + head->data = NULL; + chunk = head; + for (i = 1; i < magazine_threshold; i++) + { + chunk->next = slab_allocator_alloc_chunk (chunk_size); + chunk = chunk->next; + chunk->data = NULL; + } + chunk->next = NULL; + g_mutex_unlock (allocator->slab_mutex); + *countp = i; + return head; + } + else + { + ChunkLink *current = allocator->magazines[ix]; + ChunkLink *prev = magazine_chain_prev (current); + ChunkLink *next = magazine_chain_next (current); + /* unlink */ + magazine_chain_next (prev) = next; + magazine_chain_prev (next) = prev; + allocator->magazines[ix] = next == current ? NULL : next; + g_mutex_unlock (allocator->magazine_mutex); + /* clear special fields and hand out */ + *countp = (gsize) magazine_chain_count (current); + magazine_chain_prev (current) = NULL; + magazine_chain_next (current) = NULL; + magazine_chain_count (current) = NULL; + magazine_chain_stamp (current) = NULL; + return current; + } +} + +/* --- thread magazines --- */ +static void +private_thread_memory_cleanup (gpointer data) +{ + ThreadMemory *tmem = data; + const guint n_magazines = MAX_SLAB_INDEX (allocator); + guint ix; + for (ix = 0; ix < n_magazines; ix++) + { + Magazine *mags[2]; + guint j; + mags[0] = &tmem->magazine1[ix]; + mags[1] = &tmem->magazine2[ix]; + for (j = 0; j < 2; j++) + { + Magazine *mag = mags[j]; + if (mag->count >= MIN_MAGAZINE_SIZE) + magazine_cache_push_magazine (ix, mag->chunks, mag->count); + else + { + const gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix); + g_mutex_lock (allocator->slab_mutex); + while (mag->chunks) + { + ChunkLink *chunk = magazine_chain_pop_head (&mag->chunks); + slab_allocator_free_chunk (chunk_size, chunk); + } + g_mutex_unlock (allocator->slab_mutex); + } + } + } + g_free (tmem); +} + +static void +thread_memory_magazine1_reload (ThreadMemory *tmem, + guint ix) +{ + Magazine *mag = &tmem->magazine1[ix]; + mem_assert (mag->chunks == NULL); /* ensure that we may reset mag->count */ + mag->count = 0; + mag->chunks = magazine_cache_pop_magazine (ix, &mag->count); +} + +static void +thread_memory_magazine2_unload (ThreadMemory *tmem, + guint ix) +{ + Magazine *mag = &tmem->magazine2[ix]; + magazine_cache_push_magazine (ix, mag->chunks, mag->count); + mag->chunks = NULL; + mag->count = 0; +} + +static inline void +thread_memory_swap_magazines (ThreadMemory *tmem, + guint ix) +{ + Magazine xmag = tmem->magazine1[ix]; + tmem->magazine1[ix] = tmem->magazine2[ix]; + tmem->magazine2[ix] = xmag; +} + +static inline gboolean +thread_memory_magazine1_is_empty (ThreadMemory *tmem, + guint ix) +{ + return tmem->magazine1[ix].chunks == NULL; +} + +static inline gboolean +thread_memory_magazine2_is_full (ThreadMemory *tmem, + guint ix) +{ + return tmem->magazine2[ix].count >= allocator_get_magazine_threshold (allocator, ix); +} + +static inline gpointer +thread_memory_magazine1_alloc (ThreadMemory *tmem, + guint ix) +{ + Magazine *mag = &tmem->magazine1[ix]; + ChunkLink *chunk = magazine_chain_pop_head (&mag->chunks); + if (G_LIKELY (mag->count > 0)) + mag->count--; + return chunk; +} + +static inline void +thread_memory_magazine2_free (ThreadMemory *tmem, + guint ix, + gpointer mem) +{ + Magazine *mag = &tmem->magazine2[ix]; + ChunkLink *chunk = mem; + chunk->data = NULL; + chunk->next = mag->chunks; + mag->chunks = chunk; + mag->count++; +} + +/* --- API functions --- */ +gpointer +g_slice_alloc (gsize mem_size) +{ + gsize chunk_size; + gpointer mem; + guint acat; + chunk_size = P2ALIGN (mem_size); + acat = allocator_categorize (chunk_size); + if (G_LIKELY (acat == 1)) /* allocate through magazine layer */ + { + ThreadMemory *tmem = thread_memory_from_self(); + guint ix = SLAB_INDEX (allocator, chunk_size); + if (G_UNLIKELY (thread_memory_magazine1_is_empty (tmem, ix))) + { + thread_memory_swap_magazines (tmem, ix); + if (G_UNLIKELY (thread_memory_magazine1_is_empty (tmem, ix))) + thread_memory_magazine1_reload (tmem, ix); + } + mem = thread_memory_magazine1_alloc (tmem, ix); + } + else if (acat == 2) /* allocate through slab allocator */ + { + g_mutex_lock (allocator->slab_mutex); + mem = slab_allocator_alloc_chunk (chunk_size); + g_mutex_unlock (allocator->slab_mutex); + } + else /* delegate to system malloc */ + mem = g_malloc (mem_size); + if (G_UNLIKELY (allocator->config.debug_blocks)) + smc_notify_alloc (mem, mem_size); + + TRACE (GLIB_SLICE_ALLOC((void*)mem, mem_size)); + + return mem; +} + +gpointer +g_slice_alloc0 (gsize mem_size) +{ + gpointer mem = g_slice_alloc (mem_size); + if (mem) + memset (mem, 0, mem_size); + return mem; +} + +gpointer +g_slice_copy (gsize mem_size, + gconstpointer mem_block) +{ + gpointer mem = g_slice_alloc (mem_size); + if (mem) + memcpy (mem, mem_block, mem_size); + return mem; +} + +void +g_slice_free1 (gsize mem_size, + gpointer mem_block) +{ + gsize chunk_size = P2ALIGN (mem_size); + guint acat = allocator_categorize (chunk_size); + if (G_UNLIKELY (!mem_block)) + return; + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (mem_block, mem_size)) + abort(); + if (G_LIKELY (acat == 1)) /* allocate through magazine layer */ + { + ThreadMemory *tmem = thread_memory_from_self(); + guint ix = SLAB_INDEX (allocator, chunk_size); + if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix))) + { + thread_memory_swap_magazines (tmem, ix); + if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix))) + thread_memory_magazine2_unload (tmem, ix); + } + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (mem_block, 0, chunk_size); + thread_memory_magazine2_free (tmem, ix, mem_block); + } + else if (acat == 2) /* allocate through slab allocator */ + { + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (mem_block, 0, chunk_size); + g_mutex_lock (allocator->slab_mutex); + slab_allocator_free_chunk (chunk_size, mem_block); + g_mutex_unlock (allocator->slab_mutex); + } + else /* delegate to system malloc */ + { + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (mem_block, 0, mem_size); + g_free (mem_block); + } + TRACE (GLIB_SLICE_FREE((void*)mem_block, mem_size)); +} + +void +g_slice_free_chain_with_offset (gsize mem_size, + gpointer mem_chain, + gsize next_offset) +{ + gpointer slice = mem_chain; + /* while the thread magazines and the magazine cache are implemented so that + * they can easily be extended to allow for free lists containing more free + * lists for the first level nodes, which would allow O(1) freeing in this + * function, the benefit of such an extension is questionable, because: + * - the magazine size counts will become mere lower bounds which confuses + * the code adapting to lock contention; + * - freeing a single node to the thread magazines is very fast, so this + * O(list_length) operation is multiplied by a fairly small factor; + * - memory usage histograms on larger applications seem to indicate that + * the amount of released multi node lists is negligible in comparison + * to single node releases. + * - the major performance bottle neck, namely g_private_get() or + * g_mutex_lock()/g_mutex_unlock() has already been moved out of the + * inner loop for freeing chained slices. + */ + gsize chunk_size = P2ALIGN (mem_size); + guint acat = allocator_categorize (chunk_size); + if (G_LIKELY (acat == 1)) /* allocate through magazine layer */ + { + ThreadMemory *tmem = thread_memory_from_self(); + guint ix = SLAB_INDEX (allocator, chunk_size); + while (slice) + { + guint8 *current = slice; + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) + abort(); + if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix))) + { + thread_memory_swap_magazines (tmem, ix); + if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix))) + thread_memory_magazine2_unload (tmem, ix); + } + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (current, 0, chunk_size); + thread_memory_magazine2_free (tmem, ix, current); + } + } + else if (acat == 2) /* allocate through slab allocator */ + { + g_mutex_lock (allocator->slab_mutex); + while (slice) + { + guint8 *current = slice; + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) + abort(); + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (current, 0, chunk_size); + slab_allocator_free_chunk (chunk_size, current); + } + g_mutex_unlock (allocator->slab_mutex); + } + else /* delegate to system malloc */ + while (slice) + { + guint8 *current = slice; + slice = *(gpointer*) (current + next_offset); + if (G_UNLIKELY (allocator->config.debug_blocks) && + !smc_notify_free (current, mem_size)) + abort(); + if (G_UNLIKELY (g_mem_gc_friendly)) + memset (current, 0, mem_size); + g_free (current); + } +} + +/* --- single page allocator --- */ +static void +allocator_slab_stack_push (Allocator *allocator, + guint ix, + SlabInfo *sinfo) +{ + /* insert slab at slab ring head */ + if (!allocator->slab_stack[ix]) + { + sinfo->next = sinfo; + sinfo->prev = sinfo; + } + else + { + SlabInfo *next = allocator->slab_stack[ix], *prev = next->prev; + next->prev = sinfo; + prev->next = sinfo; + sinfo->next = next; + sinfo->prev = prev; + } + allocator->slab_stack[ix] = sinfo; +} + +static gsize +allocator_aligned_page_size (Allocator *allocator, + gsize n_bytes) +{ + gsize val = 1 << g_bit_storage (n_bytes - 1); + val = MAX (val, allocator->min_page_size); + return val; +} + +static void +allocator_add_slab (Allocator *allocator, + guint ix, + gsize chunk_size) +{ + ChunkLink *chunk; + SlabInfo *sinfo; + gsize addr, padding, n_chunks, color = 0; + gsize page_size = allocator_aligned_page_size (allocator, SLAB_BPAGE_SIZE (allocator, chunk_size)); + /* allocate 1 page for the chunks and the slab */ + gpointer aligned_memory = allocator_memalign (page_size, page_size - NATIVE_MALLOC_PADDING); + guint8 *mem = aligned_memory; + guint i; + if (!mem) + { + const gchar *syserr = "unknown error"; +#if HAVE_STRERROR + syserr = strerror (errno); +#endif + mem_error ("failed to allocate %u bytes (alignment: %u): %s\n", + (guint) (page_size - NATIVE_MALLOC_PADDING), (guint) page_size, syserr); + } + /* mask page address */ + addr = ((gsize) mem / page_size) * page_size; + /* assert alignment */ + mem_assert (aligned_memory == (gpointer) addr); + /* basic slab info setup */ + sinfo = (SlabInfo*) (mem + page_size - SLAB_INFO_SIZE); + sinfo->n_allocated = 0; + sinfo->chunks = NULL; + /* figure cache colorization */ + n_chunks = ((guint8*) sinfo - mem) / chunk_size; + padding = ((guint8*) sinfo - mem) - n_chunks * chunk_size; + if (padding) + { + color = (allocator->color_accu * P2ALIGNMENT) % padding; + allocator->color_accu += allocator->config.color_increment; + } + /* add chunks to free list */ + chunk = (ChunkLink*) (mem + color); + sinfo->chunks = chunk; + for (i = 0; i < n_chunks - 1; i++) + { + chunk->next = (ChunkLink*) ((guint8*) chunk + chunk_size); + chunk = chunk->next; + } + chunk->next = NULL; /* last chunk */ + /* add slab to slab ring */ + allocator_slab_stack_push (allocator, ix, sinfo); +} + +static gpointer +slab_allocator_alloc_chunk (gsize chunk_size) +{ + ChunkLink *chunk; + guint ix = SLAB_INDEX (allocator, chunk_size); + /* ensure non-empty slab */ + if (!allocator->slab_stack[ix] || !allocator->slab_stack[ix]->chunks) + allocator_add_slab (allocator, ix, chunk_size); + /* allocate chunk */ + chunk = allocator->slab_stack[ix]->chunks; + allocator->slab_stack[ix]->chunks = chunk->next; + allocator->slab_stack[ix]->n_allocated++; + /* rotate empty slabs */ + if (!allocator->slab_stack[ix]->chunks) + allocator->slab_stack[ix] = allocator->slab_stack[ix]->next; + return chunk; +} + +static void +slab_allocator_free_chunk (gsize chunk_size, + gpointer mem) +{ + ChunkLink *chunk; + gboolean was_empty; + guint ix = SLAB_INDEX (allocator, chunk_size); + gsize page_size = allocator_aligned_page_size (allocator, SLAB_BPAGE_SIZE (allocator, chunk_size)); + gsize addr = ((gsize) mem / page_size) * page_size; + /* mask page address */ + guint8 *page = (guint8*) addr; + SlabInfo *sinfo = (SlabInfo*) (page + page_size - SLAB_INFO_SIZE); + /* assert valid chunk count */ + mem_assert (sinfo->n_allocated > 0); + /* add chunk to free list */ + was_empty = sinfo->chunks == NULL; + chunk = (ChunkLink*) mem; + chunk->next = sinfo->chunks; + sinfo->chunks = chunk; + sinfo->n_allocated--; + /* keep slab ring partially sorted, empty slabs at end */ + if (was_empty) + { + /* unlink slab */ + SlabInfo *next = sinfo->next, *prev = sinfo->prev; + next->prev = prev; + prev->next = next; + if (allocator->slab_stack[ix] == sinfo) + allocator->slab_stack[ix] = next == sinfo ? NULL : next; + /* insert slab at head */ + allocator_slab_stack_push (allocator, ix, sinfo); + } + /* eagerly free complete unused slabs */ + if (!sinfo->n_allocated) + { + /* unlink slab */ + SlabInfo *next = sinfo->next, *prev = sinfo->prev; + next->prev = prev; + prev->next = next; + if (allocator->slab_stack[ix] == sinfo) + allocator->slab_stack[ix] = next == sinfo ? NULL : next; + /* free slab */ + allocator_memfree (page_size, page); + } +} + +/* --- memalign implementation --- */ +#ifdef HAVE_MALLOC_H +#include /* memalign() */ +#endif + +/* from config.h: + * define HAVE_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works, + * define HAVE_COMPLIANT_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works for sizes != 2^n, + * define HAVE_MEMALIGN 1 // if free(memalign(3)) works, + * define HAVE_VALLOC 1 // if free(valloc(3)) works, or + * if none is provided, we implement malloc(3)-based alloc-only page alignment + */ + +#if !(HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC) +static GTrashStack *compat_valloc_trash = NULL; +#endif + +static gpointer +allocator_memalign (gsize alignment, + gsize memsize) +{ + gpointer aligned_memory = NULL; + gint err = ENOMEM; +#if HAVE_COMPLIANT_POSIX_MEMALIGN + err = posix_memalign (&aligned_memory, alignment, memsize); +#elif HAVE_MEMALIGN + errno = 0; + aligned_memory = memalign (alignment, memsize); + err = errno; +#elif HAVE_VALLOC + errno = 0; + aligned_memory = valloc (memsize); + err = errno; +#else + /* simplistic non-freeing page allocator */ + mem_assert (alignment == sys_page_size); + mem_assert (memsize <= sys_page_size); + if (!compat_valloc_trash) + { + const guint n_pages = 16; + guint8 *mem = malloc (n_pages * sys_page_size); + err = errno; + if (mem) + { + gint i = n_pages; + guint8 *amem = (guint8*) ALIGN ((gsize) mem, sys_page_size); + if (amem != mem) + i--; /* mem wasn't page aligned */ + while (--i >= 0) + g_trash_stack_push (&compat_valloc_trash, amem + i * sys_page_size); + } + } + aligned_memory = g_trash_stack_pop (&compat_valloc_trash); +#endif + if (!aligned_memory) + errno = err; + return aligned_memory; +} + +static void +allocator_memfree (gsize memsize, + gpointer mem) +{ +#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC + free (mem); +#else + mem_assert (memsize <= sys_page_size); + g_trash_stack_push (&compat_valloc_trash, mem); +#endif +} + +static void +mem_error (const char *format, + ...) +{ + const char *pname; + va_list args; + /* at least, put out "MEMORY-ERROR", in case we segfault during the rest of the function */ + fputs ("\n***MEMORY-ERROR***: ", stderr); + pname = g_get_prgname(); + fprintf (stderr, "%s[%ld]: GSlice: ", pname ? pname : "", (long)getpid()); + va_start (args, format); + vfprintf (stderr, format, args); + va_end (args); + fputs ("\n", stderr); + abort(); + _exit (1); +} + +/* --- g-slice memory checker tree --- */ +typedef size_t SmcKType; /* key type */ +typedef size_t SmcVType; /* value type */ +typedef struct { + SmcKType key; + SmcVType value; +} SmcEntry; +static void smc_tree_insert (SmcKType key, + SmcVType value); +static gboolean smc_tree_lookup (SmcKType key, + SmcVType *value_p); +static gboolean smc_tree_remove (SmcKType key); + + +/* --- g-slice memory checker implementation --- */ +static void +smc_notify_alloc (void *pointer, + size_t size) +{ + size_t adress = (size_t) pointer; + if (pointer) + smc_tree_insert (adress, size); +} + +#if 0 +static void +smc_notify_ignore (void *pointer) +{ + size_t adress = (size_t) pointer; + if (pointer) + smc_tree_remove (adress); +} +#endif + +static int +smc_notify_free (void *pointer, + size_t size) +{ + size_t adress = (size_t) pointer; + SmcVType real_size; + gboolean found_one; + + if (!pointer) + return 1; /* ignore */ + found_one = smc_tree_lookup (adress, &real_size); + if (!found_one) + { + fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size); + return 0; + } + if (real_size != size && (real_size || size)) + { + fprintf (stderr, "GSlice: MemChecker: attempt to release block with invalid size: %p size=%" G_GSIZE_FORMAT " invalid-size=%" G_GSIZE_FORMAT "\n", pointer, real_size, size); + return 0; + } + if (!smc_tree_remove (adress)) + { + fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size); + return 0; + } + return 1; /* all fine */ +} + +/* --- g-slice memory checker tree implementation --- */ +#define SMC_TRUNK_COUNT (4093 /* 16381 */) /* prime, to distribute trunk collisions (big, allocated just once) */ +#define SMC_BRANCH_COUNT (511) /* prime, to distribute branch collisions */ +#define SMC_TRUNK_EXTENT (SMC_BRANCH_COUNT * 2039) /* key adress space per trunk, should distribute uniformly across BRANCH_COUNT */ +#define SMC_TRUNK_HASH(k) ((k / SMC_TRUNK_EXTENT) % SMC_TRUNK_COUNT) /* generate new trunk hash per megabyte (roughly) */ +#define SMC_BRANCH_HASH(k) (k % SMC_BRANCH_COUNT) + +typedef struct { + SmcEntry *entries; + unsigned int n_entries; +} SmcBranch; + +static SmcBranch **smc_tree_root = NULL; + +static void +smc_tree_abort (int errval) +{ + const char *syserr = "unknown error"; +#if HAVE_STRERROR + syserr = strerror (errval); +#endif + mem_error ("MemChecker: failure in debugging tree: %s", syserr); +} + +static inline SmcEntry* +smc_tree_branch_grow_L (SmcBranch *branch, + unsigned int index) +{ + unsigned int old_size = branch->n_entries * sizeof (branch->entries[0]); + unsigned int new_size = old_size + sizeof (branch->entries[0]); + SmcEntry *entry; + mem_assert (index <= branch->n_entries); + branch->entries = (SmcEntry*) realloc (branch->entries, new_size); + if (!branch->entries) + smc_tree_abort (errno); + entry = branch->entries + index; + g_memmove (entry + 1, entry, (branch->n_entries - index) * sizeof (entry[0])); + branch->n_entries += 1; + return entry; +} + +static inline SmcEntry* +smc_tree_branch_lookup_nearest_L (SmcBranch *branch, + SmcKType key) +{ + unsigned int n_nodes = branch->n_entries, offs = 0; + SmcEntry *check = branch->entries; + int cmp = 0; + while (offs < n_nodes) + { + unsigned int i = (offs + n_nodes) >> 1; + check = branch->entries + i; + cmp = key < check->key ? -1 : key != check->key; + if (cmp == 0) + return check; /* return exact match */ + else if (cmp < 0) + n_nodes = i; + else /* (cmp > 0) */ + offs = i + 1; + } + /* check points at last mismatch, cmp > 0 indicates greater key */ + return cmp > 0 ? check + 1 : check; /* return insertion position for inexact match */ +} + +static void +smc_tree_insert (SmcKType key, + SmcVType value) +{ + unsigned int ix0, ix1; + SmcEntry *entry; + + g_mutex_lock (smc_tree_mutex); + ix0 = SMC_TRUNK_HASH (key); + ix1 = SMC_BRANCH_HASH (key); + if (!smc_tree_root) + { + smc_tree_root = calloc (SMC_TRUNK_COUNT, sizeof (smc_tree_root[0])); + if (!smc_tree_root) + smc_tree_abort (errno); + } + if (!smc_tree_root[ix0]) + { + smc_tree_root[ix0] = calloc (SMC_BRANCH_COUNT, sizeof (smc_tree_root[0][0])); + if (!smc_tree_root[ix0]) + smc_tree_abort (errno); + } + entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key); + if (!entry || /* need create */ + entry >= smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries || /* need append */ + entry->key != key) /* need insert */ + entry = smc_tree_branch_grow_L (&smc_tree_root[ix0][ix1], entry - smc_tree_root[ix0][ix1].entries); + entry->key = key; + entry->value = value; + g_mutex_unlock (smc_tree_mutex); +} + +static gboolean +smc_tree_lookup (SmcKType key, + SmcVType *value_p) +{ + SmcEntry *entry = NULL; + unsigned int ix0 = SMC_TRUNK_HASH (key), ix1 = SMC_BRANCH_HASH (key); + gboolean found_one = FALSE; + *value_p = 0; + g_mutex_lock (smc_tree_mutex); + if (smc_tree_root && smc_tree_root[ix0]) + { + entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key); + if (entry && + entry < smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries && + entry->key == key) + { + found_one = TRUE; + *value_p = entry->value; + } + } + g_mutex_unlock (smc_tree_mutex); + return found_one; +} + +static gboolean +smc_tree_remove (SmcKType key) +{ + unsigned int ix0 = SMC_TRUNK_HASH (key), ix1 = SMC_BRANCH_HASH (key); + gboolean found_one = FALSE; + g_mutex_lock (smc_tree_mutex); + if (smc_tree_root && smc_tree_root[ix0]) + { + SmcEntry *entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key); + if (entry && + entry < smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries && + entry->key == key) + { + unsigned int i = entry - smc_tree_root[ix0][ix1].entries; + smc_tree_root[ix0][ix1].n_entries -= 1; + g_memmove (entry, entry + 1, (smc_tree_root[ix0][ix1].n_entries - i) * sizeof (entry[0])); + if (!smc_tree_root[ix0][ix1].n_entries) + { + /* avoid useless pressure on the memory system */ + free (smc_tree_root[ix0][ix1].entries); + smc_tree_root[ix0][ix1].entries = NULL; + } + found_one = TRUE; + } + } + g_mutex_unlock (smc_tree_mutex); + return found_one; +} + +#ifdef G_ENABLE_DEBUG +void +g_slice_debug_tree_statistics (void) +{ + g_mutex_lock (smc_tree_mutex); + if (smc_tree_root) + { + unsigned int i, j, t = 0, o = 0, b = 0, su = 0, ex = 0, en = 4294967295u; + double tf, bf; + for (i = 0; i < SMC_TRUNK_COUNT; i++) + if (smc_tree_root[i]) + { + t++; + for (j = 0; j < SMC_BRANCH_COUNT; j++) + if (smc_tree_root[i][j].n_entries) + { + b++; + su += smc_tree_root[i][j].n_entries; + en = MIN (en, smc_tree_root[i][j].n_entries); + ex = MAX (ex, smc_tree_root[i][j].n_entries); + } + else if (smc_tree_root[i][j].entries) + o++; /* formerly used, now empty */ + } + en = b ? en : 0; + tf = MAX (t, 1.0); /* max(1) to be a valid divisor */ + bf = MAX (b, 1.0); /* max(1) to be a valid divisor */ + fprintf (stderr, "GSlice: MemChecker: %u trunks, %u branches, %u old branches\n", t, b, o); + fprintf (stderr, "GSlice: MemChecker: %f branches per trunk, %.2f%% utilization\n", + b / tf, + 100.0 - (SMC_BRANCH_COUNT - b / tf) / (0.01 * SMC_BRANCH_COUNT)); + fprintf (stderr, "GSlice: MemChecker: %f entries per branch, %u minimum, %u maximum\n", + su / bf, en, ex); + } + else + fprintf (stderr, "GSlice: MemChecker: root=NULL\n"); + g_mutex_unlock (smc_tree_mutex); + + /* sample statistics (beast + GSLice + 24h scripted core & GUI activity): + * PID %CPU %MEM VSZ RSS COMMAND + * 8887 30.3 45.8 456068 414856 beast-0.7.1 empty.bse + * $ cat /proc/8887/statm # total-program-size resident-set-size shared-pages text/code data/stack library dirty-pages + * 114017 103714 2354 344 0 108676 0 + * $ cat /proc/8887/status + * Name: beast-0.7.1 + * VmSize: 456068 kB + * VmLck: 0 kB + * VmRSS: 414856 kB + * VmData: 434620 kB + * VmStk: 84 kB + * VmExe: 1376 kB + * VmLib: 13036 kB + * VmPTE: 456 kB + * Threads: 3 + * (gdb) print g_slice_debug_tree_statistics () + * GSlice: MemChecker: 422 trunks, 213068 branches, 0 old branches + * GSlice: MemChecker: 504.900474 branches per trunk, 98.81% utilization + * GSlice: MemChecker: 4.965039 entries per branch, 1 minimum, 37 maximum + */ +} +#endif /* G_ENABLE_DEBUG */ diff --git a/deps/glib/gslice.h b/deps/glib/gslice.h new file mode 100644 index 0000000..962199e --- /dev/null +++ b/deps/glib/gslice.h @@ -0,0 +1,86 @@ +/* GLIB sliced memory - fast threaded memory chunk allocator + * Copyright (C) 2005 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_SLICE_H__ +#define __G_SLICE_H__ + +#include + +G_BEGIN_DECLS + +/* slices - fast allocation/release of small memory blocks + */ +gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +gpointer g_slice_copy (gsize block_size, + gconstpointer mem_block) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1); +void g_slice_free1 (gsize block_size, + gpointer mem_block); +void g_slice_free_chain_with_offset (gsize block_size, + gpointer mem_chain, + gsize next_offset); +#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type))) +#define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) +/* MemoryBlockType * + * g_slice_dup (MemoryBlockType, + * MemoryBlockType *mem_block); + * g_slice_free (MemoryBlockType, + * MemoryBlockType *mem_block); + * g_slice_free_chain (MemoryBlockType, + * MemoryBlockType *first_chain_block, + * memory_block_next_field); + * pseudo prototypes for the macro + * definitions following below. + */ + +/* we go through extra hoops to ensure type safety */ +#define g_slice_dup(type, mem) \ + (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \ + : ((void) ((type*) 0 == (mem)), (type*) 0)) +#define g_slice_free(type, mem) do { \ + if (1) g_slice_free1 (sizeof (type), (mem)); \ + else (void) ((type*) 0 == (mem)); \ +} while (0) +#define g_slice_free_chain(type, mem_chain, next) do { \ + if (1) g_slice_free_chain_with_offset (sizeof (type), \ + (mem_chain), G_STRUCT_OFFSET (type, next)); \ + else (void) ((type*) 0 == (mem_chain)); \ +} while (0) + + +/* --- internal debugging API --- */ +typedef enum { + G_SLICE_CONFIG_ALWAYS_MALLOC = 1, + G_SLICE_CONFIG_BYPASS_MAGAZINES, + G_SLICE_CONFIG_WORKING_SET_MSECS, + G_SLICE_CONFIG_COLOR_INCREMENT, + G_SLICE_CONFIG_CHUNK_SIZES, + G_SLICE_CONFIG_CONTENTION_COUNTER +} GSliceConfig; +void g_slice_set_config (GSliceConfig ckey, gint64 value); +gint64 g_slice_get_config (GSliceConfig ckey); +gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values); + +G_END_DECLS + +#endif /* __G_SLICE_H__ */ diff --git a/deps/glib/gslist.c b/deps/glib/gslist.c new file mode 100644 index 0000000..1de9c57 --- /dev/null +++ b/deps/glib/gslist.c @@ -0,0 +1,1082 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include "gslist.h" +#include "gtestutils.h" + +/** + * SECTION:linked_lists_single + * @title: Singly-Linked Lists + * @short_description: linked lists containing integer values or + * pointers to data, limited to iterating over the + * list in one direction + * + * The #GSList structure and its associated functions provide a + * standard singly-linked list data structure. + * + * Each element in the list contains a piece of data, together with a + * pointer which links to the next element in the list. Using this + * pointer it is possible to move through the list in one direction + * only (unlike the Doubly-Linked Lists which + * allow movement in both directions). + * + * The data contained in each element can be either integer values, by + * using one of the Type + * Conversion Macros, or simply pointers to any type of data. + * + * List elements are allocated from the slice allocator, which is more + * efficient than allocating elements individually. + * + * Note that most of the #GSList functions expect to be passed a + * pointer to the first element in the list. The functions which insert + * elements return the new start of the list, which may have changed. + * + * There is no function to create a #GSList. %NULL is considered to be + * the empty list so you simply set a #GSList* to %NULL. + * + * To add elements, use g_slist_append(), g_slist_prepend(), + * g_slist_insert() and g_slist_insert_sorted(). + * + * To remove elements, use g_slist_remove(). + * + * To find elements in the list use g_slist_last(), g_slist_next(), + * g_slist_nth(), g_slist_nth_data(), g_slist_find() and + * g_slist_find_custom(). + * + * To find the index of an element use g_slist_position() and + * g_slist_index(). + * + * To call a function for each element in the list use + * g_slist_foreach(). + * + * To free the entire list, use g_slist_free(). + **/ + +/** + * GSList: + * @data: holds the element's data, which can be a pointer to any kind + * of data, or any integer value using the Type Conversion + * Macros. + * @next: contains the link to the next element in the list. + * + * The #GSList struct is used for each element in the singly-linked + * list. + **/ + +/** + * g_slist_next: + * @slist: an element in a #GSList. + * @Returns: the next element, or %NULL if there are no more elements. + * + * A convenience macro to get the next element in a #GSList. + **/ + + +/** + * g_slist_push_allocator: + * @dummy: the #GAllocator to use when allocating #GSList elements. + * + * Sets the allocator to use to allocate #GSList elements. Use + * g_slist_pop_allocator() to restore the previous allocator. + * + * Note that this function is not available if GLib has been compiled + * with + * + * Deprecated: 2.10: It does nothing, since #GSList has been converted + * to the slice + * allocator + **/ +void g_slist_push_allocator (gpointer dummy) { /* present for binary compat only */ } + +/** + * g_slist_pop_allocator: + * + * Restores the previous #GAllocator, used when allocating #GSList + * elements. + * + * Note that this function is not available if GLib has been compiled + * with + * + * Deprecated: 2.10: It does nothing, since #GSList has been converted + * to the slice + * allocator + **/ +void g_slist_pop_allocator (void) { /* present for binary compat only */ } + +#define _g_slist_alloc0() g_slice_new0 (GSList) +#define _g_slist_alloc() g_slice_new (GSList) +#define _g_slist_free1(slist) g_slice_free (GSList, slist) + +/** + * g_slist_alloc: + * @Returns: a pointer to the newly-allocated #GSList element. + * + * Allocates space for one #GSList element. It is called by the + * g_slist_append(), g_slist_prepend(), g_slist_insert() and + * g_slist_insert_sorted() functions and so is rarely used on its own. + **/ +GSList* +g_slist_alloc (void) +{ + return _g_slist_alloc0 (); +} + +/** + * g_slist_free: + * @list: a #GSList + * + * Frees all of the memory used by a #GSList. + * The freed elements are returned to the slice allocator. + * + * + * If list elements contain dynamically-allocated memory, + * you should either use g_slist_free_full() or free them manually + * first. + * + */ +void +g_slist_free (GSList *list) +{ + g_slice_free_chain (GSList, list, next); +} + +/** + * g_slist_free_1: + * @list: a #GSList element + * + * Frees one #GSList element. + * It is usually used after g_slist_remove_link(). + */ +/** + * g_slist_free1: + * + * A macro which does the same as g_slist_free_1(). + * + * Since: 2.10 + **/ +void +g_slist_free_1 (GSList *list) +{ + _g_slist_free1 (list); +} + +/** + * g_slist_free_full: + * @list: a pointer to a #GSList + * @free_func: the function to be called to free each element's data + * + * Convenience method, which frees all the memory used by a #GSList, and + * calls the specified destroy function on every element's data. + * + * Since: 2.28 + **/ +void +g_slist_free_full (GSList *list, + GDestroyNotify free_func) +{ + g_slist_foreach (list, (GFunc) free_func, NULL); + g_slist_free (list); +} + +/** + * g_slist_append: + * @list: a #GSList + * @data: the data for the new element + * + * Adds a new element on to the end of the list. + * + * + * The return value is the new start of the list, which may + * have changed, so make sure you store the new value. + * + * + * + * Note that g_slist_append() has to traverse the entire list + * to find the end, which is inefficient when adding multiple + * elements. A common idiom to avoid the inefficiency is to prepend + * the elements and reverse the list when all elements have been added. + * + * + * |[ + * /* Notice that these are initialized to the empty list. */ + * GSList *list = NULL, *number_list = NULL; + * + * /* This is a list of strings. */ + * list = g_slist_append (list, "first"); + * list = g_slist_append (list, "second"); + * + * /* This is a list of integers. */ + * number_list = g_slist_append (number_list, GINT_TO_POINTER (27)); + * number_list = g_slist_append (number_list, GINT_TO_POINTER (14)); + * ]| + * + * Returns: the new start of the #GSList + */ +GSList* +g_slist_append (GSList *list, + gpointer data) +{ + GSList *new_list; + GSList *last; + + new_list = _g_slist_alloc (); + new_list->data = data; + new_list->next = NULL; + + if (list) + { + last = g_slist_last (list); + /* g_assert (last != NULL); */ + last->next = new_list; + + return list; + } + else + return new_list; +} + +/** + * g_slist_prepend: + * @list: a #GSList + * @data: the data for the new element + * + * Adds a new element on to the start of the list. + * + * + * The return value is the new start of the list, which + * may have changed, so make sure you store the new value. + * + * + * |[ + * /* Notice that it is initialized to the empty list. */ + * GSList *list = NULL; + * list = g_slist_prepend (list, "last"); + * list = g_slist_prepend (list, "first"); + * ]| + * + * Returns: the new start of the #GSList + */ +GSList* +g_slist_prepend (GSList *list, + gpointer data) +{ + GSList *new_list; + + new_list = _g_slist_alloc (); + new_list->data = data; + new_list->next = list; + + return new_list; +} + +/** + * g_slist_insert: + * @list: a #GSList + * @data: the data for the new element + * @position: the position to insert the element. + * If this is negative, or is larger than the number + * of elements in the list, the new element is added on + * to the end of the list. + * + * Inserts a new element into the list at the given position. + * + * Returns: the new start of the #GSList + */ +GSList* +g_slist_insert (GSList *list, + gpointer data, + gint position) +{ + GSList *prev_list; + GSList *tmp_list; + GSList *new_list; + + if (position < 0) + return g_slist_append (list, data); + else if (position == 0) + return g_slist_prepend (list, data); + + new_list = _g_slist_alloc (); + new_list->data = data; + + if (!list) + { + new_list->next = NULL; + return new_list; + } + + prev_list = NULL; + tmp_list = list; + + while ((position-- > 0) && tmp_list) + { + prev_list = tmp_list; + tmp_list = tmp_list->next; + } + + if (prev_list) + { + new_list->next = prev_list->next; + prev_list->next = new_list; + } + else + { + new_list->next = list; + list = new_list; + } + + return list; +} + +/** + * g_slist_insert_before: + * @slist: a #GSList + * @sibling: node to insert @data before + * @data: data to put in the newly-inserted node + * + * Inserts a node before @sibling containing @data. + * + * Returns: the new head of the list. + */ +GSList* +g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data) +{ + if (!slist) + { + slist = _g_slist_alloc (); + slist->data = data; + slist->next = NULL; + g_return_val_if_fail (sibling == NULL, slist); + return slist; + } + else + { + GSList *node, *last = NULL; + + for (node = slist; node; last = node, node = last->next) + if (node == sibling) + break; + if (!last) + { + node = _g_slist_alloc (); + node->data = data; + node->next = slist; + + return node; + } + else + { + node = _g_slist_alloc (); + node->data = data; + node->next = last->next; + last->next = node; + + return slist; + } + } +} + +/** + * g_slist_concat: + * @list1: a #GSList + * @list2: the #GSList to add to the end of the first #GSList + * + * Adds the second #GSList onto the end of the first #GSList. + * Note that the elements of the second #GSList are not copied. + * They are used directly. + * + * Returns: the start of the new #GSList + */ +GSList * +g_slist_concat (GSList *list1, GSList *list2) +{ + if (list2) + { + if (list1) + g_slist_last (list1)->next = list2; + else + list1 = list2; + } + + return list1; +} + +/** + * g_slist_remove: + * @list: a #GSList + * @data: the data of the element to remove + * + * Removes an element from a #GSList. + * If two elements contain the same data, only the first is removed. + * If none of the elements contain the data, the #GSList is unchanged. + * + * Returns: the new start of the #GSList + */ +GSList* +g_slist_remove (GSList *list, + gconstpointer data) +{ + GSList *tmp, *prev = NULL; + + tmp = list; + while (tmp) + { + if (tmp->data == data) + { + if (prev) + prev->next = tmp->next; + else + list = tmp->next; + + g_slist_free_1 (tmp); + break; + } + prev = tmp; + tmp = prev->next; + } + + return list; +} + +/** + * g_slist_remove_all: + * @list: a #GSList + * @data: data to remove + * + * Removes all list nodes with data equal to @data. + * Returns the new head of the list. Contrast with + * g_slist_remove() which removes only the first node + * matching the given data. + * + * Returns: new head of @list + */ +GSList* +g_slist_remove_all (GSList *list, + gconstpointer data) +{ + GSList *tmp, *prev = NULL; + + tmp = list; + while (tmp) + { + if (tmp->data == data) + { + GSList *next = tmp->next; + + if (prev) + prev->next = next; + else + list = next; + + g_slist_free_1 (tmp); + tmp = next; + } + else + { + prev = tmp; + tmp = prev->next; + } + } + + return list; +} + +static inline GSList* +_g_slist_remove_link (GSList *list, + GSList *link) +{ + GSList *tmp; + GSList *prev; + + prev = NULL; + tmp = list; + + while (tmp) + { + if (tmp == link) + { + if (prev) + prev->next = tmp->next; + if (list == tmp) + list = list->next; + + tmp->next = NULL; + break; + } + + prev = tmp; + tmp = tmp->next; + } + + return list; +} + +/** + * g_slist_remove_link: + * @list: a #GSList + * @link_: an element in the #GSList + * + * Removes an element from a #GSList, without + * freeing the element. The removed element's next + * link is set to %NULL, so that it becomes a + * self-contained list with one element. + * + * Returns: the new start of the #GSList, without the element + */ +GSList* +g_slist_remove_link (GSList *list, + GSList *link_) +{ + return _g_slist_remove_link (list, link_); +} + +/** + * g_slist_delete_link: + * @list: a #GSList + * @link_: node to delete + * + * Removes the node link_ from the list and frees it. + * Compare this to g_slist_remove_link() which removes the node + * without freeing it. + * + * Returns: the new head of @list + */ +GSList* +g_slist_delete_link (GSList *list, + GSList *link_) +{ + list = _g_slist_remove_link (list, link_); + _g_slist_free1 (link_); + + return list; +} + +/** + * g_slist_copy: + * @list: a #GSList + * + * Copies a #GSList. + * + * + * Note that this is a "shallow" copy. If the list elements + * consist of pointers to data, the pointers are copied but + * the actual data isn't. + * + * + * Returns: a copy of @list + */ +GSList* +g_slist_copy (GSList *list) +{ + GSList *new_list = NULL; + + if (list) + { + GSList *last; + + new_list = _g_slist_alloc (); + new_list->data = list->data; + last = new_list; + list = list->next; + while (list) + { + last->next = _g_slist_alloc (); + last = last->next; + last->data = list->data; + list = list->next; + } + last->next = NULL; + } + + return new_list; +} + +/** + * g_slist_reverse: + * @list: a #GSList + * + * Reverses a #GSList. + * + * Returns: the start of the reversed #GSList + */ +GSList* +g_slist_reverse (GSList *list) +{ + GSList *prev = NULL; + + while (list) + { + GSList *next = list->next; + + list->next = prev; + + prev = list; + list = next; + } + + return prev; +} + +/** + * g_slist_nth: + * @list: a #GSList + * @n: the position of the element, counting from 0 + * + * Gets the element at the given position in a #GSList. + * + * Returns: the element, or %NULL if the position is off + * the end of the #GSList + */ +GSList* +g_slist_nth (GSList *list, + guint n) +{ + while (n-- > 0 && list) + list = list->next; + + return list; +} + +/** + * g_slist_nth_data: + * @list: a #GSList + * @n: the position of the element + * + * Gets the data of the element at the given position. + * + * Returns: the element's data, or %NULL if the position + * is off the end of the #GSList + */ +gpointer +g_slist_nth_data (GSList *list, + guint n) +{ + while (n-- > 0 && list) + list = list->next; + + return list ? list->data : NULL; +} + +/** + * g_slist_find: + * @list: a #GSList + * @data: the element data to find + * + * Finds the element in a #GSList which + * contains the given data. + * + * Returns: the found #GSList element, + * or %NULL if it is not found + */ +GSList* +g_slist_find (GSList *list, + gconstpointer data) +{ + while (list) + { + if (list->data == data) + break; + list = list->next; + } + + return list; +} + + +/** + * g_slist_find_custom: + * @list: a #GSList + * @data: user data passed to the function + * @func: the function to call for each element. + * It should return 0 when the desired element is found + * + * Finds an element in a #GSList, using a supplied function to + * find the desired element. It iterates over the list, calling + * the given function which should return 0 when the desired + * element is found. The function takes two #gconstpointer arguments, + * the #GSList element's data as the first argument and the + * given user data. + * + * Returns: the found #GSList element, or %NULL if it is not found + */ +GSList* +g_slist_find_custom (GSList *list, + gconstpointer data, + GCompareFunc func) +{ + g_return_val_if_fail (func != NULL, list); + + while (list) + { + if (! func (list->data, data)) + return list; + list = list->next; + } + + return NULL; +} + +/** + * g_slist_position: + * @list: a #GSList + * @llink: an element in the #GSList + * + * Gets the position of the given element + * in the #GSList (starting from 0). + * + * Returns: the position of the element in the #GSList, + * or -1 if the element is not found + */ +gint +g_slist_position (GSList *list, + GSList *llink) +{ + gint i; + + i = 0; + while (list) + { + if (list == llink) + return i; + i++; + list = list->next; + } + + return -1; +} + +/** + * g_slist_index: + * @list: a #GSList + * @data: the data to find + * + * Gets the position of the element containing + * the given data (starting from 0). + * + * Returns: the index of the element containing the data, + * or -1 if the data is not found + */ +gint +g_slist_index (GSList *list, + gconstpointer data) +{ + gint i; + + i = 0; + while (list) + { + if (list->data == data) + return i; + i++; + list = list->next; + } + + return -1; +} + +/** + * g_slist_last: + * @list: a #GSList + * + * Gets the last element in a #GSList. + * + * + * This function iterates over the whole list. + * + * + * Returns: the last element in the #GSList, + * or %NULL if the #GSList has no elements + */ +GSList* +g_slist_last (GSList *list) +{ + if (list) + { + while (list->next) + list = list->next; + } + + return list; +} + +/** + * g_slist_length: + * @list: a #GSList + * + * Gets the number of elements in a #GSList. + * + * + * This function iterates over the whole list to + * count its elements. + * + * + * Returns: the number of elements in the #GSList + */ +guint +g_slist_length (GSList *list) +{ + guint length; + + length = 0; + while (list) + { + length++; + list = list->next; + } + + return length; +} + +/** + * g_slist_foreach: + * @list: a #GSList + * @func: the function to call with each element's data + * @user_data: user data to pass to the function + * + * Calls a function for each element of a #GSList. + */ +void +g_slist_foreach (GSList *list, + GFunc func, + gpointer user_data) +{ + while (list) + { + GSList *next = list->next; + (*func) (list->data, user_data); + list = next; + } +} + +static GSList* +g_slist_insert_sorted_real (GSList *list, + gpointer data, + GFunc func, + gpointer user_data) +{ + GSList *tmp_list = list; + GSList *prev_list = NULL; + GSList *new_list; + gint cmp; + + g_return_val_if_fail (func != NULL, list); + + if (!list) + { + new_list = _g_slist_alloc (); + new_list->data = data; + new_list->next = NULL; + return new_list; + } + + cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); + + while ((tmp_list->next) && (cmp > 0)) + { + prev_list = tmp_list; + tmp_list = tmp_list->next; + + cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data); + } + + new_list = _g_slist_alloc (); + new_list->data = data; + + if ((!tmp_list->next) && (cmp > 0)) + { + tmp_list->next = new_list; + new_list->next = NULL; + return list; + } + + if (prev_list) + { + prev_list->next = new_list; + new_list->next = tmp_list; + return list; + } + else + { + new_list->next = list; + return new_list; + } +} + +/** + * g_slist_insert_sorted: + * @list: a #GSList + * @data: the data for the new element + * @func: the function to compare elements in the list. + * It should return a number > 0 if the first parameter + * comes after the second parameter in the sort order. + * + * Inserts a new element into the list, using the given + * comparison function to determine its position. + * + * Returns: the new start of the #GSList + */ +GSList* +g_slist_insert_sorted (GSList *list, + gpointer data, + GCompareFunc func) +{ + return g_slist_insert_sorted_real (list, data, (GFunc) func, NULL); +} + +/** + * g_slist_insert_sorted_with_data: + * @list: a #GSList + * @data: the data for the new element + * @func: the function to compare elements in the list. + * It should return a number > 0 if the first parameter + * comes after the second parameter in the sort order. + * @user_data: data to pass to comparison function + * + * Inserts a new element into the list, using the given + * comparison function to determine its position. + * + * Returns: the new start of the #GSList + * + * Since: 2.10 + */ +GSList* +g_slist_insert_sorted_with_data (GSList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) +{ + return g_slist_insert_sorted_real (list, data, (GFunc) func, user_data); +} + +static GSList * +g_slist_sort_merge (GSList *l1, + GSList *l2, + GFunc compare_func, + gpointer user_data) +{ + GSList list, *l; + gint cmp; + + l=&list; + + while (l1 && l2) + { + cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data); + + if (cmp <= 0) + { + l=l->next=l1; + l1=l1->next; + } + else + { + l=l->next=l2; + l2=l2->next; + } + } + l->next= l1 ? l1 : l2; + + return list.next; +} + +static GSList * +g_slist_sort_real (GSList *list, + GFunc compare_func, + gpointer user_data) +{ + GSList *l1, *l2; + + if (!list) + return NULL; + if (!list->next) + return list; + + l1 = list; + l2 = list->next; + + while ((l2 = l2->next) != NULL) + { + if ((l2 = l2->next) == NULL) + break; + l1=l1->next; + } + l2 = l1->next; + l1->next = NULL; + + return g_slist_sort_merge (g_slist_sort_real (list, compare_func, user_data), + g_slist_sort_real (l2, compare_func, user_data), + compare_func, + user_data); +} + +/** + * g_slist_sort: + * @list: a #GSList + * @compare_func: the comparison function used to sort the #GSList. + * This function is passed the data from 2 elements of the #GSList + * and should return 0 if they are equal, a negative value if the + * first element comes before the second, or a positive value if + * the first element comes after the second. + * + * Sorts a #GSList using the given comparison function. + * + * Returns: the start of the sorted #GSList + */ +GSList * +g_slist_sort (GSList *list, + GCompareFunc compare_func) +{ + return g_slist_sort_real (list, (GFunc) compare_func, NULL); +} + +/** + * g_slist_sort_with_data: + * @list: a #GSList + * @compare_func: comparison function + * @user_data: data to pass to comparison function + * + * Like g_slist_sort(), but the sort function accepts a user data argument. + * + * Returns: new head of the list + */ +GSList * +g_slist_sort_with_data (GSList *list, + GCompareDataFunc compare_func, + gpointer user_data) +{ + return g_slist_sort_real (list, (GFunc) compare_func, user_data); +} diff --git a/deps/glib/gslist.h b/deps/glib/gslist.h new file mode 100644 index 0000000..3731ba9 --- /dev/null +++ b/deps/glib/gslist.h @@ -0,0 +1,116 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_SLIST_H__ +#define __G_SLIST_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GSList GSList; + +struct _GSList +{ + gpointer data; + GSList *next; +}; + +/* Singly linked lists + */ +GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT; +void g_slist_free (GSList *list); +void g_slist_free_1 (GSList *list); +#define g_slist_free1 g_slist_free_1 +void g_slist_free_full (GSList *list, + GDestroyNotify free_func); +GSList* g_slist_append (GSList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_prepend (GSList *list, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_insert (GSList *list, + gpointer data, + gint position) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_insert_sorted (GSList *list, + gpointer data, + GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_insert_sorted_with_data (GSList *list, + gpointer data, + GCompareDataFunc func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_concat (GSList *list1, + GSList *list2) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_remove (GSList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_remove_all (GSList *list, + gconstpointer data) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_remove_link (GSList *list, + GSList *link_) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_delete_link (GSList *list, + GSList *link_) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_nth (GSList *list, + guint n); +GSList* g_slist_find (GSList *list, + gconstpointer data); +GSList* g_slist_find_custom (GSList *list, + gconstpointer data, + GCompareFunc func); +gint g_slist_position (GSList *list, + GSList *llink); +gint g_slist_index (GSList *list, + gconstpointer data); +GSList* g_slist_last (GSList *list); +guint g_slist_length (GSList *list); +void g_slist_foreach (GSList *list, + GFunc func, + gpointer user_data); +GSList* g_slist_sort (GSList *list, + GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT; +GSList* g_slist_sort_with_data (GSList *list, + GCompareDataFunc compare_func, + gpointer user_data) G_GNUC_WARN_UNUSED_RESULT; +gpointer g_slist_nth_data (GSList *list, + guint n); + +#define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL) + +#ifndef G_DISABLE_DEPRECATED +void g_slist_push_allocator (gpointer dummy); +void g_slist_pop_allocator (void); +#endif + +G_END_DECLS + +#endif /* __G_SLIST_H__ */ diff --git a/deps/glib/gstdio.c b/deps/glib/gstdio.c new file mode 100644 index 0000000..fb5a9fb --- /dev/null +++ b/deps/glib/gstdio.c @@ -0,0 +1,832 @@ +/* gstdio.c - wrappers for C library functions + * + * Copyright 2004 Tor Lillqvist + * + * GLib is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GLib; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" +#include "glibconfig.h" + +#define G_STDIO_NO_WRAP_ON_UNIX + +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef G_OS_WIN32 +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +#include "gstdio.h" + + +#if !defined (G_OS_UNIX) && !defined (G_OS_WIN32) && !defined (G_OS_BEOS) +#error Please port this to your operating system +#endif + +#if defined (_MSC_VER) && !defined(_WIN64) +#undef _wstat +#define _wstat _wstat32 +#endif + +/** + * g_access: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: as in access() + * + * A wrapper for the POSIX access() function. This function is used to + * test a pathname for one or several of read, write or execute + * permissions, or just existence. + * + * On Windows, the file protection mechanism is not at all POSIX-like, + * and the underlying function in the C library only checks the + * FAT-style READONLY attribute, and does not look at the ACL of a + * file at all. This function is this in practise almost useless on + * Windows. Software that needs to handle file permissions on Windows + * more exactly should use the Win32 API. + * + * See your C library manual for more details about access(). + * + * Returns: zero if the pathname refers to an existing file system + * object that has all the tested permissions, or -1 otherwise or on + * error. + * + * Since: 2.8 + */ +int +g_access (const gchar *filename, + int mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + +#ifndef X_OK +#define X_OK 1 +#endif + + retval = _waccess (wfilename, mode & ~X_OK); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return access (filename, mode); +#endif +} + +/** + * g_chmod: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: as in chmod() + * + * A wrapper for the POSIX chmod() function. The chmod() function is + * used to set the permissions of a file system object. + * + * On Windows the file protection mechanism is not at all POSIX-like, + * and the underlying chmod() function in the C library just sets or + * clears the FAT-style READONLY attribute. It does not touch any + * ACL. Software that needs to manage file permissions on Windows + * exactly should use the Win32 API. + * + * See your C library manual for more details about chmod(). + * + * Returns: zero if the operation succeeded, -1 on error. + * + * Since: 2.8 + */ +int +g_chmod (const gchar *filename, + int mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wchmod (wfilename, mode); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return chmod (filename, mode); +#endif +} +/** + * g_open: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @flags: as in open() + * @mode: as in open() + * + * A wrapper for the POSIX open() function. The open() function is + * used to convert a pathname into a file descriptor. + * + * On POSIX systems file descriptors are implemented by the operating + * system. On Windows, it's the C library that implements open() and + * file descriptors. The actual Win32 API for opening files is quite + * different, see MSDN documentation for CreateFile(). The Win32 API + * uses file handles, which are more randomish integers, not small + * integers like file descriptors. + * + * Because file descriptors are specific to the C library on Windows, + * the file descriptor returned by this function makes sense only to + * functions in the same C library. Thus if the GLib-using code uses a + * different C library than GLib does, the file descriptor returned by + * this function cannot be passed to C library functions like write() + * or read(). + * + * See your C library manual for more details about open(). + * + * Returns: a new file descriptor, or -1 if an error occurred. The + * return value can be used exactly like the return value from open(). + * + * Since: 2.6 + */ +int +g_open (const gchar *filename, + int flags, + int mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wopen (wfilename, flags, mode); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return open (filename, flags, mode); +#endif +} + +/** + * g_creat: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: as in creat() + * + * A wrapper for the POSIX creat() function. The creat() function is + * used to convert a pathname into a file descriptor, creating a file + * if necessary. + + * On POSIX systems file descriptors are implemented by the operating + * system. On Windows, it's the C library that implements creat() and + * file descriptors. The actual Windows API for opening files is + * different, see MSDN documentation for CreateFile(). The Win32 API + * uses file handles, which are more randomish integers, not small + * integers like file descriptors. + * + * Because file descriptors are specific to the C library on Windows, + * the file descriptor returned by this function makes sense only to + * functions in the same C library. Thus if the GLib-using code uses a + * different C library than GLib does, the file descriptor returned by + * this function cannot be passed to C library functions like write() + * or read(). + * + * See your C library manual for more details about creat(). + * + * Returns: a new file descriptor, or -1 if an error occurred. The + * return value can be used exactly like the return value from creat(). + * + * Since: 2.8 + */ +int +g_creat (const gchar *filename, + int mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wcreat (wfilename, mode); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return creat (filename, mode); +#endif +} + +/** + * g_rename: + * @oldfilename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @newfilename: a pathname in the GLib file name encoding + * + * A wrapper for the POSIX rename() function. The rename() function + * renames a file, moving it between directories if required. + * + * See your C library manual for more details about how rename() works + * on your system. It is not possible in general on Windows to rename + * a file that is open to some process. + * + * Returns: 0 if the renaming succeeded, -1 if an error occurred + * + * Since: 2.6 + */ +int +g_rename (const gchar *oldfilename, + const gchar *newfilename) +{ +#ifdef G_OS_WIN32 + wchar_t *woldfilename = g_utf8_to_utf16 (oldfilename, -1, NULL, NULL, NULL); + wchar_t *wnewfilename; + int retval; + int save_errno = 0; + + if (woldfilename == NULL) + { + errno = EINVAL; + return -1; + } + + wnewfilename = g_utf8_to_utf16 (newfilename, -1, NULL, NULL, NULL); + + if (wnewfilename == NULL) + { + g_free (woldfilename); + errno = EINVAL; + return -1; + } + + if (MoveFileExW (woldfilename, wnewfilename, MOVEFILE_REPLACE_EXISTING)) + retval = 0; + else + { + retval = -1; + switch (GetLastError ()) + { +#define CASE(a,b) case ERROR_##a: save_errno = b; break + CASE (FILE_NOT_FOUND, ENOENT); + CASE (PATH_NOT_FOUND, ENOENT); + CASE (ACCESS_DENIED, EACCES); + CASE (NOT_SAME_DEVICE, EXDEV); + CASE (LOCK_VIOLATION, EACCES); + CASE (SHARING_VIOLATION, EACCES); + CASE (FILE_EXISTS, EEXIST); + CASE (ALREADY_EXISTS, EEXIST); +#undef CASE + default: save_errno = EIO; + } + } + + g_free (woldfilename); + g_free (wnewfilename); + + errno = save_errno; + return retval; +#else + return rename (oldfilename, newfilename); +#endif +} + +/** + * g_mkdir: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: permissions to use for the newly created directory + * + * A wrapper for the POSIX mkdir() function. The mkdir() function + * attempts to create a directory with the given name and permissions. + * The mode argument is ignored on Windows. + * + * See your C library manual for more details about mkdir(). + * + * Returns: 0 if the directory was successfully created, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_mkdir (const gchar *filename, + int mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wmkdir (wfilename); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return mkdir (filename, mode); +#endif +} + +/** + * g_chdir: + * @path: a pathname in the GLib file name encoding (UTF-8 on Windows) + * + * A wrapper for the POSIX chdir() function. The function changes the + * current directory of the process to @path. + * + * See your C library manual for more details about chdir(). + * + * Returns: 0 on success, -1 if an error occurred. + * + * Since: 2.8 + */ +int +g_chdir (const gchar *path) +{ +#ifdef G_OS_WIN32 + wchar_t *wpath = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wpath == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wchdir (wpath); + save_errno = errno; + + g_free (wpath); + + errno = save_errno; + return retval; +#else + return chdir (path); +#endif +} + +/** + * GStatBuf: + * + * A type corresponding to the appropriate struct type for the stat + * system call, depending on the platform and/or compiler being used. + * + * See g_stat() for more information. + **/ +/** + * g_stat: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @buf: a pointer to a stat struct, which + * will be filled with the file information + * + * A wrapper for the POSIX stat() function. The stat() function + * returns information about a file. On Windows the stat() function in + * the C library checks only the FAT-style READONLY attribute and does + * not look at the ACL at all. Thus on Windows the protection bits in + * the st_mode field are a fabrication of little use. + * + * On Windows the Microsoft C libraries have several variants of the + * stat struct and stat() function with names + * like "_stat", "_stat32", "_stat32i64" and "_stat64i32". The one + * used here is for 32-bit code the one with 32-bit size and time + * fields, specifically called "_stat32". + * + * In Microsoft's compiler, by default "struct stat" means one with + * 64-bit time fields while in MinGW "struct stat" is the legacy one + * with 32-bit fields. To hopefully clear up this messs, the gstdio.h + * header defines a type GStatBuf which is the appropriate struct type + * depending on the platform and/or compiler being used. On POSIX it + * is just "struct stat", but note that even on POSIX platforms, + * "stat" might be a macro. + * + * See your C library manual for more details about stat(). + * + * Returns: 0 if the information was successfully retrieved, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_stat (const gchar *filename, + GStatBuf *buf) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + int len; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + len = wcslen (wfilename); + while (len > 0 && G_IS_DIR_SEPARATOR (wfilename[len-1])) + len--; + if (len > 0 && + (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename)) + wfilename[len] = '\0'; + + retval = _wstat (wfilename, buf); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return stat (filename, buf); +#endif +} + +/** + * g_lstat: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @buf: a pointer to a stat struct, which + * will be filled with the file information + * + * A wrapper for the POSIX lstat() function. The lstat() function is + * like stat() except that in the case of symbolic links, it returns + * information about the symbolic link itself and not the file that it + * refers to. If the system does not support symbolic links g_lstat() + * is identical to g_stat(). + * + * See your C library manual for more details about lstat(). + * + * Returns: 0 if the information was successfully retrieved, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_lstat (const gchar *filename, + GStatBuf *buf) +{ +#ifdef HAVE_LSTAT + /* This can't be Win32, so don't do the widechar dance. */ + return lstat (filename, buf); +#else + return g_stat (filename, buf); +#endif +} + +/** + * g_unlink: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * + * A wrapper for the POSIX unlink() function. The unlink() function + * deletes a name from the filesystem. If this was the last link to the + * file and no processes have it opened, the diskspace occupied by the + * file is freed. + * + * See your C library manual for more details about unlink(). Note + * that on Windows, it is in general not possible to delete files that + * are open to some process, or mapped into memory. + * + * Returns: 0 if the name was successfully deleted, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_unlink (const gchar *filename) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wunlink (wfilename); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return unlink (filename); +#endif +} + +/** + * g_remove: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * + * A wrapper for the POSIX remove() function. The remove() function + * deletes a name from the filesystem. + * + * See your C library manual for more details about how remove() works + * on your system. On Unix, remove() removes also directories, as it + * calls unlink() for files and rmdir() for directories. On Windows, + * although remove() in the C library only works for files, this + * function tries first remove() and then if that fails rmdir(), and + * thus works for both files and directories. Note however, that on + * Windows, it is in general not possible to remove a file that is + * open to some process, or mapped into memory. + * + * If this function fails on Windows you can't infer too much from the + * errno value. rmdir() is tried regardless of what caused remove() to + * fail. Any errno value set by remove() will be overwritten by that + * set by rmdir(). + * + * Returns: 0 if the file was successfully removed, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_remove (const gchar *filename) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wremove (wfilename); + if (retval == -1) + retval = _wrmdir (wfilename); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return remove (filename); +#endif +} + +/** + * g_rmdir: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * + * A wrapper for the POSIX rmdir() function. The rmdir() function + * deletes a directory from the filesystem. + * + * See your C library manual for more details about how rmdir() works + * on your system. + * + * Returns: 0 if the directory was successfully removed, -1 if an error + * occurred + * + * Since: 2.6 + */ +int +g_rmdir (const gchar *filename) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wrmdir (wfilename); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return rmdir (filename); +#endif +} + +/** + * g_fopen: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: a string describing the mode in which the file should be + * opened + * + * A wrapper for the stdio fopen() function. The fopen() function + * opens a file and associates a new stream with it. + * + * Because file descriptors are specific to the C library on Windows, + * and a file descriptor is partof the FILE struct, the + * FILE pointer returned by this function makes sense + * only to functions in the same C library. Thus if the GLib-using + * code uses a different C library than GLib does, the + * FILE pointer returned by this function cannot be + * passed to C library functions like fprintf() or fread(). + * + * See your C library manual for more details about fopen(). + * + * Returns: A FILE pointer if the file was successfully + * opened, or %NULL if an error occurred + * + * Since: 2.6 + */ +FILE * +g_fopen (const gchar *filename, + const gchar *mode) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + wchar_t *wmode; + FILE *retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return NULL; + } + + wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL); + + if (wmode == NULL) + { + g_free (wfilename); + errno = EINVAL; + return NULL; + } + + retval = _wfopen (wfilename, wmode); + save_errno = errno; + + g_free (wfilename); + g_free (wmode); + + errno = save_errno; + return retval; +#else + return fopen (filename, mode); +#endif +} + +/** + * g_freopen: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @mode: a string describing the mode in which the file should be + * opened + * @stream: an existing stream which will be reused, or %NULL + * + * A wrapper for the POSIX freopen() function. The freopen() function + * opens a file and associates it with an existing stream. + * + * See your C library manual for more details about freopen(). + * + * Returns: A FILE pointer if the file was successfully + * opened, or %NULL if an error occurred. + * + * Since: 2.6 + */ +FILE * +g_freopen (const gchar *filename, + const gchar *mode, + FILE *stream) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + wchar_t *wmode; + FILE *retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return NULL; + } + + wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL); + + if (wmode == NULL) + { + g_free (wfilename); + errno = EINVAL; + return NULL; + } + + retval = _wfreopen (wfilename, wmode, stream); + save_errno = errno; + + g_free (wfilename); + g_free (wmode); + + errno = save_errno; + return retval; +#else + return freopen (filename, mode, stream); +#endif +} + +/** + * g_utime: + * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows) + * @utb: a pointer to a struct utimbuf. + * + * A wrapper for the POSIX utime() function. The utime() function + * sets the access and modification timestamps of a file. + * + * See your C library manual for more details about how utime() works + * on your system. + * + * Returns: 0 if the operation was successful, -1 if an error + * occurred + * + * Since: 2.18 + */ +int +g_utime (const gchar *filename, + struct utimbuf *utb) +{ +#ifdef G_OS_WIN32 + wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + int retval; + int save_errno; + + if (wfilename == NULL) + { + errno = EINVAL; + return -1; + } + + retval = _wutime (wfilename, (struct _utimbuf*) utb); + save_errno = errno; + + g_free (wfilename); + + errno = save_errno; + return retval; +#else + return utime (filename, utb); +#endif +} diff --git a/deps/glib/gstdio.h b/deps/glib/gstdio.h new file mode 100644 index 0000000..08aea7d --- /dev/null +++ b/deps/glib/gstdio.h @@ -0,0 +1,149 @@ +/* gstdio.h - GFilename wrappers for C library functions + * + * Copyright 2004 Tor Lillqvist + * + * GLib is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GLib; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_STDIO_H__ +#define __G_STDIO_H__ + +#include + +#include + +G_BEGIN_DECLS + +#if defined (_MSC_VER) && !defined(_WIN64) + +/* Make it clear that we mean the struct with 32-bit st_size and + * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally + * has been compiled. If you get a compiler warning when calling + * g_stat(), do take it seriously and make sure that the type of + * struct stat the code in GLib fills in matches the struct the type + * of struct stat you pass to g_stat(). To avoid hassle, to get file + * attributes just use the GIO API instead which doesn't use struct + * stat. + * + * Sure, it would be nicer to use a struct with 64-bit st_size and + * 64-bit st_*time fields, but changing that now would break ABI. And + * in MinGW, a plain "struct stat" is the one with 32-bit st_size and + * st_*time fields. + */ + +typedef struct _stat32 GStatBuf; + +#else + +typedef struct stat GStatBuf; + +#endif + +#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX) + +/* Just pass on to the system functions, so there's no potential for data + * format mismatches, especially with large file interfaces. + * A few functions can't be handled in this way, since they are not defined + * in a portable system header that we could include here. + */ + +#ifndef __GTK_DOC_IGNORE__ +#define g_chmod chmod +#define g_open open +#define g_creat creat +#define g_rename rename +#define g_mkdir mkdir +#define g_stat stat +#define g_lstat lstat +#define g_remove remove +#define g_fopen fopen +#define g_freopen freopen +#define g_utime utime +#endif + +int g_access (const gchar *filename, + int mode); + +int g_chdir (const gchar *path); + +int g_unlink (const gchar *filename); + +int g_rmdir (const gchar *filename); + +#else /* ! G_OS_UNIX */ + +/* Wrappers for C library functions that take pathname arguments. On + * Unix, the pathname is a file name as it literally is in the file + * system. On well-maintained systems with consistent users who know + * what they are doing and no exchange of files with others this would + * be a well-defined encoding, preferably UTF-8. On Windows, the + * pathname is always in UTF-8, even if that is not the on-disk + * encoding, and not the encoding accepted by the C library or Win32 + * API. + */ + +int g_access (const gchar *filename, + int mode); + +int g_chmod (const gchar *filename, + int mode); + +int g_open (const gchar *filename, + int flags, + int mode); + +int g_creat (const gchar *filename, + int mode); + +int g_rename (const gchar *oldfilename, + const gchar *newfilename); + +int g_mkdir (const gchar *filename, + int mode); + +int g_chdir (const gchar *path); + +int g_stat (const gchar *filename, + GStatBuf *buf); + +int g_lstat (const gchar *filename, + GStatBuf *buf); + +int g_unlink (const gchar *filename); + +int g_remove (const gchar *filename); + +int g_rmdir (const gchar *filename); + +FILE *g_fopen (const gchar *filename, + const gchar *mode); + +FILE *g_freopen (const gchar *filename, + const gchar *mode, + FILE *stream); + +struct utimbuf; /* Don't need the real definition of struct utimbuf when just + * including this header. + */ + +int g_utime (const gchar *filename, + struct utimbuf *utb); + +#endif /* G_OS_UNIX */ + +G_END_DECLS + +#endif /* __G_STDIO_H__ */ diff --git a/deps/glib/gstrfuncs.c b/deps/glib/gstrfuncs.c new file mode 100644 index 0000000..d651ce1 --- /dev/null +++ b/deps/glib/gstrfuncs.c @@ -0,0 +1,3251 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include /* For tolower() */ +#if !defined (HAVE_STRSIGNAL) || !defined(NO_SYS_SIGLIST_DECL) +#include +#endif + +#include "gstrfuncs.h" + +#include "gprintf.h" +#include "gprintfint.h" +#include "glibintl.h" +#include "gconvert.h" + +#ifdef G_OS_WIN32 +#include +#endif + +/* do not include in this place since it + * interferes with g_strsignal() on some OSes + */ + +static const guint16 ascii_table_data[256] = { + 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, + 0x004, 0x104, 0x104, 0x004, 0x104, 0x104, 0x004, 0x004, + 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, + 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, + 0x140, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, + 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, + 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, + 0x459, 0x459, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, + 0x0d0, 0x653, 0x653, 0x653, 0x653, 0x653, 0x653, 0x253, + 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, + 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, + 0x253, 0x253, 0x253, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, + 0x0d0, 0x473, 0x473, 0x473, 0x473, 0x473, 0x473, 0x073, + 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, + 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, + 0x073, 0x073, 0x073, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x004 + /* the upper 128 are all zeroes */ +}; + +const guint16 * const g_ascii_table = ascii_table_data; + +/** + * g_strdup: + * @str: the string to duplicate + * + * Duplicates a string. If @str is %NULL it returns %NULL. + * The returned string should be freed with g_free() + * when no longer needed. + * + * Returns: a newly-allocated copy of @str + */ +gchar* +g_strdup (const gchar *str) +{ + gchar *new_str; + gsize length; + + if (str) + { + length = strlen (str) + 1; + new_str = g_new (char, length); + memcpy (new_str, str, length); + } + else + new_str = NULL; + + return new_str; +} + +/** + * g_memdup: + * @mem: the memory to copy. + * @byte_size: the number of bytes to copy. + * + * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it + * from @mem. If @mem is %NULL it returns %NULL. + * + * Returns: a pointer to the newly-allocated copy of the memory, or %NULL if @mem + * is %NULL. + */ +gpointer +g_memdup (gconstpointer mem, + guint byte_size) +{ + gpointer new_mem; + + if (mem) + { + new_mem = g_malloc (byte_size); + memcpy (new_mem, mem, byte_size); + } + else + new_mem = NULL; + + return new_mem; +} + +/** + * g_strndup: + * @str: the string to duplicate + * @n: the maximum number of bytes to copy from @str + * + * Duplicates the first @n bytes of a string, returning a newly-allocated + * buffer @n + 1 bytes long which will always be nul-terminated. + * If @str is less than @n bytes long the buffer is padded with nuls. + * If @str is %NULL it returns %NULL. + * The returned value should be freed when no longer needed. + * + * + * To copy a number of characters from a UTF-8 encoded string, use + * g_utf8_strncpy() instead. + * + * + * Returns: a newly-allocated buffer containing the first @n bytes + * of @str, nul-terminated + */ +gchar* +g_strndup (const gchar *str, + gsize n) +{ + gchar *new_str; + + if (str) + { + new_str = g_new (gchar, n + 1); + strncpy (new_str, str, n); + new_str[n] = '\0'; + } + else + new_str = NULL; + + return new_str; +} + +/** + * g_strnfill: + * @length: the length of the new string + * @fill_char: the byte to fill the string with + * + * Creates a new string @length bytes long filled with @fill_char. + * The returned string should be freed when no longer needed. + * + * Returns: a newly-allocated string filled the @fill_char + */ +gchar* +g_strnfill (gsize length, + gchar fill_char) +{ + gchar *str; + + str = g_new (gchar, length + 1); + memset (str, (guchar)fill_char, length); + str[length] = '\0'; + + return str; +} + +/** + * g_stpcpy: + * @dest: destination buffer. + * @src: source string. + * + * Copies a nul-terminated string into the dest buffer, include the + * trailing nul, and return a pointer to the trailing nul byte. + * This is useful for concatenating multiple strings together + * without having to repeatedly scan for the end. + * + * Return value: a pointer to trailing nul byte. + **/ +gchar * +g_stpcpy (gchar *dest, + const gchar *src) +{ +#ifdef HAVE_STPCPY + g_return_val_if_fail (dest != NULL, NULL); + g_return_val_if_fail (src != NULL, NULL); + return stpcpy (dest, src); +#else + register gchar *d = dest; + register const gchar *s = src; + + g_return_val_if_fail (dest != NULL, NULL); + g_return_val_if_fail (src != NULL, NULL); + do + *d++ = *s; + while (*s++ != '\0'); + + return d - 1; +#endif +} + +/** + * g_strdup_vprintf: + * @format: a standard printf() format string, but notice + * string precision pitfalls + * @args: the list of parameters to insert into the format string + * + * Similar to the standard C vsprintf() function but safer, since it + * calculates the maximum space required and allocates memory to hold + * the result. The returned string should be freed with g_free() when + * no longer needed. + * + * See also g_vasprintf(), which offers the same functionality, but + * additionally returns the length of the allocated string. + * + * Returns: a newly-allocated string holding the result + */ +gchar* +g_strdup_vprintf (const gchar *format, + va_list args) +{ + gchar *string = NULL; + + g_vasprintf (&string, format, args); + + return string; +} + +/** + * g_strdup_printf: + * @format: a standard printf() format string, but notice + * string precision pitfalls + * @...: the parameters to insert into the format string + * + * Similar to the standard C sprintf() function but safer, since it + * calculates the maximum space required and allocates memory to hold + * the result. The returned string should be freed with g_free() when no + * longer needed. + * + * Returns: a newly-allocated string holding the result + */ +gchar* +g_strdup_printf (const gchar *format, + ...) +{ + gchar *buffer; + va_list args; + + va_start (args, format); + buffer = g_strdup_vprintf (format, args); + va_end (args); + + return buffer; +} + +/** + * g_strconcat: + * @string1: the first string to add, which must not be %NULL + * @...: a %NULL-terminated list of strings to append to the string + * + * Concatenates all of the given strings into one long string. + * The returned string should be freed with g_free() when no longer needed. + * + * Note that this function is usually not the right function to use to + * assemble a translated message from pieces, since proper translation + * often requires the pieces to be reordered. + * + * The variable argument list must end + * with %NULL. If you forget the %NULL, g_strconcat() will start appending + * random memory junk to your string. + * + * Returns: a newly-allocated string containing all the string arguments + */ +gchar* +g_strconcat (const gchar *string1, ...) +{ + gsize l; + va_list args; + gchar *s; + gchar *concat; + gchar *ptr; + + if (!string1) + return NULL; + + l = 1 + strlen (string1); + va_start (args, string1); + s = va_arg (args, gchar*); + while (s) + { + l += strlen (s); + s = va_arg (args, gchar*); + } + va_end (args); + + concat = g_new (gchar, l); + ptr = concat; + + ptr = g_stpcpy (ptr, string1); + va_start (args, string1); + s = va_arg (args, gchar*); + while (s) + { + ptr = g_stpcpy (ptr, s); + s = va_arg (args, gchar*); + } + va_end (args); + + return concat; +} + +/** + * g_strtod: + * @nptr: the string to convert to a numeric value. + * @endptr: if non-%NULL, it returns the character after + * the last character used in the conversion. + * + * Converts a string to a #gdouble value. + * It calls the standard strtod() function to handle the conversion, but + * if the string is not completely converted it attempts the conversion + * again with g_ascii_strtod(), and returns the best match. + * + * This function should seldom be used. The normal situation when reading + * numbers not for human consumption is to use g_ascii_strtod(). Only when + * you know that you must expect both locale formatted and C formatted numbers + * should you use this. Make sure that you don't pass strings such as comma + * separated lists of values, since the commas may be interpreted as a decimal + * point in some locales, causing unexpected results. + * + * Return value: the #gdouble value. + **/ +gdouble +g_strtod (const gchar *nptr, + gchar **endptr) +{ + gchar *fail_pos_1; + gchar *fail_pos_2; + gdouble val_1; + gdouble val_2 = 0; + + g_return_val_if_fail (nptr != NULL, 0); + + fail_pos_1 = NULL; + fail_pos_2 = NULL; + + val_1 = strtod (nptr, &fail_pos_1); + + if (fail_pos_1 && fail_pos_1[0] != 0) + val_2 = g_ascii_strtod (nptr, &fail_pos_2); + + if (!fail_pos_1 || fail_pos_1[0] == 0 || fail_pos_1 >= fail_pos_2) + { + if (endptr) + *endptr = fail_pos_1; + return val_1; + } + else + { + if (endptr) + *endptr = fail_pos_2; + return val_2; + } +} + +/** + * g_ascii_strtod: + * @nptr: the string to convert to a numeric value. + * @endptr: if non-%NULL, it returns the character after + * the last character used in the conversion. + * + * Converts a string to a #gdouble value. + * + * This function behaves like the standard strtod() function + * does in the C locale. It does this without actually changing + * the current locale, since that would not be thread-safe. + * A limitation of the implementation is that this function + * will still accept localized versions of infinities and NANs. + * + * This function is typically used when reading configuration + * files or other non-user input that should be locale independent. + * To handle input from the user you should normally use the + * locale-sensitive system strtod() function. + * + * To convert from a #gdouble to a string in a locale-insensitive + * way, use g_ascii_dtostr(). + * + * If the correct value would cause overflow, plus or minus %HUGE_VAL + * is returned (according to the sign of the value), and %ERANGE is + * stored in %errno. If the correct value would cause underflow, + * zero is returned and %ERANGE is stored in %errno. + * + * This function resets %errno before calling strtod() so that + * you can reliably detect overflow and underflow. + * + * Return value: the #gdouble value. + **/ +gdouble +g_ascii_strtod (const gchar *nptr, + gchar **endptr) +{ + gchar *fail_pos; + gdouble val; + struct lconv *locale_data; + const char *decimal_point; + int decimal_point_len; + const char *p, *decimal_point_pos; + const char *end = NULL; /* Silence gcc */ + int strtod_errno; + + g_return_val_if_fail (nptr != NULL, 0); + + fail_pos = NULL; + + locale_data = localeconv (); + decimal_point = locale_data->decimal_point; + decimal_point_len = strlen (decimal_point); + + g_assert (decimal_point_len != 0); + + decimal_point_pos = NULL; + end = NULL; + + if (decimal_point[0] != '.' || + decimal_point[1] != 0) + { + p = nptr; + /* Skip leading space */ + while (g_ascii_isspace (*p)) + p++; + + /* Skip leading optional sign */ + if (*p == '+' || *p == '-') + p++; + + if (p[0] == '0' && + (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + /* HEX - find the (optional) decimal point */ + + while (g_ascii_isxdigit (*p)) + p++; + + if (*p == '.') + decimal_point_pos = p++; + + while (g_ascii_isxdigit (*p)) + p++; + + if (*p == 'p' || *p == 'P') + p++; + if (*p == '+' || *p == '-') + p++; + while (g_ascii_isdigit (*p)) + p++; + + end = p; + } + else if (g_ascii_isdigit (*p) || *p == '.') + { + while (g_ascii_isdigit (*p)) + p++; + + if (*p == '.') + decimal_point_pos = p++; + + while (g_ascii_isdigit (*p)) + p++; + + if (*p == 'e' || *p == 'E') + p++; + if (*p == '+' || *p == '-') + p++; + while (g_ascii_isdigit (*p)) + p++; + + end = p; + } + /* For the other cases, we need not convert the decimal point */ + } + + if (decimal_point_pos) + { + char *copy, *c; + + /* We need to convert the '.' to the locale specific decimal point */ + copy = g_malloc (end - nptr + 1 + decimal_point_len); + + c = copy; + memcpy (c, nptr, decimal_point_pos - nptr); + c += decimal_point_pos - nptr; + memcpy (c, decimal_point, decimal_point_len); + c += decimal_point_len; + memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1)); + c += end - (decimal_point_pos + 1); + *c = 0; + + errno = 0; + val = strtod (copy, &fail_pos); + strtod_errno = errno; + + if (fail_pos) + { + if (fail_pos - copy > decimal_point_pos - nptr) + fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1); + else + fail_pos = (char *)nptr + (fail_pos - copy); + } + + g_free (copy); + + } + else if (end) + { + char *copy; + + copy = g_malloc (end - (char *)nptr + 1); + memcpy (copy, nptr, end - nptr); + *(copy + (end - (char *)nptr)) = 0; + + errno = 0; + val = strtod (copy, &fail_pos); + strtod_errno = errno; + + if (fail_pos) + { + fail_pos = (char *)nptr + (fail_pos - copy); + } + + g_free (copy); + } + else + { + errno = 0; + val = strtod (nptr, &fail_pos); + strtod_errno = errno; + } + + if (endptr) + *endptr = fail_pos; + + errno = strtod_errno; + + return val; +} + + +/** + * g_ascii_dtostr: + * @buffer: A buffer to place the resulting string in + * @buf_len: The length of the buffer. + * @d: The #gdouble to convert + * + * Converts a #gdouble to a string, using the '.' as + * decimal point. + * + * This functions generates enough precision that converting + * the string back using g_ascii_strtod() gives the same machine-number + * (on machines with IEEE compatible 64bit doubles). It is + * guaranteed that the size of the resulting string will never + * be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes. + * + * Return value: The pointer to the buffer with the converted string. + **/ +gchar * +g_ascii_dtostr (gchar *buffer, + gint buf_len, + gdouble d) +{ + return g_ascii_formatd (buffer, buf_len, "%.17g", d); +} + +/** + * g_ascii_formatd: + * @buffer: A buffer to place the resulting string in + * @buf_len: The length of the buffer. + * @format: The printf()-style format to use for the + * code to use for converting. + * @d: The #gdouble to convert + * + * Converts a #gdouble to a string, using the '.' as + * decimal point. To format the number you pass in + * a printf()-style format string. Allowed conversion + * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'. + * + * If you just want to want to serialize the value into a + * string, use g_ascii_dtostr(). + * + * Return value: The pointer to the buffer with the converted string. + */ +gchar * +g_ascii_formatd (gchar *buffer, + gint buf_len, + const gchar *format, + gdouble d) +{ + struct lconv *locale_data; + const char *decimal_point; + int decimal_point_len; + gchar *p; + int rest_len; + gchar format_char; + + g_return_val_if_fail (buffer != NULL, NULL); + g_return_val_if_fail (format[0] == '%', NULL); + g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL); + + format_char = format[strlen (format) - 1]; + + g_return_val_if_fail (format_char == 'e' || format_char == 'E' || + format_char == 'f' || format_char == 'F' || + format_char == 'g' || format_char == 'G', + NULL); + + if (format[0] != '%') + return NULL; + + if (strpbrk (format + 1, "'l%")) + return NULL; + + if (!(format_char == 'e' || format_char == 'E' || + format_char == 'f' || format_char == 'F' || + format_char == 'g' || format_char == 'G')) + return NULL; + + _g_snprintf (buffer, buf_len, format, d); + + locale_data = localeconv (); + decimal_point = locale_data->decimal_point; + decimal_point_len = strlen (decimal_point); + + g_assert (decimal_point_len != 0); + + if (decimal_point[0] != '.' || + decimal_point[1] != 0) + { + p = buffer; + + while (g_ascii_isspace (*p)) + p++; + + if (*p == '+' || *p == '-') + p++; + + while (isdigit ((guchar)*p)) + p++; + + if (strncmp (p, decimal_point, decimal_point_len) == 0) + { + *p = '.'; + p++; + if (decimal_point_len > 1) + { + rest_len = strlen (p + (decimal_point_len-1)); + memmove (p, p + (decimal_point_len-1), rest_len); + p[rest_len] = 0; + } + } + } + + return buffer; +} + +static guint64 +g_parse_long_long (const gchar *nptr, + const gchar **endptr, + guint base, + gboolean *negative) +{ + /* this code is based on on the strtol(3) code from GNU libc released under + * the GNU Lesser General Public License. + * + * Copyright (C) 1991,92,94,95,96,97,98,99,2000,01,02 + * Free Software Foundation, Inc. + */ +#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ + (c) == '\r' || (c) == '\t' || (c) == '\v') +#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z') +#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c)) +#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c)) +#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c)) + gboolean overflow; + guint64 cutoff; + guint64 cutlim; + guint64 ui64; + const gchar *s, *save; + guchar c; + + g_return_val_if_fail (nptr != NULL, 0); + + *negative = FALSE; + if (base == 1 || base > 36) + { + errno = EINVAL; + if (endptr) + *endptr = nptr; + return 0; + } + + save = s = nptr; + + /* Skip white space. */ + while (ISSPACE (*s)) + ++s; + + if (G_UNLIKELY (!*s)) + goto noconv; + + /* Check for a sign. */ + if (*s == '-') + { + *negative = TRUE; + ++s; + } + else if (*s == '+') + ++s; + + /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ + if (*s == '0') + { + if ((base == 0 || base == 16) && TOUPPER (s[1]) == 'X') + { + s += 2; + base = 16; + } + else if (base == 0) + base = 8; + } + else if (base == 0) + base = 10; + + /* Save the pointer so we can check later if anything happened. */ + save = s; + cutoff = G_MAXUINT64 / base; + cutlim = G_MAXUINT64 % base; + + overflow = FALSE; + ui64 = 0; + c = *s; + for (; c; c = *++s) + { + if (c >= '0' && c <= '9') + c -= '0'; + else if (ISALPHA (c)) + c = TOUPPER (c) - 'A' + 10; + else + break; + if (c >= base) + break; + /* Check for overflow. */ + if (ui64 > cutoff || (ui64 == cutoff && c > cutlim)) + overflow = TRUE; + else + { + ui64 *= base; + ui64 += c; + } + } + + /* Check if anything actually happened. */ + if (s == save) + goto noconv; + + /* Store in ENDPTR the address of one character + past the last character we converted. */ + if (endptr) + *endptr = s; + + if (G_UNLIKELY (overflow)) + { + errno = ERANGE; + return G_MAXUINT64; + } + + return ui64; + + noconv: + /* We must handle a special case here: the base is 0 or 16 and the + first two characters are '0' and 'x', but the rest are no + hexadecimal digits. This is no error case. We return 0 and + ENDPTR points to the `x`. */ + if (endptr) + { + if (save - nptr >= 2 && TOUPPER (save[-1]) == 'X' + && save[-2] == '0') + *endptr = &save[-1]; + else + /* There was no number to convert. */ + *endptr = nptr; + } + return 0; +} + +/** + * g_ascii_strtoull: + * @nptr: the string to convert to a numeric value. + * @endptr: if non-%NULL, it returns the character after + * the last character used in the conversion. + * @base: to be used for the conversion, 2..36 or 0 + * + * Converts a string to a #guint64 value. + * This function behaves like the standard strtoull() function + * does in the C locale. It does this without actually + * changing the current locale, since that would not be + * thread-safe. + * + * This function is typically used when reading configuration + * files or other non-user input that should be locale independent. + * To handle input from the user you should normally use the + * locale-sensitive system strtoull() function. + * + * If the correct value would cause overflow, %G_MAXUINT64 + * is returned, and %ERANGE is stored in %errno. If the base is + * outside the valid range, zero is returned, and %EINVAL is stored + * in %errno. If the string conversion fails, zero is returned, and + * @endptr returns @nptr (if @endptr is non-%NULL). + * + * Return value: the #guint64 value or zero on error. + * + * Since: 2.2 + */ +guint64 +g_ascii_strtoull (const gchar *nptr, + gchar **endptr, + guint base) +{ + gboolean negative; + guint64 result; + + result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative); + + /* Return the result of the appropriate sign. */ + return negative ? -result : result; +} + +/** + * g_ascii_strtoll: + * @nptr: the string to convert to a numeric value. + * @endptr: if non-%NULL, it returns the character after + * the last character used in the conversion. + * @base: to be used for the conversion, 2..36 or 0 + * + * Converts a string to a #gint64 value. + * This function behaves like the standard strtoll() function + * does in the C locale. It does this without actually + * changing the current locale, since that would not be + * thread-safe. + * + * This function is typically used when reading configuration + * files or other non-user input that should be locale independent. + * To handle input from the user you should normally use the + * locale-sensitive system strtoll() function. + * + * If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64 + * is returned, and %ERANGE is stored in %errno. If the base is + * outside the valid range, zero is returned, and %EINVAL is stored + * in %errno. If the string conversion fails, zero is returned, and + * @endptr returns @nptr (if @endptr is non-%NULL). + * + * Return value: the #gint64 value or zero on error. + * + * Since: 2.12 + */ +gint64 +g_ascii_strtoll (const gchar *nptr, + gchar **endptr, + guint base) +{ + gboolean negative; + guint64 result; + + result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative); + + if (negative && result > (guint64) G_MININT64) + { + errno = ERANGE; + return G_MININT64; + } + else if (!negative && result > (guint64) G_MAXINT64) + { + errno = ERANGE; + return G_MAXINT64; + } + else if (negative) + return - (gint64) result; + else + return (gint64) result; +} + +/** + * g_strerror: + * @errnum: the system error number. See the standard C %errno + * documentation + * + * Returns a string corresponding to the given error code, e.g. + * "no such process". You should use this function in preference to + * strerror(), because it returns a string in UTF-8 encoding, and since + * not all platforms support the strerror() function. + * + * Returns: a UTF-8 string describing the error code. If the error code + * is unknown, it returns "unknown error (<code>)". The string + * can only be used until the next call to g_strerror() + */ +const gchar * +g_strerror (gint errnum) +{ + static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; + char *msg; + int saved_errno = errno; + +#ifdef HAVE_STRERROR + const char *msg_locale; + + msg_locale = strerror (errnum); + errno = saved_errno; + return msg_locale; +#elif NO_SYS_ERRLIST + switch (errnum) + { +#ifdef E2BIG + case E2BIG: return "argument list too long"; +#endif +#ifdef EACCES + case EACCES: return "permission denied"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "address already in use"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "can't assign requested address"; +#endif +#ifdef EADV + case EADV: return "advertise error"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "address family not supported by protocol family"; +#endif +#ifdef EAGAIN + case EAGAIN: return "try again"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "operation already in progress"; +#endif +#ifdef EBADE + case EBADE: return "bad exchange descriptor"; +#endif +#ifdef EBADF + case EBADF: return "bad file number"; +#endif +#ifdef EBADFD + case EBADFD: return "file descriptor in bad state"; +#endif +#ifdef EBADMSG + case EBADMSG: return "not a data message"; +#endif +#ifdef EBADR + case EBADR: return "bad request descriptor"; +#endif +#ifdef EBADRPC + case EBADRPC: return "RPC structure is bad"; +#endif +#ifdef EBADRQC + case EBADRQC: return "bad request code"; +#endif +#ifdef EBADSLT + case EBADSLT: return "invalid slot"; +#endif +#ifdef EBFONT + case EBFONT: return "bad font file format"; +#endif +#ifdef EBUSY + case EBUSY: return "mount device busy"; +#endif +#ifdef ECHILD + case ECHILD: return "no children"; +#endif +#ifdef ECHRNG + case ECHRNG: return "channel number out of range"; +#endif +#ifdef ECOMM + case ECOMM: return "communication error on send"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "software caused connection abort"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "connection refused"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "connection reset by peer"; +#endif +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) + case EDEADLK: return "resource deadlock avoided"; +#endif +#if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK)) + case EDEADLOCK: return "resource deadlock avoided"; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "destination address required"; +#endif +#ifdef EDIRTY + case EDIRTY: return "mounting a dirty fs w/o force"; +#endif +#ifdef EDOM + case EDOM: return "math argument out of range"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "cross mount point"; +#endif +#ifdef EDQUOT + case EDQUOT: return "disk quota exceeded"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "duplicate package name"; +#endif +#ifdef EEXIST + case EEXIST: return "file already exists"; +#endif +#ifdef EFAULT + case EFAULT: return "bad address in system call argument"; +#endif +#ifdef EFBIG + case EFBIG: return "file too large"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "host is down"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "host is unreachable"; +#endif +#ifdef EIDRM + case EIDRM: return "identifier removed"; +#endif +#ifdef EINIT + case EINIT: return "initialization error"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "operation now in progress"; +#endif +#ifdef EINTR + case EINTR: return "interrupted system call"; +#endif +#ifdef EINVAL + case EINVAL: return "invalid argument"; +#endif +#ifdef EIO + case EIO: return "I/O error"; +#endif +#ifdef EISCONN + case EISCONN: return "socket is already connected"; +#endif +#ifdef EISDIR + case EISDIR: return "is a directory"; +#endif +#ifdef EISNAME + case EISNAM: return "is a name file"; +#endif +#ifdef ELBIN + case ELBIN: return "ELBIN"; +#endif +#ifdef EL2HLT + case EL2HLT: return "level 2 halted"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "level 2 not synchronized"; +#endif +#ifdef EL3HLT + case EL3HLT: return "level 3 halted"; +#endif +#ifdef EL3RST + case EL3RST: return "level 3 reset"; +#endif +#ifdef ELIBACC + case ELIBACC: return "can not access a needed shared library"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "accessing a corrupted shared library"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "can not exec a shared library directly"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return "attempting to link in more shared libraries than system limit"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return ".lib section in a.out corrupted"; +#endif +#ifdef ELNRNG + case ELNRNG: return "link number out of range"; +#endif +#ifdef ELOOP + case ELOOP: return "too many levels of symbolic links"; +#endif +#ifdef EMFILE + case EMFILE: return "too many open files"; +#endif +#ifdef EMLINK + case EMLINK: return "too many links"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "message too long"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "multihop attempted"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "file name too long"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "not available"; +#endif +#ifdef ENET + case ENET: return "ENET"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "network is down"; +#endif +#ifdef ENETRESET + case ENETRESET: return "network dropped connection on reset"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "network is unreachable"; +#endif +#ifdef ENFILE + case ENFILE: return "file table overflow"; +#endif +#ifdef ENOANO + case ENOANO: return "anode table overflow"; +#endif +#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) + case ENOBUFS: return "no buffer space available"; +#endif +#ifdef ENOCSI + case ENOCSI: return "no CSI structure available"; +#endif +#ifdef ENODATA + case ENODATA: return "no data available"; +#endif +#ifdef ENODEV + case ENODEV: return "no such device"; +#endif +#ifdef ENOENT + case ENOENT: return "no such file or directory"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "exec format error"; +#endif +#ifdef ENOLCK + case ENOLCK: return "no locks available"; +#endif +#ifdef ENOLINK + case ENOLINK: return "link has be severed"; +#endif +#ifdef ENOMEM + case ENOMEM: return "not enough memory"; +#endif +#ifdef ENOMSG + case ENOMSG: return "no message of desired type"; +#endif +#ifdef ENONET + case ENONET: return "machine is not on the network"; +#endif +#ifdef ENOPKG + case ENOPKG: return "package not installed"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "bad proocol option"; +#endif +#ifdef ENOSPC + case ENOSPC: return "no space left on device"; +#endif +#ifdef ENOSR + case ENOSR: return "out of stream resources"; +#endif +#ifdef ENOSTR + case ENOSTR: return "not a stream device"; +#endif +#ifdef ENOSYM + case ENOSYM: return "unresolved symbol name"; +#endif +#ifdef ENOSYS + case ENOSYS: return "function not implemented"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "block device required"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "socket is not connected"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "not a directory"; +#endif +#ifdef ENOTEMPTY + case ENOTEMPTY: return "directory not empty"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "not a name file"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "socket operation on non-socket"; +#endif +#ifdef ENOTTY + case ENOTTY: return "inappropriate device for ioctl"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "name not unique on network"; +#endif +#ifdef ENXIO + case ENXIO: return "no such device or address"; +#endif +#ifdef EOPNOTSUPP + case EOPNOTSUPP: return "operation not supported on socket"; +#endif +#ifdef EPERM + case EPERM: return "not owner"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "protocol family not supported"; +#endif +#ifdef EPIPE + case EPIPE: return "broken pipe"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "too many processes"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "bad procedure for program"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "program version wrong"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "RPC program not available"; +#endif +#ifdef EPROTO + case EPROTO: return "protocol error"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "protocol not suppored"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "protocol wrong type for socket"; +#endif +#ifdef ERANGE + case ERANGE: return "math result unrepresentable"; +#endif +#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) + case EREFUSED: return "EREFUSED"; +#endif +#ifdef EREMCHG + case EREMCHG: return "remote address changed"; +#endif +#ifdef EREMDEV + case EREMDEV: return "remote device"; +#endif +#ifdef EREMOTE + case EREMOTE: return "pathname hit remote file system"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "remote i/o error"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef EROFS + case EROFS: return "read-only file system"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "RPC version is wrong"; +#endif +#ifdef ERREMOTE + case ERREMOTE: return "object is remote"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "can't send afer socket shutdown"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "socket type not supported"; +#endif +#ifdef ESPIPE + case ESPIPE: return "invalid seek"; +#endif +#ifdef ESRCH + case ESRCH: return "no such process"; +#endif +#ifdef ESRMNT + case ESRMNT: return "srmount error"; +#endif +#ifdef ESTALE + case ESTALE: return "stale remote file handle"; +#endif +#ifdef ESUCCESS + case ESUCCESS: return "Error 0"; +#endif +#ifdef ETIME + case ETIME: return "timer expired"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "connection timed out"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "too many references: can't splice"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "text file or pseudo-device busy"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "structure needs cleaning"; +#endif +#ifdef EUNATCH + case EUNATCH: return "protocol driver not attached"; +#endif +#ifdef EUSERS + case EUSERS: return "too many users"; +#endif +#ifdef EVERSION + case EVERSION: return "version mismatch"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: return "operation would block"; +#endif +#ifdef EXDEV + case EXDEV: return "cross-domain link"; +#endif +#ifdef EXFULL + case EXFULL: return "message tables full"; +#endif + } +#else /* NO_SYS_ERRLIST */ + extern int sys_nerr; + extern char *sys_errlist[]; + + if ((errnum > 0) && (errnum <= sys_nerr)) + return sys_errlist [errnum]; +#endif /* NO_SYS_ERRLIST */ + + msg = g_static_private_get (&msg_private); + if (!msg) + { + msg = g_new (gchar, 64); + g_static_private_set (&msg_private, msg, g_free); + } + + _g_sprintf (msg, "unknown error (%d)", errnum); + + errno = saved_errno; + return msg; +} + +/** + * g_strsignal: + * @signum: the signal number. See the signal + * documentation + * + * Returns a string describing the given signal, e.g. "Segmentation fault". + * You should use this function in preference to strsignal(), because it + * returns a string in UTF-8 encoding, and since not all platforms support + * the strsignal() function. + * + * Returns: a UTF-8 string describing the signal. If the signal is unknown, + * it returns "unknown signal (<signum>)". The string can only be + * used until the next call to g_strsignal() + */ +const gchar * +g_strsignal (gint signum) +{ + static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; + char *msg; + +#ifdef HAVE_STRSIGNAL + const char *msg_locale; + +#if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN) +extern const char *strsignal(int); +#else + /* this is declared differently (const) in string.h on BeOS */ + extern char *strsignal (int sig); +#endif /* !G_OS_BEOS && !G_WITH_CYGWIN */ + msg_locale = strsignal (signum); + return msg_locale; +#elif NO_SYS_SIGLIST + switch (signum) + { +#ifdef SIGHUP + case SIGHUP: return "Hangup"; +#endif +#ifdef SIGINT + case SIGINT: return "Interrupt"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "Quit"; +#endif +#ifdef SIGILL + case SIGILL: return "Illegal instruction"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "Trace/breakpoint trap"; +#endif +#ifdef SIGABRT + case SIGABRT: return "IOT trap/Abort"; +#endif +#ifdef SIGBUS + case SIGBUS: return "Bus error"; +#endif +#ifdef SIGFPE + case SIGFPE: return "Floating point exception"; +#endif +#ifdef SIGKILL + case SIGKILL: return "Killed"; +#endif +#ifdef SIGUSR1 + case SIGUSR1: return "User defined signal 1"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "Segmentation fault"; +#endif +#ifdef SIGUSR2 + case SIGUSR2: return "User defined signal 2"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "Broken pipe"; +#endif +#ifdef SIGALRM + case SIGALRM: return "Alarm clock"; +#endif +#ifdef SIGTERM + case SIGTERM: return "Terminated"; +#endif +#ifdef SIGSTKFLT + case SIGSTKFLT: return "Stack fault"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "Child exited"; +#endif +#ifdef SIGCONT + case SIGCONT: return "Continued"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "Stopped (signal)"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "Stopped"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "Stopped (tty input)"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "Stopped (tty output)"; +#endif +#ifdef SIGURG + case SIGURG: return "Urgent condition"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "CPU time limit exceeded"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "File size limit exceeded"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "Virtual time alarm"; +#endif +#ifdef SIGPROF + case SIGPROF: return "Profile signal"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "Window size changed"; +#endif +#ifdef SIGIO + case SIGIO: return "Possible I/O"; +#endif +#ifdef SIGPWR + case SIGPWR: return "Power failure"; +#endif +#ifdef SIGUNUSED + case SIGUNUSED: return "Unused signal"; +#endif + } +#else /* NO_SYS_SIGLIST */ + +#ifdef NO_SYS_SIGLIST_DECL + extern char *sys_siglist[]; /*(see Tue Jan 19 00:44:24 1999 in changelog)*/ +#endif + + return (char*) /* this function should return const --josh */ sys_siglist [signum]; +#endif /* NO_SYS_SIGLIST */ + + msg = g_static_private_get (&msg_private); + if (!msg) + { + msg = g_new (gchar, 64); + g_static_private_set (&msg_private, msg, g_free); + } + + _g_sprintf (msg, "unknown signal (%d)", signum); + + return msg; +} + +/* Functions g_strlcpy and g_strlcat were originally developed by + * Todd C. Miller to simplify writing secure code. + * See ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.3 + * for more information. + */ + +#ifdef HAVE_STRLCPY +/* Use the native ones, if available; they might be implemented in assembly */ +gsize +g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size) +{ + g_return_val_if_fail (dest != NULL, 0); + g_return_val_if_fail (src != NULL, 0); + + return strlcpy (dest, src, dest_size); +} + +gsize +g_strlcat (gchar *dest, + const gchar *src, + gsize dest_size) +{ + g_return_val_if_fail (dest != NULL, 0); + g_return_val_if_fail (src != NULL, 0); + + return strlcat (dest, src, dest_size); +} + +#else /* ! HAVE_STRLCPY */ +/** + * g_strlcpy: + * @dest: destination buffer + * @src: source buffer + * @dest_size: length of @dest in bytes + * + * Portability wrapper that calls strlcpy() on systems which have it, + * and emulates strlcpy() otherwise. Copies @src to @dest; @dest is + * guaranteed to be nul-terminated; @src must be nul-terminated; + * @dest_size is the buffer size, not the number of chars to copy. + * + * At most dest_size - 1 characters will be copied. Always nul-terminates + * (unless dest_size == 0). This function does not + * allocate memory. Unlike strncpy(), this function doesn't pad dest (so + * it's often faster). It returns the size of the attempted result, + * strlen (src), so if @retval >= @dest_size, truncation occurred. + * + * Caveat: strlcpy() is supposedly more secure than + * strcpy() or strncpy(), but if you really want to avoid screwups, + * g_strdup() is an even better idea. + * + * Returns: length of @src + */ +gsize +g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size) +{ + register gchar *d = dest; + register const gchar *s = src; + register gsize n = dest_size; + + g_return_val_if_fail (dest != NULL, 0); + g_return_val_if_fail (src != NULL, 0); + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) + do + { + register gchar c = *s++; + + *d++ = c; + if (c == 0) + break; + } + while (--n != 0); + + /* If not enough room in dest, add NUL and traverse rest of src */ + if (n == 0) + { + if (dest_size != 0) + *d = 0; + while (*s++) + ; + } + + return s - src - 1; /* count does not include NUL */ +} + +/** + * g_strlcat: + * @dest: destination buffer, already containing one nul-terminated string + * @src: source buffer + * @dest_size: length of @dest buffer in bytes (not length of existing string + * inside @dest) + * + * Portability wrapper that calls strlcat() on systems which have it, + * and emulates it otherwise. Appends nul-terminated @src string to @dest, + * guaranteeing nul-termination for @dest. The total size of @dest won't + * exceed @dest_size. + * + * At most dest_size - 1 characters will be copied. + * Unlike strncat, dest_size is the full size of dest, not the space left over. + * This function does NOT allocate memory. + * This always NUL terminates (unless siz == 0 or there were no NUL characters + * in the dest_size characters of dest to start with). + * + * Caveat: this is supposedly a more secure alternative to + * strcat() or strncat(), but for real security g_strconcat() is harder + * to mess up. + * + * Returns: size of attempted result, which is MIN (dest_size, strlen + * (original dest)) + strlen (src), so if retval >= dest_size, + * truncation occurred. + **/ +gsize +g_strlcat (gchar *dest, + const gchar *src, + gsize dest_size) +{ + register gchar *d = dest; + register const gchar *s = src; + register gsize bytes_left = dest_size; + gsize dlength; /* Logically, MIN (strlen (d), dest_size) */ + + g_return_val_if_fail (dest != NULL, 0); + g_return_val_if_fail (src != NULL, 0); + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (*d != 0 && bytes_left-- != 0) + d++; + dlength = d - dest; + bytes_left = dest_size - dlength; + + if (bytes_left == 0) + return dlength + strlen (s); + + while (*s != 0) + { + if (bytes_left != 1) + { + *d++ = *s; + bytes_left--; + } + s++; + } + *d = 0; + + return dlength + (s - src); /* count does not include NUL */ +} +#endif /* ! HAVE_STRLCPY */ + +/** + * g_ascii_strdown: + * @str: a string. + * @len: length of @str in bytes, or -1 if @str is nul-terminated. + * + * Converts all upper case ASCII letters to lower case ASCII letters. + * + * Return value: a newly-allocated string, with all the upper case + * characters in @str converted to lower case, with + * semantics that exactly match g_ascii_tolower(). (Note + * that this is unlike the old g_strdown(), which modified + * the string in place.) + **/ +gchar* +g_ascii_strdown (const gchar *str, + gssize len) +{ + gchar *result, *s; + + g_return_val_if_fail (str != NULL, NULL); + + if (len < 0) + len = strlen (str); + + result = g_strndup (str, len); + for (s = result; *s; s++) + *s = g_ascii_tolower (*s); + + return result; +} + +/** + * g_ascii_strup: + * @str: a string. + * @len: length of @str in bytes, or -1 if @str is nul-terminated. + * + * Converts all lower case ASCII letters to upper case ASCII letters. + * + * Return value: a newly allocated string, with all the lower case + * characters in @str converted to upper case, with + * semantics that exactly match g_ascii_toupper(). (Note + * that this is unlike the old g_strup(), which modified + * the string in place.) + **/ +gchar* +g_ascii_strup (const gchar *str, + gssize len) +{ + gchar *result, *s; + + g_return_val_if_fail (str != NULL, NULL); + + if (len < 0) + len = strlen (str); + + result = g_strndup (str, len); + for (s = result; *s; s++) + *s = g_ascii_toupper (*s); + + return result; +} + +/** + * g_strdown: + * @string: the string to convert. + * + * Converts a string to lower case. + * + * Return value: the string + * + * Deprecated:2.2: This function is totally broken for the reasons discussed + * in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown() + * instead. + **/ +gchar* +g_strdown (gchar *string) +{ + register guchar *s; + + g_return_val_if_fail (string != NULL, NULL); + + s = (guchar *) string; + + while (*s) + { + if (isupper (*s)) + *s = tolower (*s); + s++; + } + + return (gchar *) string; +} + +/** + * g_strup: + * @string: the string to convert. + * + * Converts a string to upper case. + * + * Return value: the string + * + * Deprecated:2.2: This function is totally broken for the reasons discussed + * in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead. + **/ +gchar* +g_strup (gchar *string) +{ + register guchar *s; + + g_return_val_if_fail (string != NULL, NULL); + + s = (guchar *) string; + + while (*s) + { + if (islower (*s)) + *s = toupper (*s); + s++; + } + + return (gchar *) string; +} + +/** + * g_strreverse: + * @string: the string to reverse + * + * Reverses all of the bytes in a string. For example, + * g_strreverse ("abcdef") will result + * in "fedcba". + * + * Note that g_strreverse() doesn't work on UTF-8 strings + * containing multibyte characters. For that purpose, use + * g_utf8_strreverse(). + * + * Returns: the same pointer passed in as @string + */ +gchar* +g_strreverse (gchar *string) +{ + g_return_val_if_fail (string != NULL, NULL); + + if (*string) + { + register gchar *h, *t; + + h = string; + t = string + strlen (string) - 1; + + while (h < t) + { + register gchar c; + + c = *h; + *h = *t; + h++; + *t = c; + t--; + } + } + + return string; +} + +/** + * g_ascii_tolower: + * @c: any character. + * + * Convert a character to ASCII lower case. + * + * Unlike the standard C library tolower() function, this only + * recognizes standard ASCII letters and ignores the locale, returning + * all non-ASCII characters unchanged, even if they are lower case + * letters in a particular character set. Also unlike the standard + * library function, this takes and returns a char, not an int, so + * don't call it on %EOF but no need to worry about casting to #guchar + * before passing a possibly non-ASCII character in. + * + * Return value: the result of converting @c to lower case. + * If @c is not an ASCII upper case letter, + * @c is returned unchanged. + **/ +gchar +g_ascii_tolower (gchar c) +{ + return g_ascii_isupper (c) ? c - 'A' + 'a' : c; +} + +/** + * g_ascii_toupper: + * @c: any character. + * + * Convert a character to ASCII upper case. + * + * Unlike the standard C library toupper() function, this only + * recognizes standard ASCII letters and ignores the locale, returning + * all non-ASCII characters unchanged, even if they are upper case + * letters in a particular character set. Also unlike the standard + * library function, this takes and returns a char, not an int, so + * don't call it on %EOF but no need to worry about casting to #guchar + * before passing a possibly non-ASCII character in. + * + * Return value: the result of converting @c to upper case. + * If @c is not an ASCII lower case letter, + * @c is returned unchanged. + **/ +gchar +g_ascii_toupper (gchar c) +{ + return g_ascii_islower (c) ? c - 'a' + 'A' : c; +} + +/** + * g_ascii_digit_value: + * @c: an ASCII character. + * + * Determines the numeric value of a character as a decimal + * digit. Differs from g_unichar_digit_value() because it takes + * a char, so there's no worry about sign extension if characters + * are signed. + * + * Return value: If @c is a decimal digit (according to + * g_ascii_isdigit()), its numeric value. Otherwise, -1. + **/ +int +g_ascii_digit_value (gchar c) +{ + if (g_ascii_isdigit (c)) + return c - '0'; + return -1; +} + +/** + * g_ascii_xdigit_value: + * @c: an ASCII character. + * + * Determines the numeric value of a character as a hexidecimal + * digit. Differs from g_unichar_xdigit_value() because it takes + * a char, so there's no worry about sign extension if characters + * are signed. + * + * Return value: If @c is a hex digit (according to + * g_ascii_isxdigit()), its numeric value. Otherwise, -1. + **/ +int +g_ascii_xdigit_value (gchar c) +{ + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + return g_ascii_digit_value (c); +} + +/** + * g_ascii_strcasecmp: + * @s1: string to compare with @s2. + * @s2: string to compare with @s1. + * + * Compare two strings, ignoring the case of ASCII characters. + * + * Unlike the BSD strcasecmp() function, this only recognizes standard + * ASCII letters and ignores the locale, treating all non-ASCII + * bytes as if they are not letters. + * + * This function should be used only on strings that are known to be + * in encodings where the bytes corresponding to ASCII letters always + * represent themselves. This includes UTF-8 and the ISO-8859-* + * charsets, but not for instance double-byte encodings like the + * Windows Codepage 932, where the trailing bytes of double-byte + * characters include all ASCII letters. If you compare two CP932 + * strings using this function, you will get false matches. + * + * Return value: 0 if the strings match, a negative value if @s1 < @s2, + * or a positive value if @s1 > @s2. + **/ +gint +g_ascii_strcasecmp (const gchar *s1, + const gchar *s2) +{ + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (*s1 && *s2) + { + c1 = (gint)(guchar) TOLOWER (*s1); + c2 = (gint)(guchar) TOLOWER (*s2); + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + return (((gint)(guchar) *s1) - ((gint)(guchar) *s2)); +} + +/** + * g_ascii_strncasecmp: + * @s1: string to compare with @s2. + * @s2: string to compare with @s1. + * @n: number of characters to compare. + * + * Compare @s1 and @s2, ignoring the case of ASCII characters and any + * characters after the first @n in each string. + * + * Unlike the BSD strcasecmp() function, this only recognizes standard + * ASCII letters and ignores the locale, treating all non-ASCII + * characters as if they are not letters. + * + * The same warning as in g_ascii_strcasecmp() applies: Use this + * function only on strings known to be in encodings where bytes + * corresponding to ASCII letters always represent themselves. + * + * Return value: 0 if the strings match, a negative value if @s1 < @s2, + * or a positive value if @s1 > @s2. + **/ +gint +g_ascii_strncasecmp (const gchar *s1, + const gchar *s2, + gsize n) +{ + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (n && *s1 && *s2) + { + n -= 1; + c1 = (gint)(guchar) TOLOWER (*s1); + c2 = (gint)(guchar) TOLOWER (*s2); + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + if (n) + return (((gint) (guchar) *s1) - ((gint) (guchar) *s2)); + else + return 0; +} + +/** + * g_strcasecmp: + * @s1: a string. + * @s2: a string to compare with @s1. + * + * A case-insensitive string comparison, corresponding to the standard + * strcasecmp() function on platforms which support it. + * + * Return value: 0 if the strings match, a negative value if @s1 < @s2, + * or a positive value if @s1 > @s2. + * + * Deprecated:2.2: See g_strncasecmp() for a discussion of why this function + * is deprecated and how to replace it. + **/ +gint +g_strcasecmp (const gchar *s1, + const gchar *s2) +{ +#ifdef HAVE_STRCASECMP + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + return strcasecmp (s1, s2); +#else + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (*s1 && *s2) + { + /* According to A. Cox, some platforms have islower's that + * don't work right on non-uppercase + */ + c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1; + c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2; + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + return (((gint)(guchar) *s1) - ((gint)(guchar) *s2)); +#endif +} + +/** + * g_strncasecmp: + * @s1: a string. + * @s2: a string to compare with @s1. + * @n: the maximum number of characters to compare. + * + * A case-insensitive string comparison, corresponding to the standard + * strncasecmp() function on platforms which support it. + * It is similar to g_strcasecmp() except it only compares the first @n + * characters of the strings. + * + * Return value: 0 if the strings match, a negative value if @s1 < @s2, + * or a positive value if @s1 > @s2. + * + * Deprecated:2.2: The problem with g_strncasecmp() is that it does the + * comparison by calling toupper()/tolower(). These functions are + * locale-specific and operate on single bytes. However, it is impossible + * to handle things correctly from an I18N standpoint by operating on + * bytes, since characters may be multibyte. Thus g_strncasecmp() is + * broken if your string is guaranteed to be ASCII, since it's + * locale-sensitive, and it's broken if your string is localized, since + * it doesn't work on many encodings at all, including UTF-8, EUC-JP, + * etc. + * + * There are therefore two replacement functions: g_ascii_strncasecmp(), + * which only works on ASCII and is not locale-sensitive, and + * g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8. + **/ +gint +g_strncasecmp (const gchar *s1, + const gchar *s2, + guint n) +{ +#ifdef HAVE_STRNCASECMP + return strncasecmp (s1, s2, n); +#else + gint c1, c2; + + g_return_val_if_fail (s1 != NULL, 0); + g_return_val_if_fail (s2 != NULL, 0); + + while (n && *s1 && *s2) + { + n -= 1; + /* According to A. Cox, some platforms have islower's that + * don't work right on non-uppercase + */ + c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1; + c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2; + if (c1 != c2) + return (c1 - c2); + s1++; s2++; + } + + if (n) + return (((gint) (guchar) *s1) - ((gint) (guchar) *s2)); + else + return 0; +#endif +} + +gchar* +g_strdelimit (gchar *string, + const gchar *delimiters, + gchar new_delim) +{ + register gchar *c; + + g_return_val_if_fail (string != NULL, NULL); + + if (!delimiters) + delimiters = G_STR_DELIMITERS; + + for (c = string; *c; c++) + { + if (strchr (delimiters, *c)) + *c = new_delim; + } + + return string; +} + +gchar* +g_strcanon (gchar *string, + const gchar *valid_chars, + gchar substitutor) +{ + register gchar *c; + + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (valid_chars != NULL, NULL); + + for (c = string; *c; c++) + { + if (!strchr (valid_chars, *c)) + *c = substitutor; + } + + return string; +} + +gchar* +g_strcompress (const gchar *source) +{ + const gchar *p = source, *octal; + gchar *dest = g_malloc (strlen (source) + 1); + gchar *q = dest; + + while (*p) + { + if (*p == '\\') + { + p++; + switch (*p) + { + case '\0': + g_warning ("g_strcompress: trailing \\"); + goto out; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': + *q = 0; + octal = p; + while ((p < octal + 3) && (*p >= '0') && (*p <= '7')) + { + *q = (*q * 8) + (*p - '0'); + p++; + } + q++; + p--; + break; + case 'b': + *q++ = '\b'; + break; + case 'f': + *q++ = '\f'; + break; + case 'n': + *q++ = '\n'; + break; + case 'r': + *q++ = '\r'; + break; + case 't': + *q++ = '\t'; + break; + default: /* Also handles \" and \\ */ + *q++ = *p; + break; + } + } + else + *q++ = *p; + p++; + } +out: + *q = 0; + + return dest; +} + +gchar * +g_strescape (const gchar *source, + const gchar *exceptions) +{ + const guchar *p; + gchar *dest; + gchar *q; + guchar excmap[256]; + + g_return_val_if_fail (source != NULL, NULL); + + p = (guchar *) source; + /* Each source byte needs maximally four destination chars (\777) */ + q = dest = g_malloc (strlen (source) * 4 + 1); + + memset (excmap, 0, 256); + if (exceptions) + { + guchar *e = (guchar *) exceptions; + + while (*e) + { + excmap[*e] = 1; + e++; + } + } + + while (*p) + { + if (excmap[*p]) + *q++ = *p; + else + { + switch (*p) + { + case '\b': + *q++ = '\\'; + *q++ = 'b'; + break; + case '\f': + *q++ = '\\'; + *q++ = 'f'; + break; + case '\n': + *q++ = '\\'; + *q++ = 'n'; + break; + case '\r': + *q++ = '\\'; + *q++ = 'r'; + break; + case '\t': + *q++ = '\\'; + *q++ = 't'; + break; + case '\\': + *q++ = '\\'; + *q++ = '\\'; + break; + case '"': + *q++ = '\\'; + *q++ = '"'; + break; + default: + if ((*p < ' ') || (*p >= 0177)) + { + *q++ = '\\'; + *q++ = '0' + (((*p) >> 6) & 07); + *q++ = '0' + (((*p) >> 3) & 07); + *q++ = '0' + ((*p) & 07); + } + else + *q++ = *p; + break; + } + } + p++; + } + *q = 0; + return dest; +} + +gchar* +g_strchug (gchar *string) +{ + guchar *start; + + g_return_val_if_fail (string != NULL, NULL); + + for (start = (guchar*) string; *start && g_ascii_isspace (*start); start++) + ; + + g_memmove (string, start, strlen ((gchar *) start) + 1); + + return string; +} + +gchar* +g_strchomp (gchar *string) +{ + gsize len; + + g_return_val_if_fail (string != NULL, NULL); + + len = strlen (string); + while (len--) + { + if (g_ascii_isspace ((guchar) string[len])) + string[len] = '\0'; + else + break; + } + + return string; +} + +/** + * g_strsplit: + * @string: a string to split. + * @delimiter: a string which specifies the places at which to split the string. + * The delimiter is not included in any of the resulting strings, unless + * @max_tokens is reached. + * @max_tokens: the maximum number of pieces to split @string into. If this is + * less than 1, the string is split completely. + * + * Splits a string into a maximum of @max_tokens pieces, using the given + * @delimiter. If @max_tokens is reached, the remainder of @string is appended + * to the last token. + * + * As a special case, the result of splitting the empty string "" is an empty + * vector, not a vector containing a single string. The reason for this + * special case is that being able to represent a empty vector is typically + * more useful than consistent handling of empty elements. If you do need + * to represent empty elements, you'll need to check for the empty string + * before calling g_strsplit(). + * + * Return value: a newly-allocated %NULL-terminated array of strings. Use + * g_strfreev() to free it. + **/ +gchar** +g_strsplit (const gchar *string, + const gchar *delimiter, + gint max_tokens) +{ + GSList *string_list = NULL, *slist; + gchar **str_array, *s; + guint n = 0; + const gchar *remainder; + + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (delimiter != NULL, NULL); + g_return_val_if_fail (delimiter[0] != '\0', NULL); + + if (max_tokens < 1) + max_tokens = G_MAXINT; + + remainder = string; + s = strstr (remainder, delimiter); + if (s) + { + gsize delimiter_len = strlen (delimiter); + + while (--max_tokens && s) + { + gsize len; + + len = s - remainder; + string_list = g_slist_prepend (string_list, + g_strndup (remainder, len)); + n++; + remainder = s + delimiter_len; + s = strstr (remainder, delimiter); + } + } + if (*string) + { + n++; + string_list = g_slist_prepend (string_list, g_strdup (remainder)); + } + + str_array = g_new (gchar*, n + 1); + + str_array[n--] = NULL; + for (slist = string_list; slist; slist = slist->next) + str_array[n--] = slist->data; + + g_slist_free (string_list); + + return str_array; +} + +/** + * g_strsplit_set: + * @string: The string to be tokenized + * @delimiters: A nul-terminated string containing bytes that are used + * to split the string. + * @max_tokens: The maximum number of tokens to split @string into. + * If this is less than 1, the string is split completely + * + * Splits @string into a number of tokens not containing any of the characters + * in @delimiter. A token is the (possibly empty) longest string that does not + * contain any of the characters in @delimiters. If @max_tokens is reached, the + * remainder is appended to the last token. + * + * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a + * %NULL-terminated vector containing the three strings "abc", "def", + * and "ghi". + * + * The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated + * vector containing the four strings "", "def", "ghi", and "". + * + * As a special case, the result of splitting the empty string "" is an empty + * vector, not a vector containing a single string. The reason for this + * special case is that being able to represent a empty vector is typically + * more useful than consistent handling of empty elements. If you do need + * to represent empty elements, you'll need to check for the empty string + * before calling g_strsplit_set(). + * + * Note that this function works on bytes not characters, so it can't be used + * to delimit UTF-8 strings for anything but ASCII characters. + * + * Return value: a newly-allocated %NULL-terminated array of strings. Use + * g_strfreev() to free it. + * + * Since: 2.4 + **/ +gchar ** +g_strsplit_set (const gchar *string, + const gchar *delimiters, + gint max_tokens) +{ + gboolean delim_table[256]; + GSList *tokens, *list; + gint n_tokens; + const gchar *s; + const gchar *current; + gchar *token; + gchar **result; + + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (delimiters != NULL, NULL); + + if (max_tokens < 1) + max_tokens = G_MAXINT; + + if (*string == '\0') + { + result = g_new (char *, 1); + result[0] = NULL; + return result; + } + + memset (delim_table, FALSE, sizeof (delim_table)); + for (s = delimiters; *s != '\0'; ++s) + delim_table[*(guchar *)s] = TRUE; + + tokens = NULL; + n_tokens = 0; + + s = current = string; + while (*s != '\0') + { + if (delim_table[*(guchar *)s] && n_tokens + 1 < max_tokens) + { + token = g_strndup (current, s - current); + tokens = g_slist_prepend (tokens, token); + ++n_tokens; + + current = s + 1; + } + + ++s; + } + + token = g_strndup (current, s - current); + tokens = g_slist_prepend (tokens, token); + ++n_tokens; + + result = g_new (gchar *, n_tokens + 1); + + result[n_tokens] = NULL; + for (list = tokens; list != NULL; list = list->next) + result[--n_tokens] = list->data; + + g_slist_free (tokens); + + return result; +} + +/** + * g_strfreev: + * @str_array: a %NULL-terminated array of strings to free. + + * Frees a %NULL-terminated array of strings, and the array itself. + * If called on a %NULL value, g_strfreev() simply returns. + **/ +void +g_strfreev (gchar **str_array) +{ + if (str_array) + { + int i; + + for (i = 0; str_array[i] != NULL; i++) + g_free (str_array[i]); + + g_free (str_array); + } +} + +/** + * g_strdupv: + * @str_array: %NULL-terminated array of strings. + * + * Copies %NULL-terminated array of strings. The copy is a deep copy; + * the new array should be freed by first freeing each string, then + * the array itself. g_strfreev() does this for you. If called + * on a %NULL value, g_strdupv() simply returns %NULL. + * + * Return value: a new %NULL-terminated array of strings. + **/ +gchar** +g_strdupv (gchar **str_array) +{ + if (str_array) + { + gint i; + gchar **retval; + + i = 0; + while (str_array[i]) + ++i; + + retval = g_new (gchar*, i + 1); + + i = 0; + while (str_array[i]) + { + retval[i] = g_strdup (str_array[i]); + ++i; + } + retval[i] = NULL; + + return retval; + } + else + return NULL; +} + +/** + * g_strjoinv: + * @separator: a string to insert between each of the strings, or %NULL + * @str_array: a %NULL-terminated array of strings to join + * + * Joins a number of strings together to form one long string, with the + * optional @separator inserted between each of them. The returned string + * should be freed with g_free(). + * + * Returns: a newly-allocated string containing all of the strings joined + * together, with @separator between them + */ +gchar* +g_strjoinv (const gchar *separator, + gchar **str_array) +{ + gchar *string; + gchar *ptr; + + g_return_val_if_fail (str_array != NULL, NULL); + + if (separator == NULL) + separator = ""; + + if (*str_array) + { + gint i; + gsize len; + gsize separator_len; + + separator_len = strlen (separator); + /* First part, getting length */ + len = 1 + strlen (str_array[0]); + for (i = 1; str_array[i] != NULL; i++) + len += strlen (str_array[i]); + len += separator_len * (i - 1); + + /* Second part, building string */ + string = g_new (gchar, len); + ptr = g_stpcpy (string, *str_array); + for (i = 1; str_array[i] != NULL; i++) + { + ptr = g_stpcpy (ptr, separator); + ptr = g_stpcpy (ptr, str_array[i]); + } + } + else + string = g_strdup (""); + + return string; +} + +/** + * g_strjoin: + * @separator: a string to insert between each of the strings, or %NULL + * @...: a %NULL-terminated list of strings to join + * + * Joins a number of strings together to form one long string, with the + * optional @separator inserted between each of them. The returned string + * should be freed with g_free(). + * + * Returns: a newly-allocated string containing all of the strings joined + * together, with @separator between them + */ +gchar* +g_strjoin (const gchar *separator, + ...) +{ + gchar *string, *s; + va_list args; + gsize len; + gsize separator_len; + gchar *ptr; + + if (separator == NULL) + separator = ""; + + separator_len = strlen (separator); + + va_start (args, separator); + + s = va_arg (args, gchar*); + + if (s) + { + /* First part, getting length */ + len = 1 + strlen (s); + + s = va_arg (args, gchar*); + while (s) + { + len += separator_len + strlen (s); + s = va_arg (args, gchar*); + } + va_end (args); + + /* Second part, building string */ + string = g_new (gchar, len); + + va_start (args, separator); + + s = va_arg (args, gchar*); + ptr = g_stpcpy (string, s); + + s = va_arg (args, gchar*); + while (s) + { + ptr = g_stpcpy (ptr, separator); + ptr = g_stpcpy (ptr, s); + s = va_arg (args, gchar*); + } + } + else + string = g_strdup (""); + + va_end (args); + + return string; +} + + +/** + * g_strstr_len: + * @haystack: a string. + * @haystack_len: the maximum length of @haystack. Note that -1 is + * a valid length, if @haystack is nul-terminated, meaning it will + * search through the whole string. + * @needle: the string to search for. + * + * Searches the string @haystack for the first occurrence + * of the string @needle, limiting the length of the search + * to @haystack_len. + * + * Return value: a pointer to the found occurrence, or + * %NULL if not found. + **/ +gchar * +g_strstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle) +{ + g_return_val_if_fail (haystack != NULL, NULL); + g_return_val_if_fail (needle != NULL, NULL); + + if (haystack_len < 0) + return strstr (haystack, needle); + else + { + const gchar *p = haystack; + gsize needle_len = strlen (needle); + const gchar *end; + gsize i; + + if (needle_len == 0) + return (gchar *)haystack; + + if (haystack_len < needle_len) + return NULL; + + end = haystack + haystack_len - needle_len; + + while (p <= end && *p) + { + for (i = 0; i < needle_len; i++) + if (p[i] != needle[i]) + goto next; + + return (gchar *)p; + + next: + p++; + } + + return NULL; + } +} + +/** + * g_strrstr: + * @haystack: a nul-terminated string. + * @needle: the nul-terminated string to search for. + * + * Searches the string @haystack for the last occurrence + * of the string @needle. + * + * Return value: a pointer to the found occurrence, or + * %NULL if not found. + **/ +gchar * +g_strrstr (const gchar *haystack, + const gchar *needle) +{ + gsize i; + gsize needle_len; + gsize haystack_len; + const gchar *p; + + g_return_val_if_fail (haystack != NULL, NULL); + g_return_val_if_fail (needle != NULL, NULL); + + needle_len = strlen (needle); + haystack_len = strlen (haystack); + + if (needle_len == 0) + return (gchar *)haystack; + + if (haystack_len < needle_len) + return NULL; + + p = haystack + haystack_len - needle_len; + + while (p >= haystack) + { + for (i = 0; i < needle_len; i++) + if (p[i] != needle[i]) + goto next; + + return (gchar *)p; + + next: + p--; + } + + return NULL; +} + +/** + * g_strrstr_len: + * @haystack: a nul-terminated string. + * @haystack_len: the maximum length of @haystack. + * @needle: the nul-terminated string to search for. + * + * Searches the string @haystack for the last occurrence + * of the string @needle, limiting the length of the search + * to @haystack_len. + * + * Return value: a pointer to the found occurrence, or + * %NULL if not found. + **/ +gchar * +g_strrstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle) +{ + g_return_val_if_fail (haystack != NULL, NULL); + g_return_val_if_fail (needle != NULL, NULL); + + if (haystack_len < 0) + return g_strrstr (haystack, needle); + else + { + gsize needle_len = strlen (needle); + const gchar *haystack_max = haystack + haystack_len; + const gchar *p = haystack; + gsize i; + + while (p < haystack_max && *p) + p++; + + if (p < haystack + needle_len) + return NULL; + + p -= needle_len; + + while (p >= haystack) + { + for (i = 0; i < needle_len; i++) + if (p[i] != needle[i]) + goto next; + + return (gchar *)p; + + next: + p--; + } + + return NULL; + } +} + + +/** + * g_str_has_suffix: + * @str: a nul-terminated string. + * @suffix: the nul-terminated suffix to look for. + * + * Looks whether the string @str ends with @suffix. + * + * Return value: %TRUE if @str end with @suffix, %FALSE otherwise. + * + * Since: 2.2 + **/ +gboolean +g_str_has_suffix (const gchar *str, + const gchar *suffix) +{ + int str_len; + int suffix_len; + + g_return_val_if_fail (str != NULL, FALSE); + g_return_val_if_fail (suffix != NULL, FALSE); + + str_len = strlen (str); + suffix_len = strlen (suffix); + + if (str_len < suffix_len) + return FALSE; + + return strcmp (str + str_len - suffix_len, suffix) == 0; +} + +/** + * g_str_has_prefix: + * @str: a nul-terminated string. + * @prefix: the nul-terminated prefix to look for. + * + * Looks whether the string @str begins with @prefix. + * + * Return value: %TRUE if @str begins with @prefix, %FALSE otherwise. + * + * Since: 2.2 + **/ +gboolean +g_str_has_prefix (const gchar *str, + const gchar *prefix) +{ + int str_len; + int prefix_len; + + g_return_val_if_fail (str != NULL, FALSE); + g_return_val_if_fail (prefix != NULL, FALSE); + + str_len = strlen (str); + prefix_len = strlen (prefix); + + if (str_len < prefix_len) + return FALSE; + + return strncmp (str, prefix, prefix_len) == 0; +} + + +/** + * g_strip_context: + * @msgid: a string + * @msgval: another string + * + * An auxiliary function for gettext() support (see Q_()). + * + * Return value: @msgval, unless @msgval is identical to @msgid and contains + * a '|' character, in which case a pointer to the substring of msgid after + * the first '|' character is returned. + * + * Since: 2.4 + **/ +const gchar * +g_strip_context (const gchar *msgid, + const gchar *msgval) +{ + if (msgval == msgid) + { + const char *c = strchr (msgid, '|'); + if (c != NULL) + return c + 1; + } + + return msgval; +} + + +/** + * g_strv_length: + * @str_array: a %NULL-terminated array of strings. + * + * Returns the length of the given %NULL-terminated + * string array @str_array. + * + * Return value: length of @str_array. + * + * Since: 2.6 + **/ +guint +g_strv_length (gchar **str_array) +{ + guint i = 0; + + g_return_val_if_fail (str_array != NULL, 0); + + while (str_array[i]) + ++i; + + return i; +} + + +/** + * g_dpgettext: + * @domain: the translation domain to use, or %NULL to use + * the domain set with textdomain() + * @msgctxtid: a combined message context and message id, separated + * by a \004 character + * @msgidoffset: the offset of the message id in @msgctxid + * + * This function is a variant of g_dgettext() which supports + * a disambiguating message context. GNU gettext uses the + * '\004' character to separate the message context and + * message id in @msgctxtid. + * If 0 is passed as @msgidoffset, this function will fall back to + * trying to use the deprecated convention of using "|" as a separation + * character. + * + * This uses g_dgettext() internally. See that functions for differences + * with dgettext() proper. + * + * Applications should normally not use this function directly, + * but use the C_() macro for translations with context. + * + * Returns: The translated string + * + * Since: 2.16 + */ +const gchar * +g_dpgettext (const gchar *domain, + const gchar *msgctxtid, + gsize msgidoffset) +{ + const gchar *translation; + gchar *sep; + + translation = g_dgettext (domain, msgctxtid); + + if (translation == msgctxtid) + { + if (msgidoffset > 0) + return msgctxtid + msgidoffset; + + sep = strchr (msgctxtid, '|'); + + if (sep) + { + /* try with '\004' instead of '|', in case + * xgettext -kQ_:1g was used + */ + gchar *tmp = g_alloca (strlen (msgctxtid) + 1); + strcpy (tmp, msgctxtid); + tmp[sep - msgctxtid] = '\004'; + + translation = g_dgettext (domain, tmp); + + if (translation == tmp) + return sep + 1; + } + } + + return translation; +} + +/* This function is taken from gettext.h + * GNU gettext uses '\004' to separate context and msgid in .mo files. + */ +/** + * g_dpgettext2: + * @domain: the translation domain to use, or %NULL to use + * the domain set with textdomain() + * @context: the message context + * @msgid: the message + * + * This function is a variant of g_dgettext() which supports + * a disambiguating message context. GNU gettext uses the + * '\004' character to separate the message context and + * message id in @msgctxtid. + * + * This uses g_dgettext() internally. See that functions for differences + * with dgettext() proper. + * + * This function differs from C_() in that it is not a macro and + * thus you may use non-string-literals as context and msgid arguments. + * + * Returns: The translated string + * + * Since: 2.18 + */ +const char * +g_dpgettext2 (const char *domain, + const char *msgctxt, + const char *msgid) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; + char* msg_ctxt_id; + + msg_ctxt_id = g_alloca (msgctxt_len + msgid_len); + + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + + translation = g_dgettext (domain, msg_ctxt_id); + + if (translation == msg_ctxt_id) + { + /* try the old way of doing message contexts, too */ + msg_ctxt_id[msgctxt_len - 1] = '|'; + translation = g_dgettext (domain, msg_ctxt_id); + + if (translation == msg_ctxt_id) + return msgid; + } + + return translation; +} + +static gboolean +_g_dgettext_should_translate (void) +{ + static gsize translate = 0; + enum { + SHOULD_TRANSLATE = 1, + SHOULD_NOT_TRANSLATE = 2 + }; + + if (G_UNLIKELY (g_once_init_enter (&translate))) + { + gboolean should_translate = TRUE; + + const char *default_domain = textdomain (NULL); + const char *translator_comment = gettext (""); +#ifndef G_OS_WIN32 + const char *translate_locale = setlocale (LC_MESSAGES, NULL); +#else + const char *translate_locale = g_win32_getlocale (); +#endif + /* We should NOT translate only if all the following hold: + * - user has called textdomain() and set textdomain to non-default + * - default domain has no translations + * - locale does not start with "en_" and is not "C" + * + * Rationale: + * - If text domain is still the default domain, maybe user calls + * it later. Continue with old behavior of translating. + * - If locale starts with "en_", we can continue using the + * translations even if the app doesn't have translations for + * this locale. That is, en_UK and en_CA for example. + * - If locale is "C", maybe user calls setlocale(LC_ALL,"") later. + * Continue with old behavior of translating. + */ + if (0 != strcmp (default_domain, "messages") && + '\0' == *translator_comment && + 0 != strncmp (translate_locale, "en_", 3) && + 0 != strcmp (translate_locale, "C")) + should_translate = FALSE; + + g_once_init_leave (&translate, + should_translate ? + SHOULD_TRANSLATE : + SHOULD_NOT_TRANSLATE); + } + + return translate == SHOULD_TRANSLATE; +} + +/** + * g_dgettext: + * @domain: the translation domain to use, or %NULL to use + * the domain set with textdomain() + * @msgid: message to translate + * + * This function is a wrapper of dgettext() which does not translate + * the message if the default domain as set with textdomain() has no + * translations for the current locale. + * + * The advantage of using this function over dgettext() proper is that + * libraries using this function (like GTK+) will not use translations + * if the application using the library does not have translations for + * the current locale. This results in a consistent English-only + * interface instead of one having partial translations. For this + * feature to work, the call to textdomain() and setlocale() should + * precede any g_dgettext() invocations. For GTK+, it means calling + * textdomain() before gtk_init or its variants. + * + * This function disables translations if and only if upon its first + * call all the following conditions hold: + * + * @domain is not %NULL + * textdomain() has been called to set a default text domain + * there is no translations available for the default text domain + * and the current locale + * current locale is not "C" or any English locales (those + * starting with "en_") + * + * + * Note that this behavior may not be desired for example if an application + * has its untranslated messages in a language other than English. In those + * cases the application should call textdomain() after initializing GTK+. + * + * Applications should normally not use this function directly, + * but use the _() macro for translations. + * + * Returns: The translated string + * + * Since: 2.18 + */ +const gchar * +g_dgettext (const gchar *domain, + const gchar *msgid) +{ + if (domain && G_UNLIKELY (!_g_dgettext_should_translate ())) + return msgid; + + return dgettext (domain, msgid); +} + +/** + * g_dcgettext: + * @domain: (allow-none): the translation domain to use, or %NULL to use + * the domain set with textdomain() + * @msgid: message to translate + * @category: a locale category + * + * This is a variant of g_dgettext() that allows specifying a locale + * category instead of always using %LC_MESSAGES. See g_dgettext() for + * more information about how this functions differs from calling + * dcgettext() directly. + * + * Returns: the translated string for the given locale category + * + * Since: 2.26 + */ +const gchar * +g_dcgettext (const gchar *domain, + const gchar *msgid, + int category) +{ + if (domain && G_UNLIKELY (!_g_dgettext_should_translate ())) + return msgid; + + return dcgettext (domain, msgid, category); +} + +/** + * g_dngettext: + * @domain: the translation domain to use, or %NULL to use + * the domain set with textdomain() + * @msgid: message to translate + * @msgid_plural: plural form of the message + * @n: the quantity for which translation is needed + * + * This function is a wrapper of dngettext() which does not translate + * the message if the default domain as set with textdomain() has no + * translations for the current locale. + * + * See g_dgettext() for details of how this differs from dngettext() + * proper. + * + * Returns: The translated string + * + * Since: 2.18 + */ +const gchar * +g_dngettext (const gchar *domain, + const gchar *msgid, + const gchar *msgid_plural, + gulong n) +{ + if (domain && G_UNLIKELY (!_g_dgettext_should_translate ())) + return n == 1 ? msgid : msgid_plural; + + return dngettext (domain, msgid, msgid_plural, n); +} diff --git a/deps/glib/gstrfuncs.h b/deps/glib/gstrfuncs.h new file mode 100644 index 0000000..8f99c55 --- /dev/null +++ b/deps/glib/gstrfuncs.h @@ -0,0 +1,269 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_STRFUNCS_H__ +#define __G_STRFUNCS_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +/* Functions like the ones in that are not affected by locale. */ +typedef enum { + G_ASCII_ALNUM = 1 << 0, + G_ASCII_ALPHA = 1 << 1, + G_ASCII_CNTRL = 1 << 2, + G_ASCII_DIGIT = 1 << 3, + G_ASCII_GRAPH = 1 << 4, + G_ASCII_LOWER = 1 << 5, + G_ASCII_PRINT = 1 << 6, + G_ASCII_PUNCT = 1 << 7, + G_ASCII_SPACE = 1 << 8, + G_ASCII_UPPER = 1 << 9, + G_ASCII_XDIGIT = 1 << 10 +} GAsciiType; + +GLIB_VAR const guint16 * const g_ascii_table; + +#define g_ascii_isalnum(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0) + +#define g_ascii_isalpha(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0) + +#define g_ascii_iscntrl(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0) + +#define g_ascii_isdigit(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0) + +#define g_ascii_isgraph(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0) + +#define g_ascii_islower(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0) + +#define g_ascii_isprint(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0) + +#define g_ascii_ispunct(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0) + +#define g_ascii_isspace(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0) + +#define g_ascii_isupper(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0) + +#define g_ascii_isxdigit(c) \ + ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0) + +gchar g_ascii_tolower (gchar c) G_GNUC_CONST; +gchar g_ascii_toupper (gchar c) G_GNUC_CONST; + +gint g_ascii_digit_value (gchar c) G_GNUC_CONST; +gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST; + +/* String utility functions that modify a string argument or + * return a constant string that must not be freed. + */ +#define G_STR_DELIMITERS "_-|> <." +gchar* g_strdelimit (gchar *string, + const gchar *delimiters, + gchar new_delimiter); +gchar* g_strcanon (gchar *string, + const gchar *valid_chars, + gchar substitutor); +const gchar * g_strerror (gint errnum) G_GNUC_CONST; +const gchar * g_strsignal (gint signum) G_GNUC_CONST; +gchar * g_strreverse (gchar *string); +gsize g_strlcpy (gchar *dest, + const gchar *src, + gsize dest_size); +gsize g_strlcat (gchar *dest, + const gchar *src, + gsize dest_size); +gchar * g_strstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle); +gchar * g_strrstr (const gchar *haystack, + const gchar *needle); +gchar * g_strrstr_len (const gchar *haystack, + gssize haystack_len, + const gchar *needle); + +gboolean g_str_has_suffix (const gchar *str, + const gchar *suffix); +gboolean g_str_has_prefix (const gchar *str, + const gchar *prefix); + +/* String to/from double conversion functions */ + +gdouble g_strtod (const gchar *nptr, + gchar **endptr); +gdouble g_ascii_strtod (const gchar *nptr, + gchar **endptr); +guint64 g_ascii_strtoull (const gchar *nptr, + gchar **endptr, + guint base); +gint64 g_ascii_strtoll (const gchar *nptr, + gchar **endptr, + guint base); +/* 29 bytes should enough for all possible values that + * g_ascii_dtostr can produce. + * Then add 10 for good measure */ +#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10) +gchar * g_ascii_dtostr (gchar *buffer, + gint buf_len, + gdouble d); +gchar * g_ascii_formatd (gchar *buffer, + gint buf_len, + const gchar *format, + gdouble d); + +/* removes leading spaces */ +gchar* g_strchug (gchar *string); +/* removes trailing spaces */ +gchar* g_strchomp (gchar *string); +/* removes leading & trailing spaces */ +#define g_strstrip( string ) g_strchomp (g_strchug (string)) + +gint g_ascii_strcasecmp (const gchar *s1, + const gchar *s2); +gint g_ascii_strncasecmp (const gchar *s1, + const gchar *s2, + gsize n); +gchar* g_ascii_strdown (const gchar *str, + gssize len) G_GNUC_MALLOC; +gchar* g_ascii_strup (const gchar *str, + gssize len) G_GNUC_MALLOC; + +#ifndef G_DISABLE_DEPRECATED + +/* The following four functions are deprecated and will be removed in + * the next major release. They use the locale-specific tolower and + * toupper, which is almost never the right thing. + */ + +gint g_strcasecmp (const gchar *s1, + const gchar *s2); +gint g_strncasecmp (const gchar *s1, + const gchar *s2, + guint n); +gchar* g_strdown (gchar *string); +gchar* g_strup (gchar *string); + +#endif /* G_DISABLE_DEPRECATED */ + +/* String utility functions that return a newly allocated string which + * ought to be freed with g_free from the caller at some point. + */ +gchar* g_strdup (const gchar *str) G_GNUC_MALLOC; +gchar* g_strdup_printf (const gchar *format, + ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC; +gchar* g_strdup_vprintf (const gchar *format, + va_list args) G_GNUC_MALLOC; +gchar* g_strndup (const gchar *str, + gsize n) G_GNUC_MALLOC; +gchar* g_strnfill (gsize length, + gchar fill_char) G_GNUC_MALLOC; +gchar* g_strconcat (const gchar *string1, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; +gchar* g_strjoin (const gchar *separator, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; + +/* Make a copy of a string interpreting C string -style escape + * sequences. Inverse of g_strescape. The recognized sequences are \b + * \f \n \r \t \\ \" and the octal format. + */ +gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC; + +/* Copy a string escaping nonprintable characters like in C strings. + * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points + * to a string containing characters that are not to be escaped. + * + * Deprecated API: gchar* g_strescape (const gchar *source); + * Luckily this function wasn't used much, using NULL as second parameter + * provides mostly identical semantics. + */ +gchar* g_strescape (const gchar *source, + const gchar *exceptions) G_GNUC_MALLOC; + +gpointer g_memdup (gconstpointer mem, + guint byte_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(2); + +/* NULL terminated string arrays. + * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens + * at delim and return a newly allocated string array. + * g_strjoinv() concatenates all of str_array's strings, sliding in an + * optional separator, the returned string is newly allocated. + * g_strfreev() frees the array itself and all of its strings. + * g_strdupv() copies a NULL-terminated array of strings + * g_strv_length() returns the length of a NULL-terminated array of strings + */ +gchar** g_strsplit (const gchar *string, + const gchar *delimiter, + gint max_tokens) G_GNUC_MALLOC; +gchar ** g_strsplit_set (const gchar *string, + const gchar *delimiters, + gint max_tokens) G_GNUC_MALLOC; +gchar* g_strjoinv (const gchar *separator, + gchar **str_array) G_GNUC_MALLOC; +void g_strfreev (gchar **str_array); +gchar** g_strdupv (gchar **str_array) G_GNUC_MALLOC; +guint g_strv_length (gchar **str_array); + +gchar* g_stpcpy (gchar *dest, + const char *src); + +const gchar * g_strip_context (const gchar *msgid, + const gchar *msgval) G_GNUC_FORMAT(1); + +const gchar * g_dgettext (const gchar *domain, + const gchar *msgid) G_GNUC_FORMAT(2); +const gchar * g_dcgettext (const gchar *domain, + const gchar *msgid, + int category) G_GNUC_FORMAT(2); +const gchar * g_dngettext (const gchar *domain, + const gchar *msgid, + const gchar *msgid_plural, + gulong n) G_GNUC_FORMAT(3); +const gchar * g_dpgettext (const gchar *domain, + const gchar *msgctxtid, + gsize msgidoffset) G_GNUC_FORMAT(2); +const gchar * g_dpgettext2 (const gchar *domain, + const gchar *context, + const gchar *msgid) G_GNUC_FORMAT(3); + +G_END_DECLS + +#endif /* __G_STRFUNCS_H__ */ diff --git a/deps/glib/gstring.c b/deps/glib/gstring.c new file mode 100644 index 0000000..627dee6 --- /dev/null +++ b/deps/glib/gstring.c @@ -0,0 +1,1448 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include + +#include "gstring.h" + +#include "gprintf.h" + + +/** + * SECTION:string_chunks + * @title: String Chunks + * @short_description: efficient storage of groups of strings + * + * String chunks are used to store groups of strings. Memory is + * allocated in blocks, and as strings are added to the #GStringChunk + * they are copied into the next free position in a block. When a block + * is full a new block is allocated. + * + * When storing a large number of strings, string chunks are more + * efficient than using g_strdup() since fewer calls to malloc() are + * needed, and less memory is wasted in memory allocation overheads. + * + * By adding strings with g_string_chunk_insert_const() it is also + * possible to remove duplicates. + * + * To create a new #GStringChunk use g_string_chunk_new(). + * + * To add strings to a #GStringChunk use g_string_chunk_insert(). + * + * To add strings to a #GStringChunk, but without duplicating strings + * which are already in the #GStringChunk, use + * g_string_chunk_insert_const(). + * + * To free the entire #GStringChunk use g_string_chunk_free(). It is + * not possible to free individual strings. + **/ + +/** + * GStringChunk: + * + * An opaque data structure representing String Chunks. It should only + * be accessed by using the following functions. + **/ +struct _GStringChunk +{ + GHashTable *const_table; + GSList *storage_list; + gsize storage_next; + gsize this_size; + gsize default_size; +}; + +/* Hash Functions. + */ + +/** + * g_str_equal: + * @v1: a key + * @v2: a key to compare with @v1 + * + * Compares two strings for byte-by-byte equality and returns %TRUE + * if they are equal. It can be passed to g_hash_table_new() as the + * @key_equal_func parameter, when using strings as keys in a #GHashTable. + * + * Note that this function is primarily meant as a hash table comparison + * function. For a general-purpose, %NULL-safe string comparison function, + * see g_strcmp0(). + * + * Returns: %TRUE if the two keys match + */ +gboolean +g_str_equal (gconstpointer v1, + gconstpointer v2) +{ + const gchar *string1 = v1; + const gchar *string2 = v2; + + return strcmp (string1, string2) == 0; +} + +/** + * g_str_hash: + * @v: a string key + * + * Converts a string to a hash value. + * + * This function implements the widely used "djb" hash apparently posted + * by Daniel Bernstein to comp.lang.c some time ago. The 32 bit + * unsigned hash value starts at 5381 and for each byte 'c' in the + * string, is updated: hash = hash * 33 + c. This + * function uses the signed value of each byte. + * + * It can be passed to g_hash_table_new() as the @hash_func parameter, + * when using strings as keys in a #GHashTable. + * + * Returns: a hash value corresponding to the key + **/ +guint +g_str_hash (gconstpointer v) +{ + const signed char *p; + guint32 h = 5381; + + for (p = v; *p != '\0'; p++) + h = (h << 5) + h + *p; + + return h; +} + +#define MY_MAXSIZE ((gsize)-1) + +static inline gsize +nearest_power (gsize base, gsize num) +{ + if (num > MY_MAXSIZE / 2) + { + return MY_MAXSIZE; + } + else + { + gsize n = base; + + while (n < num) + n <<= 1; + + return n; + } +} + +/* String Chunks. + */ + +/** + * g_string_chunk_new: + * @size: the default size of the blocks of memory which are + * allocated to store the strings. If a particular string + * is larger than this default size, a larger block of + * memory will be allocated for it. + * + * Creates a new #GStringChunk. + * + * Returns: a new #GStringChunk + */ +GStringChunk* +g_string_chunk_new (gsize size) +{ + GStringChunk *new_chunk = g_new (GStringChunk, 1); + gsize actual_size = 1; + + actual_size = nearest_power (1, size); + + new_chunk->const_table = NULL; + new_chunk->storage_list = NULL; + new_chunk->storage_next = actual_size; + new_chunk->default_size = actual_size; + new_chunk->this_size = actual_size; + + return new_chunk; +} + +/** + * g_string_chunk_free: + * @chunk: a #GStringChunk + * + * Frees all memory allocated by the #GStringChunk. + * After calling g_string_chunk_free() it is not safe to + * access any of the strings which were contained within it. + */ +void +g_string_chunk_free (GStringChunk *chunk) +{ + GSList *tmp_list; + + g_return_if_fail (chunk != NULL); + + if (chunk->storage_list) + { + for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next) + g_free (tmp_list->data); + + g_slist_free (chunk->storage_list); + } + + if (chunk->const_table) + g_hash_table_destroy (chunk->const_table); + + g_free (chunk); +} + +/** + * g_string_chunk_clear: + * @chunk: a #GStringChunk + * + * Frees all strings contained within the #GStringChunk. + * After calling g_string_chunk_clear() it is not safe to + * access any of the strings which were contained within it. + * + * Since: 2.14 + */ +void +g_string_chunk_clear (GStringChunk *chunk) +{ + GSList *tmp_list; + + g_return_if_fail (chunk != NULL); + + if (chunk->storage_list) + { + for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next) + g_free (tmp_list->data); + + g_slist_free (chunk->storage_list); + + chunk->storage_list = NULL; + chunk->storage_next = chunk->default_size; + chunk->this_size = chunk->default_size; + } + + if (chunk->const_table) + g_hash_table_remove_all (chunk->const_table); +} + +/** + * g_string_chunk_insert: + * @chunk: a #GStringChunk + * @string: the string to add + * + * Adds a copy of @string to the #GStringChunk. + * It returns a pointer to the new copy of the string + * in the #GStringChunk. The characters in the string + * can be changed, if necessary, though you should not + * change anything after the end of the string. + * + * Unlike g_string_chunk_insert_const(), this function + * does not check for duplicates. Also strings added + * with g_string_chunk_insert() will not be searched + * by g_string_chunk_insert_const() when looking for + * duplicates. + * + * Returns: a pointer to the copy of @string within + * the #GStringChunk + */ +gchar* +g_string_chunk_insert (GStringChunk *chunk, + const gchar *string) +{ + g_return_val_if_fail (chunk != NULL, NULL); + + return g_string_chunk_insert_len (chunk, string, -1); +} + +/** + * g_string_chunk_insert_const: + * @chunk: a #GStringChunk + * @string: the string to add + * + * Adds a copy of @string to the #GStringChunk, unless the same + * string has already been added to the #GStringChunk with + * g_string_chunk_insert_const(). + * + * This function is useful if you need to copy a large number + * of strings but do not want to waste space storing duplicates. + * But you must remember that there may be several pointers to + * the same string, and so any changes made to the strings + * should be done very carefully. + * + * Note that g_string_chunk_insert_const() will not return a + * pointer to a string added with g_string_chunk_insert(), even + * if they do match. + * + * Returns: a pointer to the new or existing copy of @string + * within the #GStringChunk + */ +gchar* +g_string_chunk_insert_const (GStringChunk *chunk, + const gchar *string) +{ + char* lookup; + + g_return_val_if_fail (chunk != NULL, NULL); + + if (!chunk->const_table) + chunk->const_table = g_hash_table_new (g_str_hash, g_str_equal); + + lookup = (char*) g_hash_table_lookup (chunk->const_table, (gchar *)string); + + if (!lookup) + { + lookup = g_string_chunk_insert (chunk, string); + g_hash_table_insert (chunk->const_table, lookup, lookup); + } + + return lookup; +} + +/** + * g_string_chunk_insert_len: + * @chunk: a #GStringChunk + * @string: bytes to insert + * @len: number of bytes of @string to insert, or -1 to insert a + * nul-terminated string + * + * Adds a copy of the first @len bytes of @string to the #GStringChunk. + * The copy is nul-terminated. + * + * Since this function does not stop at nul bytes, it is the caller's + * responsibility to ensure that @string has at least @len addressable + * bytes. + * + * The characters in the returned string can be changed, if necessary, + * though you should not change anything after the end of the string. + * + * Return value: a pointer to the copy of @string within the #GStringChunk + * + * Since: 2.4 + */ +gchar* +g_string_chunk_insert_len (GStringChunk *chunk, + const gchar *string, + gssize len) +{ + gssize size; + gchar* pos; + + g_return_val_if_fail (chunk != NULL, NULL); + + if (len < 0) + size = strlen (string); + else + size = len; + + if ((chunk->storage_next + size + 1) > chunk->this_size) + { + gsize new_size = nearest_power (chunk->default_size, size + 1); + + chunk->storage_list = g_slist_prepend (chunk->storage_list, + g_new (gchar, new_size)); + + chunk->this_size = new_size; + chunk->storage_next = 0; + } + + pos = ((gchar *) chunk->storage_list->data) + chunk->storage_next; + + *(pos + size) = '\0'; + + memcpy (pos, string, size); + + chunk->storage_next += size + 1; + + return pos; +} + +/* Strings. + */ +static void +g_string_maybe_expand (GString* string, + gsize len) +{ + if (string->len + len >= string->allocated_len) + { + string->allocated_len = nearest_power (1, string->len + len + 1); + string->str = g_realloc (string->str, string->allocated_len); + } +} + +/** + * g_string_sized_new: + * @dfl_size: the default size of the space allocated to + * hold the string + * + * Creates a new #GString, with enough space for @dfl_size + * bytes. This is useful if you are going to add a lot of + * text to the string and don't want it to be reallocated + * too often. + * + * Returns: the new #GString + */ +GString* +g_string_sized_new (gsize dfl_size) +{ + GString *string = g_slice_new (GString); + + string->allocated_len = 0; + string->len = 0; + string->str = NULL; + + g_string_maybe_expand (string, MAX (dfl_size, 2)); + string->str[0] = 0; + + return string; +} + +/** + * g_string_new: + * @init: the initial text to copy into the string + * + * Creates a new #GString, initialized with the given string. + * + * Returns: the new #GString + */ +GString* +g_string_new (const gchar *init) +{ + GString *string; + + if (init == NULL || *init == '\0') + string = g_string_sized_new (2); + else + { + gint len; + + len = strlen (init); + string = g_string_sized_new (len + 2); + + g_string_append_len (string, init, len); + } + + return string; +} + +/** + * g_string_new_len: + * @init: initial contents of the string + * @len: length of @init to use + * + * Creates a new #GString with @len bytes of the @init buffer. + * Because a length is provided, @init need not be nul-terminated, + * and can contain embedded nul bytes. + * + * Since this function does not stop at nul bytes, it is the caller's + * responsibility to ensure that @init has at least @len addressable + * bytes. + * + * Returns: a new #GString + */ +GString* +g_string_new_len (const gchar *init, + gssize len) +{ + GString *string; + + if (len < 0) + return g_string_new (init); + else + { + string = g_string_sized_new (len); + + if (init) + g_string_append_len (string, init, len); + + return string; + } +} + +/** + * g_string_free: + * @string: a #GString + * @free_segment: if %TRUE the actual character data is freed as well + * + * Frees the memory allocated for the #GString. + * If @free_segment is %TRUE it also frees the character data. If + * it's %FALSE, the caller gains ownership of the buffer and must + * free it after use with g_free(). + * + * Returns: the character data of @string + * (i.e. %NULL if @free_segment is %TRUE) + */ +gchar* +g_string_free (GString *string, + gboolean free_segment) +{ + gchar *segment; + + g_return_val_if_fail (string != NULL, NULL); + + if (free_segment) + { + g_free (string->str); + segment = NULL; + } + else + segment = string->str; + + g_slice_free (GString, string); + + return segment; +} + +/** + * g_string_equal: + * @v: a #GString + * @v2: another #GString + * + * Compares two strings for equality, returning %TRUE if they are equal. + * For use with #GHashTable. + * + * Returns: %TRUE if they strings are the same length and contain the + * same bytes + */ +gboolean +g_string_equal (const GString *v, + const GString *v2) +{ + gchar *p, *q; + GString *string1 = (GString *) v; + GString *string2 = (GString *) v2; + gsize i = string1->len; + + if (i != string2->len) + return FALSE; + + p = string1->str; + q = string2->str; + while (i) + { + if (*p != *q) + return FALSE; + p++; + q++; + i--; + } + return TRUE; +} + +/** + * g_string_hash: + * @str: a string to hash + * + * Creates a hash code for @str; for use with #GHashTable. + * + * Returns: hash code for @str + */ +/* 31 bit hash function */ +guint +g_string_hash (const GString *str) +{ + const gchar *p = str->str; + gsize n = str->len; + guint h = 0; + + while (n--) + { + h = (h << 5) - h + *p; + p++; + } + + return h; +} + +/** + * g_string_assign: + * @string: the destination #GString. Its current contents + * are destroyed. + * @rval: the string to copy into @string + * + * Copies the bytes from a string into a #GString, + * destroying any previous contents. It is rather like + * the standard strcpy() function, except that you do not + * have to worry about having enough space to copy the string. + * + * Returns: @string + */ +GString* +g_string_assign (GString *string, + const gchar *rval) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (rval != NULL, string); + + /* Make sure assigning to itself doesn't corrupt the string. */ + if (string->str != rval) + { + /* Assigning from substring should be ok since g_string_truncate + does not realloc. */ + g_string_truncate (string, 0); + g_string_append (string, rval); + } + + return string; +} + +/** + * g_string_truncate: + * @string: a #GString + * @len: the new size of @string + * + * Cuts off the end of the GString, leaving the first @len bytes. + * + * Returns: @string + */ +GString* +g_string_truncate (GString *string, + gsize len) +{ + g_return_val_if_fail (string != NULL, NULL); + + string->len = MIN (len, string->len); + string->str[string->len] = 0; + + return string; +} + +/** + * g_string_set_size: + * @string: a #GString + * @len: the new length + * + * Sets the length of a #GString. If the length is less than + * the current length, the string will be truncated. If the + * length is greater than the current length, the contents + * of the newly added area are undefined. (However, as + * always, string->str[string->len] will be a nul byte.) + * + * Return value: @string + **/ +GString* +g_string_set_size (GString *string, + gsize len) +{ + g_return_val_if_fail (string != NULL, NULL); + + if (len >= string->allocated_len) + g_string_maybe_expand (string, len - string->len); + + string->len = len; + string->str[len] = 0; + + return string; +} + +/** + * g_string_insert_len: + * @string: a #GString + * @pos: position in @string where insertion should + * happen, or -1 for at the end + * @val: bytes to insert + * @len: number of bytes of @val to insert + * + * Inserts @len bytes of @val into @string at @pos. + * Because @len is provided, @val may contain embedded + * nuls and need not be nul-terminated. If @pos is -1, + * bytes are inserted at the end of the string. + * + * Since this function does not stop at nul bytes, it is + * the caller's responsibility to ensure that @val has at + * least @len addressable bytes. + * + * Returns: @string + */ +GString* +g_string_insert_len (GString *string, + gssize pos, + const gchar *val, + gssize len) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (len == 0 || val != NULL, string); + + if (len == 0) + return string; + + if (len < 0) + len = strlen (val); + + if (pos < 0) + pos = string->len; + else + g_return_val_if_fail (pos <= string->len, string); + + /* Check whether val represents a substring of string. This test + probably violates chapter and verse of the C standards, since + ">=" and "<=" are only valid when val really is a substring. + In practice, it will work on modern archs. */ + if (val >= string->str && val <= string->str + string->len) + { + gsize offset = val - string->str; + gsize precount = 0; + + g_string_maybe_expand (string, len); + val = string->str + offset; + /* At this point, val is valid again. */ + + /* Open up space where we are going to insert. */ + if (pos < string->len) + g_memmove (string->str + pos + len, string->str + pos, string->len - pos); + + /* Move the source part before the gap, if any. */ + if (offset < pos) + { + precount = MIN (len, pos - offset); + memcpy (string->str + pos, val, precount); + } + + /* Move the source part after the gap, if any. */ + if (len > precount) + memcpy (string->str + pos + precount, + val + /* Already moved: */ precount + /* Space opened up: */ len, + len - precount); + } + else + { + g_string_maybe_expand (string, len); + + /* If we aren't appending at the end, move a hunk + * of the old string to the end, opening up space + */ + if (pos < string->len) + g_memmove (string->str + pos + len, string->str + pos, string->len - pos); + + /* insert the new string */ + if (len == 1) + string->str[pos] = *val; + else + memcpy (string->str + pos, val, len); + } + + string->len += len; + + string->str[string->len] = 0; + + return string; +} + +#define SUB_DELIM_CHARS "!$&'()*+,;=" + +/** + * g_string_append: + * @string: a #GString + * @val: the string to append onto the end of @string + * + * Adds a string onto the end of a #GString, expanding + * it if necessary. + * + * Returns: @string + */ +GString* +g_string_append (GString *string, + const gchar *val) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (val != NULL, string); + + return g_string_insert_len (string, -1, val, -1); +} + +/** + * g_string_append_len: + * @string: a #GString + * @val: bytes to append + * @len: number of bytes of @val to use + * + * Appends @len bytes of @val to @string. Because @len is + * provided, @val may contain embedded nuls and need not + * be nul-terminated. + * + * Since this function does not stop at nul bytes, it is + * the caller's responsibility to ensure that @val has at + * least @len addressable bytes. + * + * Returns: @string + */ +GString* +g_string_append_len (GString *string, + const gchar *val, + gssize len) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (len == 0 || val != NULL, string); + + return g_string_insert_len (string, -1, val, len); +} + +/** + * g_string_append_c: + * @string: a #GString + * @c: the byte to append onto the end of @string + * + * Adds a byte onto the end of a #GString, expanding + * it if necessary. + * + * Returns: @string + */ +#undef g_string_append_c +GString* +g_string_append_c (GString *string, + gchar c) +{ + g_return_val_if_fail (string != NULL, NULL); + + return g_string_insert_c (string, -1, c); +} + +/** + * g_string_append_unichar: + * @string: a #GString + * @wc: a Unicode character + * + * Converts a Unicode character into UTF-8, and appends it + * to the string. + * + * Return value: @string + **/ +GString* +g_string_append_unichar (GString *string, + gunichar wc) +{ + g_return_val_if_fail (string != NULL, NULL); + + return g_string_insert_unichar (string, -1, wc); +} + +/** + * g_string_prepend: + * @string: a #GString + * @val: the string to prepend on the start of @string + * + * Adds a string on to the start of a #GString, + * expanding it if necessary. + * + * Returns: @string + */ +GString* +g_string_prepend (GString *string, + const gchar *val) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (val != NULL, string); + + return g_string_insert_len (string, 0, val, -1); +} + +/** + * g_string_prepend_len: + * @string: a #GString + * @val: bytes to prepend + * @len: number of bytes in @val to prepend + * + * Prepends @len bytes of @val to @string. + * Because @len is provided, @val may contain + * embedded nuls and need not be nul-terminated. + * + * Since this function does not stop at nul bytes, + * it is the caller's responsibility to ensure that + * @val has at least @len addressable bytes. + * + * Returns: @string + */ +GString* +g_string_prepend_len (GString *string, + const gchar *val, + gssize len) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (val != NULL, string); + + return g_string_insert_len (string, 0, val, len); +} + +/** + * g_string_prepend_c: + * @string: a #GString + * @c: the byte to prepend on the start of the #GString + * + * Adds a byte onto the start of a #GString, + * expanding it if necessary. + * + * Returns: @string + */ +GString* +g_string_prepend_c (GString *string, + gchar c) +{ + g_return_val_if_fail (string != NULL, NULL); + + return g_string_insert_c (string, 0, c); +} + +/** + * g_string_prepend_unichar: + * @string: a #GString + * @wc: a Unicode character + * + * Converts a Unicode character into UTF-8, and prepends it + * to the string. + * + * Return value: @string + **/ +GString* +g_string_prepend_unichar (GString *string, + gunichar wc) +{ + g_return_val_if_fail (string != NULL, NULL); + + return g_string_insert_unichar (string, 0, wc); +} + +/** + * g_string_insert: + * @string: a #GString + * @pos: the position to insert the copy of the string + * @val: the string to insert + * + * Inserts a copy of a string into a #GString, + * expanding it if necessary. + * + * Returns: @string + */ +GString* +g_string_insert (GString *string, + gssize pos, + const gchar *val) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (val != NULL, string); + if (pos >= 0) + g_return_val_if_fail (pos <= string->len, string); + + return g_string_insert_len (string, pos, val, -1); +} + +/** + * g_string_insert_c: + * @string: a #GString + * @pos: the position to insert the byte + * @c: the byte to insert + * + * Inserts a byte into a #GString, expanding it if necessary. + * + * Returns: @string + */ +GString* +g_string_insert_c (GString *string, + gssize pos, + gchar c) +{ + g_return_val_if_fail (string != NULL, NULL); + + g_string_maybe_expand (string, 1); + + if (pos < 0) + pos = string->len; + else + g_return_val_if_fail (pos <= string->len, string); + + /* If not just an append, move the old stuff */ + if (pos < string->len) + g_memmove (string->str + pos + 1, string->str + pos, string->len - pos); + + string->str[pos] = c; + + string->len += 1; + + string->str[string->len] = 0; + + return string; +} + +/** + * g_string_insert_unichar: + * @string: a #GString + * @pos: the position at which to insert character, or -1 to + * append at the end of the string + * @wc: a Unicode character + * + * Converts a Unicode character into UTF-8, and insert it + * into the string at the given position. + * + * Return value: @string + **/ +GString* +g_string_insert_unichar (GString *string, + gssize pos, + gunichar wc) +{ + gint charlen, first, i; + gchar *dest; + + g_return_val_if_fail (string != NULL, NULL); + + /* Code copied from g_unichar_to_utf() */ + if (wc < 0x80) + { + first = 0; + charlen = 1; + } + else if (wc < 0x800) + { + first = 0xc0; + charlen = 2; + } + else if (wc < 0x10000) + { + first = 0xe0; + charlen = 3; + } + else if (wc < 0x200000) + { + first = 0xf0; + charlen = 4; + } + else if (wc < 0x4000000) + { + first = 0xf8; + charlen = 5; + } + else + { + first = 0xfc; + charlen = 6; + } + /* End of copied code */ + + g_string_maybe_expand (string, charlen); + + if (pos < 0) + pos = string->len; + else + g_return_val_if_fail (pos <= string->len, string); + + /* If not just an append, move the old stuff */ + if (pos < string->len) + g_memmove (string->str + pos + charlen, string->str + pos, string->len - pos); + + dest = string->str + pos; + /* Code copied from g_unichar_to_utf() */ + for (i = charlen - 1; i > 0; --i) + { + dest[i] = (wc & 0x3f) | 0x80; + wc >>= 6; + } + dest[0] = wc | first; + /* End of copied code */ + + string->len += charlen; + + string->str[string->len] = 0; + + return string; +} + +/** + * g_string_overwrite: + * @string: a #GString + * @pos: the position at which to start overwriting + * @val: the string that will overwrite the @string starting at @pos + * + * Overwrites part of a string, lengthening it if necessary. + * + * Return value: @string + * + * Since: 2.14 + **/ +GString * +g_string_overwrite (GString *string, + gsize pos, + const gchar *val) +{ + g_return_val_if_fail (val != NULL, string); + return g_string_overwrite_len (string, pos, val, strlen (val)); +} + +/** + * g_string_overwrite_len: + * @string: a #GString + * @pos: the position at which to start overwriting + * @val: the string that will overwrite the @string starting at @pos + * @len: the number of bytes to write from @val + * + * Overwrites part of a string, lengthening it if necessary. + * This function will work with embedded nuls. + * + * Return value: @string + * + * Since: 2.14 + **/ +GString * +g_string_overwrite_len (GString *string, + gsize pos, + const gchar *val, + gssize len) +{ + gsize end; + + g_return_val_if_fail (string != NULL, NULL); + + if (!len) + return string; + + g_return_val_if_fail (val != NULL, string); + g_return_val_if_fail (pos <= string->len, string); + + if (len < 0) + len = strlen (val); + + end = pos + len; + + if (end > string->len) + g_string_maybe_expand (string, end - string->len); + + memcpy (string->str + pos, val, len); + + if (end > string->len) + { + string->str[end] = '\0'; + string->len = end; + } + + return string; +} + +/** + * g_string_erase: + * @string: a #GString + * @pos: the position of the content to remove + * @len: the number of bytes to remove, or -1 to remove all + * following bytes + * + * Removes @len bytes from a #GString, starting at position @pos. + * The rest of the #GString is shifted down to fill the gap. + * + * Returns: @string + */ +GString* +g_string_erase (GString *string, + gssize pos, + gssize len) +{ + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (pos >= 0, string); + g_return_val_if_fail (pos <= string->len, string); + + if (len < 0) + len = string->len - pos; + else + { + g_return_val_if_fail (pos + len <= string->len, string); + + if (pos + len < string->len) + g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len)); + } + + string->len -= len; + + string->str[string->len] = 0; + + return string; +} + +/** + * g_string_ascii_down: + * @string: a GString + * + * Converts all upper case ASCII letters to lower case ASCII letters. + * + * Return value: passed-in @string pointer, with all the upper case + * characters converted to lower case in place, with + * semantics that exactly match g_ascii_tolower(). + **/ +GString* +g_string_ascii_down (GString *string) +{ + gchar *s; + gint n; + + g_return_val_if_fail (string != NULL, NULL); + + n = string->len; + s = string->str; + + while (n) + { + *s = g_ascii_tolower (*s); + s++; + n--; + } + + return string; +} + +/** + * g_string_ascii_up: + * @string: a GString + * + * Converts all lower case ASCII letters to upper case ASCII letters. + * + * Return value: passed-in @string pointer, with all the lower case + * characters converted to upper case in place, with + * semantics that exactly match g_ascii_toupper(). + **/ +GString* +g_string_ascii_up (GString *string) +{ + gchar *s; + gint n; + + g_return_val_if_fail (string != NULL, NULL); + + n = string->len; + s = string->str; + + while (n) + { + *s = g_ascii_toupper (*s); + s++; + n--; + } + + return string; +} + +/** + * g_string_down: + * @string: a #GString + * + * Converts a #GString to lowercase. + * + * Returns: the #GString. + * + * Deprecated:2.2: This function uses the locale-specific + * tolower() function, which is almost never the right thing. + * Use g_string_ascii_down() or g_utf8_strdown() instead. + */ +GString* +g_string_down (GString *string) +{ + guchar *s; + glong n; + + g_return_val_if_fail (string != NULL, NULL); + + n = string->len; + s = (guchar *) string->str; + + while (n) + { + if (isupper (*s)) + *s = tolower (*s); + s++; + n--; + } + + return string; +} + +/** + * g_string_up: + * @string: a #GString + * + * Converts a #GString to uppercase. + * + * Return value: @string + * + * Deprecated:2.2: This function uses the locale-specific + * toupper() function, which is almost never the right thing. + * Use g_string_ascii_up() or g_utf8_strup() instead. + **/ +GString* +g_string_up (GString *string) +{ + guchar *s; + glong n; + + g_return_val_if_fail (string != NULL, NULL); + + n = string->len; + s = (guchar *) string->str; + + while (n) + { + if (islower (*s)) + *s = toupper (*s); + s++; + n--; + } + + return string; +} + +/** + * g_string_append_vprintf: + * @string: a #GString + * @format: the string format. See the printf() documentation + * @args: the list of arguments to insert in the output + * + * Appends a formatted string onto the end of a #GString. + * This function is similar to g_string_append_printf() + * except that the arguments to the format string are passed + * as a va_list. + * + * Since: 2.14 + */ +void +g_string_append_vprintf (GString *string, + const gchar *format, + va_list args) +{ + gchar *buf; + gint len; + + g_return_if_fail (string != NULL); + g_return_if_fail (format != NULL); + + len = g_vasprintf (&buf, format, args); + + if (len >= 0) + { + g_string_maybe_expand (string, len); + memcpy (string->str + string->len, buf, len + 1); + string->len += len; + g_free (buf); + } +} + +/** + * g_string_vprintf: + * @string: a #GString + * @format: the string format. See the printf() documentation + * @args: the parameters to insert into the format string + * + * Writes a formatted string into a #GString. + * This function is similar to g_string_printf() except that + * the arguments to the format string are passed as a va_list. + * + * Since: 2.14 + */ +void +g_string_vprintf (GString *string, + const gchar *format, + va_list args) +{ + g_string_truncate (string, 0); + g_string_append_vprintf (string, format, args); +} + +/** + * g_string_sprintf: + * @string: a #GString + * @format: the string format. See the sprintf() documentation + * @...: the parameters to insert into the format string + * + * Writes a formatted string into a #GString. + * This is similar to the standard sprintf() function, + * except that the #GString buffer automatically expands + * to contain the results. The previous contents of the + * #GString are destroyed. + * + * Deprecated: This function has been renamed to g_string_printf(). + */ + +/** + * g_string_printf: + * @string: a #GString + * @format: the string format. See the printf() documentation + * @...: the parameters to insert into the format string + * + * Writes a formatted string into a #GString. + * This is similar to the standard sprintf() function, + * except that the #GString buffer automatically expands + * to contain the results. The previous contents of the + * #GString are destroyed. + */ +void +g_string_printf (GString *string, + const gchar *format, + ...) +{ + va_list args; + + g_string_truncate (string, 0); + + va_start (args, format); + g_string_append_vprintf (string, format, args); + va_end (args); +} + +/** + * g_string_sprintfa: + * @string: a #GString + * @format: the string format. See the sprintf() documentation + * @...: the parameters to insert into the format string + * + * Appends a formatted string onto the end of a #GString. + * This function is similar to g_string_sprintf() except that + * the text is appended to the #GString. + * + * Deprecated: This function has been renamed to g_string_append_printf() + */ + +/** + * g_string_append_printf: + * @string: a #GString + * @format: the string format. See the printf() documentation + * @...: the parameters to insert into the format string + * + * Appends a formatted string onto the end of a #GString. + * This function is similar to g_string_printf() except + * that the text is appended to the #GString. + */ +void +g_string_append_printf (GString *string, + const gchar *format, + ...) +{ + va_list args; + + va_start (args, format); + g_string_append_vprintf (string, format, args); + va_end (args); +} diff --git a/deps/glib/gstring.h b/deps/glib/gstring.h new file mode 100644 index 0000000..8222e42 --- /dev/null +++ b/deps/glib/gstring.h @@ -0,0 +1,186 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_STRING_H__ +#define __G_STRING_H__ + +#include +#include +#include /* for G_CAN_INLINE */ + +G_BEGIN_DECLS + +typedef struct _GString GString; +typedef struct _GStringChunk GStringChunk; + +/** + * GString: + * @str: points to the character data. It may move as text is added. + * The @str field is null-terminated and so + * can be used as an ordinary C string. + * @len: contains the length of the string, not including the + * terminating nul byte. + * @allocated_len: the number of bytes that can be stored in the + * string before it needs to be reallocated. May be larger than @len. + * + * The #GString struct contains the public fields of a #GString. + */ +struct _GString +{ + gchar *str; + gsize len; + gsize allocated_len; +}; + +/* String Chunks + */ +GStringChunk* g_string_chunk_new (gsize size); +void g_string_chunk_free (GStringChunk *chunk); +void g_string_chunk_clear (GStringChunk *chunk); +gchar* g_string_chunk_insert (GStringChunk *chunk, + const gchar *string); +gchar* g_string_chunk_insert_len (GStringChunk *chunk, + const gchar *string, + gssize len); +gchar* g_string_chunk_insert_const (GStringChunk *chunk, + const gchar *string); + + +/* Strings + */ +GString* g_string_new (const gchar *init); +GString* g_string_new_len (const gchar *init, + gssize len); +GString* g_string_sized_new (gsize dfl_size); +gchar* g_string_free (GString *string, + gboolean free_segment); +gboolean g_string_equal (const GString *v, + const GString *v2); +guint g_string_hash (const GString *str); +GString* g_string_assign (GString *string, + const gchar *rval); +GString* g_string_truncate (GString *string, + gsize len); +GString* g_string_set_size (GString *string, + gsize len); +GString* g_string_insert_len (GString *string, + gssize pos, + const gchar *val, + gssize len); +GString* g_string_append (GString *string, + const gchar *val); +GString* g_string_append_len (GString *string, + const gchar *val, + gssize len); +GString* g_string_append_c (GString *string, + gchar c); +GString* g_string_append_unichar (GString *string, + gunichar wc); +GString* g_string_prepend (GString *string, + const gchar *val); +GString* g_string_prepend_c (GString *string, + gchar c); +GString* g_string_prepend_unichar (GString *string, + gunichar wc); +GString* g_string_prepend_len (GString *string, + const gchar *val, + gssize len); +GString* g_string_insert (GString *string, + gssize pos, + const gchar *val); +GString* g_string_insert_c (GString *string, + gssize pos, + gchar c); +GString* g_string_insert_unichar (GString *string, + gssize pos, + gunichar wc); +GString* g_string_overwrite (GString *string, + gsize pos, + const gchar *val); +GString* g_string_overwrite_len (GString *string, + gsize pos, + const gchar *val, + gssize len); +GString* g_string_erase (GString *string, + gssize pos, + gssize len); +GString* g_string_ascii_down (GString *string); +GString* g_string_ascii_up (GString *string); +void g_string_vprintf (GString *string, + const gchar *format, + va_list args); +void g_string_printf (GString *string, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); +void g_string_append_vprintf (GString *string, + const gchar *format, + va_list args); +void g_string_append_printf (GString *string, + const gchar *format, + ...) G_GNUC_PRINTF (2, 3); + +/* -- optimize g_strig_append_c --- */ +#ifdef G_CAN_INLINE +static inline GString* +g_string_append_c_inline (GString *gstring, + gchar c) +{ + if (gstring->len + 1 < gstring->allocated_len) + { + gstring->str[gstring->len++] = c; + gstring->str[gstring->len] = 0; + } + else + g_string_insert_c (gstring, -1, c); + return gstring; +} +#define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) +#endif /* G_CAN_INLINE */ + + +#ifndef G_DISABLE_DEPRECATED + +/* The following two functions are deprecated and will be removed in + * the next major release. They use the locale-specific tolower and + * toupper, which is almost never the right thing. + */ + +GString* g_string_down (GString *string); +GString* g_string_up (GString *string); + +/* These aliases are included for compatibility. */ +#define g_string_sprintf g_string_printf +#define g_string_sprintfa g_string_append_printf + +#endif /* G_DISABLE_DEPRECATED */ + +G_END_DECLS + +#endif /* __G_STRING_H__ */ diff --git a/deps/glib/gtestutils.c b/deps/glib/gtestutils.c new file mode 100644 index 0000000..a339fed --- /dev/null +++ b/deps/glib/gtestutils.c @@ -0,0 +1,516 @@ +/* GLib testing utilities + * Copyright (C) 2007 Imendio AB + * Authors: Tim Janik, Sven Herzberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "gtestutils.h" + +#include +#ifdef G_OS_UNIX +#include +#include +#include +#endif +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef G_OS_WIN32 +#include +#endif +#include +#include +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ + +#include "gmain.h" +#include "gstrfuncs.h" + + +/* Global variable for storing assertion messages; this is the counterpart to + * glibc's (private) __abort_msg variable, and allows developers and crash + * analysis systems like Apport and ABRT to fish out assertion messages from + * core dumps, instead of having to catch them on screen output. */ +char *__glib_assert_msg = NULL; + +static guint8* g_test_log_dump (GTestLogMsg *msg, + guint *len); + +/* --- variables --- */ +static int test_log_fd = -1; +static int test_trap_last_pid = 0; +static gboolean test_debug_log = FALSE; + +/* --- functions --- */ +const char* +g_test_log_type_name (GTestLogType log_type) +{ + switch (log_type) + { + case G_TEST_LOG_NONE: return "none"; + case G_TEST_LOG_ERROR: return "error"; + } + return "???"; +} + +static void +g_test_log_send (guint n_bytes, + const guint8 *buffer) +{ + if (test_log_fd >= 0) + { + int r; + do + r = write (test_log_fd, buffer, n_bytes); + while (r < 0 && errno == EINTR); + } + if (test_debug_log) + { + GTestLogBuffer *lbuffer = g_test_log_buffer_new (); + GTestLogMsg *msg; + guint ui; + g_test_log_buffer_push (lbuffer, n_bytes, buffer); + msg = g_test_log_buffer_pop (lbuffer); + g_warn_if_fail (msg != NULL); + g_warn_if_fail (lbuffer->data->len == 0); + g_test_log_buffer_free (lbuffer); + /* print message */ + g_printerr ("{*LOG(%s)", g_test_log_type_name (msg->log_type)); + for (ui = 0; ui < msg->n_strings; ui++) + g_printerr (":{%s}", msg->strings[ui]); + if (msg->n_nums) + { + g_printerr (":("); + for (ui = 0; ui < msg->n_nums; ui++) + g_printerr ("%s%.16Lg", ui ? ";" : "", msg->nums[ui]); + g_printerr (")"); + } + g_printerr (":LOG*}\n"); + g_test_log_msg_free (msg); + } +} + +static void +g_test_log (GTestLogType lbit, + const gchar *string1, + const gchar *string2, + guint n_args, + long double *largs) +{ + GTestLogMsg msg; + gchar *astrings[3] = { NULL, NULL, NULL }; + guint8 *dbuffer; + guint32 dbufferlen; + + msg.log_type = lbit; + msg.n_strings = (string1 != NULL) + (string1 && string2); + msg.strings = astrings; + astrings[0] = (gchar*) string1; + astrings[1] = astrings[0] ? (gchar*) string2 : NULL; + msg.n_nums = n_args; + msg.nums = largs; + dbuffer = g_test_log_dump (&msg, &dbufferlen); + g_test_log_send (dbufferlen, dbuffer); + g_free (dbuffer); +} + +void +g_assertion_message (const char *domain, + const char *file, + int line, + const char *func, + const char *message) +{ + char lstr[32]; + char *s; + + if (!message) + message = "code should not be reached"; + g_snprintf (lstr, 32, "%d", line); + s = g_strconcat (domain ? domain : "", domain && domain[0] ? ":" : "", + "ERROR:", file, ":", lstr, ":", + func, func[0] ? ":" : "", + " ", message, NULL); + g_printerr ("**\n%s\n", s); + + /* store assertion message in global variable, so that it can be found in a + * core dump */ + if (__glib_assert_msg != NULL) + /* free the old one */ + free (__glib_assert_msg); + __glib_assert_msg = (char*) malloc (strlen (s) + 1); + strcpy (__glib_assert_msg, s); + + g_test_log (G_TEST_LOG_ERROR, s, NULL, 0, NULL); + g_free (s); + abort(); +} + +void +g_assertion_message_expr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr) +{ + char *s = g_strconcat ("assertion failed: (", expr, ")", NULL); + g_assertion_message (domain, file, line, func, s); + g_free (s); +} + +void +g_assertion_message_cmpnum (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + long double arg1, + const char *cmp, + long double arg2, + char numtype) +{ + char *s = NULL; + switch (numtype) + { + case 'i': s = g_strdup_printf ("assertion failed (%s): (%.0Lf %s %.0Lf)", expr, arg1, cmp, arg2); break; + case 'x': s = g_strdup_printf ("assertion failed (%s): (0x%08" G_GINT64_MODIFIER "x %s 0x%08" G_GINT64_MODIFIER "x)", expr, (guint64) arg1, cmp, (guint64) arg2); break; + case 'f': s = g_strdup_printf ("assertion failed (%s): (%.9Lg %s %.9Lg)", expr, arg1, cmp, arg2); break; + /* ideally use: floats=%.7g double=%.17g */ + } + g_assertion_message (domain, file, line, func, s); + g_free (s); +} + +void +g_assertion_message_cmpstr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const char *arg1, + const char *cmp, + const char *arg2) +{ + char *a1, *a2, *s, *t1 = NULL, *t2 = NULL; + a1 = arg1 ? g_strconcat ("\"", t1 = g_strescape (arg1, NULL), "\"", NULL) : g_strdup ("NULL"); + a2 = arg2 ? g_strconcat ("\"", t2 = g_strescape (arg2, NULL), "\"", NULL) : g_strdup ("NULL"); + g_free (t1); + g_free (t2); + s = g_strdup_printf ("assertion failed (%s): (%s %s %s)", expr, a1, cmp, a2); + g_free (a1); + g_free (a2); + g_assertion_message (domain, file, line, func, s); + g_free (s); +} + +void +g_assertion_message_error (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const GError *error, + GQuark error_domain, + int error_code) +{ + GString *gstring; + + /* This is used by both g_assert_error() and g_assert_no_error(), so there + * are three cases: expected an error but got the wrong error, expected + * an error but got no error, and expected no error but got an error. + */ + + gstring = g_string_new ("assertion failed "); + if (error_domain) + g_string_append_printf (gstring, "(%s == (%s, %d)): ", expr, + g_quark_to_string (error_domain), error_code); + else + g_string_append_printf (gstring, "(%s == NULL): ", expr); + + if (error) + g_string_append_printf (gstring, "%s (%s, %d)", error->message, + g_quark_to_string (error->domain), error->code); + else + g_string_append_printf (gstring, "%s is NULL", expr); + + g_assertion_message (domain, file, line, func, gstring->str); + g_string_free (gstring, TRUE); +} + +/** + * g_strcmp0: + * @str1: a C string or %NULL + * @str2: another C string or %NULL + * + * Compares @str1 and @str2 like strcmp(). Handles %NULL + * gracefully by sorting it before non-%NULL strings. + * Comparing two %NULL pointers returns 0. + * + * Returns: -1, 0 or 1, if @str1 is <, == or > than @str2. + * + * Since: 2.16 + */ +int +g_strcmp0 (const char *str1, + const char *str2) +{ + if (!str1) + return -(str1 != str2); + if (!str2) + return str1 != str2; + return strcmp (str1, str2); +} + +static inline int +g_string_must_read (GString *gstring, + int fd) +{ +#define STRING_BUFFER_SIZE 4096 + char buf[STRING_BUFFER_SIZE]; + gssize bytes; + again: + bytes = read (fd, buf, sizeof (buf)); + if (bytes == 0) + return 0; /* EOF, calling this function assumes data is available */ + else if (bytes > 0) + { + g_string_append_len (gstring, buf, bytes); + return 1; + } + else if (bytes < 0 && errno == EINTR) + goto again; + else /* bytes < 0 */ + { + g_warning ("failed to read() from child process (%d): %s", test_trap_last_pid, g_strerror (errno)); + return 1; /* ignore error after warning */ + } +} + +static inline void +g_string_write_out (GString *gstring, + int outfd, + int *stringpos) +{ + if (*stringpos < gstring->len) + { + int r; + do + r = write (outfd, gstring->str + *stringpos, gstring->len - *stringpos); + while (r < 0 && errno == EINTR); + *stringpos += MAX (r, 0); + } +} + +static void +gstring_overwrite_int (GString *gstring, + guint pos, + guint32 vuint) +{ + vuint = g_htonl (vuint); + g_string_overwrite_len (gstring, pos, (const gchar*) &vuint, 4); +} + +static void +gstring_append_int (GString *gstring, + guint32 vuint) +{ + vuint = g_htonl (vuint); + g_string_append_len (gstring, (const gchar*) &vuint, 4); +} + +static void +gstring_append_double (GString *gstring, + double vdouble) +{ + union { double vdouble; guint64 vuint64; } u; + u.vdouble = vdouble; + u.vuint64 = GUINT64_TO_BE (u.vuint64); + g_string_append_len (gstring, (const gchar*) &u.vuint64, 8); +} + +static guint8* +g_test_log_dump (GTestLogMsg *msg, + guint *len) +{ + GString *gstring = g_string_sized_new (1024); + guint ui; + gstring_append_int (gstring, 0); /* message length */ + gstring_append_int (gstring, msg->log_type); + gstring_append_int (gstring, msg->n_strings); + gstring_append_int (gstring, msg->n_nums); + gstring_append_int (gstring, 0); /* reserved */ + for (ui = 0; ui < msg->n_strings; ui++) + { + guint l = strlen (msg->strings[ui]); + gstring_append_int (gstring, l); + g_string_append_len (gstring, msg->strings[ui], l); + } + for (ui = 0; ui < msg->n_nums; ui++) + gstring_append_double (gstring, msg->nums[ui]); + *len = gstring->len; + gstring_overwrite_int (gstring, 0, *len); /* message length */ + return (guint8*) g_string_free (gstring, FALSE); +} + +static inline long double +net_double (const gchar **ipointer) +{ + union { guint64 vuint64; double vdouble; } u; + guint64 aligned_int64; + memcpy (&aligned_int64, *ipointer, 8); + *ipointer += 8; + u.vuint64 = GUINT64_FROM_BE (aligned_int64); + return u.vdouble; +} + +static inline guint32 +net_int (const gchar **ipointer) +{ + guint32 aligned_int; + memcpy (&aligned_int, *ipointer, 4); + *ipointer += 4; + return g_ntohl (aligned_int); +} + +static gboolean +g_test_log_extract (GTestLogBuffer *tbuffer) +{ + const gchar *p = tbuffer->data->str; + GTestLogMsg msg; + guint mlength; + if (tbuffer->data->len < 4 * 5) + return FALSE; + mlength = net_int (&p); + if (tbuffer->data->len < mlength) + return FALSE; + msg.log_type = net_int (&p); + msg.n_strings = net_int (&p); + msg.n_nums = net_int (&p); + if (net_int (&p) == 0) + { + guint ui; + msg.strings = g_new0 (gchar*, msg.n_strings + 1); + msg.nums = g_new0 (long double, msg.n_nums); + for (ui = 0; ui < msg.n_strings; ui++) + { + guint sl = net_int (&p); + msg.strings[ui] = g_strndup (p, sl); + p += sl; + } + for (ui = 0; ui < msg.n_nums; ui++) + msg.nums[ui] = net_double (&p); + if (p <= tbuffer->data->str + mlength) + { + g_string_erase (tbuffer->data, 0, mlength); + tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup (&msg, sizeof (msg))); + return TRUE; + } + } + g_free (msg.nums); + g_strfreev (msg.strings); + g_error ("corrupt log stream from test program"); + return FALSE; +} + +/** + * g_test_log_buffer_new: + * + * Internal function for gtester to decode test log messages, no ABI guarantees provided. + */ +GTestLogBuffer* +g_test_log_buffer_new (void) +{ + GTestLogBuffer *tb = g_new0 (GTestLogBuffer, 1); + tb->data = g_string_sized_new (1024); + return tb; +} + +/** + * g_test_log_buffer_free + * + * Internal function for gtester to free test log messages, no ABI guarantees provided. + */ +void +g_test_log_buffer_free (GTestLogBuffer *tbuffer) +{ + g_return_if_fail (tbuffer != NULL); + while (tbuffer->msgs) + g_test_log_msg_free (g_test_log_buffer_pop (tbuffer)); + g_string_free (tbuffer->data, TRUE); + g_free (tbuffer); +} + +/** + * g_test_log_buffer_push + * + * Internal function for gtester to decode test log messages, no ABI guarantees provided. + */ +void +g_test_log_buffer_push (GTestLogBuffer *tbuffer, + guint n_bytes, + const guint8 *bytes) +{ + g_return_if_fail (tbuffer != NULL); + if (n_bytes) + { + gboolean more_messages; + g_return_if_fail (bytes != NULL); + g_string_append_len (tbuffer->data, (const gchar*) bytes, n_bytes); + do + more_messages = g_test_log_extract (tbuffer); + while (more_messages); + } +} + +/** + * g_test_log_buffer_pop: + * + * Internal function for gtester to retrieve test log messages, no ABI guarantees provided. + */ +GTestLogMsg* +g_test_log_buffer_pop (GTestLogBuffer *tbuffer) +{ + GTestLogMsg *msg = NULL; + g_return_val_if_fail (tbuffer != NULL, NULL); + if (tbuffer->msgs) + { + GSList *slist = g_slist_last (tbuffer->msgs); + msg = slist->data; + tbuffer->msgs = g_slist_delete_link (tbuffer->msgs, slist); + } + return msg; +} + +/** + * g_test_log_msg_free: + * + * Internal function for gtester to free test log messages, no ABI guarantees provided. + */ +void +g_test_log_msg_free (GTestLogMsg *tmsg) +{ + g_return_if_fail (tmsg != NULL); + g_strfreev (tmsg->strings); + g_free (tmsg->nums); + g_free (tmsg); +} diff --git a/deps/glib/gtestutils.h b/deps/glib/gtestutils.h new file mode 100644 index 0000000..8de5248 --- /dev/null +++ b/deps/glib/gtestutils.h @@ -0,0 +1,161 @@ +/* GLib testing utilities + * Copyright (C) 2007 Imendio AB + * Authors: Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_TEST_UTILS_H__ +#define __G_TEST_UTILS_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + +/* assertion API */ +#define g_assert_cmpstr(s1, cmp, s2) do { const char *__s1 = (s1), *__s2 = (s2); \ + if (g_strcmp0 (__s1, __s2) cmp 0) ; else \ + g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #s1 " " #cmp " " #s2, __s1, #cmp, __s2); } while (0) +#define g_assert_cmpint(n1, cmp, n2) do { gint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'i'); } while (0) +#define g_assert_cmpuint(n1, cmp, n2) do { guint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'i'); } while (0) +#define g_assert_cmphex(n1, cmp, n2) do { guint64 __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'x'); } while (0) +#define g_assert_cmpfloat(n1,cmp,n2) do { long double __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'f'); } while (0) +#define g_assert_no_error(err) do { if (err) \ + g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #err, err, 0, 0); } while (0) +#define g_assert_error(err, dom, c) do { if (!err || (err)->domain != dom || (err)->code != c) \ + g_assertion_message_error (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #err, err, dom, c); } while (0) +#ifdef G_DISABLE_ASSERT +#define g_assert_not_reached() do { (void) 0; } while (0) +#define g_assert(expr) do { (void) 0; } while (0) +#else /* !G_DISABLE_ASSERT */ +#define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) +#define g_assert(expr) do { if G_LIKELY (expr) ; else \ + g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ + #expr); } while (0) +#endif /* !G_DISABLE_ASSERT */ + +int g_strcmp0 (const char *str1, + const char *str2); + +void g_assertion_message (const char *domain, + const char *file, + int line, + const char *func, + const char *message) G_GNUC_NORETURN; +void g_assertion_message_expr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr) G_GNUC_NORETURN; +void g_assertion_message_cmpstr (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const char *arg1, + const char *cmp, + const char *arg2) G_GNUC_NORETURN; +void g_assertion_message_cmpnum (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + long double arg1, + const char *cmp, + long double arg2, + char numtype) G_GNUC_NORETURN; +void g_assertion_message_error (const char *domain, + const char *file, + int line, + const char *func, + const char *expr, + const GError *error, + GQuark error_domain, + int error_code) G_GNUC_NORETURN; +/* internal logging API */ +typedef enum { + G_TEST_LOG_NONE, + G_TEST_LOG_ERROR, /* s:msg */ +} GTestLogType; + +typedef struct { + GTestLogType log_type; + guint n_strings; + gchar **strings; /* NULL terminated */ + guint n_nums; + long double *nums; +} GTestLogMsg; +typedef struct { + /*< private >*/ + GString *data; + GSList *msgs; +} GTestLogBuffer; + +const char* g_test_log_type_name (GTestLogType log_type); +GTestLogBuffer* g_test_log_buffer_new (void); +void g_test_log_buffer_free (GTestLogBuffer *tbuffer); +void g_test_log_buffer_push (GTestLogBuffer *tbuffer, + guint n_bytes, + const guint8 *bytes); +GTestLogMsg* g_test_log_buffer_pop (GTestLogBuffer *tbuffer); +void g_test_log_msg_free (GTestLogMsg *tmsg); + +/** + * GTestLogFatalFunc: + * @log_domain: the log domain of the message + * @log_level: the log level of the message (including the fatal and recursion flags) + * @message: the message to process + * @user_data: user data, set in g_test_log_set_fatal_handler() + * + * Specifies the prototype of fatal log handler functions. + * + * Return value: %TRUE if the program should abort, %FALSE otherwise + * + * Since: 2.22 + */ +typedef gboolean (*GTestLogFatalFunc) (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data); +void +g_test_log_set_fatal_handler (GTestLogFatalFunc log_func, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_TEST_UTILS_H__ */ diff --git a/deps/glib/gthread.c b/deps/glib/gthread.c new file mode 100644 index 0000000..654628b --- /dev/null +++ b/deps/glib/gthread.c @@ -0,0 +1,2601 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * gthread.c: MT safety related functions + * Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe + * Owen Taylor + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Prelude {{{1 ----------------------------------------------------------- */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +/* implement gthread.h's inline functions */ +#define G_IMPLEMENT_INLINES 1 +#define __G_THREAD_C__ + +#include "config.h" + +#include "gthread.h" +#include "gthreadprivate.h" + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifndef G_OS_WIN32 +#include +#include +#else +#include +#endif /* G_OS_WIN32 */ + +#include + +#include "garray.h" +#include "gbitlock.h" +#include "gslist.h" +#include "gtestutils.h" +//#include "gtimer.h" + +/** + * SECTION:threads + * @title: Threads + * @short_description: thread abstraction; including threads, different + * mutexes, conditions and thread private data + * @see_also: #GThreadPool, #GAsyncQueue + * + * Threads act almost like processes, but unlike processes all threads + * of one process share the same memory. This is good, as it provides + * easy communication between the involved threads via this shared + * memory, and it is bad, because strange things (so called + * "Heisenbugs") might happen if the program is not carefully designed. + * In particular, due to the concurrent nature of threads, no + * assumptions on the order of execution of code running in different + * threads can be made, unless order is explicitly forced by the + * programmer through synchronization primitives. + * + * The aim of the thread related functions in GLib is to provide a + * portable means for writing multi-threaded software. There are + * primitives for mutexes to protect the access to portions of memory + * (#GMutex, #GStaticMutex, #G_LOCK_DEFINE, #GStaticRecMutex and + * #GStaticRWLock). There is a facility to use individual bits for + * locks (g_bit_lock()). There are primitives for condition variables to + * allow synchronization of threads (#GCond). There are primitives for + * thread-private data - data that every thread has a private instance + * of (#GPrivate, #GStaticPrivate). There are facilities for one-time + * initialization (#GOnce, g_once_init_enter()). Last but definitely + * not least there are primitives to portably create and manage + * threads (#GThread). + * + * The threading system is initialized with g_thread_init(), which + * takes an optional custom thread implementation or %NULL for the + * default implementation. If you want to call g_thread_init() with a + * non-%NULL argument this must be done before executing any other GLib + * functions (except g_mem_set_vtable()). This is a requirement even if + * no threads are in fact ever created by the process. + * + * Calling g_thread_init() with a %NULL argument is somewhat more + * relaxed. You may call any other glib functions in the main thread + * before g_thread_init() as long as g_thread_init() is not called from + * a glib callback, or with any locks held. However, many libraries + * above glib does not support late initialization of threads, so doing + * this should be avoided if possible. + * + * Please note that since version 2.24 the GObject initialization + * function g_type_init() initializes threads (with a %NULL argument), + * so most applications, including those using Gtk+ will run with + * threads enabled. If you want a special thread implementation, make + * sure you call g_thread_init() before g_type_init() is called. + * + * After calling g_thread_init(), GLib is completely thread safe (all + * global data is automatically locked), but individual data structure + * instances are not automatically locked for performance reasons. So, + * for example you must coordinate accesses to the same #GHashTable + * from multiple threads. The two notable exceptions from this rule + * are #GMainLoop and #GAsyncQueue, which are + * threadsafe and need no further application-level locking to be + * accessed from multiple threads. + * + * To help debugging problems in multithreaded applications, GLib + * supports error-checking mutexes that will give you helpful error + * messages on common problems. To use error-checking mutexes, define + * the symbol #G_ERRORCHECK_MUTEXES when compiling the application. + **/ + +/** + * G_THREADS_IMPL_POSIX: + * + * This macro is defined if POSIX style threads are used. + **/ + +/** + * G_THREADS_ENABLED: + * + * This macro is defined if GLib was compiled with thread support. This + * does not necessarily mean that there is a thread implementation + * available, but it does mean that the infrastructure is in place and + * that once you provide a thread implementation to g_thread_init(), + * GLib will be multi-thread safe. If #G_THREADS_ENABLED is not + * defined, then Glib is not, and cannot be, multi-thread safe. + **/ + +/** + * G_THREADS_IMPL_NONE: + * + * This macro is defined if no thread implementation is used. You can, + * however, provide one to g_thread_init() to make GLib multi-thread + * safe. + **/ + +/* G_LOCK Documentation {{{1 ---------------------------------------------- */ + +/* IMPLEMENTATION NOTE: + * + * G_LOCK_DEFINE and friends are convenience macros defined in + * gthread.h. Their documentation lives here. + */ + +/** + * G_LOCK_DEFINE: + * @name: the name of the lock. + * + * The %G_LOCK_* macros provide a convenient interface to #GStaticMutex + * with the advantage that they will expand to nothing in programs + * compiled against a thread-disabled GLib, saving code and memory + * there. #G_LOCK_DEFINE defines a lock. It can appear anywhere + * variable definitions may appear in programs, i.e. in the first block + * of a function or outside of functions. The @name parameter will be + * mangled to get the name of the #GStaticMutex. This means that you + * can use names of existing variables as the parameter - e.g. the name + * of the variable you intent to protect with the lock. Look at our + * give_me_next_number() example using the + * %G_LOCK_* macros: + * + * + * Using the %G_LOCK_* convenience macros + * + * G_LOCK_DEFINE (current_number); + * + * int + * give_me_next_number (void) + * { + * static int current_number = 0; + * int ret_val; + * + * G_LOCK (current_number); + * ret_val = current_number = calc_next_number (current_number); + * G_UNLOCK (current_number); + * + * return ret_val; + * } + * + * + **/ + +/** + * G_LOCK_DEFINE_STATIC: + * @name: the name of the lock. + * + * This works like #G_LOCK_DEFINE, but it creates a static object. + **/ + +/** + * G_LOCK_EXTERN: + * @name: the name of the lock. + * + * This declares a lock, that is defined with #G_LOCK_DEFINE in another + * module. + **/ + +/** + * G_LOCK: + * @name: the name of the lock. + * + * Works like g_mutex_lock(), but for a lock defined with + * #G_LOCK_DEFINE. + **/ + +/** + * G_TRYLOCK: + * @name: the name of the lock. + * @Returns: %TRUE, if the lock could be locked. + * + * Works like g_mutex_trylock(), but for a lock defined with + * #G_LOCK_DEFINE. + **/ + +/** + * G_UNLOCK: + * @name: the name of the lock. + * + * Works like g_mutex_unlock(), but for a lock defined with + * #G_LOCK_DEFINE. + **/ + +/* GThreadError {{{1 ------------------------------------------------------- */ +/** + * GThreadError: + * @G_THREAD_ERROR_AGAIN: a thread couldn't be created due to resource + * shortage. Try again later. + * + * Possible errors of thread related functions. + **/ + +/** + * G_THREAD_ERROR: + * + * The error domain of the GLib thread subsystem. + **/ +GQuark +g_thread_error_quark (void) +{ + return g_quark_from_static_string ("g_thread_error"); +} + +/* Miscellaneous Structures {{{1 ------------------------------------------ */ +typedef struct _GRealThread GRealThread; +struct _GRealThread +{ + GThread thread; + /* Bit 0 protects private_data. To avoid deadlocks, do not block while + * holding this (particularly on the g_thread lock). */ + volatile gint private_data_lock; + GArray *private_data; + GRealThread *next; + gpointer retval; + GSystemThread system_thread; +}; + +#define LOCK_PRIVATE_DATA(self) g_bit_lock (&(self)->private_data_lock, 0) +#define UNLOCK_PRIVATE_DATA(self) g_bit_unlock (&(self)->private_data_lock, 0) + +typedef struct _GStaticPrivateNode GStaticPrivateNode; +struct _GStaticPrivateNode +{ + gpointer data; + GDestroyNotify destroy; +}; + +static void g_thread_cleanup (gpointer data); +static void g_thread_fail (void); +static guint64 gettime (void); + +guint64 (*g_thread_gettime) (void) = gettime; + +/* Global Variables {{{1 -------------------------------------------------- */ + +static GSystemThread zero_thread; /* This is initialized to all zero */ +gboolean g_thread_use_default_impl = TRUE; + +/** + * g_thread_supported: + * @Returns: %TRUE, if the thread system is initialized. + * + * This function returns %TRUE if the thread system is initialized, and + * %FALSE if it is not. + * + * This function is actually a macro. Apart from taking the + * address of it you can however use it as if it was a + * function. + **/ + +/* IMPLEMENTATION NOTE: + * + * g_thread_supported() is just returns g_threads_got_initialized + */ +gboolean g_threads_got_initialized = FALSE; + + +/* Thread Implementation Virtual Function Table {{{1 ---------------------- */ +/* Virtual Function Table Documentation {{{2 ------------------------------ */ +/** + * GThreadFunctions: + * @mutex_new: virtual function pointer for g_mutex_new() + * @mutex_lock: virtual function pointer for g_mutex_lock() + * @mutex_trylock: virtual function pointer for g_mutex_trylock() + * @mutex_unlock: virtual function pointer for g_mutex_unlock() + * @mutex_free: virtual function pointer for g_mutex_free() + * @cond_new: virtual function pointer for g_cond_new() + * @cond_signal: virtual function pointer for g_cond_signal() + * @cond_broadcast: virtual function pointer for g_cond_broadcast() + * @cond_wait: virtual function pointer for g_cond_wait() + * @cond_timed_wait: virtual function pointer for g_cond_timed_wait() + * @cond_free: virtual function pointer for g_cond_free() + * @private_new: virtual function pointer for g_private_new() + * @private_get: virtual function pointer for g_private_get() + * @private_set: virtual function pointer for g_private_set() + * @thread_create: virtual function pointer for g_thread_create() + * @thread_yield: virtual function pointer for g_thread_yield() + * @thread_join: virtual function pointer for g_thread_join() + * @thread_exit: virtual function pointer for g_thread_exit() + * @thread_set_priority: virtual function pointer for + * g_thread_set_priority() + * @thread_self: virtual function pointer for g_thread_self() + * @thread_equal: used internally by recursive mutex locks and by some + * assertion checks + * + * This function table is used by g_thread_init() to initialize the + * thread system. The functions in the table are directly used by their + * g_* prepended counterparts (described in this document). For + * example, if you call g_mutex_new() then mutex_new() from the table + * provided to g_thread_init() will be called. + * + * Do not use this struct unless you know what you are + * doing. + **/ + +/* IMPLEMENTATION NOTE: + * + * g_thread_functions_for_glib_use is a global symbol that gets used by + * most of the "primitive" threading calls. g_mutex_lock(), for + * example, is just a macro that calls the appropriate virtual function + * out of this table. + * + * For that reason, all of those macros are documented here. + */ +GThreadFunctions g_thread_functions_for_glib_use = { +/* GMutex Virtual Functions {{{2 ------------------------------------------ */ + +/** + * GMutex: + * + * The #GMutex struct is an opaque data structure to represent a mutex + * (mutual exclusion). It can be used to protect data against shared + * access. Take for example the following function: + * + * + * A function which will not work in a threaded environment + * + * int + * give_me_next_number (void) + * { + * static int current_number = 0; + * + * /* now do a very complicated calculation to calculate the new + * * number, this might for example be a random number generator + * */ + * current_number = calc_next_number (current_number); + * + * return current_number; + * } + * + * + * + * It is easy to see that this won't work in a multi-threaded + * application. There current_number must be protected against shared + * access. A first naive implementation would be: + * + * + * The wrong way to write a thread-safe function + * + * int + * give_me_next_number (void) + * { + * static int current_number = 0; + * int ret_val; + * static GMutex * mutex = NULL; + * + * if (!mutex) mutex = g_mutex_new (); + * + * g_mutex_lock (mutex); + * ret_val = current_number = calc_next_number (current_number); + * g_mutex_unlock (mutex); + * + * return ret_val; + * } + * + * + * + * This looks like it would work, but there is a race condition while + * constructing the mutex and this code cannot work reliable. Please do + * not use such constructs in your own programs! One working solution + * is: + * + * + * A correct thread-safe function + * + * static GMutex *give_me_next_number_mutex = NULL; + * + * /* this function must be called before any call to + * * give_me_next_number() + * * + * * it must be called exactly once. + * */ + * void + * init_give_me_next_number (void) + * { + * g_assert (give_me_next_number_mutex == NULL); + * give_me_next_number_mutex = g_mutex_new (); + * } + * + * int + * give_me_next_number (void) + * { + * static int current_number = 0; + * int ret_val; + * + * g_mutex_lock (give_me_next_number_mutex); + * ret_val = current_number = calc_next_number (current_number); + * g_mutex_unlock (give_me_next_number_mutex); + * + * return ret_val; + * } + * + * + * + * #GStaticMutex provides a simpler and safer way of doing this. + * + * If you want to use a mutex, and your code should also work without + * calling g_thread_init() first, then you cannot use a #GMutex, as + * g_mutex_new() requires that the thread system be initialized. Use a + * #GStaticMutex instead. + * + * A #GMutex should only be accessed via the following functions. + * + * All of the g_mutex_* functions are + * actually macros. Apart from taking their addresses, you can however + * use them as if they were functions. + **/ + +/** + * g_mutex_new: + * @Returns: a new #GMutex. + * + * Creates a new #GMutex. + * + * This function will abort if g_thread_init() has not been + * called yet. + **/ + (GMutex*(*)())g_thread_fail, + +/** + * g_mutex_lock: + * @mutex: a #GMutex. + * + * Locks @mutex. If @mutex is already locked by another thread, the + * current thread will block until @mutex is unlocked by the other + * thread. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will do nothing. + * + * #GMutex is neither guaranteed to be recursive nor to be + * non-recursive, i.e. a thread could deadlock while calling + * g_mutex_lock(), if it already has locked @mutex. Use + * #GStaticRecMutex, if you need recursive mutexes. + **/ + NULL, + +/** + * g_mutex_trylock: + * @mutex: a #GMutex. + * @Returns: %TRUE, if @mutex could be locked. + * + * Tries to lock @mutex. If @mutex is already locked by another thread, + * it immediately returns %FALSE. Otherwise it locks @mutex and returns + * %TRUE. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will immediately return %TRUE. + * + * #GMutex is neither guaranteed to be recursive nor to be + * non-recursive, i.e. the return value of g_mutex_trylock() could be + * both %FALSE or %TRUE, if the current thread already has locked + * @mutex. Use #GStaticRecMutex, if you need recursive + * mutexes. + **/ + NULL, + +/** + * g_mutex_unlock: + * @mutex: a #GMutex. + * + * Unlocks @mutex. If another thread is blocked in a g_mutex_lock() + * call for @mutex, it will be woken and can lock @mutex itself. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will do nothing. + **/ + NULL, + +/** + * g_mutex_free: + * @mutex: a #GMutex. + * + * Destroys @mutex. + * + * Calling g_mutex_free() on a locked mutex may result in + * undefined behaviour. + **/ + NULL, + +/* GCond Virtual Functions {{{2 ------------------------------------------ */ + +/** + * GCond: + * + * The #GCond struct is an opaque data structure that represents a + * condition. Threads can block on a #GCond if they find a certain + * condition to be false. If other threads change the state of this + * condition they signal the #GCond, and that causes the waiting + * threads to be woken up. + * + * + * + * Using GCond to block a thread until a condition is satisfied + * + * + * GCond* data_cond = NULL; /* Must be initialized somewhere */ + * GMutex* data_mutex = NULL; /* Must be initialized somewhere */ + * gpointer current_data = NULL; + * + * void + * push_data (gpointer data) + * { + * g_mutex_lock (data_mutex); + * current_data = data; + * g_cond_signal (data_cond); + * g_mutex_unlock (data_mutex); + * } + * + * gpointer + * pop_data (void) + * { + * gpointer data; + * + * g_mutex_lock (data_mutex); + * while (!current_data) + * g_cond_wait (data_cond, data_mutex); + * data = current_data; + * current_data = NULL; + * g_mutex_unlock (data_mutex); + * + * return data; + * } + * + * + * + * Whenever a thread calls pop_data() now, it will + * wait until current_data is non-%NULL, i.e. until some other thread + * has called push_data(). + * + * It is important to use the g_cond_wait() and + * g_cond_timed_wait() functions only inside a loop which checks for the + * condition to be true. It is not guaranteed that the waiting thread + * will find the condition fulfilled after it wakes up, even if the + * signaling thread left the condition in that state: another thread may + * have altered the condition before the waiting thread got the chance + * to be woken up, even if the condition itself is protected by a + * #GMutex, like above. + * + * A #GCond should only be accessed via the following functions. + * + * All of the g_cond_* functions are + * actually macros. Apart from taking their addresses, you can however + * use them as if they were functions. + **/ + +/** + * g_cond_new: + * @Returns: a new #GCond. + * + * Creates a new #GCond. This function will abort, if g_thread_init() + * has not been called yet. + **/ + (GCond*(*)())g_thread_fail, + +/** + * g_cond_signal: + * @cond: a #GCond. + * + * If threads are waiting for @cond, exactly one of them is woken up. + * It is good practice to hold the same lock as the waiting thread + * while calling this function, though not required. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will do nothing. + **/ + NULL, + +/** + * g_cond_broadcast: + * @cond: a #GCond. + * + * If threads are waiting for @cond, all of them are woken up. It is + * good practice to lock the same mutex as the waiting threads, while + * calling this function, though not required. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will do nothing. + **/ + NULL, + +/** + * g_cond_wait: + * @cond: a #GCond. + * @mutex: a #GMutex, that is currently locked. + * + * Waits until this thread is woken up on @cond. The @mutex is unlocked + * before falling asleep and locked again before resuming. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will immediately return. + **/ + NULL, + +/** + * g_cond_timed_wait: + * @cond: a #GCond. + * @mutex: a #GMutex that is currently locked. + * @abs_time: a #GTimeVal, determining the final time. + * @Returns: %TRUE if @cond was signalled, or %FALSE on timeout. + * + * Waits until this thread is woken up on @cond, but not longer than + * until the time specified by @abs_time. The @mutex is unlocked before + * falling asleep and locked again before resuming. + * + * If @abs_time is %NULL, g_cond_timed_wait() acts like g_cond_wait(). + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will immediately return %TRUE. + * + * To easily calculate @abs_time a combination of g_get_current_time() + * and g_time_val_add() can be used. + **/ + NULL, + +/** + * g_cond_free: + * @cond: a #GCond. + * + * Destroys the #GCond. + **/ + NULL, + +/* GPrivate Virtual Functions {{{2 --------------------------------------- */ + +/** + * GPrivate: + * + * + * #GStaticPrivate is a better choice for most uses. + * + * + * The #GPrivate struct is an opaque data structure to represent a + * thread private data key. Threads can thereby obtain and set a + * pointer which is private to the current thread. Take our + * give_me_next_number() example from + * above. Suppose we don't want current_number to be + * shared between the threads, but instead to be private to each thread. + * This can be done as follows: + * + * + * Using GPrivate for per-thread data + * + * GPrivate* current_number_key = NULL; /* Must be initialized somewhere + * with g_private_new (g_free); */ + * + * int + * give_me_next_number (void) + * { + * int *current_number = g_private_get (current_number_key); + * + * if (!current_number) + * { + * current_number = g_new (int, 1); + * *current_number = 0; + * g_private_set (current_number_key, current_number); + * } + * + * *current_number = calc_next_number (*current_number); + * + * return *current_number; + * } + * + * + * + * Here the pointer belonging to the key + * current_number_key is read. If it is %NULL, it has + * not been set yet. Then get memory for an integer value, assign this + * memory to the pointer and write the pointer back. Now we have an + * integer value that is private to the current thread. + * + * The #GPrivate struct should only be accessed via the following + * functions. + * + * All of the g_private_* functions are + * actually macros. Apart from taking their addresses, you can however + * use them as if they were functions. + **/ + +/** + * g_private_new: + * @destructor: a function to destroy the data keyed to #GPrivate when + * a thread ends. + * @Returns: a new #GPrivate. + * + * Creates a new #GPrivate. If @destructor is non-%NULL, it is a + * pointer to a destructor function. Whenever a thread ends and the + * corresponding pointer keyed to this instance of #GPrivate is + * non-%NULL, the destructor is called with this pointer as the + * argument. + * + * + * #GStaticPrivate is a better choice for most uses. + * + * + * @destructor is used quite differently from @notify in + * g_static_private_set(). + * + * A #GPrivate cannot be freed. Reuse it instead, if you + * can, to avoid shortage, or use #GStaticPrivate. + * + * This function will abort if g_thread_init() has not been + * called yet. + **/ + (GPrivate*(*)(GDestroyNotify))g_thread_fail, + +/** + * g_private_get: + * @private_key: a #GPrivate. + * @Returns: the corresponding pointer. + * + * Returns the pointer keyed to @private_key for the current thread. If + * g_private_set() hasn't been called for the current @private_key and + * thread yet, this pointer will be %NULL. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will return the value of @private_key + * casted to #gpointer. Note however, that private data set + * before g_thread_init() will + * not be retained after the + * call. Instead, %NULL will be returned in all threads directly after + * g_thread_init(), regardless of any g_private_set() calls issued + * before threading system intialization. + **/ + NULL, + +/** + * g_private_set: + * @private_key: a #GPrivate. + * @data: the new pointer. + * + * Sets the pointer keyed to @private_key for the current thread. + * + * This function can be used even if g_thread_init() has not yet been + * called, and, in that case, will set @private_key to @data casted to + * #GPrivate*. See g_private_get() for resulting caveats. + **/ + NULL, + +/* GThread Virtual Functions {{{2 ---------------------------------------- */ +/** + * GThread: + * + * The #GThread struct represents a running thread. It has three public + * read-only members, but the underlying struct is bigger, so you must + * not copy this struct. + * + * Resources for a joinable thread are not fully released + * until g_thread_join() is called for that thread. + **/ + +/** + * GThreadFunc: + * @data: data passed to the thread. + * @Returns: the return value of the thread, which will be returned by + * g_thread_join(). + * + * Specifies the type of the @func functions passed to + * g_thread_create() or g_thread_create_full(). + **/ + +/** + * GThreadPriority: + * @G_THREAD_PRIORITY_LOW: a priority lower than normal + * @G_THREAD_PRIORITY_NORMAL: the default priority + * @G_THREAD_PRIORITY_HIGH: a priority higher than normal + * @G_THREAD_PRIORITY_URGENT: the highest priority + * + * Specifies the priority of a thread. + * + * It is not guaranteed that threads with different priorities + * really behave accordingly. On some systems (e.g. Linux) there are no + * thread priorities. On other systems (e.g. Solaris) there doesn't + * seem to be different scheduling for different priorities. All in all + * try to avoid being dependent on priorities. + **/ + +/** + * g_thread_create: + * @func: a function to execute in the new thread. + * @data: an argument to supply to the new thread. + * @joinable: should this thread be joinable? + * @error: return location for error. + * @Returns: the new #GThread on success. + * + * This function creates a new thread with the default priority. + * + * If @joinable is %TRUE, you can wait for this threads termination + * calling g_thread_join(). Otherwise the thread will just disappear + * when it terminates. + * + * The new thread executes the function @func with the argument @data. + * If the thread was created successfully, it is returned. + * + * @error can be %NULL to ignore errors, or non-%NULL to report errors. + * The error is set, if and only if the function returns %NULL. + **/ + (void(*)(GThreadFunc, gpointer, gulong, + gboolean, gboolean, GThreadPriority, + gpointer, GError**))g_thread_fail, + +/** + * g_thread_yield: + * + * Gives way to other threads waiting to be scheduled. + * + * This function is often used as a method to make busy wait less evil. + * But in most cases you will encounter, there are better methods to do + * that. So in general you shouldn't use this function. + **/ + NULL, + + NULL, /* thread_join */ + NULL, /* thread_exit */ + NULL, /* thread_set_priority */ + NULL, /* thread_self */ + NULL /* thread_equal */ +}; + +/* Local Data {{{1 -------------------------------------------------------- */ + +static GMutex *g_once_mutex = NULL; +static GCond *g_once_cond = NULL; +static GPrivate *g_thread_specific_private = NULL; +static GRealThread *g_thread_all_threads = NULL; +static GSList *g_thread_free_indices = NULL; +static GSList* g_once_init_list = NULL; + +G_LOCK_DEFINE_STATIC (g_thread); + +/* Initialisation {{{1 ---------------------------------------------------- */ + +#ifdef G_THREADS_ENABLED +/** + * g_thread_init: + * @vtable: a function table of type #GThreadFunctions, that provides + * the entry points to the thread system to be used. + * + * If you use GLib from more than one thread, you must initialize the + * thread system by calling g_thread_init(). Most of the time you will + * only have to call g_thread_init (NULL). + * + * Do not call g_thread_init() with a non-%NULL parameter unless + * you really know what you are doing. + * + * g_thread_init() must not be called directly or indirectly as a + * callback from GLib. Also no mutexes may be currently locked while + * calling g_thread_init(). + * + * g_thread_init() changes the way in which #GTimer measures + * elapsed time. As a consequence, timers that are running while + * g_thread_init() is called may report unreliable times. + * + * Calling g_thread_init() multiple times is allowed (since version + * 2.24), but nothing happens except for the first call. If the + * argument is non-%NULL on such a call a warning will be printed, but + * otherwise the argument is ignored. + * + * If no thread system is available and @vtable is %NULL or if not all + * elements of @vtable are non-%NULL, then g_thread_init() will abort. + * + * To use g_thread_init() in your program, you have to link with + * the libraries that the command pkg-config --libs + * gthread-2.0 outputs. This is not the case for all the + * other thread related functions of GLib. Those can be used without + * having to link with the thread libraries. + **/ + +/* This must be called only once, before any threads are created. + * It will only be called from g_thread_init() in -lgthread. + */ +void +g_thread_init_glib (void) +{ + /* We let the main thread (the one that calls g_thread_init) inherit + * the static_private data set before calling g_thread_init + */ + GRealThread* main_thread = (GRealThread*) g_thread_self (); + + /* mutex and cond creation works without g_threads_got_initialized */ + g_once_mutex = g_mutex_new (); + g_once_cond = g_cond_new (); + + /* we may only create mutex and cond in here */ + _g_mem_thread_init_noprivate_nomessage (); + + /* setup the basic threading system */ + g_threads_got_initialized = TRUE; + g_thread_specific_private = g_private_new (g_thread_cleanup); + g_private_set (g_thread_specific_private, main_thread); + G_THREAD_UF (thread_self, (&main_thread->system_thread)); + + /* complete memory system initialization, g_private_*() works now */ + _g_slice_thread_init_nomessage (); + + /* accomplish log system initialization to enable messaging */ + _g_messages_thread_init_nomessage (); + + /* we may run full-fledged initializers from here */ + _g_utils_thread_init (); + _g_futex_thread_init (); +#ifdef G_OS_WIN32 + _g_win32_thread_init (); +#endif +} +#endif /* G_THREADS_ENABLED */ + +/* The following sections implement: GOnce, GStaticMutex, GStaticRecMutex, + * GStaticPrivate, + **/ + +/* GOnce {{{1 ------------------------------------------------------------- */ + +/** + * GOnce: + * @status: the status of the #GOnce + * @retval: the value returned by the call to the function, if @status + * is %G_ONCE_STATUS_READY + * + * A #GOnce struct controls a one-time initialization function. Any + * one-time initialization function must have its own unique #GOnce + * struct. + * + * Since: 2.4 + **/ + +/** + * G_ONCE_INIT: + * + * A #GOnce must be initialized with this macro before it can be used. + * + * + * + * GOnce my_once = G_ONCE_INIT; + * + * + * + * Since: 2.4 + **/ + +/** + * GOnceStatus: + * @G_ONCE_STATUS_NOTCALLED: the function has not been called yet. + * @G_ONCE_STATUS_PROGRESS: the function call is currently in progress. + * @G_ONCE_STATUS_READY: the function has been called. + * + * The possible statuses of a one-time initialization function + * controlled by a #GOnce struct. + * + * Since: 2.4 + **/ + +/** + * g_once: + * @once: a #GOnce structure + * @func: the #GThreadFunc function associated to @once. This function + * is called only once, regardless of the number of times it and + * its associated #GOnce struct are passed to g_once(). + * @arg: data to be passed to @func + * + * The first call to this routine by a process with a given #GOnce + * struct calls @func with the given argument. Thereafter, subsequent + * calls to g_once() with the same #GOnce struct do not call @func + * again, but return the stored result of the first call. On return + * from g_once(), the status of @once will be %G_ONCE_STATUS_READY. + * + * For example, a mutex or a thread-specific data key must be created + * exactly once. In a threaded environment, calling g_once() ensures + * that the initialization is serialized across multiple threads. + * + * Calling g_once() recursively on the same #GOnce struct in + * @func will lead to a deadlock. + * + * + * + * gpointer + * get_debug_flags (void) + * { + * static GOnce my_once = G_ONCE_INIT; + * + * g_once (&my_once, parse_debug_flags, NULL); + * + * return my_once.retval; + * } + * + * + * + * Since: 2.4 + **/ +gpointer +g_once_impl (GOnce *once, + GThreadFunc func, + gpointer arg) +{ + g_mutex_lock (g_once_mutex); + + while (once->status == G_ONCE_STATUS_PROGRESS) + g_cond_wait (g_once_cond, g_once_mutex); + + if (once->status != G_ONCE_STATUS_READY) + { + once->status = G_ONCE_STATUS_PROGRESS; + g_mutex_unlock (g_once_mutex); + + once->retval = func (arg); + + g_mutex_lock (g_once_mutex); + once->status = G_ONCE_STATUS_READY; + g_cond_broadcast (g_once_cond); + } + + g_mutex_unlock (g_once_mutex); + + return once->retval; +} + +/** + * g_once_init_enter: + * @value_location: location of a static initializable variable + * containing 0. + * @Returns: %TRUE if the initialization section should be entered, + * %FALSE and blocks otherwise + * + * Function to be called when starting a critical initialization + * section. The argument @value_location must point to a static + * 0-initialized variable that will be set to a value other than 0 at + * the end of the initialization section. In combination with + * g_once_init_leave() and the unique address @value_location, it can + * be ensured that an initialization section will be executed only once + * during a program's life time, and that concurrent threads are + * blocked until initialization completed. To be used in constructs + * like this: + * + * + * + * static gsize initialization_value = 0; + * + * if (g_once_init_enter (&initialization_value)) + * { + * gsize setup_value = 42; /* initialization code here */ + * + * g_once_init_leave (&initialization_value, setup_value); + * } + * + * /* use initialization_value here */ + * + * + * + * Since: 2.14 + **/ +gboolean +g_once_init_enter_impl (volatile gsize *value_location) +{ + gboolean need_init = FALSE; + g_mutex_lock (g_once_mutex); + if (g_atomic_pointer_get (value_location) == NULL) + { + if (!g_slist_find (g_once_init_list, (void*) value_location)) + { + need_init = TRUE; + g_once_init_list = g_slist_prepend (g_once_init_list, (void*) value_location); + } + else + do + g_cond_wait (g_once_cond, g_once_mutex); + while (g_slist_find (g_once_init_list, (void*) value_location)); + } + g_mutex_unlock (g_once_mutex); + return need_init; +} + +/** + * g_once_init_leave: + * @value_location: location of a static initializable variable + * containing 0. + * @initialization_value: new non-0 value for *@value_location. + * + * Counterpart to g_once_init_enter(). Expects a location of a static + * 0-initialized initialization variable, and an initialization value + * other than 0. Sets the variable to the initialization value, and + * releases concurrent threads blocking in g_once_init_enter() on this + * initialization variable. + * + * Since: 2.14 + **/ +void +g_once_init_leave (volatile gsize *value_location, + gsize initialization_value) +{ + g_return_if_fail (g_atomic_pointer_get (value_location) == NULL); + g_return_if_fail (initialization_value != 0); + g_return_if_fail (g_once_init_list != NULL); + + g_atomic_pointer_set (value_location, initialization_value); + g_mutex_lock (g_once_mutex); + g_once_init_list = g_slist_remove (g_once_init_list, (void*) value_location); + g_cond_broadcast (g_once_cond); + g_mutex_unlock (g_once_mutex); +} + +/* GStaticMutex {{{1 ------------------------------------------------------ */ + +/** + * GStaticMutex: + * + * A #GStaticMutex works like a #GMutex, but it has one significant + * advantage. It doesn't need to be created at run-time like a #GMutex, + * but can be defined at compile-time. Here is a shorter, easier and + * safer version of our give_me_next_number() + * example: + * + * + * + * Using <structname>GStaticMutex</structname> + * to simplify thread-safe programming + * + * + * int + * give_me_next_number (void) + * { + * static int current_number = 0; + * int ret_val; + * static GStaticMutex mutex = G_STATIC_MUTEX_INIT; + * + * g_static_mutex_lock (&mutex); + * ret_val = current_number = calc_next_number (current_number); + * g_static_mutex_unlock (&mutex); + * + * return ret_val; + * } + * + * + * + * Sometimes you would like to dynamically create a mutex. If you don't + * want to require prior calling to g_thread_init(), because your code + * should also be usable in non-threaded programs, you are not able to + * use g_mutex_new() and thus #GMutex, as that requires a prior call to + * g_thread_init(). In theses cases you can also use a #GStaticMutex. + * It must be initialized with g_static_mutex_init() before using it + * and freed with with g_static_mutex_free() when not needed anymore to + * free up any allocated resources. + * + * Even though #GStaticMutex is not opaque, it should only be used with + * the following functions, as it is defined differently on different + * platforms. + * + * All of the g_static_mutex_* functions apart + * from g_static_mutex_get_mutex can also be used + * even if g_thread_init() has not yet been called. Then they do + * nothing, apart from g_static_mutex_trylock, + * which does nothing but returning %TRUE. + * + * All of the g_static_mutex_* + * functions are actually macros. Apart from taking their addresses, you + * can however use them as if they were functions. + **/ + +/** + * G_STATIC_MUTEX_INIT: + * + * A #GStaticMutex must be initialized with this macro, before it can + * be used. This macro can used be to initialize a variable, but it + * cannot be assigned to a variable. In that case you have to use + * g_static_mutex_init(). + * + * + * + * GStaticMutex my_mutex = G_STATIC_MUTEX_INIT; + * + * + **/ + +/** + * g_static_mutex_init: + * @mutex: a #GStaticMutex to be initialized. + * + * Initializes @mutex. Alternatively you can initialize it with + * #G_STATIC_MUTEX_INIT. + **/ +void +g_static_mutex_init (GStaticMutex *mutex) +{ + static const GStaticMutex init_mutex = G_STATIC_MUTEX_INIT; + + g_return_if_fail (mutex); + + *mutex = init_mutex; +} + +/* IMPLEMENTATION NOTE: + * + * On some platforms a GStaticMutex is actually a normal GMutex stored + * inside of a structure instead of being allocated dynamically. We can + * only do this for platforms on which we know, in advance, how to + * allocate (size) and initialise (value) that memory. + * + * On other platforms, a GStaticMutex is nothing more than a pointer to + * a GMutex. In that case, the first access we make to the static mutex + * must first allocate the normal GMutex and store it into the pointer. + * + * configure.ac writes macros into glibconfig.h to determine if + * g_static_mutex_get_mutex() accesses the structure in memory directly + * (on platforms where we are able to do that) or if it ends up here, + * where we may have to allocate the GMutex before returning it. + */ + +/** + * g_static_mutex_get_mutex: + * @mutex: a #GStaticMutex. + * @Returns: the #GMutex corresponding to @mutex. + * + * For some operations (like g_cond_wait()) you must have a #GMutex + * instead of a #GStaticMutex. This function will return the + * corresponding #GMutex for @mutex. + **/ +GMutex * +g_static_mutex_get_mutex_impl (GMutex** mutex) +{ + GMutex *result; + + if (!g_thread_supported ()) + return NULL; + + result = g_atomic_pointer_get (mutex); + + if (!result) + { + g_assert (g_once_mutex); + + g_mutex_lock (g_once_mutex); + + result = *mutex; + if (!result) + { + result = g_mutex_new (); + g_atomic_pointer_set (mutex, result); + } + + g_mutex_unlock (g_once_mutex); + } + + return result; +} + +/* IMPLEMENTATION NOTE: + * + * g_static_mutex_lock(), g_static_mutex_trylock() and + * g_static_mutex_unlock() are all preprocessor macros that wrap the + * corresponding g_mutex_*() function around a call to + * g_static_mutex_get_mutex(). + */ + +/** + * g_static_mutex_lock: + * @mutex: a #GStaticMutex. + * + * Works like g_mutex_lock(), but for a #GStaticMutex. + **/ + +/** + * g_static_mutex_trylock: + * @mutex: a #GStaticMutex. + * @Returns: %TRUE, if the #GStaticMutex could be locked. + * + * Works like g_mutex_trylock(), but for a #GStaticMutex. + **/ + +/** + * g_static_mutex_unlock: + * @mutex: a #GStaticMutex. + * + * Works like g_mutex_unlock(), but for a #GStaticMutex. + **/ + +/** + * g_static_mutex_free: + * @mutex: a #GStaticMutex to be freed. + * + * Releases all resources allocated to @mutex. + * + * You don't have to call this functions for a #GStaticMutex with an + * unbounded lifetime, i.e. objects declared 'static', but if you have + * a #GStaticMutex as a member of a structure and the structure is + * freed, you should also free the #GStaticMutex. + * + * Calling g_static_mutex_free() on a locked mutex may + * result in undefined behaviour. + **/ +void +g_static_mutex_free (GStaticMutex* mutex) +{ + GMutex **runtime_mutex; + + g_return_if_fail (mutex); + + /* The runtime_mutex is the first (or only) member of GStaticMutex, + * see both versions (of glibconfig.h) in configure.ac. Note, that + * this variable is NULL, if g_thread_init() hasn't been called or + * if we're using the default thread implementation and it provides + * static mutexes. */ + runtime_mutex = ((GMutex**)mutex); + + if (*runtime_mutex) + g_mutex_free (*runtime_mutex); + + *runtime_mutex = NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * GStaticRecMutex: + * + * A #GStaticRecMutex works like a #GStaticMutex, but it can be locked + * multiple times by one thread. If you enter it n times, you have to + * unlock it n times again to let other threads lock it. An exception + * is the function g_static_rec_mutex_unlock_full(): that allows you to + * unlock a #GStaticRecMutex completely returning the depth, (i.e. the + * number of times this mutex was locked). The depth can later be used + * to restore the state of the #GStaticRecMutex by calling + * g_static_rec_mutex_lock_full(). + * + * Even though #GStaticRecMutex is not opaque, it should only be used + * with the following functions. + * + * All of the g_static_rec_mutex_* functions can + * be used even if g_thread_init() has not been called. Then they do + * nothing, apart from g_static_rec_mutex_trylock, + * which does nothing but returning %TRUE. + **/ + +/** + * G_STATIC_REC_MUTEX_INIT: + * + * A #GStaticRecMutex must be initialized with this macro before it can + * be used. This macro can used be to initialize a variable, but it + * cannot be assigned to a variable. In that case you have to use + * g_static_rec_mutex_init(). + * + * + * + * GStaticRecMutex my_mutex = G_STATIC_REC_MUTEX_INIT; + * + + **/ + +/** + * g_static_rec_mutex_init: + * @mutex: a #GStaticRecMutex to be initialized. + * + * A #GStaticRecMutex must be initialized with this function before it + * can be used. Alternatively you can initialize it with + * #G_STATIC_REC_MUTEX_INIT. + **/ +void +g_static_rec_mutex_init (GStaticRecMutex *mutex) +{ + static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT; + + g_return_if_fail (mutex); + + *mutex = init_mutex; +} + +/** + * g_static_rec_mutex_lock: + * @mutex: a #GStaticRecMutex to lock. + * + * Locks @mutex. If @mutex is already locked by another thread, the + * current thread will block until @mutex is unlocked by the other + * thread. If @mutex is already locked by the calling thread, this + * functions increases the depth of @mutex and returns immediately. + **/ +void +g_static_rec_mutex_lock (GStaticRecMutex* mutex) +{ + GSystemThread self; + + g_return_if_fail (mutex); + + if (!g_thread_supported ()) + return; + + G_THREAD_UF (thread_self, (&self)); + + if (g_system_thread_equal (self, mutex->owner)) + { + mutex->depth++; + return; + } + g_static_mutex_lock (&mutex->mutex); + g_system_thread_assign (mutex->owner, self); + mutex->depth = 1; +} + +/** + * g_static_rec_mutex_trylock: + * @mutex: a #GStaticRecMutex to lock. + * @Returns: %TRUE, if @mutex could be locked. + * + * Tries to lock @mutex. If @mutex is already locked by another thread, + * it immediately returns %FALSE. Otherwise it locks @mutex and returns + * %TRUE. If @mutex is already locked by the calling thread, this + * functions increases the depth of @mutex and immediately returns + * %TRUE. + **/ +gboolean +g_static_rec_mutex_trylock (GStaticRecMutex* mutex) +{ + GSystemThread self; + + g_return_val_if_fail (mutex, FALSE); + + if (!g_thread_supported ()) + return TRUE; + + G_THREAD_UF (thread_self, (&self)); + + if (g_system_thread_equal (self, mutex->owner)) + { + mutex->depth++; + return TRUE; + } + + if (!g_static_mutex_trylock (&mutex->mutex)) + return FALSE; + + g_system_thread_assign (mutex->owner, self); + mutex->depth = 1; + return TRUE; +} + +/** + * g_static_rec_mutex_unlock: + * @mutex: a #GStaticRecMutex to unlock. + * + * Unlocks @mutex. Another thread will be allowed to lock @mutex only + * when it has been unlocked as many times as it had been locked + * before. If @mutex is completely unlocked and another thread is + * blocked in a g_static_rec_mutex_lock() call for @mutex, it will be + * woken and can lock @mutex itself. + **/ +void +g_static_rec_mutex_unlock (GStaticRecMutex* mutex) +{ + g_return_if_fail (mutex); + + if (!g_thread_supported ()) + return; + + if (mutex->depth > 1) + { + mutex->depth--; + return; + } + g_system_thread_assign (mutex->owner, zero_thread); + g_static_mutex_unlock (&mutex->mutex); +} + +/** + * g_static_rec_mutex_lock_full: + * @mutex: a #GStaticRecMutex to lock. + * @depth: number of times this mutex has to be unlocked to be + * completely unlocked. + * + * Works like calling g_static_rec_mutex_lock() for @mutex @depth times. + **/ +void +g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, + guint depth) +{ + GSystemThread self; + g_return_if_fail (mutex); + + if (!g_thread_supported ()) + return; + + if (depth == 0) + return; + + G_THREAD_UF (thread_self, (&self)); + + if (g_system_thread_equal (self, mutex->owner)) + { + mutex->depth += depth; + return; + } + g_static_mutex_lock (&mutex->mutex); + g_system_thread_assign (mutex->owner, self); + mutex->depth = depth; +} + +/** + * g_static_rec_mutex_unlock_full: + * @mutex: a #GStaticRecMutex to completely unlock. + * @Returns: number of times @mutex has been locked by the current + * thread. + * + * Completely unlocks @mutex. If another thread is blocked in a + * g_static_rec_mutex_lock() call for @mutex, it will be woken and can + * lock @mutex itself. This function returns the number of times that + * @mutex has been locked by the current thread. To restore the state + * before the call to g_static_rec_mutex_unlock_full() you can call + * g_static_rec_mutex_lock_full() with the depth returned by this + * function. + **/ +guint +g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex) +{ + guint depth; + + g_return_val_if_fail (mutex, 0); + + if (!g_thread_supported ()) + return 1; + + depth = mutex->depth; + + g_system_thread_assign (mutex->owner, zero_thread); + mutex->depth = 0; + g_static_mutex_unlock (&mutex->mutex); + + return depth; +} + +/** + * g_static_rec_mutex_free: + * @mutex: a #GStaticRecMutex to be freed. + * + * Releases all resources allocated to a #GStaticRecMutex. + * + * You don't have to call this functions for a #GStaticRecMutex with an + * unbounded lifetime, i.e. objects declared 'static', but if you have + * a #GStaticRecMutex as a member of a structure and the structure is + * freed, you should also free the #GStaticRecMutex. + **/ +void +g_static_rec_mutex_free (GStaticRecMutex *mutex) +{ + g_return_if_fail (mutex); + + g_static_mutex_free (&mutex->mutex); +} + +/* GStaticPrivate {{{1 ---------------------------------------------------- */ + +/** + * GStaticPrivate: + * + * A #GStaticPrivate works almost like a #GPrivate, but it has one + * significant advantage. It doesn't need to be created at run-time + * like a #GPrivate, but can be defined at compile-time. This is + * similar to the difference between #GMutex and #GStaticMutex. Now + * look at our give_me_next_number() example with + * #GStaticPrivate: + * + * + * Using GStaticPrivate for per-thread data + * + * int + * give_me_next_number () + * { + * static GStaticPrivate current_number_key = G_STATIC_PRIVATE_INIT; + * int *current_number = g_static_private_get (&current_number_key); + * + * if (!current_number) + * { + * current_number = g_new (int,1); + * *current_number = 0; + * g_static_private_set (&current_number_key, current_number, g_free); + * } + * + * *current_number = calc_next_number (*current_number); + * + * return *current_number; + * } + * + * + **/ + +/** + * G_STATIC_PRIVATE_INIT: + * + * Every #GStaticPrivate must be initialized with this macro, before it + * can be used. + * + * + * + * GStaticPrivate my_private = G_STATIC_PRIVATE_INIT; + * + * + **/ + +/** + * g_static_private_init: + * @private_key: a #GStaticPrivate to be initialized. + * + * Initializes @private_key. Alternatively you can initialize it with + * #G_STATIC_PRIVATE_INIT. + **/ +void +g_static_private_init (GStaticPrivate *private_key) +{ + private_key->index = 0; +} + +/** + * g_static_private_get: + * @private_key: a #GStaticPrivate. + * @Returns: the corresponding pointer. + * + * Works like g_private_get() only for a #GStaticPrivate. + * + * This function works even if g_thread_init() has not yet been called. + **/ +gpointer +g_static_private_get (GStaticPrivate *private_key) +{ + GRealThread *self = (GRealThread*) g_thread_self (); + GArray *array; + gpointer ret = NULL; + + LOCK_PRIVATE_DATA (self); + + array = self->private_data; + + if (array && private_key->index != 0 && private_key->index <= array->len) + ret = g_array_index (array, GStaticPrivateNode, + private_key->index - 1).data; + + UNLOCK_PRIVATE_DATA (self); + return ret; +} + +/** + * g_static_private_set: + * @private_key: a #GStaticPrivate. + * @data: the new pointer. + * @notify: a function to be called with the pointer whenever the + * current thread ends or sets this pointer again. + * + * Sets the pointer keyed to @private_key for the current thread and + * the function @notify to be called with that pointer (%NULL or + * non-%NULL), whenever the pointer is set again or whenever the + * current thread ends. + * + * This function works even if g_thread_init() has not yet been called. + * If g_thread_init() is called later, the @data keyed to @private_key + * will be inherited only by the main thread, i.e. the one that called + * g_thread_init(). + * + * @notify is used quite differently from @destructor in + * g_private_new(). + **/ +void +g_static_private_set (GStaticPrivate *private_key, + gpointer data, + GDestroyNotify notify) +{ + GRealThread *self = (GRealThread*) g_thread_self (); + GArray *array; + static guint next_index = 0; + GStaticPrivateNode *node; + gpointer ddata = NULL; + GDestroyNotify ddestroy = NULL; + + if (!private_key->index) + { + G_LOCK (g_thread); + + if (!private_key->index) + { + if (g_thread_free_indices) + { + private_key->index = + GPOINTER_TO_UINT (g_thread_free_indices->data); + g_thread_free_indices = + g_slist_delete_link (g_thread_free_indices, + g_thread_free_indices); + } + else + private_key->index = ++next_index; + } + + G_UNLOCK (g_thread); + } + + LOCK_PRIVATE_DATA (self); + + array = self->private_data; + if (!array) + { + array = g_array_new (FALSE, TRUE, sizeof (GStaticPrivateNode)); + self->private_data = array; + } + + if (private_key->index > array->len) + g_array_set_size (array, private_key->index); + + node = &g_array_index (array, GStaticPrivateNode, private_key->index - 1); + + ddata = node->data; + ddestroy = node->destroy; + + node->data = data; + node->destroy = notify; + + UNLOCK_PRIVATE_DATA (self); + + if (ddestroy) + ddestroy (ddata); +} + +/** + * g_static_private_free: + * @private_key: a #GStaticPrivate to be freed. + * + * Releases all resources allocated to @private_key. + * + * You don't have to call this functions for a #GStaticPrivate with an + * unbounded lifetime, i.e. objects declared 'static', but if you have + * a #GStaticPrivate as a member of a structure and the structure is + * freed, you should also free the #GStaticPrivate. + **/ +void +g_static_private_free (GStaticPrivate *private_key) +{ + guint idx = private_key->index; + GRealThread *thread, *next; + GArray *garbage = NULL; + + if (!idx) + return; + + private_key->index = 0; + + G_LOCK (g_thread); + + thread = g_thread_all_threads; + + for (thread = g_thread_all_threads; thread; thread = next) + { + GArray *array; + + next = thread->next; + + LOCK_PRIVATE_DATA (thread); + + array = thread->private_data; + + if (array && idx <= array->len) + { + GStaticPrivateNode *node = &g_array_index (array, + GStaticPrivateNode, + idx - 1); + gpointer ddata = node->data; + GDestroyNotify ddestroy = node->destroy; + + node->data = NULL; + node->destroy = NULL; + + if (ddestroy) + { + /* defer non-trivial destruction til after we've finished + * iterating, since we must continue to hold the lock */ + if (garbage == NULL) + garbage = g_array_new (FALSE, TRUE, + sizeof (GStaticPrivateNode)); + + g_array_set_size (garbage, garbage->len + 1); + + node = &g_array_index (garbage, GStaticPrivateNode, + garbage->len - 1); + node->data = ddata; + node->destroy = ddestroy; + } + } + + UNLOCK_PRIVATE_DATA (thread); + } + g_thread_free_indices = g_slist_prepend (g_thread_free_indices, + GUINT_TO_POINTER (idx)); + G_UNLOCK (g_thread); + + if (garbage) + { + guint i; + + for (i = 0; i < garbage->len; i++) + { + GStaticPrivateNode *node; + + node = &g_array_index (garbage, GStaticPrivateNode, i); + node->destroy (node->data); + } + + g_array_free (garbage, TRUE); + } +} + +/* GThread Extra Functions {{{1 ------------------------------------------- */ +static void +g_thread_cleanup (gpointer data) +{ + if (data) + { + GRealThread* thread = data; + GArray *array; + + LOCK_PRIVATE_DATA (thread); + array = thread->private_data; + thread->private_data = NULL; + UNLOCK_PRIVATE_DATA (thread); + + if (array) + { + guint i; + + for (i = 0; i < array->len; i++ ) + { + GStaticPrivateNode *node = + &g_array_index (array, GStaticPrivateNode, i); + if (node->destroy) + node->destroy (node->data); + } + g_array_free (array, TRUE); + } + + /* We only free the thread structure, if it isn't joinable. If + it is, the structure is freed in g_thread_join */ + if (!thread->thread.joinable) + { + GRealThread *t, *p; + + G_LOCK (g_thread); + for (t = g_thread_all_threads, p = NULL; t; p = t, t = t->next) + { + if (t == thread) + { + if (p) + p->next = t->next; + else + g_thread_all_threads = t->next; + break; + } + } + G_UNLOCK (g_thread); + + /* Just to make sure, this isn't used any more */ + g_system_thread_assign (thread->system_thread, zero_thread); + g_free (thread); + } + } +} + +static void +g_thread_fail (void) +{ + g_error ("The thread system is not yet initialized."); +} + +#define G_NSEC_PER_SEC 1000000000 +#define G_USEC_PER_SEC 1000000 + +static guint64 +gettime (void) +{ +#ifdef G_OS_WIN32 + guint64 v; + + /* Returns 100s of nanoseconds since start of 1601 */ + GetSystemTimeAsFileTime ((FILETIME *)&v); + + /* Offset to Unix epoch */ + v -= G_GINT64_CONSTANT (116444736000000000); + /* Convert to nanoseconds */ + v *= 100; + + return v; +#else + struct timeval tv; + + gettimeofday (&tv, NULL); + + return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC); +#endif +} + +static gpointer +g_thread_create_proxy (gpointer data) +{ + GRealThread* thread = data; + + g_assert (data); + + /* This has to happen before G_LOCK, as that might call g_thread_self */ + g_private_set (g_thread_specific_private, data); + + /* the lock makes sure, that thread->system_thread is written, + before thread->thread.func is called. See g_thread_create. */ + G_LOCK (g_thread); + G_UNLOCK (g_thread); + + thread->retval = thread->thread.func (thread->thread.data); + + return NULL; +} + +/** + * g_thread_create_full: + * @func: a function to execute in the new thread. + * @data: an argument to supply to the new thread. + * @stack_size: a stack size for the new thread. + * @joinable: should this thread be joinable? + * @bound: should this thread be bound to a system thread? + * @priority: a priority for the thread. + * @error: return location for error. + * @Returns: the new #GThread on success. + * + * This function creates a new thread with the priority @priority. If + * the underlying thread implementation supports it, the thread gets a + * stack size of @stack_size or the default value for the current + * platform, if @stack_size is 0. + * + * If @joinable is %TRUE, you can wait for this threads termination + * calling g_thread_join(). Otherwise the thread will just disappear + * when it terminates. If @bound is %TRUE, this thread will be + * scheduled in the system scope, otherwise the implementation is free + * to do scheduling in the process scope. The first variant is more + * expensive resource-wise, but generally faster. On some systems (e.g. + * Linux) all threads are bound. + * + * The new thread executes the function @func with the argument @data. + * If the thread was created successfully, it is returned. + * + * @error can be %NULL to ignore errors, or non-%NULL to report errors. + * The error is set, if and only if the function returns %NULL. + * + * It is not guaranteed that threads with different priorities + * really behave accordingly. On some systems (e.g. Linux) there are no + * thread priorities. On other systems (e.g. Solaris) there doesn't + * seem to be different scheduling for different priorities. All in all + * try to avoid being dependent on priorities. Use + * %G_THREAD_PRIORITY_NORMAL here as a default. + * + * Only use g_thread_create_full() if you really can't use + * g_thread_create() instead. g_thread_create() does not take + * @stack_size, @bound, and @priority as arguments, as they should only + * be used in cases in which it is unavoidable. + **/ +GThread* +g_thread_create_full (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + GError **error) +{ + GRealThread* result; + GError *local_error = NULL; + g_return_val_if_fail (func, NULL); + g_return_val_if_fail (priority >= G_THREAD_PRIORITY_LOW, NULL); + g_return_val_if_fail (priority <= G_THREAD_PRIORITY_URGENT, NULL); + + result = g_new0 (GRealThread, 1); + + result->thread.joinable = joinable; + result->thread.priority = priority; + result->thread.func = func; + result->thread.data = data; + result->private_data = NULL; + G_LOCK (g_thread); + G_THREAD_UF (thread_create, (g_thread_create_proxy, result, + stack_size, joinable, bound, priority, + &result->system_thread, &local_error)); + if (!local_error) + { + result->next = g_thread_all_threads; + g_thread_all_threads = result; + } + G_UNLOCK (g_thread); + + if (local_error) + { + g_propagate_error (error, local_error); + g_free (result); + return NULL; + } + + return (GThread*) result; +} + +/** + * g_thread_exit: + * @retval: the return value of this thread. + * + * Exits the current thread. If another thread is waiting for that + * thread using g_thread_join() and the current thread is joinable, the + * waiting thread will be woken up and get @retval as the return value + * of g_thread_join(). If the current thread is not joinable, @retval + * is ignored. Calling + * + * + * + * g_thread_exit (retval); + * + * + * + * is equivalent to returning @retval from the function @func, as given + * to g_thread_create(). + * + * Never call g_thread_exit() from within a thread of a + * #GThreadPool, as that will mess up the bookkeeping and lead to funny + * and unwanted results. + **/ +void +g_thread_exit (gpointer retval) +{ + GRealThread* real = (GRealThread*) g_thread_self (); + real->retval = retval; + G_THREAD_CF (thread_exit, (void)0, ()); +} + +/** + * g_thread_join: + * @thread: a #GThread to be waited for. + * @Returns: the return value of the thread. + * + * Waits until @thread finishes, i.e. the function @func, as given to + * g_thread_create(), returns or g_thread_exit() is called by @thread. + * All resources of @thread including the #GThread struct are released. + * @thread must have been created with @joinable=%TRUE in + * g_thread_create(). The value returned by @func or given to + * g_thread_exit() by @thread is returned by this function. + **/ +gpointer +g_thread_join (GThread* thread) +{ + GRealThread* real = (GRealThread*) thread; + GRealThread *p, *t; + gpointer retval; + + g_return_val_if_fail (thread, NULL); + g_return_val_if_fail (thread->joinable, NULL); + g_return_val_if_fail (!g_system_thread_equal (real->system_thread, + zero_thread), NULL); + + G_THREAD_UF (thread_join, (&real->system_thread)); + + retval = real->retval; + + G_LOCK (g_thread); + for (t = g_thread_all_threads, p = NULL; t; p = t, t = t->next) + { + if (t == (GRealThread*) thread) + { + if (p) + p->next = t->next; + else + g_thread_all_threads = t->next; + break; + } + } + G_UNLOCK (g_thread); + + /* Just to make sure, this isn't used any more */ + thread->joinable = 0; + g_system_thread_assign (real->system_thread, zero_thread); + + /* the thread structure for non-joinable threads is freed upon + thread end. We free the memory here. This will leave a loose end, + if a joinable thread is not joined. */ + + g_free (thread); + + return retval; +} + +/** + * g_thread_set_priority: + * @thread: a #GThread. + * @priority: a new priority for @thread. + * + * Changes the priority of @thread to @priority. + * + * It is not guaranteed that threads with different + * priorities really behave accordingly. On some systems (e.g. Linux) + * there are no thread priorities. On other systems (e.g. Solaris) there + * doesn't seem to be different scheduling for different priorities. All + * in all try to avoid being dependent on priorities. + **/ +void +g_thread_set_priority (GThread* thread, + GThreadPriority priority) +{ + GRealThread* real = (GRealThread*) thread; + + g_return_if_fail (thread); + g_return_if_fail (!g_system_thread_equal (real->system_thread, zero_thread)); + g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW); + g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT); + + thread->priority = priority; + + G_THREAD_CF (thread_set_priority, (void)0, + (&real->system_thread, priority)); +} + +/** + * g_thread_self: + * @Returns: the current thread. + * + * This functions returns the #GThread corresponding to the calling + * thread. + **/ +GThread* +g_thread_self (void) +{ + GRealThread* thread = g_private_get (g_thread_specific_private); + + if (!thread) + { + /* If no thread data is available, provide and set one. This + can happen for the main thread and for threads, that are not + created by GLib. */ + thread = g_new0 (GRealThread, 1); + thread->thread.joinable = FALSE; /* This is a save guess */ + thread->thread.priority = G_THREAD_PRIORITY_NORMAL; /* This is + just a guess */ + thread->thread.func = NULL; + thread->thread.data = NULL; + thread->private_data = NULL; + + if (g_thread_supported ()) + G_THREAD_UF (thread_self, (&thread->system_thread)); + + g_private_set (g_thread_specific_private, thread); + + G_LOCK (g_thread); + thread->next = g_thread_all_threads; + g_thread_all_threads = thread; + G_UNLOCK (g_thread); + } + + return (GThread*)thread; +} + +/* GStaticRWLock {{{1 ----------------------------------------------------- */ + +/** + * GStaticRWLock: + * + * The #GStaticRWLock struct represents a read-write lock. A read-write + * lock can be used for protecting data that some portions of code only + * read from, while others also write. In such situations it is + * desirable that several readers can read at once, whereas of course + * only one writer may write at a time. Take a look at the following + * example: + * + * + * An array with access functions + * + * GStaticRWLock rwlock = G_STATIC_RW_LOCK_INIT; + * GPtrArray *array; + * + * gpointer + * my_array_get (guint index) + * { + * gpointer retval = NULL; + * + * if (!array) + * return NULL; + * + * g_static_rw_lock_reader_lock (&rwlock); + * if (index < array->len) + * retval = g_ptr_array_index (array, index); + * g_static_rw_lock_reader_unlock (&rwlock); + * + * return retval; + * } + * + * void + * my_array_set (guint index, gpointer data) + * { + * g_static_rw_lock_writer_lock (&rwlock); + * + * if (!array) + * array = g_ptr_array_new (); + * + * if (index >= array->len) + * g_ptr_array_set_size (array, index+1); + * g_ptr_array_index (array, index) = data; + * + * g_static_rw_lock_writer_unlock (&rwlock); + * } + * + * + * + * This example shows an array which can be accessed by many readers + * (the my_array_get() function) simultaneously, + * whereas the writers (the my_array_set() + * function) will only be allowed once at a time and only if no readers + * currently access the array. This is because of the potentially + * dangerous resizing of the array. Using these functions is fully + * multi-thread safe now. + * + * Most of the time, writers should have precedence over readers. That + * means, for this implementation, that as soon as a writer wants to + * lock the data, no other reader is allowed to lock the data, whereas, + * of course, the readers that already have locked the data are allowed + * to finish their operation. As soon as the last reader unlocks the + * data, the writer will lock it. + * + * Even though #GStaticRWLock is not opaque, it should only be used + * with the following functions. + * + * All of the g_static_rw_lock_* functions can be + * used even if g_thread_init() has not been called. Then they do + * nothing, apart from g_static_rw_lock_*_trylock, + * which does nothing but returning %TRUE. + * + * A read-write lock has a higher overhead than a mutex. For + * example, both g_static_rw_lock_reader_lock() and + * g_static_rw_lock_reader_unlock() have to lock and unlock a + * #GStaticMutex, so it takes at least twice the time to lock and unlock + * a #GStaticRWLock that it does to lock and unlock a #GStaticMutex. So + * only data structures that are accessed by multiple readers, and which + * keep the lock for a considerable time justify a #GStaticRWLock. The + * above example most probably would fare better with a + * #GStaticMutex. + **/ + +/** + * G_STATIC_RW_LOCK_INIT: + * + * A #GStaticRWLock must be initialized with this macro before it can + * be used. This macro can used be to initialize a variable, but it + * cannot be assigned to a variable. In that case you have to use + * g_static_rw_lock_init(). + * + * + * + * GStaticRWLock my_lock = G_STATIC_RW_LOCK_INIT; + * + * + **/ + +/** + * g_static_rw_lock_init: + * @lock: a #GStaticRWLock to be initialized. + * + * A #GStaticRWLock must be initialized with this function before it + * can be used. Alternatively you can initialize it with + * #G_STATIC_RW_LOCK_INIT. + **/ +void +g_static_rw_lock_init (GStaticRWLock* lock) +{ + static const GStaticRWLock init_lock = G_STATIC_RW_LOCK_INIT; + + g_return_if_fail (lock); + + *lock = init_lock; +} + +inline static void +g_static_rw_lock_wait (GCond** cond, GStaticMutex* mutex) +{ + if (!*cond) + *cond = g_cond_new (); + g_cond_wait (*cond, g_static_mutex_get_mutex (mutex)); +} + +inline static void +g_static_rw_lock_signal (GStaticRWLock* lock) +{ + if (lock->want_to_write && lock->write_cond) + g_cond_signal (lock->write_cond); + else if (lock->want_to_read && lock->read_cond) + g_cond_broadcast (lock->read_cond); +} + +/** + * g_static_rw_lock_reader_lock: + * @lock: a #GStaticRWLock to lock for reading. + * + * Locks @lock for reading. There may be unlimited concurrent locks for + * reading of a #GStaticRWLock at the same time. If @lock is already + * locked for writing by another thread or if another thread is already + * waiting to lock @lock for writing, this function will block until + * @lock is unlocked by the other writing thread and no other writing + * threads want to lock @lock. This lock has to be unlocked by + * g_static_rw_lock_reader_unlock(). + * + * #GStaticRWLock is not recursive. It might seem to be possible to + * recursively lock for reading, but that can result in a deadlock, due + * to writer preference. + **/ +void +g_static_rw_lock_reader_lock (GStaticRWLock* lock) +{ + g_return_if_fail (lock); + + if (!g_threads_got_initialized) + return; + + g_static_mutex_lock (&lock->mutex); + lock->want_to_read++; + while (lock->have_writer || lock->want_to_write) + g_static_rw_lock_wait (&lock->read_cond, &lock->mutex); + lock->want_to_read--; + lock->read_counter++; + g_static_mutex_unlock (&lock->mutex); +} + +/** + * g_static_rw_lock_reader_trylock: + * @lock: a #GStaticRWLock to lock for reading. + * @Returns: %TRUE, if @lock could be locked for reading. + * + * Tries to lock @lock for reading. If @lock is already locked for + * writing by another thread or if another thread is already waiting to + * lock @lock for writing, immediately returns %FALSE. Otherwise locks + * @lock for reading and returns %TRUE. This lock has to be unlocked by + * g_static_rw_lock_reader_unlock(). + **/ +gboolean +g_static_rw_lock_reader_trylock (GStaticRWLock* lock) +{ + gboolean ret_val = FALSE; + + g_return_val_if_fail (lock, FALSE); + + if (!g_threads_got_initialized) + return TRUE; + + g_static_mutex_lock (&lock->mutex); + if (!lock->have_writer && !lock->want_to_write) + { + lock->read_counter++; + ret_val = TRUE; + } + g_static_mutex_unlock (&lock->mutex); + return ret_val; +} + +/** + * g_static_rw_lock_reader_unlock: + * @lock: a #GStaticRWLock to unlock after reading. + * + * Unlocks @lock. If a thread waits to lock @lock for writing and all + * locks for reading have been unlocked, the waiting thread is woken up + * and can lock @lock for writing. + **/ +void +g_static_rw_lock_reader_unlock (GStaticRWLock* lock) +{ + g_return_if_fail (lock); + + if (!g_threads_got_initialized) + return; + + g_static_mutex_lock (&lock->mutex); + lock->read_counter--; + if (lock->read_counter == 0) + g_static_rw_lock_signal (lock); + g_static_mutex_unlock (&lock->mutex); +} + +/** + * g_static_rw_lock_writer_lock: + * @lock: a #GStaticRWLock to lock for writing. + * + * Locks @lock for writing. If @lock is already locked for writing or + * reading by other threads, this function will block until @lock is + * completely unlocked and then lock @lock for writing. While this + * functions waits to lock @lock, no other thread can lock @lock for + * reading. When @lock is locked for writing, no other thread can lock + * @lock (neither for reading nor writing). This lock has to be + * unlocked by g_static_rw_lock_writer_unlock(). + **/ +void +g_static_rw_lock_writer_lock (GStaticRWLock* lock) +{ + g_return_if_fail (lock); + + if (!g_threads_got_initialized) + return; + + g_static_mutex_lock (&lock->mutex); + lock->want_to_write++; + while (lock->have_writer || lock->read_counter) + g_static_rw_lock_wait (&lock->write_cond, &lock->mutex); + lock->want_to_write--; + lock->have_writer = TRUE; + g_static_mutex_unlock (&lock->mutex); +} + +/** + * g_static_rw_lock_writer_trylock: + * @lock: a #GStaticRWLock to lock for writing. + * @Returns: %TRUE, if @lock could be locked for writing. + * + * Tries to lock @lock for writing. If @lock is already locked (for + * either reading or writing) by another thread, it immediately returns + * %FALSE. Otherwise it locks @lock for writing and returns %TRUE. This + * lock has to be unlocked by g_static_rw_lock_writer_unlock(). + **/ +gboolean +g_static_rw_lock_writer_trylock (GStaticRWLock* lock) +{ + gboolean ret_val = FALSE; + + g_return_val_if_fail (lock, FALSE); + + if (!g_threads_got_initialized) + return TRUE; + + g_static_mutex_lock (&lock->mutex); + if (!lock->have_writer && !lock->read_counter) + { + lock->have_writer = TRUE; + ret_val = TRUE; + } + g_static_mutex_unlock (&lock->mutex); + return ret_val; +} + +/** + * g_static_rw_lock_writer_unlock: + * @lock: a #GStaticRWLock to unlock after writing. + * + * Unlocks @lock. If a thread is waiting to lock @lock for writing and + * all locks for reading have been unlocked, the waiting thread is + * woken up and can lock @lock for writing. If no thread is waiting to + * lock @lock for writing, and some thread or threads are waiting to + * lock @lock for reading, the waiting threads are woken up and can + * lock @lock for reading. + **/ +void +g_static_rw_lock_writer_unlock (GStaticRWLock* lock) +{ + g_return_if_fail (lock); + + if (!g_threads_got_initialized) + return; + + g_static_mutex_lock (&lock->mutex); + lock->have_writer = FALSE; + g_static_rw_lock_signal (lock); + g_static_mutex_unlock (&lock->mutex); +} + +/** + * g_static_rw_lock_free: + * @lock: a #GStaticRWLock to be freed. + * + * Releases all resources allocated to @lock. + * + * You don't have to call this functions for a #GStaticRWLock with an + * unbounded lifetime, i.e. objects declared 'static', but if you have + * a #GStaticRWLock as a member of a structure, and the structure is + * freed, you should also free the #GStaticRWLock. + **/ +void +g_static_rw_lock_free (GStaticRWLock* lock) +{ + g_return_if_fail (lock); + + if (lock->read_cond) + { + g_cond_free (lock->read_cond); + lock->read_cond = NULL; + } + if (lock->write_cond) + { + g_cond_free (lock->write_cond); + lock->write_cond = NULL; + } + g_static_mutex_free (&lock->mutex); +} + +/* Unsorted {{{1 ---------------------------------------------------------- */ + +/** + * g_thread_foreach + * @thread_func: function to call for all GThread structures + * @user_data: second argument to @thread_func + * + * Call @thread_func on all existing #GThread structures. Note that + * threads may decide to exit while @thread_func is running, so + * without intimate knowledge about the lifetime of foreign threads, + * @thread_func shouldn't access the GThread* pointer passed in as + * first argument. However, @thread_func will not be called for threads + * which are known to have exited already. + * + * Due to thread lifetime checks, this function has an execution complexity + * which is quadratic in the number of existing threads. + * + * Since: 2.10 + */ +void +g_thread_foreach (GFunc thread_func, + gpointer user_data) +{ + GSList *slist = NULL; + GRealThread *thread; + g_return_if_fail (thread_func != NULL); + /* snapshot the list of threads for iteration */ + G_LOCK (g_thread); + for (thread = g_thread_all_threads; thread; thread = thread->next) + slist = g_slist_prepend (slist, thread); + G_UNLOCK (g_thread); + /* walk the list, skipping non-existent threads */ + while (slist) + { + GSList *node = slist; + slist = node->next; + /* check whether the current thread still exists */ + G_LOCK (g_thread); + for (thread = g_thread_all_threads; thread; thread = thread->next) + if (thread == node->data) + break; + G_UNLOCK (g_thread); + if (thread) + thread_func (thread, user_data); + g_slist_free_1 (node); + } +} + +/** + * g_thread_get_initialized + * + * Indicates if g_thread_init() has been called. + * + * Returns: %TRUE if threads have been initialized. + * + * Since: 2.20 + */ +gboolean +g_thread_get_initialized () +{ + return g_thread_supported (); +} diff --git a/deps/glib/gthread.h b/deps/glib/gthread.h new file mode 100644 index 0000000..9f5b34b --- /dev/null +++ b/deps/glib/gthread.h @@ -0,0 +1,407 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_THREAD_H__ +#define __G_THREAD_H__ + +#include +#include /* for G_INLINE_FUNC */ +#include /* for g_atomic_pointer_get */ + +G_BEGIN_DECLS + +/* GLib Thread support + */ + +extern GQuark g_thread_error_quark (void); +#define G_THREAD_ERROR g_thread_error_quark () + +typedef enum +{ + G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */ +} GThreadError; + +typedef gpointer (*GThreadFunc) (gpointer data); + +typedef enum +{ + G_THREAD_PRIORITY_LOW, + G_THREAD_PRIORITY_NORMAL, + G_THREAD_PRIORITY_HIGH, + G_THREAD_PRIORITY_URGENT +} GThreadPriority; + +typedef struct _GThread GThread; +struct _GThread +{ + /*< private >*/ + GThreadFunc func; + gpointer data; + gboolean joinable; + GThreadPriority priority; +}; + +typedef struct _GMutex GMutex; +typedef struct _GCond GCond; +typedef struct _GPrivate GPrivate; +typedef struct _GStaticPrivate GStaticPrivate; + +typedef struct _GThreadFunctions GThreadFunctions; +struct _GThreadFunctions +{ + GMutex* (*mutex_new) (void); + void (*mutex_lock) (GMutex *mutex); + gboolean (*mutex_trylock) (GMutex *mutex); + void (*mutex_unlock) (GMutex *mutex); + void (*mutex_free) (GMutex *mutex); + GCond* (*cond_new) (void); + void (*cond_signal) (GCond *cond); + void (*cond_broadcast) (GCond *cond); + void (*cond_wait) (GCond *cond, + GMutex *mutex); + gboolean (*cond_timed_wait) (GCond *cond, + GMutex *mutex, + GTimeVal *end_time); + void (*cond_free) (GCond *cond); + GPrivate* (*private_new) (GDestroyNotify destructor); + gpointer (*private_get) (GPrivate *private_key); + void (*private_set) (GPrivate *private_key, + gpointer data); + void (*thread_create) (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + gpointer thread, + GError **error); + void (*thread_yield) (void); + void (*thread_join) (gpointer thread); + void (*thread_exit) (void); + void (*thread_set_priority)(gpointer thread, + GThreadPriority priority); + void (*thread_self) (gpointer thread); + gboolean (*thread_equal) (gpointer thread1, + gpointer thread2); +}; + +GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; +GLIB_VAR gboolean g_thread_use_default_impl; +GLIB_VAR gboolean g_threads_got_initialized; + +GLIB_VAR guint64 (*g_thread_gettime) (void); + +/* initializes the mutex/cond/private implementation for glib, might + * only be called once, and must not be called directly or indirectly + * from another glib-function, e.g. as a callback. + */ +void g_thread_init (GThreadFunctions *vtable); + +/* Errorcheck mutexes. If you define G_ERRORCHECK_MUTEXES, then all + * mutexes will check for re-locking and re-unlocking */ + +/* Initialize thread system with errorcheck mutexes. vtable must be + * NULL. Do not call directly. Use #define G_ERRORCHECK_MUTEXES + * instead. + */ +void g_thread_init_with_errorcheck_mutexes (GThreadFunctions* vtable); + +/* Checks if thread support is initialized. Identical to the + * g_thread_supported macro but provided for language bindings. + */ +gboolean g_thread_get_initialized (void); + +/* A random number to recognize debug calls to g_mutex_... */ +#define G_MUTEX_DEBUG_MAGIC 0xf8e18ad7 + +#ifdef G_ERRORCHECK_MUTEXES +#define g_thread_init(vtable) g_thread_init_with_errorcheck_mutexes (vtable) +#endif + +/* internal function for fallback static mutex implementation */ +GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex); + +#define g_static_mutex_get_mutex_impl_shortcut(mutex) \ + (g_atomic_pointer_get (mutex) ? *(mutex) : \ + g_static_mutex_get_mutex_impl (mutex)) + +/* shorthands for conditional and unconditional function calls */ + +#define G_THREAD_UF(op, arglist) \ + (*g_thread_functions_for_glib_use . op) arglist +#define G_THREAD_CF(op, fail, arg) \ + (g_thread_supported () ? G_THREAD_UF (op, arg) : (fail)) +#define G_THREAD_ECF(op, fail, mutex, type) \ + (g_thread_supported () ? \ + ((type(*)(GMutex*, const gulong, gchar const*)) \ + (*g_thread_functions_for_glib_use . op)) \ + (mutex, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : (fail)) + +#ifndef G_ERRORCHECK_MUTEXES +# define g_mutex_lock(mutex) \ + G_THREAD_CF (mutex_lock, (void)0, (mutex)) +# define g_mutex_trylock(mutex) \ + G_THREAD_CF (mutex_trylock, TRUE, (mutex)) +# define g_mutex_unlock(mutex) \ + G_THREAD_CF (mutex_unlock, (void)0, (mutex)) +# define g_mutex_free(mutex) \ + G_THREAD_CF (mutex_free, (void)0, (mutex)) +# define g_cond_wait(cond, mutex) \ + G_THREAD_CF (cond_wait, (void)0, (cond, mutex)) +# define g_cond_timed_wait(cond, mutex, abs_time) \ + G_THREAD_CF (cond_timed_wait, TRUE, (cond, mutex, abs_time)) +#else /* G_ERRORCHECK_MUTEXES */ +# define g_mutex_lock(mutex) \ + G_THREAD_ECF (mutex_lock, (void)0, (mutex), void) +# define g_mutex_trylock(mutex) \ + G_THREAD_ECF (mutex_trylock, TRUE, (mutex), gboolean) +# define g_mutex_unlock(mutex) \ + G_THREAD_ECF (mutex_unlock, (void)0, (mutex), void) +# define g_mutex_free(mutex) \ + G_THREAD_ECF (mutex_free, (void)0, (mutex), void) +# define g_cond_wait(cond, mutex) \ + (g_thread_supported () ? ((void(*)(GCond*, GMutex*, gulong, gchar*))\ + g_thread_functions_for_glib_use.cond_wait) \ + (cond, mutex, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : (void) 0) +# define g_cond_timed_wait(cond, mutex, abs_time) \ + (g_thread_supported () ? \ + ((gboolean(*)(GCond*, GMutex*, GTimeVal*, gulong, gchar*)) \ + g_thread_functions_for_glib_use.cond_timed_wait) \ + (cond, mutex, abs_time, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : TRUE) +#endif /* G_ERRORCHECK_MUTEXES */ + +#if defined(G_THREADS_ENABLED) && defined(G_THREADS_MANDATORY) +#define g_thread_supported() 1 +#else +#define g_thread_supported() (g_threads_got_initialized) +#endif +#define g_mutex_new() G_THREAD_UF (mutex_new, ()) +#define g_cond_new() G_THREAD_UF (cond_new, ()) +#define g_cond_signal(cond) G_THREAD_CF (cond_signal, (void)0, (cond)) +#define g_cond_broadcast(cond) G_THREAD_CF (cond_broadcast, (void)0, (cond)) +#define g_cond_free(cond) G_THREAD_CF (cond_free, (void)0, (cond)) +#define g_private_new(destructor) G_THREAD_UF (private_new, (destructor)) +#define g_private_get(private_key) G_THREAD_CF (private_get, \ + ((gpointer)private_key), \ + (private_key)) +#define g_private_set(private_key, value) G_THREAD_CF (private_set, \ + (void) (private_key = \ + (GPrivate*) (value)), \ + (private_key, value)) +#define g_thread_yield() G_THREAD_CF (thread_yield, (void)0, ()) + +#define g_thread_create(func, data, joinable, error) \ + (g_thread_create_full (func, data, 0, joinable, FALSE, \ + G_THREAD_PRIORITY_NORMAL, error)) + +GThread* g_thread_create_full (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + GError **error); +GThread* g_thread_self (void); +void g_thread_exit (gpointer retval); +gpointer g_thread_join (GThread *thread); + +void g_thread_set_priority (GThread *thread, + GThreadPriority priority); + +/* GStaticMutexes can be statically initialized with the value + * G_STATIC_MUTEX_INIT, and then they can directly be used, that is + * much easier, than having to explicitly allocate the mutex before + * use + */ +#define g_static_mutex_lock(mutex) \ + g_mutex_lock (g_static_mutex_get_mutex (mutex)) +#define g_static_mutex_trylock(mutex) \ + g_mutex_trylock (g_static_mutex_get_mutex (mutex)) +#define g_static_mutex_unlock(mutex) \ + g_mutex_unlock (g_static_mutex_get_mutex (mutex)) +void g_static_mutex_init (GStaticMutex *mutex); +void g_static_mutex_free (GStaticMutex *mutex); + +struct _GStaticPrivate +{ + /*< private >*/ + guint index; +}; +#define G_STATIC_PRIVATE_INIT { 0 } +void g_static_private_init (GStaticPrivate *private_key); +gpointer g_static_private_get (GStaticPrivate *private_key); +void g_static_private_set (GStaticPrivate *private_key, + gpointer data, + GDestroyNotify notify); +void g_static_private_free (GStaticPrivate *private_key); + +typedef struct _GStaticRecMutex GStaticRecMutex; +struct _GStaticRecMutex +{ + /*< private >*/ + GStaticMutex mutex; + guint depth; + GSystemThread owner; +}; + +#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, {{0, 0, 0, 0}} } +void g_static_rec_mutex_init (GStaticRecMutex *mutex); +void g_static_rec_mutex_lock (GStaticRecMutex *mutex); +gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex); +void g_static_rec_mutex_unlock (GStaticRecMutex *mutex); +void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex, + guint depth); +guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex); +void g_static_rec_mutex_free (GStaticRecMutex *mutex); + +typedef struct _GStaticRWLock GStaticRWLock; +struct _GStaticRWLock +{ + /*< private >*/ + GStaticMutex mutex; + GCond *read_cond; + GCond *write_cond; + guint read_counter; + gboolean have_writer; + guint want_to_read; + guint want_to_write; +}; + +#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } + +void g_static_rw_lock_init (GStaticRWLock* lock); +void g_static_rw_lock_reader_lock (GStaticRWLock* lock); +gboolean g_static_rw_lock_reader_trylock (GStaticRWLock* lock); +void g_static_rw_lock_reader_unlock (GStaticRWLock* lock); +void g_static_rw_lock_writer_lock (GStaticRWLock* lock); +gboolean g_static_rw_lock_writer_trylock (GStaticRWLock* lock); +void g_static_rw_lock_writer_unlock (GStaticRWLock* lock); +void g_static_rw_lock_free (GStaticRWLock* lock); + +void g_thread_foreach (GFunc thread_func, + gpointer user_data); + +typedef enum +{ + G_ONCE_STATUS_NOTCALLED, + G_ONCE_STATUS_PROGRESS, + G_ONCE_STATUS_READY +} GOnceStatus; + +typedef struct _GOnce GOnce; +struct _GOnce +{ + volatile GOnceStatus status; + volatile gpointer retval; +}; + +#define G_ONCE_INIT { G_ONCE_STATUS_NOTCALLED, NULL } + +gpointer g_once_impl (GOnce *once, GThreadFunc func, gpointer arg); + +#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED +# define g_once(once, func, arg) g_once_impl ((once), (func), (arg)) +#else /* !G_ATOMIC_OP_MEMORY_BARRIER_NEEDED*/ +# define g_once(once, func, arg) \ + (((once)->status == G_ONCE_STATUS_READY) ? \ + (once)->retval : \ + g_once_impl ((once), (func), (arg))) +#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */ + +/* initialize-once guards, keyed by value_location */ +G_INLINE_FUNC gboolean g_once_init_enter (volatile gsize *value_location); +gboolean g_once_init_enter_impl (volatile gsize *value_location); +void g_once_init_leave (volatile gsize *value_location, + gsize initialization_value); +#if defined (G_CAN_INLINE) || defined (__G_THREAD_C__) +G_INLINE_FUNC gboolean +g_once_init_enter (volatile gsize *value_location) +{ + if G_LIKELY ((gpointer) g_atomic_pointer_get (value_location) != NULL) + return FALSE; + else + return g_once_init_enter_impl (value_location); +} +#endif /* G_CAN_INLINE || __G_THREAD_C__ */ + +/* these are some convenience macros that expand to nothing if GLib + * was configured with --disable-threads. for using StaticMutexes, + * you define them with G_LOCK_DEFINE_STATIC (name) or G_LOCK_DEFINE (name) + * if you need to export the mutex. With G_LOCK_EXTERN (name) you can + * declare such an globally defined lock. name is a unique identifier + * for the protected varibale or code portion. locking, testing and + * unlocking of such mutexes can be done with G_LOCK(), G_UNLOCK() and + * G_TRYLOCK() respectively. + */ +extern void glib_dummy_decl (void); +#define G_LOCK_NAME(name) g__ ## name ## _lock +#ifdef G_THREADS_ENABLED +# define G_LOCK_DEFINE_STATIC(name) static G_LOCK_DEFINE (name) +# define G_LOCK_DEFINE(name) \ + GStaticMutex G_LOCK_NAME (name) = G_STATIC_MUTEX_INIT +# define G_LOCK_EXTERN(name) extern GStaticMutex G_LOCK_NAME (name) + +# ifdef G_DEBUG_LOCKS +# define G_LOCK(name) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): locking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name); \ + g_static_mutex_lock (&G_LOCK_NAME (name)); \ + }G_STMT_END +# define G_UNLOCK(name) G_STMT_START{ \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): unlocking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name); \ + g_static_mutex_unlock (&G_LOCK_NAME (name)); \ + }G_STMT_END +# define G_TRYLOCK(name) \ + (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s): try locking: %s ", \ + __FILE__, __LINE__, G_STRFUNC, \ + #name), g_static_mutex_trylock (&G_LOCK_NAME (name))) +# else /* !G_DEBUG_LOCKS */ +# define G_LOCK(name) g_static_mutex_lock (&G_LOCK_NAME (name)) +# define G_UNLOCK(name) g_static_mutex_unlock (&G_LOCK_NAME (name)) +# define G_TRYLOCK(name) g_static_mutex_trylock (&G_LOCK_NAME (name)) +# endif /* !G_DEBUG_LOCKS */ +#else /* !G_THREADS_ENABLED */ +# define G_LOCK_DEFINE_STATIC(name) extern void glib_dummy_decl (void) +# define G_LOCK_DEFINE(name) extern void glib_dummy_decl (void) +# define G_LOCK_EXTERN(name) extern void glib_dummy_decl (void) +# define G_LOCK(name) +# define G_UNLOCK(name) +# define G_TRYLOCK(name) (TRUE) +#endif /* !G_THREADS_ENABLED */ + +G_END_DECLS + +#endif /* __G_THREAD_H__ */ diff --git a/deps/glib/gtypes.h b/deps/glib/gtypes.h new file mode 100644 index 0000000..8e77563 --- /dev/null +++ b/deps/glib/gtypes.h @@ -0,0 +1,461 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_TYPES_H__ +#define __G_TYPES_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +/* Provide type definitions for commonly used types. + * These are useful because a "gint8" can be adjusted + * to be 1 byte (8 bits) on all platforms. Similarly and + * more importantly, "gint32" can be adjusted to be + * 4 bytes (32 bits) on all platforms. + */ + +typedef char gchar; +typedef short gshort; +typedef long glong; +typedef int gint; +typedef gint gboolean; + +typedef unsigned char guchar; +typedef unsigned short gushort; +typedef unsigned long gulong; +typedef unsigned int guint; + +typedef float gfloat; +typedef double gdouble; + +/* Define min and max constants for the fixed size numerical types */ +#define G_MININT8 ((gint8) 0x80) +#define G_MAXINT8 ((gint8) 0x7f) +#define G_MAXUINT8 ((guint8) 0xff) + +#define G_MININT16 ((gint16) 0x8000) +#define G_MAXINT16 ((gint16) 0x7fff) +#define G_MAXUINT16 ((guint16) 0xffff) + +#define G_MININT32 ((gint32) 0x80000000) +#define G_MAXINT32 ((gint32) 0x7fffffff) +#define G_MAXUINT32 ((guint32) 0xffffffff) + +#define G_MININT64 ((gint64) G_GINT64_CONSTANT(0x8000000000000000)) +#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff) +#define G_MAXUINT64 G_GINT64_CONSTANT(0xffffffffffffffffU) + +typedef void* gpointer; +typedef const void *gconstpointer; + +typedef gint (*GCompareFunc) (gconstpointer a, + gconstpointer b); +typedef gint (*GCompareDataFunc) (gconstpointer a, + gconstpointer b, + gpointer user_data); +typedef gboolean (*GEqualFunc) (gconstpointer a, + gconstpointer b); +typedef void (*GDestroyNotify) (gpointer data); +typedef void (*GFunc) (gpointer data, + gpointer user_data); +typedef guint (*GHashFunc) (gconstpointer key); +typedef void (*GHFunc) (gpointer key, + gpointer value, + gpointer user_data); + +/** + * GFreeFunc: + * @data: a data pointer + * + * Declares a type of function which takes an arbitrary + * data pointer argument and has no return value. It is + * not currently used in GLib or GTK+. + */ +typedef void (*GFreeFunc) (gpointer data); + +/** + * GTranslateFunc: + * @str: the untranslated string + * @data: user data specified when installing the function, e.g. + * in g_option_group_set_translate_func() + * + * The type of functions which are used to translate user-visible + * strings, for output. + * + * Returns: a translation of the string for the current locale. + * The returned string is owned by GLib and must not be freed. + */ +typedef const gchar * (*GTranslateFunc) (const gchar *str, + gpointer data); + + +/* Define some mathematical constants that aren't available + * symbolically in some strict ISO C implementations. + * + * Note that the large number of digits used in these definitions + * doesn't imply that GLib or current computers in general would be + * able to handle floating point numbers with an accuracy like this. + * It's mostly an exercise in futility and future proofing. For + * extended precision floating point support, look somewhere else + * than GLib. + */ +#define G_E 2.7182818284590452353602874713526624977572470937000 +#define G_LN2 0.69314718055994530941723212145817656807550013436026 +#define G_LN10 2.3025850929940456840179914546843642076011014886288 +#define G_PI 3.1415926535897932384626433832795028841971693993751 +#define G_PI_2 1.5707963267948966192313216916397514420985846996876 +#define G_PI_4 0.78539816339744830961566084581987572104929234984378 +#define G_SQRT2 1.4142135623730950488016887242096980785696718753769 + +/* Portable endian checks and conversions + * + * glibconfig.h defines G_BYTE_ORDER which expands to one of + * the below macros. + */ +#define G_LITTLE_ENDIAN 1234 +#define G_BIG_ENDIAN 4321 +#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */ + + +/* Basic bit swapping functions + */ +#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \ + (guint16) ((guint16) (val) >> 8) | \ + (guint16) ((guint16) (val) << 8))) + +#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \ + (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \ + (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \ + (((guint32) (val) & (guint32) 0xff000000U) >> 24))) + +#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \ + (((guint64) (val) & \ + (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56))) + +/* Arch specific stuff for speed + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# if defined (__i386__) +# define GUINT16_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ register guint16 __v, __x = ((guint16) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# if !defined (__i486__) && !defined (__i586__) \ + && !defined (__pentium__) && !defined (__i686__) \ + && !defined (__pentiumpro__) && !defined (__pentium4__) +# define GUINT32_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ register guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0\n\t" \ + "rorl $16, %0\n\t" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# else /* 486 and higher has bswap */ +# define GUINT32_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ register guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswap %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# endif /* processor specific 32-bit stuff */ +# define GUINT64_SWAP_LE_BE_IA32(val) \ + (G_GNUC_EXTENSION \ + ({ union { guint64 __ll; \ + guint32 __l[2]; } __w, __r; \ + __w.__ll = ((guint64) (val)); \ + if (__builtin_constant_p (__w.__ll)) \ + __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \ + else \ + { \ + __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \ + __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \ + } \ + __r.__ll; })) + /* Possibly just use the constant version and let gcc figure it out? */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val)) +# elif defined (__ia64__) +# define GUINT16_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ register guint16 __v, __x = ((guint16) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT32_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ register guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT64_SWAP_LE_BE_IA64(val) \ + (G_GNUC_EXTENSION \ + ({ register guint64 __v, __x = ((guint64) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val)) +# elif defined (__x86_64__) +# define GUINT32_SWAP_LE_BE_X86_64(val) \ + (G_GNUC_EXTENSION \ + ({ register guint32 __v, __x = ((guint32) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswapl %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# define GUINT64_SWAP_LE_BE_X86_64(val) \ + (G_GNUC_EXTENSION \ + ({ register guint64 __v, __x = ((guint64) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \ + else \ + __asm__ ("bswapq %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) + /* gcc seems to figure out optimal code for this on its own */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val)) +# else /* generic gcc */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) +# endif +#else /* generic */ +# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val)) +# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) +# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val)) +#endif /* generic */ + +#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val)) +#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val)) +#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \ + (((guint32) (val) & (guint32) 0xffff0000U) >> 16))) +#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \ + (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \ + (((guint32) (val) & (guint32) 0xff00ff00U) >> 8))) + +/* The G*_TO_?E() macros are defined in glibconfig.h. + * The transformation is symmetric, so the FROM just maps to the TO. + */ +#define GINT16_FROM_LE(val) (GINT16_TO_LE (val)) +#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val)) +#define GINT16_FROM_BE(val) (GINT16_TO_BE (val)) +#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) +#define GINT32_FROM_LE(val) (GINT32_TO_LE (val)) +#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val)) +#define GINT32_FROM_BE(val) (GINT32_TO_BE (val)) +#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val)) + +#define GINT64_FROM_LE(val) (GINT64_TO_LE (val)) +#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val)) +#define GINT64_FROM_BE(val) (GINT64_TO_BE (val)) +#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val)) + +#define GLONG_FROM_LE(val) (GLONG_TO_LE (val)) +#define GULONG_FROM_LE(val) (GULONG_TO_LE (val)) +#define GLONG_FROM_BE(val) (GLONG_TO_BE (val)) +#define GULONG_FROM_BE(val) (GULONG_TO_BE (val)) + +#define GINT_FROM_LE(val) (GINT_TO_LE (val)) +#define GUINT_FROM_LE(val) (GUINT_TO_LE (val)) +#define GINT_FROM_BE(val) (GINT_TO_BE (val)) +#define GUINT_FROM_BE(val) (GUINT_TO_BE (val)) + +#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val)) +#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val)) +#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val)) +#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val)) + + +/* Portable versions of host-network order stuff + */ +#define g_ntohl(val) (GUINT32_FROM_BE (val)) +#define g_ntohs(val) (GUINT16_FROM_BE (val)) +#define g_htonl(val) (GUINT32_TO_BE (val)) +#define g_htons(val) (GUINT16_TO_BE (val)) + +/* IEEE Standard 754 Single Precision Storage Format (gfloat): + * + * 31 30 23 22 0 + * +--------+---------------+---------------+ + * | s 1bit | e[30:23] 8bit | f[22:0] 23bit | + * +--------+---------------+---------------+ + * B0------------------->B1------->B2-->B3--> + * + * IEEE Standard 754 Double Precision Storage Format (gdouble): + * + * 63 62 52 51 32 31 0 + * +--------+----------------+----------------+ +---------------+ + * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit | + * +--------+----------------+----------------+ +---------------+ + * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7-> + */ +/* subtract from biased_exponent to form base2 exponent (normal numbers) */ +typedef union _GDoubleIEEE754 GDoubleIEEE754; +typedef union _GFloatIEEE754 GFloatIEEE754; +#define G_IEEE754_FLOAT_BIAS (127) +#define G_IEEE754_DOUBLE_BIAS (1023) +/* multiply with base2 exponent to get base10 exponent (normal numbers) */ +#define G_LOG_2_BASE_10 (0.30102999566398119521) +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +union _GFloatIEEE754 +{ + gfloat v_float; + struct { + guint mantissa : 23; + guint biased_exponent : 8; + guint sign : 1; + } mpn; +}; +union _GDoubleIEEE754 +{ + gdouble v_double; + struct { + guint mantissa_low : 32; + guint mantissa_high : 20; + guint biased_exponent : 11; + guint sign : 1; + } mpn; +}; +#elif G_BYTE_ORDER == G_BIG_ENDIAN +union _GFloatIEEE754 +{ + gfloat v_float; + struct { + guint sign : 1; + guint biased_exponent : 8; + guint mantissa : 23; + } mpn; +}; +union _GDoubleIEEE754 +{ + gdouble v_double; + struct { + guint sign : 1; + guint biased_exponent : 11; + guint mantissa_high : 20; + guint mantissa_low : 32; + } mpn; +}; +#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ +#error unknown ENDIAN type +#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */ + +typedef struct _GTimeVal GTimeVal; + +struct _GTimeVal +{ + glong tv_sec; + glong tv_usec; +}; + +G_END_DECLS + +/* We prefix variable declarations so they can + * properly get exported in Windows DLLs. + */ +#ifndef GLIB_VAR +# ifdef G_PLATFORM_WIN32 +# ifdef GLIB_STATIC_COMPILATION +# define GLIB_VAR extern +# else /* !GLIB_STATIC_COMPILATION */ +# ifdef GLIB_COMPILATION +# ifdef DLL_EXPORT +# define GLIB_VAR __declspec(dllexport) +# else /* !DLL_EXPORT */ +# define GLIB_VAR extern +# endif /* !DLL_EXPORT */ +# else /* !GLIB_COMPILATION */ +# define GLIB_VAR extern __declspec(dllimport) +# endif /* !GLIB_COMPILATION */ +# endif /* !GLIB_STATIC_COMPILATION */ +# else /* !G_PLATFORM_WIN32 */ +# define GLIB_VAR extern +# endif /* !G_PLATFORM_WIN32 */ +#endif /* GLIB_VAR */ + +#endif /* __G_TYPES_H__ */ diff --git a/deps/glib/gunicode.h b/deps/glib/gunicode.h new file mode 100644 index 0000000..5d5d3ad --- /dev/null +++ b/deps/glib/gunicode.h @@ -0,0 +1,729 @@ +/* gunicode.h - Unicode manipulation functions + * + * Copyright (C) 1999, 2000 Tom Tromey + * Copyright 2000, 2005 Red Hat, Inc. + * + * The Gnome Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Gnome Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_UNICODE_H__ +#define __G_UNICODE_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * gunichar: + * + * A type which can hold any UTF-32 or UCS-4 character code, + * also known as a Unicode code point. + * + * If you want to produce the UTF-8 representation of a #gunichar, + * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse + * process. + * + * To print/scan values of this type as integer, use + * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT. + * + * The notation to express a Unicode code point in running text is + * as a hexadecimal number with four to six digits and uppercase + * letters, prefixed by the string "U+". Leading zeros are omitted, + * unless the code point would have fewer than four hexadecimal digits. + * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point + * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X". + * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X". + * + * |[ + * gunichar c; + * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &c) + * g_print ("Read U+%04"G_GINT32_FORMAT"X", c); + * ]| + */ +typedef guint32 gunichar; + +/** + * gunichar2: + * + * A type which can hold any UTF-16 code + * pointUTF-16 also has so called + * surrogate pairs to encode characters beyond + * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored + * in a single gunichar2 field, but all GLib functions accepting gunichar2 + * arrays will correctly interpret surrogate pairs.. + * + * To print/scan values of this type to/from text you need to convert + * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16(). + * + * To print/scan values of this type as integer, use + * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT. + */ +typedef guint16 gunichar2; + +/** + * GUnicodeType: + * @G_UNICODE_CONTROL: General category "Other, Control" (Cc) + * @G_UNICODE_FORMAT: General category "Other, Format" (Cf) + * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn) + * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co) + * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs) + * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll) + * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm) + * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo) + * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt) + * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu) + * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc) + * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me) + * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn) + * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd) + * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl) + * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No) + * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc) + * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd) + * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe) + * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf) + * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi) + * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po) + * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps) + * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc) + * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk) + * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm) + * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So) + * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl) + * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp) + * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs) + * + * These are the possible character classifications from the + * Unicode specification. + * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html. + */ +typedef enum +{ + G_UNICODE_CONTROL, + G_UNICODE_FORMAT, + G_UNICODE_UNASSIGNED, + G_UNICODE_PRIVATE_USE, + G_UNICODE_SURROGATE, + G_UNICODE_LOWERCASE_LETTER, + G_UNICODE_MODIFIER_LETTER, + G_UNICODE_OTHER_LETTER, + G_UNICODE_TITLECASE_LETTER, + G_UNICODE_UPPERCASE_LETTER, + G_UNICODE_SPACING_MARK, + G_UNICODE_ENCLOSING_MARK, + G_UNICODE_NON_SPACING_MARK, + G_UNICODE_DECIMAL_NUMBER, + G_UNICODE_LETTER_NUMBER, + G_UNICODE_OTHER_NUMBER, + G_UNICODE_CONNECT_PUNCTUATION, + G_UNICODE_DASH_PUNCTUATION, + G_UNICODE_CLOSE_PUNCTUATION, + G_UNICODE_FINAL_PUNCTUATION, + G_UNICODE_INITIAL_PUNCTUATION, + G_UNICODE_OTHER_PUNCTUATION, + G_UNICODE_OPEN_PUNCTUATION, + G_UNICODE_CURRENCY_SYMBOL, + G_UNICODE_MODIFIER_SYMBOL, + G_UNICODE_MATH_SYMBOL, + G_UNICODE_OTHER_SYMBOL, + G_UNICODE_LINE_SEPARATOR, + G_UNICODE_PARAGRAPH_SEPARATOR, + G_UNICODE_SPACE_SEPARATOR +} GUnicodeType; + +/** + * G_UNICODE_COMBINING_MARK: + * + * Older name for %G_UNICODE_SPACING_MARK. + * + * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK. + */ +#ifndef G_DISABLE_DEPRECATED +#define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK +#endif + +/** + * GUnicodeBreakType: + * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK) + * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR) + * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF) + * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM) + * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG) + * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW) + * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN) + * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL) + * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB) + * @G_UNICODE_BREAK_SPACE: Space (SP) + * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA) + * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB) + * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2) + * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY) + * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS) + * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP) + * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL) + * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU) + * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX) + * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID) + * @G_UNICODE_BREAK_NUMERIC: Numeric (NU) + * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS) + * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY) + * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL) + * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR) + * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO) + * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA) + * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI) + * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX) + * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL) + * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ) + * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL) + * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV) + * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT) + * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2) + * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3) + * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28 + * + * These are the possible line break classifications. + * + * The five Hangul types were added in Unicode 4.1, so, has been + * introduced in GLib 2.10. Note that new types may be added in the future. + * Applications should be ready to handle unknown values. + * They may be regarded as %G_UNICODE_BREAK_UNKNOWN. + * + * See http://www.unicode.org/unicode/reports/tr14/. + */ +typedef enum +{ + G_UNICODE_BREAK_MANDATORY, + G_UNICODE_BREAK_CARRIAGE_RETURN, + G_UNICODE_BREAK_LINE_FEED, + G_UNICODE_BREAK_COMBINING_MARK, + G_UNICODE_BREAK_SURROGATE, + G_UNICODE_BREAK_ZERO_WIDTH_SPACE, + G_UNICODE_BREAK_INSEPARABLE, + G_UNICODE_BREAK_NON_BREAKING_GLUE, + G_UNICODE_BREAK_CONTINGENT, + G_UNICODE_BREAK_SPACE, + G_UNICODE_BREAK_AFTER, + G_UNICODE_BREAK_BEFORE, + G_UNICODE_BREAK_BEFORE_AND_AFTER, + G_UNICODE_BREAK_HYPHEN, + G_UNICODE_BREAK_NON_STARTER, + G_UNICODE_BREAK_OPEN_PUNCTUATION, + G_UNICODE_BREAK_CLOSE_PUNCTUATION, + G_UNICODE_BREAK_QUOTATION, + G_UNICODE_BREAK_EXCLAMATION, + G_UNICODE_BREAK_IDEOGRAPHIC, + G_UNICODE_BREAK_NUMERIC, + G_UNICODE_BREAK_INFIX_SEPARATOR, + G_UNICODE_BREAK_SYMBOL, + G_UNICODE_BREAK_ALPHABETIC, + G_UNICODE_BREAK_PREFIX, + G_UNICODE_BREAK_POSTFIX, + G_UNICODE_BREAK_COMPLEX_CONTEXT, + G_UNICODE_BREAK_AMBIGUOUS, + G_UNICODE_BREAK_UNKNOWN, + G_UNICODE_BREAK_NEXT_LINE, + G_UNICODE_BREAK_WORD_JOINER, + G_UNICODE_BREAK_HANGUL_L_JAMO, + G_UNICODE_BREAK_HANGUL_V_JAMO, + G_UNICODE_BREAK_HANGUL_T_JAMO, + G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, + G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, + G_UNICODE_BREAK_CLOSE_PARANTHESIS +} GUnicodeBreakType; + +/** + * GUnicodeScript: + * @G_UNICODE_SCRIPT_INVALID_CODE: + * a value never returned from g_unichar_get_script() + * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts + * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the + * i base glyph to which it is attached + * @G_UNICODE_SCRIPT_ARABIC: Arabic + * @G_UNICODE_SCRIPT_ARMENIAN: Armenian + * @G_UNICODE_SCRIPT_BENGALI: Bengali + * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo + * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee + * @G_UNICODE_SCRIPT_COPTIC: Coptic + * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic + * @G_UNICODE_SCRIPT_DESERET: Deseret + * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari + * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic + * @G_UNICODE_SCRIPT_GEORGIAN: Georgian + * @G_UNICODE_SCRIPT_GOTHIC: Gothic + * @G_UNICODE_SCRIPT_GREEK: Greek + * @G_UNICODE_SCRIPT_GUJARATI: Gujarati + * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi + * @G_UNICODE_SCRIPT_HAN: Han + * @G_UNICODE_SCRIPT_HANGUL: Hangul + * @G_UNICODE_SCRIPT_HEBREW: Hebrew + * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana + * @G_UNICODE_SCRIPT_KANNADA: Kannada + * @G_UNICODE_SCRIPT_KATAKANA: Katakana + * @G_UNICODE_SCRIPT_KHMER: Khmer + * @G_UNICODE_SCRIPT_LAO: Lao + * @G_UNICODE_SCRIPT_LATIN: Latin + * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam + * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian + * @G_UNICODE_SCRIPT_MYANMAR: Myanmar + * @G_UNICODE_SCRIPT_OGHAM: Ogham + * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic + * @G_UNICODE_SCRIPT_ORIYA: Oriya + * @G_UNICODE_SCRIPT_RUNIC: Runic + * @G_UNICODE_SCRIPT_SINHALA: Sinhala + * @G_UNICODE_SCRIPT_SYRIAC: Syriac + * @G_UNICODE_SCRIPT_TAMIL: Tamil + * @G_UNICODE_SCRIPT_TELUGU: Telugu + * @G_UNICODE_SCRIPT_THAANA: Thaana + * @G_UNICODE_SCRIPT_THAI: Thai + * @G_UNICODE_SCRIPT_TIBETAN: Tibetan + * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL: + * Canadian Aboriginal + * @G_UNICODE_SCRIPT_YI: Yi + * @G_UNICODE_SCRIPT_TAGALOG: Tagalog + * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo + * @G_UNICODE_SCRIPT_BUHID: Buhid + * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa + * @G_UNICODE_SCRIPT_BRAILLE: Braille + * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot + * @G_UNICODE_SCRIPT_LIMBU: Limbu + * @G_UNICODE_SCRIPT_OSMANYA: Osmanya + * @G_UNICODE_SCRIPT_SHAVIAN: Shavian + * @G_UNICODE_SCRIPT_LINEAR_B: Linear B + * @G_UNICODE_SCRIPT_TAI_LE: Tai Le + * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic + * @G_UNICODE_SCRIPT_NEW_TAI_LUE: + * New Tai Lue + * @G_UNICODE_SCRIPT_BUGINESE: Buginese + * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic + * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh + * @G_UNICODE_SCRIPT_SYLOTI_NAGRI: + * Syloti Nagri + * @G_UNICODE_SCRIPT_OLD_PERSIAN: + * Old Persian + * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi + * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point + * @G_UNICODE_SCRIPT_BALINESE: Balinese + * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform + * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician + * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa + * @G_UNICODE_SCRIPT_NKO: N'Ko + * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3 + * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3 + * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3 + * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3 + * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3 + * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3 + * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3 + * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3 + * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3 + * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3 + * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3 + * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26 + * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26 + * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS: + * Egyptian Hieroglpyhs. Since 2.26 + * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC: + * Imperial Aramaic. Since 2.26 + * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI: + * Inscriptional Pahlavi. Since 2.26 + * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN: + * Inscriptional Parthian. Since 2.26 + * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26 + * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26 + * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26 + * @G_UNICODE_SCRIPT_MEETEI_MAYEK: + * Meetei Mayek. Since 2.26 + * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN: + * Old South Arabian. Since 2.26 + * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28 + * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26 + * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26 + * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26 + * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28 + * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28 + * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28 + * + * The #GUnicodeScript enumeration identifies different writing + * systems. The values correspond to the names as defined in the + * Unicode standard. The enumeration has been added in GLib 2.14, + * and is interchangeable with #PangoScript. + * + * Note that new types may be added in the future. Applications + * should be ready to handle unknown values. + * See Unicode Standard Annex + * #24: Script names. + */ +typedef enum +{ /* ISO 15924 code */ + G_UNICODE_SCRIPT_INVALID_CODE = -1, + G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */ + G_UNICODE_SCRIPT_INHERITED, /* Qaai */ + G_UNICODE_SCRIPT_ARABIC, /* Arab */ + G_UNICODE_SCRIPT_ARMENIAN, /* Armn */ + G_UNICODE_SCRIPT_BENGALI, /* Beng */ + G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */ + G_UNICODE_SCRIPT_CHEROKEE, /* Cher */ + G_UNICODE_SCRIPT_COPTIC, /* Qaac */ + G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */ + G_UNICODE_SCRIPT_DESERET, /* Dsrt */ + G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */ + G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */ + G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */ + G_UNICODE_SCRIPT_GOTHIC, /* Goth */ + G_UNICODE_SCRIPT_GREEK, /* Grek */ + G_UNICODE_SCRIPT_GUJARATI, /* Gujr */ + G_UNICODE_SCRIPT_GURMUKHI, /* Guru */ + G_UNICODE_SCRIPT_HAN, /* Hani */ + G_UNICODE_SCRIPT_HANGUL, /* Hang */ + G_UNICODE_SCRIPT_HEBREW, /* Hebr */ + G_UNICODE_SCRIPT_HIRAGANA, /* Hira */ + G_UNICODE_SCRIPT_KANNADA, /* Knda */ + G_UNICODE_SCRIPT_KATAKANA, /* Kana */ + G_UNICODE_SCRIPT_KHMER, /* Khmr */ + G_UNICODE_SCRIPT_LAO, /* Laoo */ + G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */ + G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */ + G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */ + G_UNICODE_SCRIPT_MYANMAR, /* Mymr */ + G_UNICODE_SCRIPT_OGHAM, /* Ogam */ + G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */ + G_UNICODE_SCRIPT_ORIYA, /* Orya */ + G_UNICODE_SCRIPT_RUNIC, /* Runr */ + G_UNICODE_SCRIPT_SINHALA, /* Sinh */ + G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */ + G_UNICODE_SCRIPT_TAMIL, /* Taml */ + G_UNICODE_SCRIPT_TELUGU, /* Telu */ + G_UNICODE_SCRIPT_THAANA, /* Thaa */ + G_UNICODE_SCRIPT_THAI, /* Thai */ + G_UNICODE_SCRIPT_TIBETAN, /* Tibt */ + G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */ + G_UNICODE_SCRIPT_YI, /* Yiii */ + G_UNICODE_SCRIPT_TAGALOG, /* Tglg */ + G_UNICODE_SCRIPT_HANUNOO, /* Hano */ + G_UNICODE_SCRIPT_BUHID, /* Buhd */ + G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */ + + /* Unicode-4.0 additions */ + G_UNICODE_SCRIPT_BRAILLE, /* Brai */ + G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */ + G_UNICODE_SCRIPT_LIMBU, /* Limb */ + G_UNICODE_SCRIPT_OSMANYA, /* Osma */ + G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */ + G_UNICODE_SCRIPT_LINEAR_B, /* Linb */ + G_UNICODE_SCRIPT_TAI_LE, /* Tale */ + G_UNICODE_SCRIPT_UGARITIC, /* Ugar */ + + /* Unicode-4.1 additions */ + G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */ + G_UNICODE_SCRIPT_BUGINESE, /* Bugi */ + G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */ + G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */ + G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */ + G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */ + G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */ + + /* Unicode-5.0 additions */ + G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */ + G_UNICODE_SCRIPT_BALINESE, /* Bali */ + G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */ + G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */ + G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */ + G_UNICODE_SCRIPT_NKO, /* Nkoo */ + + /* Unicode-5.1 additions */ + G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */ + G_UNICODE_SCRIPT_LEPCHA, /* Lepc */ + G_UNICODE_SCRIPT_REJANG, /* Rjng */ + G_UNICODE_SCRIPT_SUNDANESE, /* Sund */ + G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */ + G_UNICODE_SCRIPT_CHAM, /* Cham */ + G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */ + G_UNICODE_SCRIPT_VAI, /* Vaii */ + G_UNICODE_SCRIPT_CARIAN, /* Cari */ + G_UNICODE_SCRIPT_LYCIAN, /* Lyci */ + G_UNICODE_SCRIPT_LYDIAN, /* Lydi */ + + /* Unicode-5.2 additions */ + G_UNICODE_SCRIPT_AVESTAN, /* Avst */ + G_UNICODE_SCRIPT_BAMUM, /* Bamu */ + G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */ + G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */ + G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */ + G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */ + G_UNICODE_SCRIPT_JAVANESE, /* Java */ + G_UNICODE_SCRIPT_KAITHI, /* Kthi */ + G_UNICODE_SCRIPT_LISU, /* Lisu */ + G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */ + G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */ + G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */ + G_UNICODE_SCRIPT_SAMARITAN, /* Samr */ + G_UNICODE_SCRIPT_TAI_THAM, /* Lana */ + G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */ + + /* Unicode-6.0 additions */ + G_UNICODE_SCRIPT_BATAK, /* Batk */ + G_UNICODE_SCRIPT_BRAHMI, /* Brah */ + G_UNICODE_SCRIPT_MANDAIC /* Mand */ +} GUnicodeScript; + +guint32 g_unicode_script_to_iso15924 (GUnicodeScript script); +GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924); + +/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is + * not null, sets *CHARSET to the name of the current locale's + * charset. This value is statically allocated, and should be copied + * in case the locale's charset will be changed later using setlocale() + * or in some other way. + */ +gboolean g_get_charset (const char **charset); + +/* These are all analogs of the functions. + */ +gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST; +gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST; +gboolean g_unichar_islower (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST; +gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST; +gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST; +gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST; +gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST; +gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST; +gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST; +gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST; + +/* More functions. These convert between the three cases. + * See the Unicode book to understand title case. */ +gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST; +gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST; +gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST; + +/* If C is a digit (according to `g_unichar_isdigit'), then return its + numeric value. Otherwise return -1. */ +gint g_unichar_digit_value (gunichar c) G_GNUC_CONST; + +gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST; + +/* Return the Unicode character type of a given character. */ +GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST; + +/* Return the line break property for a given character */ +GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST; + +/* Returns the combining class for a given character */ +gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST; + +gboolean g_unichar_get_mirror_char (gunichar ch, + gunichar *mirrored_ch); + +GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST; + +/* Validate a Unicode character */ +gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST; + +/* Pairwise canonical compose/decompose */ +gboolean g_unichar_compose (gunichar a, + gunichar b, + gunichar *ch); +gboolean g_unichar_decompose (gunichar ch, + gunichar *a, + gunichar *b); + +gsize g_unichar_fully_decompose (gunichar ch, + gboolean compat, + gunichar *result, + gsize result_len); + +/* Compute canonical ordering of a string in-place. This rearranges + decomposed characters in the string according to their combining + classes. See the Unicode manual for more information. */ +void g_unicode_canonical_ordering (gunichar *string, + gsize len); + + +#ifndef G_DISABLE_DEPRECATED +/* Deprecated. Use g_unichar_fully_decompose() */ +gunichar *g_unicode_canonical_decomposition (gunichar ch, + gsize *result_len) G_GNUC_MALLOC; +#endif + +/* Array of skip-bytes-per-initial character. + */ +GLIB_VAR const gchar * const g_utf8_skip; + +/** + * g_utf8_next_char: + * @p: Pointer to the start of a valid UTF-8 character + * + * Skips to the next character in a UTF-8 string. The string must be + * valid; this macro is as fast as possible, and has no error-checking. + * You would use this macro to iterate over a string character by + * character. The macro returns the start of the next UTF-8 character. + * Before using this macro, use g_utf8_validate() to validate strings + * that may contain invalid UTF-8. + */ +#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)]) + +gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE; +gunichar g_utf8_get_char_validated (const gchar *p, + gssize max_len) G_GNUC_PURE; + +gchar* g_utf8_offset_to_pointer (const gchar *str, + glong offset) G_GNUC_PURE; +glong g_utf8_pointer_to_offset (const gchar *str, + const gchar *pos) G_GNUC_PURE; +gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE; +gchar* g_utf8_find_next_char (const gchar *p, + const gchar *end) G_GNUC_PURE; +gchar* g_utf8_find_prev_char (const gchar *str, + const gchar *p) G_GNUC_PURE; + +glong g_utf8_strlen (const gchar *p, + gssize max) G_GNUC_PURE; + +gchar *g_utf8_substring (const gchar *str, + glong start_pos, + glong end_pos) G_GNUC_MALLOC; + +gchar *g_utf8_strncpy (gchar *dest, + const gchar *src, + gsize n); + +/* Find the UTF-8 character corresponding to ch, in string p. These + functions are equivalants to strchr and strrchr */ +gchar* g_utf8_strchr (const gchar *p, + gssize len, + gunichar c); +gchar* g_utf8_strrchr (const gchar *p, + gssize len, + gunichar c); +gchar* g_utf8_strreverse (const gchar *str, + gssize len); + +gunichar2 *g_utf8_to_utf16 (const gchar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +gunichar * g_utf8_to_ucs4 (const gchar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +gunichar * g_utf8_to_ucs4_fast (const gchar *str, + glong len, + glong *items_written) G_GNUC_MALLOC; +gunichar * g_utf16_to_ucs4 (const gunichar2 *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +gchar* g_utf16_to_utf8 (const gunichar2 *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +gunichar2 *g_ucs4_to_utf16 (const gunichar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; +gchar* g_ucs4_to_utf8 (const gunichar *str, + glong len, + glong *items_read, + glong *items_written, + GError **error) G_GNUC_MALLOC; + +gint g_unichar_to_utf8 (gunichar c, + gchar *outbuf); + +gboolean g_utf8_validate (const gchar *str, + gssize max_len, + const gchar **end); + +gchar *g_utf8_strup (const gchar *str, + gssize len) G_GNUC_MALLOC; +gchar *g_utf8_strdown (const gchar *str, + gssize len) G_GNUC_MALLOC; +gchar *g_utf8_casefold (const gchar *str, + gssize len) G_GNUC_MALLOC; + +/** + * GNormalizeMode: + * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the + * text content, such as the above-mentioned accent representation + * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT + * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with + * composed forms rather than a maximally decomposed form + * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE + * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the + * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE + * to the standard forms (in this case DIGIT THREE). Formatting + * information may be lost but for most text operations such + * characters should be considered the same + * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL + * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed + * forms rather than a maximally decomposed form + * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE + * + * Defines how a Unicode string is transformed in a canonical + * form, standardizing such issues as whether a character with + * an accent is represented as a base character and combining + * accent or as a single precomposed character. Unicode strings + * should generally be normalized before comparing them. + */ +typedef enum { + G_NORMALIZE_DEFAULT, + G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, + G_NORMALIZE_DEFAULT_COMPOSE, + G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE, + G_NORMALIZE_ALL, + G_NORMALIZE_NFKD = G_NORMALIZE_ALL, + G_NORMALIZE_ALL_COMPOSE, + G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE +} GNormalizeMode; + +gchar *g_utf8_normalize (const gchar *str, + gssize len, + GNormalizeMode mode) G_GNUC_MALLOC; + +gint g_utf8_collate (const gchar *str1, + const gchar *str2) G_GNUC_PURE; +gchar *g_utf8_collate_key (const gchar *str, + gssize len) G_GNUC_MALLOC; +gchar *g_utf8_collate_key_for_filename (const gchar *str, + gssize len) G_GNUC_MALLOC; + + +/* private */ + +gchar *_g_utf8_make_valid (const gchar *name); + +G_END_DECLS + +#endif /* __G_UNICODE_H__ */ diff --git a/deps/glib/gutils.c b/deps/glib/gutils.c new file mode 100644 index 0000000..c5b7be5 --- /dev/null +++ b/deps/glib/gutils.c @@ -0,0 +1,3872 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe for the unix part, FIXME: make the win32 part MT safe as well. + */ + +/** + * SECTION:version + * @Title: Version Information + * @Short_description: Variables and functions to check the GLib version + * + * GLib provides version information, primarily useful in configure + * checks for builds that have a configure script. Applications will + * not typically use the features described here. + */ + +/** + * GLIB_MAJOR_VERSION: + * + * The major version number of the GLib library. + * + * Like #glib_major_version, but from the headers used at + * application compile time, rather than from the library + * linked against at application run time. + */ + +/** + * GLIB_MINOR_VERSION: + * + * The minor version number of the GLib library. + * + * Like #gtk_minor_version, but from the headers used at + * application compile time, rather than from the library + * linked against at application run time. + */ + +/** + * GLIB_MICRO_VERSION: + * + * The micro version number of the GLib library. + * + * Like #gtk_micro_version, but from the headers used at + * application compile time, rather than from the library + * linked against at application run time. + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include +#include /* For tolower() */ +#include +#include +#include +#ifdef HAVE_PWD_H +#include +#endif +#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_CRT_EXTERNS_H +#include /* for _NSGetEnviron */ +#endif + +/* implement gutils's inline functions + */ +#define G_IMPLEMENT_INLINES 1 +#define __G_UTILS_C__ +#include "gutils.h" + +#include "gfileutils.h" +#include "ghash.h" +#include "gslist.h" +#include "gprintfint.h" +#include "gthread.h" +#include "gthreadprivate.h" +#include "gtestutils.h" +#include "gunicode.h" +#include "gstrfuncs.h" +#include "garray.h" +#include "glibintl.h" + +#ifdef G_PLATFORM_WIN32 +#include "garray.h" +#include "gconvert.h" +#include "gwin32.h" +#endif + + +/** + * SECTION:misc_utils + * @title: Miscellaneous Utility Functions + * @short_description: a selection of portable utility functions + * + * These are portable utility functions. + */ + +#ifdef MAXPATHLEN +#define G_PATH_LENGTH MAXPATHLEN +#elif defined (PATH_MAX) +#define G_PATH_LENGTH PATH_MAX +#elif defined (_PC_PATH_MAX) +#define G_PATH_LENGTH sysconf(_PC_PATH_MAX) +#else +#define G_PATH_LENGTH 2048 +#endif + +#ifdef G_PLATFORM_WIN32 +# define STRICT /* Strict typing, please */ +# include +# undef STRICT +# ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS +# define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 2 +# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 4 +# endif +# include /* For UNLEN */ +#endif /* G_PLATFORM_WIN32 */ + +#ifdef G_OS_WIN32 +# include +# include + /* older SDK (e.g. msvc 5.0) does not have these*/ +# ifndef CSIDL_MYMUSIC +# define CSIDL_MYMUSIC 13 +# endif +# ifndef CSIDL_MYVIDEO +# define CSIDL_MYVIDEO 14 +# endif +# ifndef CSIDL_INTERNET_CACHE +# define CSIDL_INTERNET_CACHE 32 +# endif +# ifndef CSIDL_COMMON_APPDATA +# define CSIDL_COMMON_APPDATA 35 +# endif +# ifndef CSIDL_MYPICTURES +# define CSIDL_MYPICTURES 0x27 +# endif +# ifndef CSIDL_COMMON_DOCUMENTS +# define CSIDL_COMMON_DOCUMENTS 46 +# endif +# ifndef CSIDL_PROFILE +# define CSIDL_PROFILE 40 +# endif +# include +#endif + +#ifdef HAVE_CARBON +#include +#endif + +#ifdef HAVE_CODESET +#include +#endif + +const guint glib_major_version = GLIB_MAJOR_VERSION; +const guint glib_minor_version = GLIB_MINOR_VERSION; +const guint glib_micro_version = GLIB_MICRO_VERSION; +const guint glib_interface_age = GLIB_INTERFACE_AGE; +const guint glib_binary_age = GLIB_BINARY_AGE; + +#ifdef G_PLATFORM_WIN32 + +static HMODULE glib_dll = NULL; + +#ifdef DLL_EXPORT + +BOOL WINAPI +DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + glib_dll = hinstDLL; + + return TRUE; +} + +#endif + +gchar * +_glib_get_dll_directory (void) +{ + gchar *retval; + gchar *p; + wchar_t wc_fn[MAX_PATH]; + +#ifdef DLL_EXPORT + if (glib_dll == NULL) + return NULL; +#endif + + /* This code is different from that in + * g_win32_get_package_installation_directory_of_module() in that + * here we return the actual folder where the GLib DLL is. We don't + * do the check for it being in a "bin" or "lib" subfolder and then + * returning the parent of that. + * + * In a statically built GLib, glib_dll will be NULL and we will + * thus look up the application's .exe file's location. + */ + if (!GetModuleFileNameW (glib_dll, wc_fn, MAX_PATH)) + return NULL; + + retval = g_utf16_to_utf8 (wc_fn, -1, NULL, NULL, NULL); + + p = strrchr (retval, G_DIR_SEPARATOR); + if (p == NULL) + { + /* Wtf? */ + return NULL; + } + *p = '\0'; + + return retval; +} + +#endif + +/** + * glib_check_version: + * @required_major: the required major version. + * @required_minor: the required minor version. + * @required_micro: the required micro version. + * + * Checks that the GLib library in use is compatible with the + * given version. Generally you would pass in the constants + * #GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION + * as the three arguments to this function; that produces + * a check that the library in use is compatible with + * the version of GLib the application or module was compiled + * against. + * + * Compatibility is defined by two things: first the version + * of the running library is newer than the version + * @required_major.required_minor.@required_micro. Second + * the running library must be binary compatible with the + * version @required_major.required_minor.@required_micro + * (same major version.) + * + * Return value: %NULL if the GLib library is compatible with the + * given version, or a string describing the version mismatch. + * The returned string is owned by GLib and must not be modified + * or freed. + * + * Since: 2.6 + **/ +const gchar * +glib_check_version (guint required_major, + guint required_minor, + guint required_micro) +{ + gint glib_effective_micro = 100 * GLIB_MINOR_VERSION + GLIB_MICRO_VERSION; + gint required_effective_micro = 100 * required_minor + required_micro; + + if (required_major > GLIB_MAJOR_VERSION) + return "GLib version too old (major mismatch)"; + if (required_major < GLIB_MAJOR_VERSION) + return "GLib version too new (major mismatch)"; + if (required_effective_micro < glib_effective_micro - GLIB_BINARY_AGE) + return "GLib version too new (micro mismatch)"; + if (required_effective_micro > glib_effective_micro) + return "GLib version too old (micro mismatch)"; + return NULL; +} + +#if !defined (HAVE_MEMMOVE) && !defined (HAVE_WORKING_BCOPY) +/** + * g_memmove: + * @dest: the destination address to copy the bytes to. + * @src: the source address to copy the bytes from. + * @len: the number of bytes to copy. + * + * Copies a block of memory @len bytes long, from @src to @dest. + * The source and destination areas may overlap. + * + * In order to use this function, you must include + * string.h yourself, because this macro will + * typically simply resolve to memmove() and GLib does not include + * string.h for you. + */ +void +g_memmove (gpointer dest, + gconstpointer src, + gulong len) +{ + gchar* destptr = dest; + const gchar* srcptr = src; + if (src + len < dest || dest + len < src) + { + bcopy (src, dest, len); + return; + } + else if (dest <= src) + { + while (len--) + *(destptr++) = *(srcptr++); + } + else + { + destptr += len; + srcptr += len; + while (len--) + *(--destptr) = *(--srcptr); + } +} +#endif /* !HAVE_MEMMOVE && !HAVE_WORKING_BCOPY */ + +#ifdef G_OS_WIN32 +#undef g_atexit +#endif + +/** + * g_atexit: + * @func: (scope async): the function to call on normal program termination. + * + * Specifies a function to be called at normal program termination. + * + * Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor + * macro that maps to a call to the atexit() function in the C + * library. This means that in case the code that calls g_atexit(), + * i.e. atexit(), is in a DLL, the function will be called when the + * DLL is detached from the program. This typically makes more sense + * than that the function is called when the GLib DLL is detached, + * which happened earlier when g_atexit() was a function in the GLib + * DLL. + * + * The behaviour of atexit() in the context of dynamically loaded + * modules is not formally specified and varies wildly. + * + * On POSIX systems, calling g_atexit() (or atexit()) in a dynamically + * loaded module which is unloaded before the program terminates might + * well cause a crash at program exit. + * + * Some POSIX systems implement atexit() like Windows, and have each + * dynamically loaded module maintain an own atexit chain that is + * called when the module is unloaded. + * + * On other POSIX systems, before a dynamically loaded module is + * unloaded, the registered atexit functions (if any) residing in that + * module are called, regardless where the code that registered them + * resided. This is presumably the most robust approach. + * + * As can be seen from the above, for portability it's best to avoid + * calling g_atexit() (or atexit()) except in the main executable of a + * program. + */ +void +g_atexit (GVoidFunc func) +{ + gint result; + const gchar *error = NULL; + + /* keep this in sync with glib.h */ + +#ifdef G_NATIVE_ATEXIT + result = ATEXIT (func); + if (result) + error = g_strerror (errno); +#elif defined (HAVE_ATEXIT) +# ifdef NeXT /* @#%@! NeXTStep */ + result = !atexit ((void (*)(void)) func); + if (result) + error = g_strerror (errno); +# else + result = atexit ((void (*)(void)) func); + if (result) + error = g_strerror (errno); +# endif /* NeXT */ +#elif defined (HAVE_ON_EXIT) + result = on_exit ((void (*)(int, void *)) func, NULL); + if (result) + error = g_strerror (errno); +#else + result = 0; + error = "no implementation"; +#endif /* G_NATIVE_ATEXIT */ + + if (error) + g_error ("Could not register atexit() function: %s", error); +} + +/* Based on execvp() from GNU Libc. + * Some of this code is cut-and-pasted into gspawn.c + */ + +static gchar* +my_strchrnul (const gchar *str, + gchar c) +{ + gchar *p = (gchar*)str; + while (*p && (*p != c)) + ++p; + + return p; +} + +#ifdef G_OS_WIN32 + +static gchar *inner_find_program_in_path (const gchar *program); + +gchar* +g_find_program_in_path (const gchar *program) +{ + const gchar *last_dot = strrchr (program, '.'); + + if (last_dot == NULL || + strchr (last_dot, '\\') != NULL || + strchr (last_dot, '/') != NULL) + { + const gint program_length = strlen (program); + gchar *pathext = g_build_path (";", + ".exe;.cmd;.bat;.com", + g_getenv ("PATHEXT"), + NULL); + gchar *p; + gchar *decorated_program; + gchar *retval; + + p = pathext; + do + { + gchar *q = my_strchrnul (p, ';'); + + decorated_program = g_malloc (program_length + (q-p) + 1); + memcpy (decorated_program, program, program_length); + memcpy (decorated_program+program_length, p, q-p); + decorated_program [program_length + (q-p)] = '\0'; + + retval = inner_find_program_in_path (decorated_program); + g_free (decorated_program); + + if (retval != NULL) + { + g_free (pathext); + return retval; + } + p = q; + } while (*p++ != '\0'); + g_free (pathext); + return NULL; + } + else + return inner_find_program_in_path (program); +} + +#endif + +/** + * g_find_program_in_path: + * @program: a program name in the GLib file name encoding + * + * Locates the first executable named @program in the user's path, in the + * same way that execvp() would locate it. Returns an allocated string + * with the absolute path name, or %NULL if the program is not found in + * the path. If @program is already an absolute path, returns a copy of + * @program if @program exists and is executable, and %NULL otherwise. + * + * On Windows, if @program does not have a file type suffix, tries + * with the suffixes .exe, .cmd, .bat and .com, and the suffixes in + * the PATHEXT environment variable. + * + * On Windows, it looks for the file in the same way as CreateProcess() + * would. This means first in the directory where the executing + * program was loaded from, then in the current directory, then in the + * Windows 32-bit system directory, then in the Windows directory, and + * finally in the directories in the PATH environment + * variable. If the program is found, the return value contains the + * full name including the type suffix. + * + * Return value: absolute path, or %NULL + **/ +#ifdef G_OS_WIN32 +static gchar * +inner_find_program_in_path (const gchar *program) +#else +gchar* +g_find_program_in_path (const gchar *program) +#endif +{ + const gchar *path, *p; + gchar *name, *freeme; +#ifdef G_OS_WIN32 + const gchar *path_copy; + gchar *filename = NULL, *appdir = NULL; + gchar *sysdir = NULL, *windir = NULL; + int n; + wchar_t wfilename[MAXPATHLEN], wsysdir[MAXPATHLEN], + wwindir[MAXPATHLEN]; +#endif + gsize len; + gsize pathlen; + + g_return_val_if_fail (program != NULL, NULL); + + /* If it is an absolute path, or a relative path including subdirectories, + * don't look in PATH. + */ + if (g_path_is_absolute (program) + || strchr (program, G_DIR_SEPARATOR) != NULL +#ifdef G_OS_WIN32 + || strchr (program, '/') != NULL +#endif + ) + { + if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE) && + !g_file_test (program, G_FILE_TEST_IS_DIR)) + return g_strdup (program); + else + return NULL; + } + + path = g_getenv ("PATH"); +#if defined(G_OS_UNIX) || defined(G_OS_BEOS) + if (path == NULL) + { + /* There is no `PATH' in the environment. The default + * search path in GNU libc is the current directory followed by + * the path `confstr' returns for `_CS_PATH'. + */ + + /* In GLib we put . last, for security, and don't use the + * unportable confstr(); UNIX98 does not actually specify + * what to search if PATH is unset. POSIX may, dunno. + */ + + path = "/bin:/usr/bin:."; + } +#else + n = GetModuleFileNameW (NULL, wfilename, MAXPATHLEN); + if (n > 0 && n < MAXPATHLEN) + filename = g_utf16_to_utf8 (wfilename, -1, NULL, NULL, NULL); + + n = GetSystemDirectoryW (wsysdir, MAXPATHLEN); + if (n > 0 && n < MAXPATHLEN) + sysdir = g_utf16_to_utf8 (wsysdir, -1, NULL, NULL, NULL); + + n = GetWindowsDirectoryW (wwindir, MAXPATHLEN); + if (n > 0 && n < MAXPATHLEN) + windir = g_utf16_to_utf8 (wwindir, -1, NULL, NULL, NULL); + + if (filename) + { + appdir = g_path_get_dirname (filename); + g_free (filename); + } + + path = g_strdup (path); + + if (windir) + { + const gchar *tem = path; + path = g_strconcat (windir, ";", path, NULL); + g_free ((gchar *) tem); + g_free (windir); + } + + if (sysdir) + { + const gchar *tem = path; + path = g_strconcat (sysdir, ";", path, NULL); + g_free ((gchar *) tem); + g_free (sysdir); + } + + { + const gchar *tem = path; + path = g_strconcat (".;", path, NULL); + g_free ((gchar *) tem); + } + + if (appdir) + { + const gchar *tem = path; + path = g_strconcat (appdir, ";", path, NULL); + g_free ((gchar *) tem); + g_free (appdir); + } + + path_copy = path; +#endif + + len = strlen (program) + 1; + pathlen = strlen (path); + freeme = name = g_malloc (pathlen + len + 1); + + /* Copy the file name at the top, including '\0' */ + memcpy (name + pathlen + 1, program, len); + name = name + pathlen; + /* And add the slash before the filename */ + *name = G_DIR_SEPARATOR; + + p = path; + do + { + char *startp; + + path = p; + p = my_strchrnul (path, G_SEARCHPATH_SEPARATOR); + + if (p == path) + /* Two adjacent colons, or a colon at the beginning or the end + * of `PATH' means to search the current directory. + */ + startp = name + 1; + else + startp = memcpy (name - (p - path), path, p - path); + + if (g_file_test (startp, G_FILE_TEST_IS_EXECUTABLE) && + !g_file_test (startp, G_FILE_TEST_IS_DIR)) + { + gchar *ret; + ret = g_strdup (startp); + g_free (freeme); +#ifdef G_OS_WIN32 + g_free ((gchar *) path_copy); +#endif + return ret; + } + } + while (*p++ != '\0'); + + g_free (freeme); +#ifdef G_OS_WIN32 + g_free ((gchar *) path_copy); +#endif + + return NULL; +} + +static gboolean +debug_key_matches (const gchar *key, + const gchar *token, + guint length) +{ + for (; length; length--, key++, token++) + { + char k = (*key == '_') ? '-' : tolower (*key ); + char t = (*token == '_') ? '-' : tolower (*token); + + if (k != t) + return FALSE; + } + + return *key == '\0'; +} + +/** + * g_parse_debug_string: + * @string: (allow-none): a list of debug options separated by colons, spaces, or + * commas, or %NULL. + * @keys: (array length=nkeys): pointer to an array of #GDebugKey which associate + * strings with bit flags. + * @nkeys: the number of #GDebugKeys in the array. + * + * Parses a string containing debugging options + * into a %guint containing bit flags. This is used + * within GDK and GTK+ to parse the debug options passed on the + * command line or through environment variables. + * + * If @string is equal to "all", all flags are set. If @string + * is equal to "help", all the available keys in @keys are printed + * out to standard error. + * + * Returns: the combined set of bit flags. + */ +guint +g_parse_debug_string (const gchar *string, + const GDebugKey *keys, + guint nkeys) +{ + guint i; + guint result = 0; + + if (string == NULL) + return 0; + + /* this function is used by gmem.c/gslice.c initialization code, + * so introducing malloc dependencies here would require adaptions + * of those code portions. + */ + + if (!g_ascii_strcasecmp (string, "all")) + { + for (i=0; i base)) + base = q; + } +#endif + + if (base) + return base + 1; + +#ifdef G_OS_WIN32 + if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':') + return (gchar*) file_name + 2; +#endif /* G_OS_WIN32 */ + + return (gchar*) file_name; +} + +/** + * g_path_get_basename: + * @file_name: the name of the file. + * + * Gets the last component of the filename. If @file_name ends with a + * directory separator it gets the component before the last slash. If + * @file_name consists only of directory separators (and on Windows, + * possibly a drive letter), a single separator is returned. If + * @file_name is empty, it gets ".". + * + * Return value: a newly allocated string containing the last component of + * the filename. + */ +gchar* +g_path_get_basename (const gchar *file_name) +{ + register gssize base; + register gssize last_nonslash; + gsize len; + gchar *retval; + + g_return_val_if_fail (file_name != NULL, NULL); + + if (file_name[0] == '\0') + /* empty string */ + return g_strdup ("."); + + last_nonslash = strlen (file_name) - 1; + + while (last_nonslash >= 0 && G_IS_DIR_SEPARATOR (file_name [last_nonslash])) + last_nonslash--; + + if (last_nonslash == -1) + /* string only containing slashes */ + return g_strdup (G_DIR_SEPARATOR_S); + +#ifdef G_OS_WIN32 + if (last_nonslash == 1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':') + /* string only containing slashes and a drive */ + return g_strdup (G_DIR_SEPARATOR_S); +#endif /* G_OS_WIN32 */ + + base = last_nonslash; + + while (base >=0 && !G_IS_DIR_SEPARATOR (file_name [base])) + base--; + +#ifdef G_OS_WIN32 + if (base == -1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':') + base = 1; +#endif /* G_OS_WIN32 */ + + len = last_nonslash - base; + retval = g_malloc (len + 1); + memcpy (retval, file_name + base + 1, len); + retval [len] = '\0'; + return retval; +} + +/** + * g_path_is_absolute: + * @file_name: a file name. + * + * Returns %TRUE if the given @file_name is an absolute file name. + * Note that this is a somewhat vague concept on Windows. + * + * On POSIX systems, an absolute file name is well-defined. It always + * starts from the single root directory. For example "/usr/local". + * + * On Windows, the concepts of current drive and drive-specific + * current directory introduce vagueness. This function interprets as + * an absolute file name one that either begins with a directory + * separator such as "\Users\tml" or begins with the root on a drive, + * for example "C:\Windows". The first case also includes UNC paths + * such as "\\myserver\docs\foo". In all cases, either slashes or + * backslashes are accepted. + * + * Note that a file name relative to the current drive root does not + * truly specify a file uniquely over time and across processes, as + * the current drive is a per-process value and can be changed. + * + * File names relative the current directory on some specific drive, + * such as "D:foo/bar", are not interpreted as absolute by this + * function, but they obviously are not relative to the normal current + * directory as returned by getcwd() or g_get_current_dir() + * either. Such paths should be avoided, or need to be handled using + * Windows-specific code. + * + * Returns: %TRUE if @file_name is absolute. + */ +gboolean +g_path_is_absolute (const gchar *file_name) +{ + g_return_val_if_fail (file_name != NULL, FALSE); + + if (G_IS_DIR_SEPARATOR (file_name[0])) + return TRUE; + +#ifdef G_OS_WIN32 + /* Recognize drive letter on native Windows */ + if (g_ascii_isalpha (file_name[0]) && + file_name[1] == ':' && G_IS_DIR_SEPARATOR (file_name[2])) + return TRUE; +#endif /* G_OS_WIN32 */ + + return FALSE; +} + +/** + * g_path_skip_root: + * @file_name: a file name. + * + * Returns a pointer into @file_name after the root component, i.e. after + * the "/" in UNIX or "C:\" under Windows. If @file_name is not an absolute + * path it returns %NULL. + * + * Returns: a pointer into @file_name after the root component. + */ +const gchar * +g_path_skip_root (const gchar *file_name) +{ + g_return_val_if_fail (file_name != NULL, NULL); + +#ifdef G_PLATFORM_WIN32 + /* Skip \\server\share or //server/share */ + if (G_IS_DIR_SEPARATOR (file_name[0]) && + G_IS_DIR_SEPARATOR (file_name[1]) && + file_name[2] && + !G_IS_DIR_SEPARATOR (file_name[2])) + { + gchar *p; + + p = strchr (file_name + 2, G_DIR_SEPARATOR); +#ifdef G_OS_WIN32 + { + gchar *q = strchr (file_name + 2, '/'); + if (p == NULL || (q != NULL && q < p)) + p = q; + } +#endif + if (p && + p > file_name + 2 && + p[1]) + { + file_name = p + 1; + + while (file_name[0] && !G_IS_DIR_SEPARATOR (file_name[0])) + file_name++; + + /* Possibly skip a backslash after the share name */ + if (G_IS_DIR_SEPARATOR (file_name[0])) + file_name++; + + return (gchar *)file_name; + } + } +#endif + + /* Skip initial slashes */ + if (G_IS_DIR_SEPARATOR (file_name[0])) + { + while (G_IS_DIR_SEPARATOR (file_name[0])) + file_name++; + return (gchar *)file_name; + } + +#ifdef G_OS_WIN32 + /* Skip X:\ */ + if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':' && G_IS_DIR_SEPARATOR (file_name[2])) + return (gchar *)file_name + 3; +#endif + + return NULL; +} + +/** + * g_bit_nth_lsf: + * @mask: a #gulong containing flags + * @nth_bit: the index of the bit to start the search from + * + * Find the position of the first bit set in @mask, searching + * from (but not including) @nth_bit upwards. Bits are numbered + * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, + * usually). To start searching from the 0th bit, set @nth_bit to -1. + * + * Returns: the index of the first bit set which is higher than @nth_bit + */ + +/** + * g_bit_nth_msf: + * @mask: a #gulong containing flags + * @nth_bit: the index of the bit to start the search from + * + * Find the position of the first bit set in @mask, searching + * from (but not including) @nth_bit downwards. Bits are numbered + * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, + * usually). To start searching from the last bit, set @nth_bit to + * -1 or GLIB_SIZEOF_LONG * 8. + * + * Returns: the index of the first bit set which is lower than @nth_bit + */ + +/** + * g_bit_storage: + * @number: a #guint + * + * Gets the number of bits used to hold @number, + * e.g. if @number is 4, 3 bits are needed. + * + * Returns: the number of bits used to hold @number + */ + +/** + * g_dirname: + * @file_name: the name of the file + * + * Gets the directory components of a file name. + * If the file name has no directory components "." is returned. + * The returned string should be freed when no longer needed. + * + * Returns: the directory components of the file + * + * Deprecated: use g_path_get_dirname() instead + */ + +/** + * g_path_get_dirname: + * @file_name: the name of the file. + * + * Gets the directory components of a file name. If the file name has no + * directory components "." is returned. The returned string should be + * freed when no longer needed. + * + * Returns: the directory components of the file. + */ +gchar* +g_path_get_dirname (const gchar *file_name) +{ + register gchar *base; + register gsize len; + + g_return_val_if_fail (file_name != NULL, NULL); + + base = strrchr (file_name, G_DIR_SEPARATOR); +#ifdef G_OS_WIN32 + { + gchar *q = strrchr (file_name, '/'); + if (base == NULL || (q != NULL && q > base)) + base = q; + } +#endif + if (!base) + { +#ifdef G_OS_WIN32 + if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':') + { + gchar drive_colon_dot[4]; + + drive_colon_dot[0] = file_name[0]; + drive_colon_dot[1] = ':'; + drive_colon_dot[2] = '.'; + drive_colon_dot[3] = '\0'; + + return g_strdup (drive_colon_dot); + } +#endif + return g_strdup ("."); + } + + while (base > file_name && G_IS_DIR_SEPARATOR (*base)) + base--; + +#ifdef G_OS_WIN32 + /* base points to the char before the last slash. + * + * In case file_name is the root of a drive (X:\) or a child of the + * root of a drive (X:\foo), include the slash. + * + * In case file_name is the root share of an UNC path + * (\\server\share), add a slash, returning \\server\share\ . + * + * In case file_name is a direct child of a share in an UNC path + * (\\server\share\foo), include the slash after the share name, + * returning \\server\share\ . + */ + if (base == file_name + 1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':') + base++; + else if (G_IS_DIR_SEPARATOR (file_name[0]) && + G_IS_DIR_SEPARATOR (file_name[1]) && + file_name[2] && + !G_IS_DIR_SEPARATOR (file_name[2]) && + base >= file_name + 2) + { + const gchar *p = file_name + 2; + while (*p && !G_IS_DIR_SEPARATOR (*p)) + p++; + if (p == base + 1) + { + len = (guint) strlen (file_name) + 1; + base = g_new (gchar, len + 1); + strcpy (base, file_name); + base[len-1] = G_DIR_SEPARATOR; + base[len] = 0; + return base; + } + if (G_IS_DIR_SEPARATOR (*p)) + { + p++; + while (*p && !G_IS_DIR_SEPARATOR (*p)) + p++; + if (p == base + 1) + base++; + } + } +#endif + + len = (guint) 1 + base - file_name; + + base = g_new (gchar, len + 1); + g_memmove (base, file_name, len); + base[len] = 0; + + return base; +} + +/** + * g_get_current_dir: + * + * Gets the current directory. + * The returned string should be freed when no longer needed. The encoding + * of the returned string is system defined. On Windows, it is always UTF-8. + * + * Returns: the current directory. + */ +gchar* +g_get_current_dir (void) +{ +#ifdef G_OS_WIN32 + + gchar *dir = NULL; + wchar_t dummy[2], *wdir; + int len; + + len = GetCurrentDirectoryW (2, dummy); + wdir = g_new (wchar_t, len); + + if (GetCurrentDirectoryW (len, wdir) == len - 1) + dir = g_utf16_to_utf8 (wdir, -1, NULL, NULL, NULL); + + g_free (wdir); + + if (dir == NULL) + dir = g_strdup ("\\"); + + return dir; + +#else + + gchar *buffer = NULL; + gchar *dir = NULL; + static gulong max_len = 0; + + if (max_len == 0) + max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH; + + /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd") + * and, if that wasn't bad enough, hangs in doing so. + */ +#if (defined (sun) && !defined (__SVR4)) || !defined(HAVE_GETCWD) + buffer = g_new (gchar, max_len + 1); + *buffer = 0; + dir = getwd (buffer); +#else /* !sun || !HAVE_GETCWD */ + while (max_len < G_MAXULONG / 2) + { + g_free (buffer); + buffer = g_new (gchar, max_len + 1); + *buffer = 0; + dir = getcwd (buffer, max_len); + + if (dir || errno != ERANGE) + break; + + max_len *= 2; + } +#endif /* !sun || !HAVE_GETCWD */ + + if (!dir || !*buffer) + { + /* hm, should we g_error() out here? + * this can happen if e.g. "./" has mode \0000 + */ + buffer[0] = G_DIR_SEPARATOR; + buffer[1] = 0; + } + + dir = g_strdup (buffer); + g_free (buffer); + + return dir; +#endif /* !Win32 */ +} + +/** + * g_getenv: + * @variable: the environment variable to get, in the GLib file name encoding. + * + * Returns the value of an environment variable. The name and value + * are in the GLib file name encoding. On UNIX, this means the actual + * bytes which might or might not be in some consistent character set + * and encoding. On Windows, it is in UTF-8. On Windows, in case the + * environment variable's value contains references to other + * environment variables, they are expanded. + * + * Return value: the value of the environment variable, or %NULL if + * the environment variable is not found. The returned string may be + * overwritten by the next call to g_getenv(), g_setenv() or + * g_unsetenv(). + **/ +const gchar * +g_getenv (const gchar *variable) +{ +#ifndef G_OS_WIN32 + + g_return_val_if_fail (variable != NULL, NULL); + + return getenv (variable); + +#else /* G_OS_WIN32 */ + + GQuark quark; + gchar *value; + wchar_t dummy[2], *wname, *wvalue; + int len; + + g_return_val_if_fail (variable != NULL, NULL); + g_return_val_if_fail (g_utf8_validate (variable, -1, NULL), NULL); + + /* On Windows NT, it is relatively typical that environment + * variables contain references to other environment variables. If + * so, use ExpandEnvironmentStrings(). (In an ideal world, such + * environment variables would be stored in the Registry as + * REG_EXPAND_SZ type values, and would then get automatically + * expanded before a program sees them. But there is broken software + * that stores environment variables as REG_SZ values even if they + * contain references to other environment variables.) + */ + + wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL); + + len = GetEnvironmentVariableW (wname, dummy, 2); + + if (len == 0) + { + g_free (wname); + return NULL; + } + else if (len == 1) + len = 2; + + wvalue = g_new (wchar_t, len); + + if (GetEnvironmentVariableW (wname, wvalue, len) != len - 1) + { + g_free (wname); + g_free (wvalue); + return NULL; + } + + if (wcschr (wvalue, L'%') != NULL) + { + wchar_t *tem = wvalue; + + len = ExpandEnvironmentStringsW (wvalue, dummy, 2); + + if (len > 0) + { + wvalue = g_new (wchar_t, len); + + if (ExpandEnvironmentStringsW (tem, wvalue, len) != len) + { + g_free (wvalue); + wvalue = tem; + } + else + g_free (tem); + } + } + + value = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL); + + g_free (wname); + g_free (wvalue); + + quark = g_quark_from_string (value); + g_free (value); + + return g_quark_to_string (quark); + +#endif /* G_OS_WIN32 */ +} + +/* _g_getenv_nomalloc + * this function does a getenv() without doing any kind of allocation + * through glib. it's suitable for chars <= 127 only (both, for the + * variable name and the contents) and for contents < 1024 chars in + * length. also, it aliases "" to a NULL return value. + **/ +const gchar* +_g_getenv_nomalloc (const gchar *variable, + gchar buffer[1024]) +{ + const gchar *retval = getenv (variable); + if (retval && retval[0]) + { + gint l = strlen (retval); + if (l < 1024) + { + strncpy (buffer, retval, l); + buffer[l] = 0; + return buffer; + } + } + return NULL; +} + +/** + * g_setenv: + * @variable: the environment variable to set, must not contain '='. + * @value: the value for to set the variable to. + * @overwrite: whether to change the variable if it already exists. + * + * Sets an environment variable. Both the variable's name and value + * should be in the GLib file name encoding. On UNIX, this means that + * they can be any sequence of bytes. On Windows, they should be in + * UTF-8. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * + * Returns: %FALSE if the environment variable couldn't be set. + * + * Since: 2.4 + */ +gboolean +g_setenv (const gchar *variable, + const gchar *value, + gboolean overwrite) +{ +#ifndef G_OS_WIN32 + + gint result; +#ifndef HAVE_SETENV + gchar *string; +#endif + + g_return_val_if_fail (variable != NULL, FALSE); + g_return_val_if_fail (strchr (variable, '=') == NULL, FALSE); + +#ifdef HAVE_SETENV + result = setenv (variable, value, overwrite); +#else + if (!overwrite && getenv (variable) != NULL) + return TRUE; + + /* This results in a leak when you overwrite existing + * settings. It would be fairly easy to fix this by keeping + * our own parallel array or hash table. + */ + string = g_strconcat (variable, "=", value, NULL); + result = putenv (string); +#endif + return result == 0; + +#else /* G_OS_WIN32 */ + + gboolean retval; + wchar_t *wname, *wvalue, *wassignment; + gchar *tem; + + g_return_val_if_fail (variable != NULL, FALSE); + g_return_val_if_fail (strchr (variable, '=') == NULL, FALSE); + g_return_val_if_fail (g_utf8_validate (variable, -1, NULL), FALSE); + g_return_val_if_fail (g_utf8_validate (value, -1, NULL), FALSE); + + if (!overwrite && g_getenv (variable) != NULL) + return TRUE; + + /* We want to (if possible) set both the environment variable copy + * kept by the C runtime and the one kept by the system. + * + * We can't use only the C runtime's putenv or _wputenv() as that + * won't work for arbitrary Unicode strings in a "non-Unicode" app + * (with main() and not wmain()). In a "main()" app the C runtime + * initializes the C runtime's environment table by converting the + * real (wide char) environment variables to system codepage, thus + * breaking those that aren't representable in the system codepage. + * + * As the C runtime's putenv() will also set the system copy, we do + * the putenv() first, then call SetEnvironmentValueW ourselves. + */ + + wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL); + wvalue = g_utf8_to_utf16 (value, -1, NULL, NULL, NULL); + tem = g_strconcat (variable, "=", value, NULL); + wassignment = g_utf8_to_utf16 (tem, -1, NULL, NULL, NULL); + + g_free (tem); + _wputenv (wassignment); + g_free (wassignment); + + retval = (SetEnvironmentVariableW (wname, wvalue) != 0); + + g_free (wname); + g_free (wvalue); + + return retval; + +#endif /* G_OS_WIN32 */ +} + +#ifdef HAVE__NSGETENVIRON +#define environ (*_NSGetEnviron()) +#elif !defined(G_OS_WIN32) + +/* According to the Single Unix Specification, environ is not in + * any system header, although unistd.h often declares it. + */ +extern char **environ; +#endif + +/** + * g_unsetenv: + * @variable: the environment variable to remove, must not contain '='. + * + * Removes an environment variable from the environment. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * Furthermore, this function can't be guaranteed to operate in a + * threadsafe way. + * + * Since: 2.4 + **/ +void +g_unsetenv (const gchar *variable) +{ +#ifndef G_OS_WIN32 + +#ifdef HAVE_UNSETENV + g_return_if_fail (variable != NULL); + g_return_if_fail (strchr (variable, '=') == NULL); + + unsetenv (variable); +#else /* !HAVE_UNSETENV */ + int len; + gchar **e, **f; + + g_return_if_fail (variable != NULL); + g_return_if_fail (strchr (variable, '=') == NULL); + + len = strlen (variable); + + /* Mess directly with the environ array. + * This seems to be the only portable way to do this. + * + * Note that we remove *all* environment entries for + * the variable name, not just the first. + */ + e = f = environ; + while (*e != NULL) + { + if (strncmp (*e, variable, len) != 0 || (*e)[len] != '=') + { + *f = *e; + f++; + } + e++; + } + *f = NULL; +#endif /* !HAVE_UNSETENV */ + +#else /* G_OS_WIN32 */ + + wchar_t *wname, *wassignment; + gchar *tem; + + g_return_if_fail (variable != NULL); + g_return_if_fail (strchr (variable, '=') == NULL); + g_return_if_fail (g_utf8_validate (variable, -1, NULL)); + + wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL); + tem = g_strconcat (variable, "=", NULL); + wassignment = g_utf8_to_utf16 (tem, -1, NULL, NULL, NULL); + + g_free (tem); + _wputenv (wassignment); + g_free (wassignment); + + SetEnvironmentVariableW (wname, NULL); + + g_free (wname); + +#endif /* G_OS_WIN32 */ +} + +/** + * g_listenv: + * + * Gets the names of all variables set in the environment. + * + * Returns: (array zero-terminated=1) (transfer full): a %NULL-terminated list of strings which must be freed + * with g_strfreev(). + * + * Programs that want to be portable to Windows should typically use + * this function and g_getenv() instead of using the environ array + * from the C library directly. On Windows, the strings in the environ + * array are in system codepage encoding, while in most of the typical + * use cases for environment variables in GLib-using programs you want + * the UTF-8 encoding that this function and g_getenv() provide. + * + * Since: 2.8 + */ +gchar ** +g_listenv (void) +{ +#ifndef G_OS_WIN32 + gchar **result, *eq; + gint len, i, j; + + len = g_strv_length (environ); + result = g_new0 (gchar *, len + 1); + + j = 0; + for (i = 0; i < len; i++) + { + eq = strchr (environ[i], '='); + if (eq) + result[j++] = g_strndup (environ[i], eq - environ[i]); + } + + result[j] = NULL; + + return result; +#else + gchar **result, *eq; + gint len = 0, j; + wchar_t *p, *q; + + p = (wchar_t *) GetEnvironmentStringsW (); + if (p != NULL) + { + q = p; + while (*q) + { + q += wcslen (q) + 1; + len++; + } + } + result = g_new0 (gchar *, len + 1); + + j = 0; + q = p; + while (*q) + { + result[j] = g_utf16_to_utf8 (q, -1, NULL, NULL, NULL); + if (result[j] != NULL) + { + eq = strchr (result[j], '='); + if (eq && eq > result[j]) + { + *eq = '\0'; + j++; + } + else + g_free (result[j]); + } + q += wcslen (q) + 1; + } + result[j] = NULL; + FreeEnvironmentStringsW (p); + + return result; +#endif +} + +/** + * g_get_environ: + * + * Gets the list of environment variables for the current process. The + * list is %NULL terminated and each item in the list is of the form + * 'NAME=VALUE'. + * + * This is equivalent to direct access to the 'environ' global variable, + * except portable. + * + * The return value is freshly allocated and it should be freed with + * g_strfreev() when it is no longer needed. + * + * Returns: (array zero-terminated=1) (transfer full): the list of environment variables + * + * Since: 2.28 + */ +gchar ** +g_get_environ (void) +{ +#ifndef G_OS_WIN32 + return g_strdupv (environ); +#else + gunichar2 *strings; + gchar **result; + gint i, n; + + strings = GetEnvironmentStringsW (); + for (n = 0; strings[n]; n += wcslen (strings + n) + 1); + result = g_new (char *, n + 1); + for (i = 0; strings[i]; i += wcslen (strings + i) + 1) + result[i] = g_utf16_to_utf8 (strings + i, -1, NULL, NULL, NULL); + FreeEnvironmentStringsW (strings); + result[i] = NULL; + + return result; +#endif +} + +G_LOCK_DEFINE_STATIC (g_utils_global); + +static gchar *g_tmp_dir = NULL; +static gchar *g_user_name = NULL; +static gchar *g_real_name = NULL; +static gchar *g_home_dir = NULL; +static gchar *g_host_name = NULL; + +#ifdef G_OS_WIN32 +/* System codepage versions of the above, kept at file level so that they, + * too, are produced only once. + */ +static gchar *g_tmp_dir_cp = NULL; +static gchar *g_user_name_cp = NULL; +static gchar *g_real_name_cp = NULL; +static gchar *g_home_dir_cp = NULL; +#endif + +static gchar *g_user_data_dir = NULL; +static gchar **g_system_data_dirs = NULL; +static gchar *g_user_cache_dir = NULL; +static gchar *g_user_config_dir = NULL; +static gchar **g_system_config_dirs = NULL; + +static gchar **g_user_special_dirs = NULL; + +/* fifteen minutes of fame for everybody */ +#define G_USER_DIRS_EXPIRE 15 * 60 + +#ifdef G_OS_WIN32 + +static gchar * +get_special_folder (int csidl) +{ + wchar_t path[MAX_PATH+1]; + HRESULT hr; + LPITEMIDLIST pidl = NULL; + BOOL b; + gchar *retval = NULL; + + hr = SHGetSpecialFolderLocation (NULL, csidl, &pidl); + if (hr == S_OK) + { + b = SHGetPathFromIDListW (pidl, path); + if (b) + retval = g_utf16_to_utf8 (path, -1, NULL, NULL, NULL); + CoTaskMemFree (pidl); + } + return retval; +} + +static char * +get_windows_directory_root (void) +{ + wchar_t wwindowsdir[MAX_PATH]; + + if (GetWindowsDirectoryW (wwindowsdir, G_N_ELEMENTS (wwindowsdir))) + { + /* Usually X:\Windows, but in terminal server environments + * might be an UNC path, AFAIK. + */ + char *windowsdir = g_utf16_to_utf8 (wwindowsdir, -1, NULL, NULL, NULL); + char *p; + + if (windowsdir == NULL) + return g_strdup ("C:\\"); + + p = (char *) g_path_skip_root (windowsdir); + if (G_IS_DIR_SEPARATOR (p[-1]) && p[-2] != ':') + p--; + *p = '\0'; + return windowsdir; + } + else + return g_strdup ("C:\\"); +} + +#endif + +/* HOLDS: g_utils_global_lock */ +static void +g_get_any_init_do (void) +{ + gchar hostname[100]; + + g_tmp_dir = g_strdup (g_getenv ("TMPDIR")); + if (g_tmp_dir == NULL || *g_tmp_dir == '\0') + g_tmp_dir = g_strdup (g_getenv ("TMP")); + if (g_tmp_dir == NULL || *g_tmp_dir == '\0') + g_tmp_dir = g_strdup (g_getenv ("TEMP")); + +#ifdef G_OS_WIN32 + if (g_tmp_dir == NULL || *g_tmp_dir == '\0') + g_tmp_dir = get_windows_directory_root (); +#else +#ifdef P_tmpdir + if (g_tmp_dir == NULL || *g_tmp_dir == '\0') + { + gsize k; + g_tmp_dir = g_strdup (P_tmpdir); + k = strlen (g_tmp_dir); + if (k > 1 && G_IS_DIR_SEPARATOR (g_tmp_dir[k - 1])) + g_tmp_dir[k - 1] = '\0'; + } +#endif + + if (g_tmp_dir == NULL || *g_tmp_dir == '\0') + { + g_tmp_dir = g_strdup ("/tmp"); + } +#endif /* !G_OS_WIN32 */ + +#ifdef G_OS_WIN32 + /* We check $HOME first for Win32, though it is a last resort for Unix + * where we prefer the results of getpwuid(). + */ + g_home_dir = g_strdup (g_getenv ("HOME")); + + /* Only believe HOME if it is an absolute path and exists */ + if (g_home_dir) + { + if (!(g_path_is_absolute (g_home_dir) && + g_file_test (g_home_dir, G_FILE_TEST_IS_DIR))) + { + g_free (g_home_dir); + g_home_dir = NULL; + } + } + + /* In case HOME is Unix-style (it happens), convert it to + * Windows style. + */ + if (g_home_dir) + { + gchar *p; + while ((p = strchr (g_home_dir, '/')) != NULL) + *p = '\\'; + } + + if (!g_home_dir) + { + /* USERPROFILE is probably the closest equivalent to $HOME? */ + if (g_getenv ("USERPROFILE") != NULL) + g_home_dir = g_strdup (g_getenv ("USERPROFILE")); + } + + if (!g_home_dir) + g_home_dir = get_special_folder (CSIDL_PROFILE); + + if (!g_home_dir) + g_home_dir = get_windows_directory_root (); +#endif /* G_OS_WIN32 */ + +#ifdef HAVE_PWD_H + { + struct passwd *pw = NULL; + gpointer buffer = NULL; + gint error; + gchar *logname; + +# if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R) + struct passwd pwd; +# ifdef _SC_GETPW_R_SIZE_MAX + /* This reurns the maximum length */ + glong bufsize = sysconf (_SC_GETPW_R_SIZE_MAX); + + if (bufsize < 0) + bufsize = 64; +# else /* _SC_GETPW_R_SIZE_MAX */ + glong bufsize = 64; +# endif /* _SC_GETPW_R_SIZE_MAX */ + + logname = (gchar *) g_getenv ("LOGNAME"); + + do + { + g_free (buffer); + /* we allocate 6 extra bytes to work around a bug in + * Mac OS < 10.3. See #156446 + */ + buffer = g_malloc (bufsize + 6); + errno = 0; + +# ifdef HAVE_POSIX_GETPWUID_R + if (logname) { + error = getpwnam_r (logname, &pwd, buffer, bufsize, &pw); + if (!pw || (pw->pw_uid != getuid ())) { + /* LOGNAME is lying, fall back to looking up the uid */ + error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); + } + } else { + error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); + } + error = error < 0 ? errno : error; +# else /* HAVE_NONPOSIX_GETPWUID_R */ + /* HPUX 11 falls into the HAVE_POSIX_GETPWUID_R case */ +# if defined(_AIX) || defined(__hpux) + error = getpwuid_r (getuid (), &pwd, buffer, bufsize); + pw = error == 0 ? &pwd : NULL; +# else /* !_AIX */ + if (logname) { + pw = getpwnam_r (logname, &pwd, buffer, bufsize); + if (!pw || (pw->pw_uid != getuid ())) { + /* LOGNAME is lying, fall back to looking up the uid */ + pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); + } + } else { + pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); + } + error = pw ? 0 : errno; +# endif /* !_AIX */ +# endif /* HAVE_NONPOSIX_GETPWUID_R */ + + if (!pw) + { + /* we bail out prematurely if the user id can't be found + * (should be pretty rare case actually), or if the buffer + * should be sufficiently big and lookups are still not + * successful. + */ + if (error == 0 || error == ENOENT) + { + g_warning ("getpwuid_r(): failed due to unknown user id (%lu)", + (gulong) getuid ()); + break; + } + if (bufsize > 32 * 1024) + { + g_warning ("getpwuid_r(): failed due to: %s.", + g_strerror (error)); + break; + } + + bufsize *= 2; + } + } + while (!pw); +# endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */ + + if (!pw) + { + setpwent (); + pw = getpwuid (getuid ()); + endpwent (); + } + if (pw) + { + g_user_name = g_strdup (pw->pw_name); + + if (pw->pw_gecos && *pw->pw_gecos != '\0') + { + gchar **gecos_fields; + gchar **name_parts; + + /* split the gecos field and substitute '&' */ + gecos_fields = g_strsplit (pw->pw_gecos, ",", 0); + name_parts = g_strsplit (gecos_fields[0], "&", 0); + pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]); + g_real_name = g_strjoinv (pw->pw_name, name_parts); + g_strfreev (gecos_fields); + g_strfreev (name_parts); + } + + if (!g_home_dir) + g_home_dir = g_strdup (pw->pw_dir); + } + g_free (buffer); + } + +#else /* !HAVE_PWD_H */ + +#ifdef G_OS_WIN32 + { + guint len = UNLEN+1; + wchar_t buffer[UNLEN+1]; + + if (GetUserNameW (buffer, (LPDWORD) &len)) + { + g_user_name = g_utf16_to_utf8 (buffer, -1, NULL, NULL, NULL); + g_real_name = g_strdup (g_user_name); + } + } +#endif /* G_OS_WIN32 */ + +#endif /* !HAVE_PWD_H */ + +#ifndef G_OS_WIN32 + if (!g_home_dir) + g_home_dir = g_strdup (g_getenv ("HOME")); +#endif + +#ifdef __EMX__ + /* change '\\' in %HOME% to '/' */ + g_strdelimit (g_home_dir, "\\",'/'); +#endif + if (!g_user_name) + g_user_name = g_strdup ("somebody"); + if (!g_real_name) + g_real_name = g_strdup ("Unknown"); + + { +#ifndef G_OS_WIN32 + gboolean hostname_fail = (gethostname (hostname, sizeof (hostname)) == -1); +#else + DWORD size = sizeof (hostname); + gboolean hostname_fail = (!GetComputerName (hostname, &size)); +#endif + g_host_name = g_strdup (hostname_fail ? "localhost" : hostname); + } + +#ifdef G_OS_WIN32 + g_tmp_dir_cp = g_locale_from_utf8 (g_tmp_dir, -1, NULL, NULL, NULL); + g_user_name_cp = g_locale_from_utf8 (g_user_name, -1, NULL, NULL, NULL); + g_real_name_cp = g_locale_from_utf8 (g_real_name, -1, NULL, NULL, NULL); + + if (!g_tmp_dir_cp) + g_tmp_dir_cp = g_strdup ("\\"); + if (!g_user_name_cp) + g_user_name_cp = g_strdup ("somebody"); + if (!g_real_name_cp) + g_real_name_cp = g_strdup ("Unknown"); + + /* home_dir might be NULL, unlike tmp_dir, user_name and + * real_name. + */ + if (g_home_dir) + g_home_dir_cp = g_locale_from_utf8 (g_home_dir, -1, NULL, NULL, NULL); + else + g_home_dir_cp = NULL; +#endif /* G_OS_WIN32 */ +} + +static inline void +g_get_any_init (void) +{ + if (!g_tmp_dir) + g_get_any_init_do (); +} + +static inline void +g_get_any_init_locked (void) +{ + G_LOCK (g_utils_global); + g_get_any_init (); + G_UNLOCK (g_utils_global); +} + + +/** + * g_get_user_name: + * + * Gets the user name of the current user. The encoding of the returned + * string is system-defined. On UNIX, it might be the preferred file name + * encoding, or something else, and there is no guarantee that it is even + * consistent on a machine. On Windows, it is always UTF-8. + * + * Returns: the user name of the current user. + */ +const gchar * +g_get_user_name (void) +{ + g_get_any_init_locked (); + return g_user_name; +} + +/** + * g_get_real_name: + * + * Gets the real name of the user. This usually comes from the user's entry + * in the passwd file. The encoding of the returned + * string is system-defined. (On Windows, it is, however, always UTF-8.) + * If the real user name cannot be determined, the string "Unknown" is + * returned. + * + * Returns: the user's real name. + */ +const gchar * +g_get_real_name (void) +{ + g_get_any_init_locked (); + return g_real_name; +} + +/** + * g_get_home_dir: + * + * Gets the current user's home directory as defined in the + * password database. + * + * Note that in contrast to traditional UNIX tools, this function + * prefers passwd entries over the HOME + * environment variable. + * + * One of the reasons for this decision is that applications in many + * cases need special handling to deal with the case where + * HOME is + * + * Not owned by the user + * Not writeable + * Not even readable + * + * Since applications are in general not written + * to deal with these situations it was considered better to make + * g_get_home_dir() not pay attention to HOME and to + * return the real home directory for the user. If applications + * want to pay attention to HOME, they can do: + * |[ + * const char *homedir = g_getenv ("HOME"); + * if (!homedir) + * homedir = g_get_home_dir (); + * ]| + * + * Returns: the current user's home directory + */ +const gchar * +g_get_home_dir (void) +{ + g_get_any_init_locked (); + return g_home_dir; +} + +/** + * g_get_tmp_dir: + * + * Gets the directory to use for temporary files. This is found from + * inspecting the environment variables TMPDIR, + * TMP, and TEMP in that order. If none + * of those are defined "/tmp" is returned on UNIX and "C:\" on Windows. + * The encoding of the returned string is system-defined. On Windows, + * it is always UTF-8. The return value is never %NULL or the empty string. + * + * Returns: the directory to use for temporary files. + */ +const gchar * +g_get_tmp_dir (void) +{ + g_get_any_init_locked (); + return g_tmp_dir; +} + +/** + * g_get_host_name: + * + * Return a name for the machine. + * + * The returned name is not necessarily a fully-qualified domain name, + * or even present in DNS or some other name service at all. It need + * not even be unique on your local network or site, but usually it + * is. Callers should not rely on the return value having any specific + * properties like uniqueness for security purposes. Even if the name + * of the machine is changed while an application is running, the + * return value from this function does not change. The returned + * string is owned by GLib and should not be modified or freed. If no + * name can be determined, a default fixed string "localhost" is + * returned. + * + * Returns: the host name of the machine. + * + * Since: 2.8 + */ +const gchar * +g_get_host_name (void) +{ + g_get_any_init_locked (); + return g_host_name; +} + +G_LOCK_DEFINE_STATIC (g_prgname); +static gchar *g_prgname = NULL; + +/** + * g_get_prgname: + * + * Gets the name of the program. This name should not + * be localized, contrast with g_get_application_name(). + * (If you are using GDK or GTK+ the program name is set in gdk_init(), + * which is called by gtk_init(). The program name is found by taking + * the last component of argv[0].) + * + * Returns: the name of the program. The returned string belongs + * to GLib and must not be modified or freed. + */ +gchar* +g_get_prgname (void) +{ + gchar* retval; + + G_LOCK (g_prgname); +#ifdef G_OS_WIN32 + if (g_prgname == NULL) + { + static gboolean beenhere = FALSE; + + if (!beenhere) + { + gchar *utf8_buf = NULL; + wchar_t buf[MAX_PATH+1]; + + beenhere = TRUE; + if (GetModuleFileNameW (GetModuleHandle (NULL), + buf, G_N_ELEMENTS (buf)) > 0) + utf8_buf = g_utf16_to_utf8 (buf, -1, NULL, NULL, NULL); + + if (utf8_buf) + { + g_prgname = g_path_get_basename (utf8_buf); + g_free (utf8_buf); + } + } + } +#endif + retval = g_prgname; + G_UNLOCK (g_prgname); + + return retval; +} + +/** + * g_set_prgname: + * @prgname: the name of the program. + * + * Sets the name of the program. This name should not + * be localized, contrast with g_set_application_name(). Note that for + * thread-safety reasons this function can only be called once. + */ +void +g_set_prgname (const gchar *prgname) +{ + G_LOCK (g_prgname); + g_free (g_prgname); + g_prgname = g_strdup (prgname); + G_UNLOCK (g_prgname); +} + +G_LOCK_DEFINE_STATIC (g_application_name); +static gchar *g_application_name = NULL; + +/** + * g_get_application_name: + * + * Gets a human-readable name for the application, as set by + * g_set_application_name(). This name should be localized if + * possible, and is intended for display to the user. Contrast with + * g_get_prgname(), which gets a non-localized name. If + * g_set_application_name() has not been called, returns the result of + * g_get_prgname() (which may be %NULL if g_set_prgname() has also not + * been called). + * + * Return value: human-readable application name. may return %NULL + * + * Since: 2.2 + **/ +const gchar * +g_get_application_name (void) +{ + gchar* retval; + + G_LOCK (g_application_name); + retval = g_application_name; + G_UNLOCK (g_application_name); + + if (retval == NULL) + return g_get_prgname (); + + return retval; +} + +/** + * g_set_application_name: + * @application_name: localized name of the application + * + * Sets a human-readable name for the application. This name should be + * localized if possible, and is intended for display to the user. + * Contrast with g_set_prgname(), which sets a non-localized name. + * g_set_prgname() will be called automatically by gtk_init(), + * but g_set_application_name() will not. + * + * Note that for thread safety reasons, this function can only + * be called once. + * + * The application name will be used in contexts such as error messages, + * or when displaying an application's name in the task list. + * + * Since: 2.2 + **/ +void +g_set_application_name (const gchar *application_name) +{ + gboolean already_set = FALSE; + + G_LOCK (g_application_name); + if (g_application_name) + already_set = TRUE; + else + g_application_name = g_strdup (application_name); + G_UNLOCK (g_application_name); + + if (already_set) + g_warning ("g_set_application_name() called multiple times"); +} + +/** + * g_get_user_data_dir: + * + * Returns a base directory in which to access application data such + * as icons that is customized for a particular user. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification. + * In this case the directory retrieved will be XDG_DATA_HOME. + * + * On Windows this is the folder to use for local (as opposed to + * roaming) application data. See documentation for + * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as + * what g_get_user_config_dir() returns. + * + * Return value: a string owned by GLib that must not be modified + * or freed. + * Since: 2.6 + **/ +const gchar * +g_get_user_data_dir (void) +{ + gchar *data_dir; + + G_LOCK (g_utils_global); + + if (!g_user_data_dir) + { +#ifdef G_OS_WIN32 + data_dir = get_special_folder (CSIDL_LOCAL_APPDATA); +#else + data_dir = (gchar *) g_getenv ("XDG_DATA_HOME"); + + if (data_dir && data_dir[0]) + data_dir = g_strdup (data_dir); +#endif + if (!data_dir || !data_dir[0]) + { + g_get_any_init (); + + if (g_home_dir) + data_dir = g_build_filename (g_home_dir, ".local", + "share", NULL); + else + data_dir = g_build_filename (g_tmp_dir, g_user_name, ".local", + "share", NULL); + } + + g_user_data_dir = data_dir; + } + else + data_dir = g_user_data_dir; + + G_UNLOCK (g_utils_global); + + return data_dir; +} + +static void +g_init_user_config_dir (void) +{ + gchar *config_dir; + + if (!g_user_config_dir) + { +#ifdef G_OS_WIN32 + config_dir = get_special_folder (CSIDL_LOCAL_APPDATA); +#else + config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME"); + + if (config_dir && config_dir[0]) + config_dir = g_strdup (config_dir); +#endif + if (!config_dir || !config_dir[0]) + { + g_get_any_init (); + + if (g_home_dir) + config_dir = g_build_filename (g_home_dir, ".config", NULL); + else + config_dir = g_build_filename (g_tmp_dir, g_user_name, ".config", NULL); + } + + g_user_config_dir = config_dir; + } +} + +/** + * g_get_user_config_dir: + * + * Returns a base directory in which to store user-specific application + * configuration information such as user preferences and settings. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification. + * In this case the directory retrieved will be XDG_CONFIG_HOME. + * + * On Windows this is the folder to use for local (as opposed to + * roaming) application data. See documentation for + * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as + * what g_get_user_data_dir() returns. + * + * Return value: a string owned by GLib that must not be modified + * or freed. + * Since: 2.6 + **/ +const gchar * +g_get_user_config_dir (void) +{ + G_LOCK (g_utils_global); + + g_init_user_config_dir (); + + G_UNLOCK (g_utils_global); + + return g_user_config_dir; +} + +/** + * g_get_user_cache_dir: + * + * Returns a base directory in which to store non-essential, cached + * data specific to particular user. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification. + * In this case the directory retrieved will be XDG_CACHE_HOME. + * + * On Windows is the directory that serves as a common repository for + * temporary Internet files. A typical path is + * C:\Documents and Settings\username\Local Settings\Temporary Internet Files. + * See documentation for CSIDL_INTERNET_CACHE. + * + * Return value: a string owned by GLib that must not be modified + * or freed. + * Since: 2.6 + **/ +const gchar * +g_get_user_cache_dir (void) +{ + gchar *cache_dir; + + G_LOCK (g_utils_global); + + if (!g_user_cache_dir) + { +#ifdef G_OS_WIN32 + cache_dir = get_special_folder (CSIDL_INTERNET_CACHE); /* XXX correct? */ +#else + cache_dir = (gchar *) g_getenv ("XDG_CACHE_HOME"); + + if (cache_dir && cache_dir[0]) + cache_dir = g_strdup (cache_dir); +#endif + if (!cache_dir || !cache_dir[0]) + { + g_get_any_init (); + + if (g_home_dir) + cache_dir = g_build_filename (g_home_dir, ".cache", NULL); + else + cache_dir = g_build_filename (g_tmp_dir, g_user_name, ".cache", NULL); + } + g_user_cache_dir = cache_dir; + } + else + cache_dir = g_user_cache_dir; + + G_UNLOCK (g_utils_global); + + return cache_dir; +} + +/** + * g_get_user_runtime_dir: + * + * Returns a directory that is unique to the current user on the local + * system. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification. This is the directory + * specified in the XDG_RUNTIME_DIR environment variable. + * In the case that this variable is not set, GLib will issue a warning + * message to stderr and return the value of g_get_user_cache_dir(). + * + * On Windows this is the folder to use for local (as opposed to + * roaming) application data. See documentation for + * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as + * what g_get_user_config_dir() returns. + * + * Returns: a string owned by GLib that must not be modified or freed. + * + * Since: 2.28 + **/ +const gchar * +g_get_user_runtime_dir (void) +{ +#ifndef G_OS_WIN32 + static const gchar *runtime_dir; + static gsize initialised; + + if (g_once_init_enter (&initialised)) + { + runtime_dir = g_strdup (getenv ("XDG_RUNTIME_DIR")); + + g_once_init_leave (&initialised, 1); + } + + if (runtime_dir) + return runtime_dir; + + /* Both fallback for UNIX and the default + * in Windows: use the user cache directory. + */ +#endif + + return g_get_user_cache_dir (); +} + +#ifdef HAVE_CARBON + +static gchar * +find_folder (OSType type) +{ + gchar *filename = NULL; + FSRef found; + + if (FSFindFolder (kUserDomain, type, kDontCreateFolder, &found) == noErr) + { + CFURLRef url = CFURLCreateFromFSRef (kCFAllocatorSystemDefault, &found); + + if (url) + { + CFStringRef path = CFURLCopyFileSystemPath (url, kCFURLPOSIXPathStyle); + + if (path) + { + filename = g_strdup (CFStringGetCStringPtr (path, kCFStringEncodingUTF8)); + + if (! filename) + { + filename = g_new0 (gchar, CFStringGetLength (path) * 3 + 1); + + CFStringGetCString (path, filename, + CFStringGetLength (path) * 3 + 1, + kCFStringEncodingUTF8); + } + + CFRelease (path); + } + + CFRelease (url); + } + } + + return filename; +} + +static void +load_user_special_dirs (void) +{ + g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = find_folder (kDesktopFolderType); + g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = find_folder (kDocumentsFolderType); + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = find_folder (kDesktopFolderType); /* XXX correct ? */ + g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = find_folder (kMusicDocumentsFolderType); + g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = find_folder (kPictureDocumentsFolderType); + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = NULL; + g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = find_folder (kMovieDocumentsFolderType); +} + +#endif /* HAVE_CARBON */ + +#if defined(G_OS_WIN32) +static void +load_user_special_dirs (void) +{ + typedef HRESULT (WINAPI *t_SHGetKnownFolderPath) (const GUID *rfid, + DWORD dwFlags, + HANDLE hToken, + PWSTR *ppszPath); + t_SHGetKnownFolderPath p_SHGetKnownFolderPath; + + static const GUID FOLDERID_Downloads = + { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } }; + static const GUID FOLDERID_Public = + { 0xDFDF76A2, 0xC82A, 0x4D63, { 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85 } }; + + wchar_t *wcp; + + p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (GetModuleHandle ("shell32.dll"), + "SHGetKnownFolderPath"); + + g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = get_special_folder (CSIDL_DESKTOPDIRECTORY); + g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = get_special_folder (CSIDL_PERSONAL); + + if (p_SHGetKnownFolderPath == NULL) + { + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = get_special_folder (CSIDL_DESKTOPDIRECTORY); + } + else + { + wcp = NULL; + (*p_SHGetKnownFolderPath) (&FOLDERID_Downloads, 0, NULL, &wcp); + if (wcp) + { + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = g_utf16_to_utf8 (wcp, -1, NULL, NULL, NULL); + if (g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] == NULL) + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = get_special_folder (CSIDL_DESKTOPDIRECTORY); + CoTaskMemFree (wcp); + } + else + g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = get_special_folder (CSIDL_DESKTOPDIRECTORY); + } + + g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = get_special_folder (CSIDL_MYMUSIC); + g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = get_special_folder (CSIDL_MYPICTURES); + + if (p_SHGetKnownFolderPath == NULL) + { + /* XXX */ + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = get_special_folder (CSIDL_COMMON_DOCUMENTS); + } + else + { + wcp = NULL; + (*p_SHGetKnownFolderPath) (&FOLDERID_Public, 0, NULL, &wcp); + if (wcp) + { + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = g_utf16_to_utf8 (wcp, -1, NULL, NULL, NULL); + if (g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] == NULL) + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = get_special_folder (CSIDL_COMMON_DOCUMENTS); + CoTaskMemFree (wcp); + } + else + g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = get_special_folder (CSIDL_COMMON_DOCUMENTS); + } + + g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = get_special_folder (CSIDL_TEMPLATES); + g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = get_special_folder (CSIDL_MYVIDEO); +} +#endif /* G_OS_WIN32 */ + +static void g_init_user_config_dir (void); + +#if defined(G_OS_UNIX) && !defined(HAVE_CARBON) + +/* adapted from xdg-user-dir-lookup.c + * + * Copyright (C) 2007 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +static void +load_user_special_dirs (void) +{ + gchar *config_file; + gchar *data; + gchar **lines; + gint n_lines, i; + + g_init_user_config_dir (); + config_file = g_build_filename (g_user_config_dir, + "user-dirs.dirs", + NULL); + + if (!g_file_get_contents (config_file, &data, NULL, NULL)) + { + g_free (config_file); + return; + } + + lines = g_strsplit (data, "\n", -1); + n_lines = g_strv_length (lines); + g_free (data); + + for (i = 0; i < n_lines; i++) + { + gchar *buffer = lines[i]; + gchar *d, *p; + gint len; + gboolean is_relative = FALSE; + GUserDirectory directory; + + /* Remove newline at end */ + len = strlen (buffer); + if (len > 0 && buffer[len - 1] == '\n') + buffer[len - 1] = 0; + + p = buffer; + while (*p == ' ' || *p == '\t') + p++; + + if (strncmp (p, "XDG_DESKTOP_DIR", strlen ("XDG_DESKTOP_DIR")) == 0) + { + directory = G_USER_DIRECTORY_DESKTOP; + p += strlen ("XDG_DESKTOP_DIR"); + } + else if (strncmp (p, "XDG_DOCUMENTS_DIR", strlen ("XDG_DOCUMENTS_DIR")) == 0) + { + directory = G_USER_DIRECTORY_DOCUMENTS; + p += strlen ("XDG_DOCUMENTS_DIR"); + } + else if (strncmp (p, "XDG_DOWNLOAD_DIR", strlen ("XDG_DOWNLOAD_DIR")) == 0) + { + directory = G_USER_DIRECTORY_DOWNLOAD; + p += strlen ("XDG_DOWNLOAD_DIR"); + } + else if (strncmp (p, "XDG_MUSIC_DIR", strlen ("XDG_MUSIC_DIR")) == 0) + { + directory = G_USER_DIRECTORY_MUSIC; + p += strlen ("XDG_MUSIC_DIR"); + } + else if (strncmp (p, "XDG_PICTURES_DIR", strlen ("XDG_PICTURES_DIR")) == 0) + { + directory = G_USER_DIRECTORY_PICTURES; + p += strlen ("XDG_PICTURES_DIR"); + } + else if (strncmp (p, "XDG_PUBLICSHARE_DIR", strlen ("XDG_PUBLICSHARE_DIR")) == 0) + { + directory = G_USER_DIRECTORY_PUBLIC_SHARE; + p += strlen ("XDG_PUBLICSHARE_DIR"); + } + else if (strncmp (p, "XDG_TEMPLATES_DIR", strlen ("XDG_TEMPLATES_DIR")) == 0) + { + directory = G_USER_DIRECTORY_TEMPLATES; + p += strlen ("XDG_TEMPLATES_DIR"); + } + else if (strncmp (p, "XDG_VIDEOS_DIR", strlen ("XDG_VIDEOS_DIR")) == 0) + { + directory = G_USER_DIRECTORY_VIDEOS; + p += strlen ("XDG_VIDEOS_DIR"); + } + else + continue; + + while (*p == ' ' || *p == '\t') + p++; + + if (*p != '=') + continue; + p++; + + while (*p == ' ' || *p == '\t') + p++; + + if (*p != '"') + continue; + p++; + + if (strncmp (p, "$HOME", 5) == 0) + { + p += 5; + is_relative = TRUE; + } + else if (*p != '/') + continue; + + d = strrchr (p, '"'); + if (!d) + continue; + *d = 0; + + d = p; + + /* remove trailing slashes */ + len = strlen (d); + if (d[len - 1] == '/') + d[len - 1] = 0; + + if (is_relative) + { + g_get_any_init (); + g_user_special_dirs[directory] = g_build_filename (g_home_dir, d, NULL); + } + else + g_user_special_dirs[directory] = g_strdup (d); + } + + g_strfreev (lines); + g_free (config_file); +} + +#endif /* G_OS_UNIX && !HAVE_CARBON */ + + +/** + * g_reload_user_special_dirs_cache: + * + * Resets the cache used for g_get_user_special_dir(), so + * that the latest on-disk version is used. Call this only + * if you just changed the data on disk yourself. + * + * Due to threadsafety issues this may cause leaking of strings + * that were previously returned from g_get_user_special_dir() + * that can't be freed. We ensure to only leak the data for + * the directories that actually changed value though. + * + * Since: 2.22 + */ +void +g_reload_user_special_dirs_cache (void) +{ + int i; + + G_LOCK (g_utils_global); + + if (g_user_special_dirs != NULL) + { + /* save a copy of the pointer, to check if some memory can be preserved */ + char **old_g_user_special_dirs = g_user_special_dirs; + char *old_val; + + /* recreate and reload our cache */ + g_user_special_dirs = g_new0 (gchar *, G_USER_N_DIRECTORIES); + load_user_special_dirs (); + + /* only leak changed directories */ + for (i = 0; i < G_USER_N_DIRECTORIES; i++) + { + old_val = old_g_user_special_dirs[i]; + if (g_strcmp0 (old_val, g_user_special_dirs[i]) == 0) + { + /* don't leak */ + g_free (g_user_special_dirs[i]); + g_user_special_dirs[i] = old_val; + } + else + g_free (old_val); + } + + /* free the old array */ + g_free (old_g_user_special_dirs); + } + + G_UNLOCK (g_utils_global); +} + +/** + * g_get_user_special_dir: + * @directory: the logical id of special directory + * + * Returns the full path of a special directory using its logical id. + * + * On Unix this is done using the XDG special user directories. + * For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP + * falls back to $HOME/Desktop when XDG special + * user directories have not been set up. + * + * Depending on the platform, the user might be able to change the path + * of the special directory without requiring the session to restart; GLib + * will not reflect any change once the special directories are loaded. + * + * Return value: the path to the specified special directory, or %NULL + * if the logical id was not found. The returned string is owned by + * GLib and should not be modified or freed. + * + * Since: 2.14 + */ +const gchar * +g_get_user_special_dir (GUserDirectory directory) +{ + g_return_val_if_fail (directory >= G_USER_DIRECTORY_DESKTOP && + directory < G_USER_N_DIRECTORIES, NULL); + + G_LOCK (g_utils_global); + + if (G_UNLIKELY (g_user_special_dirs == NULL)) + { + g_user_special_dirs = g_new0 (gchar *, G_USER_N_DIRECTORIES); + + load_user_special_dirs (); + + /* Special-case desktop for historical compatibility */ + if (g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] == NULL) + { + g_get_any_init (); + + g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = + g_build_filename (g_home_dir, "Desktop", NULL); + } + } + + G_UNLOCK (g_utils_global); + + return g_user_special_dirs[directory]; +} + +#ifdef G_OS_WIN32 + +#undef g_get_system_data_dirs + +static HMODULE +get_module_for_address (gconstpointer address) +{ + /* Holds the g_utils_global lock */ + + static gboolean beenhere = FALSE; + typedef BOOL (WINAPI *t_GetModuleHandleExA) (DWORD, LPCTSTR, HMODULE *); + static t_GetModuleHandleExA p_GetModuleHandleExA = NULL; + HMODULE hmodule = NULL; + + if (!address) + return NULL; + + if (!beenhere) + { + p_GetModuleHandleExA = + (t_GetModuleHandleExA) GetProcAddress (GetModuleHandle ("kernel32.dll"), + "GetModuleHandleExA"); + beenhere = TRUE; + } + + if (p_GetModuleHandleExA == NULL || + !(*p_GetModuleHandleExA) (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | + GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + address, &hmodule)) + { + MEMORY_BASIC_INFORMATION mbi; + VirtualQuery (address, &mbi, sizeof (mbi)); + hmodule = (HMODULE) mbi.AllocationBase; + } + + return hmodule; +} + +static gchar * +get_module_share_dir (gconstpointer address) +{ + HMODULE hmodule; + gchar *filename; + gchar *retval; + + hmodule = get_module_for_address (address); + if (hmodule == NULL) + return NULL; + + filename = g_win32_get_package_installation_directory_of_module (hmodule); + retval = g_build_filename (filename, "share", NULL); + g_free (filename); + + return retval; +} + +const gchar * const * +g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) +{ + GArray *data_dirs; + HMODULE hmodule; + static GHashTable *per_module_data_dirs = NULL; + gchar **retval; + gchar *p; + gchar *exe_root; + + if (address_of_function) + { + G_LOCK (g_utils_global); + hmodule = get_module_for_address (address_of_function); + if (hmodule != NULL) + { + if (per_module_data_dirs == NULL) + per_module_data_dirs = g_hash_table_new (NULL, NULL); + else + { + retval = g_hash_table_lookup (per_module_data_dirs, hmodule); + + if (retval != NULL) + { + G_UNLOCK (g_utils_global); + return (const gchar * const *) retval; + } + } + } + } + + data_dirs = g_array_new (TRUE, TRUE, sizeof (char *)); + + /* Documents and Settings\All Users\Application Data */ + p = get_special_folder (CSIDL_COMMON_APPDATA); + if (p) + g_array_append_val (data_dirs, p); + + /* Documents and Settings\All Users\Documents */ + p = get_special_folder (CSIDL_COMMON_DOCUMENTS); + if (p) + g_array_append_val (data_dirs, p); + + /* Using the above subfolders of Documents and Settings perhaps + * makes sense from a Windows perspective. + * + * But looking at the actual use cases of this function in GTK+ + * and GNOME software, what we really want is the "share" + * subdirectory of the installation directory for the package + * our caller is a part of. + * + * The address_of_function parameter, if non-NULL, points to a + * function in the calling module. Use that to determine that + * module's installation folder, and use its "share" subfolder. + * + * Additionally, also use the "share" subfolder of the installation + * locations of GLib and the .exe file being run. + * + * To guard against none of the above being what is really wanted, + * callers of this function should have Win32-specific code to look + * up their installation folder themselves, and handle a subfolder + * "share" of it in the same way as the folders returned from this + * function. + */ + + p = get_module_share_dir (address_of_function); + if (p) + g_array_append_val (data_dirs, p); + + if (glib_dll != NULL) + { + gchar *glib_root = g_win32_get_package_installation_directory_of_module (glib_dll); + p = g_build_filename (glib_root, "share", NULL); + if (p) + g_array_append_val (data_dirs, p); + g_free (glib_root); + } + + exe_root = g_win32_get_package_installation_directory_of_module (NULL); + p = g_build_filename (exe_root, "share", NULL); + if (p) + g_array_append_val (data_dirs, p); + g_free (exe_root); + + retval = (gchar **) g_array_free (data_dirs, FALSE); + + if (address_of_function) + { + if (hmodule != NULL) + g_hash_table_insert (per_module_data_dirs, hmodule, retval); + G_UNLOCK (g_utils_global); + } + + return (const gchar * const *) retval; +} + +#endif + +/** + * g_get_system_data_dirs: + * + * Returns an ordered list of base directories in which to access + * system-wide application data. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification + * In this case the list of directories retrieved will be XDG_DATA_DIRS. + * + * On Windows the first elements in the list are the Application Data + * and Documents folders for All Users. (These can be determined only + * on Windows 2000 or later and are not present in the list on other + * Windows versions.) See documentation for CSIDL_COMMON_APPDATA and + * CSIDL_COMMON_DOCUMENTS. + * + * Then follows the "share" subfolder in the installation folder for + * the package containing the DLL that calls this function, if it can + * be determined. + * + * Finally the list contains the "share" subfolder in the installation + * folder for GLib, and in the installation folder for the package the + * application's .exe file belongs to. + * + * The installation folders above are determined by looking up the + * folder where the module (DLL or EXE) in question is located. If the + * folder's name is "bin", its parent is used, otherwise the folder + * itself. + * + * Note that on Windows the returned list can vary depending on where + * this function is called. + * + * Return value: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must + * not be modified or freed. + * Since: 2.6 + **/ +const gchar * const * +g_get_system_data_dirs (void) +{ + gchar **data_dir_vector; + + G_LOCK (g_utils_global); + + if (!g_system_data_dirs) + { +#ifdef G_OS_WIN32 + data_dir_vector = (gchar **) g_win32_get_system_data_dirs_for_module (NULL); +#else + gchar *data_dirs = (gchar *) g_getenv ("XDG_DATA_DIRS"); + + if (!data_dirs || !data_dirs[0]) + data_dirs = "/usr/local/share/:/usr/share/"; + + data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0); +#endif + + g_system_data_dirs = data_dir_vector; + } + else + data_dir_vector = g_system_data_dirs; + + G_UNLOCK (g_utils_global); + + return (const gchar * const *) data_dir_vector; +} + +/** + * g_get_system_config_dirs: + * + * Returns an ordered list of base directories in which to access + * system-wide configuration information. + * + * On UNIX platforms this is determined using the mechanisms described in + * the + * XDG Base Directory Specification. + * In this case the list of directories retrieved will be XDG_CONFIG_DIRS. + * + * On Windows is the directory that contains application data for all users. + * A typical path is C:\Documents and Settings\All Users\Application Data. + * This folder is used for application data that is not user specific. + * For example, an application can store a spell-check dictionary, a database + * of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. + * This information will not roam and is available to anyone using the computer. + * + * Return value: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must + * not be modified or freed. + * Since: 2.6 + **/ +const gchar * const * +g_get_system_config_dirs (void) +{ + gchar *conf_dirs, **conf_dir_vector; + + G_LOCK (g_utils_global); + + if (!g_system_config_dirs) + { +#ifdef G_OS_WIN32 + conf_dirs = get_special_folder (CSIDL_COMMON_APPDATA); + if (conf_dirs) + { + conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0); + g_free (conf_dirs); + } + else + { + /* Return empty list */ + conf_dir_vector = g_strsplit ("", G_SEARCHPATH_SEPARATOR_S, 0); + } +#else + conf_dirs = (gchar *) g_getenv ("XDG_CONFIG_DIRS"); + + if (!conf_dirs || !conf_dirs[0]) + conf_dirs = "/etc/xdg"; + + conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0); +#endif + + g_system_config_dirs = conf_dir_vector; + } + else + conf_dir_vector = g_system_config_dirs; + G_UNLOCK (g_utils_global); + + return (const gchar * const *) conf_dir_vector; +} + +#ifndef G_OS_WIN32 + +static GHashTable *alias_table = NULL; + +/* read an alias file for the locales */ +static void +read_aliases (gchar *file) +{ + FILE *fp; + char buf[256]; + + if (!alias_table) + alias_table = g_hash_table_new (g_str_hash, g_str_equal); + fp = fopen (file,"r"); + if (!fp) + return; + while (fgets (buf, 256, fp)) + { + char *p, *q; + + g_strstrip (buf); + + /* Line is a comment */ + if ((buf[0] == '#') || (buf[0] == '\0')) + continue; + + /* Reads first column */ + for (p = buf, q = NULL; *p; p++) { + if ((*p == '\t') || (*p == ' ') || (*p == ':')) { + *p = '\0'; + q = p+1; + while ((*q == '\t') || (*q == ' ')) { + q++; + } + break; + } + } + /* The line only had one column */ + if (!q || *q == '\0') + continue; + + /* Read second column */ + for (p = q; *p; p++) { + if ((*p == '\t') || (*p == ' ')) { + *p = '\0'; + break; + } + } + + /* Add to alias table if necessary */ + if (!g_hash_table_lookup (alias_table, buf)) { + g_hash_table_insert (alias_table, g_strdup (buf), g_strdup (q)); + } + } + fclose (fp); +} + +#endif + +static char * +unalias_lang (char *lang) +{ +#ifndef G_OS_WIN32 + char *p; + int i; + + if (!alias_table) + read_aliases ("/usr/share/locale/locale.alias"); + + i = 0; + while ((p = g_hash_table_lookup (alias_table, lang)) && (strcmp (p, lang) != 0)) + { + lang = p; + if (i++ == 30) + { + static gboolean said_before = FALSE; + if (!said_before) + g_warning ("Too many alias levels for a locale, " + "may indicate a loop"); + said_before = TRUE; + return lang; + } + } +#endif + return lang; +} + +/* Mask for components of locale spec. The ordering here is from + * least significant to most significant + */ +enum +{ + COMPONENT_CODESET = 1 << 0, + COMPONENT_TERRITORY = 1 << 1, + COMPONENT_MODIFIER = 1 << 2 +}; + +/* Break an X/Open style locale specification into components + */ +static guint +explode_locale (const gchar *locale, + gchar **language, + gchar **territory, + gchar **codeset, + gchar **modifier) +{ + const gchar *uscore_pos; + const gchar *at_pos; + const gchar *dot_pos; + + guint mask = 0; + + uscore_pos = strchr (locale, '_'); + dot_pos = strchr (uscore_pos ? uscore_pos : locale, '.'); + at_pos = strchr (dot_pos ? dot_pos : (uscore_pos ? uscore_pos : locale), '@'); + + if (at_pos) + { + mask |= COMPONENT_MODIFIER; + *modifier = g_strdup (at_pos); + } + else + at_pos = locale + strlen (locale); + + if (dot_pos) + { + mask |= COMPONENT_CODESET; + *codeset = g_strndup (dot_pos, at_pos - dot_pos); + } + else + dot_pos = at_pos; + + if (uscore_pos) + { + mask |= COMPONENT_TERRITORY; + *territory = g_strndup (uscore_pos, dot_pos - uscore_pos); + } + else + uscore_pos = dot_pos; + + *language = g_strndup (locale, uscore_pos - locale); + + return mask; +} + +/* + * Compute all interesting variants for a given locale name - + * by stripping off different components of the value. + * + * For simplicity, we assume that the locale is in + * X/Open format: language[_territory][.codeset][@modifier] + * + * TODO: Extend this to handle the CEN format (see the GNUlibc docs) + * as well. We could just copy the code from glibc wholesale + * but it is big, ugly, and complicated, so I'm reluctant + * to do so when this should handle 99% of the time... + */ +static void +append_locale_variants (GPtrArray *array, + const gchar *locale) +{ + gchar *language = NULL; + gchar *territory = NULL; + gchar *codeset = NULL; + gchar *modifier = NULL; + + guint mask; + guint i, j; + + g_return_if_fail (locale != NULL); + + mask = explode_locale (locale, &language, &territory, &codeset, &modifier); + + /* Iterate through all possible combinations, from least attractive + * to most attractive. + */ + for (j = 0; j <= mask; ++j) + { + i = mask - j; + + if ((i & ~mask) == 0) + { + gchar *val = g_strconcat (language, + (i & COMPONENT_TERRITORY) ? territory : "", + (i & COMPONENT_CODESET) ? codeset : "", + (i & COMPONENT_MODIFIER) ? modifier : "", + NULL); + g_ptr_array_add (array, val); + } + } + + g_free (language); + if (mask & COMPONENT_CODESET) + g_free (codeset); + if (mask & COMPONENT_TERRITORY) + g_free (territory); + if (mask & COMPONENT_MODIFIER) + g_free (modifier); +} + +/** + * g_get_locale_variants: + * @locale: a locale identifier + * + * Returns a list of derived variants of @locale, which can be used to + * e.g. construct locale-dependent filenames or search paths. The returned + * list is sorted from most desirable to least desirable. + * This function handles territory, charset and extra locale modifiers. + * + * For example, if @locale is "fr_BE", then the returned list + * is "fr_BE", "fr". + * + * If you need the list of variants for the current locale, + * use g_get_language_names(). + * + * Returns: (transfer full) (array zero-terminated=1) (element-type utf8): a newly + * allocated array of newly allocated strings with the locale variants. Free with + * g_strfreev(). + * + * Since: 2.28 + */ +gchar ** +g_get_locale_variants (const gchar *locale) +{ + GPtrArray *array; + + g_return_val_if_fail (locale != NULL, NULL); + + array = g_ptr_array_sized_new (8); + append_locale_variants (array, locale); + g_ptr_array_add (array, NULL); + + return (gchar **) g_ptr_array_free (array, FALSE); +} + +/* The following is (partly) taken from the gettext package. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. */ + +static const gchar * +guess_category_value (const gchar *category_name) +{ + const gchar *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. This is a GNU extension. */ + retval = g_getenv ("LANGUAGE"); + if ((retval != NULL) && (retval[0] != '\0')) + return retval; + + /* `LANGUAGE' is not set. So we have to proceed with the POSIX + methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some + systems this can be done by the `setlocale' function itself. */ + + /* Setting of LC_ALL overwrites all other. */ + retval = g_getenv ("LC_ALL"); + if ((retval != NULL) && (retval[0] != '\0')) + return retval; + + /* Next comes the name of the desired category. */ + retval = g_getenv (category_name); + if ((retval != NULL) && (retval[0] != '\0')) + return retval; + + /* Last possibility is the LANG environment variable. */ + retval = g_getenv ("LANG"); + if ((retval != NULL) && (retval[0] != '\0')) + return retval; + +#ifdef G_PLATFORM_WIN32 + /* g_win32_getlocale() first checks for LC_ALL, LC_MESSAGES and + * LANG, which we already did above. Oh well. The main point of + * calling g_win32_getlocale() is to get the thread's locale as used + * by Windows and the Microsoft C runtime (in the "English_United + * States" format) translated into the Unixish format. + */ + { + char *locale = g_win32_getlocale (); + retval = g_intern_string (locale); + g_free (locale); + return retval; + } +#endif + + return NULL; +} + +typedef struct _GLanguageNamesCache GLanguageNamesCache; + +struct _GLanguageNamesCache { + gchar *languages; + gchar **language_names; +}; + +static void +language_names_cache_free (gpointer data) +{ + GLanguageNamesCache *cache = data; + g_free (cache->languages); + g_strfreev (cache->language_names); + g_free (cache); +} + +/** + * g_get_language_names: + * + * Computes a list of applicable locale names, which can be used to + * e.g. construct locale-dependent filenames or search paths. The returned + * list is sorted from most desirable to least desirable and always contains + * the default locale "C". + * + * For example, if LANGUAGE=de:en_US, then the returned list is + * "de", "en_US", "en", "C". + * + * This function consults the environment variables LANGUAGE, + * LC_ALL, LC_MESSAGES and LANG + * to find the list of locales specified by the user. + * + * Return value: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib + * that must not be modified or freed. + * + * Since: 2.6 + **/ +const gchar * const * +g_get_language_names (void) +{ + static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT; + GLanguageNamesCache *cache = g_static_private_get (&cache_private); + const gchar *value; + + if (!cache) + { + cache = g_new0 (GLanguageNamesCache, 1); + g_static_private_set (&cache_private, cache, language_names_cache_free); + } + + value = guess_category_value ("LC_MESSAGES"); + if (!value) + value = "C"; + + if (!(cache->languages && strcmp (cache->languages, value) == 0)) + { + GPtrArray *array; + gchar **alist, **a; + + g_free (cache->languages); + g_strfreev (cache->language_names); + cache->languages = g_strdup (value); + + array = g_ptr_array_sized_new (8); + + alist = g_strsplit (value, ":", 0); + for (a = alist; *a; a++) + append_locale_variants (array, unalias_lang (*a)); + g_strfreev (alist); + g_ptr_array_add (array, g_strdup ("C")); + g_ptr_array_add (array, NULL); + + cache->language_names = (gchar **) g_ptr_array_free (array, FALSE); + } + + return (const gchar * const *) cache->language_names; +} + +/** + * g_direct_hash: + * @v: a #gpointer key + * + * Converts a gpointer to a hash value. + * It can be passed to g_hash_table_new() as the @hash_func parameter, + * when using pointers as keys in a #GHashTable. + * + * Returns: a hash value corresponding to the key. + */ +guint +g_direct_hash (gconstpointer v) +{ + return GPOINTER_TO_UINT (v); +} + +/** + * g_direct_equal: + * @v1: a key. + * @v2: a key to compare with @v1. + * + * Compares two #gpointer arguments and returns %TRUE if they are equal. + * It can be passed to g_hash_table_new() as the @key_equal_func + * parameter, when using pointers as keys in a #GHashTable. + * + * Returns: %TRUE if the two keys match. + */ +gboolean +g_direct_equal (gconstpointer v1, + gconstpointer v2) +{ + return v1 == v2; +} + +/** + * g_int_equal: + * @v1: a pointer to a #gint key. + * @v2: a pointer to a #gint key to compare with @v1. + * + * Compares the two #gint values being pointed to and returns + * %TRUE if they are equal. + * It can be passed to g_hash_table_new() as the @key_equal_func + * parameter, when using pointers to integers as keys in a #GHashTable. + * + * Returns: %TRUE if the two keys match. + */ +gboolean +g_int_equal (gconstpointer v1, + gconstpointer v2) +{ + return *((const gint*) v1) == *((const gint*) v2); +} + +/** + * g_int_hash: + * @v: a pointer to a #gint key + * + * Converts a pointer to a #gint to a hash value. + * It can be passed to g_hash_table_new() as the @hash_func parameter, + * when using pointers to integers values as keys in a #GHashTable. + * + * Returns: a hash value corresponding to the key. + */ +guint +g_int_hash (gconstpointer v) +{ + return *(const gint*) v; +} + +/** + * g_int64_equal: + * @v1: a pointer to a #gint64 key. + * @v2: a pointer to a #gint64 key to compare with @v1. + * + * Compares the two #gint64 values being pointed to and returns + * %TRUE if they are equal. + * It can be passed to g_hash_table_new() as the @key_equal_func + * parameter, when using pointers to 64-bit integers as keys in a #GHashTable. + * + * Returns: %TRUE if the two keys match. + * + * Since: 2.22 + */ +gboolean +g_int64_equal (gconstpointer v1, + gconstpointer v2) +{ + return *((const gint64*) v1) == *((const gint64*) v2); +} + +/** + * g_int64_hash: + * @v: a pointer to a #gint64 key + * + * Converts a pointer to a #gint64 to a hash value. + * It can be passed to g_hash_table_new() as the @hash_func parameter, + * when using pointers to 64-bit integers values as keys in a #GHashTable. + * + * Returns: a hash value corresponding to the key. + * + * Since: 2.22 + */ +guint +g_int64_hash (gconstpointer v) +{ + return (guint) *(const gint64*) v; +} + +/** + * g_double_equal: + * @v1: a pointer to a #gdouble key. + * @v2: a pointer to a #gdouble key to compare with @v1. + * + * Compares the two #gdouble values being pointed to and returns + * %TRUE if they are equal. + * It can be passed to g_hash_table_new() as the @key_equal_func + * parameter, when using pointers to doubles as keys in a #GHashTable. + * + * Returns: %TRUE if the two keys match. + * + * Since: 2.22 + */ +gboolean +g_double_equal (gconstpointer v1, + gconstpointer v2) +{ + return *((const gdouble*) v1) == *((const gdouble*) v2); +} + +/** + * g_double_hash: + * @v: a pointer to a #gdouble key + * + * Converts a pointer to a #gdouble to a hash value. + * It can be passed to g_hash_table_new() as the @hash_func parameter, + * when using pointers to doubles as keys in a #GHashTable. + * + * Returns: a hash value corresponding to the key. + * + * Since: 2.22 + */ +guint +g_double_hash (gconstpointer v) +{ + return (guint) *(const gdouble*) v; +} + +/** + * g_nullify_pointer: + * @nullify_location: the memory address of the pointer. + * + * Set the pointer at the specified location to %NULL. + **/ +void +g_nullify_pointer (gpointer *nullify_location) +{ + g_return_if_fail (nullify_location != NULL); + + *nullify_location = NULL; +} + +/* This is called from g_thread_init(). It's used to + * initialize some static data in a threadsafe way. + */ +void +_g_utils_thread_init (void) +{ + g_get_language_names (); +} + +#ifdef G_OS_WIN32 + +/** + * _glib_get_locale_dir: + * + * Return the path to the share\locale or lib\locale subfolder of the + * GLib installation folder. The path is in the system codepage. We + * have to use system codepage as bindtextdomain() doesn't have a + * UTF-8 interface. + */ +gchar * +_glib_get_locale_dir (void) +{ + gchar *install_dir = NULL, *locale_dir; + gchar *retval = NULL; + + if (glib_dll != NULL) + install_dir = g_win32_get_package_installation_directory_of_module (glib_dll); + + if (install_dir) + { + /* + * Append "/share/locale" or "/lib/locale" depending on whether + * autoconfigury detected GNU gettext or not. + */ + const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR); + while (*--p != '/') + ; + while (*--p != '/') + ; + + locale_dir = g_build_filename (install_dir, p, NULL); + + retval = g_win32_locale_filename_from_utf8 (locale_dir); + + g_free (install_dir); + g_free (locale_dir); + } + + if (retval) + return retval; + else + return g_strdup (""); +} + +#undef GLIB_LOCALE_DIR + +#endif /* G_OS_WIN32 */ + +static void +ensure_gettext_initialized(void) +{ + static gboolean _glib_gettext_initialized = FALSE; + + if (!_glib_gettext_initialized) + { +#ifdef G_OS_WIN32 + gchar *tmp = _glib_get_locale_dir (); + bindtextdomain (GETTEXT_PACKAGE, tmp); + g_free (tmp); +#else + bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR); +#endif +# ifdef HAVE_BIND_TEXTDOMAIN_CODESET + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +# endif + _glib_gettext_initialized = TRUE; + } +} + +/** + * glib_gettext: + * @str: The string to be translated + * + * Returns the translated string from the glib translations. + * This is an internal function and should only be used by + * the internals of glib (such as libgio). + * + * Returns: the transation of @str to the current locale + */ +const gchar * +glib_gettext (const gchar *str) +{ + ensure_gettext_initialized(); + + return g_dgettext (GETTEXT_PACKAGE, str); +} + +/** + * glib_pgettext: + * @msgctxtid: a combined message context and message id, separated + * by a \004 character + * @msgidoffset: the offset of the message id in @msgctxid + * + * This function is a variant of glib_gettext() which supports + * a disambiguating message context. See g_dpgettext() for full + * details. + * + * This is an internal function and should only be used by + * the internals of glib (such as libgio). + * + * Returns: the transation of @str to the current locale + */ +const gchar * +glib_pgettext(const gchar *msgctxtid, + gsize msgidoffset) +{ + ensure_gettext_initialized(); + + return g_dpgettext (GETTEXT_PACKAGE, msgctxtid, msgidoffset); +} + +#if defined (G_OS_WIN32) && !defined (_WIN64) + +/* Binary compatibility versions. Not for newly compiled code. */ + +#undef g_find_program_in_path + +gchar* +g_find_program_in_path (const gchar *program) +{ + gchar *utf8_program = g_locale_to_utf8 (program, -1, NULL, NULL, NULL); + gchar *utf8_retval = g_find_program_in_path_utf8 (utf8_program); + gchar *retval; + + g_free (utf8_program); + if (utf8_retval == NULL) + return NULL; + retval = g_locale_from_utf8 (utf8_retval, -1, NULL, NULL, NULL); + g_free (utf8_retval); + + return retval; +} + +#undef g_get_current_dir + +gchar* +g_get_current_dir (void) +{ + gchar *utf8_dir = g_get_current_dir_utf8 (); + gchar *dir = g_locale_from_utf8 (utf8_dir, -1, NULL, NULL, NULL); + g_free (utf8_dir); + return dir; +} + +#undef g_getenv + +const gchar * +g_getenv (const gchar *variable) +{ + gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL); + const gchar *utf8_value = g_getenv_utf8 (utf8_variable); + gchar *value; + GQuark quark; + + g_free (utf8_variable); + if (!utf8_value) + return NULL; + value = g_locale_from_utf8 (utf8_value, -1, NULL, NULL, NULL); + quark = g_quark_from_string (value); + g_free (value); + + return g_quark_to_string (quark); +} + +#undef g_setenv + +gboolean +g_setenv (const gchar *variable, + const gchar *value, + gboolean overwrite) +{ + gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL); + gchar *utf8_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL); + gboolean retval = g_setenv_utf8 (utf8_variable, utf8_value, overwrite); + + g_free (utf8_variable); + g_free (utf8_value); + + return retval; +} + +#undef g_unsetenv + +void +g_unsetenv (const gchar *variable) +{ + gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL); + + g_unsetenv_utf8 (utf8_variable); + + g_free (utf8_variable); +} + +#undef g_get_user_name + +const gchar * +g_get_user_name (void) +{ + g_get_any_init_locked (); + return g_user_name_cp; +} + +#undef g_get_real_name + +const gchar * +g_get_real_name (void) +{ + g_get_any_init_locked (); + return g_real_name_cp; +} + +#undef g_get_home_dir + +const gchar * +g_get_home_dir (void) +{ + g_get_any_init_locked (); + return g_home_dir_cp; +} + +#undef g_get_tmp_dir + +const gchar * +g_get_tmp_dir (void) +{ + g_get_any_init_locked (); + return g_tmp_dir_cp; +} + +#endif diff --git a/deps/glib/gutils.h b/deps/glib/gutils.h new file mode 100644 index 0000000..a0f3cf6 --- /dev/null +++ b/deps/glib/gutils.h @@ -0,0 +1,528 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_UTILS_H__ +#define __G_UTILS_H__ + +#include +#include + +G_BEGIN_DECLS + +#ifdef G_OS_WIN32 + +/* On Win32, the canonical directory separator is the backslash, and + * the search path separator is the semicolon. Note that also the + * (forward) slash works as directory separator. + */ +#define G_DIR_SEPARATOR '\\' +#define G_DIR_SEPARATOR_S "\\" +#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') +#define G_SEARCHPATH_SEPARATOR ';' +#define G_SEARCHPATH_SEPARATOR_S ";" + +#else /* !G_OS_WIN32 */ + +/* Unix */ + +#define G_DIR_SEPARATOR '/' +#define G_DIR_SEPARATOR_S "/" +#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR) +#define G_SEARCHPATH_SEPARATOR ':' +#define G_SEARCHPATH_SEPARATOR_S ":" + +#endif /* !G_OS_WIN32 */ + +/* Define G_VA_COPY() to do the right thing for copying va_list variables. + * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy. + */ +#if !defined (G_VA_COPY) +# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) +# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) +# elif defined (G_VA_COPY_AS_ARRAY) +# define G_VA_COPY(ap1, ap2) g_memmove ((ap1), (ap2), sizeof (va_list)) +# else /* va_list is a pointer */ +# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2)) +# endif /* va_list is a pointer */ +#endif /* !G_VA_COPY */ + +/* inlining hassle. for compilers that don't allow the `inline' keyword, + * mostly because of strict ANSI C compliance or dumbness, we try to fall + * back to either `__inline__' or `__inline'. + * G_CAN_INLINE is defined in glibconfig.h if the compiler seems to be + * actually *capable* to do function inlining, in which case inline + * function bodies do make sense. we also define G_INLINE_FUNC to properly + * export the function prototypes if no inlining can be performed. + * inline function bodies have to be special cased with G_CAN_INLINE and a + * .c file specific macro to allow one compiled instance with extern linkage + * of the functions by defining G_IMPLEMENT_INLINES and the .c file macro. + */ +#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__) +# undef inline +# define inline __inline__ +#elif !defined (G_HAVE_INLINE) +# undef inline +# if defined (G_HAVE___INLINE__) +# define inline __inline__ +# elif defined (G_HAVE___INLINE) +# define inline __inline +# else /* !inline && !__inline__ && !__inline */ +# define inline /* don't inline, then */ +# endif +#endif +#ifdef G_IMPLEMENT_INLINES +# define G_INLINE_FUNC +# undef G_CAN_INLINE +#elif defined (__GNUC__) +# define G_INLINE_FUNC static __inline __attribute__ ((unused)) +#elif defined (G_CAN_INLINE) +# define G_INLINE_FUNC static inline +#else /* can't inline */ +# define G_INLINE_FUNC +#endif /* !G_INLINE_FUNC */ + +#ifndef __GTK_DOC_IGNORE__ +#ifdef G_OS_WIN32 +#define g_get_user_name g_get_user_name_utf8 +#define g_get_real_name g_get_real_name_utf8 +#define g_get_home_dir g_get_home_dir_utf8 +#define g_get_tmp_dir g_get_tmp_dir_utf8 +#endif +#endif + +const gchar * g_get_user_name (void); +const gchar * g_get_real_name (void); +const gchar * g_get_home_dir (void); +const gchar * g_get_tmp_dir (void); +const gchar * g_get_host_name (void); +gchar * g_get_prgname (void); +void g_set_prgname (const gchar *prgname); +const gchar * g_get_application_name (void); +void g_set_application_name (const gchar *application_name); + +void g_reload_user_special_dirs_cache (void); +const gchar * g_get_user_data_dir (void); +const gchar * g_get_user_config_dir (void); +const gchar * g_get_user_cache_dir (void); +const gchar * const * g_get_system_data_dirs (void); + +#ifdef G_OS_WIN32 +/* This functions is not part of the public GLib API */ +const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)); +#endif + +#if defined (G_OS_WIN32) && defined (G_CAN_INLINE) && !defined (__cplusplus) +/* This function is not part of the public GLib API either. Just call + * g_get_system_data_dirs() in your code, never mind that that is + * actually a macro and you will in fact call this inline function. + */ +static inline const gchar * const * +_g_win32_get_system_data_dirs (void) +{ + return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs); +} +#define g_get_system_data_dirs _g_win32_get_system_data_dirs +#endif + +const gchar * const * g_get_system_config_dirs (void); + +const gchar * g_get_user_runtime_dir (void); + +const gchar * const * g_get_language_names (void); + +gchar **g_get_locale_variants (const gchar *locale); + +/** + * GUserDirectory: + * @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory + * @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory + * @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory + * @G_USER_DIRECTORY_MUSIC: the user's Music directory + * @G_USER_DIRECTORY_PICTURES: the user's Pictures directory + * @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory + * @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory + * @G_USER_DIRECTORY_VIDEOS: the user's Movies directory + * @G_USER_N_DIRECTORIES: the number of enum values + * + * These are logical ids for special directories which are defined + * depending on the platform used. You should use g_get_user_special_dir() + * to retrieve the full path associated to the logical id. + * + * The #GUserDirectory enumeration can be extended at later date. Not + * every platform has a directory for every logical id in this + * enumeration. + * + * Since: 2.14 + */ +typedef enum { + G_USER_DIRECTORY_DESKTOP, + G_USER_DIRECTORY_DOCUMENTS, + G_USER_DIRECTORY_DOWNLOAD, + G_USER_DIRECTORY_MUSIC, + G_USER_DIRECTORY_PICTURES, + G_USER_DIRECTORY_PUBLIC_SHARE, + G_USER_DIRECTORY_TEMPLATES, + G_USER_DIRECTORY_VIDEOS, + + G_USER_N_DIRECTORIES +} GUserDirectory; + +const gchar * g_get_user_special_dir (GUserDirectory directory); + +/** + * GDebugKey: + * @key: the string + * @value: the flag + * + * Associates a string with a bit flag. + * Used in g_parse_debug_string(). + */ +typedef struct _GDebugKey GDebugKey; +struct _GDebugKey +{ + const gchar *key; + guint value; +}; + +/* Miscellaneous utility functions + */ +guint g_parse_debug_string (const gchar *string, + const GDebugKey *keys, + guint nkeys); + +gint g_snprintf (gchar *string, + gulong n, + gchar const *format, + ...) G_GNUC_PRINTF (3, 4); +gint g_vsnprintf (gchar *string, + gulong n, + gchar const *format, + va_list args); + +/* Check if a file name is an absolute path */ +gboolean g_path_is_absolute (const gchar *file_name); + +/* In case of absolute paths, skip the root part */ +const gchar * g_path_skip_root (const gchar *file_name); + +#ifndef G_DISABLE_DEPRECATED + +const gchar * g_basename (const gchar *file_name); +#define g_dirname g_path_get_dirname + +#endif /* G_DISABLE_DEPRECATED */ + +#ifndef __GTK_DOC_IGNORE__ +#ifdef G_OS_WIN32 +#define g_get_current_dir g_get_current_dir_utf8 +#endif +#endif + +/* The returned strings are newly allocated with g_malloc() */ +gchar* g_get_current_dir (void); +gchar* g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC; +gchar* g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC; + +/* Set the pointer at the specified location to NULL */ +void g_nullify_pointer (gpointer *nullify_location); + +/* return the environment string for the variable. The returned memory + * must not be freed. */ +#ifndef __GTK_DOC_IGNORE__ +#ifdef G_OS_WIN32 +#define g_getenv g_getenv_utf8 +#define g_setenv g_setenv_utf8 +#define g_unsetenv g_unsetenv_utf8 +#define g_find_program_in_path g_find_program_in_path_utf8 +#endif +#endif + +const gchar * g_getenv (const gchar *variable); +gboolean g_setenv (const gchar *variable, + const gchar *value, + gboolean overwrite); +void g_unsetenv (const gchar *variable); +gchar** g_listenv (void); +gchar** g_get_environ (void); + +/* private */ +const gchar* _g_getenv_nomalloc (const gchar *variable, + gchar buffer[1024]); + +/** + * GVoidFunc: + * + * Declares a type of function which takes no arguments + * and has no return value. It is used to specify the type + * function passed to g_atexit(). + */ +typedef void (*GVoidFunc) (void); +#ifndef ATEXIT +# define ATEXIT(proc) g_ATEXIT(proc) +#else +# define G_NATIVE_ATEXIT +#endif /* ATEXIT */ +/* we use a GLib function as a replacement for ATEXIT, so + * the programmer is not required to check the return value + * (if there is any in the implementation) and doesn't encounter + * missing include files. + */ +void g_atexit (GVoidFunc func); + +#ifdef G_OS_WIN32 +/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls + * atexit(), the function will be called when the GLib DLL is detached + * from the program, which is not what the caller wants. The caller + * wants the function to be called when it *itself* exits (or is + * detached, in case the caller, too, is a DLL). + */ +#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB)) +int atexit (void (*)(void)); +#endif +#define g_atexit(func) atexit(func) +#endif + +/* Look for an executable in PATH, following execvp() rules */ +gchar* g_find_program_in_path (const gchar *program); + +/* Bit tests + */ +G_INLINE_FUNC gint g_bit_nth_lsf (gulong mask, + gint nth_bit) G_GNUC_CONST; +G_INLINE_FUNC gint g_bit_nth_msf (gulong mask, + gint nth_bit) G_GNUC_CONST; +G_INLINE_FUNC guint g_bit_storage (gulong number) G_GNUC_CONST; + +/* Trash Stacks + * elements need to be >= sizeof (gpointer) + */ +typedef struct _GTrashStack GTrashStack; +struct _GTrashStack +{ + GTrashStack *next; +}; + +G_INLINE_FUNC void g_trash_stack_push (GTrashStack **stack_p, + gpointer data_p); +G_INLINE_FUNC gpointer g_trash_stack_pop (GTrashStack **stack_p); +G_INLINE_FUNC gpointer g_trash_stack_peek (GTrashStack **stack_p); +G_INLINE_FUNC guint g_trash_stack_height (GTrashStack **stack_p); + +/* inline function implementations + */ +#if defined (G_CAN_INLINE) || defined (__G_UTILS_C__) +G_INLINE_FUNC gint +g_bit_nth_lsf (gulong mask, + gint nth_bit) +{ + if (G_UNLIKELY (nth_bit < -1)) + nth_bit = -1; + while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1)) + { + nth_bit++; + if (mask & (1UL << nth_bit)) + return nth_bit; + } + return -1; +} +G_INLINE_FUNC gint +g_bit_nth_msf (gulong mask, + gint nth_bit) +{ + if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8)) + nth_bit = GLIB_SIZEOF_LONG * 8; + while (nth_bit > 0) + { + nth_bit--; + if (mask & (1UL << nth_bit)) + return nth_bit; + } + return -1; +} +G_INLINE_FUNC guint +g_bit_storage (gulong number) +{ +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__) + return G_LIKELY (number) ? + ((GLIB_SIZEOF_LONG * 8U - 1) ^ __builtin_clzl(number)) + 1 : 1; +#else + register guint n_bits = 0; + + do + { + n_bits++; + number >>= 1; + } + while (number); + return n_bits; +#endif +} +G_INLINE_FUNC void +g_trash_stack_push (GTrashStack **stack_p, + gpointer data_p) +{ + GTrashStack *data = (GTrashStack *) data_p; + + data->next = *stack_p; + *stack_p = data; +} +G_INLINE_FUNC gpointer +g_trash_stack_pop (GTrashStack **stack_p) +{ + GTrashStack *data; + + data = *stack_p; + if (data) + { + *stack_p = data->next; + /* NULLify private pointer here, most platforms store NULL as + * subsequent 0 bytes + */ + data->next = NULL; + } + + return data; +} +G_INLINE_FUNC gpointer +g_trash_stack_peek (GTrashStack **stack_p) +{ + GTrashStack *data; + + data = *stack_p; + + return data; +} +G_INLINE_FUNC guint +g_trash_stack_height (GTrashStack **stack_p) +{ + GTrashStack *data; + guint i = 0; + + for (data = *stack_p; data; data = data->next) + i++; + + return i; +} +#endif /* G_CAN_INLINE || __G_UTILS_C__ */ + +/* Glib version. + * we prefix variable declarations so they can + * properly get exported in windows dlls. + */ +GLIB_VAR const guint glib_major_version; +GLIB_VAR const guint glib_minor_version; +GLIB_VAR const guint glib_micro_version; +GLIB_VAR const guint glib_interface_age; +GLIB_VAR const guint glib_binary_age; + +const gchar * glib_check_version (guint required_major, + guint required_minor, + guint required_micro); + +/** + * GLIB_CHECK_VERSION: + * @major: the major version to check for + * @minor: the minor version to check for + * @micro: the micro version to check for + * + * Checks the version of the GLib library that is being compiled + * against. + * + * + * Checking the version of the GLib library + * + * if (!GLIB_CHECK_VERSION (1, 2, 0)) + * g_error ("GLib version 1.2.0 or above is needed"); + * + * + * + * See glib_check_version() for a runtime check. + * + * Returns: %TRUE if the version of the GLib header files + * is the same as or newer than the passed-in version. + */ +#define GLIB_CHECK_VERSION(major,minor,micro) \ + (GLIB_MAJOR_VERSION > (major) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ + GLIB_MICRO_VERSION >= (micro))) + +G_END_DECLS + +#ifndef G_DISABLE_DEPRECATED + +/* + * This macro is deprecated. This DllMain() is too complex. It is + * recommended to write an explicit minimal DLlMain() that just saves + * the handle to the DLL and then use that handle instead, for + * instance passing it to + * g_win32_get_package_installation_directory_of_module(). + * + * On Windows, this macro defines a DllMain function that stores the + * actual DLL name that the code being compiled will be included in. + * STATIC should be empty or 'static'. DLL_NAME is the name of the + * (pointer to the) char array where the DLL name will be stored. If + * this is used, you must also include . If you need a more complex + * DLL entry point function, you cannot use this. + * + * On non-Windows platforms, expands to nothing. + */ + +#ifndef G_PLATFORM_WIN32 +# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) +#else +# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \ +static char *dll_name; \ + \ +BOOL WINAPI \ +DllMain (HINSTANCE hinstDLL, \ + DWORD fdwReason, \ + LPVOID lpvReserved) \ +{ \ + wchar_t wcbfr[1000]; \ + char *tem; \ + switch (fdwReason) \ + { \ + case DLL_PROCESS_ATTACH: \ + GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \ + tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \ + dll_name = g_path_get_basename (tem); \ + g_free (tem); \ + break; \ + } \ + \ + return TRUE; \ +} + +#endif /* !G_DISABLE_DEPRECATED */ + +#endif /* G_PLATFORM_WIN32 */ + +#endif /* __G_UTILS_H__ */ diff --git a/deps/gmodule/Makefile.am b/deps/gmodule/Makefile.am new file mode 100644 index 0000000..73991a0 --- /dev/null +++ b/deps/gmodule/Makefile.am @@ -0,0 +1,32 @@ + +noinst_LTLIBRARIES = libgmodule.la + +libgmodule_la_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/deps \ + -I$(top_srcdir)/deps/glib \ + -I$(top_builddir)/deps/glib \ + -Wall \ + $(NULL) + +EXTRA_DIST = \ + gmoduleconf.h.in \ + gmodule-dl.c \ + gmodule-dld.c \ + gmodule-dyld.c \ + gmodule-win32.c \ + gmoduleconf.h.win32 \ + $(NULL) + +BUILT_SOURCES = gmoduleconf.h +gmoduleconf.h: gmoduleconf.h.in + +libgmodule_la_SOURCES = gmodule.c +libgmodule_la_LIBADD = \ + $(G_MODULE_LIBS_EXTRA) \ + $(G_MODULE_LIBS) \ + $(top_builddir)/deps/glib/$(libglib) \ + $(NULL) +libgmodule_la_LDFLAGS = \ + $(G_MODULE_LDFLAGS) \ + $(NULL) diff --git a/deps/gmodule/Makefile.in b/deps/gmodule/Makefile.in new file mode 100644 index 0000000..e2e6e1d --- /dev/null +++ b/deps/gmodule/Makefile.in @@ -0,0 +1,766 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = deps/gmodule +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/gmoduleconf.h.in $(top_srcdir)/build/depcomp README +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = gmoduleconf.h +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgmodule_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(top_builddir)/deps/glib/$(libglib) +am_libgmodule_la_OBJECTS = libgmodule_la-gmodule.lo +libgmodule_la_OBJECTS = $(am_libgmodule_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgmodule_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libgmodule_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgmodule_la_SOURCES) +DIST_SOURCES = $(libgmodule_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libgmodule.la +libgmodule_la_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/deps \ + -I$(top_srcdir)/deps/glib \ + -I$(top_builddir)/deps/glib \ + -Wall \ + $(NULL) + +EXTRA_DIST = \ + gmoduleconf.h.in \ + gmodule-dl.c \ + gmodule-dld.c \ + gmodule-dyld.c \ + gmodule-win32.c \ + gmoduleconf.h.win32 \ + $(NULL) + +BUILT_SOURCES = gmoduleconf.h +libgmodule_la_SOURCES = gmodule.c +libgmodule_la_LIBADD = \ + $(G_MODULE_LIBS_EXTRA) \ + $(G_MODULE_LIBS) \ + $(top_builddir)/deps/glib/$(libglib) \ + $(NULL) + +libgmodule_la_LDFLAGS = \ + $(G_MODULE_LDFLAGS) \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign deps/gmodule/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign deps/gmodule/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +gmoduleconf.h: $(top_builddir)/config.status $(srcdir)/gmoduleconf.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libgmodule.la: $(libgmodule_la_OBJECTS) $(libgmodule_la_DEPENDENCIES) $(EXTRA_libgmodule_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgmodule_la_LINK) $(libgmodule_la_OBJECTS) $(libgmodule_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgmodule_la-gmodule.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libgmodule_la-gmodule.lo: gmodule.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgmodule_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgmodule_la-gmodule.lo -MD -MP -MF $(DEPDIR)/libgmodule_la-gmodule.Tpo -c -o libgmodule_la-gmodule.lo `test -f 'gmodule.c' || echo '$(srcdir)/'`gmodule.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgmodule_la-gmodule.Tpo $(DEPDIR)/libgmodule_la-gmodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gmodule.c' object='libgmodule_la-gmodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgmodule_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgmodule_la-gmodule.lo `test -f 'gmodule.c' || echo '$(srcdir)/'`gmodule.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +gmoduleconf.h: gmoduleconf.h.in + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/deps/gmodule/README b/deps/gmodule/README new file mode 100644 index 0000000..74be42b --- /dev/null +++ b/deps/gmodule/README @@ -0,0 +1,4 @@ +gmodule is taken from the same glib version as deps/glib. + +The only modification is to drop the support for .la libtool archive, which +avoid pulling in GParser (and its dependencies). diff --git a/deps/gmodule/gmodule-dl.c b/deps/gmodule/gmodule-dl.c new file mode 100644 index 0000000..035b2a9 --- /dev/null +++ b/deps/gmodule/gmodule-dl.c @@ -0,0 +1,168 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998, 2000 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ +#include "config.h" + +#include + +/* Perl includes and instead of on some systmes? */ + + +/* dlerror() is not implemented on all systems + */ +#ifndef G_MODULE_HAVE_DLERROR +# ifdef __NetBSD__ +# define dlerror() g_strerror (errno) +# else /* !__NetBSD__ */ +/* could we rely on errno's state here? */ +# define dlerror() "unknown dl-error" +# endif /* !__NetBSD__ */ +#endif /* G_MODULE_HAVE_DLERROR */ + +/* some flags are missing on some systems, so we provide + * harmless defaults. + * The Perl sources say, RTLD_LAZY needs to be defined as (1), + * at least for Solaris 1. + * + * Mandatory: + * RTLD_LAZY - resolve undefined symbols as code from the dynamic library + * is executed. + * RTLD_NOW - resolve all undefined symbols before dlopen returns, and fail + * if this cannot be done. + * Optionally: + * RTLD_GLOBAL - the external symbols defined in the library will be made + * available to subsequently loaded libraries. + */ +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif /* RTLD_LAZY */ +#ifndef RTLD_NOW +#define RTLD_NOW 0 +#endif /* RTLD_NOW */ +/* some systems (OSF1 V5.0) have broken RTLD_GLOBAL linkage */ +#ifdef G_MODULE_BROKEN_RTLD_GLOBAL +#undef RTLD_GLOBAL +#endif /* G_MODULE_BROKEN_RTLD_GLOBAL */ +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif /* RTLD_GLOBAL */ + + +/* --- functions --- */ +static gchar* +fetch_dlerror (gboolean replace_null) +{ + gchar *msg = dlerror (); + + /* make sure we always return an error message != NULL, if + * expected to do so. */ + + if (!msg && replace_null) + return "unknown dl-error"; + + return msg; +} + +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local) +{ + gpointer handle; + + handle = dlopen (file_name, + (bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW)); + if (!handle) + g_module_set_error (fetch_dlerror (TRUE)); + + return handle; +} + +static gpointer +_g_module_self (void) +{ + gpointer handle; + + /* to query symbols from the program itself, special link options + * are required on some systems. + */ + + handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY); + if (!handle) + g_module_set_error (fetch_dlerror (TRUE)); + + return handle; +} + +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ + /* are there any systems out there that have dlopen()/dlclose() + * without a reference count implementation? + */ + is_unref |= 1; + + if (is_unref) + { + if (dlclose (handle) != 0) + g_module_set_error (fetch_dlerror (TRUE)); + } +} + +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + gpointer p; + gchar *msg; + + fetch_dlerror (FALSE); + p = dlsym (handle, symbol_name); + msg = fetch_dlerror (FALSE); + if (msg) + g_module_set_error (msg); + + return p; +} + +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + if (directory && *directory) { + if (strncmp (module_name, "lib", 3) == 0) + return g_strconcat (directory, "/", module_name, NULL); + else + return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL); + } else if (strncmp (module_name, "lib", 3) == 0) + return g_strdup (module_name); + else + return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL); +} diff --git a/deps/gmodule/gmodule-dld.c b/deps/gmodule/gmodule-dld.c new file mode 100644 index 0000000..401b32f --- /dev/null +++ b/deps/gmodule/gmodule-dld.c @@ -0,0 +1,163 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998, 2000 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ +#include "config.h" + +#include + + +/* some flags are missing on some systems, so we provide + * harmless defaults. + * + * Mandatory: + * BIND_IMMEDIATE - Resolve symbol references when the library is loaded. + * BIND_DEFERRED - Delay code symbol resolution until actual reference. + * + * Optionally: + * BIND_FIRST - Place the library at the head of the symbol search order. + * BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all unsatisfied + * symbols as fatal. This flag allows binding of unsatisfied code + * symbols to be deferred until use. + * [Perl: For certain libraries, like DCE, deferred binding often + * causes run time problems. Adding BIND_NONFATAL to BIND_IMMEDIATE + * still allows unresolved references in situations like this.] + * BIND_NOSTART - Do not call the initializer for the shared library when the + * library is loaded, nor on a future call to shl_unload(). + * BIND_VERBOSE - Print verbose messages concerning possible unsatisfied symbols. + * + * hp9000s700/hp9000s800: + * BIND_RESTRICTED - Restrict symbols visible by the library to those present at + * library load time. + * DYNAMIC_PATH - Allow the loader to dynamically search for the library specified + * by the path argument. + */ +#ifndef DYNAMIC_PATH +#define DYNAMIC_PATH 0 +#endif /* DYNAMIC_PATH */ +#ifndef BIND_RESTRICTED +#define BIND_RESTRICTED 0 +#endif /* BIND_RESTRICTED */ + +#define OPT_BIND_FLAGS (BIND_NONFATAL | BIND_VERBOSE) + + +/* --- functions --- */ + +/* + * shl_load() does not appear to support making symbols invisible to + * the global namespace. However, the default is to put the library + * last in the search order, which is approximately what we want, + * since it will cause symbols that conflict with existing symbols to + * be invisible. It is unclear if BIND_FIRST should be used when + * bind_local==0, since it may cause the loaded symbols to be used + * preferentially to the application's symbols, which is Almost + * Always Wrong. --ds + */ +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local) +{ + shl_t shl_handle; + + shl_handle = shl_load (file_name, + (bind_lazy ? BIND_DEFERRED : BIND_IMMEDIATE) | OPT_BIND_FLAGS, 0); + if (!shl_handle) + { + /* the hp-docs say we should better abort() if errno==ENOSYM ;( */ + g_module_set_error (g_strerror (errno)); + } + + return (gpointer) shl_handle; +} + +static gpointer +_g_module_self (void) +{ + shl_t shl_handle; + + shl_handle = PROG_HANDLE; + if (!shl_handle) + g_module_set_error (g_strerror (errno)); + + return shl_handle; +} + +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ + if (!is_unref) + { + if (shl_unload ((shl_t) handle) != 0) + g_module_set_error (g_strerror (errno)); + } +} + +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + gpointer p = NULL; + + /* should we restrict lookups to TYPE_PROCEDURE? + */ + if (handle == PROG_HANDLE) + { + /* PROG_HANDLE will only lookup symbols in the program itself, not honouring + * libraries. passing NULL as a handle will also try to lookup the symbol + * in currently loaded libraries. fix pointed out and supplied by: + * David Gero + */ + handle = NULL; + } + if (shl_findsym ((shl_t*) &handle, symbol_name, TYPE_UNDEFINED, &p) != 0 || + handle == NULL || p == NULL) + { + /* the hp-docs say we should better abort() if errno==ENOSYM ;( */ + g_module_set_error (g_strerror (errno)); + } + + return p; +} + +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + if (directory && *directory) + if (strncmp (module_name, "lib", 3) == 0) + return g_strconcat (directory, "/", module_name, NULL); + else + return g_strconcat (directory, "/lib", module_name, ".sl", NULL); + else if (strncmp (module_name, "lib", 3) == 0) + return g_strdup (module_name); + else + return g_strconcat ("lib", module_name, ".sl", NULL); +} diff --git a/deps/gmodule/gmodule-dyld.c b/deps/gmodule/gmodule-dyld.c new file mode 100644 index 0000000..1896b43 --- /dev/null +++ b/deps/gmodule/gmodule-dyld.c @@ -0,0 +1,154 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998, 2000 Tim Janik + * + * dyld (Darwin) GMODULE implementation + * Copyright (C) 2001 Dan Winship + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include "config.h" + +#include + +static gpointer self_module = GINT_TO_POINTER (1); + +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local) +{ + NSObjectFileImage image; + NSObjectFileImageReturnCode ret; + NSModule module; + unsigned long options; + char *msg; + + ret = NSCreateObjectFileImageFromFile (file_name, &image); + if (ret != NSObjectFileImageSuccess) + { + switch (ret) + { + case NSObjectFileImageInappropriateFile: + case NSObjectFileImageFormat: + msg = g_strdup_printf ("%s is not a loadable module", file_name); + break; + + case NSObjectFileImageArch: + msg = g_strdup_printf ("%s is not built for this architecture", + file_name); + break; + + case NSObjectFileImageAccess: + if (access (file_name, F_OK) == 0) + msg = g_strdup_printf ("%s: permission denied", file_name); + else + msg = g_strdup_printf ("%s: no such file or directory", file_name); + break; + + default: + msg = g_strdup_printf ("unknown error for %s", file_name); + break; + } + + g_module_set_error (msg); + g_free (msg); + return NULL; + } + + options = NSLINKMODULE_OPTION_RETURN_ON_ERROR; + if (bind_local) + options |= NSLINKMODULE_OPTION_PRIVATE; + if (!bind_lazy) + options |= NSLINKMODULE_OPTION_BINDNOW; + module = NSLinkModule (image, file_name, options); + NSDestroyObjectFileImage (image); + if (!module) + { + NSLinkEditErrors c; + int error_number; + const char *file, *error; + + NSLinkEditError (&c, &error_number, &file, &error); + msg = g_strdup_printf ("could not link %s: %s", file_name, error); + g_module_set_error (msg); + g_free (msg); + return NULL; + } + + return module; +} + +static gpointer +_g_module_self (void) +{ + return &self_module; +} + +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ + if (handle == &self_module) + return; + + if (!NSUnLinkModule (handle, 0)) + g_module_set_error ("could not unlink module"); +} + +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + NSSymbol sym; + char *msg; + + if (handle == &self_module) + { + if (NSIsSymbolNameDefined (symbol_name)) + sym = NSLookupAndBindSymbol (symbol_name); + else + sym = NULL; + } + else + sym = NSLookupSymbolInModule (handle, symbol_name); + + if (!sym) + { + msg = g_strdup_printf ("no such symbol %s", symbol_name); + g_module_set_error (msg); + g_free (msg); + return NULL; + } + + return NSAddressOfSymbol (sym); +} + +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + if (directory && *directory) + { + if (strncmp (module_name, "lib", 3) == 0) + return g_strconcat (directory, "/", module_name, NULL); + else + return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL); + } + else if (strncmp (module_name, "lib", 3) == 0) + return g_strdup (module_name); + else + return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL); +} diff --git a/deps/gmodule/gmodule-win32.c b/deps/gmodule/gmodule-win32.c new file mode 100644 index 0000000..439fb5d --- /dev/null +++ b/deps/gmodule/gmodule-win32.c @@ -0,0 +1,202 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998, 2000 Tim Janik + * + * Win32 GMODULE implementation + * Copyright (C) 1998 Tor Lillqvist + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ +#include "config.h" + +#include +#include + +#include + +#ifdef G_WITH_CYGWIN +#include +#endif + +static void +set_error (const gchar *format, + ...) +{ + gchar *error; + gchar *detail; + gchar *message; + va_list args; + + error = g_win32_error_message (GetLastError ()); + + va_start (args, format); + detail = g_strdup_vprintf (format, args); + va_end (args); + + message = g_strconcat (detail, error, NULL); + + g_module_set_error (message); + g_free (message); + g_free (detail); + g_free (error); +} + +/* --- functions --- */ +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local) +{ + HINSTANCE handle; + wchar_t *wfilename; +#ifdef G_WITH_CYGWIN + gchar tmp[MAX_PATH]; + + cygwin_conv_to_win32_path(file_name, tmp); + file_name = tmp; +#endif + wfilename = g_utf8_to_utf16 (file_name, -1, NULL, NULL, NULL); + + handle = LoadLibraryW (wfilename); + g_free (wfilename); + + if (!handle) + set_error ("`%s': ", file_name); + + return handle; +} + +static gint dummy; +static gpointer null_module_handle = &dummy; + +static gpointer +_g_module_self (void) +{ + return null_module_handle; +} + +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ + if (handle != null_module_handle) + if (!FreeLibrary (handle)) + set_error (""); +} + +static gpointer +find_in_any_module_using_toolhelp (const gchar *symbol_name) +{ + HANDLE snapshot; + MODULEENTRY32 me32; + + gpointer p; + + if ((snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1) + return NULL; + + me32.dwSize = sizeof (me32); + p = NULL; + if (Module32First (snapshot, &me32)) + { + do { + if ((p = GetProcAddress (me32.hModule, symbol_name)) != NULL) + break; + } while (Module32Next (snapshot, &me32)); + } + + CloseHandle (snapshot); + + return p; +} + +static gpointer +find_in_any_module (const gchar *symbol_name) +{ + gpointer result; + + if ((result = find_in_any_module_using_toolhelp (symbol_name)) == NULL) + return NULL; + else + return result; +} + +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + gpointer p; + + if (handle == null_module_handle) + { + if ((p = GetProcAddress (GetModuleHandle (NULL), symbol_name)) == NULL) + p = find_in_any_module (symbol_name); + } + else + p = GetProcAddress (handle, symbol_name); + + if (!p) + set_error (""); + + return p; +} + +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + gint k; + + k = strlen (module_name); + + if (directory && *directory) + if (k > 4 && g_ascii_strcasecmp (module_name + k - 4, ".dll") == 0) + return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, NULL); +#ifdef G_WITH_CYGWIN + else if (strncmp (module_name, "lib", 3) == 0 || strncmp (module_name, "cyg", 3) == 0) + return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL); + else + return g_strconcat (directory, G_DIR_SEPARATOR_S, "cyg", module_name, ".dll", NULL); +#else + else if (strncmp (module_name, "lib", 3) == 0) + return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL); + else + return g_strconcat (directory, G_DIR_SEPARATOR_S, "lib", module_name, ".dll", NULL); +#endif + else if (k > 4 && g_ascii_strcasecmp (module_name + k - 4, ".dll") == 0) + return g_strdup (module_name); +#ifdef G_WITH_CYGWIN + else if (strncmp (module_name, "lib", 3) == 0 || strncmp (module_name, "cyg", 3) == 0) + return g_strconcat (module_name, ".dll", NULL); + else + return g_strconcat ("cyg", module_name, ".dll", NULL); +#else + else if (strncmp (module_name, "lib", 3) == 0) + return g_strconcat (module_name, ".dll", NULL); + else + return g_strconcat ("lib", module_name, ".dll", NULL); +#endif +} diff --git a/deps/gmodule/gmodule.c b/deps/gmodule/gmodule.c new file mode 100644 index 0000000..460c308 --- /dev/null +++ b/deps/gmodule/gmodule.c @@ -0,0 +1,582 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include "config.h" + +#include "glib.h" +#include "gmodule.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef G_OS_WIN32 +#include /* For open() and close() prototypes. */ +#endif + +#include "gmoduleconf.h" +#include "gstdio.h" + +/* We maintain a list of modules, so we can reference count them. + * That's needed because some platforms don't support references counts on + * modules e.g. the shl_* implementation of HP-UX + * (http://www.stat.umn.edu/~luke/xls/projects/dlbasics/dlbasics.html). + * Also, the module for the program itself is kept seperatedly for + * faster access and because it has special semantics. + */ + + +/* --- structures --- */ +struct _GModule +{ + gchar *file_name; +#if defined (G_OS_WIN32) && !defined(_WIN64) + gchar *cp_file_name; +#endif + gpointer handle; + guint ref_count : 31; + guint is_resident : 1; + GModuleUnload unload; + GModule *next; +}; + + +/* --- prototypes --- */ +static gpointer _g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local); +static void _g_module_close (gpointer handle, + gboolean is_unref); +static gpointer _g_module_self (void); +static gpointer _g_module_symbol (gpointer handle, + const gchar *symbol_name); +static gchar* _g_module_build_path (const gchar *directory, + const gchar *module_name); +static inline void g_module_set_error (const gchar *error); +static inline GModule* g_module_find_by_handle (gpointer handle); +static inline GModule* g_module_find_by_name (const gchar *name); + + +/* --- variables --- */ +static GModule *modules = NULL; +static GModule *main_module = NULL; +static GStaticPrivate module_error_private = G_STATIC_PRIVATE_INIT; +static gboolean module_debug_initialized = FALSE; +static guint module_debug_flags = 0; + + +/* --- inline functions --- */ +static inline GModule* +g_module_find_by_handle (gpointer handle) +{ + GModule *module; + GModule *retval = NULL; + + if (main_module && main_module->handle == handle) + retval = main_module; + else + for (module = modules; module; module = module->next) + if (handle == module->handle) + { + retval = module; + break; + } + + return retval; +} + +static inline GModule* +g_module_find_by_name (const gchar *name) +{ + GModule *module; + GModule *retval = NULL; + + for (module = modules; module; module = module->next) + if (strcmp (name, module->file_name) == 0) + { + retval = module; + break; + } + + return retval; +} + +static inline void +g_module_set_error_unduped (gchar *error) +{ + g_static_private_set (&module_error_private, error, g_free); + errno = 0; +} + +static inline void +g_module_set_error (const gchar *error) +{ + g_module_set_error_unduped (g_strdup (error)); +} + + +/* --- include platform specifc code --- */ +#define SUPPORT_OR_RETURN(rv) { g_module_set_error (NULL); } +#if (G_MODULE_IMPL == G_MODULE_IMPL_DL) +#include "gmodule-dl.c" +#elif (G_MODULE_IMPL == G_MODULE_IMPL_DLD) +#include "gmodule-dld.c" +#elif (G_MODULE_IMPL == G_MODULE_IMPL_WIN32) +#include "gmodule-win32.c" +#elif (G_MODULE_IMPL == G_MODULE_IMPL_DYLD) +#include "gmodule-dyld.c" +#elif (G_MODULE_IMPL == G_MODULE_IMPL_AR) +#include "gmodule-ar.c" +#else +#undef SUPPORT_OR_RETURN +#define SUPPORT_OR_RETURN(rv) { g_module_set_error ("dynamic modules are " \ + "not supported by this system"); return rv; } +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy, + gboolean bind_local) +{ + return NULL; +} +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ +} +static gpointer +_g_module_self (void) +{ + return NULL; +} +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + return NULL; +} +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + return NULL; +} +#endif /* no implementation */ + +/* --- functions --- */ +gboolean +g_module_supported (void) +{ + SUPPORT_OR_RETURN (FALSE); + + return TRUE; +} + +static inline gboolean +str_check_suffix (const gchar* string, + const gchar* suffix) +{ + gsize string_len = strlen (string); + gsize suffix_len = strlen (suffix); + + return string_len >= suffix_len && + strcmp (string + string_len - suffix_len, suffix) == 0; +} + +enum +{ + G_MODULE_DEBUG_RESIDENT_MODULES = 1 << 0, + G_MODULE_DEBUG_BIND_NOW_MODULES = 1 << 1 +}; + +static void +_g_module_debug_init (void) +{ + const GDebugKey keys[] = { + { "resident-modules", G_MODULE_DEBUG_RESIDENT_MODULES }, + { "bind-now-modules", G_MODULE_DEBUG_BIND_NOW_MODULES } + }; + const gchar *env; + + env = g_getenv ("G_DEBUG"); + + module_debug_flags = + !env ? 0 : g_parse_debug_string (env, keys, G_N_ELEMENTS (keys)); + + module_debug_initialized = TRUE; +} + +static GStaticRecMutex g_module_global_lock = G_STATIC_REC_MUTEX_INIT; + +GModule* +g_module_open (const gchar *file_name, + GModuleFlags flags) +{ + GModule *module; + gpointer handle = NULL; + gchar *name = NULL; + + SUPPORT_OR_RETURN (NULL); + + g_static_rec_mutex_lock (&g_module_global_lock); + + if (G_UNLIKELY (!module_debug_initialized)) + _g_module_debug_init (); + + if (module_debug_flags & G_MODULE_DEBUG_BIND_NOW_MODULES) + flags &= ~G_MODULE_BIND_LAZY; + + if (!file_name) + { + if (!main_module) + { + handle = _g_module_self (); + if (handle) + { + main_module = g_new (GModule, 1); + main_module->file_name = NULL; +#if defined (G_OS_WIN32) && !defined(_WIN64) + main_module->cp_file_name = NULL; +#endif + main_module->handle = handle; + main_module->ref_count = 1; + main_module->is_resident = TRUE; + main_module->unload = NULL; + main_module->next = NULL; + } + } + else + main_module->ref_count++; + + g_static_rec_mutex_unlock (&g_module_global_lock); + return main_module; + } + + /* we first search the module list by name */ + module = g_module_find_by_name (file_name); + if (module) + { + module->ref_count++; + + g_static_rec_mutex_unlock (&g_module_global_lock); + return module; + } + + /* check whether we have a readable file right away */ + if (g_file_test (file_name, G_FILE_TEST_IS_REGULAR)) + name = g_strdup (file_name); + /* try completing file name with standard library suffix */ + if (!name) + { + name = g_strconcat (file_name, "." G_MODULE_SUFFIX, NULL); + if (!g_file_test (name, G_FILE_TEST_IS_REGULAR)) + { + g_free (name); + name = NULL; + } + } + /* try completing by appending libtool suffix */ + if (!name) + { + name = g_strconcat (file_name, ".la", NULL); + if (!g_file_test (name, G_FILE_TEST_IS_REGULAR)) + { + g_free (name); + name = NULL; + } + } + /* we can't access() the file, lets hope the platform backends finds + * it via library paths + */ + if (!name) + { + gchar *dot = strrchr (file_name, '.'); + gchar *slash = strrchr (file_name, G_DIR_SEPARATOR); + + /* make sure the name has a suffix */ + if (!dot || dot < slash) + name = g_strconcat (file_name, "." G_MODULE_SUFFIX, NULL); + else + name = g_strdup (file_name); + } + + /* ok, try loading the module */ + if (name) + { + handle = _g_module_open (name, (flags & G_MODULE_BIND_LAZY) != 0, + (flags & G_MODULE_BIND_LOCAL) != 0); + } + else + { + gchar *display_file_name = g_filename_display_name (file_name); + g_module_set_error_unduped (g_strdup_printf ("unable to access file \"%s\"", display_file_name)); + g_free (display_file_name); + } + g_free (name); + + if (handle) + { + gchar *saved_error; + GModuleCheckInit check_init; + const gchar *check_failed = NULL; + + /* search the module list by handle, since file names are not unique */ + module = g_module_find_by_handle (handle); + if (module) + { + _g_module_close (module->handle, TRUE); + module->ref_count++; + g_module_set_error (NULL); + + g_static_rec_mutex_unlock (&g_module_global_lock); + return module; + } + + saved_error = g_strdup (g_module_error ()); + g_module_set_error (NULL); + + module = g_new (GModule, 1); + module->file_name = g_strdup (file_name); +#if defined (G_OS_WIN32) && !defined(_WIN64) + module->cp_file_name = g_locale_from_utf8 (file_name, -1, + NULL, NULL, NULL); +#endif + module->handle = handle; + module->ref_count = 1; + module->is_resident = FALSE; + module->unload = NULL; + module->next = modules; + modules = module; + + /* check initialization */ + if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init) && check_init != NULL) + check_failed = check_init (module); + + /* we don't call unload() if the initialization check failed. */ + if (!check_failed) + g_module_symbol (module, "g_module_unload", (gpointer) &module->unload); + + if (check_failed) + { + gchar *error; + + error = g_strconcat ("GModule (", file_name, ") ", + "initialization check failed: ", + check_failed, NULL); + g_module_close (module); + module = NULL; + g_module_set_error (error); + g_free (error); + } + else + g_module_set_error (saved_error); + + g_free (saved_error); + } + + if (module != NULL && + (module_debug_flags & G_MODULE_DEBUG_RESIDENT_MODULES)) + g_module_make_resident (module); + + g_static_rec_mutex_unlock (&g_module_global_lock); + return module; +} + +#if defined (G_OS_WIN32) && !defined(_WIN64) + +#undef g_module_open + +GModule* +g_module_open (const gchar *file_name, + GModuleFlags flags) +{ + gchar *utf8_file_name = g_locale_to_utf8 (file_name, -1, NULL, NULL, NULL); + GModule *retval = g_module_open_utf8 (utf8_file_name, flags); + + g_free (utf8_file_name); + + return retval; +} + +#endif + +gboolean +g_module_close (GModule *module) +{ + SUPPORT_OR_RETURN (FALSE); + + g_return_val_if_fail (module != NULL, FALSE); + g_return_val_if_fail (module->ref_count > 0, FALSE); + + g_static_rec_mutex_lock (&g_module_global_lock); + + module->ref_count--; + + if (!module->ref_count && !module->is_resident && module->unload) + { + GModuleUnload unload; + + unload = module->unload; + module->unload = NULL; + unload (module); + } + + if (!module->ref_count && !module->is_resident) + { + GModule *last; + GModule *node; + + last = NULL; + + node = modules; + while (node) + { + if (node == module) + { + if (last) + last->next = node->next; + else + modules = node->next; + break; + } + last = node; + node = last->next; + } + module->next = NULL; + + _g_module_close (module->handle, FALSE); + g_free (module->file_name); +#if defined (G_OS_WIN32) && !defined(_WIN64) + g_free (module->cp_file_name); +#endif + g_free (module); + } + + g_static_rec_mutex_unlock (&g_module_global_lock); + return g_module_error() == NULL; +} + +void +g_module_make_resident (GModule *module) +{ + g_return_if_fail (module != NULL); + + module->is_resident = TRUE; +} + +const gchar * +g_module_error (void) +{ + return g_static_private_get (&module_error_private); +} + +gboolean +g_module_symbol (GModule *module, + const gchar *symbol_name, + gpointer *symbol) +{ + const gchar *module_error; + + if (symbol) + *symbol = NULL; + SUPPORT_OR_RETURN (FALSE); + + g_return_val_if_fail (module != NULL, FALSE); + g_return_val_if_fail (symbol_name != NULL, FALSE); + g_return_val_if_fail (symbol != NULL, FALSE); + + g_static_rec_mutex_lock (&g_module_global_lock); + +#ifdef G_MODULE_NEED_USCORE + { + gchar *name; + + name = g_strconcat ("_", symbol_name, NULL); + *symbol = _g_module_symbol (module->handle, name); + g_free (name); + } +#else /* !G_MODULE_NEED_USCORE */ + *symbol = _g_module_symbol (module->handle, symbol_name); +#endif /* !G_MODULE_NEED_USCORE */ + + module_error = g_module_error (); + if (module_error) + { + gchar *error; + + error = g_strconcat ("`", symbol_name, "': ", module_error, NULL); + g_module_set_error (error); + g_free (error); + *symbol = NULL; + } + + g_static_rec_mutex_unlock (&g_module_global_lock); + return !module_error; +} + +const gchar * +g_module_name (GModule *module) +{ + g_return_val_if_fail (module != NULL, NULL); + + if (module == main_module) + return "main"; + + return module->file_name; +} + +#if defined (G_OS_WIN32) && !defined(_WIN64) + +#undef g_module_name + +const gchar * +g_module_name (GModule *module) +{ + g_return_val_if_fail (module != NULL, NULL); + + if (module == main_module) + return "main"; + + return module->cp_file_name; +} + +#endif + +gchar* +g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + g_return_val_if_fail (module_name != NULL, NULL); + + return _g_module_build_path (directory, module_name); +} diff --git a/deps/gmodule/gmoduleconf.h.in b/deps/gmodule/gmoduleconf.h.in new file mode 100644 index 0000000..168cf23 --- /dev/null +++ b/deps/gmodule/gmoduleconf.h.in @@ -0,0 +1,54 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __G_MODULE_CONF_H__ +#define __G_MODULE_CONF_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define G_MODULE_IMPL_NONE 0 +#define G_MODULE_IMPL_DL 1 +#define G_MODULE_IMPL_DLD 2 +#define G_MODULE_IMPL_WIN32 3 +#define G_MODULE_IMPL_OS2 4 +#define G_MODULE_IMPL_BEOS 5 +#define G_MODULE_IMPL_DYLD 6 +#define G_MODULE_IMPL_AR 7 + +#define G_MODULE_IMPL @G_MODULE_IMPL@ +#undef G_MODULE_HAVE_DLERROR +#if (@G_MODULE_HAVE_DLERROR@) +#define G_MODULE_HAVE_DLERROR +#endif +#if (@G_MODULE_NEED_USCORE@) || defined (hp9000s300) || defined (__hp9000s300) || defined (__hp9000s300__) +#define G_MODULE_NEED_USCORE +#endif +#if (@G_MODULE_BROKEN_RTLD_GLOBAL@) +#define G_MODULE_BROKEN_RTLD_GLOBAL +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __G_MODULE_CONF_H__ */ diff --git a/deps/gmodule/gmoduleconf.h.win32 b/deps/gmodule/gmoduleconf.h.win32 new file mode 100644 index 0000000..18bee9b --- /dev/null +++ b/deps/gmodule/gmoduleconf.h.win32 @@ -0,0 +1,44 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __G_MODULE_CONF_H__ +#define __G_MODULE_CONF_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define G_MODULE_IMPL_NONE 0 +#define G_MODULE_IMPL_DL 1 +#define G_MODULE_IMPL_DLD 2 +#define G_MODULE_IMPL_WIN32 3 +#define G_MODULE_IMPL_OS2 4 +#define G_MODULE_IMPL_BEOS 5 +#define G_MODULE_IMPL_DYLD 6 + +#define G_MODULE_IMPL G_MODULE_IMPL_WIN32 +#undef G_MODULE_HAVE_DLERROR + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __G_MODULE_CONF_H__ */ diff --git a/doc/CODING_STYLE b/doc/CODING_STYLE new file mode 100644 index 0000000..d982adf --- /dev/null +++ b/doc/CODING_STYLE @@ -0,0 +1,50 @@ +Cogl Coding Style +-------------------- + +This document is intended to be a short description of the preferred +coding style to be used for the Cogl source code. + +Coding style is a matter of consistency, readability and maintainance; +coding style is also completely arbitrary and a matter of taste. This +document will use examples at the very least to provide authoritative +and consistent answers to common questions regarding the coding style, +and will also try to identify the allowed exceptions. + +The Cogl coding style is currently defined relative to the Clutter +coding style, so please first read clutter/docs/CODING_STYLE. + +Differences to the Clutter coding style: + ++ Headers + +Cogl headers are not exempt from the 80 characters limit as they are in +Clutter. Function prototypes should not be arranged into vertical +columns but should instead look somthing like this: + +void +my_function (CoglType type, + CoglType *a_pointer, + CoglType another_type); + ++ Types + +Avoid the use of redundant glib typedefs and wherever possible simply +use ANSI C/c99 types. + +The following types should not be used: + gint, guint, gfloat, gdouble, glong, gulong, gchar, guchar, + guint{8,16,32} or gint{8,16,32} +Instead use: + int, unsigned int, float, double, long, unsigned long, char, + unsigned char, uint{8,16,32}_t and int{8,16,32}_t + +Use CoglBool for boolean types. + +When ever you need a byte size type for dealing with pixel data then +uint8_t should be used. + +The general intention is that Cogl should look palatable to the widest +range of C programmers including those outside the Gnome community so +- especially for the public API - we want to minimize the number of +foreign looking typedefs. + diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..e8f091e --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,9 @@ +SUBDIRS = + +if BUILD_GTK_DOC +SUBDIRS += reference +endif + +DIST_SUBDIRS = reference + +EXTRA_DIST = CODING_STYLE diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..3bb6fb0 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,753 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_GTK_DOC_TRUE@am__append_1 = reference +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = $(am__append_1) +DIST_SUBDIRS = reference +EXTRA_DIST = CODING_STYLE +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am new file mode 100644 index 0000000..20a45bd --- /dev/null +++ b/doc/reference/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = cogl cogl-2.0-experimental + +if BUILD_COGL_GST +SUBDIRS += cogl-gst +endif diff --git a/doc/reference/Makefile.in b/doc/reference/Makefile.in new file mode 100644 index 0000000..edda14c --- /dev/null +++ b/doc/reference/Makefile.in @@ -0,0 +1,752 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_COGL_GST_TRUE@am__append_1 = cogl-gst +subdir = doc/reference +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = cogl cogl-2.0-experimental cogl-gst +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = cogl cogl-2.0-experimental $(am__append_1) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/reference/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/reference/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/reference/cogl-2.0-experimental/Makefile.am b/doc/reference/cogl-2.0-experimental/Makefile.am new file mode 100644 index 0000000..fd569c8 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/Makefile.am @@ -0,0 +1,132 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=cogl-2.0-experimental + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=../../../cogl + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS=--type-init-func="g_type_init()" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS=--deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=cogl + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS=\ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDKPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=\ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h \ + $(top_srcdir)/cogl/winsys/*.h +CFILE_GLOB=$(top_srcdir)/cogl/*.c + +# Header files to ignore when scanning. +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +cogl_private_headers := \ + $(shell cd $(top_srcdir)/cogl && echo *-private.h && cd - && \ + cd $(top_srcdir)/cogl/winsys && echo *-private.h && cd -) + +IGNORE_HFILES=\ + driver \ + tesselator \ + cogl.h \ + $(cogl_private_headers) \ + cogl-atlas.h \ + cogl-path.h \ + cogl-program.h \ + cogl-shader.h \ + cogl-bitmap-packing.h \ + cogl-bitmask.h \ + cogl-blend-string.h \ + cogl-blit.h \ + cogl-boxed-value.h \ + cogl-clip-stack.h \ + cogl-debug.h \ + cogl-debug-options.h \ + cogl-defines.h \ + cogl-driver.h \ + cogl-enum-types.h \ + cogl-flags.h \ + cogl-gles2-types.h \ + cogl-gl-header.h \ + cogl-glsl-shader-boilerplate.h \ + cogl-deprecated.h \ + cogl-profile.h \ + cogl-rectangle-map.h \ + cogl-spans.h \ + cogl-texture-driver.h \ + cogl-util.h \ + $(NULL) + +EXTRA_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES = \ + fill-rule-non-zero.png \ + fill-rule-even-odd.png \ + quad-indices-order.png \ + quad-indices-triangles.png \ + cogl_ortho.png + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = \ + blend-strings.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files = \ + blend-strings.xml + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) + +AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir)/cogl -DCOGL_ENABLE_EXPERIMENTAL_API $(COGL_DEP_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/cogl/libcogl.la $(COGL_DEP_LIBS) + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +if BUILD_GTK_DOC +include $(top_srcdir)/gtk-doc.make +else +EXTRA_DIST = +endif + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in + +EXTRA_DIST += $(HTML_IMAGES) $(content_files) diff --git a/doc/reference/cogl-2.0-experimental/Makefile.in b/doc/reference/cogl-2.0-experimental/Makefile.in new file mode 100644 index 0000000..ae703f9 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/Makefile.in @@ -0,0 +1,969 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# -*- mode: makefile -*- + +#################################### +# Everything below here is generic # +#################################### +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/gtk-doc.make $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am \ + $(srcdir)/cogl-2.0-experimental-docs.xml.in +subdir = doc/reference/cogl-2.0-experimental +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-2.0-experimental-docs.xml +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE = cogl-2.0-experimental + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR = ../../../cogl + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS = --type-init-func="g_type_init()" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS = --deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS = --sgml-mode --output-format=xml --name-space=cogl + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS = + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS = \ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDKPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf + + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB = \ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h \ + $(top_srcdir)/cogl/winsys/*.h + +CFILE_GLOB = $(top_srcdir)/cogl/*.c + +# Header files to ignore when scanning. +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +cogl_private_headers := \ + $(shell cd $(top_srcdir)/cogl && echo *-private.h && cd - && \ + cd $(top_srcdir)/cogl/winsys && echo *-private.h && cd -) + +IGNORE_HFILES = \ + driver \ + tesselator \ + cogl.h \ + $(cogl_private_headers) \ + cogl-atlas.h \ + cogl-path.h \ + cogl-program.h \ + cogl-shader.h \ + cogl-bitmap-packing.h \ + cogl-bitmask.h \ + cogl-blend-string.h \ + cogl-blit.h \ + cogl-boxed-value.h \ + cogl-clip-stack.h \ + cogl-debug.h \ + cogl-debug-options.h \ + cogl-defines.h \ + cogl-driver.h \ + cogl-enum-types.h \ + cogl-flags.h \ + cogl-gles2-types.h \ + cogl-gl-header.h \ + cogl-glsl-shader-boilerplate.h \ + cogl-deprecated.h \ + cogl-profile.h \ + cogl-rectangle-map.h \ + cogl-spans.h \ + cogl-texture-driver.h \ + cogl-util.h \ + $(NULL) + +EXTRA_HFILES = + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES = \ + fill-rule-non-zero.png \ + fill-rule-even-odd.png \ + quad-indices-order.png \ + quad-indices-triangles.png \ + cogl_ortho.png + + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = \ + blend-strings.xml + + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files = \ + blend-strings.xml + + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/cogl -DCOGL_ENABLE_EXPERIMENTAL_API $(COGL_DEP_CFLAGS) +GTKDOC_LIBS = $(top_builddir)/cogl/libcogl.la $(COGL_DEP_LIBS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute + +# We set GPATH here; this gives us semantics for GNU make +# which are more like other make's VPATH, when it comes to +# whether a source that is a target of one rule is then +# searched for in VPATH/GPATH. +# +@BUILD_GTK_DOC_TRUE@GPATH = $(srcdir) +@BUILD_GTK_DOC_TRUE@TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) +@BUILD_GTK_DOC_TRUE@SETUP_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(content_files) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MAIN_SGML_FILE) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-sections.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-overrides.txt + + +# This includes the standard gtk-doc make rules, copied by gtkdocize. + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_FALSE@EXTRA_DIST = $(HTML_IMAGES) $(content_files) + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_TRUE@EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) \ +@BUILD_GTK_DOC_TRUE@ $(HTML_IMAGES) $(content_files) +@BUILD_GTK_DOC_TRUE@DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \ +@BUILD_GTK_DOC_TRUE@ html-build.stamp pdf-build.stamp \ +@BUILD_GTK_DOC_TRUE@ sgml.stamp html.stamp pdf.stamp + +@BUILD_GTK_DOC_TRUE@SCANOBJ_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).args \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).hierarchy \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).interfaces \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).prerequisites \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).signals + +@BUILD_GTK_DOC_TRUE@REPORT_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undocumented.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undeclared.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-unused.txt + +@BUILD_GTK_DOC_TRUE@CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_FALSE@HTML_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp + +#### setup #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP = $(GTK_DOC_V_SETUP_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_ = $(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_0 = @echo " DOC Preparing build"; + +#### scan #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN = $(GTK_DOC_V_SCAN_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_ = $(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_0 = @echo " DOC Scanning header files"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT = $(GTK_DOC_V_INTROSPECT_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_ = $(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_0 = @echo " DOC Introspecting gobjects"; + +#### xml #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML = $(GTK_DOC_V_XML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_ = $(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_0 = @echo " DOC Building XML"; + +#### html #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML = $(GTK_DOC_V_HTML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_ = $(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_0 = @echo " DOC Building HTML"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF = $(GTK_DOC_V_XREF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_ = $(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_0 = @echo " DOC Fixing cross-references"; + +#### pdf #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF = $(GTK_DOC_V_PDF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_ = $(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_0 = @echo " DOC Building PDF"; +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/reference/cogl-2.0-experimental/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/reference/cogl-2.0-experimental/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/gtk-doc.make: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-2.0-experimental-docs.xml: $(top_builddir)/config.status $(srcdir)/cogl-2.0-experimental-docs.xml.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +@BUILD_GTK_DOC_FALSE@dist-hook: + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +@BUILD_GTK_DOC_FALSE@all-local: +all-am: Makefile all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@BUILD_GTK_DOC_FALSE@clean-local: +@BUILD_GTK_DOC_FALSE@maintainer-clean-local: +@BUILD_GTK_DOC_FALSE@install-data-local: +@BUILD_GTK_DOC_FALSE@uninstall-local: +@BUILD_GTK_DOC_FALSE@distclean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-local + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am dist-hook \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-local + + +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@all-local: + +@BUILD_GTK_DOC_TRUE@docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) + +@BUILD_GTK_DOC_TRUE@$(REPORT_FILES): sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@setup-build.stamp: +@BUILD_GTK_DOC_TRUE@ -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ +@BUILD_GTK_DOC_TRUE@ if test "x$$files" != "x" ; then \ +@BUILD_GTK_DOC_TRUE@ for file in $$files ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $(abs_srcdir)/$$file && \ +@BUILD_GTK_DOC_TRUE@ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch setup-build.stamp + +@BUILD_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_SCAN)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options="--verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ for i in $(SCANOBJ_FILES) ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $$i || touch $$i ; \ +@BUILD_GTK_DOC_TRUE@ done \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch scan-build.stamp + +@BUILD_GTK_DOC_TRUE@$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XML)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) +@BUILD_GTK_DOC_TRUE@ -@test "x$(HTML_IMAGES)" = "x" || \ +@BUILD_GTK_DOC_TRUE@ for file in $(HTML_IMAGES) ; do \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_srcdir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_builddir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_builddir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch html-build.stamp + +@BUILD_GTK_DOC_TRUE@pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test "x$(HTML_IMAGES)" != "x"; then \ +@BUILD_GTK_DOC_TRUE@ for img in $(HTML_IMAGES); do \ +@BUILD_GTK_DOC_TRUE@ part=`dirname $$img`; \ +@BUILD_GTK_DOC_TRUE@ echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ +@BUILD_GTK_DOC_TRUE@ if test $$? != 0; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch pdf-build.stamp + +############## + +@BUILD_GTK_DOC_TRUE@clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -f *~ *.bak +@BUILD_GTK_DOC_TRUE@ @rm -rf .libs + +@BUILD_GTK_DOC_TRUE@distclean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt +@BUILD_GTK_DOC_TRUE@ @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@maintainer-clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html + +@BUILD_GTK_DOC_TRUE@install-data-local: +@BUILD_GTK_DOC_TRUE@ @installfiles=`echo $(builddir)/html/*`; \ +@BUILD_GTK_DOC_TRUE@ if test "$$installfiles" = '$(builddir)/html/*'; \ +@BUILD_GTK_DOC_TRUE@ then echo 1>&2 'Nothing to install' ; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(mkinstalldirs) $${installdir} ; \ +@BUILD_GTK_DOC_TRUE@ for i in $$installfiles; do \ +@BUILD_GTK_DOC_TRUE@ echo ' $(INSTALL_DATA) '$$i ; \ +@BUILD_GTK_DOC_TRUE@ $(INSTALL_DATA) $$i $${installdir}; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ +@BUILD_GTK_DOC_TRUE@ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@uninstall-local: +@BUILD_GTK_DOC_TRUE@ @if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ rm -rf $${installdir} + +# +# Require gtk-doc when making dist +# +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: docs +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @false + +@BUILD_GTK_DOC_TRUE@dist-hook: dist-check-gtkdoc dist-hook-local +@BUILD_GTK_DOC_TRUE@ @mkdir $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @cp ./html/* $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).pdf $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).types $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @cd $(distdir) && rm -f $(DISTCLEANFILES) +@BUILD_GTK_DOC_TRUE@ @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + +@BUILD_GTK_DOC_TRUE@.PHONY : dist-hook-local docs + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/reference/cogl-2.0-experimental/blend-strings.xml b/doc/reference/cogl-2.0-experimental/blend-strings.xml new file mode 100644 index 0000000..421ab23 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/blend-strings.xml @@ -0,0 +1,129 @@ + + +]> + + + +Blend Strings +3 +COGL Library + + + +Blend Strings +A simple syntax and grammar for describing blending and texture +combining functions. + + + +Cogl Blend Strings + +Describing GPU blending and texture combining states is rather awkward to do +in a consise but also readable fashion. Cogl helps by supporting +string based descriptions using a simple syntax. + + +
+Some examples + +Here is an example used for blending: + +"RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))" + +In OpenGL terms this replaces glBlendFunc[Separate] and +glBlendEquation[Separate] + +Actually in this case it's more verbose than the GL equivalent: + + +glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + +But unless you are familiar with OpenGL or refer to its API documentation +you wouldn't know that the default function used by OpenGL is GL_FUNC_ADD +nor would you know that the above arguments determine what the source color +and destination color will be multiplied by before being adding. + + +Here is an example used for texture combining: + +"RGB = REPLACE (PREVIOUS)" +"A = MODULATE (PREVIOUS, TEXTURE)" + + +In OpenGL terms this replaces glTexEnv, and the above example is equivalent +to this OpenGL code: + + + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR); + + +
+ +
+Here's the syntax + + +<statement>: + <channel-mask>=<function-name>(<arg-list>) + + You can either use a single statement with an RGBA channel-mask or you can use + two statements; one with an A channel-mask and the other with an RGB + channel-mask. + +<channel-mask>: + A or RGB or RGBA + +<function-name>: + [A-Za-z_]* + +<arg-list>: + <arg>,<arg> + or <arg> + or "" + + I.e. functions may take 0 or more arguments + +<arg>: + <color-source> + 1 - <color-source> : Only intended for texture combining + <color-source> * ( <factor> ) : Only intended for blending + 0 : Only intended for blending + + See the blending or texture combining sections for further notes and examples. + +<color-source>: + <source-name>[<channel-mask>] + <source-name> + + See the blending or texture combining sections for the list of source-names + valid in each context. + + If a channel mask is not given then the channel mask of the statement + is assumed instead. + +<factor>: + 0 + 1 + <color-source> + 1-<color-source> + SRC_ALPHA_SATURATE + + +
+ + +
+ + +
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml new file mode 100644 index 0000000..2370875 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml @@ -0,0 +1,229 @@ + + +]> + + + + Cogl 2.0 Reference Manual + for Cogl 2.0; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + 2011 + 2012 + 2013 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl - a modern 3D graphics API + +
+ About Cogl + + Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits. + +
+ +
+ General API concepts + + + +
+ +
+ Setting Up A Drawing Context + + + + +
+ +
+ Setting Up A GPU Pipeline + + + + +
+ +
+ Allocating GPU Memory + + + +
+ +
+ Describing the layout of GPU Memory + + +
+ +
+ Geometry + + + +
+ +
+ Textures + + +
+ +
+ Meta Textures + + + + +
+ +
+ Primitive Textures + + + + +
+ +
+ Framebuffers + + + +
+ +
+ Utilities + + + + + + + + +
+ +
+ Binding and Integrating + + + + +
+ +
+ + + Glossaries + + + + + + Index of all symbols + + + + + Index of deprecated symbols + + + + + Index of new symbols in 0.8 + + + + + Index of new symbols in 1.0 + + + + + Index of new symbols in 1.2 + + + + + Index of new symbols in 1.4 + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml.in b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml.in new file mode 100644 index 0000000..8b0726a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml.in @@ -0,0 +1,229 @@ + + +]> + + + + Cogl 2.0 Reference Manual + for Cogl 2.0; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + 2011 + 2012 + 2013 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl - a modern 3D graphics API + +
+ About Cogl + + Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits. + +
+ +
+ General API concepts + + + +
+ +
+ Setting Up A Drawing Context + + + + +
+ +
+ Setting Up A GPU Pipeline + + + + +
+ +
+ Allocating GPU Memory + + + +
+ +
+ Describing the layout of GPU Memory + + +
+ +
+ Geometry + + + +
+ +
+ Textures + + +
+ +
+ Meta Textures + + + + +
+ +
+ Primitive Textures + + + + +
+ +
+ Framebuffers + + + +
+ +
+ Utilities + + + + + + + + +
+ +
+ Binding and Integrating + + + + +
+ +
+ + + Glossaries + + + + + + Index of all symbols + + + + + Index of deprecated symbols + + + + + Index of new symbols in 0.8 + + + + + Index of new symbols in 1.0 + + + + + Index of new symbols in 1.2 + + + + + Index of new symbols in 1.4 + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-overrides.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-overrides.txt new file mode 100644 index 0000000..e69de29 diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt new file mode 100644 index 0000000..94a1e65 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt @@ -0,0 +1,1058 @@ +
+cogl-object +The Object Interface +CoglObject +cogl_object_ref +cogl_object_unref +CoglUserDataKey +CoglUserDataDestroyCallback +cogl_object_get_user_data +cogl_object_set_user_data +
+ +
+cogl-error +Exception handling +CoglError +cogl_error_matches +cogl_error_free +cogl_error_copy +COGL_GLIB_ERROR +
+ +
+cogl-types +Common Types + +CoglVertexP2 +CoglVertexP3 +CoglVertexP2C4 +CoglVertexP3C4 +CoglVertexP2T2 +CoglVertexP3T2 +CoglVertexP2T2C4 +CoglVertexP3T2C4 +CoglVerticesMode + + +CoglFuncPtr +CoglPixelFormat +CoglBufferTarget +CoglBufferBit +CoglAttributeType +CoglColorMask + + +CoglTextureFlags + + +CoglBool +
+ +
+cogl-renderer +CoglRenderer: Connect to a backend renderer + +CoglRenderer +cogl_is_renderer + + +cogl_renderer_new +cogl_renderer_get_n_fragment_texture_units +cogl_renderer_connect + + +CoglWinsysID +cogl_renderer_set_winsys_id +cogl_renderer_get_winsys_id +CoglRendererConstraint +cogl_renderer_add_constraint +cogl_renderer_remove_constraint + + +cogl_xlib_renderer_set_foreign_display +cogl_xlib_renderer_get_foreign_display + + +CoglXlibFilterFunc +CoglFilterReturn +cogl_xlib_renderer_add_filter +cogl_xlib_renderer_remove_filter +cogl_xlib_renderer_handle_event + + +CoglWin32FilterFunc +cogl_win32_renderer_add_filter +cogl_win32_renderer_remove_filter +cogl_win32_renderer_handle_event +cogl_win32_renderer_set_event_retrieval_enabled + + +cogl_wayland_renderer_set_foreign_display +cogl_wayland_renderer_set_event_dispatch_enabled +cogl_wayland_renderer_get_display +
+ +
+cogl-swap-chain +CoglSwapChain: Describe a set of back buffers for flipping between + +CoglSwapChain +cogl_is_swap_chain + + +cogl_swap_chain_new +cogl_swap_chain_set_has_alpha +cogl_swap_chain_set_length +
+ +
+cogl-onscreen-template +CoglOnscreenTemplate: Describe a template for onscreen framebuffers + +CoglOnscreenTemplate +cogl_is_onscreen_template + + +cogl_onscreen_template_new +
+ +
+cogl-display +CoglDisplay: Setup a display pipeline + +CoglDisplay +cogl_is_display + + +cogl_display_new +cogl_display_get_renderer +cogl_display_setup + + +cogl_gdl_display_set_plane + + +cogl_wayland_display_set_compositor_display +
+ +
+cogl-context +The Top-Level Context + + +CoglContext +cogl_is_context +cogl_context_new +cogl_context_get_display + + +CoglFeatureID +cogl_has_feature +cogl_has_features +CoglFeatureCallback +cogl_foreach_feature + + +cogl_push_matrix +cogl_pop_matrix +cogl_scale +cogl_translate +cogl_rotate +cogl_transform +cogl_frustum +cogl_perspective +cogl_ortho + + +cogl_get_modelview_matrix +cogl_set_modelview_matrix +cogl_get_projection_matrix +cogl_set_projection_matrix +cogl_set_viewport +cogl_get_viewport + + +cogl_set_source +cogl_set_source_color +cogl_set_source_color4ub +cogl_set_source_color4f +cogl_set_source_texture +cogl_get_source +cogl_push_source +cogl_pop_source + + +COGL_TYPE_BUFFER_BIT +cogl_clear + + +CoglReadPixelsFlags +cogl_read_pixels + + +cogl_flush + + +COGL_TYPE_ATTRIBUTE_TYPE +COGL_TYPE_BLEND_STRING_ERROR +COGL_TYPE_BUFFER_ACCESS +COGL_TYPE_BUFFER_TARGET +COGL_TYPE_BUFFER_UPDATE_HINT +COGL_TYPE_BUFFER_USAGE_HINT +COGL_TYPE_DEBUG_FLAGS +COGL_TYPE_DRIVER_ERROR +COGL_TYPE_FEATURE_FLAGS +COGL_TYPE_INDICES_TYPE +COGL_TYPE_PIXEL_FORMAT +COGL_TYPE_READ_PIXELS_FLAGS +COGL_TYPE_TEXTURE_FLAGS +COGL_TYPE_VERTICES_MODE + + +COGL_DRIVER_ERROR +CoglDriverError +cogl_attribute_type_get_type +cogl_buffer_bit_get_type +cogl_buffer_target_get_type +cogl_debug_flags_get_type +cogl_driver_error_get_type +cogl_feature_flags_get_type +cogl_fixed_get_type +cogl_fog_mode_get_type +cogl_indices_type_get_type +cogl_pixel_format_get_type +cogl_read_pixels_flags_get_type +cogl_shader_type_get_type +cogl_texture_flags_get_type +cogl_vertices_mode_get_type +COGL_AFIRST_BIT +COGL_A_BIT +COGL_BGR_BIT +COGL_PREMULT_BIT +
+ +
+cogl-poll +Main loop integration +CoglPollFDEvent +CoglPollFD +cogl_poll_renderer_get_info +cogl_poll_renderer_dispatch +cogl_glib_source_new +cogl_glib_renderer_source_new +
+ +
+cogl-attribute +Vertex Attributes +CoglAttribute +cogl_attribute_new +cogl_is_attribute +cogl_attribute_set_normalized +cogl_attribute_get_normalized +cogl_attribute_get_buffer +cogl_attribute_set_buffer +
+ +
+cogl-indices +Indices + + +CoglIndices +cogl_is_indices + + +CoglIndicesType +cogl_indices_new + + +cogl_get_rectangle_indices +
+ +
+cogl-primitive +Primitives +CoglPrimitive +cogl_primitive_new +cogl_primitive_new_with_attributes +cogl_primitive_new_p2 +cogl_primitive_new_p3 +cogl_primitive_new_p2c4 +cogl_primitive_new_p3c4 +cogl_primitive_new_p2t2 +cogl_primitive_new_p3t2 +cogl_primitive_new_p2t2c4 +cogl_primitive_new_p3t2c4 +cogl_is_primitive +cogl_primitive_get_first_vertex +cogl_primitive_set_first_vertex +cogl_primitive_get_n_vertices +cogl_primitive_set_n_vertices +cogl_primitive_get_mode +cogl_primitive_set_mode +cogl_primitive_set_attributes +cogl_primitive_get_indices +cogl_primitive_set_indices +cogl_primitive_copy +CoglPrimitiveAttributeCallback +cogl_primitive_foreach_attribute +cogl_primitive_draw +
+ +
+cogl-rectangle +Rectangles +cogl_rectangle +cogl_rectangles +cogl_rectangle_with_texture_coords +cogl_rectangles_with_texture_coords +cogl_rectangle_with_multitexture_coords +
+ +
+cogl-snippet +Shader snippets +CoglSnippet +CoglSnippetHook +cogl_snippet_new +cogl_snippet_get_hook +cogl_is_snippet +cogl_snippet_set_declarations +cogl_snippet_get_declarations +cogl_snippet_set_pre +cogl_snippet_get_pre +cogl_snippet_set_replace +cogl_snippet_get_replace +cogl_snippet_set_post +cogl_snippet_get_post +
+ +
+cogl-primitives-deprecated +Primitives (Deprecated) +cogl_polygon +
+ +
+cogl-paths +Path Primitives +CoglPath +cogl_is_path +cogl_path_new +cogl_path_copy +cogl_path_move_to +cogl_path_close +cogl_path_line_to +cogl_path_curve_to +cogl_path_arc +cogl_path_rel_move_to +cogl_path_rel_line_to +cogl_path_rel_curve_to +cogl_path_line +cogl_path_polyline +cogl_path_polygon +cogl_path_rectangle +cogl_path_round_rectangle +cogl_path_ellipse + + +CoglPathFillRule +cogl_path_set_fill_rule +cogl_path_get_fill_rule +
+ +
+cogl-bitmap +Bitmap + + +CoglBitmap +cogl_is_bitmap + + +cogl_bitmap_new_from_file +cogl_bitmap_new_from_buffer +cogl_bitmap_new_with_size +cogl_bitmap_new_for_data + + +cogl_bitmap_get_format +cogl_bitmap_get_width +cogl_bitmap_get_height +cogl_bitmap_get_rowstride +cogl_bitmap_get_buffer +cogl_bitmap_get_size_from_file + + +cogl_texture_new_from_bitmap + + +COGL_BITMAP_ERROR +CoglBitmapError +
+ +
+cogl-texture +The Texture Interface +CoglTexture +cogl_is_texture + + +COGL_TEXTURE_ERROR +CoglTextureError + + +cogl_texture_allocate +cogl_texture_get_width +cogl_texture_get_height +cogl_texture_is_sliced +cogl_texture_get_data +cogl_texture_set_data +cogl_texture_set_region +CoglTextureType +CoglTextureComponents +cogl_texture_set_components +cogl_texture_get_components +cogl_texture_set_premultiplied +cogl_texture_get_premultiplied + + +COGL_TEXTURE_MAX_WASTE +
+ +
+cogl-texture-2d +2D textures +CoglTexture2D +cogl_texture_2d_new_with_size +cogl_texture_2d_new_from_file +cogl_texture_2d_new_from_bitmap +cogl_texture_2d_new_from_data +cogl_texture_2d_gl_new_from_foreign +cogl_is_texture_rectangle +
+ +
+cogl-texture-rectangle +Rectangle textures (non-normalized coordinates) +CoglTextureRectangle +cogl_texture_rectangle_new_with_size +cogl_texture_rectangle_new_from_bitmap +cogl_is_texture_rectangle +
+ +
+cogl-texture-3d +3D textures +CoglTexture3D +cogl_texture_3d_new_with_size +cogl_texture_3d_new_from_bitmap +cogl_texture_3d_new_from_data +cogl_is_texture_3d +
+ +
+cogl-meta-texture +High Level Meta Textures +CoglMetaTexture +CoglMetaTextureCallback +cogl_meta_texture_foreach_in_region +
+ +
+cogl-primitive-texture +Low-level primitive textures +CoglPrimitiveTexture +cogl_is_primitive_texture +cogl_primitive_texture_set_auto_mipmap +
+ +
+cogl-sub-texture +Sub Textures +CoglSubTexture +cogl_sub_texture_new +cogl_is_sub_texture +
+ +
+cogl-atlas-texture +Atlas Textures +CoglAtlasTexture +cogl_atlas_texture_new_with_size +cogl_atlas_texture_new_from_file +cogl_atlas_texture_new_from_data +cogl_atlas_texture_new_from_bitmap +cogl_is_atlas_texture +
+ +
+cogl-texture-2d-sliced +Sliced Textures +CoglTexture2DSliced +cogl_texture_2d_sliced_new_with_size +cogl_texture_2d_sliced_new_from_file +cogl_texture_2d_sliced_new_from_data +cogl_texture_2d_sliced_new_from_bitmap +cogl_is_texture_2d_sliced +
+ +
+cogl-texture-pixmap-x11 +X11 Texture From Pixmap + +CoglTexturePixmapX11 +cogl_is_texture_pixmap_x11 + + +cogl_texture_pixmap_x11_new + + +cogl_texture_pixmap_x11_update_area +cogl_texture_pixmap_x11_is_using_tfp_extension +CoglTexturePixmapX11ReportLevel +cogl_texture_pixmap_x11_set_damage_object +
+ +
+cogl-framebuffer +CoglFramebuffer: The Framebuffer Interface +CoglFramebuffer +COGL_FRAMEBUFFER +cogl_framebuffer_allocate +cogl_framebuffer_get_width +cogl_framebuffer_get_height +cogl_framebuffer_set_viewport +cogl_framebuffer_get_viewport_x +cogl_framebuffer_get_viewport_y +cogl_framebuffer_get_viewport_width +cogl_framebuffer_get_viewport_height +cogl_framebuffer_get_viewport4fv +cogl_framebuffer_get_red_bits +cogl_framebuffer_get_green_bits +cogl_framebuffer_get_blue_bits +cogl_framebuffer_get_alpha_bits +cogl_framebuffer_get_depth_bits +cogl_framebuffer_get_color_mask +cogl_framebuffer_set_color_mask +cogl_framebuffer_get_samples_per_pixel +cogl_framebuffer_set_samples_per_pixel +cogl_framebuffer_resolve_samples +cogl_framebuffer_resolve_samples_region +cogl_framebuffer_get_context +cogl_framebuffer_clear +cogl_framebuffer_clear4f +cogl_framebuffer_read_pixels_into_bitmap +cogl_framebuffer_read_pixels +cogl_framebuffer_set_dither_enabled +cogl_framebuffer_get_dither_enabled + + +cogl_framebuffer_draw_rectangle +cogl_framebuffer_draw_textured_rectangle +cogl_framebuffer_draw_multitextured_rectangle +cogl_framebuffer_draw_rectangles +cogl_framebuffer_draw_textured_rectangles +cogl_framebuffer_stroke_path +cogl_framebuffer_fill_path + + +cogl_framebuffer_discard_buffers +cogl_framebuffer_finish + + +cogl_framebuffer_push_matrix +cogl_framebuffer_pop_matrix +cogl_framebuffer_identity_matrix +cogl_framebuffer_scale +cogl_framebuffer_translate +cogl_framebuffer_rotate +cogl_framebuffer_rotate_euler +cogl_framebuffer_rotate_quaternion +cogl_framebuffer_transform +cogl_framebuffer_get_modelview_matrix +cogl_framebuffer_set_modelview_matrix + + +cogl_framebuffer_perspective +cogl_framebuffer_frustum +cogl_framebuffer_orthographic +cogl_framebuffer_get_projection_matrix +cogl_framebuffer_set_projection_matrix + + +cogl_framebuffer_push_scissor_clip +cogl_framebuffer_push_rectangle_clip +cogl_framebuffer_push_path_clip +cogl_framebuffer_push_primitive_clip +cogl_framebuffer_pop_clip + + +cogl_get_draw_framebuffer +cogl_set_framebuffer +cogl_push_framebuffer +cogl_pop_framebuffer +
+ +
+cogl-onscreen +CoglOnscreen: The Onscreen Framebuffer Interface + +CoglOnscreen +cogl_is_onscreen +COGL_ONSCREEN + + +cogl_onscreen_new + + +CoglOnscreenX11MaskCallback +cogl_x11_onscreen_set_foreign_window_xid +cogl_x11_onscreen_get_window_xid +cogl_x11_onscreen_get_visual_xid + + +cogl_win32_onscreen_set_foreign_window +cogl_win32_onscreen_get_window + + +cogl_onscreen_show +cogl_onscreen_hide + + +CoglFrameCallback +CoglFrameClosure +cogl_onscreen_add_frame_callback +cogl_onscreen_remove_frame_callback + + +CoglOnscreenDirtyInfo +CoglOnscreenDirtyCallback +CoglOnscreenDirtyClosure +cogl_onscreen_add_dirty_callback +cogl_onscreen_remove_dirty_callback + + +CoglOnscreenResizeCallback +CoglOnscreenResizeClosure +cogl_onscreen_add_resize_callback +cogl_onscreen_remove_resize_callback + + +cogl_onscreen_swap_buffers +cogl_onscreen_swap_buffers_with_damage +cogl_onscreen_swap_region +cogl_onscreen_set_swap_throttled +CoglSwapBuffersNotify +cogl_onscreen_add_swap_buffers_callback +cogl_onscreen_remove_swap_buffers_callback +
+ +
+cogl-offscreen +Offscreen Framebuffers + +CoglOffscreen +cogl_is_offscreen + + +cogl_offscreen_new_with_texture +
+ +
+cogl-color +Color Type +CoglColor +cogl_color_new +cogl_color_copy +cogl_color_free +cogl_color_set_from_4ub +cogl_color_set_from_4f + + +cogl_color_get_red +cogl_color_get_green +cogl_color_get_blue +cogl_color_get_alpha + + +cogl_color_get_red_byte +cogl_color_get_green_byte +cogl_color_get_blue_byte +cogl_color_get_alpha_byte + + +cogl_color_get_red_float +cogl_color_get_green_float +cogl_color_get_blue_float +cogl_color_get_alpha_float + + +cogl_color_set_red +cogl_color_set_green +cogl_color_set_blue +cogl_color_set_alpha + + +cogl_color_set_red_byte +cogl_color_set_green_byte +cogl_color_set_blue_byte +cogl_color_set_alpha_byte + + +cogl_color_set_red_float +cogl_color_set_green_float +cogl_color_set_blue_float +cogl_color_set_alpha_float + + +cogl_color_premultiply +cogl_color_unpremultiply +cogl_color_equal + + +cogl_color_init_from_hsl +cogl_color_to_hsl +
+ +
+cogl-matrix +Matrices +CoglMatrix +cogl_matrix_init_identity +cogl_matrix_init_from_array +cogl_matrix_init_translation +cogl_matrix_init_from_quaternion +cogl_matrix_init_from_euler +cogl_matrix_copy +cogl_matrix_equal +cogl_matrix_free +cogl_matrix_frustum +cogl_matrix_orthographic +cogl_matrix_perspective +cogl_matrix_look_at +cogl_matrix_multiply +cogl_matrix_rotate +cogl_matrix_rotate_quaternion +cogl_matrix_rotate_euler +cogl_matrix_translate +cogl_matrix_scale +cogl_matrix_transpose +cogl_matrix_get_array +cogl_matrix_get_inverse +cogl_matrix_transform_point +cogl_matrix_transform_points +cogl_matrix_project_points +cogl_matrix_is_identity +
+ +
+cogl-matrix-stack +Matrix Stacks +CoglMatrixStack +CoglMatrixEntry +cogl_matrix_stack_new +cogl_matrix_stack_push +cogl_matrix_stack_pop +cogl_matrix_stack_load_identity +cogl_matrix_stack_scale +cogl_matrix_stack_translate +cogl_matrix_stack_rotate +cogl_matrix_stack_rotate_quaternion +cogl_matrix_stack_rotate_euler +cogl_matrix_stack_multiply +cogl_matrix_stack_frustum +cogl_matrix_stack_perspective +cogl_matrix_stack_orthographic +cogl_matrix_stack_get_inverse +cogl_matrix_stack_get_entry +cogl_matrix_stack_get +cogl_matrix_entry_get +cogl_matrix_stack_set +cogl_matrix_entry_calculate_translation +cogl_matrix_entry_is_identity +cogl_matrix_entry_equal +cogl_matrix_entry_ref +cogl_matrix_entry_unref +
+ +
+cogl-euler +Eulers (Rotations) +CoglEuler +cogl_euler_init +cogl_euler_init_from_matrix +cogl_euler_init_from_quaternion +cogl_euler_equal +cogl_euler_copy +cogl_euler_free +
+ +
+cogl-quaternion +Quaternions (Rotations) +CoglQuaternion +cogl_quaternion_init_identity +cogl_quaternion_init +cogl_quaternion_init_from_quaternion +cogl_quaternion_init_from_angle_vector +cogl_quaternion_init_from_array +cogl_quaternion_init_from_x_rotation +cogl_quaternion_init_from_y_rotation +cogl_quaternion_init_from_z_rotation +cogl_quaternion_init_from_euler +cogl_quaternion_equal +cogl_quaternion_copy +cogl_quaternion_free +cogl_quaternion_get_rotation_angle +cogl_quaternion_get_rotation_axis +cogl_quaternion_normalize +cogl_quaternion_dot_product +cogl_quaternion_invert +cogl_quaternion_multiply +cogl_quaternion_pow +cogl_quaternion_slerp +cogl_quaternion_nlerp +cogl_quaternion_squad +cogl_get_static_identity_quaternion +cogl_get_static_zero_quaternion +
+ +
+cogl-pipeline +Pipeline +CoglPipeline +cogl_pipeline_new +cogl_pipeline_copy +cogl_is_pipeline + +cogl_pipeline_set_color +cogl_pipeline_set_color4ub +cogl_pipeline_set_color4f +cogl_pipeline_get_color + +cogl_pipeline_set_ambient +cogl_pipeline_get_ambient +cogl_pipeline_set_diffuse +cogl_pipeline_get_diffuse +cogl_pipeline_set_ambient_and_diffuse +cogl_pipeline_set_emission +cogl_pipeline_get_emission +cogl_pipeline_set_specular +cogl_pipeline_get_specular +cogl_pipeline_set_shininess +cogl_pipeline_get_shininess + +CoglPipelineAlphaFunc +cogl_pipeline_set_alpha_test_function + +COGL_BLEND_STRING_ERROR +CoglBlendStringError +cogl_pipeline_set_blend +cogl_pipeline_set_blend_constant +cogl_pipeline_set_point_size +cogl_pipeline_get_point_size +cogl_pipeline_set_per_vertex_point_size +cogl_pipeline_get_per_vertex_point_size + +cogl_pipeline_get_color_mask +cogl_pipeline_set_color_mask + +cogl_pipeline_set_depth_state +cogl_pipeline_get_depth_state + +CoglPipelineCullFaceMode +cogl_pipeline_set_cull_face_mode +CoglWinding +cogl_pipeline_set_front_face_winding + +cogl_pipeline_set_layer_texture +cogl_pipeline_set_layer_null_texture +cogl_pipeline_get_layer_texture +CoglPipelineFilter +cogl_pipeline_set_layer_filters +cogl_pipeline_get_layer_min_filter +cogl_pipeline_get_layer_mag_filter +CoglPipelineWrapMode +cogl_pipeline_set_layer_wrap_mode +cogl_pipeline_set_layer_wrap_mode_s +cogl_pipeline_set_layer_wrap_mode_t +cogl_pipeline_set_layer_wrap_mode_p +cogl_pipeline_set_layer_combine +cogl_pipeline_set_layer_combine_constant +cogl_pipeline_set_layer_matrix +cogl_pipeline_set_layer_point_sprite_coords_enabled +cogl_pipeline_get_layer_point_sprite_coords_enabled + +cogl_pipeline_remove_layer + +cogl_pipeline_get_n_layers +CoglPipelineLayerCallback +cogl_pipeline_foreach_layer + +cogl_pipeline_get_uniform_location +cogl_pipeline_set_uniform_1f +cogl_pipeline_set_uniform_1i +cogl_pipeline_set_uniform_float +cogl_pipeline_set_uniform_int +cogl_pipeline_set_uniform_matrix + +cogl_pipeline_add_snippet +cogl_pipeline_add_layer_snippet + + +cogl_blend_string_error_get_type +cogl_blend_string_error_domain +
+ +
+cogl-depth-state +Depth State +CoglDepthState +CoglDepthTestFunction +cogl_depth_state_init +cogl_depth_state_set_test_enabled +cogl_depth_state_get_test_enabled +cogl_depth_state_set_test_function +cogl_depth_state_get_test_function +cogl_depth_state_set_write_enabled +cogl_depth_state_get_write_enabled +cogl_depth_state_set_range +cogl_depth_state_get_range +
+ +
+cogl-buffer +CoglBuffer: The Buffer Interface +CoglBuffer +cogl_is_buffer +cogl_buffer_get_size +CoglBufferUsageHint +cogl_buffer_set_usage_hint +cogl_buffer_get_usage_hint +CoglBufferUpdateHint +cogl_buffer_set_update_hint +cogl_buffer_get_update_hint +CoglBufferAccess +CoglBufferMapHint +cogl_buffer_map +cogl_buffer_map_range +cogl_buffer_unmap +cogl_buffer_set_data + + +CoglPixelBuffer +cogl_pixel_buffer_new +cogl_is_pixel_buffer + + +cogl_buffer_access_get_type +cogl_buffer_update_hint_get_type +cogl_buffer_usage_hint_get_type +
+ +
+cogl-attribute-buffer +CoglAttributeBuffer: Buffers of vertex attributes +CoglAttributeBuffer +cogl_attribute_buffer_new_with_size +cogl_attribute_buffer_new +cogl_is_attribute_buffer +
+ +
+cogl-index-buffer +CoglIndexBuffer: Buffers of vertex indices +CoglIndexBuffer +cogl_index_buffer_new +cogl_is_index_buffer +
+ +
+cogl-vector +3 Component Vectors +cogl_vector3_init +cogl_vector3_init_zero +cogl_vector3_equal +cogl_vector3_equal_with_epsilon +cogl_vector3_copy +cogl_vector3_free +cogl_vector3_invert +cogl_vector3_add +cogl_vector3_subtract +cogl_vector3_multiply_scalar +cogl_vector3_divide_scalar +cogl_vector3_normalize +cogl_vector3_magnitude +cogl_vector3_cross_product +cogl_vector3_dot_product +cogl_vector3_distance +
+ +
+cogl-fence +GPU synchronisation fences +CoglFence +CoglFenceCallback +CoglFenceClosure +cogl_fence_closure_get_user_data +cogl_framebuffer_add_fence_callback +cogl_framebuffer_cancel_fence_callback +
+ +
+cogl-version +Versioning utility macros +COGL_VERSION_MAJOR +COGL_VERSION_MINOR +COGL_VERSION_MICRO +COGL_VERSION_STRING +COGL_VERSION +COGL_VERSION_ENCODE +COGL_VERSION_CHECK +COGL_VERSION_GET_MAJOR +COGL_VERSION_GET_MINOR +COGL_VERSION_GET_MICRO +
+ +
+cogl-gtype +GType Integration API +cogl_gtype_matrix_get_type +
+ +
+cogl-sdl +SDL Integration +cogl_sdl_context_new +cogl_sdl_renderer_set_event_type +cogl_sdl_renderer_get_event_type +cogl_sdl_handle_event +cogl_sdl_idle +cogl_sdl_onscreen_get_window +
+ +
+cogl-gles2 +GLES 2.0 context + + +CoglGLES2Context +CoglGLES2Vtable +COGL_GLES2_CONTEXT_ERROR +CoglGLES2ContextError +cogl_gles2_context_new +cogl_is_gles2_context + + +cogl_gles2_context_get_vtable +cogl_push_gles2_context +cogl_pop_gles2_context +cogl_gles2_get_current_vtable + + +cogl_gles2_texture_2d_new_from_handle +cogl_gles2_texture_get_handle +
diff --git a/doc/reference/cogl-2.0-experimental/cogl_ortho.png b/doc/reference/cogl-2.0-experimental/cogl_ortho.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2a1fd20be98e26e1ef6f3eb2bc664970f5fc62 GIT binary patch literal 12650 zcmb_@cRbbq`}g}CP6p2^64 z`FzLk`+5An_x;y>9uJkH^Ios(^}L?r5~Oll?kqkvK7t@;735{r5Co+SUm|#DcqjM$ zwi*0|a#oX*LGr)RF2FZu9OQMK5#-#xlP^@3ROSPC^YlZ7TQ^P*W2jN0JPyyvrV)ez zQIM6^a2sAp^3W$8C~Fa7oI2{mx*Ld~OWp9P<{R72OKHk$kS(ivmRWibl|8-@QtF$z zc>a7y)-Nr+g9!9p4Hdfcxmam3D{24I8FFdPE7F1TgaO2USQ)3|Sm&))Htf%)US6j(@b5nrO~2ql7K!KJ0bjrgA29w&VL&l{8V_4P;vITEGl z<5PDx7ptd7Gs=Rfa3&=sUB7;PF&BL&MKUk}7g02GbK7f;WP^8BR#qG$5$uq-$FA}% zP2ctzk|5cN>qx4`*RNkiMMe8GFv(Irb`}<=h0Y*R!C_%%6FRhv$lX>-2PRojzG~eA z1C&9sRypV^hSeVm3;p2WZKqmd5#e0qS!0}tGwUcLq9SNgsB=pb%Ru~6p5^4&Rh+!y z;)La=5&m2`-z_}}+MNf9{DOkxwO%9j^}dSfqQb)18RQ`@Gjm#Pt)#lTdZ{%*mT)j* z((Q9ZMBm!lL?6z-Oi3|PP&lJOgq8bHQu5QOa&eGZ#Y``?uC6XCYyQvCfsp+;*X7I1 zk*yxP%c@@Yaghwn<;%INt9AzTly3Xm50sTdD=S50zI1nQ6n9GAFCLPRkWi6A4C+69 zLKl=F=Z(&E_4caAQI5M!pB);DCc@D}97KMDg+Q5j{(DvGp4tH`H(DWR=s@ z{QivITb=o+(! zINcJS5Emy6_bP{Z?BVhKHfGQBPe~Tm$!T+QrhTp>;j{owm!zVSQsk>w@bli@UZZL^ zMhQC;6Ex>KeNj=-7t?FeiqXT!&Z#a|3N9Uoqy3%DO(!KKrJ?l4H*el_yFvfiS$}e- zJ?8f9+c^)r;2%B*E9E;&12Hi%N-VGX`}b2KOM7^DV6na-Aq2v* z)1xv>5ijVaYTdVHH#avUjsx?{F+2tzw`XFE%q=XQ1)RL{45|dLUF(^cpwFowd!s@{ zP2D!*goA@~j#k)Vy7}yS(9Mb)JVo>Vr_ae;zkVl4^pY#JU9U6Cp5tO)_S2`Q&ZG)@ zZgmLJd#4jZiIZ)t5-!1Q!+LK?d=4NQE_o+>{Ol0^=myV-@cXkSYsP{}8(EclpFVxEvbNUc(vp$+ zg8NjH@Awwz`*?x4q`lFnI17F50#j1*7C{Hm-KhY ziGyT&zRSY7bi$Pmx}siM4Js=R$(N%2j6Y_$`Rhgb!3)dqQoZDX7HY__E%XAPR=)n3 zj?D+Sdd?hTBY9O-2{Lbd^-7w#Pn|mD<>jTWjS`nT&G_lr-Kp8x*~P`XMn+e>ew3D% z_geBhg!ET5b#)QPkWIPe_y#wIp$b^8T`NjWMXIheH8t_@@N{9-eac}SP5f}+ft9FW zsHv$1Z3gR23ds^1r#D_jM*dnEc~)?*?r^ic|GgeLWmtphweX8#WscL$^xk{Yy^pxr z+2_}Mjy*Iq`hIWCT`~9=6(5hU%kq7KTZ6MSJ3HuR+QQOO?oG^kqF9CZ(c>mI-ng&6 zzP|naT9~=0*ROeWi%h@gXx>la6&4m&ZH!MyI7cTwKRLO+w{gG8LQ7lwSzw?7%PYNd zI}uUQ@e0TLBu&{gP&{E_VJ3xC=4Y*f_1wghRoFde9&BuE{8}ATFR1h{NNk*3Sb$2t zwGa@dy0NvTe&{syvo(@b;A>Np*+NhHv# z6B9>N@#xvpr%wq92~EQvy1H7Jn@hTHn!*Nsc8=b#(rL!$Xuu~uJ-w;9`CGgIffySf zUu2WXnZQqf{`{#sTCsop_;GD*?Vy~E;K7#&=8lezk#hT%j60d{-qA{W#wxSQ$;llY z9NaO}*Jg@%mzgOfAn?7v|67Wb58QBRY3YLp4*=P3+_=F-ahaF*LwY)<;0J+~l~_o`#KhRx*iQLR{rvfGYqsO);MaY&!@cQncXxN~e0^y= z+wp1il-r+Xc4v|PAwp~_`tb8D;k!-v?epNdViB2J%2M#NZI zXJO?-D6h;qRT}vm2?WaAGh;0EyAA7oodL*Tg2_Vvwr#VW!IJA zz@6IFiMo`iC>9Au35lbcU*nBsG2D7u`uf!mdRc8KV&dY4D2+V*Y~kzzf`TTC45w2% zuW)l;Y-c%r`n0|MT13l`jUY4$Lc+YfJXyTT%1SdcGpK6mLlbNzFB=*fq>c~O{WQ~Zu$r3DZ{FN9 zGNLb|Atw(sF2YHTF0cGu8WdNyEx4x*w>19Z+*CI?BnI>Y3Osbla<9TnNsI4^(j6+9v(ny zDnr0a74|3rx1J`HFFpfF(BgLr*!Zt#DA_qUV8N7G`M9}nv5)|AWTvMx2JjeGe=#pU zFSEP5%fZ31R(Jg835H;{BVlfJ_0O2=MD**|uVZ3_`1$oKozjbo`2+;W86VEHMepvq z@JF;p7k$vl3k@X<=&E#{17d-P`)R1y;^M`Nb^D9CH$o`POig8FWgUbQ-@Rj@2#JRN zl#&uY_~R{pwI=d{1QVAlRxS4U@icbABe5I#rBcH7j# z;xdt5|Hz0nJdvHC36sLT?ld_Tl2+Kjm?jjmdbqz-aDrO_-VfVW&MQCEpWIy;fdbK4 zMWDMs*qVwCN#6+Gy3Rm6`z`69t(TuEk2p1fii#?0%+v1-X6k&9EIB#3UYX6tuV3Y5 zWwRS@gFMwGrxEgS0_Bl}PXJ;+e*DPQF8H%MVh?*C_EJb#SfHB@!u!S%^+qM@CMWM= z9%GX+&W^(slyQ$ON`IW}$L|-&sU8%T)C1S;8+A|AWHqq5)VwmJ`Zf-7Yx(@72oJK* z+V`@#xfvjUhKfohTLa47;klqR192)hQjHc(qNAlvjE;UZ-^C~;Rrl%@$@-aXJS^tn zbHI|fZ{HsLTAQeLFV4#&)blwLl7YoUWuYT=)bZG(p+7Z${%owyOMCI6)WI^JV8U2$ zFHW)_onKKihE>#+SVd5WlZS)P;#)~sSy@pLy3#6Q_E2TSk&iOZdX>CPmTgKr}UhDE7iM;3LMzv{}#a&of z*b+|P@y8Jo zAhDx{dOnq#Y-(l}(Q3*W9lWyn+jBk0d}?7qA+r~F^0UT>gkLupi2L&8c)4v+g*u5T zDS#<`Jw0fFn=jg9uJBP2iiuSLO*-Z82*AHJ*XggvpF8|DSz_edw|uytqN2?t*YOB- zlzwup+b*7l6b}O#KJe#CeLG|0N!X-zqZOzfy|#3vm|7^N<>lp|j!HpMS6(KmLV^sw%N(jed!vz8TsH zz zK&Xk${rl5%bD7hey!V?41qx-=bHX?qZk?c6@CbS^UgW{5bAXDgt5Befsu1PK@UUWU zKGORFj;Q&zq4??O=%~Jd!P3%Fdhq!8`0ccAxGhml+l+CJu4Ucp5fKp>3?`N`I3&bC zU;l&{!PU=OF(+^wM6)d|EZp*PEIbuXz!31{$rEZCnzXlX#l^*ggM-!7)ft;nAx$4W ze_sod9jyr)sj^=I6X1a{hy_yIkKissCkkC%Jox|o& z1@fpO&)-hk+5;T%nbhi;l#lWSDJUqWZIZK+@UfmKOsFWghJrHFd?Xx_pFCD{QGf?2 zeA>)(>C(*lRHNxN;5@?<6Dc>-W@cuN{v51%N~Xv%t&G<|?GiEejg2M6#fk9q%ciT5 zl90HGkF%wC7Fm7IX(ituv9C)KcUNO4vl}V9C3^g@&&jNVhK}yrw{Ncn9`)G+{RQ|O z7#KJ{m^gkB9$o-Nfsa32W;+r_BLpS%T=qwU|LL)@v8n#cG_Vb6S&61f@vQ*gq3k{w z+Hy%AA8tKb>c2Olpr9b;vRq$w!rG>%dxwTNBINN22sp?T<>kMuj#YK0NQIk`?(Ym3 zvEA*D7qHIKScE+V!lLBif*KoJW|iw2C%g7H@u8K%+DE@u4XDFrmzEM@V?pbHfS8$_ zB&MWvo%$3AJ2f>mwZ0x(vA|j1+w0s{`jiwcM2?4#Z*ncpLEA7J4VRgppAYEQ@}kc3 zcMsI++IY?2>M(57e1pprA(u$bBy_kudUQ0O7S2MVU~g|fKB%Fk)s|iVElI4%#I-@!)D80i}6IJVwX>)@~vAOWNk@euJ7zhN=uvewFdj{vqlCHQ`6EOZgonL>qE=Z zbI}(4WPk78d17J*xap>u+n??-MX+~ZrCCVKT+g08YnC~WUKAvJm*hJ1TqPWM=Wc z&F=DE|N8oe<%`Fi!oA1#)0?LV+%8pACp4;KjPc(jy?OIyI}sE!;1Zp<+d4d55J|9Q zBQFDU1{%7!u+S05Czt;^^lpBlyHf_|9tCgB*Ca9RkCIM3lax%P!Ob87cjM=Yk*-!-OgFw3E{lR#JZyqgz3IywS`nLLe+K575s ziTF$r&u?eKF=7)E=H}-7uOrcZdf~`0TD^u;mg%)Do<7RbD%@9|f{-6Vwoba z7^KwXZ3FdrnST-m4BNnyR3bmdA+=j1g!gGV`ER?K@sVv zsJ}EH()U^* zbX3l*6yu4^;Ka%(ObZL=zwfqyjTN571)JL(y3$R=Snd=H*Vf!3MeWrPCsow z_E8{=wRJX>B1ksH=g)7T7oZK@#go(1FRf0as<{%u-XNN}*>(6oAiBMQ{>4_91UTU$KFA)Okqcuq{oc-%kT`hPQ0;yo6> zGlOVTapa-S!!a>6<=YS;U7Du z)UU5oQ!-3up*igcDnK}X{HWN=cLw(fh!^UxQ_(nwY0Q%XJiZC|R2ME}OUl`rnwm;W zqbR1cDk=uSK!7%=B2q6!9cJ^*@_Py9xp0o};=p-a3_ZSMT-8fxFv}R=go74{ezS|3EwWW@axbDQTu*qIo%n*BlHC zARum=*6BVZq@-|^^D-a{z>IS0ZYYU%G|$tns`StCkwfOu&}DjV7Cd`)TJo&1Eee+E zC^nW#pAZb7w$4tYn#Tg8GzcY}`c9%S2r)2AG}YDp(`!T=e|!ct=)F2B!W1EF@huUU zQeR(RVj}Iexa#{YM1EM_ZtXX4=0Wo6>gwIK2_NuZ!PRwjbXlW67^<+7;Rk*)=C$M>PL}Wh zsWsb~LQhIs3{(etyX{2n5wt9~?fLUbw_y*uxVV7-30jksduFQf+0f7sNzmuv;m3_n z&x(kM0N*eyv5Y7!-HBk9tFEcJZ(;(Lcdgro2~P|SJV+7}CJX=f?`;hX#>hHiY5o2E z!8TQ|BeLT(wy`1PMA*ZprtU$B*)$YXRUNFa^CoocZf$LCZsz3Wjh0%+ELZt&v|QYQ zx3;%!?Cf3y2g~4fB#MBxeh;?7?()z>Q3-DYyMl9R&; z4-3rmW#NqTAWG7Pd0$^>Gl!jGRe3iHnZ?V>^WBucb<2#G3Oq7>o?kzjLh!#OT8^rU z01^6^V-cPEeY#v)z!n8h0c2O0{7=M^-3NT1TCW3eJOSD&_4A8D5(KO%QabBgR^lJl ziwOz+DjhIXPd`gNM1hba4sz^dCeyccOanmffqy<$>qW!ZH!(5M*T)hepCQZ;*pd0F z4E@2S7RU#Pb2@VJrnxOj9(^4s5F?}Tu;%cR1|V*W=F0ipz9IONzpDc2P`=ExL~I-! zK}{yWf@kLDz_kVss{m{mSW^4yjZ;Cg!9hXU`S}1vf4La8PQ99|qm}B0hJS!XLy16# z>gxk7lyut%R^Y!l5nN#0zB>!1?4?VW)cNl_;o+k7HL&Me7;Cz^x*n`?pzemsvnw)U0di(p7G;)LW$4|{IF7BB}`t;c| z$B^oP`(Hj!_#8_>|BaTWuKPWka87a$OP$dJlB017TcNrhPEm1#os5;072=!FM>62Y zfnadtAm}Xf1)r011g&F!!k0~|dcKaX=iwY%`sqEFefy&_2rO%Ocvb_7{kqKTg6^m7bY-y5O_3 zaISAK^VRDoC#I+Zzf|d%vsBJk@9DKrkcqD2?sC!Zs{o|H)+y4-g8*WoYOU74Bz=;8 z#X$*d*1LBh8KQ}hFDWml|LtGrJoh3cg+U4I zLrB!|@08;>#cvp02ckqvbMyXzfoDowB^x+#?F~|*^AxmA1apq4YjIzv98#a6d{=Yo ztqW?J&5NgqP`;=9itzy)0Mwr7p|IK8zkW>*u01V75KFp~5U#jbU7Z}vJhz%gT*R0w zK;{iRjQAYnBC5C{d4c|h!!G`|-{YGChp!ZoC!4EoIn7MVgYRJjF4tA$>@@1KRL(o)a zHffa9o2X&#Ohx*hIq6x99M z2W16uA*W<!9MHrkXrAD0Yw4dHgB=6hP&M4>A8AtqrI@HFF1jHgU!-~|RQNM$g@CV z0`@JKxX?X-H$z1H`ZYzhA}(T};rH>QsAv*TggkgyKo-H4g<6JBdHf>2qO#KNN7 zUB)c;!p*~@<@0B8pFf@(KboM;0K#Yd)w>&vyDUp2Ja!oZUUTU_(GEgVLpXgOt^Fei zfQ|X=BII}OYHB29Ny*87#y!^VjkLe!zRbfjUh*Ikf?F3z-!sJ+dZS}wlVe@`7C%u-iV8}~Ur z!Vpk=O%UoF8#{tc-T09cE*f|%+?`D@-L8}kSp5` zw58w?Zr+hPf@C>p#oWy7JYE1~58V0{>yXS{*2+`aIClBJMd%!0Up%gSs+E)CodW*p=aPqG0U+6|l9o=Hus2gmH<*@44jF9Jq)jLDqRE z(nmL+WY4dyV%~mQypEl6A+&(%wBtDZclSeK}aUJtn#_SqpKxu-0; zKhJUkwCHX*)Xu)h=g*%lvlc+tfzJcH-t?M#%ZrO>zxwv}+=>ceLBal(mX@9#l9LGm zceo8u_>dt7$-V_mKe~#9C2ymYOa0baf zktl4r0|;YoJ}Y(n`wjpK*S_WL+us&?Gr=PQA##V|WJmm`NV?8K5)u-Usm6p%qGjm= z=hKiZ-{x!F-EuQjk5qAF=>dW?hHJDPx4R=kHBiqb@qO{L2-==YiqgTYrs`Tc(~!dh z@!c)QoZR~SLp=n(MR?{PY-Ewcr;(Ml^X&hOvcPG;WBg~Bbya*F-$(whFiR|%Z{utQ z9t;j0qfS1%jrZ4)s$qtRH-G$c#XtIc*MrHGKDT>?I^aaGM#uv|;o2iG^1!S?k)I2_ zLO`Gtgb?Sfw8K^41wQL%2gvE^Cx(Yb7v)Y27FjZ4ku8P_DumOQPyGzBASXyJkR^F{ z*hE{w&>ek`LG-&OpWjbAh1cHR4)IWDM+Y|t$Hw+HKObKsI`S$NApt?i6-ej~e{Vs{ zyWgaEg`M3E5{_2W&8!sIdVt!xckhCrF*h|mN#>iHFb9^Vl}@uqo9$Po3(KINgOXWT zSb$VV%58lT8tre-KVW@(O*e;~*osi`JL~II?czu*3(2in;0Q+Lc1aI~I5-|au?+4) z4MJKfDketocgOlpy4porTJNKs0o5y1baaMBMp9ai*8O>J)Ur<#(N;WM=;=vUN=i&z z9j_77s$}k<2``2Dk@Rj$V6m|Em07p?vem)Kf}R87CMzcgA6|rnQ3#T68IBK4yW-== z@j4&+5ib~QNk|xh9t?)qe|4%q^uj36mgye&^vRHwkG;>zda3RQcB09MI9(^q7V-0I zNLPYz{C_#tr4;p)EAHw#;IQ%X8pAZt3WUOH>`}1f3;}RCKnx4(O(7%q_V!k0B^A5H zlS&od0-ovu3^lnlnG}YHhud(Rc!*B}18-ol_2B-JM~R78!+zq|5P_MTF#&%5&;2Sm z$P0E=OukW_Bxu~nJByGv0Ik-{)#BKZn%Z!~V|-8|6+j%POebIz>+jzPgeHCN%PBHz zTidZBvvy&=JXrAyR8*mLqpi9G2=(C$u=*o!XGY4i5IviooJ?Il{uw4Tj>Xf|)Kmxu zkygnj()>?P+wh;B_Fg-9+DK{xC$Gn@4Mcws9JIByoiO_gH@-YwdJJ;lqCn7|%h0ON;(j4V&5@KbZMdF!i7&|m=Qwz|4hoSd92E$3fdQX-al zC<<@`%twxaI8ogF8o)FFbsqtzw>s=#AUVMMV7enYG0_uZUU0P~Bx(xVq6Na0S;Jd~ zJ$|iTVq=37iv9ID{c5+uckfJrTz*Rwp(UDwtOCS3Y#aO9-x&`B&`8F<*e6%B4ag@y ztRJYA*-v;c4_=+&UZ%g0pPQZ@*f|HrHx0}H$@Lc)*;`wCK&AyV3Y8TV%9qN*P0LPE-U zHC2HV1pWuu(1ns`iHIa0Es{~YK2b3;GOF-FQtxpZ+u7CH3>6hh!l2!g0~8Yf9$lbZ z4Zg0=?AHqpqDU6G+c$>()z1lB6iYtGzkCWkGZDnruNxXX;E`W2sXfuzv)SgM#37Q3 zY26tn$!&QU--QPdP=b)xNc7M)+Yo2`tG~U-5>93VbT1)+Mu0kL1WDNK?hPDhcF!eq zj-YvD<>duHFOjAHPUR3JDN15fRzwEP!;*eD4P7BipF~XTMds^@yNEgI5e9!X7DQdn ze}atZk}SPfpsCEZDwd`}WIt=s4-S*M#K}v?OYR$pMN$K&(bKpmEoU_cLWQ@z3y^uh zEEyE8Lmdh$=YfkL^N+*-sSKNCr!9#2;=Y1?3tQ_KG)`EHCJNAwsh2rb)YVVSJ&<)U z8o{ks1~I$G+w%5BmQTO440|{e&DrDD~O7rI#<8Q8=lya12z9?M{?bblVwtXrqtRh;uGt}CP>!A*0$ze<5N&vfSOnCmV6l=-UliP>GsvDSAn6zkmuEy_9GZp zfeA7h8JVA7!OHB`umK_N=Xh0I9P)HN*H!(1m;dq`%fP(+o8`EKQ(5u_I5W&Y!Q~I; z*VIUq^-XkkLVG9%^#sy{k>7dtYe`87sBdt;dKb1q7q+!22E0s2(9_a_nXAz(^H4J! zP`Hypg@umb_gYxYl}~twNZ6!@tV8fp*+@ERU2Il$G@l568F9 zaE@3Pn|J)!`VH}}9@y0`EHJg!6igl+9i79EgE&a*+T+8O59H~B$E&8Rn=O8Z7(Y-4 z?*q)iFaahOqZdHB#L(sV*Vq&oTs_bMh9+j@IuLI0Qw6wRije8&1y1M=X`zgD) zcngXJxCEr^me$tRR#taQEYDL=+N=zhUNNeTl4sH9aea3IT<+;Y6jH)+SwTkT34c;E zMC~v)_}cF}<~T@&-NxFwQO4Ctn3nu-92`D+Nl%zZ7OsJZO>K55qNCY;dtMdD7?>fT zn%Ec^>Q968yF%%;4NSyW3?JzoVpfrW*=qpZ zQ*XmL(Ey}f%qm8IG47A}U#>RIr#Z>baa;#cqk+92YXY?2nA7*<$DFCs%9r-%1AOPx zd|$u06xUujpLXWVnVd7rjA4?T60Z^xV2^3q02bk6;nVdvXTzeN+HZFko_v5OHB-QO z4Mv6Jxc9|-zj%gEcwC)Mi7M?w`KEXjGz1;f|(dd literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/fill-rule-even-odd.png b/doc/reference/cogl-2.0-experimental/fill-rule-even-odd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e4fbb0f2a2dc04953609dfb942f48db046e46c1 GIT binary patch literal 3121 zcmb7Gc|4Tc8-HiPkU=SBWEr`%a7}j*VGOcWqTHJrVPu&ZvX1OiV~I~mDUxN<$dbB7 zY6c;Dv@k<B)-w{bp(ui5|AX7016?3|7KF+7 z{)6924RwRCvIx%l7ZxdEs+W51pL)Ga>ZqSNtOtk<3rIl=zU!LnJ=qC;g%$K#*tud|YePErg3$5j8yC zGrwz&n`NK{4gx|=rw_cq;p{9sTk&#zN^R?587+7{-wtr5!qqd?ME zD(?zWlYuUX)qixAZg9ULYSiAC>Y;lQA#^wJc_r=lHwEr{pwj)2CJfj;IhP(2ST@ZW+c}uA*N*xm($z?(scfC=>~+5`;W9p zR%aLW2UCGSVTsejsnkuH78M3$4To%C!XrbhFgZ7M@*#BkiluF|b_pT3G2UTm^{JmY z{_oaPX3r~>5ClmWcy0gI%J1)q3)=$#teQLD1!3JsZ$xHiY_5-DP*fZo3q)b8zsb2( zyZN+#_$uAEP-+e?!tMQonAF#Y zOESX9L#X=e6C0lTB#hYtyGOOQCutR#T zhqc~SRqqJnzRg`adVjX=ik{$l?o4yclBud^ZQ2>3IJE!4y`Aj|>}Rhoq^Awnq-rwq zaP2l7iwFBmt~!4zT2@gBxz1{-d~c`Ae-oe#>IIiMMZ>ikXokGrz}`t6bMa&y!3}cn z+ZkHYh&U92+?Fcja|S^FNZyg~;C^QGPoDH1jG|@Uyd?CzK-#v5!=})-q-JQo zz&-s;`^Wav*i^O4qIuTpE*B*ZHmrMg>AP~9d+WP1O*26&U$^3(TJWn`8rw5v7dl=I zjE@c4Cx-w-`tgARZGvrdIQOO_5%=0y)w2z@uiy@nWDTvj!rqIX8xk9|hy^KK1#Qys zUn@+mBu}87kICOiVt1kaXNE(5jz$VSXFZ7JCRF7YgzWiah6i?Zt>E6`_hM9q6Kkux zqETMxIew6j#@LT4(&p%!^@X+F_42~z7zEkfl0W0zhCoHfu`)D)a}#}wm4o|`X1@@tUjpFo`K#8#+TnEDL2OiKQ1dZl^lf9XHpW!-ne2~#Q`{n_^Gnu zq1~=krS?xZ5f}|HlzGdbseq!&S4}BONATGjDZvmh8fNx2y&f5DDOCj0saW`^1wZC4 zNpoBR?tD^nI*pgFyNQznHOO%+?Xv_GpZsrtlm&;Rp?>9fJpVe^dqLq#$c{zbI z?lC)DnL}B=1vg00!yC$X#wnlaPe?N=Fx7pjO9cX}wvP2T7<@+UKb4>-$CK;ae-?N< zj4#ut^UW=7*`4$tg|xecB!sV#?t@U4;;byi8k)c+2hdcAksYs$a8r~H~~yZ&1-_p(`2(|BGvf}~b}X6jR!sz?JWhFwPg8OU3`CDtp3Ikq)EYK+*_ zM0!}0q)}km;3B(Xw#aH!zgr02el!xo62LY_?=+VxinJ`Zcp98nneSe!hkWSS33Aoh zB17;uc5Le)41MSmWhd45(nzp@uv+LbF|>kazderfYB{G4b)wu>c!!xSaB`gh~)yLmi>&rIsdx5{!82y-ieu_K9n(Xo30 zT$fIS+O>BhChWp0{Q@h5FPK|{7z!U+1ll$jmn6=sjy{o4iZ{k3v2fdqSOA#r^-5-Y zMN?N*xLp&DYqZ>-*;ovbXn9Sp-AzpYkQ{(Fz9_n23pH#$+=%+i0n0WpJ(tyg_|lhJPQ-WLfej!oL{G0EnVT3Zxq=K3fDAlzU18 zB7LdQ23%NY7&xVqvrUU*sPA)l?xZmlLe*pn!H%g%bP)?Y1$pzSnjp%N5JQIY_~DM6}bf#RywtLIa;6 zDt$W5@y05%9KFkul(6nHMC=+KU!%du+8B+`hPHy`PyDgIf$aFcx)q;}4uhH~72$b> z+cTL51{ST3)9@Q>&zGGdppCr}#iXLM7iKn|kuLNkdE#j=gZ(xep7~`g{v$-fMa5ds z+ib$3IhKYb$!IUaMCDw$;*e>X_QsVoFuRt0qpyuIU7{uKWcZY&7EN9S%Rh5muT zV_6hnKDf3-C*9QfqM#%|xD7y^>pA%Fm#X>y=oX}RUH+J{bZd|NM2l#eoz;mWr541v F{{i05cM$*p literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/fill-rule-non-zero.png b/doc/reference/cogl-2.0-experimental/fill-rule-non-zero.png new file mode 100644 index 0000000000000000000000000000000000000000..2d8ad314c4baacc70c84b83b0b83b35e6a93a01c GIT binary patch literal 3143 zcmb7Gc|25WA3w7g#$H5JmK2gKVKRlr(rarN?M#c(7=y7iqDwKD=th_OCJn~k-k2~eBOKie4q3AopYYw{`}7GJkR%6oQJc5tfnjg01B=y zPDcO$N(A3KWf0)qVVpAuJ|L7M&JF;JxAikPL0oWmb^_KUS3&*5+aL!S=Hg8O067&2 zL4a(=W{@cz;fg&ZEkLNt>uF0nrRIYyjfg|1A{;}>WI{*;;CP8}K7w#jCyEpipyTX{ z#hr{-R0katxjNY&yCRq#?#eDUR7T)t-!3=qjVbGTW1ah(=5;8qW^f?SRnvI!{zfbk z^!dL*6+iGim`*{t9ryQde}|;YBLH?)YW}$fVyiTuoE(M#bQs^ClG=~9liU_PV^jcT z9J6Nj_#Bd^Ahae{2Bc*(0w}YbdU-_vjEm<-EZ(=>4TwFt5*33U|_+*wk2V@IIPI1J9qG9&FhqYPs<{Owk(GXUHVfTU6#C3Et<%L_6=H<15vC<%!;(hsX)-ee7?~z^61JjzMu`bR_DOJ&_x1S9e^@o{fEQ_x1tt9~LkKv1r zKTgBN3Taje#m$EeVFgwTw)l!36fso${Y+)$E;>Yqv9hs~jozY!zEyv&S)Q6{8xki) z_HaYE7RpmO9k0$lPDBx(E$oQt7X*J^*u({Yjs}?k0pqkrJKO?@{?l;vrhw5w%bOJI zWk5QMYXrOZRi*IV-NnQ7>e&)3n8mEfYp!p)Xj65nc;m}h&4t(Y$G}9QC^w?UAYYC< z2+HyN?%%R}5ttdR^CPajqj?YN;K>1n1^v18(;hxAM=vX+C1?OG-iy@Cf1`-BbTuP7 zk^snGR9s{wu+iu6u>uw-Pu;>h3-!5$W7mBx&#~+_IZF#AFQN27yZ6)+m(-`NGRQFR zXG$_k`#!lFs&E?)4;;0#n%_Br{pC;0ol@?T$gFbEv9MTll{?J!9g8Un5BuK5 zp=mpM_r5DzojW|(47HzB4z)|7r`0rWSdLZisET}Xv8xo1Smv2`K?MgVF!4=SaS?Vx zJ7=DW&yA~;aZ@);OiZ|uGF|CrN88YXp=`kMM2*s!ms&dtu8A~d;9#{>v(jqT zx@`Eu-fo-5QvrT03lo_>5b{Eerw*9VhxtW%+vekB-bQH_O8+#a>*R+GfypLrQc&@E zyO7+pUzi)zIztrvn+8jdkI!UWjSC#PN>5uB`e}t^#E~e0B(2(;{Tw)T$~Ng|$=w4= zo=4R<9*TuH1W-*+UY)k}et!%s1MuE1ZOpmJL|_sWbkq<=#djpV-}!LB-U0>gEw9Q% zipcG8$$QUbfTsmB%xJl%n~@jpgjp6(_w|>Bn{ET!{maKn9#qgZ`YJ>N=pB=T9DoT7 z?FsBrb)cw>GCzjT)~iHUletkJz&!?7D5F&EYrR~T;$JNf&?@|4f{p&s$h~%W1W=Yb z%(waF!vJ5vn1TK=;QQb&^+;5|)sV2410Gq-L24B(_e8>PVBfw(h2X_4MABC>ML1WR ze%Yt!B*LNu>+@0A9k${VsLUcxh@O0)IAfmH_z~LVS9>4(P*W1Td8{k6ib$wW#_hEr z-=QRDIaR2p4joB6ulS_agFBe~u-^xmuUoA?Pj*8Sq;66X2^uZlyA9TM0(Z^=^9>KK zBOzD}tl3yAE!2n&ILY~AG=*KkI`qm<=Ht!B_t$0oF!m`yJ>ly|ZF^hasLxPz(Q9l7 zw6CeBWyQi9}G8cnU;qAB1ZjW^r zzYdxnIF!8#VXH_@qZGri%ujyHP?ORZaIEi41K* z3$ph~S8Oi~R_Q#_Ere4~kb*{3+n>NIurA_@5U>+3JbE59yL6hnw5#l^7`+Z&p5|N+ zoXK3-*exo6P{UBi4CS_PQ4p+)BpqhUo(>$DyA4t@YmyC~c<<$opfH%CQ*tH+%L0I@t}8JX!cHlY{~Nd&BjKk_IhKs>pHlj%o&TVxu7icI1xS zX69R56*6EKi2}utS450qRih*s|D5#5HpTTQYP=8`LaS5-7SjVR;!n2KD7-?~aX`P| z{=E()aDT3h66r;C~pU3x`5ag5}DUC57 z`*PaSAB2^yW1Ho$9l4>TK)*bt0Ak9?AQg#9v=WhMk%SVSgmjo_s_EdgWr+RK77dD| zo9YrVt8c! zAQJ1xg2TH%-fzZfdqs@$XA9TL4N#tHO(2d-G)-O+N9VL^ndL{4XnVylH7%U><)oRP zotJAV{$tNvJn6h9{*e y<{bqu5{34YKxrUl;;`YAegRT~^Z(xwR + + + +Cogl - a modern 3D graphics API + + + + + + + + + + + + + + + + +
+

+Cogl - a modern 3D graphics API

+
+
About Cogl
+
General API concepts
+
+
+The Object Interface +
+
+Exception handling — A way for Cogl to throw exceptions +
+
+Common Types — Types used throughout the library +
+
+
Setting Up A Drawing Context
+
+
+CoglRenderer: Connect to a backend renderer — Choosing a means to render +
+
+CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+CoglDisplay: Setup a display pipeline — Common aspects of a display pipeline +
+
+The Top-Level Context — The top level application context. +
+
+
Setting Up A GPU Pipeline
+
+
+Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions. +
+
+Pipeline — Functions for creating and manipulating the GPU + pipeline +
+
+Depth State — Functions for describing the depth testing + state of your GPU. +
+
+Shader snippets — Functions for creating and manipulating shader snippets +
+
+
Allocating GPU Memory
+
+
+CoglBuffer: The Buffer Interface — Common buffer functions, including data upload APIs +
+
+CoglAttributeBuffer: Buffers of vertex attributes — Functions for creating and manipulating attribute + buffers +
+
+CoglIndexBuffer: Buffers of vertex indices — Functions for creating and manipulating vertex +indices. +
+
+
Describing the layout of GPU Memory
+
+
+Vertex Attributes — Functions for declaring and drawing vertex + attributes +
+
+IndicesDescribe vertex indices stored in a CoglIndexBuffer. +
+
+
Geometry
+
+
+Primitives — Functions for creating, manipulating and drawing + primitives +
+
+Path Primitives +
+
+Rectangles +
+
+
Textures
+
+
+Bitmap — Functions for loading images +
+
+The Texture Interface — Functions for creating and manipulating textures +
+
+
Meta Textures
+
+
+High Level Meta TexturesInterface for high-level textures built from + low-level textures like CoglTexture2D and + CoglTexture3D. +
+
+Sub Textures — Functions for creating and manipulating + sub-textures. +
+
+Sliced Textures — Functions for creating and manipulating 2D meta + textures that may internally be comprised of + multiple 2D textures with power-of-two sizes. +
+
+X11 Texture From Pixmap — Functions for creating and manipulating 2D meta + textures derived from X11 pixmaps. +
+
+
Primitive Textures
+
+
+Low-level primitive texturesInterface for low-level textures like + CoglTexture2D and CoglTexture3D. +
+
+2D textures — Functions for creating and manipulating 2D textures +
+
+3D textures — Functions for creating and manipulating 3D textures +
+
+Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle + textures for use with non-normalized coordinates. +
+
+
Framebuffers
+
+
+CoglFramebuffer: The Framebuffer Interface — A common interface for manipulating framebuffers +
+
+CoglOnscreen: The Onscreen Framebuffer Interface +
+
+Offscreen Framebuffers — Functions for creating and manipulating offscreen + framebuffers. +
+
+
Utilities
+
+
+Color Type — A generic color definition +
+
+Matrices — Functions for initializing and manipulating 4x4 matrices +
+
+Matrix Stacks — Functions for efficiently tracking many + related transformations +
+
+3 Component Vectors — Functions for handling single precision float + vectors. +
+
+Eulers (Rotations) — Functions for initializing and manipulating +euler angles. +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+GPU synchronisation fences — Functions for notification of command completion +
+
+Versioning utility macros — Macros for determining the version of Cogl being used +
+
+
Binding and Integrating
+
+
+SDL Integration — Integration api for the Simple DirectMedia + Layer library. +
+
+Main loop integration — Functions for integrating Cogl with an + application's main loop +
+
+GType Integration API +
+
+GLES 2.0 context — A portable api to access OpenGLES 2.0 +
+
+
+
+

+About Cogl

+

Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-2D-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-2D-textures.html new file mode 100644 index 0000000..dbc2078 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-2D-textures.html @@ -0,0 +1,441 @@ + + + + +2D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

2D textures

+

2D textures — Functions for creating and manipulating 2D textures

+
+
+

Synopsis

+
                    CoglTexture2D;
+CoglTexture2D *     cogl_texture_2d_new_with_size       (CoglContext *ctx,
+                                                         int width,
+                                                         int height);
+CoglTexture2D *     cogl_texture_2d_new_from_file       (CoglContext *ctx,
+                                                         const char *filename,
+                                                         CoglError **error);
+CoglTexture2D *     cogl_texture_2d_new_from_bitmap     (CoglBitmap *bitmap);
+CoglTexture2D *     cogl_texture_2d_new_from_data       (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+CoglTexture2D *     cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx,
+                                                         unsigned int gl_handle,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format);
+CoglBool            cogl_is_texture_rectangle           (void *object);
+
+
+
+

Description

+

+These functions allow low-level 2D textures to be allocated. These +differ from sliced textures for example which may internally be +made up of multiple 2D textures, or atlas textures where Cogl must +internally modify user texture coordinates before they can be used +by the GPU. +

+

+You should be aware that many GPUs only support power of two sizes +for CoglTexture2D textures. You can check support for non power of +two textures by checking for the COGL_FEATURE_ID_TEXTURE_NPOT feature +via cogl_has_feature(). +

+
+
+

Details

+
+

CoglTexture2D

+
typedef struct _CoglTexture2D CoglTexture2D;
+
+
+
+

cogl_texture_2d_new_with_size ()

+
CoglTexture2D *     cogl_texture_2d_new_with_size       (CoglContext *ctx,
+                                                         int width,
+                                                         int height);
+

+Creates a low-level CoglTexture2D texture with a given width and +height that your GPU can texture from directly. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is being used and can optimize how it is allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

Many GPUs only support power of two sizes for CoglTexture2D +textures. You can check support for non power of two textures by +checking for the COGL_FEATURE_ID_TEXTURE_NPOT feature via +cogl_has_feature().
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

width :

Width of the texture to allocate

height :

Height of the texture to allocate

Returns :

A new CoglTexture2D object with no storage yet allocated. [transfer full] +
+

Since 2.0

+
+
+
+

cogl_texture_2d_new_from_file ()

+
CoglTexture2D *     cogl_texture_2d_new_from_file       (CoglContext *ctx,
+                                                         const char *filename,
+                                                         CoglError **error);
+

+Creates a low-level CoglTexture2D texture from an image file. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is being used and can optimize how it is allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

Many GPUs only support power of two sizes for CoglTexture2D +textures. You can check support for non power of two textures by +checking for the COGL_FEATURE_ID_TEXTURE_NPOT feature via +cogl_has_feature().
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

filename :

the file to load

error :

A CoglError to catch exceptional errors or NULL +

Returns :

A newly created CoglTexture2D or NULL on failure +and error will be updated. [transfer full] +
+

Since 1.16

+
+
+
+

cogl_texture_2d_new_from_bitmap ()

+
CoglTexture2D *     cogl_texture_2d_new_from_bitmap     (CoglBitmap *bitmap);
+

+Creates a low-level CoglTexture2D texture based on data residing +in a CoglBitmap. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is being used and can optimize how it is allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

Many GPUs only support power of two sizes for CoglTexture2D +textures. You can check support for non power of two textures by +checking for the COGL_FEATURE_ID_TEXTURE_NPOT feature via +cogl_has_feature().
+

+

+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

A newly allocated CoglTexture2D. [transfer full] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_texture_2d_new_from_data ()

+
CoglTexture2D *     cogl_texture_2d_new_from_data       (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+

+Creates a low-level CoglTexture2D texture based on data residing +in memory. +

+

+

+
+

Note

This api will always immediately allocate GPU memory for the +texture and upload the given data so that the data pointer does +not need to remain valid once this function returns. This means it +is not possible to configure the texture before it is allocated. If +you do need to configure the texture before allocation (to specify +constraints on the internal format for example) then you can +instead create a CoglBitmap for your data and use +cogl_texture_2d_new_from_bitmap() or use +cogl_texture_2d_new_with_size() and then upload data using +cogl_texture_set_data() +
+

+

+

+

+
+

Note

Many GPUs only support power of two sizes for CoglTexture2D +textures. You can check support for non power of two textures by +checking for the COGL_FEATURE_ID_TEXTURE_NPOT feature via +cogl_has_feature().
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

width :

width of texture in pixels

height :

height of texture in pixels

format :

the CoglPixelFormat the buffer is stored in in RAM

rowstride :

the memory offset in bytes between the starts of +scanlines in data. A value of 0 will make Cogl automatically +calculate rowstride from width and format.

data :

pointer the memory region where the source buffer resides

error :

A CoglError for exceptions

Returns :

A newly allocated CoglTexture2D, or if +the size is not supported (because it is too large or a +non-power-of-two size that the hardware doesn't support) +it will return NULL and set error. [transfer full] +
+

Since 2.0

+
+
+
+

cogl_texture_2d_gl_new_from_foreign ()

+
CoglTexture2D *     cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx,
+                                                         unsigned int gl_handle,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format);
+

+Wraps an existing GL_TEXTURE_2D texture object as a CoglTexture2D. +This can be used for integrating Cogl with software using OpenGL +directly. +

+

+The texture is still configurable until it has been allocated so +for example you can declare whether the texture is premultiplied +with cogl_texture_set_premultiplied(). +

+

+

+
+

Note

The results are undefined for passing an invalid gl_handle +or if width or height don't have the correct texture +geometry.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

gl_handle :

A GL handle for a GL_TEXTURE_2D texture object

width :

Width of the foreign GL texture

height :

Height of the foreign GL texture

format :

The format of the texture

Returns :

A newly allocated CoglTexture2D. [transfer full] +
+

Since 2.0

+
+
+
+

cogl_is_texture_rectangle ()

+
CoglBool            cogl_is_texture_rectangle           (void *object);
+

+Gets whether the given object references an existing +CoglTextureRectangle object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a +CoglTextureRectangle, FALSE otherwise.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3-Component-Vectors.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3-Component-Vectors.html new file mode 100644 index 0000000..4eece23 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3-Component-Vectors.html @@ -0,0 +1,798 @@ + + + + +3 Component Vectors + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

3 Component Vectors

+

3 Component Vectors — Functions for handling single precision float + vectors.

+
+
+

Synopsis

+
void                cogl_vector3_init                   (float *vector,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_vector3_init_zero              (float *vector);
+CoglBool            cogl_vector3_equal                  (const void *v1,
+                                                         const void *v2);
+CoglBool            cogl_vector3_equal_with_epsilon     (const float *vector0,
+                                                         const float *vector1,
+                                                         float epsilon);
+float *             cogl_vector3_copy                   (const float *vector);
+void                cogl_vector3_free                   (float *vector);
+void                cogl_vector3_invert                 (float *vector);
+void                cogl_vector3_add                    (float *result,
+                                                         const float *a,
+                                                         const float *b);
+void                cogl_vector3_subtract               (float *result,
+                                                         const float *a,
+                                                         const float *b);
+void                cogl_vector3_multiply_scalar        (float *vector,
+                                                         float scalar);
+void                cogl_vector3_divide_scalar          (float *vector,
+                                                         float scalar);
+void                cogl_vector3_normalize              (float *vector);
+float               cogl_vector3_magnitude              (const float *vector);
+void                cogl_vector3_cross_product          (float *result,
+                                                         const float *u,
+                                                         const float *v);
+float               cogl_vector3_dot_product            (const float *a,
+                                                         const float *b);
+float               cogl_vector3_distance               (const float *a,
+                                                         const float *b);
+
+
+
+

Description

+

+This exposes a utility API that can be used for basic manipulation of 3 +component float vectors. +

+
+
+

Details

+
+

cogl_vector3_init ()

+
void                cogl_vector3_init                   (float *vector,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Initializes a 3 component, single precision float vector which can +then be manipulated with the cogl_vector convenience APIs. Vectors +can also be used in places where a "point" is often desired. +

+
++++ + + + + + + + + + + + + + + + + + + +

vector :

The 3 component vector you want to initialize

x :

The x component

y :

The y component

z :

The z component
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_init_zero ()

+
void                cogl_vector3_init_zero              (float *vector);
+

+Initializes a 3 component, single precision float vector with zero +for each component. +

+
++++ + + + + +

vector :

The 3 component vector you want to initialize
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_equal ()

+
CoglBool            cogl_vector3_equal                  (const void *v1,
+                                                         const void *v2);
+

+Compares the components of two vectors and returns TRUE if they are +the same. +

+

+The comparison of the components is done with the '==' operator +such that -0 is considered equal to 0, but otherwise there is no +fuzziness such as an epsilon to consider vectors that are +essentially identical except for some minor precision error +differences due to the way they have been manipulated. +

+
++++ + + + + + + + + + + + + + + +

v1 :

The first 3 component vector you want to compare

v2 :

The second 3 component vector you want to compare

Returns :

TRUE if the vectors are equal else FALSE.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_equal_with_epsilon ()

+
CoglBool            cogl_vector3_equal_with_epsilon     (const float *vector0,
+                                                         const float *vector1,
+                                                         float epsilon);
+

+Compares the components of two vectors using the given epsilon and +returns TRUE if they are the same, using an internal epsilon for +comparing the floats. +

+

+Each component is compared against the epsilon value in this way: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+if (fabsf (vector0->x - vector1->x) < epsilon)
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

vector0 :

The first 3 component vector you want to compare

vector1 :

The second 3 component vector you want to compare

epsilon :

The allowable difference between components to still be +considered equal

Returns :

TRUE if the vectors are equal else FALSE.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_copy ()

+
float *             cogl_vector3_copy                   (const float *vector);
+

+Allocates a new 3 component float vector on the heap initializing +the components from the given vector and returns a pointer to the +newly allocated vector. You should free the memory using +cogl_vector3_free() +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to copy

Returns :

A newly allocated 3 component float vector
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_free ()

+
void                cogl_vector3_free                   (float *vector);
+

+Frees a 3 component vector that was previously allocated with +cogl_vector3_copy() +

+
++++ + + + + +

vector :

The 3 component you want to free
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_invert ()

+
void                cogl_vector3_invert                 (float *vector);
+

+Inverts/negates all the components of the given vector. +

+
++++ + + + + +

vector :

The 3 component vector you want to manipulate
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_add ()

+
void                cogl_vector3_add                    (float *result,
+                                                         const float *a,
+                                                         const float *b);
+

+Adds each of the corresponding components in vectors a and b +storing the results in result. +

+
++++ + + + + + + + + + + + + + + +

result :

Where you want the result written

a :

The first vector operand

b :

The second vector operand
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_subtract ()

+
void                cogl_vector3_subtract               (float *result,
+                                                         const float *a,
+                                                         const float *b);
+

+Subtracts each of the corresponding components in vector b from +a storing the results in result. +

+
++++ + + + + + + + + + + + + + + +

result :

Where you want the result written

a :

The first vector operand

b :

The second vector operand
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_multiply_scalar ()

+
void                cogl_vector3_multiply_scalar        (float *vector,
+                                                         float scalar);
+

+Multiplies each of the vector components by the given scalar. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to manipulate

scalar :

The scalar you want to multiply the vector components by
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_divide_scalar ()

+
void                cogl_vector3_divide_scalar          (float *vector,
+                                                         float scalar);
+

+Divides each of the vector components by the given scalar. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to manipulate

scalar :

The scalar you want to divide the vector components by
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_normalize ()

+
void                cogl_vector3_normalize              (float *vector);
+

+Updates the vector so it is a "unit vector" such that the +vectors magnitude or length is equal to 1. +

+

+

+
+

Note

It's safe to use this function with the [0, 0, 0] vector, it will not +try to divide components by 0 (its norm) and will leave the vector +untouched.
+

+

+
++++ + + + + +

vector :

The 3 component vector you want to manipulate
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_magnitude ()

+
float               cogl_vector3_magnitude              (const float *vector);
+

+Calculates the scalar magnitude or length of vector. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want the magnitude for

Returns :

The magnitude of vector.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_cross_product ()

+
void                cogl_vector3_cross_product          (float *result,
+                                                         const float *u,
+                                                         const float *v);
+

+Calculates the cross product between the two vectors u and v. +

+

+The cross product is a vector perpendicular to both u and v. This +can be useful for calculating the normal of a polygon by creating +two vectors in its plane using the polygons vertices and taking +their cross product. +

+

+If the two vectors are parallel then the cross product is 0. +

+

+You can use a right hand rule to determine which direction the +perpendicular vector will point: If you place the two vectors tail, +to tail and imagine grabbing the perpendicular line that extends +through the common tail with your right hand such that you fingers +rotate in the direction from u to v then the resulting vector +points along your extended thumb. +

+
++++ + + + + + + + + + + + + + + + + + + +

result :

Where you want the result written

u :

Your first 3 component vector

v :

Your second 3 component vector

Returns :

The cross product between two vectors u and v.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_dot_product ()

+
float               cogl_vector3_dot_product            (const float *a,
+                                                         const float *b);
+

+Calculates the dot product of the two 3 component vectors. This +can be used to determine the magnitude of one vector projected onto +another. (for example a surface normal) +

+

+For example if you have a polygon with a given normal vector and +some other point for which you want to calculate its distance from +the polygon, you can create a vector between one of the polygon +vertices and that point and use the dot product to calculate the +magnitude for that vector but projected onto the normal of the +polygon. This way you don't just get the distance from the point to +the edge of the polygon you get the distance from the point to the +nearest part of the polygon. +

+

+

+
+

Note

If you don't use a unit length normal in the above example +then you would then also have to divide the result by the magnitude +of the normal
+

+

+

+The dot product is calculated as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+(a->x * b->x + a->y * b->y + a->z * b->z)
+
+ +

+

+

+For reference, the dot product can also be calculated from the +angle between two vectors as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+|a||b|cos𝜃
+
+ +

+

+
++++ + + + + + + + + + + + + + + +

a :

Your first 3 component vector

b :

Your second 3 component vector

Returns :

The dot product of two vectors.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_distance ()

+
float               cogl_vector3_distance               (const float *a,
+                                                         const float *b);
+

+If you consider the two given vectors as (x,y,z) points instead +then this will compute the distance between those two points. +

+
++++ + + + + + + + + + + + + + + +

a :

The first point

b :

The second point

Returns :

The distance between two points given as 3 component +vectors.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3D-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3D-textures.html new file mode 100644 index 0000000..cd6dbe7 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3D-textures.html @@ -0,0 +1,332 @@ + + + + +3D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

3D textures

+

3D textures — Functions for creating and manipulating 3D textures

+
+
+

Synopsis

+
                    CoglTexture3D;
+CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth);
+CoglTexture3D *     cogl_texture_3d_new_from_bitmap     (CoglBitmap *bitmap,
+                                                         int height,
+                                                         int depth);
+CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+CoglBool            cogl_is_texture_3d                  (void *object);
+
+
+
+

Description

+

+These functions allow 3D textures to be used. 3D textures can be +thought of as layers of 2D images arranged into a cuboid +shape. When choosing a texel from the texture, Cogl will take into +account the 'r' texture coordinate to select one of the images. +

+
+
+

Details

+
+

CoglTexture3D

+
typedef struct _CoglTexture3D CoglTexture3D;
+
+
+
+

cogl_texture_3d_new_with_size ()

+
CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth);
+

+Creates a low-level CoglTexture3D texture with the specified +dimensions and pixel format. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is going to be used and can optimize how it is +allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

This texture will fail to allocate later if +COGL_FEATURE_ID_TEXTURE_3D is not advertised. Allocation can also +fail if the requested dimensions are not supported by the +GPU.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

a CoglContext +

width :

width of the texture in pixels.

height :

height of the texture in pixels.

depth :

depth of the texture in pixels.

Returns :

A new CoglTexture3D object with no storage yet allocated. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_texture_3d_new_from_bitmap ()

+
CoglTexture3D *     cogl_texture_3d_new_from_bitmap     (CoglBitmap *bitmap,
+                                                         int height,
+                                                         int depth);
+

+Creates a low-level 3D texture and initializes it with the images +in bitmap. The images are assumed to be packed together after one +another in the increasing y axis. The height of individual image is +given as height and the number of images is given in depth. The +actual height of the bitmap can be larger than height × depth. In +this case it assumes there is padding between the images. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is going to be used and can optimize how it is +allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

This texture will fail to allocate later if +COGL_FEATURE_ID_TEXTURE_3D is not advertised. Allocation can also +fail if the requested dimensions are not supported by the +GPU.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

bitmap :

A CoglBitmap object.

height :

height of the texture in pixels.

depth :

depth of the texture in pixels.

Returns :

a newly created CoglTexture3D. [transfer full] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_texture_3d_new_from_data ()

+
CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+

+Creates a low-level 3D texture and initializes it with data. The +data is assumed to be packed array of depth images. There can be +padding between the images using image_stride. +

+

+

+
+

Note

This api will always immediately allocate GPU memory for the +texture and upload the given data so that the data pointer does +not need to remain valid once this function returns. This means it +is not possible to configure the texture before it is allocated. If +you do need to configure the texture before allocation (to specify +constraints on the internal format for example) then you can +instead create a CoglBitmap for your data and use +cogl_texture_3d_new_from_bitmap().
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

context :

a CoglContext +

width :

width of the texture in pixels.

height :

height of the texture in pixels.

depth :

depth of the texture in pixels.

format :

the CoglPixelFormat the buffer is stored in in RAM

rowstride :

the memory offset in bytes between the starts of +scanlines in data or 0 to infer it from the width and format

image_stride :

the number of bytes from one image to the next. This +can be used to add padding between the images in a similar way +that the rowstride can be used to add padding between +rows. Alternatively 0 can be passed to infer the image_stride +from the height.

data :

pointer the memory region where the source buffer resides

error :

A CoglError return location.

Returns :

the newly created CoglTexture3D or +NULL if there was an error and an exception will be +returned through error. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_3d ()

+
CoglBool            cogl_is_texture_3d                  (void *object);
+

+Checks whether the given object references a CoglTexture3D +

+
++++ + + + + + + + + + + +

object :

a CoglObject +

Returns :

+TRUE if the passed object represents a 3D texture +and FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Bitmap.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Bitmap.html new file mode 100644 index 0000000..6e12194 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Bitmap.html @@ -0,0 +1,598 @@ + + + + +Bitmap + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Bitmap

+

Bitmap — Functions for loading images

+
+
+

Synopsis

+
                    CoglBitmap;
+CoglBool            cogl_is_bitmap                      (void *object);
+
+CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
+                                                         CoglError **error);
+CoglBitmap *        cogl_bitmap_new_from_buffer         (CoglBuffer *buffer,
+                                                         CoglPixelFormat format,
+                                                         int width,
+                                                         int height,
+                                                         int rowstride,
+                                                         int offset);
+CoglBitmap *        cogl_bitmap_new_with_size           (CoglContext *context,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         CoglPixelFormat format);
+CoglBitmap *        cogl_bitmap_new_for_data            (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         uint8_t *data);
+
+CoglPixelFormat     cogl_bitmap_get_format              (CoglBitmap *bitmap);
+int                 cogl_bitmap_get_width               (CoglBitmap *bitmap);
+int                 cogl_bitmap_get_height              (CoglBitmap *bitmap);
+int                 cogl_bitmap_get_rowstride           (CoglBitmap *bitmap);
+CoglPixelBuffer *   cogl_bitmap_get_buffer              (CoglBitmap *bitmap);
+CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
+                                                         int *width,
+                                                         int *height);
+
+CoglTexture *       cogl_texture_new_from_bitmap        (CoglBitmap *bitmap,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+
+#define             COGL_BITMAP_ERROR
+enum                CoglBitmapError;
+
+
+
+

Description

+

+Cogl allows loading image data into memory as CoglBitmaps without +loading them immediately into GPU textures. +

+

+CoglBitmap is available since Cogl 1.0 +

+
+
+

Details

+
+

CoglBitmap

+
typedef struct _CoglBitmap CoglBitmap;
+
+
+
+

cogl_is_bitmap ()

+
CoglBool            cogl_is_bitmap                      (void *object);
+

+Checks whether object is a CoglBitmap +

+
++++ + + + + + + + + + + +

object :

a CoglObject pointer

Returns :

+TRUE if the passed object represents a bitmap, +and FALSE otherwise
+

Since 1.0

+
+
+
+

cogl_bitmap_new_from_file ()

+
CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
+                                                         CoglError **error);
+

+Loads an image file from disk. This function can be safely called from +within a thread. +

+
++++ + + + + + + + + + + + + + + +

filename :

the file to load.

error :

a CoglError or NULL.

Returns :

a CoglBitmap to the new loaded +image data, or NULL if loading the image failed. [transfer full] +
+

Since 1.0

+
+
+
+

cogl_bitmap_new_from_buffer ()

+
CoglBitmap *        cogl_bitmap_new_from_buffer         (CoglBuffer *buffer,
+                                                         CoglPixelFormat format,
+                                                         int width,
+                                                         int height,
+                                                         int rowstride,
+                                                         int offset);
+

+Wraps some image data that has been uploaded into a CoglBuffer as +a CoglBitmap. The data is not copied in this process. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

buffer :

A CoglBuffer containing image data

format :

The CoglPixelFormat defining the format of the image data +in the given buffer.

width :

The width of the image data in the given buffer.

height :

The height of the image data in the given buffer.

rowstride :

The rowstride in bytes of the image data in the given buffer.

offset :

The offset into the given buffer to the first pixel that +should be considered part of the CoglBitmap.

Returns :

a CoglBitmap encapsulating the given buffer. [transfer full] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_new_with_size ()

+
CoglBitmap *        cogl_bitmap_new_with_size           (CoglContext *context,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         CoglPixelFormat format);
+

+Creates a new CoglBitmap with the given width, height and format. +The initial contents of the bitmap are undefined. +

+

+The data for the bitmap will be stored in a newly created +CoglPixelBuffer. You can get a pointer to the pixel buffer using +cogl_bitmap_get_buffer(). The CoglBuffer API can then be +used to fill the bitmap with data. +

+

+

+
+

Note

Cogl will try its best to provide a hardware array you can +map, write into and effectively do a zero copy upload when creating +a texture from it with cogl_texture_new_from_bitmap(). For various +reasons, such arrays are likely to have a stride larger than width +* bytes_per_pixel. The user must take the stride into account when +writing into it. The stride can be retrieved with +cogl_bitmap_get_rowstride().
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

width :

width of the bitmap in pixels

height :

height of the bitmap in pixels

format :

the format of the pixels the array will store

Returns :

a CoglPixelBuffer representing the +newly created array or NULL on failure. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_new_for_data ()

+
CoglBitmap *        cogl_bitmap_new_for_data            (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         uint8_t *data);
+

+Creates a bitmap using some existing data. The data is not copied +so the application must keep the buffer alive for the lifetime of +the CoglBitmap. This can be used for example with +cogl_framebuffer_read_pixels_into_bitmap() to read data directly +into an application buffer with the specified rowstride. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

width :

The width of the bitmap.

height :

The height of the bitmap.

format :

The format of the pixel data.

rowstride :

The rowstride of the bitmap (the number of bytes from +the start of one row of the bitmap to the next).

data :

A pointer to the data. The bitmap will take ownership of this data.

Returns :

A new CoglBitmap. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_format ()

+
CoglPixelFormat     cogl_bitmap_get_format              (CoglBitmap *bitmap);
+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

the CoglPixelFormat that the data for the bitmap is in.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_width ()

+
int                 cogl_bitmap_get_width               (CoglBitmap *bitmap);
+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

the width of the bitmap
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_height ()

+
int                 cogl_bitmap_get_height              (CoglBitmap *bitmap);
+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

the height of the bitmap
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_rowstride ()

+
int                 cogl_bitmap_get_rowstride           (CoglBitmap *bitmap);
+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

the rowstride of the bitmap. This is the number of +bytes between the address of start of one row to the address of the +next row in the image.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_buffer ()

+
CoglPixelBuffer *   cogl_bitmap_get_buffer              (CoglBitmap *bitmap);
+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

the CoglPixelBuffer that this +buffer uses for storage. Note that if the bitmap was created with +cogl_bitmap_new_from_file() then it will not actually be using a +pixel buffer and this function will return NULL. [transfer none] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_bitmap_get_size_from_file ()

+
CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
+                                                         int *width,
+                                                         int *height);
+

+Parses an image file enough to extract the width and height +of the bitmap. +

+
++++ + + + + + + + + + + + + + + + + + + +

filename :

the file to check

width :

return location for the bitmap width, or NULL. [out] +

height :

return location for the bitmap height, or NULL. [out] +

Returns :

+TRUE if the image was successfully parsed
+

Since 1.0

+
+
+
+

cogl_texture_new_from_bitmap ()

+
CoglTexture *       cogl_texture_new_from_bitmap        (CoglBitmap *bitmap,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+
+

Warning

+

cogl_texture_new_from_bitmap has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_from_bitmap()

+
+

+Creates a CoglTexture from a CoglBitmap. +

+
++++ + + + + + + + + + + + + + + + + + + +

bitmap :

A CoglBitmap pointer

flags :

Optional flags for the texture, or COGL_TEXTURE_NONE +

internal_format :

the CoglPixelFormat to use for the GPU storage of the +texture

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 1.0

+
+
+
+

COGL_BITMAP_ERROR

+
#define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ())
+
+

+CoglError domain for bitmap errors. +

+

Since 1.4

+
+
+
+

enum CoglBitmapError

+
typedef enum {
+  COGL_BITMAP_ERROR_FAILED,
+  COGL_BITMAP_ERROR_UNKNOWN_TYPE,
+  COGL_BITMAP_ERROR_CORRUPT_IMAGE
+} CoglBitmapError;
+
+

+Error codes that can be thrown when performing bitmap +operations. Note that gdk_pixbuf_new_from_file() can also throw +errors directly from the underlying image loading library. For +example, if GdkPixbuf is used then errors GdkPixbufErrors +will be used directly. +

+
++++ + + + + + + + + + + + + + + +

COGL_BITMAP_ERROR_FAILED

Generic failure code, something went + wrong. +

COGL_BITMAP_ERROR_UNKNOWN_TYPE

Unknown image type. +

COGL_BITMAP_ERROR_CORRUPT_IMAGE

An image file was broken somehow. +
+

Since 1.4

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html new file mode 100644 index 0000000..823f864 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html @@ -0,0 +1,209 @@ + + + + +CoglAttributeBuffer: Buffers of vertex attributes + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglAttributeBuffer: Buffers of vertex attributes

+

CoglAttributeBuffer: Buffers of vertex attributes — Functions for creating and manipulating attribute + buffers

+
+
+

Synopsis

+
                    CoglAttributeBuffer;
+CoglAttributeBuffer * cogl_attribute_buffer_new_with_size
+                                                        (CoglContext *context,
+                                                         size_t bytes);
+CoglAttributeBuffer * cogl_attribute_buffer_new         (CoglContext *context,
+                                                         size_t bytes,
+                                                         const void *data);
+CoglBool            cogl_is_attribute_buffer            (void *object);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglAttributeBuffer

+
typedef struct _CoglAttributeBuffer CoglAttributeBuffer;
+
+
+
+

cogl_attribute_buffer_new_with_size ()

+
CoglAttributeBuffer * cogl_attribute_buffer_new_with_size
+                                                        (CoglContext *context,
+                                                         size_t bytes);
+

+Describes a new CoglAttributeBuffer of size bytes to contain +arrays of vertex attribute data. Afterwards data can be set using +cogl_buffer_set_data() or by mapping it into the application's +address space using cogl_buffer_map(). +

+

+The underlying storage of this buffer isn't allocated by this +function so that you have an opportunity to use the +cogl_buffer_set_update_hint() and cogl_buffer_set_usage_hint() +functions which may influence how the storage is allocated. The +storage will be allocated once you upload data to the buffer. +

+

+Note: You can assume this function always succeeds and won't return +NULL +

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext +

bytes :

The number of bytes to allocate for vertex attribute data.

Returns :

A newly allocated CoglAttributeBuffer. Never NULL. [transfer full] +
+

Stability Level: Unstable

+
+
+
+

cogl_attribute_buffer_new ()

+
CoglAttributeBuffer * cogl_attribute_buffer_new         (CoglContext *context,
+                                                         size_t bytes,
+                                                         const void *data);
+

+Describes a new CoglAttributeBuffer of size bytes to contain +arrays of vertex attribute data and also uploads size bytes read +from data to the new buffer. +

+

+You should never pass a NULL data pointer. +

+

+

+
+

Note

This function does not report out-of-memory errors back to +the caller by returning NULL and so you can assume this function +always succeeds.
+

+

+

+

+
+

Note

In the unlikely case that there is an out of memory problem +then Cogl will abort the application with a message. If your +application needs to gracefully handle out-of-memory errors then +you can use cogl_attribute_buffer_new_with_size() and then +explicitly catch errors with cogl_buffer_set_data() or +cogl_buffer_map().
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

bytes :

The number of bytes to allocate for vertex attribute data.

data :

An optional pointer to vertex data to +upload immediately. [array length=bytes] +

Returns :

A newly allocated CoglAttributeBuffer (never NULL). [transfer full] +
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_attribute_buffer ()

+
CoglBool            cogl_is_attribute_buffer            (void *object);
+

+Gets whether the given object references a CoglAttributeBuffer. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if object references a CoglAttributeBuffer, +FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglBuffer---The-Buffer-Interface.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglBuffer---The-Buffer-Interface.html new file mode 100644 index 0000000..523058b --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglBuffer---The-Buffer-Interface.html @@ -0,0 +1,604 @@ + + + + +CoglBuffer: The Buffer Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglBuffer: The Buffer Interface

+

CoglBuffer: The Buffer Interface — Common buffer functions, including data upload APIs

+
+
+

Stability Level

+Unstable, unless otherwise indicated +
+
+

Synopsis

+
typedef             CoglBuffer;
+CoglBool            cogl_is_buffer                      (void *object);
+unsigned int        cogl_buffer_get_size                (CoglBuffer *buffer);
+enum                CoglBufferUpdateHint;
+void                cogl_buffer_set_update_hint         (CoglBuffer *buffer,
+                                                         CoglBufferUpdateHint hint);
+CoglBufferUpdateHint cogl_buffer_get_update_hint        (CoglBuffer *buffer);
+enum                CoglBufferAccess;
+enum                CoglBufferMapHint;
+void *              cogl_buffer_map                     (CoglBuffer *buffer,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints);
+void *              cogl_buffer_map_range               (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         size_t size,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints,
+                                                         CoglError **error);
+void                cogl_buffer_unmap                   (CoglBuffer *buffer);
+CoglBool            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         const void *data,
+                                                         size_t size);
+
+                    CoglPixelBuffer;
+CoglPixelBuffer *   cogl_pixel_buffer_new               (CoglContext *context,
+                                                         size_t size,
+                                                         const void *data);
+CoglBool            cogl_is_pixel_buffer                (void *object);
+
+
+
+

Description

+

+The CoglBuffer API provides a common interface to manipulate +buffers that have been allocated either via cogl_pixel_buffer_new() +or cogl_attribute_buffer_new(). The API allows you to upload data +to these buffers and define usage hints that help Cogl manage your +buffer optimally. +

+

+Data can either be uploaded by supplying a pointer and size so Cogl +can copy your data, or you can mmap() a CoglBuffer and then you can +copy data to the buffer directly. +

+

+One of the most common uses for CoglBuffers is to upload texture +data asynchronously since the ability to mmap the buffers into +the CPU makes it possible for another thread to handle the IO +of loading an image file and unpacking it into the mapped buffer +without blocking other Cogl operations. +

+
+
+

Details

+
+

CoglBuffer

+
typedef void CoglBuffer;
+
+
+
+
+

cogl_is_buffer ()

+
CoglBool            cogl_is_buffer                      (void *object);
+

+Checks whether buffer is a buffer object. +

+
++++ + + + + + + + + + + +

object :

a buffer object

Returns :

+TRUE if the handle is a CoglBuffer, and FALSE otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_get_size ()

+
unsigned int        cogl_buffer_get_size                (CoglBuffer *buffer);
+

+Retrieves the size of buffer +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

Returns :

the size of the buffer in bytes
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

enum CoglBufferUpdateHint

+
typedef enum {
+ /*< prefix=COGL_BUFFER_UPDATE_HINT >*/
+  COGL_BUFFER_UPDATE_HINT_STATIC,
+  COGL_BUFFER_UPDATE_HINT_DYNAMIC,
+  COGL_BUFFER_UPDATE_HINT_STREAM
+} CoglBufferUpdateHint;
+
+

+The update hint on a buffer allows the user to give some detail on how often +the buffer data is going to be updated. +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_UPDATE_HINT_STATIC

the buffer will not change over time +

COGL_BUFFER_UPDATE_HINT_DYNAMIC

the buffer will change from time to time +

COGL_BUFFER_UPDATE_HINT_STREAM

the buffer will be used once or a couple of + times +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_set_update_hint ()

+
void                cogl_buffer_set_update_hint         (CoglBuffer *buffer,
+                                                         CoglBufferUpdateHint hint);
+

+Sets the update hint on a buffer. See CoglBufferUpdateHint for a description +of the available hints. +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

hint :

the new hint
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_get_update_hint ()

+
CoglBufferUpdateHint cogl_buffer_get_update_hint        (CoglBuffer *buffer);
+

+Retrieves the update hints set using cogl_buffer_set_update_hint() +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

Returns :

the CoglBufferUpdateHint currently used by the buffer
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

enum CoglBufferAccess

+
typedef enum {
+ /*< prefix=COGL_BUFFER_ACCESS >*/
+ COGL_BUFFER_ACCESS_READ       = 1 << 0,
+ COGL_BUFFER_ACCESS_WRITE      = 1 << 1,
+ COGL_BUFFER_ACCESS_READ_WRITE = COGL_BUFFER_ACCESS_READ | COGL_BUFFER_ACCESS_WRITE
+} CoglBufferAccess;
+
+

+The access hints for cogl_buffer_set_update_hint() +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_ACCESS_READ

the buffer will be read +

COGL_BUFFER_ACCESS_WRITE

the buffer will written to +

COGL_BUFFER_ACCESS_READ_WRITE

the buffer will be used for both reading and + writing +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

enum CoglBufferMapHint

+
typedef enum {
+ /*< prefix=COGL_BUFFER_MAP_HINT >*/
+  COGL_BUFFER_MAP_HINT_DISCARD = 1 << 0,
+  COGL_BUFFER_MAP_HINT_DISCARD_RANGE = 1 << 1
+} CoglBufferMapHint;
+
+

+Hints to Cogl about how you are planning to modify the data once it +is mapped. +

+
++++ + + + + + + + + + + +

COGL_BUFFER_MAP_HINT_DISCARD

Tells Cogl that you plan to replace + all the buffer's contents. When this flag is used to map a + buffer, the entire contents of the buffer become undefined, even + if only a subregion of the buffer is mapped. +

COGL_BUFFER_MAP_HINT_DISCARD_RANGE

Tells Cogl that you plan to + replace all the contents of the mapped region. The contents of + the region specified are undefined after this flag is used to + map a buffer. +
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_map ()

+
void *              cogl_buffer_map                     (CoglBuffer *buffer,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints);
+

+Maps the buffer into the application address space for direct +access. This is equivalent to calling cogl_buffer_map_range() with +zero as the offset and the size of the entire buffer as the size. +

+

+It is strongly recommended that you pass +COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace +all the buffer's data. This way if the buffer is currently being +used by the GPU then the driver won't have to stall the CPU and +wait for the hardware to finish because it can instead allocate a +new buffer to map. +

+

+The behaviour is undefined if you access the buffer in a way +conflicting with the access mask you pass. It is also an error to +release your last reference while the buffer is mapped. +

+
++++ + + + + + + + + + + + + + + + + + + +

buffer :

a buffer object

access :

how the mapped buffer will be used by the application

hints :

A mask of CoglBufferMapHints that tell Cogl how +the data will be modified once mapped.

Returns :

A pointer to the mapped memory or +NULL is the call fails. [transfer none] +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_map_range ()

+
void *              cogl_buffer_map_range               (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         size_t size,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints,
+                                                         CoglError **error);
+

+Maps a sub-region of the buffer into the application's address space +for direct access. +

+

+It is strongly recommended that you pass +COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace +all the buffer's data. This way if the buffer is currently being +used by the GPU then the driver won't have to stall the CPU and +wait for the hardware to finish because it can instead allocate a +new buffer to map. You can pass +COGL_BUFFER_MAP_HINT_DISCARD_RANGE instead if you want the +regions outside of the mapping to be retained. +

+

+The behaviour is undefined if you access the buffer in a way +conflicting with the access mask you pass. It is also an error to +release your last reference while the buffer is mapped. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

buffer :

a buffer object

offset :

Offset within the buffer to start the mapping

size :

The size of data to map

access :

how the mapped buffer will be used by the application

hints :

A mask of CoglBufferMapHints that tell Cogl how +the data will be modified once mapped.

error :

A CoglError for catching exceptional errors

Returns :

A pointer to the mapped memory or +NULL is the call fails. [transfer none] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_unmap ()

+
void                cogl_buffer_unmap                   (CoglBuffer *buffer);
+

+Unmaps a buffer previously mapped by cogl_buffer_map(). +

+
++++ + + + + +

buffer :

a buffer object
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_set_data ()

+
CoglBool            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         const void *data,
+                                                         size_t size);
+

+Updates part of the buffer with new data from data. Where to put this new +data is controlled by offset and offset + data should be less than the +buffer size. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

buffer :

a buffer object

offset :

destination offset (in bytes) in the buffer

data :

a pointer to the data to be copied into the buffer

size :

number of bytes to copy

Returns :

+TRUE is the operation succeeded, FALSE otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

CoglPixelBuffer

+
typedef struct _CoglPixelBuffer CoglPixelBuffer;
+
+
+
+

cogl_pixel_buffer_new ()

+
CoglPixelBuffer *   cogl_pixel_buffer_new               (CoglContext *context,
+                                                         size_t size,
+                                                         const void *data);
+

+Declares a new CoglPixelBuffer of size bytes to contain arrays of +pixels. Once declared, data can be set using cogl_buffer_set_data() +or by mapping it into the application's address space using +cogl_buffer_map(). +

+

+If data isn't NULL then size bytes will be read from data and +immediately copied into the new buffer. +

+
++++ + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

size :

The number of bytes to allocate for the pixel data.

data :

An optional pointer to vertex data to upload immediately

Returns :

a newly allocated CoglPixelBuffer. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_pixel_buffer ()

+
CoglBool            cogl_is_pixel_buffer                (void *object);
+

+Checks whether object is a pixel buffer. +

+
++++ + + + + + + + + + + +

object :

a CoglObject to test

Returns :

+TRUE if the object is a pixel buffer, and FALSE +otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglDisplay---Setup-a-display-pipeline.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglDisplay---Setup-a-display-pipeline.html new file mode 100644 index 0000000..152bd37 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglDisplay---Setup-a-display-pipeline.html @@ -0,0 +1,334 @@ + + + + +CoglDisplay: Setup a display pipeline + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglDisplay: Setup a display pipeline

+

CoglDisplay: Setup a display pipeline — Common aspects of a display pipeline

+
+
+

Synopsis

+
                    CoglDisplay;
+CoglBool            cogl_is_display                     (void *object);
+
+CoglDisplay *       cogl_display_new                    (CoglRenderer *renderer,
+                                                         CoglOnscreenTemplate *onscreen_template);
+CoglRenderer *      cogl_display_get_renderer           (CoglDisplay *display);
+CoglBool            cogl_display_setup                  (CoglDisplay *display,
+                                                         CoglError **error);
+
+void                cogl_gdl_display_set_plane          (CoglDisplay *display,
+                                                         gdl_plane_id_t plane);
+
+void                cogl_wayland_display_set_compositor_display
+                                                        (CoglDisplay *display,
+                                                         struct wl_display *wayland_display);
+
+
+
+

Description

+

+The basic intention for this object is to let the application +configure common display preferences before creating a context, and +there are a few different aspects to this... +

+

+Firstly there are options directly relating to the physical display +pipeline that is currently being used including the digital to +analogue conversion hardware and the screens the user sees. +

+

+Another aspect is that display options may constrain or affect how +onscreen framebuffers should later be configured. The original +rationale for the display object in fact was to let us handle GLX +and EGLs requirements that framebuffers must be "compatible" with +the config associated with the current context meaning we have to +force the user to describe how they would like to create their +onscreen windows before we can choose a suitable fbconfig and +create a GLContext. +

+
+
+

Details

+
+

CoglDisplay

+
typedef struct _CoglDisplay CoglDisplay;
+
+
+
+

cogl_is_display ()

+
CoglBool            cogl_is_display                     (void *object);
+

+Gets whether the given object references a CoglDisplay. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglDisplay +and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_display_new ()

+
CoglDisplay *       cogl_display_new                    (CoglRenderer *renderer,
+                                                         CoglOnscreenTemplate *onscreen_template);
+

+Explicitly allocates a new CoglDisplay object to encapsulate the +common state of the display pipeline that applies to the whole +application. +

+

+

+
+

Note

Many applications don't need to explicitly use +cogl_display_new() and can just jump straight to cogl_context_new() +and pass a NULL display argument so Cogl will automatically +connect and setup a renderer and display.
+

+

+

+A display can only be made for a specific choice of renderer which +is why this takes the renderer argument. +

+

+A common use for explicitly allocating a display object is to +define a template for allocating onscreen framebuffers which is +what the onscreen_template argument is for, or alternatively +you can use cogl_display_set_onscreen_template(). +

+

+When a display is first allocated via cogl_display_new() it is in a +mutable configuration mode. It's designed this way so we can +extend the apis available for configuring a display without +requiring huge numbers of constructor arguments. +

+

+When you have finished configuring a display object you can +optionally call cogl_display_setup() to explicitly apply the +configuration and check for errors. Alternaitvely you can pass the +display to cogl_context_new() and Cogl will implicitly apply your +configuration but if there are errors then the application will +abort with a message. For simple applications with no fallback +options then relying on the implicit setup can be fine. +

+
++++ + + + + + + + + + + + + + + +

renderer :

A CoglRenderer +

onscreen_template :

A CoglOnscreenTemplate +

Returns :

A newly allocated CoglDisplay +object in a mutable configuration mode. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_display_get_renderer ()

+
CoglRenderer *      cogl_display_get_renderer           (CoglDisplay *display);
+

+Queries the CoglRenderer associated with the given display. +

+
++++ + + + + + + + + + + +

display :

a CoglDisplay +

Returns :

The associated CoglRenderer. [transfer none] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_display_setup ()

+
CoglBool            cogl_display_setup                  (CoglDisplay *display,
+                                                         CoglError **error);
+

+Explicitly sets up the given display object. Use of this api is +optional since Cogl will internally setup the display if not done +explicitly. +

+

+When a display is first allocated via cogl_display_new() it is in a +mutable configuration mode. This allows us to extend the apis +available for configuring a display without requiring huge numbers +of constructor arguments. +

+

+Its possible to request a configuration that might not be +supportable on the current system and so this api provides a means +to apply the configuration explicitly but if it fails then an +exception will be returned so you can handle the error gracefully +and perhaps fall back to an alternative configuration. +

+

+If you instead rely on Cogl implicitly calling cogl_display_setup() +for you then if there is an error with the configuration you won't +get an opportunity to handle that and the application may abort +with a message. For simple applications that don't have any +fallback options this behaviour may be fine. +

+
++++ + + + + + + + + + + + + + + +

display :

a CoglDisplay +

error :

return location for a CoglError +

Returns :

Returns TRUE if there was no error, else it returns +FALSE and returns an exception via error.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_gdl_display_set_plane ()

+
void                cogl_gdl_display_set_plane          (CoglDisplay *display,
+                                                         gdl_plane_id_t plane);
+

+Request that Cogl output to a specific GDL overlay plane. +

+
++++ + + + + + + + + + + +

display :

a CoglDisplay +

plane :

the GDL plane id
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_wayland_display_set_compositor_display ()

+
void                cogl_wayland_display_set_compositor_display
+                                                        (CoglDisplay *display,
+                                                         struct wl_display *wayland_display);
+

+Informs Cogl of a compositor's Wayland display pointer. This +enables Cogl to register private wayland extensions required to +pass buffers between the clients and compositor. +

+
++++ + + + + + + + + + + +

display :

a CoglDisplay +

wayland_display :

A compositor's Wayland display pointer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglFramebuffer---The-Framebuffer-Interface.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglFramebuffer---The-Framebuffer-Interface.html new file mode 100644 index 0000000..5ac45bf --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglFramebuffer---The-Framebuffer-Interface.html @@ -0,0 +1,2967 @@ + + + + +CoglFramebuffer: The Framebuffer Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglFramebuffer: The Framebuffer Interface

+

CoglFramebuffer: The Framebuffer Interface — A common interface for manipulating framebuffers

+
+
+

Synopsis

+
typedef             CoglFramebuffer;
+#define             COGL_FRAMEBUFFER                    (X)
+CoglBool            cogl_framebuffer_allocate           (CoglFramebuffer *framebuffer,
+                                                         CoglError **error);
+int                 cogl_framebuffer_get_width          (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_height         (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_set_viewport       (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float width,
+                                                         float height);
+float               cogl_framebuffer_get_viewport_x     (CoglFramebuffer *framebuffer);
+float               cogl_framebuffer_get_viewport_y     (CoglFramebuffer *framebuffer);
+float               cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer);
+float               cogl_framebuffer_get_viewport_height
+                                                        (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_get_viewport4fv    (CoglFramebuffer *framebuffer,
+                                                         float *viewport);
+int                 cogl_framebuffer_get_red_bits       (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_green_bits     (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_blue_bits      (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_alpha_bits     (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_depth_bits     (CoglFramebuffer *framebuffer);
+CoglColorMask       cogl_framebuffer_get_color_mask     (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_set_color_mask     (CoglFramebuffer *framebuffer,
+                                                         CoglColorMask color_mask);
+int                 cogl_framebuffer_get_samples_per_pixel
+                                                        (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_set_samples_per_pixel
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int samples_per_pixel);
+void                cogl_framebuffer_resolve_samples    (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_resolve_samples_region
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+CoglContext *       cogl_framebuffer_get_context        (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_clear              (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers,
+                                                         const CoglColor *color);
+void                cogl_framebuffer_clear4f            (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+CoglBool            cogl_framebuffer_read_pixels_into_bitmap
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglBitmap *bitmap);
+CoglBool            cogl_framebuffer_read_pixels        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+void                cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
+                                                         CoglBool dither_enabled);
+CoglBool            cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer);
+
+void                cogl_framebuffer_draw_rectangle     (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_framebuffer_draw_textured_rectangle
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float s_1,
+                                                         float t_1,
+                                                         float s_2,
+                                                         float t_2);
+void                cogl_framebuffer_draw_multitextured_rectangle
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+void                cogl_framebuffer_draw_rectangles    (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         const float *coordinates,
+                                                         unsigned int n_rectangles);
+void                cogl_framebuffer_draw_textured_rectangles
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         const float *coordinates,
+                                                         unsigned int n_rectangles);
+
+void                cogl_framebuffer_discard_buffers    (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers);
+void                cogl_framebuffer_finish             (CoglFramebuffer *framebuffer);
+
+void                cogl_framebuffer_push_matrix        (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_pop_matrix         (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_identity_matrix    (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_scale              (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_framebuffer_translate          (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_framebuffer_rotate             (CoglFramebuffer *framebuffer,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_framebuffer_rotate_euler       (CoglFramebuffer *framebuffer,
+                                                         const CoglEuler *euler);
+void                cogl_framebuffer_rotate_quaternion  (CoglFramebuffer *framebuffer,
+                                                         const CoglQuaternion *quaternion);
+void                cogl_framebuffer_transform          (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+void                cogl_framebuffer_get_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglMatrix *matrix);
+void                cogl_framebuffer_set_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+
+void                cogl_framebuffer_perspective        (CoglFramebuffer *framebuffer,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_framebuffer_frustum            (CoglFramebuffer *framebuffer,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_framebuffer_orthographic       (CoglFramebuffer *framebuffer,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+void                cogl_framebuffer_get_projection_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglMatrix *matrix);
+void                cogl_framebuffer_set_projection_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+
+void                cogl_framebuffer_push_scissor_clip  (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+void                cogl_framebuffer_push_rectangle_clip
+                                                        (CoglFramebuffer *framebuffer,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_framebuffer_push_primitive_clip
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPrimitive *primitive,
+                                                         float bounds_x1,
+                                                         float bounds_y1,
+                                                         float bounds_x2,
+                                                         float bounds_y2);
+void                cogl_framebuffer_pop_clip           (CoglFramebuffer *framebuffer);
+
+CoglFramebuffer *   cogl_get_draw_framebuffer           (void);
+void                cogl_set_framebuffer                (CoglFramebuffer *buffer);
+void                cogl_push_framebuffer               (CoglFramebuffer *buffer);
+void                cogl_pop_framebuffer                (void);
+
+
+
+

Description

+

+Framebuffers are a collection of buffers that can be rendered too. +A framebuffer may be comprised of one or more color buffers, an +optional depth buffer and an optional stencil buffer. Other +configuration parameters are associated with framebuffers too such +as whether the framebuffer supports multi-sampling (an anti-aliasing +technique) or dithering. +

+

+There are two kinds of framebuffer in Cogl, CoglOnscreen +framebuffers and CoglOffscreen framebuffers. As the names imply +offscreen framebuffers are for rendering something offscreen +(perhaps to a texture which is bound as one of the color buffers). +The exact semantics of onscreen framebuffers depends on the window +system backend that you are using, but typically you can expect +rendering to a CoglOnscreen framebuffer will be immediately +visible to the user. +

+

+If you want to create a new framebuffer then you should start by +looking at the CoglOnscreen and CoglOffscreen constructor +functions, such as cogl_offscreen_new_with_texture() or +cogl_onscreen_new(). The CoglFramebuffer interface deals with +all aspects that are common between those two types of framebuffer. +

+

+Setup of a new CoglFramebuffer happens in two stages. There is a +configuration stage where you specify all the options and ancillary +buffers you want associated with your framebuffer and then when you +are happy with the configuration you can "allocate" the framebuffer +using cogl_framebuffer_allocate(). Technically explicitly calling +cogl_framebuffer_allocate() is optional for convenience and the +framebuffer will automatically be allocated when you first try to +draw to it, but if you do the allocation manually then you can +also catch any possible errors that may arise from your +configuration. +

+
+
+

Details

+
+

CoglFramebuffer

+
typedef void CoglFramebuffer;
+
+
+
+
+

COGL_FRAMEBUFFER()

+
#define             COGL_FRAMEBUFFER(X)
+
+
+
+

cogl_framebuffer_allocate ()

+
CoglBool            cogl_framebuffer_allocate           (CoglFramebuffer *framebuffer,
+                                                         CoglError **error);
+

+Explicitly allocates a configured CoglFramebuffer allowing developers to +check and handle any errors that might arise from an unsupported +configuration so that fallback configurations may be tried. +

+

+

+
+

Note

Many applications don't support any fallback options at least when +they are initially developed and in that case the don't need to use this API +since Cogl will automatically allocate a framebuffer when it first gets +used. The disadvantage of relying on automatic allocation is that the +program will abort with an error message if there is an error during +automatic allocation.
+

+

+
++++ + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

error :

A pointer to a CoglError for returning exceptions.

Returns :

+TRUE if there were no error allocating the framebuffer, else FALSE.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_width ()

+
int                 cogl_framebuffer_get_width          (CoglFramebuffer *framebuffer);
+

+Queries the current width of the given framebuffer. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The width of framebuffer.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_height ()

+
int                 cogl_framebuffer_get_height         (CoglFramebuffer *framebuffer);
+

+Queries the current height of the given framebuffer. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The height of framebuffer.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_viewport ()

+
void                cogl_framebuffer_set_viewport       (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float width,
+                                                         float height);
+

+Defines a scale and offset for everything rendered relative to the +top-left of the destination framebuffer. +

+

+By default the viewport has an origin of (0,0) and width and height +that match the framebuffer's size. Assuming a default projection and +modelview matrix then you could translate the contents of a window +down and right by leaving the viewport size unchanged by moving the +offset to (10,10). The viewport coordinates are measured in pixels. +If you left the x and y origin as (0,0) you could scale the windows +contents down by specify and width and height that's half the real +size of the framebuffer. +

+

+

+
+

Note

Although the function takes floating point arguments, existing +drivers only allow the use of integer values. In the future floating +point values will be exposed via a checkable feature.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

x :

The top-left x coordinate of the viewport origin (only integers +supported currently)

y :

The top-left y coordinate of the viewport origin (only integers +supported currently)

width :

The width of the viewport (only integers supported currently)

height :

The height of the viewport (only integers supported currently)
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_viewport_x ()

+
float               cogl_framebuffer_get_viewport_x     (CoglFramebuffer *framebuffer);
+

+Queries the x coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() +or the default value which is 0. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The x coordinate of the viewport origin.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_viewport_y ()

+
float               cogl_framebuffer_get_viewport_y     (CoglFramebuffer *framebuffer);
+

+Queries the y coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() +or the default value which is 0. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The y coordinate of the viewport origin.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_viewport_width ()

+
float               cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer);
+

+Queries the width of the viewport as set using cogl_framebuffer_set_viewport() +or the default value which is the width of the framebuffer. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The width of the viewport.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_viewport_height ()

+
float               cogl_framebuffer_get_viewport_height
+                                                        (CoglFramebuffer *framebuffer);
+

+Queries the height of the viewport as set using cogl_framebuffer_set_viewport() +or the default value which is the height of the framebuffer. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The height of the viewport.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_viewport4fv ()

+
void                cogl_framebuffer_get_viewport4fv    (CoglFramebuffer *framebuffer,
+                                                         float *viewport);
+

+Queries the x, y, width and height components of the current viewport as set +using cogl_framebuffer_set_viewport() or the default values which are 0, 0, +framebuffer_width and framebuffer_height. The values are written into the +given viewport array. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

viewport :

A pointer to an +array of 4 floats to receive the (x, y, width, height) +components of the current viewport. [out caller-allocates][array fixed-size=4] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_red_bits ()

+
int                 cogl_framebuffer_get_red_bits       (CoglFramebuffer *framebuffer);
+

+Retrieves the number of red bits of framebuffer +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

the number of bits
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_green_bits ()

+
int                 cogl_framebuffer_get_green_bits     (CoglFramebuffer *framebuffer);
+

+Retrieves the number of green bits of framebuffer +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

the number of bits
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_blue_bits ()

+
int                 cogl_framebuffer_get_blue_bits      (CoglFramebuffer *framebuffer);
+

+Retrieves the number of blue bits of framebuffer +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

the number of bits
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_alpha_bits ()

+
int                 cogl_framebuffer_get_alpha_bits     (CoglFramebuffer *framebuffer);
+

+Retrieves the number of alpha bits of framebuffer +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

the number of bits
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_depth_bits ()

+
int                 cogl_framebuffer_get_depth_bits     (CoglFramebuffer *framebuffer);
+

+Retrieves the number of depth bits of framebuffer +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

the number of bits
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_color_mask ()

+
CoglColorMask       cogl_framebuffer_get_color_mask     (CoglFramebuffer *framebuffer);
+

+Gets the current CoglColorMask of which channels would be written to the +current framebuffer. Each bit set in the mask means that the +corresponding color would be written. +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

A CoglColorMask +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_color_mask ()

+
void                cogl_framebuffer_set_color_mask     (CoglFramebuffer *framebuffer,
+                                                         CoglColorMask color_mask);
+

+Defines a bit mask of which color channels should be written to the +given framebuffer. If a bit is set in color_mask that means that +color will be written. +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

color_mask :

A CoglColorMask of which color channels to write to +the current framebuffer.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_samples_per_pixel ()

+
int                 cogl_framebuffer_get_samples_per_pixel
+                                                        (CoglFramebuffer *framebuffer);
+

+Gets the number of points that are sampled per-pixel when +rasterizing geometry. Usually by default this will return 0 which +means that single-sample not multisample rendering has been chosen. +When using a GPU supporting multisample rendering it's possible to +increase the number of samples per pixel using +cogl_framebuffer_set_samples_per_pixel(). +

+

+Calling cogl_framebuffer_get_samples_per_pixel() before the +framebuffer has been allocated will simply return the value set +using cogl_framebuffer_set_samples_per_pixel(). After the +framebuffer has been allocated the value will reflect the actual +number of samples that will be made by the GPU. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer framebuffer

Returns :

The number of point samples made per pixel when +rasterizing geometry or 0 if single-sample rendering +has been chosen.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_samples_per_pixel ()

+
void                cogl_framebuffer_set_samples_per_pixel
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int samples_per_pixel);
+

+Requires that when rendering to framebuffer then n point samples +should be made per pixel which will all contribute to the final +resolved color for that pixel. The idea is that the hardware aims +to get quality similar to what you would get if you rendered +everything twice as big (for 4 samples per pixel) and then scaled +that image back down with filtering. It can effectively remove the +jagged edges of polygons and should be more efficient than if you +were to manually render at a higher resolution and downscale +because the hardware is often able to take some shortcuts. For +example the GPU may only calculate a single texture sample for all +points of a single pixel, and for tile based architectures all the +extra sample data (such as depth and stencil samples) may be +handled on-chip and so avoid increased demand on system memory +bandwidth. +

+

+By default this value is usually set to 0 and that is referred to +as "single-sample" rendering. A value of 1 or greater is referred +to as "multisample" rendering. +

+

+

+
+

Note

There are some semantic differences between single-sample +rendering and multisampling with just 1 point sample such as it +being redundant to use the cogl_framebuffer_resolve_samples() and +cogl_framebuffer_resolve_samples_region() apis with single-sample +rendering.
+

+

+

+

+
+

Note

It's recommended that +cogl_framebuffer_resolve_samples_region() be explicitly used at the +end of rendering to a point sample buffer to minimize the number of +samples that get resolved. By default Cogl will implicitly resolve +all framebuffer samples but if only a small region of a +framebuffer has changed this can lead to redundant work being +done.
+

+

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer framebuffer

samples_per_pixel :

The minimum number of samples per pixel
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_resolve_samples ()

+
void                cogl_framebuffer_resolve_samples    (CoglFramebuffer *framebuffer);
+

+When point sample rendering (also known as multisample rendering) +has been enabled via cogl_framebuffer_set_samples_per_pixel() +then you can optionally call this function (or +cogl_framebuffer_resolve_samples_region()) to explicitly resolve +the point samples into values for the final color buffer. +

+

+Some GPUs will implicitly resolve the point samples during +rendering and so this function is effectively a nop, but with other +architectures it is desirable to defer the resolve step until the +end of the frame. +

+

+Since Cogl will automatically ensure samples are resolved if the +target color buffer is used as a source this API only needs to be +used if explicit control is desired - perhaps because you want to +ensure that the resolve is completed in advance to avoid later +having to wait for the resolve to complete. +

+

+If you are performing incremental updates to a framebuffer you +should consider using cogl_framebuffer_resolve_samples_region() +instead to avoid resolving redundant pixels. +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer framebuffer
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_resolve_samples_region ()

+
void                cogl_framebuffer_resolve_samples_region
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+

+When point sample rendering (also known as multisample rendering) +has been enabled via cogl_framebuffer_set_samples_per_pixel() +then you can optionally call this function (or +cogl_framebuffer_resolve_samples()) to explicitly resolve the point +samples into values for the final color buffer. +

+

+Some GPUs will implicitly resolve the point samples during +rendering and so this function is effectively a nop, but with other +architectures it is desirable to defer the resolve step until the +end of the frame. +

+

+Use of this API is recommended if incremental, small updates to +a framebuffer are being made because by default Cogl will +implicitly resolve all the point samples of the framebuffer which +can result in redundant work if only a small number of samples have +changed. +

+

+Because some GPUs implicitly resolve point samples this function +only guarantees that at-least the region specified will be resolved +and if you have rendered to a larger region then it's possible that +other samples may be implicitly resolved. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer framebuffer

x :

top-left x coordinate of region to resolve

y :

top-left y coordinate of region to resolve

width :

width of region to resolve

height :

height of region to resolve
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_context ()

+
CoglContext *       cogl_framebuffer_get_context        (CoglFramebuffer *framebuffer);
+

+Can be used to query the CoglContext a given framebuffer was +instantiated within. This is the CoglContext that was passed to +cogl_onscreen_new() for example. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

Returns :

The CoglContext that the given +framebuffer was instantiated within. [transfer none] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_clear ()

+
void                cogl_framebuffer_clear              (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers,
+                                                         const CoglColor *color);
+

+Clears all the auxiliary buffers identified in the buffers mask, and if +that includes the color buffer then the specified color is used. +

+
++++ + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

buffers :

A mask of CoglBufferBit's identifying which auxiliary +buffers to clear

color :

The color to clear the color buffer too if specified in +buffers.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_clear4f ()

+
void                cogl_framebuffer_clear4f            (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+

+Clears all the auxiliary buffers identified in the buffers mask, and if +that includes the color buffer then the specified color is used. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

buffers :

A mask of CoglBufferBit's identifying which auxiliary +buffers to clear

red :

The red component of color to clear the color buffer too if +specified in buffers.

green :

The green component of color to clear the color buffer too if +specified in buffers.

blue :

The blue component of color to clear the color buffer too if +specified in buffers.

alpha :

The alpha component of color to clear the color buffer too if +specified in buffers.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_read_pixels_into_bitmap ()

+
CoglBool            cogl_framebuffer_read_pixels_into_bitmap
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglBitmap *bitmap);
+

+This reads a rectangle of pixels from the given framebuffer where +position (0, 0) is the top left. The pixel at (x, y) is the first +read, and a rectangle of pixels with the same size as the bitmap is +read right and downwards from that point. +

+

+Currently Cogl assumes that the framebuffer is in a premultiplied +format so if the format of bitmap is non-premultiplied it will +convert it. To read the pixel values without any conversion you +should either specify a format that doesn't use an alpha channel or +use one of the formats ending in PRE. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

x :

The x position to read from

y :

The y position to read from

source :

Identifies which auxillary buffer you want to read +(only COGL_READ_PIXELS_COLOR_BUFFER supported currently)

bitmap :

The bitmap to store the results in.

Returns :

+TRUE if the read succeeded or FALSE otherwise. The +function is only likely to fail if the bitmap points to a pixel +buffer and it could not be mapped.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_read_pixels ()

+
CoglBool            cogl_framebuffer_read_pixels        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+

+This is a convenience wrapper around +cogl_framebuffer_read_pixels_into_bitmap() which allocates a +temporary CoglBitmap to read pixel data directly into the given +buffer. The rowstride of the buffer is assumed to be the width of +the region times the bytes per pixel of the format. The source for +the data is always taken from the color buffer. If you want to use +any other rowstride or source, please use the +cogl_framebuffer_read_pixels_into_bitmap() function directly. +

+

+The implementation of the function looks like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35

+
+
+
+
+
+
+
+
+
+
+
+
+bitmap = cogl_bitmap_new_for_data (context,
+                                   width, height,
+                                   format,
+                                   /* rowstride */
+                                   bpp * width,
+                                   pixels);
+cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
+                                          x, y,
+                                          COGL_READ_PIXELS_COLOR_BUFFER,
+                                          bitmap);
+cogl_object_unref (bitmap);
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

x :

The x position to read from

y :

The y position to read from

width :

The width of the region of rectangles to read

height :

The height of the region of rectangles to read

format :

The pixel format to store the data in

pixels :

The address of the buffer to store the data in

Returns :

+TRUE if the read succeeded or FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_dither_enabled ()

+
void                cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
+                                                         CoglBool dither_enabled);
+

+Enables or disabled dithering if supported by the hardware. +

+

+Dithering is a hardware dependent technique to increase the visible +color resolution beyond what the underlying hardware supports by playing +tricks with the colors placed into the framebuffer to give the illusion +of other colors. (For example this can be compared to half-toning used +by some news papers to show varying levels of grey even though their may +only be black and white are available). +

+

+If the current display pipeline for framebuffer does not support dithering +then this has no affect. +

+

+Dithering is enabled by default. +

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

dither_enabled :

+TRUE to enable dithering or FALSE to disable
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_dither_enabled ()

+
CoglBool            cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer);
+

+Returns whether dithering has been requested for the given framebuffer. +See cogl_framebuffer_set_dither_enabled() for more details about dithering. +

+

+

+
+

Note

This may return TRUE even when the underlying framebuffer +display pipeline does not support dithering. This value only represents +the user's request for dithering.
+

+

+
++++ + + + + + + + + + + +

framebuffer :

a pointer to a CoglFramebuffer +

Returns :

+TRUE if dithering has been requested or FALSE if not.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_rectangle ()

+
void                cogl_framebuffer_draw_rectangle     (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Draws a rectangle to framebuffer with the given pipeline state +and with the top left corner positioned at (x_1, y_1) and the +bottom right corner positioned at (x_2, y_2). +

+

+

+
+

Note

The position is the position before the rectangle has been +transformed by the model-view matrix and the projection +matrix.
+

+

+

+

+
+

Note

If you want to describe a rectangle with a texture mapped on +it then you can use +cogl_framebuffer_draw_textured_rectangle().
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

x_1 :

X coordinate of the top-left corner

y_1 :

Y coordinate of the top-left corner

x_2 :

X coordinate of the bottom-right corner

y_2 :

Y coordinate of the bottom-right corner
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_textured_rectangle ()

+
void                cogl_framebuffer_draw_textured_rectangle
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float s_1,
+                                                         float t_1,
+                                                         float s_2,
+                                                         float t_2);
+

+Draws a textured rectangle to framebuffer using the given +pipeline state with the top left corner positioned at (x_1, y_1) +and the bottom right corner positioned at (x_2, y_2). The top +left corner will have texture coordinates of (s_1, t_1) and the +bottom right corner will have texture coordinates of (s_2, t_2). +

+

+

+
+

Note

The position is the position before the rectangle has been +transformed by the model-view matrix and the projection +matrix.
+

+

+

+This is a high level drawing api that can handle any kind of +CoglMetaTexture texture such as CoglTexture2DSliced textures +which may internally be comprised of multiple low-level textures. +This is unlike low-level drawing apis such as cogl_primitive_draw() +which only support low level texture types that are directly +supported by GPUs such as CoglTexture2D. +

+

+

+
+

Note

The given texture coordinates will only be used for the first +texture layer of the pipeline and if your pipeline has more than +one layer then all other layers will have default texture +coordinates of s_1=0.0 t_1=0.0 s_2=1.0 t_2=1.0
+

+

+

+The given texture coordinates should always be normalized such that +(0, 0) corresponds to the top left and (1, 1) corresponds to the +bottom right. To map an entire texture across the rectangle pass +in s_1=0, t_1=0, s_2=1, t_2=1. +

+

+

+
+

Note

Even if you have associated a CoglTextureRectangle texture +with one of your pipeline layers which normally implies working +with non-normalized texture coordinates this api should still be +passed normalized texture coordinates.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

x_1 :

x coordinate upper left on screen.

y_1 :

y coordinate upper left on screen.

x_2 :

x coordinate lower right on screen.

y_2 :

y coordinate lower right on screen.

s_1 :

S texture coordinate of the top-left coorner

t_1 :

T texture coordinate of the top-left coorner

s_2 :

S texture coordinate of the bottom-right coorner

t_2 :

T texture coordinate of the bottom-right coorner
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_multitextured_rectangle ()

+
void                cogl_framebuffer_draw_multitextured_rectangle
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+

+Draws a textured rectangle to framebuffer with the given pipeline +state with the top left corner positioned at (x_1, y_1) and the +bottom right corner positioned at (x_2, y_2). As a pipeline may +contain multiple texture layers this interface lets you supply +texture coordinates for each layer of the pipeline. +

+

+

+
+

Note

The position is the position before the rectangle has been +transformed by the model-view matrix and the projection +matrix.
+

+

+

+This is a high level drawing api that can handle any kind of +CoglMetaTexture texture for the first layer such as +CoglTexture2DSliced textures which may internally be comprised of +multiple low-level textures. This is unlike low-level drawing apis +such as cogl_primitive_draw() which only support low level texture +types that are directly supported by GPUs such as CoglTexture2D. +

+

+

+
+

Note

This api can not currently handle multiple high-level meta +texture layers. The first layer may be a high level meta texture +such as CoglTexture2DSliced but all other layers much be low +level textures such as CoglTexture2D and additionally they +should be textures that can be sampled using normalized coordinates +(so not CoglTextureRectangle textures).
+

+

+

+The top left texture coordinate for layer 0 of any pipeline will be +(tex_coords[0], tex_coords[1]) and the bottom right coordinate will +be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 +would be (tex_coords[4], tex_coords[5]) (tex_coords[6], +tex_coords[7]) and so on... +

+

+The given texture coordinates should always be normalized such that +(0, 0) corresponds to the top left and (1, 1) corresponds to the +bottom right. To map an entire texture across the rectangle pass +in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, +tex_coords[3]=1. +

+

+

+
+

Note

Even if you have associated a CoglTextureRectangle texture +which normally implies working with non-normalized texture +coordinates this api should still be passed normalized texture +coordinates.
+

+

+

+The first pair of coordinates are for the first layer (with the +smallest layer index) and if you supply less texture coordinates +than there are layers in the current source material then default +texture coordinates (0.0, 0.0, 1.0, 1.0) are generated. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

x_1 :

x coordinate upper left on screen.

y_1 :

y coordinate upper left on screen.

x_2 :

x coordinate lower right on screen.

y_2 :

y coordinate lower right on screen.

tex_coords :

An array containing groups of +4 float values: [s_1, t_1, s_2, t_2] that are interpreted as two texture +coordinates; one for the top left texel, and one for the bottom right +texel. Each value should be between 0.0 and 1.0, where the coordinate +(0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the +bottom right. [in][array][transfer none] +

tex_coords_len :

The length of the tex_coords array. (For one layer +and one group of texture coordinates, this would be 4)
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_rectangles ()

+
void                cogl_framebuffer_draw_rectangles    (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         const float *coordinates,
+                                                         unsigned int n_rectangles);
+

+Draws a series of rectangles to framebuffer with the given +pipeline state in the same way that +cogl_framebuffer_draw_rectangle() does. +

+

+The top left corner of the first rectangle is positioned at +(coordinates[0], coordinates[1]) and the bottom right corner is +positioned at (coordinates[2], coordinates[3]). The positions for +the second rectangle are (coordinates[4], coordinates[5]) and +(coordinates[6], coordinates[7]) and so on... +

+

+

+
+

Note

The position is the position before the rectangle has been +transformed by the model-view matrix and the projection +matrix.
+

+

+

+As a general rule for better performance its recommended to use +this this API instead of calling +cogl_framebuffer_draw_textured_rectangle() separately for multiple +rectangles if all of the rectangles will be drawn together with the +same pipeline state. +

+
++++ + + + + + + + + + + + + + + + + + + +

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

coordinates :

an array of coordinates +containing groups of 4 float values: [x_1, y_1, x_2, y_2] that are +interpreted as two position coordinates; one for the top left of +the rectangle (x1, y1), and one for the bottom right of the +rectangle (x2, y2). [in][array][transfer none] +

n_rectangles :

number of rectangles defined in coordinates.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_textured_rectangles ()

+
void                cogl_framebuffer_draw_textured_rectangles
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         const float *coordinates,
+                                                         unsigned int n_rectangles);
+

+Draws a series of rectangles to framebuffer with the given +pipeline state in the same way that +cogl_framebuffer_draw_textured_rectangle() does. +

+

+

+
+

Note

The position is the position before the rectangle has been +transformed by the model-view matrix and the projection +matrix.
+

+

+

+This is a high level drawing api that can handle any kind of +CoglMetaTexture texture such as CoglTexture2DSliced textures +which may internally be comprised of multiple low-level textures. +This is unlike low-level drawing apis such as cogl_primitive_draw() +which only support low level texture types that are directly +supported by GPUs such as CoglTexture2D. +

+

+The top left corner of the first rectangle is positioned at +(coordinates[0], coordinates[1]) and the bottom right corner is +positioned at (coordinates[2], coordinates[3]). The top left +texture coordinate is (coordinates[4], coordinates[5]) and the +bottom right texture coordinate is (coordinates[6], +coordinates[7]). The coordinates for subsequent rectangles +are defined similarly by the subsequent coordinates. +

+

+As a general rule for better performance its recommended to use +this this API instead of calling +cogl_framebuffer_draw_textured_rectangle() separately for multiple +rectangles if all of the rectangles will be drawn together with the +same pipeline state. +

+

+The given texture coordinates should always be normalized such that +(0, 0) corresponds to the top left and (1, 1) corresponds to the +bottom right. To map an entire texture across the rectangle pass +in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, +tex_coords[3]=1. +

+

+

+
+

Note

Even if you have associated a CoglTextureRectangle texture +which normally implies working with non-normalized texture +coordinates this api should still be passed normalized texture +coordinates.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

coordinates :

an array containing +groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2] +that have the same meaning as the arguments for +cogl_framebuffer_draw_textured_rectangle(). [in][array][transfer none] +

n_rectangles :

number of rectangles to coordinates to draw
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_discard_buffers ()

+
void                cogl_framebuffer_discard_buffers    (CoglFramebuffer *framebuffer,
+                                                         unsigned long  buffers);
+

+Declares that the specified buffers no longer need to be referenced +by any further rendering commands. This can be an important +optimization to avoid subsequent frames of rendering depending on +the results of a previous frame. +

+

+For example; some tile-based rendering GPUs are able to avoid allocating and +accessing system memory for the depth and stencil buffer so long as these +buffers are not required as input for subsequent frames and that can save a +significant amount of memory bandwidth used to save and restore their +contents to system memory between frames. +

+

+It is currently considered an error to try and explicitly discard the color +buffer by passing COGL_BUFFER_BIT_COLOR. This is because the color buffer is +already implicitly discard when you finish rendering to a CoglOnscreen +framebuffer, and it's not meaningful to try and discard the color buffer of +a CoglOffscreen framebuffer since they are single-buffered. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer +

buffers :

A CoglBufferBit mask of which ancillary buffers you want +to discard.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_finish ()

+
void                cogl_framebuffer_finish             (CoglFramebuffer *framebuffer);
+

+This blocks the CPU until all pending rendering associated with the +specified framebuffer has completed. It's very rare that developers should +ever need this level of synchronization with the GPU and should never be +used unless you clearly understand why you need to explicitly force +synchronization. +

+

+One example might be for benchmarking purposes to be sure timing +measurements reflect the time that the GPU is busy for not just the time it +takes to queue rendering commands. +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer pointer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_push_matrix ()

+
void                cogl_framebuffer_push_matrix        (CoglFramebuffer *framebuffer);
+

+Copies the current model-view matrix onto the matrix stack. The matrix +can later be restored with cogl_framebuffer_pop_matrix(). +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer pointer
+

Since 1.10

+
+
+
+

cogl_framebuffer_pop_matrix ()

+
void                cogl_framebuffer_pop_matrix         (CoglFramebuffer *framebuffer);
+

+Restores the model-view matrix on the top of the matrix stack. +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer pointer
+

Since 1.10

+
+
+
+

cogl_framebuffer_identity_matrix ()

+
void                cogl_framebuffer_identity_matrix    (CoglFramebuffer *framebuffer);
+

+Resets the current model-view matrix to the identity matrix. +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer pointer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_scale ()

+
void                cogl_framebuffer_scale              (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current model-view matrix by one that scales the x, +y and z axes by the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

x :

Amount to scale along the x-axis

y :

Amount to scale along the y-axis

z :

Amount to scale along the z-axis
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_translate ()

+
void                cogl_framebuffer_translate          (CoglFramebuffer *framebuffer,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current model-view matrix by one that translates the +model along all three axes according to the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

x :

Distance to translate along the x-axis

y :

Distance to translate along the y-axis

z :

Distance to translate along the z-axis
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_rotate ()

+
void                cogl_framebuffer_rotate             (CoglFramebuffer *framebuffer,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current model-view matrix by one that rotates the +model around the axis-vector specified by x, y and z. The +rotation follows the right-hand thumb rule so for example rotating +by 10 degrees about the axis-vector (0, 0, 1) causes a small +counter-clockwise rotation. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

angle :

Angle in degrees to rotate.

x :

X-component of vertex to rotate around.

y :

Y-component of vertex to rotate around.

z :

Z-component of vertex to rotate around.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_rotate_euler ()

+
void                cogl_framebuffer_rotate_euler       (CoglFramebuffer *framebuffer,
+                                                         const CoglEuler *euler);
+

+Multiplies the current model-view matrix by one that rotates +according to the rotation described by euler. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

euler :

A CoglEuler +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_rotate_quaternion ()

+
void                cogl_framebuffer_rotate_quaternion  (CoglFramebuffer *framebuffer,
+                                                         const CoglQuaternion *quaternion);
+

+Multiplies the current model-view matrix by one that rotates +according to the rotation described by quaternion. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

quaternion :

A CoglQuaternion +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_transform ()

+
void                cogl_framebuffer_transform          (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+

+Multiplies the current model-view matrix by the given matrix. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

matrix :

the matrix to multiply with the current model-view
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_modelview_matrix ()

+
void                cogl_framebuffer_get_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglMatrix *matrix);
+

+Stores the current model-view matrix in matrix. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

matrix :

return location for the model-view matrix. [out] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_modelview_matrix ()

+
void                cogl_framebuffer_set_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+

+Sets matrix as the new model-view matrix. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

matrix :

the new model-view matrix
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_perspective ()

+
void                cogl_framebuffer_perspective        (CoglFramebuffer *framebuffer,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+

+Replaces the current projection matrix with a perspective matrix +based on the provided values. +

+

+

+
+

Note

You should be careful not to have to great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

fov_y :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive, +and must not be 0)

z_far :

The distance to the far clipping plane (Must be positive)
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_frustum ()

+
void                cogl_framebuffer_frustum            (CoglFramebuffer *framebuffer,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+

+Replaces the current projection matrix with a perspective matrix +for a given viewing frustum defined by 4 side clip planes that +all cross through the origin and 2 near and far clip planes. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_orthographic ()

+
void                cogl_framebuffer_orthographic       (CoglFramebuffer *framebuffer,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+

+Replaces the current projection matrix with an orthographic projection +matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

x_1 :

The x coordinate for the first vertical clipping plane

y_1 :

The y coordinate for the first horizontal clipping plane

x_2 :

The x coordinate for the second vertical clipping plane

y_2 :

The y coordinate for the second horizontal clipping plane

near :

The distance to the near clipping +plane (will be negative if the plane is +behind the viewer)

far :

The distance to the far clipping +plane (will be negative if the plane is +behind the viewer)
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_projection_matrix ()

+
void                cogl_framebuffer_get_projection_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglMatrix *matrix);
+

+Stores the current projection matrix in matrix. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

matrix :

return location for the projection matrix. [out] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_set_projection_matrix ()

+
void                cogl_framebuffer_set_projection_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+

+Sets matrix as the new projection matrix. +

+
++++ + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

matrix :

the new projection matrix
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_push_scissor_clip ()

+
void                cogl_framebuffer_push_scissor_clip  (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+

+Specifies a rectangular clipping area for all subsequent drawing +operations. Any drawing commands that extend outside the rectangle +will be clipped so that only the portion inside the rectangle will +be displayed. The rectangle dimensions are not transformed by the +current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_framebuffer_pop_clip(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

x :

left edge of the clip rectangle in window coordinates

y :

top edge of the clip rectangle in window coordinates

width :

width of the clip rectangle

height :

height of the clip rectangle
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_push_rectangle_clip ()

+
void                cogl_framebuffer_push_rectangle_clip
+                                                        (CoglFramebuffer *framebuffer,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Specifies a modelview transformed rectangular clipping area for all +subsequent drawing operations. Any drawing commands that extend +outside the rectangle will be clipped so that only the portion +inside the rectangle will be displayed. The rectangle dimensions +are transformed by the current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_framebuffer_pop_clip(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

x_1 :

x coordinate for top left corner of the clip rectangle

y_1 :

y coordinate for top left corner of the clip rectangle

x_2 :

x coordinate for bottom right corner of the clip rectangle

y_2 :

y coordinate for bottom right corner of the clip rectangle
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_push_primitive_clip ()

+
void                cogl_framebuffer_push_primitive_clip
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPrimitive *primitive,
+                                                         float bounds_x1,
+                                                         float bounds_y1,
+                                                         float bounds_x2,
+                                                         float bounds_y2);
+

+Sets a new clipping area using a 2D shaped described with a +CoglPrimitive. The shape must not contain self overlapping +geometry and must lie on a single 2D plane. A bounding box of the +2D shape in local coordinates (the same coordinates used to +describe the shape) must be given. It is acceptable for the bounds +to be larger than the true bounds but behaviour is undefined if the +bounds are smaller than the true bounds. +

+

+The primitive is transformed by the current model-view matrix and +the silhouette is intersected with the previous clipping area. To +restore the previous clipping area, call +cogl_framebuffer_pop_clip(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

framebuffer :

A CoglFramebuffer pointer

primitive :

A CoglPrimitive describing a flat 2D shape

bounds_x1 :

x coordinate for the top-left corner of the primitives +bounds

bounds_y1 :

y coordinate for the top-left corner of the primitives +bounds

bounds_x2 :

x coordinate for the bottom-right corner of the +primitives bounds.

bounds_y2 :

y coordinate for the bottom-right corner of the +primitives bounds.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_pop_clip ()

+
void                cogl_framebuffer_pop_clip           (CoglFramebuffer *framebuffer);
+

+Reverts the clipping region to the state before the last call to +cogl_framebuffer_push_scissor_clip(), cogl_framebuffer_push_rectangle_clip() +cogl_framebuffer_push_path_clip(), or cogl_framebuffer_push_primitive_clip(). +

+
++++ + + + + +

framebuffer :

A CoglFramebuffer pointer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_get_draw_framebuffer ()

+
CoglFramebuffer *   cogl_get_draw_framebuffer           (void);
+

+Gets the current CoglFramebuffer as set using +cogl_push_framebuffer() +

+
++++ + + + + +

Returns :

The current CoglFramebuffer. [transfer none] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_set_framebuffer ()

+
void                cogl_set_framebuffer                (CoglFramebuffer *buffer);
+
+

Warning

+

cogl_set_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+This redirects all subsequent drawing to the specified framebuffer. This can +either be an offscreen buffer created with cogl_offscreen_new_to_texture() +or in the future it may be an onscreen framebuffers too. +

+
++++ + + + + +

buffer :

A CoglFramebuffer object, either onscreen or offscreen.
+

Since 1.2

+
+
+
+

cogl_push_framebuffer ()

+
void                cogl_push_framebuffer               (CoglFramebuffer *buffer);
+
+

Warning

+

cogl_push_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Redirects all subsequent drawing to the specified framebuffer. This can +either be an offscreen buffer created with cogl_offscreen_new_to_texture() +or in the future it may be an onscreen framebuffer too. +

+

+You should understand that a framebuffer owns the following state: +

+
    +
  • The projection matrix
  • +
  • The modelview matrix stack
  • +
  • The viewport
  • +
  • The clip stack
  • +
+

+So these items will automatically be saved and restored when you +push and pop between different framebuffers. +

+

+Also remember a newly allocated framebuffer will have an identity matrix for +the projection and modelview matrices which gives you a coordinate space +like OpenGL with (-1, -1) corresponding to the top left of the viewport, +(1, 1) corresponding to the bottom right and +z coming out towards the +viewer. +

+

+If you want to set up a coordinate space like Clutter does with (0, 0) +corresponding to the top left and (framebuffer_width, framebuffer_height) +corresponding to the bottom right you can do so like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68

+
+
+
+
+
+
+
+
+
+
+
+
+static void
+setup_viewport (unsigned int width,
+                unsigned int height,
+                float fovy,
+                float aspect,
+                float z_near,
+                float z_far)
+{
+  float z_camera;
+  CoglMatrix projection_matrix;
+  CoglMatrix mv_matrix;
+
+  cogl_set_viewport (0, 0, width, height);
+  cogl_perspective (fovy, aspect, z_near, z_far);
+
+  cogl_get_projection_matrix (&projection_matrix);
+  z_camera = 0.5 * projection_matrix.xx;
+
+  cogl_matrix_init_identity (&mv_matrix);
+  cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera);
+  cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
+  cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f);
+  cogl_set_modelview_matrix (&mv_matrix);
+}
+
+static void
+my_init_framebuffer (ClutterStage *stage,
+                     CoglFramebuffer *framebuffer,
+                     unsigned int framebuffer_width,
+                     unsigned int framebuffer_height)
+{
+  ClutterPerspective perspective;
+
+  clutter_stage_get_perspective (stage, &perspective);
+
+  cogl_push_framebuffer (framebuffer);
+  setup_viewport (framebuffer_width,
+                  framebuffer_height,
+                  perspective.fovy,
+                  perspective.aspect,
+                  perspective.z_near,
+                  perspective.z_far);
+}
+
+ +

+

+

+The previous framebuffer can be restored by calling cogl_pop_framebuffer() +

+
++++ + + + + +

buffer :

A CoglFramebuffer object, either onscreen or offscreen.
+

Since 1.2

+
+
+
+

cogl_pop_framebuffer ()

+
void                cogl_pop_framebuffer                (void);
+
+

Warning

+

cogl_pop_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Restores the framebuffer that was previously at the top of the stack. +All subsequent drawing will be redirected to this framebuffer. +

+

Since 1.2

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html new file mode 100644 index 0000000..65b483c --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html @@ -0,0 +1,130 @@ + + + + +CoglIndexBuffer: Buffers of vertex indices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglIndexBuffer: Buffers of vertex indices

+

CoglIndexBuffer: Buffers of vertex indices — Functions for creating and manipulating vertex +indices.

+
+
+

Synopsis

+
                    CoglIndexBuffer;
+CoglIndexBuffer *   cogl_index_buffer_new               (CoglContext *context,
+                                                         size_t bytes);
+CoglBool            cogl_is_index_buffer                (void *object);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglIndexBuffer

+
typedef struct _CoglIndexBuffer CoglIndexBuffer;
+
+
+
+

cogl_index_buffer_new ()

+
CoglIndexBuffer *   cogl_index_buffer_new               (CoglContext *context,
+                                                         size_t bytes);
+

+Declares a new CoglIndexBuffer of size bytes to contain vertex +indices. Once declared, data can be set using +cogl_buffer_set_data() or by mapping it into the application's +address space using cogl_buffer_map(). +

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext +

bytes :

The number of bytes to allocate for vertex attribute data.

Returns :

A newly allocated CoglIndexBuffer. [transfer full] +
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_index_buffer ()

+
CoglBool            cogl_is_index_buffer                (void *object);
+

+Gets whether the given object references a CoglIndexBuffer. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglIndexBuffer, +FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreen---The-Onscreen-Framebuffer-Interface.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreen---The-Onscreen-Framebuffer-Interface.html new file mode 100644 index 0000000..c19fb79 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreen---The-Onscreen-Framebuffer-Interface.html @@ -0,0 +1,1305 @@ + + + + +CoglOnscreen: The Onscreen Framebuffer Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglOnscreen: The Onscreen Framebuffer Interface

+

CoglOnscreen: The Onscreen Framebuffer Interface

+
+
+

Synopsis

+
                    CoglOnscreen;
+CoglBool            cogl_is_onscreen                    (void *object);
+#define             COGL_ONSCREEN                       (X)
+
+CoglOnscreen *      cogl_onscreen_new                   (CoglContext *context,
+                                                         int width,
+                                                         int height);
+
+void                (*CoglOnscreenX11MaskCallback)      (CoglOnscreen *onscreen,
+                                                         uint32_t event_mask,
+                                                         void *user_data);
+void                cogl_x11_onscreen_set_foreign_window_xid
+                                                        (CoglOnscreen *onscreen,
+                                                         uint32_t xid,
+                                                         CoglOnscreenX11MaskCallback update,
+                                                         void *user_data);
+uint32_t            cogl_x11_onscreen_get_window_xid    (CoglOnscreen *onscreen);
+uint32_t            cogl_x11_onscreen_get_visual_xid    (CoglOnscreen *onscreen);
+
+void                cogl_win32_onscreen_set_foreign_window
+                                                        (CoglOnscreen *onscreen,
+                                                         HWND hwnd);
+HWND                cogl_win32_onscreen_get_window      (CoglOnscreen *onscreen);
+
+void                cogl_onscreen_show                  (CoglOnscreen *onscreen);
+void                cogl_onscreen_hide                  (CoglOnscreen *onscreen);
+
+void                (*CoglFrameCallback)                (CoglOnscreen *onscreen,
+                                                         CoglFrameEvent event,
+                                                         CoglFrameInfo *info,
+                                                         void *user_data);
+typedef             CoglFrameClosure;
+CoglFrameClosure *  cogl_onscreen_add_frame_callback    (CoglOnscreen *onscreen,
+                                                         CoglFrameCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+void                cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
+                                                         CoglFrameClosure *closure);
+
+struct              CoglOnscreenDirtyInfo;
+void                (*CoglOnscreenDirtyCallback)        (CoglOnscreen *onscreen,
+                                                         const CoglOnscreenDirtyInfo *info,
+                                                         void *user_data);
+typedef             CoglOnscreenDirtyClosure;
+CoglOnscreenDirtyClosure * cogl_onscreen_add_dirty_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenDirtyCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+void                cogl_onscreen_remove_dirty_callback (CoglOnscreen *onscreen,
+                                                         CoglOnscreenDirtyClosure *closure);
+
+void                (*CoglOnscreenResizeCallback)       (CoglOnscreen *onscreen,
+                                                         int width,
+                                                         int height,
+                                                         void *user_data);
+typedef             CoglOnscreenResizeClosure;
+CoglOnscreenResizeClosure * cogl_onscreen_add_resize_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenResizeCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+void                cogl_onscreen_remove_resize_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenResizeClosure *closure);
+
+void                cogl_onscreen_swap_buffers          (CoglOnscreen *onscreen);
+void                cogl_onscreen_swap_buffers_with_damage
+                                                        (CoglOnscreen *onscreen,
+                                                         const int *rectangles,
+                                                         int n_rectangles);
+void                cogl_onscreen_swap_region           (CoglOnscreen *onscreen,
+                                                         const int *rectangles,
+                                                         int n_rectangles);
+void                cogl_onscreen_set_swap_throttled    (CoglOnscreen *onscreen,
+                                                         CoglBool throttled);
+void                (*CoglSwapBuffersNotify)            (CoglFramebuffer *framebuffer,
+                                                         void *user_data);
+unsigned int        cogl_onscreen_add_swap_buffers_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglSwapBuffersNotify callback,
+                                                         void *user_data);
+void                cogl_onscreen_remove_swap_buffers_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         unsigned int id);
+
+
+
+

Description

+
+
+

Details

+
+

CoglOnscreen

+
typedef struct _CoglOnscreen CoglOnscreen;
+
+
+
+

cogl_is_onscreen ()

+
CoglBool            cogl_is_onscreen                    (void *object);
+

+Gets whether the given object references a CoglOnscreen. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglOnscreen +and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

COGL_ONSCREEN()

+
#define COGL_ONSCREEN(X) ((CoglOnscreen *)(X))
+
+
+
+
+

cogl_onscreen_new ()

+
CoglOnscreen *      cogl_onscreen_new                   (CoglContext *context,
+                                                         int width,
+                                                         int height);
+

+Instantiates an "unallocated" CoglOnscreen framebuffer that may be +configured before later being allocated, either implicitly when +it is first used or explicitly via cogl_framebuffer_allocate(). +

+
++++ + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

width :

The desired framebuffer width

height :

The desired framebuffer height

Returns :

A newly instantiated CoglOnscreen framebuffer. [transfer full] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

CoglOnscreenX11MaskCallback ()

+
void                (*CoglOnscreenX11MaskCallback)      (CoglOnscreen *onscreen,
+                                                         uint32_t event_mask,
+                                                         void *user_data);
+
+
+
+

cogl_x11_onscreen_set_foreign_window_xid ()

+
void                cogl_x11_onscreen_set_foreign_window_xid
+                                                        (CoglOnscreen *onscreen,
+                                                         uint32_t xid,
+                                                         CoglOnscreenX11MaskCallback update,
+                                                         void *user_data);
+

+Ideally we would recommend that you let Cogl be responsible for +creating any X window required to back an onscreen framebuffer but +if you really need to target a window created manually this +function can be called before onscreen has been allocated to set a +foreign XID for your existing X window. +

+

+Since Cogl needs, for example, to track changes to the size of an X +window it requires that certain events be selected for via the core +X protocol. This requirement may also be changed asynchronously so +you must pass in an update callback to inform you of Cogl's +required event mask. +

+

+For example if you are using Xlib you could use this API roughly +as follows: +[{ +static void +my_update_cogl_x11_event_mask (CoglOnscreen *onscreen, + uint32_t event_mask, + void *user_data) +{ + XSetWindowAttributes attrs; + MyData *data = user_data; + attrs.event_mask = event_mask | data->my_event_mask; + XChangeWindowAttributes (data->xdpy, + data->xwin, + CWEventMask, + &attrs); +} +

+

+{ + *snip* + cogl_x11_onscreen_set_foreign_window_xid (onscreen, + data->xwin, + my_update_cogl_x11_event_mask, + data); + *snip* +} +}] +

+
++++ + + + + + + + + + + + + + + + + + + +

onscreen :

The unallocated framebuffer to associated with an X +window.

xid :

The XID of an existing X window

update :

A callback that notifies of updates to what Cogl requires +to be in the core X protocol event mask.

user_data :

user data passed to update +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_x11_onscreen_get_window_xid ()

+
uint32_t            cogl_x11_onscreen_get_window_xid    (CoglOnscreen *onscreen);
+

+Assuming you know the given onscreen framebuffer is based on an x11 window +this queries the XID of that window. If +cogl_x11_onscreen_set_foreign_window_xid() was previously called then it +will return that same XID otherwise it will be the XID of a window Cogl +created internally. If the window has not been allocated yet and a foreign +xid has not been set then it's undefined what value will be returned. +

+

+It's undefined what this function does if called when not using an x11 based +renderer. +

+
++++ + + + + +

onscreen :

A CoglOnscreen framebuffer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_x11_onscreen_get_visual_xid ()

+
uint32_t            cogl_x11_onscreen_get_visual_xid    (CoglOnscreen *onscreen);
+
+
+
+

cogl_win32_onscreen_set_foreign_window ()

+
void                cogl_win32_onscreen_set_foreign_window
+                                                        (CoglOnscreen *onscreen,
+                                                         HWND hwnd);
+

+Ideally we would recommend that you let Cogl be responsible for +creating any window required to back an onscreen framebuffer but +if you really need to target a window created manually this +function can be called before onscreen has been allocated to set a +foreign XID for your existing X window. +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

hwnd :

A win32 window handle
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_win32_onscreen_get_window ()

+
HWND                cogl_win32_onscreen_get_window      (CoglOnscreen *onscreen);
+

+Queries the internally created window HWND backing the given onscreen +framebuffer. If cogl_win32_onscreen_set_foreign_window() has been used then +it will return the same handle set with that API. +

+
++++ + + + + +

onscreen :

A CoglOnscreen framebuffer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_show ()

+
void                cogl_onscreen_show                  (CoglOnscreen *onscreen);
+

+This requests to make onscreen visible to the user. +

+

+Actually the precise semantics of this function depend on the +window system currently in use, and if you don't have a +multi-windowining system this function may in-fact do nothing. +

+

+This function will implicitly allocate the given onscreen +framebuffer before showing it if it hasn't already been allocated. +

+

+When using the Wayland winsys calling this will set the surface to +a toplevel type which will make it appear. If the application wants +to set a different type for the surface, it can avoid calling +cogl_onscreen_show() and set its own type directly with the Wayland +client API via cogl_wayland_onscreen_get_surface(). +

+

+

+
+

Note

Since Cogl doesn't explicitly track the visibility status of +onscreen framebuffers it wont try to avoid redundant window system +requests e.g. to show an already visible window. This also means +that it's acceptable to alternatively use native APIs to show and +hide windows without confusing Cogl.
+

+

+
++++ + + + + +

onscreen :

The onscreen framebuffer to make visible
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_hide ()

+
void                cogl_onscreen_hide                  (CoglOnscreen *onscreen);
+

+This requests to make onscreen invisible to the user. +

+

+Actually the precise semantics of this function depend on the +window system currently in use, and if you don't have a +multi-windowining system this function may in-fact do nothing. +

+

+This function does not implicitly allocate the given onscreen +framebuffer before hiding it. +

+

+

+
+

Note

Since Cogl doesn't explicitly track the visibility status of +onscreen framebuffers it wont try to avoid redundant window system +requests e.g. to show an already visible window. This also means +that it's acceptable to alternatively use native APIs to show and +hide windows without confusing Cogl.
+

+

+
++++ + + + + +

onscreen :

The onscreen framebuffer to make invisible
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

CoglFrameCallback ()

+
void                (*CoglFrameCallback)                (CoglOnscreen *onscreen,
+                                                         CoglFrameEvent event,
+                                                         CoglFrameInfo *info,
+                                                         void *user_data);
+

+Is a callback that can be registered via +cogl_onscreen_add_frame_callback() to be called when a frame +progresses in some notable way. +

+

+Please see the documentation for CoglFrameEvent and +cogl_onscreen_add_frame_callback() for more details about what +events can be notified. +

+
++++ + + + + + + + + + + + + + + + + + + +

onscreen :

The onscreen that the frame is associated with

event :

A CoglFrameEvent notifying how the frame has progressed

info :

The meta information, such as timing information, about +the frame that has progressed.

user_data :

The user pointer passed to +cogl_onscreen_add_frame_callback() +
+

Since 1.14

+

Stability Level: Unstable

+
+
+
+

CoglFrameClosure

+
typedef struct _CoglClosure CoglFrameClosure;
+
+

+An opaque type that tracks a CoglFrameCallback and associated user +data. A CoglFrameClosure pointer will be returned from +cogl_onscreen_add_frame_callback() and it allows you to remove a +callback later using cogl_onscreen_remove_frame_callback(). +

+

Since 1.14

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_add_frame_callback ()

+
CoglFrameClosure *  cogl_onscreen_add_frame_callback    (CoglOnscreen *onscreen,
+                                                         CoglFrameCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+

+Installs a callback function that will be called for significant +events relating to the given onscreen framebuffer. +

+

+The callback will be used to notify when the system compositor is +ready for this application to render a new frame. In this case +COGL_FRAME_EVENT_SYNC will be passed as the event argument to the +given callback in addition to the CoglFrameInfo corresponding to +the frame beeing acknowledged by the compositor. +

+

+The callback will also be called to notify when the frame has +ended. In this case COGL_FRAME_EVENT_COMPLETE will be passed as +the event argument to the given callback in addition to the +CoglFrameInfo corresponding to the newly presented frame. The +meaning of "ended" here simply means that no more timing +information will be collected within the corresponding +CoglFrameInfo and so this is a good opportunity to analyse the +given info. It does not necessarily mean that the GPU has finished +rendering the corresponding frame. +

+

+We highly recommend throttling your application according to +COGL_FRAME_EVENT_SYNC events so that your application can avoid +wasting resources, drawing more frames than your system compositor +can display. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

callback :

A callback function to call for frame events. [scope notified] +

user_data :

A private pointer to be passed to callback. [closure] +

destroy :

An optional callback to destroy user_data +when the callback is removed or onscreen is freed. [allow-none] +

Returns :

a CoglFrameClosure pointer that can be used to +remove the callback and associated user_data later.
+

Since 1.14

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_remove_frame_callback ()

+
void                cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
+                                                         CoglFrameClosure *closure);
+

+Removes a callback and associated user data that were previously +registered using cogl_onscreen_add_frame_callback(). +

+

+If a destroy callback was passed to +cogl_onscreen_add_frame_callback() to destroy the user data then +this will get called. +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen +

closure :

A CoglFrameClosure returned from +cogl_onscreen_add_frame_callback() +
+

Since 1.14

+

Stability Level: Unstable

+
+
+
+

struct CoglOnscreenDirtyInfo

+
struct CoglOnscreenDirtyInfo {
+  int x, y;
+  int width, height;
+};
+
+

+A structure passed to callbacks registered using +cogl_onscreen_add_dirty_callback(). The members describe a +rectangle within the onscreen buffer that should be redrawn. +

+
++++ + + + + + + + + + + + + + + + + + + +

int x;

Left edge of the dirty rectangle

int y;

Top edge of the dirty rectangle, measured from the top of the window

int width;

Width of the dirty rectangle

int height;

Height of the dirty rectangle
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

CoglOnscreenDirtyCallback ()

+
void                (*CoglOnscreenDirtyCallback)        (CoglOnscreen *onscreen,
+                                                         const CoglOnscreenDirtyInfo *info,
+                                                         void *user_data);
+

+Is a callback that can be registered via +cogl_onscreen_add_dirty_callback() to be called when the windowing +system determines that a region of the onscreen window has been +lost and the application should redraw it. +

+
++++ + + + + + + + + + + + + + + +

onscreen :

The onscreen that the frame is associated with

info :

A CoglOnscreenDirtyInfo struct containing the details of the +dirty area

user_data :

The user pointer passed to +cogl_onscreen_add_frame_callback() +
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

CoglOnscreenDirtyClosure

+
typedef struct _CoglClosure CoglOnscreenDirtyClosure;
+
+

+An opaque type that tracks a CoglOnscreenDirtyCallback and associated +user data. A CoglOnscreenDirtyClosure pointer will be returned from +cogl_onscreen_add_dirty_callback() and it allows you to remove a +callback later using cogl_onscreen_remove_dirty_callback(). +

+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_add_dirty_callback ()

+
CoglOnscreenDirtyClosure * cogl_onscreen_add_dirty_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenDirtyCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+

+Installs a callback function that will be called whenever the +window system has lost the contents of a region of the onscreen +buffer and the application should redraw it to repair the buffer. +For example this may happen in a window system without a compositor +if a window that was previously covering up the onscreen window has +been moved causing a region of the onscreen to be exposed. +

+

+The callback will be passed a CoglOnscreenDirtyInfo struct which +decribes a rectangle containing the newly dirtied region. Note that +this may be called multiple times to describe a non-rectangular +region composed of multiple smaller rectangles. +

+

+The dirty events are separate from COGL_FRAME_EVENT_SYNC events so +the application should also listen for this event before rendering +the dirty region to ensure that the framebuffer is actually ready +for rendering. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

callback :

A callback function to call for dirty events. [scope notified] +

user_data :

A private pointer to be passed to callback. [closure] +

destroy :

An optional callback to destroy user_data when the +callback is removed or onscreen is freed. [allow-none] +

Returns :

a CoglOnscreenDirtyClosure pointer that can be used to +remove the callback and associated user_data later.
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_remove_dirty_callback ()

+
void                cogl_onscreen_remove_dirty_callback (CoglOnscreen *onscreen,
+                                                         CoglOnscreenDirtyClosure *closure);
+

+Removes a callback and associated user data that were previously +registered using cogl_onscreen_add_dirty_callback(). +

+

+If a destroy callback was passed to +cogl_onscreen_add_dirty_callback() to destroy the user data then +this will also get called. +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen +

closure :

A CoglOnscreenDirtyClosure returned from +cogl_onscreen_add_dirty_callback() +
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

CoglOnscreenResizeCallback ()

+
void                (*CoglOnscreenResizeCallback)       (CoglOnscreen *onscreen,
+                                                         int width,
+                                                         int height,
+                                                         void *user_data);
+

+Is a callback type used with the +cogl_onscreen_add_resize_callback() allowing applications to be +notified whenever an onscreen framebuffer is resized. +

+

+

+
+

Note

Cogl automatically updates the viewport of an onscreen +framebuffer that is resized so this callback is also an indication +that the viewport has been modified too
+

+

+

+

+
+

Note

A resize callback will only ever be called while dispatching +Cogl events from the system mainloop; so for example during +cogl_poll_renderer_dispatch(). This is so that callbacks shouldn't +occur while an application might have arbitrary locks held for +example.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer that was resized

width :

The new width of onscreen +

height :

The new height of onscreen +

user_data :

The private passed to +cogl_onscreen_add_resize_callback() +
+

Since 2.0

+
+
+
+

CoglOnscreenResizeClosure

+
typedef struct _CoglClosure CoglOnscreenResizeClosure;
+
+

+An opaque type that tracks a CoglOnscreenResizeCallback and +associated user data. A CoglOnscreenResizeClosure pointer will be +returned from cogl_onscreen_add_resize_callback() and it allows you +to remove a callback later using +cogl_onscreen_remove_resize_callback(). +

+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_add_resize_callback ()

+
CoglOnscreenResizeClosure * cogl_onscreen_add_resize_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenResizeCallback callback,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+

+Registers a callback with onscreen that will be called whenever +the onscreen framebuffer changes size. +

+

+The callback can be removed using +cogl_onscreen_remove_resize_callback() passing the returned closure +pointer. +

+

+

+
+

Note

Since Cogl automatically updates the viewport of an onscreen +framebuffer that is resized, a resize callback can also be used to +track when the viewport has been changed automatically by Cogl in +case your application needs more specialized control over the +viewport.
+

+

+

+

+
+

Note

A resize callback will only ever be called while dispatching +Cogl events from the system mainloop; so for example during +cogl_poll_renderer_dispatch(). This is so that callbacks shouldn't +occur while an application might have arbitrary locks held for +example.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

callback :

A CoglOnscreenResizeCallback to call when +the onscreen changes size. [scope notified] +

user_data :

Private data to be passed to callback. [closure] +

destroy :

An optional callback to destroy user_data +when the callback is removed or onscreen is freed. [allow-none] +

Returns :

a CoglOnscreenResizeClosure pointer that can be used to +remove the callback and associated user_data later.
+

Since 2.0

+
+
+
+

cogl_onscreen_remove_resize_callback ()

+
void                cogl_onscreen_remove_resize_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglOnscreenResizeClosure *closure);
+

+Removes a resize callback and user_data pair that were previously +associated with onscreen via cogl_onscreen_add_resize_callback(). +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

closure :

An identifier returned from cogl_onscreen_add_resize_callback() +
+

Since 2.0

+
+
+
+

cogl_onscreen_swap_buffers ()

+
void                cogl_onscreen_swap_buffers          (CoglOnscreen *onscreen);
+

+Swaps the current back buffer being rendered too, to the front for display. +

+

+This function also implicitly discards the contents of the color, depth and +stencil buffers as if cogl_framebuffer_discard_buffers() were used. The +significance of the discard is that you should not expect to be able to +start a new frame that incrementally builds on the contents of the previous +frame. +

+

+

+
+

Note

It is highly recommended that applications use +cogl_onscreen_swap_buffers_with_damage() instead whenever possible +and also use the cogl_onscreen_get_buffer_age() api so they can +perform incremental updates to older buffers instead of having to +render a full buffer for every frame.
+

+

+
++++ + + + + +

onscreen :

A CoglOnscreen framebuffer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_swap_buffers_with_damage ()

+
void                cogl_onscreen_swap_buffers_with_damage
+                                                        (CoglOnscreen *onscreen,
+                                                         const int *rectangles,
+                                                         int n_rectangles);
+

+Swaps the current back buffer being rendered too, to the front for +display and provides information to any system compositor about +what regions of the buffer have changed (damage) with respect to +the last swapped buffer. +

+

+This function has the same semantics as +cogl_framebuffer_swap_buffers() except that it additionally allows +applications to pass a list of damaged rectangles which may be +passed on to a compositor so that it can minimize how much of the +screen is redrawn in response to this applications newly swapped +front buffer. +

+

+For example if your application is only animating a small object in +the corner of the screen and everything else is remaining static +then it can help the compositor to know that only the bottom right +corner of your newly swapped buffer has really changed with respect +to your previously swapped front buffer. +

+

+If n_rectangles is 0 then the whole buffer will implicitly be +reported as damaged as if cogl_onscreen_swap_buffers() had been +called. +

+

+This function also implicitly discards the contents of the color, +depth and stencil buffers as if cogl_framebuffer_discard_buffers() +were used. The significance of the discard is that you should not +expect to be able to start a new frame that incrementally builds on +the contents of the previous frame. If you want to perform +incremental updates to older back buffers then please refer to the +cogl_onscreen_get_buffer_age() api. +

+

+Whenever possible it is recommended that applications use this +function instead of cogl_onscreen_swap_buffers() to improve +performance when running under a compositor. +

+

+

+
+

Note

It is highly recommended to use this API in conjunction with +the cogl_onscreen_get_buffer_age() api so that your application can +perform incremental rendering based on old back buffers.
+

+

+
++++ + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

rectangles :

An array of integer 4-tuples representing damaged +rectangles as (x, y, width, height) tuples.

n_rectangles :

The number of 4-tuples to be read from rectangles +
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_swap_region ()

+
void                cogl_onscreen_swap_region           (CoglOnscreen *onscreen,
+                                                         const int *rectangles,
+                                                         int n_rectangles);
+

+Swaps a region of the back buffer being rendered too, to the front for +display. rectangles represents the region as array of n_rectangles each +defined by 4 sequential (x, y, width, height) integers. +

+

+This function also implicitly discards the contents of the color, depth and +stencil buffers as if cogl_framebuffer_discard_buffers() were used. The +significance of the discard is that you should not expect to be able to +start a new frame that incrementally builds on the contents of the previous +frame. +

+
++++ + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

rectangles :

An array of integer 4-tuples representing rectangles as +(x, y, width, height) tuples.

n_rectangles :

The number of 4-tuples to be read from rectangles +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_set_swap_throttled ()

+
void                cogl_onscreen_set_swap_throttled    (CoglOnscreen *onscreen,
+                                                         CoglBool throttled);
+

+Requests that the given onscreen framebuffer should have swap buffer +requests (made using cogl_onscreen_swap_buffers()) throttled either by a +displays vblank period or perhaps some other mechanism in a composited +environment. +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

throttled :

Whether swap throttling is wanted or not.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

CoglSwapBuffersNotify ()

+
void                (*CoglSwapBuffersNotify)            (CoglFramebuffer *framebuffer,
+                                                         void *user_data);
+
+
+
+

cogl_onscreen_add_swap_buffers_callback ()

+
unsigned int        cogl_onscreen_add_swap_buffers_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         CoglSwapBuffersNotify callback,
+                                                         void *user_data);
+
+

Warning

+

cogl_onscreen_add_swap_buffers_callback has been deprecated since version 1.14 and should not be used in newly-written code. Use cogl_onscreen_add_frame_callback() instead

+
+

+Installs a callback function that should be called whenever a swap buffers +request (made using cogl_onscreen_swap_buffers()) for the given +onscreen completes. +

+

+

+
+

Note

Applications should check for the COGL_FEATURE_ID_SWAP_BUFFERS_EVENT +feature before using this API. It's currently undefined when and if +registered callbacks will be called if this feature is not supported.
+

+

+

+We recommend using this mechanism when available to manually throttle your +applications (in conjunction with cogl_onscreen_set_swap_throttled()) so +your application will be able to avoid long blocks in the driver caused by +throttling when you request to swap buffers too quickly. +

+
++++ + + + + + + + + + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

callback :

A callback function to call when a swap +has completed. [scope notified] +

user_data :

A private pointer to be passed to callback. [closure] +

Returns :

a unique identifier that can be used to remove to remove +the callback later.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_remove_swap_buffers_callback ()

+
void                cogl_onscreen_remove_swap_buffers_callback
+                                                        (CoglOnscreen *onscreen,
+                                                         unsigned int id);
+
+

Warning

+

cogl_onscreen_remove_swap_buffers_callback has been deprecated since version 1.14 and should not be used in newly-written code. Use cogl_onscreen_remove_frame_callback() instead

+
+

+Removes a callback that was previously registered +using cogl_onscreen_add_swap_buffers_callback(). +

+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen framebuffer

id :

An identifier returned from cogl_onscreen_add_swap_buffers_callback() +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreenTemplate---Describe-a-template-for-onscreen-framebuffers.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreenTemplate---Describe-a-template-for-onscreen-framebuffers.html new file mode 100644 index 0000000..5009352 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglOnscreenTemplate---Describe-a-template-for-onscreen-framebuffers.html @@ -0,0 +1,94 @@ + + + + +CoglOnscreenTemplate: Describe a template for onscreen framebuffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglOnscreenTemplate: Describe a template for onscreen framebuffers

+

CoglOnscreenTemplate: Describe a template for onscreen framebuffers

+
+
+

Synopsis

+
                    CoglOnscreenTemplate;
+CoglBool            cogl_is_onscreen_template           (void *object);
+
+CoglOnscreenTemplate * cogl_onscreen_template_new       (CoglSwapChain *swap_chain);
+
+
+
+

Description

+
+
+

Details

+
+

CoglOnscreenTemplate

+
typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate;
+
+
+
+

cogl_is_onscreen_template ()

+
CoglBool            cogl_is_onscreen_template           (void *object);
+

+Gets whether the given object references a CoglOnscreenTemplate. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglOnscreenTemplate +and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_onscreen_template_new ()

+
CoglOnscreenTemplate * cogl_onscreen_template_new       (CoglSwapChain *swap_chain);
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglRenderer---Connect-to-a-backend-renderer.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglRenderer---Connect-to-a-backend-renderer.html new file mode 100644 index 0000000..1cf1857 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglRenderer---Connect-to-a-backend-renderer.html @@ -0,0 +1,916 @@ + + + + +CoglRenderer: Connect to a backend renderer + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglRenderer: Connect to a backend renderer

+

CoglRenderer: Connect to a backend renderer — Choosing a means to render

+
+
+

Synopsis

+
                    CoglRenderer;
+CoglBool            cogl_is_renderer                    (void *object);
+
+CoglRenderer *      cogl_renderer_new                   (void);
+int                 cogl_renderer_get_n_fragment_texture_units
+                                                        (CoglRenderer *renderer);
+CoglBool            cogl_renderer_connect               (CoglRenderer *renderer,
+                                                         CoglError **error);
+
+enum                CoglWinsysID;
+void                cogl_renderer_set_winsys_id         (CoglRenderer *renderer,
+                                                         CoglWinsysID winsys_id);
+CoglWinsysID        cogl_renderer_get_winsys_id         (CoglRenderer *renderer);
+enum                CoglRendererConstraint;
+void                cogl_renderer_add_constraint        (CoglRenderer *renderer,
+                                                         CoglRendererConstraint constraint);
+void                cogl_renderer_remove_constraint     (CoglRenderer *renderer,
+                                                         CoglRendererConstraint constraint);
+
+void                cogl_xlib_renderer_set_foreign_display
+                                                        (CoglRenderer *renderer,
+                                                         Display *display);
+Display *           cogl_xlib_renderer_get_foreign_display
+                                                        (CoglRenderer *renderer);
+
+CoglFilterReturn    (*CoglXlibFilterFunc)               (XEvent *event,
+                                                         void *data);
+enum                CoglFilterReturn;
+void                cogl_xlib_renderer_add_filter       (CoglRenderer *renderer,
+                                                         CoglXlibFilterFunc func,
+                                                         void *data);
+void                cogl_xlib_renderer_remove_filter    (CoglRenderer *renderer,
+                                                         CoglXlibFilterFunc func,
+                                                         void *data);
+CoglFilterReturn    cogl_xlib_renderer_handle_event     (CoglRenderer *renderer,
+                                                         XEvent *event);
+
+CoglFilterReturn    (*CoglWin32FilterFunc)              (MSG *message,
+                                                         void *data);
+void                cogl_win32_renderer_add_filter      (CoglRenderer *renderer,
+                                                         CoglWin32FilterFunc func,
+                                                         void *data);
+void                cogl_win32_renderer_remove_filter   (CoglRenderer *renderer,
+                                                         CoglWin32FilterFunc func,
+                                                         void *data);
+CoglFilterReturn    cogl_win32_renderer_handle_event    (CoglRenderer *renderer,
+                                                         MSG *message);
+void                cogl_win32_renderer_set_event_retrieval_enabled
+                                                        (CoglRenderer *renderer,
+                                                         CoglBool enable);
+
+void                cogl_wayland_renderer_set_foreign_display
+                                                        (CoglRenderer *renderer,
+                                                         struct wl_display *display);
+void                cogl_wayland_renderer_set_event_dispatch_enabled
+                                                        (CoglRenderer *renderer,
+                                                         CoglBool enable);
+struct wl_display * cogl_wayland_renderer_get_display   (CoglRenderer *renderer);
+
+
+
+

Description

+

+A CoglRenderer represents a means to render. It encapsulates the +selection of an underlying driver, such as OpenGL or OpenGL-ES and +a selection of a window system binding API such as GLX, or EGL or +WGL. +

+

+A CoglRenderer has two states, "unconnected" and "connected". When +a renderer is first instantiated using cogl_renderer_new() it is +unconnected so that it can be configured and constraints can be +specified for how the backend driver and window system should be +chosen. +

+

+After configuration a CoglRenderer can (optionally) be explicitly +connected using cogl_renderer_connect() which allows for the +handling of connection errors so that fallback configurations can +be tried if necessary. Applications that don't support any +fallbacks though can skip using cogl_renderer_connect() and leave +Cogl to automatically connect the renderer. +

+

+Once you have a configured CoglRenderer it can be used to create a +CoglDisplay object using cogl_display_new(). +

+

+

+
+

Note

Many applications don't need to explicitly use +cogl_renderer_new() or cogl_display_new() and can just jump +straight to cogl_context_new() and pass a NULL display argument so +Cogl will automatically connect and setup a renderer and +display.
+

+

+
+
+

Details

+
+

CoglRenderer

+
typedef struct _CoglRenderer CoglRenderer;
+
+
+
+

cogl_is_renderer ()

+
CoglBool            cogl_is_renderer                    (void *object);
+

+Determines if the given object is a CoglRenderer +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if object is a CoglRenderer, else FALSE.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_renderer_new ()

+
CoglRenderer *      cogl_renderer_new                   (void);
+

+Instantiates a new (unconnected) CoglRenderer object. A +CoglRenderer represents a means to render. It encapsulates the +selection of an underlying driver, such as OpenGL or OpenGL-ES and +a selection of a window system binding API such as GLX, or EGL or +WGL. +

+

+While the renderer is unconnected it can be configured so that +applications may specify backend constraints, such as "must use +x11" for example via cogl_renderer_add_constraint(). +

+

+There are also some platform specific configuration apis such +as cogl_xlib_renderer_set_foreign_display() that may also be +used while the renderer is unconnected. +

+

+Once the renderer has been configured, then it may (optionally) be +explicitly connected using cogl_renderer_connect() which allows +errors to be handled gracefully and potentially fallback +configurations can be tried out if there are initial failures. +

+

+If a renderer is not explicitly connected then cogl_display_new() +will automatically connect the renderer for you. If you don't +have any code to deal with error/fallback situations then its fine +to just let Cogl do the connection for you. +

+

+Once you have setup your renderer then the next step is to create a +CoglDisplay using cogl_display_new(). +

+

+

+
+

Note

Many applications don't need to explicitly use +cogl_renderer_new() or cogl_display_new() and can just jump +straight to cogl_context_new() and pass a NULL display argument +so Cogl will automatically connect and setup a renderer and +display.
+

+

+
++++ + + + + +

Returns :

A newly created CoglRenderer. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_renderer_get_n_fragment_texture_units ()

+
int                 cogl_renderer_get_n_fragment_texture_units
+                                                        (CoglRenderer *renderer);
+

+Queries how many texture units can be used from fragment programs +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

Returns :

the number of texture image units.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_renderer_connect ()

+
CoglBool            cogl_renderer_connect               (CoglRenderer *renderer,
+                                                         CoglError **error);
+

+Connects the configured renderer. Renderer connection isn't a +very active process, it basically just means validating that +any given constraint criteria can be satisfied and that a +usable driver and window system backend can be found. +

+
++++ + + + + + + + + + + + + + + +

renderer :

An unconnected CoglRenderer +

error :

a pointer to a CoglError for reporting exceptions

Returns :

+TRUE if there was no error while connecting the +given renderer. FALSE if there was an error.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

enum CoglWinsysID

+
typedef enum {
+  COGL_WINSYS_ID_ANY,
+  COGL_WINSYS_ID_STUB,
+  COGL_WINSYS_ID_GLX,
+  COGL_WINSYS_ID_EGL_XLIB,
+  COGL_WINSYS_ID_EGL_NULL,
+  COGL_WINSYS_ID_EGL_GDL,
+  COGL_WINSYS_ID_EGL_WAYLAND,
+  COGL_WINSYS_ID_EGL_KMS,
+  COGL_WINSYS_ID_EGL_ANDROID,
+  COGL_WINSYS_ID_WGL,
+  COGL_WINSYS_ID_SDL
+} CoglWinsysID;
+
+

+Identifies specific window system backends that Cogl supports. +

+

+These can be used to query what backend Cogl is using or to try and +explicitly select a backend to use. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_WINSYS_ID_ANY

Implies no preference for which backend is used +

COGL_WINSYS_ID_STUB

Use the no-op stub backend +

COGL_WINSYS_ID_GLX

Use the GLX window system binding API +

COGL_WINSYS_ID_EGL_XLIB

Use EGL with the X window system via XLib +

COGL_WINSYS_ID_EGL_NULL

Use EGL with the PowerVR NULL window system +

COGL_WINSYS_ID_EGL_GDL

Use EGL with the GDL platform +

COGL_WINSYS_ID_EGL_WAYLAND

Use EGL with the Wayland window system +

COGL_WINSYS_ID_EGL_KMS

Use EGL with the KMS platform +

COGL_WINSYS_ID_EGL_ANDROID

Use EGL with the Android platform +

COGL_WINSYS_ID_WGL

Use the Microsoft Windows WGL binding API +

COGL_WINSYS_ID_SDL

Use the SDL window system +
+
+
+
+

cogl_renderer_set_winsys_id ()

+
void                cogl_renderer_set_winsys_id         (CoglRenderer *renderer,
+                                                         CoglWinsysID winsys_id);
+

+This allows you to explicitly select a winsys backend to use instead +of letting Cogl automatically select a backend. +

+

+if you select an unsupported backend then cogl_renderer_connect() +will fail and report an error. +

+

+This may only be called on an un-connected CoglRenderer. +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

winsys_id :

An ID of the winsys you explicitly want to use.
+
+
+
+

cogl_renderer_get_winsys_id ()

+
CoglWinsysID        cogl_renderer_get_winsys_id         (CoglRenderer *renderer);
+

+Queries which window system backend Cogl has chosen to use. +

+

+This may only be called on a connected CoglRenderer. +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

Returns :

The CoglWinsysID corresponding to the chosen window +system backend.
+
+
+
+

enum CoglRendererConstraint

+
typedef enum {
+  COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0),
+  COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1),
+  COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2),
+  COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 = (1 << 3)
+} CoglRendererConstraint;
+
+

+These constraint flags are hard-coded features of the different renderer +backends. Sometimes a platform may support multiple rendering options which +Cogl will usually choose from automatically. Some of these features are +important to higher level applications and frameworks though, such as +whether a renderer is X11 based because an application might only support +X11 based input handling. An application might also need to ensure EGL is +used internally too if they depend on access to an EGLDisplay for some +purpose. +

+

+Applications should ideally minimize how many of these constraints +they depend on to ensure maximum portability. +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_RENDERER_CONSTRAINT_USES_X11

Require the renderer to be X11 based +

COGL_RENDERER_CONSTRAINT_USES_XLIB

Require the renderer to be X11 + based and use Xlib +

COGL_RENDERER_CONSTRAINT_USES_EGL

Require the renderer to be EGL based +

COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2

Require that the + renderer supports creating a CoglGLES2Context via + cogl_gles2_context_new(). This can be used to integrate GLES 2.0 + code into Cogl based applications. +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_renderer_add_constraint ()

+
void                cogl_renderer_add_constraint        (CoglRenderer *renderer,
+                                                         CoglRendererConstraint constraint);
+

+This adds a renderer selection constraint. +

+

+Applications should ideally minimize how many of these constraints they +depend on to ensure maximum portability. +

+
++++ + + + + + + + + + + +

renderer :

An unconnected CoglRenderer +

constraint :

A CoglRendererConstraint to add
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_renderer_remove_constraint ()

+
void                cogl_renderer_remove_constraint     (CoglRenderer *renderer,
+                                                         CoglRendererConstraint constraint);
+

+This removes a renderer selection constraint. +

+

+Applications should ideally minimize how many of these constraints they +depend on to ensure maximum portability. +

+
++++ + + + + + + + + + + +

renderer :

An unconnected CoglRenderer +

constraint :

A CoglRendererConstraint to remove
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_xlib_renderer_set_foreign_display ()

+
void                cogl_xlib_renderer_set_foreign_display
+                                                        (CoglRenderer *renderer,
+                                                         Display *display);
+
+
+
+

cogl_xlib_renderer_get_foreign_display ()

+
Display *           cogl_xlib_renderer_get_foreign_display
+                                                        (CoglRenderer *renderer);
+
+
+
+

CoglXlibFilterFunc ()

+
CoglFilterReturn    (*CoglXlibFilterFunc)               (XEvent *event,
+                                                         void *data);
+
+
+
+

enum CoglFilterReturn

+
typedef enum {
+ /*< prefix=COGL_FILTER >*/
+  COGL_FILTER_CONTINUE,
+  COGL_FILTER_REMOVE
+} CoglFilterReturn;
+
+

+Return values for the CoglXlibFilterFunc and CoglWin32FilterFunc functions. +

+
++++ + + + + + + + + + + +

COGL_FILTER_CONTINUE

The event was not handled, continues the + processing +

COGL_FILTER_REMOVE

Remove the event, stops the processing +
+

Stability Level: Unstable

+
+
+
+

cogl_xlib_renderer_add_filter ()

+
void                cogl_xlib_renderer_add_filter       (CoglRenderer *renderer,
+                                                         CoglXlibFilterFunc func,
+                                                         void *data);
+
+
+
+

cogl_xlib_renderer_remove_filter ()

+
void                cogl_xlib_renderer_remove_filter    (CoglRenderer *renderer,
+                                                         CoglXlibFilterFunc func,
+                                                         void *data);
+
+
+
+

cogl_xlib_renderer_handle_event ()

+
CoglFilterReturn    cogl_xlib_renderer_handle_event     (CoglRenderer *renderer,
+                                                         XEvent *event);
+
+
+
+

CoglWin32FilterFunc ()

+
CoglFilterReturn    (*CoglWin32FilterFunc)              (MSG *message,
+                                                         void *data);
+

+A callback function that can be registered with +cogl_win32_renderer_add_filter(). The function should return +COGL_FILTER_REMOVE if it wants to prevent further processing or +COGL_FILTER_CONTINUE otherwise. +

+
++++ + + + + + + + + + + +

message :

A pointer to a win32 MSG struct

data :

The data that was given when the filter was added
+
+
+
+

cogl_win32_renderer_add_filter ()

+
void                cogl_win32_renderer_add_filter      (CoglRenderer *renderer,
+                                                         CoglWin32FilterFunc func,
+                                                         void *data);
+

+Adds a callback function that will receive all native events. The +function can stop further processing of the event by return +COGL_FILTER_REMOVE. +

+
++++ + + + + + + + + + + + + + + +

renderer :

a CoglRenderer +

func :

the callback function

data :

user data passed to func when called
+
+
+
+

cogl_win32_renderer_remove_filter ()

+
void                cogl_win32_renderer_remove_filter   (CoglRenderer *renderer,
+                                                         CoglWin32FilterFunc func,
+                                                         void *data);
+

+Removes a callback that was previously added with +cogl_win32_renderer_add_filter(). +

+
++++ + + + + + + + + + + + + + + +

renderer :

a CoglRenderer +

func :

the callback function

data :

user data given when the callback was installed
+
+
+
+

cogl_win32_renderer_handle_event ()

+
CoglFilterReturn    cogl_win32_renderer_handle_event    (CoglRenderer *renderer,
+                                                         MSG *message);
+

+This function processes a single event; it can be used to hook into +external event retrieval (for example that done by Clutter or +GDK). +

+
++++ + + + + + + + + + + + + + + +

renderer :

a CoglRenderer +

message :

A pointer to a win32 MSG struct

Returns :

+CoglFilterReturn. COGL_FILTER_REMOVE indicates that +Cogl has internally handled the event and the caller should do no +further processing. COGL_FILTER_CONTINUE indicates that Cogl is +either not interested in the event, or has used the event to update +internal state without taking any exclusive action.
+
+
+
+

cogl_win32_renderer_set_event_retrieval_enabled ()

+
void                cogl_win32_renderer_set_event_retrieval_enabled
+                                                        (CoglRenderer *renderer,
+                                                         CoglBool enable);
+

+Sets whether Cogl should automatically retrieve messages from +Windows. It defaults to TRUE. It can be set to FALSE if the +application wants to handle its own message retrieval. Note that +Cogl still needs to see all of the messages to function properly so +the application should call cogl_win32_renderer_handle_event() for +each message if it disables automatic event retrieval. +

+
++++ + + + + + + + + + + +

renderer :

a CoglRenderer +

enable :

The new value
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_wayland_renderer_set_foreign_display ()

+
void                cogl_wayland_renderer_set_foreign_display
+                                                        (CoglRenderer *renderer,
+                                                         struct wl_display *display);
+

+Allows you to explicitly control what Wayland display you want Cogl +to work with instead of leaving Cogl to automatically connect to a +wayland compositor. +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

display :

A Wayland display
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_wayland_renderer_set_event_dispatch_enabled ()

+
void                cogl_wayland_renderer_set_event_dispatch_enabled
+                                                        (CoglRenderer *renderer,
+                                                         CoglBool enable);
+

+Sets whether Cogl should handle calling wl_display_dispatch() and +wl_display_flush() as part of its main loop integration via +cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch(). +The default value is TRUE. When it is enabled the application can +register listeners for Wayland interfaces and the callbacks will be +invoked during cogl_poll_renderer_dispatch(). If the application +wants to integrate with its own code that is already handling +reading from the Wayland display socket, it should disable this to +avoid having competing code read from the socket. +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

enable :

The new value
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_wayland_renderer_get_display ()

+
struct wl_display * cogl_wayland_renderer_get_display   (CoglRenderer *renderer);
+

+Retrieves the Wayland display that Cogl is using. If a foreign +display has been specified using +cogl_wayland_renderer_set_foreign_display() then that display will +be returned. If no foreign display has been specified then the +display that Cogl creates internally will be returned unless the +renderer has not yet been connected (either implicitly or explicitly by +calling cogl_renderer_connect()) in which case NULL is returned. +

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

Returns :

The wayland display currently associated with renderer, +or NULL if the renderer hasn't yet been connected and no +foreign display has been specified.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html new file mode 100644 index 0000000..4cc84f0 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html @@ -0,0 +1,1110 @@ + + + + +Color Type + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Color Type

+

Color Type — A generic color definition

+
+
+

Synopsis

+
struct              CoglColor;
+CoglColor *         cogl_color_new                      (void);
+CoglColor *         cogl_color_copy                     (const CoglColor *color);
+void                cogl_color_free                     (CoglColor *color);
+void                cogl_color_set_from_4ub             (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_color_set_from_4f              (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+float               cogl_color_get_red                  (const CoglColor *color);
+float               cogl_color_get_green                (const CoglColor *color);
+float               cogl_color_get_blue                 (const CoglColor *color);
+float               cogl_color_get_alpha                (const CoglColor *color);
+
+unsigned char       cogl_color_get_red_byte             (const CoglColor *color);
+unsigned char       cogl_color_get_green_byte           (const CoglColor *color);
+unsigned char       cogl_color_get_blue_byte            (const CoglColor *color);
+unsigned char       cogl_color_get_alpha_byte           (const CoglColor *color);
+
+float               cogl_color_get_red_float            (const CoglColor *color);
+float               cogl_color_get_green_float          (const CoglColor *color);
+float               cogl_color_get_blue_float           (const CoglColor *color);
+float               cogl_color_get_alpha_float          (const CoglColor *color);
+
+void                cogl_color_set_red                  (CoglColor *color,
+                                                         float red);
+void                cogl_color_set_green                (CoglColor *color,
+                                                         float green);
+void                cogl_color_set_blue                 (CoglColor *color,
+                                                         float blue);
+void                cogl_color_set_alpha                (CoglColor *color,
+                                                         float alpha);
+
+void                cogl_color_set_red_byte             (CoglColor *color,
+                                                         unsigned char red);
+void                cogl_color_set_green_byte           (CoglColor *color,
+                                                         unsigned char green);
+void                cogl_color_set_blue_byte            (CoglColor *color,
+                                                         unsigned char blue);
+void                cogl_color_set_alpha_byte           (CoglColor *color,
+                                                         unsigned char alpha);
+
+void                cogl_color_set_red_float            (CoglColor *color,
+                                                         float red);
+void                cogl_color_set_green_float          (CoglColor *color,
+                                                         float green);
+void                cogl_color_set_blue_float           (CoglColor *color,
+                                                         float blue);
+void                cogl_color_set_alpha_float          (CoglColor *color,
+                                                         float alpha);
+
+void                cogl_color_premultiply              (CoglColor *color);
+void                cogl_color_unpremultiply            (CoglColor *color);
+CoglBool            cogl_color_equal                    (const void *v1,
+                                                         const void *v2);
+
+void                cogl_color_init_from_hsl            (CoglColor *color,
+                                                         float hue,
+                                                         float saturation,
+                                                         float luminance);
+void                cogl_color_to_hsl                   (const CoglColor *color,
+                                                         float *hue,
+                                                         float *saturation,
+                                                         float *luminance);
+
+
+
+

Description

+

+CoglColor is a simple structure holding the definition of a color such +that it can be efficiently used by GL +

+
+
+

Details

+
+

struct CoglColor

+
struct CoglColor {
+};
+
+

+A structure for holding a color definition. The contents of +the CoglColor structure are private and should never by accessed +directly. +

+
++++ + +
+

Since 1.0

+
+
+
+

cogl_color_new ()

+
CoglColor *         cogl_color_new                      (void);
+

+Creates a new (empty) color +

+
++++ + + + + +

Returns :

a newly-allocated CoglColor. Use cogl_color_free() +to free the allocated resources
+

Since 1.0

+
+
+
+

cogl_color_copy ()

+
CoglColor *         cogl_color_copy                     (const CoglColor *color);
+

+Creates a copy of color +

+
++++ + + + + + + + + + + +

color :

the color to copy

Returns :

a newly-allocated CoglColor. Use cogl_color_free() +to free the allocate resources
+

Since 1.0

+
+
+
+

cogl_color_free ()

+
void                cogl_color_free                     (CoglColor *color);
+

+Frees the resources allocated by cogl_color_new() and cogl_color_copy() +

+
++++ + + + + +

color :

the color to free
+

Since 1.0

+
+
+
+

cogl_color_set_from_4ub ()

+
void                cogl_color_set_from_4ub             (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+
+

Warning

+

cogl_color_set_from_4ub has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_color_init_from_4ub instead.

+
+

+Sets the values of the passed channels into a CoglColor. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 255

green :

value of the green channel, between 0 and 255

blue :

value of the blue channel, between 0 and 255

alpha :

value of the alpha channel, between 0 and 255
+

Since 1.0

+
+
+
+

cogl_color_set_from_4f ()

+
void                cogl_color_set_from_4f              (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+

Warning

+

cogl_color_set_from_4f has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_color_init_from_4f instead.

+
+

+Sets the values of the passed channels into a CoglColor +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 1.0

green :

value of the green channel, between 0 and 1.0

blue :

value of the blue channel, between 0 and 1.0

alpha :

value of the alpha channel, between 0 and 1.0
+

Since 1.0

+
+
+
+

cogl_color_get_red ()

+
float               cogl_color_get_red                  (const CoglColor *color);
+

+Retrieves the red channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green ()

+
float               cogl_color_get_green                (const CoglColor *color);
+

+Retrieves the green channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue ()

+
float               cogl_color_get_blue                 (const CoglColor *color);
+

+Retrieves the blue channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha ()

+
float               cogl_color_get_alpha                (const CoglColor *color);
+

+Retrieves the alpha channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_red_byte ()

+
unsigned char       cogl_color_get_red_byte             (const CoglColor *color);
+

+Retrieves the red channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green_byte ()

+
unsigned char       cogl_color_get_green_byte           (const CoglColor *color);
+

+Retrieves the green channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue_byte ()

+
unsigned char       cogl_color_get_blue_byte            (const CoglColor *color);
+

+Retrieves the blue channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha_byte ()

+
unsigned char       cogl_color_get_alpha_byte           (const CoglColor *color);
+

+Retrieves the alpha channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_red_float ()

+
float               cogl_color_get_red_float            (const CoglColor *color);
+

+Retrieves the red channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green_float ()

+
float               cogl_color_get_green_float          (const CoglColor *color);
+

+Retrieves the green channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue_float ()

+
float               cogl_color_get_blue_float           (const CoglColor *color);
+

+Retrieves the blue channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha_float ()

+
float               cogl_color_get_alpha_float          (const CoglColor *color);
+

+Retrieves the alpha channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_set_red ()

+
void                cogl_color_set_red                  (CoglColor *color,
+                                                         float red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_green ()

+
void                cogl_color_set_green                (CoglColor *color,
+                                                         float green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_blue ()

+
void                cogl_color_set_blue                 (CoglColor *color,
+                                                         float blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_alpha ()

+
void                cogl_color_set_alpha                (CoglColor *color,
+                                                         float alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_red_byte ()

+
void                cogl_color_set_red_byte             (CoglColor *color,
+                                                         unsigned char red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_green_byte ()

+
void                cogl_color_set_green_byte           (CoglColor *color,
+                                                         unsigned char green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_blue_byte ()

+
void                cogl_color_set_blue_byte            (CoglColor *color,
+                                                         unsigned char blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_alpha_byte ()

+
void                cogl_color_set_alpha_byte           (CoglColor *color,
+                                                         unsigned char alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_red_float ()

+
void                cogl_color_set_red_float            (CoglColor *color,
+                                                         float red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_green_float ()

+
void                cogl_color_set_green_float          (CoglColor *color,
+                                                         float green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_blue_float ()

+
void                cogl_color_set_blue_float           (CoglColor *color,
+                                                         float blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_alpha_float ()

+
void                cogl_color_set_alpha_float          (CoglColor *color,
+                                                         float alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_premultiply ()

+
void                cogl_color_premultiply              (CoglColor *color);
+

+Converts a non-premultiplied color to a pre-multiplied color. For +example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied +and (0.5, 0, 0, 0.5) when premultiplied. +

+
++++ + + + + +

color :

the color to premultiply
+

Since 1.0

+
+
+
+

cogl_color_unpremultiply ()

+
void                cogl_color_unpremultiply            (CoglColor *color);
+

+Converts a pre-multiplied color to a non-premultiplied color. For +example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied +and (1.0, 0, 0, 0.5) when non-premultiplied. +

+
++++ + + + + +

color :

the color to unpremultiply
+

Since 1.4

+
+
+
+

cogl_color_equal ()

+
CoglBool            cogl_color_equal                    (const void *v1,
+                                                         const void *v2);
+

+Compares two CoglColors and checks if they are the same. +

+

+This function can be passed to g_hash_table_new() as the key_equal_func +parameter, when using CoglColors as keys in a GHashTable. +

+
++++ + + + + + + + + + + + + + + +

v1 :

a CoglColor +

v2 :

a CoglColor +

Returns :

+TRUE if the two colors are the same.
+

Since 1.0

+
+
+
+

cogl_color_init_from_hsl ()

+
void                cogl_color_init_from_hsl            (CoglColor *color,
+                                                         float hue,
+                                                         float saturation,
+                                                         float luminance);
+

+Converts a color expressed in HLS (hue, luminance and saturation) +values into a CoglColor. +

+
++++ + + + + + + + + + + + + + + + + + + +

color :

return location for a CoglColor. [out] +

hue :

hue value, in the 0 .. 360 range

saturation :

saturation value, in the 0 .. 1 range

luminance :

luminance value, in the 0 .. 1 range
+

Since 1.16

+
+
+
+

cogl_color_to_hsl ()

+
void                cogl_color_to_hsl                   (const CoglColor *color,
+                                                         float *hue,
+                                                         float *saturation,
+                                                         float *luminance);
+

+Converts color to the HLS format. +

+

+The hue value is in the 0 .. 360 range. The luminance and +saturation values are in the 0 .. 1 range. +

+
++++ + + + + + + + + + + + + + + + + + + +

color :

a CoglColor +

hue :

return location for the hue value or NULL. [out] +

saturation :

return location for the saturation value or NULL. [out] +

luminance :

return location for the luminance value or NULL. [out] +
+

Since 1.16

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Common-Types.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Common-Types.html new file mode 100644 index 0000000..28a8851 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Common-Types.html @@ -0,0 +1,983 @@ + + + + +Common Types + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Common Types

+

Common Types — Types used throughout the library

+
+ +
+

Description

+

+General types used by various Cogl functions. +

+
+
+

Details

+
+

CoglVertexP2

+
typedef struct {
+   float x, y;
+} CoglVertexP2;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p2(). +

+
++++ + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP3

+
typedef struct {
+   float x, y, z;
+} CoglVertexP3;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p3(). +

+
++++ + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float z;

The z component of a position attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP2C4

+
typedef struct {
+   float x, y;
+   uint8_t r, g, b, a;
+} CoglVertexP2C4;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p2c4(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

uint8_t r;

The red component of a color attribute

uint8_t g;

The blue component of a color attribute

uint8_t b;

The green component of a color attribute

uint8_t a;

The alpha component of a color attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP3C4

+
typedef struct {
+   float x, y, z;
+   uint8_t r, g, b, a;
+} CoglVertexP3C4;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p3c4(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float z;

The z component of a position attribute

uint8_t r;

The red component of a color attribute

uint8_t g;

The blue component of a color attribute

uint8_t b;

The green component of a color attribute

uint8_t a;

The alpha component of a color attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP2T2

+
typedef struct {
+   float x, y;
+   float s, t;
+} CoglVertexP2T2;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p2t2(). +

+
++++ + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float s;

The s component of a texture coordinate attribute

float t;

The t component of a texture coordinate attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP3T2

+
typedef struct {
+   float x, y, z;
+   float s, t;
+} CoglVertexP3T2;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p3t2(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float z;

The z component of a position attribute

float s;

The s component of a texture coordinate attribute

float t;

The t component of a texture coordinate attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP2T2C4

+
typedef struct {
+   float x, y;
+   float s, t;
+   uint8_t r, g, b, a;
+} CoglVertexP2T2C4;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p3t2c4(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float s;

The s component of a texture coordinate attribute

float t;

The t component of a texture coordinate attribute

uint8_t r;

The red component of a color attribute

uint8_t g;

The blue component of a color attribute

uint8_t b;

The green component of a color attribute

uint8_t a;

The alpha component of a color attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

CoglVertexP3T2C4

+
typedef struct {
+   float x, y, z;
+   float s, t;
+   uint8_t r, g, b, a;
+} CoglVertexP3T2C4;
+
+

+A convenience vertex definition that can be used with +cogl_primitive_new_p3t2c4(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

float x;

The x component of a position attribute

float y;

The y component of a position attribute

float z;

The z component of a position attribute

float s;

The s component of a texture coordinate attribute

float t;

The t component of a texture coordinate attribute

uint8_t r;

The red component of a color attribute

uint8_t g;

The blue component of a color attribute

uint8_t b;

The green component of a color attribute

uint8_t a;

The alpha component of a color attribute
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

enum CoglVerticesMode

+
typedef enum {
+  COGL_VERTICES_MODE_POINTS = 0x0000,
+  COGL_VERTICES_MODE_LINES = 0x0001,
+  COGL_VERTICES_MODE_LINE_LOOP = 0x0002,
+  COGL_VERTICES_MODE_LINE_STRIP = 0x0003,
+  COGL_VERTICES_MODE_TRIANGLES = 0x0004,
+  COGL_VERTICES_MODE_TRIANGLE_STRIP = 0x0005,
+  COGL_VERTICES_MODE_TRIANGLE_FAN = 0x0006
+} CoglVerticesMode;
+
+

+Different ways of interpreting vertices when drawing. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_VERTICES_MODE_POINTS

FIXME, equivalent to +GL_POINTS +

COGL_VERTICES_MODE_LINES

FIXME, equivalent to GL_LINES +

COGL_VERTICES_MODE_LINE_LOOP

FIXME, equivalent to +GL_LINE_LOOP +

COGL_VERTICES_MODE_LINE_STRIP

FIXME, equivalent to +GL_LINE_STRIP +

COGL_VERTICES_MODE_TRIANGLES

FIXME, equivalent to +GL_TRIANGLES +

COGL_VERTICES_MODE_TRIANGLE_STRIP

FIXME, equivalent to +GL_TRIANGLE_STRIP +

COGL_VERTICES_MODE_TRIANGLE_FAN

FIXME, equivalent to GL_TRIANGLE_FAN +
+

Since 1.0

+
+
+
+

CoglFuncPtr ()

+
void                (*CoglFuncPtr)                      (void);
+

+The type used by cogl for function pointers, note that this type +is used as a generic catch-all cast for function pointers and the +actual arguments and return type may be different. +

+
+
+
+

enum CoglPixelFormat

+
typedef enum {
+ /*< prefix=COGL_PIXEL_FORMAT >*/
+  COGL_PIXEL_FORMAT_ANY           = 0,
+  COGL_PIXEL_FORMAT_A_8           = 1 | COGL_A_BIT,
+
+  COGL_PIXEL_FORMAT_RGB_565       = 4,
+  COGL_PIXEL_FORMAT_RGBA_4444     = 5 | COGL_A_BIT,
+  COGL_PIXEL_FORMAT_RGBA_5551     = 6 | COGL_A_BIT,
+  COGL_PIXEL_FORMAT_YUV           = 7,
+  COGL_PIXEL_FORMAT_G_8           = 8,
+
+  COGL_PIXEL_FORMAT_RG_88         = 9,
+
+  COGL_PIXEL_FORMAT_RGB_888       = 2,
+  COGL_PIXEL_FORMAT_BGR_888       = (2 | COGL_BGR_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_8888     = (3 | COGL_A_BIT),
+  COGL_PIXEL_FORMAT_BGRA_8888     = (3 | COGL_A_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_8888     = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_8888     = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_1010102  = (13 | COGL_A_BIT),
+  COGL_PIXEL_FORMAT_BGRA_1010102  = (13 | COGL_A_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_2101010  = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_2101010  = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
+
+  COGL_PIXEL_FORMAT_DEPTH_16  = (9 | COGL_DEPTH_BIT),
+  COGL_PIXEL_FORMAT_DEPTH_32  = (3 | COGL_DEPTH_BIT),
+
+  COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT)
+} CoglPixelFormat;
+
+

+Pixel formats used by Cogl. For the formats with a byte per +component, the order of the components specify the order in +increasing memory addresses. So for example +COGL_PIXEL_FORMAT_RGB_888 would have the red component in the +lowest address, green in the next address and blue after that +regardless of the endianness of the system. +

+

+For the formats with non byte aligned components the component +order specifies the order within a 16-bit or 32-bit number from +most significant bit to least significant. So for +COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits +11-15, the green component would be in 6-11 and the blue component +would be in 1-5. Therefore the order in memory depends on the +endianness of the system. +

+

+When uploading a texture COGL_PIXEL_FORMAT_ANY can be used as the +internal format. Cogl will try to pick the best format to use +internally and convert the texture data if necessary. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_PIXEL_FORMAT_ANY

Any format +

COGL_PIXEL_FORMAT_A_8

8 bits alpha mask +

COGL_PIXEL_FORMAT_RGB_565

RGB, 16 bits +

COGL_PIXEL_FORMAT_RGBA_4444

RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_5551

RGBA, 16 bits +

COGL_PIXEL_FORMAT_YUV

Not currently supported +

COGL_PIXEL_FORMAT_G_8

Single luminance component +

COGL_PIXEL_FORMAT_RG_88

RG, 16 bits. Note that red-green textures + are only available if COGL_FEATURE_ID_TEXTURE_RG is advertised. + See cogl_texture_set_components() for details. +

COGL_PIXEL_FORMAT_RGB_888

RGB, 24 bits +

COGL_PIXEL_FORMAT_BGR_888

BGR, 24 bits +

COGL_PIXEL_FORMAT_RGBA_8888

RGBA, 32 bits +

COGL_PIXEL_FORMAT_BGRA_8888

BGRA, 32 bits +

COGL_PIXEL_FORMAT_ARGB_8888

ARGB, 32 bits +

COGL_PIXEL_FORMAT_ABGR_8888

ABGR, 32 bits +

COGL_PIXEL_FORMAT_RGBA_1010102

RGBA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_BGRA_1010102

BGRA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ARGB_2101010

ARGB, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ABGR_2101010

ABGR, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_RGBA_8888_PRE

Premultiplied RGBA, 32 bits +

COGL_PIXEL_FORMAT_BGRA_8888_PRE

Premultiplied BGRA, 32 bits +

COGL_PIXEL_FORMAT_ARGB_8888_PRE

Premultiplied ARGB, 32 bits +

COGL_PIXEL_FORMAT_ABGR_8888_PRE

Premultiplied ABGR, 32 bits +

COGL_PIXEL_FORMAT_RGBA_4444_PRE

Premultiplied RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_5551_PRE

Premultiplied RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_1010102_PRE

Premultiplied RGBA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_BGRA_1010102_PRE

Premultiplied BGRA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ARGB_2101010_PRE

Premultiplied ARGB, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ABGR_2101010_PRE

Premultiplied ABGR, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_DEPTH_16

COGL_PIXEL_FORMAT_DEPTH_32

COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8

+

Since 0.8

+
+
+
+

enum CoglBufferTarget

+
typedef enum {
+  COGL_WINDOW_BUFFER      = (1 << 1),
+  COGL_OFFSCREEN_BUFFER   = (1 << 2)
+} CoglBufferTarget;
+
+

+Target flags for FBOs. +

+
++++ + + + + + + + + + + +

COGL_WINDOW_BUFFER

FIXME +

COGL_OFFSCREEN_BUFFER

FIXME +
+

Since 0.8

+
+
+
+

enum CoglBufferBit

+
typedef enum {
+  COGL_BUFFER_BIT_COLOR   = 1L<<0,
+  COGL_BUFFER_BIT_DEPTH   = 1L<<1,
+  COGL_BUFFER_BIT_STENCIL = 1L<<2
+} CoglBufferBit;
+
+

+Types of auxiliary buffers +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_BIT_COLOR

Selects the primary color buffer +

COGL_BUFFER_BIT_DEPTH

Selects the depth buffer +

COGL_BUFFER_BIT_STENCIL

Selects the stencil buffer +
+

Since 1.0

+
+
+
+

enum CoglAttributeType

+
typedef enum {
+  COGL_ATTRIBUTE_TYPE_BYTE           = 0x1400,
+  COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE  = 0x1401,
+  COGL_ATTRIBUTE_TYPE_SHORT          = 0x1402,
+  COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT = 0x1403,
+  COGL_ATTRIBUTE_TYPE_FLOAT          = 0x1406
+} CoglAttributeType;
+
+

+Data types for the components of a vertex attribute. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

COGL_ATTRIBUTE_TYPE_BYTE

Data is the same size of a byte +

COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE

Data is the same size of an + unsigned byte +

COGL_ATTRIBUTE_TYPE_SHORT

Data is the same size of a short integer +

COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT

Data is the same size of + an unsigned short integer +

COGL_ATTRIBUTE_TYPE_FLOAT

Data is the same size of a float +
+

Since 1.0

+
+
+
+

enum CoglColorMask

+
typedef enum {
+  COGL_COLOR_MASK_NONE = 0,
+  COGL_COLOR_MASK_RED = 1L<<0,
+  COGL_COLOR_MASK_GREEN = 1L<<1,
+  COGL_COLOR_MASK_BLUE = 1L<<2,
+  COGL_COLOR_MASK_ALPHA = 1L<<3,
+  /* XXX: glib-mkenums is a perl script that can't cope if we split
+   * this onto multiple lines! *sigh* */
+  COGL_COLOR_MASK_ALL = (COGL_COLOR_MASK_RED | COGL_COLOR_MASK_GREEN | COGL_COLOR_MASK_BLUE | COGL_COLOR_MASK_ALPHA)
+} CoglColorMask;
+
+

+Defines a bit mask of color channels. This can be used with +cogl_pipeline_set_color_mask() for example to define which color +channels should be written to the current framebuffer when +drawing something. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_COLOR_MASK_NONE

None of the color channels are masked +

COGL_COLOR_MASK_RED

Masks the red color channel +

COGL_COLOR_MASK_GREEN

Masks the green color channel +

COGL_COLOR_MASK_BLUE

Masks the blue color channel +

COGL_COLOR_MASK_ALPHA

Masks the alpha color channel +

COGL_COLOR_MASK_ALL

All of the color channels are masked +
+
+
+
+

enum CoglTextureFlags

+
typedef enum {
+  COGL_TEXTURE_NONE           = 0,
+  COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
+  COGL_TEXTURE_NO_SLICING     = 1 << 1,
+  COGL_TEXTURE_NO_ATLAS       = 1 << 2
+} CoglTextureFlags;
+
+

+Flags to pass to the cogl_texture_new_* family of functions. +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_TEXTURE_NONE

No flags specified +

COGL_TEXTURE_NO_AUTO_MIPMAP

Disables the automatic generation of + the mipmap pyramid from the base level image whenever it is + updated. The mipmaps are only generated when the texture is + rendered with a mipmap filter so it should be free to leave out + this flag when using other filtering modes +

COGL_TEXTURE_NO_SLICING

Disables the slicing of the texture +

COGL_TEXTURE_NO_ATLAS

Disables the insertion of the texture inside + the texture atlas used by Cogl +
+

Since 1.0

+
+
+
+

CoglBool

+
typedef int CoglBool;
+
+

+A boolean data type used throughout the Cogl C api. This should be +used in conjunction with the TRUE and FALSE macro defines for +setting and testing boolean values. +

+

Since 2.0

+

Stability Level: Stable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Depth-State.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Depth-State.html new file mode 100644 index 0000000..0925ce7 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Depth-State.html @@ -0,0 +1,484 @@ + + + + +Depth State + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Depth State

+

Depth State — Functions for describing the depth testing + state of your GPU.

+
+ +
+

Description

+
+
+

Details

+
+

CoglDepthState

+
typedef struct {
+} CoglDepthState;
+
+

Since 2.0

+
+
+
+

enum CoglDepthTestFunction

+
typedef enum {
+  COGL_DEPTH_TEST_FUNCTION_NEVER    = 0x0200,
+  COGL_DEPTH_TEST_FUNCTION_LESS     = 0x0201,
+  COGL_DEPTH_TEST_FUNCTION_EQUAL    = 0x0202,
+  COGL_DEPTH_TEST_FUNCTION_LEQUAL   = 0x0203,
+  COGL_DEPTH_TEST_FUNCTION_GREATER  = 0x0204,
+  COGL_DEPTH_TEST_FUNCTION_NOTEQUAL = 0x0205,
+  COGL_DEPTH_TEST_FUNCTION_GEQUAL   = 0x0206,
+  COGL_DEPTH_TEST_FUNCTION_ALWAYS   = 0x0207
+} CoglDepthTestFunction;
+
+

+When using depth testing one of these functions is used to compare +the depth of an incoming fragment against the depth value currently +stored in the depth buffer. The function is changed using +cogl_depth_state_set_test_function(). +

+

+The test is only done when depth testing is explicitly enabled. (See +cogl_depth_state_set_test_enabled()) +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_DEPTH_TEST_FUNCTION_NEVER

Never passes. +

COGL_DEPTH_TEST_FUNCTION_LESS

Passes if the fragment's depth +value is less than the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_EQUAL

Passes if the fragment's depth +value is equal to the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_LEQUAL

Passes if the fragment's depth +value is less or equal to the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_GREATER

Passes if the fragment's depth +value is greater than the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_NOTEQUAL

Passes if the fragment's depth +value is not equal to the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_GEQUAL

Passes if the fragment's depth +value greater than or equal to the value currently in the depth buffer. +

COGL_DEPTH_TEST_FUNCTION_ALWAYS

Always passes. +
+
+
+
+

cogl_depth_state_init ()

+
void                cogl_depth_state_init               (CoglDepthState *state);
+

+Initializes the members of state to their default values. +

+

+You should never pass an un initialized CoglDepthState structure +to cogl_pipeline_set_depth_state(). +

+
++++ + + + + +

state :

A CoglDepthState struct
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_set_test_enabled ()

+
void                cogl_depth_state_set_test_enabled   (CoglDepthState *state,
+                                                         CoglBool enable);
+

+Enables or disables depth testing according to the value of +enable. +

+

+If depth testing is enable then the CoglDepthTestFunction set +using cogl_depth_state_set_test_function() us used to evaluate +the depth value of incoming fragments against the corresponding +value stored in the current depth buffer, and if the test passes +then the fragments depth value is used to update the depth buffer. +(unless you have disabled depth writing via +cogl_depth_state_set_write_enabled()) +

+

+By default depth testing is disabled. +

+

+NB: this won't directly affect the state of the GPU. You have +to then set the state on a CoglPipeline using +cogl_pipeline_set_depth_state() +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

enable :

The enable state you want
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_get_test_enabled ()

+
CoglBool            cogl_depth_state_get_test_enabled   (CoglDepthState *state);
+

+Gets the current depth test enabled state as previously set by +cogl_depth_state_set_test_enabled(). +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

Returns :

The pipeline's current depth test enabled state.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_set_test_function ()

+
void                cogl_depth_state_set_test_function  (CoglDepthState *state,
+                                                         CoglDepthTestFunction function);
+

+Sets the CoglDepthTestFunction used to compare the depth value of +an incoming fragment against the corresponding value in the current +depth buffer. +

+

+By default the depth test function is COGL_DEPTH_TEST_FUNCTION_LESS +

+

+NB: this won't directly affect the state of the GPU. You have +to then set the state on a CoglPipeline using +cogl_pipeline_set_depth_state() +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

function :

The CoglDepthTestFunction to set
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_get_test_function ()

+
CoglDepthTestFunction cogl_depth_state_get_test_function
+                                                        (CoglDepthState *state);
+

+Gets the current depth test enable state as previously set via +cogl_depth_state_set_test_enabled(). +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

Returns :

The current depth test enable state.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_set_write_enabled ()

+
void                cogl_depth_state_set_write_enabled  (CoglDepthState *state,
+                                                         CoglBool enable);
+

+Enables or disables depth buffer writing according to the value of +enable. Normally when depth testing is enabled and the comparison +between a fragment's depth value and the corresponding depth buffer +value passes then the fragment's depth is written to the depth +buffer unless writing is disabled here. +

+

+By default depth writing is enabled +

+

+NB: this won't directly affect the state of the GPU. You have +to then set the state on a CoglPipeline using +cogl_pipeline_set_depth_state() +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

enable :

The enable state you want
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_get_write_enabled ()

+
CoglBool            cogl_depth_state_get_write_enabled  (CoglDepthState *state);
+

+Gets the depth writing enable state as set by the corresponding +cogl_depth_state_set_write_enabled(). +

+
++++ + + + + + + + + + + +

state :

A CoglDepthState struct

Returns :

The current depth writing enable state
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_set_range ()

+
void                cogl_depth_state_set_range          (CoglDepthState *state,
+                                                         float near_val,
+                                                         float far_val);
+

+Sets the range to map depth values in normalized device coordinates +to before writing out to a depth buffer. +

+

+After your geometry has be transformed, clipped and had perspective +division applied placing it in normalized device +coordinates all depth values between the near and far z clipping +planes are in the range -1 to 1. Before writing any depth value to +the depth buffer though the value is mapped into the range [0, 1]. +

+

+With this function you can change the range which depth values are +mapped too although the range must still lye within the range [0, +1]. +

+

+If your driver does not support this feature (for example you are +using GLES 1 drivers) then if you don't use the default range +values you will get an error reported when calling +cogl_pipeline_set_depth_state(). You can check ahead of time for +the COGL_FEATURE_ID_DEPTH_RANGE feature with +cogl_has_feature() to know if this function will succeed. +

+

+By default normalized device coordinate depth values are mapped to +the full range of depth buffer values, [0, 1]. +

+

+NB: this won't directly affect the state of the GPU. You have +to then set the state on a CoglPipeline using +cogl_pipeline_set_depth_state(). +

+
++++ + + + + + + + + + + + + + + +

state :

A CoglDepthState object

near_val :

The near component of the desired depth range which will be +clamped to the range [0, 1]

far_val :

The far component of the desired depth range which will be +clamped to the range [0, 1]
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_depth_state_get_range ()

+
void                cogl_depth_state_get_range          (CoglDepthState *state,
+                                                         float *near_val,
+                                                         float *far_val);
+

+Gets the current range to which normalized depth values are mapped +before writing to the depth buffer. This corresponds to the range +set with cogl_depth_state_set_range(). +

+
++++ + + + + + + + + + + + + + + +

state :

A CoglDepthState object

near_val :

A pointer to store the near component of the depth range

far_val :

A pointer to store the far component of the depth range
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Eulers-(Rotations).html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Eulers-(Rotations).html new file mode 100644 index 0000000..10341b6 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Eulers-(Rotations).html @@ -0,0 +1,388 @@ + + + + +Eulers (Rotations) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Eulers (Rotations)

+

Eulers (Rotations) — Functions for initializing and manipulating +euler angles.

+
+
+

Synopsis

+
                    CoglEuler;
+void                cogl_euler_init                     (CoglEuler *euler,
+                                                         float heading,
+                                                         float pitch,
+                                                         float roll);
+void                cogl_euler_init_from_matrix         (CoglEuler *euler,
+                                                         const CoglMatrix *matrix);
+void                cogl_euler_init_from_quaternion     (CoglEuler *euler,
+                                                         const CoglQuaternion *quaternion);
+CoglBool            cogl_euler_equal                    (const void *v1,
+                                                         const void *v2);
+CoglEuler *         cogl_euler_copy                     (const CoglEuler *src);
+void                cogl_euler_free                     (CoglEuler *euler);
+
+
+
+

Description

+

+Euler angles are a simple representation of a 3 dimensional +rotation; comprised of 3 ordered heading, pitch and roll rotations. +An important thing to understand is that the axis of rotation +belong to the object being rotated and so they also rotate as each +of the heading, pitch and roll rotations are applied. +

+

+One way to consider euler angles is to imagine controlling an +aeroplane, where you first choose a heading (Such as flying south +east), then you set the pitch (such as 30 degrees to take off) and +then you might set a roll, by dipping the left, wing as you prepare +to turn. +

+

+They have some advantages and limitations that it helps to be +aware of: +

+

+Advantages: +

+
    +
  • +Easy to understand and use, compared to quaternions and matrices, +so may be a good choice for a user interface. +
  • +
  • +Efficient storage, needing only 3 components any rotation can be +represented. +
    +

    Note

    Actually the CoglEuler type isn't optimized for size because +we may cache the equivalent CoglQuaternion along with a euler +rotation, but it would be trivial for an application to track the +components of euler rotations in a packed float array if optimizing +for size was important. The values could be passed to Cogl only when +manipulation is necessary.
    +
  • +
+

+

+

+Disadvantages: +

+
    +
  • +Aliasing: it's possible to represent some rotations with multiple +different heading, pitch and roll rotations. +
  • +
  • +They can suffer from a problem called Gimbal Lock. A good +explanation of this can be seen on wikipedia here: +http://en.wikipedia.org/wiki/Gimbal_lock but basically two +of the axis of rotation may become aligned and so you loose a +degree of freedom. For example a pitch of +-90° would mean that +heading and bank rotate around the same axis. +
  • +
  • +If you use euler angles to orient something in 3D space and try to +transition between orientations by interpolating the component +angles you probably wont get the transitions you expect as they may +not follow the shortest path between the two orientations. +
  • +
  • +There's no standard to what order the component axis rotations are +applied. The most common convention seems to be what we do in Cogl +with heading (y-axis), pitch (x-axis) and then roll (z-axis), but +other software might apply x-axis, y-axis then z-axis or any other +order so you need to consider this if you are accepting euler +rotations from some other software. Other software may also use +slightly different aeronautical terms, such as "yaw" instead of +"heading" or "bank" instead of "roll". +
  • +
+

+

+

+To minimize the aliasing issue we may refer to "Canonical Euler" +angles where heading and roll are restricted to +- 180° and pitch is +restricted to +- 90°. If pitch is +- 90° bank is set to 0°. +

+

+Quaternions don't suffer from Gimbal Lock and they can be nicely +interpolated between, their disadvantage is that they don't have an +intuitive representation. +

+

+A common practice is to accept angles in the intuitive Euler form +and convert them to quaternions internally to avoid Gimbal Lock and +handle interpolations. See cogl_quaternion_init_from_euler(). +

+
+
+

Details

+
+

CoglEuler

+
typedef struct {
+  float heading;
+  float pitch;
+  float roll;
+} CoglEuler;
+
+

+Represents an ordered rotation first of heading degrees around an +object's y axis, then pitch degrees around an object's x axis and +finally roll degrees around an object's z axis. +

+

+

+
+

Note

It's important to understand the that axis are associated +with the object being rotated, so the axis also rotate in sequence +with the rotations being applied.
+

+

+

+The members of a CoglEuler can be initialized, for example, with +cogl_euler_init() and cogl_euler_init_from_quaternion(). +

+

+You may also want to look at cogl_quaternion_init_from_euler() if +you want to do interpolation between 3d rotations. +

+
++++ + + + + + + + + + + + + + + +

float heading;

Angle to rotate around an object's y axis

float pitch;

Angle to rotate around an object's x axis

float roll;

Angle to rotate around an object's z axis
+

Since 2.0

+
+
+
+

cogl_euler_init ()

+
void                cogl_euler_init                     (CoglEuler *euler,
+                                                         float heading,
+                                                         float pitch,
+                                                         float roll);
+

+Initializes euler to represent a rotation of x_angle degrees +around the x axis, then y_angle degrees around the y_axis and +z_angle degrees around the z axis. +

+
++++ + + + + + + + + + + + + + + + + + + +

euler :

The CoglEuler angle to initialize

heading :

Angle to rotate around an object's y axis

pitch :

Angle to rotate around an object's x axis

roll :

Angle to rotate around an object's z axis
+

Since 2.0

+
+
+
+

cogl_euler_init_from_matrix ()

+
void                cogl_euler_init_from_matrix         (CoglEuler *euler,
+                                                         const CoglMatrix *matrix);
+

+Extracts a euler rotation from the given matrix and +initializses euler with the component x, y and z rotation angles. +

+
++++ + + + + + + + + + + +

euler :

The CoglEuler angle to initialize

matrix :

A CoglMatrix containing a rotation, but no scaling, +mirroring or skewing.
+
+
+
+

cogl_euler_init_from_quaternion ()

+
void                cogl_euler_init_from_quaternion     (CoglEuler *euler,
+                                                         const CoglQuaternion *quaternion);
+

+Initializes a euler rotation with the equivalent rotation +represented by the given quaternion. +

+
++++ + + + + + + + + + + +

euler :

The CoglEuler angle to initialize

quaternion :

A CoglEuler with the rotation to initialize with
+
+
+
+

cogl_euler_equal ()

+
CoglBool            cogl_euler_equal                    (const void *v1,
+                                                         const void *v2);
+

+Compares the two given euler angles v1 and v1 and it they are +equal returns TRUE else FALSE. +

+

+

+
+

Note

This function only checks that all three components rotations +are numerically equal, it does not consider that some rotations +can be represented with different component rotations
+

+

+
++++ + + + + + + + + + + + + + + +

v1 :

The first euler angle to compare

v2 :

The second euler angle to compare

Returns :

+TRUE if v1 and v2 are equal else FALSE.
+

Since 2.0

+
+
+
+

cogl_euler_copy ()

+
CoglEuler *         cogl_euler_copy                     (const CoglEuler *src);
+

+Allocates a new CoglEuler and initilizes it with the component +angles of src. The newly allocated euler should be freed using +cogl_euler_free(). +

+
++++ + + + + + + + + + + +

src :

A CoglEuler to copy

Returns :

A newly allocated CoglEuler +
+

Since 2.0

+
+
+
+

cogl_euler_free ()

+
void                cogl_euler_free                     (CoglEuler *euler);
+

+Frees a CoglEuler that was previously allocated using +cogl_euler_copy(). +

+
++++ + + + + +

euler :

A CoglEuler allocated via cogl_euler_copy() +
+

Since 2.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Exception-handling.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Exception-handling.html new file mode 100644 index 0000000..2b321aa --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Exception-handling.html @@ -0,0 +1,462 @@ + + + + +Exception handling + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Exception handling

+

Exception handling — A way for Cogl to throw exceptions

+
+
+

Synopsis

+
#define             CoglError
+CoglBool            cogl_error_matches                  (CoglError *error,
+                                                         uint32_t domain,
+                                                         int code);
+void                cogl_error_free                     (CoglError *error);
+CoglError *         cogl_error_copy                     (CoglError *error);
+#define             COGL_GLIB_ERROR                     (COGL_ERROR)
+
+
+
+

Description

+

+As a general rule Cogl shields non-recoverable errors from +developers, such as most heap allocation failures (unless for +exceptionally large resources which we might reasonably expect to +fail) and this reduces the burden on developers. +

+

+There are some Cogl apis though that can fail for exceptional +reasons that can also potentially be recovered from at runtime +and for these apis we use a standard convention for reporting +runtime recoverable errors. +

+

+As an example if we look at the cogl_context_new() api which +takes an error argument: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+CoglContext *
+  cogl_context_new (CoglDisplay *display, CoglError **error);
+
+ +

+

+

+A caller interested in catching any runtime error when creating a +new CoglContext would pass the address of a CoglError pointer +that has first been initialized to NULL as follows: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+CoglError *error = NULL;
+  CoglContext *context;
+
+  context = cogl_context_new (NULL, &error);
+
+ +

+

+

+The return status should usually be enough to determine if there +was an error set (in this example we can check if context == NULL) +but if it's not possible to tell from the function's return status +you can instead look directly at the error pointer which you +initialized to NULL. In this example we now check the error, +report any error to the user, free the error and then simply +abort without attempting to recover. +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+if (context == NULL)
+    {
+      fprintf (stderr, "Failed to create a Cogl context: %s\n",
+               error->message);
+      cogl_error_free (error);
+      abort ();
+    }
+
+ +

+

+

+All Cogl APIs that accept an error argument can also be passed a +NULL pointer. In this case if an exceptional error condition is hit +then Cogl will simply log the error message and abort the +application. This can be compared to language execeptions where the +developer has not attempted to catch the exception. This means the +above example is essentially redundant because it's what Cogl would +have done automatically and so, similarly, if your application has +no way to recover from a particular error you might just as well +pass a NULL CoglError pointer to save a bit of typing. +

+

+

+
+

Note

If you are used to using the GLib API you will probably +recognize that CoglError is just like a GError. In fact if Cogl +has been built with --enable-glib then it is safe to cast a +CoglError to a GError.
+

+

+

+

+
+

Note

An important detail to be aware of if you are used to using +GLib's GError API is that Cogl deviates from the GLib GError +conventions in one noteable way which is that a NULL error pointer +does not mean you want to ignore the details of an error, it means +you are not trying to catch any exceptional errors the function might +throw which will result in the program aborting with a log message +if an error is thrown.
+

+

+
+
+

Details

+
+

CoglError

+
#define CoglError GError
+
+
++++ + + + + + + + + + + + + + + +

domain :

A high-level domain identifier for the error

code :

A specific error code within a specified domain

message :

A human readable error message
+
+
+
+

cogl_error_matches ()

+
CoglBool            cogl_error_matches                  (CoglError *error,
+                                                         uint32_t domain,
+                                                         int code);
+

+Returns TRUE if error matches domain and code, FALSE otherwise. +In particular, when error is NULL, FALSE will be returned. +

+
++++ + + + + + + + + + + + + + + + + + + +

error :

A CoglError thrown by the Cogl api or NULL +

domain :

The error domain

code :

The error code

Returns :

whether the error corresponds to the given domain +and code.
+
+
+
+

cogl_error_free ()

+
void                cogl_error_free                     (CoglError *error);
+

+Frees a CoglError and associated resources. +

+
++++ + + + + +

error :

A CoglError thrown by the Cogl api
+
+
+
+

cogl_error_copy ()

+
CoglError *         cogl_error_copy                     (CoglError *error);
+

+Makes a copy of error which can later be freed using +cogl_error_free(). +

+
++++ + + + + + + + + + + +

error :

A CoglError thrown by the Cogl api

Returns :

A newly allocated CoglError initialized to match the +contents of error.
+
+
+
+

COGL_GLIB_ERROR()

+
#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR)
+
+

+Simply casts a CoglError to a CoglError +

+

+If Cogl is built with GLib support then it can safely be assumed +that a CoglError is a GError and can be used directly with the +GError api. +

+
++++ + + + + +

COGL_ERROR :

A CoglError thrown by the Cogl api or NULL +
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GLES-2.0-context.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GLES-2.0-context.html new file mode 100644 index 0000000..bce371c --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GLES-2.0-context.html @@ -0,0 +1,567 @@ + + + + +GLES 2.0 context + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

GLES 2.0 context

+

GLES 2.0 context — A portable api to access OpenGLES 2.0

+
+
+

Synopsis

+
                    CoglGLES2Context;
+struct              CoglGLES2Vtable;
+#define             COGL_GLES2_CONTEXT_ERROR
+enum                CoglGLES2ContextError;
+CoglGLES2Context *  cogl_gles2_context_new              (CoglContext *ctx,
+                                                         CoglError **error);
+CoglBool            cogl_is_gles2_context               (void *object);
+
+const CoglGLES2Vtable * cogl_gles2_context_get_vtable   (CoglGLES2Context *gles2_ctx);
+CoglBool            cogl_push_gles2_context             (CoglContext *ctx,
+                                                         CoglGLES2Context *gles2_ctx,
+                                                         CoglFramebuffer *read_buffer,
+                                                         CoglFramebuffer *write_buffer,
+                                                         CoglError **error);
+void                cogl_pop_gles2_context              (CoglContext *ctx);
+CoglGLES2Vtable *   cogl_gles2_get_current_vtable       (void);
+
+CoglTexture2D *     cogl_gles2_texture_2d_new_from_handle
+                                                        (CoglContext *ctx,
+                                                         CoglGLES2Context *gles2_ctx,
+                                                         unsigned int handle,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format);
+CoglBool            cogl_gles2_texture_get_handle       (CoglTexture *texture,
+                                                         unsigned int *handle,
+                                                         unsigned int *target);
+
+
+
+

Description

+

+Cogl provides portable access to the OpenGLES api through a single +library that is able to smooth over inconsistencies between the +different vendor drivers for OpenGLES in a single place. +

+

+The api is designed to allow Cogl to transparently implement the +api on top of other drivers, such as OpenGL, D3D or on Cogl's own +drawing api so even if your platform doesn't come with an +OpenGLES 2.0 api Cogl may still be able to expose the api to your +application. +

+

+Since Cogl is a library and not an api specification it is possible +to add OpenGLES 2.0 api features to Cogl which can immidiately +benefit developers regardless of what platform they are running on. +

+

+With this api it's possible to re-use existing OpenGLES 2.0 code +within applications that are rendering with the Cogl API and also +it's possible for applications that render using OpenGLES 2.0 to +incorporate content rendered with Cogl. +

+

+Applications can check for OpenGLES 2.0 api support by checking for +COGL_FEATURE_ID_GLES2_CONTEXT support with cogl_has_feature(). +

+
+
+

Details

+
+

CoglGLES2Context

+
typedef struct _CoglGLES2Context CoglGLES2Context;
+

+Represents an OpenGLES 2.0 api context used as a sandbox for +OpenGLES 2.0 state. This is comparable to an EGLContext for those +who have used OpenGLES 2.0 with EGL before. +

+

Since 1.12

+

Stability Level: Unstable

+
+
+
+

struct CoglGLES2Vtable

+
struct CoglGLES2Vtable {
+};
+
+

+Provides function pointers for the full OpenGLES 2.0 api. The +api must be accessed this way and not by directly calling +symbols of any system OpenGLES 2.0 api. +

+

Since 1.12

+

Stability Level: Unstable

+
+
+
+

COGL_GLES2_CONTEXT_ERROR

+
#define COGL_GLES2_CONTEXT_ERROR (_cogl_gles2_context_error_quark ())
+
+

+An error domain for runtime exceptions relating to the +cogl_gles2_context api. +

+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

enum CoglGLES2ContextError

+
typedef enum {
+ /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/
+  COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED,
+  COGL_GLES2_CONTEXT_ERROR_DRIVER
+} CoglGLES2ContextError;
+
+

+Error codes that relate to the cogl_gles2_context api. +

+
++++ + + + + + + + + + + +

COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED

Creating GLES2 contexts + isn't supported. Applications should use cogl_has_feature() to + check for the COGL_FEATURE_ID_GLES2_CONTEXT. +

COGL_GLES2_CONTEXT_ERROR_DRIVER

An underlying driver error + occured. +
+
+
+
+

cogl_gles2_context_new ()

+
CoglGLES2Context *  cogl_gles2_context_new              (CoglContext *ctx,
+                                                         CoglError **error);
+

+Allocates a new OpenGLES 2.0 context that can be used to render to +CoglOffscreen framebuffers (Rendering to CoglOnscreen +framebuffers is not currently supported). +

+

+To actually access the OpenGLES 2.0 api itself you need to use +cogl_gles2_context_get_vtable(). You should not try to directly link +to and use the symbols provided by the a system OpenGLES 2.0 +driver. +

+

+Once you have allocated an OpenGLES 2.0 context you can make it +current using cogl_push_gles2_context(). For those familiar with +using the EGL api, this serves a similar purpose to eglMakeCurrent. +

+

+

+
+

Note

Before using this api applications can check for OpenGLES 2.0 +api support by checking for COGL_FEATURE_ID_GLES2_CONTEXT support +with cogl_has_feature(). This function will return FALSE and +return an COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED error if the +feature isn't available.
+

+

+
++++ + + + + + + + + + + + + + + +

ctx :

A CoglContext +

error :

A pointer to a CoglError for returning exceptions

Returns :

A newly allocated CoglGLES2Context or NULL if there +was an error and error will be updated in that case.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_is_gles2_context ()

+
CoglBool            cogl_is_gles2_context               (void *object);
+

+Gets whether the given object references a CoglGLES2Context. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglGLES2Context +and FALSE otherwise.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_gles2_context_get_vtable ()

+
const CoglGLES2Vtable * cogl_gles2_context_get_vtable   (CoglGLES2Context *gles2_ctx);
+

+Queries the OpenGLES 2.0 api function pointers that should be +used for rendering with the given gles2_ctx. +

+

+

+
+

Note

You should not try to directly link to and use the symbols +provided by any system OpenGLES 2.0 driver.
+

+

+
++++ + + + + + + + + + + +

gles2_ctx :

A CoglGLES2Context allocated with +cogl_gles2_context_new() +

Returns :

A pointer to a CoglGLES2Vtable providing pointers +to functions for the full OpenGLES 2.0 api.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_push_gles2_context ()

+
CoglBool            cogl_push_gles2_context             (CoglContext *ctx,
+                                                         CoglGLES2Context *gles2_ctx,
+                                                         CoglFramebuffer *read_buffer,
+                                                         CoglFramebuffer *write_buffer,
+                                                         CoglError **error);
+

+Pushes the given gles2_ctx onto a stack associated with ctx so +that the OpenGLES 2.0 api can be used instead of the Cogl +rendering apis to read and write to the specified framebuffers. +

+

+Usage of the api available through a CoglGLES2Vtable is only +allowed between cogl_push_gles2_context() and +cogl_pop_gles2_context() calls. +

+

+If there is a runtime problem with switching over to the given +gles2_ctx then this function will return FALSE and return +an error through error. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

gles2_ctx :

A CoglGLES2Context allocated with +cogl_gles2_context_new() +

read_buffer :

A CoglFramebuffer to access to read operations +such as glReadPixels. (must be a CoglOffscreen +framebuffer currently)

write_buffer :

A CoglFramebuffer to access for drawing operations +such as glDrawArrays. (must be a CoglOffscreen +framebuffer currently)

error :

A pointer to a CoglError for returning exceptions

Returns :

+TRUE if operation was successfull or FALSE +otherwise and error will be updated.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pop_gles2_context ()

+
void                cogl_pop_gles2_context              (CoglContext *ctx);
+

+Restores the previously active CoglGLES2Context if there +were nested calls to cogl_push_gles2_context() or otherwise +restores the ability to render with the Cogl api instead +of OpenGLES 2.0. +

+

+The behaviour is undefined if calls to cogl_pop_gles2_context() +are not balenced with the number of corresponding calls to +cogl_push_gles2_context(). +

+
++++ + + + + +

ctx :

A CoglContext +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_gles2_get_current_vtable ()

+
CoglGLES2Vtable *   cogl_gles2_get_current_vtable       (void);
+

+Returns the OpenGL ES 2.0 api vtable for the currently pushed +CoglGLES2Context (last pushed with cogl_push_gles2_context()) or +NULL if no CoglGLES2Context has been pushed. +

+
++++ + + + + +

Returns :

The CoglGLES2Vtable for the currently pushed +CoglGLES2Context or NULL if none has been pushed.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_gles2_texture_2d_new_from_handle ()

+
CoglTexture2D *     cogl_gles2_texture_2d_new_from_handle
+                                                        (CoglContext *ctx,
+                                                         CoglGLES2Context *gles2_ctx,
+                                                         unsigned int handle,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format);
+

+Creates a CoglTexture2D from an OpenGL ES 2.0 texture handle that +was created within the given gles2_ctx via glGenTextures(). The +texture needs to have been associated with the GL_TEXTURE_2D target. +

+

+

+
+

Note

This interface is only intended for sharing textures to read +from. The behaviour is undefined if the texture is modified using +the Cogl api.
+

+

+

+

+
+

Note

Applications should only pass this function handles that were +created via a CoglGLES2Vtable or via libcogl-gles2 and not pass +handles created directly using the system's native libGLESv2 +api.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

gles2_ctx :

A CoglGLES2Context allocated with +cogl_gles2_context_new() +

handle :

An OpenGL ES 2.0 texture handle created with +glGenTextures() +

width :

Width of the texture to allocate

height :

Height of the texture to allocate

format :

The format of the texture
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_gles2_texture_get_handle ()

+
CoglBool            cogl_gles2_texture_get_handle       (CoglTexture *texture,
+                                                         unsigned int *handle,
+                                                         unsigned int *target);
+

+Gets an OpenGL ES 2.0 texture handle for a CoglTexture that can +then be referenced by a CoglGLES2Context. As well as returning +a texture handle the texture's target (such as GL_TEXTURE_2D) is +also returned. +

+

+If the CoglTexture can not be shared with a CoglGLES2Context then +this function will return FALSE. +

+

+This api does not affect the lifetime of the CoglTexture and you +must take care not to reference the returned handle after the +original texture has been freed. +

+

+

+
+

Note

This interface is only intended for sharing textures to read +from. The behaviour is undefined if the texture is modified by a +GLES2 context.
+

+

+

+

+
+

Note

This function will only return TRUE for low-level +CoglTextures such as CoglTexture2D or CoglTexture3D but +not for high level meta textures such as +CoglTexture2DSliced +
+

+

+

+

+
+

Note

The handle returned should not be passed directly to a system +OpenGL ES 2.0 library, the handle is only intended to be used via +a CoglGLES2Vtable or via libcogl-gles2.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

texture :

A CoglTexture +

handle :

A return location for an OpenGL ES 2.0 texture handle

target :

A return location for an OpenGL ES 2.0 texture target

Returns :

+TRUE if a handle and target could be returned +otherwise FALSE is returned.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GPU-synchronisation-fences.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GPU-synchronisation-fences.html new file mode 100644 index 0000000..f7eb542 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GPU-synchronisation-fences.html @@ -0,0 +1,203 @@ + + + + +GPU synchronisation fences + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

GPU synchronisation fences

+

GPU synchronisation fences — Functions for notification of command completion

+
+
+

Synopsis

+
                    CoglFence;
+void                (*CoglFenceCallback)                (CoglFence *fence,
+                                                         void *user_data);
+                    CoglFenceClosure;
+void *              cogl_fence_closure_get_user_data    (CoglFenceClosure *closure);
+CoglFenceClosure *  cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer,
+                                                         CoglFenceCallback callback,
+                                                         void *user_data);
+void                cogl_framebuffer_cancel_fence_callback
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglFenceClosure *closure);
+
+
+
+

Description

+

+Cogl allows notification of GPU command completion; users may mark +points in the GPU command stream and receive notification when the GPU +has executed to that point. +

+
+
+

Details

+
+

CoglFence

+
typedef struct _CoglFence CoglFence;
+

+An opaque object representing a fence. This type is currently +unused but in the future may be used to pass extra information +about the fence completion. +

+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

CoglFenceCallback ()

+
void                (*CoglFenceCallback)                (CoglFence *fence,
+                                                         void *user_data);
+

+The callback prototype used with +cogl_framebuffer_add_fence_callback() for notification of GPU +command completion. +

+
++++ + + + + + + + + + + +

fence :

Unused. In the future this parameter may be used to pass +extra information about the fence completion but for now it +should be ignored.

user_data :

The private data passed to cogl_framebuffer_add_fence_callback() +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

CoglFenceClosure

+
typedef struct _CoglFenceClosure CoglFenceClosure;
+

+An opaque type representing one future callback to be made when the +GPU command stream has passed a certain point. +

+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_fence_closure_get_user_data ()

+
void *              cogl_fence_closure_get_user_data    (CoglFenceClosure *closure);
+
+
+
+

cogl_framebuffer_add_fence_callback ()

+
CoglFenceClosure *  cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer,
+                                                         CoglFenceCallback callback,
+                                                         void *user_data);
+

+Calls the provided callback when all previously-submitted commands have +been executed by the GPU. +

+
++++ + + + + + + + + + + + + + + + + + + +

framebuffer :

The CoglFramebuffer the commands have been submitted to

callback :

A CoglFenceCallback to be called when +all commands submitted to Cogl have been executed. [scope notified] +

user_data :

Private data that will be passed to the callback. [closure] +

Returns :

non-NULL if the fence succeeded, or NULL if it was unable to +be inserted and the callback will never be called. The user does not +need to free the closure; it will be freed automatically when the +callback is called, or cancelled.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_cancel_fence_callback ()

+
void                cogl_framebuffer_cancel_fence_callback
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglFenceClosure *closure);
+

+Removes a fence previously submitted with +cogl_framebuffer_add_fence_callback(); the callback will not be +called. +

+
++++ + + + + + + + + + + +

framebuffer :

The CoglFramebuffer the commands were submitted to

closure :

The CoglFenceClosure returned from +cogl_framebuffer_add_fence_callback() +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GType-Integration-API.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GType-Integration-API.html new file mode 100644 index 0000000..c927f90 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GType-Integration-API.html @@ -0,0 +1,74 @@ + + + + +GType Integration API + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

GType Integration API

+

GType Integration API

+
+
+

Synopsis

+
GType               cogl_gtype_matrix_get_type          (void);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_gtype_matrix_get_type ()

+
GType               cogl_gtype_matrix_get_type          (void);
+
+

Warning

+

cogl_gtype_matrix_get_type has been deprecated since version 1.18 and should not be used in newly-written code. Use cogl_matrix_get_gtype() instead.

+
+
++++ + + + + +

Returns :

the GType for the registered "CoglMatrix" boxed type. This +can be used for example to define GObject properties that accept a +CoglMatrix value.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-High-Level-Meta-Textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-High-Level-Meta-Textures.html new file mode 100644 index 0000000..162c17a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-High-Level-Meta-Textures.html @@ -0,0 +1,278 @@ + + + + +High Level Meta Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

High Level Meta Textures

+

High Level Meta Textures — Interface for high-level textures built from + low-level textures like CoglTexture2D and + CoglTexture3D.

+
+
+

Synopsis

+
typedef             CoglMetaTexture;
+void                (*CoglMetaTextureCallback)          (CoglTexture *sub_texture,
+                                                         const float *sub_texture_coords,
+                                                         const float *meta_coords,
+                                                         void *user_data);
+void                cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
+                                                         float tx_1,
+                                                         float ty_1,
+                                                         float tx_2,
+                                                         float ty_2,
+                                                         CoglPipelineWrapMode wrap_s,
+                                                         CoglPipelineWrapMode wrap_t,
+                                                         CoglMetaTextureCallback callback,
+                                                         void *user_data);
+
+
+
+

Description

+

+Cogl helps to make it easy to deal with high level textures such +as CoglAtlasTextures, CoglSubTextures, +CoglTexturePixmapX11 textures and CoglTexture2DSliced textures +consistently. +

+

+A CoglMetaTexture is a texture that might internally be +represented by one or more low-level CoglTextures +such as CoglTexture2D or CoglTexture3D. These low-level textures +are the only ones that a GPU really understands but because +applications often want more high-level texture abstractions +(such as storing multiple textures inside one larger "atlas" +texture) it's desirable to be able to deal with these +using a common interface. +

+

+For example the GPU is not able to automatically handle repeating a +texture that is part of a larger atlas texture but if you use +COGL_PIPELINE_WRAP_MODE_REPEAT with an atlas texture when drawing +with cogl_rectangle() you should see that it "Just Works™" - at +least if you don't use multi-texturing. The reason this works is +because cogl_rectangle() internally understands the CoglMetaTexture +interface and is able to manually resolve the low-level textures +using this interface and by making multiple draw calls it can +emulate the texture repeat modes. +

+

+Cogl doesn't aim to pretend that meta-textures are just like real +textures because it would get extremely complex to try and emulate +low-level GPU semantics transparently for these textures. The low +level drawing APIs of Cogl, such as cogl_primitive_draw() don't +actually know anything about the CoglMetaTexture interface and its +the developer's responsibility to resolve all textures referenced +by a CoglPipeline to low-level textures before drawing. +

+

+If you want to develop custom primitive APIs like +cogl_framebuffer_draw_rectangle() and you want to support drawing +with CoglAtlasTextures or CoglSubTextures for +example, then you will need to use this CoglMetaTexture interface +to be able to resolve high-level textures into low-level textures +before drawing with Cogl's low-level drawing APIs such as +cogl_primitive_draw(). +

+

+

+
+

Note

Most developers won't need to use this interface directly +but still it is worth understanding the distinction between +low-level and meta textures because you may find other references +in the documentation that detail limitations of using +meta-textures.
+

+

+
+
+

Details

+
+

CoglMetaTexture

+
typedef void CoglMetaTexture;
+
+
+
+
+

CoglMetaTextureCallback ()

+
void                (*CoglMetaTextureCallback)          (CoglTexture *sub_texture,
+                                                         const float *sub_texture_coords,
+                                                         const float *meta_coords,
+                                                         void *user_data);
+

+A callback used with cogl_meta_texture_foreach_in_region() to +retrieve details of all the low-level CoglTextures that +make up a given CoglMetaTexture. +

+
++++ + + + + + + + + + + + + + + + + + + +

sub_texture :

A low-level CoglTexture making up part of a +CoglMetaTexture.

sub_texture_coords :

A float 4-tuple ordered like +(tx1,ty1,tx2,ty2) defining what region of the +current sub_texture maps to a sub-region of a +CoglMetaTexture. (tx1,ty1) is the top-left +sub-region coordinate and (tx2,ty2) is the +bottom-right. These are low-level texture +coordinates.

meta_coords :

A float 4-tuple ordered like (tx1,ty1,tx2,ty2) +defining what sub-region of a CoglMetaTexture this +low-level sub_texture maps too. (tx1,ty1) is +the top-left sub-region coordinate and (tx2,ty2) is +the bottom-right. These are high-level meta-texture +coordinates.

user_data :

A private pointer passed to +cogl_meta_texture_foreach_in_region().
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_meta_texture_foreach_in_region ()

+
void                cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
+                                                         float tx_1,
+                                                         float ty_1,
+                                                         float tx_2,
+                                                         float ty_2,
+                                                         CoglPipelineWrapMode wrap_s,
+                                                         CoglPipelineWrapMode wrap_t,
+                                                         CoglMetaTextureCallback callback,
+                                                         void *user_data);
+

+Allows you to manually iterate the low-level textures that define a +given region of a high-level CoglMetaTexture. +

+

+For example cogl_texture_2d_sliced_new_with_size() can be used to +create a meta texture that may slice a large image into multiple, +smaller power-of-two sized textures. These high level textures are +not directly understood by a GPU and so this API must be used to +manually resolve the underlying textures for drawing. +

+

+All high level textures (CoglAtlasTexture, CoglSubTexture, +CoglTexturePixmapX11, and CoglTexture2DSliced) can be handled +consistently using this interface which greately simplifies +implementing primitives that support all texture types. +

+

+For example if you use the cogl_rectangle() API then Cogl will +internally use this API to resolve the low level textures of any +meta textures you have associated with CoglPipeline layers. +

+

+

+
+

Note

The low level drawing APIs such as cogl_primitive_draw() +don't understand the CoglMetaTexture interface and so it is your +responsibility to use this API to resolve all CoglPipeline textures +into low-level textures before drawing.
+

+

+

+For each low-level texture that makes up part of the given region +of the meta_texture, callback is called specifying how the +low-level texture maps to the original region. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

meta_texture :

An object implementing the CoglMetaTexture +interface.

tx_1 :

The top-left x coordinate of the region to iterate

ty_1 :

The top-left y coordinate of the region to iterate

tx_2 :

The bottom-right x coordinate of the region to iterate

ty_2 :

The bottom-right y coordinate of the region to iterate

wrap_s :

The wrap mode for the x-axis

wrap_t :

The wrap mode for the y-axis

callback :

A CoglMetaTextureCallback pointer to be called +for each low-level texture within the specified region.

user_data :

A private pointer that is passed to callback.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Indices.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Indices.html new file mode 100644 index 0000000..048c5e5 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Indices.html @@ -0,0 +1,285 @@ + + + + +Indices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Indices

+

Indices — Describe vertex indices stored in a CoglIndexBuffer.

+
+
+

Synopsis

+
                    CoglIndices;
+CoglBool            cogl_is_indices                     (void *object);
+
+enum                CoglIndicesType;
+CoglIndices *       cogl_indices_new                    (CoglContext *context,
+                                                         CoglIndicesType type,
+                                                         const void *indices_data,
+                                                         int n_indices);
+
+CoglIndices *       cogl_get_rectangle_indices          (CoglContext *context,
+                                                         int n_rectangles);
+
+
+
+

Description

+

+Indices allow you to avoid duplicating vertices in your vertex data +by virtualizing your data and instead providing a sequence of index +values that tell the GPU which data should be used for each vertex. +

+

+If the GPU is given a sequence of indices it doesn't simply walk +through each vertex of your data in order it will instead walk +through the indices which can provide random access to the +underlying data. +

+

+Since it's very common to have duplicate vertices when describing a +shape as a list of triangles it can often be a significant space +saving to describe geometry using indices. Reducing the size of +your models can make it cheaper to map them into the GPU by +reducing the demand on memory bandwidth and may help to make better +use of your GPUs internal vertex caching. +

+

+For example, to describe a quadrilateral as 2 triangles for the GPU +you could either provide data with 6 vertices or instead with +indices you can provide vertex data for just 4 vertices and an +index buffer that specfies the 6 vertices by indexing the shared +vertices multiple times. +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertex2f quad_vertices[] = {
+    {x0, y0}, //0 = top left
+    {x1, y1}, //1 = bottom left
+    {x2, y2}, //2 = bottom right
+    {x3, y3}, //3 = top right
+  };
+  //tell the gpu how to interpret the quad as 2 triangles...
+  unsigned char indices[] = {0, 1, 2, 0, 2, 3};
+
+ +

+

+

+Even in the above illustration we see a saving of 10bytes for one +quad compared to having data for 6 vertices and no indices but if +you need to draw 100s or 1000s of quads then its really quite +significant. +

+

+Something else to consider is that often indices can be defined +once and remain static while the vertex data may change for +animations perhaps. That means you may be able to ignore the +negligable cost of mapping your indices into the GPU if they don't +ever change. +

+

+The above illustration is actually a good example of static indices +because it's really common that developers have quad mesh data that +they need to display and we know exactly what that indices array +needs to look like depending on the number of quads that need to be +drawn. It doesn't matter how the quads might be animated and +changed the indices will remain the same. Cogl even has a utility +(cogl_get_rectangle_indices()) to get access to re-useable indices +for drawing quads as above. +

+
+
+

Details

+
+

CoglIndices

+
typedef struct _CoglIndices CoglIndices;
+
+
+
+

cogl_is_indices ()

+
CoglBool            cogl_is_indices                     (void *object);
+

+Gets whether the given object references a CoglIndices. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglIndices +and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

enum CoglIndicesType

+
typedef enum {
+  COGL_INDICES_TYPE_UNSIGNED_BYTE,
+  COGL_INDICES_TYPE_UNSIGNED_SHORT,
+  COGL_INDICES_TYPE_UNSIGNED_INT
+} CoglIndicesType;
+
+

+You should aim to use the smallest data type that gives you enough +range, since it reduces the size of your index array and can help +reduce the demand on memory bandwidth. +

+

+Note that COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the +COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This +should always be available on OpenGL but on OpenGL ES it will only +be available if the GL_OES_element_index_uint extension is +advertized. +

+
++++ + + + + + + + + + + + + + + +

COGL_INDICES_TYPE_UNSIGNED_BYTE

Your indices are unsigned bytes +

COGL_INDICES_TYPE_UNSIGNED_SHORT

Your indices are unsigned shorts +

COGL_INDICES_TYPE_UNSIGNED_INT

Your indices are unsigned ints +
+
+
+
+

cogl_indices_new ()

+
CoglIndices *       cogl_indices_new                    (CoglContext *context,
+                                                         CoglIndicesType type,
+                                                         const void *indices_data,
+                                                         int n_indices);
+
+
+
+

cogl_get_rectangle_indices ()

+
CoglIndices *       cogl_get_rectangle_indices          (CoglContext *context,
+                                                         int n_rectangles);
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Low-level-primitive-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Low-level-primitive-textures.html new file mode 100644 index 0000000..881fc09 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Low-level-primitive-textures.html @@ -0,0 +1,150 @@ + + + + +Low-level primitive textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Low-level primitive textures

+

Low-level primitive textures — Interface for low-level textures like + CoglTexture2D and CoglTexture3D.

+
+
+

Synopsis

+
typedef             CoglPrimitiveTexture;
+CoglBool            cogl_is_primitive_texture           (void *object);
+void                cogl_primitive_texture_set_auto_mipmap
+                                                        (CoglPrimitiveTexture *primitive_texture,
+                                                         CoglBool value);
+
+
+
+

Description

+

+A CoglPrimitiveTexture is a texture that is directly represented +by a single texture on the GPU. For example these could be a +CoglTexture2D, CoglTexture3D or CoglTextureRectangle. This is +opposed to high level meta textures which may be composed of +multiple primitive textures or a sub-region of another texture such +as CoglAtlasTexture and CoglTexture2DSliced. +

+

+A texture that implements this interface can be directly used with +the low level cogl_primitive_draw() API. Other types of textures +need to be first resolved to primitive textures using the +CoglMetaTexture interface. +

+

+

+
+

Note

Most developers won't need to use this interface directly but +still it is worth understanding the distinction between high-level +and primitive textures because you may find other references in the +documentation that detail limitations of using +primitive textures.
+

+

+
+
+

Details

+
+

CoglPrimitiveTexture

+
typedef void CoglPrimitiveTexture;
+
+
+
+
+

cogl_is_primitive_texture ()

+
CoglBool            cogl_is_primitive_texture           (void *object);
+

+Gets whether the given object references a primitive texture object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the pointer references a primitive texture, and +FALSE otherwise
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_texture_set_auto_mipmap ()

+
void                cogl_primitive_texture_set_auto_mipmap
+                                                        (CoglPrimitiveTexture *primitive_texture,
+                                                         CoglBool value);
+

+Sets whether the texture will automatically update the smaller +mipmap levels after any part of level 0 is updated. The update will +only occur whenever the texture is used for drawing with a texture +filter that requires the lower mipmap levels. An application should +disable this if it wants to upload its own data for the other +levels. By default auto mipmapping is enabled. +

+
++++ + + + + + + + + + + +

primitive_texture :

A CoglPrimitiveTexture +

value :

The new value for whether to auto mipmap
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integration.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integration.html new file mode 100644 index 0000000..c76e43a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integration.html @@ -0,0 +1,411 @@ + + + + +Main loop integration + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Main loop integration

+

Main loop integration — Functions for integrating Cogl with an + application's main loop

+
+
+

Synopsis

+
enum                CoglPollFDEvent;
+                    CoglPollFD;
+int                 cogl_poll_renderer_get_info         (CoglRenderer *renderer,
+                                                         CoglPollFD **poll_fds,
+                                                         int *n_poll_fds,
+                                                         int64_t *timeout);
+void                cogl_poll_renderer_dispatch         (CoglRenderer *renderer,
+                                                         const CoglPollFD *poll_fds,
+                                                         int n_poll_fds);
+GSource *           cogl_glib_source_new                (CoglContext *context,
+                                                         int priority);
+GSource *           cogl_glib_renderer_source_new       (CoglRenderer *renderer,
+                                                         int priority);
+
+
+
+

Description

+

+Cogl needs to integrate with the application's main loop so that it +can internally handle some events from the driver. All Cogl +applications must use these functions. They provide enough +information to describe the state that Cogl will need to wake up +on. An application using the GLib main loop can instead use +cogl_glib_source_new() which provides a GSource ready to be added +to the main loop. +

+
+
+

Details

+
+

enum CoglPollFDEvent

+
typedef enum {
+  COGL_POLL_FD_EVENT_IN = COGL_SYSDEF_POLLIN,
+  COGL_POLL_FD_EVENT_PRI = COGL_SYSDEF_POLLPRI,
+  COGL_POLL_FD_EVENT_OUT = COGL_SYSDEF_POLLOUT,
+  COGL_POLL_FD_EVENT_ERR = COGL_SYSDEF_POLLERR,
+  COGL_POLL_FD_EVENT_HUP = COGL_SYSDEF_POLLHUP,
+  COGL_POLL_FD_EVENT_NVAL = COGL_SYSDEF_POLLNVAL
+} CoglPollFDEvent;
+
+

+A bitmask of events that Cogl may need to wake on for a file +descriptor. Note that these all have the same values as the +corresponding defines for the poll function call on Unix so they +may be directly passed to poll. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_POLL_FD_EVENT_IN

there is data to read +

COGL_POLL_FD_EVENT_PRI

data can be written (without blocking) +

COGL_POLL_FD_EVENT_OUT

there is urgent data to read. +

COGL_POLL_FD_EVENT_ERR

error condition +

COGL_POLL_FD_EVENT_HUP

hung up (the connection has been broken, usually + for pipes and sockets). +

COGL_POLL_FD_EVENT_NVAL

invalid request. The file descriptor is not open. +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

CoglPollFD

+
typedef struct {
+  int fd;
+  short int events;
+  short int revents;
+} CoglPollFD;
+
+

+A struct for describing the state of a file descriptor that Cogl +needs to block on. The events field contains a bitmask of +CoglPollFDEvents that should cause the application to wake +up. After the application is woken up from idle it should pass back +an array of CoglPollFDs to Cogl and update the revents +mask to the actual events that occurred on the file descriptor. +

+

+Note that CoglPollFD is deliberately exactly the same as struct +pollfd on Unix so that it can simply be cast when calling poll. +

+
++++ + + + + + + + + + + + + + + +

int fd;

The file descriptor to block on

short int events;

A bitmask of events to block on

short int revents;

A bitmask of returned events
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_poll_renderer_get_info ()

+
int                 cogl_poll_renderer_get_info         (CoglRenderer *renderer,
+                                                         CoglPollFD **poll_fds,
+                                                         int *n_poll_fds,
+                                                         int64_t *timeout);
+

+Is used to integrate Cogl with an application mainloop that is based +on the unix poll(2) api (or select() or something equivalent). This +api should be called whenever an application is about to go idle so +that Cogl has a chance to describe what file descriptor events it +needs to be woken up for. +

+

+

+
+

Note

If your application is using the Glib mainloop then you +should jump to the cogl_glib_source_new() api as a more convenient +way of integrating Cogl with the mainloop.
+

+

+

+After the function is called *poll_fds will contain a pointer to +an array of CoglPollFD structs describing the file descriptors +that Cogl expects. The fd and events members will be updated +accordingly. After the application has completed its idle it is +expected to either update the revents members directly in this +array or to create a copy of the array and update them +there. +

+

+When the application mainloop returns from calling poll(2) (or its +equivalent) then it should call cogl_poll_renderer_dispatch() +passing a pointer the array of CoglPollFDs with updated +revent values. +

+

+When using the COGL_WINSYS_ID_WGL winsys (where file descriptors +don't make any sense) or COGL_WINSYS_ID_SDL (where the event +handling functions of SDL don't allow blocking on a file +descriptor) *n_poll_fds is guaranteed to be zero. +

+

+timeout will contain a maximum amount of time to wait in +microseconds before the application should wake up or -1 if the +application should wait indefinitely. This can also be 0 if +Cogl needs to be woken up immediately. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

renderer :

A CoglRenderer +

poll_fds :

A return location for a pointer to an array +of CoglPollFDs

n_poll_fds :

A return location for the number of entries in *poll_fds +

timeout :

A return location for the maximum length of time to wait +in microseconds, or -1 to wait indefinitely.

Returns :

A "poll fd state age" that changes whenever the set +of poll_fds has changed. If this API is being used to +integrate with another system mainloop api then +knowing if the set of file descriptors and events has +really changed can help avoid redundant work +depending the api. The age isn't guaranteed to change +when the timeout changes.
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_poll_renderer_dispatch ()

+
void                cogl_poll_renderer_dispatch         (CoglRenderer *renderer,
+                                                         const CoglPollFD *poll_fds,
+                                                         int n_poll_fds);
+

+This should be called whenever an application is woken up from +going idle in its main loop. The poll_fds array should contain a +list of file descriptors matched with the events that occurred in +revents. The events field is ignored. It is safe to pass in extra +file descriptors that Cogl didn't request when calling +cogl_poll_renderer_get_info() or a shorter array missing some file +descriptors that Cogl requested. +

+

+

+
+

Note

If your application didn't originally create a CoglRenderer +manually then you can easily get a CoglRenderer pointer by calling +cogl_get_renderer().
+

+

+
++++ + + + + + + + + + + + + + + +

renderer :

A CoglRenderer +

poll_fds :

An array of CoglPollFDs describing the events +that have occurred since the application went idle.

n_poll_fds :

The length of the poll_fds array.
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_glib_source_new ()

+
GSource *           cogl_glib_source_new                (CoglContext *context,
+                                                         int priority);
+

+Creates a GSource which handles Cogl's internal system event +processing. This can be used as a convenience instead of +cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in +applications that are already using the GLib main loop. After this +is called the GSource should be attached to the main loop using +g_source_attach(). +

+

+Applications that manually connect to a CoglRenderer before they +create a CoglContext should instead use +cogl_glib_renderer_source_new() so that events may be dispatched +before a context has been created. In that case you don't need to +use this api in addition later, it is simply enough to use +cogl_glib_renderer_source_new() instead. +

+

+

+
+

Note

This api is actually just a thin convenience wrapper around +cogl_glib_renderer_source_new() +
+

+

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext +

priority :

The priority of the GSource +

Returns :

a new GSource +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_glib_renderer_source_new ()

+
GSource *           cogl_glib_renderer_source_new       (CoglRenderer *renderer,
+                                                         int priority);
+

+Creates a GSource which handles Cogl's internal system event +processing. This can be used as a convenience instead of +cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in +applications that are already using the GLib main loop. After this +is called the GSource should be attached to the main loop using +g_source_attach(). +

+
++++ + + + + + + + + + + + + + + +

renderer :

A CoglRenderer +

priority :

The priority of the GSource +

Returns :

a new GSource +
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html new file mode 100644 index 0000000..7d42b14 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html @@ -0,0 +1,1589 @@ + + + + +Matrices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Matrices

+

Matrices — Functions for initializing and manipulating 4x4 matrices

+
+
+

Synopsis

+
                    CoglMatrix;
+void                cogl_matrix_init_identity           (CoglMatrix *matrix);
+void                cogl_matrix_init_from_array         (CoglMatrix *matrix,
+                                                         const float *array);
+void                cogl_matrix_init_translation        (CoglMatrix *matrix,
+                                                         float tx,
+                                                         float ty,
+                                                         float tz);
+void                cogl_matrix_init_from_quaternion    (CoglMatrix *matrix,
+                                                         const CoglQuaternion *quaternion);
+void                cogl_matrix_init_from_euler         (CoglMatrix *matrix,
+                                                         const CoglEuler *euler);
+CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+CoglBool            cogl_matrix_equal                   (const void *v1,
+                                                         const void *v2);
+void                cogl_matrix_free                    (CoglMatrix *matrix);
+void                cogl_matrix_frustum                 (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_orthographic            (CoglMatrix *matrix,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+void                cogl_matrix_perspective             (CoglMatrix *matrix,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_look_at                 (CoglMatrix *matrix,
+                                                         float eye_position_x,
+                                                         float eye_position_y,
+                                                         float eye_position_z,
+                                                         float object_x,
+                                                         float object_y,
+                                                         float object_z,
+                                                         float world_up_x,
+                                                         float world_up_y,
+                                                         float world_up_z);
+void                cogl_matrix_multiply                (CoglMatrix *result,
+                                                         const CoglMatrix *a,
+                                                         const CoglMatrix *b);
+void                cogl_matrix_rotate                  (CoglMatrix *matrix,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_rotate_quaternion       (CoglMatrix *matrix,
+                                                         const CoglQuaternion *quaternion);
+void                cogl_matrix_rotate_euler            (CoglMatrix *matrix,
+                                                         const CoglEuler *euler);
+void                cogl_matrix_translate               (CoglMatrix *matrix,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_scale                   (CoglMatrix *matrix,
+                                                         float sx,
+                                                         float sy,
+                                                         float sz);
+void                cogl_matrix_transpose               (CoglMatrix *matrix);
+const float *       cogl_matrix_get_array               (const CoglMatrix *matrix);
+CoglBool            cogl_matrix_get_inverse             (const CoglMatrix *matrix,
+                                                         CoglMatrix *inverse);
+void                cogl_matrix_transform_point         (const CoglMatrix *matrix,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z,
+                                                         float *w);
+void                cogl_matrix_transform_points        (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+void                cogl_matrix_project_points          (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+CoglBool            cogl_matrix_is_identity             (const CoglMatrix *matrix);
+
+
+
+

Description

+

+Matrices are used in Cogl to describe affine model-view transforms, texture +transforms, and projective transforms. This exposes a utility API that can +be used for direct manipulation of these matrices. +

+
+
+

Details

+
+

CoglMatrix

+
typedef struct {
+  /* column 0 */
+  float xx;
+  float yx;
+  float zx;
+  float wx;
+
+  /* column 1 */
+  float xy;
+  float yy;
+  float zy;
+  float wy;
+
+  /* column 2 */
+  float xz;
+  float yz;
+  float zz;
+  float wz;
+
+  /* column 3 */
+  float xw;
+  float yw;
+  float zw;
+  float ww;
+} CoglMatrix;
+
+

+A CoglMatrix holds a 4x4 transform matrix. This is a single precision, +column-major matrix which means it is compatible with what OpenGL expects. +

+

+A CoglMatrix can represent transforms such as, rotations, scaling, +translation, sheering, and linear projections. You can combine these +transforms by multiplying multiple matrices in the order you want them +applied. +

+

+The transformation of a vertex (x, y, z, w) by a CoglMatrix is given by: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27

+
+
+
+
+
+
+
+
+
+
+
+
+x_new = xx * x + xy * y + xz * z + xw * w
+  y_new = yx * x + yy * y + yz * z + yw * w
+  z_new = zx * x + zy * y + zz * z + zw * w
+  w_new = wx * x + wy * y + wz * z + ww * w
+
+ +

+

+

+Where w is normally 1 +

+

+

+
+

Note

You must consider the members of the CoglMatrix structure read only, +and all matrix modifications must be done via the cogl_matrix API. This +allows Cogl to annotate the matrices internally. Violation of this will give +undefined results. If you need to initialize a matrix with a constant other +than the identity matrix you can use cogl_matrix_init_from_array().
+

+

+
+
+
+

cogl_matrix_init_identity ()

+
void                cogl_matrix_init_identity           (CoglMatrix *matrix);
+

+Resets matrix to the identity matrix: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+.xx=1; .xy=0; .xz=0; .xw=0;
+  .yx=0; .yy=1; .yz=0; .yw=0;
+  .zx=0; .zy=0; .zz=1; .zw=0;
+  .wx=0; .wy=0; .wz=0; .ww=1;
+
+ +

+

+
++++ + + + + +

matrix :

A 4x4 transformation matrix
+
+
+
+

cogl_matrix_init_from_array ()

+
void                cogl_matrix_init_from_array         (CoglMatrix *matrix,
+                                                         const float *array);
+

+Initializes matrix with the contents of array +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

array :

A linear array of 16 floats (column-major order)
+
+
+
+

cogl_matrix_init_translation ()

+
void                cogl_matrix_init_translation        (CoglMatrix *matrix,
+                                                         float tx,
+                                                         float ty,
+                                                         float tz);
+

+Resets matrix to the (tx, ty, tz) translation matrix: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+.xx=1; .xy=0; .xz=0; .xw=tx;
+  .yx=0; .yy=1; .yz=0; .yw=ty;
+  .zx=0; .zy=0; .zz=1; .zw=tz;
+  .wx=0; .wy=0; .wz=0; .ww=1;
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

tx :

x coordinate of the translation vector

ty :

y coordinate of the translation vector

tz :

z coordinate of the translation vector
+

Since 2.0

+
+
+
+

cogl_matrix_init_from_quaternion ()

+
void                cogl_matrix_init_from_quaternion    (CoglMatrix *matrix,
+                                                         const CoglQuaternion *quaternion);
+

+Initializes matrix from a CoglQuaternion rotation. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

quaternion :

A CoglQuaternion +
+
+
+
+

cogl_matrix_init_from_euler ()

+
void                cogl_matrix_init_from_euler         (CoglMatrix *matrix,
+                                                         const CoglEuler *euler);
+

+Initializes matrix from a CoglEuler rotation. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

euler :

A CoglEuler +
+
+
+
+

cogl_matrix_copy ()

+
CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+

+Allocates a new CoglMatrix on the heap and initializes it with +the same values as matrix. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix you want to copy

Returns :

A newly allocated CoglMatrix which +should be freed using cogl_matrix_free(). [transfer full] +
+

Since 1.6

+
+
+
+

cogl_matrix_equal ()

+
CoglBool            cogl_matrix_equal                   (const void *v1,
+                                                         const void *v2);
+

+Compares two matrices to see if they represent the same +transformation. Although internally the matrices may have different +annotations associated with them and may potentially have a cached +inverse matrix these are not considered in the comparison. +

+
++++ + + + + + + + + + + +

v1 :

A 4x4 transformation matrix

v2 :

A 4x4 transformation matrix
+

Since 1.4

+
+
+
+

cogl_matrix_free ()

+
void                cogl_matrix_free                    (CoglMatrix *matrix);
+

+Frees a CoglMatrix that was previously allocated via a call to +cogl_matrix_copy(). +

+
++++ + + + + +

matrix :

A 4x4 transformation matrix you want to free
+

Since 1.6

+
+
+
+

cogl_matrix_frustum ()

+
void                cogl_matrix_frustum                 (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+

+Multiplies matrix by the given frustum perspective matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_orthographic ()

+
void                cogl_matrix_orthographic            (CoglMatrix *matrix,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+

+Multiplies matrix by a parallel projection matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

x_1 :

The x coordinate for the first vertical clipping plane

y_1 :

The y coordinate for the first horizontal clipping plane

x_2 :

The x coordinate for the second vertical clipping plane

y_2 :

The y coordinate for the second horizontal clipping plane

near :

The distance to the near clipping +plane (will be negative if the plane is +behind the viewer)

far :

The distance to the far clipping +plane (will be negative if the plane is +behind the viewer)
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_matrix_perspective ()

+
void                cogl_matrix_perspective             (CoglMatrix *matrix,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+

+Multiplies matrix by the described perspective matrix +

+

+

+
+

Note

You should be careful not to have to great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

fov_y :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive, +and must not be 0)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_look_at ()

+
void                cogl_matrix_look_at                 (CoglMatrix *matrix,
+                                                         float eye_position_x,
+                                                         float eye_position_y,
+                                                         float eye_position_z,
+                                                         float object_x,
+                                                         float object_y,
+                                                         float object_z,
+                                                         float world_up_x,
+                                                         float world_up_y,
+                                                         float world_up_z);
+

+Applies a view transform matrix that positions the camera at +the coordinate (eye_position_x, eye_position_y, eye_position_z) +looking towards an object at the coordinate (object_x, object_y, +object_z). The top of the camera is aligned to the given world up +vector, which is normally simply (0, 1, 0) to map up to the +positive direction of the y axis. +

+

+Because there is a lot of missleading documentation online for +gluLookAt regarding the up vector we want to try and be a bit +clearer here. +

+

+The up vector should simply be relative to your world coordinates +and does not need to change as you move the eye and object +positions. Many online sources may claim that the up vector needs +to be perpendicular to the vector between the eye and object +position (partly because the man page is somewhat missleading) but +that is not necessary for this function. +

+

+

+
+

Note

You should never look directly along the world-up +vector.
+

+

+

+

+
+

Note

It is assumed you are using a typical projection matrix where +your origin maps to the center of your viewport.
+

+

+

+

+
+

Note

Almost always when you use this function it should be the first +transform applied to a new modelview transform
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

eye_position_x :

The X coordinate to look from

eye_position_y :

The Y coordinate to look from

eye_position_z :

The Z coordinate to look from

object_x :

The X coordinate of the object to look at

object_y :

The Y coordinate of the object to look at

object_z :

The Z coordinate of the object to look at

world_up_x :

The X component of the world's up direction vector

world_up_y :

The Y component of the world's up direction vector

world_up_z :

The Z component of the world's up direction vector
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_matrix_multiply ()

+
void                cogl_matrix_multiply                (CoglMatrix *result,
+                                                         const CoglMatrix *a,
+                                                         const CoglMatrix *b);
+

+Multiplies the two supplied matrices together and stores +the resulting matrix inside result. +

+

+

+
+

Note

It is possible to multiply the a matrix in-place, so +result can be equal to a but can't be equal to b.
+

+

+
++++ + + + + + + + + + + + + + + +

result :

The address of a 4x4 matrix to store the result in

a :

A 4x4 transformation matrix

b :

A 4x4 transformation matrix
+
+
+
+

cogl_matrix_rotate ()

+
void                cogl_matrix_rotate                  (CoglMatrix *matrix,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies matrix with a rotation matrix that applies a rotation +of angle degrees around the specified 3D vector. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

angle :

The angle you want to rotate in degrees

x :

X component of your rotation vector

y :

Y component of your rotation vector

z :

Z component of your rotation vector
+
+
+
+

cogl_matrix_rotate_quaternion ()

+
void                cogl_matrix_rotate_quaternion       (CoglMatrix *matrix,
+                                                         const CoglQuaternion *quaternion);
+

+Multiplies matrix with a rotation transformation described by the +given CoglQuaternion. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

quaternion :

A quaternion describing a rotation
+

Since 2.0

+
+
+
+

cogl_matrix_rotate_euler ()

+
void                cogl_matrix_rotate_euler            (CoglMatrix *matrix,
+                                                         const CoglEuler *euler);
+

+Multiplies matrix with a rotation transformation described by the +given CoglEuler. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

euler :

A euler describing a rotation
+

Since 2.0

+
+
+
+

cogl_matrix_translate ()

+
void                cogl_matrix_translate               (CoglMatrix *matrix,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies matrix with a transform matrix that translates along +the X, Y and Z axis. +

+
++++ + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

x :

The X translation you want to apply

y :

The Y translation you want to apply

z :

The Z translation you want to apply
+
+
+
+

cogl_matrix_scale ()

+
void                cogl_matrix_scale                   (CoglMatrix *matrix,
+                                                         float sx,
+                                                         float sy,
+                                                         float sz);
+

+Multiplies matrix with a transform matrix that scales along the X, +Y and Z axis. +

+
++++ + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

sx :

The X scale factor

sy :

The Y scale factor

sz :

The Z scale factor
+
+
+
+

cogl_matrix_transpose ()

+
void                cogl_matrix_transpose               (CoglMatrix *matrix);
+

+Replaces matrix with its transpose. Ie, every element (i,j) in the +new matrix is taken from element (j,i) in the old matrix. +

+
++++ + + + + +

matrix :

A CoglMatrix +
+

Since 1.10

+
+
+
+

cogl_matrix_get_array ()

+
const float *       cogl_matrix_get_array               (const CoglMatrix *matrix);
+

+Casts matrix to a float array which can be directly passed to OpenGL. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

Returns :

a pointer to the float array
+
+
+
+

cogl_matrix_get_inverse ()

+
CoglBool            cogl_matrix_get_inverse             (const CoglMatrix *matrix,
+                                                         CoglMatrix *inverse);
+

+Gets the inverse transform of a given matrix and uses it to initialize +a new CoglMatrix. +

+

+

+
+

Note

Although the first parameter is annotated as const to indicate +that the transform it represents isn't modified this function may +technically save a copy of the inverse transform within the given +CoglMatrix so that subsequent requests for the inverse transform may +avoid costly inversion calculations.
+

+

+
++++ + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

inverse :

The destination for a 4x4 inverse transformation matrix. [out] +

Returns :

+TRUE if the inverse was successfully calculated or FALSE +for degenerate transformations that can't be inverted (in this case the +inverse matrix will simply be initialized with the identity matrix)
+

Since 1.2

+
+
+
+

cogl_matrix_transform_point ()

+
void                cogl_matrix_transform_point         (const CoglMatrix *matrix,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z,
+                                                         float *w);
+

+Transforms a point whos position is given and returned as four float +components. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

x :

The X component of your points position. [inout] +

y :

The Y component of your points position. [inout] +

z :

The Z component of your points position. [inout] +

w :

The W component of your points position. [inout] +
+
+
+
+

cogl_matrix_transform_points ()

+
void                cogl_matrix_transform_points        (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+

+Transforms an array of input points and writes the result to +another array of output points. The input points can either have 2 +or 3 components each. The output points always have 3 components. +The output array can simply point to the input array to do the +transform in-place. +

+

+If you need to transform 4 component points see +cogl_matrix_project_points(). +

+

+Here's an example with differing input/output strides: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49

+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct {
+  float x,y;
+  uint8_t r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  uint8_t r,g,b,a;
+  float x,y,z;
+} MyOutVertex;
+MyInVertex vertices[N_VERTICES];
+MyOutVertex results[N_VERTICES];
+CoglMatrix matrix;
+
+my_load_vertices (vertices);
+my_get_matrix (&matrix);
+
+cogl_matrix_transform_points (&matrix,
+                              2,
+                              sizeof (MyInVertex),
+                              &vertices[0].x,
+                              sizeof (MyOutVertex),
+                              &results[0].x,
+                              N_VERTICES);
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A transformation matrix

n_components :

The number of position components for each input point. +(either 2 or 3)

stride_in :

The stride in bytes between input points.

points_in :

A pointer to the first component of the first input point.

stride_out :

The stride in bytes between output points.

points_out :

A pointer to the first component of the first output point.

n_points :

The number of points to transform.
+

Stability Level: Unstable

+
+
+
+

cogl_matrix_project_points ()

+
void                cogl_matrix_project_points          (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+

+Projects an array of input points and writes the result to another +array of output points. The input points can either have 2, 3 or 4 +components each. The output points always have 4 components (known +as homogenous coordinates). The output array can simply point to +the input array to do the transform in-place. +

+

+Here's an example with differing input/output strides: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49

+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct {
+  float x,y;
+  uint8_t r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  uint8_t r,g,b,a;
+  float x,y,z;
+} MyOutVertex;
+MyInVertex vertices[N_VERTICES];
+MyOutVertex results[N_VERTICES];
+CoglMatrix matrix;
+
+my_load_vertices (vertices);
+my_get_matrix (&matrix);
+
+cogl_matrix_project_points (&matrix,
+                            2,
+                            sizeof (MyInVertex),
+                            &vertices[0].x,
+                            sizeof (MyOutVertex),
+                            &results[0].x,
+                            N_VERTICES);
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A projection matrix

n_components :

The number of position components for each input point. +(either 2, 3 or 4)

stride_in :

The stride in bytes between input points.

points_in :

A pointer to the first component of the first input point.

stride_out :

The stride in bytes between output points.

points_out :

A pointer to the first component of the first output point.

n_points :

The number of points to transform.
+

Stability Level: Unstable

+
+
+
+

cogl_matrix_is_identity ()

+
CoglBool            cogl_matrix_is_identity             (const CoglMatrix *matrix);
+

+Determines if the given matrix is an identity matrix. +

+
++++ + + + + + + + + + + +

matrix :

A CoglMatrix +

Returns :

+TRUE if matrix is an identity matrix else FALSE +
+

Since 1.8

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrix-Stacks.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrix-Stacks.html new file mode 100644 index 0000000..3768200 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrix-Stacks.html @@ -0,0 +1,1141 @@ + + + + +Matrix Stacks + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Matrix Stacks

+

Matrix Stacks — Functions for efficiently tracking many + related transformations

+
+
+

Synopsis

+
                    CoglMatrixStack;
+                    CoglMatrixEntry;
+CoglMatrixStack *   cogl_matrix_stack_new               (CoglContext *ctx);
+void                cogl_matrix_stack_push              (CoglMatrixStack *stack);
+void                cogl_matrix_stack_pop               (CoglMatrixStack *stack);
+void                cogl_matrix_stack_load_identity     (CoglMatrixStack *stack);
+void                cogl_matrix_stack_scale             (CoglMatrixStack *stack,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_stack_translate         (CoglMatrixStack *stack,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_stack_rotate            (CoglMatrixStack *stack,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_stack_rotate_quaternion (CoglMatrixStack *stack,
+                                                         const CoglQuaternion *quaternion);
+void                cogl_matrix_stack_rotate_euler      (CoglMatrixStack *stack,
+                                                         const CoglEuler *euler);
+void                cogl_matrix_stack_multiply          (CoglMatrixStack *stack,
+                                                         const CoglMatrix *matrix);
+void                cogl_matrix_stack_frustum           (CoglMatrixStack *stack,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_stack_perspective       (CoglMatrixStack *stack,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_stack_orthographic      (CoglMatrixStack *stack,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+CoglBool            cogl_matrix_stack_get_inverse       (CoglMatrixStack *stack,
+                                                         CoglMatrix *inverse);
+CoglMatrixEntry *   cogl_matrix_stack_get_entry         (CoglMatrixStack *stack);
+CoglMatrix *        cogl_matrix_stack_get               (CoglMatrixStack *stack,
+                                                         CoglMatrix *matrix);
+CoglMatrix *        cogl_matrix_entry_get               (CoglMatrixEntry *entry,
+                                                         CoglMatrix *matrix);
+void                cogl_matrix_stack_set               (CoglMatrixStack *stack,
+                                                         const CoglMatrix *matrix);
+CoglBool            cogl_matrix_entry_calculate_translation
+                                                        (CoglMatrixEntry *entry0,
+                                                         CoglMatrixEntry *entry1,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z);
+CoglBool            cogl_matrix_entry_is_identity       (CoglMatrixEntry *entry);
+CoglBool            cogl_matrix_entry_equal             (CoglMatrixEntry *entry0,
+                                                         CoglMatrixEntry *entry1);
+CoglMatrixEntry *   cogl_matrix_entry_ref               (CoglMatrixEntry *entry);
+void                cogl_matrix_entry_unref             (CoglMatrixEntry *entry);
+
+
+
+

Description

+

+Matrices can be used (for example) to describe the model-view +transforms of objects, texture transforms, and projective +transforms. +

+

+The CoglMatrix api provides a good way to manipulate individual +matrices representing a single transformation but if you need to +track many-many such transformations for many objects that are +organized in a scenegraph for example then using a separate +CoglMatrix for each object may not be the most efficient way. +

+

+A CoglMatrixStack enables applications to track lots of +transformations that are related to each other in some kind of +hierarchy. In a scenegraph for example if you want to know how to +transform a particular node then you usually have to walk up +through the ancestors and accumulate their transforms before +finally applying the transform of the node itself. In this model +things are grouped together spatially according to their ancestry +and all siblings with the same parent share the same initial +transformation. The CoglMatrixStack API is suited to tracking lots +of transformations that fit this kind of model. +

+

+Compared to using the CoglMatrix api directly to track many +related transforms, these can be some advantages to using a +CoglMatrixStack: +

+
    +
  • Faster equality comparisons of transformations
  • +
  • Efficient comparisons of the differences between arbitrary + transformations
  • +
  • Avoid redundant arithmetic related to common transforms +
  • +
  • Can be more space efficient (not always though)
  • +
+

+

+

+For reference (to give an idea of when a CoglMatrixStack can +provide a space saving) a CoglMatrix can be expected to take 72 +bytes whereas a single CoglMatrixEntry in a CoglMatrixStack is +currently around 32 bytes on a 32bit CPU or 36 bytes on a 64bit +CPU. An entry is needed for each individual operation applied to +the stack (such as rotate, scale, translate) so if most of your +leaf node transformations only need one or two simple operations +relative to their parent then a matrix stack will likely take less +space than having a CoglMatrix for each node. +

+

+Even without any space saving though the ability to perform fast +comparisons and avoid redundant arithmetic (especially sine and +cosine calculations for rotations) can make using a matrix stack +worthwhile. +

+
+
+

Details

+
+

CoglMatrixStack

+
typedef struct _CoglMatrixStack CoglMatrixStack;
+

+Tracks your current position within a hierarchy and lets you build +up a graph of transformations as you traverse through a hierarchy +such as a scenegraph. +

+

+A CoglMatrixStack always maintains a reference to a single +transformation at any point in time, representing the +transformation at the current position in the hierarchy. You can +get a reference to the current transformation by calling +cogl_matrix_stack_get_entry(). +

+

+When a CoglMatrixStack is first created with +cogl_matrix_stack_new() then it is conceptually positioned at the +root of your hierarchy and the current transformation simply +represents an identity transformation. +

+

+As you traverse your object hierarchy (your scenegraph) then you +should call cogl_matrix_stack_push() whenever you move down one +level and call cogl_matrix_stack_pop() whenever you move back up +one level towards the root. +

+

+At any time you can apply a set of operations, such as "rotate", +"scale", "translate" on top of the current transformation of a +CoglMatrixStack using functions such as +cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and +cogl_matrix_stack_translate(). These operations will derive a new +current transformation and will never affect a transformation +that you have referenced using cogl_matrix_stack_get_entry(). +

+

+Internally applying operations to a CoglMatrixStack builds up a +graph of CoglMatrixEntry structures which each represent a single +immutable transform. +

+
+
+
+

CoglMatrixEntry

+
typedef struct _CoglMatrixEntry CoglMatrixEntry;
+

+Represents a single immutable transformation that was retrieved +from a CoglMatrixStack using cogl_matrix_stack_get_entry(). +

+

+Internally a CoglMatrixEntry represents a single matrix +operation (such as "rotate", "scale", "translate") which is applied +to the transform of a single parent entry. +

+

+Using the CoglMatrixStack api effectively builds up a graph of +these immutable CoglMatrixEntry structures whereby operations +that can be shared between multiple transformations will result +in shared CoglMatrixEntry nodes in the graph. +

+

+When a CoglMatrixStack is first created it references one +CoglMatrixEntry that represents a single "load identity" +operation. This serves as the root entry and all operations +that are then applied to the stack will extend the graph +starting from this root "load identity" entry. +

+

+Given the typical usage model for a CoglMatrixStack and the way +the entries are built up while traversing a scenegraph then in most +cases where an application is interested in comparing two +transformations for equality then it is enough to simply compare +two CoglMatrixEntry pointers directly. Technically this can lead +to false negatives that could be identified with a deeper +comparison but often these false negatives are unlikely and +don't matter anyway so this enables extremely cheap comparisons. +

+

+

+ +

+

+
+
+
+

cogl_matrix_stack_new ()

+
CoglMatrixStack *   cogl_matrix_stack_new               (CoglContext *ctx);
+

+Allocates a new CoglMatrixStack that can be used to build up +transformations relating to objects in a scenegraph like hierarchy. +(See the description of CoglMatrixStack and CoglMatrixEntry for +more details of what a matrix stack is best suited for) +

+

+When a CoglMatrixStack is first allocated it is conceptually +positioned at the root of your scenegraph hierarchy. As you +traverse your scenegraph then you should call +cogl_matrix_stack_push() whenever you move down a level and +cogl_matrix_stack_pop() whenever you move back up a level towards +the root. +

+

+Once you have allocated a CoglMatrixStack you can get a reference +to the current transformation for the current position in the +hierarchy by calling cogl_matrix_stack_get_entry(). +

+

+Once you have allocated a CoglMatrixStack you can apply operations +such as rotate, scale and translate to modify the current transform +for the current position in the hierarchy by calling +cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and +cogl_matrix_stack_translate(). +

+
++++ + + + + + + + + + + +

ctx :

A CoglContext +

Returns :

A newly allocated CoglMatrixStack. [transfer full] +
+
+
+
+

cogl_matrix_stack_push ()

+
void                cogl_matrix_stack_push              (CoglMatrixStack *stack);
+

+Saves the current transform and starts a new transform that derives +from the current transform. +

+

+This is usually called while traversing a scenegraph whenever you +traverse one level deeper. cogl_matrix_stack_pop() can then be +called when going back up one layer to restore the previous +transform of an ancestor. +

+
++++ + + + + +

stack :

A CoglMatrixStack +
+
+
+
+

cogl_matrix_stack_pop ()

+
void                cogl_matrix_stack_pop               (CoglMatrixStack *stack);
+

+Restores the previous transform that was last saved by calling +cogl_matrix_stack_push(). +

+

+This is usually called while traversing a scenegraph whenever you +return up one level in the graph towards the root node. +

+
++++ + + + + +

stack :

A CoglMatrixStack +
+
+
+
+

cogl_matrix_stack_load_identity ()

+
void                cogl_matrix_stack_load_identity     (CoglMatrixStack *stack);
+

+Resets the current matrix to the identity matrix. +

+
++++ + + + + +

stack :

A CoglMatrixStack +
+
+
+
+

cogl_matrix_stack_scale ()

+
void                cogl_matrix_stack_scale             (CoglMatrixStack *stack,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current matrix by one that scales the x, y and z +axes by the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

x :

Amount to scale along the x-axis

y :

Amount to scale along the y-axis

z :

Amount to scale along the z-axis
+
+
+
+

cogl_matrix_stack_translate ()

+
void                cogl_matrix_stack_translate         (CoglMatrixStack *stack,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current matrix by one that translates along all +three axes according to the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

x :

Distance to translate along the x-axis

y :

Distance to translate along the y-axis

z :

Distance to translate along the z-axis
+
+
+
+

cogl_matrix_stack_rotate ()

+
void                cogl_matrix_stack_rotate            (CoglMatrixStack *stack,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies the current matrix by one that rotates the around the +axis-vector specified by x, y and z. The rotation follows the +right-hand thumb rule so for example rotating by 10 degrees about +the axis-vector (0, 0, 1) causes a small counter-clockwise +rotation. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

angle :

Angle in degrees to rotate.

x :

X-component of vertex to rotate around.

y :

Y-component of vertex to rotate around.

z :

Z-component of vertex to rotate around.
+
+
+
+

cogl_matrix_stack_rotate_quaternion ()

+
void                cogl_matrix_stack_rotate_quaternion (CoglMatrixStack *stack,
+                                                         const CoglQuaternion *quaternion);
+

+Multiplies the current matrix by one that rotates according to the +rotation described by quaternion. +

+
++++ + + + + + + + + + + +

stack :

A CoglMatrixStack +

quaternion :

A CoglQuaternion +
+
+
+
+

cogl_matrix_stack_rotate_euler ()

+
void                cogl_matrix_stack_rotate_euler      (CoglMatrixStack *stack,
+                                                         const CoglEuler *euler);
+

+Multiplies the current matrix by one that rotates according to the +rotation described by euler. +

+
++++ + + + + + + + + + + +

stack :

A CoglMatrixStack +

euler :

A CoglEuler +
+
+
+
+

cogl_matrix_stack_multiply ()

+
void                cogl_matrix_stack_multiply          (CoglMatrixStack *stack,
+                                                         const CoglMatrix *matrix);
+

+Multiplies the current matrix by the given matrix. +

+
++++ + + + + + + + + + + +

stack :

A CoglMatrixStack +

matrix :

the matrix to multiply with the current model-view
+
+
+
+

cogl_matrix_stack_frustum ()

+
void                cogl_matrix_stack_frustum           (CoglMatrixStack *stack,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+

+Replaces the current matrix with a perspective matrix for a given +viewing frustum defined by 4 side clip planes that all cross +through the origin and 2 near and far clip planes. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_stack_perspective ()

+
void                cogl_matrix_stack_perspective       (CoglMatrixStack *stack,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+

+Replaces the current matrix with a perspective matrix based on the +provided values. +

+

+

+
+

Note

You should be careful not to have too great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

fov_y :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive, +and must not be 0)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_stack_orthographic ()

+
void                cogl_matrix_stack_orthographic      (CoglMatrixStack *stack,
+                                                         float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float near,
+                                                         float far);
+

+Replaces the current matrix with an orthographic projection matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

x_1 :

The x coordinate for the first vertical clipping plane

y_1 :

The y coordinate for the first horizontal clipping plane

x_2 :

The x coordinate for the second vertical clipping plane

y_2 :

The y coordinate for the second horizontal clipping plane

near :

The distance to the near clipping +plane (will be negative if the plane is +behind the viewer)

far :

The distance to the far clipping +plane (will be negative if the plane is +behind the viewer)
+
+
+
+

cogl_matrix_stack_get_inverse ()

+
CoglBool            cogl_matrix_stack_get_inverse       (CoglMatrixStack *stack,
+                                                         CoglMatrix *inverse);
+

+Gets the inverse transform of the current matrix and uses it to +initialize a new CoglMatrix. +

+
++++ + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

inverse :

The destination for a 4x4 inverse transformation matrix. [out] +

Returns :

+TRUE if the inverse was successfully calculated or FALSE +for degenerate transformations that can't be inverted (in this case the +inverse matrix will simply be initialized with the identity matrix)
+
+
+
+

cogl_matrix_stack_get_entry ()

+
CoglMatrixEntry *   cogl_matrix_stack_get_entry         (CoglMatrixStack *stack);
+

+Gets a reference to the current transform represented by a +CoglMatrixEntry pointer. +

+

+

+
+

Note

The transform represented by a CoglMatrixEntry is +immutable.
+

+

+

+

+
+

Note

+CoglMatrixEntrys are reference counted using +cogl_matrix_entry_ref() and cogl_matrix_entry_unref() and you +should call cogl_matrix_entry_unref() when you are finished with +and entry you get via cogl_matrix_stack_get_entry().
+

+

+
++++ + + + + + + + + + + +

stack :

A CoglMatrixStack +

Returns :

A pointer to the CoglMatrixEntry +representing the current matrix stack transform. [transfer none] +
+
+
+
+

cogl_matrix_stack_get ()

+
CoglMatrix *        cogl_matrix_stack_get               (CoglMatrixStack *stack,
+                                                         CoglMatrix *matrix);
+

+Resolves the current stack transform into a CoglMatrix by +combining the operations that have been applied to build up the +current transform. +

+

+There are two possible ways that this function may return its +result depending on whether the stack is able to directly point +to an internal CoglMatrix or whether the result needs to be +composed of multiple operations. +

+

+If an internal matrix contains the required result then this +function will directly return a pointer to that matrix, otherwise +if the function returns NULL then matrix will be initialized +to match the current transform of stack. +

+

+

+
+

Note

+matrix will be left untouched if a direct pointer is +returned.
+

+

+
++++ + + + + + + + + + + + + + + +

stack :

A CoglMatrixStack +

matrix :

The potential destination for the current matrix. [out] +

Returns :

A direct pointer to the current transform or NULL +and in that case matrix will be initialized with +the value of the current transform.
+
+
+
+

cogl_matrix_entry_get ()

+
CoglMatrix *        cogl_matrix_entry_get               (CoglMatrixEntry *entry,
+                                                         CoglMatrix *matrix);
+

+Resolves the current entry transform into a CoglMatrix by +combining the sequence of operations that have been applied to +build up the current transform. +

+

+There are two possible ways that this function may return its +result depending on whether it's possible to directly point +to an internal CoglMatrix or whether the result needs to be +composed of multiple operations. +

+

+If an internal matrix contains the required result then this +function will directly return a pointer to that matrix, otherwise +if the function returns NULL then matrix will be initialized +to match the transform of entry. +

+

+

+
+

Note

+matrix will be left untouched if a direct pointer is +returned.
+

+

+
++++ + + + + + + + + + + + + + + +

entry :

A CoglMatrixEntry +

matrix :

The potential destination for the transform as +a matrix. [out] +

Returns :

A direct pointer to a CoglMatrix transform or NULL +and in that case matrix will be initialized with +the effective transform represented by entry.
+
+
+
+

cogl_matrix_stack_set ()

+
void                cogl_matrix_stack_set               (CoglMatrixStack *stack,
+                                                         const CoglMatrix *matrix);
+

+Replaces the current stack matrix value with the value of matrix. +This effectively discards any other operations that were applied +since the last time cogl_matrix_stack_push() was called or since +the stack was initialized. +

+
++++ + + + + + + + + + + +

stack :

A CoglMatrixStack +

matrix :

A CoglMatrix replace the current matrix value with
+
+
+
+

cogl_matrix_entry_calculate_translation ()

+
CoglBool            cogl_matrix_entry_calculate_translation
+                                                        (CoglMatrixEntry *entry0,
+                                                         CoglMatrixEntry *entry1,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z);
+

+Determines if the only difference between two transforms is a +translation and if so returns what the x, y, and z components of +the translation are. +

+

+If the difference between the two translations involves anything +other than a translation then the function returns FALSE. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

entry0 :

The first reference transform

entry1 :

A second reference transform

x :

The destination for the x-component of the translation. [out] +

y :

The destination for the y-component of the translation. [out] +

z :

The destination for the z-component of the translation. [out] +

Returns :

+TRUE if the only difference between the transform of +entry0 and the transform of entry1 is a translation, +otherwise FALSE.
+
+
+
+

cogl_matrix_entry_is_identity ()

+
CoglBool            cogl_matrix_entry_is_identity       (CoglMatrixEntry *entry);
+

+Determines whether entry is known to represent an identity +transform. +

+

+If this returns TRUE then the entry is definitely the identity +matrix. If it returns FALSE it may or may not be the identity +matrix but no expensive comparison is performed to verify it. +

+
++++ + + + + + + + + + + +

entry :

A CoglMatrixEntry +

Returns :

+TRUE if entry is definitely an identity transform, +otherwise FALSE.
+
+
+
+

cogl_matrix_entry_equal ()

+
CoglBool            cogl_matrix_entry_equal             (CoglMatrixEntry *entry0,
+                                                         CoglMatrixEntry *entry1);
+

+Compares two arbitrary CoglMatrixEntry transforms for equality +returning TRUE if they are equal or FALSE otherwise. +

+

+

+
+

Note

In many cases it is unnecessary to use this api and instead +direct pointer comparisons of entries are good enough and much +cheaper too.
+

+

+
++++ + + + + + + + + + + + + + + +

entry0 :

The first CoglMatrixEntry to compare

entry1 :

A second CoglMatrixEntry to compare

Returns :

+TRUE if entry0 represents the same transform as +entry1, otherwise FALSE.
+
+
+
+

cogl_matrix_entry_ref ()

+
CoglMatrixEntry *   cogl_matrix_entry_ref               (CoglMatrixEntry *entry);
+

+Takes a reference on the given entry to ensure the entry stays +alive and remains valid. When you are finished with the entry then +you should call cogl_matrix_entry_unref(). +

+

+It is an error to pass an entry pointer to cogl_object_ref() and +cogl_object_unref() +

+
++++ + + + + +

entry :

A CoglMatrixEntry +
+
+
+
+

cogl_matrix_entry_unref ()

+
void                cogl_matrix_entry_unref             (CoglMatrixEntry *entry);
+

+Releases a reference on entry either taken by calling +cogl_matrix_entry_unref() or to release the reference given when +calling cogl_matrix_stack_get_entry(). +

+
++++ + + + + +

entry :

A CoglMatrixEntry +
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html new file mode 100644 index 0000000..758aca6 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html @@ -0,0 +1,148 @@ + + + + +Offscreen Framebuffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Offscreen Framebuffers

+

Offscreen Framebuffers — Functions for creating and manipulating offscreen + framebuffers.

+
+ +
+

Description

+

+Cogl allows creating and operating on offscreen framebuffers. +

+
+
+

Details

+
+

CoglOffscreen

+
typedef struct _CoglOffscreen CoglOffscreen;
+
+
+
+

cogl_is_offscreen ()

+
CoglBool            cogl_is_offscreen                   (void *object);
+

+Determines whether the given CoglObject references an offscreen +framebuffer object. +

+
++++ + + + + + + + + + + +

object :

A pointer to a CoglObject +

Returns :

+TRUE if object is a CoglOffscreen framebuffer, +FALSE otherwise
+
+
+
+

cogl_offscreen_new_with_texture ()

+
CoglOffscreen *     cogl_offscreen_new_with_texture     (CoglTexture *texture);
+

+This creates an offscreen framebuffer object using the given +texture as the primary color buffer. It doesn't just initialize +the contents of the offscreen buffer with the texture; they are +tightly bound so that drawing to the offscreen buffer effectively +updates the contents of the given texture. You don't need to +destroy the offscreen buffer before you can use the texture again. +

+

+

+
+

Note

This api only works with low-level CoglTexture types such as +CoglTexture2D, CoglTexture3D and CoglTextureRectangle, and not +with meta-texture types such as CoglTexture2DSliced.
+

+

+

+The storage for the framebuffer is actually allocated lazily +so this function will never return NULL to indicate a runtime +error. This means it is still possible to configure the framebuffer +before it is really allocated. +

+

+Simple applications without full error handling can simply rely on +Cogl to lazily allocate the storage of framebuffers but you should +be aware that if Cogl encounters an error (such as running out of +GPU memory) then your application will simply abort with an error +message. If you need to be able to catch such exceptions at runtime +then you can explicitly allocate your framebuffer when you have +finished configuring it by calling cogl_framebuffer_allocate() and +passing in a CoglError argument to catch any exceptions. +

+
++++ + + + + + + + + + + +

texture :

A CoglTexture pointer

Returns :

a newly instantiated CoglOffscreen +framebuffer. [transfer full] +
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Path-Primitives.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Path-Primitives.html new file mode 100644 index 0000000..1595914 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Path-Primitives.html @@ -0,0 +1,53 @@ + + + + +Path Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Path Primitives

+

Path Primitives

+
+
+

Synopsis

+

+
+
+

Description

+
+
+

Details

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Pipeline.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Pipeline.html new file mode 100644 index 0000000..a94b8df --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Pipeline.html @@ -0,0 +1,3052 @@ + + + + +Pipeline + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Pipeline

+

Pipeline — Functions for creating and manipulating the GPU + pipeline

+
+
+

Synopsis

+
                    CoglPipeline;
+CoglPipeline *      cogl_pipeline_new                   (CoglContext *context);
+CoglPipeline *      cogl_pipeline_copy                  (CoglPipeline *source);
+CoglBool            cogl_is_pipeline                    (void *object);
+void                cogl_pipeline_set_color             (CoglPipeline *pipeline,
+                                                         const CoglColor *color);
+void                cogl_pipeline_set_color4ub          (CoglPipeline *pipeline,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_pipeline_set_color4f           (CoglPipeline *pipeline,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+void                cogl_pipeline_get_color             (CoglPipeline *pipeline,
+                                                         CoglColor *color);
+void                cogl_pipeline_set_ambient           (CoglPipeline *pipeline,
+                                                         const CoglColor *ambient);
+void                cogl_pipeline_get_ambient           (CoglPipeline *pipeline,
+                                                         CoglColor *ambient);
+void                cogl_pipeline_set_diffuse           (CoglPipeline *pipeline,
+                                                         const CoglColor *diffuse);
+void                cogl_pipeline_get_diffuse           (CoglPipeline *pipeline,
+                                                         CoglColor *diffuse);
+void                cogl_pipeline_set_ambient_and_diffuse
+                                                        (CoglPipeline *pipeline,
+                                                         const CoglColor *color);
+void                cogl_pipeline_set_emission          (CoglPipeline *pipeline,
+                                                         const CoglColor *emission);
+void                cogl_pipeline_get_emission          (CoglPipeline *pipeline,
+                                                         CoglColor *emission);
+void                cogl_pipeline_set_specular          (CoglPipeline *pipeline,
+                                                         const CoglColor *specular);
+void                cogl_pipeline_get_specular          (CoglPipeline *pipeline,
+                                                         CoglColor *specular);
+void                cogl_pipeline_set_shininess         (CoglPipeline *pipeline,
+                                                         float shininess);
+float               cogl_pipeline_get_shininess         (CoglPipeline *pipeline);
+enum                CoglPipelineAlphaFunc;
+void                cogl_pipeline_set_alpha_test_function
+                                                        (CoglPipeline *pipeline,
+                                                         CoglPipelineAlphaFunc alpha_func,
+                                                         float alpha_reference);
+#define             COGL_BLEND_STRING_ERROR
+enum                CoglBlendStringError;
+CoglBool            cogl_pipeline_set_blend             (CoglPipeline *pipeline,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+void                cogl_pipeline_set_blend_constant    (CoglPipeline *pipeline,
+                                                         const CoglColor *constant_color);
+void                cogl_pipeline_set_point_size        (CoglPipeline *pipeline,
+                                                         float point_size);
+float               cogl_pipeline_get_point_size        (CoglPipeline *pipeline);
+CoglBool            cogl_pipeline_set_per_vertex_point_size
+                                                        (CoglPipeline *pipeline,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+CoglBool            cogl_pipeline_get_per_vertex_point_size
+                                                        (CoglPipeline *pipeline);
+CoglColorMask       cogl_pipeline_get_color_mask        (CoglPipeline *pipeline);
+void                cogl_pipeline_set_color_mask        (CoglPipeline *pipeline,
+                                                         CoglColorMask color_mask);
+CoglBool            cogl_pipeline_set_depth_state       (CoglPipeline *pipeline,
+                                                         const CoglDepthState *state,
+                                                         CoglError **error);
+void                cogl_pipeline_get_depth_state       (CoglPipeline *pipeline,
+                                                         CoglDepthState *state_out);
+enum                CoglPipelineCullFaceMode;
+void                cogl_pipeline_set_cull_face_mode    (CoglPipeline *pipeline,
+                                                         CoglPipelineCullFaceMode cull_face_mode);
+enum                CoglWinding;
+void                cogl_pipeline_set_front_face_winding
+                                                        (CoglPipeline *pipeline,
+                                                         CoglWinding front_winding);
+void                cogl_pipeline_set_layer_texture     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglTexture *texture);
+void                cogl_pipeline_set_layer_null_texture
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglTextureType texture_type);
+CoglTexture *       cogl_pipeline_get_layer_texture     (CoglPipeline *pipeline,
+                                                         int layer_index);
+enum                CoglPipelineFilter;
+void                cogl_pipeline_set_layer_filters     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineFilter min_filter,
+                                                         CoglPipelineFilter mag_filter);
+CoglPipelineFilter  cogl_pipeline_get_layer_min_filter  (CoglPipeline *pipeline,
+                                                         int layer_index);
+CoglPipelineFilter  cogl_pipeline_get_layer_mag_filter  (CoglPipeline *pipeline,
+                                                         int layer_index);
+enum                CoglPipelineWrapMode;
+void                cogl_pipeline_set_layer_wrap_mode   (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+void                cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+void                cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+void                cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+CoglBool            cogl_pipeline_set_layer_combine     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+void                cogl_pipeline_set_layer_combine_constant
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const CoglColor *constant);
+void                cogl_pipeline_set_layer_matrix      (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const CoglMatrix *matrix);
+CoglBool            cogl_pipeline_set_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+CoglBool            cogl_pipeline_get_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index);
+void                cogl_pipeline_remove_layer          (CoglPipeline *pipeline,
+                                                         int layer_index);
+int                 cogl_pipeline_get_n_layers          (CoglPipeline *pipeline);
+CoglBool            (*CoglPipelineLayerCallback)        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         void *user_data);
+void                cogl_pipeline_foreach_layer         (CoglPipeline *pipeline,
+                                                         CoglPipelineLayerCallback callback,
+                                                         void *user_data);
+int                 cogl_pipeline_get_uniform_location  (CoglPipeline *pipeline,
+                                                         const char *uniform_name);
+void                cogl_pipeline_set_uniform_1f        (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         float value);
+void                cogl_pipeline_set_uniform_1i        (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int value);
+void                cogl_pipeline_set_uniform_float     (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const float *value);
+void                cogl_pipeline_set_uniform_int       (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const int *value);
+void                cogl_pipeline_set_uniform_matrix    (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int dimensions,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+void                cogl_pipeline_add_snippet           (CoglPipeline *pipeline,
+                                                         CoglSnippet *snippet);
+void                cogl_pipeline_add_layer_snippet     (CoglPipeline *pipeline,
+                                                         int layer,
+                                                         CoglSnippet *snippet);
+
+
+
+

Description

+

+Cogl allows creating and manipulating objects representing the full +configuration of the GPU pipeline. In simplified terms the GPU +pipeline takes primitive geometry as the input, it first performs +vertex processing, allowing you to deform your geometry, then +rasterizes that (turning it from pure geometry into fragments) then +performs fragment processing including depth testing and texture +mapping. Finally it blends the result with the framebuffer. +

+
+
+

Details

+
+

CoglPipeline

+
typedef struct _CoglPipeline CoglPipeline;
+
+
+
+

cogl_pipeline_new ()

+
CoglPipeline *      cogl_pipeline_new                   (CoglContext *context);
+

+Allocates and initializes a default simple pipeline that will color +a primitive white. +

+
++++ + + + + + + + + + + +

context :

a CoglContext +

Returns :

a pointer to a new CoglPipeline. [transfer full] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_copy ()

+
CoglPipeline *      cogl_pipeline_copy                  (CoglPipeline *source);
+

+Creates a new pipeline with the configuration copied from the +source pipeline. +

+

+We would strongly advise developers to always aim to use +cogl_pipeline_copy() instead of cogl_pipeline_new() whenever there will +be any similarity between two pipelines. Copying a pipeline helps Cogl +keep track of a pipelines ancestry which we may use to help minimize GPU +state changes. +

+
++++ + + + + + + + + + + +

source :

a CoglPipeline object to copy

Returns :

a pointer to the newly allocated CoglPipeline. [transfer full] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_is_pipeline ()

+
CoglBool            cogl_is_pipeline                    (void *object);
+

+Gets whether the given object references an existing pipeline object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglPipeline, +FALSE otherwise
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_color ()

+
void                cogl_pipeline_set_color             (CoglPipeline *pipeline,
+                                                         const CoglColor *color);
+

+Sets the basic color of the pipeline, used when no lighting is enabled. +

+

+Note that if you don't add any layers to the pipeline then the color +will be blended unmodified with the destination; the default blend +expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for +semi-transparent red. See cogl_color_premultiply(). +

+

+The default value is (1.0, 1.0, 1.0, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

color :

The components of the color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_color4ub ()

+
void                cogl_pipeline_set_color4ub          (CoglPipeline *pipeline,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+

+Sets the basic color of the pipeline, used when no lighting is enabled. +

+

+The default value is (0xff, 0xff, 0xff, 0xff) +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

red :

The red component

green :

The green component

blue :

The blue component

alpha :

The alpha component
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_color4f ()

+
void                cogl_pipeline_set_color4f           (CoglPipeline *pipeline,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+

+Sets the basic color of the pipeline, used when no lighting is enabled. +

+

+The default value is (1.0, 1.0, 1.0, 1.0) +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

red :

The red component

green :

The green component

blue :

The blue component

alpha :

The alpha component
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_color ()

+
void                cogl_pipeline_get_color             (CoglPipeline *pipeline,
+                                                         CoglColor *color);
+

+Retrieves the current pipeline color. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

color :

The location to store the color. [out] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_ambient ()

+
void                cogl_pipeline_set_ambient           (CoglPipeline *pipeline,
+                                                         const CoglColor *ambient);
+

+Sets the pipeline's ambient color, in the standard OpenGL lighting +model. The ambient color affects the overall color of the object. +

+

+Since the diffuse color will be intense when the light hits the surface +directly, the ambient will be most apparent where the light hits at a +slant. +

+

+The default value is (0.2, 0.2, 0.2, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

ambient :

The components of the desired ambient color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_ambient ()

+
void                cogl_pipeline_get_ambient           (CoglPipeline *pipeline,
+                                                         CoglColor *ambient);
+

+Retrieves the current ambient color for pipeline +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

ambient :

The location to store the ambient color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_diffuse ()

+
void                cogl_pipeline_set_diffuse           (CoglPipeline *pipeline,
+                                                         const CoglColor *diffuse);
+

+Sets the pipeline's diffuse color, in the standard OpenGL lighting +model. The diffuse color is most intense where the light hits the +surface directly - perpendicular to the surface. +

+

+The default value is (0.8, 0.8, 0.8, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

diffuse :

The components of the desired diffuse color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_diffuse ()

+
void                cogl_pipeline_get_diffuse           (CoglPipeline *pipeline,
+                                                         CoglColor *diffuse);
+

+Retrieves the current diffuse color for pipeline +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

diffuse :

The location to store the diffuse color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_ambient_and_diffuse ()

+
void                cogl_pipeline_set_ambient_and_diffuse
+                                                        (CoglPipeline *pipeline,
+                                                         const CoglColor *color);
+

+Conveniently sets the diffuse and ambient color of pipeline at the same +time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse(). +

+

+The default ambient color is (0.2, 0.2, 0.2, 1.0) +

+

+The default diffuse color is (0.8, 0.8, 0.8, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

color :

The components of the desired ambient and diffuse colors
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_emission ()

+
void                cogl_pipeline_set_emission          (CoglPipeline *pipeline,
+                                                         const CoglColor *emission);
+

+Sets the pipeline's emissive color, in the standard OpenGL lighting +model. It will look like the surface is a light source emitting this +color. +

+

+The default value is (0.0, 0.0, 0.0, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

emission :

The components of the desired emissive color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_emission ()

+
void                cogl_pipeline_get_emission          (CoglPipeline *pipeline,
+                                                         CoglColor *emission);
+

+Retrieves the pipelines current emission color. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

emission :

The location to store the emission color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_specular ()

+
void                cogl_pipeline_set_specular          (CoglPipeline *pipeline,
+                                                         const CoglColor *specular);
+

+Sets the pipeline's specular color, in the standard OpenGL lighting +model. The intensity of the specular color depends on the viewport +position, and is brightest along the lines of reflection. +

+

+The default value is (0.0, 0.0, 0.0, 1.0) +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

specular :

The components of the desired specular color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_specular ()

+
void                cogl_pipeline_get_specular          (CoglPipeline *pipeline,
+                                                         CoglColor *specular);
+

+Retrieves the pipelines current specular color. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

specular :

The location to store the specular color
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_shininess ()

+
void                cogl_pipeline_set_shininess         (CoglPipeline *pipeline,
+                                                         float shininess);
+

+Sets the shininess of the pipeline, in the standard OpenGL lighting +model, which determines the size of the specular highlights. A +higher shininess will produce smaller highlights which makes the +object appear more shiny. +

+

+The default value is 0.0 +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

shininess :

The desired shininess; must be >= 0.0
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_shininess ()

+
float               cogl_pipeline_get_shininess         (CoglPipeline *pipeline);
+

+Retrieves the pipelines current emission color. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

Returns :

The pipelines current shininess value
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

enum CoglPipelineAlphaFunc

+
typedef enum {
+  COGL_PIPELINE_ALPHA_FUNC_NEVER    = 0x0200,
+  COGL_PIPELINE_ALPHA_FUNC_LESS	    = 0x0201,
+  COGL_PIPELINE_ALPHA_FUNC_EQUAL    = 0x0202,
+  COGL_PIPELINE_ALPHA_FUNC_LEQUAL   = 0x0203,
+  COGL_PIPELINE_ALPHA_FUNC_GREATER  = 0x0204,
+  COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL = 0x0205,
+  COGL_PIPELINE_ALPHA_FUNC_GEQUAL   = 0x0206,
+  COGL_PIPELINE_ALPHA_FUNC_ALWAYS   = 0x0207
+} CoglPipelineAlphaFunc;
+
+

+Alpha testing happens before blending primitives with the framebuffer and +gives an opportunity to discard fragments based on a comparison with the +incoming alpha value and a reference alpha value. The CoglPipelineAlphaFunc +determines how the comparison is done. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_PIPELINE_ALPHA_FUNC_NEVER

Never let the fragment through. +

COGL_PIPELINE_ALPHA_FUNC_LESS

Let the fragment through if the incoming + alpha value is less than the reference alpha value +

COGL_PIPELINE_ALPHA_FUNC_EQUAL

Let the fragment through if the incoming + alpha value equals the reference alpha value +

COGL_PIPELINE_ALPHA_FUNC_LEQUAL

Let the fragment through if the incoming + alpha value is less than or equal to the reference alpha value +

COGL_PIPELINE_ALPHA_FUNC_GREATER

Let the fragment through if the incoming + alpha value is greater than the reference alpha value +

COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL

Let the fragment through if the incoming + alpha value does not equal the reference alpha value +

COGL_PIPELINE_ALPHA_FUNC_GEQUAL

Let the fragment through if the incoming + alpha value is greater than or equal to the reference alpha value. +

COGL_PIPELINE_ALPHA_FUNC_ALWAYS

Always let the fragment through. +
+
+
+
+

cogl_pipeline_set_alpha_test_function ()

+
void                cogl_pipeline_set_alpha_test_function
+                                                        (CoglPipeline *pipeline,
+                                                         CoglPipelineAlphaFunc alpha_func,
+                                                         float alpha_reference);
+

+Before a primitive is blended with the framebuffer, it goes through an +alpha test stage which lets you discard fragments based on the current +alpha value. This function lets you change the function used to evaluate +the alpha channel, and thus determine which fragments are discarded +and which continue on to the blending stage. +

+

+The default is COGL_PIPELINE_ALPHA_FUNC_ALWAYS +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

alpha_func :

A CoglPipelineAlphaFunc constant

alpha_reference :

A reference point that the chosen alpha function uses +to compare incoming fragments to.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

COGL_BLEND_STRING_ERROR

+
#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ())
+
+

+CoglError domain for blend string parser errors +

+

Since 1.0

+
+
+
+

enum CoglBlendStringError

+
typedef enum {
+ /*< prefix=COGL_BLEND_STRING_ERROR >*/
+  COGL_BLEND_STRING_ERROR_PARSE_ERROR,
+  COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
+  COGL_BLEND_STRING_ERROR_INVALID_ERROR,
+  COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
+} CoglBlendStringError;
+
+

+Error enumeration for the blend strings parser +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_BLEND_STRING_ERROR_PARSE_ERROR

Generic parse error +

COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR

Argument parse error +

COGL_BLEND_STRING_ERROR_INVALID_ERROR

Internal parser error +

COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR

Blend string not + supported by the GPU +
+

Since 1.0

+
+
+
+

cogl_pipeline_set_blend ()

+
CoglBool            cogl_pipeline_set_blend             (CoglPipeline *pipeline,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+

+If not already familiar; please refer here +for an overview of what blend strings are, and their syntax. +

+

+Blending occurs after the alpha test function, and combines fragments with +the framebuffer. +

+

+Currently the only blend function Cogl exposes is ADD(). So any valid +blend statements will be of the form: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+<channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
+
+ +

+

+

+This is the list of source-names usable as blend factors: +

+
+

+

+

+The source names can be used according to the +color-source and factor syntax, +so for example "(1-SRC_COLOR[A])" would be a valid factor, as would +"(CONSTANT[RGB])" +

+

+These can also be used as factors: +

+
    +
  • 0: (0, 0, 0, 0)
  • +
  • 1: (1, 1, 1, 1)
  • +
  • SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])
  • +
+

+

+

+

+
+

Note

Remember; all color components are normalized to the range [0, 1] +before computing the result of blending.
+

+

+

+

+
+

Example 1. Blend Strings/1

+
+

Blend a non-premultiplied source over a destination with + premultiplied alpha:

+
+"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
+"A   = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
+  
+
+
+


+

+

+

+
+

Example 2. Blend Strings/2

+
+

Blend a premultiplied source over a destination with + premultiplied alpha

+
+"RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
+  
+
+
+


+

+

+The default blend string is: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
+
+ +

+

+

+That gives normal alpha-blending when the calculated color for the pipeline +is in premultiplied form. +

+
++++ + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

blend_string :

A Cogl blend string +describing the desired blend function.

error :

return location for a CoglError that may report lack of driver +support if you give separate blend string statements for the alpha +channel and RGB channels since some drivers, or backends such as +GLES 1.1, don't support this feature. May be NULL, in which case a +warning will be printed out using GLib's logging facilities if an +error is encountered.

Returns :

+TRUE if the blend string was successfully parsed, and the +described blending is supported by the underlying driver/hardware. If +there was an error, FALSE is returned and error is set accordingly (if +present).
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_blend_constant ()

+
void                cogl_pipeline_set_blend_constant    (CoglPipeline *pipeline,
+                                                         const CoglColor *constant_color);
+

+When blending is setup to reference a CONSTANT blend factor then +blending will depend on the constant set with this function. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

constant_color :

The constant color you want
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_point_size ()

+
void                cogl_pipeline_set_point_size        (CoglPipeline *pipeline,
+                                                         float point_size);
+

+Changes the size of points drawn when COGL_VERTICES_MODE_POINTS is +used with the attribute buffer API. Note that typically the GPU +will only support a limited minimum and maximum range of point +sizes. If the chosen point size is outside that range then the +nearest value within that range will be used instead. The size of a +point is in screen space so it will be the same regardless of any +transformations. +

+

+If the point size is set to 0.0 then drawing points with the +pipeline will have undefined results. This is the default value so +if an application wants to draw points it must make sure to use a +pipeline that has an explicit point size set on it. +

+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline pointer

point_size :

the new point size.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_point_size ()

+
float               cogl_pipeline_get_point_size        (CoglPipeline *pipeline);
+

+Get the size of points drawn when COGL_VERTICES_MODE_POINTS is +used with the vertex buffer API. +

+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline pointer

Returns :

the point size of the pipeline.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_per_vertex_point_size ()

+
CoglBool            cogl_pipeline_set_per_vertex_point_size
+                                                        (CoglPipeline *pipeline,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+

+Sets whether to use a per-vertex point size or to use the value set +by cogl_pipeline_set_point_size(). If per-vertex point size is +enabled then the point size can be set for an individual point +either by drawing with a CoglAttribute with the name +‘cogl_point_size_in’ or by writing to the GLSL builtin +‘cogl_point_size_out’ from a vertex shader snippet. +

+

+If per-vertex point size is enabled and this attribute is not used +and cogl_point_size_out is not written to then the results are +undefined. +

+

+Note that enabling this will only work if the +COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE feature is available. If +this is not available then the function will return FALSE and set +a CoglError. +

+
++++ + + + + + + + + + + + + + + + + + + +

pipeline :

a CoglPipeline pointer

enable :

whether to enable per-vertex point size

error :

a location to store a CoglError if the change failed

Returns :

+TRUE if the change suceeded or FALSE otherwise
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_per_vertex_point_size ()

+
CoglBool            cogl_pipeline_get_per_vertex_point_size
+                                                        (CoglPipeline *pipeline);
+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline pointer

Returns :

+TRUE if the pipeline has per-vertex point size +enabled or FALSE otherwise. The per-vertex point size can be +enabled with cogl_pipeline_set_per_vertex_point_size().
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_color_mask ()

+
CoglColorMask       cogl_pipeline_get_color_mask        (CoglPipeline *pipeline);
+

+Gets the current CoglColorMask of which channels would be written to the +current framebuffer. Each bit set in the mask means that the +corresponding color would be written. +

+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline object.

Returns :

A CoglColorMask +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_color_mask ()

+
void                cogl_pipeline_set_color_mask        (CoglPipeline *pipeline,
+                                                         CoglColorMask color_mask);
+

+Defines a bit mask of which color channels should be written to the +current framebuffer. If a bit is set in color_mask that means that +color will be written. +

+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline object.

color_mask :

A CoglColorMask of which color channels to write to +the current framebuffer.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_depth_state ()

+
CoglBool            cogl_pipeline_set_depth_state       (CoglPipeline *pipeline,
+                                                         const CoglDepthState *state,
+                                                         CoglError **error);
+

+This commits all the depth state configured in state struct to the +given pipeline. The configuration values are copied into the +pipeline so there is no requirement to keep the CoglDepthState +struct around if you don't need it any more. +

+

+Note: Since some platforms do not support the depth range feature +it is possible for this function to fail and report an error. +

+
++++ + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

state :

A CoglDepthState struct

error :

A CoglError to report failures to setup the given state.

Returns :

TRUE if the GPU supports all the given state else FALSE +and returns an error.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_depth_state ()

+
void                cogl_pipeline_get_depth_state       (CoglPipeline *pipeline,
+                                                         CoglDepthState *state_out);
+

+Retrieves the current depth state configuration for the given +pipeline as previously set using cogl_pipeline_set_depth_state(). +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

state_out :

A destination CoglDepthState struct. [out] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

enum CoglPipelineCullFaceMode

+
typedef enum {
+  COGL_PIPELINE_CULL_FACE_MODE_NONE,
+  COGL_PIPELINE_CULL_FACE_MODE_FRONT,
+  COGL_PIPELINE_CULL_FACE_MODE_BACK,
+  COGL_PIPELINE_CULL_FACE_MODE_BOTH
+} CoglPipelineCullFaceMode;
+
+

+Specifies which faces should be culled. This can be set on a +pipeline using cogl_pipeline_set_cull_face_mode(). +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_PIPELINE_CULL_FACE_MODE_NONE

Neither face will be + culled. This is the default. +

COGL_PIPELINE_CULL_FACE_MODE_FRONT

Front faces will be culled. +

COGL_PIPELINE_CULL_FACE_MODE_BACK

Back faces will be culled. +

COGL_PIPELINE_CULL_FACE_MODE_BOTH

All faces will be culled. +
+
+
+
+

cogl_pipeline_set_cull_face_mode ()

+
void                cogl_pipeline_set_cull_face_mode    (CoglPipeline *pipeline,
+                                                         CoglPipelineCullFaceMode cull_face_mode);
+

+Sets which faces will be culled when drawing. Face culling can be +used to increase efficiency by avoiding drawing faces that would +get overridden. For example, if a model has gaps so that it is +impossible to see the inside then faces which are facing away from +the screen will never be seen so there is no point in drawing +them. This can be acheived by setting the cull face mode to +COGL_PIPELINE_CULL_FACE_MODE_BACK. +

+

+Face culling relies on the primitives being drawn with a specific +order to represent which faces are facing inside and outside the +model. This order can be specified by calling +cogl_pipeline_set_front_face_winding(). +

+

+Status: Unstable +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline +

cull_face_mode :

The new mode to set
+

Since 2.0

+
+
+
+

enum CoglWinding

+
typedef enum {
+  COGL_WINDING_CLOCKWISE,
+  COGL_WINDING_COUNTER_CLOCKWISE
+} CoglWinding;
+
+

+Enum used to represent the two directions of rotation. This can be +used to set the front face for culling by calling +cogl_pipeline_set_front_face_winding(). +

+
++++ + + + + + + + + + + +

COGL_WINDING_CLOCKWISE

Vertices are in a clockwise order +

COGL_WINDING_COUNTER_CLOCKWISE

Vertices are in a counter-clockwise order +
+
+
+
+

cogl_pipeline_set_front_face_winding ()

+
void                cogl_pipeline_set_front_face_winding
+                                                        (CoglPipeline *pipeline,
+                                                         CoglWinding front_winding);
+

+The order of the vertices within a primitive specifies whether it +is considered to be front or back facing. This function specifies +which order is considered to be the front +faces. COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to +primitives with vertices in a counter-clockwise order and +COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is +COGL_WINDING_COUNTER_CLOCKWISE. +

+

+Status: Unstable +

+
++++ + + + + + + + + + + +

pipeline :

a CoglPipeline +

front_winding :

the winding order
+

Since 2.0

+
+
+
+

cogl_pipeline_set_layer_texture ()

+
void                cogl_pipeline_set_layer_texture     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglTexture *texture);
+
+
+
+

cogl_pipeline_set_layer_null_texture ()

+
void                cogl_pipeline_set_layer_null_texture
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglTextureType texture_type);
+

+Sets the texture for this layer to be the default texture for the +given type. This is equivalent to calling +cogl_pipeline_set_layer_texture() with NULL for the texture +argument except that you can also specify the type of default +texture to use. The default texture is a 1x1 pixel white texture. +

+

+This function is mostly useful if you want to create a base +pipeline that you want to create multiple copies from using +cogl_pipeline_copy(). In that case this function can be used to +specify the texture type so that any pipeline copies can share the +internal texture type state for efficiency. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline +

layer_index :

The layer number to modify

texture_type :

The type of the default texture to use
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_layer_texture ()

+
CoglTexture *       cogl_pipeline_get_layer_texture     (CoglPipeline *pipeline,
+                                                         int layer_index);
+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the index of the layer

Returns :

the texture that was set for the +given layer of the pipeline or NULL if no texture was set. [transfer none] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

enum CoglPipelineFilter

+
typedef enum {
+  COGL_PIPELINE_FILTER_NEAREST = 0x2600,
+  COGL_PIPELINE_FILTER_LINEAR = 0x2601,
+  COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700,
+  COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701,
+  COGL_PIPELINE_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702,
+  COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703
+} CoglPipelineFilter;
+
+

+Texture filtering is used whenever the current pixel maps either to more +than one texture element (texel) or less than one. These filter enums +correspond to different strategies used to come up with a pixel color, by +possibly referring to multiple neighbouring texels and taking a weighted +average or simply using the nearest texel. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_PIPELINE_FILTER_NEAREST

Measuring in manhatten distance from the, + current pixel center, use the nearest texture texel +

COGL_PIPELINE_FILTER_LINEAR

Use the weighted average of the 4 texels + nearest the current pixel center +

COGL_PIPELINE_FILTER_NEAREST_MIPMAP_NEAREST

Select the mimap level whose + texel size most closely matches the current pixel, and use the + COGL_PIPELINE_FILTER_NEAREST criterion +

COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST

Select the mimap level whose + texel size most closely matches the current pixel, and use the + COGL_PIPELINE_FILTER_LINEAR criterion +

COGL_PIPELINE_FILTER_NEAREST_MIPMAP_LINEAR

Select the two mimap levels + whose texel size most closely matches the current pixel, use + the COGL_PIPELINE_FILTER_NEAREST criterion on each one and take + their weighted average +

COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR

Select the two mimap levels + whose texel size most closely matches the current pixel, use + the COGL_PIPELINE_FILTER_LINEAR criterion on each one and take + their weighted average +
+
+
+
+

cogl_pipeline_set_layer_filters ()

+
void                cogl_pipeline_set_layer_filters     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineFilter min_filter,
+                                                         CoglPipelineFilter mag_filter);
+

+Changes the decimation and interpolation filters used when a texture is +drawn at other scales than 100%. +

+

+

+
+

Note

It is an error to pass anything other than +COGL_PIPELINE_FILTER_NEAREST or COGL_PIPELINE_FILTER_LINEAR as +magnification filters since magnification doesn't ever need to +reference values stored in the mipmap chain.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

min_filter :

the filter used when scaling a texture down.

mag_filter :

the filter used when magnifying a texture.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_layer_min_filter ()

+
CoglPipelineFilter  cogl_pipeline_get_layer_min_filter  (CoglPipeline *pipeline,
+                                                         int layer_index);
+

+Retrieves the currently set minification CoglPipelineFilter set on +the specified layer. The miniifcation filter determines how the +layer should be sampled when down-scaled. +

+

+The default filter is COGL_PIPELINE_FILTER_LINEAR but this can be +changed using cogl_pipeline_set_layer_filters(). +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

Returns :

The minification CoglPipelineFilter for the +specified layer.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_layer_mag_filter ()

+
CoglPipelineFilter  cogl_pipeline_get_layer_mag_filter  (CoglPipeline *pipeline,
+                                                         int layer_index);
+

+Retrieves the currently set magnification CoglPipelineFilter set on +the specified layer. The magnification filter determines how the +layer should be sampled when up-scaled. +

+

+The default filter is COGL_PIPELINE_FILTER_LINEAR but this can be +changed using cogl_pipeline_set_layer_filters(). +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

Returns :

The magnification CoglPipelineFilter for the +specified layer.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

enum CoglPipelineWrapMode

+
typedef enum {
+  COGL_PIPELINE_WRAP_MODE_REPEAT = 0x2901,
+  COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT = 0x8370,
+  COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE = 0x812F,
+  COGL_PIPELINE_WRAP_MODE_AUTOMATIC = 0x0207 /* GL_ALWAYS */
+} CoglPipelineWrapMode;
+
+

+The wrap mode specifies what happens when texture coordinates +outside the range 0→1 are used. Note that if the filter mode is +anything but COGL_PIPELINE_FILTER_NEAREST then texels outside the +range 0→1 might be used even when the coordinate is exactly 0 or 1 +because OpenGL will try to sample neighbouring pixels. For example +if you are trying to render the full texture then you may get +artifacts around the edges when the pixels from the other side are +merged in if the wrap mode is set to repeat. +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_PIPELINE_WRAP_MODE_REPEAT

The texture will be repeated. This + is useful for example to draw a tiled background. +

COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT

COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE

The coordinates outside the + range 0→1 will sample copies of the edge pixels of the + texture. This is useful to avoid artifacts if only one copy of + the texture is being rendered. +

COGL_PIPELINE_WRAP_MODE_AUTOMATIC

Cogl will try to automatically + decide which of the above two to use. For cogl_rectangle(), it + will use repeat mode if any of the texture coordinates are + outside the range 0→1, otherwise it will use clamp to edge. For + cogl_polygon() it will always use repeat mode. For + cogl_vertex_buffer_draw() it will use repeat mode except for + layers that have point sprite coordinate generation enabled. This + is the default value. +
+

Since 2.0

+
+
+
+

cogl_pipeline_set_layer_wrap_mode ()

+
void                cogl_pipeline_set_layer_wrap_mode   (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+

+Sets the wrap mode for all three coordinates of texture lookups on +this layer. This is equivalent to calling +cogl_pipeline_set_layer_wrap_mode_s(), +cogl_pipeline_set_layer_wrap_mode_t() and +cogl_pipeline_set_layer_wrap_mode_p() separately. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_wrap_mode_s ()

+
void                cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+

+Sets the wrap mode for the 's' coordinate of texture lookups on this layer. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_wrap_mode_t ()

+
void                cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+

+Sets the wrap mode for the 't' coordinate of texture lookups on this layer. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_wrap_mode_p ()

+
void                cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglPipelineWrapMode mode);
+

+Sets the wrap mode for the 'p' coordinate of texture lookups on +this layer. 'p' is the third coordinate. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_combine ()

+
CoglBool            cogl_pipeline_set_layer_combine     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+

+If not already familiar; you can refer +here for an overview of what blend +strings are and there syntax. +

+

+These are all the functions available for texture combining: +

+
    +
  • REPLACE(arg0) = arg0
  • +
  • MODULATE(arg0, arg1) = arg0 x arg1
  • +
  • ADD(arg0, arg1) = arg0 + arg1
  • +
  • ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5
  • +
  • INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)
  • +
  • SUBTRACT(arg0, arg1) = arg0 - arg1
  • +
  • + DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    +                             (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    +                             (arg0[B] - 0.5)) * (arg1[B] - 0.5))
    +    
  • +
  • + DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    +                              (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    +                              (arg0[B] - 0.5)) * (arg1[B] - 0.5))
    +    
  • +
+

+

+

+Refer to the +color-source syntax for +describing the arguments. The valid source names for texture combining +are: +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

TEXTURE

Use the color from the current texture layer

TEXTURE_0, TEXTURE_1, etc

Use the color from the specified texture layer

CONSTANT

Use the color from the constant given with + cogl_pipeline_set_layer_combine_constant() +

PRIMARY

Use the color of the pipeline as set with + cogl_pipeline_set_color() +

PREVIOUS

Either use the texture color from the previous layer, or + if this is layer 0, use the color of the pipeline as set with + cogl_pipeline_set_color() +
+

+

+

+

+
+

Layer Combine Examples

+

This is effectively what the default blending is:

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = MODULATE (PREVIOUS, TEXTURE)
+
+ +

This could be used to cross-fade between two images, using + the alpha component of a constant as the interpolator. The constant + color is given by calling + cogl_pipeline_set_layer_combine_constant().

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
+
+ +
+

+

+

+

+
+

Note

You can't give a multiplication factor for arguments as you can +with blending.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

Specifies the layer you want define a combine function for

blend_string :

A Cogl blend string +describing the desired texture combine function.

error :

A CoglError that may report parse errors or lack of GPU/driver +support. May be NULL, in which case a warning will be printed out if an +error is encountered.

Returns :

+TRUE if the blend string was successfully parsed, and the +described texture combining is supported by the underlying driver and +or hardware. On failure, FALSE is returned and error is set
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_combine_constant ()

+
void                cogl_pipeline_set_layer_combine_constant
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const CoglColor *constant);
+

+When you are using the 'CONSTANT' color source in a layer combine +description then you can use this function to define its value. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

Specifies the layer you want to specify a constant used +for texture combining

constant :

The constant color you want
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_matrix ()

+
void                cogl_pipeline_set_layer_matrix      (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const CoglMatrix *matrix);
+

+This function lets you set a matrix that can be used to e.g. translate +and rotate a single layer of a pipeline used to fill your geometry. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the index for the layer inside pipeline +

matrix :

the transformation matrix for the layer
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_layer_point_sprite_coords_enabled ()

+
CoglBool            cogl_pipeline_set_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+

+When rendering points, if enable is TRUE then the texture +coordinates for this layer will be replaced with coordinates that +vary from 0.0 to 1.0 across the primitive. The top left of the +point will have the coordinates 0.0,0.0 and the bottom right will +have 1.0,1.0. If enable is FALSE then the coordinates will be +fixed for the entire point. +

+

+This function will only work if COGL_FEATURE_ID_POINT_SPRITE is +available. If the feature is not available then the function will +return FALSE and set error. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to change.

enable :

whether to enable point sprite coord generation.

error :

A return location for a CoglError, or NULL to ignore errors.

Returns :

+TRUE if the function succeeds, FALSE otherwise.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_layer_point_sprite_coords_enabled ()

+
CoglBool            cogl_pipeline_get_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index);
+

+Gets whether point sprite coordinate generation is enabled for this +texture layer. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

the layer number to check.

Returns :

whether the texture coordinates will be replaced with +point sprite coordinates.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_remove_layer ()

+
void                cogl_pipeline_remove_layer          (CoglPipeline *pipeline,
+                                                         int layer_index);
+

+This function removes a layer from your pipeline +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

layer_index :

Specifies the layer you want to remove
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_n_layers ()

+
int                 cogl_pipeline_get_n_layers          (CoglPipeline *pipeline);
+

+Retrieves the number of layers defined for the given pipeline +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline object

Returns :

the number of layers
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

CoglPipelineLayerCallback ()

+
CoglBool            (*CoglPipelineLayerCallback)        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         void *user_data);
+

+The callback prototype used with cogl_pipeline_foreach_layer() for +iterating all the layers of a pipeline. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

The CoglPipeline whos layers are being iterated

layer_index :

The current layer index

user_data :

The private data passed to cogl_pipeline_foreach_layer() +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_foreach_layer ()

+
void                cogl_pipeline_foreach_layer         (CoglPipeline *pipeline,
+                                                         CoglPipelineLayerCallback callback,
+                                                         void *user_data);
+

+Iterates all the layer indices of the given pipeline. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

callback :

A CoglPipelineLayerCallback to be +called for each layer index. [scope call] +

user_data :

Private data that will be passed to the +callback. [closure] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_get_uniform_location ()

+
int                 cogl_pipeline_get_uniform_location  (CoglPipeline *pipeline,
+                                                         const char *uniform_name);
+

+This is used to get an integer representing the uniform with the +name uniform_name. The integer can be passed to functions such as +cogl_pipeline_set_uniform_1f() to set the value of a uniform. +

+

+This function will always return a valid integer. Ie, unlike +OpenGL, it does not return -1 if the uniform is not available in +this pipeline so it can not be used to test whether uniforms are +present. It is not necessary to set the program on the pipeline +before calling this function. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_name :

The name of a uniform

Returns :

A integer representing the location of the given uniform.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_uniform_1f ()

+
void                cogl_pipeline_set_uniform_1f        (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         float value);
+

+Sets a new value for the uniform at uniform_location. If this +pipeline has a user program attached and is later used as a source +for drawing, the given value will be assigned to the uniform which +can be accessed from the shader's source. The value for +uniform_location should be retrieved from the string name of the +uniform by calling cogl_pipeline_get_uniform_location(). +

+

+This function should be used to set uniforms that are of type +float. It can also be used to set a single member of a float array +uniform. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_location :

The uniform's location identifier

value :

The new value for the uniform
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_uniform_1i ()

+
void                cogl_pipeline_set_uniform_1i        (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int value);
+

+Sets a new value for the uniform at uniform_location. If this +pipeline has a user program attached and is later used as a source +for drawing, the given value will be assigned to the uniform which +can be accessed from the shader's source. The value for +uniform_location should be retrieved from the string name of the +uniform by calling cogl_pipeline_get_uniform_location(). +

+

+This function should be used to set uniforms that are of type +int. It can also be used to set a single member of a int array +uniform or a sampler uniform. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_location :

The uniform's location identifier

value :

The new value for the uniform
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_uniform_float ()

+
void                cogl_pipeline_set_uniform_float     (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const float *value);
+

+Sets new values for the uniform at uniform_location. If this +pipeline has a user program attached and is later used as a source +for drawing, the given values will be assigned to the uniform which +can be accessed from the shader's source. The value for +uniform_location should be retrieved from the string name of the +uniform by calling cogl_pipeline_get_uniform_location(). +

+

+This function can be used to set any floating point type uniform, +including float arrays and float vectors. For example, to set a +single vec4 uniform you would use 4 for n_components and 1 for +count. To set an array of 8 float values, you could use 1 for +n_components and 8 for count. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_location :

The uniform's location identifier

n_components :

The number of components in the corresponding uniform's type

count :

The number of values to set

value :

Pointer to the new values to set
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_uniform_int ()

+
void                cogl_pipeline_set_uniform_int       (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const int *value);
+

+Sets new values for the uniform at uniform_location. If this +pipeline has a user program attached and is later used as a source +for drawing, the given values will be assigned to the uniform which +can be accessed from the shader's source. The value for +uniform_location should be retrieved from the string name of the +uniform by calling cogl_pipeline_get_uniform_location(). +

+

+This function can be used to set any integer type uniform, +including int arrays and int vectors. For example, to set a single +ivec4 uniform you would use 4 for n_components and 1 for +count. To set an array of 8 int values, you could use 1 for +n_components and 8 for count. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_location :

The uniform's location identifier

n_components :

The number of components in the corresponding uniform's type

count :

The number of values to set

value :

Pointer to the new values to set
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_set_uniform_matrix ()

+
void                cogl_pipeline_set_uniform_matrix    (CoglPipeline *pipeline,
+                                                         int uniform_location,
+                                                         int dimensions,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+

+Sets new values for the uniform at uniform_location. If this +pipeline has a user program attached and is later used as a source +for drawing, the given values will be assigned to the uniform which +can be accessed from the shader's source. The value for +uniform_location should be retrieved from the string name of the +uniform by calling cogl_pipeline_get_uniform_location(). +

+

+This function can be used to set any matrix type uniform, including +matrix arrays. For example, to set a single mat4 uniform you would +use 4 for dimensions and 1 for count. To set an array of 8 +mat3 values, you could use 3 for dimensions and 8 for count. +

+

+If transpose is FALSE then the matrix is expected to be in +column-major order or if it is TRUE then the matrix is in +row-major order. You can pass a CoglMatrix by calling by passing +the result of cogl_matrix_get_array() in value and setting +transpose to FALSE. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline object

uniform_location :

The uniform's location identifier

dimensions :

The size of the matrix

count :

The number of values to set

transpose :

Whether to transpose the matrix

value :

Pointer to the new values to set
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_add_snippet ()

+
void                cogl_pipeline_add_snippet           (CoglPipeline *pipeline,
+                                                         CoglSnippet *snippet);
+

+Adds a shader snippet to pipeline. The snippet will wrap around or +replace some part of the pipeline as defined by the hook point in +snippet. Note that some hook points are specific to a layer and +must be added with cogl_pipeline_add_layer_snippet() instead. +

+
++++ + + + + + + + + + + +

pipeline :

A CoglPipeline +

snippet :

The CoglSnippet to add to the vertex processing hook
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_pipeline_add_layer_snippet ()

+
void                cogl_pipeline_add_layer_snippet     (CoglPipeline *pipeline,
+                                                         int layer,
+                                                         CoglSnippet *snippet);
+

+Adds a shader snippet that will hook on to the given layer of the +pipeline. The exact part of the pipeline that the snippet wraps +around depends on the hook that is given to +cogl_snippet_new(). Note that some hooks can't be used with a layer +and need to be added with cogl_pipeline_add_snippet() instead. +

+
++++ + + + + + + + + + + + + + + +

pipeline :

A CoglPipeline +

layer :

The layer to hook the snippet to

snippet :

A CoglSnippet +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Primitives.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Primitives.html new file mode 100644 index 0000000..b9c68eb --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Primitives.html @@ -0,0 +1,1828 @@ + + + + +Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Primitives

+

Primitives — Functions for creating, manipulating and drawing + primitives

+
+
+

Synopsis

+
                    CoglPrimitive;
+CoglPrimitive *     cogl_primitive_new                  (CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         ...);
+CoglPrimitive *     cogl_primitive_new_with_attributes  (CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+CoglPrimitive *     cogl_primitive_new_p2               (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2 *data);
+CoglPrimitive *     cogl_primitive_new_p3               (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3 *data);
+CoglPrimitive *     cogl_primitive_new_p2c4             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2C4 *data);
+CoglPrimitive *     cogl_primitive_new_p3c4             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3C4 *data);
+CoglPrimitive *     cogl_primitive_new_p2t2             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2T2 *data);
+CoglPrimitive *     cogl_primitive_new_p3t2             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3T2 *data);
+CoglPrimitive *     cogl_primitive_new_p2t2c4           (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2T2C4 *data);
+CoglPrimitive *     cogl_primitive_new_p3t2c4           (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3T2C4 *data);
+CoglBool            cogl_is_primitive                   (void *object);
+int                 cogl_primitive_get_first_vertex     (CoglPrimitive *primitive);
+void                cogl_primitive_set_first_vertex     (CoglPrimitive *primitive,
+                                                         int first_vertex);
+int                 cogl_primitive_get_n_vertices       (CoglPrimitive *primitive);
+void                cogl_primitive_set_n_vertices       (CoglPrimitive *primitive,
+                                                         int n_vertices);
+CoglVerticesMode    cogl_primitive_get_mode             (CoglPrimitive *primitive);
+void                cogl_primitive_set_mode             (CoglPrimitive *primitive,
+                                                         CoglVerticesMode mode);
+void                cogl_primitive_set_attributes       (CoglPrimitive *primitive,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+CoglIndices *       cogl_primitive_get_indices          (CoglPrimitive *primitive);
+void                cogl_primitive_set_indices          (CoglPrimitive *primitive,
+                                                         CoglIndices *indices,
+                                                         int n_indices);
+CoglPrimitive *     cogl_primitive_copy                 (CoglPrimitive *primitive);
+CoglBool            (*CoglPrimitiveAttributeCallback)   (CoglPrimitive *primitive,
+                                                         CoglAttribute *attribute,
+                                                         void *user_data);
+void                cogl_primitive_foreach_attribute    (CoglPrimitive *primitive,
+                                                         CoglPrimitiveAttributeCallback callback,
+                                                         void *user_data);
+void                cogl_primitive_draw                 (CoglPrimitive *primitive,
+                                                         CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglPrimitive

+
typedef struct _CoglPrimitive CoglPrimitive;
+
+
+
+

cogl_primitive_new ()

+
CoglPrimitive *     cogl_primitive_new                  (CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         ...);
+

+Combines a set of CoglAttributes with a specific draw mode +and defines a vertex count so a CoglPrimitive object can be retained and +drawn later with no addition information required. +

+

+The value passed as n_vertices will simply update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+
++++ + + + + + + + + + + + + + + + + + + +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to process when drawing

... :

A NULL terminated list of attributes

Returns :

A newly allocated CoglPrimitive object. [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_with_attributes ()

+
CoglPrimitive *     cogl_primitive_new_with_attributes  (CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+

+Combines a set of CoglAttributes with a specific draw mode +and defines a vertex count so a CoglPrimitive object can be retained and +drawn later with no addition information required. +

+

+The value passed as n_vertices will simply update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to process when drawing

attributes :

An array of CoglAttribute

n_attributes :

The number of attributes

Returns :

A newly allocated CoglPrimitive object. [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p2 ()

+
CoglPrimitive *     cogl_primitive_new_p2               (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position +attribute with a CoglAttribute and upload your data. +

+

+For example to draw a convex polygon you can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP2 triangle[] =
+{
+  { 0,   300 },
+  { 150, 0,  },
+  { 300, 300 }
+};
+prim = cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                              3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP2): An array +of CoglVertexP2 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p3 ()

+
CoglPrimitive *     cogl_primitive_new_p3               (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position +attribute with a CoglAttribute and upload your data. +

+

+For example to draw a convex polygon you can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP3 triangle[] =
+{
+  { 0,   300, 0 },
+  { 150, 0,   0 },
+  { 300, 300, 0 }
+};
+prim = cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                              3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP3): An array of +CoglVertexP3 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p2c4 ()

+
CoglPrimitive *     cogl_primitive_new_p2c4             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2C4 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position +and color attributes with CoglAttributes and upload +your data. +

+

+For example to draw a convex polygon with a linear gradient you +can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP2C4 triangle[] =
+{
+  { 0,   300,  0xff, 0x00, 0x00, 0xff },
+  { 150, 0,    0x00, 0xff, 0x00, 0xff },
+  { 300, 300,  0xff, 0x00, 0x00, 0xff }
+};
+prim = cogl_primitive_new_p2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP2C4): An array +of CoglVertexP2C4 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p3c4 ()

+
CoglPrimitive *     cogl_primitive_new_p3c4             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3C4 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position +and color attributes with CoglAttributes and upload +your data. +

+

+For example to draw a convex polygon with a linear gradient you +can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP3C4 triangle[] =
+{
+  { 0,   300, 0,  0xff, 0x00, 0x00, 0xff },
+  { 150, 0,   0,  0x00, 0xff, 0x00, 0xff },
+  { 300, 300, 0,  0xff, 0x00, 0x00, 0xff }
+};
+prim = cogl_primitive_new_p3c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP3C4): An array +of CoglVertexP3C4 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p2t2 ()

+
CoglPrimitive *     cogl_primitive_new_p2t2             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2T2 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position and +texture coordinate attributes with CoglAttributes and +upload your data. +

+

+For example to draw a convex polygon with texture mapping you can +do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP2T2 triangle[] =
+{
+  { 0,   300,  0.0, 1.0},
+  { 150, 0,    0.5, 0.0},
+  { 300, 300,  1.0, 1.0}
+};
+prim = cogl_primitive_new_p2t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP2T2): An array +of CoglVertexP2T2 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p3t2 ()

+
CoglPrimitive *     cogl_primitive_new_p3t2             (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3T2 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position and +texture coordinate attributes with CoglAttributes and +upload your data. +

+

+For example to draw a convex polygon with texture mapping you can +do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP3T2 triangle[] =
+{
+  { 0,   300, 0,  0.0, 1.0},
+  { 150, 0,   0,  0.5, 0.0},
+  { 300, 300, 0,  1.0, 1.0}
+};
+prim = cogl_primitive_new_p3t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP3T2): An array +of CoglVertexP3T2 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p2t2c4 ()

+
CoglPrimitive *     cogl_primitive_new_p2t2c4           (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP2T2C4 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position, texture +coordinate and color attributes with CoglAttributes and +upload your data. +

+

+For example to draw a convex polygon with texture mapping and a +linear gradient you can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP2T2C4 triangle[] =
+{
+  { 0,   300,  0.0, 1.0,  0xff, 0x00, 0x00, 0xff},
+  { 150, 0,    0.5, 0.0,  0x00, 0xff, 0x00, 0xff},
+  { 300, 300,  1.0, 1.0,  0xff, 0x00, 0x00, 0xff}
+};
+prim = cogl_primitive_new_p2t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                  3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP2T2C4): An +array of CoglVertexP2T2C4 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_new_p3t2c4 ()

+
CoglPrimitive *     cogl_primitive_new_p3t2c4           (CoglContext *context,
+                                                         CoglVerticesMode mode,
+                                                         int n_vertices,
+                                                         const CoglVertexP3T2C4 *data);
+

+Provides a convenient way to describe a primitive, such as a single +triangle strip or a triangle fan, that will internally allocate the +necessary CoglAttributeBuffer storage, describe the position, texture +coordinate and color attributes with CoglAttributes and +upload your data. +

+

+For example to draw a convex polygon with texture mapping and a +linear gradient you can do: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33

+
+
+
+
+
+
+
+
+
+
+
+
+CoglVertexP3T2C4 triangle[] =
+{
+  { 0,   300, 0,  0.0, 1.0,  0xff, 0x00, 0x00, 0xff},
+  { 150, 0,   0,  0.5, 0.0,  0x00, 0xff, 0x00, 0xff},
+  { 300, 300, 0,  1.0, 1.0,  0xff, 0x00, 0x00, 0xff}
+};
+prim = cogl_primitive_new_p3t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
+                                  3, triangle);
+cogl_primitive_draw (prim);
+
+ +

+

+

+The value passed as n_vertices is initially used to determine how +much can be read from data but it will also be used to update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to read when drawing. +

+

+

+
+

Note

The primitive API doesn't support drawing with sliced +textures (since switching between slices implies changing state and +so that implies multiple primitives need to be submitted). You +should pass the COGL_TEXTURE_NO_SLICING flag to all textures that +might be used while drawing with this API. If your hardware doesn't +support non-power of two textures (For example you are using GLES +1.1) then you will need to make sure your assets are resized to a +power-of-two size (though they don't have to be square)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

mode :

A CoglVerticesMode defining how to draw the vertices

n_vertices :

The number of vertices to read from data and also +the number of vertices to read when later drawing.

data :

(type Cogl.VertexP3T2C4): An +array of CoglVertexP3T2C4 vertices. [array length=n_vertices] +

Returns :

A newly allocated CoglPrimitive +with a reference of 1. This can be freed using cogl_object_unref(). [transfer full] +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_is_primitive ()

+
CoglBool            cogl_is_primitive                   (void *object);
+

+Gets whether the given object references a CoglPrimitive. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglPrimitive, +FALSE otherwise
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_get_first_vertex ()

+
int                 cogl_primitive_get_first_vertex     (CoglPrimitive *primitive);
+
+
+
+

cogl_primitive_set_first_vertex ()

+
void                cogl_primitive_set_first_vertex     (CoglPrimitive *primitive,
+                                                         int first_vertex);
+
+
+
+

cogl_primitive_get_n_vertices ()

+
int                 cogl_primitive_get_n_vertices       (CoglPrimitive *primitive);
+

+Queries the number of vertices to read when drawing the given +primitive. Usually this value is implicitly set when associating +vertex data or indices with a CoglPrimitive. +

+

+If cogl_primitive_set_indices() has been used to associate a +sequence of CoglIndices with the given primitive then the +number of vertices to read can also be phrased as the number +of indices to read. +

+

+

+
+

Note

To be clear; it doesn't refer to the number of vertices - in +terms of data - associated with the primitive it's just the number +of vertices to read and draw.
+

+

+
++++ + + + + + + + + + + +

primitive :

A CoglPrimitive object

Returns :

The number of vertices to read when drawing.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_set_n_vertices ()

+
void                cogl_primitive_set_n_vertices       (CoglPrimitive *primitive,
+                                                         int n_vertices);
+

+Specifies how many vertices should be read when drawing the given +primitive. +

+

+Usually this value is set implicitly when associating vertex data +or indices with a CoglPrimitive. +

+

+

+
+

Note

To be clear; it doesn't refer to the number of vertices - in +terms of data - associated with the primitive it's just the number +of vertices to read and draw.
+

+

+
++++ + + + + + + + + + + +

primitive :

A CoglPrimitive object

n_vertices :

The number of vertices to read when drawing.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_get_mode ()

+
CoglVerticesMode    cogl_primitive_get_mode             (CoglPrimitive *primitive);
+
+
+
+

cogl_primitive_set_mode ()

+
void                cogl_primitive_set_mode             (CoglPrimitive *primitive,
+                                                         CoglVerticesMode mode);
+
+
+
+

cogl_primitive_set_attributes ()

+
void                cogl_primitive_set_attributes       (CoglPrimitive *primitive,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+

+Replaces all the attributes of the given CoglPrimitive object. +

+
++++ + + + + + + + + + + + + + + +

primitive :

A CoglPrimitive object

attributes :

an array of CoglAttribute pointers

n_attributes :

the number of elements in attributes +
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_get_indices ()

+
CoglIndices *       cogl_primitive_get_indices          (CoglPrimitive *primitive);
+
++++ + + + + + + + + + + +

primitive :

A CoglPrimitive +

Returns :

the indices that were set with +cogl_primitive_set_indices() or NULL if no indices were set. [transfer none] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_set_indices ()

+
void                cogl_primitive_set_indices          (CoglPrimitive *primitive,
+                                                         CoglIndices *indices,
+                                                         int n_indices);
+

+Associates a sequence of CoglIndices with the given primitive. +

+

+CoglIndices provide a way to virtualize your real vertex data by +providing a sequence of indices that index into your real vertex +data. The GPU will walk though the index values to indirectly +lookup the data for each vertex instead of sequentially walking +through the data directly. This lets you save memory by indexing +shared data multiple times instead of duplicating the data. +

+

+The value passed as n_indices will simply update the +CoglPrimitive n_vertices property as if +cogl_primitive_set_n_vertices() were called. This property defines +the number of vertices to draw or, put another way, how many +indices should be read from indices when drawing. +

+

+

+
+

Note

The CoglPrimitivefirst_vertex property +also affects drawing with indices by defining the first entry of the +indices to start drawing from.
+

+

+
++++ + + + + + + + + + + + + + + +

primitive :

A CoglPrimitive +

indices :

A CoglIndices array

n_indices :

The number of indices to reference when drawing
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_copy ()

+
CoglPrimitive *     cogl_primitive_copy                 (CoglPrimitive *primitive);
+

+Makes a copy of an existing CoglPrimitive. Note that the primitive +is a shallow copy which means it will use the same attributes and +attribute buffers as the original primitive. +

+
++++ + + + + + + + + + + +

primitive :

A primitive copy

Returns :

the new primitive. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

CoglPrimitiveAttributeCallback ()

+
CoglBool            (*CoglPrimitiveAttributeCallback)   (CoglPrimitive *primitive,
+                                                         CoglAttribute *attribute,
+                                                         void *user_data);
+

+The callback prototype used with cogl_primitive_foreach_attribute() +for iterating all the attributes of a CoglPrimitive. +

+

+The function should return TRUE to continue iteration or FALSE to +stop. +

+
++++ + + + + + + + + + + + + + + +

primitive :

The CoglPrimitive whose attributes are being iterated

attribute :

The CoglAttribute +

user_data :

The private data passed to cogl_primitive_foreach_attribute() +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_foreach_attribute ()

+
void                cogl_primitive_foreach_attribute    (CoglPrimitive *primitive,
+                                                         CoglPrimitiveAttributeCallback callback,
+                                                         void *user_data);
+

+Iterates all the attributes of the given CoglPrimitive. +

+
++++ + + + + + + + + + + + + + + +

primitive :

A CoglPrimitive object

callback :

A CoglPrimitiveAttributeCallback to be +called for each attribute. [scope call] +

user_data :

Private data that will be passed to the +callback. [closure] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_draw ()

+
void                cogl_primitive_draw                 (CoglPrimitive *primitive,
+                                                         CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline);
+

+Draws the given primitive geometry to the specified destination +framebuffer using the graphics processing state described by pipeline. +

+

+This drawing api doesn't support high-level meta texture types such +as CoglTexture2DSliced so it is the user's responsibility to +ensure that only low-level textures that can be directly sampled by +a GPU such as CoglTexture2D, CoglTextureRectangle or CoglTexture3D +are associated with layers of the given pipeline. +

+
++++ + + + + + + + + + + + + + + +

primitive :

A CoglPrimitive geometry object

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html new file mode 100644 index 0000000..5162c3b --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html @@ -0,0 +1,1136 @@ + + + + +Quaternions (Rotations) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Quaternions (Rotations)

+

Quaternions (Rotations) — Functions for initializing and manipulating +quaternions.

+
+
+

Synopsis

+
                    CoglQuaternion;
+void                cogl_quaternion_init_identity       (CoglQuaternion *quaternion);
+void                cogl_quaternion_init                (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_quaternion_init_from_quaternion
+                                                        (CoglQuaternion *quaternion,
+                                                         CoglQuaternion *src);
+void                cogl_quaternion_init_from_angle_vector
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         const float *axis3f);
+void                cogl_quaternion_init_from_array     (CoglQuaternion *quaternion,
+                                                         const float *array);
+void                cogl_quaternion_init_from_x_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+void                cogl_quaternion_init_from_y_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+void                cogl_quaternion_init_from_z_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+void                cogl_quaternion_init_from_euler     (CoglQuaternion *quaternion,
+                                                         const CoglEuler *euler);
+CoglBool            cogl_quaternion_equal               (const void *v1,
+                                                         const void *v2);
+CoglQuaternion *    cogl_quaternion_copy                (const CoglQuaternion *src);
+void                cogl_quaternion_free                (CoglQuaternion *quaternion);
+float               cogl_quaternion_get_rotation_angle  (const CoglQuaternion *quaternion);
+void                cogl_quaternion_get_rotation_axis   (const CoglQuaternion *quaternion,
+                                                         float *vector3);
+void                cogl_quaternion_normalize           (CoglQuaternion *quaternion);
+float               cogl_quaternion_dot_product         (const CoglQuaternion *a,
+                                                         const CoglQuaternion *b);
+void                cogl_quaternion_invert              (CoglQuaternion *quaternion);
+void                cogl_quaternion_multiply            (CoglQuaternion *result,
+                                                         const CoglQuaternion *left,
+                                                         const CoglQuaternion *right);
+void                cogl_quaternion_pow                 (CoglQuaternion *quaternion,
+                                                         float exponent);
+void                cogl_quaternion_slerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+void                cogl_quaternion_nlerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+void                cogl_quaternion_squad               (CoglQuaternion *result,
+                                                         const CoglQuaternion *prev,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         const CoglQuaternion *next,
+                                                         float t);
+const CoglQuaternion * cogl_get_static_identity_quaternion
+                                                        (void);
+const CoglQuaternion * cogl_get_static_zero_quaternion  (void);
+
+
+
+

Description

+

+Quaternions have become a standard form for representing 3D +rotations and have some nice properties when compared with other +representation such as (roll,pitch,yaw) Euler angles. They can be +used to interpolate between different rotations and they don't +suffer from a problem called +"Gimbal lock" +where two of the axis of rotation may become aligned and you loose a +degree of freedom. +. +

+
+
+

Details

+
+

CoglQuaternion

+
typedef struct {
+  float w;
+
+  float x;
+  float y;
+  float z;
+} CoglQuaternion;
+
+

+A quaternion is comprised of a scalar component and a 3D vector +component. The scalar component is normally referred to as w and the +vector might either be referred to as v or a (for axis) or expanded +with the individual components: (x, y, z) A full quaternion would +then be written as [w (x, y, z)]. +

+

+Quaternions can be considered to represent an axis and angle +pair although sadly these numbers are buried somewhat under some +maths... +

+

+For the curious you can see here that a given axis (a) and angle (𝜃) +pair are represented in a quaternion as follows: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+[w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )]
+
+ +

+

+

+Unit Quaternions: +When using Quaternions to represent spatial orientations for 3D +graphics it's always assumed you have a unit quaternion. The +magnitude of a quaternion is defined as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+sqrt (w² + x² + y² + z²)
+
+ +

+and a unit quaternion satisfies this equation: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+w² + x² + y² + z² = 1
+
+ +

+

+

+Thankfully most of the time we don't actually have to worry about +the maths that goes on behind the scenes but if you are curious to +learn more here are some external references: +

+

+

+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

float w;

based on the angle of rotation it is cos(𝜃/2)

float x;

based on the angle of rotation and x component of the axis of +rotation it is sin(𝜃/2)*axis.x

float y;

based on the angle of rotation and y component of the axis of +rotation it is sin(𝜃/2)*axis.y

float z;

based on the angle of rotation and z component of the axis of +rotation it is sin(𝜃/2)*axis.z
+
+
+
+

cogl_quaternion_init_identity ()

+
void                cogl_quaternion_init_identity       (CoglQuaternion *quaternion);
+

+Initializes the quaternion with the canonical quaternion identity +[1 (0, 0, 0)] which represents no rotation. Multiplying a +quaternion with this identity leaves the quaternion unchanged. +

+

+You might also want to consider using +cogl_get_static_identity_quaternion(). +

+
++++ + + + + +

quaternion :

An uninitialized CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_init ()

+
void                cogl_quaternion_init                (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Initializes a quaternion that rotates angle degrees around the +axis vector (x, y, z). The axis vector does not need to be +normalized. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle you want to rotate around the given axis

x :

The x component of your axis vector about which you want to +rotate.

y :

The y component of your axis vector about which you want to +rotate.

z :

The z component of your axis vector about which you want to +rotate.

Returns :

A normalized, unit quaternion representing an orientation +rotated angle degrees around the axis vector (x, y, z)
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_quaternion ()

+
void                cogl_quaternion_init_from_quaternion
+                                                        (CoglQuaternion *quaternion,
+                                                         CoglQuaternion *src);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

src :

A CoglQuaternion with which to initialize quaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_angle_vector ()

+
void                cogl_quaternion_init_from_angle_vector
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         const float *axis3f);
+

+Initializes a quaternion that rotates angle degrees around the +given axis vector. The axis vector does not need to be +normalized. +

+
++++ + + + + + + + + + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around axis3f +

axis3f :

your 3 component axis vector about which you want to rotate.

Returns :

A normalized, unit quaternion representing an orientation +rotated angle degrees around the given axis vector.
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_array ()

+
void                cogl_quaternion_init_from_array     (CoglQuaternion *quaternion,
+                                                         const float *array);
+

+Initializes a [w (x, y,z)] quaternion directly from an array of 4 +floats: [w,x,y,z]. +

+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

array :

An array of 4 floats w,(x,y,z)
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_x_rotation ()

+
void                cogl_quaternion_init_from_x_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+

+XXX: check which direction this rotates +

+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the x axis
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_y_rotation ()

+
void                cogl_quaternion_init_from_y_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the y axis
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_z_rotation ()

+
void                cogl_quaternion_init_from_z_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the z axis
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_euler ()

+
void                cogl_quaternion_init_from_euler     (CoglQuaternion *quaternion,
+                                                         const CoglEuler *euler);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

euler :

A CoglEuler with which to initialize the quaternion
+

Since 2.0

+
+
+
+

cogl_quaternion_equal ()

+
CoglBool            cogl_quaternion_equal               (const void *v1,
+                                                         const void *v2);
+

+Compares that all the components of quaternions a and b are +equal. +

+

+An epsilon value is not used to compare the float components, but +the == operator is at least used so that 0 and -0 are considered +equal. +

+
++++ + + + + + + + + + + + + + + +

v1 :

A CoglQuaternion +

v2 :

A CoglQuaternion +

Returns :

+TRUE if the quaternions are equal else FALSE.
+

Since 2.0

+
+
+
+

cogl_quaternion_copy ()

+
CoglQuaternion *    cogl_quaternion_copy                (const CoglQuaternion *src);
+

+Allocates a new CoglQuaternion on the stack and initializes it with +the same values as src. +

+
++++ + + + + + + + + + + +

src :

A CoglQuaternion +

Returns :

A newly allocated CoglQuaternion which should be freed +using cogl_quaternion_free() +
+

Since 2.0

+
+
+
+

cogl_quaternion_free ()

+
void                cogl_quaternion_free                (CoglQuaternion *quaternion);
+

+Frees a CoglQuaternion that was previously allocated via +cogl_quaternion_copy(). +

+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_get_rotation_angle ()

+
float               cogl_quaternion_get_rotation_angle  (const CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_get_rotation_axis ()

+
void                cogl_quaternion_get_rotation_axis   (const CoglQuaternion *quaternion,
+                                                         float *vector3);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

vector3 :

an allocated 3-float array. [out] +
+

Since 2.0

+
+
+
+

cogl_quaternion_normalize ()

+
void                cogl_quaternion_normalize           (CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_dot_product ()

+
float               cogl_quaternion_dot_product         (const CoglQuaternion *a,
+                                                         const CoglQuaternion *b);
+
++++ + + + + + + + + + + +

a :

A CoglQuaternion +

b :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_invert ()

+
void                cogl_quaternion_invert              (CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_multiply ()

+
void                cogl_quaternion_multiply            (CoglQuaternion *result,
+                                                         const CoglQuaternion *left,
+                                                         const CoglQuaternion *right);
+

+This combines the rotations of two quaternions into result. The +operation is not commutative so the order is important because AxB +!= BxA. Cogl follows the standard convention for quaternions here +so the rotations are applied right to left. This is similar to the +combining of matrices. +

+

+

+
+

Note

It is possible to multiply the a quaternion in-place, so +result can be equal to a but can't be equal to b.
+

+

+
++++ + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

left :

The second CoglQuaternion rotation to apply

right :

The first CoglQuaternion rotation to apply
+

Since 2.0

+
+
+
+

cogl_quaternion_pow ()

+
void                cogl_quaternion_pow                 (CoglQuaternion *quaternion,
+                                                         float exponent);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

exponent :

the exponent
+

Since 2.0

+
+
+
+

cogl_quaternion_slerp ()

+
void                cogl_quaternion_slerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+

+Performs a spherical linear interpolation between two quaternions. +

+

+Noteable properties: +

+
    +
  • +commutative: No +
  • +
  • +constant velocity: Yes +
  • +
  • +torque minimal (travels along the surface of the 4-sphere): Yes +
  • +
  • +more expensive than cogl_quaternion_nlerp() +
  • +
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

t :

The factor in the range [0,1] used to interpolate between +quaternion a and b.
+
+
+
+

cogl_quaternion_nlerp ()

+
void                cogl_quaternion_nlerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+

+Performs a normalized linear interpolation between two quaternions. +That is it does a linear interpolation of the quaternion components +and then normalizes the result. This will follow the shortest arc +between the two orientations (just like the slerp() function) but +will not progress at a constant speed. Unlike slerp() nlerp is +commutative which is useful if you are blending animations +together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp, +d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp, +b)). Finally nlerp is cheaper than slerp so it can be a good choice +if you don't need the constant speed property of the slerp() function. +

+

+Notable properties: +

+
    +
  • +commutative: Yes +
  • +
  • +constant velocity: No +
  • +
  • +torque minimal (travels along the surface of the 4-sphere): Yes +
  • +
  • +faster than cogl_quaternion_slerp() +
  • +
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

t :

The factor in the range [0,1] used to interpolate between +quaterion a and b.
+
+
+
+

cogl_quaternion_squad ()

+
void                cogl_quaternion_squad               (CoglQuaternion *result,
+                                                         const CoglQuaternion *prev,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         const CoglQuaternion *next,
+                                                         float t);
+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

prev :

A CoglQuaternion used before a +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

next :

A CoglQuaternion that will be used after b +

t :

The factor in the range [0,1] used to interpolate between +quaternion a and b.
+

Since 2.0

+
+
+
+

cogl_get_static_identity_quaternion ()

+
const CoglQuaternion * cogl_get_static_identity_quaternion
+                                                        (void);
+

+Returns a pointer to a singleton quaternion constant describing the +canonical identity [1 (0, 0, 0)] which represents no rotation. +

+

+If you multiply a quaternion with the identity quaternion you will +get back the same value as the original quaternion. +

+
++++ + + + + +

Returns :

A pointer to an identity quaternion
+

Since 2.0

+
+
+
+

cogl_get_static_zero_quaternion ()

+
const CoglQuaternion * cogl_get_static_zero_quaternion  (void);
+
++++ + + + + +

Returns :

a pointer to a singleton quaternion constant describing a +rotation of 180 degrees around a degenerate axis: +[0 (0, 0, 0)]
+

Since 2.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html new file mode 100644 index 0000000..4725e40 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html @@ -0,0 +1,258 @@ + + + + +Rectangle textures (non-normalized coordinates) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Rectangle textures (non-normalized coordinates)

+

Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle + textures for use with non-normalized coordinates.

+
+ +
+

Description

+

+These functions allow low-level "rectangle" textures to be allocated. +These textures are never constrained to power-of-two sizes but they +also don't support having a mipmap and can only be wrapped with +COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE. +

+

+The most notable difference between rectangle textures and 2D +textures is that rectangle textures are sampled using un-normalized +texture coordinates, so instead of using coordinates (0,0) and +(1,1) to map to the top-left and bottom right corners of the +texture you would instead use (0,0) and (width,height). +

+

+The use of non-normalized coordinates can be particularly +convenient when writing glsl shaders that use a texture as a lookup +table since you don't need to upload separate uniforms to map +normalized coordinates to texels. +

+

+If you want to sample from a rectangle texture from GLSL you should +use the sampler2DRect sampler type. +

+

+Applications wanting to use CoglTextureRectangle should first check +for the COGL_FEATURE_ID_TEXTURE_RECTANGLE feature using +cogl_has_feature(). +

+
+
+

Details

+
+

CoglTextureRectangle

+
typedef struct _CoglTextureRectangle CoglTextureRectangle;
+
+
+
+

cogl_texture_rectangle_new_with_size ()

+
CoglTextureRectangle * cogl_texture_rectangle_new_with_size
+                                                        (CoglContext *ctx,
+                                                         int width,
+                                                         int height);
+

+Creates a new CoglTextureRectangle texture with a given width, +and height. This texture is a low-level texture that the GPU can +sample from directly unlike high-level textures such as +CoglTexture2DSliced and CoglAtlasTexture. +

+

+

+
+

Note

Unlike for CoglTexture2D textures, coordinates for +CoglTextureRectangle textures should not be normalized. So instead +of using the coordinate (1, 1) to sample the bottom right corner of +a rectangle texture you would use (width, height) where width +and height are the width and height of the texture.
+

+

+

+

+
+

Note

If you want to sample from a rectangle texture from GLSL you +should use the sampler2DRect sampler type.
+

+

+

+

+
+

Note

Applications wanting to use CoglTextureRectangle should +first check for the COGL_FEATURE_ID_TEXTURE_RECTANGLE feature +using cogl_has_feature().
+

+

+

+The storage for the texture is not allocated before this function +

+
++++ + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext pointer

width :

The texture width to allocate

height :

The texture height to allocate

Returns :

value: (transfer full): A pointer to a new CoglTextureRectangle +object with no storage allocated yet.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_texture_rectangle_new_from_bitmap ()

+
CoglTextureRectangle * cogl_texture_rectangle_new_from_bitmap
+                                                        (CoglBitmap *bitmap);
+

+Allocates a new CoglTextureRectangle texture which will be +initialized with the pixel data from bitmap. This texture is a +low-level texture that the GPU can sample from directly unlike +high-level textures such as CoglTexture2DSliced and +CoglAtlasTexture. +

+

+

+
+

Note

Unlike for CoglTexture2D textures, coordinates for +CoglTextureRectangle textures should not be normalized. So instead +of using the coordinate (1, 1) to sample the bottom right corner of +a rectangle texture you would use (width, height) where width +and height are the width and height of the texture.
+

+

+

+

+
+

Note

If you want to sample from a rectangle texture from GLSL you +should use the sampler2DRect sampler type.
+

+

+

+

+
+

Note

Applications wanting to use CoglTextureRectangle should +first check for the COGL_FEATURE_ID_TEXTURE_RECTANGLE feature +using cogl_has_feature().
+

+

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is going to be used and can optimize how it is +allocated. +

+
++++ + + + + + + + + + + +

bitmap :

A CoglBitmap +

Returns :

A pointer to a new +CoglTextureRectangle texture. [transfer full] +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_rectangle ()

+
CoglBool            cogl_is_texture_rectangle           (void *object);
+

+Gets whether the given object references an existing +CoglTextureRectangle object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a +CoglTextureRectangle, FALSE otherwise.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangles.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangles.html new file mode 100644 index 0000000..f08d605 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangles.html @@ -0,0 +1,303 @@ + + + + +Rectangles + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Rectangles

+

Rectangles

+
+
+

Synopsis

+
void                cogl_rectangle                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_rectangles                     (const float *verts,
+                                                         unsigned int n_rects);
+void                cogl_rectangle_with_texture_coords  (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         float tx1,
+                                                         float ty1,
+                                                         float tx2,
+                                                         float ty2);
+void                cogl_rectangles_with_texture_coords (const float *verts,
+                                                         unsigned int n_rects);
+void                cogl_rectangle_with_multitexture_coords
+                                                        (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_rectangle ()

+
void                cogl_rectangle                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Fills a rectangle at the given coordinates with the current source material +

+
++++ + + + + + + + + + + + + + + + + + + +

x_1 :

X coordinate of the top-left corner

y_1 :

Y coordinate of the top-left corner

x_2 :

X coordinate of the bottom-right corner

y_2 :

Y coordinate of the bottom-right corner
+
+
+
+

cogl_rectangles ()

+
void                cogl_rectangles                     (const float *verts,
+                                                         unsigned int n_rects);
+

+Draws a series of rectangles in the same way that +cogl_rectangle() does. In some situations it can give a +significant performance boost to use this function rather than +calling cogl_rectangle() separately for each rectangle. +

+

+verts should point to an array of floats with +n_rects * 4 elements. Each group of 4 values corresponds to the +parameters x1, y1, x2, and y2, and have the same +meaning as in cogl_rectangle(). +

+
++++ + + + + + + + + + + +

verts :

an array of vertices. [in][array][transfer none] +

n_rects :

number of rectangles to draw
+

Since 1.0

+
+
+
+

cogl_rectangle_with_texture_coords ()

+
void                cogl_rectangle_with_texture_coords  (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         float tx1,
+                                                         float ty1,
+                                                         float tx2,
+                                                         float ty2);
+

+Draw a rectangle using the current material and supply texture coordinates +to be used for the first texture layer of the material. To draw the entire +texture pass in tx1=0.0 ty1=0.0 tx2=1.0 ty2=1.0. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

x1 :

x coordinate upper left on screen.

y1 :

y coordinate upper left on screen.

x2 :

x coordinate lower right on screen.

y2 :

y coordinate lower right on screen.

tx1 :

x part of texture coordinate to use for upper left pixel

ty1 :

y part of texture coordinate to use for upper left pixel

tx2 :

x part of texture coordinate to use for lower right pixel

ty2 :

y part of texture coordinate to use for left pixel
+

Since 1.0

+
+
+
+

cogl_rectangles_with_texture_coords ()

+
void                cogl_rectangles_with_texture_coords (const float *verts,
+                                                         unsigned int n_rects);
+

+Draws a series of rectangles in the same way that +cogl_rectangle_with_texture_coords() does. In some situations it can give a +significant performance boost to use this function rather than +calling cogl_rectangle_with_texture_coords() separately for each rectangle. +

+

+verts should point to an array of floats with +n_rects * 8 elements. Each group of 8 values corresponds to the +parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same +meaning as in cogl_rectangle_with_texture_coords(). +

+
++++ + + + + + + + + + + +

verts :

an array of vertices. [in][array][transfer none] +

n_rects :

number of rectangles to draw
+

Since 0.8.6

+
+
+
+

cogl_rectangle_with_multitexture_coords ()

+
void                cogl_rectangle_with_multitexture_coords
+                                                        (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+

+This function draws a rectangle using the current source material to +texture or fill with. As a material may contain multiple texture layers +this interface lets you supply texture coordinates for each layer of the +material. +

+

+The first pair of coordinates are for the first layer (with the smallest +layer index) and if you supply less texture coordinates than there are +layers in the current source material then default texture coordinates +(0.0, 0.0, 1.0, 1.0) are generated. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

x1 :

x coordinate upper left on screen.

y1 :

y coordinate upper left on screen.

x2 :

x coordinate lower right on screen.

y2 :

y coordinate lower right on screen.

tex_coords :

An array containing groups of +4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture +coordinates; one for the upper left texel, and one for the lower right +texel. Each value should be between 0.0 and 1.0, where the coordinate +(0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the +bottom right. [in][array][transfer none] +

tex_coords_len :

The length of the tex_coords array. (e.g. for one layer +and one group of texture coordinates, this would be 4)
+

Since 1.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-SDL-Integration.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-SDL-Integration.html new file mode 100644 index 0000000..aa1c14f --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-SDL-Integration.html @@ -0,0 +1,489 @@ + + + + +SDL Integration + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

SDL Integration

+

SDL Integration — Integration api for the Simple DirectMedia + Layer library.

+
+
+

Synopsis

+
CoglContext *       cogl_sdl_context_new                (int type,
+                                                         CoglError **error);
+void                cogl_sdl_renderer_set_event_type    (CoglRenderer *renderer,
+                                                         int type);
+int                 cogl_sdl_renderer_get_event_type    (CoglRenderer *renderer);
+void                cogl_sdl_handle_event               (CoglContext *context,
+                                                         SDL_Event *event);
+void                cogl_sdl_idle                       (CoglContext *context);
+SDL_Window *        cogl_sdl_onscreen_get_window        (CoglOnscreen *onscreen);
+
+
+
+

Description

+

+Cogl is a portable graphics api that can either be used standalone +or alternatively integrated with certain existing frameworks. This +api enables Cogl to be used in conjunction with the Simple +DirectMedia Layer library. +

+

+Using this API a typical SDL application would look something like +this: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63

+
+
+
+
+
+
+
+
+
+
+
+
+MyAppData data;
+CoglError *error = NULL;
+
+data.ctx = cogl_sdl_context_new (SDL_USEREVENT, &error);
+if (!data.ctx)
+  {
+    fprintf (stderr, "Failed to create context: %s\n",
+             error->message);
+    return 1;
+  }
+
+my_application_setup (&data);
+
+data.redraw_queued = TRUE;
+while (!data.quit)
+  {
+    while (!data.quit)
+      {
+        if (!SDL_PollEvent (&event))
+          {
+            if (data.redraw_queued)
+              break;
+
+            cogl_sdl_idle (ctx);
+            if (!SDL_WaitEvent (&event))
+              {
+                fprintf (stderr, "Error waiting for SDL events");
+                return 1;
+              }
+          }
+
+         handle_event (&data, &event);
+         cogl_sdl_handle_event (ctx, &event);
+       }
+
+    data.redraw_queued = redraw (&data);
+  }
+
+ +

+

+
+
+

Details

+
+

cogl_sdl_context_new ()

+
CoglContext *       cogl_sdl_context_new                (int type,
+                                                         CoglError **error);
+

+This is a convenience function for creating a new CoglContext for +use with SDL and specifying what SDL user event type Cogl can use +as a way to interrupt SDL_WaitEvent(). +

+

+This function is equivalent to the following code: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40

+
+
+
+
+
+
+
+
+
+
+
+
+CoglRenderer *renderer = cogl_renderer_new ();
+CoglDisplay *display;
+
+cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_SDL);
+
+cogl_sdl_renderer_set_event_type (renderer, type);
+
+if (!cogl_renderer_connect (renderer, error))
+  return NULL;
+
+display = cogl_display_new (renderer, NULL);
+if (!cogl_display_setup (display, error))
+  return NULL;
+
+return cogl_context_new (display, error);
+
+ +

+

+

+

+
+

Note

SDL applications are required to either use this API or +to manually create a CoglRenderer and call +cogl_sdl_renderer_set_event_type().
+

+

+
++++ + + + + + + + + + + +

type :

An SDL user event type between SDL_USEREVENT and +SDL_NUMEVENTS - 1

error :

A CoglError return location.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_sdl_renderer_set_event_type ()

+
void                cogl_sdl_renderer_set_event_type    (CoglRenderer *renderer,
+                                                         int type);
+

+Tells Cogl what SDL user event type it can use as a way to +interrupt SDL_WaitEvent() to ensure that cogl_sdl_handle_event() +will be called in a finite amount of time. +

+

+

+
+

Note

This should only be called on an un-connected +renderer.
+

+

+

+

+
+

Note

For convenience most simple applications can use +cogl_sdl_context_new() if they don't want to manually create +CoglRenderer and CoglDisplay objects during +initialization.
+

+

+
++++ + + + + + + + + + + +

renderer :

A CoglRenderer +

type :

An SDL user event type between SDL_USEREVENT and +SDL_NUMEVENTS - 1
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_sdl_renderer_get_event_type ()

+
int                 cogl_sdl_renderer_get_event_type    (CoglRenderer *renderer);
+

+Queries what SDL user event type Cogl is using as a way to +interrupt SDL_WaitEvent(). This is set either using +cogl_sdl_context_new or by using +cogl_sdl_renderer_set_event_type(). +

+
++++ + + + + +

renderer :

A CoglRenderer +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_sdl_handle_event ()

+
void                cogl_sdl_handle_event               (CoglContext *context,
+                                                         SDL_Event *event);
+

+Passes control to Cogl so that it may dispatch any internal event +callbacks in response to the given SDL event. This function must +be called for every SDL event. +

+
++++ + + + + + + + + + + +

context :

A CoglContext +

event :

An SDL event
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_sdl_idle ()

+
void                cogl_sdl_idle                       (CoglContext *context);
+

+Notifies Cogl that the application is idle and about to call +SDL_WaitEvent(). Cogl may use this to run low priority book keeping +tasks. +

+
++++ + + + + +

context :

A CoglContext +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_sdl_onscreen_get_window ()

+
SDL_Window *        cogl_sdl_onscreen_get_window        (CoglOnscreen *onscreen);
+
++++ + + + + + + + + + + +

onscreen :

A CoglOnscreen +

Returns :

the underlying SDL_Window associated with an onscreen framebuffer.
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html new file mode 100644 index 0000000..3e25129 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html @@ -0,0 +1,1033 @@ + + + + +Shader snippets + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Shader snippets

+

Shader snippets — Functions for creating and manipulating shader snippets

+
+
+

Synopsis

+
                    CoglSnippet;
+enum                CoglSnippetHook;
+CoglSnippet *       cogl_snippet_new                    (CoglSnippetHook hook,
+                                                         const char *declarations,
+                                                         const char *post);
+CoglSnippetHook     cogl_snippet_get_hook               (CoglSnippet *snippet);
+CoglBool            cogl_is_snippet                     (void *object);
+void                cogl_snippet_set_declarations       (CoglSnippet *snippet,
+                                                         const char *declarations);
+const char *        cogl_snippet_get_declarations       (CoglSnippet *snippet);
+void                cogl_snippet_set_pre                (CoglSnippet *snippet,
+                                                         const char *pre);
+const char *        cogl_snippet_get_pre                (CoglSnippet *snippet);
+void                cogl_snippet_set_replace            (CoglSnippet *snippet,
+                                                         const char *replace);
+const char *        cogl_snippet_get_replace            (CoglSnippet *snippet);
+void                cogl_snippet_set_post               (CoglSnippet *snippet,
+                                                         const char *post);
+const char *        cogl_snippet_get_post               (CoglSnippet *snippet);
+
+
+
+

Description

+

+CoglSnippets are used to modify or replace parts of a +CoglPipeline using GLSL. GLSL is a programming language supported +by OpenGL on programmable hardware to provide a more flexible +description of what should be rendered. A description of GLSL +itself is outside the scope of this documentation but any good +OpenGL book should help to describe it. +

+

+Unlike in OpenGL, when using GLSL with Cogl it is possible to write +short snippets to replace small sections of the pipeline instead of +having to replace the whole of either the vertex or fragment +pipelines. Of course it is also possible to replace the whole of +the pipeline if needed. +

+

+Each snippet is a standalone chunk of code which would attach to +the pipeline at a particular point. The code is split into four +separate strings (all of which are optional): +

+

+

+
+
declarations
+

+The code in this string will be inserted outside of any function in +the global scope of the shader. This can be used to declare +uniforms, attributes, varyings and functions to be used by the +snippet. +

+
pre
+

+The code in this string will be inserted before the hook point. +

+
post
+

+The code in this string will be inserted after the hook point. This +can be used to modify the results of the builtin generated code for +that hook point. +

+
replace
+

+If present the code in this string will replace the generated code +for the hook point. +

+
+

+

+

+All of the strings apart from the declarations string of a pipeline +are generated in a single function so they can share variables +declared from one string in another. The scope of the code is +limited to each snippet so local variables declared in the snippet +will not collide with variables declared in another +snippet. However, code in the 'declarations' string is global to +the shader so it is the application's responsibility to ensure that +variables declared here will not collide with those from other +snippets. +

+

+The snippets can be added to a pipeline with +cogl_pipeline_add_snippet() or +cogl_pipeline_add_layer_snippet(). Which function to use depends on +which hook the snippet is targetting. The snippets are all +generated in the order they are added to the pipeline. That is, the +post strings are executed in the order they are added to the +pipeline and the pre strings are executed in reverse order. If any +replace strings are given for a snippet then any other snippets +with the same hook added before that snippet will be ignored. The +different hooks are documented under CoglSnippetHook. +

+

+For portability with GLES2, it is recommended not to use the GLSL +builtin names such as gl_FragColor. Instead there are replacement +names under the cogl_* namespace which can be used instead. These +are: +

+

+

+
+
uniform mat4 + cogl_modelview_matrix
+

+ The current modelview matrix. This is equivalent to + gl_ModelViewMatrix. +

+
uniform mat4 + cogl_projection_matrix
+

+ The current projection matrix. This is equivalent to + gl_ProjectionMatrix. +

+
uniform mat4 + cogl_modelview_projection_matrix
+

+ The combined modelview and projection matrix. A vertex shader + would typically use this to transform the incoming vertex + position. The separate modelview and projection matrices are + usually only needed for lighting calculations. This is + equivalent to gl_ModelViewProjectionMatrix. +

+
uniform mat4 + cogl_texture_matrix[]
+

+ An array of matrices for transforming the texture + coordinates. This is equivalent to gl_TextureMatrix. +

+
+

+

+

+In a vertex shader, the following are also available: +

+

+

+
+
attribute vec4 + cogl_position_in
+

+ The incoming vertex position. This is equivalent to gl_Vertex. +

+
attribute vec4 + cogl_color_in
+

+ The incoming vertex color. This is equivalent to gl_Color. +

+
attribute vec4 + cogl_tex_coord_in
+

+ The texture coordinate for layer 0. This is an alternative name + for cogl_tex_coord0_in. +

+
attribute vec4 + cogl_tex_coord0_in
+

+ The texture coordinate for the layer 0. This is equivalent to + gl_MultiTexCoord0. There will also be cogl_tex_coord1_in and + so on if more layers are added to the pipeline. +

+
attribute vec3 + cogl_normal_in
+

+ The normal of the vertex. This is equivalent to gl_Normal. +

+
vec4 + cogl_position_out
+

+ The calculated position of the vertex. This must be written to + in all vertex shaders. This is equivalent to gl_Position. +

+
float + cogl_point_size_in
+

+ The incoming point size from the cogl_point_size_in attribute. + This is only available if + cogl_pipeline_set_per_vertex_point_size() is set on the + pipeline. +

+
float + cogl_point_size_out
+

+ The calculated size of a point. This is equivalent to gl_PointSize. +

+
varying vec4 + cogl_color_out
+

+ The calculated color of a vertex. This is equivalent to gl_FrontColor. +

+
varying vec4 + cogl_tex_coord0_out
+

+ The calculated texture coordinate for layer 0 of the pipeline. + This is equivalent to gl_TexCoord[0]. There will also be + cogl_tex_coord1_out and so on if more layers are added to the + pipeline. In the fragment shader, this varying is called + cogl_tex_coord0_in. +

+
+

+

+

+In a fragment shader, the following are also available: +

+

+

+
+
varying vec4 cogl_color_in
+

+ The calculated color of a vertex. This is equivalent to gl_FrontColor. +

+
varying vec4 + cogl_tex_coord0_in
+

+ The texture coordinate for layer 0. This is equivalent to + gl_TexCoord[0]. There will also be cogl_tex_coord1_in and so + on if more layers are added to the pipeline. +

+
vec4 cogl_color_out
+

+ The final calculated color of the fragment. All fragment shaders + must write to this variable. This is equivalent to + gl_FrontColor. +

+
float cogl_depth_out
+

+ An optional output variable specifying the depth value to use + for this fragment. This is equivalent to gl_FragDepth. +

+
bool cogl_front_facing
+

+ A readonly variable that will be true if the current primitive + is front facing. This can be used to implement two-sided + coloring algorithms. This is equivalent to gl_FrontFacing. +

+
vec2 cogl_point_coord
+

+ When rendering points, this will contain a vec2 which represents + the position within the point of the current fragment. + vec2(0.0,0.0) will be the topleft of the point and vec2(1.0,1.0) + will be the bottom right. Note that there is currently a bug in + Cogl where when rendering to an offscreen buffer these + coordinates will be upside-down. The value is undefined when not + rendering points. This builtin can only be used if the + COGL_FEATURE_ID_POINT_SPRITE feature is available. +

+
+

+

+

+Here is an example of using a snippet to add a desaturate effect to the +generated color on a pipeline. +

+

+

+
+  CoglPipeline *pipeline = cogl_pipeline_new ();
+
+  /* Set up the pipeline here, ie by adding a texture or other
+     layers */
+
+  /* Create the snippet. The first string is the declarations which
+     we will use to add a uniform. The second is the 'post' string which
+     will contain the code to perform the desaturation. */
+  CoglSnippet *snippet =
+    cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
+                      "uniform float factor;",
+                      "float gray = dot (vec3 (0.299, 0.587, 0.114), "
+                      "                  cogl_color_out.rgb);"
+                      "cogl_color_out.rgb = mix (vec3 (gray),"
+                      "                          cogl_color_out.rgb,"
+                      "                          factor);");
+
+  /* Add it to the pipeline */
+  cogl_pipeline_add_snippet (pipeline, snippet);
+  /* The pipeline keeps a reference to the snippet
+     so we don't need to */
+  cogl_object_unref (snippet);
+
+  /* Update the custom uniform on the pipeline */
+  int location = cogl_pipeline_get_uniform_location (pipeline, "factor");
+  cogl_pipeline_set_uniform_1f (pipeline, location, 0.5f);
+
+  /* Now we can render with the snippet as usual */
+  cogl_push_source (pipeline);
+  cogl_rectangle (0, 0, 10, 10);
+  cogl_pop_source ();
+
+

+

+
+
+

Details

+
+

CoglSnippet

+
typedef struct _CoglSnippet CoglSnippet;
+
+
+
+

enum CoglSnippetHook

+
typedef enum {
+  /* Per pipeline vertex hooks */
+  COGL_SNIPPET_HOOK_VERTEX = 0,
+  COGL_SNIPPET_HOOK_VERTEX_TRANSFORM,
+  COGL_SNIPPET_HOOK_VERTEX_GLOBALS,
+  COGL_SNIPPET_HOOK_POINT_SIZE,
+
+  /* Per pipeline fragment hooks */
+  COGL_SNIPPET_HOOK_FRAGMENT = 2048,
+  COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS,
+
+  /* Per layer vertex hooks */
+  COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM = 4096,
+
+  /* Per layer fragment hooks */
+  COGL_SNIPPET_HOOK_LAYER_FRAGMENT = 6144,
+  COGL_SNIPPET_HOOK_TEXTURE_LOOKUP
+} CoglSnippetHook;
+
+

+CoglSnippetHook is used to specify a location within a +CoglPipeline where the code of the snippet should be used when it +is attached to a pipeline. +

+

+

+
+
COGL_SNIPPET_HOOK_VERTEX_GLOBALS
+

+Adds a shader snippet at the beginning of the global section of the +shader for the vertex processing. Any declarations here can be +shared with all other snippets that are attached to a vertex hook. +Only the ‘declarations’ string is used and the other strings are +ignored. +

+
COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS
+

+Adds a shader snippet at the beginning of the global section of the +shader for the fragment processing. Any declarations here can be +shared with all other snippets that are attached to a fragment +hook. Only the ‘declarations’ string is used and the other strings +are ignored. +

+
COGL_SNIPPET_HOOK_VERTEX
+
+

+Adds a shader snippet that will hook on to the vertex processing +stage of the pipeline. This gives a chance for the application to +modify the vertex attributes generated by the shader. Typically the +snippet will modify cogl_color_out or cogl_position_out builtins. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted at the top of the +main() function before any vertex processing is done. +

+

+The ‘replace’ string in snippet will be used instead of the +generated vertex processing if it is present. This can be used if +the application wants to provide a complete vertex shader and +doesn't need the generated output from Cogl. +

+

+The ‘post’ string in snippet will be inserted after all of the +standard vertex processing is done. This can be used to modify the +outputs. +

+
+
COGL_SNIPPET_HOOK_VERTEX_TRANSFORM
+
+

+Adds a shader snippet that will hook on to the vertex transform stage. +Typically the snippet will use the cogl_modelview_matrix, +cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the +cogl_position_in attribute. The hook must write to cogl_position_out. +The default processing for this hook will multiply cogl_position_in by +the combined modelview-projection matrix and store it on cogl_position_out. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted at the top of the +main() function before the vertex transform is done. +

+

+The ‘replace’ string in snippet will be used instead of the +generated vertex transform if it is present. +

+

+The ‘post’ string in snippet will be inserted after all of the +standard vertex transformation is done. This can be used to modify the +cogl_position_out in addition to the default processing. +

+
+
COGL_SNIPPET_HOOK_POINT_SIZE
+
+

+Adds a shader snippet that will hook on to the point size +calculation step within the vertex shader stage. The snippet should +write to the builtin cogl_point_size_out with the new point size. +The snippet can either read cogl_point_size_in directly and write a +new value or first read an existing value in cogl_point_size_out +that would be set by a previous snippet. Note that this hook is +only used if cogl_pipeline_set_per_vertex_point_size() is enabled +on the pipeline. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted just before +calculating the point size. +

+

+The ‘replace’ string in snippet will be used instead of the +generated point size calculation if it is present. +

+

+The ‘post’ string in snippet will be inserted after the +standard point size calculation is done. This can be used to modify +cogl_point_size_out in addition to the default processing. +

+
+
COGL_SNIPPET_HOOK_FRAGMENT
+
+

+Adds a shader snippet that will hook on to the fragment processing +stage of the pipeline. This gives a chance for the application to +modify the fragment color generated by the shader. Typically the +snippet will modify cogl_color_out. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted at the top of the +main() function before any fragment processing is done. +

+

+The ‘replace’ string in snippet will be used instead of the +generated fragment processing if it is present. This can be used if +the application wants to provide a complete fragment shader and +doesn't need the generated output from Cogl. +

+

+The ‘post’ string in snippet will be inserted after all of the +standard fragment processing is done. At this point the generated +value for the rest of the pipeline state will already be in +cogl_color_out so the application can modify the result by altering +this variable. +

+
+
COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM
+
+

+Adds a shader snippet that will hook on to the texture coordinate +transformation of a particular layer. This can be used to replace +the processing for a layer or to modify the results. +

+

+Within the snippet code for this hook there are two extra +variables. The first is a mat4 called cogl_matrix which represents +the user matrix for this layer. The second is called cogl_tex_coord +and represents the incoming and outgoing texture coordinate. On +entry to the hook, cogl_tex_coord contains the value of the +corresponding texture coordinate attribute for this layer. The hook +is expected to modify this variable. The output will be passed as a +varying to the fragment processing stage. The default code will +just multiply cogl_matrix by cogl_tex_coord and store the result in +cogl_tex_coord. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted just before the +fragment processing for this layer. At this point cogl_tex_coord +still contains the value of the texture coordinate attribute. +

+

+If a ‘replace’ string is given then this will be used instead of +the default fragment processing for this layer. The snippet can +modify cogl_tex_coord or leave it as is to apply no transformation. +

+

+The ‘post’ string in snippet will be inserted just after the +transformation. At this point cogl_tex_coord will contain the +results of the transformation but it can be further modified by the +snippet. +

+
+
COGL_SNIPPET_HOOK_LAYER_FRAGMENT
+
+

+Adds a shader snippet that will hook on to the fragment processing +of a particular layer. This can be used to replace the processing +for a layer or to modify the results. +

+

+Within the snippet code for this hook there is an extra vec4 +variable called ‘cogl_layer’. This contains the resulting color +that will be used for the layer. This can be modified in the ‘post’ +section or it the default processing can be replaced entirely using +the ‘replace’ section. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted just before the +fragment processing for this layer. +

+

+If a ‘replace’ string is given then this will be used instead of +the default fragment processing for this layer. The snippet must write to +the ‘cogl_layer’ variable in that case. +

+

+The ‘post’ string in snippet will be inserted just after the +fragment processing for the layer. The results can be modified by changing +the value of the ‘cogl_layer’ variable. +

+
+
COGL_SNIPPET_HOOK_TEXTURE_LOOKUP
+
+

+Adds a shader snippet that will hook on to the texture lookup part +of a given layer. This gives a chance for the application to modify +the coordinates that will be used for the texture lookup or to +alter the returned texel. +

+

+Within the snippet code for this hook there are three extra +variables available. ‘cogl_sampler’ is a sampler object +representing the sampler for the layer where the snippet is +attached. ‘cogl_tex_coord’ is a vec4 which contains the texture +coordinates that will be used for the texture lookup. This can be +modified. ‘cogl_texel’ will contain the result of the texture +lookup. This can also be modified. +

+

+The ‘declarations’ string in snippet will be inserted in the +global scope of the shader. Use this to declare any uniforms, +attributes or functions that the snippet requires. +

+

+The ‘pre’ string in snippet will be inserted at the top of the +main() function before any fragment processing is done. This is a +good place to modify the cogl_tex_coord variable. +

+

+If a ‘replace’ string is given then this will be used instead of a +the default texture lookup. The snippet would typically use its own +sampler in this case. +

+

+The ‘post’ string in snippet will be inserted after texture lookup +has been preformed. Here the snippet can modify the cogl_texel +variable to alter the returned texel. +

+
+
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_SNIPPET_HOOK_VERTEX

A hook for the entire vertex processing + stage of the pipeline. +

COGL_SNIPPET_HOOK_VERTEX_TRANSFORM

A hook for the vertex transformation. +

COGL_SNIPPET_HOOK_VERTEX_GLOBALS

A hook for declaring global data + that can be shared with all other snippets that are on a vertex + hook. +

COGL_SNIPPET_HOOK_POINT_SIZE

A hook for manipulating the point + size of a vertex. This is only used if + cogl_pipeline_set_per_vertex_point_size() is enabled on the + pipeline. +

COGL_SNIPPET_HOOK_FRAGMENT

A hook for the entire fragment + processing stage of the pipeline. +

COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS

A hook for declaring global + data wthat can be shared with all other snippets that are on a + fragment hook. +

COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM

A hook for applying the + layer matrix to a texture coordinate for a layer. +

COGL_SNIPPET_HOOK_LAYER_FRAGMENT

A hook for the fragment + processing of a particular layer. +

COGL_SNIPPET_HOOK_TEXTURE_LOOKUP

A hook for the texture lookup + stage of a given layer in a pipeline. +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_new ()

+
CoglSnippet *       cogl_snippet_new                    (CoglSnippetHook hook,
+                                                         const char *declarations,
+                                                         const char *post);
+

+Allocates and initializes a new snippet with the given source strings. +

+
++++ + + + + + + + + + + + + + + + + + + +

hook :

The point in the pipeline that this snippet will wrap around +or replace.

declarations :

The source code for the declarations for this +snippet or NULL. See cogl_snippet_set_declarations().

post :

The source code to run after the hook point where this +shader snippet is attached or NULL. See cogl_snippet_set_post().

Returns :

a pointer to a new CoglSnippet +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_get_hook ()

+
CoglSnippetHook     cogl_snippet_get_hook               (CoglSnippet *snippet);
+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

Returns :

the hook that was set when cogl_snippet_new() was +called.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_snippet ()

+
CoglBool            cogl_is_snippet                     (void *object);
+

+Gets whether the given object references an existing snippet object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglSnippet, +FALSE otherwise
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_set_declarations ()

+
void                cogl_snippet_set_declarations       (CoglSnippet *snippet,
+                                                         const char *declarations);
+

+Sets a source string that will be inserted in the global scope of +the generated shader when this snippet is used on a pipeline. This +string is typically used to declare uniforms, attributes or +functions that will be used by the other parts of the snippets. +

+

+This function should only be called before the snippet is attached +to its first pipeline. After that the snippet should be considered +immutable. +

+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

declarations :

The new source string for the declarations section +of this snippet.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_get_declarations ()

+
const char *        cogl_snippet_get_declarations       (CoglSnippet *snippet);
+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

Returns :

the source string that was set with +cogl_snippet_set_declarations() or NULL if none was set.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_set_pre ()

+
void                cogl_snippet_set_pre                (CoglSnippet *snippet,
+                                                         const char *pre);
+

+Sets a source string that will be inserted before the hook point in +the generated shader for the pipeline that this snippet is attached +to. Please see the documentation of each hook point in +CoglPipeline for a description of how this string should be used. +

+

+This function should only be called before the snippet is attached +to its first pipeline. After that the snippet should be considered +immutable. +

+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

pre :

The new source string for the pre section of this snippet.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_get_pre ()

+
const char *        cogl_snippet_get_pre                (CoglSnippet *snippet);
+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

Returns :

the source string that was set with +cogl_snippet_set_pre() or NULL if none was set.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_set_replace ()

+
void                cogl_snippet_set_replace            (CoglSnippet *snippet,
+                                                         const char *replace);
+

+Sets a source string that will be used instead of any generated +source code or any previous snippets for this hook point. Please +see the documentation of each hook point in CoglPipeline for a +description of how this string should be used. +

+

+This function should only be called before the snippet is attached +to its first pipeline. After that the snippet should be considered +immutable. +

+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

replace :

The new source string for the replace section of this snippet.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_get_replace ()

+
const char *        cogl_snippet_get_replace            (CoglSnippet *snippet);
+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

Returns :

the source string that was set with +cogl_snippet_set_replace() or NULL if none was set.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_set_post ()

+
void                cogl_snippet_set_post               (CoglSnippet *snippet,
+                                                         const char *post);
+

+Sets a source string that will be inserted after the hook point in +the generated shader for the pipeline that this snippet is attached +to. Please see the documentation of each hook point in +CoglPipeline for a description of how this string should be used. +

+

+This function should only be called before the snippet is attached +to its first pipeline. After that the snippet should be considered +immutable. +

+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

post :

The new source string for the post section of this snippet.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_snippet_get_post ()

+
const char *        cogl_snippet_get_post               (CoglSnippet *snippet);
+
++++ + + + + + + + + + + +

snippet :

A CoglSnippet +

Returns :

the source string that was set with +cogl_snippet_set_post() or NULL if none was set.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sliced-Textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sliced-Textures.html new file mode 100644 index 0000000..36594e4 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sliced-Textures.html @@ -0,0 +1,478 @@ + + + + +Sliced Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Sliced Textures

+

Sliced Textures — Functions for creating and manipulating 2D meta + textures that may internally be comprised of + multiple 2D textures with power-of-two sizes.

+
+
+

Synopsis

+
                    CoglTexture2DSliced;
+CoglTexture2DSliced * cogl_texture_2d_sliced_new_with_size
+                                                        (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         int max_waste);
+CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_file
+                                                        (CoglContext *ctx,
+                                                         const char *filename,
+                                                         int max_waste,
+                                                         CoglError **error);
+CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_data
+                                                        (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         int max_waste,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_bitmap
+                                                        (CoglBitmap *bmp,
+                                                         int max_waste);
+CoglBool            cogl_is_texture_2d_sliced           (void *object);
+
+
+
+

Description

+

+These functions allow high-level meta textures (See the +CoglMetaTexture interface) to be allocated that may internally be +comprised of multiple 2D texture "slices" with power-of-two sizes. +

+

+This API can be useful when working with GPUs that don't have +native support for non-power-of-two textures or if you want to load +a texture that is larger than the GPUs maximum texture size limits. +

+

+The algorithm for slicing works by first trying to map a virtual +size to the next larger power-of-two size and then seeing how many +wasted pixels that would result in. For example if you have a +virtual texture that's 259 texels wide, the next pot size = 512 and +the amount of waste would be 253 texels. If the amount of waste is +above a max-waste threshold then we would next slice that texture +into one that's 256 texels and then looking at how many more texels +remain unallocated after that we choose the next power-of-two size. +For the example of a 259 texel image that would mean having a 256 +texel wide texture, leaving 3 texels unallocated so we'd then +create a 4 texel wide texture - now there is only one texel of +waste. The algorithm continues to slice the right most textures +until the amount of waste is less than or equal to a specfied +max-waste threshold. The same logic for slicing from left to right +is also applied from top to bottom. +

+
+
+

Details

+
+

CoglTexture2DSliced

+
typedef struct _CoglTexture2DSliced CoglTexture2DSliced;
+
+
+
+

cogl_texture_2d_sliced_new_with_size ()

+
CoglTexture2DSliced * cogl_texture_2d_sliced_new_with_size
+                                                        (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         int max_waste);
+

+Creates a CoglTexture2DSliced that may internally be comprised of +1 or more CoglTexture2D textures depending on GPU limitations. +For example if the GPU only supports power-of-two sized textures +then a sliced texture will turn a non-power-of-two size into a +combination of smaller power-of-two sized textures. If the +requested texture size is larger than is supported by the hardware +then the texture will be sliced into smaller textures that can be +accessed by the hardware. +

+

+max_waste is used as a threshold for recursively slicing the +right-most or bottom-most slices into smaller sizes until the +wasted padding at the bottom and right of the textures is less than +specified. A negative max_waste will disable slicing. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or let Cogl automatically allocate +storage lazily. +

+

+

+
+

Note

It's possible for the allocation of a sliced texture to fail +later due to impossible slicing constraints if a negative +max_waste value is given. If the given virtual texture size size +is larger than is supported by the hardware but slicing is disabled +the texture size would be too large to handle.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

width :

The virtual width of your sliced texture.

height :

The virtual height of your sliced texture.

max_waste :

The threshold of how wide a strip of wasted texels +are allowed along the right and bottom textures before +they must be sliced to reduce the amount of waste. A +negative can be passed to disable slicing.

Returns :

A new CoglTexture2DSliced object with no storage +allocated yet. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_texture_2d_sliced_new_from_file ()

+
CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_file
+                                                        (CoglContext *ctx,
+                                                         const char *filename,
+                                                         int max_waste,
+                                                         CoglError **error);
+

+Creates a CoglTexture2DSliced from an image file. +

+

+A CoglTexture2DSliced may internally be comprised of 1 or more +CoglTexture2D textures depending on GPU limitations. For example +if the GPU only supports power-of-two sized textures then a sliced +texture will turn a non-power-of-two size into a combination of +smaller power-of-two sized textures. If the requested texture size +is larger than is supported by the hardware then the texture will +be sliced into smaller textures that can be accessed by the +hardware. +

+

+max_waste is used as a threshold for recursively slicing the +right-most or bottom-most slices into smaller sizes until the +wasted padding at the bottom and right of the textures is less than +specified. A negative max_waste will disable slicing. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or let Cogl automatically allocate +storage lazily. +

+

+

+
+

Note

It's possible for the allocation of a sliced texture to fail +later due to impossible slicing constraints if a negative +max_waste value is given. If the given virtual texture size is +larger than is supported by the hardware but slicing is disabled +the texture size would be too large to handle.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

filename :

the file to load

max_waste :

The threshold of how wide a strip of wasted texels +are allowed along the right and bottom textures before +they must be sliced to reduce the amount of waste. A +negative can be passed to disable slicing.

error :

A CoglError to catch exceptional errors or NULL +

Returns :

A newly created CoglTexture2DSliced +or NULL on failure and error will be updated. [transfer full] +
+

Since 1.16

+
+
+
+

cogl_texture_2d_sliced_new_from_data ()

+
CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_data
+                                                        (CoglContext *ctx,
+                                                         int width,
+                                                         int height,
+                                                         int max_waste,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+

+Creates a new CoglTexture2DSliced texture based on data residing +in memory. +

+

+A CoglTexture2DSliced may internally be comprised of 1 or more +CoglTexture2D textures depending on GPU limitations. For example +if the GPU only supports power-of-two sized textures then a sliced +texture will turn a non-power-of-two size into a combination of +smaller power-of-two sized textures. If the requested texture size +is larger than is supported by the hardware then the texture will +be sliced into smaller textures that can be accessed by the +hardware. +

+

+max_waste is used as a threshold for recursively slicing the +right-most or bottom-most slices into smaller sizes until the +wasted padding at the bottom and right of the textures is less than +specified. A negative max_waste will disable slicing. +

+

+

+
+

Note

This api will always immediately allocate GPU memory for all +the required texture slices and upload the given data so that the +data pointer does not need to remain valid once this function +returns. This means it is not possible to configure the texture +before it is allocated. If you do need to configure the texture +before allocation (to specify constraints on the internal format +for example) then you can instead create a CoglBitmap for your +data and use cogl_texture_2d_sliced_new_from_bitmap() or use +cogl_texture_2d_sliced_new_with_size() and then upload data using +cogl_texture_set_data() +
+

+

+

+

+
+

Note

It's possible for the allocation of a sliced texture to fail +due to impossible slicing constraints if a negative max_waste +value is given. If the given virtual texture size is larger than is +supported by the hardware but slicing is disabled the texture size +would be too large to handle.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext +

width :

width of texture in pixels

height :

height of texture in pixels

format :

the CoglPixelFormat the buffer is stored in in RAM

max_waste :

The threshold of how wide a strip of wasted texels +are allowed along the right and bottom textures before +they must be sliced to reduce the amount of waste. A +negative can be passed to disable slicing.

rowstride :

the memory offset in bytes between the start of each +row in data. A value of 0 will make Cogl automatically +calculate rowstride from width and format.

data :

pointer the memory region where the source buffer resides

error :

A CoglError to catch exceptional errors or NULL +

Returns :

A newly created CoglTexture2DSliced +or NULL on failure and error will be updated. [transfer full] +
+

Since 1.16

+
+
+
+

cogl_texture_2d_sliced_new_from_bitmap ()

+
CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_bitmap
+                                                        (CoglBitmap *bmp,
+                                                         int max_waste);
+

+Creates a new CoglTexture2DSliced texture based on data residing +in a bitmap. +

+

+A CoglTexture2DSliced may internally be comprised of 1 or more +CoglTexture2D textures depending on GPU limitations. For example +if the GPU only supports power-of-two sized textures then a sliced +texture will turn a non-power-of-two size into a combination of +smaller power-of-two sized textures. If the requested texture size +is larger than is supported by the hardware then the texture will +be sliced into smaller textures that can be accessed by the +hardware. +

+

+max_waste is used as a threshold for recursively slicing the +right-most or bottom-most slices into smaller sizes until the +wasted padding at the bottom and right of the textures is less than +specified. A negative max_waste will disable slicing. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or let Cogl automatically allocate +storage lazily. +

+

+

+
+

Note

It's possible for the allocation of a sliced texture to fail +later due to impossible slicing constraints if a negative +max_waste value is given. If the given virtual texture size is +larger than is supported by the hardware but slicing is disabled +the texture size would be too large to handle.
+

+

+
++++ + + + + + + + + + + + + + + +

bmp :

A CoglBitmap +

max_waste :

The threshold of how wide a strip of wasted texels +are allowed along the right and bottom textures before +they must be sliced to reduce the amount of waste. A +negative can be passed to disable slicing.

Returns :

A newly created CoglTexture2DSliced +or NULL on failure and error will be updated. [transfer full] +
+

Since 1.16

+
+
+
+

cogl_is_texture_2d_sliced ()

+
CoglBool            cogl_is_texture_2d_sliced           (void *object);
+

+Gets whether the given object references a CoglTexture2DSliced. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a CoglTexture2DSliced +and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sub-Textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sub-Textures.html new file mode 100644 index 0000000..864ce78 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sub-Textures.html @@ -0,0 +1,171 @@ + + + + +Sub Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Sub Textures

+

Sub Textures — Functions for creating and manipulating + sub-textures.

+
+
+

Synopsis

+
                    CoglSubTexture;
+CoglSubTexture *    cogl_sub_texture_new                (CoglContext *ctx,
+                                                         CoglTexture *parent_texture,
+                                                         int sub_x,
+                                                         int sub_y,
+                                                         int sub_width,
+                                                         int sub_height);
+CoglBool            cogl_is_sub_texture                 (void *object);
+
+
+
+

Description

+

+These functions allow high-level textures to be created that +represent a sub-region of another texture. For example these +can be used to implement custom texture atlasing schemes. +

+
+
+

Details

+
+

CoglSubTexture

+
typedef struct _CoglSubTexture CoglSubTexture;
+
+
+
+

cogl_sub_texture_new ()

+
CoglSubTexture *    cogl_sub_texture_new                (CoglContext *ctx,
+                                                         CoglTexture *parent_texture,
+                                                         int sub_x,
+                                                         int sub_y,
+                                                         int sub_width,
+                                                         int sub_height);
+

+Creates a high-level CoglSubTexture representing a sub-region of +any other CoglTexture. The sub-region must strictly lye within the +bounds of the parent_texture. The returned texture implements the +CoglMetaTexture interface because it's not a low level texture +that hardware can understand natively. +

+

+

+
+

Note

Remember: Unless you are using high level drawing APIs such +as cogl_rectangle() or other APIs documented to understand the +CoglMetaTexture interface then you need to use the +CoglMetaTexture interface to resolve a CoglSubTexture into a +low-level texture before drawing.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

ctx :

A CoglContext pointer

parent_texture :

The full texture containing a sub-region you want +to make a CoglSubTexture from.

sub_x :

The top-left x coordinate of the parent region to make +a texture from.

sub_y :

The top-left y coordinate of the parent region to make +a texture from.

sub_width :

The width of the parent region to make a texture from.

sub_height :

The height of the parent region to make a texture +from.

Returns :

A newly allocated CoglSubTexture +representing a sub-region of parent_texture. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_sub_texture ()

+
CoglBool            cogl_is_sub_texture                 (void *object);
+

+Checks whether object is a CoglSubTexture. +

+
++++ + + + + + + + + + + +

object :

a CoglObject +

Returns :

+TRUE if the passed object represents a +CoglSubTexture and FALSE otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Object-Interface.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Object-Interface.html new file mode 100644 index 0000000..9c83fe3 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Object-Interface.html @@ -0,0 +1,332 @@ + + + + +The Object Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Object Interface

+

The Object Interface

+
+
+

Synopsis

+
                    CoglObject;
+void *              cogl_object_ref                     (void *object);
+void                cogl_object_unref                   (void *object);
+                    CoglUserDataKey;
+typedef             CoglUserDataDestroyCallback;
+void *              cogl_object_get_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key);
+void                cogl_object_set_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+
+
+
+

Description

+
+
+

Details

+
+

CoglObject

+
typedef struct _CoglObject CoglObject;
+

+Ref Func: cogl_object_ref +Unref Func: cogl_object_unref +Set Value Func: cogl_object_value_set_object +Get Value Func: cogl_object_value_get_object +

+
+
+
+

cogl_object_ref ()

+
void *              cogl_object_ref                     (void *object);
+

+Increases the reference count of object by 1 +

+
++++ + + + + + + + + + + +

object :

a CoglObject +

Returns :

the object, with its reference count increased
+
+
+
+

cogl_object_unref ()

+
void                cogl_object_unref                   (void *object);
+

+Drecreases the reference count of object by 1; if the reference +count reaches 0, the resources allocated by object will be freed +

+
++++ + + + + +

object :

a CoglObject +
+
+
+
+

CoglUserDataKey

+
typedef struct {
+  int unused;
+} CoglUserDataKey;
+
+

+A CoglUserDataKey is used to declare a key for attaching data to a +CoglObject using cogl_object_set_user_data. The typedef only exists as a +formality to make code self documenting since only the unique address of a +CoglUserDataKey is used. +

+

+Typically you would declare a static CoglUserDataKey and set private data +on an object something like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40

+
+
+
+
+
+
+
+
+
+
+
+
+static CoglUserDataKey path_private_key;
+
+static void
+destroy_path_private_cb (void *data)
+{
+  g_free (data);
+}
+
+static void
+my_path_set_data (CoglPath *path, void *data)
+{
+  cogl_object_set_user_data (COGL_OBJECT (path),
+                             &private_key,
+                             data,
+                             destroy_path_private_cb);
+}
+
+ +

+

+
++++ + + + + +

int unused;

ignored.
+

Since 1.4

+
+
+
+

CoglUserDataDestroyCallback

+
typedef GDestroyNotify CoglUserDataDestroyCallback;
+
+

+When associating private data with a CoglObject a callback can be +given which will be called either if the object is destroyed or if +cogl_object_set_user_data() is called with NULL user_data for the +same key. +

+

Since 1.4

+
+
+
+

cogl_object_get_user_data ()

+
void *              cogl_object_get_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key);
+

+Finds the user data previously associated with object using +the given key. If no user data has been associated with object +for the given key this function returns NULL. +

+
++++ + + + + + + + + + + + + + + +

object :

The object with associated private data to query

key :

The address of a CoglUserDataKey which provides a unique value +with which to index the private data.

Returns :

The user data previously associated +with object using the given key; or NULL if no associated +data is found. [transfer none] +
+

Since 1.4

+
+
+
+

cogl_object_set_user_data ()

+
void                cogl_object_set_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+

+Associates some private user_data with a given CoglObject. To +later remove the association call cogl_object_set_user_data() with +the same key but NULL for the user_data. +

+
++++ + + + + + + + + + + + + + + + + + + +

object :

The object to associate private data with

key :

The address of a CoglUserDataKey which provides a unique value +with which to index the private data.

user_data :

The data to associate with the given object, +or NULL to remove a previous association.

destroy :

A CoglUserDataDestroyCallback to call if the object is +destroyed or if the association is removed by later setting +NULL data for the same key.
+

Since 1.4

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Texture-Interface.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Texture-Interface.html new file mode 100644 index 0000000..1512ea7 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Texture-Interface.html @@ -0,0 +1,902 @@ + + + + +The Texture Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Texture Interface

+

The Texture Interface — Functions for creating and manipulating textures

+
+
+

Synopsis

+
typedef             CoglTexture;
+CoglBool            cogl_is_texture                     (void *object);
+
+#define             COGL_TEXTURE_ERROR
+enum                CoglTextureError;
+
+CoglBool            cogl_texture_allocate               (CoglTexture *texture,
+                                                         CoglError **error);
+unsigned int        cogl_texture_get_width              (CoglTexture *texture);
+unsigned int        cogl_texture_get_height             (CoglTexture *texture);
+CoglBool            cogl_texture_is_sliced              (CoglTexture *texture);
+int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         uint8_t *data);
+CoglBool            cogl_texture_set_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         int level,
+                                                         CoglError **error);
+CoglBool            cogl_texture_set_region             (CoglTexture *texture,
+                                                         int src_x,
+                                                         int src_y,
+                                                         int dst_x,
+                                                         int dst_y,
+                                                         unsigned int dst_width,
+                                                         unsigned int dst_height,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         const uint8_t *data);
+enum                CoglTextureType;
+enum                CoglTextureComponents;
+void                cogl_texture_set_components         (CoglTexture *texture,
+                                                         CoglTextureComponents components);
+CoglTextureComponents cogl_texture_get_components       (CoglTexture *texture);
+void                cogl_texture_set_premultiplied      (CoglTexture *texture,
+                                                         CoglBool premultiplied);
+CoglBool            cogl_texture_get_premultiplied      (CoglTexture *texture);
+
+
+
+

Description

+

+Cogl allows creating and manipulating textures using a uniform +API that tries to hide all the various complexities of creating, +loading and manipulating textures. +

+
+
+

Details

+
+

CoglTexture

+
typedef void CoglTexture;
+
+
+
+
+

cogl_is_texture ()

+
CoglBool            cogl_is_texture                     (void *object);
+

+Gets whether the given object references a texture object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a texture, and +FALSE otherwise
+
+
+
+

COGL_TEXTURE_ERROR

+
#define COGL_TEXTURE_ERROR (cogl_texture_error_quark ())
+
+

+CoglError domain for texture errors. +

+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

enum CoglTextureError

+
typedef enum {
+  COGL_TEXTURE_ERROR_SIZE,
+  COGL_TEXTURE_ERROR_FORMAT,
+  COGL_TEXTURE_ERROR_BAD_PARAMETER,
+  COGL_TEXTURE_ERROR_TYPE
+} CoglTextureError;
+
+

+Error codes that can be thrown when allocating textures. +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_TEXTURE_ERROR_SIZE

Unsupported size +

COGL_TEXTURE_ERROR_FORMAT

Unsupported format +

COGL_TEXTURE_ERROR_BAD_PARAMETER

COGL_TEXTURE_ERROR_TYPE

A primitive texture type that is + unsupported by the driver was used +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_texture_allocate ()

+
CoglBool            cogl_texture_allocate               (CoglTexture *texture,
+                                                         CoglError **error);
+

+Explicitly allocates the storage for the given texture which +allows you to be sure that there is enough memory for the +texture and if not then the error can be handled gracefully. +

+

+

+
+

Note

Normally applications don't need to use this api directly +since the texture will be implicitly allocated when data is set on +the texture, or if the texture is attached to a CoglOffscreen +framebuffer and rendered too.
+

+

+
++++ + + + + + + + + + + + + + + +

texture :

A CoglTexture +

error :

A CoglError to return exceptional errors or NULL +

Returns :

+TRUE if the texture was successfully allocated, +otherwise FALSE and error will be updated if it +wasn't NULL.
+
+
+
+

cogl_texture_get_width ()

+
unsigned int        cogl_texture_get_width              (CoglTexture *texture);
+

+Queries the width of a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the width of the GPU side texture in pixels
+
+
+
+

cogl_texture_get_height ()

+
unsigned int        cogl_texture_get_height             (CoglTexture *texture);
+

+Queries the height of a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the height of the GPU side texture in pixels
+
+
+
+

cogl_texture_is_sliced ()

+
CoglBool            cogl_texture_is_sliced              (CoglTexture *texture);
+

+Queries if a texture is sliced (stored as multiple GPU side tecture +objects). +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

+TRUE if the texture is sliced, FALSE if the texture +is stored as a single GPU texture
+
+
+
+

cogl_texture_get_data ()

+
int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         uint8_t *data);
+

+Copies the pixel data from a cogl texture to system memory. +

+

+

+
+

Note

Don't pass the value of cogl_texture_get_rowstride() as the +rowstride argument, the rowstride should be the rowstride you +want for the destination data buffer not the rowstride of the +source texture
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

texture :

a CoglTexture pointer.

format :

the CoglPixelFormat to store the texture as.

rowstride :

the rowstride of data in bytes or pass 0 to calculate +from the bytes-per-pixel of format multiplied by the +texture width.

data :

memory location to write the texture's contents, or NULL +to only query the data size through the return value.

Returns :

the size of the texture data in bytes
+
+
+
+

cogl_texture_set_data ()

+
CoglBool            cogl_texture_set_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         const uint8_t *data,
+                                                         int level,
+                                                         CoglError **error);
+

+Sets all the pixels for a given mipmap level by copying the pixel +data pointed to by the data argument into the given texture. +

+

+data should point to the first pixel to copy corresponding +to the top left of the mipmap level being set. +

+

+If rowstride equals 0 then it will be automatically calculated +from the width of the mipmap level and the bytes-per-pixel for the +given format. +

+

+A mipmap level of 0 corresponds to the largest, base image of a +texture and level 1 is half the width and height of level 0. If +dividing any dimension of the previous level by two results in a +fraction then round the number down (floor()), but clamp to 1 +something like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+next_width = MAX (1, floor (prev_width));
+
+ +

+

+

+You can determine the number of mipmap levels for a given texture +like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+n_levels = 1 + floor (log2 (max_dimension));
+
+ +

+

+

+Where max_dimension is the larger of cogl_texture_get_width() and +cogl_texture_get_height(). +

+

+It is an error to pass a level number >= the number of levels that +texture can have according to the above calculation. +

+

+

+
+

Note

Since the storage for a CoglTexture is allocated lazily then +if the given texture has not previously been allocated then this +api can return FALSE and throw an exceptional error if there is +not enough memory to allocate storage for texture.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

format :

the CoglPixelFormat used in the source data buffer.

rowstride :

rowstride of the source data buffer (computed from +the texture width and format if it equals 0)

data :

the source data, pointing to the first top-left pixel to set

level :

The mipmap level to update (Normally 0 for the largest, +base texture)

error :

A CoglError to return exceptional errors

Returns :

+TRUE if the data upload was successful, and +FALSE otherwise
+
+
+
+

cogl_texture_set_region ()

+
CoglBool            cogl_texture_set_region             (CoglTexture *texture,
+                                                         int src_x,
+                                                         int src_y,
+                                                         int dst_x,
+                                                         int dst_y,
+                                                         unsigned int dst_width,
+                                                         unsigned int dst_height,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         const uint8_t *data);
+

+Sets the pixels in a rectangular subregion of texture from an in-memory +buffer containing pixel data. +

+

+

+
+

Note

The region set can't be larger than the source data +
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

texture :

a CoglTexture.

src_x :

upper left coordinate to use from source data.

src_y :

upper left coordinate to use from source data.

dst_x :

upper left destination horizontal coordinate.

dst_y :

upper left destination vertical coordinate.

dst_width :

width of destination region to write. (Must be less +than or equal to width)

dst_height :

height of destination region to write. (Must be less +than or equal to height)

width :

width of source data buffer.

height :

height of source data buffer.

format :

the CoglPixelFormat used in the source buffer.

rowstride :

rowstride of source buffer (computed from width if none +specified)

data :

the actual pixel data.

Returns :

+TRUE if the subregion upload was successful, and +FALSE otherwise
+
+
+
+

enum CoglTextureType

+
typedef enum {
+  COGL_TEXTURE_TYPE_2D,
+  COGL_TEXTURE_TYPE_3D,
+  COGL_TEXTURE_TYPE_RECTANGLE
+} CoglTextureType;
+
+

+Constants representing the underlying hardware texture type of a +CoglTexture. +

+
++++ + + + + + + + + + + + + + + +

COGL_TEXTURE_TYPE_2D

A CoglTexture2D +

COGL_TEXTURE_TYPE_3D

A CoglTexture3D +

COGL_TEXTURE_TYPE_RECTANGLE

A CoglTextureRectangle +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

enum CoglTextureComponents

+
typedef enum {
+  COGL_TEXTURE_COMPONENTS_A = 1,
+  COGL_TEXTURE_COMPONENTS_RG,
+  COGL_TEXTURE_COMPONENTS_RGB,
+  COGL_TEXTURE_COMPONENTS_RGBA,
+  COGL_TEXTURE_COMPONENTS_DEPTH
+} CoglTextureComponents;
+
+

+See cogl_texture_set_components(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

COGL_TEXTURE_COMPONENTS_A

Only the alpha component +

COGL_TEXTURE_COMPONENTS_RG

Red and green components. Note that + this can only be used if the COGL_FEATURE_ID_TEXTURE_RG feature + is advertised. +

COGL_TEXTURE_COMPONENTS_RGB

Red, green and blue components +

COGL_TEXTURE_COMPONENTS_RGBA

Red, green, blue and alpha components +

COGL_TEXTURE_COMPONENTS_DEPTH

Only a depth component +
+

Since 1.18

+
+
+
+

cogl_texture_set_components ()

+
void                cogl_texture_set_components         (CoglTexture *texture,
+                                                         CoglTextureComponents components);
+

+Affects the internal storage format for this texture by specifying +what components will be required for sampling later. +

+

+This api affects how data is uploaded to the GPU since unused +components can potentially be discarded from source data. +

+

+For textures created by the ‘_with_size’ constructors the default +is COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take +a CoglBitmap or a data pointer default to the same components as +the pixel format of the data. +

+

+Note that the COGL_TEXTURE_COMPONENTS_RG format is not available +on all drivers. The availability can be determined by checking for +the COGL_FEATURE_ID_TEXTURE_RG feature. If this format is used on +a driver where it is not available then COGL_TEXTURE_ERROR_FORMAT +will be raised when the texture is allocated. Even if the feature +is not available then COGL_PIXEL_FORMAT_RG_88 can still be used as +an image format as long as COGL_TEXTURE_COMPONENTS_RG isn't used +as the texture's components. +

+
++++ + + + + +

texture :

a CoglTexture pointer.
+

Since 1.18

+
+
+
+

cogl_texture_get_components ()

+
CoglTextureComponents cogl_texture_get_components       (CoglTexture *texture);
+

+Queries what components the given texture stores internally as set +via cogl_texture_set_components(). +

+

+For textures created by the ‘_with_size’ constructors the default +is COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take +a CoglBitmap or a data pointer default to the same components as +the pixel format of the data. +

+
++++ + + + + +

texture :

a CoglTexture pointer.
+

Since 1.18

+
+
+
+

cogl_texture_set_premultiplied ()

+
void                cogl_texture_set_premultiplied      (CoglTexture *texture,
+                                                         CoglBool premultiplied);
+

+Affects the internal storage format for this texture by specifying +whether red, green and blue color components should be stored as +pre-multiplied alpha values. +

+

+This api affects how data is uploaded to the GPU since Cogl will +convert source data to have premultiplied or unpremultiplied +components according to this state. +

+

+For example if you create a texture via +cogl_texture_2d_new_with_size() and then upload data via +cogl_texture_set_data() passing a source format of +COGL_PIXEL_FORMAT_RGBA_8888 then Cogl will internally multiply the +red, green and blue components of the source data by the alpha +component, for each pixel so that the internally stored data has +pre-multiplied alpha components. If you instead upload data that +already has pre-multiplied components by passing +COGL_PIXEL_FORMAT_RGBA_8888_PRE as the source format to +cogl_texture_set_data() then the data can be uploaded without being +converted. +

+

+By default the premultipled state is TRUE. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

premultiplied :

Whether any internally stored red, green or blue +components are pre-multiplied by an alpha +component.
+

Since 1.18

+
+
+
+

cogl_texture_get_premultiplied ()

+
CoglBool            cogl_texture_get_premultiplied      (CoglTexture *texture);
+

+Queries the pre-multiplied alpha status for internally stored red, +green and blue components for the given texture as set by +cogl_texture_set_premultiplied(). +

+

+By default the pre-multipled state is TRUE. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

+TRUE if red, green and blue components are +internally stored pre-multiplied by the alpha +value or FALSE if not.
+

Since 1.18

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Top-Level-Context.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Top-Level-Context.html new file mode 100644 index 0000000..d5b41d2 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Top-Level-Context.html @@ -0,0 +1,1561 @@ + + + + +The Top-Level Context + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Top-Level Context

+

The Top-Level Context — The top level application context.

+
+
+

Synopsis

+
                    CoglContext;
+CoglBool            cogl_is_context                     (void *object);
+CoglContext *       cogl_context_new                    (CoglDisplay *display,
+                                                         CoglError **error);
+CoglDisplay *       cogl_context_get_display            (CoglContext *context);
+
+enum                CoglFeatureID;
+CoglBool            cogl_has_feature                    (CoglContext *context,
+                                                         CoglFeatureID feature);
+CoglBool            cogl_has_features                   (CoglContext *context,
+                                                         ...);
+void                (*CoglFeatureCallback)              (CoglFeatureID feature,
+                                                         void *user_data);
+void                cogl_foreach_feature                (CoglContext *context,
+                                                         CoglFeatureCallback callback,
+                                                         void *user_data);
+
+void                cogl_push_matrix                    (void);
+void                cogl_pop_matrix                     (void);
+void                cogl_scale                          (float x,
+                                                         float y,
+                                                         float z);
+void                cogl_translate                      (float x,
+                                                         float y,
+                                                         float z);
+void                cogl_rotate                         (float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_transform                      (const CoglMatrix *matrix);
+void                cogl_frustum                        (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_perspective                    (float fovy,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_ortho                          (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+
+void                cogl_get_modelview_matrix           (CoglMatrix *matrix);
+void                cogl_set_modelview_matrix           (CoglMatrix *matrix);
+void                cogl_get_projection_matrix          (CoglMatrix *matrix);
+void                cogl_set_projection_matrix          (CoglMatrix *matrix);
+void                cogl_set_viewport                   (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+void                cogl_get_viewport                   (float v[4]);
+
+void                cogl_set_source                     (void *material);
+void                cogl_set_source_color               (const CoglColor *color);
+void                cogl_set_source_color4ub            (uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_set_source_color4f             (float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+void                cogl_set_source_texture             (CoglTexture *texture);
+void *              cogl_get_source                     (void);
+void                cogl_push_source                    (void *material);
+void                cogl_pop_source                     (void);
+
+void                cogl_clear                          (const CoglColor *color,
+                                                         unsigned long  buffers);
+
+enum                CoglReadPixelsFlags;
+void                cogl_read_pixels                    (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+
+void                cogl_flush                          (void);
+
+
+
+

Description

+

+A CoglContext is the top most sandbox of Cogl state for an +application or toolkit. Its main purpose is to act as a sandbox +for the memory management of state objects. Normally an application +will only create a single context since there is no way to share +resources between contexts. +

+

+For those familiar with OpenGL or perhaps Cairo it should be +understood that unlike these APIs a Cogl context isn't a rendering +context as such. In other words Cogl doesn't aim to provide a state +machine style model for configuring rendering parameters. Most +rendering state in Cogl is directly associated with user managed +objects called pipelines and geometry is drawn with a specific +pipeline object to a framebuffer object and those 3 things fully +define the state for drawing. This is an important part of Cogl's +design since it helps you write orthogonal rendering components +that can all access the same GPU without having to worry about +what state other components have left you with. +

+

+

+
+

Note

+

Cogl does not maintain internal references to the context for +resources that depend on the context so applications. This is to +help applications control the lifetime a context without us needing to +introduce special api to handle the breakup of internal circular +references due to internal resources and caches associated with the +context. +

+

+One a context has been destroyed then all directly or indirectly +dependant resources will be in an inconsistent state and should not +be manipulated or queried in any way. +

+

+For applications that rely on the operating system to clean up +resources this policy shouldn't affect them, but for applications +that need to carefully destroy and re-create Cogl contexts multiple +times throughout their lifetime (such as Android applications) they +should be careful to destroy all context dependant resources, such as +framebuffers or textures etc before unrefing and destroying the +context.

+
+

+

+
+
+

Details

+
+

CoglContext

+
typedef struct _CoglContext CoglContext;
+
+
+
+

cogl_is_context ()

+
CoglBool            cogl_is_context                     (void *object);
+

+Gets whether the given object references an existing context object. +

+
++++ + + + + + + + + + + +

object :

An object or NULL +

Returns :

+TRUE if the object references a CoglContext, +FALSE otherwise
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_context_new ()

+
CoglContext *       cogl_context_new                    (CoglDisplay *display,
+                                                         CoglError **error);
+

+Creates a new CoglContext which acts as an application sandbox +for any state objects that are allocated. +

+
++++ + + + + + + + + + + + + + + +

display :

A CoglDisplay pointer. [allow-none] +

error :

A CoglError return location.

Returns :

A newly allocated CoglContext. [transfer full] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_context_get_display ()

+
CoglDisplay *       cogl_context_get_display            (CoglContext *context);
+

+Retrieves the CoglDisplay that is internally associated with the +given context. This will return the same CoglDisplay that was +passed to cogl_context_new() or if NULL was passed to +cogl_context_new() then this function returns a pointer to the +display that was automatically setup internally. +

+
++++ + + + + + + + + + + +

context :

A CoglContext pointer

Returns :

The CoglDisplay associated with the +given context. [transfer none] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

enum CoglFeatureID

+
typedef enum {
+  COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
+  COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP,
+  COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT,
+  COGL_FEATURE_ID_TEXTURE_NPOT,
+  COGL_FEATURE_ID_TEXTURE_RECTANGLE,
+  COGL_FEATURE_ID_TEXTURE_3D,
+  COGL_FEATURE_ID_GLSL,
+  COGL_FEATURE_ID_ARBFP,
+  COGL_FEATURE_ID_OFFSCREEN,
+  COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
+  COGL_FEATURE_ID_ONSCREEN_MULTIPLE,
+  COGL_FEATURE_ID_UNSIGNED_INT_INDICES,
+  COGL_FEATURE_ID_DEPTH_RANGE,
+  COGL_FEATURE_ID_POINT_SPRITE,
+  COGL_FEATURE_ID_MAP_BUFFER_FOR_READ,
+  COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE,
+  COGL_FEATURE_ID_MIRRORED_REPEAT,
+  COGL_FEATURE_ID_SWAP_BUFFERS_EVENT,
+  COGL_FEATURE_ID_GLES2_CONTEXT,
+  COGL_FEATURE_ID_DEPTH_TEXTURE,
+  COGL_FEATURE_ID_PRESENTATION_TIME,
+  COGL_FEATURE_ID_FENCE,
+  COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
+  COGL_FEATURE_ID_TEXTURE_RG,
+  COGL_FEATURE_ID_BUFFER_AGE,
+} CoglFeatureID;
+
+

+All the capabilities that can vary between different GPUs supported +by Cogl. Applications that depend on any of these features should explicitly +check for them using cogl_has_feature() or cogl_has_features(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_FEATURE_ID_TEXTURE_NPOT_BASIC

The hardware supports non power + of two textures, but you also need to check the + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT + features to know if the hardware supports npot texture mipmaps + or repeat modes other than + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively. +

COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP

Mipmapping is supported in + conjuntion with non power of two textures. +

COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT

Repeat modes other than + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the + hardware. +

COGL_FEATURE_ID_TEXTURE_NPOT

Non power of two textures are supported + by the hardware. This is a equivalent to the + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP + and COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined. +

COGL_FEATURE_ID_TEXTURE_RECTANGLE

Support for rectangular + textures with non-normalized texture coordinates. +

COGL_FEATURE_ID_TEXTURE_3D

3D texture support +

COGL_FEATURE_ID_GLSL

GLSL support +

COGL_FEATURE_ID_ARBFP

ARBFP support +

COGL_FEATURE_ID_OFFSCREEN

Offscreen rendering support +

COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE

Multisample support for + offscreen framebuffers +

COGL_FEATURE_ID_ONSCREEN_MULTIPLE

Multiple onscreen framebuffers + supported. +

COGL_FEATURE_ID_UNSIGNED_INT_INDICES

Set if + COGL_INDICES_TYPE_UNSIGNED_INT is supported in + cogl_indices_new(). +

COGL_FEATURE_ID_DEPTH_RANGE

cogl_pipeline_set_depth_range() support +

COGL_FEATURE_ID_POINT_SPRITE

Whether + cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported. +

COGL_FEATURE_ID_MAP_BUFFER_FOR_READ

Whether cogl_buffer_map() is + supported with CoglBufferAccess including read support. +

COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE

Whether cogl_buffer_map() is + supported with CoglBufferAccess including write support. +

COGL_FEATURE_ID_MIRRORED_REPEAT

Whether + COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported. +

COGL_FEATURE_ID_SWAP_BUFFERS_EVENT

Available if the window system supports reporting an event + for swap buffer completions. +

COGL_FEATURE_ID_GLES2_CONTEXT

Whether creating new GLES2 contexts is + suported. +

COGL_FEATURE_ID_DEPTH_TEXTURE

Whether CoglFramebuffer support rendering + the depth buffer to a texture. +

COGL_FEATURE_ID_PRESENTATION_TIME

Whether frame presentation + time stamps will be recorded in CoglFrameInfo objects. +

COGL_FEATURE_ID_FENCE

COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE

Whether cogl_point_size_in + can be used as an attribute to set a per-vertex point size. +

COGL_FEATURE_ID_TEXTURE_RG

Support for + COGL_TEXTURE_COMPONENTS_RG as the internal components of a + texture. +

COGL_FEATURE_ID_BUFFER_AGE

Available if the age of CoglOnscreen back + buffers are tracked and so cogl_onscreen_get_buffer_age() can be + expected to return age values other than 0. +
+

Since 1.10

+
+
+
+

cogl_has_feature ()

+
CoglBool            cogl_has_feature                    (CoglContext *context,
+                                                         CoglFeatureID feature);
+

+Checks if a given feature is currently available +

+

+Cogl does not aim to be a lowest common denominator API, it aims to +expose all the interesting features of GPUs to application which +means applications have some responsibility to explicitly check +that certain features are available before depending on them. +

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext pointer

feature :

A CoglFeatureID +

Returns :

+TRUE if the feature is currently supported or FALSE if +not.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_has_features ()

+
CoglBool            cogl_has_features                   (CoglContext *context,
+                                                         ...);
+

+Checks if a list of features are all currently available. +

+

+This checks all of the listed features using cogl_has_feature() and +returns TRUE if all the features are available or FALSE +otherwise. +

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext pointer

... :

A 0 terminated list of CoglFeatureIDs

Returns :

+TRUE if all the features are available, FALSE +otherwise.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

CoglFeatureCallback ()

+
void                (*CoglFeatureCallback)              (CoglFeatureID feature,
+                                                         void *user_data);
+

+A callback used with cogl_foreach_feature() for enumerating all +context level features supported by Cogl. +

+
++++ + + + + + + + + + + +

feature :

A single feature currently supported by Cogl

user_data :

A private pointer passed to cogl_foreach_feature().
+

Since 0.10

+

Stability Level: Unstable

+
+
+
+

cogl_foreach_feature ()

+
void                cogl_foreach_feature                (CoglContext *context,
+                                                         CoglFeatureCallback callback,
+                                                         void *user_data);
+

+Iterates through all the context level features currently supported +for a given context and for each feature callback is called. +

+
++++ + + + + + + + + + + + + + + +

context :

A CoglContext pointer

callback :

A CoglFeatureCallback called for each +supported feature. [scope call] +

user_data :

Private data to pass to the callback. [closure] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_push_matrix ()

+
void                cogl_push_matrix                    (void);
+
+

Warning

+

cogl_push_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_push_matrix() instead

+
+

+Stores the current model-view matrix on the matrix stack. The matrix +can later be restored with cogl_pop_matrix(). +

+
+
+
+

cogl_pop_matrix ()

+
void                cogl_pop_matrix                     (void);
+
+

Warning

+

cogl_pop_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_pop_matrix() instead

+
+

+Restores the current model-view matrix from the matrix stack. +

+
+
+
+

cogl_scale ()

+
void                cogl_scale                          (float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_scale has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_pop_matrix() instead

+
+

+Multiplies the current model-view matrix by one that scales the x, +y and z axes by the given values. +

+
++++ + + + + + + + + + + + + + + +

x :

Amount to scale along the x-axis

y :

Amount to scale along the y-axis

z :

Amount to scale along the z-axis
+
+
+
+

cogl_translate ()

+
void                cogl_translate                      (float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_translate has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_translate() instead

+
+

+Multiplies the current model-view matrix by one that translates the +model along all three axes according to the given values. +

+
++++ + + + + + + + + + + + + + + +

x :

Distance to translate along the x-axis

y :

Distance to translate along the y-axis

z :

Distance to translate along the z-axis
+
+
+
+

cogl_rotate ()

+
void                cogl_rotate                         (float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_rotate has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_rotate() instead

+
+

+Multiplies the current model-view matrix by one that rotates the +model around the vertex specified by x, y and z. The rotation +follows the right-hand thumb rule so for example rotating by 10 +degrees about the vertex (0, 0, 1) causes a small counter-clockwise +rotation. +

+
++++ + + + + + + + + + + + + + + + + + + +

angle :

Angle in degrees to rotate.

x :

X-component of vertex to rotate around.

y :

Y-component of vertex to rotate around.

z :

Z-component of vertex to rotate around.
+
+
+
+

cogl_transform ()

+
void                cogl_transform                      (const CoglMatrix *matrix);
+
+

Warning

+

cogl_transform has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_transform() instead

+
+

+Multiplies the current model-view matrix by the given matrix. +

+
++++ + + + + +

matrix :

the matrix to multiply with the current model-view
+

Since 1.4

+
+
+
+

cogl_frustum ()

+
void                cogl_frustum                        (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+
+

Warning

+

cogl_frustum has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_frustum() instead

+
+

+Replaces the current projection matrix with a perspective matrix +for a given viewing frustum defined by 4 side clip planes that +all cross through the origin and 2 near and far clip planes. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+

Since 0.8.2

+
+
+
+

cogl_perspective ()

+
void                cogl_perspective                    (float fovy,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+
+

Warning

+

cogl_perspective has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_perspective() instead

+
+

+Replaces the current projection matrix with a perspective matrix +based on the provided values. +

+

+

+
+

Note

You should be careful not to have to great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

fovy :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_ortho ()

+
void                cogl_ortho                          (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+
+

Warning

+

cogl_ortho has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_orthographic() instead

+
+

+Replaces the current projection matrix with an orthographic projection +matrix. See Figure 1, “” to see how the matrix is +calculated. +

+

+

+
+

Figure 1. 

+
+
+


+

+

+

+
+

Note

This function copies the arguments from OpenGL's glOrtho() even +though they are unnecessarily confusing due to the z near and z far +arguments actually being a "distance" from the origin, where +negative values are behind the viewer, instead of coordinates for +the z clipping planes which would have been consistent with the +left, right bottom and top arguments.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

left :

The coordinate for the left clipping plane

right :

The coordinate for the right clipping plane

bottom :

The coordinate for the bottom clipping plane

top :

The coordinate for the top clipping plane

near :

The distance to the near clipping +plane (negative if the plane is behind the viewer)

far :

The distance for the far clipping +plane (negative if the plane is behind the viewer)
+

Since 1.0

+
+
+
+

cogl_get_modelview_matrix ()

+
void                cogl_get_modelview_matrix           (CoglMatrix *matrix);
+
+

Warning

+

cogl_get_modelview_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_modelview_matrix() + instead

+
+

+Stores the current model-view matrix in matrix. +

+
++++ + + + + +

matrix :

return location for the model-view matrix. [out] +
+
+
+
+

cogl_set_modelview_matrix ()

+
void                cogl_set_modelview_matrix           (CoglMatrix *matrix);
+
+

Warning

+

cogl_set_modelview_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_set_modelview_matrix() + instead

+
+

+Loads matrix as the new model-view matrix. +

+
++++ + + + + +

matrix :

the new model-view matrix
+
+
+
+

cogl_get_projection_matrix ()

+
void                cogl_get_projection_matrix          (CoglMatrix *matrix);
+
+

Warning

+

cogl_get_projection_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_projection_matrix() + instead

+
+

+Stores the current projection matrix in matrix. +

+
++++ + + + + +

matrix :

return location for the projection matrix. [out] +
+
+
+
+

cogl_set_projection_matrix ()

+
void                cogl_set_projection_matrix          (CoglMatrix *matrix);
+
+

Warning

+

cogl_set_projection_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_set_projection_matrix() + instead

+
+

+Loads matrix as the new projection matrix. +

+
++++ + + + + +

matrix :

the new projection matrix
+
+
+
+

cogl_set_viewport ()

+
void                cogl_set_viewport                   (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+
+

Warning

+

cogl_set_viewport has been deprecated since version 1.8 and should not be used in newly-written code. Use cogl_framebuffer_set_viewport() instead

+
+

+Replaces the current viewport with the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

x :

X offset of the viewport

y :

Y offset of the viewport

width :

Width of the viewport

height :

Height of the viewport
+

Since 1.2

+
+
+
+

cogl_get_viewport ()

+
void                cogl_get_viewport                   (float v[4]);
+
+

Warning

+

cogl_get_viewport has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_viewport4fv() + instead

+
+

+Stores the current viewport in v. v[0] and v[1] get the x and y +position of the viewport and v[2] and v[3] get the width and +height. +

+
++++ + + + + +

v :

pointer to a 4 element array +of floats to receive the viewport dimensions. [out][array fixed-size=4] +
+
+
+
+

cogl_set_source ()

+
void                cogl_set_source                     (void *material);
+
+

Warning

+

cogl_set_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This function changes the material at the top of the source stack. +The material at the top of this stack defines the GPU state used to +process subsequent primitives, such as rectangles drawn with +cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw(). +

+
++++ + + + + +

material :

A CoglMaterial +
+

Since 1.0

+
+
+
+

cogl_set_source_color ()

+
void                cogl_set_source_color               (const CoglColor *color);
+
+

Warning

+

cogl_set_source_color has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color. This color will be used for any subsequent drawing +operation. +

+

+The color will be premultiplied by Cogl, so the color should be +non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for +semi-transparent red. +

+

+See also cogl_set_source_color4ub() and cogl_set_source_color4f() +if you already have the color components. +

+
++++ + + + + +

color :

a CoglColor +
+

Since 1.0

+
+
+
+

cogl_set_source_color4ub ()

+
void                cogl_set_source_color4ub            (uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+
+

Warning

+

cogl_set_source_color4ub has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color using unsigned bytes for each component. This +color will be used for any subsequent drawing operation. +

+

+The value for each component is an unsigned byte in the range +between 0 and 255. +

+
++++ + + + + + + + + + + + + + + + + + + +

red :

value of the red channel, between 0 and 255

green :

value of the green channel, between 0 and 255

blue :

value of the blue channel, between 0 and 255

alpha :

value of the alpha channel, between 0 and 255
+

Since 1.0

+
+
+
+

cogl_set_source_color4f ()

+
void                cogl_set_source_color4f             (float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+

Warning

+

cogl_set_source_color4f has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color using normalized values for each component. This color +will be used for any subsequent drawing operation. +

+

+The value for each component is a fixed point number in the range +between 0 and 1.0. If the values passed in are outside that +range, they will be clamped. +

+
++++ + + + + + + + + + + + + + + + + + + +

red :

value of the red channel, between 0 and 1.0

green :

value of the green channel, between 0 and 1.0

blue :

value of the blue channel, between 0 and 1.0

alpha :

value of the alpha channel, between 0 and 1.0
+

Since 1.0

+
+
+
+

cogl_set_source_texture ()

+
void                cogl_set_source_texture             (CoglTexture *texture);
+
+

Warning

+

cogl_set_source_texture has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a material with the first +layer set to texture and setting that material as the source with +cogl_set_source. +

+

+Note: There is no interaction between calls to cogl_set_source_color +and cogl_set_source_texture. If you need to blend a texture with a color then +you can create a simple material like this: +

+
+material = cogl_material_new ();
+cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
+cogl_material_set_layer (material, 0, tex_handle);
+cogl_set_source (material);
+
+

+

+
++++ + + + + +

texture :

The CoglTexture you want as your source
+

Since 1.0

+
+
+
+

cogl_get_source ()

+
void *              cogl_get_source                     (void);
+
+

Warning

+

cogl_get_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Returns the current source material as previously set using +cogl_set_source(). +

+

+

+
+

Note

You should typically consider the returned material immutable +and not try to change any of its properties unless you own a +reference to that material. At times you may be able to get a +reference to an internally managed materials and the result of +modifying such materials is undefined.
+

+

+
++++ + + + + +

Returns :

The current source material.
+

Since 1.6

+
+
+
+

cogl_push_source ()

+
void                cogl_push_source                    (void *material);
+
+

Warning

+

cogl_push_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Pushes the given material to the top of the source stack. The +material at the top of this stack defines the GPU state used to +process later primitives as defined by cogl_set_source(). +

+
++++ + + + + +

material :

A CoglMaterial +
+

Since 1.6

+
+
+
+

cogl_pop_source ()

+
void                cogl_pop_source                     (void);
+
+

Warning

+

cogl_pop_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Removes the material at the top of the source stack. The material +at the top of this stack defines the GPU state used to process +later primitives as defined by cogl_set_source(). +

+

Since 1.6

+
+
+
+

cogl_clear ()

+
void                cogl_clear                          (const CoglColor *color,
+                                                         unsigned long  buffers);
+
+

Warning

+

cogl_clear has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_clear() api instead

+
+

+Clears all the auxiliary buffers identified in the buffers mask, and if +that includes the color buffer then the specified color is used. +

+
++++ + + + + + + + + + + +

color :

Background color to clear to

buffers :

A mask of CoglBufferBit's identifying which auxiliary +buffers to clear
+
+
+
+

enum CoglReadPixelsFlags

+
typedef enum {
+ /*< prefix=COGL_READ_PIXELS >*/
+  COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0
+} CoglReadPixelsFlags;
+
+

+Flags for cogl_framebuffer_read_pixels_into_bitmap() +

+
++++ + + + + +

COGL_READ_PIXELS_COLOR_BUFFER

Read from the color buffer +
+

Since 1.0

+
+
+
+

cogl_read_pixels ()

+
void                cogl_read_pixels                    (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+
+

Warning

+

cogl_read_pixels has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_read_pixels() instead

+
+

+This reads a rectangle of pixels from the current framebuffer where +position (0, 0) is the top left. The pixel at (x, y) is the first +read, and the data is returned with a rowstride of (width * 4). +

+

+Currently Cogl assumes that the framebuffer is in a premultiplied +format so if format is non-premultiplied it will convert it. To +read the pixel values without any conversion you should either +specify a format that doesn't use an alpha channel or use one of +the formats ending in PRE. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

x :

The window x position to start reading from

y :

The window y position to start reading from

width :

The width of the rectangle you want to read

height :

The height of the rectangle you want to read

source :

Identifies which auxillary buffer you want to read +(only COGL_READ_PIXELS_COLOR_BUFFER supported currently)

format :

The pixel format you want the result in +(only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)

pixels :

The location to write the pixel data.
+
+
+
+

cogl_flush ()

+
void                cogl_flush                          (void);
+

+This function should only need to be called in exceptional circumstances. +

+

+As an optimization Cogl drawing functions may batch up primitives +internally, so if you are trying to use raw GL outside of Cogl you stand a +better chance of being successful if you ask Cogl to flush any batched +geometry before making your state changes. +

+

+It only ensure that the underlying driver is issued all the commands +necessary to draw the batched primitives. It provides no guarantees about +when the driver will complete the rendering. +

+

+This provides no guarantees about the GL state upon returning and to avoid +confusing Cogl you should aim to restore any changes you make before +resuming use of Cogl. +

+

+If you are making state changes with the intention of affecting Cogl drawing +primitives you are 100% on your own since you stand a good chance of +conflicting with Cogl internals. For example clutter-gst which currently +uses direct GL calls to bind ARBfp programs will very likely break when Cogl +starts to use ARBfb programs itself for the material API. +

+

Since 1.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Versioning-utility-macros.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Versioning-utility-macros.html new file mode 100644 index 0000000..de6b9c5 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Versioning-utility-macros.html @@ -0,0 +1,620 @@ + + + + +Versioning utility macros + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Versioning utility macros

+

Versioning utility macros — Macros for determining the version of Cogl being used

+
+
+

Synopsis

+
#define             COGL_VERSION_MAJOR
+#define             COGL_VERSION_MINOR
+#define             COGL_VERSION_MICRO
+#define             COGL_VERSION_STRING
+#define             COGL_VERSION
+#define             COGL_VERSION_ENCODE                 (major,
+                                                         minor,
+                                                         micro)
+#define             COGL_VERSION_CHECK                  (major,
+                                                         minor,
+                                                         micro)
+#define             COGL_VERSION_GET_MAJOR              (version)
+#define             COGL_VERSION_GET_MINOR              (version)
+#define             COGL_VERSION_GET_MICRO              (version)
+
+
+
+

Description

+

+Cogl offers a set of macros for checking the version of the library +at compile time. +

+

+Cogl adds version information to both API deprecations and additions; +by definining the macros COGL_VERSION_MIN_REQUIRED and +COGL_VERSION_MAX_ALLOWED, you can specify the range of Cogl versions +whose API you want to use. Functions that were deprecated before, or +introduced after, this range will trigger compiler warnings. For instance, +if we define the following symbols: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+COGL_VERSION_MIN_REQUIRED = COGL_VERSION_1_6
+  COGL_VERSION_MAX_ALLOWED  = COGL_VERSION_1_8
+
+ +

+

+

+and we have the following functions annotated in the Cogl headers: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+COGL_DEPRECATED_IN_1_4 void cogl_function_A (void);
+  COGL_DEPRECATED_IN_1_6 void cogl_function_B (void);
+  COGL_AVAILABLE_IN_1_8 void cogl_function_C (void);
+  COGL_AVAILABLE_IN_1_10 void cogl_function_D (void);
+
+ +

+

+

+then any application code using the functions above will get the output: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+cogl_function_A: deprecation warning
+  cogl_function_B: no warning
+  cogl_function_C: no warning
+  cogl_function_D: symbol not available warning
+
+ +

+

+

+It is possible to disable the compiler warnings by defining the macro +COGL_DISABLE_DEPRECATION_WARNINGS before including the cogl.h +header. +

+
+
+

Details

+
+

COGL_VERSION_MAJOR

+
#define COGL_VERSION_MAJOR COGL_VERSION_MAJOR_INTERNAL
+
+

+The major version of the Cogl library (1, if COGL_VERSION is 1.2.3) +

+

Since 1.12.0

+
+
+
+

COGL_VERSION_MINOR

+
#define COGL_VERSION_MINOR COGL_VERSION_MINOR_INTERNAL
+
+

+The minor version of the Cogl library (2, if COGL_VERSION is 1.2.3) +

+

Since 1.12.0

+
+
+
+

COGL_VERSION_MICRO

+
#define COGL_VERSION_MICRO COGL_VERSION_MICRO_INTERNAL
+
+

+The micro version of the Cogl library (3, if COGL_VERSION is 1.2.3) +

+

Since 1.12.0

+
+
+
+

COGL_VERSION_STRING

+
#define COGL_VERSION_STRING COGL_VERSION_STRING_INTERNAL
+
+

+The full version of the Cogl library, in string form (suited for +string concatenation) +

+

Since 1.12.0

+
+
+
+

COGL_VERSION

+
#define             COGL_VERSION
+

+The Cogl version encoded into a single integer using the +COGL_VERSION_ENCODE() macro. This can be used for quick comparisons +with particular versions. +

+

Since 1.12.0

+
+
+
+

COGL_VERSION_ENCODE()

+
#define             COGL_VERSION_ENCODE(major, minor, micro)
+

+Encodes a 3 part version number into a single integer. This can be +used to compare the Cogl version. For example if there is a known +bug in Cogl versions between 1.3.2 and 1.3.4 you could use the +following code to provide a workaround: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30

+
+
+
+
+
+
+
+
+
+
+
+
+#if COGL_VERSION >= COGL_VERSION_ENCODE (1, 3, 2) && \
+    COGL_VERSION <= COGL_VERSION_ENCODE (1, 3, 4)
+  /* Do the workaround */
+#endif
+
+ +

+

+
++++ + + + + + + + + + + + + + + +

major :

The major part of a version number

minor :

The minor part of a version number

micro :

The micro part of a version number
+

Since 1.12.0

+
+
+
+

COGL_VERSION_CHECK()

+
#define             COGL_VERSION_CHECK(major, minor, micro)
+

+A convenient macro to check whether the Cogl version being compiled +against is at least the given version number. For example if the +function cogl_pipeline_frobnicate was added in version 2.0.1 and +you want to conditionally use that function when it is available, +you could write the following: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32

+
+
+
+
+
+
+
+
+
+
+
+
+#if COGL_VERSION_CHECK (2, 0, 1)
+cogl_pipeline_frobnicate (pipeline);
+#else
+/* Frobnication is not supported. Use a red color instead */
+cogl_pipeline_set_color_4f (pipeline, 1.0f, 0.0f, 0.0f, 1.0f);
+#endif
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

major :

The major part of a version number

minor :

The minor part of a version number

micro :

The micro part of a version number

Returns :

+TRUE if the Cogl version being compiled against is +greater than or equal to the given three part version number.
+

Since 1.12.0

+
+
+
+

COGL_VERSION_GET_MAJOR()

+
#define             COGL_VERSION_GET_MAJOR(version)
+

+Extracts the major part of an encoded version number. +

+
++++ + + + + +

version :

An encoded version number
+

Since 1.12.0

+
+
+
+

COGL_VERSION_GET_MINOR()

+
#define             COGL_VERSION_GET_MINOR(version)
+

+Extracts the minor part of an encoded version number. +

+
++++ + + + + +

version :

An encoded version number
+

Since 1.12.0

+
+
+
+

COGL_VERSION_GET_MICRO()

+
#define             COGL_VERSION_GET_MICRO(version)
+

+Extracts the micro part of an encoded version number. +

+
++++ + + + + +

version :

An encoded version number
+

Since 1.12.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html new file mode 100644 index 0000000..8a12d39 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html @@ -0,0 +1,475 @@ + + + + +Vertex Attributes + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Vertex Attributes

+

Vertex Attributes — Functions for declaring and drawing vertex + attributes

+
+
+

Synopsis

+
                    CoglAttribute;
+CoglAttribute *     cogl_attribute_new                  (CoglAttributeBuffer *attribute_buffer,
+                                                         const char *name,
+                                                         size_t stride,
+                                                         size_t offset,
+                                                         int components,
+                                                         CoglAttributeType type);
+CoglBool            cogl_is_attribute                   (void *object);
+void                cogl_attribute_set_normalized       (CoglAttribute *attribute,
+                                                         CoglBool normalized);
+CoglBool            cogl_attribute_get_normalized       (CoglAttribute *attribute);
+CoglAttributeBuffer * cogl_attribute_get_buffer         (CoglAttribute *attribute);
+void                cogl_attribute_set_buffer           (CoglAttribute *attribute,
+                                                         CoglAttributeBuffer *attribute_buffer);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglAttribute

+
typedef struct _CoglAttribute CoglAttribute;
+
+
+
+

cogl_attribute_new ()

+
CoglAttribute *     cogl_attribute_new                  (CoglAttributeBuffer *attribute_buffer,
+                                                         const char *name,
+                                                         size_t stride,
+                                                         size_t offset,
+                                                         int components,
+                                                         CoglAttributeType type);
+

+Describes the layout for a list of vertex attribute values (For +example, a list of texture coordinates or colors). +

+

+The name is used to access the attribute inside a GLSL vertex +shader and there are some special names you should use if they are +applicable: +

+
    +
  • "cogl_position_in" (used for vertex positions)
  • +
  • "cogl_color_in" (used for vertex colors)
  • +
  • "cogl_tex_coord0_in", "cogl_tex_coord1", ... +(used for vertex texture coordinates)
  • +
  • "cogl_normal_in" (used for vertex normals)
  • +
  • "cogl_point_size_in" (used to set the size of points + per-vertex. Note this can only be used if + COGL_FEATURE_ID_POINT_SIZE_ATTRIBUTE is advertised and + cogl_pipeline_set_per_vertex_point_size() is called on the pipeline. +
  • +
+

+

+

+The attribute values corresponding to different vertices can either +be tightly packed or interleaved with other attribute values. For +example it's common to define a structure for a single vertex like: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30

+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct
+{
+  float x, y, z; /* position attribute */
+  float s, t; /* texture coordinate attribute */
+} MyVertex;
+
+ +

+

+

+And then create an array of vertex data something like: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+MyVertex vertices[100] = { .... }
+
+ +

+

+

+In this case, to describe either the position or texture coordinate +attribute you have to move sizeof (MyVertex) bytes to +move from one vertex to the next. This is called the attribute +stride. If you weren't interleving attributes and you instead had +a packed array of float x, y pairs then the attribute stride would +be (2 * sizeof (float)). So the stride is the number of +bytes to move to find the attribute value of the next vertex. +

+

+Normally a list of attributes starts at the beginning of an array. +So for the MyVertex example above the offset is the +offset inside the MyVertex structure to the first +component of the attribute. For the texture coordinate attribute +the offset would be offsetof (MyVertex, s) or instead of +using the offsetof macro you could use sizeof (float) * +3. If you've divided your array into blocks of non-interleved +attributes then you will need to calculate the offset as the number of +bytes in blocks preceding the attribute you're describing. +

+

+An attribute often has more than one component. For example a color +is often comprised of 4 red, green, blue and alpha components, and a +position may be comprised of 2 x and y components. You should aim +to keep the number of components to a minimum as more components +means more data needs to be mapped into the GPU which can be a +bottlneck when dealing with a large number of vertices. +

+

+Finally you need to specify the component data type. Here you +should aim to use the smallest type that meets your precision +requirements. Again the larger the type then more data needs to be +mapped into the GPU which can be a bottlneck when dealing with +a large number of vertices. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

attribute_buffer :

The CoglAttributeBuffer containing the actual +attribute data

name :

The name of the attribute (used to reference it from GLSL)

stride :

The number of bytes to jump to get to the next attribute +value for the next vertex. (Usually +sizeof (MyVertex))

offset :

The byte offset from the start of attribute_buffer for +the first attribute value. (Usually +offsetof (MyVertex, component0) +

components :

The number of components (e.g. 4 for an rgba color or +3 for and (x,y,z) position)

type :

FIXME

Returns :

A newly allocated CoglAttribute +describing the layout for a list of attribute values +stored in array. [transfer full] +
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_attribute ()

+
CoglBool            cogl_is_attribute                   (void *object);
+

+Gets whether the given object references a CoglAttribute. +

+
++++ + + + + + + + + + + +

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglAttribute, +FALSE otherwise
+
+
+
+

cogl_attribute_set_normalized ()

+
void                cogl_attribute_set_normalized       (CoglAttribute *attribute,
+                                                         CoglBool normalized);
+

+Sets whether fixed point attribute types are mapped to the range +0→1. For example when this property is TRUE and a +COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE type is used then the value 255 +will be mapped to 1.0. +

+

+The default value of this property depends on the name of the +attribute. For the builtin properties cogl_color_in and +cogl_normal_in it will default to TRUE and for all other names it +will default to FALSE. +

+
++++ + + + + + + + + + + +

attribute :

A CoglAttribute +

normalized :

The new value for the normalized property.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_attribute_get_normalized ()

+
CoglBool            cogl_attribute_get_normalized       (CoglAttribute *attribute);
+
++++ + + + + + + + + + + +

attribute :

A CoglAttribute +

Returns :

the value of the normalized property set with +cogl_attribute_set_normalized().
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_attribute_get_buffer ()

+
CoglAttributeBuffer * cogl_attribute_get_buffer         (CoglAttribute *attribute);
+
++++ + + + + + + + + + + +

attribute :

A CoglAttribute +

Returns :

the CoglAttributeBuffer that was +set with cogl_attribute_set_buffer() or cogl_attribute_new(). [transfer none] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_attribute_set_buffer ()

+
void                cogl_attribute_set_buffer           (CoglAttribute *attribute,
+                                                         CoglAttributeBuffer *attribute_buffer);
+

+Sets a new CoglAttributeBuffer for the attribute. +

+
++++ + + + + + + + + + + +

attribute :

A CoglAttribute +

attribute_buffer :

A CoglAttributeBuffer +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-X11-Texture-From-Pixmap.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-X11-Texture-From-Pixmap.html new file mode 100644 index 0000000..5fe02aa --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-X11-Texture-From-Pixmap.html @@ -0,0 +1,312 @@ + + + + +X11 Texture From Pixmap + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

X11 Texture From Pixmap

+

X11 Texture From Pixmap — Functions for creating and manipulating 2D meta + textures derived from X11 pixmaps.

+
+
+

Synopsis

+
                    CoglTexturePixmapX11;
+CoglBool            cogl_is_texture_pixmap_x11          (void *object);
+
+CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new      (CoglContext *context,
+                                                         uint32_t pixmap,
+                                                         CoglBool automatic_updates,
+                                                         CoglError **error);
+
+void                cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *texture,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+CoglBool            cogl_texture_pixmap_x11_is_using_tfp_extension
+                                                        (CoglTexturePixmapX11 *texture);
+enum                CoglTexturePixmapX11ReportLevel;
+void                cogl_texture_pixmap_x11_set_damage_object
+                                                        (CoglTexturePixmapX11 *texture,
+                                                         uint32_t damage,
+                                                         CoglTexturePixmapX11ReportLevel report_level);
+
+
+
+

Description

+

+These functions allow high-level meta textures (See the +CoglMetaTexture interface) that derive their contents from an X11 +pixmap. +

+
+
+

Details

+
+

CoglTexturePixmapX11

+
typedef struct _CoglTexturePixmapX11 CoglTexturePixmapX11;
+
+
+
+

cogl_is_texture_pixmap_x11 ()

+
CoglBool            cogl_is_texture_pixmap_x11          (void *object);
+

+Checks whether object points to a CoglTexturePixmapX11 instance. +

+
++++ + + + + + + + + + + +

object :

A pointer to a CoglObject +

Returns :

+TRUE if the object is a CoglTexturePixmapX11, and +FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_texture_pixmap_x11_new ()

+
CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new      (CoglContext *context,
+                                                         uint32_t pixmap,
+                                                         CoglBool automatic_updates,
+                                                         CoglError **error);
+

+Creates a texture that contains the contents of pixmap. If +automatic_updates is TRUE then Cogl will attempt to listen for +damage events on the pixmap and automatically update the texture +when it changes. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

pixmap :

A X11 pixmap ID

automatic_updates :

Whether to automatically copy the contents of +the pixmap to the texture.

error :

A CoglError for exceptions

Returns :

a new CoglTexturePixmapX11 instance
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_texture_pixmap_x11_update_area ()

+
void                cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *texture,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+

+Forces an update of the given texture so that it is refreshed with +the contents of the pixmap that was given to +cogl_texture_pixmap_x11_new(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

texture :

A CoglTexturePixmapX11 instance

x :

x coordinate of the area to update

y :

y coordinate of the area to update

width :

width of the area to update

height :

height of the area to update
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_texture_pixmap_x11_is_using_tfp_extension ()

+
CoglBool            cogl_texture_pixmap_x11_is_using_tfp_extension
+                                                        (CoglTexturePixmapX11 *texture);
+

+Checks whether the given texture is using the +GLX_EXT_texture_from_pixmap or similar extension to copy the +contents of the pixmap to the texture. This extension is usually +implemented as zero-copy operation so it implies the updates are +working efficiently. +

+
++++ + + + + + + + + + + +

texture :

A CoglTexturePixmapX11 instance

Returns :

+TRUE if the texture is using an efficient extension +and FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

enum CoglTexturePixmapX11ReportLevel

+
typedef enum {
+  COGL_TEXTURE_PIXMAP_X11_DAMAGE_RAW_RECTANGLES,
+  COGL_TEXTURE_PIXMAP_X11_DAMAGE_DELTA_RECTANGLES,
+  COGL_TEXTURE_PIXMAP_X11_DAMAGE_BOUNDING_BOX,
+  COGL_TEXTURE_PIXMAP_X11_DAMAGE_NON_EMPTY
+} CoglTexturePixmapX11ReportLevel;
+
+
++++ + + + + + + + + + + + + + + + + + + +

COGL_TEXTURE_PIXMAP_X11_DAMAGE_RAW_RECTANGLES

COGL_TEXTURE_PIXMAP_X11_DAMAGE_DELTA_RECTANGLES

COGL_TEXTURE_PIXMAP_X11_DAMAGE_BOUNDING_BOX

COGL_TEXTURE_PIXMAP_X11_DAMAGE_NON_EMPTY

+
+
+
+

cogl_texture_pixmap_x11_set_damage_object ()

+
void                cogl_texture_pixmap_x11_set_damage_object
+                                                        (CoglTexturePixmapX11 *texture,
+                                                         uint32_t damage,
+                                                         CoglTexturePixmapX11ReportLevel report_level);
+

+Sets the damage object that will be used to track automatic updates +to the texture. Damage tracking can be disabled by passing 0 for +damage. Otherwise this damage will replace the one used if TRUE +was passed for automatic_updates to cogl_texture_pixmap_x11_new(). +

+

+Note that Cogl will subtract from the damage region as it processes +damage events. +

+
++++ + + + + + + + + + + + + + + +

texture :

A CoglTexturePixmapX11 instance

damage :

A X11 Damage object or 0

report_level :

The report level which describes how to interpret +the damage events. This should match the level that the damage +object was created with.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental.devhelp2 b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental.devhelp2 new file mode 100644 index 0000000..b97605c --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental.devhelp2 @@ -0,0 +1,869 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-Blend-Strings.html b/doc/reference/cogl-2.0-experimental/html/cogl-Blend-Strings.html new file mode 100644 index 0000000..5a4c272 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-Blend-Strings.html @@ -0,0 +1,143 @@ + + + + +Blend Strings + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Blend Strings

+

Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions.

+
+
+

Cogl Blend Strings

+

+Describing GPU blending and texture combining states is rather awkward to do +in a consise but also readable fashion. Cogl helps by supporting +string based descriptions using a simple syntax. +

+
+
+Some examples
+

Here is an example used for blending:

+
+"RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))"
+
+

In OpenGL terms this replaces glBlendFunc[Separate] and +glBlendEquation[Separate]

+

+Actually in this case it's more verbose than the GL equivalent: +

+
+glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+

+But unless you are familiar with OpenGL or refer to its API documentation +you wouldn't know that the default function used by OpenGL is GL_FUNC_ADD +nor would you know that the above arguments determine what the source color +and destination color will be multiplied by before being adding. +

+

Here is an example used for texture combining:

+
+"RGB = REPLACE (PREVIOUS)"
+"A = MODULATE (PREVIOUS, TEXTURE)"
+
+

+In OpenGL terms this replaces glTexEnv, and the above example is equivalent +to this OpenGL code: +

+
+  glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+  glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR);
+
+
+
+
+Here's the syntax
+
+<statement>:
+  <channel-mask>=<function-name>(<arg-list>)
+
+  You can either use a single statement with an RGBA channel-mask or you can use
+  two statements; one with an A channel-mask and the other with an RGB
+  channel-mask.
+
+<channel-mask>:
+  A or RGB or RGBA
+
+<function-name>:
+  [A-Za-z_]*
+
+<arg-list>:
+  <arg>,<arg>
+  or <arg>
+  or ""
+
+  I.e. functions may take 0 or more arguments
+
+<arg>:
+  <color-source>
+  1 - <color-source>                : Only intended for texture combining
+  <color-source> * ( <factor> )     : Only intended for blending
+  0                                 : Only intended for blending
+
+  See the blending or texture combining sections for further notes and examples.
+
+<color-source>:
+  <source-name>[<channel-mask>]
+  <source-name>
+
+  See the blending or texture combining sections for the list of source-names
+  valid in each context.
+
+  If a channel mask is not given then the channel mask of the statement
+  is assumed instead.
+
+<factor>:
+  0
+  1
+  <color-source>
+  1-<color-source>
+  SRC_ALPHA_SATURATE
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-buffer-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-buffer-apis.html new file mode 100644 index 0000000..cd707b4 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-buffer-apis.html @@ -0,0 +1,28 @@ + + + + +Allocating GPU Memory + + + + + + + + + + + + + + + + +

+Allocating GPU Memory

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-buffer-layout-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-buffer-layout-apis.html new file mode 100644 index 0000000..b17aceb --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-buffer-layout-apis.html @@ -0,0 +1,28 @@ + + + + +Describing the layout of GPU Memory + + + + + + + + + + + + + + + + +

+Describing the layout of GPU Memory

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-context-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-context-apis.html new file mode 100644 index 0000000..03a5114 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-context-apis.html @@ -0,0 +1,28 @@ + + + + +Setting Up A Drawing Context + + + + + + + + + + + + + + + + +

+Setting Up A Drawing Context

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-framebuffer-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-framebuffer-apis.html new file mode 100644 index 0000000..abb83b8 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-framebuffer-apis.html @@ -0,0 +1,28 @@ + + + + +Framebuffers + + + + + + + + + + + + + + + + +

+Framebuffers

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-general-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-general-apis.html new file mode 100644 index 0000000..8a375e5 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-general-apis.html @@ -0,0 +1,28 @@ + + + + +General API concepts + + + + + + + + + + + + + + + + +

+General API concepts

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-integration.html b/doc/reference/cogl-2.0-experimental/html/cogl-integration.html new file mode 100644 index 0000000..eb544be --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-integration.html @@ -0,0 +1,28 @@ + + + + +Binding and Integrating + + + + + + + + + + + + + + + + +

+Binding and Integrating

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-meta-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-meta-textures.html new file mode 100644 index 0000000..69cdb76 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-meta-textures.html @@ -0,0 +1,28 @@ + + + + +Meta Textures + + + + + + + + + + + + + + + + +

+Meta Textures

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-pipeline-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-pipeline-apis.html new file mode 100644 index 0000000..c7d37dd --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-pipeline-apis.html @@ -0,0 +1,28 @@ + + + + +Setting Up A GPU Pipeline + + + + + + + + + + + + + + + + +

+Setting Up A GPU Pipeline

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-primitive-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-primitive-apis.html new file mode 100644 index 0000000..bf806b6 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-primitive-apis.html @@ -0,0 +1,28 @@ + + + + +Geometry + + + + + + + + + + + + + + + + +

+Geometry

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-primitive-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-primitive-textures.html new file mode 100644 index 0000000..a8f793d --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-primitive-textures.html @@ -0,0 +1,28 @@ + + + + +Primitive Textures + + + + + + + + + + + + + + + + +

+Primitive Textures

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-textures.html new file mode 100644 index 0000000..011b53b --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-textures.html @@ -0,0 +1,28 @@ + + + + +Textures + + + + + + + + + + + + + + + + +

+Textures

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-utilities.html b/doc/reference/cogl-2.0-experimental/html/cogl-utilities.html new file mode 100644 index 0000000..9a184bd --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-utilities.html @@ -0,0 +1,28 @@ + + + + +Utilities + + + + + + + + + + + + + + + + +

+Utilities

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl_ortho.png b/doc/reference/cogl-2.0-experimental/html/cogl_ortho.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2a1fd20be98e26e1ef6f3eb2bc664970f5fc62 GIT binary patch literal 12650 zcmb_@cRbbq`}g}CP6p2^64 z`FzLk`+5An_x;y>9uJkH^Ios(^}L?r5~Oll?kqkvK7t@;735{r5Co+SUm|#DcqjM$ zwi*0|a#oX*LGr)RF2FZu9OQMK5#-#xlP^@3ROSPC^YlZ7TQ^P*W2jN0JPyyvrV)ez zQIM6^a2sAp^3W$8C~Fa7oI2{mx*Ld~OWp9P<{R72OKHk$kS(ivmRWibl|8-@QtF$z zc>a7y)-Nr+g9!9p4Hdfcxmam3D{24I8FFdPE7F1TgaO2USQ)3|Sm&))Htf%)US6j(@b5nrO~2ql7K!KJ0bjrgA29w&VL&l{8V_4P;vITEGl z<5PDx7ptd7Gs=Rfa3&=sUB7;PF&BL&MKUk}7g02GbK7f;WP^8BR#qG$5$uq-$FA}% zP2ctzk|5cN>qx4`*RNkiMMe8GFv(Irb`}<=h0Y*R!C_%%6FRhv$lX>-2PRojzG~eA z1C&9sRypV^hSeVm3;p2WZKqmd5#e0qS!0}tGwUcLq9SNgsB=pb%Ru~6p5^4&Rh+!y z;)La=5&m2`-z_}}+MNf9{DOkxwO%9j^}dSfqQb)18RQ`@Gjm#Pt)#lTdZ{%*mT)j* z((Q9ZMBm!lL?6z-Oi3|PP&lJOgq8bHQu5QOa&eGZ#Y``?uC6XCYyQvCfsp+;*X7I1 zk*yxP%c@@Yaghwn<;%INt9AzTly3Xm50sTdD=S50zI1nQ6n9GAFCLPRkWi6A4C+69 zLKl=F=Z(&E_4caAQI5M!pB);DCc@D}97KMDg+Q5j{(DvGp4tH`H(DWR=s@ z{QivITb=o+(! zINcJS5Emy6_bP{Z?BVhKHfGQBPe~Tm$!T+QrhTp>;j{owm!zVSQsk>w@bli@UZZL^ zMhQC;6Ex>KeNj=-7t?FeiqXT!&Z#a|3N9Uoqy3%DO(!KKrJ?l4H*el_yFvfiS$}e- zJ?8f9+c^)r;2%B*E9E;&12Hi%N-VGX`}b2KOM7^DV6na-Aq2v* z)1xv>5ijVaYTdVHH#avUjsx?{F+2tzw`XFE%q=XQ1)RL{45|dLUF(^cpwFowd!s@{ zP2D!*goA@~j#k)Vy7}yS(9Mb)JVo>Vr_ae;zkVl4^pY#JU9U6Cp5tO)_S2`Q&ZG)@ zZgmLJd#4jZiIZ)t5-!1Q!+LK?d=4NQE_o+>{Ol0^=myV-@cXkSYsP{}8(EclpFVxEvbNUc(vp$+ zg8NjH@Awwz`*?x4q`lFnI17F50#j1*7C{Hm-KhY ziGyT&zRSY7bi$Pmx}siM4Js=R$(N%2j6Y_$`Rhgb!3)dqQoZDX7HY__E%XAPR=)n3 zj?D+Sdd?hTBY9O-2{Lbd^-7w#Pn|mD<>jTWjS`nT&G_lr-Kp8x*~P`XMn+e>ew3D% z_geBhg!ET5b#)QPkWIPe_y#wIp$b^8T`NjWMXIheH8t_@@N{9-eac}SP5f}+ft9FW zsHv$1Z3gR23ds^1r#D_jM*dnEc~)?*?r^ic|GgeLWmtphweX8#WscL$^xk{Yy^pxr z+2_}Mjy*Iq`hIWCT`~9=6(5hU%kq7KTZ6MSJ3HuR+QQOO?oG^kqF9CZ(c>mI-ng&6 zzP|naT9~=0*ROeWi%h@gXx>la6&4m&ZH!MyI7cTwKRLO+w{gG8LQ7lwSzw?7%PYNd zI}uUQ@e0TLBu&{gP&{E_VJ3xC=4Y*f_1wghRoFde9&BuE{8}ATFR1h{NNk*3Sb$2t zwGa@dy0NvTe&{syvo(@b;A>Np*+NhHv# z6B9>N@#xvpr%wq92~EQvy1H7Jn@hTHn!*Nsc8=b#(rL!$Xuu~uJ-w;9`CGgIffySf zUu2WXnZQqf{`{#sTCsop_;GD*?Vy~E;K7#&=8lezk#hT%j60d{-qA{W#wxSQ$;llY z9NaO}*Jg@%mzgOfAn?7v|67Wb58QBRY3YLp4*=P3+_=F-ahaF*LwY)<;0J+~l~_o`#KhRx*iQLR{rvfGYqsO);MaY&!@cQncXxN~e0^y= z+wp1il-r+Xc4v|PAwp~_`tb8D;k!-v?epNdViB2J%2M#NZI zXJO?-D6h;qRT}vm2?WaAGh;0EyAA7oodL*Tg2_Vvwr#VW!IJA zz@6IFiMo`iC>9Au35lbcU*nBsG2D7u`uf!mdRc8KV&dY4D2+V*Y~kzzf`TTC45w2% zuW)l;Y-c%r`n0|MT13l`jUY4$Lc+YfJXyTT%1SdcGpK6mLlbNzFB=*fq>c~O{WQ~Zu$r3DZ{FN9 zGNLb|Atw(sF2YHTF0cGu8WdNyEx4x*w>19Z+*CI?BnI>Y3Osbla<9TnNsI4^(j6+9v(ny zDnr0a74|3rx1J`HFFpfF(BgLr*!Zt#DA_qUV8N7G`M9}nv5)|AWTvMx2JjeGe=#pU zFSEP5%fZ31R(Jg835H;{BVlfJ_0O2=MD**|uVZ3_`1$oKozjbo`2+;W86VEHMepvq z@JF;p7k$vl3k@X<=&E#{17d-P`)R1y;^M`Nb^D9CH$o`POig8FWgUbQ-@Rj@2#JRN zl#&uY_~R{pwI=d{1QVAlRxS4U@icbABe5I#rBcH7j# z;xdt5|Hz0nJdvHC36sLT?ld_Tl2+Kjm?jjmdbqz-aDrO_-VfVW&MQCEpWIy;fdbK4 zMWDMs*qVwCN#6+Gy3Rm6`z`69t(TuEk2p1fii#?0%+v1-X6k&9EIB#3UYX6tuV3Y5 zWwRS@gFMwGrxEgS0_Bl}PXJ;+e*DPQF8H%MVh?*C_EJb#SfHB@!u!S%^+qM@CMWM= z9%GX+&W^(slyQ$ON`IW}$L|-&sU8%T)C1S;8+A|AWHqq5)VwmJ`Zf-7Yx(@72oJK* z+V`@#xfvjUhKfohTLa47;klqR192)hQjHc(qNAlvjE;UZ-^C~;Rrl%@$@-aXJS^tn zbHI|fZ{HsLTAQeLFV4#&)blwLl7YoUWuYT=)bZG(p+7Z${%owyOMCI6)WI^JV8U2$ zFHW)_onKKihE>#+SVd5WlZS)P;#)~sSy@pLy3#6Q_E2TSk&iOZdX>CPmTgKr}UhDE7iM;3LMzv{}#a&of z*b+|P@y8Jo zAhDx{dOnq#Y-(l}(Q3*W9lWyn+jBk0d}?7qA+r~F^0UT>gkLupi2L&8c)4v+g*u5T zDS#<`Jw0fFn=jg9uJBP2iiuSLO*-Z82*AHJ*XggvpF8|DSz_edw|uytqN2?t*YOB- zlzwup+b*7l6b}O#KJe#CeLG|0N!X-zqZOzfy|#3vm|7^N<>lp|j!HpMS6(KmLV^sw%N(jed!vz8TsH zz zK&Xk${rl5%bD7hey!V?41qx-=bHX?qZk?c6@CbS^UgW{5bAXDgt5Befsu1PK@UUWU zKGORFj;Q&zq4??O=%~Jd!P3%Fdhq!8`0ccAxGhml+l+CJu4Ucp5fKp>3?`N`I3&bC zU;l&{!PU=OF(+^wM6)d|EZp*PEIbuXz!31{$rEZCnzXlX#l^*ggM-!7)ft;nAx$4W ze_sod9jyr)sj^=I6X1a{hy_yIkKissCkkC%Jox|o& z1@fpO&)-hk+5;T%nbhi;l#lWSDJUqWZIZK+@UfmKOsFWghJrHFd?Xx_pFCD{QGf?2 zeA>)(>C(*lRHNxN;5@?<6Dc>-W@cuN{v51%N~Xv%t&G<|?GiEejg2M6#fk9q%ciT5 zl90HGkF%wC7Fm7IX(ituv9C)KcUNO4vl}V9C3^g@&&jNVhK}yrw{Ncn9`)G+{RQ|O z7#KJ{m^gkB9$o-Nfsa32W;+r_BLpS%T=qwU|LL)@v8n#cG_Vb6S&61f@vQ*gq3k{w z+Hy%AA8tKb>c2Olpr9b;vRq$w!rG>%dxwTNBINN22sp?T<>kMuj#YK0NQIk`?(Ym3 zvEA*D7qHIKScE+V!lLBif*KoJW|iw2C%g7H@u8K%+DE@u4XDFrmzEM@V?pbHfS8$_ zB&MWvo%$3AJ2f>mwZ0x(vA|j1+w0s{`jiwcM2?4#Z*ncpLEA7J4VRgppAYEQ@}kc3 zcMsI++IY?2>M(57e1pprA(u$bBy_kudUQ0O7S2MVU~g|fKB%Fk)s|iVElI4%#I-@!)D80i}6IJVwX>)@~vAOWNk@euJ7zhN=uvewFdj{vqlCHQ`6EOZgonL>qE=Z zbI}(4WPk78d17J*xap>u+n??-MX+~ZrCCVKT+g08YnC~WUKAvJm*hJ1TqPWM=Wc z&F=DE|N8oe<%`Fi!oA1#)0?LV+%8pACp4;KjPc(jy?OIyI}sE!;1Zp<+d4d55J|9Q zBQFDU1{%7!u+S05Czt;^^lpBlyHf_|9tCgB*Ca9RkCIM3lax%P!Ob87cjM=Yk*-!-OgFw3E{lR#JZyqgz3IywS`nLLe+K575s ziTF$r&u?eKF=7)E=H}-7uOrcZdf~`0TD^u;mg%)Do<7RbD%@9|f{-6Vwoba z7^KwXZ3FdrnST-m4BNnyR3bmdA+=j1g!gGV`ER?K@sVv zsJ}EH()U^* zbX3l*6yu4^;Ka%(ObZL=zwfqyjTN571)JL(y3$R=Snd=H*Vf!3MeWrPCsow z_E8{=wRJX>B1ksH=g)7T7oZK@#go(1FRf0as<{%u-XNN}*>(6oAiBMQ{>4_91UTU$KFA)Okqcuq{oc-%kT`hPQ0;yo6> zGlOVTapa-S!!a>6<=YS;U7Du z)UU5oQ!-3up*igcDnK}X{HWN=cLw(fh!^UxQ_(nwY0Q%XJiZC|R2ME}OUl`rnwm;W zqbR1cDk=uSK!7%=B2q6!9cJ^*@_Py9xp0o};=p-a3_ZSMT-8fxFv}R=go74{ezS|3EwWW@axbDQTu*qIo%n*BlHC zARum=*6BVZq@-|^^D-a{z>IS0ZYYU%G|$tns`StCkwfOu&}DjV7Cd`)TJo&1Eee+E zC^nW#pAZb7w$4tYn#Tg8GzcY}`c9%S2r)2AG}YDp(`!T=e|!ct=)F2B!W1EF@huUU zQeR(RVj}Iexa#{YM1EM_ZtXX4=0Wo6>gwIK2_NuZ!PRwjbXlW67^<+7;Rk*)=C$M>PL}Wh zsWsb~LQhIs3{(etyX{2n5wt9~?fLUbw_y*uxVV7-30jksduFQf+0f7sNzmuv;m3_n z&x(kM0N*eyv5Y7!-HBk9tFEcJZ(;(Lcdgro2~P|SJV+7}CJX=f?`;hX#>hHiY5o2E z!8TQ|BeLT(wy`1PMA*ZprtU$B*)$YXRUNFa^CoocZf$LCZsz3Wjh0%+ELZt&v|QYQ zx3;%!?Cf3y2g~4fB#MBxeh;?7?()z>Q3-DYyMl9R&; z4-3rmW#NqTAWG7Pd0$^>Gl!jGRe3iHnZ?V>^WBucb<2#G3Oq7>o?kzjLh!#OT8^rU z01^6^V-cPEeY#v)z!n8h0c2O0{7=M^-3NT1TCW3eJOSD&_4A8D5(KO%QabBgR^lJl ziwOz+DjhIXPd`gNM1hba4sz^dCeyccOanmffqy<$>qW!ZH!(5M*T)hepCQZ;*pd0F z4E@2S7RU#Pb2@VJrnxOj9(^4s5F?}Tu;%cR1|V*W=F0ipz9IONzpDc2P`=ExL~I-! zK}{yWf@kLDz_kVss{m{mSW^4yjZ;Cg!9hXU`S}1vf4La8PQ99|qm}B0hJS!XLy16# z>gxk7lyut%R^Y!l5nN#0zB>!1?4?VW)cNl_;o+k7HL&Me7;Cz^x*n`?pzemsvnw)U0di(p7G;)LW$4|{IF7BB}`t;c| z$B^oP`(Hj!_#8_>|BaTWuKPWka87a$OP$dJlB017TcNrhPEm1#os5;072=!FM>62Y zfnadtAm}Xf1)r011g&F!!k0~|dcKaX=iwY%`sqEFefy&_2rO%Ocvb_7{kqKTg6^m7bY-y5O_3 zaISAK^VRDoC#I+Zzf|d%vsBJk@9DKrkcqD2?sC!Zs{o|H)+y4-g8*WoYOU74Bz=;8 z#X$*d*1LBh8KQ}hFDWml|LtGrJoh3cg+U4I zLrB!|@08;>#cvp02ckqvbMyXzfoDowB^x+#?F~|*^AxmA1apq4YjIzv98#a6d{=Yo ztqW?J&5NgqP`;=9itzy)0Mwr7p|IK8zkW>*u01V75KFp~5U#jbU7Z}vJhz%gT*R0w zK;{iRjQAYnBC5C{d4c|h!!G`|-{YGChp!ZoC!4EoIn7MVgYRJjF4tA$>@@1KRL(o)a zHffa9o2X&#Ohx*hIq6x99M z2W16uA*W<!9MHrkXrAD0Yw4dHgB=6hP&M4>A8AtqrI@HFF1jHgU!-~|RQNM$g@CV z0`@JKxX?X-H$z1H`ZYzhA}(T};rH>QsAv*TggkgyKo-H4g<6JBdHf>2qO#KNN7 zUB)c;!p*~@<@0B8pFf@(KboM;0K#Yd)w>&vyDUp2Ja!oZUUTU_(GEgVLpXgOt^Fei zfQ|X=BII}OYHB29Ny*87#y!^VjkLe!zRbfjUh*Ikf?F3z-!sJ+dZS}wlVe@`7C%u-iV8}~Ur z!Vpk=O%UoF8#{tc-T09cE*f|%+?`D@-L8}kSp5` zw58w?Zr+hPf@C>p#oWy7JYE1~58V0{>yXS{*2+`aIClBJMd%!0Up%gSs+E)CodW*p=aPqG0U+6|l9o=Hus2gmH<*@44jF9Jq)jLDqRE z(nmL+WY4dyV%~mQypEl6A+&(%wBtDZclSeK}aUJtn#_SqpKxu-0; zKhJUkwCHX*)Xu)h=g*%lvlc+tfzJcH-t?M#%ZrO>zxwv}+=>ceLBal(mX@9#l9LGm zceo8u_>dt7$-V_mKe~#9C2ymYOa0baf zktl4r0|;YoJ}Y(n`wjpK*S_WL+us&?Gr=PQA##V|WJmm`NV?8K5)u-Usm6p%qGjm= z=hKiZ-{x!F-EuQjk5qAF=>dW?hHJDPx4R=kHBiqb@qO{L2-==YiqgTYrs`Tc(~!dh z@!c)QoZR~SLp=n(MR?{PY-Ewcr;(Ml^X&hOvcPG;WBg~Bbya*F-$(whFiR|%Z{utQ z9t;j0qfS1%jrZ4)s$qtRH-G$c#XtIc*MrHGKDT>?I^aaGM#uv|;o2iG^1!S?k)I2_ zLO`Gtgb?Sfw8K^41wQL%2gvE^Cx(Yb7v)Y27FjZ4ku8P_DumOQPyGzBASXyJkR^F{ z*hE{w&>ek`LG-&OpWjbAh1cHR4)IWDM+Y|t$Hw+HKObKsI`S$NApt?i6-ej~e{Vs{ zyWgaEg`M3E5{_2W&8!sIdVt!xckhCrF*h|mN#>iHFb9^Vl}@uqo9$Po3(KINgOXWT zSb$VV%58lT8tre-KVW@(O*e;~*osi`JL~II?czu*3(2in;0Q+Lc1aI~I5-|au?+4) z4MJKfDketocgOlpy4porTJNKs0o5y1baaMBMp9ai*8O>J)Ur<#(N;WM=;=vUN=i&z z9j_77s$}k<2``2Dk@Rj$V6m|Em07p?vem)Kf}R87CMzcgA6|rnQ3#T68IBK4yW-== z@j4&+5ib~QNk|xh9t?)qe|4%q^uj36mgye&^vRHwkG;>zda3RQcB09MI9(^q7V-0I zNLPYz{C_#tr4;p)EAHw#;IQ%X8pAZt3WUOH>`}1f3;}RCKnx4(O(7%q_V!k0B^A5H zlS&od0-ovu3^lnlnG}YHhud(Rc!*B}18-ol_2B-JM~R78!+zq|5P_MTF#&%5&;2Sm z$P0E=OukW_Bxu~nJByGv0Ik-{)#BKZn%Z!~V|-8|6+j%POebIz>+jzPgeHCN%PBHz zTidZBvvy&=JXrAyR8*mLqpi9G2=(C$u=*o!XGY4i5IviooJ?Il{uw4Tj>Xf|)Kmxu zkygnj()>?P+wh;B_Fg-9+DK{xC$Gn@4Mcws9JIByoiO_gH@-YwdJJ;lqCn7|%h0ON;(j4V&5@KbZMdF!i7&|m=Qwz|4hoSd92E$3fdQX-al zC<<@`%twxaI8ogF8o)FFbsqtzw>s=#AUVMMV7enYG0_uZUU0P~Bx(xVq6Na0S;Jd~ zJ$|iTVq=37iv9ID{c5+uckfJrTz*Rwp(UDwtOCS3Y#aO9-x&`B&`8F<*e6%B4ag@y ztRJYA*-v;c4_=+&UZ%g0pPQZ@*f|HrHx0}H$@Lc)*;`wCK&AyV3Y8TV%9qN*P0LPE-U zHC2HV1pWuu(1ns`iHIa0Es{~YK2b3;GOF-FQtxpZ+u7CH3>6hh!l2!g0~8Yf9$lbZ z4Zg0=?AHqpqDU6G+c$>()z1lB6iYtGzkCWkGZDnruNxXX;E`W2sXfuzv)SgM#37Q3 zY26tn$!&QU--QPdP=b)xNc7M)+Yo2`tG~U-5>93VbT1)+Mu0kL1WDNK?hPDhcF!eq zj-YvD<>duHFOjAHPUR3JDN15fRzwEP!;*eD4P7BipF~XTMds^@yNEgI5e9!X7DQdn ze}atZk}SPfpsCEZDwd`}WIt=s4-S*M#K}v?OYR$pMN$K&(bKpmEoU_cLWQ@z3y^uh zEEyE8Lmdh$=YfkL^N+*-sSKNCr!9#2;=Y1?3tQ_KG)`EHCJNAwsh2rb)YVVSJ&<)U z8o{ks1~I$G+w%5BmQTO440|{e&DrDD~O7rI#<8Q8=lya12z9?M{?bblVwtXrqtRh;uGt}CP>!A*0$ze<5N&vfSOnCmV6l=-UliP>GsvDSAn6zkmuEy_9GZp zfeA7h8JVA7!OHB`umK_N=Xh0I9P)HN*H!(1m;dq`%fP(+o8`EKQ(5u_I5W&Y!Q~I; z*VIUq^-XkkLVG9%^#sy{k>7dtYe`87sBdt;dKb1q7q+!22E0s2(9_a_nXAz(^H4J! zP`Hypg@umb_gYxYl}~twNZ6!@tV8fp*+@ERU2Il$G@l568F9 zaE@3Pn|J)!`VH}}9@y0`EHJg!6igl+9i79EgE&a*+T+8O59H~B$E&8Rn=O8Z7(Y-4 z?*q)iFaahOqZdHB#L(sV*Vq&oTs_bMh9+j@IuLI0Qw6wRije8&1y1M=X`zgD) zcngXJxCEr^me$tRR#taQEYDL=+N=zhUNNeTl4sH9aea3IT<+;Y6jH)+SwTkT34c;E zMC~v)_}cF}<~T@&-NxFwQO4Ctn3nu-92`D+Nl%zZ7OsJZO>K55qNCY;dtMdD7?>fT zn%Ec^>Q968yF%%;4NSyW3?JzoVpfrW*=qpZ zQ*XmL(Ey}f%qm8IG47A}U#>RIr#Z>baa;#cqk+92YXY?2nA7*<$DFCs%9r-%1AOPx zd|$u06xUujpLXWVnVd7rjA4?T60Z^xV2^3q02bk6;nVdvXTzeN+HZFko_v5OHB-QO z4Mv6Jxc9|-zj%gEcwC)Mi7M?w`KEXjGz1;f|(dd literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/html/coglglossary.html b/doc/reference/cogl-2.0-experimental/html/coglglossary.html new file mode 100644 index 0000000..17357f8 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/coglglossary.html @@ -0,0 +1,67 @@ + + + + +Glossaries + + + + + + + + + + + + + + + + +
+

+Glossaries

+ +
+

+Annotation Glossary

+

A

+
allow-none
+

NULL is ok, both for passing and for returning.

+
array
+

Parameter points to an array of items.

+

O

+
out
+

Parameter for returning results. Default is transfer full.

+

S

+
scope notified
+

The callback is valid until the GDestroyNotify argument is called.

+

C

+
closure
+

This parameter is a 'user_data', for callbacks; many bindings can pass NULL here.

+

O

+
out caller-allocates
+

Out parameter, where caller must allocate storage.

+

T

+
transfer full
+

Free data after the code is done.

+

I

+
in
+

Parameter for input. Default is transfer none.

+

T

+
transfer none
+

Don't free data after the code is done.

+

I

+
inout
+

Parameter for input and for returning results. Default is transfer full.

+

S

+
scope call
+

The callback is valid only during the call to the method.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/fill-rule-even-odd.png b/doc/reference/cogl-2.0-experimental/html/fill-rule-even-odd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e4fbb0f2a2dc04953609dfb942f48db046e46c1 GIT binary patch literal 3121 zcmb7Gc|4Tc8-HiPkU=SBWEr`%a7}j*VGOcWqTHJrVPu&ZvX1OiV~I~mDUxN<$dbB7 zY6c;Dv@k<B)-w{bp(ui5|AX7016?3|7KF+7 z{)6924RwRCvIx%l7ZxdEs+W51pL)Ga>ZqSNtOtk<3rIl=zU!LnJ=qC;g%$K#*tud|YePErg3$5j8yC zGrwz&n`NK{4gx|=rw_cq;p{9sTk&#zN^R?587+7{-wtr5!qqd?ME zD(?zWlYuUX)qixAZg9ULYSiAC>Y;lQA#^wJc_r=lHwEr{pwj)2CJfj;IhP(2ST@ZW+c}uA*N*xm($z?(scfC=>~+5`;W9p zR%aLW2UCGSVTsejsnkuH78M3$4To%C!XrbhFgZ7M@*#BkiluF|b_pT3G2UTm^{JmY z{_oaPX3r~>5ClmWcy0gI%J1)q3)=$#teQLD1!3JsZ$xHiY_5-DP*fZo3q)b8zsb2( zyZN+#_$uAEP-+e?!tMQonAF#Y zOESX9L#X=e6C0lTB#hYtyGOOQCutR#T zhqc~SRqqJnzRg`adVjX=ik{$l?o4yclBud^ZQ2>3IJE!4y`Aj|>}Rhoq^Awnq-rwq zaP2l7iwFBmt~!4zT2@gBxz1{-d~c`Ae-oe#>IIiMMZ>ikXokGrz}`t6bMa&y!3}cn z+ZkHYh&U92+?Fcja|S^FNZyg~;C^QGPoDH1jG|@Uyd?CzK-#v5!=})-q-JQo zz&-s;`^Wav*i^O4qIuTpE*B*ZHmrMg>AP~9d+WP1O*26&U$^3(TJWn`8rw5v7dl=I zjE@c4Cx-w-`tgARZGvrdIQOO_5%=0y)w2z@uiy@nWDTvj!rqIX8xk9|hy^KK1#Qys zUn@+mBu}87kICOiVt1kaXNE(5jz$VSXFZ7JCRF7YgzWiah6i?Zt>E6`_hM9q6Kkux zqETMxIew6j#@LT4(&p%!^@X+F_42~z7zEkfl0W0zhCoHfu`)D)a}#}wm4o|`X1@@tUjpFo`K#8#+TnEDL2OiKQ1dZl^lf9XHpW!-ne2~#Q`{n_^Gnu zq1~=krS?xZ5f}|HlzGdbseq!&S4}BONATGjDZvmh8fNx2y&f5DDOCj0saW`^1wZC4 zNpoBR?tD^nI*pgFyNQznHOO%+?Xv_GpZsrtlm&;Rp?>9fJpVe^dqLq#$c{zbI z?lC)DnL}B=1vg00!yC$X#wnlaPe?N=Fx7pjO9cX}wvP2T7<@+UKb4>-$CK;ae-?N< zj4#ut^UW=7*`4$tg|xecB!sV#?t@U4;;byi8k)c+2hdcAksYs$a8r~H~~yZ&1-_p(`2(|BGvf}~b}X6jR!sz?JWhFwPg8OU3`CDtp3Ikq)EYK+*_ zM0!}0q)}km;3B(Xw#aH!zgr02el!xo62LY_?=+VxinJ`Zcp98nneSe!hkWSS33Aoh zB17;uc5Le)41MSmWhd45(nzp@uv+LbF|>kazderfYB{G4b)wu>c!!xSaB`gh~)yLmi>&rIsdx5{!82y-ieu_K9n(Xo30 zT$fIS+O>BhChWp0{Q@h5FPK|{7z!U+1ll$jmn6=sjy{o4iZ{k3v2fdqSOA#r^-5-Y zMN?N*xLp&DYqZ>-*;ovbXn9Sp-AzpYkQ{(Fz9_n23pH#$+=%+i0n0WpJ(tyg_|lhJPQ-WLfej!oL{G0EnVT3Zxq=K3fDAlzU18 zB7LdQ23%NY7&xVqvrUU*sPA)l?xZmlLe*pn!H%g%bP)?Y1$pzSnjp%N5JQIY_~DM6}bf#RywtLIa;6 zDt$W5@y05%9KFkul(6nHMC=+KU!%du+8B+`hPHy`PyDgIf$aFcx)q;}4uhH~72$b> z+cTL51{ST3)9@Q>&zGGdppCr}#iXLM7iKn|kuLNkdE#j=gZ(xep7~`g{v$-fMa5ds z+ib$3IhKYb$!IUaMCDw$;*e>X_QsVoFuRt0qpyuIU7{uKWcZY&7EN9S%Rh5muT zV_6hnKDf3-C*9QfqM#%|xD7y^>pA%Fm#X>y=oX}RUH+J{bZd|NM2l#eoz;mWr541v F{{i05cM$*p literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/html/fill-rule-non-zero.png b/doc/reference/cogl-2.0-experimental/html/fill-rule-non-zero.png new file mode 100644 index 0000000000000000000000000000000000000000..2d8ad314c4baacc70c84b83b0b83b35e6a93a01c GIT binary patch literal 3143 zcmb7Gc|25WA3w7g#$H5JmK2gKVKRlr(rarN?M#c(7=y7iqDwKD=th_OCJn~k-k2~eBOKie4q3AopYYw{`}7GJkR%6oQJc5tfnjg01B=y zPDcO$N(A3KWf0)qVVpAuJ|L7M&JF;JxAikPL0oWmb^_KUS3&*5+aL!S=Hg8O067&2 zL4a(=W{@cz;fg&ZEkLNt>uF0nrRIYyjfg|1A{;}>WI{*;;CP8}K7w#jCyEpipyTX{ z#hr{-R0katxjNY&yCRq#?#eDUR7T)t-!3=qjVbGTW1ah(=5;8qW^f?SRnvI!{zfbk z^!dL*6+iGim`*{t9ryQde}|;YBLH?)YW}$fVyiTuoE(M#bQs^ClG=~9liU_PV^jcT z9J6Nj_#Bd^Ahae{2Bc*(0w}YbdU-_vjEm<-EZ(=>4TwFt5*33U|_+*wk2V@IIPI1J9qG9&FhqYPs<{Owk(GXUHVfTU6#C3Et<%L_6=H<15vC<%!;(hsX)-ee7?~z^61JjzMu`bR_DOJ&_x1S9e^@o{fEQ_x1tt9~LkKv1r zKTgBN3Taje#m$EeVFgwTw)l!36fso${Y+)$E;>Yqv9hs~jozY!zEyv&S)Q6{8xki) z_HaYE7RpmO9k0$lPDBx(E$oQt7X*J^*u({Yjs}?k0pqkrJKO?@{?l;vrhw5w%bOJI zWk5QMYXrOZRi*IV-NnQ7>e&)3n8mEfYp!p)Xj65nc;m}h&4t(Y$G}9QC^w?UAYYC< z2+HyN?%%R}5ttdR^CPajqj?YN;K>1n1^v18(;hxAM=vX+C1?OG-iy@Cf1`-BbTuP7 zk^snGR9s{wu+iu6u>uw-Pu;>h3-!5$W7mBx&#~+_IZF#AFQN27yZ6)+m(-`NGRQFR zXG$_k`#!lFs&E?)4;;0#n%_Br{pC;0ol@?T$gFbEv9MTll{?J!9g8Un5BuK5 zp=mpM_r5DzojW|(47HzB4z)|7r`0rWSdLZisET}Xv8xo1Smv2`K?MgVF!4=SaS?Vx zJ7=DW&yA~;aZ@);OiZ|uGF|CrN88YXp=`kMM2*s!ms&dtu8A~d;9#{>v(jqT zx@`Eu-fo-5QvrT03lo_>5b{Eerw*9VhxtW%+vekB-bQH_O8+#a>*R+GfypLrQc&@E zyO7+pUzi)zIztrvn+8jdkI!UWjSC#PN>5uB`e}t^#E~e0B(2(;{Tw)T$~Ng|$=w4= zo=4R<9*TuH1W-*+UY)k}et!%s1MuE1ZOpmJL|_sWbkq<=#djpV-}!LB-U0>gEw9Q% zipcG8$$QUbfTsmB%xJl%n~@jpgjp6(_w|>Bn{ET!{maKn9#qgZ`YJ>N=pB=T9DoT7 z?FsBrb)cw>GCzjT)~iHUletkJz&!?7D5F&EYrR~T;$JNf&?@|4f{p&s$h~%W1W=Yb z%(waF!vJ5vn1TK=;QQb&^+;5|)sV2410Gq-L24B(_e8>PVBfw(h2X_4MABC>ML1WR ze%Yt!B*LNu>+@0A9k${VsLUcxh@O0)IAfmH_z~LVS9>4(P*W1Td8{k6ib$wW#_hEr z-=QRDIaR2p4joB6ulS_agFBe~u-^xmuUoA?Pj*8Sq;66X2^uZlyA9TM0(Z^=^9>KK zBOzD}tl3yAE!2n&ILY~AG=*KkI`qm<=Ht!B_t$0oF!m`yJ>ly|ZF^hasLxPz(Q9l7 zw6CeBWyQi9}G8cnU;qAB1ZjW^r zzYdxnIF!8#VXH_@qZGri%ujyHP?ORZaIEi41K* z3$ph~S8Oi~R_Q#_Ere4~kb*{3+n>NIurA_@5U>+3JbE59yL6hnw5#l^7`+Z&p5|N+ zoXK3-*exo6P{UBi4CS_PQ4p+)BpqhUo(>$DyA4t@YmyC~c<<$opfH%CQ*tH+%L0I@t}8JX!cHlY{~Nd&BjKk_IhKs>pHlj%o&TVxu7icI1xS zX69R56*6EKi2}utS450qRih*s|D5#5HpTTQYP=8`LaS5-7SjVR;!n2KD7-?~aX`P| z{=E()aDT3h66r;C~pU3x`5ag5}DUC57 z`*PaSAB2^yW1Ho$9l4>TK)*bt0Ak9?AQg#9v=WhMk%SVSgmjo_s_EdgWr+RK77dD| zo9YrVt8c! zAQJ1xg2TH%-fzZfdqs@$XA9TL4N#tHO(2d-G)-O+N9VL^ndL{4XnVylH7%U><)oRP zotJAV{$tNvJn6h9{*e y<{bqu5{34YKxrUl;;`YAegRT~^Z(xwR~yY zO1cF+0vxb!W?!x?K+*#62Jq)nA4q`)5S6sgX4ao{=)(Mgq+YMr)7sjak|a^9)zS!j zlk{-n29mabXYF=7SYBQx&vO8xC}MYams+hxqtO7sImhPaCf@rq;I^3!#u*2aUP)55 zT2&N90xmEJ0s&fGT~(T<3d2xYmK9C>IP*x-M@ib*+0pFm>>uW37N2Wzaq-fCnIZE9 zpb8}0+uN+KuQM2oZVHfP8U6kQdo3?>Wo2dT)WeM9So8DqhLi#T0 z-i(>mfjhvbsYV`;4sgfJ-p>G-SqJ!fjR6BQYs1h*y9xaN0l{VB;o%`08yiy@)$8@~ z2PD1gcDuiy;j1tR0v#V8OH%W)25-YKyx(j#IXO9*YWf0mb8}QG6@b@;cHxh9{t7+@ o!Yd`f8L$sLH?yBt^q3C6015TtIu@BS5dZ)H07*qoM6N<$f*igdr~m)} literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/html/index.html b/doc/reference/cogl-2.0-experimental/html/index.html new file mode 100644 index 0000000..60ffd3a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/index.html @@ -0,0 +1,255 @@ + + + + +Cogl 2.0 Reference Manual + + + + + + + +
+
+
+
+

for Cogl 2.0;

+
+
+
+

+ Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +

+


+          The Free Software Foundation, Inc.,
+          59 Temple Place - Suite 330,
+          Boston, MA 02111-1307,
+          USA
+        

+

+

+
+
+
+
+
+
Cogl - a modern 3D graphics API
+
+
About Cogl
+
General API concepts
+
+
+The Object Interface +
+
+Exception handling — A way for Cogl to throw exceptions +
+
+Common Types — Types used throughout the library +
+
+
Setting Up A Drawing Context
+
+
+CoglRenderer: Connect to a backend renderer — Choosing a means to render +
+
+CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+CoglDisplay: Setup a display pipeline — Common aspects of a display pipeline +
+
+The Top-Level Context — The top level application context. +
+
+
Setting Up A GPU Pipeline
+
+
+Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions. +
+
+Pipeline — Functions for creating and manipulating the GPU + pipeline +
+
+Depth State — Functions for describing the depth testing + state of your GPU. +
+
+Shader snippets — Functions for creating and manipulating shader snippets +
+
+
Allocating GPU Memory
+
+
+CoglBuffer: The Buffer Interface — Common buffer functions, including data upload APIs +
+
+CoglAttributeBuffer: Buffers of vertex attributes — Functions for creating and manipulating attribute + buffers +
+
+CoglIndexBuffer: Buffers of vertex indices — Functions for creating and manipulating vertex +indices. +
+
+
Describing the layout of GPU Memory
+
+
+Vertex Attributes — Functions for declaring and drawing vertex + attributes +
+
+IndicesDescribe vertex indices stored in a CoglIndexBuffer. +
+
+
Geometry
+
+
+Primitives — Functions for creating, manipulating and drawing + primitives +
+
+Path Primitives +
+
+Rectangles +
+
+
Textures
+
+
+Bitmap — Functions for loading images +
+
+The Texture Interface — Functions for creating and manipulating textures +
+
+
Meta Textures
+
+
+High Level Meta TexturesInterface for high-level textures built from + low-level textures like CoglTexture2D and + CoglTexture3D. +
+
+Sub Textures — Functions for creating and manipulating + sub-textures. +
+
+Sliced Textures — Functions for creating and manipulating 2D meta + textures that may internally be comprised of + multiple 2D textures with power-of-two sizes. +
+
+X11 Texture From Pixmap — Functions for creating and manipulating 2D meta + textures derived from X11 pixmaps. +
+
+
Primitive Textures
+
+
+Low-level primitive texturesInterface for low-level textures like + CoglTexture2D and CoglTexture3D. +
+
+2D textures — Functions for creating and manipulating 2D textures +
+
+3D textures — Functions for creating and manipulating 3D textures +
+
+Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle + textures for use with non-normalized coordinates. +
+
+
Framebuffers
+
+
+CoglFramebuffer: The Framebuffer Interface — A common interface for manipulating framebuffers +
+
+CoglOnscreen: The Onscreen Framebuffer Interface +
+
+Offscreen Framebuffers — Functions for creating and manipulating offscreen + framebuffers. +
+
+
Utilities
+
+
+Color Type — A generic color definition +
+
+Matrices — Functions for initializing and manipulating 4x4 matrices +
+
+Matrix Stacks — Functions for efficiently tracking many + related transformations +
+
+3 Component Vectors — Functions for handling single precision float + vectors. +
+
+Eulers (Rotations) — Functions for initializing and manipulating +euler angles. +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+GPU synchronisation fences — Functions for notification of command completion +
+
+Versioning utility macros — Macros for determining the version of Cogl being used +
+
+
Binding and Integrating
+
+
+SDL Integration — Integration api for the Simple DirectMedia + Layer library. +
+
+Main loop integration — Functions for integrating Cogl with an + application's main loop +
+
+GType Integration API +
+
+GLES 2.0 context — A portable api to access OpenGLES 2.0 +
+
+
+
Glossaries
+
Annotation Glossary
+
Index of all symbols
+
Index of deprecated symbols
+
Index of new symbols in 0.8
+
Index of new symbols in 1.0
+
Index of new symbols in 1.2
+
Index of new symbols in 1.4
+
A. License
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/index.sgml b/doc/reference/cogl-2.0-experimental/html/index.sgml new file mode 100644 index 0000000..82ce267 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/index.sgml @@ -0,0 +1,966 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl-2.0-experimental/html/ix01.html b/doc/reference/cogl-2.0-experimental/html/ix01.html new file mode 100644 index 0000000..6a39d8d --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix01.html @@ -0,0 +1,2517 @@ + + + + +Index of all symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of all symbols

+

A

+
+CoglAtlasTexture, struct in Atlas Textures +
+
+
+cogl_atlas_texture_new_from_bitmap, function in Atlas Textures +
+
+
+cogl_atlas_texture_new_from_data, function in Atlas Textures +
+
+
+cogl_atlas_texture_new_from_file, function in Atlas Textures +
+
+
+cogl_atlas_texture_new_with_size, function in Atlas Textures +
+
+
+CoglAttribute, struct in Vertex Attributes +
+
+
+CoglAttributeBuffer, struct in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+CoglAttributeType, enum in Common Types +
+
+
+cogl_attribute_buffer_new, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_attribute_buffer_new_with_size, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_attribute_get_buffer, function in Vertex Attributes +
+
+
+cogl_attribute_get_normalized, function in Vertex Attributes +
+
+
+cogl_attribute_new, function in Vertex Attributes +
+
+
+cogl_attribute_set_buffer, function in Vertex Attributes +
+
+
+cogl_attribute_set_normalized, function in Vertex Attributes +
+
+

B

+
+CoglBitmap, struct in Bitmap +
+
+
+CoglBitmapError, enum in Bitmap +
+
+
+COGL_BITMAP_ERROR, macro in Bitmap +
+
+
+cogl_bitmap_get_buffer, function in Bitmap +
+
+
+cogl_bitmap_get_format, function in Bitmap +
+
+
+cogl_bitmap_get_height, function in Bitmap +
+
+
+cogl_bitmap_get_rowstride, function in Bitmap +
+
+
+cogl_bitmap_get_size_from_file, function in Bitmap +
+
+
+cogl_bitmap_get_width, function in Bitmap +
+
+
+cogl_bitmap_new_for_data, function in Bitmap +
+
+
+cogl_bitmap_new_from_buffer, function in Bitmap +
+
+
+cogl_bitmap_new_from_file, function in Bitmap +
+
+
+cogl_bitmap_new_with_size, function in Bitmap +
+
+
+CoglBlendStringError, enum in Pipeline +
+
+
+COGL_BLEND_STRING_ERROR, macro in Pipeline +
+
+
+CoglBool, typedef in Common Types +
+
+
+CoglBuffer, typedef in CoglBuffer: The Buffer Interface +
+
+
+CoglBufferAccess, enum in CoglBuffer: The Buffer Interface +
+
+
+CoglBufferBit, enum in Common Types +
+
+
+CoglBufferMapHint, enum in CoglBuffer: The Buffer Interface +
+
+
+CoglBufferTarget, enum in Common Types +
+
+
+CoglBufferUpdateHint, enum in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_get_size, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_get_update_hint, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_map, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_map_range, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_set_data, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_set_update_hint, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_buffer_unmap, function in CoglBuffer: The Buffer Interface +
+
+

C

+
+cogl_clear, function in The Top-Level Context +
+
+
+CoglColor, struct in Color Type +
+
+
+CoglColorMask, enum in Common Types +
+
+
+cogl_color_copy, function in Color Type +
+
+
+cogl_color_equal, function in Color Type +
+
+
+cogl_color_free, function in Color Type +
+
+
+cogl_color_get_alpha, function in Color Type +
+
+
+cogl_color_get_alpha_byte, function in Color Type +
+
+
+cogl_color_get_alpha_float, function in Color Type +
+
+
+cogl_color_get_blue, function in Color Type +
+
+
+cogl_color_get_blue_byte, function in Color Type +
+
+
+cogl_color_get_blue_float, function in Color Type +
+
+
+cogl_color_get_green, function in Color Type +
+
+
+cogl_color_get_green_byte, function in Color Type +
+
+
+cogl_color_get_green_float, function in Color Type +
+
+
+cogl_color_get_red, function in Color Type +
+
+
+cogl_color_get_red_byte, function in Color Type +
+
+
+cogl_color_get_red_float, function in Color Type +
+
+
+cogl_color_init_from_hsl, function in Color Type +
+
+
+cogl_color_new, function in Color Type +
+
+
+cogl_color_premultiply, function in Color Type +
+
+
+cogl_color_set_alpha, function in Color Type +
+
+
+cogl_color_set_alpha_byte, function in Color Type +
+
+
+cogl_color_set_alpha_float, function in Color Type +
+
+
+cogl_color_set_blue, function in Color Type +
+
+
+cogl_color_set_blue_byte, function in Color Type +
+
+
+cogl_color_set_blue_float, function in Color Type +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+
+cogl_color_set_green, function in Color Type +
+
+
+cogl_color_set_green_byte, function in Color Type +
+
+
+cogl_color_set_green_float, function in Color Type +
+
+
+cogl_color_set_red, function in Color Type +
+
+
+cogl_color_set_red_byte, function in Color Type +
+
+
+cogl_color_set_red_float, function in Color Type +
+
+
+cogl_color_to_hsl, function in Color Type +
+
+
+cogl_color_unpremultiply, function in Color Type +
+
+
+CoglContext, struct in The Top-Level Context +
+
+
+cogl_context_get_display, function in The Top-Level Context +
+
+
+cogl_context_new, function in The Top-Level Context +
+
+

D

+
+CoglDepthState, struct in Depth State +
+
+
+CoglDepthTestFunction, enum in Depth State +
+
+
+cogl_depth_state_get_range, function in Depth State +
+
+
+cogl_depth_state_get_test_enabled, function in Depth State +
+
+
+cogl_depth_state_get_test_function, function in Depth State +
+
+
+cogl_depth_state_get_write_enabled, function in Depth State +
+
+
+cogl_depth_state_init, function in Depth State +
+
+
+cogl_depth_state_set_range, function in Depth State +
+
+
+cogl_depth_state_set_test_enabled, function in Depth State +
+
+
+cogl_depth_state_set_test_function, function in Depth State +
+
+
+cogl_depth_state_set_write_enabled, function in Depth State +
+
+
+CoglDisplay, struct in CoglDisplay: Setup a display pipeline +
+
+
+cogl_display_get_renderer, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_display_new, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_display_setup, function in CoglDisplay: Setup a display pipeline +
+
+

E

+
+CoglError, macro in Exception handling +
+
+
+cogl_error_copy, function in Exception handling +
+
+
+cogl_error_free, function in Exception handling +
+
+
+cogl_error_matches, function in Exception handling +
+
+
+CoglEuler, struct in Eulers (Rotations) +
+
+
+cogl_euler_copy, function in Eulers (Rotations) +
+
+
+cogl_euler_equal, function in Eulers (Rotations) +
+
+
+cogl_euler_free, function in Eulers (Rotations) +
+
+
+cogl_euler_init, function in Eulers (Rotations) +
+
+
+cogl_euler_init_from_matrix, function in Eulers (Rotations) +
+
+
+cogl_euler_init_from_quaternion, function in Eulers (Rotations) +
+
+

F

+
+CoglFeatureCallback, user_function in The Top-Level Context +
+
+
+CoglFeatureID, enum in The Top-Level Context +
+
+
+CoglFence, struct in GPU synchronisation fences +
+
+
+CoglFenceCallback, user_function in GPU synchronisation fences +
+
+
+CoglFenceClosure, struct in GPU synchronisation fences +
+
+
+cogl_fence_closure_get_user_data, function in GPU synchronisation fences +
+
+
+CoglFilterReturn, enum in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_flush, function in The Top-Level Context +
+
+
+cogl_foreach_feature, function in The Top-Level Context +
+
+
+CoglFramebuffer, typedef in CoglFramebuffer: The Framebuffer Interface +
+
+
+COGL_FRAMEBUFFER, macro in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_add_fence_callback, function in GPU synchronisation fences +
+
+
+cogl_framebuffer_allocate, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_cancel_fence_callback, function in GPU synchronisation fences +
+
+
+cogl_framebuffer_clear, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_clear4f, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_discard_buffers, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_multitextured_rectangle, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_rectangle, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_rectangles, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_textured_rectangle, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_textured_rectangles, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_finish, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_frustum, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_alpha_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_blue_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_color_mask, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_context, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_depth_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_dither_enabled, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_green_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_height, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_modelview_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_projection_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_red_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_samples_per_pixel, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_viewport4fv, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_viewport_height, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_viewport_width, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_viewport_x, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_viewport_y, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_width, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_identity_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_orthographic, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_perspective, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_pop_clip, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_pop_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_push_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_push_primitive_clip, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_push_rectangle_clip, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_push_scissor_clip, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_read_pixels, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_read_pixels_into_bitmap, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_resolve_samples, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_resolve_samples_region, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_rotate, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_rotate_euler, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_rotate_quaternion, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_scale, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_color_mask, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_dither_enabled, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_modelview_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_projection_matrix, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_samples_per_pixel, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_set_viewport, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_transform, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_translate, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+CoglFrameCallback, user_function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglFrameClosure, typedef in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_frustum, function in The Top-Level Context +
+
+
+CoglFuncPtr, user_function in Common Types +
+
+

G

+
+cogl_gdl_display_set_plane, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_get_draw_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_get_modelview_matrix, function in The Top-Level Context +
+
+
+cogl_get_projection_matrix, function in The Top-Level Context +
+
+
+cogl_get_rectangle_indices, function in Indices +
+
+
+cogl_get_source, function in The Top-Level Context +
+
+
+cogl_get_static_identity_quaternion, function in Quaternions (Rotations) +
+
+
+cogl_get_static_zero_quaternion, function in Quaternions (Rotations) +
+
+
+cogl_get_viewport, function in The Top-Level Context +
+
+
+CoglGLES2Context, struct in GLES 2.0 context +
+
+
+CoglGLES2ContextError, enum in GLES 2.0 context +
+
+
+CoglGLES2Vtable, struct in GLES 2.0 context +
+
+
+COGL_GLES2_CONTEXT_ERROR, macro in GLES 2.0 context +
+
+
+cogl_gles2_context_get_vtable, function in GLES 2.0 context +
+
+
+cogl_gles2_context_new, function in GLES 2.0 context +
+
+
+cogl_gles2_get_current_vtable, function in GLES 2.0 context +
+
+
+cogl_gles2_texture_2d_new_from_handle, function in GLES 2.0 context +
+
+
+cogl_gles2_texture_get_handle, function in GLES 2.0 context +
+
+
+COGL_GLIB_ERROR, macro in Exception handling +
+
+
+cogl_glib_renderer_source_new, function in Main loop integration +
+
+
+cogl_glib_source_new, function in Main loop integration +
+
+
+cogl_gtype_matrix_get_type, function in GType Integration API +
+
+

H

+
+cogl_has_feature, function in The Top-Level Context +
+
+
+cogl_has_features, function in The Top-Level Context +
+
+

I

+
+CoglIndexBuffer, struct in CoglIndexBuffer: Buffers of vertex indices +
+
+
+cogl_index_buffer_new, function in CoglIndexBuffer: Buffers of vertex indices +
+
+
+CoglIndices, struct in Indices +
+
+
+CoglIndicesType, enum in Indices +
+
+
+cogl_indices_new, function in Indices +
+
+
+cogl_is_atlas_texture, function in Atlas Textures +
+
+
+cogl_is_attribute, function in Vertex Attributes +
+
+
+cogl_is_attribute_buffer, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_is_bitmap, function in Bitmap +
+
+
+cogl_is_buffer, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_is_context, function in The Top-Level Context +
+
+
+cogl_is_display, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_is_gles2_context, function in GLES 2.0 context +
+
+
+cogl_is_index_buffer, function in CoglIndexBuffer: Buffers of vertex indices +
+
+
+cogl_is_indices, function in Indices +
+
+
+cogl_is_offscreen, function in Offscreen Framebuffers +
+
+
+cogl_is_onscreen, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_is_onscreen_template, function in CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+
+cogl_is_pipeline, function in Pipeline +
+
+
+cogl_is_pixel_buffer, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_is_primitive, function in Primitives +
+
+
+cogl_is_primitive_texture, function in Low-level primitive textures +
+
+
+cogl_is_renderer, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_is_snippet, function in Shader snippets +
+
+
+cogl_is_sub_texture, function in Sub Textures +
+
+
+cogl_is_swap_chain, function in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_is_texture, function in The Texture Interface +
+
+
+cogl_is_texture_2d_sliced, function in Sliced Textures +
+
+
+cogl_is_texture_3d, function in 3D textures +
+
+
+cogl_is_texture_pixmap_x11, function in X11 Texture From Pixmap +
+
+
+cogl_is_texture_rectangle, function in Rectangle textures (non-normalized coordinates) +
+
+

M

+
+CoglMatrix, struct in Matrices +
+
+
+CoglMatrixEntry, struct in Matrix Stacks +
+
+
+CoglMatrixStack, struct in Matrix Stacks +
+
+
+cogl_matrix_copy, function in Matrices +
+
+
+cogl_matrix_entry_calculate_translation, function in Matrix Stacks +
+
+
+cogl_matrix_entry_equal, function in Matrix Stacks +
+
+
+cogl_matrix_entry_get, function in Matrix Stacks +
+
+
+cogl_matrix_entry_is_identity, function in Matrix Stacks +
+
+
+cogl_matrix_entry_ref, function in Matrix Stacks +
+
+
+cogl_matrix_entry_unref, function in Matrix Stacks +
+
+
+cogl_matrix_equal, function in Matrices +
+
+
+cogl_matrix_free, function in Matrices +
+
+
+cogl_matrix_frustum, function in Matrices +
+
+
+cogl_matrix_get_array, function in Matrices +
+
+
+cogl_matrix_get_inverse, function in Matrices +
+
+
+cogl_matrix_init_from_array, function in Matrices +
+
+
+cogl_matrix_init_from_euler, function in Matrices +
+
+
+cogl_matrix_init_from_quaternion, function in Matrices +
+
+
+cogl_matrix_init_identity, function in Matrices +
+
+
+cogl_matrix_init_translation, function in Matrices +
+
+
+cogl_matrix_is_identity, function in Matrices +
+
+
+cogl_matrix_look_at, function in Matrices +
+
+
+cogl_matrix_multiply, function in Matrices +
+
+
+cogl_matrix_orthographic, function in Matrices +
+
+
+cogl_matrix_perspective, function in Matrices +
+
+
+cogl_matrix_project_points, function in Matrices +
+
+
+cogl_matrix_rotate, function in Matrices +
+
+
+cogl_matrix_rotate_euler, function in Matrices +
+
+
+cogl_matrix_rotate_quaternion, function in Matrices +
+
+
+cogl_matrix_scale, function in Matrices +
+
+
+cogl_matrix_stack_frustum, function in Matrix Stacks +
+
+
+cogl_matrix_stack_get, function in Matrix Stacks +
+
+
+cogl_matrix_stack_get_entry, function in Matrix Stacks +
+
+
+cogl_matrix_stack_get_inverse, function in Matrix Stacks +
+
+
+cogl_matrix_stack_load_identity, function in Matrix Stacks +
+
+
+cogl_matrix_stack_multiply, function in Matrix Stacks +
+
+
+cogl_matrix_stack_new, function in Matrix Stacks +
+
+
+cogl_matrix_stack_orthographic, function in Matrix Stacks +
+
+
+cogl_matrix_stack_perspective, function in Matrix Stacks +
+
+
+cogl_matrix_stack_pop, function in Matrix Stacks +
+
+
+cogl_matrix_stack_push, function in Matrix Stacks +
+
+
+cogl_matrix_stack_rotate, function in Matrix Stacks +
+
+
+cogl_matrix_stack_rotate_euler, function in Matrix Stacks +
+
+
+cogl_matrix_stack_rotate_quaternion, function in Matrix Stacks +
+
+
+cogl_matrix_stack_scale, function in Matrix Stacks +
+
+
+cogl_matrix_stack_set, function in Matrix Stacks +
+
+
+cogl_matrix_stack_translate, function in Matrix Stacks +
+
+
+cogl_matrix_transform_point, function in Matrices +
+
+
+cogl_matrix_transform_points, function in Matrices +
+
+
+cogl_matrix_translate, function in Matrices +
+
+
+cogl_matrix_transpose, function in Matrices +
+
+
+CoglMetaTexture, typedef in High Level Meta Textures +
+
+
+CoglMetaTextureCallback, user_function in High Level Meta Textures +
+
+
+cogl_meta_texture_foreach_in_region, function in High Level Meta Textures +
+
+

O

+
+CoglObject, struct in The Object Interface +
+
+
+cogl_object_get_user_data, function in The Object Interface +
+
+
+cogl_object_ref, function in The Object Interface +
+
+
+cogl_object_set_user_data, function in The Object Interface +
+
+
+cogl_object_unref, function in The Object Interface +
+
+
+CoglOffscreen, struct in Offscreen Framebuffers +
+
+
+cogl_offscreen_new_with_texture, function in Offscreen Framebuffers +
+
+
+CoglOnscreen, struct in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+COGL_ONSCREEN, macro in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenDirtyCallback, user_function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenDirtyClosure, typedef in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenDirtyInfo, struct in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenResizeCallback, user_function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenResizeClosure, typedef in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreenTemplate, struct in CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+
+CoglOnscreenX11MaskCallback, user_function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_add_dirty_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_add_frame_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_add_resize_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_add_swap_buffers_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_hide, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_new, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_remove_dirty_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_remove_frame_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_remove_resize_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_remove_swap_buffers_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_set_swap_throttled, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_show, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_swap_buffers, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_swap_buffers_with_damage, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_swap_region, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_template_new, function in CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+
+cogl_ortho, function in The Top-Level Context +
+
+

P

+
+cogl_perspective, function in The Top-Level Context +
+
+
+CoglPipeline, struct in Pipeline +
+
+
+CoglPipelineAlphaFunc, enum in Pipeline +
+
+
+CoglPipelineCullFaceMode, enum in Pipeline +
+
+
+CoglPipelineFilter, enum in Pipeline +
+
+
+CoglPipelineLayerCallback, user_function in Pipeline +
+
+
+CoglPipelineWrapMode, enum in Pipeline +
+
+
+cogl_pipeline_add_layer_snippet, function in Pipeline +
+
+
+cogl_pipeline_add_snippet, function in Pipeline +
+
+
+cogl_pipeline_copy, function in Pipeline +
+
+
+cogl_pipeline_foreach_layer, function in Pipeline +
+
+
+cogl_pipeline_get_ambient, function in Pipeline +
+
+
+cogl_pipeline_get_color, function in Pipeline +
+
+
+cogl_pipeline_get_color_mask, function in Pipeline +
+
+
+cogl_pipeline_get_depth_state, function in Pipeline +
+
+
+cogl_pipeline_get_diffuse, function in Pipeline +
+
+
+cogl_pipeline_get_emission, function in Pipeline +
+
+
+cogl_pipeline_get_layer_mag_filter, function in Pipeline +
+
+
+cogl_pipeline_get_layer_min_filter, function in Pipeline +
+
+
+cogl_pipeline_get_layer_point_sprite_coords_enabled, function in Pipeline +
+
+
+cogl_pipeline_get_layer_texture, function in Pipeline +
+
+
+cogl_pipeline_get_n_layers, function in Pipeline +
+
+
+cogl_pipeline_get_per_vertex_point_size, function in Pipeline +
+
+
+cogl_pipeline_get_point_size, function in Pipeline +
+
+
+cogl_pipeline_get_shininess, function in Pipeline +
+
+
+cogl_pipeline_get_specular, function in Pipeline +
+
+
+cogl_pipeline_get_uniform_location, function in Pipeline +
+
+
+cogl_pipeline_new, function in Pipeline +
+
+
+cogl_pipeline_remove_layer, function in Pipeline +
+
+
+cogl_pipeline_set_alpha_test_function, function in Pipeline +
+
+
+cogl_pipeline_set_ambient, function in Pipeline +
+
+
+cogl_pipeline_set_ambient_and_diffuse, function in Pipeline +
+
+
+cogl_pipeline_set_blend, function in Pipeline +
+
+
+cogl_pipeline_set_blend_constant, function in Pipeline +
+
+
+cogl_pipeline_set_color, function in Pipeline +
+
+
+cogl_pipeline_set_color4f, function in Pipeline +
+
+
+cogl_pipeline_set_color4ub, function in Pipeline +
+
+
+cogl_pipeline_set_color_mask, function in Pipeline +
+
+
+cogl_pipeline_set_cull_face_mode, function in Pipeline +
+
+
+cogl_pipeline_set_depth_state, function in Pipeline +
+
+
+cogl_pipeline_set_diffuse, function in Pipeline +
+
+
+cogl_pipeline_set_emission, function in Pipeline +
+
+
+cogl_pipeline_set_front_face_winding, function in Pipeline +
+
+
+cogl_pipeline_set_layer_combine, function in Pipeline +
+
+
+cogl_pipeline_set_layer_combine_constant, function in Pipeline +
+
+
+cogl_pipeline_set_layer_filters, function in Pipeline +
+
+
+cogl_pipeline_set_layer_matrix, function in Pipeline +
+
+
+cogl_pipeline_set_layer_null_texture, function in Pipeline +
+
+
+cogl_pipeline_set_layer_point_sprite_coords_enabled, function in Pipeline +
+
+
+cogl_pipeline_set_layer_texture, function in Pipeline +
+
+
+cogl_pipeline_set_layer_wrap_mode, function in Pipeline +
+
+
+cogl_pipeline_set_layer_wrap_mode_p, function in Pipeline +
+
+
+cogl_pipeline_set_layer_wrap_mode_s, function in Pipeline +
+
+
+cogl_pipeline_set_layer_wrap_mode_t, function in Pipeline +
+
+
+cogl_pipeline_set_per_vertex_point_size, function in Pipeline +
+
+
+cogl_pipeline_set_point_size, function in Pipeline +
+
+
+cogl_pipeline_set_shininess, function in Pipeline +
+
+
+cogl_pipeline_set_specular, function in Pipeline +
+
+
+cogl_pipeline_set_uniform_1f, function in Pipeline +
+
+
+cogl_pipeline_set_uniform_1i, function in Pipeline +
+
+
+cogl_pipeline_set_uniform_float, function in Pipeline +
+
+
+cogl_pipeline_set_uniform_int, function in Pipeline +
+
+
+cogl_pipeline_set_uniform_matrix, function in Pipeline +
+
+
+CoglPixelBuffer, struct in CoglBuffer: The Buffer Interface +
+
+
+CoglPixelFormat, enum in Common Types +
+
+
+cogl_pixel_buffer_new, function in CoglBuffer: The Buffer Interface +
+
+
+CoglPollFD, struct in Main loop integration +
+
+
+CoglPollFDEvent, enum in Main loop integration +
+
+
+cogl_poll_renderer_dispatch, function in Main loop integration +
+
+
+cogl_poll_renderer_get_info, function in Main loop integration +
+
+
+cogl_polygon, function in Primitives (Deprecated) +
+
+
+cogl_pop_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_pop_gles2_context, function in GLES 2.0 context +
+
+
+cogl_pop_matrix, function in The Top-Level Context +
+
+
+cogl_pop_source, function in The Top-Level Context +
+
+
+CoglPrimitive, struct in Primitives +
+
+
+CoglPrimitiveAttributeCallback, user_function in Primitives +
+
+
+CoglPrimitiveTexture, typedef in Low-level primitive textures +
+
+
+cogl_primitive_copy, function in Primitives +
+
+
+cogl_primitive_draw, function in Primitives +
+
+
+cogl_primitive_foreach_attribute, function in Primitives +
+
+
+cogl_primitive_get_first_vertex, function in Primitives +
+
+
+cogl_primitive_get_indices, function in Primitives +
+
+
+cogl_primitive_get_mode, function in Primitives +
+
+
+cogl_primitive_get_n_vertices, function in Primitives +
+
+
+cogl_primitive_new, function in Primitives +
+
+
+cogl_primitive_new_p2, function in Primitives +
+
+
+cogl_primitive_new_p2c4, function in Primitives +
+
+
+cogl_primitive_new_p2t2, function in Primitives +
+
+
+cogl_primitive_new_p2t2c4, function in Primitives +
+
+
+cogl_primitive_new_p3, function in Primitives +
+
+
+cogl_primitive_new_p3c4, function in Primitives +
+
+
+cogl_primitive_new_p3t2, function in Primitives +
+
+
+cogl_primitive_new_p3t2c4, function in Primitives +
+
+
+cogl_primitive_new_with_attributes, function in Primitives +
+
+
+cogl_primitive_set_attributes, function in Primitives +
+
+
+cogl_primitive_set_first_vertex, function in Primitives +
+
+
+cogl_primitive_set_indices, function in Primitives +
+
+
+cogl_primitive_set_mode, function in Primitives +
+
+
+cogl_primitive_set_n_vertices, function in Primitives +
+
+
+cogl_primitive_texture_set_auto_mipmap, function in Low-level primitive textures +
+
+
+cogl_push_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_push_gles2_context, function in GLES 2.0 context +
+
+
+cogl_push_matrix, function in The Top-Level Context +
+
+
+cogl_push_source, function in The Top-Level Context +
+
+

Q

+
+CoglQuaternion, struct in Quaternions (Rotations) +
+
+
+cogl_quaternion_copy, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_dot_product, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_equal, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_free, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_get_rotation_angle, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_get_rotation_axis, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_angle_vector, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_array, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_euler, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_quaternion, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_x_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_y_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_z_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_identity, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_invert, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_multiply, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_nlerp, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_normalize, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_pow, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_slerp, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_squad, function in Quaternions (Rotations) +
+
+

R

+
+CoglReadPixelsFlags, enum in The Top-Level Context +
+
+
+cogl_read_pixels, function in The Top-Level Context +
+
+
+cogl_rectangle, function in Rectangles +
+
+
+cogl_rectangles, function in Rectangles +
+
+
+cogl_rectangles_with_texture_coords, function in Rectangles +
+
+
+cogl_rectangle_with_multitexture_coords, function in Rectangles +
+
+
+cogl_rectangle_with_texture_coords, function in Rectangles +
+
+
+CoglRenderer, struct in CoglRenderer: Connect to a backend renderer +
+
+
+CoglRendererConstraint, enum in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_add_constraint, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_connect, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_get_n_fragment_texture_units, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_get_winsys_id, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_new, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_remove_constraint, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_renderer_set_winsys_id, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_rotate, function in The Top-Level Context +
+
+

S

+
+cogl_scale, function in The Top-Level Context +
+
+
+cogl_sdl_context_new, function in SDL Integration +
+
+
+cogl_sdl_handle_event, function in SDL Integration +
+
+
+cogl_sdl_idle, function in SDL Integration +
+
+
+cogl_sdl_onscreen_get_window, function in SDL Integration +
+
+
+cogl_sdl_renderer_get_event_type, function in SDL Integration +
+
+
+cogl_sdl_renderer_set_event_type, function in SDL Integration +
+
+
+cogl_set_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_set_modelview_matrix, function in The Top-Level Context +
+
+
+cogl_set_projection_matrix, function in The Top-Level Context +
+
+
+cogl_set_source, function in The Top-Level Context +
+
+
+cogl_set_source_color, function in The Top-Level Context +
+
+
+cogl_set_source_color4f, function in The Top-Level Context +
+
+
+cogl_set_source_color4ub, function in The Top-Level Context +
+
+
+cogl_set_source_texture, function in The Top-Level Context +
+
+
+cogl_set_viewport, function in The Top-Level Context +
+
+
+CoglSnippet, struct in Shader snippets +
+
+
+CoglSnippetHook, enum in Shader snippets +
+
+
+cogl_snippet_get_declarations, function in Shader snippets +
+
+
+cogl_snippet_get_hook, function in Shader snippets +
+
+
+cogl_snippet_get_post, function in Shader snippets +
+
+
+cogl_snippet_get_pre, function in Shader snippets +
+
+
+cogl_snippet_get_replace, function in Shader snippets +
+
+
+cogl_snippet_new, function in Shader snippets +
+
+
+cogl_snippet_set_declarations, function in Shader snippets +
+
+
+cogl_snippet_set_post, function in Shader snippets +
+
+
+cogl_snippet_set_pre, function in Shader snippets +
+
+
+cogl_snippet_set_replace, function in Shader snippets +
+
+
+CoglSubTexture, struct in Sub Textures +
+
+
+cogl_sub_texture_new, function in Sub Textures +
+
+
+CoglSwapBuffersNotify, user_function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglSwapChain, struct in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_swap_chain_new, function in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_swap_chain_set_has_alpha, function in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_swap_chain_set_length, function in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+

T

+
+CoglTexture, typedef in The Texture Interface +
+
+
+CoglTexture2D, struct in 2D textures +
+
+
+CoglTexture2DSliced, struct in Sliced Textures +
+
+
+CoglTexture3D, struct in 3D textures +
+
+
+CoglTextureComponents, enum in The Texture Interface +
+
+
+CoglTextureError, enum in The Texture Interface +
+
+
+CoglTextureFlags, enum in Common Types +
+
+
+CoglTexturePixmapX11, struct in X11 Texture From Pixmap +
+
+
+CoglTexturePixmapX11ReportLevel, enum in X11 Texture From Pixmap +
+
+
+CoglTextureRectangle, struct in Rectangle textures (non-normalized coordinates) +
+
+
+CoglTextureType, enum in The Texture Interface +
+
+
+cogl_texture_2d_gl_new_from_foreign, function in 2D textures +
+
+
+cogl_texture_2d_new_from_bitmap, function in 2D textures +
+
+
+cogl_texture_2d_new_from_data, function in 2D textures +
+
+
+cogl_texture_2d_new_from_file, function in 2D textures +
+
+
+cogl_texture_2d_new_with_size, function in 2D textures +
+
+
+cogl_texture_2d_sliced_new_from_bitmap, function in Sliced Textures +
+
+
+cogl_texture_2d_sliced_new_from_data, function in Sliced Textures +
+
+
+cogl_texture_2d_sliced_new_from_file, function in Sliced Textures +
+
+
+cogl_texture_2d_sliced_new_with_size, function in Sliced Textures +
+
+
+cogl_texture_3d_new_from_bitmap, function in 3D textures +
+
+
+cogl_texture_3d_new_from_data, function in 3D textures +
+
+
+cogl_texture_3d_new_with_size, function in 3D textures +
+
+
+cogl_texture_allocate, function in The Texture Interface +
+
+
+COGL_TEXTURE_ERROR, macro in The Texture Interface +
+
+
+cogl_texture_get_components, function in The Texture Interface +
+
+
+cogl_texture_get_data, function in The Texture Interface +
+
+
+cogl_texture_get_height, function in The Texture Interface +
+
+
+cogl_texture_get_premultiplied, function in The Texture Interface +
+
+
+cogl_texture_get_width, function in The Texture Interface +
+
+
+cogl_texture_is_sliced, function in The Texture Interface +
+
+
+cogl_texture_new_from_bitmap, function in Bitmap +
+
+
+cogl_texture_pixmap_x11_is_using_tfp_extension, function in X11 Texture From Pixmap +
+
+
+cogl_texture_pixmap_x11_new, function in X11 Texture From Pixmap +
+
+
+cogl_texture_pixmap_x11_set_damage_object, function in X11 Texture From Pixmap +
+
+
+cogl_texture_pixmap_x11_update_area, function in X11 Texture From Pixmap +
+
+
+cogl_texture_rectangle_new_from_bitmap, function in Rectangle textures (non-normalized coordinates) +
+
+
+cogl_texture_rectangle_new_with_size, function in Rectangle textures (non-normalized coordinates) +
+
+
+cogl_texture_set_components, function in The Texture Interface +
+
+
+cogl_texture_set_data, function in The Texture Interface +
+
+
+cogl_texture_set_premultiplied, function in The Texture Interface +
+
+
+cogl_texture_set_region, function in The Texture Interface +
+
+
+cogl_transform, function in The Top-Level Context +
+
+
+cogl_translate, function in The Top-Level Context +
+
+

U

+
+CoglUserDataDestroyCallback, typedef in The Object Interface +
+
+
+CoglUserDataKey, struct in The Object Interface +
+
+

V

+
+cogl_vector3_add, function in 3 Component Vectors +
+
+
+cogl_vector3_copy, function in 3 Component Vectors +
+
+
+cogl_vector3_cross_product, function in 3 Component Vectors +
+
+
+cogl_vector3_distance, function in 3 Component Vectors +
+
+
+cogl_vector3_divide_scalar, function in 3 Component Vectors +
+
+
+cogl_vector3_dot_product, function in 3 Component Vectors +
+
+
+cogl_vector3_equal, function in 3 Component Vectors +
+
+
+cogl_vector3_equal_with_epsilon, function in 3 Component Vectors +
+
+
+cogl_vector3_free, function in 3 Component Vectors +
+
+
+cogl_vector3_init, function in 3 Component Vectors +
+
+
+cogl_vector3_init_zero, function in 3 Component Vectors +
+
+
+cogl_vector3_invert, function in 3 Component Vectors +
+
+
+cogl_vector3_magnitude, function in 3 Component Vectors +
+
+
+cogl_vector3_multiply_scalar, function in 3 Component Vectors +
+
+
+cogl_vector3_normalize, function in 3 Component Vectors +
+
+
+cogl_vector3_subtract, function in 3 Component Vectors +
+
+
+COGL_VERSION, macro in Versioning utility macros +
+
+
+COGL_VERSION_CHECK, macro in Versioning utility macros +
+
+
+COGL_VERSION_ENCODE, macro in Versioning utility macros +
+
+
+COGL_VERSION_GET_MAJOR, macro in Versioning utility macros +
+
+
+COGL_VERSION_GET_MICRO, macro in Versioning utility macros +
+
+
+COGL_VERSION_GET_MINOR, macro in Versioning utility macros +
+
+
+COGL_VERSION_MAJOR, macro in Versioning utility macros +
+
+
+COGL_VERSION_MICRO, macro in Versioning utility macros +
+
+
+COGL_VERSION_MINOR, macro in Versioning utility macros +
+
+
+COGL_VERSION_STRING, macro in Versioning utility macros +
+
+
+CoglVertexP2, struct in Common Types +
+
+
+CoglVertexP2C4, struct in Common Types +
+
+
+CoglVertexP2T2, struct in Common Types +
+
+
+CoglVertexP2T2C4, struct in Common Types +
+
+
+CoglVertexP3, struct in Common Types +
+
+
+CoglVertexP3C4, struct in Common Types +
+
+
+CoglVertexP3T2, struct in Common Types +
+
+
+CoglVertexP3T2C4, struct in Common Types +
+
+
+CoglVerticesMode, enum in Common Types +
+
+

W

+
+cogl_wayland_display_set_compositor_display, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_wayland_renderer_get_display, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_wayland_renderer_set_event_dispatch_enabled, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_wayland_renderer_set_foreign_display, function in CoglRenderer: Connect to a backend renderer +
+
+
+CoglWin32FilterFunc, user_function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_win32_onscreen_get_window, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_win32_onscreen_set_foreign_window, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_win32_renderer_add_filter, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_win32_renderer_handle_event, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_win32_renderer_remove_filter, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_win32_renderer_set_event_retrieval_enabled, function in CoglRenderer: Connect to a backend renderer +
+
+
+CoglWinding, enum in Pipeline +
+
+
+CoglWinsysID, enum in CoglRenderer: Connect to a backend renderer +
+
+

X

+
+cogl_x11_onscreen_get_visual_xid, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_x11_onscreen_get_window_xid, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_x11_onscreen_set_foreign_window_xid, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglXlibFilterFunc, user_function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_add_filter, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_get_foreign_display, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_handle_event, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_remove_filter, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_set_foreign_display, function in CoglRenderer: Connect to a backend renderer +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/ix02.html b/doc/reference/cogl-2.0-experimental/html/ix02.html new file mode 100644 index 0000000..bc6b03c --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix02.html @@ -0,0 +1,193 @@ + + + + +Index of deprecated symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of deprecated symbols

+

C

+
+cogl_clear, function in The Top-Level Context +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+

F

+
+cogl_frustum, function in The Top-Level Context +
+
+

G

+
+cogl_get_modelview_matrix, function in The Top-Level Context +
+
+
+cogl_get_projection_matrix, function in The Top-Level Context +
+
+
+cogl_get_source, function in The Top-Level Context +
+
+
+cogl_get_viewport, function in The Top-Level Context +
+
+
+cogl_gtype_matrix_get_type, function in GType Integration API +
+
+

O

+
+cogl_onscreen_add_swap_buffers_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_remove_swap_buffers_callback, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_ortho, function in The Top-Level Context +
+
+

P

+
+cogl_perspective, function in The Top-Level Context +
+
+
+cogl_pop_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_pop_matrix, function in The Top-Level Context +
+
+
+cogl_pop_source, function in The Top-Level Context +
+
+
+cogl_push_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_push_matrix, function in The Top-Level Context +
+
+
+cogl_push_source, function in The Top-Level Context +
+
+

R

+
+cogl_read_pixels, function in The Top-Level Context +
+
+
+cogl_rotate, function in The Top-Level Context +
+
+

S

+
+cogl_scale, function in The Top-Level Context +
+
+
+cogl_set_framebuffer, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_set_modelview_matrix, function in The Top-Level Context +
+
+
+cogl_set_projection_matrix, function in The Top-Level Context +
+
+
+cogl_set_source, function in The Top-Level Context +
+
+
+cogl_set_source_color, function in The Top-Level Context +
+
+
+cogl_set_source_color4f, function in The Top-Level Context +
+
+
+cogl_set_source_color4ub, function in The Top-Level Context +
+
+
+cogl_set_source_texture, function in The Top-Level Context +
+
+
+cogl_set_viewport, function in The Top-Level Context +
+
+

T

+
+cogl_texture_new_from_bitmap, function in Bitmap +
+
+
+cogl_transform, function in The Top-Level Context +
+
+
+cogl_translate, function in The Top-Level Context +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/ix03.html b/doc/reference/cogl-2.0-experimental/html/ix03.html new file mode 100644 index 0000000..2325e77 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix03.html @@ -0,0 +1,47 @@ + + + + +Index of new symbols in 0.8 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.8

+

B

+
+CoglBufferTarget, enum in Common Types +
+
+

P

+
+CoglPixelFormat, enum in Common Types +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/ix04.html b/doc/reference/cogl-2.0-experimental/html/ix04.html new file mode 100644 index 0000000..577c979 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix04.html @@ -0,0 +1,234 @@ + + + + +Index of new symbols in 1.0 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.0

+

A

+
+CoglAttributeType, enum in Common Types +
+
+

B

+
+cogl_bitmap_get_size_from_file, function in Bitmap +
+
+
+cogl_bitmap_new_from_file, function in Bitmap +
+
+
+CoglBlendStringError, enum in Pipeline +
+
+
+COGL_BLEND_STRING_ERROR, macro in Pipeline +
+
+
+CoglBufferBit, enum in Common Types +
+
+

C

+
+CoglColor, struct in Color Type +
+
+
+cogl_color_copy, function in Color Type +
+
+
+cogl_color_equal, function in Color Type +
+
+
+cogl_color_free, function in Color Type +
+
+
+cogl_color_get_alpha, function in Color Type +
+
+
+cogl_color_get_alpha_byte, function in Color Type +
+
+
+cogl_color_get_alpha_float, function in Color Type +
+
+
+cogl_color_get_blue, function in Color Type +
+
+
+cogl_color_get_blue_byte, function in Color Type +
+
+
+cogl_color_get_blue_float, function in Color Type +
+
+
+cogl_color_get_green, function in Color Type +
+
+
+cogl_color_get_green_byte, function in Color Type +
+
+
+cogl_color_get_green_float, function in Color Type +
+
+
+cogl_color_get_red, function in Color Type +
+
+
+cogl_color_get_red_byte, function in Color Type +
+
+
+cogl_color_get_red_float, function in Color Type +
+
+
+cogl_color_new, function in Color Type +
+
+
+cogl_color_premultiply, function in Color Type +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+

F

+
+cogl_flush, function in The Top-Level Context +
+
+

I

+
+cogl_is_bitmap, function in Bitmap +
+
+

O

+
+cogl_ortho, function in The Top-Level Context +
+
+

P

+
+cogl_polygon, function in Primitives (Deprecated) +
+
+

R

+
+CoglReadPixelsFlags, enum in The Top-Level Context +
+
+
+cogl_rectangles, function in Rectangles +
+
+
+cogl_rectangle_with_multitexture_coords, function in Rectangles +
+
+
+cogl_rectangle_with_texture_coords, function in Rectangles +
+
+

S

+
+cogl_set_source, function in The Top-Level Context +
+
+
+cogl_set_source_color, function in The Top-Level Context +
+
+
+cogl_set_source_color4f, function in The Top-Level Context +
+
+
+cogl_set_source_color4ub, function in The Top-Level Context +
+
+
+cogl_set_source_texture, function in The Top-Level Context +
+
+

T

+
+CoglTextureFlags, enum in Common Types +
+
+
+cogl_texture_new_from_bitmap, function in Bitmap +
+
+

V

+
+CoglVerticesMode, enum in Common Types +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/ix05.html b/doc/reference/cogl-2.0-experimental/html/ix05.html new file mode 100644 index 0000000..fb5033b --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix05.html @@ -0,0 +1,108 @@ + + + + +Index of new symbols in 1.2 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/ix06.html b/doc/reference/cogl-2.0-experimental/html/ix06.html new file mode 100644 index 0000000..91cfab4 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix06.html @@ -0,0 +1,252 @@ + + + + +Index of new symbols in 1.4 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.4

+

A

+
+cogl_attribute_buffer_new, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_attribute_new, function in Vertex Attributes +
+
+

B

+
+CoglBitmapError, enum in Bitmap +
+
+
+COGL_BITMAP_ERROR, macro in Bitmap +
+
+
+CoglBufferMapHint, enum in CoglBuffer: The Buffer Interface +
+
+

C

+
+cogl_color_set_alpha, function in Color Type +
+
+
+cogl_color_set_alpha_byte, function in Color Type +
+
+
+cogl_color_set_alpha_float, function in Color Type +
+
+
+cogl_color_set_blue, function in Color Type +
+
+
+cogl_color_set_blue_byte, function in Color Type +
+
+
+cogl_color_set_blue_float, function in Color Type +
+
+
+cogl_color_set_green, function in Color Type +
+
+
+cogl_color_set_green_byte, function in Color Type +
+
+
+cogl_color_set_green_float, function in Color Type +
+
+
+cogl_color_set_red, function in Color Type +
+
+
+cogl_color_set_red_byte, function in Color Type +
+
+
+cogl_color_set_red_float, function in Color Type +
+
+
+cogl_color_unpremultiply, function in Color Type +
+
+

I

+
+cogl_index_buffer_new, function in CoglIndexBuffer: Buffers of vertex indices +
+
+
+cogl_is_attribute_buffer, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_is_index_buffer, function in CoglIndexBuffer: Buffers of vertex indices +
+
+
+cogl_is_texture_3d, function in 3D textures +
+
+
+cogl_is_texture_pixmap_x11, function in X11 Texture From Pixmap +
+
+

M

+
+cogl_matrix_equal, function in Matrices +
+
+

O

+
+cogl_object_get_user_data, function in The Object Interface +
+
+
+cogl_object_set_user_data, function in The Object Interface +
+
+

T

+
+cogl_texture_pixmap_x11_is_using_tfp_extension, function in X11 Texture From Pixmap +
+
+
+cogl_texture_pixmap_x11_set_damage_object, function in X11 Texture From Pixmap +
+
+
+cogl_texture_pixmap_x11_update_area, function in X11 Texture From Pixmap +
+
+
+cogl_transform, function in The Top-Level Context +
+
+

U

+
+CoglUserDataDestroyCallback, typedef in The Object Interface +
+
+
+CoglUserDataKey, struct in The Object Interface +
+
+

V

+
+cogl_vector3_add, function in 3 Component Vectors +
+
+
+cogl_vector3_copy, function in 3 Component Vectors +
+
+
+cogl_vector3_cross_product, function in 3 Component Vectors +
+
+
+cogl_vector3_distance, function in 3 Component Vectors +
+
+
+cogl_vector3_divide_scalar, function in 3 Component Vectors +
+
+
+cogl_vector3_dot_product, function in 3 Component Vectors +
+
+
+cogl_vector3_equal, function in 3 Component Vectors +
+
+
+cogl_vector3_equal_with_epsilon, function in 3 Component Vectors +
+
+
+cogl_vector3_free, function in 3 Component Vectors +
+
+
+cogl_vector3_init, function in 3 Component Vectors +
+
+
+cogl_vector3_init_zero, function in 3 Component Vectors +
+
+
+cogl_vector3_invert, function in 3 Component Vectors +
+
+
+cogl_vector3_magnitude, function in 3 Component Vectors +
+
+
+cogl_vector3_multiply_scalar, function in 3 Component Vectors +
+
+
+cogl_vector3_normalize, function in 3 Component Vectors +
+
+
+cogl_vector3_subtract, function in 3 Component Vectors +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/left.png b/doc/reference/cogl-2.0-experimental/html/left.png new file mode 100644 index 0000000000000000000000000000000000000000..2d05b3d5b4aeec9384bbfe404bfc4ed0897051c4 GIT binary patch literal 459 zcmV;+0W|)JP)40xL?wO*>WZ(J#ML5j2<9jD6A%Q&kC}jOeEc;X{s;`zcnxLeZR6?6h#^ihmNF6NpGdilO$m<82oD9WQ|6nVv1`? z>KufRi{?QPXg;4;wroQu4?mN1Ydd@|kaQ|ZyWLK!)yi7Wb%=0{}lD)tfliHAUyWRQ+fD_;aV6j->y6!O_8bENg + + + +Appendix A. License + + + + + + + + + + + + + + + +
+

+Appendix A. License

+

+ This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. +

+

+ This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. +

+

+ You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +

+


+        Free Software Foundation, Inc.
+        59 Temple Place - Suite 330
+        Boston, MA 02111-1307
+        USA
+      

+

+

+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/quad-indices-order.png b/doc/reference/cogl-2.0-experimental/html/quad-indices-order.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d95d48777358e396de9c58b4ca990cdb46c12 GIT binary patch literal 2620 zcmeHJc~sJS76%kj1Cz4cN)a`)%ndaPuu@de)Jc1lxlt-eE>I|HEi+|4z8yuaqp`EUN3?>YD0bGLKuxu0{-=X?2YL4F8* zGkp*UgdmfMAsXAMk>7N6G#VdV_DN&3SzhGBx|)}z8_U!9dQ4InOH<$Tmw>&t-%i&A zO;dc1rGzr5DQPFp#DUV%(j4i@39OhC%s5BJ8QSe}yqTu4kxV>rIK52WpK&!Z&XhAX zy!E&})F>?W5L@^Wm4DGz_qg_k8}Xo45Yo`6zQHD*w02q#jL_L=bqf`*tz}>3d-;yT z@l8gBLX@t)?fLV%jwn=I((+Qro~}KZ@-IgQ_>G|z(XL!*B~dgnJ{Js)$`)>&H21AH^dlX44w#C+1g;<;EGvmQ0(n5L=S3lwOpc)Au8xWkvk8u(|;X2`R=g*VUY$U6O!;wVJ?MH! zGw-hxN|%U42T(GETIc-~6hN;iQo|Gb`7K5t8P4~)-@)B5QOx!`wg8*om`xogv*K}* z8Po$}`|0B8UQ!ndT@MzW*na0FAm=wGP%W{z6lz4`2ZPmO)t;fBU0Jrw4BE(u`(V<; zi7{=w56d;lbn=m&YOptKKu0iqVL4UDn3lO>)-fcXZY8MizwdCJ0aJ2_QgFRoT55MJ zE>Auk`gTjvcQstZ&dD-5_sxN^8EHQMtTsgQT561$X`NCL+f{Ie$|K%OA;v6_)|-dx z;JZu(Jxn&0OSRhU+!!~L2r6>ZFB3bS|L9PEJMZ%6F6O%nTM@haBkl7#~p~2V1!6=KhsWT z*jwPTdO$gf6n_)8feg#_c4qbgMA~;@U28U=2Y`XoZVW{WTnhd>EcqIbP?d3NK4MvG z?^;mo3;A>{6z4EkE?r3-?j3~Wqlaz-1@S?hNd_w@v_PDxu*qSW)v1jGFxh!voGXGLqY^9rQ|S*JPP9ZKXU#DQ9>33kodHLelNpoNSla)QX6ed{WmA zwCDP=e$(T=UBG8IyCId!dl-q0-@R!5u}E`eWqfc#&E@m3H&qvM z>dk11E+CAb@%5KE-vL8&5B&|u^)>0eMN%SRPtmrb6>xY3tAtcvk(=GR@lA}+vOBXf>ma)RGOeoVo z(>Az~yf2~0cXpRjNbWCm6HkEbf_)E$B0KTGe8qbwHho`M-TTAMzE>_kAcayxRxKX< z+r3jaz%<7x&y7ERe^GLE+lQ2kB{4rrO+)H|4Sm(( zb>LYNf6o?+`fS8*dgR$jTQ)#2*EHH^eZU9jwZR+@~o;h>wt!zy4$5$ z(1ypD=b7`o6!*#R>V4!-K=9(`bzQlN5*+6H%lMu+hf*0 z?Q@|gZ9+~|?b+ipa%3?6M)!WA6zZs>6Fq|mMI@0z3eYD#CbKCM?0C)HQyq8PJcJ=# z@>PL~`P5tu$I6@umUo>r%197p?J^otK-vI8itU+D*$%%a6xD_7kcFa1$ygEhI;znH^OvBu7- iLUDTR^7K~=tFVxb$A9t|_ej$G^gv{vAfm{Na{f;SUWiKo literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/html/quad-indices-triangles.png b/doc/reference/cogl-2.0-experimental/html/quad-indices-triangles.png new file mode 100644 index 0000000000000000000000000000000000000000..18c42c845ed165d3b15dbd431f905be823416276 GIT binary patch literal 8018 zcmXw82|UyP|KH4zGs%5tqH?y8ifK8roRyL!d@;#LlKa|xBloO>k)s;A97W`wq){81 zkX&MLlAl^duTjZ!{x+Wic{QJ+JFrVw+ zJ7={!h9hySv+Lpc#$7{8c>|jxL&Kq+jQdL_dy_i#DxowRGI}bwq|nU+*Ggc1U4y&XC{Iy|CXvDHU+pFj>u z8_CNIwMC{uLrBYZS8e&z2o$E^hOFtMa~udqqXMO;*Z&7nQAX`z9Tq0~wlWNPEMfl6 zJy|p%+8}Kg4PQH~3_F*#tX~V$tDJ*Lvo6WF!OQ58687INxkt05kn)bJqX^9uKVRL{ zt582^<;e@8%^OBLw;Z6)q4)0%dF-@N$5k8Ykynm{%2$x6ZR(|aeM8)x*o`)BN=C8o z7sz^*W2P<=N&~jb&!JB=rsB988H36Qz6}%c?Y38RRo{ zu7(ysQ>-KQ-R)AzzQCBd;!dBTpCFuFGSIFW#nB$m&~@V;kpH+od7Sw1lFSL1saDf1 zsyt!tdyc3<<>CL9{CL%a90S(xU$`k=ys=r%j8Wj-cwC+aZ>jnRhh&RM9Z+z5rpIGd zC&}?!nKjW>ox z;FwL$-g(hK6<=*P2tiK9d4rdDH+K0-x)(oRIE;<`@y#Nj-JdQ^t#u}>Bx-kAN7UwS z(#NtsL4iWy|88ZT$@QTp5@LdC<3w1fWqL?iK`7_wM8kV>+ zZshf)lu!M(Zu;$rFq@d>@=qVFcT(M9>{Wv=CwTa+B5GLO@2a9P=nifo!aKHpnob9o zr@tLVU&cwzP@|D->4D7?g>^zqz}>Im71g4shOp+6w? z6RkZ>H2dX9sF*j>PbPcE-P}x*=tX0dnoVCtVg9cqF;aF}BAr1Rj4AJFBo;z5gMA)M zA4JMShjd;X6mq^TuKMN2Ka7vR2^ioae}ZquJ~vWgJ?jO?!xuJC?gWH;K{ zpQ~S^=tlacz6A;BR8m4Z1swgef@wa+a;2%&7QY&tGD1!GnM9Rt#BdME@9!VaHjGCPp(8Lo1Vn;0>bij~1cHk^y5yYfY4a#5{ixjNr|{i(;>azSv5x z8oe5WW#vZu>j@NR4igHz2SZ^d`_f0>``hDTvmFM)U43cO$z!!Yrw*g^opU0;&Rylm z$-BO=4p^^7>r3+f@~{brd`)5YPUpu_m|{^H{iqk()?-iJ{$f~4>w7s{ei^AP{!!9- zwL9)&=HQVyBL~U z(0aZ%?(Ay8%ij7J>-DOZB=Wo6t3o;HKiW@Q#f2028Ti@_QC#)Dku%RzZ#G!6gr>Fl zT0W^xU*BNWz4?X4bI zLk+tcX_luH*7{C!Wgj_>A8OQqz&6>|L6l;?Sss$QZh zG!->oDX34Q+DifMtRbtg>)%7}3rCsL0|n!v)m#urA@w4kU*#qm zV!HLb!YfVRO5gl(MQhH5mZ6?@KM3#P+h;NV%cXyI5`Kv%{mydzr3g_u65gUiap7}u z+rsT}Yg#4kE_rr({PXaXOujttlb!R{*gVk#s7mMg+MdxjiKWqs&HH2cUMp@z#eN#g zzA!z8tLCZLhn~H5gnfA90aFuO@NLCqr%bmiE1Qz8dUtvxPm{s-p=iQPYVqIm_%=`)xEdOM9wSC>l2xGDViCq*M|;!*6co#cP`EQB)Cl#-v{&Az;tX>m$L$(-hWl71#LU?Tl`Hv8uN5S@n?lq(NY)bT@SLG_%=l(mT zFv^=eU6){5Q9H=^_M|nE*Ea6{8N!WenVbB2Vu2YHMM=Lre&#Wg?-WTL{?8YAEbomQA*EiV&TWfAG~k$c^b){SDwRuOHwiuA`iP=l;)T|l^*{h zlbvnSzJr)REn8Knl->OSCbpY8rC+5&Zo0FKj5?0FX1ffZC#Ar8jtUWHpRB`Vv0E)A z%K5+*&oP$r!aN!D`_908itANe+wXOZ!~W=nDmkp1)sbEH3*j{?P7%WV%WaYTX-U*9 zg29xLPU)L!8ZXjiZ|O6Ysr%@C>5_;vzH_t*&XO=sXNHoQpXxLc%Rh#^^2doJ4SVMe zmBKh2iN2r!MQlo(&r2uNNmj#^(turN(UDStjZzhnchb(ypBQ{j%CfxEQ%mClD${4M z>tlX*qRx|~`IYo5UC)H=kb_~ncn-j_`bnX5Q;C$l29mso$-C)-SUYvF&3R1(&BV*gQ}t{w9&?>wwu$^6vD=~&6$myH$w|3 zk2%ylZ&H~`Kb`Ce$7VsEji(&`N|Am2kV$ zI~_t+YE4|N%k1GGZEK#Ny|;t(zw<* zUBSiuVPS2ntfNBjkF$)T&M|+&JLb<<)idz3Phs(eb|~{}&sC=J?0U{Ww&6Jb0A%HD z=JN-}{LzWj(D{8Obca0gTB%IV?qyXGr^^VFe-oWj_gN*xVrLIl)|E+$qja3dd%6g} z=5KypVx(xGH&MF^h!H)3ZQ?2}s2DRg?^EQSem@7{7eJA;-Bplt-)egQB^8u zcNLVSye%m_gtEBy?>^bgM3@U?PIB@=ScXUQ;qqJ zeICtYCM1Md%QQI7ki}>sk2pK|3h3gSkad;Z(JzTxlPiFi9xt zsS|u}&icg}nrW7%T15#KClza@>#3^+xw&hw9}ydP^+p&We_^pj`|j>`$}IhDiTl&b zU&ha4SO#IdUwYuamh6+rdZP&8QnP!UD)|ZxZW)Nhx&R0HZ_I+rpQz5kjlFO}CEG}} zUI_o)we2dxyjc_2pvhGd6}t1jm`h4?`gjVswG=s@raUt2$aPg{y=Kd;{GJUDW(wR_ zAh42>=Z)j`_0rFzyT!eYZwJ@+*(m+;O278piTHPkMcc*r$VpC=5M-&a zop2%kz_+Nj3-FyWrssZuy-94?iT)W_u-r*}Nm|}jAs6T&5`NVEI7kDZwkrVonhE;y z#tS0KWZn;1|Am1&3CJT}OD!nY_)l47YP&1w<D8>B z>?wk9y&0>Tzt0K@b;=zOK<1(wD+`5R0&j%Iq}29%s>z-jRuQ|Jsdd!}4Z43Sa1W}= zhzB!+cg!oYZxS6lZW(JF+_NrrN}>K37{EgyE02z-1<8zfel`Z@Xdz6}O&jWK6E-~e zsJ$HB+4h3pN{*llT|14*fxm8JblysB@58Xx$<^;B=72@PuC^D6RylF2QYZRJu|#{5 zjSGJv$6sJIe+Bc@%RFBp$)0JwF;>ijog1(8Nv8sDH`v#ZE{AGg6rvC&srD9tvt?GsXGt#PKTXui4|PDAGR@Y?W5;qMMPtokGYcl&(wB06Q2f3dP&@k z?Q710g=LK86F>3Yzr{b@nK^XcK@jj9mbMn0FCK30Wo`%}jU-SHE$Fs(IMQ89Ge)!B z47Obl#}}ZKwX9$SH^?Ip%Hdn%pRHdiwO-?R_a24+{z2Qsg&T37p2}PH6EI=J< zL+)_`kk8)#(5P<*Hk56WkSN3ora9w6Dk&n^?cy&?3%Coh8;QodIhB;3Ss)-!U@VR; zXPX`EELFXlBqrykQ~IpX1~Gin(4$aAghvPD^c^T{UgmNw)hy0GPE2s|4XqVd?ey2X zM!xvrhY1aeN|#>-gXD&qUz<@w4F7A7jC`oVgj~eqoN@+Ixls8lrVF8MsqO0XRt@d9 z@G1|DR#eIP^pe}I7tBUvw~lLN_MLUuOST+OvbUF{0t-E0p$}R*pBCWgW3H3tcG@4@ z*+Gt+|4wMK*I?3Q!9|x#Tf39SvjwnDkOQzSO)EEOnL(ux1MdJXC~LK5#prKqZNAsqea3^qr&Ljck+ornZf!^#wYaEf&>C@Q}PsLGr#U^)93mQ zp+RXr@NkQ$xcTD0kk{WB8`d_MG>dzITlodxtC_B@I?ZF;@%<|ibpYKqgF?!a{>Sb2 zXdaFl=xF|e!hJ=J)fNHEpETRh z$g;U7UMm~8d)^y!Nn%d_dER#5N^k6QJOxk72Wsi<1&xxgnJ#kdo_M%ih3NbROuoFB zjmh5eG9Y|cq4GQ$T+J1YVWpR+6Vpyj^r92b= z4KUY1z{6rCA(oRw4uYs$6xwGBEZJ6T(iMDxmqfz-+=&$J+`p(8i+`sfMV%%HG4Wnr z<|`m{TW;uj725O7#0E_z$BGl%kc<#72njnS5*`WKrr-P;eh*?eZdK;b1ri^uS-0#2y+M%98V2k$ZHXsm}4GA}ia-If5rGSO&D3Cwb!G zMHE*B*~~NcyXkw)!CY4ltB2hdTs+8$ZujSgyeCUM+*Tx9m;Ipq*8L;kEPb*LIIBS0 z3OwOCRJo+4_VNaZHI!!sj@EAfFd>`iQXJZMAKWhpu_=;qr2aud6l6Y*qD|V4R_Bd! zU&DD)0_0HcfHP1N6R?g!$$vC_UDzsM6mojQFL3q#wiNFj7n`%}C5gdjGg8~jK=v|7 z!D#f}MK`#wp?ei2Pfj+oG@iPO@P{gJCFd!}@e@!~KT*(HNJJWaPIvemNjSrz9;^n~ z04+@stk3uvF+XqfkpP^ArKOj_f-*}ibJ@*Zf_)h{P6RW_Sdu?neb00k2fH*2s7--? zNLDse5qP%m0HO--gJ05ZUt*iIKiV_?)|5&Z5 z0k&!atk#LF{K1@gwynls_T$6vXmBGP0FWpSJ%>J};Ib2|3l51rYc?WPklSdptr~T3 zQ(yEsQZc_}_J9G-@JxiySMjzN7MaTwDvY4a?KPSF*-97g1t$;g(JfP*ivz54x9@B? zDDpMLrf5O#W(^S~^P0iXN!u1G4e|;!q!>hoHC78MS?**>wCNvXRfg4deKnXICY)g4 zKT?Z{r!#{M(7IdGM3h9}U5cw0uBRmQUb<#F6ik7OiL`vcZ81X4Vzst^(Jv_WQPJ6K zMBXjm6KE?-96W)EqgoT@AYiE5UN44j)n8Er*-|8IKF$+A{E<;@HTQfjX~_i!GeGfl;d;`!yx7YH_`Bu~Jl3+8lGn1}UFC;yenDe4IoTL-@lsWH=2f<;1S1 z1A5!?ya`vHz3wOSThIMDg_+fNmTNk-3){@w$9rj?RV6GIRe1(<k9pa>q4SEj#${{_$g^#c!m$8MaXoP^One`A90Q=upqFcn=(I15rG#%H8Y@RY zB-wirjeO5VHi%%NwVhwMdSLG%sXGbOqYJmcwZeT>0uw01EF0O(Qws6Edq3RT*jI6Q zJ^-VXOn2o9EfB3sK%l#xs9qHXn_NQC4FiAkYr+v})Q=oa%?|G7OQ5*=;oP`F4Z{{# zAKCpm2ROPJm&m|_8Lt>r9ODY+Jaqi{8@a_0un=4Y%jcbBYVHE%T!u6tMz`F7-n9GT zvYB0qb&=Z-M*&9}fPl~#7BWnUeU~e_ub5DysC-4)tjj#O=aCU# zbOJR){b#bzR`h97R%^kbKy7;0MpKUvcVqagw}7O? z)cwU~#G=lT62X4QLUIqpl9rABOfG(tTT~4j>h1sQ_$EgnF-wr8g*wKKLq(Q6l2v68 zs0sFk(U$LH0bKEwBJX84wtY01Y@L6SSmXs5LYS;Jtq>*E_6(>j+Yov5#lS=vF<))k zHEM;C33{k3p#ary{qq1i4ztfHLZ%=w(g$+|mJWNDJ#g{=l`_4nKekk*YsZiWj$UHy z3l0VA!C)Bq!vc4Bi(i#FXTMFMVr(_pS#2wS+K#YH8#1>dns>Ek|3iSswoKxN0oWLh zZqKuz3xCC(d2APTA;WwdI0?sC!yNCGcrKjkC}~%UUq34h_0nK^E*wY+6ZF1rp z(Q2S+^tglHwsPF^Q@=dDRd`T8qPvHxx?a_b5 z`2a^S`+ISe+wJ76|_i z41-B~^*9gXrpJ*x@3c&i@97SjJLuq6qS@itjNbKECBCO? zsNy(7S&m2ECNIXmwrbs#_$QqzzxLm&k|*C~cro3hNe_%MJ9!O2>+)hgc;I>{&RO== zk-^UXxF75e88PgdQ{Dy~GpvVfExD_mT%NUwnok~YItB51P#ZahER}*wLHO91di${+ z@vhq_bxOnF_+{JysMtg!<7egFuf#&t_CEQ;BAX?1BuJY_(KX7rFQgVGrUpY#;8&PmwrpS|;HQ{XWpU&hAf;$`)|_x=UL z&K}^Y5a0ZVi#>v8k{?k@2|mTH&?t33r9{(?9Yo82!UEPWVhcj5Jy(_&US8~}XgVl~ zQW$0Wn|_JkRPOQ@`!IUFLDEfEY9pU1OZ&))rWZv_=n4F1QB7mX)fP90R$onzovdzl zb~}MlBS+h<@P1?dv7Ku1_$^a~eWlcH^Y&5UY{v+-1|44*V3l)!SUHD(tK0Nre5+Ku ze=|$t9WmiJ%gdeNs8k&k5E<2Eln(36TBctD4;|5n`qY@i>-`dao&Fi+&5sHPI_zFY ze#`li@`yTDRI{5mI)x$vt7aN()@tcu%&znO?7A?*UzS$ei)mJue~%=t2ot_9@J_2_ z6Df)!GxzDy^-ySby?ei`|)BVLMU#2a1-h+*2+tVac8QfQ7r4M%VSY z_#oygB=fJtZBXP&6$;oh7#r10kF`(Do+;J(;8mN$u?QKFl z!qp-FSz%_oU4G5@0qJu_@*HgGP#56c9#7n}apkpv%Hj-yBBG5|3f1#2{V_gwHS&Rc7pjQS-p1@OUoBo`n=Zj$-ScJevTRw@sn=i*BT^ zbSQ{BlPxDc$BDiN2a-st?-XnH!EGENM}Is!ZBZ&^hRD1Nl(jR45;w@EGIyZr2CTJdV#geOD(hB$t*(P^~TSfg5Hg zPXIZwrAKfgS|z_s#r$e9evy8|ufpc4n+muj-kcoTEl~!UooQQGi#@-BjZkS({0%<; OhF~r1%*&3u6aNpuN&@u& literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/html/right.png b/doc/reference/cogl-2.0-experimental/html/right.png new file mode 100644 index 0000000000000000000000000000000000000000..92832e3a4566e59d6e4092010e08d28f3be3a68d GIT binary patch literal 472 zcmV;}0Vn>6P)Cd4HCN^TYHBC0dz3r5|}*T3c5!K}0^NPTey!^rYo;W&eW{b1SE%dR-1ljcju- zJITo5P_e{cPDWDszO|97o#m$fni3V4d%~7^?0HU4-k!+X`e~w55Q}HA=c?CM9`EK` z^o5GF_RsnG`ey+9wOf8O4bzg>7W*;jU~M?g`OZAA$mNp|Lz<$s+~N9!2`ir8RcClo$(Q~19INM~9}j;&*|enC yGd}kJak0wj?aUKd8;%}`i}SSew>!A-2iw}^5}Rh(M>+vRkipZ{&t;ucLK6U4uc96R literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/quad-indices-order.png b/doc/reference/cogl-2.0-experimental/quad-indices-order.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d95d48777358e396de9c58b4ca990cdb46c12 GIT binary patch literal 2620 zcmeHJc~sJS76%kj1Cz4cN)a`)%ndaPuu@de)Jc1lxlt-eE>I|HEi+|4z8yuaqp`EUN3?>YD0bGLKuxu0{-=X?2YL4F8* zGkp*UgdmfMAsXAMk>7N6G#VdV_DN&3SzhGBx|)}z8_U!9dQ4InOH<$Tmw>&t-%i&A zO;dc1rGzr5DQPFp#DUV%(j4i@39OhC%s5BJ8QSe}yqTu4kxV>rIK52WpK&!Z&XhAX zy!E&})F>?W5L@^Wm4DGz_qg_k8}Xo45Yo`6zQHD*w02q#jL_L=bqf`*tz}>3d-;yT z@l8gBLX@t)?fLV%jwn=I((+Qro~}KZ@-IgQ_>G|z(XL!*B~dgnJ{Js)$`)>&H21AH^dlX44w#C+1g;<;EGvmQ0(n5L=S3lwOpc)Au8xWkvk8u(|;X2`R=g*VUY$U6O!;wVJ?MH! zGw-hxN|%U42T(GETIc-~6hN;iQo|Gb`7K5t8P4~)-@)B5QOx!`wg8*om`xogv*K}* z8Po$}`|0B8UQ!ndT@MzW*na0FAm=wGP%W{z6lz4`2ZPmO)t;fBU0Jrw4BE(u`(V<; zi7{=w56d;lbn=m&YOptKKu0iqVL4UDn3lO>)-fcXZY8MizwdCJ0aJ2_QgFRoT55MJ zE>Auk`gTjvcQstZ&dD-5_sxN^8EHQMtTsgQT561$X`NCL+f{Ie$|K%OA;v6_)|-dx z;JZu(Jxn&0OSRhU+!!~L2r6>ZFB3bS|L9PEJMZ%6F6O%nTM@haBkl7#~p~2V1!6=KhsWT z*jwPTdO$gf6n_)8feg#_c4qbgMA~;@U28U=2Y`XoZVW{WTnhd>EcqIbP?d3NK4MvG z?^;mo3;A>{6z4EkE?r3-?j3~Wqlaz-1@S?hNd_w@v_PDxu*qSW)v1jGFxh!voGXGLqY^9rQ|S*JPP9ZKXU#DQ9>33kodHLelNpoNSla)QX6ed{WmA zwCDP=e$(T=UBG8IyCId!dl-q0-@R!5u}E`eWqfc#&E@m3H&qvM z>dk11E+CAb@%5KE-vL8&5B&|u^)>0eMN%SRPtmrb6>xY3tAtcvk(=GR@lA}+vOBXf>ma)RGOeoVo z(>Az~yf2~0cXpRjNbWCm6HkEbf_)E$B0KTGe8qbwHho`M-TTAMzE>_kAcayxRxKX< z+r3jaz%<7x&y7ERe^GLE+lQ2kB{4rrO+)H|4Sm(( zb>LYNf6o?+`fS8*dgR$jTQ)#2*EHH^eZU9jwZR+@~o;h>wt!zy4$5$ z(1ypD=b7`o6!*#R>V4!-K=9(`bzQlN5*+6H%lMu+hf*0 z?Q@|gZ9+~|?b+ipa%3?6M)!WA6zZs>6Fq|mMI@0z3eYD#CbKCM?0C)HQyq8PJcJ=# z@>PL~`P5tu$I6@umUo>r%197p?J^otK-vI8itU+D*$%%a6xD_7kcFa1$ygEhI;znH^OvBu7- iLUDTR^7K~=tFVxb$A9t|_ej$G^gv{vAfm{Na{f;SUWiKo literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-2.0-experimental/quad-indices-triangles.png b/doc/reference/cogl-2.0-experimental/quad-indices-triangles.png new file mode 100644 index 0000000000000000000000000000000000000000..18c42c845ed165d3b15dbd431f905be823416276 GIT binary patch literal 8018 zcmXw82|UyP|KH4zGs%5tqH?y8ifK8roRyL!d@;#LlKa|xBloO>k)s;A97W`wq){81 zkX&MLlAl^duTjZ!{x+Wic{QJ+JFrVw+ zJ7={!h9hySv+Lpc#$7{8c>|jxL&Kq+jQdL_dy_i#DxowRGI}bwq|nU+*Ggc1U4y&XC{Iy|CXvDHU+pFj>u z8_CNIwMC{uLrBYZS8e&z2o$E^hOFtMa~udqqXMO;*Z&7nQAX`z9Tq0~wlWNPEMfl6 zJy|p%+8}Kg4PQH~3_F*#tX~V$tDJ*Lvo6WF!OQ58687INxkt05kn)bJqX^9uKVRL{ zt582^<;e@8%^OBLw;Z6)q4)0%dF-@N$5k8Ykynm{%2$x6ZR(|aeM8)x*o`)BN=C8o z7sz^*W2P<=N&~jb&!JB=rsB988H36Qz6}%c?Y38RRo{ zu7(ysQ>-KQ-R)AzzQCBd;!dBTpCFuFGSIFW#nB$m&~@V;kpH+od7Sw1lFSL1saDf1 zsyt!tdyc3<<>CL9{CL%a90S(xU$`k=ys=r%j8Wj-cwC+aZ>jnRhh&RM9Z+z5rpIGd zC&}?!nKjW>ox z;FwL$-g(hK6<=*P2tiK9d4rdDH+K0-x)(oRIE;<`@y#Nj-JdQ^t#u}>Bx-kAN7UwS z(#NtsL4iWy|88ZT$@QTp5@LdC<3w1fWqL?iK`7_wM8kV>+ zZshf)lu!M(Zu;$rFq@d>@=qVFcT(M9>{Wv=CwTa+B5GLO@2a9P=nifo!aKHpnob9o zr@tLVU&cwzP@|D->4D7?g>^zqz}>Im71g4shOp+6w? z6RkZ>H2dX9sF*j>PbPcE-P}x*=tX0dnoVCtVg9cqF;aF}BAr1Rj4AJFBo;z5gMA)M zA4JMShjd;X6mq^TuKMN2Ka7vR2^ioae}ZquJ~vWgJ?jO?!xuJC?gWH;K{ zpQ~S^=tlacz6A;BR8m4Z1swgef@wa+a;2%&7QY&tGD1!GnM9Rt#BdME@9!VaHjGCPp(8Lo1Vn;0>bij~1cHk^y5yYfY4a#5{ixjNr|{i(;>azSv5x z8oe5WW#vZu>j@NR4igHz2SZ^d`_f0>``hDTvmFM)U43cO$z!!Yrw*g^opU0;&Rylm z$-BO=4p^^7>r3+f@~{brd`)5YPUpu_m|{^H{iqk()?-iJ{$f~4>w7s{ei^AP{!!9- zwL9)&=HQVyBL~U z(0aZ%?(Ay8%ij7J>-DOZB=Wo6t3o;HKiW@Q#f2028Ti@_QC#)Dku%RzZ#G!6gr>Fl zT0W^xU*BNWz4?X4bI zLk+tcX_luH*7{C!Wgj_>A8OQqz&6>|L6l;?Sss$QZh zG!->oDX34Q+DifMtRbtg>)%7}3rCsL0|n!v)m#urA@w4kU*#qm zV!HLb!YfVRO5gl(MQhH5mZ6?@KM3#P+h;NV%cXyI5`Kv%{mydzr3g_u65gUiap7}u z+rsT}Yg#4kE_rr({PXaXOujttlb!R{*gVk#s7mMg+MdxjiKWqs&HH2cUMp@z#eN#g zzA!z8tLCZLhn~H5gnfA90aFuO@NLCqr%bmiE1Qz8dUtvxPm{s-p=iQPYVqIm_%=`)xEdOM9wSC>l2xGDViCq*M|;!*6co#cP`EQB)Cl#-v{&Az;tX>m$L$(-hWl71#LU?Tl`Hv8uN5S@n?lq(NY)bT@SLG_%=l(mT zFv^=eU6){5Q9H=^_M|nE*Ea6{8N!WenVbB2Vu2YHMM=Lre&#Wg?-WTL{?8YAEbomQA*EiV&TWfAG~k$c^b){SDwRuOHwiuA`iP=l;)T|l^*{h zlbvnSzJr)REn8Knl->OSCbpY8rC+5&Zo0FKj5?0FX1ffZC#Ar8jtUWHpRB`Vv0E)A z%K5+*&oP$r!aN!D`_908itANe+wXOZ!~W=nDmkp1)sbEH3*j{?P7%WV%WaYTX-U*9 zg29xLPU)L!8ZXjiZ|O6Ysr%@C>5_;vzH_t*&XO=sXNHoQpXxLc%Rh#^^2doJ4SVMe zmBKh2iN2r!MQlo(&r2uNNmj#^(turN(UDStjZzhnchb(ypBQ{j%CfxEQ%mClD${4M z>tlX*qRx|~`IYo5UC)H=kb_~ncn-j_`bnX5Q;C$l29mso$-C)-SUYvF&3R1(&BV*gQ}t{w9&?>wwu$^6vD=~&6$myH$w|3 zk2%ylZ&H~`Kb`Ce$7VsEji(&`N|Am2kV$ zI~_t+YE4|N%k1GGZEK#Ny|;t(zw<* zUBSiuVPS2ntfNBjkF$)T&M|+&JLb<<)idz3Phs(eb|~{}&sC=J?0U{Ww&6Jb0A%HD z=JN-}{LzWj(D{8Obca0gTB%IV?qyXGr^^VFe-oWj_gN*xVrLIl)|E+$qja3dd%6g} z=5KypVx(xGH&MF^h!H)3ZQ?2}s2DRg?^EQSem@7{7eJA;-Bplt-)egQB^8u zcNLVSye%m_gtEBy?>^bgM3@U?PIB@=ScXUQ;qqJ zeICtYCM1Md%QQI7ki}>sk2pK|3h3gSkad;Z(JzTxlPiFi9xt zsS|u}&icg}nrW7%T15#KClza@>#3^+xw&hw9}ydP^+p&We_^pj`|j>`$}IhDiTl&b zU&ha4SO#IdUwYuamh6+rdZP&8QnP!UD)|ZxZW)Nhx&R0HZ_I+rpQz5kjlFO}CEG}} zUI_o)we2dxyjc_2pvhGd6}t1jm`h4?`gjVswG=s@raUt2$aPg{y=Kd;{GJUDW(wR_ zAh42>=Z)j`_0rFzyT!eYZwJ@+*(m+;O278piTHPkMcc*r$VpC=5M-&a zop2%kz_+Nj3-FyWrssZuy-94?iT)W_u-r*}Nm|}jAs6T&5`NVEI7kDZwkrVonhE;y z#tS0KWZn;1|Am1&3CJT}OD!nY_)l47YP&1w<D8>B z>?wk9y&0>Tzt0K@b;=zOK<1(wD+`5R0&j%Iq}29%s>z-jRuQ|Jsdd!}4Z43Sa1W}= zhzB!+cg!oYZxS6lZW(JF+_NrrN}>K37{EgyE02z-1<8zfel`Z@Xdz6}O&jWK6E-~e zsJ$HB+4h3pN{*llT|14*fxm8JblysB@58Xx$<^;B=72@PuC^D6RylF2QYZRJu|#{5 zjSGJv$6sJIe+Bc@%RFBp$)0JwF;>ijog1(8Nv8sDH`v#ZE{AGg6rvC&srD9tvt?GsXGt#PKTXui4|PDAGR@Y?W5;qMMPtokGYcl&(wB06Q2f3dP&@k z?Q710g=LK86F>3Yzr{b@nK^XcK@jj9mbMn0FCK30Wo`%}jU-SHE$Fs(IMQ89Ge)!B z47Obl#}}ZKwX9$SH^?Ip%Hdn%pRHdiwO-?R_a24+{z2Qsg&T37p2}PH6EI=J< zL+)_`kk8)#(5P<*Hk56WkSN3ora9w6Dk&n^?cy&?3%Coh8;QodIhB;3Ss)-!U@VR; zXPX`EELFXlBqrykQ~IpX1~Gin(4$aAghvPD^c^T{UgmNw)hy0GPE2s|4XqVd?ey2X zM!xvrhY1aeN|#>-gXD&qUz<@w4F7A7jC`oVgj~eqoN@+Ixls8lrVF8MsqO0XRt@d9 z@G1|DR#eIP^pe}I7tBUvw~lLN_MLUuOST+OvbUF{0t-E0p$}R*pBCWgW3H3tcG@4@ z*+Gt+|4wMK*I?3Q!9|x#Tf39SvjwnDkOQzSO)EEOnL(ux1MdJXC~LK5#prKqZNAsqea3^qr&Ljck+ornZf!^#wYaEf&>C@Q}PsLGr#U^)93mQ zp+RXr@NkQ$xcTD0kk{WB8`d_MG>dzITlodxtC_B@I?ZF;@%<|ibpYKqgF?!a{>Sb2 zXdaFl=xF|e!hJ=J)fNHEpETRh z$g;U7UMm~8d)^y!Nn%d_dER#5N^k6QJOxk72Wsi<1&xxgnJ#kdo_M%ih3NbROuoFB zjmh5eG9Y|cq4GQ$T+J1YVWpR+6Vpyj^r92b= z4KUY1z{6rCA(oRw4uYs$6xwGBEZJ6T(iMDxmqfz-+=&$J+`p(8i+`sfMV%%HG4Wnr z<|`m{TW;uj725O7#0E_z$BGl%kc<#72njnS5*`WKrr-P;eh*?eZdK;b1ri^uS-0#2y+M%98V2k$ZHXsm}4GA}ia-If5rGSO&D3Cwb!G zMHE*B*~~NcyXkw)!CY4ltB2hdTs+8$ZujSgyeCUM+*Tx9m;Ipq*8L;kEPb*LIIBS0 z3OwOCRJo+4_VNaZHI!!sj@EAfFd>`iQXJZMAKWhpu_=;qr2aud6l6Y*qD|V4R_Bd! zU&DD)0_0HcfHP1N6R?g!$$vC_UDzsM6mojQFL3q#wiNFj7n`%}C5gdjGg8~jK=v|7 z!D#f}MK`#wp?ei2Pfj+oG@iPO@P{gJCFd!}@e@!~KT*(HNJJWaPIvemNjSrz9;^n~ z04+@stk3uvF+XqfkpP^ArKOj_f-*}ibJ@*Zf_)h{P6RW_Sdu?neb00k2fH*2s7--? zNLDse5qP%m0HO--gJ05ZUt*iIKiV_?)|5&Z5 z0k&!atk#LF{K1@gwynls_T$6vXmBGP0FWpSJ%>J};Ib2|3l51rYc?WPklSdptr~T3 zQ(yEsQZc_}_J9G-@JxiySMjzN7MaTwDvY4a?KPSF*-97g1t$;g(JfP*ivz54x9@B? zDDpMLrf5O#W(^S~^P0iXN!u1G4e|;!q!>hoHC78MS?**>wCNvXRfg4deKnXICY)g4 zKT?Z{r!#{M(7IdGM3h9}U5cw0uBRmQUb<#F6ik7OiL`vcZ81X4Vzst^(Jv_WQPJ6K zMBXjm6KE?-96W)EqgoT@AYiE5UN44j)n8Er*-|8IKF$+A{E<;@HTQfjX~_i!GeGfl;d;`!yx7YH_`Bu~Jl3+8lGn1}UFC;yenDe4IoTL-@lsWH=2f<;1S1 z1A5!?ya`vHz3wOSThIMDg_+fNmTNk-3){@w$9rj?RV6GIRe1(<k9pa>q4SEj#${{_$g^#c!m$8MaXoP^One`A90Q=upqFcn=(I15rG#%H8Y@RY zB-wirjeO5VHi%%NwVhwMdSLG%sXGbOqYJmcwZeT>0uw01EF0O(Qws6Edq3RT*jI6Q zJ^-VXOn2o9EfB3sK%l#xs9qHXn_NQC4FiAkYr+v})Q=oa%?|G7OQ5*=;oP`F4Z{{# zAKCpm2ROPJm&m|_8Lt>r9ODY+Jaqi{8@a_0un=4Y%jcbBYVHE%T!u6tMz`F7-n9GT zvYB0qb&=Z-M*&9}fPl~#7BWnUeU~e_ub5DysC-4)tjj#O=aCU# zbOJR){b#bzR`h97R%^kbKy7;0MpKUvcVqagw}7O? z)cwU~#G=lT62X4QLUIqpl9rABOfG(tTT~4j>h1sQ_$EgnF-wr8g*wKKLq(Q6l2v68 zs0sFk(U$LH0bKEwBJX84wtY01Y@L6SSmXs5LYS;Jtq>*E_6(>j+Yov5#lS=vF<))k zHEM;C33{k3p#ary{qq1i4ztfHLZ%=w(g$+|mJWNDJ#g{=l`_4nKekk*YsZiWj$UHy z3l0VA!C)Bq!vc4Bi(i#FXTMFMVr(_pS#2wS+K#YH8#1>dns>Ek|3iSswoKxN0oWLh zZqKuz3xCC(d2APTA;WwdI0?sC!yNCGcrKjkC}~%UUq34h_0nK^E*wY+6ZF1rp z(Q2S+^tglHwsPF^Q@=dDRd`T8qPvHxx?a_b5 z`2a^S`+ISe+wJ76|_i z41-B~^*9gXrpJ*x@3c&i@97SjJLuq6qS@itjNbKECBCO? zsNy(7S&m2ECNIXmwrbs#_$QqzzxLm&k|*C~cro3hNe_%MJ9!O2>+)hgc;I>{&RO== zk-^UXxF75e88PgdQ{Dy~GpvVfExD_mT%NUwnok~YItB51P#ZahER}*wLHO91di${+ z@vhq_bxOnF_+{JysMtg!<7egFuf#&t_CEQ;BAX?1BuJY_(KX7rFQgVGrUpY#;8&PmwrpS|;HQ{XWpU&hAf;$`)|_x=UL z&K}^Y5a0ZVi#>v8k{?k@2|mTH&?t33r9{(?9Yo82!UEPWVhcj5Jy(_&US8~}XgVl~ zQW$0Wn|_JkRPOQ@`!IUFLDEfEY9pU1OZ&))rWZv_=n4F1QB7mX)fP90R$onzovdzl zb~}MlBS+h<@P1?dv7Ku1_$^a~eWlcH^Y&5UY{v+-1|44*V3l)!SUHD(tK0Nre5+Ku ze=|$t9WmiJ%gdeNs8k&k5E<2Eln(36TBctD4;|5n`qY@i>-`dao&Fi+&5sHPI_zFY ze#`li@`yTDRI{5mI)x$vt7aN()@tcu%&znO?7A?*UzS$ei)mJue~%=t2ot_9@J_2_ z6Df)!GxzDy^-ySby?ei`|)BVLMU#2a1-h+*2+tVac8QfQ7r4M%VSY z_#oygB=fJtZBXP&6$;oh7#r10kF`(Do+;J(;8mN$u?QKFl z!qp-FSz%_oU4G5@0qJu_@*HgGP#56c9#7n}apkpv%Hj-yBBG5|3f1#2{V_gwHS&Rc7pjQS-p1@OUoBo`n=Zj$-ScJevTRw@sn=i*BT^ zbSQ{BlPxDc$BDiN2a-st?-XnH!EGENM}Is!ZBZ&^hRD1Nl(jR45;w@EGIyZr2CTJdV#geOD(hB$t*(P^~TSfg5Hg zPXIZwrAKfgS|z_s#r$e9evy8|ufpc4n+muj-kcoTEl~!UooQQGi#@-BjZkS({0%<; OhF~r1%*&3u6aNpuN&@u& literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-gst/Makefile.am b/doc/reference/cogl-gst/Makefile.am new file mode 100644 index 0000000..5e5c21d --- /dev/null +++ b/doc/reference/cogl-gst/Makefile.am @@ -0,0 +1,106 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=cogl-gst + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=../../../cogl-gst + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS=--type-init-func="gst_init(NULL, NULL)" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS=--deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=cogl_gst + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS=\ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDKPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf \ + --extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-1.0 \ + --extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-libs-1.0 + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=\ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h \ + $(top_srcdir)/cogl/winsys/*.h \ + $(top_srcdir)/cogl-gst/*.h +CFILE_GLOB=$(top_srcdir)/cogl-gst/*.c + +IGNORE_HFILES=\ + $(NULL) + +EXTRA_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES=\ + $(NULL) + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files=\ + $(NULL) + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files=\ + $(NULL) + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) + +AM_CPPFLAGS=\ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + $(COGL_DEP_CFLAGS) \ + $(COGL_GST_DEP_CFLAGS) + +GTKDOC_LIBS=\ + $(top_builddir)/cogl/libcogl.la \ + $(top_builddir)/cogl-gst/libcogl-gst.la \ + $(COGL_DEP_LIBS) \ + $(COGL_GST_DEP_LIBS) + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +if BUILD_GTK_DOC +include $(top_srcdir)/gtk-doc.make +else +EXTRA_DIST = +endif + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in + +EXTRA_DIST += $(HTML_IMAGES) $(content_files) diff --git a/doc/reference/cogl-gst/Makefile.in b/doc/reference/cogl-gst/Makefile.in new file mode 100644 index 0000000..beb1f2d --- /dev/null +++ b/doc/reference/cogl-gst/Makefile.in @@ -0,0 +1,942 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# -*- mode: makefile -*- + +#################################### +# Everything below here is generic # +#################################### +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/gtk-doc.make $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(srcdir)/cogl-gst-docs.xml.in +subdir = doc/reference/cogl-gst +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-gst-docs.xml +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE = cogl-gst + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR = ../../../cogl-gst + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS = --type-init-func="gst_init(NULL, NULL)" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS = --deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS = --sgml-mode --output-format=xml --name-space=cogl_gst + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS = + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS = \ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDKPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf \ + --extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-1.0 \ + --extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-libs-1.0 + + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB = \ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h \ + $(top_srcdir)/cogl/winsys/*.h \ + $(top_srcdir)/cogl-gst/*.h + +CFILE_GLOB = $(top_srcdir)/cogl-gst/*.c +IGNORE_HFILES = \ + $(NULL) + +EXTRA_HFILES = + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES = \ + $(NULL) + + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = \ + $(NULL) + + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files = \ + $(NULL) + + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + $(COGL_DEP_CFLAGS) \ + $(COGL_GST_DEP_CFLAGS) + +GTKDOC_LIBS = \ + $(top_builddir)/cogl/libcogl.la \ + $(top_builddir)/cogl-gst/libcogl-gst.la \ + $(COGL_DEP_LIBS) \ + $(COGL_GST_DEP_LIBS) + +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute + +# We set GPATH here; this gives us semantics for GNU make +# which are more like other make's VPATH, when it comes to +# whether a source that is a target of one rule is then +# searched for in VPATH/GPATH. +# +@BUILD_GTK_DOC_TRUE@GPATH = $(srcdir) +@BUILD_GTK_DOC_TRUE@TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) +@BUILD_GTK_DOC_TRUE@SETUP_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(content_files) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MAIN_SGML_FILE) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-sections.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-overrides.txt + + +# This includes the standard gtk-doc make rules, copied by gtkdocize. + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_FALSE@EXTRA_DIST = $(HTML_IMAGES) $(content_files) + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_TRUE@EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) \ +@BUILD_GTK_DOC_TRUE@ $(HTML_IMAGES) $(content_files) +@BUILD_GTK_DOC_TRUE@DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \ +@BUILD_GTK_DOC_TRUE@ html-build.stamp pdf-build.stamp \ +@BUILD_GTK_DOC_TRUE@ sgml.stamp html.stamp pdf.stamp + +@BUILD_GTK_DOC_TRUE@SCANOBJ_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).args \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).hierarchy \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).interfaces \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).prerequisites \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).signals + +@BUILD_GTK_DOC_TRUE@REPORT_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undocumented.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undeclared.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-unused.txt + +@BUILD_GTK_DOC_TRUE@CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_FALSE@HTML_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp + +#### setup #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP = $(GTK_DOC_V_SETUP_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_ = $(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_0 = @echo " DOC Preparing build"; + +#### scan #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN = $(GTK_DOC_V_SCAN_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_ = $(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_0 = @echo " DOC Scanning header files"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT = $(GTK_DOC_V_INTROSPECT_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_ = $(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_0 = @echo " DOC Introspecting gobjects"; + +#### xml #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML = $(GTK_DOC_V_XML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_ = $(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_0 = @echo " DOC Building XML"; + +#### html #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML = $(GTK_DOC_V_HTML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_ = $(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_0 = @echo " DOC Building HTML"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF = $(GTK_DOC_V_XREF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_ = $(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_0 = @echo " DOC Fixing cross-references"; + +#### pdf #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF = $(GTK_DOC_V_PDF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_ = $(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_0 = @echo " DOC Building PDF"; +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/reference/cogl-gst/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/reference/cogl-gst/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/gtk-doc.make: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-gst-docs.xml: $(top_builddir)/config.status $(srcdir)/cogl-gst-docs.xml.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +@BUILD_GTK_DOC_FALSE@dist-hook: + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +@BUILD_GTK_DOC_FALSE@all-local: +all-am: Makefile all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@BUILD_GTK_DOC_FALSE@clean-local: +@BUILD_GTK_DOC_FALSE@maintainer-clean-local: +@BUILD_GTK_DOC_FALSE@install-data-local: +@BUILD_GTK_DOC_FALSE@uninstall-local: +@BUILD_GTK_DOC_FALSE@distclean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-local + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am dist-hook \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-local + + +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@all-local: + +@BUILD_GTK_DOC_TRUE@docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) + +@BUILD_GTK_DOC_TRUE@$(REPORT_FILES): sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@setup-build.stamp: +@BUILD_GTK_DOC_TRUE@ -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ +@BUILD_GTK_DOC_TRUE@ if test "x$$files" != "x" ; then \ +@BUILD_GTK_DOC_TRUE@ for file in $$files ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $(abs_srcdir)/$$file && \ +@BUILD_GTK_DOC_TRUE@ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch setup-build.stamp + +@BUILD_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_SCAN)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options="--verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ for i in $(SCANOBJ_FILES) ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $$i || touch $$i ; \ +@BUILD_GTK_DOC_TRUE@ done \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch scan-build.stamp + +@BUILD_GTK_DOC_TRUE@$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XML)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) +@BUILD_GTK_DOC_TRUE@ -@test "x$(HTML_IMAGES)" = "x" || \ +@BUILD_GTK_DOC_TRUE@ for file in $(HTML_IMAGES) ; do \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_srcdir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_builddir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_builddir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch html-build.stamp + +@BUILD_GTK_DOC_TRUE@pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test "x$(HTML_IMAGES)" != "x"; then \ +@BUILD_GTK_DOC_TRUE@ for img in $(HTML_IMAGES); do \ +@BUILD_GTK_DOC_TRUE@ part=`dirname $$img`; \ +@BUILD_GTK_DOC_TRUE@ echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ +@BUILD_GTK_DOC_TRUE@ if test $$? != 0; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch pdf-build.stamp + +############## + +@BUILD_GTK_DOC_TRUE@clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -f *~ *.bak +@BUILD_GTK_DOC_TRUE@ @rm -rf .libs + +@BUILD_GTK_DOC_TRUE@distclean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt +@BUILD_GTK_DOC_TRUE@ @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@maintainer-clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html + +@BUILD_GTK_DOC_TRUE@install-data-local: +@BUILD_GTK_DOC_TRUE@ @installfiles=`echo $(builddir)/html/*`; \ +@BUILD_GTK_DOC_TRUE@ if test "$$installfiles" = '$(builddir)/html/*'; \ +@BUILD_GTK_DOC_TRUE@ then echo 1>&2 'Nothing to install' ; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(mkinstalldirs) $${installdir} ; \ +@BUILD_GTK_DOC_TRUE@ for i in $$installfiles; do \ +@BUILD_GTK_DOC_TRUE@ echo ' $(INSTALL_DATA) '$$i ; \ +@BUILD_GTK_DOC_TRUE@ $(INSTALL_DATA) $$i $${installdir}; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ +@BUILD_GTK_DOC_TRUE@ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@uninstall-local: +@BUILD_GTK_DOC_TRUE@ @if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ rm -rf $${installdir} + +# +# Require gtk-doc when making dist +# +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: docs +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @false + +@BUILD_GTK_DOC_TRUE@dist-hook: dist-check-gtkdoc dist-hook-local +@BUILD_GTK_DOC_TRUE@ @mkdir $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @cp ./html/* $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).pdf $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).types $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @cd $(distdir) && rm -f $(DISTCLEANFILES) +@BUILD_GTK_DOC_TRUE@ @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + +@BUILD_GTK_DOC_TRUE@.PHONY : dist-hook-local docs + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/reference/cogl-gst/cogl-gst-docs.xml b/doc/reference/cogl-gst/cogl-gst-docs.xml new file mode 100644 index 0000000..a4bca53 --- /dev/null +++ b/doc/reference/cogl-gst/cogl-gst-docs.xml @@ -0,0 +1,105 @@ + + +]> + + + + Cogl GST 2.0 Reference Manual + for Cogl &version; + + + 2013 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl GST - a library for integrating GStreamer with Cogl + +
+ About Cogl GST + + Cogl GST is a small library which provides a GStreamer + sink which can manage a CoglPipeline to render a video within a + Cogl scene. + +
+ +
+ General APIs + +
+ +
+ + + Glossaries + + + + + + Index of all symbols + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl-gst/cogl-gst-docs.xml.in b/doc/reference/cogl-gst/cogl-gst-docs.xml.in new file mode 100644 index 0000000..8bf4fb6 --- /dev/null +++ b/doc/reference/cogl-gst/cogl-gst-docs.xml.in @@ -0,0 +1,105 @@ + + +]> + + + + Cogl GST 2.0 Reference Manual + for Cogl &version; + + + 2013 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl GST - a library for integrating GStreamer with Cogl + +
+ About Cogl GST + + Cogl GST is a small library which provides a GStreamer + sink which can manage a CoglPipeline to render a video within a + Cogl scene. + +
+ +
+ General APIs + +
+ +
+ + + Glossaries + + + + + + Index of all symbols + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl-gst/cogl-gst-overrides.txt b/doc/reference/cogl-gst/cogl-gst-overrides.txt new file mode 100644 index 0000000..e69de29 diff --git a/doc/reference/cogl-gst/cogl-gst-sections.txt b/doc/reference/cogl-gst/cogl-gst-sections.txt new file mode 100644 index 0000000..0b6c0bd --- /dev/null +++ b/doc/reference/cogl-gst/cogl-gst-sections.txt @@ -0,0 +1,33 @@ +
+cogl-gst-video-sink +CoglGstVideoSink + + +CoglGstVideoSink +CoglGstVideoSinkClass +cogl_gst_video_sink_new +cogl_gst_video_sink_set_context +cogl_gst_video_sink_get_pipeline +cogl_gst_video_sink_attach_frame +cogl_gst_video_sink_setup_pipeline +cogl_gst_video_sink_get_free_layer +cogl_gst_video_sink_set_first_layer +cogl_gst_video_sink_set_default_sample +cogl_gst_video_sink_is_ready +cogl_gst_video_sink_get_aspect +cogl_gst_video_sink_get_width_for_height +cogl_gst_video_sink_get_height_for_width +cogl_gst_video_sink_fit_size + + +COGL_GST_IS_VIDEO_SINK +COGL_GST_IS_VIDEO_SINK_CLASS +COGL_GST_VIDEO_SINK +COGL_GST_VIDEO_SINK_CLASS +COGL_GST_TYPE_VIDEO_SINK +COGL_GST_VIDEO_SINK_GET_CLASS + +CoglGstVideoSinkPrivate +cogl_gst_video_sink_get_type + +
diff --git a/doc/reference/cogl-gst/cogl-gst.types b/doc/reference/cogl-gst/cogl-gst.types new file mode 100644 index 0000000..4d6f953 --- /dev/null +++ b/doc/reference/cogl-gst/cogl-gst.types @@ -0,0 +1,2 @@ +#include +cogl_gst_video_sink_get_type diff --git a/doc/reference/cogl-gst/html/CoglGstVideoSink.html b/doc/reference/cogl-gst/html/CoglGstVideoSink.html new file mode 100644 index 0000000..0fc861c --- /dev/null +++ b/doc/reference/cogl-gst/html/CoglGstVideoSink.html @@ -0,0 +1,723 @@ + + + + +CoglGstVideoSink + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglGstVideoSink

+

CoglGstVideoSink — A video sink for integrating a GStreamer + pipeline with a Cogl pipeline.

+
+
+

Synopsis

+
struct              CoglGstVideoSink;
+struct              CoglGstVideoSinkClass;
+CoglGstVideoSink *  cogl_gst_video_sink_new             (CoglContext *ctx);
+void                cogl_gst_video_sink_set_context     (CoglGstVideoSink *vt,
+                                                         CoglContext *ctx);
+CoglPipeline *      cogl_gst_video_sink_get_pipeline    (CoglGstVideoSink *vt);
+void                cogl_gst_video_sink_attach_frame    (CoglGstVideoSink *sink,
+                                                         CoglPipeline *pln);
+void                cogl_gst_video_sink_setup_pipeline  (CoglGstVideoSink *sink,
+                                                         CoglPipeline *pipeline);
+int                 cogl_gst_video_sink_get_free_layer  (CoglGstVideoSink *sink);
+void                cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink,
+                                                         int first_layer);
+void                cogl_gst_video_sink_set_default_sample
+                                                        (CoglGstVideoSink *sink,
+                                                         CoglBool default_sample);
+CoglBool            cogl_gst_video_sink_is_ready        (CoglGstVideoSink *sink);
+float               cogl_gst_video_sink_get_aspect      (CoglGstVideoSink *sink);
+float               cogl_gst_video_sink_get_width_for_height
+                                                        (CoglGstVideoSink *sink,
+                                                         float height);
+float               cogl_gst_video_sink_get_height_for_width
+                                                        (CoglGstVideoSink *sink,
+                                                         float width);
+void                cogl_gst_video_sink_fit_size        (CoglGstVideoSink *sink,
+                                                         const CoglGstRectangle *available,
+                                                         CoglGstRectangle *output);
+
+
+
+

Object Hierarchy

+
+  GObject
+   +----GInitiallyUnowned
+         +----GstObject
+               +----GstElement
+                     +----GstBaseSink
+                           +----CoglGstVideoSink
+
+
+
+

Properties

+
+  "update-priority"          gint                  : Read / Write
+
+
+
+

Signals

+
+  "new-frame"                                      : Run Last
+  "pipeline-ready"                                 : Run Last
+
+
+
+

Description

+

+CoglGstVideoSink is a subclass of GstBaseSink which can be used to +create a CoglPipeline for rendering the frames of the video. +

+

+To create a basic video player, an application can create a +GstPipeline as normal using gst_pipeline_new() and set the +sink on it to one created with cogl_gst_video_sink_new(). The +application can then listen for the "new-frame" +signal which will be emitted whenever there are new textures ready +for rendering. For simple rendering, the application can just call +cogl_gst_video_sink_get_pipeline() in the signal handler and use +the returned pipeline to paint the new frame. +

+

+An application is also free to do more advanced rendering by +customizing the pipeline. In that case it should listen for the +"pipeline-ready" signal which will be emitted as +soon as the sink has determined enough information about the video +to know how it should be rendered. In the handler for this signal, +the application can either make modifications to a copy of the +pipeline returned by cogl_gst_video_sink_get_pipeline() or it can +create its own pipeline from scratch and ask the sink to configure +it with cogl_gst_video_sink_setup_pipeline(). If a custom pipeline +is created using one of these methods then the application should +call cogl_gst_video_sink_attach_frame() on the pipeline before +rendering in order to update the textures on the pipeline's layers. +

+

+If the COGL_FEATURE_ID_GLSL feature is available then the pipeline +used by the sink will have a shader snippet with a function in it +called cogl_gst_sample_video0 which takes a single vec2 argument. +This can be used by custom snippets set the by the application to +sample from the video. The vec2 argument represents the normalised +coordinates within the video. The function returns a vec4 +containing a pre-multiplied RGBA color of the pixel within the +video. +

+
+
+

Details

+
+

struct CoglGstVideoSink

+
struct CoglGstVideoSink;
+

+The CoglGstVideoSink structure contains only private data and +should be accessed using the provided API. +

+

Since 1.16

+
+
+
+

struct CoglGstVideoSinkClass

+
struct CoglGstVideoSinkClass {
+  void (* new_frame) (CoglGstVideoSink *sink);
+  void (* pipeline_ready) (CoglGstVideoSink *sink);
+};
+
+
++++ + + + + + + + + + + +

new_frame ()

handler for the "new-frame" signal

pipeline_ready ()

handler for the "pipeline-ready" signal
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_new ()

+
CoglGstVideoSink *  cogl_gst_video_sink_new             (CoglContext *ctx);
+

+Creates a new CoglGstVideoSink which will create resources for use +with the given context. +

+
++++ + + + + + + + + + + +

ctx :

The CoglContext +

Returns :

a new CoglGstVideoSink. [transfer full] +
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_set_context ()

+
void                cogl_gst_video_sink_set_context     (CoglGstVideoSink *vt,
+                                                         CoglContext *ctx);
+

+Sets the CoglContext that the video sink should use for creating +any resources. This function would normally only be used if the +sink was constructed via gst_element_factory_make() instead of +cogl_gst_video_sink_new(). +

+
++++ + + + + + + + + + + +

vt :

The CoglGstVideoSink +

ctx :

The CoglContext for the sink to use
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_get_pipeline ()

+
CoglPipeline *      cogl_gst_video_sink_get_pipeline    (CoglGstVideoSink *vt);
+

+Returns a pipeline suitable for rendering the current frame of the +given video sink. The pipeline will already have the textures for +the frame attached. For simple rendering, an application will +typically call this function immediately before it paints the +video. It can then just paint a rectangle using the returned +pipeline. +

+

+An application is free to make a copy of this +pipeline and modify it for custom rendering. +

+

+Note: it is considered an error to call this function before the +"pipeline-ready" signal is emitted. +

+
++++ + + + + + + + + + + +

vt :

The CoglGstVideoSink +

Returns :

the pipeline for rendering the +current frame. [transfer none] +
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_attach_frame ()

+
void                cogl_gst_video_sink_attach_frame    (CoglGstVideoSink *sink,
+                                                         CoglPipeline *pln);
+

+Updates the given pipeline with the textures for the current frame. +This can be used if the application wants to customize the +rendering using its own pipeline. Typically this would be called in +response to the "new-frame" signal which is +emitted whenever the new textures are available. The application +would then make a copy of its template pipeline and call this to +set the textures. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

pln :

A CoglPipeline +
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_setup_pipeline ()

+
void                cogl_gst_video_sink_setup_pipeline  (CoglGstVideoSink *sink,
+                                                         CoglPipeline *pipeline);
+

+Configures the given pipeline so that will be able to render the +video for the sink. This should only be used if the application +wants to perform some custom rendering using its own pipeline. +Typically an application will call this in response to the +"pipeline-ready" signal. +

+

+Note: it is considered an error to call this function before the +"pipeline-ready" signal is emitted. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

pipeline :

A CoglPipeline +
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_get_free_layer ()

+
int                 cogl_gst_video_sink_get_free_layer  (CoglGstVideoSink *sink);
+

+This can be used when doing specialised rendering of the video by +customizing the pipeline. CoglGstVideoSink may use up to three +private layers on the pipeline in order to attach the textures of +the video frame. This function will return the index of the next +available unused layer after the sink's internal layers. This can +be used by the application to add additional layers, for example to +blend in another color in the fragment processing. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

Returns :

the index of the next available layer after the +sink's internal layers.
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_set_first_layer ()

+
void                cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink,
+                                                         int first_layer);
+

+Sets the index of the first layer that the sink will use for its +rendering. This is useful if the application wants to have custom +layers that appear before the layers added by the sink. In that +case by default the sink's layers will be modulated with the result +of the application's layers that come before first_layer. +

+

+Note that if this function is called then the name of the function +to call in the shader snippets to sample the video will also +change. For example, if first_layer is three then the function +will be cogl_gst_sample_video3. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

first_layer :

The new first layer
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_set_default_sample ()

+
void                cogl_gst_video_sink_set_default_sample
+                                                        (CoglGstVideoSink *sink,
+                                                         CoglBool default_sample);
+

+By default the pipeline generated by +cogl_gst_video_sink_setup_pipeline() and +cogl_gst_video_sink_get_pipeline() will have a layer with a shader +snippet that automatically samples the video. If the application +wants to sample the video in a completely custom way using its own +shader snippet it can set default_sample to FALSE to avoid this +default snippet being added. In that case the application's snippet +can call cogl_gst_sample_video0 to sample the texture itself. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

default_sample :

Whether to add the default sampling
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_is_ready ()

+
CoglBool            cogl_gst_video_sink_is_ready        (CoglGstVideoSink *sink);
+

+Returns whether the pipeline is ready and so +cogl_gst_video_sink_get_pipeline() and +cogl_gst_video_sink_setup_pipeline() can be called without causing error. +

+

+Note: Normally an application will wait until the +"pipeline-ready" signal is emitted instead of +polling the ready status with this api, but sometimes when a sink +is passed between components that didn't have an opportunity to +connect a signal handler this can be useful. +

+
++++ + + + + + + + + + + +

sink :

The CoglGstVideoSink +

Returns :

+TRUE if the sink is ready, else FALSE +
+

Since 1.16

+
+
+
+

cogl_gst_video_sink_get_aspect ()

+
float               cogl_gst_video_sink_get_aspect      (CoglGstVideoSink *sink);
+

+Returns a width-for-height aspect ratio that lets you calculate a +suitable width for displaying your video based on a given height by +multiplying your chosen height by the returned aspect ratio. +

+

+This aspect ratio is calculated based on the underlying size of the +video buffers and the current pixel-aspect-ratio. +

+
++++ + + + + + + + + + + +

sink :

A CoglGstVideoSink +

Returns :

a width-for-height aspect ratio
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_gst_video_sink_get_width_for_height ()

+
float               cogl_gst_video_sink_get_width_for_height
+                                                        (CoglGstVideoSink *sink,
+                                                         float height);
+

+Calculates a suitable output width for a specific output height +that will maintain the video's aspect ratio. +

+
++++ + + + + + + + + + + + + + + +

sink :

A CoglGstVideoSink +

height :

A specific output height +

Returns :

An output width for the given output height.
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_gst_video_sink_get_height_for_width ()

+
float               cogl_gst_video_sink_get_height_for_width
+                                                        (CoglGstVideoSink *sink,
+                                                         float width);
+

+Calculates a suitable output height for a specific output width +that will maintain the video's aspect ratio. +

+
++++ + + + + + + + + + + + + + + +

sink :

A CoglGstVideoSink +

width :

A specific output width +

Returns :

An output height for the given output width.
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

cogl_gst_video_sink_fit_size ()

+
void                cogl_gst_video_sink_fit_size        (CoglGstVideoSink *sink,
+                                                         const CoglGstRectangle *available,
+                                                         CoglGstRectangle *output);
+

+Calculates a suitable output rectangle that can fit inside the +available space while maintaining the aspect ratio of the current +video. +

+

+Applications would typically use this api for "letterboxing" by +using this api to position a video inside a fixed screen space and +filling the remaining space with black borders. +

+
++++ + + + + + + + + + + + + + + +

sink :

A CoglGstVideoSink +

available :

The space available for video output. [in] +

output :

The return location for the calculated output position. [inout] +
+

Since 1.16

+

Stability Level: Unstable

+
+
+
+

Property Details

+
+

The "update-priority" property

+
  "update-priority"          gint                  : Read / Write
+

Priority of video updates in the thread.

+

Allowed values: >= -2147483647

+

Default value: 100

+
+
+
+

Signal Details

+
+

The "new-frame" signal

+
void                user_function                      (CoglGstVideoSink *sink,
+                                                        gpointer          user_data)      : Run Last
+

+The sink will emit this signal whenever there are new textures +available for a new frame of the video. After this signal is +emitted, an application can call cogl_gst_video_sink_get_pipeline() +to get a pipeline suitable for rendering the frame. If the +application is using a custom pipeline it can alternatively call +cogl_gst_video_sink_attach_frame() to attach the textures. +

+
++++ + + + + + + + + + + +

sink :

the CoglGstVideoSink +

user_data :

user data set when the signal handler was connected.
+

Since 1.16

+
+
+
+

The "pipeline-ready" signal

+
void                user_function                      (CoglGstVideoSink *sink,
+                                                        gpointer          user_data)      : Run Last
+

+The sink will emit this signal as soon as it has gathered enough +information from the video to configure a pipeline. If the +application wants to do some customized rendering, it can setup its +pipeline after this signal is emitted. The application's pipeline +will typically either be a copy of the one returned by +cogl_gst_video_sink_get_pipeline() or it can be a completely custom +pipeline which is setup using cogl_gst_video_sink_setup_pipeline(). +

+

+Note that it is an error to call either of those functions before +this signal is emitted. The "new-frame" signal +will only be emitted after the pipeline is ready so the application +could also create its pipeline in the handler for that. +

+
++++ + + + + + + + + + + +

sink :

the CoglGstVideoSink +

user_data :

user data set when the signal handler was connected.
+

Since 1.16

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/ch01.html b/doc/reference/cogl-gst/html/ch01.html new file mode 100644 index 0000000..e9f2acd --- /dev/null +++ b/doc/reference/cogl-gst/html/ch01.html @@ -0,0 +1,45 @@ + + + + +Cogl GST - a library for integrating GStreamer with Cogl + + + + + + + + + + + + + + + + +
+

+Cogl GST - a library for integrating GStreamer with Cogl

+
+
About Cogl GST
+
General APIs
+
+CoglGstVideoSink — A video sink for integrating a GStreamer + pipeline with a Cogl pipeline. +
+
+
+

+About Cogl GST

+

Cogl GST is a small library which provides a GStreamer + sink which can manage a CoglPipeline to render a video within a + Cogl scene.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/cogl-gst-general-apis.html b/doc/reference/cogl-gst/html/cogl-gst-general-apis.html new file mode 100644 index 0000000..a8083c1 --- /dev/null +++ b/doc/reference/cogl-gst/html/cogl-gst-general-apis.html @@ -0,0 +1,28 @@ + + + + +General APIs + + + + + + + + + + + + + + + + +

+General APIs

+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/cogl-gst.devhelp2 b/doc/reference/cogl-gst/html/cogl-gst.devhelp2 new file mode 100644 index 0000000..c349f89 --- /dev/null +++ b/doc/reference/cogl-gst/html/cogl-gst.devhelp2 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl-gst/html/coglglossary.html b/doc/reference/cogl-gst/html/coglglossary.html new file mode 100644 index 0000000..2e9cfdd --- /dev/null +++ b/doc/reference/cogl-gst/html/coglglossary.html @@ -0,0 +1,45 @@ + + + + +Glossaries + + + + + + + + + + + + + + + + +
+

+Glossaries

+ +
+

+Annotation Glossary

+

I

+
inout
+

Parameter for input and for returning results. Default is transfer full.

+
in
+

Parameter for input. Default is transfer none.

+

T

+
transfer full
+

Free data after the code is done.

+
transfer none
+

Don't free data after the code is done.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/home.png b/doc/reference/cogl-gst/html/home.png new file mode 100644 index 0000000000000000000000000000000000000000..17003611d9df2b066afc682cbde962f3a575002d GIT binary patch literal 654 zcmV;90&)F`P)~yY zO1cF+0vxb!W?!x?K+*#62Jq)nA4q`)5S6sgX4ao{=)(Mgq+YMr)7sjak|a^9)zS!j zlk{-n29mabXYF=7SYBQx&vO8xC}MYams+hxqtO7sImhPaCf@rq;I^3!#u*2aUP)55 zT2&N90xmEJ0s&fGT~(T<3d2xYmK9C>IP*x-M@ib*+0pFm>>uW37N2Wzaq-fCnIZE9 zpb8}0+uN+KuQM2oZVHfP8U6kQdo3?>Wo2dT)WeM9So8DqhLi#T0 z-i(>mfjhvbsYV`;4sgfJ-p>G-SqJ!fjR6BQYs1h*y9xaN0l{VB;o%`08yiy@)$8@~ z2PD1gcDuiy;j1tR0v#V8OH%W)25-YKyx(j#IXO9*YWf0mb8}QG6@b@;cHxh9{t7+@ o!Yd`f8L$sLH?yBt^q3C6015TtIu@BS5dZ)H07*qoM6N<$f*igdr~m)} literal 0 HcmV?d00001 diff --git a/doc/reference/cogl-gst/html/index.html b/doc/reference/cogl-gst/html/index.html new file mode 100644 index 0000000..a594577 --- /dev/null +++ b/doc/reference/cogl-gst/html/index.html @@ -0,0 +1,64 @@ + + + + +Cogl GST 2.0 Reference Manual + + + + + + + +
+
+
+
+

for Cogl 1.18.2

+
+
+

+ Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +

+


+          The Free Software Foundation, Inc.,
+          59 Temple Place - Suite 330,
+          Boston, MA 02111-1307,
+          USA
+        

+

+

+
+
+
+
+
+
Cogl GST - a library for integrating GStreamer with Cogl
+
+
About Cogl GST
+
General APIs
+
+CoglGstVideoSink — A video sink for integrating a GStreamer + pipeline with a Cogl pipeline. +
+
+
Glossaries
+
Annotation Glossary
+
Index of all symbols
+
A. License
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/index.sgml b/doc/reference/cogl-gst/html/index.sgml new file mode 100644 index 0000000..a4fe0ef --- /dev/null +++ b/doc/reference/cogl-gst/html/index.sgml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl-gst/html/ix01.html b/doc/reference/cogl-gst/html/ix01.html new file mode 100644 index 0000000..6cef8b0 --- /dev/null +++ b/doc/reference/cogl-gst/html/ix01.html @@ -0,0 +1,111 @@ + + + + +Index of all symbols + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/left.png b/doc/reference/cogl-gst/html/left.png new file mode 100644 index 0000000000000000000000000000000000000000..2d05b3d5b4aeec9384bbfe404bfc4ed0897051c4 GIT binary patch literal 459 zcmV;+0W|)JP)40xL?wO*>WZ(J#ML5j2<9jD6A%Q&kC}jOeEc;X{s;`zcnxLeZR6?6h#^ihmNF6NpGdilO$m<82oD9WQ|6nVv1`? z>KufRi{?QPXg;4;wroQu4?mN1Ydd@|kaQ|ZyWLK!)yi7Wb%=0{}lD)tfliHAUyWRQ+fD_;aV6j->y6!O_8bENg + + + +Appendix A. License + + + + + + + + + + + + + + + +
+

+Appendix A. License

+

+ This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. +

+

+ This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. +

+

+ You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +

+


+        Free Software Foundation, Inc.
+        59 Temple Place - Suite 330
+        Boston, MA 02111-1307
+        USA
+      

+

+

+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-gst/html/right.png b/doc/reference/cogl-gst/html/right.png new file mode 100644 index 0000000000000000000000000000000000000000..92832e3a4566e59d6e4092010e08d28f3be3a68d GIT binary patch literal 472 zcmV;}0Vn>6P)Cd4HCN^TYHBC0dz3r5|}*T3c5!K}0^NPTey!^rYo;W&eW{b1SE%dR-1ljcju- zJITo5P_e{cPDWDszO|97o#m$fni3V4d%~7^?0HU4-k!+X`e~w55Q}HA=c?CM9`EK` z^o5GF_RsnG`ey+9wOf8O4bzg>7W*;jU~M?g`OZAA$mNp|Lz<$s+~N9!2`ir8RcClo$(Q~19INM~9}j;&*|enC yGd}kJak0wj?aUKd8;%}`i}SSew>!A-2iw}^5}Rh(M>+vRkipZ{&t;ucLK6U4uc96R literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/Makefile.am b/doc/reference/cogl/Makefile.am new file mode 100644 index 0000000..1dc050f --- /dev/null +++ b/doc/reference/cogl/Makefile.am @@ -0,0 +1,152 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=cogl + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=../../../cogl + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS=--type-init-func="g_type_init()" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS=--deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=cogl + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS=\ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=\ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h +CFILE_GLOB=$(top_srcdir)/cogl/*.c + +# Header files to ignore when scanning. +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES=\ + cogl-atlas.h \ + cogl-atlas-texture-private.h \ + cogl-bitmap-private.h \ + cogl-buffer-private.h \ + cogl-color-private.h \ + cogl-feature-private.h \ + cogl-framebuffer-private.h \ + cogl-onscreen-private.h \ + cogl-gtype-private.h \ + cogl-index-buffer-private.h \ + cogl-indices-private.h \ + cogl-journal-private.h \ + cogl-matrix-private.h \ + cogl-object-private.h \ + cogl-path-private.h \ + cogl-depth-state-private.h \ + cogl-pipeline-fragend-arbfp-private.h \ + cogl-pipeline-fragend-fixed-private.h \ + cogl-pipeline-fragend-glsl-private.h \ + cogl-pipeline-opengl-private.h \ + cogl-pipeline-private.h \ + cogl-pipeline-state-private.h \ + cogl-pipeline-layer-state-private.h \ + cogl-pipeline-progend-glsl-private.h \ + cogl-pipeline-vertend-fixed-private.h \ + cogl-pipeline-vertend-glsl-private.h \ + cogl-pixel-buffer-private.h \ + cogl-primitive-private.h \ + cogl-primitives-private.h \ + cogl-private.h \ + cogl-program-private.h \ + cogl-shader-private.h \ + cogl-sub-texture-private.h \ + cogl-texture-2d-private.h \ + cogl-texture-2d-sliced-private.h \ + cogl-texture-3d-private.h \ + cogl-texture-private.h \ + cogl-texture-rectangle-private.h \ + cogl-vertex-array-private.h \ + cogl-vertex-attribute-private.h \ + cogl-vertex-buffer-private.h \ + cogl-blend-string.h \ + cogl-clip-stack.h \ + cogl-debug.h \ + cogl-defines.h \ + cogl-deprecated.h \ + cogl-internal.h \ + cogl-matrix-mesa.h \ + cogl-matrix-stack.h \ + cogl-spans.h \ + cogl-profile.h \ + cogl-util.h \ + driver \ + tesselator \ + winsys + +EXTRA_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES = \ + fill-rule-non-zero.png \ + fill-rule-even-odd.png \ + quad-indices-order.png \ + quad-indices-triangles.png \ + cogl_ortho.png + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = \ + blend-strings.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files = \ + blend-strings.xml + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) + +INCLUDES=-I$(top_srcdir) -I$(top_builddir)/cogl -DCOGL_ENABLE_EXPERIMENTAL_API $(COGL_DEP_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/cogl/libcogl.la $(COGL_DEP_LIBS) + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +if BUILD_GTK_DOC +include $(top_srcdir)/gtk-doc.make +else +EXTRA_DIST = +endif + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in + +EXTRA_DIST += $(HTML_IMAGES) $(content_files) diff --git a/doc/reference/cogl/Makefile.in b/doc/reference/cogl/Makefile.in new file mode 100644 index 0000000..afe1539 --- /dev/null +++ b/doc/reference/cogl/Makefile.in @@ -0,0 +1,988 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# -*- mode: makefile -*- + +#################################### +# Everything below here is generic # +#################################### +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/gtk-doc.make $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(srcdir)/cogl-docs.xml.in +subdir = doc/reference/cogl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = cogl-docs.xml +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE = cogl + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR = ../../../cogl + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS = --type-init-func="g_type_init()" + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS = --deprecated-guards="COGL_DISABLE_DEPRECATED" + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS = --sgml-mode --output-format=xml --name-space=cogl + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS = + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS = \ + --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ + --extra-dir=$(GDPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf + + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB = \ + $(top_srcdir)/cogl/*.h \ + $(top_builddir)/cogl/*.h + +CFILE_GLOB = $(top_srcdir)/cogl/*.c + +# Header files to ignore when scanning. +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES = \ + cogl-atlas.h \ + cogl-atlas-texture-private.h \ + cogl-bitmap-private.h \ + cogl-buffer-private.h \ + cogl-color-private.h \ + cogl-feature-private.h \ + cogl-framebuffer-private.h \ + cogl-onscreen-private.h \ + cogl-gtype-private.h \ + cogl-index-buffer-private.h \ + cogl-indices-private.h \ + cogl-journal-private.h \ + cogl-matrix-private.h \ + cogl-object-private.h \ + cogl-path-private.h \ + cogl-depth-state-private.h \ + cogl-pipeline-fragend-arbfp-private.h \ + cogl-pipeline-fragend-fixed-private.h \ + cogl-pipeline-fragend-glsl-private.h \ + cogl-pipeline-opengl-private.h \ + cogl-pipeline-private.h \ + cogl-pipeline-state-private.h \ + cogl-pipeline-layer-state-private.h \ + cogl-pipeline-progend-glsl-private.h \ + cogl-pipeline-vertend-fixed-private.h \ + cogl-pipeline-vertend-glsl-private.h \ + cogl-pixel-buffer-private.h \ + cogl-primitive-private.h \ + cogl-primitives-private.h \ + cogl-private.h \ + cogl-program-private.h \ + cogl-shader-private.h \ + cogl-sub-texture-private.h \ + cogl-texture-2d-private.h \ + cogl-texture-2d-sliced-private.h \ + cogl-texture-3d-private.h \ + cogl-texture-private.h \ + cogl-texture-rectangle-private.h \ + cogl-vertex-array-private.h \ + cogl-vertex-attribute-private.h \ + cogl-vertex-buffer-private.h \ + cogl-blend-string.h \ + cogl-clip-stack.h \ + cogl-debug.h \ + cogl-defines.h \ + cogl-deprecated.h \ + cogl-internal.h \ + cogl-matrix-mesa.h \ + cogl-matrix-stack.h \ + cogl-spans.h \ + cogl-profile.h \ + cogl-util.h \ + driver \ + tesselator \ + winsys + +EXTRA_HFILES = + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES = \ + fill-rule-non-zero.png \ + fill-rule-even-odd.png \ + quad-indices-order.png \ + quad-indices-triangles.png \ + cogl_ortho.png + + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = \ + blend-strings.xml + + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files = \ + blend-strings.xml + + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +INCLUDES = -I$(top_srcdir) -I$(top_builddir)/cogl -DCOGL_ENABLE_EXPERIMENTAL_API $(COGL_DEP_CFLAGS) +GTKDOC_LIBS = $(top_builddir)/cogl/libcogl.la $(COGL_DEP_LIBS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = +@BUILD_GTK_DOC_TRUE@@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute + +# We set GPATH here; this gives us semantics for GNU make +# which are more like other make's VPATH, when it comes to +# whether a source that is a target of one rule is then +# searched for in VPATH/GPATH. +# +@BUILD_GTK_DOC_TRUE@GPATH = $(srcdir) +@BUILD_GTK_DOC_TRUE@TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) +@BUILD_GTK_DOC_TRUE@SETUP_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(content_files) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MAIN_SGML_FILE) \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-sections.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-overrides.txt + + +# This includes the standard gtk-doc make rules, copied by gtkdocize. + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_FALSE@EXTRA_DIST = $(HTML_IMAGES) $(content_files) + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +@BUILD_GTK_DOC_TRUE@EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) \ +@BUILD_GTK_DOC_TRUE@ $(HTML_IMAGES) $(content_files) +@BUILD_GTK_DOC_TRUE@DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \ +@BUILD_GTK_DOC_TRUE@ html-build.stamp pdf-build.stamp \ +@BUILD_GTK_DOC_TRUE@ sgml.stamp html.stamp pdf.stamp + +@BUILD_GTK_DOC_TRUE@SCANOBJ_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).args \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).hierarchy \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).interfaces \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).prerequisites \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE).signals + +@BUILD_GTK_DOC_TRUE@REPORT_FILES = \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undocumented.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-undeclared.txt \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-unused.txt + +@BUILD_GTK_DOC_TRUE@CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_FALSE@HTML_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp + +#### setup #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP = $(GTK_DOC_V_SETUP_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_ = $(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SETUP_0 = @echo " DOC Preparing build"; + +#### scan #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN = $(GTK_DOC_V_SCAN_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_ = $(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_SCAN_0 = @echo " DOC Scanning header files"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT = $(GTK_DOC_V_INTROSPECT_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_ = $(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_INTROSPECT_0 = @echo " DOC Introspecting gobjects"; + +#### xml #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML = $(GTK_DOC_V_XML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_ = $(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XML_0 = @echo " DOC Building XML"; + +#### html #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML = $(GTK_DOC_V_HTML_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_ = $(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_HTML_0 = @echo " DOC Building HTML"; +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF = $(GTK_DOC_V_XREF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_ = $(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_XREF_0 = @echo " DOC Fixing cross-references"; + +#### pdf #### +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF = $(GTK_DOC_V_PDF_$(V)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_ = $(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY)) +@BUILD_GTK_DOC_TRUE@GTK_DOC_V_PDF_0 = @echo " DOC Building PDF"; +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/gtk-doc.make $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/reference/cogl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/reference/cogl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/gtk-doc.make: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +cogl-docs.xml: $(top_builddir)/config.status $(srcdir)/cogl-docs.xml.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +@BUILD_GTK_DOC_FALSE@dist-hook: + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +@BUILD_GTK_DOC_FALSE@all-local: +all-am: Makefile all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@BUILD_GTK_DOC_FALSE@install-data-local: +@BUILD_GTK_DOC_FALSE@maintainer-clean-local: +@BUILD_GTK_DOC_FALSE@clean-local: +@BUILD_GTK_DOC_FALSE@distclean-local: +@BUILD_GTK_DOC_FALSE@uninstall-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-local + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am dist-hook \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + maintainer-clean-local mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-local + + +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@all-local: + +@BUILD_GTK_DOC_TRUE@docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) + +@BUILD_GTK_DOC_TRUE@$(REPORT_FILES): sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@setup-build.stamp: +@BUILD_GTK_DOC_TRUE@ -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ +@BUILD_GTK_DOC_TRUE@ if test "x$$files" != "x" ; then \ +@BUILD_GTK_DOC_TRUE@ for file in $$files ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $(abs_srcdir)/$$file && \ +@BUILD_GTK_DOC_TRUE@ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch setup-build.stamp + +@BUILD_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_SCAN)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ scanobj_options="--verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ for i in $(SCANOBJ_FILES) ; do \ +@BUILD_GTK_DOC_TRUE@ test -f $$i || touch $$i ; \ +@BUILD_GTK_DOC_TRUE@ done \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch scan-build.stamp + +@BUILD_GTK_DOC_TRUE@$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XML)_source_dir='' ; \ +@BUILD_GTK_DOC_TRUE@ for i in $(DOC_SOURCE_DIR) ; do \ +@BUILD_GTK_DOC_TRUE@ _source_dir="$${_source_dir} --source-dir=$$i" ; \ +@BUILD_GTK_DOC_TRUE@ done ; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +@BUILD_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) +@BUILD_GTK_DOC_TRUE@ -@test "x$(HTML_IMAGES)" = "x" || \ +@BUILD_GTK_DOC_TRUE@ for file in $(HTML_IMAGES) ; do \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_srcdir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test -f $(abs_builddir)/$$file ; then \ +@BUILD_GTK_DOC_TRUE@ cp $(abs_builddir)/$$file $(abs_builddir)/html; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch html-build.stamp + +@BUILD_GTK_DOC_TRUE@pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options=""; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ +@BUILD_GTK_DOC_TRUE@ if test "$(?)" = "0"; then \ +@BUILD_GTK_DOC_TRUE@ if test "x$(V)" = "x1"; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --verbose"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ if test "x$(HTML_IMAGES)" != "x"; then \ +@BUILD_GTK_DOC_TRUE@ for img in $(HTML_IMAGES); do \ +@BUILD_GTK_DOC_TRUE@ part=`dirname $$img`; \ +@BUILD_GTK_DOC_TRUE@ echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ +@BUILD_GTK_DOC_TRUE@ if test $$? != 0; then \ +@BUILD_GTK_DOC_TRUE@ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ $(AM_V_at)touch pdf-build.stamp + +############## + +@BUILD_GTK_DOC_TRUE@clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -f *~ *.bak +@BUILD_GTK_DOC_TRUE@ @rm -rf .libs + +@BUILD_GTK_DOC_TRUE@distclean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ +@BUILD_GTK_DOC_TRUE@ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt +@BUILD_GTK_DOC_TRUE@ @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@maintainer-clean-local: +@BUILD_GTK_DOC_TRUE@ @rm -rf xml html + +@BUILD_GTK_DOC_TRUE@install-data-local: +@BUILD_GTK_DOC_TRUE@ @installfiles=`echo $(builddir)/html/*`; \ +@BUILD_GTK_DOC_TRUE@ if test "$$installfiles" = '$(builddir)/html/*'; \ +@BUILD_GTK_DOC_TRUE@ then echo 1>&2 'Nothing to install' ; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(mkinstalldirs) $${installdir} ; \ +@BUILD_GTK_DOC_TRUE@ for i in $$installfiles; do \ +@BUILD_GTK_DOC_TRUE@ echo ' $(INSTALL_DATA) '$$i ; \ +@BUILD_GTK_DOC_TRUE@ $(INSTALL_DATA) $$i $${installdir}; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ +@BUILD_GTK_DOC_TRUE@ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ +@BUILD_GTK_DOC_TRUE@ fi + +@BUILD_GTK_DOC_TRUE@uninstall-local: +@BUILD_GTK_DOC_TRUE@ @if test -n "$(DOC_MODULE_VERSION)"; then \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ +@BUILD_GTK_DOC_TRUE@ else \ +@BUILD_GTK_DOC_TRUE@ installdir="$(DESTDIR)$(TARGET_DIR)"; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ rm -rf $${installdir} + +# +# Require gtk-doc when making dist +# +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_TRUE@dist-check-gtkdoc: docs +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@dist-check-gtkdoc: +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist" +@BUILD_GTK_DOC_TRUE@@ENABLE_GTK_DOC_FALSE@ @false + +@BUILD_GTK_DOC_TRUE@dist-hook: dist-check-gtkdoc dist-hook-local +@BUILD_GTK_DOC_TRUE@ @mkdir $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @cp ./html/* $(distdir)/html +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).pdf $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE).types $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ +@BUILD_GTK_DOC_TRUE@ @cd $(distdir) && rm -f $(DISTCLEANFILES) +@BUILD_GTK_DOC_TRUE@ @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + +@BUILD_GTK_DOC_TRUE@.PHONY : dist-hook-local docs + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/reference/cogl/blend-strings.xml b/doc/reference/cogl/blend-strings.xml new file mode 100644 index 0000000..0b37757 --- /dev/null +++ b/doc/reference/cogl/blend-strings.xml @@ -0,0 +1,129 @@ + + +]> + + + +Material Blend Strings +3 +COGL Library + + + +Material Blend Strings +A simple syntax and grammar for describing blending and texture +combining functions. + + + +Cogl Blend Strings + +Describing GPU blending and texture combining states is rather awkward to do +in a consise but also readable fashion. Cogl helps by supporting +string based descriptions using a simple syntax. + + +
+Some examples + +Here is an example used for blending: + +"RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))" + +In OpenGL terms this replaces glBlendFunc[Separate] and +glBlendEquation[Separate] + +Actually in this case it's more verbose than the GL equivalent: + + +glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + +But unless you are familiar with OpenGL or refer to its API documentation +you wouldn't know that the default function used by OpenGL is GL_FUNC_ADD +nor would you know that the above arguments determine what the source color +and destination color will be multiplied by before being adding. + + +Here is an example used for texture combining: + +"RGB = REPLACE (PREVIOUS)" +"A = MODULATE (PREVIOUS, TEXTURE)" + + +In OpenGL terms this replaces glTexEnv, and the above example is equivalent +to this OpenGL code: + + + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR); + glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE); + glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR); + + +
+ +
+Here's the syntax + + +<statement>: + <channel-mask>=<function-name>(<arg-list>) + + You can either use a single statement with an RGBA channel-mask or you can use + two statements; one with an A channel-mask and the other with an RGB + channel-mask. + +<channel-mask>: + A or RGB or RGBA + +<function-name>: + [A-Za-z_]* + +<arg-list>: + <arg>,<arg> + or <arg> + or "" + + I.e. functions may take 0 or more arguments + +<arg>: + <color-source> + 1 - <color-source> : Only intended for texture combining + <color-source> * ( <factor> ) : Only intended for blending + 0 : Only intended for blending + + See the blending or texture combining sections for further notes and examples. + +<color-source>: + <source-name>[<channel-mask>] + <source-name> + + See the blending or texture combining sections for the list of source-names + valid in each context. + + If a channel mask is not given then the channel mask of the statement + is assumed instead. + +<factor>: + 0 + 1 + <color-source> + 1-<color-source> + SRC_ALPHA_SATURATE + + +
+ + +
+ + +
diff --git a/doc/reference/cogl/cogl-docs.xml b/doc/reference/cogl/cogl-docs.xml new file mode 100644 index 0000000..4da687d --- /dev/null +++ b/doc/reference/cogl/cogl-docs.xml @@ -0,0 +1,212 @@ + + +]> + + + + Cogl Reference Manual + for Cogl &version; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl - a modern 3D graphics API + +
+ About Cogl + + Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits. + +
+ + + + + + + + + + + + + + + + + +
+ + + Cogl experimental API + +
+ About the experimental API + + Cogl has some experimental API developers are welcomed to play + with. The main drawback when using those is that there is no API + stability guarantee, functions flagged as experimental could be changed + or removed in future versions of the library. To use this experimental + API you will need to define + COGL_ENABLE_EXPERIMENTAL_API before including + <clutter/clutter.h> or + <cogl/cogl.h>. + +
+ + + + + + +
+ + + Cogl deprecated API + +
+ + About the deprecated API + + Cogl has evolved from once being a thin abstraction over + OpenGL and GLES where a lot of OpenGL's state machine style APIs + were simply rebranded as Cogl API into the more distinguished API + style we have today. The result of this evolution though is that + some of the APIs are considered deprecated and because we plan to + remove them at the next opportunity we have to break the API + developers should aim to avoid these functions to keep their code + working with future major versions of Cogl. + +
+ + + + + + + + + +
+ + + Glossaries + + + + + + Index of all symbols + + + + + Index of deprecated symbols + + + + + Index of new symbols in 0.8 + + + + + Index of new symbols in 1.0 + + + + + Index of new symbols in 1.2 + + + + + Index of new symbols in 1.4 + + + + + Index of new symbols in 1.6 + + + + + Index of new symbols in 1.8 + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl/cogl-docs.xml.in b/doc/reference/cogl/cogl-docs.xml.in new file mode 100644 index 0000000..3cd1cf4 --- /dev/null +++ b/doc/reference/cogl/cogl-docs.xml.in @@ -0,0 +1,212 @@ + + +]> + + + + Cogl Reference Manual + for Cogl &version; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + Intel Corporation + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
+ The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
+
+
+ +
+ + + Cogl - a modern 3D graphics API + +
+ About Cogl + + Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits. + +
+ + + + + + + + + + + + + + + + + +
+ + + Cogl experimental API + +
+ About the experimental API + + Cogl has some experimental API developers are welcomed to play + with. The main drawback when using those is that there is no API + stability guarantee, functions flagged as experimental could be changed + or removed in future versions of the library. To use this experimental + API you will need to define + COGL_ENABLE_EXPERIMENTAL_API before including + <clutter/clutter.h> or + <cogl/cogl.h>. + +
+ + + + + + +
+ + + Cogl deprecated API + +
+ + About the deprecated API + + Cogl has evolved from once being a thin abstraction over + OpenGL and GLES where a lot of OpenGL's state machine style APIs + were simply rebranded as Cogl API into the more distinguished API + style we have today. The result of this evolution though is that + some of the APIs are considered deprecated and because we plan to + remove them at the next opportunity we have to break the API + developers should aim to avoid these functions to keep their code + working with future major versions of Cogl. + +
+ + + + + + + + + +
+ + + Glossaries + + + + + + Index of all symbols + + + + + Index of deprecated symbols + + + + + Index of new symbols in 0.8 + + + + + Index of new symbols in 1.0 + + + + + Index of new symbols in 1.2 + + + + + Index of new symbols in 1.4 + + + + + Index of new symbols in 1.6 + + + + + Index of new symbols in 1.8 + + + + + License + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. + + + + You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +
+ Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307 + USA +
+
+
+ +
diff --git a/doc/reference/cogl/cogl-overrides.txt b/doc/reference/cogl/cogl-overrides.txt new file mode 100644 index 0000000..e69de29 diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt new file mode 100644 index 0000000..af510ce --- /dev/null +++ b/doc/reference/cogl/cogl-sections.txt @@ -0,0 +1,715 @@ +
+cogl +General API +CoglObject +cogl_object_ref +cogl_object_unref +CoglUserDataKey +cogl_object_get_user_data +cogl_object_set_user_data +COGL_INVALID_HANDLE +CoglHandle +cogl_handle_ref +cogl_handle_unref + + +CoglFuncPtr +CoglPixelFormat +CoglBufferTarget +CoglBufferBit +CoglAttributeType + + +CoglFeatureFlags +cogl_get_features +cogl_features_available +cogl_get_proc_address +cogl_get_option_group + + +cogl_push_matrix +cogl_pop_matrix +cogl_scale +cogl_translate +cogl_rotate +cogl_transform +cogl_frustum +cogl_perspective +cogl_ortho + + +cogl_get_modelview_matrix +cogl_set_modelview_matrix +cogl_get_projection_matrix +cogl_set_projection_matrix +cogl_set_viewport +cogl_get_viewport + + +cogl_clear +cogl_set_backface_culling_enabled +cogl_get_backface_culling_enabled + + +CoglFogMode +cogl_set_fog +cogl_disable_fog + + +cogl_set_source +cogl_set_source_color +cogl_set_source_color4ub +cogl_set_source_color4f +cogl_set_source_texture +cogl_get_source +cogl_push_source +cogl_pop_source + + +CoglReadPixelsFlags +cogl_read_pixels + + +cogl_flush +cogl_begin_gl +cogl_end_gl + + +COGL_TYPE_ATTRIBUTE_TYPE +COGL_TYPE_BLEND_STRING_ERROR +COGL_TYPE_BUFFER_ACCESS +COGL_TYPE_BUFFER_BIT +COGL_TYPE_BUFFER_TARGET +COGL_TYPE_BUFFER_UPDATE_HINT +COGL_TYPE_BUFFER_USAGE_HINT +COGL_TYPE_DEBUG_FLAGS +COGL_TYPE_DRIVER_ERROR +COGL_TYPE_FEATURE_FLAGS +COGL_TYPE_FIXED +COGL_TYPE_FOG_MODE +COGL_TYPE_HANDLE +COGL_TYPE_INDICES_TYPE +COGL_TYPE_MATERIAL_ALPHA_FUNC +COGL_TYPE_MATERIAL_FILTER +COGL_TYPE_MATERIAL_LAYER_TYPE +COGL_TYPE_PIXEL_FORMAT +COGL_TYPE_READ_PIXELS_FLAGS +COGL_TYPE_SHADER_TYPE +COGL_TYPE_TEXTURE_FLAGS +COGL_TYPE_VERTICES_MODE + + +COGL_DRIVER_ERROR +CoglDriverError +cogl_attribute_type_get_type +cogl_buffer_bit_get_type +cogl_buffer_target_get_type +cogl_debug_flags_get_type +cogl_driver_error_get_type +cogl_feature_flags_get_type +cogl_fixed_get_type +cogl_fog_mode_get_type +cogl_handle_get_type +cogl_indices_type_get_type +cogl_material_alpha_func_get_type +cogl_material_filter_get_type +cogl_material_layer_type_get_type +cogl_pixel_format_get_type +cogl_read_pixels_flags_get_type +cogl_shader_type_get_type +cogl_texture_flags_get_type +cogl_vertices_mode_get_type +COGL_AFIRST_BIT +COGL_A_BIT +COGL_BGR_BIT +COGL_PREMULT_BIT +
+ +
+cogl-clipping +Clipping +cogl_clip_push_rectangle +cogl_clip_push_window_rectangle +cogl_clip_push_from_path +cogl_clip_push_from_path_preserve +cogl_clip_pop +
+ +
+cogl-primitives +Primitives +cogl_rectangle +cogl_rectangles +cogl_rectangle_with_texture_coords +cogl_rectangles_with_texture_coords +cogl_rectangle_with_multitexture_coords +cogl_polygon +
+ +
+cogl-paths +Path Primitives +cogl_is_path +cogl_path_new +cogl_get_path +cogl_set_path +cogl_path_copy +cogl_path_move_to +cogl_path_close +cogl_path_line_to +cogl_path_curve_to +cogl_path_arc +cogl_path_rel_move_to +cogl_path_rel_line_to +cogl_path_rel_curve_to +cogl_path_line +cogl_path_polyline +cogl_path_polygon +cogl_path_rectangle +cogl_path_round_rectangle +cogl_path_ellipse + + +CoglPathFillRule +cogl_path_set_fill_rule +cogl_path_get_fill_rule +cogl_path_fill +cogl_path_fill_preserve +cogl_path_stroke +cogl_path_stroke_preserve +
+ +
+cogl-bitmap +Bitmaps +CoglBitmap +cogl_bitmap_new_from_file +cogl_bitmap_get_size_from_file +cogl_is_bitmap +CoglBitmapError +COGL_BITMAP_ERROR + +cogl_bitmap_error_get_type +cogl_bitmap_error_quark +
+ +
+cogl-texture +Textures +CoglTextureVertex +CoglTextureFlags +cogl_texture_new_with_size +cogl_texture_new_from_file +cogl_texture_new_from_data +cogl_texture_new_from_foreign +cogl_texture_new_from_bitmap +cogl_texture_new_from_sub_texture +cogl_is_texture + + +cogl_texture_get_width +cogl_texture_get_height +cogl_texture_get_format +cogl_texture_get_rowstride +cogl_texture_get_max_waste +cogl_texture_is_sliced +cogl_texture_get_gl_texture +cogl_texture_get_data +cogl_texture_set_region + + +COGL_TEXTURE_MAX_WASTE +
+ +
+cogl-texture-2d +2D textures +CoglTexture2D +cogl_is_texture_2d +cogl_texture_2d_new_with_size +cogl_texture_2d_new_from_data +cogl_texture_2d_gl_new_from_foreign +
+ +
+cogl-texture-3d +3D textures +cogl_texture_3d_new_with_size +cogl_texture_3d_new_from_data +cogl_is_texture_3d +
+ +
+cogl-shaders +Shaders and Programmable Pipeline +CoglShaderType +cogl_create_shader +cogl_is_shader +cogl_shader_source +cogl_shader_compile +cogl_shader_get_info_log +cogl_shader_get_type +cogl_shader_is_compiled + + +cogl_create_program +cogl_is_program +cogl_program_attach_shader +cogl_program_link +cogl_program_get_uniform_location +cogl_program_set_uniform_1f +cogl_program_set_uniform_1i +cogl_program_set_uniform_float +cogl_program_set_uniform_int +cogl_program_set_uniform_matrix +
+ +
+cogl-offscreen +Offscreen Buffers +cogl_offscreen_new_with_texture +cogl_offscreen_new_to_texture +cogl_is_offscreen +cogl_set_framebuffer +cogl_push_framebuffer +cogl_pop_framebuffer +cogl_set_draw_buffer +cogl_pop_draw_buffer +cogl_push_draw_buffer +
+ +
+cogl-fixed +Fixed Point API +CoglFixed +COGL_FIXED_BITS +COGL_FIXED_Q +COGL_FIXED_MAX +COGL_FIXED_MIN + + +COGL_FIXED_FROM_FLOAT +COGL_FIXED_TO_FLOAT +COGL_FIXED_FROM_INT +COGL_FIXED_TO_INT +COGL_FIXED_FROM_DOUBLE +COGL_FIXED_TO_DOUBLE +COGL_FLOAT_TO_INT +COGL_FLOAT_TO_UINT + + +COGL_FIXED_EPSILON +COGL_FIXED_1 +COGL_FIXED_0_5 +COGL_FIXED_30 +COGL_FIXED_45 +COGL_FIXED_60 +COGL_FIXED_90 +COGL_FIXED_120 +COGL_FIXED_180 +COGL_FIXED_240 +COGL_FIXED_255 +COGL_FIXED_270 +COGL_FIXED_360 + + +COGL_FIXED_MUL +COGL_FIXED_DIV +COGL_FIXED_MUL_DIV +COGL_FIXED_FAST_DIV +COGL_FIXED_FAST_MUL +COGL_FIXED_FRACTION +COGL_FIXED_FLOOR +COGL_FIXED_CEIL + + +COGL_FIXED_2_PI +COGL_FIXED_PI +COGL_FIXED_PI_2 +COGL_FIXED_PI_4 +COGL_RADIANS_TO_DEGREES + + +COGL_SQRTI_ARG_10_PERCENT +COGL_SQRTI_ARG_5_PERCENT +COGL_SQRTI_ARG_MAX +cogl_sqrti + + +cogl_fixed_atan2 +cogl_fixed_atan +cogl_fixed_cos +cogl_fixed_log2 +cogl_fixed_pow +cogl_fixed_pow2 +cogl_fixed_sin +cogl_fixed_sqrt +cogl_fixed_tan +cogl_fixed_div +cogl_fixed_mul +cogl_fixed_mul_div + + +CoglAngle +COGL_ANGLE_FROM_DEG +COGL_ANGLE_FROM_DEGX +COGL_ANGLE_TO_DEG +COGL_ANGLE_TO_DEGX +cogl_angle_cos +cogl_angle_sin +cogl_angle_tan + + +cogl_double_to_fixed +cogl_double_to_int +cogl_double_to_uint +
+ +
+cogl-color +Color Type +CoglColor +cogl_color_new +cogl_color_copy +cogl_color_free +cogl_color_init_from_4f +cogl_color_init_from_4fv +cogl_color_init_from_4ub +cogl_color_set_from_4ub +cogl_color_set_from_4f + + +cogl_color_get_red +cogl_color_get_green +cogl_color_get_blue +cogl_color_get_alpha + + +cogl_color_get_red_byte +cogl_color_get_green_byte +cogl_color_get_blue_byte +cogl_color_get_alpha_byte + + +cogl_color_get_red_float +cogl_color_get_green_float +cogl_color_get_blue_float +cogl_color_get_alpha_float + + +cogl_color_set_red +cogl_color_set_green +cogl_color_set_blue +cogl_color_set_alpha + + +cogl_color_set_red_byte +cogl_color_set_green_byte +cogl_color_set_blue_byte +cogl_color_set_alpha_byte + + +cogl_color_set_red_float +cogl_color_set_green_float +cogl_color_set_blue_float +cogl_color_set_alpha_float + + +cogl_color_premultiply +cogl_color_unpremultiply +cogl_color_equal + + +cogl_color_init_from_hsl +cogl_color_to_hsl +
+ +
+cogl-vertex-buffer +Vertex Buffers +cogl_vertex_buffer_new +cogl_vertex_buffer_get_n_vertices +cogl_vertex_buffer_add +cogl_vertex_buffer_delete +cogl_vertex_buffer_submit +cogl_vertex_buffer_disable +cogl_vertex_buffer_enable +CoglVerticesMode +cogl_vertex_buffer_draw +cogl_is_vertex_buffer + + +CoglIndicesType +cogl_vertex_buffer_indices_new +cogl_vertex_buffer_draw_elements +cogl_vertex_buffer_indices_get_for_quads +cogl_is_vertex_buffer_indices + + +cogl_vertex_buffer_indices_get_type +
+ +
+cogl-matrix +Matrices +CoglMatrix +cogl_matrix_init_identity +cogl_matrix_copy +cogl_matrix_equal +cogl_matrix_free +cogl_matrix_frustum +cogl_matrix_ortho +cogl_matrix_perspective +cogl_matrix_multiply +cogl_matrix_rotate +cogl_matrix_translate +cogl_matrix_scale +cogl_matrix_transpose +cogl_matrix_init_from_array +cogl_matrix_get_array +cogl_matrix_get_inverse +cogl_matrix_transform_point +cogl_matrix_project_points +cogl_matrix_transform_points +cogl_matrix_is_identity +
+ +
+cogl-material +Materials +CoglMaterial +CoglMaterialLayer +CoglMaterialLayerCallback +cogl_material_new +cogl_material_copy +cogl_is_material +cogl_material_set_color +cogl_material_set_color4ub +cogl_material_set_color4f +cogl_material_get_color +cogl_material_set_ambient +cogl_material_get_ambient +cogl_material_set_diffuse +cogl_material_get_diffuse +cogl_material_set_ambient_and_diffuse +cogl_material_set_emission +cogl_material_get_emission +cogl_material_set_specular +cogl_material_get_specular +cogl_material_set_shininess +cogl_material_get_shininess +CoglMaterialAlphaFunc +cogl_material_set_alpha_test_function +COGL_BLEND_STRING_ERROR +CoglBlendStringError +cogl_material_set_blend +cogl_material_set_blend_constant +cogl_material_set_point_size +cogl_material_get_point_size +cogl_material_set_layer +cogl_material_remove_layer +cogl_material_set_layer_combine +cogl_material_set_layer_combine_constant +cogl_material_set_layer_matrix +cogl_material_set_layer_point_sprite_coords_enabled +cogl_material_get_layer_point_sprite_coords_enabled +cogl_material_get_n_layers +CoglMaterialFilter +cogl_material_set_layer_filters +CoglMaterialLayerType +cogl_material_layer_get_type +cogl_material_layer_get_texture +cogl_material_layer_get_min_filter +cogl_material_layer_get_mag_filter +CoglMaterialWrapMode +cogl_material_set_layer_wrap_mode +cogl_material_set_layer_wrap_mode_s +cogl_material_set_layer_wrap_mode_t +cogl_material_set_layer_wrap_mode_p +cogl_material_get_layer_wrap_mode_s +cogl_material_get_layer_wrap_mode_t +cogl_material_get_layer_wrap_mode_p +cogl_material_wrap_mode_get_type +cogl_material_set_user_program +cogl_material_get_user_program +cogl_material_foreach_layer + + +cogl_blend_string_error_get_type +cogl_blend_string_error_quark +
+ +
+cogl-depth-state +CoglDepthState +cogl_depth_state_init +cogl_depth_state_set_test_enabled +cogl_depth_state_get_test_enabled +cogl_depth_state_set_test_function +cogl_depth_state_get_test_function +cogl_depth_state_set_writing_enabled +cogl_depth_state_get_writing_enabled +cogl_depth_state_set_range +cogl_depth_state_get_range +
+ +
+cogl-buffer +Buffers +cogl_is_buffer +cogl_buffer_get_size +CoglBufferUsageHint +cogl_buffer_set_usage_hint +cogl_buffer_get_usage_hint +CoglBufferUpdateHint +cogl_buffer_set_update_hint +cogl_buffer_get_update_hint +CoglBufferAccess +cogl_buffer_map +cogl_buffer_unmap +cogl_buffer_set_data + + +cogl_pixel_buffer_new +cogl_is_pixel_buffer + + +cogl_buffer_access_get_type +cogl_buffer_update_hint_get_type +cogl_buffer_usage_hint_get_type +
+ +
+cogl-vector +Vectors +cogl_vector3_init +cogl_vector3_init_zero +cogl_vector3_equal +cogl_vector3_equal_with_epsilon +cogl_vector3_copy +cogl_vector3_free +cogl_vector3_invert +cogl_vector3_add +cogl_vector3_subtract +cogl_vector3_multiply_scalar +cogl_vector3_divide_scalar +cogl_vector3_normalize +cogl_vector3_magnitude +cogl_vector3_cross_product +cogl_vector3_dot_product +cogl_vector3_distance +
+ +
+cogl-gtype +GType Integration API +cogl_gtype_matrix_get_type +
+ +
+cogl-deprecated +General API (Deprecated) +cogl_check_extension +cogl_viewport + +cogl_get_bitmasks + +cogl_set_depth_test_enabled +cogl_get_depth_test_enabled +
+ +
+cogl-clipping-deprecated +Clipping (Deprecated) +cogl_clip_push +cogl_clip_push_window_rect +cogl_clip_ensure +cogl_clip_stack_save +cogl_clip_stack_restore +
+ +
+cogl-texture-deprecated +Textures (Deprecated) +cogl_texture_ref +cogl_texture_unref +
+ +
+cogl-material-deprecated +Materials (Deprecated) +cogl_material_ref +cogl_material_unref +cogl_material_get_layers +
+ +
+cogl-vertex-buffer-deprecated +Vertex Buffers (Deprecated) +cogl_vertex_buffer_ref +cogl_vertex_buffer_unref +
+ +
+cogl-shaders-deprecated +Shaders and Programmable Pipeline (Deprecated) +cogl_shader_ref +cogl_shader_unref + + +cogl_program_ref +cogl_program_unref +cogl_program_use +cogl_program_uniform_1f +cogl_program_uniform_1i +cogl_program_uniform_float +cogl_program_uniform_int +cogl_program_uniform_matrix +
+ +
+cogl-offscreen-deprecated +Offscreen Buffers (Deprecated) +cogl_offscreen_ref +cogl_offscreen_unref +
+ +
+cogl-euler +Eulers (Rotations) +CoglEuler +cogl_euler_init +cogl_euler_init_from_matrix +cogl_euler_init_from_quaternion +cogl_euler_equal +cogl_euler_copy +cogl_euler_free +
+ +
+cogl-quaternion +Quaternions (Rotations) +CoglQuaternion +cogl_quaternion_init_identity +cogl_quaternion_init +cogl_quaternion_init_from_angle_vector +cogl_quaternion_init_from_array +cogl_quaternion_init_from_x_rotation +cogl_quaternion_init_from_y_rotation +cogl_quaternion_init_from_z_rotation +cogl_quaternion_equal +cogl_quaternion_copy +cogl_quaternion_free +cogl_quaternion_get_rotation_angle +cogl_quaternion_get_rotation_axis +cogl_quaternion_normalize +cogl_quaternion_dot_product +cogl_quaternion_invert +cogl_quaternion_multiply +cogl_quaternion_pow +cogl_quaternion_slerp +cogl_quaternion_nlerp +cogl_quaternion_squad +cogl_get_static_identity_quaternion +cogl_get_static_zero_quaternion +
diff --git a/doc/reference/cogl/cogl_ortho.png b/doc/reference/cogl/cogl_ortho.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2a1fd20be98e26e1ef6f3eb2bc664970f5fc62 GIT binary patch literal 12650 zcmb_@cRbbq`}g}CP6p2^64 z`FzLk`+5An_x;y>9uJkH^Ios(^}L?r5~Oll?kqkvK7t@;735{r5Co+SUm|#DcqjM$ zwi*0|a#oX*LGr)RF2FZu9OQMK5#-#xlP^@3ROSPC^YlZ7TQ^P*W2jN0JPyyvrV)ez zQIM6^a2sAp^3W$8C~Fa7oI2{mx*Ld~OWp9P<{R72OKHk$kS(ivmRWibl|8-@QtF$z zc>a7y)-Nr+g9!9p4Hdfcxmam3D{24I8FFdPE7F1TgaO2USQ)3|Sm&))Htf%)US6j(@b5nrO~2ql7K!KJ0bjrgA29w&VL&l{8V_4P;vITEGl z<5PDx7ptd7Gs=Rfa3&=sUB7;PF&BL&MKUk}7g02GbK7f;WP^8BR#qG$5$uq-$FA}% zP2ctzk|5cN>qx4`*RNkiMMe8GFv(Irb`}<=h0Y*R!C_%%6FRhv$lX>-2PRojzG~eA z1C&9sRypV^hSeVm3;p2WZKqmd5#e0qS!0}tGwUcLq9SNgsB=pb%Ru~6p5^4&Rh+!y z;)La=5&m2`-z_}}+MNf9{DOkxwO%9j^}dSfqQb)18RQ`@Gjm#Pt)#lTdZ{%*mT)j* z((Q9ZMBm!lL?6z-Oi3|PP&lJOgq8bHQu5QOa&eGZ#Y``?uC6XCYyQvCfsp+;*X7I1 zk*yxP%c@@Yaghwn<;%INt9AzTly3Xm50sTdD=S50zI1nQ6n9GAFCLPRkWi6A4C+69 zLKl=F=Z(&E_4caAQI5M!pB);DCc@D}97KMDg+Q5j{(DvGp4tH`H(DWR=s@ z{QivITb=o+(! zINcJS5Emy6_bP{Z?BVhKHfGQBPe~Tm$!T+QrhTp>;j{owm!zVSQsk>w@bli@UZZL^ zMhQC;6Ex>KeNj=-7t?FeiqXT!&Z#a|3N9Uoqy3%DO(!KKrJ?l4H*el_yFvfiS$}e- zJ?8f9+c^)r;2%B*E9E;&12Hi%N-VGX`}b2KOM7^DV6na-Aq2v* z)1xv>5ijVaYTdVHH#avUjsx?{F+2tzw`XFE%q=XQ1)RL{45|dLUF(^cpwFowd!s@{ zP2D!*goA@~j#k)Vy7}yS(9Mb)JVo>Vr_ae;zkVl4^pY#JU9U6Cp5tO)_S2`Q&ZG)@ zZgmLJd#4jZiIZ)t5-!1Q!+LK?d=4NQE_o+>{Ol0^=myV-@cXkSYsP{}8(EclpFVxEvbNUc(vp$+ zg8NjH@Awwz`*?x4q`lFnI17F50#j1*7C{Hm-KhY ziGyT&zRSY7bi$Pmx}siM4Js=R$(N%2j6Y_$`Rhgb!3)dqQoZDX7HY__E%XAPR=)n3 zj?D+Sdd?hTBY9O-2{Lbd^-7w#Pn|mD<>jTWjS`nT&G_lr-Kp8x*~P`XMn+e>ew3D% z_geBhg!ET5b#)QPkWIPe_y#wIp$b^8T`NjWMXIheH8t_@@N{9-eac}SP5f}+ft9FW zsHv$1Z3gR23ds^1r#D_jM*dnEc~)?*?r^ic|GgeLWmtphweX8#WscL$^xk{Yy^pxr z+2_}Mjy*Iq`hIWCT`~9=6(5hU%kq7KTZ6MSJ3HuR+QQOO?oG^kqF9CZ(c>mI-ng&6 zzP|naT9~=0*ROeWi%h@gXx>la6&4m&ZH!MyI7cTwKRLO+w{gG8LQ7lwSzw?7%PYNd zI}uUQ@e0TLBu&{gP&{E_VJ3xC=4Y*f_1wghRoFde9&BuE{8}ATFR1h{NNk*3Sb$2t zwGa@dy0NvTe&{syvo(@b;A>Np*+NhHv# z6B9>N@#xvpr%wq92~EQvy1H7Jn@hTHn!*Nsc8=b#(rL!$Xuu~uJ-w;9`CGgIffySf zUu2WXnZQqf{`{#sTCsop_;GD*?Vy~E;K7#&=8lezk#hT%j60d{-qA{W#wxSQ$;llY z9NaO}*Jg@%mzgOfAn?7v|67Wb58QBRY3YLp4*=P3+_=F-ahaF*LwY)<;0J+~l~_o`#KhRx*iQLR{rvfGYqsO);MaY&!@cQncXxN~e0^y= z+wp1il-r+Xc4v|PAwp~_`tb8D;k!-v?epNdViB2J%2M#NZI zXJO?-D6h;qRT}vm2?WaAGh;0EyAA7oodL*Tg2_Vvwr#VW!IJA zz@6IFiMo`iC>9Au35lbcU*nBsG2D7u`uf!mdRc8KV&dY4D2+V*Y~kzzf`TTC45w2% zuW)l;Y-c%r`n0|MT13l`jUY4$Lc+YfJXyTT%1SdcGpK6mLlbNzFB=*fq>c~O{WQ~Zu$r3DZ{FN9 zGNLb|Atw(sF2YHTF0cGu8WdNyEx4x*w>19Z+*CI?BnI>Y3Osbla<9TnNsI4^(j6+9v(ny zDnr0a74|3rx1J`HFFpfF(BgLr*!Zt#DA_qUV8N7G`M9}nv5)|AWTvMx2JjeGe=#pU zFSEP5%fZ31R(Jg835H;{BVlfJ_0O2=MD**|uVZ3_`1$oKozjbo`2+;W86VEHMepvq z@JF;p7k$vl3k@X<=&E#{17d-P`)R1y;^M`Nb^D9CH$o`POig8FWgUbQ-@Rj@2#JRN zl#&uY_~R{pwI=d{1QVAlRxS4U@icbABe5I#rBcH7j# z;xdt5|Hz0nJdvHC36sLT?ld_Tl2+Kjm?jjmdbqz-aDrO_-VfVW&MQCEpWIy;fdbK4 zMWDMs*qVwCN#6+Gy3Rm6`z`69t(TuEk2p1fii#?0%+v1-X6k&9EIB#3UYX6tuV3Y5 zWwRS@gFMwGrxEgS0_Bl}PXJ;+e*DPQF8H%MVh?*C_EJb#SfHB@!u!S%^+qM@CMWM= z9%GX+&W^(slyQ$ON`IW}$L|-&sU8%T)C1S;8+A|AWHqq5)VwmJ`Zf-7Yx(@72oJK* z+V`@#xfvjUhKfohTLa47;klqR192)hQjHc(qNAlvjE;UZ-^C~;Rrl%@$@-aXJS^tn zbHI|fZ{HsLTAQeLFV4#&)blwLl7YoUWuYT=)bZG(p+7Z${%owyOMCI6)WI^JV8U2$ zFHW)_onKKihE>#+SVd5WlZS)P;#)~sSy@pLy3#6Q_E2TSk&iOZdX>CPmTgKr}UhDE7iM;3LMzv{}#a&of z*b+|P@y8Jo zAhDx{dOnq#Y-(l}(Q3*W9lWyn+jBk0d}?7qA+r~F^0UT>gkLupi2L&8c)4v+g*u5T zDS#<`Jw0fFn=jg9uJBP2iiuSLO*-Z82*AHJ*XggvpF8|DSz_edw|uytqN2?t*YOB- zlzwup+b*7l6b}O#KJe#CeLG|0N!X-zqZOzfy|#3vm|7^N<>lp|j!HpMS6(KmLV^sw%N(jed!vz8TsH zz zK&Xk${rl5%bD7hey!V?41qx-=bHX?qZk?c6@CbS^UgW{5bAXDgt5Befsu1PK@UUWU zKGORFj;Q&zq4??O=%~Jd!P3%Fdhq!8`0ccAxGhml+l+CJu4Ucp5fKp>3?`N`I3&bC zU;l&{!PU=OF(+^wM6)d|EZp*PEIbuXz!31{$rEZCnzXlX#l^*ggM-!7)ft;nAx$4W ze_sod9jyr)sj^=I6X1a{hy_yIkKissCkkC%Jox|o& z1@fpO&)-hk+5;T%nbhi;l#lWSDJUqWZIZK+@UfmKOsFWghJrHFd?Xx_pFCD{QGf?2 zeA>)(>C(*lRHNxN;5@?<6Dc>-W@cuN{v51%N~Xv%t&G<|?GiEejg2M6#fk9q%ciT5 zl90HGkF%wC7Fm7IX(ituv9C)KcUNO4vl}V9C3^g@&&jNVhK}yrw{Ncn9`)G+{RQ|O z7#KJ{m^gkB9$o-Nfsa32W;+r_BLpS%T=qwU|LL)@v8n#cG_Vb6S&61f@vQ*gq3k{w z+Hy%AA8tKb>c2Olpr9b;vRq$w!rG>%dxwTNBINN22sp?T<>kMuj#YK0NQIk`?(Ym3 zvEA*D7qHIKScE+V!lLBif*KoJW|iw2C%g7H@u8K%+DE@u4XDFrmzEM@V?pbHfS8$_ zB&MWvo%$3AJ2f>mwZ0x(vA|j1+w0s{`jiwcM2?4#Z*ncpLEA7J4VRgppAYEQ@}kc3 zcMsI++IY?2>M(57e1pprA(u$bBy_kudUQ0O7S2MVU~g|fKB%Fk)s|iVElI4%#I-@!)D80i}6IJVwX>)@~vAOWNk@euJ7zhN=uvewFdj{vqlCHQ`6EOZgonL>qE=Z zbI}(4WPk78d17J*xap>u+n??-MX+~ZrCCVKT+g08YnC~WUKAvJm*hJ1TqPWM=Wc z&F=DE|N8oe<%`Fi!oA1#)0?LV+%8pACp4;KjPc(jy?OIyI}sE!;1Zp<+d4d55J|9Q zBQFDU1{%7!u+S05Czt;^^lpBlyHf_|9tCgB*Ca9RkCIM3lax%P!Ob87cjM=Yk*-!-OgFw3E{lR#JZyqgz3IywS`nLLe+K575s ziTF$r&u?eKF=7)E=H}-7uOrcZdf~`0TD^u;mg%)Do<7RbD%@9|f{-6Vwoba z7^KwXZ3FdrnST-m4BNnyR3bmdA+=j1g!gGV`ER?K@sVv zsJ}EH()U^* zbX3l*6yu4^;Ka%(ObZL=zwfqyjTN571)JL(y3$R=Snd=H*Vf!3MeWrPCsow z_E8{=wRJX>B1ksH=g)7T7oZK@#go(1FRf0as<{%u-XNN}*>(6oAiBMQ{>4_91UTU$KFA)Okqcuq{oc-%kT`hPQ0;yo6> zGlOVTapa-S!!a>6<=YS;U7Du z)UU5oQ!-3up*igcDnK}X{HWN=cLw(fh!^UxQ_(nwY0Q%XJiZC|R2ME}OUl`rnwm;W zqbR1cDk=uSK!7%=B2q6!9cJ^*@_Py9xp0o};=p-a3_ZSMT-8fxFv}R=go74{ezS|3EwWW@axbDQTu*qIo%n*BlHC zARum=*6BVZq@-|^^D-a{z>IS0ZYYU%G|$tns`StCkwfOu&}DjV7Cd`)TJo&1Eee+E zC^nW#pAZb7w$4tYn#Tg8GzcY}`c9%S2r)2AG}YDp(`!T=e|!ct=)F2B!W1EF@huUU zQeR(RVj}Iexa#{YM1EM_ZtXX4=0Wo6>gwIK2_NuZ!PRwjbXlW67^<+7;Rk*)=C$M>PL}Wh zsWsb~LQhIs3{(etyX{2n5wt9~?fLUbw_y*uxVV7-30jksduFQf+0f7sNzmuv;m3_n z&x(kM0N*eyv5Y7!-HBk9tFEcJZ(;(Lcdgro2~P|SJV+7}CJX=f?`;hX#>hHiY5o2E z!8TQ|BeLT(wy`1PMA*ZprtU$B*)$YXRUNFa^CoocZf$LCZsz3Wjh0%+ELZt&v|QYQ zx3;%!?Cf3y2g~4fB#MBxeh;?7?()z>Q3-DYyMl9R&; z4-3rmW#NqTAWG7Pd0$^>Gl!jGRe3iHnZ?V>^WBucb<2#G3Oq7>o?kzjLh!#OT8^rU z01^6^V-cPEeY#v)z!n8h0c2O0{7=M^-3NT1TCW3eJOSD&_4A8D5(KO%QabBgR^lJl ziwOz+DjhIXPd`gNM1hba4sz^dCeyccOanmffqy<$>qW!ZH!(5M*T)hepCQZ;*pd0F z4E@2S7RU#Pb2@VJrnxOj9(^4s5F?}Tu;%cR1|V*W=F0ipz9IONzpDc2P`=ExL~I-! zK}{yWf@kLDz_kVss{m{mSW^4yjZ;Cg!9hXU`S}1vf4La8PQ99|qm}B0hJS!XLy16# z>gxk7lyut%R^Y!l5nN#0zB>!1?4?VW)cNl_;o+k7HL&Me7;Cz^x*n`?pzemsvnw)U0di(p7G;)LW$4|{IF7BB}`t;c| z$B^oP`(Hj!_#8_>|BaTWuKPWka87a$OP$dJlB017TcNrhPEm1#os5;072=!FM>62Y zfnadtAm}Xf1)r011g&F!!k0~|dcKaX=iwY%`sqEFefy&_2rO%Ocvb_7{kqKTg6^m7bY-y5O_3 zaISAK^VRDoC#I+Zzf|d%vsBJk@9DKrkcqD2?sC!Zs{o|H)+y4-g8*WoYOU74Bz=;8 z#X$*d*1LBh8KQ}hFDWml|LtGrJoh3cg+U4I zLrB!|@08;>#cvp02ckqvbMyXzfoDowB^x+#?F~|*^AxmA1apq4YjIzv98#a6d{=Yo ztqW?J&5NgqP`;=9itzy)0Mwr7p|IK8zkW>*u01V75KFp~5U#jbU7Z}vJhz%gT*R0w zK;{iRjQAYnBC5C{d4c|h!!G`|-{YGChp!ZoC!4EoIn7MVgYRJjF4tA$>@@1KRL(o)a zHffa9o2X&#Ohx*hIq6x99M z2W16uA*W<!9MHrkXrAD0Yw4dHgB=6hP&M4>A8AtqrI@HFF1jHgU!-~|RQNM$g@CV z0`@JKxX?X-H$z1H`ZYzhA}(T};rH>QsAv*TggkgyKo-H4g<6JBdHf>2qO#KNN7 zUB)c;!p*~@<@0B8pFf@(KboM;0K#Yd)w>&vyDUp2Ja!oZUUTU_(GEgVLpXgOt^Fei zfQ|X=BII}OYHB29Ny*87#y!^VjkLe!zRbfjUh*Ikf?F3z-!sJ+dZS}wlVe@`7C%u-iV8}~Ur z!Vpk=O%UoF8#{tc-T09cE*f|%+?`D@-L8}kSp5` zw58w?Zr+hPf@C>p#oWy7JYE1~58V0{>yXS{*2+`aIClBJMd%!0Up%gSs+E)CodW*p=aPqG0U+6|l9o=Hus2gmH<*@44jF9Jq)jLDqRE z(nmL+WY4dyV%~mQypEl6A+&(%wBtDZclSeK}aUJtn#_SqpKxu-0; zKhJUkwCHX*)Xu)h=g*%lvlc+tfzJcH-t?M#%ZrO>zxwv}+=>ceLBal(mX@9#l9LGm zceo8u_>dt7$-V_mKe~#9C2ymYOa0baf zktl4r0|;YoJ}Y(n`wjpK*S_WL+us&?Gr=PQA##V|WJmm`NV?8K5)u-Usm6p%qGjm= z=hKiZ-{x!F-EuQjk5qAF=>dW?hHJDPx4R=kHBiqb@qO{L2-==YiqgTYrs`Tc(~!dh z@!c)QoZR~SLp=n(MR?{PY-Ewcr;(Ml^X&hOvcPG;WBg~Bbya*F-$(whFiR|%Z{utQ z9t;j0qfS1%jrZ4)s$qtRH-G$c#XtIc*MrHGKDT>?I^aaGM#uv|;o2iG^1!S?k)I2_ zLO`Gtgb?Sfw8K^41wQL%2gvE^Cx(Yb7v)Y27FjZ4ku8P_DumOQPyGzBASXyJkR^F{ z*hE{w&>ek`LG-&OpWjbAh1cHR4)IWDM+Y|t$Hw+HKObKsI`S$NApt?i6-ej~e{Vs{ zyWgaEg`M3E5{_2W&8!sIdVt!xckhCrF*h|mN#>iHFb9^Vl}@uqo9$Po3(KINgOXWT zSb$VV%58lT8tre-KVW@(O*e;~*osi`JL~II?czu*3(2in;0Q+Lc1aI~I5-|au?+4) z4MJKfDketocgOlpy4porTJNKs0o5y1baaMBMp9ai*8O>J)Ur<#(N;WM=;=vUN=i&z z9j_77s$}k<2``2Dk@Rj$V6m|Em07p?vem)Kf}R87CMzcgA6|rnQ3#T68IBK4yW-== z@j4&+5ib~QNk|xh9t?)qe|4%q^uj36mgye&^vRHwkG;>zda3RQcB09MI9(^q7V-0I zNLPYz{C_#tr4;p)EAHw#;IQ%X8pAZt3WUOH>`}1f3;}RCKnx4(O(7%q_V!k0B^A5H zlS&od0-ovu3^lnlnG}YHhud(Rc!*B}18-ol_2B-JM~R78!+zq|5P_MTF#&%5&;2Sm z$P0E=OukW_Bxu~nJByGv0Ik-{)#BKZn%Z!~V|-8|6+j%POebIz>+jzPgeHCN%PBHz zTidZBvvy&=JXrAyR8*mLqpi9G2=(C$u=*o!XGY4i5IviooJ?Il{uw4Tj>Xf|)Kmxu zkygnj()>?P+wh;B_Fg-9+DK{xC$Gn@4Mcws9JIByoiO_gH@-YwdJJ;lqCn7|%h0ON;(j4V&5@KbZMdF!i7&|m=Qwz|4hoSd92E$3fdQX-al zC<<@`%twxaI8ogF8o)FFbsqtzw>s=#AUVMMV7enYG0_uZUU0P~Bx(xVq6Na0S;Jd~ zJ$|iTVq=37iv9ID{c5+uckfJrTz*Rwp(UDwtOCS3Y#aO9-x&`B&`8F<*e6%B4ag@y ztRJYA*-v;c4_=+&UZ%g0pPQZ@*f|HrHx0}H$@Lc)*;`wCK&AyV3Y8TV%9qN*P0LPE-U zHC2HV1pWuu(1ns`iHIa0Es{~YK2b3;GOF-FQtxpZ+u7CH3>6hh!l2!g0~8Yf9$lbZ z4Zg0=?AHqpqDU6G+c$>()z1lB6iYtGzkCWkGZDnruNxXX;E`W2sXfuzv)SgM#37Q3 zY26tn$!&QU--QPdP=b)xNc7M)+Yo2`tG~U-5>93VbT1)+Mu0kL1WDNK?hPDhcF!eq zj-YvD<>duHFOjAHPUR3JDN15fRzwEP!;*eD4P7BipF~XTMds^@yNEgI5e9!X7DQdn ze}atZk}SPfpsCEZDwd`}WIt=s4-S*M#K}v?OYR$pMN$K&(bKpmEoU_cLWQ@z3y^uh zEEyE8Lmdh$=YfkL^N+*-sSKNCr!9#2;=Y1?3tQ_KG)`EHCJNAwsh2rb)YVVSJ&<)U z8o{ks1~I$G+w%5BmQTO440|{e&DrDD~O7rI#<8Q8=lya12z9?M{?bblVwtXrqtRh;uGt}CP>!A*0$ze<5N&vfSOnCmV6l=-UliP>GsvDSAn6zkmuEy_9GZp zfeA7h8JVA7!OHB`umK_N=Xh0I9P)HN*H!(1m;dq`%fP(+o8`EKQ(5u_I5W&Y!Q~I; z*VIUq^-XkkLVG9%^#sy{k>7dtYe`87sBdt;dKb1q7q+!22E0s2(9_a_nXAz(^H4J! zP`Hypg@umb_gYxYl}~twNZ6!@tV8fp*+@ERU2Il$G@l568F9 zaE@3Pn|J)!`VH}}9@y0`EHJg!6igl+9i79EgE&a*+T+8O59H~B$E&8Rn=O8Z7(Y-4 z?*q)iFaahOqZdHB#L(sV*Vq&oTs_bMh9+j@IuLI0Qw6wRije8&1y1M=X`zgD) zcngXJxCEr^me$tRR#taQEYDL=+N=zhUNNeTl4sH9aea3IT<+;Y6jH)+SwTkT34c;E zMC~v)_}cF}<~T@&-NxFwQO4Ctn3nu-92`D+Nl%zZ7OsJZO>K55qNCY;dtMdD7?>fT zn%Ec^>Q968yF%%;4NSyW3?JzoVpfrW*=qpZ zQ*XmL(Ey}f%qm8IG47A}U#>RIr#Z>baa;#cqk+92YXY?2nA7*<$DFCs%9r-%1AOPx zd|$u06xUujpLXWVnVd7rjA4?T60Z^xV2^3q02bk6;nVdvXTzeN+HZFko_v5OHB-QO z4Mv6Jxc9|-zj%gEcwC)Mi7M?w`KEXjGz1;f|(dd literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/fill-rule-even-odd.png b/doc/reference/cogl/fill-rule-even-odd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e4fbb0f2a2dc04953609dfb942f48db046e46c1 GIT binary patch literal 3121 zcmb7Gc|4Tc8-HiPkU=SBWEr`%a7}j*VGOcWqTHJrVPu&ZvX1OiV~I~mDUxN<$dbB7 zY6c;Dv@k<B)-w{bp(ui5|AX7016?3|7KF+7 z{)6924RwRCvIx%l7ZxdEs+W51pL)Ga>ZqSNtOtk<3rIl=zU!LnJ=qC;g%$K#*tud|YePErg3$5j8yC zGrwz&n`NK{4gx|=rw_cq;p{9sTk&#zN^R?587+7{-wtr5!qqd?ME zD(?zWlYuUX)qixAZg9ULYSiAC>Y;lQA#^wJc_r=lHwEr{pwj)2CJfj;IhP(2ST@ZW+c}uA*N*xm($z?(scfC=>~+5`;W9p zR%aLW2UCGSVTsejsnkuH78M3$4To%C!XrbhFgZ7M@*#BkiluF|b_pT3G2UTm^{JmY z{_oaPX3r~>5ClmWcy0gI%J1)q3)=$#teQLD1!3JsZ$xHiY_5-DP*fZo3q)b8zsb2( zyZN+#_$uAEP-+e?!tMQonAF#Y zOESX9L#X=e6C0lTB#hYtyGOOQCutR#T zhqc~SRqqJnzRg`adVjX=ik{$l?o4yclBud^ZQ2>3IJE!4y`Aj|>}Rhoq^Awnq-rwq zaP2l7iwFBmt~!4zT2@gBxz1{-d~c`Ae-oe#>IIiMMZ>ikXokGrz}`t6bMa&y!3}cn z+ZkHYh&U92+?Fcja|S^FNZyg~;C^QGPoDH1jG|@Uyd?CzK-#v5!=})-q-JQo zz&-s;`^Wav*i^O4qIuTpE*B*ZHmrMg>AP~9d+WP1O*26&U$^3(TJWn`8rw5v7dl=I zjE@c4Cx-w-`tgARZGvrdIQOO_5%=0y)w2z@uiy@nWDTvj!rqIX8xk9|hy^KK1#Qys zUn@+mBu}87kICOiVt1kaXNE(5jz$VSXFZ7JCRF7YgzWiah6i?Zt>E6`_hM9q6Kkux zqETMxIew6j#@LT4(&p%!^@X+F_42~z7zEkfl0W0zhCoHfu`)D)a}#}wm4o|`X1@@tUjpFo`K#8#+TnEDL2OiKQ1dZl^lf9XHpW!-ne2~#Q`{n_^Gnu zq1~=krS?xZ5f}|HlzGdbseq!&S4}BONATGjDZvmh8fNx2y&f5DDOCj0saW`^1wZC4 zNpoBR?tD^nI*pgFyNQznHOO%+?Xv_GpZsrtlm&;Rp?>9fJpVe^dqLq#$c{zbI z?lC)DnL}B=1vg00!yC$X#wnlaPe?N=Fx7pjO9cX}wvP2T7<@+UKb4>-$CK;ae-?N< zj4#ut^UW=7*`4$tg|xecB!sV#?t@U4;;byi8k)c+2hdcAksYs$a8r~H~~yZ&1-_p(`2(|BGvf}~b}X6jR!sz?JWhFwPg8OU3`CDtp3Ikq)EYK+*_ zM0!}0q)}km;3B(Xw#aH!zgr02el!xo62LY_?=+VxinJ`Zcp98nneSe!hkWSS33Aoh zB17;uc5Le)41MSmWhd45(nzp@uv+LbF|>kazderfYB{G4b)wu>c!!xSaB`gh~)yLmi>&rIsdx5{!82y-ieu_K9n(Xo30 zT$fIS+O>BhChWp0{Q@h5FPK|{7z!U+1ll$jmn6=sjy{o4iZ{k3v2fdqSOA#r^-5-Y zMN?N*xLp&DYqZ>-*;ovbXn9Sp-AzpYkQ{(Fz9_n23pH#$+=%+i0n0WpJ(tyg_|lhJPQ-WLfej!oL{G0EnVT3Zxq=K3fDAlzU18 zB7LdQ23%NY7&xVqvrUU*sPA)l?xZmlLe*pn!H%g%bP)?Y1$pzSnjp%N5JQIY_~DM6}bf#RywtLIa;6 zDt$W5@y05%9KFkul(6nHMC=+KU!%du+8B+`hPHy`PyDgIf$aFcx)q;}4uhH~72$b> z+cTL51{ST3)9@Q>&zGGdppCr}#iXLM7iKn|kuLNkdE#j=gZ(xep7~`g{v$-fMa5ds z+ib$3IhKYb$!IUaMCDw$;*e>X_QsVoFuRt0qpyuIU7{uKWcZY&7EN9S%Rh5muT zV_6hnKDf3-C*9QfqM#%|xD7y^>pA%Fm#X>y=oX}RUH+J{bZd|NM2l#eoz;mWr541v F{{i05cM$*p literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/fill-rule-non-zero.png b/doc/reference/cogl/fill-rule-non-zero.png new file mode 100644 index 0000000000000000000000000000000000000000..2d8ad314c4baacc70c84b83b0b83b35e6a93a01c GIT binary patch literal 3143 zcmb7Gc|25WA3w7g#$H5JmK2gKVKRlr(rarN?M#c(7=y7iqDwKD=th_OCJn~k-k2~eBOKie4q3AopYYw{`}7GJkR%6oQJc5tfnjg01B=y zPDcO$N(A3KWf0)qVVpAuJ|L7M&JF;JxAikPL0oWmb^_KUS3&*5+aL!S=Hg8O067&2 zL4a(=W{@cz;fg&ZEkLNt>uF0nrRIYyjfg|1A{;}>WI{*;;CP8}K7w#jCyEpipyTX{ z#hr{-R0katxjNY&yCRq#?#eDUR7T)t-!3=qjVbGTW1ah(=5;8qW^f?SRnvI!{zfbk z^!dL*6+iGim`*{t9ryQde}|;YBLH?)YW}$fVyiTuoE(M#bQs^ClG=~9liU_PV^jcT z9J6Nj_#Bd^Ahae{2Bc*(0w}YbdU-_vjEm<-EZ(=>4TwFt5*33U|_+*wk2V@IIPI1J9qG9&FhqYPs<{Owk(GXUHVfTU6#C3Et<%L_6=H<15vC<%!;(hsX)-ee7?~z^61JjzMu`bR_DOJ&_x1S9e^@o{fEQ_x1tt9~LkKv1r zKTgBN3Taje#m$EeVFgwTw)l!36fso${Y+)$E;>Yqv9hs~jozY!zEyv&S)Q6{8xki) z_HaYE7RpmO9k0$lPDBx(E$oQt7X*J^*u({Yjs}?k0pqkrJKO?@{?l;vrhw5w%bOJI zWk5QMYXrOZRi*IV-NnQ7>e&)3n8mEfYp!p)Xj65nc;m}h&4t(Y$G}9QC^w?UAYYC< z2+HyN?%%R}5ttdR^CPajqj?YN;K>1n1^v18(;hxAM=vX+C1?OG-iy@Cf1`-BbTuP7 zk^snGR9s{wu+iu6u>uw-Pu;>h3-!5$W7mBx&#~+_IZF#AFQN27yZ6)+m(-`NGRQFR zXG$_k`#!lFs&E?)4;;0#n%_Br{pC;0ol@?T$gFbEv9MTll{?J!9g8Un5BuK5 zp=mpM_r5DzojW|(47HzB4z)|7r`0rWSdLZisET}Xv8xo1Smv2`K?MgVF!4=SaS?Vx zJ7=DW&yA~;aZ@);OiZ|uGF|CrN88YXp=`kMM2*s!ms&dtu8A~d;9#{>v(jqT zx@`Eu-fo-5QvrT03lo_>5b{Eerw*9VhxtW%+vekB-bQH_O8+#a>*R+GfypLrQc&@E zyO7+pUzi)zIztrvn+8jdkI!UWjSC#PN>5uB`e}t^#E~e0B(2(;{Tw)T$~Ng|$=w4= zo=4R<9*TuH1W-*+UY)k}et!%s1MuE1ZOpmJL|_sWbkq<=#djpV-}!LB-U0>gEw9Q% zipcG8$$QUbfTsmB%xJl%n~@jpgjp6(_w|>Bn{ET!{maKn9#qgZ`YJ>N=pB=T9DoT7 z?FsBrb)cw>GCzjT)~iHUletkJz&!?7D5F&EYrR~T;$JNf&?@|4f{p&s$h~%W1W=Yb z%(waF!vJ5vn1TK=;QQb&^+;5|)sV2410Gq-L24B(_e8>PVBfw(h2X_4MABC>ML1WR ze%Yt!B*LNu>+@0A9k${VsLUcxh@O0)IAfmH_z~LVS9>4(P*W1Td8{k6ib$wW#_hEr z-=QRDIaR2p4joB6ulS_agFBe~u-^xmuUoA?Pj*8Sq;66X2^uZlyA9TM0(Z^=^9>KK zBOzD}tl3yAE!2n&ILY~AG=*KkI`qm<=Ht!B_t$0oF!m`yJ>ly|ZF^hasLxPz(Q9l7 zw6CeBWyQi9}G8cnU;qAB1ZjW^r zzYdxnIF!8#VXH_@qZGri%ujyHP?ORZaIEi41K* z3$ph~S8Oi~R_Q#_Ere4~kb*{3+n>NIurA_@5U>+3JbE59yL6hnw5#l^7`+Z&p5|N+ zoXK3-*exo6P{UBi4CS_PQ4p+)BpqhUo(>$DyA4t@YmyC~c<<$opfH%CQ*tH+%L0I@t}8JX!cHlY{~Nd&BjKk_IhKs>pHlj%o&TVxu7icI1xS zX69R56*6EKi2}utS450qRih*s|D5#5HpTTQYP=8`LaS5-7SjVR;!n2KD7-?~aX`P| z{=E()aDT3h66r;C~pU3x`5ag5}DUC57 z`*PaSAB2^yW1Ho$9l4>TK)*bt0Ak9?AQg#9v=WhMk%SVSgmjo_s_EdgWr+RK77dD| zo9YrVt8c! zAQJ1xg2TH%-fzZfdqs@$XA9TL4N#tHO(2d-G)-O+N9VL^ndL{4XnVylH7%U><)oRP zotJAV{$tNvJn6h9{*e y<{bqu5{34YKxrUl;;`YAegRT~^Z(xwR + + + +Cogl - a modern 3D graphics API + + + + + + + + + + + + + + + + +
+

+Cogl - a modern 3D graphics API

+
+
About Cogl
+
+General API — General purpose API +
+
+Color Type — A generic color definition +
+
+Textures — Functions for creating and manipulating textures +
+
+Material Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions. +
+
+Materials — Fuctions for creating and manipulating materials +
+
+Primitives — Functions that draw various primitive 3D shapes +
+
+Path Primitives +
+
+Clipping — Fuctions for manipulating a stack of clipping regions +
+
+Vertex Buffers — An API for submitting extensible arrays of vertex + attributes to be mapped into the GPU for fast drawing. +
+
+Matrices — Functions for initializing and manipulating 4x4 matrices +
+
+Shaders and Programmable Pipeline — Fuctions for accessing the programmable GL pipeline +
+
+Offscreen Buffers — Functions for creating and manipulating offscreen + framebuffers. +
+
+Bitmaps — Functions for loading images +
+
+Fixed Point API — Fixed Point API +
+
+GType Integration API +
+
+
+

+About Cogl

+

Cogl is a modern 3D graphics API with associated utility + APIs designed to expose the features of 3D graphics hardware + using a more object oriented design than OpenGL. The library has + primarily been driven by the practical needs of Clutter but it + is not tied to any one toolkit or even constrained to developing + UI toolkits.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ch02.html b/doc/reference/cogl/html/ch02.html new file mode 100644 index 0000000..4c4d148 --- /dev/null +++ b/doc/reference/cogl/html/ch02.html @@ -0,0 +1,59 @@ + + + + +Cogl experimental API + + + + + + + + + + + + + + + + +
+

+Cogl experimental API

+
+
About the experimental API
+
+Buffers — Common buffer functions, including data upload APIs +
+
+Vectors — Functions for handling single precision float + vectors. +
+
+3D textures — Functions for creating and manipulating 3D textures +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+
+

+About the experimental API

+

Cogl has some experimental API developers are welcomed to play + with. The main drawback when using those is that there is no API + stability guarantee, functions flagged as experimental could be changed + or removed in future versions of the library. To use this experimental + API you will need to define + COGL_ENABLE_EXPERIMENTAL_API before including + <clutter/clutter.h> or + <cogl/cogl.h>.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ch03.html b/doc/reference/cogl/html/ch03.html new file mode 100644 index 0000000..336da9a --- /dev/null +++ b/doc/reference/cogl/html/ch03.html @@ -0,0 +1,66 @@ + + + + +Cogl deprecated API + + + + + + + + + + + + + + + + +
+

+Cogl deprecated API

+ +
+

+About the deprecated API

+

Cogl has evolved from once being a thin abstraction over + OpenGL and GLES where a lot of OpenGL's state machine style APIs + were simply rebranded as Cogl API into the more distinguished API + style we have today. The result of this evolution though is that + some of the APIs are considered deprecated and because we plan to + remove them at the next opportunity we have to break the API + developers should aim to avoid these functions to keep their code + working with future major versions of Cogl.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-3D-textures.html b/doc/reference/cogl/html/cogl-3D-textures.html new file mode 100644 index 0000000..9a6c9d4 --- /dev/null +++ b/doc/reference/cogl/html/cogl-3D-textures.html @@ -0,0 +1,258 @@ + + + + +3D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

3D textures

+

3D textures — Functions for creating and manipulating 3D textures

+
+
+

Synopsis

+
CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth);
+CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+CoglBool            cogl_is_texture_3d                  (void *object);
+
+
+
+

Description

+

+These functions allow 3D textures to be used. 3D textures can be +thought of as layers of 2D images arranged into a cuboid +shape. When choosing a texel from the texture, Cogl will take into +account the 'r' texture coordinate to select one of the images. +

+
+
+

Details

+
+

cogl_texture_3d_new_with_size ()

+
CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth);
+

+Creates a low-level CoglTexture3D texture with the specified +dimensions and pixel format. +

+

+The storage for the texture is not allocated before this function +returns. You can call cogl_texture_allocate() to explicitly +allocate the underlying storage or preferably let Cogl +automatically allocate storage lazily when it may know more about +how the texture is going to be used and can optimize how it is +allocated. +

+

+The texture is still configurable until it has been allocated so +for example you can influence the internal format of the texture +using cogl_texture_set_components() and +cogl_texture_set_premultiplied(). +

+

+

+
+

Note

This texture will fail to allocate later if +COGL_FEATURE_ID_TEXTURE_3D is not advertised. Allocation can also +fail if the requested dimensions are not supported by the +GPU.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

context :

a CoglContext +

width :

width of the texture in pixels.

height :

height of the texture in pixels.

depth :

depth of the texture in pixels.

Returns :

A new CoglTexture3D object with no storage yet allocated. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_texture_3d_new_from_data ()

+
CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const uint8_t *data,
+                                                         CoglError **error);
+

+Creates a low-level 3D texture and initializes it with data. The +data is assumed to be packed array of depth images. There can be +padding between the images using image_stride. +

+

+

+
+

Note

This api will always immediately allocate GPU memory for the +texture and upload the given data so that the data pointer does +not need to remain valid once this function returns. This means it +is not possible to configure the texture before it is allocated. If +you do need to configure the texture before allocation (to specify +constraints on the internal format for example) then you can +instead create a CoglBitmap for your data and use +cogl_texture_3d_new_from_bitmap().
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

context :

a CoglContext +

width :

width of the texture in pixels.

height :

height of the texture in pixels.

depth :

depth of the texture in pixels.

format :

the CoglPixelFormat the buffer is stored in in RAM

rowstride :

the memory offset in bytes between the starts of +scanlines in data or 0 to infer it from the width and format

image_stride :

the number of bytes from one image to the next. This +can be used to add padding between the images in a similar way +that the rowstride can be used to add padding between +rows. Alternatively 0 can be passed to infer the image_stride +from the height.

data :

pointer the memory region where the source buffer resides

error :

A CoglError return location.

Returns :

the newly created CoglTexture3D or +NULL if there was an error and an exception will be +returned through error. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_3d ()

+
CoglBool            cogl_is_texture_3d                  (void *object);
+

+Checks whether the given object references a CoglTexture3D +

+
++++ + + + + + + + + + + +

object :

a CoglObject +

Returns :

+TRUE if the passed object represents a 3D texture +and FALSE otherwise
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Bitmaps.html b/doc/reference/cogl/html/cogl-Bitmaps.html new file mode 100644 index 0000000..b9c83d8 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Bitmaps.html @@ -0,0 +1,224 @@ + + + + +Bitmaps + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Bitmaps

+

Bitmaps — Functions for loading images

+
+
+

Synopsis

+
                    CoglBitmap;
+CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
+                                                         CoglError **error);
+CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
+                                                         int *width,
+                                                         int *height);
+CoglBool            cogl_is_bitmap                      (void *object);
+enum                CoglBitmapError;
+#define             COGL_BITMAP_ERROR
+
+
+
+

Description

+

+Cogl allows loading image data into memory as CoglBitmaps without +loading them immediately into GPU textures. +

+

+CoglBitmap is available since Cogl 1.0 +

+
+
+

Details

+
+

CoglBitmap

+
typedef struct _CoglBitmap CoglBitmap;
+
+
+
+

cogl_bitmap_new_from_file ()

+
CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
+                                                         CoglError **error);
+

+Loads an image file from disk. This function can be safely called from +within a thread. +

+
++++ + + + + + + + + + + + + + + +

filename :

the file to load.

error :

a CoglError or NULL.

Returns :

a CoglBitmap to the new loaded +image data, or NULL if loading the image failed. [transfer full] +
+

Since 1.0

+
+
+
+

cogl_bitmap_get_size_from_file ()

+
CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
+                                                         int *width,
+                                                         int *height);
+

+Parses an image file enough to extract the width and height +of the bitmap. +

+
++++ + + + + + + + + + + + + + + + + + + +

filename :

the file to check

width :

return location for the bitmap width, or NULL. [out] +

height :

return location for the bitmap height, or NULL. [out] +

Returns :

+TRUE if the image was successfully parsed
+

Since 1.0

+
+
+
+

cogl_is_bitmap ()

+
CoglBool            cogl_is_bitmap                      (void *object);
+

+Checks whether object is a CoglBitmap +

+
++++ + + + + + + + + + + +

object :

a CoglObject pointer

Returns :

+TRUE if the passed object represents a bitmap, +and FALSE otherwise
+

Since 1.0

+
+
+
+

enum CoglBitmapError

+
typedef enum {
+  COGL_BITMAP_ERROR_FAILED,
+  COGL_BITMAP_ERROR_UNKNOWN_TYPE,
+  COGL_BITMAP_ERROR_CORRUPT_IMAGE
+} CoglBitmapError;
+
+

+Error codes that can be thrown when performing bitmap +operations. Note that gdk_pixbuf_new_from_file() can also throw +errors directly from the underlying image loading library. For +example, if GdkPixbuf is used then errors GdkPixbufErrors +will be used directly. +

+
++++ + + + + + + + + + + + + + + +

COGL_BITMAP_ERROR_FAILED

Generic failure code, something went + wrong. +

COGL_BITMAP_ERROR_UNKNOWN_TYPE

Unknown image type. +

COGL_BITMAP_ERROR_CORRUPT_IMAGE

An image file was broken somehow. +
+

Since 1.4

+
+
+
+

COGL_BITMAP_ERROR

+
#define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ())
+
+

+CoglError domain for bitmap errors. +

+

Since 1.4

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Blend-Strings.html b/doc/reference/cogl/html/cogl-Blend-Strings.html new file mode 100644 index 0000000..539dbcd --- /dev/null +++ b/doc/reference/cogl/html/cogl-Blend-Strings.html @@ -0,0 +1,143 @@ + + + + +Material Blend Strings + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Material Blend Strings

+

Material Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions.

+
+
+

Cogl Blend Strings

+

+Describing GPU blending and texture combining states is rather awkward to do +in a consise but also readable fashion. Cogl helps by supporting +string based descriptions using a simple syntax. +

+
+

+Some examples

+

Here is an example used for blending:

+
+"RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))"
+
+

In OpenGL terms this replaces glBlendFunc[Separate] and +glBlendEquation[Separate]

+

+Actually in this case it's more verbose than the GL equivalent: +

+
+glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+

+But unless you are familiar with OpenGL or refer to its API documentation +you wouldn't know that the default function used by OpenGL is GL_FUNC_ADD +nor would you know that the above arguments determine what the source color +and destination color will be multiplied by before being adding. +

+

Here is an example used for texture combining:

+
+"RGB = REPLACE (PREVIOUS)"
+"A = MODULATE (PREVIOUS, TEXTURE)"
+
+

+In OpenGL terms this replaces glTexEnv, and the above example is equivalent +to this OpenGL code: +

+
+  glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+  glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR);
+  glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
+  glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR);
+
+
+
+

+Here's the syntax

+
+<statement>:
+  <channel-mask>=<function-name>(<arg-list>)
+
+  You can either use a single statement with an RGBA channel-mask or you can use
+  two statements; one with an A channel-mask and the other with an RGB
+  channel-mask.
+
+<channel-mask>:
+  A or RGB or RGBA
+
+<function-name>:
+  [A-Za-z_]*
+
+<arg-list>:
+  <arg>,<arg>
+  or <arg>
+  or ""
+
+  I.e. functions may take 0 or more arguments
+
+<arg>:
+  <color-source>
+  1 - <color-source>                : Only intended for texture combining
+  <color-source> * ( <factor> )     : Only intended for blending
+  0                                 : Only intended for blending
+
+  See the blending or texture combining sections for further notes and examples.
+
+<color-source>:
+  <source-name>[<channel-mask>]
+  <source-name>
+
+  See the blending or texture combining sections for the list of source-names
+  valid in each context.
+
+  If a channel mask is not given then the channel mask of the statement
+  is assumed instead.
+
+<factor>:
+  0
+  1
+  <color-source>
+  1-<color-source>
+  SRC_ALPHA_SATURATE
+
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Buffers.html b/doc/reference/cogl/html/cogl-Buffers.html new file mode 100644 index 0000000..3251eab --- /dev/null +++ b/doc/reference/cogl/html/cogl-Buffers.html @@ -0,0 +1,474 @@ + + + + +Buffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Buffers

+

Buffers — Common buffer functions, including data upload APIs

+
+
+

Stability Level

+Unstable, unless otherwise indicated +
+
+

Synopsis

+
CoglBool            cogl_is_buffer                      (void *object);
+unsigned int        cogl_buffer_get_size                (CoglBuffer *buffer);
+enum                CoglBufferUpdateHint;
+void                cogl_buffer_set_update_hint         (CoglBuffer *buffer,
+                                                         CoglBufferUpdateHint hint);
+CoglBufferUpdateHint cogl_buffer_get_update_hint        (CoglBuffer *buffer);
+enum                CoglBufferAccess;
+void *              cogl_buffer_map                     (CoglBuffer *buffer,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints);
+void                cogl_buffer_unmap                   (CoglBuffer *buffer);
+CoglBool            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         const void *data,
+                                                         size_t size);
+
+CoglPixelBuffer *   cogl_pixel_buffer_new               (CoglContext *context,
+                                                         size_t size,
+                                                         const void *data);
+CoglBool            cogl_is_pixel_buffer                (void *object);
+
+
+
+

Description

+

+The CoglBuffer API provides a common interface to manipulate +buffers that have been allocated either via cogl_pixel_buffer_new() +or cogl_attribute_buffer_new(). The API allows you to upload data +to these buffers and define usage hints that help Cogl manage your +buffer optimally. +

+

+Data can either be uploaded by supplying a pointer and size so Cogl +can copy your data, or you can mmap() a CoglBuffer and then you can +copy data to the buffer directly. +

+

+One of the most common uses for CoglBuffers is to upload texture +data asynchronously since the ability to mmap the buffers into +the CPU makes it possible for another thread to handle the IO +of loading an image file and unpacking it into the mapped buffer +without blocking other Cogl operations. +

+
+
+

Details

+
+

cogl_is_buffer ()

+
CoglBool            cogl_is_buffer                      (void *object);
+

+Checks whether buffer is a buffer object. +

+
++++ + + + + + + + + + + +

object :

a buffer object

Returns :

+TRUE if the handle is a CoglBuffer, and FALSE otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_get_size ()

+
unsigned int        cogl_buffer_get_size                (CoglBuffer *buffer);
+

+Retrieves the size of buffer +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

Returns :

the size of the buffer in bytes
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

enum CoglBufferUpdateHint

+
typedef enum {
+ /*< prefix=COGL_BUFFER_UPDATE_HINT >*/
+  COGL_BUFFER_UPDATE_HINT_STATIC,
+  COGL_BUFFER_UPDATE_HINT_DYNAMIC,
+  COGL_BUFFER_UPDATE_HINT_STREAM
+} CoglBufferUpdateHint;
+
+

+The update hint on a buffer allows the user to give some detail on how often +the buffer data is going to be updated. +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_UPDATE_HINT_STATIC

the buffer will not change over time +

COGL_BUFFER_UPDATE_HINT_DYNAMIC

the buffer will change from time to time +

COGL_BUFFER_UPDATE_HINT_STREAM

the buffer will be used once or a couple of + times +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_set_update_hint ()

+
void                cogl_buffer_set_update_hint         (CoglBuffer *buffer,
+                                                         CoglBufferUpdateHint hint);
+

+Sets the update hint on a buffer. See CoglBufferUpdateHint for a description +of the available hints. +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

hint :

the new hint
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_get_update_hint ()

+
CoglBufferUpdateHint cogl_buffer_get_update_hint        (CoglBuffer *buffer);
+

+Retrieves the update hints set using cogl_buffer_set_update_hint() +

+
++++ + + + + + + + + + + +

buffer :

a buffer object

Returns :

the CoglBufferUpdateHint currently used by the buffer
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

enum CoglBufferAccess

+
typedef enum {
+ /*< prefix=COGL_BUFFER_ACCESS >*/
+ COGL_BUFFER_ACCESS_READ       = 1 << 0,
+ COGL_BUFFER_ACCESS_WRITE      = 1 << 1,
+ COGL_BUFFER_ACCESS_READ_WRITE = COGL_BUFFER_ACCESS_READ | COGL_BUFFER_ACCESS_WRITE
+} CoglBufferAccess;
+
+

+The access hints for cogl_buffer_set_update_hint() +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_ACCESS_READ

the buffer will be read +

COGL_BUFFER_ACCESS_WRITE

the buffer will written to +

COGL_BUFFER_ACCESS_READ_WRITE

the buffer will be used for both reading and + writing +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_map ()

+
void *              cogl_buffer_map                     (CoglBuffer *buffer,
+                                                         CoglBufferAccess access,
+                                                         CoglBufferMapHint hints);
+

+Maps the buffer into the application address space for direct +access. This is equivalent to calling cogl_buffer_map_range() with +zero as the offset and the size of the entire buffer as the size. +

+

+It is strongly recommended that you pass +COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace +all the buffer's data. This way if the buffer is currently being +used by the GPU then the driver won't have to stall the CPU and +wait for the hardware to finish because it can instead allocate a +new buffer to map. +

+

+The behaviour is undefined if you access the buffer in a way +conflicting with the access mask you pass. It is also an error to +release your last reference while the buffer is mapped. +

+
++++ + + + + + + + + + + + + + + + + + + +

buffer :

a buffer object

access :

how the mapped buffer will be used by the application

hints :

A mask of CoglBufferMapHints that tell Cogl how +the data will be modified once mapped.

Returns :

A pointer to the mapped memory or +NULL is the call fails. [transfer none] +
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_unmap ()

+
void                cogl_buffer_unmap                   (CoglBuffer *buffer);
+

+Unmaps a buffer previously mapped by cogl_buffer_map(). +

+
++++ + + + + +

buffer :

a buffer object
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_buffer_set_data ()

+
CoglBool            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         size_t offset,
+                                                         const void *data,
+                                                         size_t size);
+

+Updates part of the buffer with new data from data. Where to put this new +data is controlled by offset and offset + data should be less than the +buffer size. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

buffer :

a buffer object

offset :

destination offset (in bytes) in the buffer

data :

a pointer to the data to be copied into the buffer

size :

number of bytes to copy

Returns :

+TRUE is the operation succeeded, FALSE otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+

cogl_pixel_buffer_new ()

+
CoglPixelBuffer *   cogl_pixel_buffer_new               (CoglContext *context,
+                                                         size_t size,
+                                                         const void *data);
+

+Declares a new CoglPixelBuffer of size bytes to contain arrays of +pixels. Once declared, data can be set using cogl_buffer_set_data() +or by mapping it into the application's address space using +cogl_buffer_map(). +

+

+If data isn't NULL then size bytes will be read from data and +immediately copied into the new buffer. +

+
++++ + + + + + + + + + + + + + + + + + + +

context :

A CoglContext +

size :

The number of bytes to allocate for the pixel data.

data :

An optional pointer to vertex data to upload immediately

Returns :

a newly allocated CoglPixelBuffer. [transfer full] +
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_pixel_buffer ()

+
CoglBool            cogl_is_pixel_buffer                (void *object);
+

+Checks whether object is a pixel buffer. +

+
++++ + + + + + + + + + + +

object :

a CoglObject to test

Returns :

+TRUE if the object is a pixel buffer, and FALSE +otherwise
+

Since 1.2

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Clipping-(Deprecated).html b/doc/reference/cogl/html/cogl-Clipping-(Deprecated).html new file mode 100644 index 0000000..19a4f73 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Clipping-(Deprecated).html @@ -0,0 +1,216 @@ + + + + +Clipping (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Clipping (Deprecated)

+

Clipping (Deprecated)

+
+
+

Synopsis

+
void                cogl_clip_push                      (float x_offset,
+                                                         float y_offset,
+                                                         float width,
+                                                         float height);
+void                cogl_clip_push_window_rect          (float x_offset,
+                                                         float y_offset,
+                                                         float width,
+                                                         float height);
+void                cogl_clip_ensure                    (void);
+void                cogl_clip_stack_save                (void);
+void                cogl_clip_stack_restore             (void);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_clip_push ()

+
void                cogl_clip_push                      (float x_offset,
+                                                         float y_offset,
+                                                         float width,
+                                                         float height);
+
+

Warning

+

cogl_clip_push has been deprecated since version 1.16 and should not be used in newly-written code. The x, y, width, height arguments are inconsistent + with other API that specify rectangles in model space, and when used + with a coordinate space that puts the origin at the center and y+ + extending up, it's awkward to use. Please use + cogl_framebuffer_push_rectangle_clip()

+
+

+Specifies a rectangular clipping area for all subsequent drawing +operations. Any drawing commands that extend outside the rectangle +will be clipped so that only the portion inside the rectangle will +be displayed. The rectangle dimensions are transformed by the +current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_clip_pop(). +

+
++++ + + + + + + + + + + + + + + + + + + +

x_offset :

left edge of the clip rectangle

y_offset :

top edge of the clip rectangle

width :

width of the clip rectangle

height :

height of the clip rectangle
+
+
+
+

cogl_clip_push_window_rect ()

+
void                cogl_clip_push_window_rect          (float x_offset,
+                                                         float y_offset,
+                                                         float width,
+                                                         float height);
+
+

Warning

+

cogl_clip_push_window_rect has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_push_scissor_clip() instead

+
+

+Specifies a rectangular clipping area for all subsequent drawing +operations. Any drawing commands that extend outside the rectangle +will be clipped so that only the portion inside the rectangle will +be displayed. The rectangle dimensions are not transformed by the +current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_clip_pop(). +

+
++++ + + + + + + + + + + + + + + + + + + +

x_offset :

left edge of the clip rectangle in window coordinates

y_offset :

top edge of the clip rectangle in window coordinates

width :

width of the clip rectangle

height :

height of the clip rectangle
+
+
+
+

cogl_clip_ensure ()

+
void                cogl_clip_ensure                    (void);
+
+

Warning

+

cogl_clip_ensure has been deprecated since version 1.2 and should not be used in newly-written code. Calling this function has no effect

+
+

+Ensures that the current clipping region has been set in GL. This +will automatically be called before any Cogl primitives but it +maybe be neccessary to call if you are using raw GL calls with +clipping. +

+

Since 1.0

+
+
+
+

cogl_clip_stack_save ()

+
void                cogl_clip_stack_save                (void);
+
+

Warning

+

cogl_clip_stack_save has been deprecated since version 1.2 and should not be used in newly-written code. This was originally added to allow us to save the + clip stack when switching to an offscreen framebuffer, but it's + not necessary anymore given that framebuffers now own separate + clip stacks which will be automatically switched between when a + new buffer is set. Calling this function has no effect

+
+

+Save the entire state of the clipping stack and then clear all +clipping. The previous state can be returned to with +cogl_clip_stack_restore(). Each call to cogl_clip_push() after this +must be matched by a call to cogl_clip_pop() before calling +cogl_clip_stack_restore(). +

+

Since 0.8.2

+
+
+
+

cogl_clip_stack_restore ()

+
void                cogl_clip_stack_restore             (void);
+
+

Warning

+

cogl_clip_stack_restore has been deprecated since version 1.2 and should not be used in newly-written code. This was originally added to allow us to restore + the clip stack when switching back from an offscreen framebuffer, + but it's not necessary anymore given that framebuffers now own + separate clip stacks which will be automatically switched between + when a new buffer is set. Calling this function has no effect

+
+

+Restore the state of the clipping stack that was previously saved +by cogl_clip_stack_save(). +

+

Since 0.8.2

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Clipping.html b/doc/reference/cogl/html/cogl-Clipping.html new file mode 100644 index 0000000..18cefed --- /dev/null +++ b/doc/reference/cogl/html/cogl-Clipping.html @@ -0,0 +1,176 @@ + + + + +Clipping + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Clipping

+

Clipping — Fuctions for manipulating a stack of clipping regions

+
+
+

Synopsis

+
void                cogl_clip_push_rectangle            (float x0,
+                                                         float y0,
+                                                         float x1,
+                                                         float y1);
+void                cogl_clip_push_window_rectangle     (int x_offset,
+                                                         int y_offset,
+                                                         int width,
+                                                         int height);
+void                cogl_clip_pop                       (void);
+
+
+
+

Description

+

+To support clipping your geometry to rectangles or paths Cogl exposes a +stack based API whereby each clip region you push onto the stack is +intersected with the previous region. +

+
+
+

Details

+
+

cogl_clip_push_rectangle ()

+
void                cogl_clip_push_rectangle            (float x0,
+                                                         float y0,
+                                                         float x1,
+                                                         float y1);
+
+

Warning

+

cogl_clip_push_rectangle has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_push_rectangle_clip() + instead

+
+

+Specifies a rectangular clipping area for all subsequent drawing +operations. Any drawing commands that extend outside the rectangle +will be clipped so that only the portion inside the rectangle will +be displayed. The rectangle dimensions are transformed by the +current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_clip_pop(). +

+
++++ + + + + + + + + + + + + + + + + + + +

x0 :

x coordinate for top left corner of the clip rectangle

y0 :

y coordinate for top left corner of the clip rectangle

x1 :

x coordinate for bottom right corner of the clip rectangle

y1 :

y coordinate for bottom right corner of the clip rectangle
+

Since 1.2

+
+
+
+

cogl_clip_push_window_rectangle ()

+
void                cogl_clip_push_window_rectangle     (int x_offset,
+                                                         int y_offset,
+                                                         int width,
+                                                         int height);
+
+

Warning

+

cogl_clip_push_window_rectangle has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_push_scissor_clip() instead

+
+

+Specifies a rectangular clipping area for all subsequent drawing +operations. Any drawing commands that extend outside the rectangle +will be clipped so that only the portion inside the rectangle will +be displayed. The rectangle dimensions are not transformed by the +current model-view matrix. +

+

+The rectangle is intersected with the current clip region. To undo +the effect of this function, call cogl_clip_pop(). +

+
++++ + + + + + + + + + + + + + + + + + + +

x_offset :

left edge of the clip rectangle in window coordinates

y_offset :

top edge of the clip rectangle in window coordinates

width :

width of the clip rectangle

height :

height of the clip rectangle
+

Since 1.2

+
+
+
+

cogl_clip_pop ()

+
void                cogl_clip_pop                       (void);
+
+

Warning

+

cogl_clip_pop has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_pop_clip() instead

+
+

+Reverts the clipping region to the state before the last call to +cogl_clip_push(). +

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Color-Type.html b/doc/reference/cogl/html/cogl-Color-Type.html new file mode 100644 index 0000000..19a728c --- /dev/null +++ b/doc/reference/cogl/html/cogl-Color-Type.html @@ -0,0 +1,1230 @@ + + + + +Color Type + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Color Type

+

Color Type — A generic color definition

+
+
+

Synopsis

+
struct              CoglColor;
+CoglColor *         cogl_color_new                      (void);
+CoglColor *         cogl_color_copy                     (const CoglColor *color);
+void                cogl_color_free                     (CoglColor *color);
+void                cogl_color_init_from_4f             (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+void                cogl_color_init_from_4fv            (CoglColor *color,
+                                                         const float *color_array);
+void                cogl_color_init_from_4ub            (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_color_set_from_4ub             (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_color_set_from_4f              (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+float               cogl_color_get_red                  (const CoglColor *color);
+float               cogl_color_get_green                (const CoglColor *color);
+float               cogl_color_get_blue                 (const CoglColor *color);
+float               cogl_color_get_alpha                (const CoglColor *color);
+
+unsigned char       cogl_color_get_red_byte             (const CoglColor *color);
+unsigned char       cogl_color_get_green_byte           (const CoglColor *color);
+unsigned char       cogl_color_get_blue_byte            (const CoglColor *color);
+unsigned char       cogl_color_get_alpha_byte           (const CoglColor *color);
+
+float               cogl_color_get_red_float            (const CoglColor *color);
+float               cogl_color_get_green_float          (const CoglColor *color);
+float               cogl_color_get_blue_float           (const CoglColor *color);
+float               cogl_color_get_alpha_float          (const CoglColor *color);
+
+void                cogl_color_set_red                  (CoglColor *color,
+                                                         float red);
+void                cogl_color_set_green                (CoglColor *color,
+                                                         float green);
+void                cogl_color_set_blue                 (CoglColor *color,
+                                                         float blue);
+void                cogl_color_set_alpha                (CoglColor *color,
+                                                         float alpha);
+
+void                cogl_color_set_red_byte             (CoglColor *color,
+                                                         unsigned char red);
+void                cogl_color_set_green_byte           (CoglColor *color,
+                                                         unsigned char green);
+void                cogl_color_set_blue_byte            (CoglColor *color,
+                                                         unsigned char blue);
+void                cogl_color_set_alpha_byte           (CoglColor *color,
+                                                         unsigned char alpha);
+
+void                cogl_color_set_red_float            (CoglColor *color,
+                                                         float red);
+void                cogl_color_set_green_float          (CoglColor *color,
+                                                         float green);
+void                cogl_color_set_blue_float           (CoglColor *color,
+                                                         float blue);
+void                cogl_color_set_alpha_float          (CoglColor *color,
+                                                         float alpha);
+
+void                cogl_color_premultiply              (CoglColor *color);
+void                cogl_color_unpremultiply            (CoglColor *color);
+CoglBool            cogl_color_equal                    (const void *v1,
+                                                         const void *v2);
+
+void                cogl_color_init_from_hsl            (CoglColor *color,
+                                                         float hue,
+                                                         float saturation,
+                                                         float luminance);
+void                cogl_color_to_hsl                   (const CoglColor *color,
+                                                         float *hue,
+                                                         float *saturation,
+                                                         float *luminance);
+
+
+
+

Description

+

+CoglColor is a simple structure holding the definition of a color such +that it can be efficiently used by GL +

+
+
+

Details

+
+

struct CoglColor

+
struct CoglColor {
+};
+
+

+A structure for holding a color definition. The contents of +the CoglColor structure are private and should never by accessed +directly. +

+
++++ + +
+

Since 1.0

+
+
+
+

cogl_color_new ()

+
CoglColor *         cogl_color_new                      (void);
+

+Creates a new (empty) color +

+
++++ + + + + +

Returns :

a newly-allocated CoglColor. Use cogl_color_free() +to free the allocated resources
+

Since 1.0

+
+
+
+

cogl_color_copy ()

+
CoglColor *         cogl_color_copy                     (const CoglColor *color);
+

+Creates a copy of color +

+
++++ + + + + + + + + + + +

color :

the color to copy

Returns :

a newly-allocated CoglColor. Use cogl_color_free() +to free the allocate resources
+

Since 1.0

+
+
+
+

cogl_color_free ()

+
void                cogl_color_free                     (CoglColor *color);
+

+Frees the resources allocated by cogl_color_new() and cogl_color_copy() +

+
++++ + + + + +

color :

the color to free
+

Since 1.0

+
+
+
+

cogl_color_init_from_4f ()

+
void                cogl_color_init_from_4f             (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+

+Sets the values of the passed channels into a CoglColor +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 1.0

green :

value of the green channel, between 0 and 1.0

blue :

value of the blue channel, between 0 and 1.0

alpha :

value of the alpha channel, between 0 and 1.0
+

Since 1.4

+
+
+
+

cogl_color_init_from_4fv ()

+
void                cogl_color_init_from_4fv            (CoglColor *color,
+                                                         const float *color_array);
+

+Sets the values of the passed channels into a CoglColor +

+
++++ + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

color_array :

a pointer to an array of 4 float color components
+

Since 1.4

+
+
+
+

cogl_color_init_from_4ub ()

+
void                cogl_color_init_from_4ub            (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+

+Sets the values of the passed channels into a CoglColor. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 255

green :

value of the green channel, between 0 and 255

blue :

value of the blue channel, between 0 and 255

alpha :

value of the alpha channel, between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_from_4ub ()

+
void                cogl_color_set_from_4ub             (CoglColor *color,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+
+

Warning

+

cogl_color_set_from_4ub has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_color_init_from_4ub instead.

+
+

+Sets the values of the passed channels into a CoglColor. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 255

green :

value of the green channel, between 0 and 255

blue :

value of the blue channel, between 0 and 255

alpha :

value of the alpha channel, between 0 and 255
+

Since 1.0

+
+
+
+

cogl_color_set_from_4f ()

+
void                cogl_color_set_from_4f              (CoglColor *color,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+

Warning

+

cogl_color_set_from_4f has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_color_init_from_4f instead.

+
+

+Sets the values of the passed channels into a CoglColor +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

color :

A pointer to a CoglColor to initialize

red :

value of the red channel, between 0 and 1.0

green :

value of the green channel, between 0 and 1.0

blue :

value of the blue channel, between 0 and 1.0

alpha :

value of the alpha channel, between 0 and 1.0
+

Since 1.0

+
+
+
+

cogl_color_get_red ()

+
float               cogl_color_get_red                  (const CoglColor *color);
+

+Retrieves the red channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green ()

+
float               cogl_color_get_green                (const CoglColor *color);
+

+Retrieves the green channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue ()

+
float               cogl_color_get_blue                 (const CoglColor *color);
+

+Retrieves the blue channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha ()

+
float               cogl_color_get_alpha                (const CoglColor *color);
+

+Retrieves the alpha channel of color as a fixed point +value between 0 and 1.0. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_red_byte ()

+
unsigned char       cogl_color_get_red_byte             (const CoglColor *color);
+

+Retrieves the red channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green_byte ()

+
unsigned char       cogl_color_get_green_byte           (const CoglColor *color);
+

+Retrieves the green channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue_byte ()

+
unsigned char       cogl_color_get_blue_byte            (const CoglColor *color);
+

+Retrieves the blue channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha_byte ()

+
unsigned char       cogl_color_get_alpha_byte           (const CoglColor *color);
+

+Retrieves the alpha channel of color as a byte value +between 0 and 255 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_red_float ()

+
float               cogl_color_get_red_float            (const CoglColor *color);
+

+Retrieves the red channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the red channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_green_float ()

+
float               cogl_color_get_green_float          (const CoglColor *color);
+

+Retrieves the green channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the green channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_blue_float ()

+
float               cogl_color_get_blue_float           (const CoglColor *color);
+

+Retrieves the blue channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the blue channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_get_alpha_float ()

+
float               cogl_color_get_alpha_float          (const CoglColor *color);
+

+Retrieves the alpha channel of color as a floating point +value between 0.0 and 1.0 +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

Returns :

the alpha channel of the passed color
+

Since 1.0

+
+
+
+

cogl_color_set_red ()

+
void                cogl_color_set_red                  (CoglColor *color,
+                                                         float red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_green ()

+
void                cogl_color_set_green                (CoglColor *color,
+                                                         float green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_blue ()

+
void                cogl_color_set_blue                 (CoglColor *color,
+                                                         float blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_alpha ()

+
void                cogl_color_set_alpha                (CoglColor *color,
+                                                         float alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_red_byte ()

+
void                cogl_color_set_red_byte             (CoglColor *color,
+                                                         unsigned char red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_green_byte ()

+
void                cogl_color_set_green_byte           (CoglColor *color,
+                                                         unsigned char green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_blue_byte ()

+
void                cogl_color_set_blue_byte            (CoglColor *color,
+                                                         unsigned char blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_alpha_byte ()

+
void                cogl_color_set_alpha_byte           (CoglColor *color,
+                                                         unsigned char alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a byte value between 0 and 255
+

Since 1.4

+
+
+
+

cogl_color_set_red_float ()

+
void                cogl_color_set_red_float            (CoglColor *color,
+                                                         float red);
+

+Sets the red channel of color to red. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

red :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_green_float ()

+
void                cogl_color_set_green_float          (CoglColor *color,
+                                                         float green);
+

+Sets the green channel of color to green. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

green :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_blue_float ()

+
void                cogl_color_set_blue_float           (CoglColor *color,
+                                                         float blue);
+

+Sets the blue channel of color to blue. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

blue :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_set_alpha_float ()

+
void                cogl_color_set_alpha_float          (CoglColor *color,
+                                                         float alpha);
+

+Sets the alpha channel of color to alpha. +

+
++++ + + + + + + + + + + +

color :

a CoglColor +

alpha :

a float value between 0.0f and 1.0f
+

Since 1.4

+
+
+
+

cogl_color_premultiply ()

+
void                cogl_color_premultiply              (CoglColor *color);
+

+Converts a non-premultiplied color to a pre-multiplied color. For +example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied +and (0.5, 0, 0, 0.5) when premultiplied. +

+
++++ + + + + +

color :

the color to premultiply
+

Since 1.0

+
+
+
+

cogl_color_unpremultiply ()

+
void                cogl_color_unpremultiply            (CoglColor *color);
+

+Converts a pre-multiplied color to a non-premultiplied color. For +example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied +and (1.0, 0, 0, 0.5) when non-premultiplied. +

+
++++ + + + + +

color :

the color to unpremultiply
+

Since 1.4

+
+
+
+

cogl_color_equal ()

+
CoglBool            cogl_color_equal                    (const void *v1,
+                                                         const void *v2);
+

+Compares two CoglColors and checks if they are the same. +

+

+This function can be passed to g_hash_table_new() as the key_equal_func +parameter, when using CoglColors as keys in a GHashTable. +

+
++++ + + + + + + + + + + + + + + +

v1 :

a CoglColor +

v2 :

a CoglColor +

Returns :

+TRUE if the two colors are the same.
+

Since 1.0

+
+
+
+

cogl_color_init_from_hsl ()

+
void                cogl_color_init_from_hsl            (CoglColor *color,
+                                                         float hue,
+                                                         float saturation,
+                                                         float luminance);
+

+Converts a color expressed in HLS (hue, luminance and saturation) +values into a CoglColor. +

+
++++ + + + + + + + + + + + + + + + + + + +

color :

return location for a CoglColor. [out] +

hue :

hue value, in the 0 .. 360 range

saturation :

saturation value, in the 0 .. 1 range

luminance :

luminance value, in the 0 .. 1 range
+

Since 1.16

+
+
+
+

cogl_color_to_hsl ()

+
void                cogl_color_to_hsl                   (const CoglColor *color,
+                                                         float *hue,
+                                                         float *saturation,
+                                                         float *luminance);
+

+Converts color to the HLS format. +

+

+The hue value is in the 0 .. 360 range. The luminance and +saturation values are in the 0 .. 1 range. +

+
++++ + + + + + + + + + + + + + + + + + + +

color :

a CoglColor +

hue :

return location for the hue value or NULL. [out] +

saturation :

return location for the saturation value or NULL. [out] +

luminance :

return location for the luminance value or NULL. [out] +
+

Since 1.16

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Fixed-Point-API.html b/doc/reference/cogl/html/cogl-Fixed-Point-API.html new file mode 100644 index 0000000..6b612ea --- /dev/null +++ b/doc/reference/cogl/html/cogl-Fixed-Point-API.html @@ -0,0 +1,1331 @@ + + + + +Fixed Point API + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Fixed Point API

+

Fixed Point API — Fixed Point API

+
+
+

Synopsis

+
typedef             CoglFixed;
+#define             COGL_FIXED_BITS
+#define             COGL_FIXED_Q
+#define             COGL_FIXED_MAX
+#define             COGL_FIXED_MIN
+
+#define             COGL_FIXED_FROM_FLOAT               (x)
+#define             COGL_FIXED_TO_FLOAT                 (x)
+#define             COGL_FIXED_FROM_INT                 (x)
+#define             COGL_FIXED_TO_INT                   (x)
+#define             COGL_FIXED_FROM_DOUBLE              (x)
+#define             COGL_FIXED_TO_DOUBLE                (x)
+#define             COGL_FLOAT_TO_INT                   (x)
+#define             COGL_FLOAT_TO_UINT                  (x)
+
+#define             COGL_FIXED_EPSILON
+#define             COGL_FIXED_1
+#define             COGL_FIXED_0_5
+#define             COGL_FIXED_30
+#define             COGL_FIXED_45
+#define             COGL_FIXED_60
+#define             COGL_FIXED_90
+#define             COGL_FIXED_120
+#define             COGL_FIXED_180
+#define             COGL_FIXED_240
+#define             COGL_FIXED_255
+#define             COGL_FIXED_270
+#define             COGL_FIXED_360
+
+#define             COGL_FIXED_MUL                      (a,
+                                                         b)
+#define             COGL_FIXED_DIV                      (a,
+                                                         b)
+#define             COGL_FIXED_MUL_DIV                  (a,
+                                                         b,
+                                                         c)
+#define             COGL_FIXED_FAST_DIV                 (a,
+                                                         b)
+#define             COGL_FIXED_FAST_MUL                 (a,
+                                                         b)
+#define             COGL_FIXED_FRACTION                 (x)
+#define             COGL_FIXED_FLOOR                    (x)
+#define             COGL_FIXED_CEIL                     (x)
+
+#define             COGL_FIXED_2_PI
+#define             COGL_FIXED_PI
+#define             COGL_FIXED_PI_2
+#define             COGL_FIXED_PI_4
+#define             COGL_RADIANS_TO_DEGREES
+
+#define             COGL_SQRTI_ARG_10_PERCENT
+#define             COGL_SQRTI_ARG_5_PERCENT
+#define             COGL_SQRTI_ARG_MAX
+int                 cogl_sqrti                          (int x);
+
+CoglFixed           cogl_fixed_atan2                    (CoglFixed a,
+                                                         CoglFixed b);
+CoglFixed           cogl_fixed_atan                     (CoglFixed a);
+CoglFixed           cogl_fixed_cos                      (CoglFixed angle);
+CoglFixed           cogl_fixed_log2                     (unsigned int x);
+unsigned int        cogl_fixed_pow                      (unsigned int x,
+                                                         CoglFixed y);
+unsigned int        cogl_fixed_pow2                     (CoglFixed x);
+CoglFixed           cogl_fixed_sin                      (CoglFixed angle);
+CoglFixed           cogl_fixed_sqrt                     (CoglFixed x);
+CoglFixed           cogl_fixed_tan                      (CoglFixed angle);
+CoglFixed           cogl_fixed_div                      (CoglFixed a,
+                                                         CoglFixed b);
+CoglFixed           cogl_fixed_mul                      (CoglFixed a,
+                                                         CoglFixed b);
+CoglFixed           cogl_fixed_mul_div                  (CoglFixed a,
+                                                         CoglFixed b,
+                                                         CoglFixed c);
+
+typedef             CoglAngle;
+#define             COGL_ANGLE_FROM_DEG                 (x)
+#define             COGL_ANGLE_FROM_DEGX                (x)
+#define             COGL_ANGLE_TO_DEG                   (x)
+#define             COGL_ANGLE_TO_DEGX                  (x)
+CoglFixed           cogl_angle_cos                      (CoglAngle angle);
+CoglFixed           cogl_angle_sin                      (CoglAngle angle);
+CoglFixed           cogl_angle_tan                      (CoglAngle angle);
+
+
+
+

Description

+

+COGL has a fixed point API targeted at platforms without a floating +point unit, such as embedded devices. On such platforms this API should +be preferred to the floating point one as it does not trigger the slow +path of software emulation, relying on integer math for fixed-to-floating +and floating-to-fixed notations conversion. +

+

+It is not recommened for use on platforms with a floating point unit +(e.g. desktop systems), nor for use in language bindings. +

+

+Basic rules of Fixed Point arithmethic: +

+
    +
  • Two fixed point numbers can be directly added, subtracted and + have their modulus taken.

  • +
  • To add other numerical type to a fixed point number it has to + be first converted to fixed point.

  • +
  • A fixed point number can be directly multiplied or divided by + an integer.

  • +
  • Two fixed point numbers can only be multiplied and divided by + the provided COGL_FIXED_MUL and COGL_FIXED_DIV macros.

  • +
+

+

+

+The fixed point API is available since COGL 1.0. +

+
+
+

Details

+
+

CoglFixed

+
typedef int32_t CoglFixed;
+
+

+Fixed point number using a (16.16) notation. +

+
+
+
+

COGL_FIXED_BITS

+
#define COGL_FIXED_BITS         (32)
+
+

+Evaluates to the number of bits used by the CoglFixed type. +

+

Since 1.0

+
+
+
+

COGL_FIXED_Q

+
#define COGL_FIXED_Q            (COGL_FIXED_BITS - 16)
+
+

+Evaluates to the number of bits used for the non-integer part +of the CoglFixed type. +

+

Since 1.0

+
+
+
+

COGL_FIXED_MAX

+
#define COGL_FIXED_MAX          (0x7fffffff)
+
+

+The biggest number representable using CoglFixed +

+

Since 1.0

+
+
+
+

COGL_FIXED_MIN

+
#define COGL_FIXED_MIN          (0x80000000)
+
+

+The smallest number representable using CoglFixed +

+

Since 1.0

+
+
+
+

COGL_FIXED_FROM_FLOAT()

+
#define COGL_FIXED_FROM_FLOAT(x)        ((float) cogl_double_to_fixed (x))
+
+

+Converts x from a floating point to a fixed point notation. +

+
++++ + + + + +

x :

a floating point number
+

Since 1.0

+
+
+
+

COGL_FIXED_TO_FLOAT()

+
#define COGL_FIXED_TO_FLOAT(x)          ((float) ((int)(x) / 65536.0))
+
+

+Converts x from a fixed point to a floating point notation, in +single precision. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FROM_INT()

+
#define COGL_FIXED_FROM_INT(x)          ((x) << COGL_FIXED_Q)
+
+

+Converts x from an integer to a fixed point notation. +

+
++++ + + + + +

x :

an integer number
+

Since 1.0

+
+
+
+

COGL_FIXED_TO_INT()

+
#define COGL_FIXED_TO_INT(x)            ((x) >> COGL_FIXED_Q)
+
+

+Converts x from a fixed point notation to an integer, dropping +the fractional part without rounding. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FROM_DOUBLE()

+
#define COGL_FIXED_FROM_DOUBLE(x)       (cogl_double_to_fixed (x))
+
+

+Converts x from a double precision, floating point to a fixed +point notation. +

+
++++ + + + + +

x :

a floating point number
+

Since 1.0

+
+
+
+

COGL_FIXED_TO_DOUBLE()

+
#define COGL_FIXED_TO_DOUBLE(x)         ((double) ((int)(x) / 65536.0))
+
+

+Converts x from a fixed point to a floating point notation, in +double precision. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FLOAT_TO_INT()

+
#define COGL_FLOAT_TO_INT(x)            (cogl_double_to_int ((x)))
+
+

+Converts x from a floating point notation to a signed integer. +

+
++++ + + + + +

x :

a floatint point number
+

Since 1.0

+
+
+
+

COGL_FLOAT_TO_UINT()

+
#define COGL_FLOAT_TO_UINT(x)           (cogl_double_to_uint ((x)))
+
+

+Converts x from a floating point notation to an unsigned integer. +

+
++++ + + + + +

x :

a floatint point number
+

Since 1.0

+
+
+
+

COGL_FIXED_EPSILON

+
#define COGL_FIXED_EPSILON      (1)
+
+

+A very small number expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_1

+
#define COGL_FIXED_1            (1 << COGL_FIXED_Q)
+
+

+The number 1 expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_0_5

+
#define COGL_FIXED_0_5          (32768)
+
+

+The number 0.5 expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_30

+
#define COGL_FIXED_30           (COGL_FIXED_FROM_INT (30))
+
+

+Evaluates to the number 30 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_45

+
#define COGL_FIXED_45           (COGL_FIXED_FROM_INT (45))
+
+

+Evaluates to the number 45 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_60

+
#define COGL_FIXED_60           (COGL_FIXED_FROM_INT (60))
+
+

+Evaluates to the number 60 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_90

+
#define COGL_FIXED_90           (COGL_FIXED_FROM_INT (90))
+
+

+Evaluates to the number 90 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_120

+
#define COGL_FIXED_120          (COGL_FIXED_FROM_INT (120))
+
+

+Evaluates to the number 120 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_180

+
#define COGL_FIXED_180          (COGL_FIXED_FROM_INT (180))
+
+

+Evaluates to the number 180 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_240

+
#define COGL_FIXED_240          (COGL_FIXED_FROM_INT (240))
+
+

+Evaluates to the number 240 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_255

+
#define COGL_FIXED_255          (COGL_FIXED_FROM_INT (255))
+
+

+Evaluates to the number 255 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_270

+
#define COGL_FIXED_270          (COGL_FIXED_FROM_INT (270))
+
+

+Evaluates to the number 270 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_360

+
#define COGL_FIXED_360          (COGL_FIXED_FROM_INT (360))
+
+

+Evaluates to the number 360 in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_FIXED_MUL()

+
#define COGL_FIXED_MUL(a,b)             (cogl_fixed_mul ((a), (b)))
+
+

+Computes (a * b). +

+
++++ + + + + + + + + + + +

a :

a CoglFixed number

b :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_DIV()

+
#define COGL_FIXED_DIV(a,b)             (cogl_fixed_div ((a), (b)))
+
+

+Computes (a / b). +

+
++++ + + + + + + + + + + +

a :

a CoglFixed number

b :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_MUL_DIV()

+
#define COGL_FIXED_MUL_DIV(a,b,c)       (cogl_fixed_mul_div ((a), (b), (c)))
+
+

+Computes ((a * b) / c). It is logically equivalent to: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+res = COGL_FIXED_DIV (COGL_FIXED_MUL (a, b), c);
+
+ +

+

+

+But it is shorter to type. +

+
++++ + + + + + + + + + + + + + + +

a :

a CoglFixed number

b :

a CoglFixed number

c :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FAST_DIV()

+
#define COGL_FIXED_FAST_DIV(a,b)        ((((a) << 8) / (b)) << 8)
+
+

+Fast version of COGL_FIXED_DIV, implemented as a macro. +

+

+

+
+

Note

This macro might lose precision. If the precision of the result +is important use COGL_FIXED_DIV instead.
+

+

+
++++ + + + + + + + + + + +

a :

a CoglFixed number

b :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FAST_MUL()

+
#define COGL_FIXED_FAST_MUL(a,b)        ((a) >> 8) * ((b) >> 8)
+
+

+Fast version of COGL_FIXED_MUL, implemented as a macro. +

+

+

+
+

Note

This macro might lose precision. If the precision of the result +is important use COGL_FIXED_MUL instead.
+

+

+
++++ + + + + + + + + + + +

a :

a CoglFixed number

b :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FRACTION()

+
#define COGL_FIXED_FRACTION(x)          ((x) & ((1 << COGL_FIXED_Q) - 1))
+
+

+Retrieves the fractionary part of x. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_FLOOR()

+
#define             COGL_FIXED_FLOOR(x)
+

+Rounds down a fixed point number to the previous integer. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_CEIL()

+
#define COGL_FIXED_CEIL(x)              (COGL_FIXED_FLOOR ((x) + 0xffff))
+
+

+Rounds up a fixed point number to the next integer. +

+
++++ + + + + +

x :

a CoglFixed number
+

Since 1.0

+
+
+
+

COGL_FIXED_2_PI

+
#define COGL_FIXED_2_PI         (0x0006487f)
+
+

+Two times pi, expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_PI

+
#define COGL_FIXED_PI           (0x0003243f)
+
+

+The number pi, expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_PI_2

+
#define COGL_FIXED_PI_2         (0x00019220)
+
+

+Half pi, expressed as a CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_FIXED_PI_4

+
#define COGL_FIXED_PI_4         (0x0000c910)
+
+

+pi / 4, expressed as CoglFixed number. +

+

Since 1.0

+
+
+
+

COGL_RADIANS_TO_DEGREES

+
#define COGL_RADIANS_TO_DEGREES (0x394bb8)
+
+

+Evaluates to 180 / pi in fixed point notation. +

+

Since 1.0

+
+
+
+

COGL_SQRTI_ARG_10_PERCENT

+
#define COGL_SQRTI_ARG_10_PERCENT 5590
+
+

+Maximum argument that can be passed to cogl_sqrti() for which the +resulting error is < 10% +

+

Since 1.0

+
+
+
+

COGL_SQRTI_ARG_5_PERCENT

+
#define COGL_SQRTI_ARG_5_PERCENT 210
+
+

+Maximum argument that can be passed to cogl_sqrti() for which the +resulting error is < 5% +

+

Since 1.0

+
+
+
+

COGL_SQRTI_ARG_MAX

+
#define COGL_SQRTI_ARG_MAX 0x3fffff
+
+

+Maximum argument that can be passed to cogl_sqrti() function. +

+

Since 1.0

+
+
+
+

cogl_sqrti ()

+
int                 cogl_sqrti                          (int x);
+

+Very fast fixed point implementation of square root for integers. +

+

+This function is at least 6x faster than clib sqrt() on x86, and (this is +not a typo!) about 500x faster on ARM without FPU. It's error is less than +5% for arguments smaller than COGL_SQRTI_ARG_5_PERCENT and less than 10% +for narguments smaller than COGL_SQRTI_ARG_10_PERCENT. The maximum +argument that can be passed to this function is COGL_SQRTI_ARG_MAX. +

+
++++ + + + + + + + + + + +

x :

integer value

Returns :

integer square root.
+

Since 1.0

+
+
+
+

cogl_fixed_atan2 ()

+
CoglFixed           cogl_fixed_atan2                    (CoglFixed a,
+                                                         CoglFixed b);
+

+Computes the arc tangent of a / b but uses the sign of both +arguments to return the angle in right quadrant. +

+
++++ + + + + + + + + + + + + + + +

a :

the numerator as a CoglFixed number

b :

the denominator as a CoglFixed number

Returns :

the arc tangent of the passed fraction, in fixed point +notation
+

Since 1.0

+
+
+
+

cogl_fixed_atan ()

+
CoglFixed           cogl_fixed_atan                     (CoglFixed a);
+

+Computes the arc tangent of a. +

+
++++ + + + + + + + + + + +

a :

a CoglFixed number

Returns :

the arc tangent of the passed value, in fixed point notation
+

Since 1.0

+
+
+
+

cogl_fixed_cos ()

+
CoglFixed           cogl_fixed_cos                      (CoglFixed angle);
+

+Computes the cosine of angle. +

+
++++ + + + + + + + + + + +

angle :

a CoglFixed number

Returns :

the cosine of the passed angle, in fixed point notation
+

Since 1.0

+
+
+
+

cogl_fixed_log2 ()

+
CoglFixed           cogl_fixed_log2                     (unsigned int x);
+

+Calculates base 2 logarithm. +

+

+This function is some 2.5 times faster on x86, and over 12 times faster on +fpu-less arm, than using libc log(). +

+
++++ + + + + + + + + + + +

x :

value to calculate base 2 logarithm from

Returns :

base 2 logarithm.
+

Since 1.0

+
+
+
+

cogl_fixed_pow ()

+
unsigned int        cogl_fixed_pow                      (unsigned int x,
+                                                         CoglFixed y);
+

+Calculates x to the y power. +

+
++++ + + + + + + + + + + + + + + +

x :

base

y :

+CoglFixed exponent

Returns :

the power of x to the y +
+

Since 1.0

+
+
+
+

cogl_fixed_pow2 ()

+
unsigned int        cogl_fixed_pow2                     (CoglFixed x);
+

+Calculates 2 to the x power. +

+

+This function is around 11 times faster on x86, and around 22 times faster +on fpu-less arm than libc pow(2, x). +

+
++++ + + + + + + + + + + +

x :

a CoglFixed number

Returns :

the power of 2 to the passed value
+

Since 1.0

+
+
+
+

cogl_fixed_sin ()

+
CoglFixed           cogl_fixed_sin                      (CoglFixed angle);
+

+Computes the sine of angle. +

+
++++ + + + + + + + + + + +

angle :

a CoglFixed number

Returns :

the sine of the passed angle, in fixed point notation
+

Since 1.0

+
+
+
+

cogl_fixed_sqrt ()

+
CoglFixed           cogl_fixed_sqrt                     (CoglFixed x);
+

+Computes the square root of x. +

+
++++ + + + + + + + + + + +

x :

a CoglFixed number

Returns :

the square root of the passed value, in floating point +notation
+

Since 1.0

+
+
+
+

cogl_fixed_tan ()

+
CoglFixed           cogl_fixed_tan                      (CoglFixed angle);
+

+Computes the tangent of angle. +

+
++++ + + + + + + + + + + +

angle :

a CoglFixed number

Returns :

the tangent of the passed angle, in fixed point notation
+

Since 1.0

+
+
+
+

cogl_fixed_div ()

+
CoglFixed           cogl_fixed_div                      (CoglFixed a,
+                                                         CoglFixed b);
+
+
+
+

cogl_fixed_mul ()

+
CoglFixed           cogl_fixed_mul                      (CoglFixed a,
+                                                         CoglFixed b);
+
+
+
+

cogl_fixed_mul_div ()

+
CoglFixed           cogl_fixed_mul_div                  (CoglFixed a,
+                                                         CoglFixed b,
+                                                         CoglFixed c);
+
+
+
+

CoglAngle

+
typedef int32_t CoglAngle;
+
+

+Integer representation of an angle such that 1024 corresponds to +full circle (i.e., 2 * pi). +

+

Since 1.0

+
+
+
+

COGL_ANGLE_FROM_DEG()

+
#define COGL_ANGLE_FROM_DEG(x)  (COGL_FLOAT_TO_INT (((float)(x) * 1024.0f) / 360.0f))
+
+

+Converts an angle in degrees into a CoglAngle. +

+
++++ + + + + +

x :

an angle in degrees in floating point notation
+

Since 1.0

+
+
+
+

COGL_ANGLE_FROM_DEGX()

+
#define COGL_ANGLE_FROM_DEGX(x) (COGL_FIXED_TO_INT ((((x) / 360) * 1024) + COGL_FIXED_0_5))
+
+

+Converts an angle in degrees into a CoglAngle. +

+
++++ + + + + +

x :

an angle in degrees in fixed point notation
+

Since 1.0

+
+
+
+

COGL_ANGLE_TO_DEG()

+
#define COGL_ANGLE_TO_DEG(x)    (((float)(x) * 360.0) / 1024.0)
+
+

+Converts a CoglAngle into an angle in degrees, using floatint point +notation. +

+
++++ + + + + +

x :

a CoglAngle +
+

Since 1.0

+
+
+
+

COGL_ANGLE_TO_DEGX()

+
#define COGL_ANGLE_TO_DEGX(x)   (COGL_FIXED_FROM_INT ((x) * 45) / 128)
+
+

+Converts a CoglAngle into an angle in degrees, using fixed point notation +

+
++++ + + + + +

x :

a CoglAngle +
+

Since 1.0

+
+
+
+

cogl_angle_cos ()

+
CoglFixed           cogl_angle_cos                      (CoglAngle angle);
+

+Computes the cosine of angle +

+
++++ + + + + + + + + + + +

angle :

an angle expressed using CoglAngle +

Returns :

the cosine of the passed angle
+

Since 1.0

+
+
+
+

cogl_angle_sin ()

+
CoglFixed           cogl_angle_sin                      (CoglAngle angle);
+

+Computes the sine of angle +

+
++++ + + + + + + + + + + +

angle :

an angle expressed using CoglAngle +

Returns :

the sine of the passed angle
+

Since 1.0

+
+
+
+

cogl_angle_tan ()

+
CoglFixed           cogl_angle_tan                      (CoglAngle angle);
+

+Computes the tangent of angle +

+
++++ + + + + + + + + + + +

angle :

an angle expressed using CoglAngle +

Returns :

the tangent of the passed angle
+

Since 1.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-GType-Integration-API.html b/doc/reference/cogl/html/cogl-GType-Integration-API.html new file mode 100644 index 0000000..2610341 --- /dev/null +++ b/doc/reference/cogl/html/cogl-GType-Integration-API.html @@ -0,0 +1,74 @@ + + + + +GType Integration API + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

GType Integration API

+

GType Integration API

+
+
+

Synopsis

+
GType               cogl_gtype_matrix_get_type          (void);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_gtype_matrix_get_type ()

+
GType               cogl_gtype_matrix_get_type          (void);
+
+

Warning

+

cogl_gtype_matrix_get_type has been deprecated since version 1.18 and should not be used in newly-written code. Use cogl_matrix_get_gtype() instead.

+
+
++++ + + + + +

Returns :

the GType for the registered "CoglMatrix" boxed type. This +can be used for example to define GObject properties that accept a +CoglMatrix value.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-General-API-(Deprecated).html b/doc/reference/cogl/html/cogl-General-API-(Deprecated).html new file mode 100644 index 0000000..06e5d62 --- /dev/null +++ b/doc/reference/cogl/html/cogl-General-API-(Deprecated).html @@ -0,0 +1,284 @@ + + + + +General API (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

General API (Deprecated)

+

General API (Deprecated)

+
+
+

Synopsis

+
CoglBool            cogl_check_extension                (const char *name,
+                                                         const char *ext);
+void                cogl_viewport                       (unsigned int width,
+                                                         unsigned int height);
+void                cogl_get_bitmasks                   (int *red,
+                                                         int *green,
+                                                         int *blue,
+                                                         int *alpha);
+void                cogl_set_depth_test_enabled         (CoglBool setting);
+CoglBool            cogl_get_depth_test_enabled         (void);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_check_extension ()

+
CoglBool            cogl_check_extension                (const char *name,
+                                                         const char *ext);
+
+

Warning

+

cogl_check_extension has been deprecated since version 1.2 and should not be used in newly-written code. OpenGL is an implementation detail for Cogl and so it's + not appropriate to expose OpenGL extensions through the Cogl API. This + function can be replaced by the following equivalent code: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+CoglBool retval = (strstr (ext, name) != NULL) ? TRUE : FALSE;
+
+ +
+

+Check whether name occurs in list of extensions in ext. +

+
++++ + + + + + + + + + + + + + + +

name :

extension to check for

ext :

list of extensions

Returns :

+TRUE if the extension occurs in the list, FALSE otherwise.
+
+
+
+

cogl_viewport ()

+
void                cogl_viewport                       (unsigned int width,
+                                                         unsigned int height);
+
+

Warning

+

cogl_viewport has been deprecated since version 1.8 and should not be used in newly-written code. Use cogl_framebuffer_set_viewport instead

+
+

+Replace the current viewport with the given values. +

+
++++ + + + + + + + + + + +

width :

Width of the viewport

height :

Height of the viewport
+

Since 0.8.2

+
+
+
+

cogl_get_bitmasks ()

+
void                cogl_get_bitmasks                   (int *red,
+                                                         int *green,
+                                                         int *blue,
+                                                         int *alpha);
+
+

Warning

+

cogl_get_bitmasks has been deprecated since version 1.8 and should not be used in newly-written code. Use cogl_framebuffer_get_red/green/blue/alpha_bits() + instead

+
+

+Gets the number of bitplanes used for each of the color components +in the color buffer. Pass NULL for any of the arguments if the +value is not required. +

+
++++ + + + + + + + + + + + + + + + + + + +

red :

Return location for the number of red bits or NULL. [out] +

green :

Return location for the number of green bits or NULL. [out] +

blue :

Return location for the number of blue bits or NULL. [out] +

alpha :

Return location for the number of alpha bits or NULL. [out] +
+
+
+
+

cogl_set_depth_test_enabled ()

+
void                cogl_set_depth_test_enabled         (CoglBool setting);
+
+

Warning

+

cogl_set_depth_test_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_depth_state() instead

+
+

+Sets whether depth testing is enabled. If it is disabled then the +order that actors are layered on the screen depends solely on the +order specified using clutter_actor_raise() and +clutter_actor_lower(), otherwise it will also take into account the +actor's depth. Depth testing is disabled by default. +

+
++++ + + + + +

setting :

+TRUE to enable depth testing or FALSE to disable.
+
+
+
+

cogl_get_depth_test_enabled ()

+
CoglBool            cogl_get_depth_test_enabled         (void);
+
+

Warning

+

cogl_get_depth_test_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_depth_state() instead

+
+

+Queries if depth testing has been enabled via cogl_set_depth_test_enable() +

+
++++ + + + + +

Returns :

+TRUE if depth testing is enabled, and FALSE otherwise
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-General-API.html b/doc/reference/cogl/html/cogl-General-API.html new file mode 100644 index 0000000..7f1ac45 --- /dev/null +++ b/doc/reference/cogl/html/cogl-General-API.html @@ -0,0 +1,2784 @@ + + + + +General API + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

General API

+

General API — General purpose API

+
+
+

Synopsis

+
                    CoglObject;
+void *              cogl_object_ref                     (void *object);
+void                cogl_object_unref                   (void *object);
+                    CoglUserDataKey;
+void *              cogl_object_get_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key);
+void                cogl_object_set_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+#define             COGL_INVALID_HANDLE
+typedef             CoglHandle;
+CoglHandle          cogl_handle_ref                     (CoglHandle handle);
+void                cogl_handle_unref                   (CoglHandle handle);
+
+void                (*CoglFuncPtr)                      (void);
+enum                CoglPixelFormat;
+enum                CoglBufferTarget;
+enum                CoglBufferBit;
+enum                CoglAttributeType;
+
+enum                CoglFeatureFlags;
+CoglFeatureFlags    cogl_get_features                   (void);
+CoglBool            cogl_features_available             (CoglFeatureFlags features);
+CoglFuncPtr         cogl_get_proc_address               (const char *name);
+GOptionGroup *      cogl_get_option_group               (void);
+
+void                cogl_push_matrix                    (void);
+void                cogl_pop_matrix                     (void);
+void                cogl_scale                          (float x,
+                                                         float y,
+                                                         float z);
+void                cogl_translate                      (float x,
+                                                         float y,
+                                                         float z);
+void                cogl_rotate                         (float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_transform                      (const CoglMatrix *matrix);
+void                cogl_frustum                        (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_perspective                    (float fovy,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_ortho                          (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+
+void                cogl_get_modelview_matrix           (CoglMatrix *matrix);
+void                cogl_set_modelview_matrix           (CoglMatrix *matrix);
+void                cogl_get_projection_matrix          (CoglMatrix *matrix);
+void                cogl_set_projection_matrix          (CoglMatrix *matrix);
+void                cogl_set_viewport                   (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+void                cogl_get_viewport                   (float v[4]);
+
+void                cogl_clear                          (const CoglColor *color,
+                                                         unsigned long  buffers);
+void                cogl_set_backface_culling_enabled   (CoglBool setting);
+CoglBool            cogl_get_backface_culling_enabled   (void);
+
+enum                CoglFogMode;
+void                cogl_set_fog                        (const CoglColor *fog_color,
+                                                         CoglFogMode mode,
+                                                         float density,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_disable_fog                    (void);
+
+void                cogl_set_source                     (void *material);
+void                cogl_set_source_color               (const CoglColor *color);
+void                cogl_set_source_color4ub            (uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_set_source_color4f             (float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+void                cogl_set_source_texture             (CoglTexture *texture);
+void *              cogl_get_source                     (void);
+void                cogl_push_source                    (void *material);
+void                cogl_pop_source                     (void);
+
+enum                CoglReadPixelsFlags;
+void                cogl_read_pixels                    (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+
+void                cogl_flush                          (void);
+void                cogl_begin_gl                       (void);
+void                cogl_end_gl                         (void);
+
+
+
+

Description

+

+General utility functions for COGL. +

+
+
+

Details

+
+

CoglObject

+
typedef struct _CoglObject CoglObject;
+

+Ref Func: cogl_object_ref +Unref Func: cogl_object_unref +Set Value Func: cogl_object_value_set_object +Get Value Func: cogl_object_value_get_object +

+
+
+
+

cogl_object_ref ()

+
void *              cogl_object_ref                     (void *object);
+

+Increases the reference count of object by 1 +

+
++++ + + + + + + + + + + +

object :

a CoglObject +

Returns :

the object, with its reference count increased
+
+
+
+

cogl_object_unref ()

+
void                cogl_object_unref                   (void *object);
+

+Drecreases the reference count of object by 1; if the reference +count reaches 0, the resources allocated by object will be freed +

+
++++ + + + + +

object :

a CoglObject +
+
+
+
+

CoglUserDataKey

+
typedef struct {
+  int unused;
+} CoglUserDataKey;
+
+

+A CoglUserDataKey is used to declare a key for attaching data to a +CoglObject using cogl_object_set_user_data. The typedef only exists as a +formality to make code self documenting since only the unique address of a +CoglUserDataKey is used. +

+

+Typically you would declare a static CoglUserDataKey and set private data +on an object something like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40

+
+
+
+
+
+
+
+
+
+
+
+
+static CoglUserDataKey path_private_key;
+
+static void
+destroy_path_private_cb (void *data)
+{
+  g_free (data);
+}
+
+static void
+my_path_set_data (CoglPath *path, void *data)
+{
+  cogl_object_set_user_data (COGL_OBJECT (path),
+                             &private_key,
+                             data,
+                             destroy_path_private_cb);
+}
+
+ +

+

+
++++ + + + + +

int unused;

ignored.
+

Since 1.4

+
+
+
+

cogl_object_get_user_data ()

+
void *              cogl_object_get_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key);
+

+Finds the user data previously associated with object using +the given key. If no user data has been associated with object +for the given key this function returns NULL. +

+
++++ + + + + + + + + + + + + + + +

object :

The object with associated private data to query

key :

The address of a CoglUserDataKey which provides a unique value +with which to index the private data.

Returns :

The user data previously associated +with object using the given key; or NULL if no associated +data is found. [transfer none] +
+

Since 1.4

+
+
+
+

cogl_object_set_user_data ()

+
void                cogl_object_set_user_data           (CoglObject *object,
+                                                         CoglUserDataKey *key,
+                                                         void *user_data,
+                                                         CoglUserDataDestroyCallback destroy);
+

+Associates some private user_data with a given CoglObject. To +later remove the association call cogl_object_set_user_data() with +the same key but NULL for the user_data. +

+
++++ + + + + + + + + + + + + + + + + + + +

object :

The object to associate private data with

key :

The address of a CoglUserDataKey which provides a unique value +with which to index the private data.

user_data :

The data to associate with the given object, +or NULL to remove a previous association.

destroy :

A CoglUserDataDestroyCallback to call if the object is +destroyed or if the association is removed by later setting +NULL data for the same key.
+

Since 1.4

+
+
+
+

COGL_INVALID_HANDLE

+
#define COGL_INVALID_HANDLE NULL
+
+

+A COGL handle that is not valid, used for unitialized handles as well as +error conditions. +

+
+
+
+

CoglHandle

+
typedef void * CoglHandle;
+
+

+Type used for storing references to cogl objects, the CoglHandle is +a fully opaque type without any public data members. +

+
+
+
+

cogl_handle_ref ()

+
CoglHandle          cogl_handle_ref                     (CoglHandle handle);
+

+Increases the reference count of handle by 1 +

+
++++ + + + + + + + + + + +

handle :

a CoglHandle +

Returns :

the handle, with its reference count increased. [transfer none] +
+
+
+
+

cogl_handle_unref ()

+
void                cogl_handle_unref                   (CoglHandle handle);
+

+Drecreases the reference count of handle by 1; if the reference +count reaches 0, the resources allocated by handle will be freed +

+
++++ + + + + +

handle :

a CoglHandle +
+
+
+
+

CoglFuncPtr ()

+
void                (*CoglFuncPtr)                      (void);
+

+The type used by cogl for function pointers, note that this type +is used as a generic catch-all cast for function pointers and the +actual arguments and return type may be different. +

+
+
+
+

enum CoglPixelFormat

+
typedef enum {
+ /*< prefix=COGL_PIXEL_FORMAT >*/
+  COGL_PIXEL_FORMAT_ANY           = 0,
+  COGL_PIXEL_FORMAT_A_8           = 1 | COGL_A_BIT,
+
+  COGL_PIXEL_FORMAT_RGB_565       = 4,
+  COGL_PIXEL_FORMAT_RGBA_4444     = 5 | COGL_A_BIT,
+  COGL_PIXEL_FORMAT_RGBA_5551     = 6 | COGL_A_BIT,
+  COGL_PIXEL_FORMAT_YUV           = 7,
+  COGL_PIXEL_FORMAT_G_8           = 8,
+
+  COGL_PIXEL_FORMAT_RG_88         = 9,
+
+  COGL_PIXEL_FORMAT_RGB_888       = 2,
+  COGL_PIXEL_FORMAT_BGR_888       = (2 | COGL_BGR_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_8888     = (3 | COGL_A_BIT),
+  COGL_PIXEL_FORMAT_BGRA_8888     = (3 | COGL_A_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_8888     = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_8888     = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_1010102  = (13 | COGL_A_BIT),
+  COGL_PIXEL_FORMAT_BGRA_1010102  = (13 | COGL_A_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_2101010  = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_2101010  = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
+  COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
+  COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
+
+  COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
+  COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
+
+  COGL_PIXEL_FORMAT_DEPTH_16  = (9 | COGL_DEPTH_BIT),
+  COGL_PIXEL_FORMAT_DEPTH_32  = (3 | COGL_DEPTH_BIT),
+
+  COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT)
+} CoglPixelFormat;
+
+

+Pixel formats used by Cogl. For the formats with a byte per +component, the order of the components specify the order in +increasing memory addresses. So for example +COGL_PIXEL_FORMAT_RGB_888 would have the red component in the +lowest address, green in the next address and blue after that +regardless of the endianness of the system. +

+

+For the formats with non byte aligned components the component +order specifies the order within a 16-bit or 32-bit number from +most significant bit to least significant. So for +COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits +11-15, the green component would be in 6-11 and the blue component +would be in 1-5. Therefore the order in memory depends on the +endianness of the system. +

+

+When uploading a texture COGL_PIXEL_FORMAT_ANY can be used as the +internal format. Cogl will try to pick the best format to use +internally and convert the texture data if necessary. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_PIXEL_FORMAT_ANY

Any format +

COGL_PIXEL_FORMAT_A_8

8 bits alpha mask +

COGL_PIXEL_FORMAT_RGB_565

RGB, 16 bits +

COGL_PIXEL_FORMAT_RGBA_4444

RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_5551

RGBA, 16 bits +

COGL_PIXEL_FORMAT_YUV

Not currently supported +

COGL_PIXEL_FORMAT_G_8

Single luminance component +

COGL_PIXEL_FORMAT_RG_88

RG, 16 bits. Note that red-green textures + are only available if COGL_FEATURE_ID_TEXTURE_RG is advertised. + See cogl_texture_set_components() for details. +

COGL_PIXEL_FORMAT_RGB_888

RGB, 24 bits +

COGL_PIXEL_FORMAT_BGR_888

BGR, 24 bits +

COGL_PIXEL_FORMAT_RGBA_8888

RGBA, 32 bits +

COGL_PIXEL_FORMAT_BGRA_8888

BGRA, 32 bits +

COGL_PIXEL_FORMAT_ARGB_8888

ARGB, 32 bits +

COGL_PIXEL_FORMAT_ABGR_8888

ABGR, 32 bits +

COGL_PIXEL_FORMAT_RGBA_1010102

RGBA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_BGRA_1010102

BGRA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ARGB_2101010

ARGB, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ABGR_2101010

ABGR, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_RGBA_8888_PRE

Premultiplied RGBA, 32 bits +

COGL_PIXEL_FORMAT_BGRA_8888_PRE

Premultiplied BGRA, 32 bits +

COGL_PIXEL_FORMAT_ARGB_8888_PRE

Premultiplied ARGB, 32 bits +

COGL_PIXEL_FORMAT_ABGR_8888_PRE

Premultiplied ABGR, 32 bits +

COGL_PIXEL_FORMAT_RGBA_4444_PRE

Premultiplied RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_5551_PRE

Premultiplied RGBA, 16 bits +

COGL_PIXEL_FORMAT_RGBA_1010102_PRE

Premultiplied RGBA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_BGRA_1010102_PRE

Premultiplied BGRA, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ARGB_2101010_PRE

Premultiplied ARGB, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_ABGR_2101010_PRE

Premultiplied ABGR, 32 bits, 10 bpc +

COGL_PIXEL_FORMAT_DEPTH_16

COGL_PIXEL_FORMAT_DEPTH_32

COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8

+

Since 0.8

+
+
+
+

enum CoglBufferTarget

+
typedef enum {
+  COGL_WINDOW_BUFFER      = (1 << 1),
+  COGL_OFFSCREEN_BUFFER   = (1 << 2)
+} CoglBufferTarget;
+
+

+Target flags for FBOs. +

+
++++ + + + + + + + + + + +

COGL_WINDOW_BUFFER

FIXME +

COGL_OFFSCREEN_BUFFER

FIXME +
+

Since 0.8

+
+
+
+

enum CoglBufferBit

+
typedef enum {
+  COGL_BUFFER_BIT_COLOR   = 1L<<0,
+  COGL_BUFFER_BIT_DEPTH   = 1L<<1,
+  COGL_BUFFER_BIT_STENCIL = 1L<<2
+} CoglBufferBit;
+
+

+Types of auxiliary buffers +

+
++++ + + + + + + + + + + + + + + +

COGL_BUFFER_BIT_COLOR

Selects the primary color buffer +

COGL_BUFFER_BIT_DEPTH

Selects the depth buffer +

COGL_BUFFER_BIT_STENCIL

Selects the stencil buffer +
+

Since 1.0

+
+
+
+

enum CoglAttributeType

+
typedef enum {
+  COGL_ATTRIBUTE_TYPE_BYTE           = 0x1400,
+  COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE  = 0x1401,
+  COGL_ATTRIBUTE_TYPE_SHORT          = 0x1402,
+  COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT = 0x1403,
+  COGL_ATTRIBUTE_TYPE_FLOAT          = 0x1406
+} CoglAttributeType;
+
+

+Data types for the components of a vertex attribute. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

COGL_ATTRIBUTE_TYPE_BYTE

Data is the same size of a byte +

COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE

Data is the same size of an + unsigned byte +

COGL_ATTRIBUTE_TYPE_SHORT

Data is the same size of a short integer +

COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT

Data is the same size of + an unsigned short integer +

COGL_ATTRIBUTE_TYPE_FLOAT

Data is the same size of a float +
+

Since 1.0

+
+
+
+

enum CoglFeatureFlags

+
typedef enum {
+  COGL_FEATURE_TEXTURE_RECTANGLE      = (1 << 1),
+  COGL_FEATURE_TEXTURE_NPOT           = (1 << 2),
+  COGL_FEATURE_TEXTURE_YUV            = (1 << 3),
+  COGL_FEATURE_TEXTURE_READ_PIXELS    = (1 << 4),
+  COGL_FEATURE_SHADERS_GLSL           = (1 << 5),
+  COGL_FEATURE_OFFSCREEN              = (1 << 6),
+  COGL_FEATURE_OFFSCREEN_MULTISAMPLE  = (1 << 7),
+  COGL_FEATURE_OFFSCREEN_BLIT         = (1 << 8),
+  COGL_FEATURE_FOUR_CLIP_PLANES       = (1 << 9),
+  COGL_FEATURE_STENCIL_BUFFER         = (1 << 10),
+  COGL_FEATURE_VBOS		      = (1 << 11),
+  COGL_FEATURE_PBOS		      = (1 << 12),
+  COGL_FEATURE_UNSIGNED_INT_INDICES   = (1 << 13),
+  COGL_FEATURE_DEPTH_RANGE            = (1 << 14),
+  COGL_FEATURE_TEXTURE_NPOT_BASIC     = (1 << 15),
+  COGL_FEATURE_TEXTURE_NPOT_MIPMAP    = (1 << 16),
+  COGL_FEATURE_TEXTURE_NPOT_REPEAT    = (1 << 17),
+  COGL_FEATURE_POINT_SPRITE           = (1 << 18),
+  COGL_FEATURE_TEXTURE_3D             = (1 << 19),
+  COGL_FEATURE_SHADERS_ARBFP          = (1 << 20),
+  COGL_FEATURE_MAP_BUFFER_FOR_READ    = (1 << 21),
+  COGL_FEATURE_MAP_BUFFER_FOR_WRITE   = (1 << 22),
+  COGL_FEATURE_ONSCREEN_MULTIPLE      = (1 << 23),
+  COGL_FEATURE_DEPTH_TEXTURE          = (1 << 24)
+} CoglFeatureFlags;
+
+

+Flags for the supported features. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_FEATURE_TEXTURE_RECTANGLE

ARB_texture_rectangle support +

COGL_FEATURE_TEXTURE_NPOT

Non power of two textures are supported + by the hardware. This is a equivalent to the + COGL_FEATURE_TEXTURE_NPOT_BASIC, COGL_FEATURE_TEXTURE_NPOT_MIPMAP + and COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined. +

COGL_FEATURE_TEXTURE_YUV

ycbcr conversion support +

COGL_FEATURE_TEXTURE_READ_PIXELS

glReadPixels() support +

COGL_FEATURE_SHADERS_GLSL

GLSL support +

COGL_FEATURE_OFFSCREEN

FBO support +

COGL_FEATURE_OFFSCREEN_MULTISAMPLE

Multisample support on FBOs +

COGL_FEATURE_OFFSCREEN_BLIT

Blit support on FBOs +

COGL_FEATURE_FOUR_CLIP_PLANES

At least 4 clip planes available +

COGL_FEATURE_STENCIL_BUFFER

Stencil buffer support +

COGL_FEATURE_VBOS

VBO support +

COGL_FEATURE_PBOS

PBO support +

COGL_FEATURE_UNSIGNED_INT_INDICES

Set if + COGL_INDICES_TYPE_UNSIGNED_INT is supported in + cogl_vertex_buffer_indices_new(). +

COGL_FEATURE_DEPTH_RANGE

cogl_material_set_depth_range() support +

COGL_FEATURE_TEXTURE_NPOT_BASIC

The hardware supports non power + of two textures, but you also need to check the + COGL_FEATURE_TEXTURE_NPOT_MIPMAP and COGL_FEATURE_TEXTURE_NPOT_REPEAT + features to know if the hardware supports npot texture mipmaps + or repeat modes other than + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively. +

COGL_FEATURE_TEXTURE_NPOT_MIPMAP

Mipmapping is supported in + conjuntion with non power of two textures. +

COGL_FEATURE_TEXTURE_NPOT_REPEAT

Repeat modes other than + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the + hardware. +

COGL_FEATURE_POINT_SPRITE

Whether + cogl_material_set_layer_point_sprite_coords_enabled() is supported. +

COGL_FEATURE_TEXTURE_3D

3D texture support +

COGL_FEATURE_SHADERS_ARBFP

ARBFP support +

COGL_FEATURE_MAP_BUFFER_FOR_READ

Whether cogl_buffer_map() is + supported with CoglBufferAccess including read support. +

COGL_FEATURE_MAP_BUFFER_FOR_WRITE

Whether cogl_buffer_map() is + supported with CoglBufferAccess including write support. +

COGL_FEATURE_ONSCREEN_MULTIPLE

COGL_FEATURE_DEPTH_TEXTURE

Whether CoglFramebuffer support rendering the + depth buffer to a texture. +
+

Since 0.8

+
+
+
+

cogl_get_features ()

+
CoglFeatureFlags    cogl_get_features                   (void);
+
+

Warning

+

cogl_get_features has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_foreach_feature() instead

+
+

+Returns all of the features supported by COGL. +

+
++++ + + + + +

Returns :

A logical OR of all the supported COGL features.
+

Since 0.8

+
+
+
+

cogl_features_available ()

+
CoglBool            cogl_features_available             (CoglFeatureFlags features);
+
+

Warning

+

cogl_features_available has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_has_feature() instead

+
+

+Checks whether the given COGL features are available. Multiple +features can be checked for by or-ing them together with the '|' +operator. TRUE is only returned if all of the requested features +are available. +

+
++++ + + + + + + + + + + +

features :

A bitmask of features to check for

Returns :

+TRUE if the features are available, FALSE otherwise.
+
+
+
+

cogl_get_proc_address ()

+
CoglFuncPtr         cogl_get_proc_address               (const char *name);
+

+Gets a pointer to a given GL or GL ES extension function. This acts +as a wrapper around glXGetProcAddress() or whatever is the +appropriate function for the current backend. +

+

+

+
+

Note

This function should not be used to query core opengl API +symbols since eglGetProcAddress for example doesn't allow this and +and may return a junk pointer if you do.
+

+

+
++++ + + + + + + + + + + +

name :

the name of the function.

Returns :

a pointer to the requested function or NULL if the +function is not available.
+
+
+
+

cogl_get_option_group ()

+
GOptionGroup *      cogl_get_option_group               (void);
+
+

Warning

+

cogl_get_option_group has been deprecated since version 1.16 and should not be used in newly-written code. Not replaced

+
+

+Retrieves the GOptionGroup used by Cogl to parse the command +line options. Clutter uses this to handle the Cogl command line +options during its initialization process. +

+
++++ + + + + +

Returns :

a GOptionGroup +
+

Since 1.0

+
+
+
+

cogl_push_matrix ()

+
void                cogl_push_matrix                    (void);
+
+

Warning

+

cogl_push_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_push_matrix() instead

+
+

+Stores the current model-view matrix on the matrix stack. The matrix +can later be restored with cogl_pop_matrix(). +

+
+
+
+

cogl_pop_matrix ()

+
void                cogl_pop_matrix                     (void);
+
+

Warning

+

cogl_pop_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_pop_matrix() instead

+
+

+Restores the current model-view matrix from the matrix stack. +

+
+
+
+

cogl_scale ()

+
void                cogl_scale                          (float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_scale has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_pop_matrix() instead

+
+

+Multiplies the current model-view matrix by one that scales the x, +y and z axes by the given values. +

+
++++ + + + + + + + + + + + + + + +

x :

Amount to scale along the x-axis

y :

Amount to scale along the y-axis

z :

Amount to scale along the z-axis
+
+
+
+

cogl_translate ()

+
void                cogl_translate                      (float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_translate has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_translate() instead

+
+

+Multiplies the current model-view matrix by one that translates the +model along all three axes according to the given values. +

+
++++ + + + + + + + + + + + + + + +

x :

Distance to translate along the x-axis

y :

Distance to translate along the y-axis

z :

Distance to translate along the z-axis
+
+
+
+

cogl_rotate ()

+
void                cogl_rotate                         (float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+
+

Warning

+

cogl_rotate has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_rotate() instead

+
+

+Multiplies the current model-view matrix by one that rotates the +model around the vertex specified by x, y and z. The rotation +follows the right-hand thumb rule so for example rotating by 10 +degrees about the vertex (0, 0, 1) causes a small counter-clockwise +rotation. +

+
++++ + + + + + + + + + + + + + + + + + + +

angle :

Angle in degrees to rotate.

x :

X-component of vertex to rotate around.

y :

Y-component of vertex to rotate around.

z :

Z-component of vertex to rotate around.
+
+
+
+

cogl_transform ()

+
void                cogl_transform                      (const CoglMatrix *matrix);
+
+

Warning

+

cogl_transform has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_transform() instead

+
+

+Multiplies the current model-view matrix by the given matrix. +

+
++++ + + + + +

matrix :

the matrix to multiply with the current model-view
+

Since 1.4

+
+
+
+

cogl_frustum ()

+
void                cogl_frustum                        (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+
+

Warning

+

cogl_frustum has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_frustum() instead

+
+

+Replaces the current projection matrix with a perspective matrix +for a given viewing frustum defined by 4 side clip planes that +all cross through the origin and 2 near and far clip planes. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+

Since 0.8.2

+
+
+
+

cogl_perspective ()

+
void                cogl_perspective                    (float fovy,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+
+

Warning

+

cogl_perspective has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_perspective() instead

+
+

+Replaces the current projection matrix with a perspective matrix +based on the provided values. +

+

+

+
+

Note

You should be careful not to have to great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

fovy :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_ortho ()

+
void                cogl_ortho                          (float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+
+

Warning

+

cogl_ortho has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_orthographic() instead

+
+

+Replaces the current projection matrix with an orthographic projection +matrix. See Figure 1, “” to see how the matrix is +calculated. +

+

+

+
+

Figure 1. 

+
+
+


+

+

+

+
+

Note

This function copies the arguments from OpenGL's glOrtho() even +though they are unnecessarily confusing due to the z near and z far +arguments actually being a "distance" from the origin, where +negative values are behind the viewer, instead of coordinates for +the z clipping planes which would have been consistent with the +left, right bottom and top arguments.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

left :

The coordinate for the left clipping plane

right :

The coordinate for the right clipping plane

bottom :

The coordinate for the bottom clipping plane

top :

The coordinate for the top clipping plane

near :

The distance to the near clipping +plane (negative if the plane is behind the viewer)

far :

The distance for the far clipping +plane (negative if the plane is behind the viewer)
+

Since 1.0

+
+
+
+

cogl_get_modelview_matrix ()

+
void                cogl_get_modelview_matrix           (CoglMatrix *matrix);
+
+

Warning

+

cogl_get_modelview_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_modelview_matrix() + instead

+
+

+Stores the current model-view matrix in matrix. +

+
++++ + + + + +

matrix :

return location for the model-view matrix. [out] +
+
+
+
+

cogl_set_modelview_matrix ()

+
void                cogl_set_modelview_matrix           (CoglMatrix *matrix);
+
+

Warning

+

cogl_set_modelview_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_set_modelview_matrix() + instead

+
+

+Loads matrix as the new model-view matrix. +

+
++++ + + + + +

matrix :

the new model-view matrix
+
+
+
+

cogl_get_projection_matrix ()

+
void                cogl_get_projection_matrix          (CoglMatrix *matrix);
+
+

Warning

+

cogl_get_projection_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_projection_matrix() + instead

+
+

+Stores the current projection matrix in matrix. +

+
++++ + + + + +

matrix :

return location for the projection matrix. [out] +
+
+
+
+

cogl_set_projection_matrix ()

+
void                cogl_set_projection_matrix          (CoglMatrix *matrix);
+
+

Warning

+

cogl_set_projection_matrix has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_set_projection_matrix() + instead

+
+

+Loads matrix as the new projection matrix. +

+
++++ + + + + +

matrix :

the new projection matrix
+
+
+
+

cogl_set_viewport ()

+
void                cogl_set_viewport                   (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+
+

Warning

+

cogl_set_viewport has been deprecated since version 1.8 and should not be used in newly-written code. Use cogl_framebuffer_set_viewport() instead

+
+

+Replaces the current viewport with the given values. +

+
++++ + + + + + + + + + + + + + + + + + + +

x :

X offset of the viewport

y :

Y offset of the viewport

width :

Width of the viewport

height :

Height of the viewport
+

Since 1.2

+
+
+
+

cogl_get_viewport ()

+
void                cogl_get_viewport                   (float v[4]);
+
+

Warning

+

cogl_get_viewport has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_framebuffer_get_viewport4fv() + instead

+
+

+Stores the current viewport in v. v[0] and v[1] get the x and y +position of the viewport and v[2] and v[3] get the width and +height. +

+
++++ + + + + +

v :

pointer to a 4 element array +of floats to receive the viewport dimensions. [out][array fixed-size=4] +
+
+
+
+

cogl_clear ()

+
void                cogl_clear                          (const CoglColor *color,
+                                                         unsigned long  buffers);
+
+

Warning

+

cogl_clear has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_clear() api instead

+
+

+Clears all the auxiliary buffers identified in the buffers mask, and if +that includes the color buffer then the specified color is used. +

+
++++ + + + + + + + + + + +

color :

Background color to clear to

buffers :

A mask of CoglBufferBit's identifying which auxiliary +buffers to clear
+
+
+
+

cogl_set_backface_culling_enabled ()

+
void                cogl_set_backface_culling_enabled   (CoglBool setting);
+
+

Warning

+

cogl_set_backface_culling_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_cull_face_mode() instead

+
+

+Sets whether textures positioned so that their backface is showing +should be hidden. This can be used to efficiently draw two-sided +textures or fully closed cubes without enabling depth testing. This +only affects calls to the cogl_rectangle* family of functions and +cogl_vertex_buffer_draw*. Backface culling is disabled by default. +

+
++++ + + + + +

setting :

+TRUE to enable backface culling or FALSE to disable.
+
+
+
+

cogl_get_backface_culling_enabled ()

+
CoglBool            cogl_get_backface_culling_enabled   (void);
+
+

Warning

+

cogl_get_backface_culling_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_cull_face_mode() instead

+
+

+Queries if backface culling has been enabled via +cogl_set_backface_culling_enabled() +

+
++++ + + + + +

Returns :

+TRUE if backface culling is enabled, and FALSE otherwise
+
+
+
+

enum CoglFogMode

+
typedef enum {
+  COGL_FOG_MODE_LINEAR,
+  COGL_FOG_MODE_EXPONENTIAL,
+  COGL_FOG_MODE_EXPONENTIAL_SQUARED
+} CoglFogMode;
+
+

+The fog mode determines the equation used to calculate the fogging blend +factor while fogging is enabled. The simplest COGL_FOG_MODE_LINEAR mode +determines f as: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+f = end - eye_distance / end - start
+
+ +

+

+

+Where eye_distance is the distance of the current fragment in eye +coordinates from the origin. +

+
++++ + + + + + + + + + + + + + + +

COGL_FOG_MODE_LINEAR

Calculates the fog blend factor as: +
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+f = end - eye_distance / end - start
+
+ +

COGL_FOG_MODE_EXPONENTIAL

Calculates the fog blend factor as: +
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+f = e ^ -(density * eye_distance)
+
+ +

COGL_FOG_MODE_EXPONENTIAL_SQUARED

Calculates the fog blend factor as: +
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+f = e ^ -(density * eye_distance)^2
+
+ +
+

Since 1.0

+
+
+
+

cogl_set_fog ()

+
void                cogl_set_fog                        (const CoglColor *fog_color,
+                                                         CoglFogMode mode,
+                                                         float density,
+                                                         float z_near,
+                                                         float z_far);
+
+

Warning

+

cogl_set_fog has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet shader api for fog

+
+

+Enables fogging. Fogging causes vertices that are further away from the eye +to be rendered with a different color. The color is determined according to +the chosen fog mode; at it's simplest the color is linearly interpolated so +that vertices at z_near are drawn fully with their original color and +vertices at z_far are drawn fully with fog_color. Fogging will remain +enabled until you call cogl_disable_fog(). +

+

+

+
+

Note

The fogging functions only work correctly when primitives use +unmultiplied alpha colors. By default Cogl will premultiply textures +and cogl_set_source_color() will premultiply colors, so unless you +explicitly load your textures requesting an unmultiplied internal format +and use cogl_material_set_color() you can only use fogging with fully +opaque primitives. This might improve in the future when we can depend +on fragment shaders.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

fog_color :

The color of the fog

mode :

A CoglFogMode that determines the equation used to calculate the +fogging blend factor.

density :

Used by COGL_FOG_MODE_EXPONENTIAL and by +COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.

z_near :

Position along Z axis where no fogging should be applied

z_far :

Position along Z axis where full fogging should be applied
+
+
+
+

cogl_disable_fog ()

+
void                cogl_disable_fog                    (void);
+
+

Warning

+

cogl_disable_fog has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet shader api for fog

+
+

+This function disables fogging, so primitives drawn afterwards will not be +blended with any previously set fog color. +

+
+
+
+

cogl_set_source ()

+
void                cogl_set_source                     (void *material);
+
+

Warning

+

cogl_set_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This function changes the material at the top of the source stack. +The material at the top of this stack defines the GPU state used to +process subsequent primitives, such as rectangles drawn with +cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw(). +

+
++++ + + + + +

material :

A CoglMaterial +
+

Since 1.0

+
+
+
+

cogl_set_source_color ()

+
void                cogl_set_source_color               (const CoglColor *color);
+
+

Warning

+

cogl_set_source_color has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color. This color will be used for any subsequent drawing +operation. +

+

+The color will be premultiplied by Cogl, so the color should be +non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for +semi-transparent red. +

+

+See also cogl_set_source_color4ub() and cogl_set_source_color4f() +if you already have the color components. +

+
++++ + + + + +

color :

a CoglColor +
+

Since 1.0

+
+
+
+

cogl_set_source_color4ub ()

+
void                cogl_set_source_color4ub            (uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+
+

Warning

+

cogl_set_source_color4ub has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color using unsigned bytes for each component. This +color will be used for any subsequent drawing operation. +

+

+The value for each component is an unsigned byte in the range +between 0 and 255. +

+
++++ + + + + + + + + + + + + + + + + + + +

red :

value of the red channel, between 0 and 255

green :

value of the green channel, between 0 and 255

blue :

value of the blue channel, between 0 and 255

alpha :

value of the alpha channel, between 0 and 255
+

Since 1.0

+
+
+
+

cogl_set_source_color4f ()

+
void                cogl_set_source_color4f             (float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+

Warning

+

cogl_set_source_color4f has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a solid fill source material +from the given color using normalized values for each component. This color +will be used for any subsequent drawing operation. +

+

+The value for each component is a fixed point number in the range +between 0 and 1.0. If the values passed in are outside that +range, they will be clamped. +

+
++++ + + + + + + + + + + + + + + + + + + +

red :

value of the red channel, between 0 and 1.0

green :

value of the green channel, between 0 and 1.0

blue :

value of the blue channel, between 0 and 1.0

alpha :

value of the alpha channel, between 0 and 1.0
+

Since 1.0

+
+
+
+

cogl_set_source_texture ()

+
void                cogl_set_source_texture             (CoglTexture *texture);
+
+

Warning

+

cogl_set_source_texture has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+This is a convenience function for creating a material with the first +layer set to texture and setting that material as the source with +cogl_set_source. +

+

+Note: There is no interaction between calls to cogl_set_source_color +and cogl_set_source_texture. If you need to blend a texture with a color then +you can create a simple material like this: +

+
+material = cogl_material_new ();
+cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
+cogl_material_set_layer (material, 0, tex_handle);
+cogl_set_source (material);
+
+

+

+
++++ + + + + +

texture :

The CoglTexture you want as your source
+

Since 1.0

+
+
+
+

cogl_get_source ()

+
void *              cogl_get_source                     (void);
+
+

Warning

+

cogl_get_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Returns the current source material as previously set using +cogl_set_source(). +

+

+

+
+

Note

You should typically consider the returned material immutable +and not try to change any of its properties unless you own a +reference to that material. At times you may be able to get a +reference to an internally managed materials and the result of +modifying such materials is undefined.
+

+

+
++++ + + + + +

Returns :

The current source material.
+

Since 1.6

+
+
+
+

cogl_push_source ()

+
void                cogl_push_source                    (void *material);
+
+

Warning

+

cogl_push_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Pushes the given material to the top of the source stack. The +material at the top of this stack defines the GPU state used to +process later primitives as defined by cogl_set_source(). +

+
++++ + + + + +

material :

A CoglMaterial +
+

Since 1.6

+
+
+
+

cogl_pop_source ()

+
void                cogl_pop_source                     (void);
+
+

Warning

+

cogl_pop_source has been deprecated since version 1.16 and should not be used in newly-written code. Latest drawing apis all take an explicit + CoglPipeline argument so this stack of + CoglMaterials shouldn't be used.

+
+

+Removes the material at the top of the source stack. The material +at the top of this stack defines the GPU state used to process +later primitives as defined by cogl_set_source(). +

+

Since 1.6

+
+
+
+

enum CoglReadPixelsFlags

+
typedef enum {
+ /*< prefix=COGL_READ_PIXELS >*/
+  COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0
+} CoglReadPixelsFlags;
+
+

+Flags for cogl_framebuffer_read_pixels_into_bitmap() +

+
++++ + + + + +

COGL_READ_PIXELS_COLOR_BUFFER

Read from the color buffer +
+

Since 1.0

+
+
+
+

cogl_read_pixels ()

+
void                cogl_read_pixels                    (int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglPixelFormat format,
+                                                         uint8_t *pixels);
+
+

Warning

+

cogl_read_pixels has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_framebuffer_read_pixels() instead

+
+

+This reads a rectangle of pixels from the current framebuffer where +position (0, 0) is the top left. The pixel at (x, y) is the first +read, and the data is returned with a rowstride of (width * 4). +

+

+Currently Cogl assumes that the framebuffer is in a premultiplied +format so if format is non-premultiplied it will convert it. To +read the pixel values without any conversion you should either +specify a format that doesn't use an alpha channel or use one of +the formats ending in PRE. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

x :

The window x position to start reading from

y :

The window y position to start reading from

width :

The width of the rectangle you want to read

height :

The height of the rectangle you want to read

source :

Identifies which auxillary buffer you want to read +(only COGL_READ_PIXELS_COLOR_BUFFER supported currently)

format :

The pixel format you want the result in +(only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)

pixels :

The location to write the pixel data.
+
+
+
+

cogl_flush ()

+
void                cogl_flush                          (void);
+

+This function should only need to be called in exceptional circumstances. +

+

+As an optimization Cogl drawing functions may batch up primitives +internally, so if you are trying to use raw GL outside of Cogl you stand a +better chance of being successful if you ask Cogl to flush any batched +geometry before making your state changes. +

+

+It only ensure that the underlying driver is issued all the commands +necessary to draw the batched primitives. It provides no guarantees about +when the driver will complete the rendering. +

+

+This provides no guarantees about the GL state upon returning and to avoid +confusing Cogl you should aim to restore any changes you make before +resuming use of Cogl. +

+

+If you are making state changes with the intention of affecting Cogl drawing +primitives you are 100% on your own since you stand a good chance of +conflicting with Cogl internals. For example clutter-gst which currently +uses direct GL calls to bind ARBfp programs will very likely break when Cogl +starts to use ARBfb programs itself for the material API. +

+

Since 1.0

+
+
+
+

cogl_begin_gl ()

+
void                cogl_begin_gl                       (void);
+
+

Warning

+

cogl_begin_gl has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglGLES2Context api instead

+
+

+We do not advise nor reliably support the interleaving of raw GL drawing and +Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl() +provide a simple mechanism that may at least give you a fighting chance of +succeeding. +

+

+Note: this doesn't help you modify the behaviour of Cogl drawing functions +through the modification of GL state; that will never be reliably supported, +but if you are trying to do something like: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30

+
+
+
+
+
+
+
+
+
+
+
+
+{
+   - setup some OpenGL state.
+   - draw using OpenGL (e.g. glDrawArrays() )
+   - reset modified OpenGL state.
+   - continue using Cogl to draw
+}
+
+ +

+

+

+You should surround blocks of drawing using raw GL with cogl_begin_gl() +and cogl_end_gl(): +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32

+
+
+
+
+
+
+
+
+
+
+
+
+{
+   cogl_begin_gl ();
+   - setup some OpenGL state.
+   - draw using OpenGL (e.g. glDrawArrays() )
+   - reset modified OpenGL state.
+   cogl_end_gl ();
+   - continue using Cogl to draw
+}
+
+ +

+

+

+Don't ever try and do: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+{
+   - setup some OpenGL state.
+   - use Cogl to draw
+   - reset modified OpenGL state.
+}
+
+ +

+

+

+When the internals of Cogl evolves, this is very liable to break. +

+

+This function will flush all batched primitives, and subsequently flush +all internal Cogl state to OpenGL as if it were going to draw something +itself. +

+

+The result is that the OpenGL modelview matrix will be setup; the state +corresponding to the current source material will be set up and other world +state such as backface culling, depth and fogging enabledness will be sent +to OpenGL. +

+

+

+
+

Note

No special material state is flushed, so if you want Cogl to setup a +simplified material state it is your responsibility to set a simple source +material before calling cogl_begin_gl(). E.g. by calling +cogl_set_source_color4ub().
+

+

+

+

+
+

Note

It is your responsibility to restore any OpenGL state that you modify +to how it was after calling cogl_begin_gl() if you don't do this then the +result of further Cogl calls is undefined.
+

+

+

+

+
+

Note

You can not nest begin/end blocks.
+

+

+

+Again we would like to stress, we do not advise the use of this API and if +possible we would prefer to improve Cogl than have developers require raw +OpenGL. +

+

Since 1.0

+
+
+
+

cogl_end_gl ()

+
void                cogl_end_gl                         (void);
+
+

Warning

+

cogl_end_gl has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglGLES2Context api instead

+
+

+This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing +code using raw OpenGL. Please refer to cogl_begin_gl() for full details. +

+

Since 1.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Materials-(Deprecated).html b/doc/reference/cogl/html/cogl-Materials-(Deprecated).html new file mode 100644 index 0000000..0f779f4 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Materials-(Deprecated).html @@ -0,0 +1,157 @@ + + + + +Materials (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Materials (Deprecated)

+

Materials (Deprecated)

+
+
+

Synopsis

+
CoglHandle          cogl_material_ref                   (CoglHandle material);
+void                cogl_material_unref                 (CoglHandle material);
+const GList *       cogl_material_get_layers            (CoglMaterial *material);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_material_ref ()

+
CoglHandle          cogl_material_ref                   (CoglHandle material);
+
+

Warning

+

cogl_material_ref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_ref() instead

+
+

+Increment the reference count for a CoglMaterial. +

+
++++ + + + + + + + + + + +

material :

a CoglMaterial object.

Returns :

the material.
+

Since 1.0

+
+
+
+

cogl_material_unref ()

+
void                cogl_material_unref                 (CoglHandle material);
+
+

Warning

+

cogl_material_unref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_unref() instead

+
+

+Decrement the reference count for a CoglMaterial. +

+
++++ + + + + +

material :

a CoglMaterial object.
+

Since 1.0

+
+
+
+

cogl_material_get_layers ()

+
const GList *       cogl_material_get_layers            (CoglMaterial *material);
+
+

Warning

+

cogl_material_get_layers has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_layers() instead

+
+

+This function lets you access a material's internal list of layers +for iteration. +

+

+

+
+

Note

You should avoid using this API if possible since it was only +made public by mistake and will be deprecated when we have +suitable alternative.
+

+

+

+

+
+

Note

It's important to understand that the list returned may not +remain valid if you modify the material or any of the layers in any +way and so you would have to re-get the list in that +situation.
+

+

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

Returns :

A +list of CoglMaterialLayer's that can be passed to the +cogl_material_layer_* functions. The list is owned by Cogl and it +should not be modified or freed. [element-type CoglMaterialLayer][transfer none] +
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Materials.html b/doc/reference/cogl/html/cogl-Materials.html new file mode 100644 index 0000000..6edc8e6 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Materials.html @@ -0,0 +1,2705 @@ + + + + +Materials + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Materials

+

Materials — Fuctions for creating and manipulating materials

+
+
+

Synopsis

+
                    CoglMaterial;
+                    CoglMaterialLayer;
+CoglBool            (*CoglMaterialLayerCallback)        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         void *user_data);
+CoglMaterial *      cogl_material_new                   (void);
+CoglMaterial *      cogl_material_copy                  (CoglMaterial *source);
+CoglBool            cogl_is_material                    (CoglHandle handle);
+void                cogl_material_set_color             (CoglMaterial *material,
+                                                         const CoglColor *color);
+void                cogl_material_set_color4ub          (CoglMaterial *material,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+void                cogl_material_set_color4f           (CoglMaterial *material,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+void                cogl_material_get_color             (CoglMaterial *material,
+                                                         CoglColor *color);
+void                cogl_material_set_ambient           (CoglMaterial *material,
+                                                         const CoglColor *ambient);
+void                cogl_material_get_ambient           (CoglMaterial *material,
+                                                         CoglColor *ambient);
+void                cogl_material_set_diffuse           (CoglMaterial *material,
+                                                         const CoglColor *diffuse);
+void                cogl_material_get_diffuse           (CoglMaterial *material,
+                                                         CoglColor *diffuse);
+void                cogl_material_set_ambient_and_diffuse
+                                                        (CoglMaterial *material,
+                                                         const CoglColor *color);
+void                cogl_material_set_emission          (CoglMaterial *material,
+                                                         const CoglColor *emission);
+void                cogl_material_get_emission          (CoglMaterial *material,
+                                                         CoglColor *emission);
+void                cogl_material_set_specular          (CoglMaterial *material,
+                                                         const CoglColor *specular);
+void                cogl_material_get_specular          (CoglMaterial *material,
+                                                         CoglColor *specular);
+void                cogl_material_set_shininess         (CoglMaterial *material,
+                                                         float shininess);
+float               cogl_material_get_shininess         (CoglMaterial *material);
+enum                CoglMaterialAlphaFunc;
+void                cogl_material_set_alpha_test_function
+                                                        (CoglMaterial *material,
+                                                         CoglMaterialAlphaFunc alpha_func,
+                                                         float alpha_reference);
+#define             COGL_BLEND_STRING_ERROR
+enum                CoglBlendStringError;
+CoglBool            cogl_material_set_blend             (CoglMaterial *material,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+void                cogl_material_set_blend_constant    (CoglMaterial *material,
+                                                         const CoglColor *constant_color);
+void                cogl_material_set_point_size        (CoglMaterial *material,
+                                                         float point_size);
+float               cogl_material_get_point_size        (CoglMaterial *material);
+void                cogl_material_set_layer             (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglHandle texture);
+void                cogl_material_remove_layer          (CoglMaterial *material,
+                                                         int layer_index);
+CoglBool            cogl_material_set_layer_combine     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+void                cogl_material_set_layer_combine_constant
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const CoglColor *constant);
+void                cogl_material_set_layer_matrix      (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const CoglMatrix *matrix);
+CoglBool            cogl_material_set_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+CoglBool            cogl_material_get_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+int                 cogl_material_get_n_layers          (CoglMaterial *material);
+enum                CoglMaterialFilter;
+void                cogl_material_set_layer_filters     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialFilter min_filter,
+                                                         CoglMaterialFilter mag_filter);
+enum                CoglMaterialLayerType;
+CoglMaterialLayerType cogl_material_layer_get_type      (CoglMaterialLayer *layer);
+CoglHandle          cogl_material_layer_get_texture     (CoglMaterialLayer *layer);
+CoglMaterialFilter  cogl_material_layer_get_min_filter  (CoglMaterialLayer *layer);
+CoglMaterialFilter  cogl_material_layer_get_mag_filter  (CoglMaterialLayer *layer);
+enum                CoglMaterialWrapMode;
+void                cogl_material_set_layer_wrap_mode   (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+void                cogl_material_set_layer_wrap_mode_s (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+void                cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+void                cogl_material_set_layer_wrap_mode_p (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_s
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_t
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_p
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+GType               cogl_material_wrap_mode_get_type    (void);
+void                cogl_material_set_user_program      (CoglMaterial *material,
+                                                         CoglHandle program);
+CoglHandle          cogl_material_get_user_program      (CoglMaterial *material);
+void                cogl_material_foreach_layer         (CoglMaterial *material,
+                                                         CoglMaterialLayerCallback callback,
+                                                         void *user_data);
+
+
+
+

Description

+

+COGL allows creating and manipulating materials used to fill in +geometry. Materials may simply be lighting attributes (such as an +ambient and diffuse colour) or might represent one or more textures +blended together. +

+
+
+

Details

+
+

CoglMaterial

+
typedef struct _CoglMaterial CoglMaterial;
+
+
+
+

CoglMaterialLayer

+
typedef struct _CoglMaterialLayer CoglMaterialLayer;
+
+
+
+

CoglMaterialLayerCallback ()

+
CoglBool            (*CoglMaterialLayerCallback)        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         void *user_data);
+
+

Warning

+

CoglMaterialLayerCallback is deprecated and should not be used in newly-written code. 1.16

+
+

+The callback prototype used with cogl_material_foreach_layer() for +iterating all the layers of a material. +

+
++++ + + + + + + + + + + + + + + +

material :

The CoglMaterial whos layers are being iterated

layer_index :

The current layer index

user_data :

The private data passed to cogl_material_foreach_layer() +
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_material_new ()

+
CoglMaterial *      cogl_material_new                   (void);
+
+

Warning

+

cogl_material_new has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_new() instead

+
+

+Allocates and initializes a blank white material +

+
++++ + + + + +

Returns :

a pointer to a new CoglMaterial +
+
+
+
+

cogl_material_copy ()

+
CoglMaterial *      cogl_material_copy                  (CoglMaterial *source);
+
+

Warning

+

cogl_material_copy has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_copy() instead

+
+

+Creates a new material with the configuration copied from the +source material. +

+

+We would strongly advise developers to always aim to use +cogl_material_copy() instead of cogl_material_new() whenever there will +be any similarity between two materials. Copying a material helps Cogl +keep track of a materials ancestry which we may use to help minimize GPU +state changes. +

+
++++ + + + + + + + + + + +

source :

a CoglMaterial object to copy

Returns :

a pointer to the newly allocated CoglMaterial +
+

Since 1.2

+
+
+
+

cogl_is_material ()

+
CoglBool            cogl_is_material                    (CoglHandle handle);
+
+

Warning

+

cogl_is_material has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_is_pipeline() instead

+
+

+Gets whether the given handle references an existing material object. +

+
++++ + + + + + + + + + + +

handle :

A CoglHandle

Returns :

+TRUE if the handle references a CoglMaterial, +FALSE otherwise
+
+
+
+

cogl_material_set_color ()

+
void                cogl_material_set_color             (CoglMaterial *material,
+                                                         const CoglColor *color);
+
+

Warning

+

cogl_material_set_color has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_color() instead

+
+

+Sets the basic color of the material, used when no lighting is enabled. +

+

+Note that if you don't add any layers to the material then the color +will be blended unmodified with the destination; the default blend +expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for +semi-transparent red. See cogl_color_premultiply(). +

+

+The default value is (1.0, 1.0, 1.0, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

color :

The components of the color
+

Since 1.0

+
+
+
+

cogl_material_set_color4ub ()

+
void                cogl_material_set_color4ub          (CoglMaterial *material,
+                                                         uint8_t red,
+                                                         uint8_t green,
+                                                         uint8_t blue,
+                                                         uint8_t alpha);
+
+

Warning

+

cogl_material_set_color4ub has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_color4ub() instead

+
+

+Sets the basic color of the material, used when no lighting is enabled. +

+

+The default value is (0xff, 0xff, 0xff, 0xff) +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

material :

A CoglMaterial object

red :

The red component

green :

The green component

blue :

The blue component

alpha :

The alpha component
+

Since 1.0

+
+
+
+

cogl_material_set_color4f ()

+
void                cogl_material_set_color4f           (CoglMaterial *material,
+                                                         float red,
+                                                         float green,
+                                                         float blue,
+                                                         float alpha);
+
+

Warning

+

cogl_material_set_color4f has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_color4f() instead

+
+

+Sets the basic color of the material, used when no lighting is enabled. +

+

+The default value is (1.0, 1.0, 1.0, 1.0) +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

material :

A CoglMaterial object

red :

The red component

green :

The green component

blue :

The blue component

alpha :

The alpha component
+

Since 1.0

+
+
+
+

cogl_material_get_color ()

+
void                cogl_material_get_color             (CoglMaterial *material,
+                                                         CoglColor *color);
+
+

Warning

+

cogl_material_get_color has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_color() instead

+
+

+Retrieves the current material color. +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

color :

The location to store the color. [out] +
+

Since 1.0

+
+
+
+

cogl_material_set_ambient ()

+
void                cogl_material_set_ambient           (CoglMaterial *material,
+                                                         const CoglColor *ambient);
+
+

Warning

+

cogl_material_set_ambient has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Sets the material's ambient color, in the standard OpenGL lighting +model. The ambient color affects the overall color of the object. +

+

+Since the diffuse color will be intense when the light hits the surface +directly, the ambient will be most apparent where the light hits at a +slant. +

+

+The default value is (0.2, 0.2, 0.2, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

ambient :

The components of the desired ambient color
+

Since 1.0

+
+
+
+

cogl_material_get_ambient ()

+
void                cogl_material_get_ambient           (CoglMaterial *material,
+                                                         CoglColor *ambient);
+
+

Warning

+

cogl_material_get_ambient has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Retrieves the current ambient color for material +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

ambient :

The location to store the ambient color
+

Since 1.0

+
+
+
+

cogl_material_set_diffuse ()

+
void                cogl_material_set_diffuse           (CoglMaterial *material,
+                                                         const CoglColor *diffuse);
+
+

Warning

+

cogl_material_set_diffuse has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Sets the material's diffuse color, in the standard OpenGL lighting +model. The diffuse color is most intense where the light hits the +surface directly - perpendicular to the surface. +

+

+The default value is (0.8, 0.8, 0.8, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

diffuse :

The components of the desired diffuse color
+

Since 1.0

+
+
+
+

cogl_material_get_diffuse ()

+
void                cogl_material_get_diffuse           (CoglMaterial *material,
+                                                         CoglColor *diffuse);
+
+

Warning

+

cogl_material_get_diffuse has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Retrieves the current diffuse color for material +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

diffuse :

The location to store the diffuse color
+

Since 1.0

+
+
+
+

cogl_material_set_ambient_and_diffuse ()

+
void                cogl_material_set_ambient_and_diffuse
+                                                        (CoglMaterial *material,
+                                                         const CoglColor *color);
+
+

Warning

+

cogl_material_set_ambient_and_diffuse has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Conveniently sets the diffuse and ambient color of material at the same +time. See cogl_material_set_ambient() and cogl_material_set_diffuse(). +

+

+The default ambient color is (0.2, 0.2, 0.2, 1.0) +

+

+The default diffuse color is (0.8, 0.8, 0.8, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

color :

The components of the desired ambient and diffuse colors
+

Since 1.0

+
+
+
+

cogl_material_set_emission ()

+
void                cogl_material_set_emission          (CoglMaterial *material,
+                                                         const CoglColor *emission);
+
+

Warning

+

cogl_material_set_emission has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Sets the material's emissive color, in the standard OpenGL lighting +model. It will look like the surface is a light source emitting this +color. +

+

+The default value is (0.0, 0.0, 0.0, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

emission :

The components of the desired emissive color
+

Since 1.0

+
+
+
+

cogl_material_get_emission ()

+
void                cogl_material_get_emission          (CoglMaterial *material,
+                                                         CoglColor *emission);
+
+

Warning

+

cogl_material_get_emission has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Retrieves the materials current emission color. +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

emission :

The location to store the emission color
+

Since 1.0

+
+
+
+

cogl_material_set_specular ()

+
void                cogl_material_set_specular          (CoglMaterial *material,
+                                                         const CoglColor *specular);
+
+

Warning

+

cogl_material_set_specular has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Sets the material's specular color, in the standard OpenGL lighting +model. The intensity of the specular color depends on the viewport +position, and is brightest along the lines of reflection. +

+

+The default value is (0.0, 0.0, 0.0, 1.0) +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

specular :

The components of the desired specular color
+

Since 1.0

+
+
+
+

cogl_material_get_specular ()

+
void                cogl_material_get_specular          (CoglMaterial *material,
+                                                         CoglColor *specular);
+
+

Warning

+

cogl_material_get_specular has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Retrieves the materials current specular color. +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

specular :

The location to store the specular color
+

Since 1.0

+
+
+
+

cogl_material_set_shininess ()

+
void                cogl_material_set_shininess         (CoglMaterial *material,
+                                                         float shininess);
+
+

Warning

+

cogl_material_set_shininess has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Sets the shininess of the material, in the standard OpenGL lighting +model, which determines the size of the specular highlights. A +higher shininess will produce smaller highlights which makes the +object appear more shiny. +

+

+The default value is 0.0 +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

shininess :

The desired shininess; must be >= 0.0
+

Since 1.0

+
+
+
+

cogl_material_get_shininess ()

+
float               cogl_material_get_shininess         (CoglMaterial *material);
+
+

Warning

+

cogl_material_get_shininess has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglSnippet shader api for lighting

+
+

+Retrieves the materials current emission color. +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

Returns :

The materials current shininess value
+

Since 1.0

+
+
+
+

enum CoglMaterialAlphaFunc

+
typedef enum {
+  COGL_MATERIAL_ALPHA_FUNC_NEVER    = 0x0200,
+  COGL_MATERIAL_ALPHA_FUNC_LESS	    = 0x0201,
+  COGL_MATERIAL_ALPHA_FUNC_EQUAL    = 0x0202,
+  COGL_MATERIAL_ALPHA_FUNC_LEQUAL   = 0x0203,
+  COGL_MATERIAL_ALPHA_FUNC_GREATER  = 0x0204,
+  COGL_MATERIAL_ALPHA_FUNC_NOTEQUAL = 0x0205,
+  COGL_MATERIAL_ALPHA_FUNC_GEQUAL   = 0x0206,
+  COGL_MATERIAL_ALPHA_FUNC_ALWAYS   = 0x0207
+} CoglMaterialAlphaFunc;
+
+

+Alpha testing happens before blending primitives with the framebuffer and +gives an opportunity to discard fragments based on a comparison with the +incoming alpha value and a reference alpha value. The CoglMaterialAlphaFunc +determines how the comparison is done. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_MATERIAL_ALPHA_FUNC_NEVER

Never let the fragment through. +

COGL_MATERIAL_ALPHA_FUNC_LESS

Let the fragment through if the incoming + alpha value is less than the reference alpha value +

COGL_MATERIAL_ALPHA_FUNC_EQUAL

Let the fragment through if the incoming + alpha value equals the reference alpha value +

COGL_MATERIAL_ALPHA_FUNC_LEQUAL

Let the fragment through if the incoming + alpha value is less than or equal to the reference alpha value +

COGL_MATERIAL_ALPHA_FUNC_GREATER

Let the fragment through if the incoming + alpha value is greater than the reference alpha value +

COGL_MATERIAL_ALPHA_FUNC_NOTEQUAL

Let the fragment through if the incoming + alpha value does not equal the reference alpha value +

COGL_MATERIAL_ALPHA_FUNC_GEQUAL

Let the fragment through if the incoming + alpha value is greater than or equal to the reference alpha value. +

COGL_MATERIAL_ALPHA_FUNC_ALWAYS

Always let the fragment through. +
+
+
+
+

cogl_material_set_alpha_test_function ()

+
void                cogl_material_set_alpha_test_function
+                                                        (CoglMaterial *material,
+                                                         CoglMaterialAlphaFunc alpha_func,
+                                                         float alpha_reference);
+
+

Warning

+

cogl_material_set_alpha_test_function has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_alpha_test_function() instead

+
+

+Before a primitive is blended with the framebuffer, it goes through an +alpha test stage which lets you discard fragments based on the current +alpha value. This function lets you change the function used to evaluate +the alpha channel, and thus determine which fragments are discarded +and which continue on to the blending stage. +

+

+The default is COGL_MATERIAL_ALPHA_FUNC_ALWAYS +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

alpha_func :

A CoglMaterialAlphaFunc constant

alpha_reference :

A reference point that the chosen alpha function uses +to compare incoming fragments to.
+

Since 1.0

+
+
+
+

COGL_BLEND_STRING_ERROR

+
#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ())
+
+

+CoglError domain for blend string parser errors +

+

Since 1.0

+
+
+
+

enum CoglBlendStringError

+
typedef enum {
+ /*< prefix=COGL_BLEND_STRING_ERROR >*/
+  COGL_BLEND_STRING_ERROR_PARSE_ERROR,
+  COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
+  COGL_BLEND_STRING_ERROR_INVALID_ERROR,
+  COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
+} CoglBlendStringError;
+
+

+Error enumeration for the blend strings parser +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_BLEND_STRING_ERROR_PARSE_ERROR

Generic parse error +

COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR

Argument parse error +

COGL_BLEND_STRING_ERROR_INVALID_ERROR

Internal parser error +

COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR

Blend string not + supported by the GPU +
+

Since 1.0

+
+
+
+

cogl_material_set_blend ()

+
CoglBool            cogl_material_set_blend             (CoglMaterial *material,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+
+

Warning

+

cogl_material_set_blend has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_blend() instead

+
+

+If not already familiar; please refer here +for an overview of what blend strings are, and their syntax. +

+

+Blending occurs after the alpha test function, and combines fragments with +the framebuffer. +

+

+Currently the only blend function Cogl exposes is ADD(). So any valid +blend statements will be of the form: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+<channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
+
+ +

+

+

+

+
+

Warning

The brackets around blend factors are currently not +optional!
+

+

+

+This is the list of source-names usable as blend factors: +

+
+

+

+

+The source names can be used according to the +color-source and factor syntax, +so for example "(1-SRC_COLOR[A])" would be a valid factor, as would +"(CONSTANT[RGB])" +

+

+These can also be used as factors: +

+
    +
  • 0: (0, 0, 0, 0)
  • +
  • 1: (1, 1, 1, 1)
  • +
  • SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])
  • +
+

+

+

+

+
+

Note

Remember; all color components are normalized to the range [0, 1] +before computing the result of blending.
+

+

+

+

+
+

Example 1. Blend Strings/1

+
+

Blend a non-premultiplied source over a destination with + premultiplied alpha:

+
+"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
+"A   = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
+  
+
+
+


+

+

+

+
+

Example 2. Blend Strings/2

+
+

Blend a premultiplied source over a destination with + premultiplied alpha

+
+"RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
+  
+
+
+


+

+

+The default blend string is: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
+
+ +

+

+

+That gives normal alpha-blending when the calculated color for the material +is in premultiplied form. +

+
++++ + + + + + + + + + + + + + + + + + + +

material :

A CoglMaterial object

blend_string :

A Cogl blend string +describing the desired blend function.

error :

return location for a CoglError that may report lack of driver +support if you give separate blend string statements for the alpha +channel and RGB channels since some drivers, or backends such as +GLES 1.1, don't support this feature. May be NULL, in which case a +warning will be printed out using GLib's logging facilities if an +error is encountered.

Returns :

+TRUE if the blend string was successfully parsed, and the +described blending is supported by the underlying driver/hardware. If +there was an error, FALSE is returned and error is set accordingly (if +present).
+

Since 1.0

+
+
+
+

cogl_material_set_blend_constant ()

+
void                cogl_material_set_blend_constant    (CoglMaterial *material,
+                                                         const CoglColor *constant_color);
+
+

Warning

+

cogl_material_set_blend_constant has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_blend_constant() instead

+
+

+When blending is setup to reference a CONSTANT blend factor then +blending will depend on the constant set with this function. +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

constant_color :

The constant color you want
+

Since 1.0

+
+
+
+

cogl_material_set_point_size ()

+
void                cogl_material_set_point_size        (CoglMaterial *material,
+                                                         float point_size);
+
+

Warning

+

cogl_material_set_point_size has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_point_size() instead

+
+

+Changes the size of points drawn when COGL_VERTICES_MODE_POINTS is +used with the vertex buffer API. Note that typically the GPU will +only support a limited minimum and maximum range of point sizes. If +the chosen point size is outside that range then the nearest value +within that range will be used instead. The size of a point is in +screen space so it will be the same regardless of any +transformations. The default point size is 1.0. +

+
++++ + + + + + + + + + + +

material :

a material.

point_size :

the new point size.
+

Since 1.4

+
+
+
+

cogl_material_get_point_size ()

+
float               cogl_material_get_point_size        (CoglMaterial *material);
+
+

Warning

+

cogl_material_get_point_size has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_point_size() instead

+
+

+Get the size of points drawn when COGL_VERTICES_MODE_POINTS is +used with the vertex buffer API. +

+
++++ + + + + + + + + + + +

material :

a CoglHandle to a material.

Returns :

the point size of the material.
+

Since 1.4

+
+
+
+

cogl_material_set_layer ()

+
void                cogl_material_set_layer             (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglHandle texture);
+
+

Warning

+

cogl_material_set_layer has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer() instead

+
+

+In addition to the standard OpenGL lighting model a Cogl material may have +one or more layers comprised of textures that can be blended together in +order, with a number of different texture combine modes. This function +defines a new texture layer. +

+

+The index values of multiple layers do not have to be consecutive; it is +only their relative order that is important. +

+

+

+
+

Note

In the future, we may define other types of material layers, such +as purely GLSL based layers.
+

+

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the index of the layer

texture :

a CoglHandle for the layer object
+

Since 1.0

+
+
+
+

cogl_material_remove_layer ()

+
void                cogl_material_remove_layer          (CoglMaterial *material,
+                                                         int layer_index);
+
+

Warning

+

cogl_material_remove_layer has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_remove_layer() instead

+
+

+This function removes a layer from your material +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

Specifies the layer you want to remove
+
+
+
+

cogl_material_set_layer_combine ()

+
CoglBool            cogl_material_set_layer_combine     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         CoglError **error);
+
+

Warning

+

cogl_material_set_layer_combine has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_combine() instead

+
+

+If not already familiar; you can refer +here for an overview of what blend +strings are and there syntax. +

+

+These are all the functions available for texture combining: +

+
    +
  • REPLACE(arg0) = arg0
  • +
  • MODULATE(arg0, arg1) = arg0 x arg1
  • +
  • ADD(arg0, arg1) = arg0 + arg1
  • +
  • ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5
  • +
  • INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)
  • +
  • SUBTRACT(arg0, arg1) = arg0 - arg1
  • +
  • + DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    +                             (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    +                             (arg0[B] - 0.5)) * (arg1[B] - 0.5))
    +    
  • +
  • + DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
    +                              (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
    +                              (arg0[B] - 0.5)) * (arg1[B] - 0.5))
    +    
  • +
+

+

+

+Refer to the +color-source syntax for +describing the arguments. The valid source names for texture combining +are: +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

TEXTURE

Use the color from the current texture layer

TEXTURE_0, TEXTURE_1, etc

Use the color from the specified texture layer

CONSTANT

Use the color from the constant given with + cogl_material_set_layer_constant() +

PRIMARY

Use the color of the material as set with + cogl_material_set_color() +

PREVIOUS

Either use the texture color from the previous layer, or + if this is layer 0, use the color of the material as set with + cogl_material_set_color() +
+

+

+

+

+
+

Layer Combine Examples

+

This is effectively what the default blending is:

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = MODULATE (PREVIOUS, TEXTURE)
+
+ +

This could be used to cross-fade between two images, using + the alpha component of a constant as the interpolator. The constant + color is given by calling cogl_material_set_layer_constant.

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
+
+ +
+

+

+

+

+
+

Note

You can't give a multiplication factor for arguments as you can +with blending.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

Specifies the layer you want define a combine function for

blend_string :

A Cogl blend string +describing the desired texture combine function.

error :

A CoglError that may report parse errors or lack of GPU/driver +support. May be NULL, in which case a warning will be printed out if an +error is encountered.

Returns :

+TRUE if the blend string was successfully parsed, and the +described texture combining is supported by the underlying driver and +or hardware. On failure, FALSE is returned and error is set
+

Since 1.0

+
+
+
+

cogl_material_set_layer_combine_constant ()

+
void                cogl_material_set_layer_combine_constant
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const CoglColor *constant);
+
+

Warning

+

cogl_material_set_layer_combine_constant has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_combine_constant() +instead

+
+

+When you are using the 'CONSTANT' color source in a layer combine +description then you can use this function to define its value. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

Specifies the layer you want to specify a constant used +for texture combining

constant :

The constant color you want
+

Since 1.0

+
+
+
+

cogl_material_set_layer_matrix ()

+
void                cogl_material_set_layer_matrix      (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const CoglMatrix *matrix);
+
+

Warning

+

cogl_material_set_layer_matrix has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_matrix() instead

+
+

+This function lets you set a matrix that can be used to e.g. translate +and rotate a single layer of a material used to fill your geometry. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the index for the layer inside material +

matrix :

the transformation matrix for the layer
+
+
+
+

cogl_material_set_layer_point_sprite_coords_enabled ()

+
CoglBool            cogl_material_set_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglBool enable,
+                                                         CoglError **error);
+
+

Warning

+

cogl_material_set_layer_point_sprite_coords_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_point_sprite_coords_enabled() + instead

+
+

+When rendering points, if enable is TRUE then the texture +coordinates for this layer will be replaced with coordinates that +vary from 0.0 to 1.0 across the primitive. The top left of the +point will have the coordinates 0.0,0.0 and the bottom right will +have 1.0,1.0. If enable is FALSE then the coordinates will be +fixed for the entire point. +

+

+This function will only work if COGL_FEATURE_POINT_SPRITE is +available. If the feature is not available then the function will +return FALSE and set error. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

material :

a CoglHandle to a material.

layer_index :

the layer number to change.

enable :

whether to enable point sprite coord generation.

error :

A return location for a CoglError, or NULL to ignore errors.

Returns :

+TRUE if the function succeeds, FALSE otherwise.
+

Since 1.4

+
+
+
+

cogl_material_get_layer_point_sprite_coords_enabled ()

+
CoglBool            cogl_material_get_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+
+

Warning

+

cogl_material_get_layer_point_sprite_coords_enabled has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_layer_point_sprite_coords_enabled() + instead

+
+

+Gets whether point sprite coordinate generation is enabled for this +texture layer. +

+
++++ + + + + + + + + + + + + + + +

material :

a CoglHandle to a material.

layer_index :

the layer number to check.

Returns :

whether the texture coordinates will be replaced with +point sprite coordinates.
+

Since 1.4

+
+
+
+

cogl_material_get_n_layers ()

+
int                 cogl_material_get_n_layers          (CoglMaterial *material);
+
+

Warning

+

cogl_material_get_n_layers has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_n_layers() instead

+
+

+Retrieves the number of layers defined for the given material +

+
++++ + + + + + + + + + + +

material :

A CoglMaterial object

Returns :

the number of layers
+

Since 1.0

+
+
+
+

enum CoglMaterialFilter

+
typedef enum {
+  COGL_MATERIAL_FILTER_NEAREST = 0x2600,
+  COGL_MATERIAL_FILTER_LINEAR = 0x2601,
+  COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST = 0x2700,
+  COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST = 0x2701,
+  COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR = 0x2702,
+  COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR = 0x2703
+} CoglMaterialFilter;
+
+

+Texture filtering is used whenever the current pixel maps either to more +than one texture element (texel) or less than one. These filter enums +correspond to different strategies used to come up with a pixel color, by +possibly referring to multiple neighbouring texels and taking a weighted +average or simply using the nearest texel. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_MATERIAL_FILTER_NEAREST

Measuring in manhatten distance from the, + current pixel center, use the nearest texture texel +

COGL_MATERIAL_FILTER_LINEAR

Use the weighted average of the 4 texels + nearest the current pixel center +

COGL_MATERIAL_FILTER_NEAREST_MIPMAP_NEAREST

Select the mimap level whose + texel size most closely matches the current pixel, and use the + COGL_MATERIAL_FILTER_NEAREST criterion +

COGL_MATERIAL_FILTER_LINEAR_MIPMAP_NEAREST

Select the mimap level whose + texel size most closely matches the current pixel, and use the + COGL_MATERIAL_FILTER_LINEAR criterion +

COGL_MATERIAL_FILTER_NEAREST_MIPMAP_LINEAR

Select the two mimap levels + whose texel size most closely matches the current pixel, use + the COGL_MATERIAL_FILTER_NEAREST criterion on each one and take + their weighted average +

COGL_MATERIAL_FILTER_LINEAR_MIPMAP_LINEAR

Select the two mimap levels + whose texel size most closely matches the current pixel, use + the COGL_MATERIAL_FILTER_LINEAR criterion on each one and take + their weighted average +
+
+
+
+

cogl_material_set_layer_filters ()

+
void                cogl_material_set_layer_filters     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialFilter min_filter,
+                                                         CoglMaterialFilter mag_filter);
+
+

Warning

+

cogl_material_set_layer_filters has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_filters() instead

+
+

+Changes the decimation and interpolation filters used when a texture is +drawn at other scales than 100%. +

+
++++ + + + + + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

min_filter :

the filter used when scaling a texture down.

mag_filter :

the filter used when magnifying a texture.
+
+
+
+

enum CoglMaterialLayerType

+
typedef enum {
+  COGL_MATERIAL_LAYER_TYPE_TEXTURE
+} CoglMaterialLayerType;
+
+

+Available types of layers for a CoglMaterial. This enumeration +might be expanded in later versions. +

+
++++ + + + + +

COGL_MATERIAL_LAYER_TYPE_TEXTURE

The layer represents a + texture +
+

Since 1.0

+
+
+
+

cogl_material_layer_get_type ()

+
CoglMaterialLayerType cogl_material_layer_get_type      (CoglMaterialLayer *layer);
+
+

Warning

+

cogl_material_layer_get_type has been deprecated since version 1.16 and should not be used in newly-written code. No replacement

+
+

+Retrieves the type of the layer +

+

+Currently there is only one type of layer defined: +COGL_MATERIAL_LAYER_TYPE_TEXTURE, but considering we may add purely GLSL +based layers in the future, you should write code that checks the type +first. +

+
++++ + + + + + + + + + + +

layer :

A CoglMaterialLayer object

Returns :

the type of the layer
+
+
+
+

cogl_material_layer_get_texture ()

+
CoglHandle          cogl_material_layer_get_texture     (CoglMaterialLayer *layer);
+
+

Warning

+

cogl_material_layer_get_texture has been deprecated since version 1.16 and should not be used in newly-written code. No replacement

+
+

+Extracts a texture handle for a specific layer. +

+

+

+
+

Note

In the future Cogl may support purely GLSL based layers; for those +layers this function which will likely return COGL_INVALID_HANDLE if you +try to get the texture handle from them. Considering this scenario, you +should call cogl_material_layer_get_type() first in order check it is of +type COGL_MATERIAL_LAYER_TYPE_TEXTURE before calling this function.
+

+

+
++++ + + + + + + + + + + +

layer :

A CoglMaterialLayer object

Returns :

a CoglHandle for the texture inside the layer. [transfer none] +
+
+
+
+

cogl_material_layer_get_min_filter ()

+
CoglMaterialFilter  cogl_material_layer_get_min_filter  (CoglMaterialLayer *layer);
+
+

Warning

+

cogl_material_layer_get_min_filter has been deprecated since version 1.16 and should not be used in newly-written code. No replacement

+
+

+Queries the currently set downscaling filter for a material layer +

+
++++ + + + + + + + + + + +

layer :

a CoglHandle for a material layer

Returns :

the current downscaling filter
+
+
+
+

cogl_material_layer_get_mag_filter ()

+
CoglMaterialFilter  cogl_material_layer_get_mag_filter  (CoglMaterialLayer *layer);
+
+

Warning

+

cogl_material_layer_get_mag_filter has been deprecated since version 1.16 and should not be used in newly-written code. No replacement

+
+

+Queries the currently set downscaling filter for a material later +

+
++++ + + + + + + + + + + +

layer :

A CoglMaterialLayer object

Returns :

the current downscaling filter
+
+
+
+

enum CoglMaterialWrapMode

+
typedef enum {
+  COGL_MATERIAL_WRAP_MODE_REPEAT = 0x2901,
+  COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE = 0x812F,
+  COGL_MATERIAL_WRAP_MODE_AUTOMATIC = 0x0207
+} CoglMaterialWrapMode;
+
+

+The wrap mode specifies what happens when texture coordinates +outside the range 0→1 are used. Note that if the filter mode is +anything but COGL_MATERIAL_FILTER_NEAREST then texels outside the +range 0→1 might be used even when the coordinate is exactly 0 or 1 +because OpenGL will try to sample neighbouring pixels. For example +if you are trying to render the full texture then you may get +artifacts around the edges when the pixels from the other side are +merged in if the wrap mode is set to repeat. +

+
++++ + + + + + + + + + + + + + + +

COGL_MATERIAL_WRAP_MODE_REPEAT

The texture will be repeated. This + is useful for example to draw a tiled background. +

COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE

The coordinates outside the + range 0→1 will sample copies of the edge pixels of the + texture. This is useful to avoid artifacts if only one copy of + the texture is being rendered. +

COGL_MATERIAL_WRAP_MODE_AUTOMATIC

Cogl will try to automatically + decide which of the above two to use. For cogl_rectangle(), it + will use repeat mode if any of the texture coordinates are + outside the range 0→1, otherwise it will use clamp to edge. For + cogl_polygon() it will always use repeat mode. For + cogl_vertex_buffer_draw() it will use repeat mode except for + layers that have point sprite coordinate generation enabled. This + is the default value. +
+

Since 1.4

+
+
+
+

cogl_material_set_layer_wrap_mode ()

+
void                cogl_material_set_layer_wrap_mode   (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+
+

Warning

+

cogl_material_set_layer_wrap_mode has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_wrap_mode() instead

+
+

+Sets the wrap mode for all three coordinates of texture lookups on +this layer. This is equivalent to calling +cogl_material_set_layer_wrap_mode_s(), +cogl_material_set_layer_wrap_mode_t() and +cogl_material_set_layer_wrap_mode_p() separately. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 1.4

+
+
+
+

cogl_material_set_layer_wrap_mode_s ()

+
void                cogl_material_set_layer_wrap_mode_s (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+
+

Warning

+

cogl_material_set_layer_wrap_mode_s has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_wrap_mode_s() instead

+
+

+Sets the wrap mode for the 's' coordinate of texture lookups on this layer. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 1.4

+
+
+
+

cogl_material_set_layer_wrap_mode_t ()

+
void                cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+
+

Warning

+

cogl_material_set_layer_wrap_mode_t has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_wrap_mode_t() instead

+
+

+Sets the wrap mode for the 't' coordinate of texture lookups on this layer. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 1.4

+
+
+
+

cogl_material_set_layer_wrap_mode_p ()

+
void                cogl_material_set_layer_wrap_mode_p (CoglMaterial *material,
+                                                         int layer_index,
+                                                         CoglMaterialWrapMode mode);
+
+

Warning

+

cogl_material_set_layer_wrap_mode_p has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_set_layer_wrap_mode_p() instead

+
+

+Sets the wrap mode for the 'p' coordinate of texture lookups on +this layer. 'p' is the third coordinate. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

mode :

the new wrap mode
+

Since 1.4

+
+
+
+

cogl_material_get_layer_wrap_mode_s ()

+
CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_s
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+
+

Warning

+

cogl_material_get_layer_wrap_mode_s has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_layer_wrap_mode_s() instead

+
+

+Returns the wrap mode for the 's' coordinate of texture lookups on this +layer. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

Returns :

the wrap mode for the 's' coordinate of texture lookups on +this layer.
+

Since 1.6

+
+
+
+

cogl_material_get_layer_wrap_mode_t ()

+
CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_t
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+
+

Warning

+

cogl_material_get_layer_wrap_mode_t has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_layer_wrap_mode_t() instead

+
+

+Returns the wrap mode for the 't' coordinate of texture lookups on this +layer. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

Returns :

the wrap mode for the 't' coordinate of texture lookups on +this layer.
+

Since 1.6

+
+
+
+

cogl_material_get_layer_wrap_mode_p ()

+
CoglMaterialWrapMode cogl_material_get_layer_wrap_mode_p
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+
+

Warning

+

cogl_material_get_layer_wrap_mode_p has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_pipeline_get_layer_wrap_mode_p() instead

+
+

+Returns the wrap mode for the 'p' coordinate of texture lookups on this +layer. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

layer_index :

the layer number to change.

Returns :

the wrap mode for the 'p' coordinate of texture lookups on +this layer.
+

Since 1.6

+
+
+
+

cogl_material_wrap_mode_get_type ()

+
GType               cogl_material_wrap_mode_get_type    (void);
+
+
+
+

cogl_material_set_user_program ()

+
void                cogl_material_set_user_program      (CoglMaterial *material,
+                                                         CoglHandle program);
+
+

Warning

+

cogl_material_set_user_program has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead instead

+
+

+Associates a linked CoglProgram with the given material so that the +program can take full control of vertex and/or fragment processing. +

+

+This is an example of how it can be used to associate an ARBfp +program with a CoglMaterial: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45

+
+
+
+
+
+
+
+
+
+
+
+
+CoglHandle shader;
+CoglHandle program;
+CoglMaterial *material;
+
+shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
+cogl_shader_source (shader,
+                    "!!ARBfp1.0\n"
+                    "MOV result.color,fragment.color;\n"
+                    "END\n");
+cogl_shader_compile (shader);
+
+program = cogl_create_program ();
+cogl_program_attach_shader (program, shader);
+cogl_program_link (program);
+
+material = cogl_material_new ();
+cogl_material_set_user_program (material, program);
+
+cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
+cogl_rectangle (0, 0, 100, 100);
+
+ +

+

+

+It is possibly worth keeping in mind that this API is not part of +the long term design for how we want to expose shaders to Cogl +developers (We are planning on deprecating the cogl_program and +cogl_shader APIs in favour of a "snippet" framework) but in the +meantime we hope this will handle most practical GLSL and ARBfp +requirements. +

+

+Also remember you need to check for either the +COGL_FEATURE_SHADERS_GLSL or COGL_FEATURE_SHADERS_ARBFP before +using the cogl_program or cogl_shader API. +

+
++++ + + + + + + + + + + +

material :

a CoglMaterial object.

program :

A CoglHandle to a linked CoglProgram
+

Since 1.4

+
+
+
+

cogl_material_get_user_program ()

+
CoglHandle          cogl_material_get_user_program      (CoglMaterial *material);
+
+

Warning

+

cogl_material_get_user_program has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead instead

+
+

+Queries what user program has been associated with the given +material using cogl_material_set_user_program(). +

+
++++ + + + + + + + + + + +

material :

a CoglMaterial object.

Returns :

The current user program +or COGL_INVALID_HANDLE. [transfer none] +
+

Since 1.4

+
+
+
+

cogl_material_foreach_layer ()

+
void                cogl_material_foreach_layer         (CoglMaterial *material,
+                                                         CoglMaterialLayerCallback callback,
+                                                         void *user_data);
+
+

Warning

+

cogl_material_foreach_layer has been deprecated since version 1.16 and should not be used in newly-written code. No replacement

+
+

+Iterates all the layer indices of the given material. +

+
++++ + + + + + + + + + + + + + + +

material :

A CoglMaterial object

callback :

A CoglMaterialLayerCallback to be called for each layer +index

user_data :

Private data that will be passed to the callback
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Matrices.html b/doc/reference/cogl/html/cogl-Matrices.html new file mode 100644 index 0000000..84ca30f --- /dev/null +++ b/doc/reference/cogl/html/cogl-Matrices.html @@ -0,0 +1,1252 @@ + + + + +Matrices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Matrices

+

Matrices — Functions for initializing and manipulating 4x4 matrices

+
+
+

Synopsis

+
                    CoglMatrix;
+void                cogl_matrix_init_identity           (CoglMatrix *matrix);
+CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+CoglBool            cogl_matrix_equal                   (const void *v1,
+                                                         const void *v2);
+void                cogl_matrix_free                    (CoglMatrix *matrix);
+void                cogl_matrix_frustum                 (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_ortho                   (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+void                cogl_matrix_perspective             (CoglMatrix *matrix,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+void                cogl_matrix_multiply                (CoglMatrix *result,
+                                                         const CoglMatrix *a,
+                                                         const CoglMatrix *b);
+void                cogl_matrix_rotate                  (CoglMatrix *matrix,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_translate               (CoglMatrix *matrix,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_matrix_scale                   (CoglMatrix *matrix,
+                                                         float sx,
+                                                         float sy,
+                                                         float sz);
+void                cogl_matrix_transpose               (CoglMatrix *matrix);
+void                cogl_matrix_init_from_array         (CoglMatrix *matrix,
+                                                         const float *array);
+const float *       cogl_matrix_get_array               (const CoglMatrix *matrix);
+CoglBool            cogl_matrix_get_inverse             (const CoglMatrix *matrix,
+                                                         CoglMatrix *inverse);
+void                cogl_matrix_transform_point         (const CoglMatrix *matrix,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z,
+                                                         float *w);
+void                cogl_matrix_project_points          (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+void                cogl_matrix_transform_points        (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+CoglBool            cogl_matrix_is_identity             (const CoglMatrix *matrix);
+
+
+
+

Description

+

+Matrices are used in Cogl to describe affine model-view transforms, texture +transforms, and projective transforms. This exposes a utility API that can +be used for direct manipulation of these matrices. +

+
+
+

Details

+
+

CoglMatrix

+
typedef struct {
+  /* column 0 */
+  float xx;
+  float yx;
+  float zx;
+  float wx;
+
+  /* column 1 */
+  float xy;
+  float yy;
+  float zy;
+  float wy;
+
+  /* column 2 */
+  float xz;
+  float yz;
+  float zz;
+  float wz;
+
+  /* column 3 */
+  float xw;
+  float yw;
+  float zw;
+  float ww;
+} CoglMatrix;
+
+

+A CoglMatrix holds a 4x4 transform matrix. This is a single precision, +column-major matrix which means it is compatible with what OpenGL expects. +

+

+A CoglMatrix can represent transforms such as, rotations, scaling, +translation, sheering, and linear projections. You can combine these +transforms by multiplying multiple matrices in the order you want them +applied. +

+

+The transformation of a vertex (x, y, z, w) by a CoglMatrix is given by: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27

+
+
+
+
+
+
+
+
+
+
+
+
+x_new = xx * x + xy * y + xz * z + xw * w
+  y_new = yx * x + yy * y + yz * z + yw * w
+  z_new = zx * x + zy * y + zz * z + zw * w
+  w_new = wx * x + wy * y + wz * z + ww * w
+
+ +

+

+

+Where w is normally 1 +

+

+

+
+

Note

You must consider the members of the CoglMatrix structure read only, +and all matrix modifications must be done via the cogl_matrix API. This +allows Cogl to annotate the matrices internally. Violation of this will give +undefined results. If you need to initialize a matrix with a constant other +than the identity matrix you can use cogl_matrix_init_from_array().
+

+

+
+
+
+

cogl_matrix_init_identity ()

+
void                cogl_matrix_init_identity           (CoglMatrix *matrix);
+

+Resets matrix to the identity matrix: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28

+
+
+
+
+
+
+
+
+
+
+
+
+.xx=1; .xy=0; .xz=0; .xw=0;
+  .yx=0; .yy=1; .yz=0; .yw=0;
+  .zx=0; .zy=0; .zz=1; .zw=0;
+  .wx=0; .wy=0; .wz=0; .ww=1;
+
+ +

+

+
++++ + + + + +

matrix :

A 4x4 transformation matrix
+
+
+
+

cogl_matrix_copy ()

+
CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+

+Allocates a new CoglMatrix on the heap and initializes it with +the same values as matrix. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix you want to copy

Returns :

A newly allocated CoglMatrix which +should be freed using cogl_matrix_free(). [transfer full] +
+

Since 1.6

+
+
+
+

cogl_matrix_equal ()

+
CoglBool            cogl_matrix_equal                   (const void *v1,
+                                                         const void *v2);
+

+Compares two matrices to see if they represent the same +transformation. Although internally the matrices may have different +annotations associated with them and may potentially have a cached +inverse matrix these are not considered in the comparison. +

+
++++ + + + + + + + + + + +

v1 :

A 4x4 transformation matrix

v2 :

A 4x4 transformation matrix
+

Since 1.4

+
+
+
+

cogl_matrix_free ()

+
void                cogl_matrix_free                    (CoglMatrix *matrix);
+

+Frees a CoglMatrix that was previously allocated via a call to +cogl_matrix_copy(). +

+
++++ + + + + +

matrix :

A 4x4 transformation matrix you want to free
+

Since 1.6

+
+
+
+

cogl_matrix_frustum ()

+
void                cogl_matrix_frustum                 (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float z_near,
+                                                         float z_far);
+

+Multiplies matrix by the given frustum perspective matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

left :

X position of the left clipping plane where it +intersects the near clipping plane

right :

X position of the right clipping plane where it +intersects the near clipping plane

bottom :

Y position of the bottom clipping plane where it +intersects the near clipping plane

top :

Y position of the top clipping plane where it intersects +the near clipping plane

z_near :

The distance to the near clipping plane (Must be positive)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_ortho ()

+
void                cogl_matrix_ortho                   (CoglMatrix *matrix,
+                                                         float left,
+                                                         float right,
+                                                         float bottom,
+                                                         float top,
+                                                         float near,
+                                                         float far);
+
+

Warning

+

cogl_matrix_ortho has been deprecated since version 1.10 and should not be used in newly-written code. Use cogl_matrix_orthographic()

+
+

+Multiplies matrix by a parallel projection matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

left :

The coordinate for the left clipping plane

right :

The coordinate for the right clipping plane

bottom :

The coordinate for the bottom clipping plane

top :

The coordinate for the top clipping plane

near :

The distance to the near clipping +plane (will be negative if the plane is +behind the viewer)

far :

The distance to the far clipping +plane (will be negative if the plane is +behind the viewer)
+
+
+
+

cogl_matrix_perspective ()

+
void                cogl_matrix_perspective             (CoglMatrix *matrix,
+                                                         float fov_y,
+                                                         float aspect,
+                                                         float z_near,
+                                                         float z_far);
+

+Multiplies matrix by the described perspective matrix +

+

+

+
+

Note

You should be careful not to have to great a z_far / z_near +ratio since that will reduce the effectiveness of depth testing +since there wont be enough precision to identify the depth of +objects near to each other.
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

fov_y :

Vertical field of view angle in degrees.

aspect :

The (width over height) aspect ratio for display

z_near :

The distance to the near clipping plane (Must be positive, +and must not be 0)

z_far :

The distance to the far clipping plane (Must be positive)
+
+
+
+

cogl_matrix_multiply ()

+
void                cogl_matrix_multiply                (CoglMatrix *result,
+                                                         const CoglMatrix *a,
+                                                         const CoglMatrix *b);
+

+Multiplies the two supplied matrices together and stores +the resulting matrix inside result. +

+

+

+
+

Note

It is possible to multiply the a matrix in-place, so +result can be equal to a but can't be equal to b.
+

+

+
++++ + + + + + + + + + + + + + + +

result :

The address of a 4x4 matrix to store the result in

a :

A 4x4 transformation matrix

b :

A 4x4 transformation matrix
+
+
+
+

cogl_matrix_rotate ()

+
void                cogl_matrix_rotate                  (CoglMatrix *matrix,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies matrix with a rotation matrix that applies a rotation +of angle degrees around the specified 3D vector. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

angle :

The angle you want to rotate in degrees

x :

X component of your rotation vector

y :

Y component of your rotation vector

z :

Z component of your rotation vector
+
+
+
+

cogl_matrix_translate ()

+
void                cogl_matrix_translate               (CoglMatrix *matrix,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Multiplies matrix with a transform matrix that translates along +the X, Y and Z axis. +

+
++++ + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

x :

The X translation you want to apply

y :

The Y translation you want to apply

z :

The Z translation you want to apply
+
+
+
+

cogl_matrix_scale ()

+
void                cogl_matrix_scale                   (CoglMatrix *matrix,
+                                                         float sx,
+                                                         float sy,
+                                                         float sz);
+

+Multiplies matrix with a transform matrix that scales along the X, +Y and Z axis. +

+
++++ + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

sx :

The X scale factor

sy :

The Y scale factor

sz :

The Z scale factor
+
+
+
+

cogl_matrix_transpose ()

+
void                cogl_matrix_transpose               (CoglMatrix *matrix);
+

+Replaces matrix with its transpose. Ie, every element (i,j) in the +new matrix is taken from element (j,i) in the old matrix. +

+
++++ + + + + +

matrix :

A CoglMatrix +
+

Since 1.10

+
+
+
+

cogl_matrix_init_from_array ()

+
void                cogl_matrix_init_from_array         (CoglMatrix *matrix,
+                                                         const float *array);
+

+Initializes matrix with the contents of array +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

array :

A linear array of 16 floats (column-major order)
+
+
+
+

cogl_matrix_get_array ()

+
const float *       cogl_matrix_get_array               (const CoglMatrix *matrix);
+

+Casts matrix to a float array which can be directly passed to OpenGL. +

+
++++ + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

Returns :

a pointer to the float array
+
+
+
+

cogl_matrix_get_inverse ()

+
CoglBool            cogl_matrix_get_inverse             (const CoglMatrix *matrix,
+                                                         CoglMatrix *inverse);
+

+Gets the inverse transform of a given matrix and uses it to initialize +a new CoglMatrix. +

+

+

+
+

Note

Although the first parameter is annotated as const to indicate +that the transform it represents isn't modified this function may +technically save a copy of the inverse transform within the given +CoglMatrix so that subsequent requests for the inverse transform may +avoid costly inversion calculations.
+

+

+
++++ + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

inverse :

The destination for a 4x4 inverse transformation matrix. [out] +

Returns :

+TRUE if the inverse was successfully calculated or FALSE +for degenerate transformations that can't be inverted (in this case the +inverse matrix will simply be initialized with the identity matrix)
+

Since 1.2

+
+
+
+

cogl_matrix_transform_point ()

+
void                cogl_matrix_transform_point         (const CoglMatrix *matrix,
+                                                         float *x,
+                                                         float *y,
+                                                         float *z,
+                                                         float *w);
+

+Transforms a point whos position is given and returned as four float +components. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A 4x4 transformation matrix

x :

The X component of your points position. [inout] +

y :

The Y component of your points position. [inout] +

z :

The Z component of your points position. [inout] +

w :

The W component of your points position. [inout] +
+
+
+
+

cogl_matrix_project_points ()

+
void                cogl_matrix_project_points          (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+

+Projects an array of input points and writes the result to another +array of output points. The input points can either have 2, 3 or 4 +components each. The output points always have 4 components (known +as homogenous coordinates). The output array can simply point to +the input array to do the transform in-place. +

+

+Here's an example with differing input/output strides: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49

+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct {
+  float x,y;
+  uint8_t r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  uint8_t r,g,b,a;
+  float x,y,z;
+} MyOutVertex;
+MyInVertex vertices[N_VERTICES];
+MyOutVertex results[N_VERTICES];
+CoglMatrix matrix;
+
+my_load_vertices (vertices);
+my_get_matrix (&matrix);
+
+cogl_matrix_project_points (&matrix,
+                            2,
+                            sizeof (MyInVertex),
+                            &vertices[0].x,
+                            sizeof (MyOutVertex),
+                            &results[0].x,
+                            N_VERTICES);
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A projection matrix

n_components :

The number of position components for each input point. +(either 2, 3 or 4)

stride_in :

The stride in bytes between input points.

points_in :

A pointer to the first component of the first input point.

stride_out :

The stride in bytes between output points.

points_out :

A pointer to the first component of the first output point.

n_points :

The number of points to transform.
+

Stability Level: Unstable

+
+
+
+

cogl_matrix_transform_points ()

+
void                cogl_matrix_transform_points        (const CoglMatrix *matrix,
+                                                         int n_components,
+                                                         size_t stride_in,
+                                                         const void *points_in,
+                                                         size_t stride_out,
+                                                         void *points_out,
+                                                         int n_points);
+

+Transforms an array of input points and writes the result to +another array of output points. The input points can either have 2 +or 3 components each. The output points always have 3 components. +The output array can simply point to the input array to do the +transform in-place. +

+

+If you need to transform 4 component points see +cogl_matrix_project_points(). +

+

+Here's an example with differing input/output strides: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49

+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct {
+  float x,y;
+  uint8_t r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  uint8_t r,g,b,a;
+  float x,y,z;
+} MyOutVertex;
+MyInVertex vertices[N_VERTICES];
+MyOutVertex results[N_VERTICES];
+CoglMatrix matrix;
+
+my_load_vertices (vertices);
+my_get_matrix (&matrix);
+
+cogl_matrix_transform_points (&matrix,
+                              2,
+                              sizeof (MyInVertex),
+                              &vertices[0].x,
+                              sizeof (MyOutVertex),
+                              &results[0].x,
+                              N_VERTICES);
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

matrix :

A transformation matrix

n_components :

The number of position components for each input point. +(either 2 or 3)

stride_in :

The stride in bytes between input points.

points_in :

A pointer to the first component of the first input point.

stride_out :

The stride in bytes between output points.

points_out :

A pointer to the first component of the first output point.

n_points :

The number of points to transform.
+

Stability Level: Unstable

+
+
+
+

cogl_matrix_is_identity ()

+
CoglBool            cogl_matrix_is_identity             (const CoglMatrix *matrix);
+

+Determines if the given matrix is an identity matrix. +

+
++++ + + + + + + + + + + +

matrix :

A CoglMatrix +

Returns :

+TRUE if matrix is an identity matrix else FALSE +
+

Since 1.8

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Offscreen-Buffers-(Deprecated).html b/doc/reference/cogl/html/cogl-Offscreen-Buffers-(Deprecated).html new file mode 100644 index 0000000..9da1561 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Offscreen-Buffers-(Deprecated).html @@ -0,0 +1,107 @@ + + + + +Offscreen Buffers (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Offscreen Buffers (Deprecated)

+

Offscreen Buffers (Deprecated)

+
+
+

Synopsis

+
void *              cogl_offscreen_ref                  (void *offscreen);
+void                cogl_offscreen_unref                (void *offscreen);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_offscreen_ref ()

+
void *              cogl_offscreen_ref                  (void *offscreen);
+
+

Warning

+

cogl_offscreen_ref has been deprecated since version 1.2 and should not be used in newly-written code. cogl_object_ref() should be used in new code.

+
+

+Increments the reference count on the offscreen framebuffer. +

+
++++ + + + + + + + + + + +

offscreen :

A pointer to a CoglOffscreen framebuffer

Returns :

For convenience it returns the +given offscreen. [transfer none] +
+
+
+
+

cogl_offscreen_unref ()

+
void                cogl_offscreen_unref                (void *offscreen);
+
+

Warning

+

cogl_offscreen_unref has been deprecated since version 1.2 and should not be used in newly-written code. cogl_object_unref() should be used in new code.

+
+

+Decreases the reference count for the offscreen buffer and frees it when +the count reaches 0. +

+
++++ + + + + +

offscreen :

A pointer to a CoglOffscreen framebuffer
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Offscreen-Buffers.html b/doc/reference/cogl/html/cogl-Offscreen-Buffers.html new file mode 100644 index 0000000..9dd2a51 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Offscreen-Buffers.html @@ -0,0 +1,504 @@ + + + + +Offscreen Buffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Offscreen Buffers

+

Offscreen Buffers — Functions for creating and manipulating offscreen + framebuffers.

+
+
+

Synopsis

+
CoglOffscreen *     cogl_offscreen_new_with_texture     (CoglTexture *texture);
+CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+CoglBool            cogl_is_offscreen                   (void *object);
+void                cogl_set_framebuffer                (CoglFramebuffer *buffer);
+void                cogl_push_framebuffer               (CoglFramebuffer *buffer);
+void                cogl_pop_framebuffer                (void);
+void                cogl_set_draw_buffer                (CoglBufferTarget target,
+                                                         CoglHandle offscreen);
+void                cogl_pop_draw_buffer                (void);
+void                cogl_push_draw_buffer               (void);
+
+
+
+

Description

+

+Cogl allows creating and operating on offscreen framebuffers. +

+
+
+

Details

+
+

cogl_offscreen_new_with_texture ()

+
CoglOffscreen *     cogl_offscreen_new_with_texture     (CoglTexture *texture);
+

+This creates an offscreen framebuffer object using the given +texture as the primary color buffer. It doesn't just initialize +the contents of the offscreen buffer with the texture; they are +tightly bound so that drawing to the offscreen buffer effectively +updates the contents of the given texture. You don't need to +destroy the offscreen buffer before you can use the texture again. +

+

+

+
+

Note

This api only works with low-level CoglTexture types such as +CoglTexture2D, CoglTexture3D and CoglTextureRectangle, and not +with meta-texture types such as CoglTexture2DSliced.
+

+

+

+The storage for the framebuffer is actually allocated lazily +so this function will never return NULL to indicate a runtime +error. This means it is still possible to configure the framebuffer +before it is really allocated. +

+

+Simple applications without full error handling can simply rely on +Cogl to lazily allocate the storage of framebuffers but you should +be aware that if Cogl encounters an error (such as running out of +GPU memory) then your application will simply abort with an error +message. If you need to be able to catch such exceptions at runtime +then you can explicitly allocate your framebuffer when you have +finished configuring it by calling cogl_framebuffer_allocate() and +passing in a CoglError argument to catch any exceptions. +

+
++++ + + + + + + + + + + +

texture :

A CoglTexture pointer

Returns :

a newly instantiated CoglOffscreen +framebuffer. [transfer full] +
+
+
+
+

cogl_offscreen_new_to_texture ()

+
CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+
+

Warning

+

cogl_offscreen_new_to_texture has been deprecated since version 1.16 and should not be used in newly-written code. Use cogl_offscreen_new_with_texture instead.

+
+

+This creates an offscreen buffer object using the given texture as the +primary color buffer. It doesn't just initialize the contents of the +offscreen buffer with the texture; they are tightly bound so that +drawing to the offscreen buffer effectivly updates the contents of the +given texture. You don't need to destroy the offscreen buffer before +you can use the texture again. +

+

+

+
+

Note

This only works with low-level CoglTexture types such as +CoglTexture2D, CoglTexture3D and CoglTextureRectangle, and not +with meta-texture types such as CoglTexture2DSliced.
+

+

+
++++ + + + + + + + + + + +

texture :

A CoglTexture pointer

Returns :

a newly instantiated CoglOffscreen +framebuffer or NULL if it wasn't possible to create the +buffer. [transfer full] +
+
+
+
+

cogl_is_offscreen ()

+
CoglBool            cogl_is_offscreen                   (void *object);
+

+Determines whether the given CoglObject references an offscreen +framebuffer object. +

+
++++ + + + + + + + + + + +

object :

A pointer to a CoglObject +

Returns :

+TRUE if object is a CoglOffscreen framebuffer, +FALSE otherwise
+
+
+
+

cogl_set_framebuffer ()

+
void                cogl_set_framebuffer                (CoglFramebuffer *buffer);
+
+

Warning

+

cogl_set_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+This redirects all subsequent drawing to the specified framebuffer. This can +either be an offscreen buffer created with cogl_offscreen_new_to_texture() +or in the future it may be an onscreen framebuffers too. +

+
++++ + + + + +

buffer :

A CoglFramebuffer object, either onscreen or offscreen.
+

Since 1.2

+
+
+
+

cogl_push_framebuffer ()

+
void                cogl_push_framebuffer               (CoglFramebuffer *buffer);
+
+

Warning

+

cogl_push_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Redirects all subsequent drawing to the specified framebuffer. This can +either be an offscreen buffer created with cogl_offscreen_new_to_texture() +or in the future it may be an onscreen framebuffer too. +

+

+You should understand that a framebuffer owns the following state: +

+
    +
  • The projection matrix
  • +
  • The modelview matrix stack
  • +
  • The viewport
  • +
  • The clip stack
  • +
+

+So these items will automatically be saved and restored when you +push and pop between different framebuffers. +

+

+Also remember a newly allocated framebuffer will have an identity matrix for +the projection and modelview matrices which gives you a coordinate space +like OpenGL with (-1, -1) corresponding to the top left of the viewport, +(1, 1) corresponding to the bottom right and +z coming out towards the +viewer. +

+

+If you want to set up a coordinate space like Clutter does with (0, 0) +corresponding to the top left and (framebuffer_width, framebuffer_height) +corresponding to the bottom right you can do so like this: +

+

+

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68

+
+
+
+
+
+
+
+
+
+
+
+
+static void
+setup_viewport (unsigned int width,
+                unsigned int height,
+                float fovy,
+                float aspect,
+                float z_near,
+                float z_far)
+{
+  float z_camera;
+  CoglMatrix projection_matrix;
+  CoglMatrix mv_matrix;
+
+  cogl_set_viewport (0, 0, width, height);
+  cogl_perspective (fovy, aspect, z_near, z_far);
+
+  cogl_get_projection_matrix (&projection_matrix);
+  z_camera = 0.5 * projection_matrix.xx;
+
+  cogl_matrix_init_identity (&mv_matrix);
+  cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera);
+  cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
+  cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f);
+  cogl_set_modelview_matrix (&mv_matrix);
+}
+
+static void
+my_init_framebuffer (ClutterStage *stage,
+                     CoglFramebuffer *framebuffer,
+                     unsigned int framebuffer_width,
+                     unsigned int framebuffer_height)
+{
+  ClutterPerspective perspective;
+
+  clutter_stage_get_perspective (stage, &perspective);
+
+  cogl_push_framebuffer (framebuffer);
+  setup_viewport (framebuffer_width,
+                  framebuffer_height,
+                  perspective.fovy,
+                  perspective.aspect,
+                  perspective.z_near,
+                  perspective.z_far);
+}
+
+ +

+

+

+The previous framebuffer can be restored by calling cogl_pop_framebuffer() +

+
++++ + + + + +

buffer :

A CoglFramebuffer object, either onscreen or offscreen.
+

Since 1.2

+
+
+
+

cogl_pop_framebuffer ()

+
void                cogl_pop_framebuffer                (void);
+
+

Warning

+

cogl_pop_framebuffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Restores the framebuffer that was previously at the top of the stack. +All subsequent drawing will be redirected to this framebuffer. +

+

Since 1.2

+
+
+
+

cogl_set_draw_buffer ()

+
void                cogl_set_draw_buffer                (CoglBufferTarget target,
+                                                         CoglHandle offscreen);
+
+

Warning

+

cogl_set_draw_buffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Redirects all subsequent drawing to the specified framebuffer. This +can either be an offscreen buffer created with +cogl_offscreen_new_to_texture() or you can revert to your original +on screen window buffer. +

+
++++ + + + + + + + + + + +

target :

A CoglBufferTarget that specifies what kind of framebuffer you +are setting as the render target.

offscreen :

If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER +then this is a CoglHandle for the offscreen buffer.
+
+
+
+

cogl_pop_draw_buffer ()

+
void                cogl_pop_draw_buffer                (void);
+
+

Warning

+

cogl_pop_draw_buffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Restore cogl_set_draw_buffer() state. +

+
+
+
+

cogl_push_draw_buffer ()

+
void                cogl_push_draw_buffer               (void);
+
+

Warning

+

cogl_push_draw_buffer has been deprecated since version 1.16 and should not be used in newly-written code. The latest drawing apis take explicit + CoglFramebuffer arguments so this stack of + framebuffers shouldn't be used anymore.

+
+

+Save cogl_set_draw_buffer() state. +

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Path-Primitives.html b/doc/reference/cogl/html/cogl-Path-Primitives.html new file mode 100644 index 0000000..28b7cc3 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Path-Primitives.html @@ -0,0 +1,53 @@ + + + + +Path Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Path Primitives

+

Path Primitives

+
+
+

Synopsis

+

+
+
+

Description

+
+
+

Details

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Primitives.html b/doc/reference/cogl/html/cogl-Primitives.html new file mode 100644 index 0000000..779ecc2 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Primitives.html @@ -0,0 +1,360 @@ + + + + +Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Primitives

+

Primitives — Functions that draw various primitive 3D shapes

+
+
+

Synopsis

+
void                cogl_rectangle                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_rectangles                     (const float *verts,
+                                                         unsigned int n_rects);
+void                cogl_rectangle_with_texture_coords  (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         float tx1,
+                                                         float ty1,
+                                                         float tx2,
+                                                         float ty2);
+void                cogl_rectangles_with_texture_coords (const float *verts,
+                                                         unsigned int n_rects);
+void                cogl_rectangle_with_multitexture_coords
+                                                        (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+void                cogl_polygon                        (const CoglTextureVertex *vertices,
+                                                         unsigned int n_vertices,
+                                                         CoglBool use_color);
+
+
+
+

Description

+

+The primitives API provides utilities for drawing some +common 3D shapes in a more convenient way than the CoglVertexBuffer +API provides. +

+
+
+

Details

+
+

cogl_rectangle ()

+
void                cogl_rectangle                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Fills a rectangle at the given coordinates with the current source material +

+
++++ + + + + + + + + + + + + + + + + + + +

x_1 :

X coordinate of the top-left corner

y_1 :

Y coordinate of the top-left corner

x_2 :

X coordinate of the bottom-right corner

y_2 :

Y coordinate of the bottom-right corner
+
+
+
+

cogl_rectangles ()

+
void                cogl_rectangles                     (const float *verts,
+                                                         unsigned int n_rects);
+

+Draws a series of rectangles in the same way that +cogl_rectangle() does. In some situations it can give a +significant performance boost to use this function rather than +calling cogl_rectangle() separately for each rectangle. +

+

+verts should point to an array of floats with +n_rects * 4 elements. Each group of 4 values corresponds to the +parameters x1, y1, x2, and y2, and have the same +meaning as in cogl_rectangle(). +

+
++++ + + + + + + + + + + +

verts :

an array of vertices. [in][array][transfer none] +

n_rects :

number of rectangles to draw
+

Since 1.0

+
+
+
+

cogl_rectangle_with_texture_coords ()

+
void                cogl_rectangle_with_texture_coords  (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         float tx1,
+                                                         float ty1,
+                                                         float tx2,
+                                                         float ty2);
+

+Draw a rectangle using the current material and supply texture coordinates +to be used for the first texture layer of the material. To draw the entire +texture pass in tx1=0.0 ty1=0.0 tx2=1.0 ty2=1.0. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

x1 :

x coordinate upper left on screen.

y1 :

y coordinate upper left on screen.

x2 :

x coordinate lower right on screen.

y2 :

y coordinate lower right on screen.

tx1 :

x part of texture coordinate to use for upper left pixel

ty1 :

y part of texture coordinate to use for upper left pixel

tx2 :

x part of texture coordinate to use for lower right pixel

ty2 :

y part of texture coordinate to use for left pixel
+

Since 1.0

+
+
+
+

cogl_rectangles_with_texture_coords ()

+
void                cogl_rectangles_with_texture_coords (const float *verts,
+                                                         unsigned int n_rects);
+

+Draws a series of rectangles in the same way that +cogl_rectangle_with_texture_coords() does. In some situations it can give a +significant performance boost to use this function rather than +calling cogl_rectangle_with_texture_coords() separately for each rectangle. +

+

+verts should point to an array of floats with +n_rects * 8 elements. Each group of 8 values corresponds to the +parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same +meaning as in cogl_rectangle_with_texture_coords(). +

+
++++ + + + + + + + + + + +

verts :

an array of vertices. [in][array][transfer none] +

n_rects :

number of rectangles to draw
+

Since 0.8.6

+
+
+
+

cogl_rectangle_with_multitexture_coords ()

+
void                cogl_rectangle_with_multitexture_coords
+                                                        (float x1,
+                                                         float y1,
+                                                         float x2,
+                                                         float y2,
+                                                         const float *tex_coords,
+                                                         int tex_coords_len);
+

+This function draws a rectangle using the current source material to +texture or fill with. As a material may contain multiple texture layers +this interface lets you supply texture coordinates for each layer of the +material. +

+

+The first pair of coordinates are for the first layer (with the smallest +layer index) and if you supply less texture coordinates than there are +layers in the current source material then default texture coordinates +(0.0, 0.0, 1.0, 1.0) are generated. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

x1 :

x coordinate upper left on screen.

y1 :

y coordinate upper left on screen.

x2 :

x coordinate lower right on screen.

y2 :

y coordinate lower right on screen.

tex_coords :

An array containing groups of +4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture +coordinates; one for the upper left texel, and one for the lower right +texel. Each value should be between 0.0 and 1.0, where the coordinate +(0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the +bottom right. [in][array][transfer none] +

tex_coords_len :

The length of the tex_coords array. (e.g. for one layer +and one group of texture coordinates, this would be 4)
+

Since 1.0

+
+
+
+

cogl_polygon ()

+
void                cogl_polygon                        (const CoglTextureVertex *vertices,
+                                                         unsigned int n_vertices,
+                                                         CoglBool use_color);
+

+Draws a convex polygon using the current source material to fill / texture +with according to the texture coordinates passed. +

+

+If use_color is TRUE then the color will be changed for each vertex using +the value specified in the color member of CoglTextureVertex. This can be +used for example to make the texture fade out by setting the alpha value of +the color. +

+

+All of the texture coordinates must be in the range [0,1] and repeating the +texture is not supported. +

+

+Because of the way this function is implemented it will currently +only work if either the texture is not sliced or the backend is not +OpenGL ES and the minifying and magnifying functions are both set +to COGL_MATERIAL_FILTER_NEAREST. +

+
++++ + + + + + + + + + + + + + + +

vertices :

An array of CoglTextureVertex structs

n_vertices :

The length of the vertices array

use_color :

+TRUE if the color member of CoglTextureVertex should be used
+

Since 1.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Quaternions-(Rotations).html b/doc/reference/cogl/html/cogl-Quaternions-(Rotations).html new file mode 100644 index 0000000..5bd04fc --- /dev/null +++ b/doc/reference/cogl/html/cogl-Quaternions-(Rotations).html @@ -0,0 +1,1081 @@ + + + + +Quaternions (Rotations) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Quaternions (Rotations)

+

Quaternions (Rotations) — Functions for initializing and manipulating +quaternions.

+
+
+

Synopsis

+
                    CoglQuaternion;
+void                cogl_quaternion_init_identity       (CoglQuaternion *quaternion);
+void                cogl_quaternion_init                (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_quaternion_init_from_angle_vector
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         const float *axis3f);
+void                cogl_quaternion_init_from_array     (CoglQuaternion *quaternion,
+                                                         const float *array);
+void                cogl_quaternion_init_from_x_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+void                cogl_quaternion_init_from_y_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+void                cogl_quaternion_init_from_z_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+CoglBool            cogl_quaternion_equal               (const void *v1,
+                                                         const void *v2);
+CoglQuaternion *    cogl_quaternion_copy                (const CoglQuaternion *src);
+void                cogl_quaternion_free                (CoglQuaternion *quaternion);
+float               cogl_quaternion_get_rotation_angle  (const CoglQuaternion *quaternion);
+void                cogl_quaternion_get_rotation_axis   (const CoglQuaternion *quaternion,
+                                                         float *vector3);
+void                cogl_quaternion_normalize           (CoglQuaternion *quaternion);
+float               cogl_quaternion_dot_product         (const CoglQuaternion *a,
+                                                         const CoglQuaternion *b);
+void                cogl_quaternion_invert              (CoglQuaternion *quaternion);
+void                cogl_quaternion_multiply            (CoglQuaternion *result,
+                                                         const CoglQuaternion *left,
+                                                         const CoglQuaternion *right);
+void                cogl_quaternion_pow                 (CoglQuaternion *quaternion,
+                                                         float exponent);
+void                cogl_quaternion_slerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+void                cogl_quaternion_nlerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+void                cogl_quaternion_squad               (CoglQuaternion *result,
+                                                         const CoglQuaternion *prev,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         const CoglQuaternion *next,
+                                                         float t);
+const CoglQuaternion * cogl_get_static_identity_quaternion
+                                                        (void);
+const CoglQuaternion * cogl_get_static_zero_quaternion  (void);
+
+
+
+

Description

+

+Quaternions have become a standard form for representing 3D +rotations and have some nice properties when compared with other +representation such as (roll,pitch,yaw) Euler angles. They can be +used to interpolate between different rotations and they don't +suffer from a problem called +"Gimbal lock" +where two of the axis of rotation may become aligned and you loose a +degree of freedom. +. +

+
+
+

Details

+
+

CoglQuaternion

+
typedef struct {
+  float w;
+
+  float x;
+  float y;
+  float z;
+} CoglQuaternion;
+
+

+A quaternion is comprised of a scalar component and a 3D vector +component. The scalar component is normally referred to as w and the +vector might either be referred to as v or a (for axis) or expanded +with the individual components: (x, y, z) A full quaternion would +then be written as [w (x, y, z)]. +

+

+Quaternions can be considered to represent an axis and angle +pair although sadly these numbers are buried somewhat under some +maths... +

+

+For the curious you can see here that a given axis (a) and angle (𝜃) +pair are represented in a quaternion as follows: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+[w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )]
+
+ +

+

+

+Unit Quaternions: +When using Quaternions to represent spatial orientations for 3D +graphics it's always assumed you have a unit quaternion. The +magnitude of a quaternion is defined as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+sqrt (w² + x² + y² + z²)
+
+ +

+and a unit quaternion satisfies this equation: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+w² + x² + y² + z² = 1
+
+ +

+

+

+Thankfully most of the time we don't actually have to worry about +the maths that goes on behind the scenes but if you are curious to +learn more here are some external references: +

+

+

+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

float w;

based on the angle of rotation it is cos(𝜃/2)

float x;

based on the angle of rotation and x component of the axis of +rotation it is sin(𝜃/2)*axis.x

float y;

based on the angle of rotation and y component of the axis of +rotation it is sin(𝜃/2)*axis.y

float z;

based on the angle of rotation and z component of the axis of +rotation it is sin(𝜃/2)*axis.z
+
+
+
+

cogl_quaternion_init_identity ()

+
void                cogl_quaternion_init_identity       (CoglQuaternion *quaternion);
+

+Initializes the quaternion with the canonical quaternion identity +[1 (0, 0, 0)] which represents no rotation. Multiplying a +quaternion with this identity leaves the quaternion unchanged. +

+

+You might also want to consider using +cogl_get_static_identity_quaternion(). +

+
++++ + + + + +

quaternion :

An uninitialized CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_init ()

+
void                cogl_quaternion_init                (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Initializes a quaternion that rotates angle degrees around the +axis vector (x, y, z). The axis vector does not need to be +normalized. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle you want to rotate around the given axis

x :

The x component of your axis vector about which you want to +rotate.

y :

The y component of your axis vector about which you want to +rotate.

z :

The z component of your axis vector about which you want to +rotate.

Returns :

A normalized, unit quaternion representing an orientation +rotated angle degrees around the axis vector (x, y, z)
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_angle_vector ()

+
void                cogl_quaternion_init_from_angle_vector
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle,
+                                                         const float *axis3f);
+

+Initializes a quaternion that rotates angle degrees around the +given axis vector. The axis vector does not need to be +normalized. +

+
++++ + + + + + + + + + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around axis3f +

axis3f :

your 3 component axis vector about which you want to rotate.

Returns :

A normalized, unit quaternion representing an orientation +rotated angle degrees around the given axis vector.
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_array ()

+
void                cogl_quaternion_init_from_array     (CoglQuaternion *quaternion,
+                                                         const float *array);
+

+Initializes a [w (x, y,z)] quaternion directly from an array of 4 +floats: [w,x,y,z]. +

+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

array :

An array of 4 floats w,(x,y,z)
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_x_rotation ()

+
void                cogl_quaternion_init_from_x_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+

+XXX: check which direction this rotates +

+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the x axis
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_y_rotation ()

+
void                cogl_quaternion_init_from_y_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the y axis
+

Since 2.0

+
+
+
+

cogl_quaternion_init_from_z_rotation ()

+
void                cogl_quaternion_init_from_z_rotation
+                                                        (CoglQuaternion *quaternion,
+                                                         float angle);
+
++++ + + + + + + + + + + +

quaternion :

An uninitialized CoglQuaternion +

angle :

The angle to rotate around the z axis
+

Since 2.0

+
+
+
+

cogl_quaternion_equal ()

+
CoglBool            cogl_quaternion_equal               (const void *v1,
+                                                         const void *v2);
+

+Compares that all the components of quaternions a and b are +equal. +

+

+An epsilon value is not used to compare the float components, but +the == operator is at least used so that 0 and -0 are considered +equal. +

+
++++ + + + + + + + + + + + + + + +

v1 :

A CoglQuaternion +

v2 :

A CoglQuaternion +

Returns :

+TRUE if the quaternions are equal else FALSE.
+

Since 2.0

+
+
+
+

cogl_quaternion_copy ()

+
CoglQuaternion *    cogl_quaternion_copy                (const CoglQuaternion *src);
+

+Allocates a new CoglQuaternion on the stack and initializes it with +the same values as src. +

+
++++ + + + + + + + + + + +

src :

A CoglQuaternion +

Returns :

A newly allocated CoglQuaternion which should be freed +using cogl_quaternion_free() +
+

Since 2.0

+
+
+
+

cogl_quaternion_free ()

+
void                cogl_quaternion_free                (CoglQuaternion *quaternion);
+

+Frees a CoglQuaternion that was previously allocated via +cogl_quaternion_copy(). +

+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_get_rotation_angle ()

+
float               cogl_quaternion_get_rotation_angle  (const CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_get_rotation_axis ()

+
void                cogl_quaternion_get_rotation_axis   (const CoglQuaternion *quaternion,
+                                                         float *vector3);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

vector3 :

an allocated 3-float array. [out] +
+

Since 2.0

+
+
+
+

cogl_quaternion_normalize ()

+
void                cogl_quaternion_normalize           (CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_dot_product ()

+
float               cogl_quaternion_dot_product         (const CoglQuaternion *a,
+                                                         const CoglQuaternion *b);
+
++++ + + + + + + + + + + +

a :

A CoglQuaternion +

b :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_invert ()

+
void                cogl_quaternion_invert              (CoglQuaternion *quaternion);
+
++++ + + + + +

quaternion :

A CoglQuaternion +
+

Since 2.0

+
+
+
+

cogl_quaternion_multiply ()

+
void                cogl_quaternion_multiply            (CoglQuaternion *result,
+                                                         const CoglQuaternion *left,
+                                                         const CoglQuaternion *right);
+

+This combines the rotations of two quaternions into result. The +operation is not commutative so the order is important because AxB +!= BxA. Cogl follows the standard convention for quaternions here +so the rotations are applied right to left. This is similar to the +combining of matrices. +

+

+

+
+

Note

It is possible to multiply the a quaternion in-place, so +result can be equal to a but can't be equal to b.
+

+

+
++++ + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

left :

The second CoglQuaternion rotation to apply

right :

The first CoglQuaternion rotation to apply
+

Since 2.0

+
+
+
+

cogl_quaternion_pow ()

+
void                cogl_quaternion_pow                 (CoglQuaternion *quaternion,
+                                                         float exponent);
+
++++ + + + + + + + + + + +

quaternion :

A CoglQuaternion +

exponent :

the exponent
+

Since 2.0

+
+
+
+

cogl_quaternion_slerp ()

+
void                cogl_quaternion_slerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+

+Performs a spherical linear interpolation between two quaternions. +

+

+Noteable properties: +

+
    +
  • +commutative: No +
  • +
  • +constant velocity: Yes +
  • +
  • +torque minimal (travels along the surface of the 4-sphere): Yes +
  • +
  • +more expensive than cogl_quaternion_nlerp() +
  • +
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

t :

The factor in the range [0,1] used to interpolate between +quaternion a and b.
+
+
+
+

cogl_quaternion_nlerp ()

+
void                cogl_quaternion_nlerp               (CoglQuaternion *result,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         float t);
+

+Performs a normalized linear interpolation between two quaternions. +That is it does a linear interpolation of the quaternion components +and then normalizes the result. This will follow the shortest arc +between the two orientations (just like the slerp() function) but +will not progress at a constant speed. Unlike slerp() nlerp is +commutative which is useful if you are blending animations +together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp, +d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp, +b)). Finally nlerp is cheaper than slerp so it can be a good choice +if you don't need the constant speed property of the slerp() function. +

+

+Notable properties: +

+
    +
  • +commutative: Yes +
  • +
  • +constant velocity: No +
  • +
  • +torque minimal (travels along the surface of the 4-sphere): Yes +
  • +
  • +faster than cogl_quaternion_slerp() +
  • +
+

+

+
++++ + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

t :

The factor in the range [0,1] used to interpolate between +quaterion a and b.
+
+
+
+

cogl_quaternion_squad ()

+
void                cogl_quaternion_squad               (CoglQuaternion *result,
+                                                         const CoglQuaternion *prev,
+                                                         const CoglQuaternion *a,
+                                                         const CoglQuaternion *b,
+                                                         const CoglQuaternion *next,
+                                                         float t);
+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

result :

The destination CoglQuaternion +

prev :

A CoglQuaternion used before a +

a :

The first CoglQuaternion +

b :

The second CoglQuaternion +

next :

A CoglQuaternion that will be used after b +

t :

The factor in the range [0,1] used to interpolate between +quaternion a and b.
+

Since 2.0

+
+
+
+

cogl_get_static_identity_quaternion ()

+
const CoglQuaternion * cogl_get_static_identity_quaternion
+                                                        (void);
+

+Returns a pointer to a singleton quaternion constant describing the +canonical identity [1 (0, 0, 0)] which represents no rotation. +

+

+If you multiply a quaternion with the identity quaternion you will +get back the same value as the original quaternion. +

+
++++ + + + + +

Returns :

A pointer to an identity quaternion
+

Since 2.0

+
+
+
+

cogl_get_static_zero_quaternion ()

+
const CoglQuaternion * cogl_get_static_zero_quaternion  (void);
+
++++ + + + + +

Returns :

a pointer to a singleton quaternion constant describing a +rotation of 180 degrees around a degenerate axis: +[0 (0, 0, 0)]
+

Since 2.0

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline-(Deprecated).html b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline-(Deprecated).html new file mode 100644 index 0000000..460182d --- /dev/null +++ b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline-(Deprecated).html @@ -0,0 +1,396 @@ + + + + +Shaders and Programmable Pipeline (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Shaders and Programmable Pipeline (Deprecated)

+

Shaders and Programmable Pipeline (Deprecated)

+
+
+

Synopsis

+
CoglHandle          cogl_shader_ref                     (CoglHandle handle);
+void                cogl_shader_unref                   (CoglHandle handle);
+
+CoglHandle          cogl_program_ref                    (CoglHandle handle);
+void                cogl_program_unref                  (CoglHandle handle);
+void                cogl_program_use                    (CoglHandle handle);
+void                cogl_program_uniform_1f             (int uniform_no,
+                                                         float value);
+void                cogl_program_uniform_1i             (int uniform_no,
+                                                         int value);
+void                cogl_program_uniform_float          (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         const float *value);
+void                cogl_program_uniform_int            (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         const int *value);
+void                cogl_program_uniform_matrix         (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_shader_ref ()

+
CoglHandle          cogl_shader_ref                     (CoglHandle handle);
+
+

Warning

+

cogl_shader_ref has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Add an extra reference to a shader. +

+
++++ + + + + + + + + + + +

handle :

A CoglHandle to a shader.

Returns :

handle
+
+
+
+

cogl_shader_unref ()

+
void                cogl_shader_unref                   (CoglHandle handle);
+
+

Warning

+

cogl_shader_unref has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Removes a reference to a shader. If it was the last reference the +shader object will be destroyed. +

+
++++ + + + + +

handle :

A CoglHandle to a shader.
+
+
+
+

cogl_program_ref ()

+
CoglHandle          cogl_program_ref                    (CoglHandle handle);
+
+

Warning

+

cogl_program_ref has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Add an extra reference to a program. +

+
++++ + + + + + + + + + + +

handle :

A CoglHandle to a program.

Returns :

handle
+
+
+
+

cogl_program_unref ()

+
void                cogl_program_unref                  (CoglHandle handle);
+
+

Warning

+

cogl_program_unref has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Removes a reference to a program. If it was the last reference the +program object will be destroyed. +

+
++++ + + + + +

handle :

A CoglHandle to a program.
+
+
+
+

cogl_program_use ()

+
void                cogl_program_use                    (CoglHandle handle);
+
+

Warning

+

cogl_program_use has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Activate a specific shader program replacing that part of the GL +rendering pipeline, if passed in COGL_INVALID_HANDLE the default +behavior of GL is reinstated. +

+

+This function affects the global state of the current Cogl +context. It is much more efficient to attach the shader to a +specific material used for rendering instead by calling +cogl_material_set_user_program(). +

+
++++ + + + + +

handle :

a CoglHandle for a shader program or COGL_INVALID_HANDLE.
+
+
+
+

cogl_program_uniform_1f ()

+
void                cogl_program_uniform_1f             (int uniform_no,
+                                                         float value);
+
+

Warning

+

cogl_program_uniform_1f has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Changes the value of a floating point uniform in the currently +used (see cogl_program_use()) shader program. +

+
++++ + + + + + + + + + + +

uniform_no :

the uniform to set.

value :

the new value of the uniform.
+
+
+
+

cogl_program_uniform_1i ()

+
void                cogl_program_uniform_1i             (int uniform_no,
+                                                         int value);
+
+

Warning

+

cogl_program_uniform_1i has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Changes the value of an integer uniform in the currently +used (see cogl_program_use()) shader program. +

+
++++ + + + + + + + + + + +

uniform_no :

the uniform to set.

value :

the new value of the uniform.
+
+
+
+

cogl_program_uniform_float ()

+
void                cogl_program_uniform_float          (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         const float *value);
+
+

Warning

+

cogl_program_uniform_float has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Changes the value of a float vector uniform, or uniform array in the +currently used (see cogl_program_use()) shader program. +

+
++++ + + + + + + + + + + + + + + + + + + +

uniform_no :

the uniform to set.

size :

Size of float vector.

count :

Size of array of uniforms.

value :

the new value of the uniform. [array length=count] +
+
+
+
+

cogl_program_uniform_int ()

+
void                cogl_program_uniform_int            (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         const int *value);
+
+

Warning

+

cogl_program_uniform_int has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Changes the value of a int vector uniform, or uniform array in the +currently used (see cogl_program_use()) shader program. +

+
++++ + + + + + + + + + + + + + + + + + + +

uniform_no :

the uniform to set.

size :

Size of int vector.

count :

Size of array of uniforms.

value :

the new value of the uniform. [array length=count] +
+
+
+
+

cogl_program_uniform_matrix ()

+
void                cogl_program_uniform_matrix         (int uniform_no,
+                                                         int size,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+
+

Warning

+

cogl_program_uniform_matrix has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Changes the value of a matrix uniform, or uniform array in the +currently used (see cogl_program_use()) shader program. The size +parameter is used to determine the square size of the matrix. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

uniform_no :

the uniform to set.

size :

Size of matrix.

count :

Size of array of uniforms.

transpose :

Whether to transpose the matrix when setting the uniform.

value :

the new value of the uniform. [array length=count] +
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline.html b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline.html new file mode 100644 index 0000000..ae76e19 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline.html @@ -0,0 +1,873 @@ + + + + +Shaders and Programmable Pipeline + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Shaders and Programmable Pipeline

+

Shaders and Programmable Pipeline — Fuctions for accessing the programmable GL pipeline

+
+
+

Synopsis

+
enum                CoglShaderType;
+CoglHandle          cogl_create_shader                  (CoglShaderType shader_type);
+CoglBool            cogl_is_shader                      (CoglHandle handle);
+void                cogl_shader_source                  (CoglHandle shader,
+                                                         const char *source);
+void                cogl_shader_compile                 (CoglHandle handle);
+char *              cogl_shader_get_info_log            (CoglHandle handle);
+CoglShaderType      cogl_shader_get_type                (CoglHandle handle);
+CoglBool            cogl_shader_is_compiled             (CoglHandle handle);
+
+CoglHandle          cogl_create_program                 (void);
+CoglBool            cogl_is_program                     (CoglHandle handle);
+void                cogl_program_attach_shader          (CoglHandle program_handle,
+                                                         CoglHandle shader_handle);
+void                cogl_program_link                   (CoglHandle handle);
+int                 cogl_program_get_uniform_location   (CoglHandle handle,
+                                                         const char *uniform_name);
+void                cogl_program_set_uniform_1f         (CoglHandle program,
+                                                         int uniform_location,
+                                                         float value);
+void                cogl_program_set_uniform_1i         (CoglHandle program,
+                                                         int uniform_location,
+                                                         int value);
+void                cogl_program_set_uniform_float      (CoglHandle program,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const float *value);
+void                cogl_program_set_uniform_int        (CoglHandle program,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const int *value);
+void                cogl_program_set_uniform_matrix     (CoglHandle program,
+                                                         int uniform_location,
+                                                         int dimensions,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+
+
+
+

Description

+

+Cogl allows accessing the GL programmable pipeline in order to create +vertex and fragment shaders. +

+

+The shader source code can either be GLSL or ARBfp. If the source +code is ARBfp, it must begin with the string “!!ARBfp1.0”. The +application should check for the COGL_FEATURE_SHADERS_GLSL or +COGL_FEATURE_SHADERS_ARBFP features before using shaders. +

+

+When using GLSL Cogl provides replacement names for most of the +builtin varyings and uniforms. It is recommended to use these names +wherever possible to increase portability between OpenGL 2.0 and +GLES 2.0. GLES 2.0 does not have most of the builtins under their +original names so they will only work with the Cogl names. +

+

+For use in all GLSL shaders, the Cogl builtins are as follows: +

+

+

+
+

Tip

+
+
uniform mat4 + cogl_modelview_matrix
+

+ The current modelview matrix. This is equivalent to + gl_ModelViewMatrix. +

+
uniform mat4 + cogl_projection_matrix
+

+ The current projection matrix. This is equivalent to + gl_ProjectionMatrix. +

+
uniform mat4 + cogl_modelview_projection_matrix
+

+ The combined modelview and projection matrix. A vertex shader + would typically use this to transform the incoming vertex + position. The separate modelview and projection matrices are + usually only needed for lighting calculations. This is + equivalent to gl_ModelViewProjectionMatrix. +

+
uniform mat4 + cogl_texture_matrix[]
+

+ An array of matrices for transforming the texture + coordinates. This is equivalent to gl_TextureMatrix. +

+
+
+

+

+

+In a vertex shader, the following are also available: +

+

+

+
+

Tip

+
+
attribute vec4 + cogl_position_in
+

+ The incoming vertex position. This is equivalent to gl_Vertex. +

+
attribute vec4 + cogl_color_in
+

+ The incoming vertex color. This is equivalent to gl_Color. +

+
attribute vec4 + cogl_tex_coord_in
+

+ The texture coordinate for the first texture unit. This is + equivalent to gl_MultiTexCoord0. +

+
attribute vec4 + cogl_tex_coord0_in
+

+ The texture coordinate for the first texture unit. This is + equivalent to gl_MultiTexCoord0. There is also + cogl_tex_coord1_in and so on. +

+
attribute vec3 + cogl_normal_in
+

+ The normal of the vertex. This is equivalent to gl_Normal. +

+
vec4 + cogl_position_out
+

+ The calculated position of the vertex. This must be written to + in all vertex shaders. This is equivalent to gl_Position. +

+
float + cogl_point_size_out
+

+ The calculated size of a point. This is equivalent to gl_PointSize. +

+
varying vec4 + cogl_color_out
+

+ The calculated color of a vertex. This is equivalent to gl_FrontColor. +

+
varying vec4 + cogl_tex_coord_out[]
+

+ An array of calculated texture coordinates for a vertex. This is + equivalent to gl_TexCoord. +

+
+
+

+

+

+In a fragment shader, the following are also available: +

+

+

+
+

Tip

+
+
varying vec4 cogl_color_in
+

+ The calculated color of a vertex. This is equivalent to gl_FrontColor. +

+
varying vec4 + cogl_tex_coord_in[]
+

+ An array of calculated texture coordinates for a vertex. This is + equivalent to gl_TexCoord. +

+
vec4 cogl_color_out
+

+ The final calculated color of the fragment. All fragment shaders + must write to this variable. This is equivalent to + gl_FrontColor. +

+
float cogl_depth_out
+

+ An optional output variable specifying the depth value to use + for this fragment. This is equivalent to gl_FragDepth. +

+
bool cogl_front_facing
+

+ A readonly variable that will be true if the current primitive + is front facing. This can be used to implement two-sided + coloring algorithms. This is equivalent to gl_FrontFacing. +

+
+
+

+

+

+It's worth nothing that this API isn't what Cogl would like to have +in the long term and it may be removed in Cogl 2.0. The +experimental CoglShader API is the proposed replacement. +

+
+
+

Details

+
+

enum CoglShaderType

+
typedef enum {
+  COGL_SHADER_TYPE_VERTEX,
+  COGL_SHADER_TYPE_FRAGMENT
+} CoglShaderType;
+
+

+Types of shaders +

+
++++ + + + + + + + + + + +

COGL_SHADER_TYPE_VERTEX

A program for proccessing vertices +

COGL_SHADER_TYPE_FRAGMENT

A program for processing fragments +
+

Since 1.0

+
+
+
+

cogl_create_shader ()

+
CoglHandle          cogl_create_shader                  (CoglShaderType shader_type);
+
+

Warning

+

cogl_create_shader has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Create a new shader handle, use cogl_shader_source() to set the +source code to be used on it. +

+
++++ + + + + + + + + + + +

shader_type :

COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.

Returns :

a new shader handle.
+
+
+
+

cogl_is_shader ()

+
CoglBool            cogl_is_shader                      (CoglHandle handle);
+
+

Warning

+

cogl_is_shader has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Gets whether the given handle references an existing shader object. +

+
++++ + + + + + + + + + + +

handle :

A CoglHandle

Returns :

+TRUE if the handle references a shader, +FALSE otherwise
+
+
+
+

cogl_shader_source ()

+
void                cogl_shader_source                  (CoglHandle shader,
+                                                         const char *source);
+
+

Warning

+

cogl_shader_source has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Replaces the current source associated with a shader with a new +one. +

+

+Please see above +for a description of the recommended format for the shader code. +

+
++++ + + + + + + + + + + +

shader :

+CoglHandle for a shader.

source :

Shader source.
+
+
+
+

cogl_shader_compile ()

+
void                cogl_shader_compile                 (CoglHandle handle);
+
+

Warning

+

cogl_shader_compile has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Compiles the shader, no return value, but the shader is now ready +for linking into a program. Note that calling this function is +optional. If it is not called then the shader will be automatically +compiled when it is linked. +

+
++++ + + + + +

handle :

+CoglHandle for a shader.
+
+
+
+

cogl_shader_get_info_log ()

+
char *              cogl_shader_get_info_log            (CoglHandle handle);
+
+

Warning

+

cogl_shader_get_info_log has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Retrieves the information log for a coglobject, can be used in conjunction +with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error +messages that caused a shader to not compile correctly, mainly useful for +debugging purposes. +

+
++++ + + + + + + + + + + +

handle :

+CoglHandle for a shader.

Returns :

a newly allocated string containing the info log. Use +g_free() to free it
+
+
+
+

cogl_shader_get_type ()

+
CoglShaderType      cogl_shader_get_type                (CoglHandle handle);
+
+

Warning

+

cogl_shader_get_type has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Retrieves the type of a shader CoglHandle +

+
++++ + + + + + + + + + + +

handle :

+CoglHandle for a shader.

Returns :

+COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor +or COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
+
+
+
+

cogl_shader_is_compiled ()

+
CoglBool            cogl_shader_is_compiled             (CoglHandle handle);
+
+

Warning

+

cogl_shader_is_compiled has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Retrieves whether a shader CoglHandle has been compiled +

+
++++ + + + + + + + + + + +

handle :

+CoglHandle for a shader.

Returns :

+TRUE if the shader object has sucessfully be compiled
+
+
+
+

cogl_create_program ()

+
CoglHandle          cogl_create_program                 (void);
+
+

Warning

+

cogl_create_program has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Create a new cogl program object that can be used to replace parts of the GL +rendering pipeline with custom code. +

+
++++ + + + + +

Returns :

a new cogl program.
+
+
+
+

cogl_is_program ()

+
CoglBool            cogl_is_program                     (CoglHandle handle);
+
+

Warning

+

cogl_is_program has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Gets whether the given handle references an existing program object. +

+
++++ + + + + + + + + + + +

handle :

A CoglHandle

Returns :

+TRUE if the handle references a program, +FALSE otherwise
+
+
+
+

cogl_program_attach_shader ()

+
void                cogl_program_attach_shader          (CoglHandle program_handle,
+                                                         CoglHandle shader_handle);
+
+

Warning

+

cogl_program_attach_shader has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Attaches a shader to a program object. A program can have multiple +vertex or fragment shaders but only one of them may provide a +main() function. It is allowed to use a program with only a vertex +shader or only a fragment shader. +

+
++++ + + + + + + + + + + +

program_handle :

a CoglHandle for a shdaer program.

shader_handle :

a CoglHandle for a vertex of fragment shader.
+
+
+
+

cogl_program_link ()

+
void                cogl_program_link                   (CoglHandle handle);
+
+

Warning

+

cogl_program_link has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api

+
+

+Links a program making it ready for use. Note that calling this +function is optional. If it is not called the program will +automatically be linked the first time it is used. +

+
++++ + + + + +

handle :

a CoglHandle for a shader program.
+
+
+
+

cogl_program_get_uniform_location ()

+
int                 cogl_program_get_uniform_location   (CoglHandle handle,
+                                                         const char *uniform_name);
+
+

Warning

+

cogl_program_get_uniform_location has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Retrieve the location (offset) of a uniform variable in a shader program, +a uniform is a variable that is constant for all vertices/fragments for a +shader object and is possible to modify as an external parameter. +

+
++++ + + + + + + + + + + + + + + +

handle :

a CoglHandle for a shader program.

uniform_name :

the name of a uniform.

Returns :

the offset of a uniform in a specified program. +This uniform can be set using cogl_program_uniform_1f() when the +program is in use.
+
+
+
+

cogl_program_set_uniform_1f ()

+
void                cogl_program_set_uniform_1f         (CoglHandle program,
+                                                         int uniform_location,
+                                                         float value);
+
+

Warning

+

cogl_program_set_uniform_1f has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Changes the value of a floating point uniform for the given linked +program. +

+
++++ + + + + + + + + + + + + + + +

program :

A CoglHandle for a linked program

uniform_location :

the uniform location retrieved from +cogl_program_get_uniform_location().

value :

the new value of the uniform.
+

Since 1.4

+
+
+
+

cogl_program_set_uniform_1i ()

+
void                cogl_program_set_uniform_1i         (CoglHandle program,
+                                                         int uniform_location,
+                                                         int value);
+
+

Warning

+

cogl_program_set_uniform_1i has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Changes the value of an integer uniform for the given linked +program. +

+
++++ + + + + + + + + + + + + + + +

program :

A CoglHandle for a linked program

uniform_location :

the uniform location retrieved from +cogl_program_get_uniform_location().

value :

the new value of the uniform.
+

Since 1.4

+
+
+
+

cogl_program_set_uniform_float ()

+
void                cogl_program_set_uniform_float      (CoglHandle program,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const float *value);
+
+

Warning

+

cogl_program_set_uniform_float has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Changes the value of a float vector uniform, or uniform array for +the given linked program. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

program :

A CoglHandle for a linked program

uniform_location :

the uniform location retrieved from +cogl_program_get_uniform_location().

n_components :

The number of components for the uniform. For +example with glsl you'd use 3 for a vec3 or 4 for a vec4.

count :

For uniform arrays this is the array length otherwise just +pass 1

value :

the new value of the uniform[s]. [array length=count] +
+

Since 1.4

+
+
+
+

cogl_program_set_uniform_int ()

+
void                cogl_program_set_uniform_int        (CoglHandle program,
+                                                         int uniform_location,
+                                                         int n_components,
+                                                         int count,
+                                                         const int *value);
+
+

Warning

+

cogl_program_set_uniform_int has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Changes the value of a int vector uniform, or uniform array for +the given linked program. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

program :

A CoglHandle for a linked program

uniform_location :

the uniform location retrieved from +cogl_program_get_uniform_location().

n_components :

The number of components for the uniform. For +example with glsl you'd use 3 for a vec3 or 4 for a vec4.

count :

For uniform arrays this is the array length otherwise just +pass 1

value :

the new value of the uniform[s]. [array length=count] +
+

Since 1.4

+
+
+
+

cogl_program_set_uniform_matrix ()

+
void                cogl_program_set_uniform_matrix     (CoglHandle program,
+                                                         int uniform_location,
+                                                         int dimensions,
+                                                         int count,
+                                                         CoglBool transpose,
+                                                         const float *value);
+
+

Warning

+

cogl_program_set_uniform_matrix has been deprecated since version 1.16 and should not be used in newly-written code. Use CoglSnippet api instead

+
+

+Changes the value of a matrix uniform, or uniform array in the +given linked program. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

program :

A CoglHandle for a linked program

uniform_location :

the uniform location retrieved from +cogl_program_get_uniform_location().

dimensions :

The dimensions of the matrix. So for for example pass +2 for a 2x2 matrix or 3 for 3x3.

count :

For uniform arrays this is the array length otherwise just +pass 1

transpose :

Whether to transpose the matrix when setting the uniform.

value :

the new value of the uniform. [array length=count] +
+

Since 1.4

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Textures-(Deprecated).html b/doc/reference/cogl/html/cogl-Textures-(Deprecated).html new file mode 100644 index 0000000..1ca7788 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Textures-(Deprecated).html @@ -0,0 +1,104 @@ + + + + +Textures (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Textures (Deprecated)

+

Textures (Deprecated)

+
+
+

Synopsis

+
void *              cogl_texture_ref                    (void *texture);
+void                cogl_texture_unref                  (void *texture);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_texture_ref ()

+
void *              cogl_texture_ref                    (void *texture);
+
+

Warning

+

cogl_texture_ref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_ref() instead

+
+

+Increment the reference count for a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture.

Returns :

the texture pointer.
+
+
+
+

cogl_texture_unref ()

+
void                cogl_texture_unref                  (void *texture);
+
+

Warning

+

cogl_texture_unref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_unref() instead

+
+

+Decrement the reference count for a cogl texture. +

+
++++ + + + + +

texture :

a CoglTexture.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Textures.html b/doc/reference/cogl/html/cogl-Textures.html new file mode 100644 index 0000000..c54f657 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Textures.html @@ -0,0 +1,956 @@ + + + + +Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Textures

+

Textures — Functions for creating and manipulating textures

+
+
+

Synopsis

+
struct              CoglTextureVertex;
+enum                CoglTextureFlags;
+CoglTexture *       cogl_texture_new_with_size          (unsigned int width,
+                                                         unsigned int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+CoglTexture *       cogl_texture_new_from_file          (const char *filename,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format,
+                                                         CoglError **error);
+CoglTexture *       cogl_texture_new_from_data          (int width,
+                                                         int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         const uint8_t *data);
+CoglTexture *       cogl_texture_new_from_foreign       (unsigned int gl_handle,
+                                                         unsigned int gl_target,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         unsigned int x_pot_waste,
+                                                         unsigned int y_pot_waste,
+                                                         CoglPixelFormat format);
+CoglTexture *       cogl_texture_new_from_bitmap        (CoglBitmap *bitmap,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+CoglTexture *       cogl_texture_new_from_sub_texture   (CoglTexture *full_texture,
+                                                         int sub_x,
+                                                         int sub_y,
+                                                         int sub_width,
+                                                         int sub_height);
+CoglBool            cogl_is_texture                     (void *object);
+
+unsigned int        cogl_texture_get_width              (CoglTexture *texture);
+unsigned int        cogl_texture_get_height             (CoglTexture *texture);
+CoglPixelFormat     cogl_texture_get_format             (CoglTexture *texture);
+unsigned int        cogl_texture_get_rowstride          (CoglTexture *texture);
+int                 cogl_texture_get_max_waste          (CoglTexture *texture);
+CoglBool            cogl_texture_is_sliced              (CoglTexture *texture);
+CoglBool            cogl_texture_get_gl_texture         (CoglTexture *texture,
+                                                         unsigned int *out_gl_handle,
+                                                         unsigned int *out_gl_target);
+int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         uint8_t *data);
+CoglBool            cogl_texture_set_region             (CoglTexture *texture,
+                                                         int src_x,
+                                                         int src_y,
+                                                         int dst_x,
+                                                         int dst_y,
+                                                         unsigned int dst_width,
+                                                         unsigned int dst_height,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         const uint8_t *data);
+
+
+
+

Description

+

+Cogl allows creating and manipulating textures using a uniform +API that tries to hide all the various complexities of creating, +loading and manipulating textures. +

+
+
+

Details

+
+

struct CoglTextureVertex

+
struct CoglTextureVertex {
+  float x, y, z;
+  float tx, ty;
+
+  CoglColor color;
+};
+
+

+Used to specify vertex information when calling cogl_polygon() +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

float x;

Model x-coordinate

float y;

Model y-coordinate

float z;

Model z-coordinate

float tx;

Texture x-coordinate

float ty;

Texture y-coordinate

CoglColor color;

The color to use at this vertex. This is ignored if +use_color is FALSE when calling cogl_polygon() +
+
+
+
+

enum CoglTextureFlags

+
typedef enum {
+  COGL_TEXTURE_NONE           = 0,
+  COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
+  COGL_TEXTURE_NO_SLICING     = 1 << 1,
+  COGL_TEXTURE_NO_ATLAS       = 1 << 2
+} CoglTextureFlags;
+
+

+Flags to pass to the cogl_texture_new_* family of functions. +

+
++++ + + + + + + + + + + + + + + + + + + +

COGL_TEXTURE_NONE

No flags specified +

COGL_TEXTURE_NO_AUTO_MIPMAP

Disables the automatic generation of + the mipmap pyramid from the base level image whenever it is + updated. The mipmaps are only generated when the texture is + rendered with a mipmap filter so it should be free to leave out + this flag when using other filtering modes +

COGL_TEXTURE_NO_SLICING

Disables the slicing of the texture +

COGL_TEXTURE_NO_ATLAS

Disables the insertion of the texture inside + the texture atlas used by Cogl +
+

Since 1.0

+
+
+
+

cogl_texture_new_with_size ()

+
CoglTexture *       cogl_texture_new_with_size          (unsigned int width,
+                                                         unsigned int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+
+

Warning

+

cogl_texture_new_with_size has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_with_size()

+
+

+Creates a new CoglTexture with the specified dimensions and pixel format. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

width :

width of texture in pixels.

height :

height of texture in pixels.

flags :

Optional flags for the texture, or COGL_TEXTURE_NONE +

internal_format :

the CoglPixelFormat to use for the GPU storage of the +texture.

Returns :

A newly created CoglTexture or NULL on failure. [transfer full] +
+

Since 0.8

+
+
+
+

cogl_texture_new_from_file ()

+
CoglTexture *       cogl_texture_new_from_file          (const char *filename,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format,
+                                                         CoglError **error);
+
+

Warning

+

cogl_texture_new_from_file has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_from_file()

+
+

+Creates a CoglTexture from an image file. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

filename :

the file to load

flags :

Optional flags for the texture, or COGL_TEXTURE_NONE +

internal_format :

the CoglPixelFormat to use for the GPU storage of the +texture. If COGL_PIXEL_FORMAT_ANY is given then a premultiplied +format similar to the format of the source data will be used. The +default blending equations of Cogl expect premultiplied color data; +the main use of passing a non-premultiplied format here is if you +have non-premultiplied source data and are going to adjust the blend +mode (see cogl_material_set_blend()) or use the data for something +other than straight blending.

error :

return location for a CoglError or NULL +

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 0.8

+
+
+
+

cogl_texture_new_from_data ()

+
CoglTexture *       cogl_texture_new_from_data          (int width,
+                                                         int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         const uint8_t *data);
+
+

Warning

+

cogl_texture_new_from_data has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_from_data()

+
+

+Creates a new CoglTexture based on data residing in memory. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

width :

width of texture in pixels

height :

height of texture in pixels

flags :

Optional flags for the texture, or COGL_TEXTURE_NONE +

format :

the CoglPixelFormat the buffer is stored in in RAM

internal_format :

the CoglPixelFormat that will be used for storing +the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a +premultiplied format similar to the format of the source data will +be used. The default blending equations of Cogl expect premultiplied +color data; the main use of passing a non-premultiplied format here +is if you have non-premultiplied source data and are going to adjust +the blend mode (see cogl_material_set_blend()) or use the data for +something other than straight blending.

rowstride :

the memory offset in bytes between the starts of +scanlines in data +

data :

pointer the memory region where the source buffer resides

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 0.8

+
+
+
+

cogl_texture_new_from_foreign ()

+
CoglTexture *       cogl_texture_new_from_foreign       (unsigned int gl_handle,
+                                                         unsigned int gl_target,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         unsigned int x_pot_waste,
+                                                         unsigned int y_pot_waste,
+                                                         CoglPixelFormat format);
+
+

Warning

+

cogl_texture_new_from_foreign has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_from_foreign()

+
+

+Creates a CoglTexture based on an existing OpenGL texture; the +width, height and format are passed along since it is not always +possible to query these from OpenGL. +

+

+The waste arguments allow you to create a Cogl texture that maps to +a region smaller than the real OpenGL texture. For instance if your +hardware only supports power-of-two textures you may load a +non-power-of-two image into a larger power-of-two texture and use +the waste arguments to tell Cogl which region should be mapped to +the texture coordinate range [0:1]. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

gl_handle :

opengl handle of foreign texture.

gl_target :

opengl target type of foreign texture

width :

width of foreign texture

height :

height of foreign texture.

x_pot_waste :

horizontal waste on the right hand edge of the texture.

y_pot_waste :

vertical waste on the bottom edge of the texture.

format :

format of the foreign texture.

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 0.8

+
+
+
+

cogl_texture_new_from_bitmap ()

+
CoglTexture *       cogl_texture_new_from_bitmap        (CoglBitmap *bitmap,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format);
+
+

Warning

+

cogl_texture_new_from_bitmap has been deprecated since version 1.18 and should not be used in newly-written code. Use specific constructors such as + cogl_texture_2d_new_from_bitmap()

+
+

+Creates a CoglTexture from a CoglBitmap. +

+
++++ + + + + + + + + + + + + + + + + + + +

bitmap :

A CoglBitmap pointer

flags :

Optional flags for the texture, or COGL_TEXTURE_NONE +

internal_format :

the CoglPixelFormat to use for the GPU storage of the +texture

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 1.0

+
+
+
+

cogl_texture_new_from_sub_texture ()

+
CoglTexture *       cogl_texture_new_from_sub_texture   (CoglTexture *full_texture,
+                                                         int sub_x,
+                                                         int sub_y,
+                                                         int sub_width,
+                                                         int sub_height);
+
+

Warning

+

cogl_texture_new_from_sub_texture has been deprecated since version 1.18 and should not be used in newly-written code. Use cogl_sub_texture_new()

+
+

+Creates a new texture which represents a subregion of another +texture. The GL resources will be shared so that no new texture +data is actually allocated. +

+

+Sub textures have undefined behaviour texture coordinates outside +of the range [0,1] are used. They also do not work with +CoglVertexBuffers. +

+

+The sub texture will keep a reference to the full texture so you do +not need to keep one separately if you only want to use the sub +texture. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + +

full_texture :

a CoglTexture pointer

sub_x :

X coordinate of the top-left of the subregion

sub_y :

Y coordinate of the top-left of the subregion

sub_width :

Width in pixels of the subregion

sub_height :

Height in pixels of the subregion

Returns :

A newly created CoglTexture or +NULL on failure. [transfer full] +
+

Since 1.2

+
+
+
+

cogl_is_texture ()

+
CoglBool            cogl_is_texture                     (void *object);
+

+Gets whether the given object references a texture object. +

+
++++ + + + + + + + + + + +

object :

A CoglObject pointer

Returns :

+TRUE if the object references a texture, and +FALSE otherwise
+
+
+
+

cogl_texture_get_width ()

+
unsigned int        cogl_texture_get_width              (CoglTexture *texture);
+

+Queries the width of a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the width of the GPU side texture in pixels
+
+
+
+

cogl_texture_get_height ()

+
unsigned int        cogl_texture_get_height             (CoglTexture *texture);
+

+Queries the height of a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the height of the GPU side texture in pixels
+
+
+
+

cogl_texture_get_format ()

+
CoglPixelFormat     cogl_texture_get_format             (CoglTexture *texture);
+
+

Warning

+

cogl_texture_get_format has been deprecated since version 1.18 and should not be used in newly-written code. This api is misleading

+
+

+Queries the CoglPixelFormat of a cogl texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the CoglPixelFormat of the GPU side texture
+
+
+
+

cogl_texture_get_rowstride ()

+
unsigned int        cogl_texture_get_rowstride          (CoglTexture *texture);
+
+

Warning

+

cogl_texture_get_rowstride has been deprecated since version 1.10 and should not be used in newly-written code. There's no replacement for the API but there's + also no known need for API either. It was just + a mistake that it was ever published.

+
+

+Determines the bytes-per-pixel for the CoglPixelFormat retrieved +from cogl_texture_get_format() and multiplies that by the texture's +width. +

+

+

+
+

Note

It's very unlikely that anyone would need to use this API to +query the internal rowstride of a CoglTexture which can just be +considered an implementation detail. Actually it's not even useful +internally since underlying drivers are free to use a different +format
+

+

+

+

+
+

Note

This API is only here for backwards compatibility and +shouldn't be used in new code. In particular please don't be +mislead to pass the returned value to cogl_texture_get_data() for +the rowstride, since you should be passing the rowstride you desire +for your destination buffer not the rowstride of the source +texture.
+

+

+
++++ + + + + +

Returns :

The bytes-per-pixel for the current format +multiplied by the texture's width
+
+
+
+

cogl_texture_get_max_waste ()

+
int                 cogl_texture_get_max_waste          (CoglTexture *texture);
+

+Queries the maximum wasted (unused) pixels in one dimension of a GPU side +texture. +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

the maximum waste
+
+
+
+

cogl_texture_is_sliced ()

+
CoglBool            cogl_texture_is_sliced              (CoglTexture *texture);
+

+Queries if a texture is sliced (stored as multiple GPU side tecture +objects). +

+
++++ + + + + + + + + + + +

texture :

a CoglTexture pointer.

Returns :

+TRUE if the texture is sliced, FALSE if the texture +is stored as a single GPU texture
+
+
+
+

cogl_texture_get_gl_texture ()

+
CoglBool            cogl_texture_get_gl_texture         (CoglTexture *texture,
+                                                         unsigned int *out_gl_handle,
+                                                         unsigned int *out_gl_target);
+

+Queries the GL handles for a GPU side texture through its CoglTexture. +

+

+If the texture is spliced the data for the first sub texture will be +queried. +

+
++++ + + + + + + + + + + + + + + + + + + +

texture :

a CoglTexture pointer.

out_gl_handle :

pointer to return location for the +textures GL handle, or NULL. [out][allow-none] +

out_gl_target :

pointer to return location for the +GL target type, or NULL. [out][allow-none] +

Returns :

+TRUE if the handle was successfully retrieved, FALSE +if the handle was invalid
+
+
+
+

cogl_texture_get_data ()

+
int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         uint8_t *data);
+

+Copies the pixel data from a cogl texture to system memory. +

+

+

+
+

Note

Don't pass the value of cogl_texture_get_rowstride() as the +rowstride argument, the rowstride should be the rowstride you +want for the destination data buffer not the rowstride of the +source texture
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

texture :

a CoglTexture pointer.

format :

the CoglPixelFormat to store the texture as.

rowstride :

the rowstride of data in bytes or pass 0 to calculate +from the bytes-per-pixel of format multiplied by the +texture width.

data :

memory location to write the texture's contents, or NULL +to only query the data size through the return value.

Returns :

the size of the texture data in bytes
+
+
+
+

cogl_texture_set_region ()

+
CoglBool            cogl_texture_set_region             (CoglTexture *texture,
+                                                         int src_x,
+                                                         int src_y,
+                                                         int dst_x,
+                                                         int dst_y,
+                                                         unsigned int dst_width,
+                                                         unsigned int dst_height,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         const uint8_t *data);
+

+Sets the pixels in a rectangular subregion of texture from an in-memory +buffer containing pixel data. +

+

+

+
+

Note

The region set can't be larger than the source data +
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

texture :

a CoglTexture.

src_x :

upper left coordinate to use from source data.

src_y :

upper left coordinate to use from source data.

dst_x :

upper left destination horizontal coordinate.

dst_y :

upper left destination vertical coordinate.

dst_width :

width of destination region to write. (Must be less +than or equal to width)

dst_height :

height of destination region to write. (Must be less +than or equal to height)

width :

width of source data buffer.

height :

height of source data buffer.

format :

the CoglPixelFormat used in the source buffer.

rowstride :

rowstride of source buffer (computed from width if none +specified)

data :

the actual pixel data.

Returns :

+TRUE if the subregion upload was successful, and +FALSE otherwise
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Vectors.html b/doc/reference/cogl/html/cogl-Vectors.html new file mode 100644 index 0000000..c7c06d4 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vectors.html @@ -0,0 +1,798 @@ + + + + +Vectors + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Vectors

+

Vectors — Functions for handling single precision float + vectors.

+
+
+

Synopsis

+
void                cogl_vector3_init                   (float *vector,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+void                cogl_vector3_init_zero              (float *vector);
+CoglBool            cogl_vector3_equal                  (const void *v1,
+                                                         const void *v2);
+CoglBool            cogl_vector3_equal_with_epsilon     (const float *vector0,
+                                                         const float *vector1,
+                                                         float epsilon);
+float *             cogl_vector3_copy                   (const float *vector);
+void                cogl_vector3_free                   (float *vector);
+void                cogl_vector3_invert                 (float *vector);
+void                cogl_vector3_add                    (float *result,
+                                                         const float *a,
+                                                         const float *b);
+void                cogl_vector3_subtract               (float *result,
+                                                         const float *a,
+                                                         const float *b);
+void                cogl_vector3_multiply_scalar        (float *vector,
+                                                         float scalar);
+void                cogl_vector3_divide_scalar          (float *vector,
+                                                         float scalar);
+void                cogl_vector3_normalize              (float *vector);
+float               cogl_vector3_magnitude              (const float *vector);
+void                cogl_vector3_cross_product          (float *result,
+                                                         const float *u,
+                                                         const float *v);
+float               cogl_vector3_dot_product            (const float *a,
+                                                         const float *b);
+float               cogl_vector3_distance               (const float *a,
+                                                         const float *b);
+
+
+
+

Description

+

+This exposes a utility API that can be used for basic manipulation of 3 +component float vectors. +

+
+
+

Details

+
+

cogl_vector3_init ()

+
void                cogl_vector3_init                   (float *vector,
+                                                         float x,
+                                                         float y,
+                                                         float z);
+

+Initializes a 3 component, single precision float vector which can +then be manipulated with the cogl_vector convenience APIs. Vectors +can also be used in places where a "point" is often desired. +

+
++++ + + + + + + + + + + + + + + + + + + +

vector :

The 3 component vector you want to initialize

x :

The x component

y :

The y component

z :

The z component
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_init_zero ()

+
void                cogl_vector3_init_zero              (float *vector);
+

+Initializes a 3 component, single precision float vector with zero +for each component. +

+
++++ + + + + +

vector :

The 3 component vector you want to initialize
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_equal ()

+
CoglBool            cogl_vector3_equal                  (const void *v1,
+                                                         const void *v2);
+

+Compares the components of two vectors and returns TRUE if they are +the same. +

+

+The comparison of the components is done with the '==' operator +such that -0 is considered equal to 0, but otherwise there is no +fuzziness such as an epsilon to consider vectors that are +essentially identical except for some minor precision error +differences due to the way they have been manipulated. +

+
++++ + + + + + + + + + + + + + + +

v1 :

The first 3 component vector you want to compare

v2 :

The second 3 component vector you want to compare

Returns :

TRUE if the vectors are equal else FALSE.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_equal_with_epsilon ()

+
CoglBool            cogl_vector3_equal_with_epsilon     (const float *vector0,
+                                                         const float *vector1,
+                                                         float epsilon);
+

+Compares the components of two vectors using the given epsilon and +returns TRUE if they are the same, using an internal epsilon for +comparing the floats. +

+

+Each component is compared against the epsilon value in this way: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25

+
+
+
+
+
+
+
+
+
+
+
+
+if (fabsf (vector0->x - vector1->x) < epsilon)
+
+ +

+

+
++++ + + + + + + + + + + + + + + + + + + +

vector0 :

The first 3 component vector you want to compare

vector1 :

The second 3 component vector you want to compare

epsilon :

The allowable difference between components to still be +considered equal

Returns :

TRUE if the vectors are equal else FALSE.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_copy ()

+
float *             cogl_vector3_copy                   (const float *vector);
+

+Allocates a new 3 component float vector on the heap initializing +the components from the given vector and returns a pointer to the +newly allocated vector. You should free the memory using +cogl_vector3_free() +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to copy

Returns :

A newly allocated 3 component float vector
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_free ()

+
void                cogl_vector3_free                   (float *vector);
+

+Frees a 3 component vector that was previously allocated with +cogl_vector3_copy() +

+
++++ + + + + +

vector :

The 3 component you want to free
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_invert ()

+
void                cogl_vector3_invert                 (float *vector);
+

+Inverts/negates all the components of the given vector. +

+
++++ + + + + +

vector :

The 3 component vector you want to manipulate
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_add ()

+
void                cogl_vector3_add                    (float *result,
+                                                         const float *a,
+                                                         const float *b);
+

+Adds each of the corresponding components in vectors a and b +storing the results in result. +

+
++++ + + + + + + + + + + + + + + +

result :

Where you want the result written

a :

The first vector operand

b :

The second vector operand
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_subtract ()

+
void                cogl_vector3_subtract               (float *result,
+                                                         const float *a,
+                                                         const float *b);
+

+Subtracts each of the corresponding components in vector b from +a storing the results in result. +

+
++++ + + + + + + + + + + + + + + +

result :

Where you want the result written

a :

The first vector operand

b :

The second vector operand
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_multiply_scalar ()

+
void                cogl_vector3_multiply_scalar        (float *vector,
+                                                         float scalar);
+

+Multiplies each of the vector components by the given scalar. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to manipulate

scalar :

The scalar you want to multiply the vector components by
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_divide_scalar ()

+
void                cogl_vector3_divide_scalar          (float *vector,
+                                                         float scalar);
+

+Divides each of the vector components by the given scalar. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want to manipulate

scalar :

The scalar you want to divide the vector components by
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_normalize ()

+
void                cogl_vector3_normalize              (float *vector);
+

+Updates the vector so it is a "unit vector" such that the +vectors magnitude or length is equal to 1. +

+

+

+
+

Note

It's safe to use this function with the [0, 0, 0] vector, it will not +try to divide components by 0 (its norm) and will leave the vector +untouched.
+

+

+
++++ + + + + +

vector :

The 3 component vector you want to manipulate
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_magnitude ()

+
float               cogl_vector3_magnitude              (const float *vector);
+

+Calculates the scalar magnitude or length of vector. +

+
++++ + + + + + + + + + + +

vector :

The 3 component vector you want the magnitude for

Returns :

The magnitude of vector.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_cross_product ()

+
void                cogl_vector3_cross_product          (float *result,
+                                                         const float *u,
+                                                         const float *v);
+

+Calculates the cross product between the two vectors u and v. +

+

+The cross product is a vector perpendicular to both u and v. This +can be useful for calculating the normal of a polygon by creating +two vectors in its plane using the polygons vertices and taking +their cross product. +

+

+If the two vectors are parallel then the cross product is 0. +

+

+You can use a right hand rule to determine which direction the +perpendicular vector will point: If you place the two vectors tail, +to tail and imagine grabbing the perpendicular line that extends +through the common tail with your right hand such that you fingers +rotate in the direction from u to v then the resulting vector +points along your extended thumb. +

+
++++ + + + + + + + + + + + + + + + + + + +

result :

Where you want the result written

u :

Your first 3 component vector

v :

Your second 3 component vector

Returns :

The cross product between two vectors u and v.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_dot_product ()

+
float               cogl_vector3_dot_product            (const float *a,
+                                                         const float *b);
+

+Calculates the dot product of the two 3 component vectors. This +can be used to determine the magnitude of one vector projected onto +another. (for example a surface normal) +

+

+For example if you have a polygon with a given normal vector and +some other point for which you want to calculate its distance from +the polygon, you can create a vector between one of the polygon +vertices and that point and use the dot product to calculate the +magnitude for that vector but projected onto the normal of the +polygon. This way you don't just get the distance from the point to +the edge of the polygon you get the distance from the point to the +nearest part of the polygon. +

+

+

+
+

Note

If you don't use a unit length normal in the above example +then you would then also have to divide the result by the magnitude +of the normal
+

+

+

+The dot product is calculated as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+(a->x * b->x + a->y * b->y + a->z * b->z)
+
+ +

+

+

+For reference, the dot product can also be calculated from the +angle between two vectors as: +

+
+ + + + + + + +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24

+
+
+
+
+
+
+
+
+
+
+
+
+|a||b|cos𝜃
+
+ +

+

+
++++ + + + + + + + + + + + + + + +

a :

Your first 3 component vector

b :

Your second 3 component vector

Returns :

The dot product of two vectors.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_vector3_distance ()

+
float               cogl_vector3_distance               (const float *a,
+                                                         const float *b);
+

+If you consider the two given vectors as (x,y,z) points instead +then this will compute the distance between those two points. +

+
++++ + + + + + + + + + + + + + + +

a :

The first point

b :

The second point

Returns :

The distance between two points given as 3 component +vectors.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Vertex-Buffers-(Deprecated).html b/doc/reference/cogl/html/cogl-Vertex-Buffers-(Deprecated).html new file mode 100644 index 0000000..3ff71b3 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vertex-Buffers-(Deprecated).html @@ -0,0 +1,104 @@ + + + + +Vertex Buffers (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Vertex Buffers (Deprecated)

+

Vertex Buffers (Deprecated)

+
+ +
+

Description

+
+
+

Details

+
+

cogl_vertex_buffer_ref ()

+
CoglHandle          cogl_vertex_buffer_ref              (CoglHandle handle);
+
+

Warning

+

cogl_vertex_buffer_ref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_ref() instead

+
+

+Increment the reference count for a vertex buffer +

+
++++ + + + + + + + + + + +

handle :

a CoglHandle.

Returns :

the handle.
+
+
+
+

cogl_vertex_buffer_unref ()

+
void                cogl_vertex_buffer_unref            (CoglHandle handle);
+
+

Warning

+

cogl_vertex_buffer_unref has been deprecated since version 1.2 and should not be used in newly-written code. Use cogl_object_unref() instead

+
+

+Decrement the reference count for a vertex buffer +

+
++++ + + + + +

handle :

a CoglHandle.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl-Vertex-Buffers.html b/doc/reference/cogl/html/cogl-Vertex-Buffers.html new file mode 100644 index 0000000..be564f7 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vertex-Buffers.html @@ -0,0 +1,821 @@ + + + + +Vertex Buffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Vertex Buffers

+

Vertex Buffers — An API for submitting extensible arrays of vertex + attributes to be mapped into the GPU for fast drawing.

+
+
+

Synopsis

+
CoglHandle          cogl_vertex_buffer_new              (unsigned int n_vertices);
+unsigned int        cogl_vertex_buffer_get_n_vertices   (CoglHandle handle);
+void                cogl_vertex_buffer_add              (CoglHandle handle,
+                                                         const char *attribute_name,
+                                                         uint8_t n_components,
+                                                         CoglAttributeType type,
+                                                         CoglBool normalized,
+                                                         uint16_t stride,
+                                                         const void *pointer);
+void                cogl_vertex_buffer_delete           (CoglHandle handle,
+                                                         const char *attribute_name);
+void                cogl_vertex_buffer_submit           (CoglHandle handle);
+void                cogl_vertex_buffer_disable          (CoglHandle handle,
+                                                         const char *attribute_name);
+void                cogl_vertex_buffer_enable           (CoglHandle handle,
+                                                         const char *attribute_name);
+enum                CoglVerticesMode;
+void                cogl_vertex_buffer_draw             (CoglHandle handle,
+                                                         CoglVerticesMode mode,
+                                                         int first,
+                                                         int count);
+CoglBool            cogl_is_vertex_buffer               (CoglHandle handle);
+
+enum                CoglIndicesType;
+CoglHandle          cogl_vertex_buffer_indices_new      (CoglIndicesType indices_type,
+                                                         const void *indices_array,
+                                                         int indices_len);
+void                cogl_vertex_buffer_draw_elements    (CoglHandle handle,
+                                                         CoglVerticesMode mode,
+                                                         CoglHandle indices,
+                                                         int min_index,
+                                                         int max_index,
+                                                         int indices_offset,
+                                                         int count);
+CoglHandle          cogl_vertex_buffer_indices_get_for_quads
+                                                        (unsigned int n_indices);
+CoglBool            cogl_is_vertex_buffer_indices       (CoglHandle handle);
+
+
+
+

Description

+

+For example to describe a textured triangle, you could create a new cogl +vertex buffer with 3 vertices, and then you might add 2 attributes for each +vertex: +

+
    +
  1. +a "gl_Position" describing the (x,y,z) position for each vertex. +
  2. +
  3. +a "gl_MultiTexCoord0" describing the (tx,ty) texture coordinates for each +vertex. +
  4. +
+

+

+

+The Vertex Buffer API is designed to be a fairly raw mechanism for +developers to be able to submit geometry to Cogl in a format that can be +directly consumed by an OpenGL driver and mapped into your GPU for fast +re-use. It is designed to avoid repeated validation of the attributes by the +driver; to minimize transport costs (e.g. considering indirect GLX +use-cases) and to potentially avoid repeated format conversions when +attributes are supplied in a format that is not natively supported by the +GPU. +

+

+Although this API does allow you to modify attributes after they have been +submitted to the GPU you should be aware that modification is not that +cheap, since it implies validating the new data and potentially the +OpenGL driver will need to reformat it for the GPU. +

+

+If at all possible think of tricks that let you re-use static attributes, +and if you do need to repeatedly update attributes (e.g. for some kind of +morphing geometry) then only update and re-submit the specific attributes +that have changed. +

+
+
+

Details

+
+

cogl_vertex_buffer_new ()

+
CoglHandle          cogl_vertex_buffer_new              (unsigned int n_vertices);
+
+

Warning

+

cogl_vertex_buffer_new has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Creates a new vertex buffer that you can use to add attributes. +

+
++++ + + + + + + + + + + +

n_vertices :

The number of vertices that your attributes will correspond to.

Returns :

a new CoglHandle +
+
+
+
+

cogl_vertex_buffer_get_n_vertices ()

+
unsigned int        cogl_vertex_buffer_get_n_vertices   (CoglHandle handle);
+
+

Warning

+

cogl_vertex_buffer_get_n_vertices has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Retrieves the number of vertices that handle represents +

+
++++ + + + + + + + + + + +

handle :

A vertex buffer handle

Returns :

the number of vertices
+
+
+
+

cogl_vertex_buffer_add ()

+
void                cogl_vertex_buffer_add              (CoglHandle handle,
+                                                         const char *attribute_name,
+                                                         uint8_t n_components,
+                                                         CoglAttributeType type,
+                                                         CoglBool normalized,
+                                                         uint16_t stride,
+                                                         const void *pointer);
+
+

Warning

+

cogl_vertex_buffer_add has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Adds an attribute to a buffer, or replaces a previously added +attribute with the same name. +

+

+You either can use one of the built-in names such as "gl_Vertex", or +"gl_MultiTexCoord0" to add standard attributes, like positions, colors +and normals, or you can add custom attributes for use in shaders. +

+

+The number of vertices declared when calling cogl_vertex_buffer_new() +determines how many attribute values will be read from the supplied +pointer. +

+

+The data for your attribute isn't copied anywhere until you call +cogl_vertex_buffer_submit(), or issue a draw call which automatically +submits pending attribute changes. so the supplied pointer must remain +valid until then. If you are updating an existing attribute (done by +re-adding it) then you still need to re-call cogl_vertex_buffer_submit() +to commit the changes to the GPU. Be carefull to minimize the number +of calls to cogl_vertex_buffer_submit(), though. +

+

+

+
+

Note

If you are interleving attributes it is assumed that each interleaved +attribute starts no farther than +- stride bytes from the other attributes +it is interleved with. I.e. this is ok: +
+|-0-0-0-0-0-0-0-0-0-0|
+
+This is not ok: +
+|- - - - -0-0-0-0-0-0 0 0 0 0|
+
+(Though you can have multiple groups of interleved attributes)
+

+

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

handle :

A vertex buffer handle

attribute_name :

The name of your attribute. It should be a valid GLSL +variable name and standard attribute types must use one of following +built-in names: (Note: they correspond to the built-in names of GLSL) +
    +
  • "gl_Color"
  • +
  • "gl_Normal"
  • +
  • "gl_MultiTexCoord0, gl_MultiTexCoord1, ..."
  • +
  • "gl_Vertex"
  • +
+To support adding multiple variations of the same attribute the name +can have a detail component, E.g. "gl_Color::active" or +"gl_Color::inactive"

n_components :

The number of components per attribute and must be 1, 2, +3 or 4

type :

a CoglAttributeType specifying the data type of each component.

normalized :

If TRUE, this specifies that values stored in an integer +format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0] +for unsigned values. If FALSE they are converted to floats +directly.

stride :

This specifies the number of bytes from the start of one attribute +value to the start of the next value (for the same attribute). So, for +example, with a position interleved with color like this: +XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the +stride for both attributes is 6. The special value 0 means the +values are stored sequentially in memory.

pointer :

This addresses the first attribute in the vertex array. This +must remain valid until you either call cogl_vertex_buffer_submit() or +issue a draw call.
+
+
+
+

cogl_vertex_buffer_delete ()

+
void                cogl_vertex_buffer_delete           (CoglHandle handle,
+                                                         const char *attribute_name);
+
+

Warning

+

cogl_vertex_buffer_delete has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Deletes an attribute from a buffer. You will need to call +cogl_vertex_buffer_submit() or issue a draw call to commit this +change to the GPU. +

+
++++ + + + + + + + + + + +

handle :

A vertex buffer handle

attribute_name :

The name of a previously added attribute
+
+
+
+

cogl_vertex_buffer_submit ()

+
void                cogl_vertex_buffer_submit           (CoglHandle handle);
+
+

Warning

+

cogl_vertex_buffer_submit has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Submits all the user added attributes to the GPU; once submitted, the +attributes can be used for drawing. +

+

+You should aim to minimize calls to this function since it implies +validating your data; it potentially incurs a transport cost (especially if +you are using GLX indirect rendering) and potentially a format conversion +cost if the GPU doesn't natively support any of the given attribute formats. +

+
++++ + + + + +

handle :

A vertex buffer handle
+
+
+
+

cogl_vertex_buffer_disable ()

+
void                cogl_vertex_buffer_disable          (CoglHandle handle,
+                                                         const char *attribute_name);
+
+

Warning

+

cogl_vertex_buffer_disable has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Disables a previosuly added attribute. +

+

+Since it can be costly to add and remove new attributes to buffers; to make +individual buffers more reuseable it is possible to enable and disable +attributes before using a buffer for drawing. +

+

+You don't need to call cogl_vertex_buffer_submit() after using this +function. +

+
++++ + + + + + + + + + + +

handle :

A vertex buffer handle

attribute_name :

The name of the attribute you want to disable
+
+
+
+

cogl_vertex_buffer_enable ()

+
void                cogl_vertex_buffer_enable           (CoglHandle handle,
+                                                         const char *attribute_name);
+
+

Warning

+

cogl_vertex_buffer_enable has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Enables a previosuly disabled attribute. +

+

+Since it can be costly to add and remove new attributes to buffers; to make +individual buffers more reuseable it is possible to enable and disable +attributes before using a buffer for drawing. +

+

+You don't need to call cogl_vertex_buffer_submit() after using this function +

+
++++ + + + + + + + + + + +

handle :

A vertex buffer handle

attribute_name :

The name of the attribute you want to enable
+
+
+
+

enum CoglVerticesMode

+
typedef enum {
+  COGL_VERTICES_MODE_POINTS = 0x0000,
+  COGL_VERTICES_MODE_LINES = 0x0001,
+  COGL_VERTICES_MODE_LINE_LOOP = 0x0002,
+  COGL_VERTICES_MODE_LINE_STRIP = 0x0003,
+  COGL_VERTICES_MODE_TRIANGLES = 0x0004,
+  COGL_VERTICES_MODE_TRIANGLE_STRIP = 0x0005,
+  COGL_VERTICES_MODE_TRIANGLE_FAN = 0x0006
+} CoglVerticesMode;
+
+

+Different ways of interpreting vertices when drawing. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

COGL_VERTICES_MODE_POINTS

FIXME, equivalent to +GL_POINTS +

COGL_VERTICES_MODE_LINES

FIXME, equivalent to GL_LINES +

COGL_VERTICES_MODE_LINE_LOOP

FIXME, equivalent to +GL_LINE_LOOP +

COGL_VERTICES_MODE_LINE_STRIP

FIXME, equivalent to +GL_LINE_STRIP +

COGL_VERTICES_MODE_TRIANGLES

FIXME, equivalent to +GL_TRIANGLES +

COGL_VERTICES_MODE_TRIANGLE_STRIP

FIXME, equivalent to +GL_TRIANGLE_STRIP +

COGL_VERTICES_MODE_TRIANGLE_FAN

FIXME, equivalent to GL_TRIANGLE_FAN +
+

Since 1.0

+
+
+
+

cogl_vertex_buffer_draw ()

+
void                cogl_vertex_buffer_draw             (CoglHandle handle,
+                                                         CoglVerticesMode mode,
+                                                         int first,
+                                                         int count);
+
+

Warning

+

cogl_vertex_buffer_draw has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Allows you to draw geometry using all or a subset of the +vertices in a vertex buffer. +

+

+Any un-submitted attribute changes are automatically submitted before +drawing. +

+
++++ + + + + + + + + + + + + + + + + + + +

handle :

A vertex buffer handle

mode :

A CoglVerticesMode specifying how the vertices should be +interpreted.

first :

Specifies the index of the first vertex you want to draw with

count :

Specifies the number of vertices you want to draw.
+
+
+
+

cogl_is_vertex_buffer ()

+
CoglBool            cogl_is_vertex_buffer               (CoglHandle handle);
+
+

Warning

+

cogl_is_vertex_buffer has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Checks whether handle is a Vertex Buffer Object +

+
++++ + + + + + + + + + + +

handle :

a CoglHandle for a vertex buffer object

Returns :

+TRUE if the handle is a VBO, and FALSE +otherwise
+

Since 1.0

+
+
+
+

enum CoglIndicesType

+
typedef enum {
+  COGL_INDICES_TYPE_UNSIGNED_BYTE,
+  COGL_INDICES_TYPE_UNSIGNED_SHORT,
+  COGL_INDICES_TYPE_UNSIGNED_INT
+} CoglIndicesType;
+
+

+You should aim to use the smallest data type that gives you enough +range, since it reduces the size of your index array and can help +reduce the demand on memory bandwidth. +

+

+Note that COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the +COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This +should always be available on OpenGL but on OpenGL ES it will only +be available if the GL_OES_element_index_uint extension is +advertized. +

+
++++ + + + + + + + + + + + + + + +

COGL_INDICES_TYPE_UNSIGNED_BYTE

Your indices are unsigned bytes +

COGL_INDICES_TYPE_UNSIGNED_SHORT

Your indices are unsigned shorts +

COGL_INDICES_TYPE_UNSIGNED_INT

Your indices are unsigned ints +
+
+
+
+

cogl_vertex_buffer_indices_new ()

+
CoglHandle          cogl_vertex_buffer_indices_new      (CoglIndicesType indices_type,
+                                                         const void *indices_array,
+                                                         int indices_len);
+
+

Warning

+

cogl_vertex_buffer_indices_new has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Depending on how much geometry you are submitting it can be worthwhile +optimizing the number of redundant vertices you submit. Using an index +array allows you to reference vertices multiple times, for example +during triangle strips. +

+
++++ + + + + + + + + + + + + + + + + + + +

indices_type :

a CoglIndicesType specifying the data type used for +the indices.

indices_array :

Specifies the address of +your array of indices. [array length=indices_len] +

indices_len :

The number of indices in indices_array

Returns :

A CoglHandle for the indices which you can pass to +cogl_vertex_buffer_draw_elements().
+
+
+
+

cogl_vertex_buffer_draw_elements ()

+
void                cogl_vertex_buffer_draw_elements    (CoglHandle handle,
+                                                         CoglVerticesMode mode,
+                                                         CoglHandle indices,
+                                                         int min_index,
+                                                         int max_index,
+                                                         int indices_offset,
+                                                         int count);
+
+

Warning

+

cogl_vertex_buffer_draw_elements has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+This function lets you use an array of indices to specify the vertices +within your vertex buffer that you want to draw. The indices themselves +are created by calling cogl_vertex_buffer_indices_new() +

+

+Any un-submitted attribute changes are automatically submitted before +drawing. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

handle :

A vertex buffer handle

mode :

A CoglVerticesMode specifying how the vertices should be +interpreted.

indices :

A CoglHandle for a set of indices allocated via +cogl_vertex_buffer_indices_new() +

min_index :

Specifies the minimum vertex index contained in indices

max_index :

Specifies the maximum vertex index contained in indices

indices_offset :

An offset into named indices. The offset marks the first +index to use for drawing.

count :

Specifies the number of vertices you want to draw.
+
+
+
+

cogl_vertex_buffer_indices_get_for_quads ()

+
CoglHandle          cogl_vertex_buffer_indices_get_for_quads
+                                                        (unsigned int n_indices);
+
+

Warning

+

cogl_vertex_buffer_indices_get_for_quads has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Creates a vertex buffer containing the indices needed to draw pairs +of triangles from a list of vertices grouped as quads. There will +be at least n_indices entries in the buffer (but there may be +more). +

+

+The indices will follow this pattern: +

+

+0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc +

+

+For example, if you submit vertices for a quad like like that shown +in Figure 2, “Example of vertices submitted to form a quad” then you can request 6 +indices to render two triangles like those shown in Figure 3, “Illustration of the triangle indices that will be generated”. +

+

+

+
+

Figure 2. Example of vertices submitted to form a quad

+
Example of vertices submitted to form a quad
+
+


+

+

+

+
+

Figure 3. Illustration of the triangle indices that will be generated

+
Illustration of the triangle indices that will be generated
+
+


+

+
++++ + + + + + + + + + + +

n_indices :

the number of indices in the vertex buffer.

Returns :

A CoglHandle containing the indices. The handled is +owned by Cogl and should not be modified or unref'd.
+
+
+
+

cogl_is_vertex_buffer_indices ()

+
CoglBool            cogl_is_vertex_buffer_indices       (CoglHandle handle);
+
+

Warning

+

cogl_is_vertex_buffer_indices has been deprecated since version 1.16 and should not be used in newly-written code. Use the CoglPrimitive api instead

+
+

+Checks whether handle is a handle to the indices for a vertex +buffer object +

+
++++ + + + + + + + + + + +

handle :

a CoglHandle +

Returns :

+TRUE if the handle is indices, and FALSE +otherwise
+

Since 1.4

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/cogl.devhelp2 b/doc/reference/cogl/html/cogl.devhelp2 new file mode 100644 index 0000000..16b0ae8 --- /dev/null +++ b/doc/reference/cogl/html/cogl.devhelp2 @@ -0,0 +1,561 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl/html/cogl_ortho.png b/doc/reference/cogl/html/cogl_ortho.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2a1fd20be98e26e1ef6f3eb2bc664970f5fc62 GIT binary patch literal 12650 zcmb_@cRbbq`}g}CP6p2^64 z`FzLk`+5An_x;y>9uJkH^Ios(^}L?r5~Oll?kqkvK7t@;735{r5Co+SUm|#DcqjM$ zwi*0|a#oX*LGr)RF2FZu9OQMK5#-#xlP^@3ROSPC^YlZ7TQ^P*W2jN0JPyyvrV)ez zQIM6^a2sAp^3W$8C~Fa7oI2{mx*Ld~OWp9P<{R72OKHk$kS(ivmRWibl|8-@QtF$z zc>a7y)-Nr+g9!9p4Hdfcxmam3D{24I8FFdPE7F1TgaO2USQ)3|Sm&))Htf%)US6j(@b5nrO~2ql7K!KJ0bjrgA29w&VL&l{8V_4P;vITEGl z<5PDx7ptd7Gs=Rfa3&=sUB7;PF&BL&MKUk}7g02GbK7f;WP^8BR#qG$5$uq-$FA}% zP2ctzk|5cN>qx4`*RNkiMMe8GFv(Irb`}<=h0Y*R!C_%%6FRhv$lX>-2PRojzG~eA z1C&9sRypV^hSeVm3;p2WZKqmd5#e0qS!0}tGwUcLq9SNgsB=pb%Ru~6p5^4&Rh+!y z;)La=5&m2`-z_}}+MNf9{DOkxwO%9j^}dSfqQb)18RQ`@Gjm#Pt)#lTdZ{%*mT)j* z((Q9ZMBm!lL?6z-Oi3|PP&lJOgq8bHQu5QOa&eGZ#Y``?uC6XCYyQvCfsp+;*X7I1 zk*yxP%c@@Yaghwn<;%INt9AzTly3Xm50sTdD=S50zI1nQ6n9GAFCLPRkWi6A4C+69 zLKl=F=Z(&E_4caAQI5M!pB);DCc@D}97KMDg+Q5j{(DvGp4tH`H(DWR=s@ z{QivITb=o+(! zINcJS5Emy6_bP{Z?BVhKHfGQBPe~Tm$!T+QrhTp>;j{owm!zVSQsk>w@bli@UZZL^ zMhQC;6Ex>KeNj=-7t?FeiqXT!&Z#a|3N9Uoqy3%DO(!KKrJ?l4H*el_yFvfiS$}e- zJ?8f9+c^)r;2%B*E9E;&12Hi%N-VGX`}b2KOM7^DV6na-Aq2v* z)1xv>5ijVaYTdVHH#avUjsx?{F+2tzw`XFE%q=XQ1)RL{45|dLUF(^cpwFowd!s@{ zP2D!*goA@~j#k)Vy7}yS(9Mb)JVo>Vr_ae;zkVl4^pY#JU9U6Cp5tO)_S2`Q&ZG)@ zZgmLJd#4jZiIZ)t5-!1Q!+LK?d=4NQE_o+>{Ol0^=myV-@cXkSYsP{}8(EclpFVxEvbNUc(vp$+ zg8NjH@Awwz`*?x4q`lFnI17F50#j1*7C{Hm-KhY ziGyT&zRSY7bi$Pmx}siM4Js=R$(N%2j6Y_$`Rhgb!3)dqQoZDX7HY__E%XAPR=)n3 zj?D+Sdd?hTBY9O-2{Lbd^-7w#Pn|mD<>jTWjS`nT&G_lr-Kp8x*~P`XMn+e>ew3D% z_geBhg!ET5b#)QPkWIPe_y#wIp$b^8T`NjWMXIheH8t_@@N{9-eac}SP5f}+ft9FW zsHv$1Z3gR23ds^1r#D_jM*dnEc~)?*?r^ic|GgeLWmtphweX8#WscL$^xk{Yy^pxr z+2_}Mjy*Iq`hIWCT`~9=6(5hU%kq7KTZ6MSJ3HuR+QQOO?oG^kqF9CZ(c>mI-ng&6 zzP|naT9~=0*ROeWi%h@gXx>la6&4m&ZH!MyI7cTwKRLO+w{gG8LQ7lwSzw?7%PYNd zI}uUQ@e0TLBu&{gP&{E_VJ3xC=4Y*f_1wghRoFde9&BuE{8}ATFR1h{NNk*3Sb$2t zwGa@dy0NvTe&{syvo(@b;A>Np*+NhHv# z6B9>N@#xvpr%wq92~EQvy1H7Jn@hTHn!*Nsc8=b#(rL!$Xuu~uJ-w;9`CGgIffySf zUu2WXnZQqf{`{#sTCsop_;GD*?Vy~E;K7#&=8lezk#hT%j60d{-qA{W#wxSQ$;llY z9NaO}*Jg@%mzgOfAn?7v|67Wb58QBRY3YLp4*=P3+_=F-ahaF*LwY)<;0J+~l~_o`#KhRx*iQLR{rvfGYqsO);MaY&!@cQncXxN~e0^y= z+wp1il-r+Xc4v|PAwp~_`tb8D;k!-v?epNdViB2J%2M#NZI zXJO?-D6h;qRT}vm2?WaAGh;0EyAA7oodL*Tg2_Vvwr#VW!IJA zz@6IFiMo`iC>9Au35lbcU*nBsG2D7u`uf!mdRc8KV&dY4D2+V*Y~kzzf`TTC45w2% zuW)l;Y-c%r`n0|MT13l`jUY4$Lc+YfJXyTT%1SdcGpK6mLlbNzFB=*fq>c~O{WQ~Zu$r3DZ{FN9 zGNLb|Atw(sF2YHTF0cGu8WdNyEx4x*w>19Z+*CI?BnI>Y3Osbla<9TnNsI4^(j6+9v(ny zDnr0a74|3rx1J`HFFpfF(BgLr*!Zt#DA_qUV8N7G`M9}nv5)|AWTvMx2JjeGe=#pU zFSEP5%fZ31R(Jg835H;{BVlfJ_0O2=MD**|uVZ3_`1$oKozjbo`2+;W86VEHMepvq z@JF;p7k$vl3k@X<=&E#{17d-P`)R1y;^M`Nb^D9CH$o`POig8FWgUbQ-@Rj@2#JRN zl#&uY_~R{pwI=d{1QVAlRxS4U@icbABe5I#rBcH7j# z;xdt5|Hz0nJdvHC36sLT?ld_Tl2+Kjm?jjmdbqz-aDrO_-VfVW&MQCEpWIy;fdbK4 zMWDMs*qVwCN#6+Gy3Rm6`z`69t(TuEk2p1fii#?0%+v1-X6k&9EIB#3UYX6tuV3Y5 zWwRS@gFMwGrxEgS0_Bl}PXJ;+e*DPQF8H%MVh?*C_EJb#SfHB@!u!S%^+qM@CMWM= z9%GX+&W^(slyQ$ON`IW}$L|-&sU8%T)C1S;8+A|AWHqq5)VwmJ`Zf-7Yx(@72oJK* z+V`@#xfvjUhKfohTLa47;klqR192)hQjHc(qNAlvjE;UZ-^C~;Rrl%@$@-aXJS^tn zbHI|fZ{HsLTAQeLFV4#&)blwLl7YoUWuYT=)bZG(p+7Z${%owyOMCI6)WI^JV8U2$ zFHW)_onKKihE>#+SVd5WlZS)P;#)~sSy@pLy3#6Q_E2TSk&iOZdX>CPmTgKr}UhDE7iM;3LMzv{}#a&of z*b+|P@y8Jo zAhDx{dOnq#Y-(l}(Q3*W9lWyn+jBk0d}?7qA+r~F^0UT>gkLupi2L&8c)4v+g*u5T zDS#<`Jw0fFn=jg9uJBP2iiuSLO*-Z82*AHJ*XggvpF8|DSz_edw|uytqN2?t*YOB- zlzwup+b*7l6b}O#KJe#CeLG|0N!X-zqZOzfy|#3vm|7^N<>lp|j!HpMS6(KmLV^sw%N(jed!vz8TsH zz zK&Xk${rl5%bD7hey!V?41qx-=bHX?qZk?c6@CbS^UgW{5bAXDgt5Befsu1PK@UUWU zKGORFj;Q&zq4??O=%~Jd!P3%Fdhq!8`0ccAxGhml+l+CJu4Ucp5fKp>3?`N`I3&bC zU;l&{!PU=OF(+^wM6)d|EZp*PEIbuXz!31{$rEZCnzXlX#l^*ggM-!7)ft;nAx$4W ze_sod9jyr)sj^=I6X1a{hy_yIkKissCkkC%Jox|o& z1@fpO&)-hk+5;T%nbhi;l#lWSDJUqWZIZK+@UfmKOsFWghJrHFd?Xx_pFCD{QGf?2 zeA>)(>C(*lRHNxN;5@?<6Dc>-W@cuN{v51%N~Xv%t&G<|?GiEejg2M6#fk9q%ciT5 zl90HGkF%wC7Fm7IX(ituv9C)KcUNO4vl}V9C3^g@&&jNVhK}yrw{Ncn9`)G+{RQ|O z7#KJ{m^gkB9$o-Nfsa32W;+r_BLpS%T=qwU|LL)@v8n#cG_Vb6S&61f@vQ*gq3k{w z+Hy%AA8tKb>c2Olpr9b;vRq$w!rG>%dxwTNBINN22sp?T<>kMuj#YK0NQIk`?(Ym3 zvEA*D7qHIKScE+V!lLBif*KoJW|iw2C%g7H@u8K%+DE@u4XDFrmzEM@V?pbHfS8$_ zB&MWvo%$3AJ2f>mwZ0x(vA|j1+w0s{`jiwcM2?4#Z*ncpLEA7J4VRgppAYEQ@}kc3 zcMsI++IY?2>M(57e1pprA(u$bBy_kudUQ0O7S2MVU~g|fKB%Fk)s|iVElI4%#I-@!)D80i}6IJVwX>)@~vAOWNk@euJ7zhN=uvewFdj{vqlCHQ`6EOZgonL>qE=Z zbI}(4WPk78d17J*xap>u+n??-MX+~ZrCCVKT+g08YnC~WUKAvJm*hJ1TqPWM=Wc z&F=DE|N8oe<%`Fi!oA1#)0?LV+%8pACp4;KjPc(jy?OIyI}sE!;1Zp<+d4d55J|9Q zBQFDU1{%7!u+S05Czt;^^lpBlyHf_|9tCgB*Ca9RkCIM3lax%P!Ob87cjM=Yk*-!-OgFw3E{lR#JZyqgz3IywS`nLLe+K575s ziTF$r&u?eKF=7)E=H}-7uOrcZdf~`0TD^u;mg%)Do<7RbD%@9|f{-6Vwoba z7^KwXZ3FdrnST-m4BNnyR3bmdA+=j1g!gGV`ER?K@sVv zsJ}EH()U^* zbX3l*6yu4^;Ka%(ObZL=zwfqyjTN571)JL(y3$R=Snd=H*Vf!3MeWrPCsow z_E8{=wRJX>B1ksH=g)7T7oZK@#go(1FRf0as<{%u-XNN}*>(6oAiBMQ{>4_91UTU$KFA)Okqcuq{oc-%kT`hPQ0;yo6> zGlOVTapa-S!!a>6<=YS;U7Du z)UU5oQ!-3up*igcDnK}X{HWN=cLw(fh!^UxQ_(nwY0Q%XJiZC|R2ME}OUl`rnwm;W zqbR1cDk=uSK!7%=B2q6!9cJ^*@_Py9xp0o};=p-a3_ZSMT-8fxFv}R=go74{ezS|3EwWW@axbDQTu*qIo%n*BlHC zARum=*6BVZq@-|^^D-a{z>IS0ZYYU%G|$tns`StCkwfOu&}DjV7Cd`)TJo&1Eee+E zC^nW#pAZb7w$4tYn#Tg8GzcY}`c9%S2r)2AG}YDp(`!T=e|!ct=)F2B!W1EF@huUU zQeR(RVj}Iexa#{YM1EM_ZtXX4=0Wo6>gwIK2_NuZ!PRwjbXlW67^<+7;Rk*)=C$M>PL}Wh zsWsb~LQhIs3{(etyX{2n5wt9~?fLUbw_y*uxVV7-30jksduFQf+0f7sNzmuv;m3_n z&x(kM0N*eyv5Y7!-HBk9tFEcJZ(;(Lcdgro2~P|SJV+7}CJX=f?`;hX#>hHiY5o2E z!8TQ|BeLT(wy`1PMA*ZprtU$B*)$YXRUNFa^CoocZf$LCZsz3Wjh0%+ELZt&v|QYQ zx3;%!?Cf3y2g~4fB#MBxeh;?7?()z>Q3-DYyMl9R&; z4-3rmW#NqTAWG7Pd0$^>Gl!jGRe3iHnZ?V>^WBucb<2#G3Oq7>o?kzjLh!#OT8^rU z01^6^V-cPEeY#v)z!n8h0c2O0{7=M^-3NT1TCW3eJOSD&_4A8D5(KO%QabBgR^lJl ziwOz+DjhIXPd`gNM1hba4sz^dCeyccOanmffqy<$>qW!ZH!(5M*T)hepCQZ;*pd0F z4E@2S7RU#Pb2@VJrnxOj9(^4s5F?}Tu;%cR1|V*W=F0ipz9IONzpDc2P`=ExL~I-! zK}{yWf@kLDz_kVss{m{mSW^4yjZ;Cg!9hXU`S}1vf4La8PQ99|qm}B0hJS!XLy16# z>gxk7lyut%R^Y!l5nN#0zB>!1?4?VW)cNl_;o+k7HL&Me7;Cz^x*n`?pzemsvnw)U0di(p7G;)LW$4|{IF7BB}`t;c| z$B^oP`(Hj!_#8_>|BaTWuKPWka87a$OP$dJlB017TcNrhPEm1#os5;072=!FM>62Y zfnadtAm}Xf1)r011g&F!!k0~|dcKaX=iwY%`sqEFefy&_2rO%Ocvb_7{kqKTg6^m7bY-y5O_3 zaISAK^VRDoC#I+Zzf|d%vsBJk@9DKrkcqD2?sC!Zs{o|H)+y4-g8*WoYOU74Bz=;8 z#X$*d*1LBh8KQ}hFDWml|LtGrJoh3cg+U4I zLrB!|@08;>#cvp02ckqvbMyXzfoDowB^x+#?F~|*^AxmA1apq4YjIzv98#a6d{=Yo ztqW?J&5NgqP`;=9itzy)0Mwr7p|IK8zkW>*u01V75KFp~5U#jbU7Z}vJhz%gT*R0w zK;{iRjQAYnBC5C{d4c|h!!G`|-{YGChp!ZoC!4EoIn7MVgYRJjF4tA$>@@1KRL(o)a zHffa9o2X&#Ohx*hIq6x99M z2W16uA*W<!9MHrkXrAD0Yw4dHgB=6hP&M4>A8AtqrI@HFF1jHgU!-~|RQNM$g@CV z0`@JKxX?X-H$z1H`ZYzhA}(T};rH>QsAv*TggkgyKo-H4g<6JBdHf>2qO#KNN7 zUB)c;!p*~@<@0B8pFf@(KboM;0K#Yd)w>&vyDUp2Ja!oZUUTU_(GEgVLpXgOt^Fei zfQ|X=BII}OYHB29Ny*87#y!^VjkLe!zRbfjUh*Ikf?F3z-!sJ+dZS}wlVe@`7C%u-iV8}~Ur z!Vpk=O%UoF8#{tc-T09cE*f|%+?`D@-L8}kSp5` zw58w?Zr+hPf@C>p#oWy7JYE1~58V0{>yXS{*2+`aIClBJMd%!0Up%gSs+E)CodW*p=aPqG0U+6|l9o=Hus2gmH<*@44jF9Jq)jLDqRE z(nmL+WY4dyV%~mQypEl6A+&(%wBtDZclSeK}aUJtn#_SqpKxu-0; zKhJUkwCHX*)Xu)h=g*%lvlc+tfzJcH-t?M#%ZrO>zxwv}+=>ceLBal(mX@9#l9LGm zceo8u_>dt7$-V_mKe~#9C2ymYOa0baf zktl4r0|;YoJ}Y(n`wjpK*S_WL+us&?Gr=PQA##V|WJmm`NV?8K5)u-Usm6p%qGjm= z=hKiZ-{x!F-EuQjk5qAF=>dW?hHJDPx4R=kHBiqb@qO{L2-==YiqgTYrs`Tc(~!dh z@!c)QoZR~SLp=n(MR?{PY-Ewcr;(Ml^X&hOvcPG;WBg~Bbya*F-$(whFiR|%Z{utQ z9t;j0qfS1%jrZ4)s$qtRH-G$c#XtIc*MrHGKDT>?I^aaGM#uv|;o2iG^1!S?k)I2_ zLO`Gtgb?Sfw8K^41wQL%2gvE^Cx(Yb7v)Y27FjZ4ku8P_DumOQPyGzBASXyJkR^F{ z*hE{w&>ek`LG-&OpWjbAh1cHR4)IWDM+Y|t$Hw+HKObKsI`S$NApt?i6-ej~e{Vs{ zyWgaEg`M3E5{_2W&8!sIdVt!xckhCrF*h|mN#>iHFb9^Vl}@uqo9$Po3(KINgOXWT zSb$VV%58lT8tre-KVW@(O*e;~*osi`JL~II?czu*3(2in;0Q+Lc1aI~I5-|au?+4) z4MJKfDketocgOlpy4porTJNKs0o5y1baaMBMp9ai*8O>J)Ur<#(N;WM=;=vUN=i&z z9j_77s$}k<2``2Dk@Rj$V6m|Em07p?vem)Kf}R87CMzcgA6|rnQ3#T68IBK4yW-== z@j4&+5ib~QNk|xh9t?)qe|4%q^uj36mgye&^vRHwkG;>zda3RQcB09MI9(^q7V-0I zNLPYz{C_#tr4;p)EAHw#;IQ%X8pAZt3WUOH>`}1f3;}RCKnx4(O(7%q_V!k0B^A5H zlS&od0-ovu3^lnlnG}YHhud(Rc!*B}18-ol_2B-JM~R78!+zq|5P_MTF#&%5&;2Sm z$P0E=OukW_Bxu~nJByGv0Ik-{)#BKZn%Z!~V|-8|6+j%POebIz>+jzPgeHCN%PBHz zTidZBvvy&=JXrAyR8*mLqpi9G2=(C$u=*o!XGY4i5IviooJ?Il{uw4Tj>Xf|)Kmxu zkygnj()>?P+wh;B_Fg-9+DK{xC$Gn@4Mcws9JIByoiO_gH@-YwdJJ;lqCn7|%h0ON;(j4V&5@KbZMdF!i7&|m=Qwz|4hoSd92E$3fdQX-al zC<<@`%twxaI8ogF8o)FFbsqtzw>s=#AUVMMV7enYG0_uZUU0P~Bx(xVq6Na0S;Jd~ zJ$|iTVq=37iv9ID{c5+uckfJrTz*Rwp(UDwtOCS3Y#aO9-x&`B&`8F<*e6%B4ag@y ztRJYA*-v;c4_=+&UZ%g0pPQZ@*f|HrHx0}H$@Lc)*;`wCK&AyV3Y8TV%9qN*P0LPE-U zHC2HV1pWuu(1ns`iHIa0Es{~YK2b3;GOF-FQtxpZ+u7CH3>6hh!l2!g0~8Yf9$lbZ z4Zg0=?AHqpqDU6G+c$>()z1lB6iYtGzkCWkGZDnruNxXX;E`W2sXfuzv)SgM#37Q3 zY26tn$!&QU--QPdP=b)xNc7M)+Yo2`tG~U-5>93VbT1)+Mu0kL1WDNK?hPDhcF!eq zj-YvD<>duHFOjAHPUR3JDN15fRzwEP!;*eD4P7BipF~XTMds^@yNEgI5e9!X7DQdn ze}atZk}SPfpsCEZDwd`}WIt=s4-S*M#K}v?OYR$pMN$K&(bKpmEoU_cLWQ@z3y^uh zEEyE8Lmdh$=YfkL^N+*-sSKNCr!9#2;=Y1?3tQ_KG)`EHCJNAwsh2rb)YVVSJ&<)U z8o{ks1~I$G+w%5BmQTO440|{e&DrDD~O7rI#<8Q8=lya12z9?M{?bblVwtXrqtRh;uGt}CP>!A*0$ze<5N&vfSOnCmV6l=-UliP>GsvDSAn6zkmuEy_9GZp zfeA7h8JVA7!OHB`umK_N=Xh0I9P)HN*H!(1m;dq`%fP(+o8`EKQ(5u_I5W&Y!Q~I; z*VIUq^-XkkLVG9%^#sy{k>7dtYe`87sBdt;dKb1q7q+!22E0s2(9_a_nXAz(^H4J! zP`Hypg@umb_gYxYl}~twNZ6!@tV8fp*+@ERU2Il$G@l568F9 zaE@3Pn|J)!`VH}}9@y0`EHJg!6igl+9i79EgE&a*+T+8O59H~B$E&8Rn=O8Z7(Y-4 z?*q)iFaahOqZdHB#L(sV*Vq&oTs_bMh9+j@IuLI0Qw6wRije8&1y1M=X`zgD) zcngXJxCEr^me$tRR#taQEYDL=+N=zhUNNeTl4sH9aea3IT<+;Y6jH)+SwTkT34c;E zMC~v)_}cF}<~T@&-NxFwQO4Ctn3nu-92`D+Nl%zZ7OsJZO>K55qNCY;dtMdD7?>fT zn%Ec^>Q968yF%%;4NSyW3?JzoVpfrW*=qpZ zQ*XmL(Ey}f%qm8IG47A}U#>RIr#Z>baa;#cqk+92YXY?2nA7*<$DFCs%9r-%1AOPx zd|$u06xUujpLXWVnVd7rjA4?T60Z^xV2^3q02bk6;nVdvXTzeN+HZFko_v5OHB-QO z4Mv6Jxc9|-zj%gEcwC)Mi7M?w`KEXjGz1;f|(dd literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/html/coglglossary.html b/doc/reference/cogl/html/coglglossary.html new file mode 100644 index 0000000..8d3474b --- /dev/null +++ b/doc/reference/cogl/html/coglglossary.html @@ -0,0 +1,59 @@ + + + + +Glossaries + + + + + + + + + + + + + + + + +
+

+Glossaries

+ +
+

+Annotation Glossary

+

A

+
array
+

Parameter points to an array of items.

+

T

+
transfer full
+

Free data after the code is done.

+

A

+
allow-none
+

NULL is ok, both for passing and for returning.

+

E

+
element-type
+

Generics and defining elements of containers and arrays.

+

I

+
in
+

Parameter for input. Default is transfer none.

+

O

+
out
+

Parameter for returning results. Default is transfer full.

+

I

+
inout
+

Parameter for input and for returning results. Default is transfer full.

+

T

+
transfer none
+

Don't free data after the code is done.

+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/fill-rule-even-odd.png b/doc/reference/cogl/html/fill-rule-even-odd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e4fbb0f2a2dc04953609dfb942f48db046e46c1 GIT binary patch literal 3121 zcmb7Gc|4Tc8-HiPkU=SBWEr`%a7}j*VGOcWqTHJrVPu&ZvX1OiV~I~mDUxN<$dbB7 zY6c;Dv@k<B)-w{bp(ui5|AX7016?3|7KF+7 z{)6924RwRCvIx%l7ZxdEs+W51pL)Ga>ZqSNtOtk<3rIl=zU!LnJ=qC;g%$K#*tud|YePErg3$5j8yC zGrwz&n`NK{4gx|=rw_cq;p{9sTk&#zN^R?587+7{-wtr5!qqd?ME zD(?zWlYuUX)qixAZg9ULYSiAC>Y;lQA#^wJc_r=lHwEr{pwj)2CJfj;IhP(2ST@ZW+c}uA*N*xm($z?(scfC=>~+5`;W9p zR%aLW2UCGSVTsejsnkuH78M3$4To%C!XrbhFgZ7M@*#BkiluF|b_pT3G2UTm^{JmY z{_oaPX3r~>5ClmWcy0gI%J1)q3)=$#teQLD1!3JsZ$xHiY_5-DP*fZo3q)b8zsb2( zyZN+#_$uAEP-+e?!tMQonAF#Y zOESX9L#X=e6C0lTB#hYtyGOOQCutR#T zhqc~SRqqJnzRg`adVjX=ik{$l?o4yclBud^ZQ2>3IJE!4y`Aj|>}Rhoq^Awnq-rwq zaP2l7iwFBmt~!4zT2@gBxz1{-d~c`Ae-oe#>IIiMMZ>ikXokGrz}`t6bMa&y!3}cn z+ZkHYh&U92+?Fcja|S^FNZyg~;C^QGPoDH1jG|@Uyd?CzK-#v5!=})-q-JQo zz&-s;`^Wav*i^O4qIuTpE*B*ZHmrMg>AP~9d+WP1O*26&U$^3(TJWn`8rw5v7dl=I zjE@c4Cx-w-`tgARZGvrdIQOO_5%=0y)w2z@uiy@nWDTvj!rqIX8xk9|hy^KK1#Qys zUn@+mBu}87kICOiVt1kaXNE(5jz$VSXFZ7JCRF7YgzWiah6i?Zt>E6`_hM9q6Kkux zqETMxIew6j#@LT4(&p%!^@X+F_42~z7zEkfl0W0zhCoHfu`)D)a}#}wm4o|`X1@@tUjpFo`K#8#+TnEDL2OiKQ1dZl^lf9XHpW!-ne2~#Q`{n_^Gnu zq1~=krS?xZ5f}|HlzGdbseq!&S4}BONATGjDZvmh8fNx2y&f5DDOCj0saW`^1wZC4 zNpoBR?tD^nI*pgFyNQznHOO%+?Xv_GpZsrtlm&;Rp?>9fJpVe^dqLq#$c{zbI z?lC)DnL}B=1vg00!yC$X#wnlaPe?N=Fx7pjO9cX}wvP2T7<@+UKb4>-$CK;ae-?N< zj4#ut^UW=7*`4$tg|xecB!sV#?t@U4;;byi8k)c+2hdcAksYs$a8r~H~~yZ&1-_p(`2(|BGvf}~b}X6jR!sz?JWhFwPg8OU3`CDtp3Ikq)EYK+*_ zM0!}0q)}km;3B(Xw#aH!zgr02el!xo62LY_?=+VxinJ`Zcp98nneSe!hkWSS33Aoh zB17;uc5Le)41MSmWhd45(nzp@uv+LbF|>kazderfYB{G4b)wu>c!!xSaB`gh~)yLmi>&rIsdx5{!82y-ieu_K9n(Xo30 zT$fIS+O>BhChWp0{Q@h5FPK|{7z!U+1ll$jmn6=sjy{o4iZ{k3v2fdqSOA#r^-5-Y zMN?N*xLp&DYqZ>-*;ovbXn9Sp-AzpYkQ{(Fz9_n23pH#$+=%+i0n0WpJ(tyg_|lhJPQ-WLfej!oL{G0EnVT3Zxq=K3fDAlzU18 zB7LdQ23%NY7&xVqvrUU*sPA)l?xZmlLe*pn!H%g%bP)?Y1$pzSnjp%N5JQIY_~DM6}bf#RywtLIa;6 zDt$W5@y05%9KFkul(6nHMC=+KU!%du+8B+`hPHy`PyDgIf$aFcx)q;}4uhH~72$b> z+cTL51{ST3)9@Q>&zGGdppCr}#iXLM7iKn|kuLNkdE#j=gZ(xep7~`g{v$-fMa5ds z+ib$3IhKYb$!IUaMCDw$;*e>X_QsVoFuRt0qpyuIU7{uKWcZY&7EN9S%Rh5muT zV_6hnKDf3-C*9QfqM#%|xD7y^>pA%Fm#X>y=oX}RUH+J{bZd|NM2l#eoz;mWr541v F{{i05cM$*p literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/html/fill-rule-non-zero.png b/doc/reference/cogl/html/fill-rule-non-zero.png new file mode 100644 index 0000000000000000000000000000000000000000..2d8ad314c4baacc70c84b83b0b83b35e6a93a01c GIT binary patch literal 3143 zcmb7Gc|25WA3w7g#$H5JmK2gKVKRlr(rarN?M#c(7=y7iqDwKD=th_OCJn~k-k2~eBOKie4q3AopYYw{`}7GJkR%6oQJc5tfnjg01B=y zPDcO$N(A3KWf0)qVVpAuJ|L7M&JF;JxAikPL0oWmb^_KUS3&*5+aL!S=Hg8O067&2 zL4a(=W{@cz;fg&ZEkLNt>uF0nrRIYyjfg|1A{;}>WI{*;;CP8}K7w#jCyEpipyTX{ z#hr{-R0katxjNY&yCRq#?#eDUR7T)t-!3=qjVbGTW1ah(=5;8qW^f?SRnvI!{zfbk z^!dL*6+iGim`*{t9ryQde}|;YBLH?)YW}$fVyiTuoE(M#bQs^ClG=~9liU_PV^jcT z9J6Nj_#Bd^Ahae{2Bc*(0w}YbdU-_vjEm<-EZ(=>4TwFt5*33U|_+*wk2V@IIPI1J9qG9&FhqYPs<{Owk(GXUHVfTU6#C3Et<%L_6=H<15vC<%!;(hsX)-ee7?~z^61JjzMu`bR_DOJ&_x1S9e^@o{fEQ_x1tt9~LkKv1r zKTgBN3Taje#m$EeVFgwTw)l!36fso${Y+)$E;>Yqv9hs~jozY!zEyv&S)Q6{8xki) z_HaYE7RpmO9k0$lPDBx(E$oQt7X*J^*u({Yjs}?k0pqkrJKO?@{?l;vrhw5w%bOJI zWk5QMYXrOZRi*IV-NnQ7>e&)3n8mEfYp!p)Xj65nc;m}h&4t(Y$G}9QC^w?UAYYC< z2+HyN?%%R}5ttdR^CPajqj?YN;K>1n1^v18(;hxAM=vX+C1?OG-iy@Cf1`-BbTuP7 zk^snGR9s{wu+iu6u>uw-Pu;>h3-!5$W7mBx&#~+_IZF#AFQN27yZ6)+m(-`NGRQFR zXG$_k`#!lFs&E?)4;;0#n%_Br{pC;0ol@?T$gFbEv9MTll{?J!9g8Un5BuK5 zp=mpM_r5DzojW|(47HzB4z)|7r`0rWSdLZisET}Xv8xo1Smv2`K?MgVF!4=SaS?Vx zJ7=DW&yA~;aZ@);OiZ|uGF|CrN88YXp=`kMM2*s!ms&dtu8A~d;9#{>v(jqT zx@`Eu-fo-5QvrT03lo_>5b{Eerw*9VhxtW%+vekB-bQH_O8+#a>*R+GfypLrQc&@E zyO7+pUzi)zIztrvn+8jdkI!UWjSC#PN>5uB`e}t^#E~e0B(2(;{Tw)T$~Ng|$=w4= zo=4R<9*TuH1W-*+UY)k}et!%s1MuE1ZOpmJL|_sWbkq<=#djpV-}!LB-U0>gEw9Q% zipcG8$$QUbfTsmB%xJl%n~@jpgjp6(_w|>Bn{ET!{maKn9#qgZ`YJ>N=pB=T9DoT7 z?FsBrb)cw>GCzjT)~iHUletkJz&!?7D5F&EYrR~T;$JNf&?@|4f{p&s$h~%W1W=Yb z%(waF!vJ5vn1TK=;QQb&^+;5|)sV2410Gq-L24B(_e8>PVBfw(h2X_4MABC>ML1WR ze%Yt!B*LNu>+@0A9k${VsLUcxh@O0)IAfmH_z~LVS9>4(P*W1Td8{k6ib$wW#_hEr z-=QRDIaR2p4joB6ulS_agFBe~u-^xmuUoA?Pj*8Sq;66X2^uZlyA9TM0(Z^=^9>KK zBOzD}tl3yAE!2n&ILY~AG=*KkI`qm<=Ht!B_t$0oF!m`yJ>ly|ZF^hasLxPz(Q9l7 zw6CeBWyQi9}G8cnU;qAB1ZjW^r zzYdxnIF!8#VXH_@qZGri%ujyHP?ORZaIEi41K* z3$ph~S8Oi~R_Q#_Ere4~kb*{3+n>NIurA_@5U>+3JbE59yL6hnw5#l^7`+Z&p5|N+ zoXK3-*exo6P{UBi4CS_PQ4p+)BpqhUo(>$DyA4t@YmyC~c<<$opfH%CQ*tH+%L0I@t}8JX!cHlY{~Nd&BjKk_IhKs>pHlj%o&TVxu7icI1xS zX69R56*6EKi2}utS450qRih*s|D5#5HpTTQYP=8`LaS5-7SjVR;!n2KD7-?~aX`P| z{=E()aDT3h66r;C~pU3x`5ag5}DUC57 z`*PaSAB2^yW1Ho$9l4>TK)*bt0Ak9?AQg#9v=WhMk%SVSgmjo_s_EdgWr+RK77dD| zo9YrVt8c! zAQJ1xg2TH%-fzZfdqs@$XA9TL4N#tHO(2d-G)-O+N9VL^ndL{4XnVylH7%U><)oRP zotJAV{$tNvJn6h9{*e y<{bqu5{34YKxrUl;;`YAegRT~^Z(xwR~yY zO1cF+0vxb!W?!x?K+*#62Jq)nA4q`)5S6sgX4ao{=)(Mgq+YMr)7sjak|a^9)zS!j zlk{-n29mabXYF=7SYBQx&vO8xC}MYams+hxqtO7sImhPaCf@rq;I^3!#u*2aUP)55 zT2&N90xmEJ0s&fGT~(T<3d2xYmK9C>IP*x-M@ib*+0pFm>>uW37N2Wzaq-fCnIZE9 zpb8}0+uN+KuQM2oZVHfP8U6kQdo3?>Wo2dT)WeM9So8DqhLi#T0 z-i(>mfjhvbsYV`;4sgfJ-p>G-SqJ!fjR6BQYs1h*y9xaN0l{VB;o%`08yiy@)$8@~ z2PD1gcDuiy;j1tR0v#V8OH%W)25-YKyx(j#IXO9*YWf0mb8}QG6@b@;cHxh9{t7+@ o!Yd`f8L$sLH?yBt^q3C6015TtIu@BS5dZ)H07*qoM6N<$f*igdr~m)} literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/html/index.html b/doc/reference/cogl/html/index.html new file mode 100644 index 0000000..82f91ff --- /dev/null +++ b/doc/reference/cogl/html/index.html @@ -0,0 +1,158 @@ + + + + +Cogl Reference Manual + + + + + + + +
+
+
+
+

for Cogl 1.18.2

+
+
+
+

+ Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +

+


+          The Free Software Foundation, Inc.,
+          59 Temple Place - Suite 330,
+          Boston, MA 02111-1307,
+          USA
+        

+

+

+
+
+
+
+
+
Cogl - a modern 3D graphics API
+
+
About Cogl
+
+General API — General purpose API +
+
+Color Type — A generic color definition +
+
+Textures — Functions for creating and manipulating textures +
+
+Material Blend Strings — A simple syntax and grammar for describing blending and texture +combining functions. +
+
+Materials — Fuctions for creating and manipulating materials +
+
+Primitives — Functions that draw various primitive 3D shapes +
+
+Path Primitives +
+
+Clipping — Fuctions for manipulating a stack of clipping regions +
+
+Vertex Buffers — An API for submitting extensible arrays of vertex + attributes to be mapped into the GPU for fast drawing. +
+
+Matrices — Functions for initializing and manipulating 4x4 matrices +
+
+Shaders and Programmable Pipeline — Fuctions for accessing the programmable GL pipeline +
+
+Offscreen Buffers — Functions for creating and manipulating offscreen + framebuffers. +
+
+Bitmaps — Functions for loading images +
+
+Fixed Point API — Fixed Point API +
+
+GType Integration API +
+
+
Cogl experimental API
+
+
About the experimental API
+
+Buffers — Common buffer functions, including data upload APIs +
+
+Vectors — Functions for handling single precision float + vectors. +
+
+3D textures — Functions for creating and manipulating 3D textures +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+
Cogl deprecated API
+
+
About the deprecated API
+
+General API (Deprecated) +
+
+Textures (Deprecated) +
+
+Materials (Deprecated) +
+
+Clipping (Deprecated) +
+
+Vertex Buffers (Deprecated) +
+
+Shaders and Programmable Pipeline (Deprecated) +
+
+Offscreen Buffers (Deprecated) +
+
+
Glossaries
+
Annotation Glossary
+
Index of all symbols
+
Index of deprecated symbols
+
Index of new symbols in 0.8
+
Index of new symbols in 1.0
+
Index of new symbols in 1.2
+
Index of new symbols in 1.4
+
Index of new symbols in 1.6
+
Index of new symbols in 1.8
+
A. License
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/index.sgml b/doc/reference/cogl/html/index.sgml new file mode 100644 index 0000000..c8d262b --- /dev/null +++ b/doc/reference/cogl/html/index.sgml @@ -0,0 +1,617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl/html/ix01.html b/doc/reference/cogl/html/ix01.html new file mode 100644 index 0000000..0c01879 --- /dev/null +++ b/doc/reference/cogl/html/ix01.html @@ -0,0 +1,1723 @@ + + + + +Index of all symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of all symbols

+

A

+
+CoglAngle, typedef in Fixed Point API +
+
+
+cogl_angle_cos, function in Fixed Point API +
+
+
+COGL_ANGLE_FROM_DEG, macro in Fixed Point API +
+
+
+COGL_ANGLE_FROM_DEGX, macro in Fixed Point API +
+
+
+cogl_angle_sin, function in Fixed Point API +
+
+
+cogl_angle_tan, function in Fixed Point API +
+
+
+COGL_ANGLE_TO_DEG, macro in Fixed Point API +
+
+
+COGL_ANGLE_TO_DEGX, macro in Fixed Point API +
+
+
+CoglAttributeType, enum in General API +
+
+

B

+
+cogl_begin_gl, function in General API +
+
+
+CoglBitmap, struct in Bitmaps +
+
+
+CoglBitmapError, enum in Bitmaps +
+
+
+COGL_BITMAP_ERROR, macro in Bitmaps +
+
+
+cogl_bitmap_get_size_from_file, function in Bitmaps +
+
+
+cogl_bitmap_new_from_file, function in Bitmaps +
+
+
+CoglBlendStringError, enum in Materials +
+
+
+COGL_BLEND_STRING_ERROR, macro in Materials +
+
+
+CoglBufferAccess, enum in Buffers +
+
+
+CoglBufferBit, enum in General API +
+
+
+CoglBufferTarget, enum in General API +
+
+
+CoglBufferUpdateHint, enum in Buffers +
+
+
+cogl_buffer_get_size, function in Buffers +
+
+
+cogl_buffer_get_update_hint, function in Buffers +
+
+
+cogl_buffer_map, function in Buffers +
+
+
+cogl_buffer_set_data, function in Buffers +
+
+
+cogl_buffer_set_update_hint, function in Buffers +
+
+
+cogl_buffer_unmap, function in Buffers +
+
+

C

+
+cogl_check_extension, function in General API (Deprecated) +
+
+
+cogl_clear, function in General API +
+
+
+cogl_clip_ensure, function in Clipping (Deprecated) +
+
+
+cogl_clip_pop, function in Clipping +
+
+
+cogl_clip_push, function in Clipping (Deprecated) +
+
+
+cogl_clip_push_rectangle, function in Clipping +
+
+
+cogl_clip_push_window_rect, function in Clipping (Deprecated) +
+
+
+cogl_clip_push_window_rectangle, function in Clipping +
+
+
+cogl_clip_stack_restore, function in Clipping (Deprecated) +
+
+
+cogl_clip_stack_save, function in Clipping (Deprecated) +
+
+
+CoglColor, struct in Color Type +
+
+
+cogl_color_copy, function in Color Type +
+
+
+cogl_color_equal, function in Color Type +
+
+
+cogl_color_free, function in Color Type +
+
+
+cogl_color_get_alpha, function in Color Type +
+
+
+cogl_color_get_alpha_byte, function in Color Type +
+
+
+cogl_color_get_alpha_float, function in Color Type +
+
+
+cogl_color_get_blue, function in Color Type +
+
+
+cogl_color_get_blue_byte, function in Color Type +
+
+
+cogl_color_get_blue_float, function in Color Type +
+
+
+cogl_color_get_green, function in Color Type +
+
+
+cogl_color_get_green_byte, function in Color Type +
+
+
+cogl_color_get_green_float, function in Color Type +
+
+
+cogl_color_get_red, function in Color Type +
+
+
+cogl_color_get_red_byte, function in Color Type +
+
+
+cogl_color_get_red_float, function in Color Type +
+
+
+cogl_color_init_from_4f, function in Color Type +
+
+
+cogl_color_init_from_4fv, function in Color Type +
+
+
+cogl_color_init_from_4ub, function in Color Type +
+
+
+cogl_color_init_from_hsl, function in Color Type +
+
+
+cogl_color_new, function in Color Type +
+
+
+cogl_color_premultiply, function in Color Type +
+
+
+cogl_color_set_alpha, function in Color Type +
+
+
+cogl_color_set_alpha_byte, function in Color Type +
+
+
+cogl_color_set_alpha_float, function in Color Type +
+
+
+cogl_color_set_blue, function in Color Type +
+
+
+cogl_color_set_blue_byte, function in Color Type +
+
+
+cogl_color_set_blue_float, function in Color Type +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+
+cogl_color_set_green, function in Color Type +
+
+
+cogl_color_set_green_byte, function in Color Type +
+
+
+cogl_color_set_green_float, function in Color Type +
+
+
+cogl_color_set_red, function in Color Type +
+
+
+cogl_color_set_red_byte, function in Color Type +
+
+
+cogl_color_set_red_float, function in Color Type +
+
+
+cogl_color_to_hsl, function in Color Type +
+
+
+cogl_color_unpremultiply, function in Color Type +
+
+
+cogl_create_program, function in Shaders and Programmable Pipeline +
+
+
+cogl_create_shader, function in Shaders and Programmable Pipeline +
+
+

D

+
+CoglDepthState, struct in cogl-depth-state +
+
+
+cogl_depth_state_get_range, function in cogl-depth-state +
+
+
+cogl_depth_state_get_test_enabled, function in cogl-depth-state +
+
+
+cogl_depth_state_get_test_function, function in cogl-depth-state +
+
+
+cogl_depth_state_init, function in cogl-depth-state +
+
+
+cogl_depth_state_set_range, function in cogl-depth-state +
+
+
+cogl_depth_state_set_test_enabled, function in cogl-depth-state +
+
+
+cogl_depth_state_set_test_function, function in cogl-depth-state +
+
+
+cogl_disable_fog, function in General API +
+
+

E

+
+cogl_end_gl, function in General API +
+
+
+CoglEuler, struct in Eulers (Rotations) +
+
+
+cogl_euler_copy, function in Eulers (Rotations) +
+
+
+cogl_euler_equal, function in Eulers (Rotations) +
+
+
+cogl_euler_free, function in Eulers (Rotations) +
+
+
+cogl_euler_init, function in Eulers (Rotations) +
+
+
+cogl_euler_init_from_matrix, function in Eulers (Rotations) +
+
+
+cogl_euler_init_from_quaternion, function in Eulers (Rotations) +
+
+

F

+
+CoglFeatureFlags, enum in General API +
+
+
+cogl_features_available, function in General API +
+
+
+CoglFixed, typedef in Fixed Point API +
+
+
+COGL_FIXED_0_5, macro in Fixed Point API +
+
+
+COGL_FIXED_1, macro in Fixed Point API +
+
+
+COGL_FIXED_120, macro in Fixed Point API +
+
+
+COGL_FIXED_180, macro in Fixed Point API +
+
+
+COGL_FIXED_240, macro in Fixed Point API +
+
+
+COGL_FIXED_255, macro in Fixed Point API +
+
+
+COGL_FIXED_270, macro in Fixed Point API +
+
+
+COGL_FIXED_2_PI, macro in Fixed Point API +
+
+
+COGL_FIXED_30, macro in Fixed Point API +
+
+
+COGL_FIXED_360, macro in Fixed Point API +
+
+
+COGL_FIXED_45, macro in Fixed Point API +
+
+
+COGL_FIXED_60, macro in Fixed Point API +
+
+
+COGL_FIXED_90, macro in Fixed Point API +
+
+
+cogl_fixed_atan, function in Fixed Point API +
+
+
+cogl_fixed_atan2, function in Fixed Point API +
+
+
+COGL_FIXED_BITS, macro in Fixed Point API +
+
+
+COGL_FIXED_CEIL, macro in Fixed Point API +
+
+
+cogl_fixed_cos, function in Fixed Point API +
+
+
+COGL_FIXED_DIV, macro in Fixed Point API +
+
+
+cogl_fixed_div, function in Fixed Point API +
+
+
+COGL_FIXED_EPSILON, macro in Fixed Point API +
+
+
+COGL_FIXED_FAST_DIV, macro in Fixed Point API +
+
+
+COGL_FIXED_FAST_MUL, macro in Fixed Point API +
+
+
+COGL_FIXED_FLOOR, macro in Fixed Point API +
+
+
+COGL_FIXED_FRACTION, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_DOUBLE, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_FLOAT, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_INT, macro in Fixed Point API +
+
+
+cogl_fixed_log2, function in Fixed Point API +
+
+
+COGL_FIXED_MAX, macro in Fixed Point API +
+
+
+COGL_FIXED_MIN, macro in Fixed Point API +
+
+
+cogl_fixed_mul, function in Fixed Point API +
+
+
+COGL_FIXED_MUL, macro in Fixed Point API +
+
+
+cogl_fixed_mul_div, function in Fixed Point API +
+
+
+COGL_FIXED_MUL_DIV, macro in Fixed Point API +
+
+
+COGL_FIXED_PI, macro in Fixed Point API +
+
+
+COGL_FIXED_PI_2, macro in Fixed Point API +
+
+
+COGL_FIXED_PI_4, macro in Fixed Point API +
+
+
+cogl_fixed_pow, function in Fixed Point API +
+
+
+cogl_fixed_pow2, function in Fixed Point API +
+
+
+COGL_FIXED_Q, macro in Fixed Point API +
+
+
+cogl_fixed_sin, function in Fixed Point API +
+
+
+cogl_fixed_sqrt, function in Fixed Point API +
+
+
+cogl_fixed_tan, function in Fixed Point API +
+
+
+COGL_FIXED_TO_DOUBLE, macro in Fixed Point API +
+
+
+COGL_FIXED_TO_FLOAT, macro in Fixed Point API +
+
+
+COGL_FIXED_TO_INT, macro in Fixed Point API +
+
+
+COGL_FLOAT_TO_INT, macro in Fixed Point API +
+
+
+COGL_FLOAT_TO_UINT, macro in Fixed Point API +
+
+
+cogl_flush, function in General API +
+
+
+CoglFogMode, enum in General API +
+
+
+cogl_frustum, function in General API +
+
+
+CoglFuncPtr, user_function in General API +
+
+

G

+
+cogl_get_backface_culling_enabled, function in General API +
+
+
+cogl_get_bitmasks, function in General API (Deprecated) +
+
+
+cogl_get_depth_test_enabled, function in General API (Deprecated) +
+
+
+cogl_get_features, function in General API +
+
+
+cogl_get_modelview_matrix, function in General API +
+
+
+cogl_get_option_group, function in General API +
+
+
+cogl_get_proc_address, function in General API +
+
+
+cogl_get_projection_matrix, function in General API +
+
+
+cogl_get_source, function in General API +
+
+
+cogl_get_static_identity_quaternion, function in Quaternions (Rotations) +
+
+
+cogl_get_static_zero_quaternion, function in Quaternions (Rotations) +
+
+
+cogl_get_viewport, function in General API +
+
+
+cogl_gtype_matrix_get_type, function in GType Integration API +
+
+

H

+
+CoglHandle, typedef in General API +
+
+
+cogl_handle_ref, function in General API +
+
+
+cogl_handle_unref, function in General API +
+
+

I

+
+CoglIndicesType, enum in Vertex Buffers +
+
+
+COGL_INVALID_HANDLE, macro in General API +
+
+
+cogl_is_bitmap, function in Bitmaps +
+
+
+cogl_is_buffer, function in Buffers +
+
+
+cogl_is_material, function in Materials +
+
+
+cogl_is_offscreen, function in Offscreen Buffers +
+
+
+cogl_is_pixel_buffer, function in Buffers +
+
+
+cogl_is_program, function in Shaders and Programmable Pipeline +
+
+
+cogl_is_shader, function in Shaders and Programmable Pipeline +
+
+
+cogl_is_texture, function in Textures +
+
+
+cogl_is_texture_2d, function in 2D textures +
+
+
+cogl_is_texture_3d, function in 3D textures +
+
+
+cogl_is_vertex_buffer, function in Vertex Buffers +
+
+
+cogl_is_vertex_buffer_indices, function in Vertex Buffers +
+
+

M

+
+CoglMaterial, struct in Materials +
+
+
+CoglMaterialAlphaFunc, enum in Materials +
+
+
+CoglMaterialFilter, enum in Materials +
+
+
+CoglMaterialLayer, struct in Materials +
+
+
+CoglMaterialLayerCallback, user_function in Materials +
+
+
+CoglMaterialLayerType, enum in Materials +
+
+
+CoglMaterialWrapMode, enum in Materials +
+
+
+cogl_material_copy, function in Materials +
+
+
+cogl_material_foreach_layer, function in Materials +
+
+
+cogl_material_get_ambient, function in Materials +
+
+
+cogl_material_get_color, function in Materials +
+
+
+cogl_material_get_diffuse, function in Materials +
+
+
+cogl_material_get_emission, function in Materials +
+
+
+cogl_material_get_layers, function in Materials (Deprecated) +
+
+
+cogl_material_get_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_t, function in Materials +
+
+
+cogl_material_get_n_layers, function in Materials +
+
+
+cogl_material_get_point_size, function in Materials +
+
+
+cogl_material_get_shininess, function in Materials +
+
+
+cogl_material_get_specular, function in Materials +
+
+
+cogl_material_get_user_program, function in Materials +
+
+
+cogl_material_layer_get_mag_filter, function in Materials +
+
+
+cogl_material_layer_get_min_filter, function in Materials +
+
+
+cogl_material_layer_get_texture, function in Materials +
+
+
+cogl_material_layer_get_type, function in Materials +
+
+
+cogl_material_new, function in Materials +
+
+
+cogl_material_ref, function in Materials (Deprecated) +
+
+
+cogl_material_remove_layer, function in Materials +
+
+
+cogl_material_set_alpha_test_function, function in Materials +
+
+
+cogl_material_set_ambient, function in Materials +
+
+
+cogl_material_set_ambient_and_diffuse, function in Materials +
+
+
+cogl_material_set_blend, function in Materials +
+
+
+cogl_material_set_blend_constant, function in Materials +
+
+
+cogl_material_set_color, function in Materials +
+
+
+cogl_material_set_color4f, function in Materials +
+
+
+cogl_material_set_color4ub, function in Materials +
+
+
+cogl_material_set_diffuse, function in Materials +
+
+
+cogl_material_set_emission, function in Materials +
+
+
+cogl_material_set_layer, function in Materials +
+
+
+cogl_material_set_layer_combine, function in Materials +
+
+
+cogl_material_set_layer_combine_constant, function in Materials +
+
+
+cogl_material_set_layer_filters, function in Materials +
+
+
+cogl_material_set_layer_matrix, function in Materials +
+
+
+cogl_material_set_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_t, function in Materials +
+
+
+cogl_material_set_point_size, function in Materials +
+
+
+cogl_material_set_shininess, function in Materials +
+
+
+cogl_material_set_specular, function in Materials +
+
+
+cogl_material_set_user_program, function in Materials +
+
+
+cogl_material_unref, function in Materials (Deprecated) +
+
+
+cogl_material_wrap_mode_get_type, function in Materials +
+
+
+CoglMatrix, struct in Matrices +
+
+
+cogl_matrix_copy, function in Matrices +
+
+
+cogl_matrix_equal, function in Matrices +
+
+
+cogl_matrix_free, function in Matrices +
+
+
+cogl_matrix_frustum, function in Matrices +
+
+
+cogl_matrix_get_array, function in Matrices +
+
+
+cogl_matrix_get_inverse, function in Matrices +
+
+
+cogl_matrix_init_from_array, function in Matrices +
+
+
+cogl_matrix_init_identity, function in Matrices +
+
+
+cogl_matrix_is_identity, function in Matrices +
+
+
+cogl_matrix_multiply, function in Matrices +
+
+
+cogl_matrix_ortho, function in Matrices +
+
+
+cogl_matrix_perspective, function in Matrices +
+
+
+cogl_matrix_project_points, function in Matrices +
+
+
+cogl_matrix_rotate, function in Matrices +
+
+
+cogl_matrix_scale, function in Matrices +
+
+
+cogl_matrix_transform_point, function in Matrices +
+
+
+cogl_matrix_transform_points, function in Matrices +
+
+
+cogl_matrix_translate, function in Matrices +
+
+
+cogl_matrix_transpose, function in Matrices +
+
+

O

+
+CoglObject, struct in General API +
+
+
+cogl_object_get_user_data, function in General API +
+
+
+cogl_object_ref, function in General API +
+
+
+cogl_object_set_user_data, function in General API +
+
+
+cogl_object_unref, function in General API +
+
+
+cogl_offscreen_new_to_texture, function in Offscreen Buffers +
+
+
+cogl_offscreen_new_with_texture, function in Offscreen Buffers +
+
+
+cogl_offscreen_ref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_offscreen_unref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_ortho, function in General API +
+
+

P

+
+cogl_perspective, function in General API +
+
+
+CoglPixelFormat, enum in General API +
+
+
+cogl_pixel_buffer_new, function in Buffers +
+
+
+cogl_polygon, function in Primitives +
+
+
+cogl_pop_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_pop_framebuffer, function in Offscreen Buffers +
+
+
+cogl_pop_matrix, function in General API +
+
+
+cogl_pop_source, function in General API +
+
+
+cogl_program_attach_shader, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_get_uniform_location, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_link, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_set_uniform_1f, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_1i, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_float, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_int, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_matrix, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_uniform_1f, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_1i, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_float, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_int, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_matrix, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_unref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_use, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_push_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_push_framebuffer, function in Offscreen Buffers +
+
+
+cogl_push_matrix, function in General API +
+
+
+cogl_push_source, function in General API +
+
+

Q

+
+CoglQuaternion, struct in Quaternions (Rotations) +
+
+
+cogl_quaternion_copy, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_dot_product, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_equal, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_free, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_get_rotation_angle, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_get_rotation_axis, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_angle_vector, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_array, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_x_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_y_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_from_z_rotation, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_init_identity, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_invert, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_multiply, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_nlerp, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_normalize, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_pow, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_slerp, function in Quaternions (Rotations) +
+
+
+cogl_quaternion_squad, function in Quaternions (Rotations) +
+
+

R

+
+COGL_RADIANS_TO_DEGREES, macro in Fixed Point API +
+
+
+CoglReadPixelsFlags, enum in General API +
+
+
+cogl_read_pixels, function in General API +
+
+
+cogl_rectangle, function in Primitives +
+
+
+cogl_rectangles, function in Primitives +
+
+
+cogl_rectangles_with_texture_coords, function in Primitives +
+
+
+cogl_rectangle_with_multitexture_coords, function in Primitives +
+
+
+cogl_rectangle_with_texture_coords, function in Primitives +
+
+
+cogl_rotate, function in General API +
+
+

S

+
+cogl_scale, function in General API +
+
+
+cogl_set_backface_culling_enabled, function in General API +
+
+
+cogl_set_depth_test_enabled, function in General API (Deprecated) +
+
+
+cogl_set_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_set_fog, function in General API +
+
+
+cogl_set_framebuffer, function in Offscreen Buffers +
+
+
+cogl_set_modelview_matrix, function in General API +
+
+
+cogl_set_projection_matrix, function in General API +
+
+
+cogl_set_source, function in General API +
+
+
+cogl_set_source_color, function in General API +
+
+
+cogl_set_source_color4f, function in General API +
+
+
+cogl_set_source_color4ub, function in General API +
+
+
+cogl_set_source_texture, function in General API +
+
+
+cogl_set_viewport, function in General API +
+
+
+CoglShaderType, enum in Shaders and Programmable Pipeline +
+
+
+cogl_shader_compile, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_get_info_log, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_get_type, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_is_compiled, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_shader_source, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_unref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_sqrti, function in Fixed Point API +
+
+
+COGL_SQRTI_ARG_10_PERCENT, macro in Fixed Point API +
+
+
+COGL_SQRTI_ARG_5_PERCENT, macro in Fixed Point API +
+
+
+COGL_SQRTI_ARG_MAX, macro in Fixed Point API +
+
+

T

+
+CoglTexture2D, struct in 2D textures +
+
+
+CoglTextureFlags, enum in Textures +
+
+
+CoglTextureVertex, struct in Textures +
+
+
+cogl_texture_2d_gl_new_from_foreign, function in 2D textures +
+
+
+cogl_texture_2d_new_from_data, function in 2D textures +
+
+
+cogl_texture_2d_new_with_size, function in 2D textures +
+
+
+cogl_texture_3d_new_from_data, function in 3D textures +
+
+
+cogl_texture_3d_new_with_size, function in 3D textures +
+
+
+cogl_texture_get_data, function in Textures +
+
+
+cogl_texture_get_format, function in Textures +
+
+
+cogl_texture_get_gl_texture, function in Textures +
+
+
+cogl_texture_get_height, function in Textures +
+
+
+cogl_texture_get_max_waste, function in Textures +
+
+
+cogl_texture_get_rowstride, function in Textures +
+
+
+cogl_texture_get_width, function in Textures +
+
+
+cogl_texture_is_sliced, function in Textures +
+
+
+cogl_texture_new_from_bitmap, function in Textures +
+
+
+cogl_texture_new_from_data, function in Textures +
+
+
+cogl_texture_new_from_file, function in Textures +
+
+
+cogl_texture_new_from_foreign, function in Textures +
+
+
+cogl_texture_new_from_sub_texture, function in Textures +
+
+
+cogl_texture_new_with_size, function in Textures +
+
+
+cogl_texture_ref, function in Textures (Deprecated) +
+
+
+cogl_texture_set_region, function in Textures +
+
+
+cogl_texture_unref, function in Textures (Deprecated) +
+
+
+cogl_transform, function in General API +
+
+
+cogl_translate, function in General API +
+
+

U

+
+CoglUserDataKey, struct in General API +
+
+

V

+
+cogl_vector3_add, function in Vectors +
+
+
+cogl_vector3_copy, function in Vectors +
+
+
+cogl_vector3_cross_product, function in Vectors +
+
+
+cogl_vector3_distance, function in Vectors +
+
+
+cogl_vector3_divide_scalar, function in Vectors +
+
+
+cogl_vector3_dot_product, function in Vectors +
+
+
+cogl_vector3_equal, function in Vectors +
+
+
+cogl_vector3_equal_with_epsilon, function in Vectors +
+
+
+cogl_vector3_free, function in Vectors +
+
+
+cogl_vector3_init, function in Vectors +
+
+
+cogl_vector3_init_zero, function in Vectors +
+
+
+cogl_vector3_invert, function in Vectors +
+
+
+cogl_vector3_magnitude, function in Vectors +
+
+
+cogl_vector3_multiply_scalar, function in Vectors +
+
+
+cogl_vector3_normalize, function in Vectors +
+
+
+cogl_vector3_subtract, function in Vectors +
+
+
+cogl_vertex_buffer_add, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_delete, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_disable, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_draw, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_draw_elements, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_enable, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_get_n_vertices, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_indices_get_for_quads, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_indices_new, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_new, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_ref, function in Vertex Buffers (Deprecated) +
+
+
+cogl_vertex_buffer_submit, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_unref, function in Vertex Buffers (Deprecated) +
+
+
+CoglVerticesMode, enum in Vertex Buffers +
+
+
+cogl_viewport, function in General API (Deprecated) +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix02.html b/doc/reference/cogl/html/ix02.html new file mode 100644 index 0000000..0aa9ff3 --- /dev/null +++ b/doc/reference/cogl/html/ix02.html @@ -0,0 +1,723 @@ + + + + +Index of deprecated symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of deprecated symbols

+

B

+
+cogl_begin_gl, function in General API +
+
+

C

+
+cogl_check_extension, function in General API (Deprecated) +
+
+
+cogl_clear, function in General API +
+
+
+cogl_clip_ensure, function in Clipping (Deprecated) +
+
+
+cogl_clip_pop, function in Clipping +
+
+
+cogl_clip_push, function in Clipping (Deprecated) +
+
+
+cogl_clip_push_rectangle, function in Clipping +
+
+
+cogl_clip_push_window_rect, function in Clipping (Deprecated) +
+
+
+cogl_clip_push_window_rectangle, function in Clipping +
+
+
+cogl_clip_stack_restore, function in Clipping (Deprecated) +
+
+
+cogl_clip_stack_save, function in Clipping (Deprecated) +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+
+cogl_create_program, function in Shaders and Programmable Pipeline +
+
+
+cogl_create_shader, function in Shaders and Programmable Pipeline +
+
+

D

+
+cogl_disable_fog, function in General API +
+
+

E

+
+cogl_end_gl, function in General API +
+
+

F

+
+cogl_features_available, function in General API +
+
+
+cogl_frustum, function in General API +
+
+

G

+
+cogl_get_backface_culling_enabled, function in General API +
+
+
+cogl_get_bitmasks, function in General API (Deprecated) +
+
+
+cogl_get_depth_test_enabled, function in General API (Deprecated) +
+
+
+cogl_get_features, function in General API +
+
+
+cogl_get_modelview_matrix, function in General API +
+
+
+cogl_get_option_group, function in General API +
+
+
+cogl_get_projection_matrix, function in General API +
+
+
+cogl_get_source, function in General API +
+
+
+cogl_get_viewport, function in General API +
+
+
+cogl_gtype_matrix_get_type, function in GType Integration API +
+
+

I

+
+cogl_is_material, function in Materials +
+
+
+cogl_is_program, function in Shaders and Programmable Pipeline +
+
+
+cogl_is_shader, function in Shaders and Programmable Pipeline +
+
+
+cogl_is_vertex_buffer, function in Vertex Buffers +
+
+
+cogl_is_vertex_buffer_indices, function in Vertex Buffers +
+
+

M

+
+CoglMaterialLayerCallback, user_function in Materials +
+
+
+cogl_material_copy, function in Materials +
+
+
+cogl_material_foreach_layer, function in Materials +
+
+
+cogl_material_get_ambient, function in Materials +
+
+
+cogl_material_get_color, function in Materials +
+
+
+cogl_material_get_diffuse, function in Materials +
+
+
+cogl_material_get_emission, function in Materials +
+
+
+cogl_material_get_layers, function in Materials (Deprecated) +
+
+
+cogl_material_get_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_t, function in Materials +
+
+
+cogl_material_get_n_layers, function in Materials +
+
+
+cogl_material_get_point_size, function in Materials +
+
+
+cogl_material_get_shininess, function in Materials +
+
+
+cogl_material_get_specular, function in Materials +
+
+
+cogl_material_get_user_program, function in Materials +
+
+
+cogl_material_layer_get_mag_filter, function in Materials +
+
+
+cogl_material_layer_get_min_filter, function in Materials +
+
+
+cogl_material_layer_get_texture, function in Materials +
+
+
+cogl_material_layer_get_type, function in Materials +
+
+
+cogl_material_new, function in Materials +
+
+
+cogl_material_ref, function in Materials (Deprecated) +
+
+
+cogl_material_remove_layer, function in Materials +
+
+
+cogl_material_set_alpha_test_function, function in Materials +
+
+
+cogl_material_set_ambient, function in Materials +
+
+
+cogl_material_set_ambient_and_diffuse, function in Materials +
+
+
+cogl_material_set_blend, function in Materials +
+
+
+cogl_material_set_blend_constant, function in Materials +
+
+
+cogl_material_set_color, function in Materials +
+
+
+cogl_material_set_color4f, function in Materials +
+
+
+cogl_material_set_color4ub, function in Materials +
+
+
+cogl_material_set_diffuse, function in Materials +
+
+
+cogl_material_set_emission, function in Materials +
+
+
+cogl_material_set_layer, function in Materials +
+
+
+cogl_material_set_layer_combine, function in Materials +
+
+
+cogl_material_set_layer_combine_constant, function in Materials +
+
+
+cogl_material_set_layer_filters, function in Materials +
+
+
+cogl_material_set_layer_matrix, function in Materials +
+
+
+cogl_material_set_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_t, function in Materials +
+
+
+cogl_material_set_point_size, function in Materials +
+
+
+cogl_material_set_shininess, function in Materials +
+
+
+cogl_material_set_specular, function in Materials +
+
+
+cogl_material_set_user_program, function in Materials +
+
+
+cogl_material_unref, function in Materials (Deprecated) +
+
+
+cogl_matrix_ortho, function in Matrices +
+
+

O

+
+cogl_offscreen_new_to_texture, function in Offscreen Buffers +
+
+
+cogl_offscreen_ref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_offscreen_unref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_ortho, function in General API +
+
+

P

+
+cogl_perspective, function in General API +
+
+
+cogl_pop_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_pop_framebuffer, function in Offscreen Buffers +
+
+
+cogl_pop_matrix, function in General API +
+
+
+cogl_pop_source, function in General API +
+
+
+cogl_program_attach_shader, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_get_uniform_location, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_link, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_set_uniform_1f, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_1i, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_float, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_int, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_matrix, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_uniform_1f, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_1i, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_float, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_int, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_uniform_matrix, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_unref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_program_use, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_push_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_push_framebuffer, function in Offscreen Buffers +
+
+
+cogl_push_matrix, function in General API +
+
+
+cogl_push_source, function in General API +
+
+

R

+
+cogl_read_pixels, function in General API +
+
+
+cogl_rotate, function in General API +
+
+

S

+
+cogl_scale, function in General API +
+
+
+cogl_set_backface_culling_enabled, function in General API +
+
+
+cogl_set_depth_test_enabled, function in General API (Deprecated) +
+
+
+cogl_set_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_set_fog, function in General API +
+
+
+cogl_set_framebuffer, function in Offscreen Buffers +
+
+
+cogl_set_modelview_matrix, function in General API +
+
+
+cogl_set_projection_matrix, function in General API +
+
+
+cogl_set_source, function in General API +
+
+
+cogl_set_source_color, function in General API +
+
+
+cogl_set_source_color4f, function in General API +
+
+
+cogl_set_source_color4ub, function in General API +
+
+
+cogl_set_source_texture, function in General API +
+
+
+cogl_set_viewport, function in General API +
+
+
+cogl_shader_compile, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_get_info_log, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_get_type, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_is_compiled, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_shader_source, function in Shaders and Programmable Pipeline +
+
+
+cogl_shader_unref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+

T

+
+cogl_texture_get_format, function in Textures +
+
+
+cogl_texture_get_rowstride, function in Textures +
+
+
+cogl_texture_new_from_bitmap, function in Textures +
+
+
+cogl_texture_new_from_data, function in Textures +
+
+
+cogl_texture_new_from_file, function in Textures +
+
+
+cogl_texture_new_from_foreign, function in Textures +
+
+
+cogl_texture_new_from_sub_texture, function in Textures +
+
+
+cogl_texture_new_with_size, function in Textures +
+
+
+cogl_texture_ref, function in Textures (Deprecated) +
+
+
+cogl_texture_unref, function in Textures (Deprecated) +
+
+
+cogl_transform, function in General API +
+
+
+cogl_translate, function in General API +
+
+

V

+
+cogl_vertex_buffer_add, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_delete, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_disable, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_draw, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_draw_elements, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_enable, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_get_n_vertices, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_indices_get_for_quads, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_indices_new, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_new, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_ref, function in Vertex Buffers (Deprecated) +
+
+
+cogl_vertex_buffer_submit, function in Vertex Buffers +
+
+
+cogl_vertex_buffer_unref, function in Vertex Buffers (Deprecated) +
+
+
+cogl_viewport, function in General API (Deprecated) +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix03.html b/doc/reference/cogl/html/ix03.html new file mode 100644 index 0000000..65d3043 --- /dev/null +++ b/doc/reference/cogl/html/ix03.html @@ -0,0 +1,80 @@ + + + + +Index of new symbols in 0.8 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.8

+

B

+
+CoglBufferTarget, enum in General API +
+
+

F

+
+CoglFeatureFlags, enum in General API +
+
+

G

+
+cogl_get_features, function in General API +
+
+

P

+
+CoglPixelFormat, enum in General API +
+
+

T

+
+cogl_texture_new_from_data, function in Textures +
+
+
+cogl_texture_new_from_file, function in Textures +
+
+
+cogl_texture_new_from_foreign, function in Textures +
+
+
+cogl_texture_new_with_size, function in Textures +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix04.html b/doc/reference/cogl/html/ix04.html new file mode 100644 index 0000000..ebcdd9a --- /dev/null +++ b/doc/reference/cogl/html/ix04.html @@ -0,0 +1,607 @@ + + + + +Index of new symbols in 1.0 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.0

+

A

+
+CoglAngle, typedef in Fixed Point API +
+
+
+cogl_angle_cos, function in Fixed Point API +
+
+
+COGL_ANGLE_FROM_DEG, macro in Fixed Point API +
+
+
+COGL_ANGLE_FROM_DEGX, macro in Fixed Point API +
+
+
+cogl_angle_sin, function in Fixed Point API +
+
+
+cogl_angle_tan, function in Fixed Point API +
+
+
+COGL_ANGLE_TO_DEG, macro in Fixed Point API +
+
+
+COGL_ANGLE_TO_DEGX, macro in Fixed Point API +
+
+
+CoglAttributeType, enum in General API +
+
+

B

+
+cogl_begin_gl, function in General API +
+
+
+cogl_bitmap_get_size_from_file, function in Bitmaps +
+
+
+cogl_bitmap_new_from_file, function in Bitmaps +
+
+
+CoglBlendStringError, enum in Materials +
+
+
+COGL_BLEND_STRING_ERROR, macro in Materials +
+
+
+CoglBufferBit, enum in General API +
+
+

C

+
+cogl_clip_ensure, function in Clipping (Deprecated) +
+
+
+CoglColor, struct in Color Type +
+
+
+cogl_color_copy, function in Color Type +
+
+
+cogl_color_equal, function in Color Type +
+
+
+cogl_color_free, function in Color Type +
+
+
+cogl_color_get_alpha, function in Color Type +
+
+
+cogl_color_get_alpha_byte, function in Color Type +
+
+
+cogl_color_get_alpha_float, function in Color Type +
+
+
+cogl_color_get_blue, function in Color Type +
+
+
+cogl_color_get_blue_byte, function in Color Type +
+
+
+cogl_color_get_blue_float, function in Color Type +
+
+
+cogl_color_get_green, function in Color Type +
+
+
+cogl_color_get_green_byte, function in Color Type +
+
+
+cogl_color_get_green_float, function in Color Type +
+
+
+cogl_color_get_red, function in Color Type +
+
+
+cogl_color_get_red_byte, function in Color Type +
+
+
+cogl_color_get_red_float, function in Color Type +
+
+
+cogl_color_new, function in Color Type +
+
+
+cogl_color_premultiply, function in Color Type +
+
+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+

E

+
+cogl_end_gl, function in General API +
+
+

F

+
+COGL_FIXED_0_5, macro in Fixed Point API +
+
+
+COGL_FIXED_1, macro in Fixed Point API +
+
+
+COGL_FIXED_120, macro in Fixed Point API +
+
+
+COGL_FIXED_180, macro in Fixed Point API +
+
+
+COGL_FIXED_240, macro in Fixed Point API +
+
+
+COGL_FIXED_255, macro in Fixed Point API +
+
+
+COGL_FIXED_270, macro in Fixed Point API +
+
+
+COGL_FIXED_2_PI, macro in Fixed Point API +
+
+
+COGL_FIXED_30, macro in Fixed Point API +
+
+
+COGL_FIXED_360, macro in Fixed Point API +
+
+
+COGL_FIXED_45, macro in Fixed Point API +
+
+
+COGL_FIXED_60, macro in Fixed Point API +
+
+
+COGL_FIXED_90, macro in Fixed Point API +
+
+
+cogl_fixed_atan, function in Fixed Point API +
+
+
+cogl_fixed_atan2, function in Fixed Point API +
+
+
+COGL_FIXED_BITS, macro in Fixed Point API +
+
+
+COGL_FIXED_CEIL, macro in Fixed Point API +
+
+
+cogl_fixed_cos, function in Fixed Point API +
+
+
+COGL_FIXED_DIV, macro in Fixed Point API +
+
+
+COGL_FIXED_EPSILON, macro in Fixed Point API +
+
+
+COGL_FIXED_FAST_DIV, macro in Fixed Point API +
+
+
+COGL_FIXED_FAST_MUL, macro in Fixed Point API +
+
+
+COGL_FIXED_FLOOR, macro in Fixed Point API +
+
+
+COGL_FIXED_FRACTION, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_DOUBLE, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_FLOAT, macro in Fixed Point API +
+
+
+COGL_FIXED_FROM_INT, macro in Fixed Point API +
+
+
+cogl_fixed_log2, function in Fixed Point API +
+
+
+COGL_FIXED_MAX, macro in Fixed Point API +
+
+
+COGL_FIXED_MIN, macro in Fixed Point API +
+
+
+COGL_FIXED_MUL, macro in Fixed Point API +
+
+
+COGL_FIXED_MUL_DIV, macro in Fixed Point API +
+
+
+COGL_FIXED_PI, macro in Fixed Point API +
+
+
+COGL_FIXED_PI_2, macro in Fixed Point API +
+
+
+COGL_FIXED_PI_4, macro in Fixed Point API +
+
+
+cogl_fixed_pow, function in Fixed Point API +
+
+
+cogl_fixed_pow2, function in Fixed Point API +
+
+
+COGL_FIXED_Q, macro in Fixed Point API +
+
+
+cogl_fixed_sin, function in Fixed Point API +
+
+
+cogl_fixed_sqrt, function in Fixed Point API +
+
+
+cogl_fixed_tan, function in Fixed Point API +
+
+
+COGL_FIXED_TO_DOUBLE, macro in Fixed Point API +
+
+
+COGL_FIXED_TO_FLOAT, macro in Fixed Point API +
+
+
+COGL_FIXED_TO_INT, macro in Fixed Point API +
+
+
+COGL_FLOAT_TO_INT, macro in Fixed Point API +
+
+
+COGL_FLOAT_TO_UINT, macro in Fixed Point API +
+
+
+cogl_flush, function in General API +
+
+
+CoglFogMode, enum in General API +
+
+

G

+
+cogl_get_option_group, function in General API +
+
+

I

+
+cogl_is_bitmap, function in Bitmaps +
+
+
+cogl_is_vertex_buffer, function in Vertex Buffers +
+
+

M

+
+CoglMaterialLayerType, enum in Materials +
+
+
+cogl_material_get_ambient, function in Materials +
+
+
+cogl_material_get_color, function in Materials +
+
+
+cogl_material_get_diffuse, function in Materials +
+
+
+cogl_material_get_emission, function in Materials +
+
+
+cogl_material_get_n_layers, function in Materials +
+
+
+cogl_material_get_shininess, function in Materials +
+
+
+cogl_material_get_specular, function in Materials +
+
+
+cogl_material_ref, function in Materials (Deprecated) +
+
+
+cogl_material_set_alpha_test_function, function in Materials +
+
+
+cogl_material_set_ambient, function in Materials +
+
+
+cogl_material_set_ambient_and_diffuse, function in Materials +
+
+
+cogl_material_set_blend, function in Materials +
+
+
+cogl_material_set_blend_constant, function in Materials +
+
+
+cogl_material_set_color, function in Materials +
+
+
+cogl_material_set_color4f, function in Materials +
+
+
+cogl_material_set_color4ub, function in Materials +
+
+
+cogl_material_set_diffuse, function in Materials +
+
+
+cogl_material_set_emission, function in Materials +
+
+
+cogl_material_set_layer, function in Materials +
+
+
+cogl_material_set_layer_combine, function in Materials +
+
+
+cogl_material_set_layer_combine_constant, function in Materials +
+
+
+cogl_material_set_shininess, function in Materials +
+
+
+cogl_material_set_specular, function in Materials +
+
+
+cogl_material_unref, function in Materials (Deprecated) +
+
+

O

+
+cogl_ortho, function in General API +
+
+

P

+
+cogl_polygon, function in Primitives +
+
+

R

+
+COGL_RADIANS_TO_DEGREES, macro in Fixed Point API +
+
+
+CoglReadPixelsFlags, enum in General API +
+
+
+cogl_rectangles, function in Primitives +
+
+
+cogl_rectangle_with_multitexture_coords, function in Primitives +
+
+
+cogl_rectangle_with_texture_coords, function in Primitives +
+
+

S

+
+cogl_set_source, function in General API +
+
+
+cogl_set_source_color, function in General API +
+
+
+cogl_set_source_color4f, function in General API +
+
+
+cogl_set_source_color4ub, function in General API +
+
+
+cogl_set_source_texture, function in General API +
+
+
+CoglShaderType, enum in Shaders and Programmable Pipeline +
+
+
+cogl_sqrti, function in Fixed Point API +
+
+
+COGL_SQRTI_ARG_10_PERCENT, macro in Fixed Point API +
+
+
+COGL_SQRTI_ARG_5_PERCENT, macro in Fixed Point API +
+
+
+COGL_SQRTI_ARG_MAX, macro in Fixed Point API +
+
+

T

+
+CoglTextureFlags, enum in Textures +
+
+
+cogl_texture_new_from_bitmap, function in Textures +
+
+

V

+
+CoglVerticesMode, enum in Vertex Buffers +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix05.html b/doc/reference/cogl/html/ix05.html new file mode 100644 index 0000000..1eb673c --- /dev/null +++ b/doc/reference/cogl/html/ix05.html @@ -0,0 +1,130 @@ + + + + +Index of new symbols in 1.2 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.2

+

B

+
+CoglBufferAccess, enum in Buffers +
+
+
+CoglBufferUpdateHint, enum in Buffers +
+
+
+cogl_buffer_get_size, function in Buffers +
+
+
+cogl_buffer_get_update_hint, function in Buffers +
+
+
+cogl_buffer_map, function in Buffers +
+
+
+cogl_buffer_set_data, function in Buffers +
+
+
+cogl_buffer_set_update_hint, function in Buffers +
+
+
+cogl_buffer_unmap, function in Buffers +
+
+

C

+
+cogl_clip_push_rectangle, function in Clipping +
+
+
+cogl_clip_push_window_rectangle, function in Clipping +
+
+

I

+
+cogl_is_buffer, function in Buffers +
+
+
+cogl_is_pixel_buffer, function in Buffers +
+
+

M

+
+cogl_material_copy, function in Materials +
+
+
+cogl_matrix_get_inverse, function in Matrices +
+
+

P

+
+cogl_pop_framebuffer, function in Offscreen Buffers +
+
+
+cogl_push_framebuffer, function in Offscreen Buffers +
+
+

S

+
+cogl_set_framebuffer, function in Offscreen Buffers +
+
+
+cogl_set_viewport, function in General API +
+
+

T

+
+cogl_texture_new_from_sub_texture, function in Textures +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix06.html b/doc/reference/cogl/html/ix06.html new file mode 100644 index 0000000..23e204a --- /dev/null +++ b/doc/reference/cogl/html/ix06.html @@ -0,0 +1,296 @@ + + + + +Index of new symbols in 1.4 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.4

+

B

+
+CoglBitmapError, enum in Bitmaps +
+
+
+COGL_BITMAP_ERROR, macro in Bitmaps +
+
+

C

+
+cogl_color_init_from_4f, function in Color Type +
+
+
+cogl_color_init_from_4fv, function in Color Type +
+
+
+cogl_color_init_from_4ub, function in Color Type +
+
+
+cogl_color_set_alpha, function in Color Type +
+
+
+cogl_color_set_alpha_byte, function in Color Type +
+
+
+cogl_color_set_alpha_float, function in Color Type +
+
+
+cogl_color_set_blue, function in Color Type +
+
+
+cogl_color_set_blue_byte, function in Color Type +
+
+
+cogl_color_set_blue_float, function in Color Type +
+
+
+cogl_color_set_green, function in Color Type +
+
+
+cogl_color_set_green_byte, function in Color Type +
+
+
+cogl_color_set_green_float, function in Color Type +
+
+
+cogl_color_set_red, function in Color Type +
+
+
+cogl_color_set_red_byte, function in Color Type +
+
+
+cogl_color_set_red_float, function in Color Type +
+
+
+cogl_color_unpremultiply, function in Color Type +
+
+

I

+
+cogl_is_texture_3d, function in 3D textures +
+
+
+cogl_is_vertex_buffer_indices, function in Vertex Buffers +
+
+

M

+
+CoglMaterialLayerCallback, user_function in Materials +
+
+
+CoglMaterialWrapMode, enum in Materials +
+
+
+cogl_material_foreach_layer, function in Materials +
+
+
+cogl_material_get_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_get_point_size, function in Materials +
+
+
+cogl_material_get_user_program, function in Materials +
+
+
+cogl_material_set_layer_point_sprite_coords_enabled, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_set_layer_wrap_mode_t, function in Materials +
+
+
+cogl_material_set_point_size, function in Materials +
+
+
+cogl_material_set_user_program, function in Materials +
+
+
+cogl_matrix_equal, function in Matrices +
+
+

O

+
+cogl_object_get_user_data, function in General API +
+
+
+cogl_object_set_user_data, function in General API +
+
+

P

+
+cogl_program_set_uniform_1f, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_1i, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_float, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_int, function in Shaders and Programmable Pipeline +
+
+
+cogl_program_set_uniform_matrix, function in Shaders and Programmable Pipeline +
+
+

T

+
+cogl_transform, function in General API +
+
+

U

+
+CoglUserDataKey, struct in General API +
+
+

V

+
+cogl_vector3_add, function in Vectors +
+
+
+cogl_vector3_copy, function in Vectors +
+
+
+cogl_vector3_cross_product, function in Vectors +
+
+
+cogl_vector3_distance, function in Vectors +
+
+
+cogl_vector3_divide_scalar, function in Vectors +
+
+
+cogl_vector3_dot_product, function in Vectors +
+
+
+cogl_vector3_equal, function in Vectors +
+
+
+cogl_vector3_equal_with_epsilon, function in Vectors +
+
+
+cogl_vector3_free, function in Vectors +
+
+
+cogl_vector3_init, function in Vectors +
+
+
+cogl_vector3_init_zero, function in Vectors +
+
+
+cogl_vector3_invert, function in Vectors +
+
+
+cogl_vector3_magnitude, function in Vectors +
+
+
+cogl_vector3_multiply_scalar, function in Vectors +
+
+
+cogl_vector3_normalize, function in Vectors +
+
+
+cogl_vector3_subtract, function in Vectors +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix07.html b/doc/reference/cogl/html/ix07.html new file mode 100644 index 0000000..9d8d50e --- /dev/null +++ b/doc/reference/cogl/html/ix07.html @@ -0,0 +1,74 @@ + + + + +Index of new symbols in 1.6 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.6

+

G

+
+cogl_get_source, function in General API +
+
+

M

+
+cogl_material_get_layer_wrap_mode_p, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_s, function in Materials +
+
+
+cogl_material_get_layer_wrap_mode_t, function in Materials +
+
+
+cogl_matrix_copy, function in Matrices +
+
+
+cogl_matrix_free, function in Matrices +
+
+

P

+
+cogl_pop_source, function in General API +
+
+
+cogl_push_source, function in General API +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/ix08.html b/doc/reference/cogl/html/ix08.html new file mode 100644 index 0000000..debda69 --- /dev/null +++ b/doc/reference/cogl/html/ix08.html @@ -0,0 +1,38 @@ + + + + +Index of new symbols in 1.8 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.8

+

M

+
+cogl_matrix_is_identity, function in Matrices +
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/left.png b/doc/reference/cogl/html/left.png new file mode 100644 index 0000000000000000000000000000000000000000..2d05b3d5b4aeec9384bbfe404bfc4ed0897051c4 GIT binary patch literal 459 zcmV;+0W|)JP)40xL?wO*>WZ(J#ML5j2<9jD6A%Q&kC}jOeEc;X{s;`zcnxLeZR6?6h#^ihmNF6NpGdilO$m<82oD9WQ|6nVv1`? z>KufRi{?QPXg;4;wroQu4?mN1Ydd@|kaQ|ZyWLK!)yi7Wb%=0{}lD)tfliHAUyWRQ+fD_;aV6j->y6!O_8bENg + + + +Appendix A. License + + + + + + + + + + + + + + + +
+

+Appendix A. License

+

+ This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General + Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. +

+

+ This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for + more details. +

+

+ You may obtain a copy of the GNU Library General + Public License from the Free Software Foundation by + visiting their Web + site or by writing to: + +

+


+        Free Software Foundation, Inc.
+        59 Temple Place - Suite 330
+        Boston, MA 02111-1307
+        USA
+      

+

+

+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl/html/quad-indices-order.png b/doc/reference/cogl/html/quad-indices-order.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d95d48777358e396de9c58b4ca990cdb46c12 GIT binary patch literal 2620 zcmeHJc~sJS76%kj1Cz4cN)a`)%ndaPuu@de)Jc1lxlt-eE>I|HEi+|4z8yuaqp`EUN3?>YD0bGLKuxu0{-=X?2YL4F8* zGkp*UgdmfMAsXAMk>7N6G#VdV_DN&3SzhGBx|)}z8_U!9dQ4InOH<$Tmw>&t-%i&A zO;dc1rGzr5DQPFp#DUV%(j4i@39OhC%s5BJ8QSe}yqTu4kxV>rIK52WpK&!Z&XhAX zy!E&})F>?W5L@^Wm4DGz_qg_k8}Xo45Yo`6zQHD*w02q#jL_L=bqf`*tz}>3d-;yT z@l8gBLX@t)?fLV%jwn=I((+Qro~}KZ@-IgQ_>G|z(XL!*B~dgnJ{Js)$`)>&H21AH^dlX44w#C+1g;<;EGvmQ0(n5L=S3lwOpc)Au8xWkvk8u(|;X2`R=g*VUY$U6O!;wVJ?MH! zGw-hxN|%U42T(GETIc-~6hN;iQo|Gb`7K5t8P4~)-@)B5QOx!`wg8*om`xogv*K}* z8Po$}`|0B8UQ!ndT@MzW*na0FAm=wGP%W{z6lz4`2ZPmO)t;fBU0Jrw4BE(u`(V<; zi7{=w56d;lbn=m&YOptKKu0iqVL4UDn3lO>)-fcXZY8MizwdCJ0aJ2_QgFRoT55MJ zE>Auk`gTjvcQstZ&dD-5_sxN^8EHQMtTsgQT561$X`NCL+f{Ie$|K%OA;v6_)|-dx z;JZu(Jxn&0OSRhU+!!~L2r6>ZFB3bS|L9PEJMZ%6F6O%nTM@haBkl7#~p~2V1!6=KhsWT z*jwPTdO$gf6n_)8feg#_c4qbgMA~;@U28U=2Y`XoZVW{WTnhd>EcqIbP?d3NK4MvG z?^;mo3;A>{6z4EkE?r3-?j3~Wqlaz-1@S?hNd_w@v_PDxu*qSW)v1jGFxh!voGXGLqY^9rQ|S*JPP9ZKXU#DQ9>33kodHLelNpoNSla)QX6ed{WmA zwCDP=e$(T=UBG8IyCId!dl-q0-@R!5u}E`eWqfc#&E@m3H&qvM z>dk11E+CAb@%5KE-vL8&5B&|u^)>0eMN%SRPtmrb6>xY3tAtcvk(=GR@lA}+vOBXf>ma)RGOeoVo z(>Az~yf2~0cXpRjNbWCm6HkEbf_)E$B0KTGe8qbwHho`M-TTAMzE>_kAcayxRxKX< z+r3jaz%<7x&y7ERe^GLE+lQ2kB{4rrO+)H|4Sm(( zb>LYNf6o?+`fS8*dgR$jTQ)#2*EHH^eZU9jwZR+@~o;h>wt!zy4$5$ z(1ypD=b7`o6!*#R>V4!-K=9(`bzQlN5*+6H%lMu+hf*0 z?Q@|gZ9+~|?b+ipa%3?6M)!WA6zZs>6Fq|mMI@0z3eYD#CbKCM?0C)HQyq8PJcJ=# z@>PL~`P5tu$I6@umUo>r%197p?J^otK-vI8itU+D*$%%a6xD_7kcFa1$ygEhI;znH^OvBu7- iLUDTR^7K~=tFVxb$A9t|_ej$G^gv{vAfm{Na{f;SUWiKo literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/html/quad-indices-triangles.png b/doc/reference/cogl/html/quad-indices-triangles.png new file mode 100644 index 0000000000000000000000000000000000000000..18c42c845ed165d3b15dbd431f905be823416276 GIT binary patch literal 8018 zcmXw82|UyP|KH4zGs%5tqH?y8ifK8roRyL!d@;#LlKa|xBloO>k)s;A97W`wq){81 zkX&MLlAl^duTjZ!{x+Wic{QJ+JFrVw+ zJ7={!h9hySv+Lpc#$7{8c>|jxL&Kq+jQdL_dy_i#DxowRGI}bwq|nU+*Ggc1U4y&XC{Iy|CXvDHU+pFj>u z8_CNIwMC{uLrBYZS8e&z2o$E^hOFtMa~udqqXMO;*Z&7nQAX`z9Tq0~wlWNPEMfl6 zJy|p%+8}Kg4PQH~3_F*#tX~V$tDJ*Lvo6WF!OQ58687INxkt05kn)bJqX^9uKVRL{ zt582^<;e@8%^OBLw;Z6)q4)0%dF-@N$5k8Ykynm{%2$x6ZR(|aeM8)x*o`)BN=C8o z7sz^*W2P<=N&~jb&!JB=rsB988H36Qz6}%c?Y38RRo{ zu7(ysQ>-KQ-R)AzzQCBd;!dBTpCFuFGSIFW#nB$m&~@V;kpH+od7Sw1lFSL1saDf1 zsyt!tdyc3<<>CL9{CL%a90S(xU$`k=ys=r%j8Wj-cwC+aZ>jnRhh&RM9Z+z5rpIGd zC&}?!nKjW>ox z;FwL$-g(hK6<=*P2tiK9d4rdDH+K0-x)(oRIE;<`@y#Nj-JdQ^t#u}>Bx-kAN7UwS z(#NtsL4iWy|88ZT$@QTp5@LdC<3w1fWqL?iK`7_wM8kV>+ zZshf)lu!M(Zu;$rFq@d>@=qVFcT(M9>{Wv=CwTa+B5GLO@2a9P=nifo!aKHpnob9o zr@tLVU&cwzP@|D->4D7?g>^zqz}>Im71g4shOp+6w? z6RkZ>H2dX9sF*j>PbPcE-P}x*=tX0dnoVCtVg9cqF;aF}BAr1Rj4AJFBo;z5gMA)M zA4JMShjd;X6mq^TuKMN2Ka7vR2^ioae}ZquJ~vWgJ?jO?!xuJC?gWH;K{ zpQ~S^=tlacz6A;BR8m4Z1swgef@wa+a;2%&7QY&tGD1!GnM9Rt#BdME@9!VaHjGCPp(8Lo1Vn;0>bij~1cHk^y5yYfY4a#5{ixjNr|{i(;>azSv5x z8oe5WW#vZu>j@NR4igHz2SZ^d`_f0>``hDTvmFM)U43cO$z!!Yrw*g^opU0;&Rylm z$-BO=4p^^7>r3+f@~{brd`)5YPUpu_m|{^H{iqk()?-iJ{$f~4>w7s{ei^AP{!!9- zwL9)&=HQVyBL~U z(0aZ%?(Ay8%ij7J>-DOZB=Wo6t3o;HKiW@Q#f2028Ti@_QC#)Dku%RzZ#G!6gr>Fl zT0W^xU*BNWz4?X4bI zLk+tcX_luH*7{C!Wgj_>A8OQqz&6>|L6l;?Sss$QZh zG!->oDX34Q+DifMtRbtg>)%7}3rCsL0|n!v)m#urA@w4kU*#qm zV!HLb!YfVRO5gl(MQhH5mZ6?@KM3#P+h;NV%cXyI5`Kv%{mydzr3g_u65gUiap7}u z+rsT}Yg#4kE_rr({PXaXOujttlb!R{*gVk#s7mMg+MdxjiKWqs&HH2cUMp@z#eN#g zzA!z8tLCZLhn~H5gnfA90aFuO@NLCqr%bmiE1Qz8dUtvxPm{s-p=iQPYVqIm_%=`)xEdOM9wSC>l2xGDViCq*M|;!*6co#cP`EQB)Cl#-v{&Az;tX>m$L$(-hWl71#LU?Tl`Hv8uN5S@n?lq(NY)bT@SLG_%=l(mT zFv^=eU6){5Q9H=^_M|nE*Ea6{8N!WenVbB2Vu2YHMM=Lre&#Wg?-WTL{?8YAEbomQA*EiV&TWfAG~k$c^b){SDwRuOHwiuA`iP=l;)T|l^*{h zlbvnSzJr)REn8Knl->OSCbpY8rC+5&Zo0FKj5?0FX1ffZC#Ar8jtUWHpRB`Vv0E)A z%K5+*&oP$r!aN!D`_908itANe+wXOZ!~W=nDmkp1)sbEH3*j{?P7%WV%WaYTX-U*9 zg29xLPU)L!8ZXjiZ|O6Ysr%@C>5_;vzH_t*&XO=sXNHoQpXxLc%Rh#^^2doJ4SVMe zmBKh2iN2r!MQlo(&r2uNNmj#^(turN(UDStjZzhnchb(ypBQ{j%CfxEQ%mClD${4M z>tlX*qRx|~`IYo5UC)H=kb_~ncn-j_`bnX5Q;C$l29mso$-C)-SUYvF&3R1(&BV*gQ}t{w9&?>wwu$^6vD=~&6$myH$w|3 zk2%ylZ&H~`Kb`Ce$7VsEji(&`N|Am2kV$ zI~_t+YE4|N%k1GGZEK#Ny|;t(zw<* zUBSiuVPS2ntfNBjkF$)T&M|+&JLb<<)idz3Phs(eb|~{}&sC=J?0U{Ww&6Jb0A%HD z=JN-}{LzWj(D{8Obca0gTB%IV?qyXGr^^VFe-oWj_gN*xVrLIl)|E+$qja3dd%6g} z=5KypVx(xGH&MF^h!H)3ZQ?2}s2DRg?^EQSem@7{7eJA;-Bplt-)egQB^8u zcNLVSye%m_gtEBy?>^bgM3@U?PIB@=ScXUQ;qqJ zeICtYCM1Md%QQI7ki}>sk2pK|3h3gSkad;Z(JzTxlPiFi9xt zsS|u}&icg}nrW7%T15#KClza@>#3^+xw&hw9}ydP^+p&We_^pj`|j>`$}IhDiTl&b zU&ha4SO#IdUwYuamh6+rdZP&8QnP!UD)|ZxZW)Nhx&R0HZ_I+rpQz5kjlFO}CEG}} zUI_o)we2dxyjc_2pvhGd6}t1jm`h4?`gjVswG=s@raUt2$aPg{y=Kd;{GJUDW(wR_ zAh42>=Z)j`_0rFzyT!eYZwJ@+*(m+;O278piTHPkMcc*r$VpC=5M-&a zop2%kz_+Nj3-FyWrssZuy-94?iT)W_u-r*}Nm|}jAs6T&5`NVEI7kDZwkrVonhE;y z#tS0KWZn;1|Am1&3CJT}OD!nY_)l47YP&1w<D8>B z>?wk9y&0>Tzt0K@b;=zOK<1(wD+`5R0&j%Iq}29%s>z-jRuQ|Jsdd!}4Z43Sa1W}= zhzB!+cg!oYZxS6lZW(JF+_NrrN}>K37{EgyE02z-1<8zfel`Z@Xdz6}O&jWK6E-~e zsJ$HB+4h3pN{*llT|14*fxm8JblysB@58Xx$<^;B=72@PuC^D6RylF2QYZRJu|#{5 zjSGJv$6sJIe+Bc@%RFBp$)0JwF;>ijog1(8Nv8sDH`v#ZE{AGg6rvC&srD9tvt?GsXGt#PKTXui4|PDAGR@Y?W5;qMMPtokGYcl&(wB06Q2f3dP&@k z?Q710g=LK86F>3Yzr{b@nK^XcK@jj9mbMn0FCK30Wo`%}jU-SHE$Fs(IMQ89Ge)!B z47Obl#}}ZKwX9$SH^?Ip%Hdn%pRHdiwO-?R_a24+{z2Qsg&T37p2}PH6EI=J< zL+)_`kk8)#(5P<*Hk56WkSN3ora9w6Dk&n^?cy&?3%Coh8;QodIhB;3Ss)-!U@VR; zXPX`EELFXlBqrykQ~IpX1~Gin(4$aAghvPD^c^T{UgmNw)hy0GPE2s|4XqVd?ey2X zM!xvrhY1aeN|#>-gXD&qUz<@w4F7A7jC`oVgj~eqoN@+Ixls8lrVF8MsqO0XRt@d9 z@G1|DR#eIP^pe}I7tBUvw~lLN_MLUuOST+OvbUF{0t-E0p$}R*pBCWgW3H3tcG@4@ z*+Gt+|4wMK*I?3Q!9|x#Tf39SvjwnDkOQzSO)EEOnL(ux1MdJXC~LK5#prKqZNAsqea3^qr&Ljck+ornZf!^#wYaEf&>C@Q}PsLGr#U^)93mQ zp+RXr@NkQ$xcTD0kk{WB8`d_MG>dzITlodxtC_B@I?ZF;@%<|ibpYKqgF?!a{>Sb2 zXdaFl=xF|e!hJ=J)fNHEpETRh z$g;U7UMm~8d)^y!Nn%d_dER#5N^k6QJOxk72Wsi<1&xxgnJ#kdo_M%ih3NbROuoFB zjmh5eG9Y|cq4GQ$T+J1YVWpR+6Vpyj^r92b= z4KUY1z{6rCA(oRw4uYs$6xwGBEZJ6T(iMDxmqfz-+=&$J+`p(8i+`sfMV%%HG4Wnr z<|`m{TW;uj725O7#0E_z$BGl%kc<#72njnS5*`WKrr-P;eh*?eZdK;b1ri^uS-0#2y+M%98V2k$ZHXsm}4GA}ia-If5rGSO&D3Cwb!G zMHE*B*~~NcyXkw)!CY4ltB2hdTs+8$ZujSgyeCUM+*Tx9m;Ipq*8L;kEPb*LIIBS0 z3OwOCRJo+4_VNaZHI!!sj@EAfFd>`iQXJZMAKWhpu_=;qr2aud6l6Y*qD|V4R_Bd! zU&DD)0_0HcfHP1N6R?g!$$vC_UDzsM6mojQFL3q#wiNFj7n`%}C5gdjGg8~jK=v|7 z!D#f}MK`#wp?ei2Pfj+oG@iPO@P{gJCFd!}@e@!~KT*(HNJJWaPIvemNjSrz9;^n~ z04+@stk3uvF+XqfkpP^ArKOj_f-*}ibJ@*Zf_)h{P6RW_Sdu?neb00k2fH*2s7--? zNLDse5qP%m0HO--gJ05ZUt*iIKiV_?)|5&Z5 z0k&!atk#LF{K1@gwynls_T$6vXmBGP0FWpSJ%>J};Ib2|3l51rYc?WPklSdptr~T3 zQ(yEsQZc_}_J9G-@JxiySMjzN7MaTwDvY4a?KPSF*-97g1t$;g(JfP*ivz54x9@B? zDDpMLrf5O#W(^S~^P0iXN!u1G4e|;!q!>hoHC78MS?**>wCNvXRfg4deKnXICY)g4 zKT?Z{r!#{M(7IdGM3h9}U5cw0uBRmQUb<#F6ik7OiL`vcZ81X4Vzst^(Jv_WQPJ6K zMBXjm6KE?-96W)EqgoT@AYiE5UN44j)n8Er*-|8IKF$+A{E<;@HTQfjX~_i!GeGfl;d;`!yx7YH_`Bu~Jl3+8lGn1}UFC;yenDe4IoTL-@lsWH=2f<;1S1 z1A5!?ya`vHz3wOSThIMDg_+fNmTNk-3){@w$9rj?RV6GIRe1(<k9pa>q4SEj#${{_$g^#c!m$8MaXoP^One`A90Q=upqFcn=(I15rG#%H8Y@RY zB-wirjeO5VHi%%NwVhwMdSLG%sXGbOqYJmcwZeT>0uw01EF0O(Qws6Edq3RT*jI6Q zJ^-VXOn2o9EfB3sK%l#xs9qHXn_NQC4FiAkYr+v})Q=oa%?|G7OQ5*=;oP`F4Z{{# zAKCpm2ROPJm&m|_8Lt>r9ODY+Jaqi{8@a_0un=4Y%jcbBYVHE%T!u6tMz`F7-n9GT zvYB0qb&=Z-M*&9}fPl~#7BWnUeU~e_ub5DysC-4)tjj#O=aCU# zbOJR){b#bzR`h97R%^kbKy7;0MpKUvcVqagw}7O? z)cwU~#G=lT62X4QLUIqpl9rABOfG(tTT~4j>h1sQ_$EgnF-wr8g*wKKLq(Q6l2v68 zs0sFk(U$LH0bKEwBJX84wtY01Y@L6SSmXs5LYS;Jtq>*E_6(>j+Yov5#lS=vF<))k zHEM;C33{k3p#ary{qq1i4ztfHLZ%=w(g$+|mJWNDJ#g{=l`_4nKekk*YsZiWj$UHy z3l0VA!C)Bq!vc4Bi(i#FXTMFMVr(_pS#2wS+K#YH8#1>dns>Ek|3iSswoKxN0oWLh zZqKuz3xCC(d2APTA;WwdI0?sC!yNCGcrKjkC}~%UUq34h_0nK^E*wY+6ZF1rp z(Q2S+^tglHwsPF^Q@=dDRd`T8qPvHxx?a_b5 z`2a^S`+ISe+wJ76|_i z41-B~^*9gXrpJ*x@3c&i@97SjJLuq6qS@itjNbKECBCO? zsNy(7S&m2ECNIXmwrbs#_$QqzzxLm&k|*C~cro3hNe_%MJ9!O2>+)hgc;I>{&RO== zk-^UXxF75e88PgdQ{Dy~GpvVfExD_mT%NUwnok~YItB51P#ZahER}*wLHO91di${+ z@vhq_bxOnF_+{JysMtg!<7egFuf#&t_CEQ;BAX?1BuJY_(KX7rFQgVGrUpY#;8&PmwrpS|;HQ{XWpU&hAf;$`)|_x=UL z&K}^Y5a0ZVi#>v8k{?k@2|mTH&?t33r9{(?9Yo82!UEPWVhcj5Jy(_&US8~}XgVl~ zQW$0Wn|_JkRPOQ@`!IUFLDEfEY9pU1OZ&))rWZv_=n4F1QB7mX)fP90R$onzovdzl zb~}MlBS+h<@P1?dv7Ku1_$^a~eWlcH^Y&5UY{v+-1|44*V3l)!SUHD(tK0Nre5+Ku ze=|$t9WmiJ%gdeNs8k&k5E<2Eln(36TBctD4;|5n`qY@i>-`dao&Fi+&5sHPI_zFY ze#`li@`yTDRI{5mI)x$vt7aN()@tcu%&znO?7A?*UzS$ei)mJue~%=t2ot_9@J_2_ z6Df)!GxzDy^-ySby?ei`|)BVLMU#2a1-h+*2+tVac8QfQ7r4M%VSY z_#oygB=fJtZBXP&6$;oh7#r10kF`(Do+;J(;8mN$u?QKFl z!qp-FSz%_oU4G5@0qJu_@*HgGP#56c9#7n}apkpv%Hj-yBBG5|3f1#2{V_gwHS&Rc7pjQS-p1@OUoBo`n=Zj$-ScJevTRw@sn=i*BT^ zbSQ{BlPxDc$BDiN2a-st?-XnH!EGENM}Is!ZBZ&^hRD1Nl(jR45;w@EGIyZr2CTJdV#geOD(hB$t*(P^~TSfg5Hg zPXIZwrAKfgS|z_s#r$e9evy8|ufpc4n+muj-kcoTEl~!UooQQGi#@-BjZkS({0%<; OhF~r1%*&3u6aNpuN&@u& literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/html/right.png b/doc/reference/cogl/html/right.png new file mode 100644 index 0000000000000000000000000000000000000000..92832e3a4566e59d6e4092010e08d28f3be3a68d GIT binary patch literal 472 zcmV;}0Vn>6P)Cd4HCN^TYHBC0dz3r5|}*T3c5!K}0^NPTey!^rYo;W&eW{b1SE%dR-1ljcju- zJITo5P_e{cPDWDszO|97o#m$fni3V4d%~7^?0HU4-k!+X`e~w55Q}HA=c?CM9`EK` z^o5GF_RsnG`ey+9wOf8O4bzg>7W*;jU~M?g`OZAA$mNp|Lz<$s+~N9!2`ir8RcClo$(Q~19INM~9}j;&*|enC yGd}kJak0wj?aUKd8;%}`i}SSew>!A-2iw}^5}Rh(M>+vRkipZ{&t;ucLK6U4uc96R literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/quad-indices-order.png b/doc/reference/cogl/quad-indices-order.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d95d48777358e396de9c58b4ca990cdb46c12 GIT binary patch literal 2620 zcmeHJc~sJS76%kj1Cz4cN)a`)%ndaPuu@de)Jc1lxlt-eE>I|HEi+|4z8yuaqp`EUN3?>YD0bGLKuxu0{-=X?2YL4F8* zGkp*UgdmfMAsXAMk>7N6G#VdV_DN&3SzhGBx|)}z8_U!9dQ4InOH<$Tmw>&t-%i&A zO;dc1rGzr5DQPFp#DUV%(j4i@39OhC%s5BJ8QSe}yqTu4kxV>rIK52WpK&!Z&XhAX zy!E&})F>?W5L@^Wm4DGz_qg_k8}Xo45Yo`6zQHD*w02q#jL_L=bqf`*tz}>3d-;yT z@l8gBLX@t)?fLV%jwn=I((+Qro~}KZ@-IgQ_>G|z(XL!*B~dgnJ{Js)$`)>&H21AH^dlX44w#C+1g;<;EGvmQ0(n5L=S3lwOpc)Au8xWkvk8u(|;X2`R=g*VUY$U6O!;wVJ?MH! zGw-hxN|%U42T(GETIc-~6hN;iQo|Gb`7K5t8P4~)-@)B5QOx!`wg8*om`xogv*K}* z8Po$}`|0B8UQ!ndT@MzW*na0FAm=wGP%W{z6lz4`2ZPmO)t;fBU0Jrw4BE(u`(V<; zi7{=w56d;lbn=m&YOptKKu0iqVL4UDn3lO>)-fcXZY8MizwdCJ0aJ2_QgFRoT55MJ zE>Auk`gTjvcQstZ&dD-5_sxN^8EHQMtTsgQT561$X`NCL+f{Ie$|K%OA;v6_)|-dx z;JZu(Jxn&0OSRhU+!!~L2r6>ZFB3bS|L9PEJMZ%6F6O%nTM@haBkl7#~p~2V1!6=KhsWT z*jwPTdO$gf6n_)8feg#_c4qbgMA~;@U28U=2Y`XoZVW{WTnhd>EcqIbP?d3NK4MvG z?^;mo3;A>{6z4EkE?r3-?j3~Wqlaz-1@S?hNd_w@v_PDxu*qSW)v1jGFxh!voGXGLqY^9rQ|S*JPP9ZKXU#DQ9>33kodHLelNpoNSla)QX6ed{WmA zwCDP=e$(T=UBG8IyCId!dl-q0-@R!5u}E`eWqfc#&E@m3H&qvM z>dk11E+CAb@%5KE-vL8&5B&|u^)>0eMN%SRPtmrb6>xY3tAtcvk(=GR@lA}+vOBXf>ma)RGOeoVo z(>Az~yf2~0cXpRjNbWCm6HkEbf_)E$B0KTGe8qbwHho`M-TTAMzE>_kAcayxRxKX< z+r3jaz%<7x&y7ERe^GLE+lQ2kB{4rrO+)H|4Sm(( zb>LYNf6o?+`fS8*dgR$jTQ)#2*EHH^eZU9jwZR+@~o;h>wt!zy4$5$ z(1ypD=b7`o6!*#R>V4!-K=9(`bzQlN5*+6H%lMu+hf*0 z?Q@|gZ9+~|?b+ipa%3?6M)!WA6zZs>6Fq|mMI@0z3eYD#CbKCM?0C)HQyq8PJcJ=# z@>PL~`P5tu$I6@umUo>r%197p?J^otK-vI8itU+D*$%%a6xD_7kcFa1$ygEhI;znH^OvBu7- iLUDTR^7K~=tFVxb$A9t|_ej$G^gv{vAfm{Na{f;SUWiKo literal 0 HcmV?d00001 diff --git a/doc/reference/cogl/quad-indices-triangles.png b/doc/reference/cogl/quad-indices-triangles.png new file mode 100644 index 0000000000000000000000000000000000000000..18c42c845ed165d3b15dbd431f905be823416276 GIT binary patch literal 8018 zcmXw82|UyP|KH4zGs%5tqH?y8ifK8roRyL!d@;#LlKa|xBloO>k)s;A97W`wq){81 zkX&MLlAl^duTjZ!{x+Wic{QJ+JFrVw+ zJ7={!h9hySv+Lpc#$7{8c>|jxL&Kq+jQdL_dy_i#DxowRGI}bwq|nU+*Ggc1U4y&XC{Iy|CXvDHU+pFj>u z8_CNIwMC{uLrBYZS8e&z2o$E^hOFtMa~udqqXMO;*Z&7nQAX`z9Tq0~wlWNPEMfl6 zJy|p%+8}Kg4PQH~3_F*#tX~V$tDJ*Lvo6WF!OQ58687INxkt05kn)bJqX^9uKVRL{ zt582^<;e@8%^OBLw;Z6)q4)0%dF-@N$5k8Ykynm{%2$x6ZR(|aeM8)x*o`)BN=C8o z7sz^*W2P<=N&~jb&!JB=rsB988H36Qz6}%c?Y38RRo{ zu7(ysQ>-KQ-R)AzzQCBd;!dBTpCFuFGSIFW#nB$m&~@V;kpH+od7Sw1lFSL1saDf1 zsyt!tdyc3<<>CL9{CL%a90S(xU$`k=ys=r%j8Wj-cwC+aZ>jnRhh&RM9Z+z5rpIGd zC&}?!nKjW>ox z;FwL$-g(hK6<=*P2tiK9d4rdDH+K0-x)(oRIE;<`@y#Nj-JdQ^t#u}>Bx-kAN7UwS z(#NtsL4iWy|88ZT$@QTp5@LdC<3w1fWqL?iK`7_wM8kV>+ zZshf)lu!M(Zu;$rFq@d>@=qVFcT(M9>{Wv=CwTa+B5GLO@2a9P=nifo!aKHpnob9o zr@tLVU&cwzP@|D->4D7?g>^zqz}>Im71g4shOp+6w? z6RkZ>H2dX9sF*j>PbPcE-P}x*=tX0dnoVCtVg9cqF;aF}BAr1Rj4AJFBo;z5gMA)M zA4JMShjd;X6mq^TuKMN2Ka7vR2^ioae}ZquJ~vWgJ?jO?!xuJC?gWH;K{ zpQ~S^=tlacz6A;BR8m4Z1swgef@wa+a;2%&7QY&tGD1!GnM9Rt#BdME@9!VaHjGCPp(8Lo1Vn;0>bij~1cHk^y5yYfY4a#5{ixjNr|{i(;>azSv5x z8oe5WW#vZu>j@NR4igHz2SZ^d`_f0>``hDTvmFM)U43cO$z!!Yrw*g^opU0;&Rylm z$-BO=4p^^7>r3+f@~{brd`)5YPUpu_m|{^H{iqk()?-iJ{$f~4>w7s{ei^AP{!!9- zwL9)&=HQVyBL~U z(0aZ%?(Ay8%ij7J>-DOZB=Wo6t3o;HKiW@Q#f2028Ti@_QC#)Dku%RzZ#G!6gr>Fl zT0W^xU*BNWz4?X4bI zLk+tcX_luH*7{C!Wgj_>A8OQqz&6>|L6l;?Sss$QZh zG!->oDX34Q+DifMtRbtg>)%7}3rCsL0|n!v)m#urA@w4kU*#qm zV!HLb!YfVRO5gl(MQhH5mZ6?@KM3#P+h;NV%cXyI5`Kv%{mydzr3g_u65gUiap7}u z+rsT}Yg#4kE_rr({PXaXOujttlb!R{*gVk#s7mMg+MdxjiKWqs&HH2cUMp@z#eN#g zzA!z8tLCZLhn~H5gnfA90aFuO@NLCqr%bmiE1Qz8dUtvxPm{s-p=iQPYVqIm_%=`)xEdOM9wSC>l2xGDViCq*M|;!*6co#cP`EQB)Cl#-v{&Az;tX>m$L$(-hWl71#LU?Tl`Hv8uN5S@n?lq(NY)bT@SLG_%=l(mT zFv^=eU6){5Q9H=^_M|nE*Ea6{8N!WenVbB2Vu2YHMM=Lre&#Wg?-WTL{?8YAEbomQA*EiV&TWfAG~k$c^b){SDwRuOHwiuA`iP=l;)T|l^*{h zlbvnSzJr)REn8Knl->OSCbpY8rC+5&Zo0FKj5?0FX1ffZC#Ar8jtUWHpRB`Vv0E)A z%K5+*&oP$r!aN!D`_908itANe+wXOZ!~W=nDmkp1)sbEH3*j{?P7%WV%WaYTX-U*9 zg29xLPU)L!8ZXjiZ|O6Ysr%@C>5_;vzH_t*&XO=sXNHoQpXxLc%Rh#^^2doJ4SVMe zmBKh2iN2r!MQlo(&r2uNNmj#^(turN(UDStjZzhnchb(ypBQ{j%CfxEQ%mClD${4M z>tlX*qRx|~`IYo5UC)H=kb_~ncn-j_`bnX5Q;C$l29mso$-C)-SUYvF&3R1(&BV*gQ}t{w9&?>wwu$^6vD=~&6$myH$w|3 zk2%ylZ&H~`Kb`Ce$7VsEji(&`N|Am2kV$ zI~_t+YE4|N%k1GGZEK#Ny|;t(zw<* zUBSiuVPS2ntfNBjkF$)T&M|+&JLb<<)idz3Phs(eb|~{}&sC=J?0U{Ww&6Jb0A%HD z=JN-}{LzWj(D{8Obca0gTB%IV?qyXGr^^VFe-oWj_gN*xVrLIl)|E+$qja3dd%6g} z=5KypVx(xGH&MF^h!H)3ZQ?2}s2DRg?^EQSem@7{7eJA;-Bplt-)egQB^8u zcNLVSye%m_gtEBy?>^bgM3@U?PIB@=ScXUQ;qqJ zeICtYCM1Md%QQI7ki}>sk2pK|3h3gSkad;Z(JzTxlPiFi9xt zsS|u}&icg}nrW7%T15#KClza@>#3^+xw&hw9}ydP^+p&We_^pj`|j>`$}IhDiTl&b zU&ha4SO#IdUwYuamh6+rdZP&8QnP!UD)|ZxZW)Nhx&R0HZ_I+rpQz5kjlFO}CEG}} zUI_o)we2dxyjc_2pvhGd6}t1jm`h4?`gjVswG=s@raUt2$aPg{y=Kd;{GJUDW(wR_ zAh42>=Z)j`_0rFzyT!eYZwJ@+*(m+;O278piTHPkMcc*r$VpC=5M-&a zop2%kz_+Nj3-FyWrssZuy-94?iT)W_u-r*}Nm|}jAs6T&5`NVEI7kDZwkrVonhE;y z#tS0KWZn;1|Am1&3CJT}OD!nY_)l47YP&1w<D8>B z>?wk9y&0>Tzt0K@b;=zOK<1(wD+`5R0&j%Iq}29%s>z-jRuQ|Jsdd!}4Z43Sa1W}= zhzB!+cg!oYZxS6lZW(JF+_NrrN}>K37{EgyE02z-1<8zfel`Z@Xdz6}O&jWK6E-~e zsJ$HB+4h3pN{*llT|14*fxm8JblysB@58Xx$<^;B=72@PuC^D6RylF2QYZRJu|#{5 zjSGJv$6sJIe+Bc@%RFBp$)0JwF;>ijog1(8Nv8sDH`v#ZE{AGg6rvC&srD9tvt?GsXGt#PKTXui4|PDAGR@Y?W5;qMMPtokGYcl&(wB06Q2f3dP&@k z?Q710g=LK86F>3Yzr{b@nK^XcK@jj9mbMn0FCK30Wo`%}jU-SHE$Fs(IMQ89Ge)!B z47Obl#}}ZKwX9$SH^?Ip%Hdn%pRHdiwO-?R_a24+{z2Qsg&T37p2}PH6EI=J< zL+)_`kk8)#(5P<*Hk56WkSN3ora9w6Dk&n^?cy&?3%Coh8;QodIhB;3Ss)-!U@VR; zXPX`EELFXlBqrykQ~IpX1~Gin(4$aAghvPD^c^T{UgmNw)hy0GPE2s|4XqVd?ey2X zM!xvrhY1aeN|#>-gXD&qUz<@w4F7A7jC`oVgj~eqoN@+Ixls8lrVF8MsqO0XRt@d9 z@G1|DR#eIP^pe}I7tBUvw~lLN_MLUuOST+OvbUF{0t-E0p$}R*pBCWgW3H3tcG@4@ z*+Gt+|4wMK*I?3Q!9|x#Tf39SvjwnDkOQzSO)EEOnL(ux1MdJXC~LK5#prKqZNAsqea3^qr&Ljck+ornZf!^#wYaEf&>C@Q}PsLGr#U^)93mQ zp+RXr@NkQ$xcTD0kk{WB8`d_MG>dzITlodxtC_B@I?ZF;@%<|ibpYKqgF?!a{>Sb2 zXdaFl=xF|e!hJ=J)fNHEpETRh z$g;U7UMm~8d)^y!Nn%d_dER#5N^k6QJOxk72Wsi<1&xxgnJ#kdo_M%ih3NbROuoFB zjmh5eG9Y|cq4GQ$T+J1YVWpR+6Vpyj^r92b= z4KUY1z{6rCA(oRw4uYs$6xwGBEZJ6T(iMDxmqfz-+=&$J+`p(8i+`sfMV%%HG4Wnr z<|`m{TW;uj725O7#0E_z$BGl%kc<#72njnS5*`WKrr-P;eh*?eZdK;b1ri^uS-0#2y+M%98V2k$ZHXsm}4GA}ia-If5rGSO&D3Cwb!G zMHE*B*~~NcyXkw)!CY4ltB2hdTs+8$ZujSgyeCUM+*Tx9m;Ipq*8L;kEPb*LIIBS0 z3OwOCRJo+4_VNaZHI!!sj@EAfFd>`iQXJZMAKWhpu_=;qr2aud6l6Y*qD|V4R_Bd! zU&DD)0_0HcfHP1N6R?g!$$vC_UDzsM6mojQFL3q#wiNFj7n`%}C5gdjGg8~jK=v|7 z!D#f}MK`#wp?ei2Pfj+oG@iPO@P{gJCFd!}@e@!~KT*(HNJJWaPIvemNjSrz9;^n~ z04+@stk3uvF+XqfkpP^ArKOj_f-*}ibJ@*Zf_)h{P6RW_Sdu?neb00k2fH*2s7--? zNLDse5qP%m0HO--gJ05ZUt*iIKiV_?)|5&Z5 z0k&!atk#LF{K1@gwynls_T$6vXmBGP0FWpSJ%>J};Ib2|3l51rYc?WPklSdptr~T3 zQ(yEsQZc_}_J9G-@JxiySMjzN7MaTwDvY4a?KPSF*-97g1t$;g(JfP*ivz54x9@B? zDDpMLrf5O#W(^S~^P0iXN!u1G4e|;!q!>hoHC78MS?**>wCNvXRfg4deKnXICY)g4 zKT?Z{r!#{M(7IdGM3h9}U5cw0uBRmQUb<#F6ik7OiL`vcZ81X4Vzst^(Jv_WQPJ6K zMBXjm6KE?-96W)EqgoT@AYiE5UN44j)n8Er*-|8IKF$+A{E<;@HTQfjX~_i!GeGfl;d;`!yx7YH_`Bu~Jl3+8lGn1}UFC;yenDe4IoTL-@lsWH=2f<;1S1 z1A5!?ya`vHz3wOSThIMDg_+fNmTNk-3){@w$9rj?RV6GIRe1(<k9pa>q4SEj#${{_$g^#c!m$8MaXoP^One`A90Q=upqFcn=(I15rG#%H8Y@RY zB-wirjeO5VHi%%NwVhwMdSLG%sXGbOqYJmcwZeT>0uw01EF0O(Qws6Edq3RT*jI6Q zJ^-VXOn2o9EfB3sK%l#xs9qHXn_NQC4FiAkYr+v})Q=oa%?|G7OQ5*=;oP`F4Z{{# zAKCpm2ROPJm&m|_8Lt>r9ODY+Jaqi{8@a_0un=4Y%jcbBYVHE%T!u6tMz`F7-n9GT zvYB0qb&=Z-M*&9}fPl~#7BWnUeU~e_ub5DysC-4)tjj#O=aCU# zbOJR){b#bzR`h97R%^kbKy7;0MpKUvcVqagw}7O? z)cwU~#G=lT62X4QLUIqpl9rABOfG(tTT~4j>h1sQ_$EgnF-wr8g*wKKLq(Q6l2v68 zs0sFk(U$LH0bKEwBJX84wtY01Y@L6SSmXs5LYS;Jtq>*E_6(>j+Yov5#lS=vF<))k zHEM;C33{k3p#ary{qq1i4ztfHLZ%=w(g$+|mJWNDJ#g{=l`_4nKekk*YsZiWj$UHy z3l0VA!C)Bq!vc4Bi(i#FXTMFMVr(_pS#2wS+K#YH8#1>dns>Ek|3iSswoKxN0oWLh zZqKuz3xCC(d2APTA;WwdI0?sC!yNCGcrKjkC}~%UUq34h_0nK^E*wY+6ZF1rp z(Q2S+^tglHwsPF^Q@=dDRd`T8qPvHxx?a_b5 z`2a^S`+ISe+wJ76|_i z41-B~^*9gXrpJ*x@3c&i@97SjJLuq6qS@itjNbKECBCO? zsNy(7S&m2ECNIXmwrbs#_$QqzzxLm&k|*C~cro3hNe_%MJ9!O2>+)hgc;I>{&RO== zk-^UXxF75e88PgdQ{Dy~GpvVfExD_mT%NUwnok~YItB51P#ZahER}*wLHO91di${+ z@vhq_bxOnF_+{JysMtg!<7egFuf#&t_CEQ;BAX?1BuJY_(KX7rFQgVGrUpY#;8&PmwrpS|;HQ{XWpU&hAf;$`)|_x=UL z&K}^Y5a0ZVi#>v8k{?k@2|mTH&?t33r9{(?9Yo82!UEPWVhcj5Jy(_&US8~}XgVl~ zQW$0Wn|_JkRPOQ@`!IUFLDEfEY9pU1OZ&))rWZv_=n4F1QB7mX)fP90R$onzovdzl zb~}MlBS+h<@P1?dv7Ku1_$^a~eWlcH^Y&5UY{v+-1|44*V3l)!SUHD(tK0Nre5+Ku ze=|$t9WmiJ%gdeNs8k&k5E<2Eln(36TBctD4;|5n`qY@i>-`dao&Fi+&5sHPI_zFY ze#`li@`yTDRI{5mI)x$vt7aN()@tcu%&znO?7A?*UzS$ei)mJue~%=t2ot_9@J_2_ z6Df)!GxzDy^-ySby?ei`|)BVLMU#2a1-h+*2+tVac8QfQ7r4M%VSY z_#oygB=fJtZBXP&6$;oh7#r10kF`(Do+;J(;8mN$u?QKFl z!qp-FSz%_oU4G5@0qJu_@*HgGP#56c9#7n}apkpv%Hj-yBBG5|3f1#2{V_gwHS&Rc7pjQS-p1@OUoBo`n=Zj$-ScJevTRw@sn=i*BT^ zbSQ{BlPxDc$BDiN2a-st?-XnH!EGENM}Is!ZBZ&^hRD1Nl(jR45;w@EGIyZr2CTJdV#geOD(hB$t*(P^~TSfg5Hg zPXIZwrAKfgS|z_s#r$e9evy8|ufpc4n+muj-kcoTEl~!UooQQGi#@-BjZkS({0%<; OhF~r1%*&3u6aNpuN&@u& literal 0 HcmV?d00001 diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..b7cccec --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,140 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +AM_CPPFLAGS = \ + -I$(top_srcdir) + +if !USE_GLIB +AM_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +AM_CFLAGS = \ + $(COGL_DEP_CFLAGS) \ + $(COGL_EXTRA_CFLAGS) \ + -DCOGL_ENABLE_EXPERIMENTAL_2_0_API + +if INSTALL_EXAMPLES +AM_CFLAGS += -DCOGL_EXAMPLES_DATA=\""$(pkgdatadir)/examples-data/"\" +else +AM_CFLAGS += -DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\" +endif + +common_ldadd = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la \ + $(LIBM) + +if !USE_GLIB +common_ldadd += $(top_builddir)/deps/glib/libglib.la +endif + +programs = cogl-info + +cogl_info_SOURCES = cogl-info.c +cogl_info_LDADD = $(common_ldadd) + +if USE_GLIB +programs += cogl-hello cogl-msaa cogl-gles2-context cogl-point-sprites +examples_datadir = $(pkgdatadir)/examples-data +examples_data_DATA = + +cogl_hello_SOURCES = cogl-hello.c +cogl_hello_LDADD = $(common_ldadd) +cogl_msaa_SOURCES = cogl-msaa.c +cogl_msaa_LDADD = $(common_ldadd) +cogl_point_sprites_SOURCES = cogl-point-sprites.c +cogl_point_sprites_LDADD = $(common_ldadd) + +if BUILD_COGL_PANGO +programs += cogl-crate +cogl_crate_SOURCES = cogl-crate.c +cogl_crate_LDADD = $(common_ldadd) $(COGL_PANGO_DEP_LIBS) $(top_builddir)/cogl-pango/libcogl-pango.la +cogl_crate_CFLAGS = $(AM_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +examples_data_DATA += crate.jpg +endif + +if BUILD_COGL_GST +programs += cogl-basic-video-player +cogl_basic_video_player_SOURCES = cogl-basic-video-player.c +cogl_basic_video_player_LDADD = $(common_ldadd) $(COGL_GST_DEP_LIBS) $(top_builddir)/cogl-gst/libcogl-gst.la +cogl_basic_video_player_CFLAGS = $(AM_CFLAGS) $(COGL_GST_DEP_CFLAGS) -I$(top_builddir)/cogl-gst +endif + +if X11_TESTS +programs += cogl-x11-foreign cogl-x11-tfp +cogl_x11_foreign_SOURCES = cogl-x11-foreign.c +cogl_x11_foreign_LDADD = $(common_ldadd) +cogl_x11_tfp_SOURCES = cogl-x11-tfp.c +cogl_x11_tfp_LDADD = $(common_ldadd) +endif + +if SUPPORT_WAYLAND_EGL_SERVER +# Note: Cogland currently only builds for Wayland 0.85 +programs += cogland +cogland_SOURCES = cogland.c +cogland_LDADD = $(common_ldadd) +endif + +cogl_gles2_context_SOURCES = cogl-gles2-context.c +cogl_gles2_context_LDADD = $(common_ldadd) + +if BUILD_COGL_GLES2 +programs += cogl-gles2-gears +cogl_gles2_gears_SOURCES = cogl-gles2-gears.c +cogl_gles2_gears_CFLAGS = -I$(top_srcdir)/cogl-gles2 $(AM_CFLAGS) +cogl_gles2_gears_LDADD = $(common_ldadd) $(top_builddir)/cogl-gles2/libcogl-gles2.la +endif + +endif #USE_GLIB + +# XXX although emscripten "supports sdl" we can't build cogl-sdl-hello +# un-modified for emscripten since emscripten doesn't support +# SDL_WaitEvent() and we need to use some special emscripten apis +# to create a mainloop.... +if USING_EMSCRIPTEN + +programs += cogl-emscripten-hello +cogl_emscripten_hello_SOURCES = cogl-emscripten-hello.c +cogl_emscripten_hello_LDADD = $(common_ldadd) + +else # USING_EMSCRIPTEN + +if SUPPORT_SDL +programs += cogl-sdl-hello +cogl_sdl_hello_SOURCES = cogl-sdl-hello.c +cogl_sdl_hello_LDADD = $(common_ldadd) +endif + +endif # USING_EMSCRIPTEN + +if SUPPORT_SDL2 +programs += cogl-sdl2-hello +cogl_sdl2_hello_SOURCES = cogl-sdl2-hello.c +cogl_sdl2_hello_LDADD = $(common_ldadd) +endif + +if USING_EMSCRIPTEN +%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/glib/.libs/libglib.a + $(CC) $(AM_CFLAGS) $(CFLAGS) --js-library $(top_srcdir)/examples/emscripten-example-js-library.js -o $@ $^ + +all-local: $(addsuffix .html, $(programs)) +endif + +if INSTALL_EXAMPLES +bin_PROGRAMS = $(programs) +else +noinst_PROGRAMS = $(programs) +endif + +EXTRA_DIST = \ + cogl-gjs.js \ + crate.jpg \ + emscripten-example-js.h \ + emscripten-example-js-library.js \ + android/hello/AndroidManifest.xml \ + android/hello/jni/Application.mk \ + android/hello/jni/Android.mk \ + android/hello/jni/main.c \ + android/hello/res/values/strings.xml \ + android/hello/.gitignore \ + android/hello/build.xml + diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..a66fcb2 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,1153 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp +@USE_GLIB_FALSE@am__append_1 = -I$(top_builddir)/deps/glib +@INSTALL_EXAMPLES_TRUE@am__append_2 = -DCOGL_EXAMPLES_DATA=\""$(pkgdatadir)/examples-data/"\" +@INSTALL_EXAMPLES_FALSE@am__append_3 = -DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\" +@USE_GLIB_FALSE@am__append_4 = $(top_builddir)/deps/glib/libglib.la +@USE_GLIB_TRUE@am__append_5 = cogl-hello cogl-msaa cogl-gles2-context cogl-point-sprites +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@am__append_6 = cogl-crate +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@am__append_7 = crate.jpg +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@am__append_8 = cogl-basic-video-player +@USE_GLIB_TRUE@@X11_TESTS_TRUE@am__append_9 = cogl-x11-foreign cogl-x11-tfp + +# Note: Cogland currently only builds for Wayland 0.85 +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@am__append_10 = cogland +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@am__append_11 = cogl-gles2-gears + +# XXX although emscripten "supports sdl" we can't build cogl-sdl-hello +# un-modified for emscripten since emscripten doesn't support +# SDL_WaitEvent() and we need to use some special emscripten apis +# to create a mainloop.... +@USING_EMSCRIPTEN_TRUE@am__append_12 = cogl-emscripten-hello +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@am__append_13 = cogl-sdl-hello +@SUPPORT_SDL2_TRUE@am__append_14 = cogl-sdl2-hello +@INSTALL_EXAMPLES_TRUE@bin_PROGRAMS = $(am__EXEEXT_10) +@INSTALL_EXAMPLES_FALSE@noinst_PROGRAMS = $(am__EXEEXT_10) +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@USE_GLIB_TRUE@am__EXEEXT_1 = cogl-hello$(EXEEXT) cogl-msaa$(EXEEXT) \ +@USE_GLIB_TRUE@ cogl-gles2-context$(EXEEXT) \ +@USE_GLIB_TRUE@ cogl-point-sprites$(EXEEXT) +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@am__EXEEXT_2 = \ +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@ cogl-crate$(EXEEXT) +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@am__EXEEXT_3 = cogl-basic-video-player$(EXEEXT) +@USE_GLIB_TRUE@@X11_TESTS_TRUE@am__EXEEXT_4 = \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ cogl-x11-foreign$(EXEEXT) \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ cogl-x11-tfp$(EXEEXT) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@am__EXEEXT_5 = cogland$(EXEEXT) +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@am__EXEEXT_6 = cogl-gles2-gears$(EXEEXT) +@USING_EMSCRIPTEN_TRUE@am__EXEEXT_7 = cogl-emscripten-hello$(EXEEXT) +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@am__EXEEXT_8 = cogl-sdl-hello$(EXEEXT) +@SUPPORT_SDL2_TRUE@am__EXEEXT_9 = cogl-sdl2-hello$(EXEEXT) +am__EXEEXT_10 = cogl-info$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) \ + $(am__EXEEXT_6) $(am__EXEEXT_7) $(am__EXEEXT_8) \ + $(am__EXEEXT_9) +am__installdirs = "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(examples_datadir)" +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am__cogl_basic_video_player_SOURCES_DIST = cogl-basic-video-player.c +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@am_cogl_basic_video_player_OBJECTS = cogl_basic_video_player-cogl-basic-video-player.$(OBJEXT) +cogl_basic_video_player_OBJECTS = \ + $(am_cogl_basic_video_player_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la $(am__DEPENDENCIES_1) \ + $(am__append_4) +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@cogl_basic_video_player_DEPENDENCIES = \ +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@ $(am__DEPENDENCIES_2) \ +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@ $(am__DEPENDENCIES_1) \ +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@ $(top_builddir)/cogl-gst/libcogl-gst.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +cogl_basic_video_player_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(cogl_basic_video_player_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__cogl_crate_SOURCES_DIST = cogl-crate.c +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@am_cogl_crate_OBJECTS = cogl_crate-cogl-crate.$(OBJEXT) +cogl_crate_OBJECTS = $(am_cogl_crate_OBJECTS) +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@cogl_crate_DEPENDENCIES = \ +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@ $(am__DEPENDENCIES_2) \ +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@ $(am__DEPENDENCIES_1) \ +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@ $(top_builddir)/cogl-pango/libcogl-pango.la +cogl_crate_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cogl_crate_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am__cogl_emscripten_hello_SOURCES_DIST = cogl-emscripten-hello.c +@USING_EMSCRIPTEN_TRUE@am_cogl_emscripten_hello_OBJECTS = \ +@USING_EMSCRIPTEN_TRUE@ cogl-emscripten-hello.$(OBJEXT) +cogl_emscripten_hello_OBJECTS = $(am_cogl_emscripten_hello_OBJECTS) +@USING_EMSCRIPTEN_TRUE@cogl_emscripten_hello_DEPENDENCIES = \ +@USING_EMSCRIPTEN_TRUE@ $(am__DEPENDENCIES_2) +am__cogl_gles2_context_SOURCES_DIST = cogl-gles2-context.c +@USE_GLIB_TRUE@am_cogl_gles2_context_OBJECTS = \ +@USE_GLIB_TRUE@ cogl-gles2-context.$(OBJEXT) +cogl_gles2_context_OBJECTS = $(am_cogl_gles2_context_OBJECTS) +@USE_GLIB_TRUE@cogl_gles2_context_DEPENDENCIES = \ +@USE_GLIB_TRUE@ $(am__DEPENDENCIES_2) +am__cogl_gles2_gears_SOURCES_DIST = cogl-gles2-gears.c +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@am_cogl_gles2_gears_OBJECTS = cogl_gles2_gears-cogl-gles2-gears.$(OBJEXT) +cogl_gles2_gears_OBJECTS = $(am_cogl_gles2_gears_OBJECTS) +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@cogl_gles2_gears_DEPENDENCIES = \ +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@ $(am__DEPENDENCIES_2) \ +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@ $(top_builddir)/cogl-gles2/libcogl-gles2.la +cogl_gles2_gears_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(cogl_gles2_gears_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__cogl_hello_SOURCES_DIST = cogl-hello.c +@USE_GLIB_TRUE@am_cogl_hello_OBJECTS = cogl-hello.$(OBJEXT) +cogl_hello_OBJECTS = $(am_cogl_hello_OBJECTS) +@USE_GLIB_TRUE@cogl_hello_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_cogl_info_OBJECTS = cogl-info.$(OBJEXT) +cogl_info_OBJECTS = $(am_cogl_info_OBJECTS) +cogl_info_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_msaa_SOURCES_DIST = cogl-msaa.c +@USE_GLIB_TRUE@am_cogl_msaa_OBJECTS = cogl-msaa.$(OBJEXT) +cogl_msaa_OBJECTS = $(am_cogl_msaa_OBJECTS) +@USE_GLIB_TRUE@cogl_msaa_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_point_sprites_SOURCES_DIST = cogl-point-sprites.c +@USE_GLIB_TRUE@am_cogl_point_sprites_OBJECTS = \ +@USE_GLIB_TRUE@ cogl-point-sprites.$(OBJEXT) +cogl_point_sprites_OBJECTS = $(am_cogl_point_sprites_OBJECTS) +@USE_GLIB_TRUE@cogl_point_sprites_DEPENDENCIES = \ +@USE_GLIB_TRUE@ $(am__DEPENDENCIES_2) +am__cogl_sdl_hello_SOURCES_DIST = cogl-sdl-hello.c +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@am_cogl_sdl_hello_OBJECTS = cogl-sdl-hello.$(OBJEXT) +cogl_sdl_hello_OBJECTS = $(am_cogl_sdl_hello_OBJECTS) +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@cogl_sdl_hello_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_sdl2_hello_SOURCES_DIST = cogl-sdl2-hello.c +@SUPPORT_SDL2_TRUE@am_cogl_sdl2_hello_OBJECTS = \ +@SUPPORT_SDL2_TRUE@ cogl-sdl2-hello.$(OBJEXT) +cogl_sdl2_hello_OBJECTS = $(am_cogl_sdl2_hello_OBJECTS) +@SUPPORT_SDL2_TRUE@cogl_sdl2_hello_DEPENDENCIES = \ +@SUPPORT_SDL2_TRUE@ $(am__DEPENDENCIES_2) +am__cogl_x11_foreign_SOURCES_DIST = cogl-x11-foreign.c +@USE_GLIB_TRUE@@X11_TESTS_TRUE@am_cogl_x11_foreign_OBJECTS = \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ cogl-x11-foreign.$(OBJEXT) +cogl_x11_foreign_OBJECTS = $(am_cogl_x11_foreign_OBJECTS) +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_foreign_DEPENDENCIES = \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ $(am__DEPENDENCIES_2) +am__cogl_x11_tfp_SOURCES_DIST = cogl-x11-tfp.c +@USE_GLIB_TRUE@@X11_TESTS_TRUE@am_cogl_x11_tfp_OBJECTS = \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ cogl-x11-tfp.$(OBJEXT) +cogl_x11_tfp_OBJECTS = $(am_cogl_x11_tfp_OBJECTS) +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_tfp_DEPENDENCIES = \ +@USE_GLIB_TRUE@@X11_TESTS_TRUE@ $(am__DEPENDENCIES_2) +am__cogland_SOURCES_DIST = cogland.c +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@am_cogland_OBJECTS = cogland.$(OBJEXT) +cogland_OBJECTS = $(am_cogland_OBJECTS) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@cogland_DEPENDENCIES = $(am__DEPENDENCIES_2) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(cogl_basic_video_player_SOURCES) $(cogl_crate_SOURCES) \ + $(cogl_emscripten_hello_SOURCES) $(cogl_gles2_context_SOURCES) \ + $(cogl_gles2_gears_SOURCES) $(cogl_hello_SOURCES) \ + $(cogl_info_SOURCES) $(cogl_msaa_SOURCES) \ + $(cogl_point_sprites_SOURCES) $(cogl_sdl_hello_SOURCES) \ + $(cogl_sdl2_hello_SOURCES) $(cogl_x11_foreign_SOURCES) \ + $(cogl_x11_tfp_SOURCES) $(cogland_SOURCES) +DIST_SOURCES = $(am__cogl_basic_video_player_SOURCES_DIST) \ + $(am__cogl_crate_SOURCES_DIST) \ + $(am__cogl_emscripten_hello_SOURCES_DIST) \ + $(am__cogl_gles2_context_SOURCES_DIST) \ + $(am__cogl_gles2_gears_SOURCES_DIST) \ + $(am__cogl_hello_SOURCES_DIST) $(cogl_info_SOURCES) \ + $(am__cogl_msaa_SOURCES_DIST) \ + $(am__cogl_point_sprites_SOURCES_DIST) \ + $(am__cogl_sdl_hello_SOURCES_DIST) \ + $(am__cogl_sdl2_hello_SOURCES_DIST) \ + $(am__cogl_x11_foreign_SOURCES_DIST) \ + $(am__cogl_x11_tfp_SOURCES_DIST) $(am__cogland_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(examples_data_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +AM_CPPFLAGS = -I$(top_srcdir) $(am__append_1) +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) \ + -DCOGL_ENABLE_EXPERIMENTAL_2_0_API $(am__append_2) \ + $(am__append_3) +common_ldadd = $(COGL_DEP_LIBS) $(top_builddir)/cogl/libcogl.la \ + $(LIBM) $(am__append_4) +programs = cogl-info $(am__append_5) $(am__append_6) $(am__append_8) \ + $(am__append_9) $(am__append_10) $(am__append_11) \ + $(am__append_12) $(am__append_13) $(am__append_14) +cogl_info_SOURCES = cogl-info.c +cogl_info_LDADD = $(common_ldadd) +@USE_GLIB_TRUE@examples_datadir = $(pkgdatadir)/examples-data +@USE_GLIB_TRUE@examples_data_DATA = $(am__append_7) +@USE_GLIB_TRUE@cogl_hello_SOURCES = cogl-hello.c +@USE_GLIB_TRUE@cogl_hello_LDADD = $(common_ldadd) +@USE_GLIB_TRUE@cogl_msaa_SOURCES = cogl-msaa.c +@USE_GLIB_TRUE@cogl_msaa_LDADD = $(common_ldadd) +@USE_GLIB_TRUE@cogl_point_sprites_SOURCES = cogl-point-sprites.c +@USE_GLIB_TRUE@cogl_point_sprites_LDADD = $(common_ldadd) +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@cogl_crate_SOURCES = cogl-crate.c +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@cogl_crate_LDADD = $(common_ldadd) $(COGL_PANGO_DEP_LIBS) $(top_builddir)/cogl-pango/libcogl-pango.la +@BUILD_COGL_PANGO_TRUE@@USE_GLIB_TRUE@cogl_crate_CFLAGS = $(AM_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@cogl_basic_video_player_SOURCES = cogl-basic-video-player.c +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@cogl_basic_video_player_LDADD = $(common_ldadd) $(COGL_GST_DEP_LIBS) $(top_builddir)/cogl-gst/libcogl-gst.la +@BUILD_COGL_GST_TRUE@@USE_GLIB_TRUE@cogl_basic_video_player_CFLAGS = $(AM_CFLAGS) $(COGL_GST_DEP_CFLAGS) -I$(top_builddir)/cogl-gst +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_foreign_SOURCES = cogl-x11-foreign.c +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_foreign_LDADD = $(common_ldadd) +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_tfp_SOURCES = cogl-x11-tfp.c +@USE_GLIB_TRUE@@X11_TESTS_TRUE@cogl_x11_tfp_LDADD = $(common_ldadd) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@cogland_SOURCES = cogland.c +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@@USE_GLIB_TRUE@cogland_LDADD = $(common_ldadd) +@USE_GLIB_TRUE@cogl_gles2_context_SOURCES = cogl-gles2-context.c +@USE_GLIB_TRUE@cogl_gles2_context_LDADD = $(common_ldadd) +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@cogl_gles2_gears_SOURCES = cogl-gles2-gears.c +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@cogl_gles2_gears_CFLAGS = -I$(top_srcdir)/cogl-gles2 $(AM_CFLAGS) +@BUILD_COGL_GLES2_TRUE@@USE_GLIB_TRUE@cogl_gles2_gears_LDADD = $(common_ldadd) $(top_builddir)/cogl-gles2/libcogl-gles2.la +@USING_EMSCRIPTEN_TRUE@cogl_emscripten_hello_SOURCES = cogl-emscripten-hello.c +@USING_EMSCRIPTEN_TRUE@cogl_emscripten_hello_LDADD = $(common_ldadd) +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@cogl_sdl_hello_SOURCES = cogl-sdl-hello.c +@SUPPORT_SDL_TRUE@@USING_EMSCRIPTEN_FALSE@cogl_sdl_hello_LDADD = $(common_ldadd) +@SUPPORT_SDL2_TRUE@cogl_sdl2_hello_SOURCES = cogl-sdl2-hello.c +@SUPPORT_SDL2_TRUE@cogl_sdl2_hello_LDADD = $(common_ldadd) +EXTRA_DIST = \ + cogl-gjs.js \ + crate.jpg \ + emscripten-example-js.h \ + emscripten-example-js-library.js \ + android/hello/AndroidManifest.xml \ + android/hello/jni/Application.mk \ + android/hello/jni/Android.mk \ + android/hello/jni/main.c \ + android/hello/res/values/strings.xml \ + android/hello/.gitignore \ + android/hello/build.xml + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +cogl-basic-video-player$(EXEEXT): $(cogl_basic_video_player_OBJECTS) $(cogl_basic_video_player_DEPENDENCIES) $(EXTRA_cogl_basic_video_player_DEPENDENCIES) + @rm -f cogl-basic-video-player$(EXEEXT) + $(AM_V_CCLD)$(cogl_basic_video_player_LINK) $(cogl_basic_video_player_OBJECTS) $(cogl_basic_video_player_LDADD) $(LIBS) + +cogl-crate$(EXEEXT): $(cogl_crate_OBJECTS) $(cogl_crate_DEPENDENCIES) $(EXTRA_cogl_crate_DEPENDENCIES) + @rm -f cogl-crate$(EXEEXT) + $(AM_V_CCLD)$(cogl_crate_LINK) $(cogl_crate_OBJECTS) $(cogl_crate_LDADD) $(LIBS) + +cogl-emscripten-hello$(EXEEXT): $(cogl_emscripten_hello_OBJECTS) $(cogl_emscripten_hello_DEPENDENCIES) $(EXTRA_cogl_emscripten_hello_DEPENDENCIES) + @rm -f cogl-emscripten-hello$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_emscripten_hello_OBJECTS) $(cogl_emscripten_hello_LDADD) $(LIBS) + +cogl-gles2-context$(EXEEXT): $(cogl_gles2_context_OBJECTS) $(cogl_gles2_context_DEPENDENCIES) $(EXTRA_cogl_gles2_context_DEPENDENCIES) + @rm -f cogl-gles2-context$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_gles2_context_OBJECTS) $(cogl_gles2_context_LDADD) $(LIBS) + +cogl-gles2-gears$(EXEEXT): $(cogl_gles2_gears_OBJECTS) $(cogl_gles2_gears_DEPENDENCIES) $(EXTRA_cogl_gles2_gears_DEPENDENCIES) + @rm -f cogl-gles2-gears$(EXEEXT) + $(AM_V_CCLD)$(cogl_gles2_gears_LINK) $(cogl_gles2_gears_OBJECTS) $(cogl_gles2_gears_LDADD) $(LIBS) + +cogl-hello$(EXEEXT): $(cogl_hello_OBJECTS) $(cogl_hello_DEPENDENCIES) $(EXTRA_cogl_hello_DEPENDENCIES) + @rm -f cogl-hello$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_hello_OBJECTS) $(cogl_hello_LDADD) $(LIBS) + +cogl-info$(EXEEXT): $(cogl_info_OBJECTS) $(cogl_info_DEPENDENCIES) $(EXTRA_cogl_info_DEPENDENCIES) + @rm -f cogl-info$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_info_OBJECTS) $(cogl_info_LDADD) $(LIBS) + +cogl-msaa$(EXEEXT): $(cogl_msaa_OBJECTS) $(cogl_msaa_DEPENDENCIES) $(EXTRA_cogl_msaa_DEPENDENCIES) + @rm -f cogl-msaa$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_msaa_OBJECTS) $(cogl_msaa_LDADD) $(LIBS) + +cogl-point-sprites$(EXEEXT): $(cogl_point_sprites_OBJECTS) $(cogl_point_sprites_DEPENDENCIES) $(EXTRA_cogl_point_sprites_DEPENDENCIES) + @rm -f cogl-point-sprites$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_point_sprites_OBJECTS) $(cogl_point_sprites_LDADD) $(LIBS) + +cogl-sdl-hello$(EXEEXT): $(cogl_sdl_hello_OBJECTS) $(cogl_sdl_hello_DEPENDENCIES) $(EXTRA_cogl_sdl_hello_DEPENDENCIES) + @rm -f cogl-sdl-hello$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_sdl_hello_OBJECTS) $(cogl_sdl_hello_LDADD) $(LIBS) + +cogl-sdl2-hello$(EXEEXT): $(cogl_sdl2_hello_OBJECTS) $(cogl_sdl2_hello_DEPENDENCIES) $(EXTRA_cogl_sdl2_hello_DEPENDENCIES) + @rm -f cogl-sdl2-hello$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_sdl2_hello_OBJECTS) $(cogl_sdl2_hello_LDADD) $(LIBS) + +cogl-x11-foreign$(EXEEXT): $(cogl_x11_foreign_OBJECTS) $(cogl_x11_foreign_DEPENDENCIES) $(EXTRA_cogl_x11_foreign_DEPENDENCIES) + @rm -f cogl-x11-foreign$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_x11_foreign_OBJECTS) $(cogl_x11_foreign_LDADD) $(LIBS) + +cogl-x11-tfp$(EXEEXT): $(cogl_x11_tfp_OBJECTS) $(cogl_x11_tfp_DEPENDENCIES) $(EXTRA_cogl_x11_tfp_DEPENDENCIES) + @rm -f cogl-x11-tfp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_x11_tfp_OBJECTS) $(cogl_x11_tfp_LDADD) $(LIBS) + +cogland$(EXEEXT): $(cogland_OBJECTS) $(cogland_DEPENDENCIES) $(EXTRA_cogland_DEPENDENCIES) + @rm -f cogland$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogland_OBJECTS) $(cogland_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-emscripten-hello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gles2-context.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-hello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-msaa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-point-sprites.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-sdl-hello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-sdl2-hello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-x11-foreign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-x11-tfp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl_crate-cogl-crate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogland.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +cogl_basic_video_player-cogl-basic-video-player.o: cogl-basic-video-player.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_basic_video_player_CFLAGS) $(CFLAGS) -MT cogl_basic_video_player-cogl-basic-video-player.o -MD -MP -MF $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Tpo -c -o cogl_basic_video_player-cogl-basic-video-player.o `test -f 'cogl-basic-video-player.c' || echo '$(srcdir)/'`cogl-basic-video-player.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Tpo $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-basic-video-player.c' object='cogl_basic_video_player-cogl-basic-video-player.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_basic_video_player_CFLAGS) $(CFLAGS) -c -o cogl_basic_video_player-cogl-basic-video-player.o `test -f 'cogl-basic-video-player.c' || echo '$(srcdir)/'`cogl-basic-video-player.c + +cogl_basic_video_player-cogl-basic-video-player.obj: cogl-basic-video-player.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_basic_video_player_CFLAGS) $(CFLAGS) -MT cogl_basic_video_player-cogl-basic-video-player.obj -MD -MP -MF $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Tpo -c -o cogl_basic_video_player-cogl-basic-video-player.obj `if test -f 'cogl-basic-video-player.c'; then $(CYGPATH_W) 'cogl-basic-video-player.c'; else $(CYGPATH_W) '$(srcdir)/cogl-basic-video-player.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Tpo $(DEPDIR)/cogl_basic_video_player-cogl-basic-video-player.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-basic-video-player.c' object='cogl_basic_video_player-cogl-basic-video-player.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_basic_video_player_CFLAGS) $(CFLAGS) -c -o cogl_basic_video_player-cogl-basic-video-player.obj `if test -f 'cogl-basic-video-player.c'; then $(CYGPATH_W) 'cogl-basic-video-player.c'; else $(CYGPATH_W) '$(srcdir)/cogl-basic-video-player.c'; fi` + +cogl_crate-cogl-crate.o: cogl-crate.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_crate_CFLAGS) $(CFLAGS) -MT cogl_crate-cogl-crate.o -MD -MP -MF $(DEPDIR)/cogl_crate-cogl-crate.Tpo -c -o cogl_crate-cogl-crate.o `test -f 'cogl-crate.c' || echo '$(srcdir)/'`cogl-crate.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_crate-cogl-crate.Tpo $(DEPDIR)/cogl_crate-cogl-crate.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-crate.c' object='cogl_crate-cogl-crate.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_crate_CFLAGS) $(CFLAGS) -c -o cogl_crate-cogl-crate.o `test -f 'cogl-crate.c' || echo '$(srcdir)/'`cogl-crate.c + +cogl_crate-cogl-crate.obj: cogl-crate.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_crate_CFLAGS) $(CFLAGS) -MT cogl_crate-cogl-crate.obj -MD -MP -MF $(DEPDIR)/cogl_crate-cogl-crate.Tpo -c -o cogl_crate-cogl-crate.obj `if test -f 'cogl-crate.c'; then $(CYGPATH_W) 'cogl-crate.c'; else $(CYGPATH_W) '$(srcdir)/cogl-crate.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_crate-cogl-crate.Tpo $(DEPDIR)/cogl_crate-cogl-crate.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-crate.c' object='cogl_crate-cogl-crate.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_crate_CFLAGS) $(CFLAGS) -c -o cogl_crate-cogl-crate.obj `if test -f 'cogl-crate.c'; then $(CYGPATH_W) 'cogl-crate.c'; else $(CYGPATH_W) '$(srcdir)/cogl-crate.c'; fi` + +cogl_gles2_gears-cogl-gles2-gears.o: cogl-gles2-gears.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_gles2_gears_CFLAGS) $(CFLAGS) -MT cogl_gles2_gears-cogl-gles2-gears.o -MD -MP -MF $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Tpo -c -o cogl_gles2_gears-cogl-gles2-gears.o `test -f 'cogl-gles2-gears.c' || echo '$(srcdir)/'`cogl-gles2-gears.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Tpo $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-gles2-gears.c' object='cogl_gles2_gears-cogl-gles2-gears.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_gles2_gears_CFLAGS) $(CFLAGS) -c -o cogl_gles2_gears-cogl-gles2-gears.o `test -f 'cogl-gles2-gears.c' || echo '$(srcdir)/'`cogl-gles2-gears.c + +cogl_gles2_gears-cogl-gles2-gears.obj: cogl-gles2-gears.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_gles2_gears_CFLAGS) $(CFLAGS) -MT cogl_gles2_gears-cogl-gles2-gears.obj -MD -MP -MF $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Tpo -c -o cogl_gles2_gears-cogl-gles2-gears.obj `if test -f 'cogl-gles2-gears.c'; then $(CYGPATH_W) 'cogl-gles2-gears.c'; else $(CYGPATH_W) '$(srcdir)/cogl-gles2-gears.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Tpo $(DEPDIR)/cogl_gles2_gears-cogl-gles2-gears.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cogl-gles2-gears.c' object='cogl_gles2_gears-cogl-gles2-gears.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cogl_gles2_gears_CFLAGS) $(CFLAGS) -c -o cogl_gles2_gears-cogl-gles2-gears.obj `if test -f 'cogl-gles2-gears.c'; then $(CYGPATH_W) 'cogl-gles2-gears.c'; else $(CYGPATH_W) '$(srcdir)/cogl-gles2-gears.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-examples_dataDATA: $(examples_data_DATA) + @$(NORMAL_INSTALL) + @list='$(examples_data_DATA)'; test -n "$(examples_datadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(examples_datadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(examples_datadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(examples_datadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(examples_datadir)" || exit $$?; \ + done + +uninstall-examples_dataDATA: + @$(NORMAL_UNINSTALL) + @list='$(examples_data_DATA)'; test -n "$(examples_datadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(examples_datadir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +@USING_EMSCRIPTEN_FALSE@all-local: +all-am: Makefile $(PROGRAMS) $(DATA) all-local +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(examples_datadir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-examples_dataDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-examples_dataDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am \ + install-examples_dataDATA install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-examples_dataDATA + + +@USING_EMSCRIPTEN_TRUE@%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/glib/.libs/libglib.a +@USING_EMSCRIPTEN_TRUE@ $(CC) $(AM_CFLAGS) $(CFLAGS) --js-library $(top_srcdir)/examples/emscripten-example-js-library.js -o $@ $^ + +@USING_EMSCRIPTEN_TRUE@all-local: $(addsuffix .html, $(programs)) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/android/hello/.gitignore b/examples/android/hello/.gitignore new file mode 100644 index 0000000..7fdabdd --- /dev/null +++ b/examples/android/hello/.gitignore @@ -0,0 +1,7 @@ +bin +libs +obj + +default.properties +local.properties +proguard.cfg diff --git a/examples/android/hello/AndroidManifest.xml b/examples/android/hello/AndroidManifest.xml new file mode 100644 index 0000000..3cb6026 --- /dev/null +++ b/examples/android/hello/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/android/hello/build.xml b/examples/android/hello/build.xml new file mode 100644 index 0000000..d69afbc --- /dev/null +++ b/examples/android/hello/build.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/android/hello/jni/Android.mk b/examples/android/hello/jni/Android.mk new file mode 100644 index 0000000..01c811c --- /dev/null +++ b/examples/android/hello/jni/Android.mk @@ -0,0 +1,19 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := test-cogl-hello +LOCAL_SRC_FILES := main.c +LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM +LOCAL_STATIC_LIBRARIES := cogl android_native_app_glue gobject gmodule gthread glib-android glib iconv +LOCAL_ARM_MODE := arm +LOCAL_CFLAGS := \ + -DG_LOG_DOMAIN=\"TestCoglHello\" \ + -DCOGL_ENABLE_EXPERIMENTAL_2_0_API \ + $(NULL) + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,android/native_app_glue) +$(call import-module,glib) +$(call import-module,cogl) diff --git a/examples/android/hello/jni/Application.mk b/examples/android/hello/jni/Application.mk new file mode 100644 index 0000000..22d188e --- /dev/null +++ b/examples/android/hello/jni/Application.mk @@ -0,0 +1 @@ +APP_PLATFORM := android-9 diff --git a/examples/android/hello/jni/main.c b/examples/android/hello/jni/main.c new file mode 100644 index 0000000..c9a8401 --- /dev/null +++ b/examples/android/hello/jni/main.c @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * Copyright (C) 2011 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* + * This file is derived from the "native-activity" sample of the android NDK + * r5b. The coding style has been adapted to the code style most commonly found + * in glib/gobject based projects. + */ + +#include + +#include +#include +#include + +typedef struct +{ + struct android_app* app; + + CoglContext *context; + CoglPrimitive *triangle; + CoglFramebuffer *fb; +} TestData; + +static int test_init (TestData* data) +{ + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + + cogl_android_set_native_window (data->app->window); + + data->context = cogl_context_new (NULL, &error); + if (!data->context) + { + g_critical ("Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (data->context, 320, 420); + + /* Eventually there will be an implicit allocate on first use so this + * will become optional... */ + data->fb = COGL_FRAMEBUFFER (onscreen); + if (!cogl_framebuffer_allocate (data->fb, &error)) + { + if (error) + g_critical ("Failed to allocate framebuffer: %s\n", error->message); + else + g_critical ("Failed to allocate framebuffer"); + return 1; + } + + cogl_onscreen_show (onscreen); + + cogl_push_framebuffer (data->fb); + + data->triangle = cogl_primitive_new_p2c4 (COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + + return 0; +} + +static test_draw_frame_and_swap (TestData *data) +{ + if (data->context) + { + cogl_primitive_draw (data->triangle); + cogl_framebuffer_swap_buffers (data->fb); + } +} + +static void +test_fini (TestData *data) +{ + if (data->fb) + { + cogl_object_unref (data->triangle); + cogl_object_unref (data->fb); + cogl_object_unref (data->context); + data->triangle = NULL; + data->fb = NULL; + data->context = NULL; + } +} + +/** + * Process the next main command. + */ +static void +test_handle_cmd (struct android_app* app, + int32_t cmd) +{ + TestData *data = (TestData *) app->userData; + + switch (cmd) + { + case APP_CMD_INIT_WINDOW: + /* The window is being shown, get it ready */ + g_message ("command: INIT_WINDOW"); + if (data->app->window != NULL) + { + test_init (data); + test_draw_frame_and_swap (data); + } + break; + + case APP_CMD_TERM_WINDOW: + /* The window is being hidden or closed, clean it up */ + g_message ("command: TERM_WINDOW"); + test_fini (data); + break; + + case APP_CMD_GAINED_FOCUS: + g_message ("command: GAINED_FOCUS"); + break; + + case APP_CMD_LOST_FOCUS: + /* When our app loses focus, we stop monitoring the accelerometer. + * This is to avoid consuming battery while not being used. */ + g_message ("command: LOST_FOCUS"); + test_draw_frame_and_swap (data); + break; + } +} + +/** + * This is the main entry point of a native application that is using + * android_native_app_glue. It runs in its own thread, with its own + * event loop for receiving input events and doing other things. + */ +void +android_main (struct android_app* application) +{ + TestData data; + + /* Make sure glue isn't stripped */ + app_dummy (); + + g_android_init (); + + memset (&data, 0, sizeof (TestData)); + application->userData = &data; + application->onAppCmd = test_handle_cmd; + data.app = application; + + while (1) + { + int events; + struct android_poll_source* source; + + while ((ALooper_pollAll (0, NULL, &events, (void**)&source)) >= 0) + { + + /* Process this event */ + if (source != NULL) + source->process (application, source); + + /* Check if we are exiting */ + if (application->destroyRequested != 0) + { + test_fini (&data); + return; + } + } + + test_draw_frame_and_swap (&data); + } +} diff --git a/examples/android/hello/res/values/strings.xml b/examples/android/hello/res/values/strings.xml new file mode 100644 index 0000000..e4cdec0 --- /dev/null +++ b/examples/android/hello/res/values/strings.xml @@ -0,0 +1,4 @@ + + + TestCoglHello + diff --git a/examples/cogl-basic-video-player.c b/examples/cogl-basic-video-player.c new file mode 100644 index 0000000..f894c38 --- /dev/null +++ b/examples/cogl-basic-video-player.c @@ -0,0 +1,422 @@ +#include +#include +#include + +#include +#include + +typedef struct _Data +{ + CoglFramebuffer *fb; + CoglPipeline *border_pipeline; + CoglPipeline *video_pipeline; + CoglGstVideoSink *sink; + int onscreen_width; + int onscreen_height; + CoglGstRectangle video_output; + bool draw_ready; + bool frame_ready; + GMainLoop *main_loop; +}Data; + +static gboolean +_bus_watch (GstBus *bus, + GstMessage *msg, + void *user_data) +{ + Data *data = (Data*) user_data; + switch (GST_MESSAGE_TYPE (msg)) + { + case GST_MESSAGE_EOS: + { + g_main_loop_quit (data->main_loop); + break; + } + case GST_MESSAGE_ERROR: + { + char *debug; + GError *error = NULL; + + gst_message_parse_error (msg, &error, &debug); + g_free (debug); + + if (error != NULL) + { + g_error ("Playback error: %s\n", error->message); + g_error_free (error); + } + g_main_loop_quit (data->main_loop); + break; + } + default: + break; + } + + return TRUE; +} + +static void +_draw (Data *data) +{ + /* + The cogl pipeline needs to be retrieved from the sink before every draw. + This is due to the cogl-gst sink creating a new cogl pipeline for each frame + by copying the previous one and attaching the new frame to it. + */ + CoglPipeline* current = cogl_gst_video_sink_get_pipeline (data->sink); + + data->video_pipeline = current; + + if (data->video_output.x) + { + int x = data->video_output.x; + + /* Letterboxed with vertical borders */ + cogl_framebuffer_draw_rectangle (data->fb, + data->border_pipeline, + 0, 0, x, data->onscreen_height); + cogl_framebuffer_draw_rectangle (data->fb, + data->border_pipeline, + data->onscreen_width - x, + 0, + data->onscreen_width, + data->onscreen_height); + cogl_framebuffer_draw_rectangle (data->fb, data->video_pipeline, + x, 0, + x + data->video_output.width, + data->onscreen_height); + } + else if (data->video_output.y) + { + int y = data->video_output.y; + + /* Letterboxed with horizontal borders */ + cogl_framebuffer_draw_rectangle (data->fb, + data->border_pipeline, + 0, 0, data->onscreen_width, y); + cogl_framebuffer_draw_rectangle (data->fb, + data->border_pipeline, + 0, + data->onscreen_height - y, + data->onscreen_width, + data->onscreen_height); + cogl_framebuffer_draw_rectangle (data->fb, data->video_pipeline, + 0, y, + data->onscreen_width, + y + data->video_output.height); + + } + else + { + cogl_framebuffer_draw_rectangle (data->fb, + data->video_pipeline, + 0, 0, + data->onscreen_width, + data->onscreen_height); + } + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb)); +} + +static void +_check_draw (Data *data) +{ + /* The frame is only drawn once we know that a new buffer is ready + * from GStreamer and that Cogl is ready to accept some new + * rendering */ + if (data->draw_ready && data->frame_ready) + { + _draw (data); + data->draw_ready = FALSE; + data->frame_ready = FALSE; + } +} + +static void +_frame_callback (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + { + data->draw_ready = TRUE; + _check_draw (data); + } +} + +static void +_new_frame_cb (CoglGstVideoSink *sink, + Data *data) +{ + data->frame_ready = TRUE; + _check_draw (data); +} + +static void +_resize_callback (CoglOnscreen *onscreen, + int width, + int height, + void *user_data) +{ + Data *data = user_data; + CoglGstRectangle available; + + data->onscreen_width = width; + data->onscreen_height = height; + + cogl_framebuffer_orthographic (data->fb, 0, 0, width, height, -1, 100); + + if (!data->video_pipeline) + return; + + available.x = 0; + available.y = 0; + available.width = width; + available.height = height; + cogl_gst_video_sink_fit_size (data->sink, + &available, + &data->video_output); +} + +/* + A callback like this should be attached to the cogl-pipeline-ready + signal. This way requesting the cogl pipeline before its creation + by the sink is avoided. At this point, user textures and snippets can + be added to the cogl pipeline. +*/ + +static void +_set_up_pipeline (gpointer instance, + gpointer user_data) +{ + Data* data = (Data*) user_data; + + data->video_pipeline = cogl_gst_video_sink_get_pipeline (data->sink); + + /* disable blending... */ + cogl_pipeline_set_blend (data->video_pipeline, + "RGBA = ADD (SRC_COLOR, 0)", NULL); + + /* Now that we know the video size we can perform letterboxing */ + _resize_callback (COGL_ONSCREEN (data->fb), + data->onscreen_width, + data->onscreen_height, + data); + + cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data->fb), _frame_callback, + data, NULL); + + /* + The cogl-gst-new-frame signal is emitted when the cogl-gst sink has + retrieved a new frame and attached it to the cogl pipeline. This can be + used to make sure cogl doesn't do any unnecessary drawing i.e. keeps to the + frame-rate of the video. + */ + + g_signal_connect (data->sink, "new-frame", G_CALLBACK (_new_frame_cb), data); +} + +static CoglBool +is_uri (const char *str) +{ + const char *p = str; + + while (g_ascii_isalpha (*p)) + p++; + + return p > str && g_str_has_prefix (p, "://"); +} + +static CoglGstVideoSink * +find_cogl_gst_video_sink (GstElement *element) +{ + GstElement *sink_element = NULL; + GstIterator *iterator; + GstElement *iterator_value; + GValue value; + + if (!GST_IS_BIN (element)) + return NULL; + + iterator = gst_bin_iterate_recurse (GST_BIN (element)); + + g_value_init (&value, GST_TYPE_ELEMENT); + + while (gst_iterator_next (iterator, &value) == GST_ITERATOR_OK) + { + iterator_value = g_value_get_object (&value); + + g_value_reset (&value); + + if (COGL_GST_IS_VIDEO_SINK (iterator_value)) + { + sink_element = iterator_value; + break; + } + } + + g_value_unset (&value); + + gst_iterator_free (iterator); + + return COGL_GST_VIDEO_SINK (sink_element); +} + + +static CoglBool +make_pipeline_for_uri (CoglContext *ctx, + const char *uri, + GstElement **pipeline_out, + CoglGstVideoSink **sink_out, + GError **error) +{ + GstElement *pipeline; + GstElement *bin; + CoglGstVideoSink *sink; + GError *tmp_error = NULL; + + if (is_uri (uri)) + { + pipeline = gst_pipeline_new ("gst-player"); + bin = gst_element_factory_make ("playbin", "bin"); + + sink = cogl_gst_video_sink_new (ctx); + + g_object_set (G_OBJECT (bin), + "video-sink", + GST_ELEMENT (sink), + NULL); + + gst_bin_add (GST_BIN (pipeline), bin); + + g_object_set (G_OBJECT (bin), "uri", uri, NULL); + } + else + { + pipeline = gst_parse_launch (uri, &tmp_error); + + if (tmp_error) + { + if (pipeline) + g_object_unref (pipeline); + + g_propagate_error (error, tmp_error); + + return FALSE; + } + + sink = find_cogl_gst_video_sink (pipeline); + + if (sink == NULL) + { + g_set_error (error, + GST_STREAM_ERROR, + GST_STREAM_ERROR_FAILED, + "The pipeline does not contain a CoglGstVideoSink. " + "Make sure you add a 'coglsink' element somewhere in " + "the pipeline"); + g_object_unref (pipeline); + return FALSE; + } + + g_object_ref (sink); + + cogl_gst_video_sink_set_context (sink, ctx); + } + + *pipeline_out = pipeline; + *sink_out = sink; + + return TRUE; +} + +int +main (int argc, + char **argv) +{ + Data data; + CoglContext *ctx; + CoglOnscreen *onscreen; + GstElement *pipeline; + GSource *cogl_source; + GstBus *bus; + char *uri; + GError *error = NULL; + + memset (&data, 0, sizeof (Data)); + + /* Set the necessary cogl elements */ + + ctx = cogl_context_new (NULL, NULL); + + onscreen = cogl_onscreen_new (ctx, 640, 480); + cogl_onscreen_set_resizable (onscreen, TRUE); + cogl_onscreen_add_resize_callback (onscreen, _resize_callback, &data, NULL); + cogl_onscreen_show (onscreen); + + data.fb = onscreen; + cogl_framebuffer_orthographic (data.fb, 0, 0, 640, 480, -1, 100); + + data.border_pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_color4f (data.border_pipeline, 0, 0, 0, 1); + /* disable blending */ + cogl_pipeline_set_blend (data.border_pipeline, + "RGBA = ADD (SRC_COLOR, 0)", NULL); + + /* Intialize GStreamer */ + + gst_init (&argc, &argv); + + /* + Create the cogl-gst video sink by calling the cogl_gst_video_sink_new + function and passing it a CoglContext (this is used to create the + CoglPipeline and the texures for each frame). Alternatively you can use + gst_element_factory_make ("coglsink", "some_name") and then set the + context with cogl_gst_video_sink_set_context. + */ + + if (argc < 2) + uri = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm"; + else + uri = argv[1]; + + if (!make_pipeline_for_uri (ctx, uri, &pipeline, &data.sink, &error)) + { + g_print ("Error creating pipeline: %s\n", error->message); + g_clear_error (&error); + return EXIT_FAILURE; + } + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, _bus_watch, &data); + + data.main_loop = g_main_loop_new (NULL, FALSE); + + cogl_source = cogl_glib_source_new (ctx, G_PRIORITY_DEFAULT); + g_source_attach (cogl_source, NULL); + + /* + The cogl-pipeline-ready signal tells you when the cogl pipeline is + initialized i.e. when cogl-gst has figured out the video format and + is prepared to retrieve and attach the first frame of the video. + */ + + g_signal_connect (data.sink, "pipeline-ready", + G_CALLBACK (_set_up_pipeline), &data); + + data.draw_ready = TRUE; + data.frame_ready = FALSE; + + g_main_loop_run (data.main_loop); + + g_source_destroy (cogl_source); + g_source_unref (cogl_source); + + g_main_loop_unref (data.main_loop); + + return 0; +} diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c new file mode 100644 index 0000000..0836b82 --- /dev/null +++ b/examples/cogl-crate.c @@ -0,0 +1,302 @@ +#include +#include + +/* The state for this example... */ +typedef struct _Data +{ + CoglFramebuffer *fb; + int framebuffer_width; + int framebuffer_height; + + CoglMatrix view; + + CoglIndices *indices; + CoglPrimitive *prim; + CoglTexture *texture; + CoglPipeline *crate_pipeline; + + CoglPangoFontMap *pango_font_map; + PangoContext *pango_context; + PangoFontDescription *pango_font_desc; + + PangoLayout *hello_label; + int hello_label_width; + int hello_label_height; + + GTimer *timer; + + CoglBool swap_ready; + +} Data; + +/* A static identity matrix initialized for convenience. */ +static CoglMatrix identity; +/* static colors initialized for convenience. */ +static CoglColor white; + +/* A cube modelled using 4 vertices for each face. + * + * We use an index buffer when drawing the cube later so the GPU will + * actually read each face as 2 separate triangles. + */ +static CoglVertexP3T2 vertices[] = +{ + /* Front face */ + { /* pos = */ -1.0f, -1.0f, 1.0f, /* tex coords = */ 0.0f, 1.0f}, + { /* pos = */ 1.0f, -1.0f, 1.0f, /* tex coords = */ 1.0f, 1.0f}, + { /* pos = */ 1.0f, 1.0f, 1.0f, /* tex coords = */ 1.0f, 0.0f}, + { /* pos = */ -1.0f, 1.0f, 1.0f, /* tex coords = */ 0.0f, 0.0f}, + + /* Back face */ + { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f}, + { /* pos = */ -1.0f, 1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f}, + { /* pos = */ 1.0f, 1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f}, + { /* pos = */ 1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 0.0f}, + + /* Top face */ + { /* pos = */ -1.0f, 1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f}, + { /* pos = */ -1.0f, 1.0f, 1.0f, /* tex coords = */ 0.0f, 0.0f}, + { /* pos = */ 1.0f, 1.0f, 1.0f, /* tex coords = */ 1.0f, 0.0f}, + { /* pos = */ 1.0f, 1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f}, + + /* Bottom face */ + { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f}, + { /* pos = */ 1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f}, + { /* pos = */ 1.0f, -1.0f, 1.0f, /* tex coords = */ 0.0f, 0.0f}, + { /* pos = */ -1.0f, -1.0f, 1.0f, /* tex coords = */ 1.0f, 0.0f}, + + /* Right face */ + { /* pos = */ 1.0f, -1.0f, -1.0f, /* tex coords = */ 1.0f, 0.0f}, + { /* pos = */ 1.0f, 1.0f, -1.0f, /* tex coords = */ 1.0f, 1.0f}, + { /* pos = */ 1.0f, 1.0f, 1.0f, /* tex coords = */ 0.0f, 1.0f}, + { /* pos = */ 1.0f, -1.0f, 1.0f, /* tex coords = */ 0.0f, 0.0f}, + + /* Left face */ + { /* pos = */ -1.0f, -1.0f, -1.0f, /* tex coords = */ 0.0f, 0.0f}, + { /* pos = */ -1.0f, -1.0f, 1.0f, /* tex coords = */ 1.0f, 0.0f}, + { /* pos = */ -1.0f, 1.0f, 1.0f, /* tex coords = */ 1.0f, 1.0f}, + { /* pos = */ -1.0f, 1.0f, -1.0f, /* tex coords = */ 0.0f, 1.0f} +}; + +static void +paint (Data *data) +{ + CoglFramebuffer *fb = data->fb; + float rotation; + + cogl_framebuffer_clear4f (fb, + COGL_BUFFER_BIT_COLOR|COGL_BUFFER_BIT_DEPTH, + 0, 0, 0, 1); + + cogl_framebuffer_push_matrix (fb); + + cogl_framebuffer_translate (fb, + data->framebuffer_width / 2, + data->framebuffer_height / 2, + 0); + + cogl_framebuffer_scale (fb, 75, 75, 75); + + /* Update the rotation based on the time the application has been + running so that we get a linear animation regardless of the frame + rate */ + rotation = g_timer_elapsed (data->timer, NULL) * 60.0f; + + /* Rotate the cube separately around each axis. + * + * Note: Cogl matrix manipulation follows the same rules as for + * OpenGL. We use column-major matrices and - if you consider the + * transformations happening to the model - then they are combined + * in reverse order which is why the rotation is done last, since + * we want it to be a rotation around the origin, before it is + * scaled and translated. + */ + cogl_framebuffer_rotate (fb, rotation, 0, 0, 1); + cogl_framebuffer_rotate (fb, rotation, 0, 1, 0); + cogl_framebuffer_rotate (fb, rotation, 1, 0, 0); + + cogl_primitive_draw (data->prim, fb, data->crate_pipeline); + + cogl_framebuffer_pop_matrix (fb); + + /* And finally render our Pango layouts... */ + + cogl_pango_render_layout (data->hello_label, + (data->framebuffer_width / 2) - + (data->hello_label_width / 2), + (data->framebuffer_height / 2) - + (data->hello_label_height / 2), + &white, 0); +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + data->swap_ready = TRUE; +} + +int +main (int argc, char **argv) +{ + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + CoglError *error = NULL; + Data data; + PangoRectangle hello_label_size; + float fovy, aspect, z_near, z_2d, z_far; + CoglDepthState depth_state; + + ctx = cogl_context_new (NULL, &error); + if (!ctx) { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 640, 480); + fb = onscreen; + data.fb = fb; + data.framebuffer_width = cogl_framebuffer_get_width (fb); + data.framebuffer_height = cogl_framebuffer_get_height (fb); + + data.timer = g_timer_new (); + + cogl_onscreen_show (onscreen); + + cogl_framebuffer_set_viewport (fb, 0, 0, + data.framebuffer_width, + data.framebuffer_height); + + fovy = 60; /* y-axis field of view */ + aspect = (float)data.framebuffer_width/(float)data.framebuffer_height; + z_near = 0.1; /* distance to near clipping plane */ + z_2d = 1000; /* position to 2d plane */ + z_far = 2000; /* distance to far clipping plane */ + + cogl_framebuffer_perspective (fb, fovy, aspect, z_near, z_far); + + /* Since the pango renderer emits geometry in pixel/device coordinates + * and the anti aliasing is implemented with the assumption that the + * geometry *really* does end up pixel aligned, we setup a modelview + * matrix so that for geometry in the plane z = 0 we exactly map x + * coordinates in the range [0,stage_width] and y coordinates in the + * range [0,stage_height] to the framebuffer extents with (0,0) being + * the top left. + * + * This is roughly what Clutter does for a ClutterStage, but this + * demonstrates how it is done manually using Cogl. + */ + cogl_matrix_init_identity (&data.view); + cogl_matrix_view_2d_in_perspective (&data.view, fovy, aspect, z_near, z_2d, + data.framebuffer_width, + data.framebuffer_height); + cogl_framebuffer_set_modelview_matrix (fb, &data.view); + + /* Initialize some convenient constants */ + cogl_matrix_init_identity (&identity); + cogl_color_init_from_4ub (&white, 0xff, 0xff, 0xff, 0xff); + + /* rectangle indices allow the GPU to interpret a list of quads (the + * faces of our cube) as a list of triangles. + * + * Since this is a very common thing to do + * cogl_get_rectangle_indices() is a convenience function for + * accessing internal index buffers that can be shared. + */ + data.indices = cogl_get_rectangle_indices (ctx, 6 /* n_rectangles */); + data.prim = cogl_primitive_new_p3t2 (ctx, COGL_VERTICES_MODE_TRIANGLES, + G_N_ELEMENTS (vertices), + vertices); + /* Each face will have 6 indices so we have 6 * 6 indices in total... */ + cogl_primitive_set_indices (data.prim, + data.indices, + 6 * 6); + + /* Load a jpeg crate texture from a file */ + printf ("crate.jpg (CC by-nc-nd http://bit.ly/9kP45T) ShadowRunner27 http://bit.ly/m1YXLh\n"); + data.texture = + cogl_texture_2d_new_from_file (ctx, + COGL_EXAMPLES_DATA "crate.jpg", + &error); + if (!data.texture) + g_error ("Failed to load texture: %s", error->message); + + /* a CoglPipeline conceptually describes all the state for vertex + * processing, fragment processing and blending geometry. When + * drawing the geometry for the crate this pipeline says to sample a + * single texture during fragment processing... */ + data.crate_pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_layer_texture (data.crate_pipeline, 0, data.texture); + + /* Since the box is made of multiple triangles that will overlap + * when drawn and we don't control the order they are drawn in, we + * enable depth testing to make sure that triangles that shouldn't + * be visible get culled by the GPU. */ + cogl_depth_state_init (&depth_state); + cogl_depth_state_set_test_enabled (&depth_state, TRUE); + + cogl_pipeline_set_depth_state (data.crate_pipeline, &depth_state, NULL); + + /* Setup a Pango font map and context */ + + data.pango_font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new()); + + cogl_pango_font_map_set_use_mipmapping (data.pango_font_map, TRUE); + + data.pango_context = cogl_pango_font_map_create_context (data.pango_font_map); + + data.pango_font_desc = pango_font_description_new (); + pango_font_description_set_family (data.pango_font_desc, "Sans"); + pango_font_description_set_size (data.pango_font_desc, 30 * PANGO_SCALE); + + /* Setup the "Hello Cogl" text */ + + data.hello_label = pango_layout_new (data.pango_context); + pango_layout_set_font_description (data.hello_label, data.pango_font_desc); + pango_layout_set_text (data.hello_label, "Hello Cogl", -1); + + pango_layout_get_extents (data.hello_label, NULL, &hello_label_size); + data.hello_label_width = PANGO_PIXELS (hello_label_size.width); + data.hello_label_height = PANGO_PIXELS (hello_label_size.height); + + cogl_push_framebuffer (fb); + + data.swap_ready = TRUE; + + cogl_onscreen_add_frame_callback (COGL_ONSCREEN (fb), + frame_event_cb, + &data, + NULL); /* destroy notify */ + + + while (1) + { + CoglPollFD *poll_fds; + int n_poll_fds; + int64_t timeout; + + if (data.swap_ready) + { + paint (&data); + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); + } + + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); + + g_poll ((GPollFD *) poll_fds, n_poll_fds, + timeout == -1 ? -1 : timeout / 1000); + + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); + } + + return 0; +} + diff --git a/examples/cogl-emscripten-hello.c b/examples/cogl-emscripten-hello.c new file mode 100644 index 0000000..e969e95 --- /dev/null +++ b/examples/cogl-emscripten-hello.c @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include "emscripten-example-js.h" + +/* This short example is just to demonstrate using Cogl with + * Emscripten using SDL to receive input events */ + +typedef struct Data +{ + CoglPrimitive *triangle; + CoglPipeline *pipeline; + float center_x, center_y; + CoglFramebuffer *fb; + CoglBool redraw_queued; + CoglBool ready_to_draw; +} Data; + +static Data data; +static CoglContext *ctx; + +static void +redraw (Data *data) +{ + CoglFramebuffer *fb = data->fb; + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f); + + cogl_primitive_draw (data->triangle, fb, data->pipeline); + cogl_framebuffer_pop_matrix (fb); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); +} + +static void +handle_event (Data *data, SDL_Event *event) +{ + switch (event->type) + { + case SDL_MOUSEMOTION: + { + int width = + cogl_framebuffer_get_width (COGL_FRAMEBUFFER (data->fb)); + int height = + cogl_framebuffer_get_height (COGL_FRAMEBUFFER (data->fb)); + + data->center_x = event->motion.x * 2.0f / width - 1.0f; + data->center_y = event->motion.y * 2.0f / height - 1.0f; + + data->redraw_queued = TRUE; + } + break; + } +} + +static void +frame_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + data->ready_to_draw = TRUE; +} + +static void +mainloop (void) +{ + SDL_Event event; + + while (SDL_PollEvent (&event)) + { + handle_event (&data, &event); + cogl_sdl_handle_event (ctx, &event); + } + + if (data.redraw_queued && data.ready_to_draw) + { + data.redraw_queued = FALSE; + data.ready_to_draw = FALSE; + redraw (&data); + } + + /* NB: The mainloop will be automatically resumed if user input is received */ + if (!data.redraw_queued) + emscripten_pause_main_loop (); + + cogl_sdl_idle (ctx); +} + +int +main (int argc, char **argv) +{ + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + + ctx = cogl_sdl_context_new (SDL_USEREVENT, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 800, 600); + data.fb = COGL_FRAMEBUFFER (onscreen); + + cogl_onscreen_add_frame_callback (onscreen, + frame_cb, + &data, + NULL /* destroy callback */); + + data.center_x = 0.0f; + data.center_y = 0.0f; + + cogl_onscreen_show (onscreen); + + data.triangle = cogl_primitive_new_p2c4 (ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + data.pipeline = cogl_pipeline_new (ctx); + + data.redraw_queued = TRUE; + data.ready_to_draw = TRUE; + + /* The emscripten mainloop isn't event driven, it's periodic and so + * we aim to pause the emscripten mainlooop whenever we don't have a + * redraw queued. What we do instead is hook into the real browser + * mainloop using this javascript binding api to add an input event + * listener that will resume the emscripten mainloop whenever input + * is received. + */ + example_js_add_input_listener (); + + emscripten_set_main_loop (mainloop, -1, TRUE); + + cogl_object_unref (ctx); + + return 0; +} diff --git a/examples/cogl-gjs.js b/examples/cogl-gjs.js new file mode 100644 index 0000000..6652e16 --- /dev/null +++ b/examples/cogl-gjs.js @@ -0,0 +1,46 @@ +const Cogl = imports.gi.Cogl; +const GLib = imports.gi.GLib; +const Lang = imports.lang; + +let renderer = new Cogl.Renderer(); +let display = new Cogl.Display(renderer, new Cogl.OnscreenTemplate(new Cogl.SwapChain())); +let ctx = new Cogl.Context(display); + +// Should be able to replace the 3 previous lines with : +// let ctx = new Cogl.Context(null); +// But crashing for some reason. + +// GLib mainloop integration +let gsource = Cogl.glib_renderer_source_new(renderer, 0); +let loop = GLib.MainLoop.new(null, false); +gsource.attach(loop.get_context()); + +// Onscreen creation +let onscreen = new Cogl.Onscreen(ctx, 800, 600); +onscreen.show(); + +// Drawing pipeline +let crate = Cogl.Texture2D.new_from_file(ctx, 'crate.jpg'); +let pipeline = new Cogl.Pipeline(ctx); +pipeline.set_layer_texture(0, crate); +let clearColor = new Cogl.Color(); +clearColor.init_from_4f(0, 0, 0, 1.0); + +// Redraw callback +let closure = onscreen.add_dirty_callback(Lang.bind(this, function() { + onscreen.clear(Cogl.BufferBit.COLOR, clearColor); + onscreen.draw_rectangle(pipeline, -1, -1, 1, 1); + onscreen.swap_buffers(); + return true; +}), null); + +// Quit after 5s +let tm = GLib.timeout_source_new(5000); +tm.set_callback(Lang.bind(this, function() { + loop.quit(); + return false; +}), null); +tm.attach(loop.get_context()); + +// Run! +loop.run(); diff --git a/examples/cogl-gles2-context.c b/examples/cogl-gles2-context.c new file mode 100644 index 0000000..da52423 --- /dev/null +++ b/examples/cogl-gles2-context.c @@ -0,0 +1,138 @@ +#include +#include +#include +#include + +#define OFFSCREEN_WIDTH 100 +#define OFFSCREEN_HEIGHT 100 + +typedef struct _Data +{ + CoglContext *ctx; + CoglFramebuffer *fb; + CoglPrimitive *triangle; + CoglPipeline *pipeline; + + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglGLES2Context *gles2_ctx; + const CoglGLES2Vtable *gles2_vtable; +} Data; + +static gboolean +paint_cb (void *user_data) +{ + Data *data = user_data; + CoglError *error = NULL; + const CoglGLES2Vtable *gles2 = data->gles2_vtable; + + /* Draw scene with GLES2 */ + if (!cogl_push_gles2_context (data->ctx, + data->gles2_ctx, + data->fb, + data->fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + /* Clear offscreen framebuffer with a random color */ + gles2->glClearColor (g_random_double (), + g_random_double (), + g_random_double (), + 1.0f); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (data->ctx); + + /* Draw scene with Cogl */ + cogl_primitive_draw (data->triangle, data->fb, data->pipeline); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb)); + + return FALSE; /* remove the callback */ +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + if (event == COGL_FRAME_EVENT_SYNC) + paint_cb (user_data); +} + +int +main (int argc, char **argv) +{ + Data data; + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + GSource *cogl_source; + GMainLoop *loop; + CoglRenderer *renderer; + CoglDisplay *display; + + renderer = cogl_renderer_new (); + cogl_renderer_add_constraint (renderer, + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2); + display = cogl_display_new (renderer, NULL); + data.ctx = cogl_context_new (display, NULL); + + onscreen = cogl_onscreen_new (data.ctx, 640, 480); + cogl_onscreen_show (onscreen); + data.fb = onscreen; + + /* Prepare onscreen primitive */ + data.triangle = cogl_primitive_new_p2c4 (data.ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + data.pipeline = cogl_pipeline_new (data.ctx); + + data.offscreen_texture = + cogl_texture_2d_new_with_size (data.ctx, + OFFSCREEN_WIDTH, + OFFSCREEN_HEIGHT); + data.offscreen = cogl_offscreen_new_with_texture (data.offscreen_texture); + + data.gles2_ctx = cogl_gles2_context_new (data.ctx, &error); + if (!data.gles2_ctx) { + g_error ("Failed to create GLES2 context: %s\n", error->message); + } + + data.gles2_vtable = cogl_gles2_context_get_vtable (data.gles2_ctx); + + /* Draw scene with GLES2 */ + if (!cogl_push_gles2_context (data.ctx, + data.gles2_ctx, + data.fb, + data.fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + cogl_pop_gles2_context (data.ctx); + + cogl_source = cogl_glib_source_new (data.ctx, G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data.fb), + frame_event_cb, + &data, + NULL); /* destroy notify */ + + g_idle_add (paint_cb, &data); + + loop = g_main_loop_new (NULL, TRUE); + g_main_loop_run (loop); + + return 0; +} diff --git a/examples/cogl-gles2-gears.c b/examples/cogl-gles2-gears.c new file mode 100644 index 0000000..048cd27 --- /dev/null +++ b/examples/cogl-gles2-gears.c @@ -0,0 +1,825 @@ +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Ported to GLES2. + * Kristian Høgsberg + * May 3, 2010 + * + * Improve GLES2 port: + * * Refactor gear drawing. + * * Use correct normals for surfaces. + * * Improve shader. + * * Use perspective projection transformation. + * * Add FPS count. + * * Add comments. + * Alexandros Frantzis + * Jul 13, 2010 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define GL_GLEXT_PROTOTYPES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRIPS_PER_TOOTH 7 +#define VERTICES_PER_TOOTH 34 +#define GEAR_VERTEX_STRIDE 6 + +typedef struct _Data +{ + CoglContext *ctx; + CoglFramebuffer *fb; + + CoglGLES2Context *gles2_ctx; + + GTimer *timer; + int frames; + double last_elapsed; +} Data; + + +/** + * Struct describing the vertices in triangle strip + */ +struct vertex_strip { + /** The first vertex in the strip */ + GLint first; + /** The number of consecutive vertices in the strip after the first */ + GLint count; +}; + +/* Each vertex consist of GEAR_VERTEX_STRIDE GLfloat attributes */ +typedef GLfloat GearVertex[GEAR_VERTEX_STRIDE]; + +/** + * Struct representing a gear. + */ +struct gear { + /** The array of vertices comprising the gear */ + GearVertex *vertices; + /** The number of vertices comprising the gear */ + int nvertices; + /** The array of triangle strips comprising the gear */ + struct vertex_strip *strips; + /** The number of triangle strips comprising the gear */ + int nstrips; + /** The Vertex Buffer Object holding the vertices in the graphics card */ + GLuint vbo; +}; + +/** The view rotation [x, y, z] */ +static GLfloat view_rot[3] = { 20.0, 30.0, 0.0 }; +/** The gears */ +static struct gear *gear1, *gear2, *gear3; +/** The current gear rotation angle */ +static GLfloat angle = 0.0; +/** The location of the shader uniforms */ +static GLuint ModelViewProjectionMatrix_location, + NormalMatrix_location, + LightSourcePosition_location, + MaterialColor_location; +/** The projection matrix */ +static GLfloat ProjectionMatrix[16]; +/** The direction of the directional light for the scene */ +static const GLfloat LightSourcePosition[4] = { 5.0, 5.0, 10.0, 1.0}; + +#ifndef HAVE_SINCOS +static void +sincos (double x, double *sinx, double *cosx) +{ + *sinx = sin (x); + *cosx = cos (x); +} +#endif /* HAVE_SINCOS */ + +/** + * Fills a gear vertex. + * + * @param v the vertex to fill + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coortinate + * @param n pointer to the normal table + * + * @return the operation error code + */ +static GearVertex * +vert (GearVertex *v, GLfloat x, GLfloat y, GLfloat z, GLfloat n[3]) +{ + v[0][0] = x; + v[0][1] = y; + v[0][2] = z; + v[0][3] = n[0]; + v[0][4] = n[1]; + v[0][5] = n[2]; + + return v + 1; +} + +/** + * Create a gear wheel. + * + * @param inner_radius radius of hole at center + * @param outer_radius radius at center of teeth + * @param width width of gear + * @param teeth number of teeth + * @param tooth_depth depth of tooth + * + * @return pointer to the constructed struct gear + */ +static struct gear * +create_gear (GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth) +{ + GLfloat r0, r1, r2; + GLfloat da; + GearVertex *v; + struct gear *gear; + double s[5], c[5]; + GLfloat normal[3]; + int cur_strip = 0; + int i; + + /* Allocate memory for the gear */ + gear = malloc (sizeof *gear); + if (gear == NULL) + return NULL; + + /* Calculate the radii used in the gear */ + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0; + r2 = outer_radius + tooth_depth / 2.0; + + da = 2.0 * M_PI / teeth / 4.0; + + /* Allocate memory for the triangle strip information */ + gear->nstrips = STRIPS_PER_TOOTH * teeth; + gear->strips = calloc (gear->nstrips, sizeof (*gear->strips)); + + /* Allocate memory for the vertices */ + gear->vertices = calloc (VERTICES_PER_TOOTH * teeth, sizeof(*gear->vertices)); + v = gear->vertices; + + for (i = 0; i < teeth; i++) { + /* Calculate needed sin/cos for varius angles */ + sincos (i * 2.0 * M_PI / teeth, &s[0], &c[0]); + sincos (i * 2.0 * M_PI / teeth + da, &s[1], &c[1]); + sincos (i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]); + sincos (i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]); + sincos (i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]); + + /* A set of macros for making the creation of the gears easier */ +#define GEAR_POINT(r, da) { (r) * c[(da)], (r) * s[(da)] } +#define SET_NORMAL(x, y, z) do { \ + normal[0] = (x); normal[1] = (y); normal[2] = (z); \ +} while(0) + +#define GEAR_VERT(v, point, sign) vert((v), p[(point)].x, p[(point)].y, (sign) * width * 0.5, normal) + +#define START_STRIP do { \ + gear->strips[cur_strip].first = v - gear->vertices; \ +} while(0); + +#define END_STRIP do { \ + int _tmp = (v - gear->vertices); \ + gear->strips[cur_strip].count = _tmp - gear->strips[cur_strip].first; \ + cur_strip++; \ +} while (0) + +#define QUAD_WITH_NORMAL(p1, p2) do { \ + SET_NORMAL((p[(p1)].y - p[(p2)].y), -(p[(p1)].x - p[(p2)].x), 0); \ + v = GEAR_VERT(v, (p1), -1); \ + v = GEAR_VERT(v, (p1), 1); \ + v = GEAR_VERT(v, (p2), -1); \ + v = GEAR_VERT(v, (p2), 1); \ +} while(0) + + { + struct point { + GLfloat x; + GLfloat y; + }; + + /* Create the 7 points (only x,y coords) used to draw a tooth */ + struct point p[7] = { + GEAR_POINT (r2, 1), // 0 + GEAR_POINT (r2, 2), // 1 + GEAR_POINT (r1, 0), // 2 + GEAR_POINT (r1, 3), // 3 + GEAR_POINT (r0, 0), // 4 + GEAR_POINT (r1, 4), // 5 + GEAR_POINT (r0, 4), // 6 + }; + + /* Front face */ + START_STRIP; + SET_NORMAL (0, 0, 1.0); + v = GEAR_VERT (v, 0, +1); + v = GEAR_VERT (v, 1, +1); + v = GEAR_VERT (v, 2, +1); + v = GEAR_VERT (v, 3, +1); + v = GEAR_VERT (v, 4, +1); + v = GEAR_VERT (v, 5, +1); + v = GEAR_VERT (v, 6, +1); + END_STRIP; + + /* Inner face */ + START_STRIP; + QUAD_WITH_NORMAL (4, 6); + END_STRIP; + + /* Back face */ + START_STRIP; + SET_NORMAL (0, 0, -1.0); + v = GEAR_VERT (v, 6, -1); + v = GEAR_VERT (v, 5, -1); + v = GEAR_VERT (v, 4, -1); + v = GEAR_VERT (v, 3, -1); + v = GEAR_VERT (v, 2, -1); + v = GEAR_VERT (v, 1, -1); + v = GEAR_VERT (v, 0, -1); + END_STRIP; + + /* Outer face */ + START_STRIP; + QUAD_WITH_NORMAL (0, 2); + END_STRIP; + + START_STRIP; + QUAD_WITH_NORMAL (1, 0); + END_STRIP; + + START_STRIP; + QUAD_WITH_NORMAL (3, 1); + END_STRIP; + + START_STRIP; + QUAD_WITH_NORMAL (5, 3); + END_STRIP; + } + } + + gear->nvertices = (v - gear->vertices); + + /* Store the vertices in a vertex buffer object (VBO) */ + glGenBuffers (1, &gear->vbo); + glBindBuffer (GL_ARRAY_BUFFER, gear->vbo); + glBufferData (GL_ARRAY_BUFFER, gear->nvertices * sizeof(GearVertex), + gear->vertices, GL_STATIC_DRAW); + + return gear; +} + +/** + * Multiplies two 4x4 matrices. + * + * The result is stored in matrix m. + * + * @param m the first matrix to multiply + * @param n the second matrix to multiply + */ +static void +multiply (GLfloat *m, const GLfloat *n) +{ + GLfloat tmp[16]; + const GLfloat *row, *column; + div_t d; + int i, j; + + for (i = 0; i < 16; i++) { + tmp[i] = 0; + d = div(i, 4); + row = n + d.quot * 4; + column = m + d.rem; + for (j = 0; j < 4; j++) + tmp[i] += row[j] * column[j * 4]; + } + memcpy (m, &tmp, sizeof tmp); +} + +/** + * Rotates a 4x4 matrix. + * + * @param[in,out] m the matrix to rotate + * @param angle the angle to rotate + * @param x the x component of the direction to rotate to + * @param y the y component of the direction to rotate to + * @param z the z component of the direction to rotate to + */ +static void +rotate (GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +{ + double s, c; + + sincos (angle, &s, &c); + + { + GLfloat r[16] = { + x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0, + x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0, + x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0, + 0, 0, 0, 1 + }; + + multiply (m, r); + } +} + + +/** + * Translates a 4x4 matrix. + * + * @param[in,out] m the matrix to translate + * @param x the x component of the direction to translate to + * @param y the y component of the direction to translate to + * @param z the z component of the direction to translate to + */ +static void +translate(GLfloat *m, GLfloat x, GLfloat y, GLfloat z) +{ + GLfloat t[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 }; + + multiply (m, t); +} + +/** + * Creates an identity 4x4 matrix. + * + * @param m the matrix make an identity matrix + */ +static void +identity (GLfloat *m) +{ + GLfloat t[16] = { + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0, + }; + + memcpy (m, t, sizeof(t)); +} + +/** + * Transposes a 4x4 matrix. + * + * @param m the matrix to transpose + */ +static void +transpose (GLfloat *m) +{ + GLfloat t[16] = { + m[0], m[4], m[8], m[12], + m[1], m[5], m[9], m[13], + m[2], m[6], m[10], m[14], + m[3], m[7], m[11], m[15]}; + + memcpy (m, t, sizeof(t)); +} + +/** + * Inverts a 4x4 matrix. + * + * This function can currently handle only pure translation-rotation matrices. + * Read http://www.gamedev.net/community/forums/topic.asp?topic_id=425118 + * for an explanation. + */ +static void +invert (GLfloat *m) +{ + GLfloat t[16]; + identity (t); + + // Extract and invert the translation part 't'. The inverse of a + // translation matrix can be calculated by negating the translation + // coordinates. + t[12] = -m[12]; t[13] = -m[13]; t[14] = -m[14]; + + // Invert the rotation part 'r'. The inverse of a rotation matrix is + // equal to its transpose. + m[12] = m[13] = m[14] = 0; + transpose (m); + + // inv (m) = inv (r) * inv (t) + multiply (m, t); +} + +/** + * Calculate a perspective projection transformation. + * + * @param m the matrix to save the transformation in + * @param fovy the field of view in the y direction + * @param aspect the view aspect ratio + * @param zNear the near clipping plane + * @param zFar the far clipping plane + */ +static void +perspective (GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar) +{ + GLfloat tmp[16]; + double sine, cosine, cotangent, deltaZ; + GLfloat radians = fovy / 2 * M_PI / 180; + + identity (tmp); + + deltaZ = zFar - zNear; + sincos (radians, &sine, &cosine); + + if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) + return; + + cotangent = cosine / sine; + + tmp[0] = cotangent / aspect; + tmp[5] = cotangent; + tmp[10] = -(zFar + zNear) / deltaZ; + tmp[11] = -1; + tmp[14] = -2 * zNear * zFar / deltaZ; + tmp[15] = 0; + + memcpy (m, tmp, sizeof(tmp)); +} + +/** + * Draws a gear. + * + * @param gear the gear to draw + * @param transform the current transformation matrix + * @param x the x position to draw the gear at + * @param y the y position to draw the gear at + * @param angle the rotation angle of the gear + * @param color the color of the gear + */ +static void +draw_gear (struct gear *gear, GLfloat *transform, + GLfloat x, GLfloat y, GLfloat angle, const GLfloat color[4]) +{ + GLfloat model_view[16]; + GLfloat normal_matrix[16]; + GLfloat model_view_projection[16]; + int n; + + /* Translate and rotate the gear */ + memcpy(model_view, transform, sizeof (model_view)); + translate(model_view, x, y, 0); + rotate(model_view, 2 * M_PI * angle / 360.0, 0, 0, 1); + + /* Create and set the ModelViewProjectionMatrix */ + memcpy (model_view_projection, + ProjectionMatrix, + sizeof(model_view_projection)); + multiply (model_view_projection, model_view); + + glUniformMatrix4fv (ModelViewProjectionMatrix_location, 1, GL_FALSE, + model_view_projection); + + /* + * Create and set the NormalMatrix. It's the inverse transpose of the + * ModelView matrix. + */ + memcpy (normal_matrix, model_view, sizeof (normal_matrix)); + invert (normal_matrix); + transpose (normal_matrix); + glUniformMatrix4fv (NormalMatrix_location, 1, GL_FALSE, normal_matrix); + + /* Set the gear color */ + glUniform4fv (MaterialColor_location, 1, color); + + /* Set the vertex buffer object to use */ + glBindBuffer (GL_ARRAY_BUFFER, gear->vbo); + + /* Set up the position of the attributes in the vertex buffer object */ + glVertexAttribPointer (0, 3, GL_FLOAT, GL_FALSE, + 6 * sizeof(GLfloat), NULL); + glVertexAttribPointer (1, 3, GL_FLOAT, GL_FALSE, + 6 * sizeof(GLfloat), (GLfloat *) 0 + 3); + + /* Enable the attributes */ + glEnableVertexAttribArray (0); + glEnableVertexAttribArray (1); + + /* Draw the triangle strips that comprise the gear */ + for (n = 0; n < gear->nstrips; n++) + glDrawArrays (GL_TRIANGLE_STRIP, + gear->strips[n].first, + gear->strips[n].count); + + /* Disable the attributes */ + glDisableVertexAttribArray (1); + glDisableVertexAttribArray (0); +} + +/** + * Draws the gears. + */ +static void +gears_draw(void) +{ + const static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; + const static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; + const static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; + GLfloat transform[16]; + identity(transform); + + glClearColor (0.0, 0.0, 0.0, 0.0); + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* Translate and rotate the view */ + translate (transform, 0, 0, -20); + rotate (transform, 2 * M_PI * view_rot[0] / 360.0, 1, 0, 0); + rotate (transform, 2 * M_PI * view_rot[1] / 360.0, 0, 1, 0); + rotate (transform, 2 * M_PI * view_rot[2] / 360.0, 0, 0, 1); + + /* Draw the gears */ + draw_gear (gear1, transform, -3.0, -2.0, angle, red); + draw_gear (gear2, transform, 3.1, -2.0, -2 * angle - 9.0, green); + draw_gear (gear3, transform, -3.1, 4.2, -2 * angle - 25.0, blue); +} + +static gboolean +paint_cb (void *user_data) +{ + Data *data = user_data; + double elapsed = g_timer_elapsed (data->timer, NULL); + double dt = elapsed - data->last_elapsed; + CoglError *error = NULL; + + /* Draw scene with GLES2 */ + if (!cogl_push_gles2_context (data->ctx, + data->gles2_ctx, + data->fb, + data->fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gears_draw (); + + cogl_pop_gles2_context (data->ctx); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb)); + + /* advance rotation for next frame */ + angle += 70.0 * dt; /* 70 degrees per second */ + if (angle > 3600.0) + angle -= 3600.0; + + data->frames++; + + if (elapsed > 5.0) { + GLfloat fps = data->frames / elapsed; + printf ("%d frames in %3.1f seconds = %6.3f FPS\n", + data->frames, elapsed, fps); + g_timer_reset (data->timer); + data->last_elapsed = 0; + data->frames = 0; + }else + data->last_elapsed = elapsed; + + return FALSE; /* remove the callback */ +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + if (event == COGL_FRAME_EVENT_SYNC) + paint_cb (user_data); +} + +/** + * Handles a new window size or exposure. + * + * @param width the window width + * @param height the window height + */ +static void +gears_reshape (int width, int height) +{ + /* Update the projection matrix */ + perspective (ProjectionMatrix, 60.0, width / (float)height, 1.0, 1024.0); + + /* Set the viewport */ + glViewport (0, 0, (GLint) width, (GLint) height); +} + +#if 0 +/** + * Handles special eglut events. + * + * @param special the event to handle. + */ +static void +gears_special(int special) +{ + switch (special) { + case EGLUT_KEY_LEFT: + view_rot[1] += 5.0; + break; + case EGLUT_KEY_RIGHT: + view_rot[1] -= 5.0; + break; + case EGLUT_KEY_UP: + view_rot[0] += 5.0; + break; + case EGLUT_KEY_DOWN: + view_rot[0] -= 5.0; + break; + } +} +#endif + +static const char vertex_shader[] = + "attribute vec3 position;\n" + "attribute vec3 normal;\n" + "\n" + "uniform mat4 ModelViewProjectionMatrix;\n" + "uniform mat4 NormalMatrix;\n" + "uniform vec4 LightSourcePosition;\n" + "uniform vec4 MaterialColor;\n" + "\n" + "varying vec4 Color;\n" + "\n" + "void main(void)\n" + "{\n" + " // Transform the normal to eye coordinates\n" + " vec3 N = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));\n" + "\n" + " // The LightSourcePosition is actually its direction for directional light\n" + " vec3 L = normalize(LightSourcePosition.xyz);\n" + "\n" + " // Multiply the diffuse value by the vertex color (which is fixed in this case)\n" + " // to get the actual color that we will use to draw this vertex with\n" + " float diffuse = max(dot(N, L), 0.0);\n" + " Color = diffuse * MaterialColor;\n" + "\n" + " // Transform the position to clip coordinates\n" + " gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);\n" + "}"; + +static const char fragment_shader[] = + "precision mediump float;\n" + "varying vec4 Color;\n" + "\n" + "void main(void)\n" + "{\n" + " gl_FragColor = Color;\n" + "}"; + +static void +gears_init(void) +{ + GLuint v, f, program; + const char *p; + char msg[512]; + + glEnable (GL_CULL_FACE); + glEnable (GL_DEPTH_TEST); + + /* Compile the vertex shader */ + p = vertex_shader; + v = glCreateShader (GL_VERTEX_SHADER); + glShaderSource (v, 1, &p, NULL); + glCompileShader (v); + glGetShaderInfoLog (v, sizeof msg, NULL, msg); + printf ("vertex shader info: %s\n", msg); + + /* Compile the fragment shader */ + p = fragment_shader; + f = glCreateShader (GL_FRAGMENT_SHADER); + glShaderSource (f, 1, &p, NULL); + glCompileShader (f); + glGetShaderInfoLog (f, sizeof msg, NULL, msg); + printf ("fragment shader info: %s\n", msg); + + /* Create and link the shader program */ + program = glCreateProgram (); + glAttachShader (program, v); + glAttachShader (program, f); + glBindAttribLocation (program, 0, "position"); + glBindAttribLocation (program, 1, "normal"); + + glLinkProgram (program); + glGetProgramInfoLog (program, sizeof msg, NULL, msg); + printf ("info: %s\n", msg); + + /* Enable the shaders */ + glUseProgram (program); + + /* Get the locations of the uniforms so we can access them */ + ModelViewProjectionMatrix_location = + glGetUniformLocation (program, "ModelViewProjectionMatrix"); + NormalMatrix_location = + glGetUniformLocation (program, "NormalMatrix"); + LightSourcePosition_location = + glGetUniformLocation (program, "LightSourcePosition"); + MaterialColor_location = + glGetUniformLocation (program, "MaterialColor"); + + /* Set the LightSourcePosition uniform which is constant throughout + * the program */ + glUniform4fv (LightSourcePosition_location, 1, LightSourcePosition); + + /* make the gears */ + gear1 = create_gear (1.0, 4.0, 1.0, 20, 0.7); + gear2 = create_gear (0.5, 2.0, 2.0, 10, 0.7); + gear3 = create_gear (1.3, 2.0, 0.5, 10, 0.7); +} + +int +main (int argc, char **argv) +{ + Data data; + CoglOnscreen *onscreen; + CoglError *error = NULL; + GSource *cogl_source; + GMainLoop *loop; + CoglRenderer *renderer; + CoglDisplay *display; + + renderer = cogl_renderer_new (); + cogl_renderer_add_constraint (renderer, + COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2); + display = cogl_display_new (renderer, NULL); + data.ctx = cogl_context_new (display, NULL); + + onscreen = cogl_onscreen_new (data.ctx, 300, 300); + cogl_onscreen_show (onscreen); + data.fb = onscreen; + + data.gles2_ctx = cogl_gles2_context_new (data.ctx, &error); + if (!data.gles2_ctx) + g_error ("Failed to create GLES2 context: %s\n", error->message); + + /* Draw scene with GLES2 */ + if (!cogl_push_gles2_context (data.ctx, + data.gles2_ctx, + data.fb, + data.fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gears_reshape (cogl_framebuffer_get_width (data.fb), + cogl_framebuffer_get_height (data.fb)); + + /* Initialize the gears */ + gears_init(); + + cogl_pop_gles2_context (data.ctx); + + cogl_source = cogl_glib_source_new (data.ctx, G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data.fb), + frame_event_cb, + &data, + NULL); /* destroy notify */ + + g_idle_add (paint_cb, &data); + + data.timer = g_timer_new (); + data.frames = 0; + data.last_elapsed = 0; + + loop = g_main_loop_new (NULL, TRUE); + g_main_loop_run (loop); + + return 0; +} diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c new file mode 100644 index 0000000..1387ab8 --- /dev/null +++ b/examples/cogl-hello.c @@ -0,0 +1,123 @@ +#include +#include +#include + +typedef struct _Data +{ + CoglContext *ctx; + CoglFramebuffer *fb; + CoglPrimitive *triangle; + CoglPipeline *pipeline; + + unsigned int redraw_idle; + CoglBool is_dirty; + CoglBool draw_ready; +} Data; + +static gboolean +paint_cb (void *user_data) +{ + Data *data = user_data; + + data->redraw_idle = 0; + data->is_dirty = FALSE; + data->draw_ready = FALSE; + + cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + cogl_primitive_draw (data->triangle, + data->fb, + data->pipeline); + cogl_onscreen_swap_buffers (data->fb); + + return G_SOURCE_REMOVE; +} + +static void +maybe_redraw (Data *data) +{ + if (data->is_dirty && data->draw_ready && data->redraw_idle == 0) { + /* We'll draw on idle instead of drawing immediately so that + * if Cogl reports multiple dirty rectangles we won't + * redundantly draw multiple frames */ + data->redraw_idle = g_idle_add (paint_cb, data); + } +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) { + data->draw_ready = TRUE; + maybe_redraw (data); + } +} + +static void +dirty_cb (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info, + void *user_data) +{ + Data *data = user_data; + + data->is_dirty = TRUE; + maybe_redraw (data); +} + +int +main (int argc, char **argv) +{ + Data data; + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + GSource *cogl_source; + GMainLoop *loop; + + data.redraw_idle = 0; + data.is_dirty = FALSE; + data.draw_ready = TRUE; + + data.ctx = cogl_context_new (NULL, &error); + if (!data.ctx) { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (data.ctx, 640, 480); + cogl_onscreen_show (onscreen); + data.fb = onscreen; + + cogl_onscreen_set_resizable (onscreen, TRUE); + + data.triangle = cogl_primitive_new_p2c4 (data.ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + data.pipeline = cogl_pipeline_new (data.ctx); + + cogl_source = cogl_glib_source_new (data.ctx, G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + cogl_onscreen_add_frame_callback (data.fb, + frame_event_cb, + &data, + NULL); /* destroy notify */ + cogl_onscreen_add_dirty_callback (data.fb, + dirty_cb, + &data, + NULL); /* destroy notify */ + + loop = g_main_loop_new (NULL, TRUE); + g_main_loop_run (loop); + + return 0; +} diff --git a/examples/cogl-info.c b/examples/cogl-info.c new file mode 100644 index 0000000..0eb711e --- /dev/null +++ b/examples/cogl-info.c @@ -0,0 +1,262 @@ +#include +#include +#include + +struct { + CoglFeatureID feature; + const char *short_description; + const char *long_description; +} features[] = +{ + { + COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, + "Non power of two textures (basic)", + "The hardware supports non power of two textures, but you also " + "need to check the COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and " + "COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features to know if the " + "hardware supports npot texture mipmaps or repeat modes other " + "than COGL_RENDERER_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively." + }, + { + COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, + "Non power of two textures (+ mipmap)", + "Mipmapping is supported in conjuntion with non power of two " + "textures." + }, + { + COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, + "Non power of two textures (+ repeat modes)", + "Repeat modes other than " + "COGL_RENDERER_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by " + "the hardware in conjunction with non power of two textures." + }, + { + COGL_FEATURE_ID_TEXTURE_NPOT, + "Non power of two textures (fully featured)", + "Non power of two textures are supported by the hardware. This " + "is a equivalent to the COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, " + "COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and " + "COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined." + }, + { + COGL_FEATURE_ID_TEXTURE_RECTANGLE, + "Unnormalized coordinate, rectangle textures", + "Support for rectangular textures with non-normalized texture " + "coordinates." + }, + { + COGL_FEATURE_ID_TEXTURE_3D, + "3D texture support", + "3D texture support" + }, + { + COGL_FEATURE_ID_OFFSCREEN, + "Offscreen rendering support", + "Offscreen rendering support" + }, + { + COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE, + "Offscreen rendering with multisampling support", + "Offscreen rendering with multisampling support" + }, + { + COGL_FEATURE_ID_ONSCREEN_MULTIPLE, + "Multiple onscreen framebuffers supported", + "Multiple onscreen framebuffers supported" + }, + { + COGL_FEATURE_ID_GLSL, + "GLSL support", + "GLSL support" + }, + { + COGL_FEATURE_ID_ARBFP, + "ARBFP support", + "ARBFP support" + }, + { + COGL_FEATURE_ID_UNSIGNED_INT_INDICES, + "Unsigned integer indices", + "COGL_RENDERER_INDICES_TYPE_UNSIGNED_INT is supported in cogl_indices_new()." + }, + { + COGL_FEATURE_ID_DEPTH_RANGE, + "cogl_pipeline_set_depth_range() support", + "cogl_pipeline_set_depth_range() support", + }, + { + COGL_FEATURE_ID_POINT_SPRITE, + "Point sprite coordinates", + "cogl_pipeline_set_layer_point_sprite_coords_enabled() is supported" + }, + { + COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, + "Mapping buffers for reading", + "Mapping buffers for reading" + }, + { + COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, + "Mapping buffers for writing", + "Mapping buffers for writing" + }, + { + COGL_FEATURE_ID_MIRRORED_REPEAT, + "Mirrored repeat wrap modes", + "Mirrored repeat wrap modes" + }, + { + COGL_FEATURE_ID_GLES2_CONTEXT, + "GLES2 API integration supported", + "Support for creating a GLES2 context for using the GLES2 API in a " + "way that's integrated with Cogl." + }, + { + COGL_FEATURE_ID_DEPTH_TEXTURE, + "Depth Textures", + "CoglFramebuffers can be configured to render their depth buffer into " + "a texture" + }, + { + COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, + "Per-vertex point size", + "cogl_point_size_in can be used as an attribute to specify a per-vertex " + "point size" + } +}; + +static const char * +get_winsys_name_for_id (CoglWinsysID winsys_id) +{ + switch (winsys_id) + { + case COGL_WINSYS_ID_ANY: + g_return_val_if_reached ("ERROR"); + case COGL_WINSYS_ID_STUB: + return "Stub"; + case COGL_WINSYS_ID_GLX: + return "GLX"; + case COGL_WINSYS_ID_EGL_XLIB: + return "EGL + Xlib platform"; + case COGL_WINSYS_ID_EGL_NULL: + return "EGL + NULL window system platform"; + case COGL_WINSYS_ID_EGL_GDL: + return "EGL + GDL platform"; + case COGL_WINSYS_ID_EGL_WAYLAND: + return "EGL + Wayland platform"; + case COGL_WINSYS_ID_EGL_KMS: + return "EGL + KMS platform"; + case COGL_WINSYS_ID_EGL_ANDROID: + return "EGL + Android platform"; + case COGL_WINSYS_ID_WGL: + return "EGL + Windows WGL platform"; + case COGL_WINSYS_ID_SDL: + return "EGL + SDL platform"; + } + g_return_val_if_reached ("Unknown"); +} + +static void +feature_cb (CoglFeatureID feature, void *user_data) +{ + int i; + for (i = 0; i < sizeof(features) / sizeof(features[0]); i++) + { + if (features[i].feature == feature) + { + printf (" » %s\n", features[i].short_description); + return; + } + } + printf (" » Unknown feature %d\n", feature); +} + +typedef struct _OutputState +{ + int id; +} OutputState; + +static void +output_cb (CoglOutput *output, void *user_data) +{ + OutputState *state = user_data; + const char *order; + float refresh; + + printf (" Output%d:\n", state->id++); + printf (" » position = (%d, %d)\n", + cogl_output_get_x (output), + cogl_output_get_y (output)); + printf (" » resolution = %d x %d\n", + cogl_output_get_width (output), + cogl_output_get_height (output)); + printf (" » physical size = %dmm x %dmm\n", + cogl_output_get_mm_width (output), + cogl_output_get_mm_height (output)); + switch (cogl_output_get_subpixel_order (output)) + { + case COGL_SUBPIXEL_ORDER_UNKNOWN: + order = "unknown"; + break; + case COGL_SUBPIXEL_ORDER_NONE: + order = "non-standard"; + break; + case COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB: + order = "horizontal,rgb"; + break; + case COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR: + order = "horizontal,bgr"; + break; + case COGL_SUBPIXEL_ORDER_VERTICAL_RGB: + order = "vertical,rgb"; + break; + case COGL_SUBPIXEL_ORDER_VERTICAL_BGR: + order = "vertical,bgr"; + break; + } + printf (" » sub pixel order = %s\n", order); + + refresh = cogl_output_get_refresh_rate (output); + if (refresh) + printf (" » refresh = %f Hz\n", refresh); + else + printf (" » refresh = unknown\n"); +} + +int +main (int argc, char **argv) +{ + CoglRenderer *renderer; + CoglDisplay *display; + CoglContext *ctx; + CoglError *error = NULL; + CoglWinsysID winsys_id; + const char *winsys_name; + OutputState output_state; + +#ifdef COGL_HAS_EMSCRIPTEN_SUPPORT + ctx = cogl_sdl_context_new (SDL_USEREVENT, &error); +#else + ctx = cogl_context_new (NULL, &error); +#endif + if (!ctx) { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + display = cogl_context_get_display (ctx); + renderer = cogl_display_get_renderer (display); + winsys_id = cogl_renderer_get_winsys_id (renderer); + winsys_name = get_winsys_name_for_id (winsys_id); + g_print ("Renderer: %s\n\n", winsys_name); + + g_print ("Features:\n"); + cogl_foreach_feature (ctx, feature_cb, NULL); + + g_print ("Outputs:\n"); + output_state.id = 0; + cogl_renderer_foreach_output (renderer, output_cb, &output_state); + if (output_state.id == 0) + printf (" Unknown\n"); + + return 0; +} diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c new file mode 100644 index 0000000..b5f6665 --- /dev/null +++ b/examples/cogl-msaa.c @@ -0,0 +1,114 @@ +#include +#include +#include + +int +main (int argc, char **argv) +{ + CoglOnscreenTemplate *onscreen_template; + CoglDisplay *display; + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + CoglPrimitive *triangle; + CoglTexture *tex; + CoglOffscreen *offscreen; + CoglFramebuffer *offscreen_fb; + CoglPipeline *pipeline; + + onscreen_template = cogl_onscreen_template_new (NULL); + cogl_onscreen_template_set_samples_per_pixel (onscreen_template, 4); + display = cogl_display_new (NULL, onscreen_template); + + if (!cogl_display_setup (display, &error)) + { + fprintf (stderr, "Platform doesn't support onscreen 4x msaa rendering: %s\n", + error->message); + return 1; + } + + ctx = cogl_context_new (display, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 640, 480); + fb = onscreen; + + cogl_framebuffer_set_samples_per_pixel (fb, 4); + + if (!cogl_framebuffer_allocate (fb, &error)) + { + fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, " + "disabling msaa for onscreen rendering: %s\n", error->message); + cogl_error_free (error); + cogl_framebuffer_set_samples_per_pixel (fb, 0); + + error = NULL; + if (!cogl_framebuffer_allocate (fb, &error)) + { + fprintf (stderr, "Failed to allocate framebuffer: %s\n", error->message); + return 1; + } + } + + cogl_onscreen_show (onscreen); + + tex = cogl_texture_2d_new_with_size (ctx, 320, 480); + offscreen = cogl_offscreen_new_with_texture (tex); + offscreen_fb = offscreen; + cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 4); + if (!cogl_framebuffer_allocate (offscreen_fb, &error)) + { + cogl_error_free (error); + error = NULL; + fprintf (stderr, "Failed to allocate 4x msaa offscreen framebuffer, " + "disabling msaa for offscreen rendering"); + cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 0); + } + + triangle = cogl_primitive_new_p2c4 (ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + pipeline = cogl_pipeline_new (ctx); + + for (;;) { + CoglPollFD *poll_fds; + int n_poll_fds; + int64_t timeout; + CoglPipeline *texture_pipeline; + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_scale (fb, 0.5, 1, 1); + cogl_framebuffer_translate (fb, -1, 0, 0); + cogl_primitive_draw (triangle, fb, pipeline); + cogl_framebuffer_pop_matrix (fb); + + cogl_primitive_draw (triangle, fb, pipeline); + cogl_framebuffer_resolve_samples (offscreen_fb); + + texture_pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_layer_texture (texture_pipeline, 0, tex); + cogl_framebuffer_draw_rectangle (fb, texture_pipeline, 0, 1, 1, -1); + cogl_object_unref (texture_pipeline); + + cogl_onscreen_swap_buffers (onscreen); + + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); + g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); + } + + return 0; +} diff --git a/examples/cogl-point-sprites.c b/examples/cogl-point-sprites.c new file mode 100644 index 0000000..860d8fe --- /dev/null +++ b/examples/cogl-point-sprites.c @@ -0,0 +1,323 @@ +#include +#include +#include +#include +#include + +#define N_FIREWORKS 32 +/* Units per second per second */ +#define GRAVITY -1.5f + +#define N_SPARKS (N_FIREWORKS * 32) /* Must be a power of two */ +#define TIME_PER_SPARK 0.01f /* in seconds */ + +#define TEXTURE_SIZE 32 + +typedef struct +{ + uint8_t red, green, blue, alpha; +} Color; + +typedef struct +{ + float size; + float x, y; + float start_x, start_y; + Color color; + + /* Velocities are in units per second */ + float initial_x_velocity; + float initial_y_velocity; + + GTimer *timer; +} Firework; + +typedef struct +{ + float x, y; + Color color; + Color base_color; +} Spark; + +typedef struct +{ + Firework fireworks[N_FIREWORKS]; + + int next_spark_num; + Spark sparks[N_SPARKS]; + GTimer *last_spark_time; + + CoglContext *context; + CoglFramebuffer *fb; + CoglPipeline *pipeline; + CoglPrimitive *primitive; + CoglAttributeBuffer *attribute_buffer; +} Data; + +static CoglTexture * +generate_round_texture (CoglContext *context) +{ + uint8_t *p, *data; + int x, y; + CoglTexture2D *tex; + + p = data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4); + + /* Generate a white circle which gets transparent towards the edges */ + for (y = 0; y < TEXTURE_SIZE; y++) + for (x = 0; x < TEXTURE_SIZE; x++) + { + int dx = x - TEXTURE_SIZE / 2; + int dy = y - TEXTURE_SIZE / 2; + float value = sqrtf (dx * dx + dy * dy) * 255.0 / (TEXTURE_SIZE / 2); + if (value > 255.0f) + value = 255.0f; + value = 255.0f - value; + *(p++) = value; + *(p++) = value; + *(p++) = value; + *(p++) = value; + } + + tex = cogl_texture_2d_new_from_data (context, + TEXTURE_SIZE, TEXTURE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + TEXTURE_SIZE * 4, + data, + NULL /* error */); + + g_free (data); + + return tex; +} + +static void +paint (Data *data) +{ + int i; + float diff_time; + + /* Update all of the firework's positions */ + for (i = 0; i < N_FIREWORKS; i++) + { + Firework *firework = data->fireworks + i; + + if ((fabsf (firework->x - firework->start_x) > 2.0f) || + firework->y < -1.0f) + { + firework->size = g_random_double_range (0.001f, 0.1f); + firework->start_x = 1.0f + firework->size; + firework->start_y = -1.0f; + firework->initial_x_velocity = g_random_double_range (-0.1f, -2.0f); + firework->initial_y_velocity = g_random_double_range (0.1f, 4.0f); + g_timer_reset (firework->timer); + + /* Pick a random color out of six */ + if (g_random_boolean ()) + { + memset (&firework->color, 0, sizeof (Color)); + ((uint8_t *) &firework->color)[g_random_int_range (0, 3)] = 255; + } + else + { + memset (&firework->color, 255, sizeof (Color)); + ((uint8_t *) &firework->color)[g_random_int_range (0, 3)] = 0; + } + firework->color.alpha = 255; + + /* Fire some of the fireworks from the other side */ + if (g_random_boolean ()) + { + firework->start_x = -firework->start_x; + firework->initial_x_velocity = -firework->initial_x_velocity; + } + } + + diff_time = g_timer_elapsed (firework->timer, NULL); + + firework->x = (firework->start_x + + firework->initial_x_velocity * diff_time); + + firework->y = ((firework->initial_y_velocity * diff_time + + 0.5f * GRAVITY * diff_time * diff_time) + + firework->start_y); + } + + diff_time = g_timer_elapsed (data->last_spark_time, NULL); + if (diff_time < 0.0f || diff_time >= TIME_PER_SPARK) + { + /* Add a new spark for each firework, overwriting the oldest ones */ + for (i = 0; i < N_FIREWORKS; i++) + { + Spark *spark = data->sparks + data->next_spark_num; + Firework *firework = data->fireworks + i; + + spark->x = (firework->x + + g_random_double_range (-firework->size / 2.0f, + firework->size / 2.0f)); + spark->y = (firework->y + + g_random_double_range (-firework->size / 2.0f, + firework->size / 2.0f)); + spark->base_color = firework->color; + + data->next_spark_num = (data->next_spark_num + 1) & (N_SPARKS - 1); + } + + /* Update the colour of each spark */ + for (i = 0; i < N_SPARKS; i++) + { + float color_value; + + /* First spark is the oldest */ + Spark *spark = data->sparks + ((data->next_spark_num + i) + & (N_SPARKS - 1)); + + color_value = i / (N_SPARKS - 1.0f); + spark->color.red = spark->base_color.red * color_value; + spark->color.green = spark->base_color.green * color_value; + spark->color.blue = spark->base_color.blue * color_value; + spark->color.alpha = 255.0f * color_value; + } + + g_timer_reset (data->last_spark_time); + } + + cogl_buffer_set_data (data->attribute_buffer, + 0, /* offset */ + data->sparks, + sizeof (data->sparks)); + + cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_primitive_draw (data->primitive, + data->fb, + data->pipeline); + + cogl_onscreen_swap_buffers (data->fb); +} + +static void +create_primitive (Data *data) +{ + CoglAttribute *attributes[2]; + int i; + + data->attribute_buffer = + cogl_attribute_buffer_new_with_size (data->context, + sizeof (data->sparks)); + cogl_buffer_set_update_hint (data->attribute_buffer, + COGL_BUFFER_UPDATE_HINT_DYNAMIC); + + attributes[0] = cogl_attribute_new (data->attribute_buffer, + "cogl_position_in", + sizeof (Spark), + G_STRUCT_OFFSET (Spark, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (data->attribute_buffer, + "cogl_color_in", + sizeof (Spark), + G_STRUCT_OFFSET (Spark, color), + 4, /* n_components */ + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + + data->primitive = + cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_POINTS, + N_SPARKS, + attributes, + G_N_ELEMENTS (attributes)); + + for (i = 0; i < G_N_ELEMENTS (attributes); i++) + cogl_object_unref (attributes[i]); +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + paint (data); +} + +int +main (int argc, char *argv[]) +{ + CoglTexture *tex; + CoglOnscreen *onscreen; + GSource *cogl_source; + GMainLoop *loop; + Data data; + int i; + + data.context = cogl_context_new (NULL, NULL); + + create_primitive (&data); + + data.pipeline = cogl_pipeline_new (data.context); + data.last_spark_time = g_timer_new (); + data.next_spark_num = 0; + cogl_pipeline_set_point_size (data.pipeline, TEXTURE_SIZE); + + tex = generate_round_texture (data.context); + cogl_pipeline_set_layer_texture (data.pipeline, 0, tex); + cogl_object_unref (tex); + + cogl_pipeline_set_layer_point_sprite_coords_enabled (data.pipeline, + 0, /* layer */ + TRUE, + NULL /* error */); + + for (i = 0; i < N_FIREWORKS; i++) + { + data.fireworks[i].x = -FLT_MAX; + data.fireworks[i].y = FLT_MAX; + data.fireworks[i].size = 0.0f; + data.fireworks[i].timer = g_timer_new (); + } + + for (i = 0; i < N_SPARKS; i++) + { + data.sparks[i].x = 2.0f; + data.sparks[i].y = 2.0f; + } + + onscreen = cogl_onscreen_new (data.context, 800, 600); + cogl_onscreen_show (onscreen); + data.fb = onscreen; + + cogl_source = cogl_glib_source_new (data.context, G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + cogl_onscreen_add_frame_callback (onscreen, + frame_event_cb, + &data, + NULL /* destroy notify */); + + loop = g_main_loop_new (NULL, TRUE); + + paint (&data); + + g_main_loop_run (loop); + + g_main_loop_unref (loop); + + g_source_destroy (cogl_source); + + cogl_object_unref (data.pipeline); + cogl_object_unref (data.attribute_buffer); + cogl_object_unref (data.primitive); + cogl_object_unref (onscreen); + cogl_object_unref (data.context); + + g_timer_destroy (data.last_spark_time); + + for (i = 0; i < N_FIREWORKS; i++) + g_timer_destroy (data.fireworks[i].timer); + + return 0; +} diff --git a/examples/cogl-sdl-hello.c b/examples/cogl-sdl-hello.c new file mode 100644 index 0000000..157c3e8 --- /dev/null +++ b/examples/cogl-sdl-hello.c @@ -0,0 +1,156 @@ +#include +#include +#include +#include + +/* This short example is just to demonstrate mixing SDL with Cogl as a + simple way to get portable support for events */ + +typedef struct Data +{ + CoglPrimitive *triangle; + CoglPipeline *pipeline; + float center_x, center_y; + CoglFramebuffer *fb; + CoglBool quit; + CoglBool redraw_queued; + CoglBool ready_to_draw; +} Data; + +static void +redraw (Data *data) +{ + CoglFramebuffer *fb = data->fb; + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f); + + cogl_primitive_draw (data->triangle, fb, data->pipeline); + cogl_framebuffer_pop_matrix (fb); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); +} + +static void +dirty_cb (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info, + void *user_data) +{ + Data *data = user_data; + + data->redraw_queued = TRUE; +} + +static void +handle_event (Data *data, SDL_Event *event) +{ + switch (event->type) + { + case SDL_MOUSEMOTION: + { + int width = + cogl_framebuffer_get_width (COGL_FRAMEBUFFER (data->fb)); + int height = + cogl_framebuffer_get_height (COGL_FRAMEBUFFER (data->fb)); + + data->center_x = event->motion.x * 2.0f / width - 1.0f; + data->center_y = event->motion.y * 2.0f / height - 1.0f; + + data->redraw_queued = TRUE; + } + break; + + case SDL_QUIT: + data->quit = TRUE; + break; + } +} + +static void +frame_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + data->ready_to_draw = TRUE; +} + +int +main (int argc, char **argv) +{ + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + Data data; + SDL_Event event; + + ctx = cogl_sdl_context_new (SDL_USEREVENT, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 800, 600); + data.fb = COGL_FRAMEBUFFER (onscreen); + + cogl_onscreen_add_frame_callback (onscreen, + frame_cb, + &data, + NULL /* destroy callback */); + cogl_onscreen_add_dirty_callback (onscreen, + dirty_cb, + &data, + NULL /* destroy callback */); + + data.center_x = 0.0f; + data.center_y = 0.0f; + data.quit = FALSE; + + cogl_onscreen_show (onscreen); + + data.triangle = cogl_primitive_new_p2c4 (ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + data.pipeline = cogl_pipeline_new (ctx); + + data.redraw_queued = FALSE; + data.ready_to_draw = TRUE; + + while (!data.quit) + { + if (!SDL_PollEvent (&event)) + { + if (data.redraw_queued && data.ready_to_draw) + { + redraw (&data); + data.redraw_queued = FALSE; + data.ready_to_draw = FALSE; + continue; + } + + cogl_sdl_idle (ctx); + if (!SDL_WaitEvent (&event)) + { + fprintf (stderr, "Error waiting for SDL events"); + return 1; + } + } + + handle_event (&data, &event); + cogl_sdl_handle_event (ctx, &event); + } + + cogl_object_unref (ctx); + + return 0; +} diff --git a/examples/cogl-sdl2-hello.c b/examples/cogl-sdl2-hello.c new file mode 100644 index 0000000..0e32fdb --- /dev/null +++ b/examples/cogl-sdl2-hello.c @@ -0,0 +1,169 @@ +#include +#include +#include +#include + +/* This short example is just to demonstrate mixing SDL with Cogl as a + simple way to get portable support for events */ + +typedef struct Data +{ + CoglPrimitive *triangle; + CoglPipeline *pipeline; + float center_x, center_y; + CoglFramebuffer *fb; + CoglBool quit; + CoglBool redraw_queued; + CoglBool ready_to_draw; +} Data; + +static void +redraw (Data *data) +{ + CoglFramebuffer *fb = data->fb; + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f); + + cogl_primitive_draw (data->triangle, fb, data->pipeline); + cogl_framebuffer_pop_matrix (fb); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); +} + +static void +dirty_cb (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info, + void *user_data) +{ + Data *data = user_data; + + data->redraw_queued = TRUE; +} + +static void +handle_event (Data *data, SDL_Event *event) +{ + switch (event->type) + { + case SDL_WINDOWEVENT: + switch (event->window.event) + { + case SDL_WINDOWEVENT_CLOSE: + data->quit = TRUE; + break; + } + break; + + case SDL_MOUSEMOTION: + { + int width = + cogl_framebuffer_get_width (data->fb); + int height = + cogl_framebuffer_get_height (data->fb); + + data->center_x = event->motion.x * 2.0f / width - 1.0f; + data->center_y = event->motion.y * 2.0f / height - 1.0f; + + data->redraw_queued = TRUE; + } + break; + + case SDL_QUIT: + data->quit = TRUE; + break; + } +} + +static void +frame_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + Data *data = user_data; + + if (event == COGL_FRAME_EVENT_SYNC) + data->ready_to_draw = TRUE; +} + +int +main (int argc, char **argv) +{ + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + Data data; + SDL_Event event; + + ctx = cogl_sdl_context_new (SDL_USEREVENT, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 800, 600); + data.fb = onscreen; + + cogl_onscreen_add_frame_callback (onscreen, + frame_cb, + &data, + NULL /* destroy callback */); + cogl_onscreen_add_dirty_callback (onscreen, + dirty_cb, + &data, + NULL /* destroy callback */); + + data.center_x = 0.0f; + data.center_y = 0.0f; + data.quit = FALSE; + + /* In SDL2, setting resizable only works before allocating the + * onscreen */ + cogl_onscreen_set_resizable (onscreen, TRUE); + + cogl_onscreen_show (onscreen); + + data.triangle = cogl_primitive_new_p2c4 (ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + data.pipeline = cogl_pipeline_new (ctx); + + data.redraw_queued = FALSE; + data.ready_to_draw = TRUE; + + while (!data.quit) + { + if (!SDL_PollEvent (&event)) + { + if (data.redraw_queued && data.ready_to_draw) + { + redraw (&data); + data.redraw_queued = FALSE; + data.ready_to_draw = FALSE; + continue; + } + + cogl_sdl_idle (ctx); + if (!SDL_WaitEvent (&event)) + { + fprintf (stderr, "Error waiting for SDL events"); + return 1; + } + } + + handle_event (&data, &event); + cogl_sdl_handle_event (ctx, &event); + } + + cogl_object_unref (ctx); + + return 0; +} diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c new file mode 100644 index 0000000..04d586f --- /dev/null +++ b/examples/cogl-x11-foreign.c @@ -0,0 +1,203 @@ +#include +#include +#include +#include + +#include +#include + +#define X11_FOREIGN_EVENT_MASK \ + (KeyPressMask | \ + KeyReleaseMask | \ + ButtonPressMask | \ + ButtonReleaseMask | \ + PointerMotionMask) + +static void +update_cogl_x11_event_mask (CoglOnscreen *onscreen, + uint32_t event_mask, + void *user_data) +{ + Display *xdpy = user_data; + XSetWindowAttributes attrs; + uint32_t xwin; + + attrs.event_mask = event_mask | X11_FOREIGN_EVENT_MASK; + xwin = cogl_x11_onscreen_get_window_xid (onscreen); + + XChangeWindowAttributes (xdpy, + (Window)xwin, + CWEventMask, + &attrs); +} + +static void +resize_handler (CoglOnscreen *onscreen, + int width, + int height, + void *user_data) +{ + CoglFramebuffer *fb = user_data; + cogl_framebuffer_set_viewport (fb, width / 4, height / 4, width / 2, height / 2); +} + +int +main (int argc, char **argv) +{ + Display *xdpy; + CoglRenderer *renderer; + CoglSwapChain *chain; + CoglOnscreenTemplate *onscreen_template; + CoglDisplay *display; + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + CoglPipeline *pipeline; + CoglError *error = NULL; + uint32_t visual; + XVisualInfo template, *xvisinfo; + int visinfos_count; + XSetWindowAttributes xattr; + unsigned long mask; + Window xwin; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + CoglPrimitive *triangle; + + + /* Since we want to test external ownership of the X display, + * connect to X manually... */ + xdpy = XOpenDisplay (NULL); + if (!xdpy) + { + fprintf (stderr, "Failed to open X Display\n"); + return 1; + } + + /* Conceptually choose a GPU... */ + renderer = cogl_renderer_new (); + /* FIXME: This should conceptually be part of the configuration of + * a renderer. */ + cogl_xlib_renderer_set_foreign_display (renderer, xdpy); + if (!cogl_renderer_connect (renderer, &error)) + { + fprintf (stderr, "Failed to connect to a renderer: %s\n", + error->message); + } + + chain = cogl_swap_chain_new (); + cogl_swap_chain_set_has_alpha (chain, TRUE); + + /* Conceptually declare upfront the kinds of windows we anticipate + * creating so that when we configure the display pipeline we can avoid + * having an impedance miss-match between the format of windows and the + * format the display pipeline expects. */ + onscreen_template = cogl_onscreen_template_new (chain); + cogl_object_unref (chain); + + /* Conceptually setup a display pipeline */ + display = cogl_display_new (renderer, onscreen_template); + cogl_object_unref (renderer); + if (!cogl_display_setup (display, &error)) + { + fprintf (stderr, "Failed to setup a display pipeline: %s\n", + error->message); + return 1; + } + + ctx = cogl_context_new (display, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 640, 480); + + /* We want to test that Cogl can handle foreign X windows... */ + + visual = cogl_x11_onscreen_get_visual_xid (onscreen); + if (!visual) + { + fprintf (stderr, "Failed to query an X visual suitable for the " + "configured CoglOnscreen framebuffer\n"); + return 1; + } + + template.visualid = visual; + xvisinfo = XGetVisualInfo (xdpy, VisualIDMask, &template, &visinfos_count); + + /* window attributes */ + xattr.background_pixel = WhitePixel (xdpy, DefaultScreen (xdpy)); + xattr.border_pixel = 0; + xattr.colormap = XCreateColormap (xdpy, + DefaultRootWindow (xdpy), + xvisinfo->visual, + AllocNone); + mask = CWBorderPixel | CWColormap; + + xwin = XCreateWindow (xdpy, + DefaultRootWindow (xdpy), + 0, 0, + 800, 600, + 0, + xvisinfo->depth, + InputOutput, + xvisinfo->visual, + mask, &xattr); + + XFree (xvisinfo); + + cogl_x11_onscreen_set_foreign_window_xid (onscreen, xwin, + update_cogl_x11_event_mask, + xdpy); + + XMapWindow (xdpy, xwin); + + fb = onscreen; + + cogl_onscreen_set_resizable (onscreen, TRUE); + cogl_onscreen_add_resize_callback (onscreen, resize_handler, onscreen, NULL); + + triangle = cogl_primitive_new_p2c4 (ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + pipeline = cogl_pipeline_new (ctx); + for (;;) + { + CoglPollFD *poll_fds; + int n_poll_fds; + int64_t timeout; + + while (XPending (xdpy)) + { + XEvent event; + XNextEvent (xdpy, &event); + switch (event.type) + { + case KeyRelease: + case ButtonRelease: + return 0; + } + cogl_xlib_renderer_handle_event (renderer, &event); + } + + /* After forwarding native events directly to Cogl you should + * then allow Cogl to dispatch any corresponding event + * callbacks, such as resize notification callbacks... + */ + cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), + &poll_fds, &n_poll_fds, &timeout); + g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); + cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx), + poll_fds, n_poll_fds); + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + cogl_primitive_draw (triangle, fb, pipeline); + cogl_onscreen_swap_buffers (onscreen); + } + + return 0; +} diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c new file mode 100644 index 0000000..52580e9 --- /dev/null +++ b/examples/cogl-x11-tfp.c @@ -0,0 +1,255 @@ +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define X11_FOREIGN_EVENT_MASK \ + (KeyPressMask | \ + KeyReleaseMask | \ + ButtonPressMask | \ + ButtonReleaseMask | \ + PointerMotionMask) + +#define TFP_XWIN_WIDTH 200 +#define TFP_XWIN_HEIGHT 200 + +static void +update_cogl_x11_event_mask (CoglOnscreen *onscreen, + uint32_t event_mask, + void *user_data) +{ + Display *xdpy = user_data; + XSetWindowAttributes attrs; + uint32_t xwin; + + attrs.event_mask = event_mask | X11_FOREIGN_EVENT_MASK; + xwin = cogl_x11_onscreen_get_window_xid (onscreen); + + XChangeWindowAttributes (xdpy, + (Window)xwin, + CWEventMask, + &attrs); +} + +int +main (int argc, char **argv) +{ + Display *xdpy; + int composite_error = 0, composite_event = 0; + CoglRenderer *renderer; + CoglSwapChain *chain; + CoglOnscreenTemplate *onscreen_template; + CoglDisplay *display; + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + CoglError *error = NULL; + uint32_t visual; + XVisualInfo template, *xvisinfo; + int visinfos_count; + XSetWindowAttributes xattr; + unsigned long mask; + Window xwin; + Atom atom_wm_protocols; + Atom atom_wm_delete_window; + int screen; + Window tfp_xwin; + Pixmap pixmap; + CoglTexturePixmapX11 *tfp; + GC gc; + + g_print ("NB: Don't use this example as a benchmark since there is " + "no synchonization between X window updates and onscreen " + "framebuffer updates!\n"); + + /* Since we want to test external ownership of the X display, + * connect to X manually... */ + xdpy = XOpenDisplay (NULL); + if (!xdpy) + { + fprintf (stderr, "Failed to open X Display\n"); + return 1; + } + + XSynchronize (xdpy, True); + + if (XCompositeQueryExtension (xdpy, &composite_event, &composite_error)) + { + int major = 0, minor = 0; + if (XCompositeQueryVersion (xdpy, &major, &minor)) + { + if (major != 0 || minor < 3) + g_error ("Missing XComposite extension >= 0.3"); + } + } + + /* Conceptually choose a GPU... */ + renderer = cogl_renderer_new (); + /* FIXME: This should conceptually be part of the configuration of + * a renderer. */ + cogl_xlib_renderer_set_foreign_display (renderer, xdpy); + if (!cogl_renderer_connect (renderer, &error)) + { + fprintf (stderr, "Failed to connect to a renderer: %s\n", + error->message); + } + + chain = cogl_swap_chain_new (); + cogl_swap_chain_set_has_alpha (chain, TRUE); + + /* Conceptually declare upfront the kinds of windows we anticipate + * creating so that when we configure the display pipeline we can avoid + * having an impedance miss-match between the format of windows and the + * format the display pipeline expects. */ + onscreen_template = cogl_onscreen_template_new (chain); + cogl_object_unref (chain); + + /* Conceptually setup a display pipeline */ + display = cogl_display_new (renderer, onscreen_template); + cogl_object_unref (renderer); + if (!cogl_display_setup (display, &error)) + { + fprintf (stderr, "Failed to setup a display pipeline: %s\n", + error->message); + return 1; + } + + ctx = cogl_context_new (display, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + onscreen = cogl_onscreen_new (ctx, 640, 480); + + /* We want to test that Cogl can handle foreign X windows... */ + + visual = cogl_x11_onscreen_get_visual_xid (onscreen); + if (!visual) + { + fprintf (stderr, "Failed to query an X visual suitable for the " + "configured CoglOnscreen framebuffer\n"); + return 1; + } + + template.visualid = visual; + xvisinfo = XGetVisualInfo (xdpy, VisualIDMask, &template, &visinfos_count); + + /* window attributes */ + xattr.background_pixel = WhitePixel (xdpy, DefaultScreen (xdpy)); + xattr.border_pixel = 0; + xattr.colormap = XCreateColormap (xdpy, + DefaultRootWindow (xdpy), + xvisinfo->visual, + AllocNone); + xattr.event_mask = StructureNotifyMask; + mask = CWBorderPixel | CWColormap | CWEventMask; + + xwin = XCreateWindow (xdpy, + DefaultRootWindow (xdpy), + 0, 0, + 800, 600, + 0, + xvisinfo->depth, + InputOutput, + xvisinfo->visual, + mask, &xattr); + + atom_wm_protocols = XInternAtom (xdpy, "WM_PROTOCOLS", False); + atom_wm_delete_window = XInternAtom (xdpy, "WM_DELETE_WINDOW", False); + XSetWMProtocols (xdpy, xwin, &atom_wm_delete_window, 1); + + XFree (xvisinfo); + + cogl_x11_onscreen_set_foreign_window_xid (onscreen, xwin, + update_cogl_x11_event_mask, + xdpy); + + XMapWindow (xdpy, xwin); + + XCompositeRedirectSubwindows (xdpy, xwin, CompositeRedirectManual); + + screen = DefaultScreen (xdpy); + tfp_xwin = XCreateSimpleWindow (xdpy, xwin, + 0, 0, TFP_XWIN_WIDTH, TFP_XWIN_HEIGHT, + 0, + WhitePixel (xdpy, screen), + WhitePixel (xdpy, screen)); + XMapWindow (xdpy, tfp_xwin); + + gc = XCreateGC (xdpy, tfp_xwin, 0, NULL); + + while (TRUE) + { + XEvent xev; + + XWindowEvent (xdpy, xwin, StructureNotifyMask, &xev); + + if (xev.xany.type == MapNotify) + break; + } + + pixmap = XCompositeNameWindowPixmap (xdpy, tfp_xwin); + + tfp = cogl_texture_pixmap_x11_new (ctx, pixmap, TRUE, &error); + if (!tfp) + { + fprintf (stderr, "Failed to create CoglTexturePixmapX11: %s", + error->message); + return 1; + } + + fb = onscreen; + + for (;;) + { + unsigned long pixel; + CoglPipeline *pipeline; + + while (XPending (xdpy)) + { + XEvent event; + KeySym keysym; + XNextEvent (xdpy, &event); + switch (event.type) + { + case KeyRelease: + keysym = XLookupKeysym (&event.xkey, 0); + if (keysym == XK_q || keysym == XK_Q || keysym == XK_Escape) + return 0; + break; + case ClientMessage: + if (event.xclient.message_type == atom_wm_protocols && + event.xclient.data.l[0] == atom_wm_delete_window) + return 0; + break; + } + cogl_xlib_renderer_handle_event (renderer, &event); + } + + pixel = + g_random_int_range (0, 255) << 24 | + g_random_int_range (0, 255) << 16 | + g_random_int_range (0, 255) << 8; + g_random_int_range (0, 255); + XSetForeground (xdpy, gc, pixel); + XFillRectangle (xdpy, tfp_xwin, gc, 0, 0, TFP_XWIN_WIDTH, TFP_XWIN_HEIGHT); + XFlush (xdpy); + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, tfp); + cogl_framebuffer_draw_rectangle (fb, pipeline, -0.8, 0.8, 0.8, -0.8); + cogl_object_unref (pipeline); + cogl_onscreen_swap_buffers (onscreen); + } + + return 0; +} diff --git a/examples/cogland.c b/examples/cogland.c new file mode 100644 index 0000000..f208211 --- /dev/null +++ b/examples/cogland.c @@ -0,0 +1,1224 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +typedef struct _CoglandCompositor CoglandCompositor; + +typedef struct +{ + int x1, y1, x2, y2; +} CoglandRegion; + +typedef struct +{ + struct wl_resource *resource; + CoglandRegion region; +} CoglandSharedRegion; + +typedef struct +{ + struct wl_resource *resource; + struct wl_signal destroy_signal; + struct wl_listener destroy_listener; + + union + { + struct wl_shm_buffer *shm_buffer; + struct wl_buffer *legacy_buffer; + }; + + int32_t width, height; + uint32_t busy_count; +} CoglandBuffer; + +typedef struct +{ + CoglandBuffer *buffer; + struct wl_listener destroy_listener; +} CoglandBufferReference; + +typedef struct +{ + CoglandCompositor *compositor; + + struct wl_resource *resource; + int x; + int y; + CoglandBufferReference buffer_ref; + CoglTexture2D *texture; + + CoglBool has_shell_surface; + + struct wl_signal destroy_signal; + + /* All the pending state, that wl_surface.commit will apply. */ + struct + { + /* wl_surface.attach */ + CoglBool newly_attached; + CoglandBuffer *buffer; + struct wl_listener buffer_destroy_listener; + int32_t sx; + int32_t sy; + + /* wl_surface.damage */ + CoglandRegion damage; + + /* wl_surface.frame */ + struct wl_list frame_callback_list; + } pending; +} CoglandSurface; + +typedef struct +{ + CoglandSurface *surface; + struct wl_resource *resource; + struct wl_listener surface_destroy_listener; +} CoglandShellSurface; + +typedef struct +{ + uint32_t flags; + int width; + int height; + int refresh; +} CoglandMode; + +typedef struct +{ + struct wl_object wayland_output; + + int32_t x; + int32_t y; + int32_t width_mm; + int32_t height_mm; + + CoglOnscreen *onscreen; + + GList *modes; + +} CoglandOutput; + +typedef struct +{ + GSource source; + GPollFD pfd; + struct wl_display *display; +} WaylandEventSource; + +struct _CoglandCompositor +{ + struct wl_display *wayland_display; + struct wl_event_loop *wayland_loop; + + CoglContext *cogl_context; + + int virtual_width; + int virtual_height; + GList *outputs; + + struct wl_list frame_callbacks; + + CoglPrimitive *triangle; + CoglPipeline *triangle_pipeline; + + GSource *wayland_event_source; + + GList *surfaces; + + unsigned int redraw_idle; +}; + +static CoglBool option_multiple_outputs = FALSE; + +static GOptionEntry +options[] = + { + { + "multiple", 'm', 0, G_OPTION_ARG_NONE, &option_multiple_outputs, + "Split the compositor into four outputs", NULL + }, + { NULL, 0, 0, 0, NULL, NULL, NULL } + }; + +static CoglBool +process_arguments (int *argc, char ***argv, + GError **error) +{ + GOptionContext *context; + CoglBool ret; + GOptionGroup *group; + + group = g_option_group_new (NULL, /* name */ + NULL, /* description */ + NULL, /* help_description */ + NULL, /* user_data */ + NULL /* destroy notify */); + g_option_group_add_entries (group, options); + context = g_option_context_new ("- An example Wayland compositor using Cogl"); + g_option_context_set_main_group (context, group); + ret = g_option_context_parse (context, argc, argv, error); + g_option_context_free (context); + + if (ret && *argc > 1) + { + g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_UNKNOWN_OPTION, + "Unknown option '%s'", (* argv)[1]); + ret = FALSE; + } + + return ret; +} + +static uint32_t +get_time (void) +{ + struct timeval tv; + gettimeofday (&tv, NULL); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} + +static void +region_init (CoglandRegion *region) +{ + memset (region, 0, sizeof (*region)); +} + +static CoglBool +region_is_empty (const CoglandRegion *region) +{ + return region->x1 == region->x2 || region->y1 == region->y2; +} + +static void +region_add (CoglandRegion *region, + int x, + int y, + int w, + int h) +{ + if (region_is_empty (region)) + { + region->x1 = x; + region->y1 = y; + region->x2 = x + w; + region->y2 = y + h; + } + else + { + if (x < region->x1) + region->x1 = x; + if (y < region->y1) + region->y1 = y; + if (x + w > region->x2) + region->x2 = x + w; + if (y + h > region->y2) + region->y2 = y + h; + } +} + +static void +region_subtract (CoglandRegion *region, + int x, + int y, + int w, + int h) +{ + /* FIXME */ +} + +static CoglBool +wayland_event_source_prepare (GSource *base, int *timeout) +{ + WaylandEventSource *source = (WaylandEventSource *)base; + + *timeout = -1; + + wl_display_flush_clients (source->display); + + return FALSE; +} + +static CoglBool +wayland_event_source_check (GSource *base) +{ + WaylandEventSource *source = (WaylandEventSource *)base; + + return source->pfd.revents; +} + +static CoglBool +wayland_event_source_dispatch (GSource *base, + GSourceFunc callback, + void *data) +{ + WaylandEventSource *source = (WaylandEventSource *)base; + struct wl_event_loop *loop = wl_display_get_event_loop (source->display); + + wl_event_loop_dispatch (loop, 0); + + return TRUE; +} + +static GSourceFuncs wayland_event_source_funcs = +{ + wayland_event_source_prepare, + wayland_event_source_check, + wayland_event_source_dispatch, + NULL +}; + +static GSource * +wayland_event_source_new (struct wl_display *display) +{ + WaylandEventSource *source; + struct wl_event_loop *loop = + wl_display_get_event_loop (display); + + source = (WaylandEventSource *) g_source_new (&wayland_event_source_funcs, + sizeof (WaylandEventSource)); + source->display = display; + source->pfd.fd = wl_event_loop_get_fd (loop); + source->pfd.events = G_IO_IN | G_IO_ERR; + g_source_add_poll (&source->source, &source->pfd); + + return &source->source; +} + +static void +cogland_buffer_destroy_handler (struct wl_listener *listener, + void *data) +{ + CoglandBuffer *buffer = wl_container_of (listener, buffer, destroy_listener); + + wl_signal_emit (&buffer->destroy_signal, buffer); + g_slice_free (CoglandBuffer, buffer); +} + +static CoglandBuffer * +cogland_buffer_from_resource (struct wl_resource *resource) +{ + CoglandBuffer *buffer; + struct wl_listener *listener; + + listener = wl_resource_get_destroy_listener (resource, + cogland_buffer_destroy_handler); + + if (listener) + { + buffer = wl_container_of (listener, buffer, destroy_listener); + } + else + { + buffer = g_slice_new0 (CoglandBuffer); + + buffer->resource = resource; + wl_signal_init (&buffer->destroy_signal); + buffer->destroy_listener.notify = cogland_buffer_destroy_handler; + wl_resource_add_destroy_listener (resource, &buffer->destroy_listener); + } + + return buffer; +} + +static void +cogland_buffer_reference_handle_destroy (struct wl_listener *listener, + void *data) +{ + CoglandBufferReference *ref = + wl_container_of (listener, ref, destroy_listener); + + g_assert (data == ref->buffer); + + ref->buffer = NULL; +} + +static void +cogland_buffer_reference (CoglandBufferReference *ref, + CoglandBuffer *buffer) +{ + if (ref->buffer && buffer != ref->buffer) + { + ref->buffer->busy_count--; + + if (ref->buffer->busy_count == 0) + { + g_assert (wl_resource_get_client (ref->buffer->resource)); + wl_resource_queue_event (ref->buffer->resource, WL_BUFFER_RELEASE); + } + + wl_list_remove (&ref->destroy_listener.link); + } + + if (buffer && buffer != ref->buffer) + { + buffer->busy_count++; + wl_signal_add (&buffer->destroy_signal, &ref->destroy_listener); + } + + ref->buffer = buffer; + ref->destroy_listener.notify = cogland_buffer_reference_handle_destroy; +} + +typedef struct _CoglandFrameCallback +{ + struct wl_list link; + + /* Pointer back to the compositor */ + CoglandCompositor *compositor; + + struct wl_resource *resource; +} CoglandFrameCallback; + +static CoglBool +paint_cb (void *user_data) +{ + CoglandCompositor *compositor = user_data; + GList *l; + + for (l = compositor->outputs; l; l = l->next) + { + CoglandOutput *output = l->data; + CoglFramebuffer *fb = output->onscreen; + GList *l2; + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_primitive_draw (compositor->triangle, + fb, compositor->triangle_pipeline); + + for (l2 = compositor->surfaces; l2; l2 = l2->next) + { + CoglandSurface *surface = l2->data; + + if (surface->texture) + { + CoglTexture2D *texture = surface->texture; + CoglPipeline *pipeline = + cogl_pipeline_new (compositor->cogl_context); + cogl_pipeline_set_layer_texture (pipeline, 0, texture); + cogl_framebuffer_draw_rectangle (fb, pipeline, -1, 1, 1, -1); + cogl_object_unref (pipeline); + } + } + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); + } + + while (!wl_list_empty (&compositor->frame_callbacks)) + { + CoglandFrameCallback *callback = + wl_container_of (compositor->frame_callbacks.next, callback, link); + + wl_callback_send_done (callback->resource, get_time ()); + wl_resource_destroy (callback->resource); + } + + compositor->redraw_idle = 0; + + return G_SOURCE_REMOVE; +} + +static void +cogland_queue_redraw (CoglandCompositor *compositor) +{ + if (compositor->redraw_idle == 0) + compositor->redraw_idle = g_idle_add (paint_cb, compositor); +} + +static void +surface_damaged (CoglandSurface *surface, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + if (surface->buffer_ref.buffer && + surface->texture) + { + struct wl_shm_buffer *shm_buffer = + wl_shm_buffer_get (surface->buffer_ref.buffer->resource); + + if (shm_buffer) + cogl_wayland_texture_set_region_from_shm_buffer (surface->texture, + x, y, + width, + height, + shm_buffer, + x, y, + 0, /* level */ + NULL); + } + + cogland_queue_redraw (surface->compositor); +} + +static void +cogland_surface_destroy (struct wl_client *wayland_client, + struct wl_resource *wayland_resource) +{ + wl_resource_destroy (wayland_resource); +} + +static void +cogland_surface_attach (struct wl_client *wayland_client, + struct wl_resource *wayland_surface_resource, + struct wl_resource *wayland_buffer_resource, + int32_t sx, int32_t sy) +{ + CoglandSurface *surface = + wl_resource_get_user_data (wayland_surface_resource); + CoglandBuffer *buffer; + + if (wayland_buffer_resource) + buffer = cogland_buffer_from_resource (wayland_buffer_resource); + else + buffer = NULL; + + /* Attach without commit in between does not went wl_buffer.release */ + if (surface->pending.buffer) + wl_list_remove (&surface->pending.buffer_destroy_listener.link); + + surface->pending.sx = sx; + surface->pending.sy = sy; + surface->pending.buffer = buffer; + surface->pending.newly_attached = TRUE; + + if (buffer) + wl_signal_add (&buffer->destroy_signal, + &surface->pending.buffer_destroy_listener); +} + +static void +cogland_surface_damage (struct wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + CoglandSurface *surface = wl_resource_get_user_data (resource); + + region_add (&surface->pending.damage, x, y, width, height); +} + +static void +destroy_frame_callback (struct wl_resource *callback_resource) +{ + CoglandFrameCallback *callback = + wl_resource_get_user_data (callback_resource); + + wl_list_remove (&callback->link); + g_slice_free (CoglandFrameCallback, callback); +} + +static void +cogland_surface_frame (struct wl_client *client, + struct wl_resource *surface_resource, + uint32_t callback_id) +{ + CoglandFrameCallback *callback; + CoglandSurface *surface = wl_resource_get_user_data (surface_resource); + + callback = g_slice_new0 (CoglandFrameCallback); + callback->compositor = surface->compositor; + callback->resource = wl_client_add_object (client, + &wl_callback_interface, + NULL, /* no implementation */ + callback_id, + callback); + wl_resource_set_destructor (callback->resource, destroy_frame_callback); + + wl_list_insert (surface->pending.frame_callback_list.prev, &callback->link); +} + +static void +cogland_surface_set_opaque_region (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *region) +{ +} + +static void +cogland_surface_set_input_region (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *region) +{ +} + +static void +cogland_surface_commit (struct wl_client *client, + struct wl_resource *resource) +{ + CoglandSurface *surface = wl_resource_get_user_data (resource); + CoglandCompositor *compositor = surface->compositor; + + /* wl_surface.attach */ + if (surface->pending.newly_attached && + surface->buffer_ref.buffer != surface->pending.buffer) + { + CoglError *error = NULL; + + if (surface->texture) + { + cogl_object_unref (surface->texture); + surface->texture = NULL; + } + + cogland_buffer_reference (&surface->buffer_ref, surface->pending.buffer); + + if (surface->pending.buffer) + { + struct wl_resource *buffer_resource = + surface->pending.buffer->resource; + + surface->texture = + cogl_wayland_texture_2d_new_from_buffer (compositor->cogl_context, + buffer_resource, + &error); + + if (!surface->texture) + { + g_error ("Failed to create texture_2d from wayland buffer: %s", + error->message); + cogl_error_free (error); + } + } + } + if (surface->pending.buffer) + { + wl_list_remove (&surface->pending.buffer_destroy_listener.link); + surface->pending.buffer = NULL; + } + surface->pending.sx = 0; + surface->pending.sy = 0; + surface->pending.newly_attached = FALSE; + + /* wl_surface.damage */ + if (surface->buffer_ref.buffer && + surface->texture && + !region_is_empty (&surface->pending.damage)) + { + CoglandRegion *region = &surface->pending.damage; + CoglTexture *texture = surface->texture; + + if (region->x2 > cogl_texture_get_width (texture)) + region->x2 = cogl_texture_get_width (texture); + if (region->y2 > cogl_texture_get_height (texture)) + region->y2 = cogl_texture_get_height (texture); + if (region->x1 < 0) + region->x1 = 0; + if (region->y1 < 0) + region->y1 = 0; + + surface_damaged (surface, + region->x1, + region->y1, + region->x2 - region->x1, + region->y2 - region->y1); + } + region_init (&surface->pending.damage); + + /* wl_surface.frame */ + wl_list_insert_list (&compositor->frame_callbacks, + &surface->pending.frame_callback_list); + wl_list_init (&surface->pending.frame_callback_list); +} + +static void +cogland_surface_set_buffer_transform (struct wl_client *client, + struct wl_resource *resource, + int32_t transform) +{ +} + +const struct wl_surface_interface cogland_surface_interface = { + cogland_surface_destroy, + cogland_surface_attach, + cogland_surface_damage, + cogland_surface_frame, + cogland_surface_set_opaque_region, + cogland_surface_set_input_region, + cogland_surface_commit, + cogland_surface_set_buffer_transform +}; + +static void +cogland_surface_free (CoglandSurface *surface) +{ + CoglandCompositor *compositor = surface->compositor; + CoglandFrameCallback *cb, *next; + + wl_signal_emit (&surface->destroy_signal, &surface->resource); + + compositor->surfaces = g_list_remove (compositor->surfaces, surface); + + cogland_buffer_reference (&surface->buffer_ref, NULL); + if (surface->texture) + cogl_object_unref (surface->texture); + + if (surface->pending.buffer) + wl_list_remove (&surface->pending.buffer_destroy_listener.link); + + wl_list_for_each_safe (cb, next, + &surface->pending.frame_callback_list, link) + wl_resource_destroy (cb->resource); + + g_slice_free (CoglandSurface, surface); + + cogland_queue_redraw (compositor); +} + +static void +cogland_surface_resource_destroy_cb (struct wl_resource *resource) +{ + CoglandSurface *surface = wl_resource_get_user_data (resource); + cogland_surface_free (surface); +} + +static void +surface_handle_pending_buffer_destroy (struct wl_listener *listener, + void *data) +{ + CoglandSurface *surface = + wl_container_of (listener, surface, pending.buffer_destroy_listener); + + surface->pending.buffer = NULL; +} + +static void +cogland_compositor_create_surface (struct wl_client *wayland_client, + struct wl_resource *wayland_compositor_resource, + uint32_t id) +{ + CoglandCompositor *compositor = + wl_resource_get_user_data (wayland_compositor_resource); + CoglandSurface *surface = g_slice_new0 (CoglandSurface); + + surface->compositor = compositor; + + wl_signal_init (&surface->destroy_signal); + + surface->resource = wl_client_add_object (wayland_client, + &wl_surface_interface, + &cogland_surface_interface, + id, + surface); + wl_resource_set_destructor (surface->resource, + cogland_surface_resource_destroy_cb); + + surface->pending.buffer_destroy_listener.notify = + surface_handle_pending_buffer_destroy; + wl_list_init (&surface->pending.frame_callback_list); + region_init (&surface->pending.damage); + + compositor->surfaces = g_list_prepend (compositor->surfaces, + surface); +} + +static void +cogland_region_destroy (struct wl_client *client, + struct wl_resource *resource) +{ + wl_resource_destroy (resource); +} + +static void +cogland_region_add (struct wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + CoglandSharedRegion *shared_region = wl_resource_get_user_data (resource); + + region_add (&shared_region->region, x, y, width, height); +} + +static void +cogland_region_subtract (struct wl_client *client, + struct wl_resource *resource, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + CoglandSharedRegion *shared_region = wl_resource_get_user_data (resource); + + region_subtract (&shared_region->region, x, y, width, height); +} + +const struct wl_region_interface cogland_region_interface = { + cogland_region_destroy, + cogland_region_add, + cogland_region_subtract +}; + +static void +cogland_region_resource_destroy_cb (struct wl_resource *resource) +{ + CoglandSharedRegion *region = wl_resource_get_user_data (resource); + + g_slice_free (CoglandSharedRegion, region); +} + +static void +cogland_compositor_create_region (struct wl_client *wayland_client, + struct wl_resource *compositor_resource, + uint32_t id) +{ + CoglandSharedRegion *region = g_slice_new0 (CoglandSharedRegion); + + region->resource = wl_client_add_object (wayland_client, + &wl_region_interface, + &cogland_region_interface, + id, + region); + wl_resource_set_destructor (region->resource, + cogland_region_resource_destroy_cb); + + region_init (®ion->region); +} + +static void +bind_output (struct wl_client *client, + void *data, + uint32_t version, + uint32_t id) +{ + CoglandOutput *output = data; + struct wl_resource *resource = + wl_client_add_object (client, &wl_output_interface, NULL, id, data); + GList *l; + + wl_resource_post_event (resource, + WL_OUTPUT_GEOMETRY, + output->x, output->y, + output->width_mm, + output->height_mm, + 0, /* subpixel: unknown */ + "unknown", /* make */ + "unknown"); /* model */ + + for (l = output->modes; l; l = l->next) + { + CoglandMode *mode = l->data; + wl_resource_post_event (resource, + WL_OUTPUT_MODE, + mode->flags, + mode->width, + mode->height, + mode->refresh); + } +} + +static void +dirty_cb (CoglOnscreen *onscreen, + const CoglOnscreenDirtyInfo *info, + void *user_data) +{ + CoglandCompositor *compositor = user_data; + + cogland_queue_redraw (compositor); +} + +static void +cogland_compositor_create_output (CoglandCompositor *compositor, + int x, + int y, + int width_mm, + int height_mm) +{ + CoglandOutput *output = g_slice_new0 (CoglandOutput); + CoglFramebuffer *fb; + CoglError *error = NULL; + CoglandMode *mode; + + output->x = x; + output->y = y; + output->width_mm = width_mm; + output->height_mm = height_mm; + + output->wayland_output.interface = &wl_output_interface; + + wl_display_add_global (compositor->wayland_display, + &wl_output_interface, + output, + bind_output); + + output->onscreen = cogl_onscreen_new (compositor->cogl_context, + width_mm, height_mm); + /* Eventually there will be an implicit allocate on first use so this + * will become optional... */ + fb = output->onscreen; + if (!cogl_framebuffer_allocate (fb, &error)) + g_error ("Failed to allocate framebuffer: %s\n", error->message); + + cogl_onscreen_add_dirty_callback (output->onscreen, + dirty_cb, + compositor, + NULL /* destroy */); + + cogl_onscreen_show (output->onscreen); + cogl_framebuffer_set_viewport (fb, + -x, -y, + compositor->virtual_width, + compositor->virtual_height); + + mode = g_slice_new0 (CoglandMode); + mode->flags = 0; + mode->width = width_mm; + mode->height = height_mm; + mode->refresh = 60; + + output->modes = g_list_prepend (output->modes, mode); + + compositor->outputs = g_list_prepend (compositor->outputs, output); +} + +const static struct wl_compositor_interface cogland_compositor_interface = +{ + cogland_compositor_create_surface, + cogland_compositor_create_region +}; + +static void +compositor_bind (struct wl_client *client, + void *data, + uint32_t version, + uint32_t id) +{ + CoglandCompositor *compositor = data; + + wl_client_add_object (client, &wl_compositor_interface, + &cogland_compositor_interface, id, compositor); +} + +static void +shell_surface_pong (struct wl_client *client, + struct wl_resource *resource, + uint32_t serial) +{ +} + +static void +shell_surface_move (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *seat, + uint32_t serial) +{ +} + +static void +shell_surface_resize (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *seat, + uint32_t serial, + uint32_t edges) +{ +} + +static void +shell_surface_set_toplevel (struct wl_client *client, + struct wl_resource *resource) +{ +} + +static void +shell_surface_set_transient (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags) +{ +} + +static void +shell_surface_set_fullscreen (struct wl_client *client, + struct wl_resource *resource, + uint32_t method, + uint32_t framerate, + struct wl_resource *output) +{ +} + +static void +shell_surface_set_popup (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *seat, + uint32_t serial, + struct wl_resource *parent, + int32_t x, + int32_t y, + uint32_t flags) +{ +} + +static void +shell_surface_set_maximized (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *output) +{ +} + +static void +shell_surface_set_title (struct wl_client *client, + struct wl_resource *resource, + const char *title) +{ +} + +static void +shell_surface_set_class (struct wl_client *client, + struct wl_resource *resource, + const char *class_) +{ +} + +static const struct wl_shell_surface_interface cogl_shell_surface_interface = +{ + shell_surface_pong, + shell_surface_move, + shell_surface_resize, + shell_surface_set_toplevel, + shell_surface_set_transient, + shell_surface_set_fullscreen, + shell_surface_set_popup, + shell_surface_set_maximized, + shell_surface_set_title, + shell_surface_set_class +}; + +static void +destroy_shell_surface (CoglandShellSurface *shell_surface) +{ + /* In case cleaning up a dead client destroys shell_surface first */ + if (shell_surface->surface) + { + wl_list_remove (&shell_surface->surface_destroy_listener.link); + shell_surface->surface->has_shell_surface = FALSE; + } + + g_free (shell_surface); +} + +static void +destroy_shell_surface_cb (struct wl_resource *resource) +{ + destroy_shell_surface (wl_resource_get_user_data (resource)); +} + +static void +shell_handle_surface_destroy (struct wl_listener *listener, + void *data) +{ + CoglandShellSurface *shell_surface = + wl_container_of (listener, shell_surface, surface_destroy_listener); + + shell_surface->surface->has_shell_surface = FALSE; + shell_surface->surface = NULL; + + if (shell_surface->resource) + wl_resource_destroy (shell_surface->resource); + else + destroy_shell_surface (shell_surface); +} + +static void +get_shell_surface (struct wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct wl_resource *surface_resource) +{ + CoglandSurface *surface = wl_resource_get_user_data (surface_resource); + CoglandShellSurface *shell_surface; + + if (surface->has_shell_surface) + { + wl_resource_post_error (surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "wl_shell::get_shell_surface already requested"); + return; + } + + shell_surface = g_new0 (CoglandShellSurface, 1); + + shell_surface->surface = surface; + shell_surface->surface_destroy_listener.notify = + shell_handle_surface_destroy; + wl_signal_add (&surface->destroy_signal, + &shell_surface->surface_destroy_listener); + + surface->has_shell_surface = TRUE; + + shell_surface->resource = wl_client_add_object (client, + &wl_shell_surface_interface, + &cogl_shell_surface_interface, + id, + shell_surface); + wl_resource_set_destructor (shell_surface->resource, + destroy_shell_surface_cb); +} + +static const struct wl_shell_interface cogland_shell_interface = +{ + get_shell_surface +}; + +static void +bind_shell (struct wl_client *client, + void *data, + uint32_t version, + uint32_t id) +{ + wl_client_add_object (client, &wl_shell_interface, + &cogland_shell_interface, id, data); +} + +static CoglContext * +create_cogl_context (CoglandCompositor *compositor, + CoglBool use_egl_constraint, + CoglError **error) +{ + CoglRenderer *renderer = renderer = cogl_renderer_new (); + CoglDisplay *display; + CoglContext *context; + + if (use_egl_constraint) + cogl_renderer_add_constraint (renderer, COGL_RENDERER_CONSTRAINT_USES_EGL); + + if (!cogl_renderer_connect (renderer, error)) + { + cogl_object_unref (renderer); + return NULL; + } + + display = cogl_display_new (renderer, NULL); + cogl_wayland_display_set_compositor_display (display, + compositor->wayland_display); + + context = cogl_context_new (display, error); + + cogl_object_unref (renderer); + cogl_object_unref (display); + + return context; +} + +int +main (int argc, char **argv) +{ + CoglandCompositor compositor; + GMainLoop *loop; + CoglError *error = NULL; + GError *gerror = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0xff}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + GSource *cogl_source; + + if (!process_arguments (&argc, &argv, &gerror)) + { + fprintf (stderr, "%s\n", gerror->message); + return EXIT_FAILURE; + } + + memset (&compositor, 0, sizeof (compositor)); + + compositor.wayland_display = wl_display_create (); + if (compositor.wayland_display == NULL) + g_error ("failed to create wayland display"); + + wl_list_init (&compositor.frame_callbacks); + + if (!wl_display_add_global (compositor.wayland_display, + &wl_compositor_interface, + &compositor, + compositor_bind)) + g_error ("Failed to register wayland compositor object"); + + wl_display_init_shm (compositor.wayland_display); + + loop = g_main_loop_new (NULL, FALSE); + compositor.wayland_loop = + wl_display_get_event_loop (compositor.wayland_display); + compositor.wayland_event_source = + wayland_event_source_new (compositor.wayland_display); + g_source_attach (compositor.wayland_event_source, NULL); + + /* We want Cogl to use an EGL renderer because otherwise it won't + * set up the wl_drm object and only SHM buffers will work. */ + compositor.cogl_context = + create_cogl_context (&compositor, + TRUE /* use EGL constraint */, + &error); + if (compositor.cogl_context == NULL) + { + /* If we couldn't get an EGL context then try any type of + * context */ + cogl_error_free (error); + error = NULL; + + compositor.cogl_context = + create_cogl_context (&compositor, + FALSE, /* don't set EGL constraint */ + &error); + + if (compositor.cogl_context) + g_warning ("Failed to create context with EGL constraint, " + "falling back"); + else + g_error ("Failed to create a Cogl context: %s\n", error->message); + } + + compositor.virtual_width = 800; + compositor.virtual_height = 600; + + if (option_multiple_outputs) + { + int hw = compositor.virtual_width / 2; + int hh = compositor.virtual_height / 2; + /* Emulate compositing with multiple monitors... */ + cogland_compositor_create_output (&compositor, 0, 0, hw, hh); + cogland_compositor_create_output (&compositor, hw, 0, hw, hh); + cogland_compositor_create_output (&compositor, 0, hh, hw, hh); + cogland_compositor_create_output (&compositor, hw, hh, hw, hh); + } + else + { + cogland_compositor_create_output (&compositor, + 0, 0, + compositor.virtual_width, + compositor.virtual_height); + } + + if (wl_display_add_global (compositor.wayland_display, &wl_shell_interface, + &compositor, bind_shell) == NULL) + g_error ("Failed to register a global shell object"); + + if (wl_display_add_socket (compositor.wayland_display, "wayland-0")) + g_error ("Failed to create socket"); + + compositor.triangle = cogl_primitive_new_p2c4 (compositor.cogl_context, + COGL_VERTICES_MODE_TRIANGLES, + 3, triangle_vertices); + compositor.triangle_pipeline = cogl_pipeline_new (compositor.cogl_context); + + cogl_source = cogl_glib_source_new (compositor.cogl_context, + G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + g_main_loop_run (loop); + + return 0; +} diff --git a/examples/crate.jpg b/examples/crate.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2807459ffa4c08a37d23543635d301a8fd2c09be GIT binary patch literal 171588 zcmbSz1wd5a()it_Te?}gL~`lwmM%rA#zc21`&(57QGiPSboO93JGnez3^9A6NmYSv-009p^2p<5Pf1%)34MaEs zfUYjU3jhEvfCC`|FhB?begFs^fOP=_fGvdnH|zr8{)+|*(g*=y2@rs%H$?aXrU2p4 z7zBX%7jFvqJpodJEnY~y_*U1{)n^vw7vq-z0AWEPAt^yoDIpFL`XnD zNJ~aeLcvG}V`8LZU|?qF=VE5%V`E_87U$s;6oSLyFfK`131Jz25x6i~2m}ugkC1?n zhKPtpn1z8w_bfi9p61HuYGNg)`dkn=782I`50?tKW_jEe&T#lXbE#=*tI zCjbfRF9A>p1_l%p0}Bfi>^?{cSPx*5Vv(^3DPofw*x;~wQ3yvQ=i#y`)pk%Cj{am9 zvGtC`!>6LAp{3*C>AXl!bJ+u7CK)7#fSFg89h zIW;}=VfM@7(%0p0E8kbwws&^-_74t^j!)2bff4b`tlyUXi(RCkT~JI+3``ufT@Yvh zcw&%ZVzCHelPMbD*m#k%3P<2lC?)6BcHpsz82+TR^&Z8iVuyd>*hZUnVcGx8u*mxatw#a&pMt1Irqc1UT7aQ#hf;zqL89i0k;H}u3`oYEO0}u>W6do zN5IB1<)*#P0okwTK-(ItA_~@L=-&GiEw(e{t=a!AE_yHY zIP4RuIBrxH&w1+cR>Q=E$6$)I(Klr8G}rM&NCoSgWuJIAM)e|zu-3*?9vq_|mc40= zi350>UM4iVWS*jbRPB8A(RRfTFfl2zrps(fLhtcr1 znBAg*fMK7U52wV^Cx&3<_Tg=GWsHavpIUDWMUd;<%67Hq>H_t#y1~cUr+BUI2M`?7w{ukix%;Bw@P+I2>Q-9xS7|Yv zf6OMR&hZbQExix*b+@uK6FnfACyh8%T-`EalyO707s;v4Sq{zj$-)w=Fnq)&*!+bx zzZXnQi-^{wUPa*Uh2r9C&@h&(=&f0y5@sQ2{r9JpV&CpVdF3u_M1 zwf<1OV)NsAZ*C<$tZm=(L&|XSC4j^wLq#xWb6oL@UcHWd%-L-80B`4|uBI)vB`}mU zY0gCS8r%lf!d42<*DH+Y0KVHAe*}g0O9uba&y+j62|lLkihHH+WL}{5b$gVTfr54I z<%cEfS0(XzG>(a+WA7J0HRTG9jnV~yLU*UI&SRt9fis@)AmsrWqb}`627ijLv=7_T zmUfb4%iV>a$9ur8g{2V|B<{vhc+1suZ6_8*6i^hyr6J>;#-& zPDsl>#;y)}UMDyu*ejjiBsnbCI95HNc#FgIq!6lkDz`^$C$D8jYn7L$M$Oa{emUXB zNF%IBX6Nl)*gEJieW^&7yINJq7gs&nLc_(#R zlwz1Iw&)xPJ25#+*E2+V?``*W!*^Lq1U{8=4^KdLr_VahoQo!e9rZx3!%dTCq7lQW z*2J*w;_L@|C3CR7n3K$hjm)MFk%^zCh+N$l)`r+TchrWE$;bMj?4rdK@ItRi@zPVT(`=9c1No1iuBz|)- z=#m+?RVCQk*EU#{Ujygw>YVpRTj#)JoGyFlqQ}YV8J5)tYQt^hkG&G&v?=7Ufq`So88di30dX5?i4 zWbGo1IG4*_cfI1k;BME7XCUb*w%WH_)eqN@*HWg~<(j6b8ZE^*%th)43+Ce5AxAdU zcS=b1Rghx>^Qmj{Nkt4@SYj;OiJwB@+|sy(M#vZYMamidhZNEH!dF9IRt?#YVMKG?Iq0!`TW9Waixu8*P; zUS_JFl)(0;<%_I7aFu!OHoe}x%BVgLuat99Jd7F3Es)y_Jq>G7l|r5cUrbe$`7_bZ zBdA(baYhivcb=V`XBS>$usfR_s{O<&R}%N;IZTpizfDp>c0K30#G|&Ris+%o&EnR} zIWxwEwlXKi`tcfJvy_6%7P^iDyvnHzF{n(*bD;O3`Qxp)NLUlsnP1o$?!*{VblE0H zt#D2ne*9Aw*h-OX(CTc4T9{OFr1#RQ9*VQ@Cc_zz;@LVr5QVy?y$>5m){}q}+h?uG zKayBTQWYY>I0{ka{sI)|wC5;a4QtV`C{i2oCDyL6b4R7o=+Q= zwDgAeD8@Slw=%sJbMqe_cdetg_TdJ>BD^ce_KDGJSMEFBEjb(`Ie4fRbmn5AzBRvY zu#`DuTk{EKWO)`t?lduVgseE4B1$C532waAb*Q#yon}>}qo;PdCK04_+c;-u=nTto zKvkoWjQF!FdgK+_C3maiB3DqE^5A5pJT14c=fxWM4zJiLV!tSUXX2R#(>@z4UIcc4 zkYCP&ub>=r`GVx{0b=|&Jr3K8PaQ881@fUCGHL@ebQA_N^HE0-{sIw_ZhafPTaYL67~9! zawzV06rY(CGQLOA7pTND;9at6k!BjR*>L6yM$LHNKw_0JY~KmhjCPNqr$YJd`y`34 znQ2lUN#ZbmUy)=Co``4o8cK=(HSXy``~=%q_uF*Nn9BF9z_8I~Ic|&0yXnqAVsKin zE@`KH=`wjz2v7eYiH$BS(5{I0RcES(-OP`5T}=$JIor&U$Nk_8oL<0K3MrQ#H%H&k z@}jT*%=IdLehyfNiD=CUpYhaE@XJriIgf>Y&DkG6G4S`S+Akbyp9GhIe|hK}*e2i7 zI)x1+#gnVVtiZG)Fx8%;G8N;fBP5SY&)VFIcxo=yb|i0ndu_Pnw}R9m)?eg zYtHI~u7&P}xxZi>FBHuj zN=cshv+VX)V|N8`6lEQ<5Y(VxYUpLY^Q?beUMO z&}!W<&(bG;j23&mk^FN}V){r~Q7ZjCc6%qLJ)pDuSbl@#8)8V#X0JFkYY9CeKO5~G z%OcJ3mG_^>v_9*~*&5$$TQ~A;vjy+QVUNIQGE&)x_e+gsM<+LRE2{Z}&WGV$%;cek z@?&Oa9jdO3v9})=%fFU4I$foY8s?i{&sx_w2Lj{z@)bMSW}60sWL`;D-*p$JuypV7 z4(8q$)mas5>^V+sQ$RiPLb!9X-sHZ!JA1DMD))Nz>LZVM_Z+4n`M0S^{uzGpxv+WV zQ|`mt(S?FHO6NyTU;3P6dbR*g@Up^d)m|JO{amG6M@H?nKei96<+t)s6!TXOsd68O z+ppBi+>CyMQx8W_9U%{4hws59Snw*<66%`X2vYf!=l1K~(wtkg3){M`wY{>EW%9K@ z)R}I9PY-B9SLcJ?!WXckOCT)!`AgXi51c0~BVMQFj;%L?)-~YQ{rCb#MhZxNmN2r; z?B7m4O8i-TeEWexg}=nN$3LQ&SLy{0bZbuc8o`c>InwuSu{;MV!KWhF7wu0>1vfVs zTla?f0$gBKI9jjdcgDacr?7h%nhmgC`LjLww}}CbE`m1_UkQ!;OkB|ucfpm+MNlm& zAy?iB9mX6PB_z9tC0wwG56+45SboAb?f78|kIGO2@iirwd&Ed@0Bfea%ZVe=RIcQ7+u)o2Tj7@VUuJDXo~uA=IC z-IZmSDM<@ekKbgEO3|wkrI~ahdaEXnfr1+-UyEe$yB!}ga}Kbf;5i?ujMg0?U+;waYK4}{o&T1?#VE{M9xVyO zI3o=6qA~9LPUiIGZ`NJB+wt6saokm;T<0IozuKKzRb1`P6&5duC11KE@p(iESH(6uAr``vV${1BiP%)DEO+e zU9hX2q&=6s9KKATRG^!un}e?nbD-NTcOR)hS*{D=QXq^*3vhu%-u8}ChAL`*k$_jS zTz}~j5D>s0Aj0qA?Ia*1DJdx+C@df>dd7fX{p(L&d?z&Ku$B zi|}y&OP0OeZ&99p-nT9U+1m*?+;VVpaQF2AO%p9wW@RH`W;2Aly+?qLjKIGVqqY8xb5ODIb&wMl6coRL{(~C}ilBdR6@-JAQi6hi zaQ~wG2eYn+J;E{Qf5Q9+f71T1ovEw)pWW%^_E$H84$;+>Qt`0! zLwB&I3NyOTyd8Wz{JiZPWV!tO5cX0^N^n(0HDw7wC1FJsWg#I&MI|LwC1FuBKM11`9E`CxEj>q55B+rg;vbL8{zL@ujcLHcA=T4 zjkk}3agZmdn&Dqca)H!;MX!&qp~K%};oruQ51LuvAG{zrdN_arWG;B65dW&Yn*DFL{&EFeL`YOjQBg=x;@>+`M&OsUKlsqDKu7XF`vO$?e>1v#5sv>Kx1eh- z=Br=h3wgFAf24I|4m={!9IDCX4@u z>CgJ#On>v3xFdY!g#T*bU(mnFuY$_^JE$O>9DG1xQ87L+R>4yOJSF*r#f15U#o^!y z;w0dFq9TIeDFnhGUP6RVSW=8nL{NxNL`VWWCHX{!!Ba#S#DQ|e1;G=f6-Qr-g7x4j z0v8dMR)s663Mwh93JIyINQx;bim8bzD+x;|ii;=-fmoHlH2x>e{&$_|0Paiu`$3Ja z`J)rjms0wOK!;oADhO~?`&@J+xM?IK@NcWoZu`5!;-7fnfAaiM^_xf8bxszQFt{ML@i$&@UP|ADT=2q6GT| z^f`zDOArH>5EZ;A!9D?Dut&fW>_c%8u!qqlNDr2h=u!ft1WR;VB4B@`OLQwDU>u-J zkQXd3c)=)u3&Fu!bO~w;mcKCK7qA4nlmztz%L^JwQ4kgvM&rf7hyhD5uHZtFpiFd$ z=9QE{^GZsfX(T1kG?J1RG?GFWFj|`Ag)~V?bc>P~G9}TPfE$8hd|>SHf$_>G#wX4v z!6(TFx<*KdPe_K3?|13ZQ z;RCKFg5>@r{s->goBeC%1=nBTN=)GQdJVkzz2b9l2bX!?==I$BBB42`qLsd(o|>kP zD!9`O0E8Mk2zL+YB>-@9_w`0A4ekaq*IQCosAh`@Bz9PIef4*h-nw*aCZW` z+ua^<@oa-||EGE34+;NAwm&4G!C!F=0_24#fWnF&xHLimVEh;YFv$r349je=2J*Y# zbnr|8^vE-Vt^A665C-cn%6}@LiQpyF2jRqwMk^Z{Gu!!j`=eoSOrQ%a03RR$C;(c3 z319=bfh&M8APz_a3VKust_HB zA;bb=4RM0FL;N6jAW@J9kQ7KJBo9&ssf9E_Iw1X!QOF0#7sx7P2XX?%fD%F}po~yX zr~p&~stDDF8bfbDouFROVCY?F0yG1f53Pj0f_6X$p_9-B=sI*C%vB-4pu%9mxPl>p zp^Tx2aSg)}!y6+MBMu`SBOjw0qZy+YV;o}vV*}$D6C0BplNs|0rZlDorU|AUrWa-? zW;|vlW+~V?V>L!G421ioJxr4<@kC;#|g&#nHpD!STh3#(9EMiPMfV zhO>-wgiC-6!xhF=!@Y*Ytz^}&d#-GFAB_JSRC6FXAAV3g=6J!uPC+H*iLU2q-M#xL3 zOlV2yN0>lZLimR81K}R)uZYKp zH%ahFI7k#pZjuC(q?5cL86nxYgm;PalJX^+OQDytE;U`6zO+wDPAWvIN9slzPg+je zPx_q0so9-}^_p{G%xaiEE# zsiB#qIiY2yRi$;MO{Q(2{X~aJ$4h5G7eJRy*G;!UPeCtDZ$}?TUq?U70A=81Fl4yR zP{1(6u+PZEsLtrg_=K^Oaf6A9NrB0QDUGR(X%$8elY=2(X|Q(K8Z#xcBJ(Zg4CXH8 zpJ29-28$m{9?LrxBr6xI32P*44eKX1d^QO-N47M!w`@PzVeGo>ci1b~XF2dVBsiQo z9&_|^9CC7TnsLT(HgJCDqT$ly3g)Wdn&T$omgn~3&gY)s!RC?Rapif&^PU&VE6VH4 zo5eeF8G2dlGUD>H%cFc);OfksFQ0Gv3gH#SEB;q1u6*IA;@9Di}O(aaDQDhr_8SVhjhR=wSi|UHT zh`tp)6B8Hn7ONIp6=xT>7Jn)}EkPlnFA*=%Cy6DgBpD{zDtRm=Cgm$tC$%MgMcP%m zT>85VmyCl*Uj3k$(_vI)xFDu$s^EX)bp}uwC94C zl-DD#pWfQu#Xb<98$OM`6yRcN$dB9ap5GULIsYvGqX5%@7lEXK?tw!=yg~PaR)W=n zi*94yw!8iI4$Ga0J6}Q+L-Il)p|+uK!`Q;^hAoGyhnGg+N4Q1|M+!!!MD9hIMK#}L zyc>RZ>7M$%ifH0!@960m>6n~Y%veP1yZa*dpWH{q*~bk$5PXpS;56PYe&C_d!;FXL z362Tx62%g;ldzNAlctj8lS@-bQ-V{LQgu^br7@?)rR_bkdeol|PtSRb|Jd*GLWWL8 z;}iBLNl#8Qoiiu1l(K4`GCaNi^zfPev$1T2?CKoGoCi54xrp4EJoUU+`JDOb1=t1t z1>Xuy3ww(sipq-ViXRl8mAIEIlp2Jx9`94e6!Kv)Uou|>g~r)^UjGbgRXbo+TDFUYCWC3 zioNZ9vVE=nQvFQ>5(5o`VuP=SM2G5!MThI(iM@L@B0kdiUh;kOsLW{FnEY7BxXO6X zgyzKHzqhWct-fEozP7yXxsKe3{z3ZV=_dE) z%Pobip`YeIm$$vQ&v)W?X?IKZ;CpZP_4hv?xE&x5%hVWvkf6oTs#2GP`nBzR-!Wyv7lH`Ft-vLAi2mtBx3=vu!V5Q zSrrY0ZEz{rydsp6DMj+AsM!r`Icz&dztC{PmA!v%8%3sYiRFumtEd^hLRCpEvoKFZf`%t7q@pHdNrPCC1-sAMG9+)Hxu z?3|EAXWXoG47!Cx=>Nb4*xoRk1Ir zZHW%e$0pK>Vm;_iXy%*=x<6r&sCK}Qxr51Co^ZG!UO{K26XM2VwngdQVZA{gWABG$ z5=Is((G{?*T*JYf>2dIYFCt9NGEWm)NhcjLO#QCeWLiqC6o&Zh5>0{^HfphnuXyx$ z`?V-vHpl*35uUy5f)Ngl7p+yo)hnn~=^qU)Qf6AsKgJ#v{GgOmkAi)AvWd@fl(Ai( zITH5_L55X(L-h$8(W?`#q~wEUE~Mwxv0zJwLRa#!rJwo>Kf{(SHjQc)mAjAeA8*@L zv-@Lrten0T=FcF}2@ZL^g?frN*6a*iFTAWiEA+Y2`nkv*5!udu&-vII>bF#K{DF7# zxG5i$21S;qU~y+ua8Mnx`^%l`kDa*NG@i8I$)U7j?Qrz`aY(}2qP(>AFeOJ=fa+Ai z&-JAF@ssEA7@M^YK+ktN#x{un zS((1~XA0@GlFj~HuWM&fbIQeg^#w3<#@5B#)p>8M`{flzJWa3n)-VtSh4SxrN7HGn z(e_r>6u}d0PtsqX$+y3`vtQ(Rv^IM1w4_fk;EeI{cl^LRe%oK$YkHW<4RPfwCR!)& z%Ocr}l(8zP6o1USvy3}bR!&C-r7z98 z8jfXEFTheer1e%g-yGlYXuC5>1a7>aVaW${XnYnAJh=Kq=Gxj)E*T}5cq6e(6Yj^K zoRs_Q)eHfBqWk5QA8cXc>u1ZviEpD|TqT<~Y_>alpQ93~nx_YWbc`||(&-PzFPn@L zus$b|Q2B1AeoU;YI!KI+QvVY6ri4+^_Z$dqlWa|h>8@^*(j2Rrl+1Doj=na`6n{H-99Rq^ZeHC}H& zmH4)1^iCnW1)Vo8-R~SfB*F3x{INK$ric8z{(Lc_Eo4Z6{aIRA7hrDH*M_q)EXH^% z#H!VR2o`=0@Q*Z?wI?zOmJ-U?tWO$+<{U)9Er7_1Add3Be2=3A)SYo!1~&_&D#lBH zOuhGYas#J1u`n7M4{#^+Mnq}Zl?e+6joCM&yomWG7y6L(I4M`1xjW63X9eF%tp!;* zqi~)J3?D^pd*R7%J+8S_DpoTRRFGE{`zo!hJs7*is^JpinMl~U%g8JXb)P4x%mc1M ztxYhzDRl+6E2>SLNk&(izP>=zQEFm7Yx!{FV6n|_{0YMi1X6w2qQja`l}h~slh(`j zSSuPa=T_%+&*+hLpN(RD#X4MCBGqW*hHUIYbjG+i>~fVn;`62O1y6C-D7KAzH_ibv zId~6DJ^q;q&&R;yZ_YCa@MQ`8YbjS#&yIwOeEV3v>U)uiIl(z>9kFLjX=gc+)nKZr zJVT!W^@G>8itN|+u{}9rCqmo@S`ch@T7k7i@WOd|t1TFu3+L_!#q6!fa1{HUV2IXH z)zsH#eW_(TCN9ITj`4rENQb;yX!9EjfJvAhHktMPY&w0GJVCLv&9Sufe0nj!%)~T# z!lLgh@7cA2%mm4nDWSh`eR5^`2OQ%XlbCHGHB$b8AV9w|Y+)$J8 zQx?ChG^w%ksl{SK##oQSSbYT2X))INxu;$~Pmb+r7-=?~12Qe^$0J?QJ0a;+-4&V3 zkdB#yoFeky49t;U^${srOFV={=CF6D#FKNC@}2`orK5q9`lCnF62rBZQIn2TnA3Sm zW8|+*kfhzG+r^lW!nNe7JMT|pFx@@l4=-bEV=YeQlElddFNAl6y|f&~D<`Uq;l-{A zu?jhYW&6&BS(v~!V9~+c=%mfmArGQXRvHxVu~P=LO7JO)zz(F{au4lFVPOS*L!3w+rvgIYUOjHftW`Y$qGgxwoz7BFkf&4iHwZre$9dOl=zUISJf| zE5e$SW0RrBOe}gS3%OT`a(sDgPp<~{P2XhQA4pXR`lS4rZd~k(F?X(<>+OR@X-!1p zagkN)orz;Hg3}7wj++m_@Gu@?lVkU5)B>jE2W*Kx-Wp>Iezoyt`h;)w2H(fifjk%MdwTxjwTPZzCuf zf0?b6KQ)wD=4MiO8?WC>H;xV!L0f2LZmwsHMMi$o9O8&i@)$ShG%k*1hx`a>6e@n%A1*ZM^aCdRc!!X1 zw^Zbl93%jo`abguN1%?S8Y9i2!BH8}KNJdHDb&82wmV#GyED#){1Mh_aylRJz@X$% z>3*y4b_D+Vc2@b?#`+quEnag4sl#Og442vV_aHI5M$a^|+iduVhE(n8KGtUe##ZyB zXH0^A1*=jTF{P3z$By5l$?RLx`5?E+k=yFJtF_r;&l&l7??gfEzVq}963afQ%oYuN zyP_5NVi7Yl$0;=bn}$9C<|A@VT0RY6lzO}C7^!3VG{hXKs$B5=Dx|7YIJ9r+V;ZehMU-5p>Yu%wUF-=OJdqjm{3U#+Vt>jl-6Cax(dpq>9JR=E81&MQ;2bZkk z0}n{zWy8dl2WkvSz!=W7c(}p87o`;m>6w&OIj%Tv!TmCvcQshO!y=~p9AMJm zICb2H>Sh*R^?6E)-C>;ZE!}YNdM4u`gYqhI+J}dw@}CWesPB#>Iejvn?$Lu$MFuua z6I)bFPTU#Abu+OiI5;TgdL8g3Y=DR>8N3(u4qFXp+-M9A{qnU^JRT)m{+)@>4>fE4 ze5FaafKkPqgpb|Lq!H8Ya3M5g%xY!r?2z}kfl&A7Mq(YM`gXxK_6Dtt*}9TgE$aQQ z#$KYeDUWcc5bWc(15R1yF`;*3lx^GFETD78<+bAYdJ4PR`#W*Y<3ZfIM*21D{gjQ+0L z=V1f}tCqh1r-YBwmk?*HOKxnYa-&Ay<|N2K|9XARw_-XCsJBd{JUQvJr45=FG+{Fk zU4QmbKbSEl zy6Vf?|It?7JCG!MFR$U9Xbf^BQ>fr)IBe8{6v<)~#?%^g{qka>#ae;cyQT{6f;n|2 zEk>0~w**G8;os6kq|_SbxvwU^z13-iEDcp(B=sFcG>v!{-DP8 zcwSoqcg!zzw{?Ps4|Z&dj7b3#*q!I;X|V#IO>GNNDed#y4caHkvIa1QpD5JqEheOo z&F}J#9>l$fd<&@eTWsQz$e)@Vm5krX$?!piEy2E*cyj$tm{^6Tp^HHV`)6 z7{0s)F?MlsF~Q7SQiH)tyhO`vejW{MmG1)3Rjx$qCLR;P8GM}(tu&e`xMi}t>?&79 zFtRuP9KdQG?3HJfQQT%D!I95BJ_kfj zy-e6m0fU#Noqhf06Zl_Ka(~UhouRs%Gbkd7;oyg(=i;u(S0!Muhmvc8Jr>Cy0^eIn zR*4V$VsYK{szfc*W|sflv|$h2sPw%MvyW~~9p0wg+Z5&JUz-Xu)rDFLy~ZBcWk{yW z&}IY)eN&cNk2AOU;CMfc9@`{2%Cw8jwHAn@VbJAjdPJif@$p5=!wLnK1*#`lm!imd zw4SrV#kJYiPr|u$Y%k%m`84!yy^-8#6qnnIyFA;MtaFbpn_GcxpXO=c58{gYyIQ{C z9?uWI2#BZRMg}fY^4s@2Z%~kyKfJ4Ouc|Z2?;atRo70&@ zL@MP^d>*w>3m&Bwmu@mcJS4S=9-4T<2F2w zKP0 zU_*M|<%=hmdGts_hh^610abI8h`#8+-cl;W7h*9kqgB(LAG(vLqz7b7Dlelpc+D9S znY!Ki7=mK$pTwCv(9({j)vj%@y$2U5!@ zO2aZ5%hi2)Go-P&l_q(Hve8jAEy;V>cg#_vXk&HPUe#7pD!ToObE;o^;f!o!iAlJh zIa`@I;yFL>$dM~|={GVW_Emw)M5+&0LwJ-PPA0k?EH-KPU#c)=cV}=nna3L~h_@|p zVHYw@_TQMmR#cO1Uk3bZTuF$t{TjdPzrv+!y*;hE96MxoDhV^7GI8XqvcDnSXi$1P z?8u4NR##(PUwE60+H~1qU8CTx(#MpgVP^7cagQ^&F+8y_+8Z!0OK5Vczv#EHo+)&< zpl9a$T#hNl%S(5o6aGNMJ+zBIboSV_3kI7xdtXxsAUtiK8B%PH*2_hKvMYw zmrZ_DAdA6U4QsjanF=G8%X!PK&7x%-eNU;mEh`~oF}~ z%T*LE)4VqjF2DW#@y$dQZSukciSW;vpZlrRYri}#vUSsI7$ziIFO;}b_B3O+qo97t zMJn?l-`IeOV(pC8Zg+E$^*DT~_)cWwt>Ec3HS69ts=Vw1Dp-?rrPnbG@0l_~dytOeT1XoD^6oXxNTxO42J19K|;K|R=fqUKq__$L+RIf1Bfh#vxZ00|H z-Ul}}Y;)I78Z7Tqq{J}VOGpGyz% z6H3zJpxz+ zYbm6*q{;MjVgvP*`i8QnW4ai7=J;9=#m$^XW;2}9k7vx;xpydWATR3uZ?hBe#fPS) zimB3@JX_?sSpiq;4E`ALoKxoNOXn>dWdq;i%xjpyLY-Q`t<&Lpi7qMY{k%Lsg_A0a z99`K@*qyPgCbI4CX+1b_vvNPZ?($-ibTbD_wK~4CqO4n!H*ojMW!-8?Th@xEslrvx z!-=pRkxKVzc#cOvhc@05BbnC1snT7}78hEU_qEXb`V+-1j3d@AjhALSxgZ%0d( z(BWz`rzl)5F&zp$1m8rNvVUk=fAd9wG{3xPMy&iIXDk#^6rC|zl^o7FeVcmq;9zkd zkyA=yU{V=SowUohPnTd=Ct=M&_+0@Gty{Yb{wSmO>hyZqI41$|^Fyz(Ty}a&7dapP zN4qbIZ{xp%*QwoqLdp1Q-FpsH zBw^a+YA5QAu)PIhhPm_)=A|C*m}`cgO^A?Db7TsXZfW6dQbdpgzLA=FmZrrFdg9M| zuSM(=t5h33@$p2Ic)khHyrF@4g`3ZwV}g8UR1~>QB&E)mHeD`0(AGMi<<6GF!BC20 zaOGqBl)gptUM6ZK{A-z;tI1B{jLvqgaj4DktSaA@FahQunUKQAU_Xt`k;1LjO< z{fs&J#~W`qc0f}FW=NREC7#(U+GCyKib-XO*h_xRUo$NH2(K3Km;W$S_-)>j#G`|+ zE$}GMFyWehWA7sx($dx-J5`f3qe|ZCj%s>QZxZqili~R4$IUT0d%ah8o}xlVf+j30 zQoUQ9hTaVhCEIlMMvG#i|?`+(! zZ=u7_&Mhs6=2s^H^g$uCH;dV>F04%l`I(v7uy0M>urv`He`Dq#RNkTcUMk|+$bATj z`Rgc3dqy##tt3Q0hT+y1vSQbt%8r4`WIqC8$>zVFE!t<95 zUB1MFRab0$lxNlQRP(;l5_b&_FWJ&-)g2o;>nkun69%MD%@5}9NnaX$L^!&mk|7G+ zJPqg8KYd4w%akVJs1On{#*9$FQaj)aX;@HWy~RVbZj=gpMXB89l=MimcC|v&{3cm( z=DnM_!)n#xZ0@u>;Y1w?P0Ib>I0s6Q^64D5ACe(IpIE0%2U`>p=JHNje2$(Y?W*JJ z+%!t@J?Z>Rk+U(kBX^$(lU*)Gr}1f@Zo?GSAk3>U@wFL+&=saqG3hqmV{zR@skiF_ zx;`{^MZSIjk;_T+Gx5Uk8oDG3WHRdMbuai+Mds2qJ@;;G@hdwKyLNy{&Qxy(_jqBH zq6x0_d{LrnUUze;7-9=onRq#rPevBA(dLqpC_5j`C5jL=1z80T^;c)e%85I%_gA^Y z5uD#BVjk}t(k%@S8aHEHzgIlJ+N5&JW#f`-0|l=!B0;xESFLL}t&E8Uax(~~mgyho zlyX2d>!58?7n*fY&AmPs{b2txT}hCNUH9^4eC~1!#Gca9^UcGmLYJ{FIzHJRq-Tlj zLKNcgkd5fpB@Ry^NiQ7rqF9H@`>awUb_EJ|%`ra2G`O^JzSe!gG-)}g(9WpELM)@> zC-WY|jPcBI+{l8S807C6w?YTY-0*-Xv?y zdFW%$xOy#Ao&#@tCOLhBKU8rfC3U&WrKgKSWA<-Hycz6E>V#0dWSF+2yT>;-CYbr! zbp`!k_hsZBK*uN18;dMbtn~~p` zri;Ul-*0(jnl3TJ7bIeVbwgf&V&L`%F2fl42A750WR8M)T+LS9X|nhrs&8jy{(Y39-R>miW_Y5)I2_1TnM+R z*3X%}r>3IG(4I3`0Fd=q2-&+BS=YVsP~>WV66Q`frmXsGBL^k`$LtWp?;^`3WbIq7 zQ6#`lQHrrEielGO+Ps&d?tV&;h13mbS&XIWyGK8qa($GEqOwYT5P_*|OYLj0I$m4b z_(M6A+0`Cu3DIww5;HCu>L>JFbfLoAiCV1~frT*RN{)x4RtFm!gV$Ka zU~*D5stykTb7rA$%g=-XoZDh}?H?nF5YWy~t~due-UbzQrPIvDM%BLY z8f&@lb051l)qA#Mx{MF<-8_j5oIEVfj`C@rr_RJuMOn>g)V15n>W1G9BOa z6$l85)Lv@LjOcKO4Sw9}VwdK%_8QCMs1@L?92YFV)n6~s&QIwJoCBIA&{rESBTWml z*#3-;Yl$jl^wN`3i@UlvYiGr7 z6kg^rv8&bzD&URYc$rXnJ#=y|V6j^~{@KST%9Wo6DpRe8@;Pi5QYdAj@-pxp1j^Kq znYkg2g1q8Fe(Gk9T1~xij-_5v@_UsJS*uR&5jh(`!~HocmLmB*$*kO^9;swu%IWBo z-ru$LOdp7?tz5T`sAXAF!*NSH2fn>ubHw#K`+VARN_k1K`FrwZNit>DajLm~>Jkra zn1H9|?3Ibx}1ScCVdOCdA44w3$v7Pp+lwp7Kr(`HKzr4FfHbjRF#a99fd zClX@E8;aiM0US@|l3OS}gv=$_pCLzUW^@(35KG>#ja>N$?-^oSz*FZaV=G*6LNs9+ zG@=34>Wv2!E@bnjO3%l1EUupeMA=pqT*?M>DwwyTlRF5)z~{-!OX15vwtfDjNM;o$ zfXV*Eur5l`&Yb;udDZG`VP{Nof9{;*j<{%cLH|5f)*B9ZaePW@kA;#;&lF#|`2)s= zkooc3o438Jn{#W)Whm7khMcBsJX0SO4h%O;u%5y3)UVrZRp{e{a@Q{c(7@GQqfGIE zh`eqGSj}VYV0j&_o(P~UNxF`{1rv1+U^9HFt;N4yWZpx}UyLbONUqIJrTGalr>5S= z`RZVS5&Oz!)Ix4;Z9Bsavil;NdE8f1oR?Laqg?VUNU~O`u#skVmOMRAwTpvWN5vc= zxGCN!H{o&nMUD-l-7EZWHYzv!YDG81=s$lt!Z1vAr&$cn6BOM%c`HSEtJ+LzK1XMQ zyI5agqGZiC&P2A?PW{{F{rU(l3!2?;+gL7&n7d@Wr;C|U525CK(E^EB|_cf+Vp?` zI!a3ImZWk#X7bKECDb>w=?PTYUZ59rAt=;?G|_ufgdx{zh>AzqpSHBrG#P*24DU#A z&)S~vy_sRm*Z4{K$p2JopB?LNxp6z^_DJtlZP_`(Zf~jE#ow-Zm2h$RA}nOz`;n-5 zy4x|#HXEXsbBaS4D46a;Tbu)n}^XMFNS|i%BsI>&dPT5 z<1+A(dFM3}l&(1VjrO?OA%~4ulgTN-c2+5ZMn$zqmChIoAYngwBt*$ORk^d$+Rr88 zyyS3~f1GC4?f(JGKs3K&DYOOwXhL8K0R=>C0(9Mbj zVzESINsoGEBQ$AR(d3c*r2ha6gg?~s#;lr4TO6>e)O65lVms}^r|Dcx;7?*<0s&2( zEb~H)Vv&+qkeIzj_m()l#X6b@s|+d9@5m>KoD(z$td&4<>?8h=lws7WaP86 zWOX-AVygHqh{h$aCmBJl*(eWBPMD{pnW*y^mX2xtp}6=Ro%vi{h9%7( zL~|QQNZryE*t(w^nBqm9g*GJc&l)y9N;wNMuqV>e6=xwq4RxlzMRASTN|fGdy`&Is zIOA^A;Z!(l2s5>J{{RulokWHNQDo|j0t(p!QC3Y%2>yFtz=~~Y16of?u;Uj9dC19G z9K{_P7FR5qHf$AL(#hSo03H|`!!qNhbYDuaxpOht4sx5*GZ#(x`R>B*Hg8YHB-^-;34|PbY6@l%X947inUZ z0a1~PrBnkn%<9y_!fSa6I=7+#_#9hHTtu{tkSc`LZC#G5Pc=1Rq#mtwZOk zni%s6V#LI_%)@fE=7(TS8`|sd--6U6dcynV4BkNQT((5gF$oOzG|-vwg@9V_qJ~ZT z_p*C;;s&-Z;C<@$z!&x|B*uBvNgx3UECI$=8(7p?S#|DhcJIFXaRY#`J*uFQFsq1h zVPfqgM{DKLGe)A`lHoW~GO?Aw^%jaSKokHvvIz-9f-3CqLx=;xg2G2%!CyAy zy8TM2UR?IAmyW6*)R_3F8HVI9cCZG-n?Lj=^rGR0I!cf)&Q?`9Q?NgoRXRq6c*#IJ zRg_k?_N|A025Z3@r{1JA?N+1A<*M3HK*)pC#j;`>*e0B5JDrFia0Z=N2KvPGermyB zIVo41a>%u!z>bVaNkNI3i8d?D)XE0`00e)2E0L;VTtQYI1jB5*L)1L7Hm}GU1YO7^ zYc1+!xq)g2uu=tf@5DH2hbPLm)M$`d#~lmw{Pz-FDljB8Z9!QAnxc0yG(=Gq>94hM z8-{q2UL{R-pQ~leJmwcVBfxd0Wh~hE(lH&taMF}O2iTvnz9XnPqD?^ur1^NN4;e>~ ze5?Ne;}QLD0|hN*mj)1nds`}vrG1INfJegl5^MjgPpxj93Fo@%%s9j5FB}4h{pFktT#Fg6YYnn%AYWf3(WxGE8xGqk)yWA(KR<%Fa zDksgs)f|t3H`J#|nWQ4i5EyDfxZ8iY_8eGa`OOtX1zOA|NLL#>1t_izu@VQ$0U#3Pz<>JYm}lgr2@ zaoNXk{%f6!0JgPZ=#Il{z9@=-kvBvONcDSFi1~*sRnhqZyZ3h3djq~JhFUw@d;b7o zEU9uTaqmz#52?qwaG4k-i}@I~7*Vwh0ikNj&^ZcgYA3Z<7Fkz$Q(2ICp>Q%eTgoIc zoime0}80%H6%)lDay347{ggKHg$wNa(XkK`jgSXOQ zy~B;Qb{_S_)h9h;$6AHbb_39(06R0hvNW_C^jO9WWrmVhMUdCoRQ3nla96Mb-94&j zHc`k}6T;9rhdio*>vml@NW9qy`37&@{Hf@$y$!xS?wW;Hn2Avk+%mmHr6Nr2kLgJ?U5W>yu1TUH5CjbDlgPX5S4pk zcHEx!4;BG*15iqU!1ZjWjn+*pvA~oNDm+m~R5uKuuFQMvP3?Z%327V6_ntkf2zKdR z!t(`RF(8UXVriGmMoP9*8nKWtJ2io-zCEO{kuEZ<7kRpUF^s%$QqJMr0(}^KoTUBGv0@mR(--Nha#H z;hdWtGVai;Sc7Z(5g59MItb|Eswo;$R9RHo*2FP=Axls-TX)#-vxlbR0rx~I5G|Vg zdWRxF-|#76w0Vcg4BOpXW9TNqKB5Wx(c*lajW8d_y-redZP31T*SxQ#IUh3WE~A?h zm2!?-izZfoF`dz1#fmN6wP-BU$bBe?tj@$Lg2Y=W;40$l)5BrGeP|u zlvw(e2x|bj_exv+4{v7&?97$T&UnKFv$39ac0_EsW z)15nzpfCd`C3NXl_4R&9=%x_TrdwA^)oc@(185)V?;`b&`a_?^V6CO=>pT`<*lae= z^ZWb1V1D)6&tG$Xb=3V^KTz||W0lQ0&pDK4=kpBN8fmg}7)3dDb^uoTRYf9&0YCr& zk7^%0Y|(t(E2D-} zS)Yh*S+Rm}n5q8&4c*JoU3rdEt$LmyOR?uUv`PNC3r3`sHf+~z_v02Z^NFtLwy{s3 z*r!Y#-vq79@QyriDu422#@4E!CIhdK)k!ImWxiI9$ zWQQjnW^|EQizs74`hg@B_G`1o2Qln>nNY)qV2rzhcp=S^a8!CxJxIJQ&X%G<9 zLWMH}y;au7ziuxvXoIt7YKj>I1M4cJsBmUEAi4GyThmIr_aC<06Lq8!G0+DEO}VJ? z!hikQOQNY9jHx zJ-7RPjdG0!ONYDSt`6l1z;k+*1qewxv+-phsUDI9!INTaR~O2Sl6{3pJQdtv$~Ads z9ImaECV)F=17r%axAf5kZ`kj^nv)Ybbo@Ki0LSFNK0J_}TC#(a^eKf49e}o0jMmmI zYQ8wVcDQ6C+NvUCt{s>W=EPKi>n|F(1ZrSNS1Tf$-oN}Z$JKWpYAIr6W?fmZzzc2~ z8jJ;DLKjWigUY>#15jnvV{hsQ=YiED`!@sE zD(2B57wu3-sf4jTwSb8sbHA(9Nw9BfCclm(5+hPN;Z?VVWhKET)!n26uvyu46Qt_b zvJyT1$M)a|s4hT+Qov^Nt%%~001`&tqQ9twC^jq+^#&hud-maEnVX`45(gdX2{9#A zB~uN-JC*X#5QfOo&O=c@B=BMF%3M9@OH2bIJ&GAIFsM7E0rn+I0x#dz3Zj!;$G-$0 zQ|glni$>BX-m089CR637Ems6v8L}cEf=geDU0VPUe6U|~01}2f8!YlUYP0Zb;NJ)IhD7FsK#2;-iYW;zh?ZRa zQk9oa*s2h3-uPK_go9A!xm}LLQ5s0CV!}y)9j0$IX{x28YT%MD;Qs)15FI4G4D}Ru zZS_2RmvhWzC>Q)HR8?9g66G|W;0@h~A8+G}6x$@4z@C+Q#C=FrWzI4mOnDI%1O#V{ zi)tEKo;0iOEce)U;DtD`a3gvW`Pp?`=T9TZuC9ekD04c=xDK1HI6;>#ld8f>x^(;@P@tV4*c)+rw2VtQ_o|bM>FE0#R*TUf0;| z+~0AUb|J%#qO5Ce$q^G|r5_>)$f^Z{J1MbdvGj*;dnA3hTr%QG?(gtMb&OgSCut>_ zyyzN@*>|SBMBLA;Jkzq549TDleYt{ ztzzg1qgLQbtt!gKrNnhrO^cY&iftiDL}ROStK<7{ZPgi66YoH0Hv=4WD1@=Hd1n(P zN!S(qF_s`%y7xuJ`aUrLf6$_h=7P!A+*2E%$h0H_Do5RX*YmbpwYW<@uR zj7wd#xo||wwVl^c0*`I`@EYtVGaX9c&O-ewq}V{|M@VR!AMxRd8*EH)vuRR0ef#lY z@gx)O_^K_~K%TTT^6X``Y-v|fP`Wc4K_cj}Xx6V+xEucfejCca_TY7K#>6_gh`Ox! zSg{h~Jmo+^f6L4y(tb+~A%%(_=i`DE9Ox3?Xo*#-GlHO5FoS9H@`z$hO(+182L4(~ z6yEi)`QV6o5*puNOseeC}-MNOOBEw2# zQKx0}pFFDk6I&nKisaa5==t1qE7o`IS$8t|hzXe)HC35$!h&1+b%JafZ>G5FCPu2B0gkC2|;$R*4EK{{WIftQpzeB>WW;;t1H6dB;2C z{WHnAmr`{}nkO~Z9(o~vzGI;6BXi2G3ohojtRpG2|(~@N99}dJ3@(&(-dFl3&Wn6xv{5*agdYd0tl&n%t zQ{#t@Jfds4UNR@?&YZ|yfn1!GB9*;+>ft>Z!*W#1YH3QX=Qvydb`SLT?W{-mW1q(j ztEFm(yg9f=8xEcS0Bi7lxz%WssQJHA^L}U4eM8JLdCxoM?Ah7*`LY>ua`I+#D0xrB zWy*vADj=W$01pq1saFwI^=iDjtDH$D_v0;tV((CEDK}A#0iXy%dF*VNT&cw}EJ`Fx zAE;xAl}P~6u^AxOzYC!SmD{)Cj;MmdM#MTqR?3ux49gP{V6uTOJ1GZar}ZOady68z zI5~#4_MYSM?Lj=_(zBlu!#{<7CpwKLPL1cpjX-wgSsHYT+gdfBZMf-Z*cw+xG@J76 z{7Wt{6NANH`!{zL=-#$nU3=7Ig$y~AqRrlv%aTN88-m0YB=*0KIr!KZj6{Cf?&E^A zQS~W(ke7L;gP0=UOpwG-9gt`bsDJ?3i;+Xvlg3I@t2;qjUw1(ng-?~@mYhOK)~%Gr z$fedJV4Lax0FtJh?n8QkQaSK8V0@!&yOkygP*Jn6P(avG zKO=@=?kY*!=lP+j^>?B8*|K7}38@{WnCcP$rB$9{px=9N3ZGyHZtvBHHNfNtZ-(Ts zMnzM}NSZe&CrStlSr(!abh|WoVb;#mL0vN{akpiuEWfV5lD*UmHruRl9 z3my9)?dS*D)~!xO#m&7VnDHJVGGb!#jLcZGa71~Sc_2#$L|G`&6DMX7Eihwy*aQ*2 z`*F>4tFgtENfiddFYj7f7~l&?EjwjEc~&Qw%^YhTkjCVcp|-FQ2>|LB*zHxf1%#{?WTLS2AKKu!*P#ZQ6N5HGp8%mjZ7cEq= zl8GqPHNlZMtX0UnbET)Q!uU2>$@#r%3^_((8&M);6nha!mzWWaR7Pyuxp z(Ip*Mwylr%;CVnz>Jb})nuP3C2QHP|mBS>c8${~rD(qM;E->29!y5}-+SOWYICsLdGlAQcN93_OpHHK(ayk`Kw<%) z09hT@kFW>#;k>I$ZmM8OUz3+)I~D-yQVB9Nidul6j#9}`J~rYS%xEG^cPkBX$SW&{ zo?HZmc?}W@J4#6wK^|d1PW9h@2b88o+yb)KZd^Yu&p^^P6q|O}j-&!83v({5R(k=& zLiayY061`_&c!H-$^2nFfe{T^lF^Qz>A=zN+%WgxLF!e#3|w0gh7TT#TSf z{JD7U6%H)HsEtWE6}5dHNGAR4ZFR+(ZUmii$F)?6zI=2pbmGioMV4sIf5{%M;DS(2 zgs|;;Z1F_Bpppc2`Kz?_BC&F~h^27kjh;ny2CUI47L9$*+$7d{kb4PrXxUd7ZI1=;$mkVpZ>Jw36&swxf6V956nVfviSIOI&tcK`F~CvLY2* zRgI%kM`~9wF*~mMg@d;I7}N*Ww@mq}AdJ-|&Xp9Y^2@H0$nha0P#&g?GY16wg(kju zK1@3DVM$T1G|0B4DBF}!bhre9My5stQNH7T+wlz+@4BsHzU%X5TL3S;4d8Vnv9a670bD-D>#EPpK?*W5!y7cxw1;zBtbV z=9C)&(J}NgfJvYPh)RR@t-p>4(_n&I+uO&vLg#Np;+vU>?WK}4q%dYEtZW@5E|zG) z?`FX#g*Z|!BmwR`6@2)yT|D_%>6bEJG4E1EkXA}GO}uC~aB9!bZY~CGZHGdu%$Hqv z5hRopW=li@A0s8cdoP$2iu;eZ6iH|#>Vec0%-9p{Qmz>kqXpElv}T%X0{3Fhpd0qy z{{YvD$emw;fBc<~YTyBoTl$I;1koK`d|PvnknyoA2%4isak| zXWjy$;BNvqerh3Mn28 z{L`NG2R`OmeBYgOOts3)<{7ei**SSKG^+08k`Jj-RX_m(fD{hiKBY>SioC677gcd2 zlbJTptMZJOYMUEPfsAMjXn;Bp{#J>NlaK|KDWWSX%DWW|T7ViXd)eE!38+h&+ul)Zxc#`9{mi~N#CRMjHMgvE(*=jBadftxPaFZeAje!{T zKsgkR%sF>5-!qjZq4`h!oJ>m+jSKsADO% zm1u4ypaAXv0J?k+zo!`wq)VA5kupb@m$@9p!;_fdIV8s61bKL$)qnPSsIA#gSYHLG)A<`Eol+2FHCVJ^0GwE5-n;>pjDOTHhuq=T? zZYb7i16H0})HLmKtw+kzFH-XfM&trnNKnex*fkGL3;XYU393lFF&uR$8yP)WPFQ91 z{&F`oR6Auzq&IR|G#zCB0L;CJ-`sF6ss)QX73xkzcP{P7Cvl=2lRH_qhEhyt(8TIk znc9K7BCBEX#kRY3gNr@ta%9*UE2?rF!M3JSpq*(nbFtrMbZk(}X!g_G_u_n_oy-gS zJXP{exr-~&a%_gw=g*diVMZ9-SlP&t;&vXZ*c;f@)h*SARtUK#2{%>_4B(1_20%#- zCPJXST74h_s@7`ACif)!jh-JFM?%1`Zn+`b8G5trLH&V4{d5T6rKLc=o zZYx?1o@c342W;*5s8~i2tILTNlHKwmW2Bv^W9k8o?lz&p0!bR7$JnK!(Tc^D)#O2#%vf6x1&41tz`5E!54RPp@diqPqDV0vf1h&ZUS9FXasFaN-Khe(Q@JEFM3+_j zirn!9K_D2`QOqLY4;;2xhv`g>LW)k2q=k2-sWj>+KH~m(K2QU3ZiG6ez`}*OG_V`| zqfCaw#3SExK!qC0(Kc3W? z)t%`5_$_m)dFWxFivX=diH`!AUm1d}G1nNdzw-J{s!jH7#UG9V&vUJ=h&NXHs^pmn zROrM)ENL(z?hfSp$X1Tx_deVJZTZi-B6TA&K0tG{-k zw&u7aR4@jN)a1#MMWJ>4yby(lx zZHZzfX$kLS)osB!?zB90M0hIHY>+|Y*uORw8#4JKb|CJ}EGmP0E^E}Huh@16Z+h2w zooEWnTd0n({0l0^$G6pl8#q6Y*kIt`7G>IoNtxpg>rk&-3J*(lek zMOgZ@vsgD>fxa(YElCx>1TePDPq&W`dJ|USCKX}NCXu&><2tCx zlOWg|JD5?>sjB$C4A5wR9nR<7F>Q$%^ROnhRY(Pb1$M2t15L~~ zJ%LSNMTOO%v*{X0nldhyRhGU^mX#0%BI{4zfR@U=EYv#ETs?|vjDt+B%ZgZ?68UG}%Q#z80E}vKZERVkB>Q{tCE!J; z-{hbhJe5A7<~*OIc_%UIZlmXr^1eyRv0F1Ym~#er@$ut`hYI0AGD{;cSmQ?5E0t9Y z#9L@nt&Oiw4TqpzUB&KsX)02|7N`0kA;XN6_I-M6b zrj)ANyDb(wiC%XsN6{RON}ZKJ3IdKiH!D)MAlI(q>aQe{Pfr~k3(yue zoi?(YKwtn_ATbQSVl5vwH<3^_hHp!-Vi(rSD$wj~-@gw6`n!T!vjmbE+BIrm*xE?0 z@-Q>9nk16?esvLi3z{`Gk4hmqB0TK4mH~F77JZ2%5j3i808&6M560hq7eE3JSlF%S z)e*5Tzo;^@mI(qeZsh*}oLpUMaMG{`aBGbhX#n)cXMzNw;)3~J4fXt_64CT$QZ*k) zCQe(-MFl&6Huwj>YCLPvWIIgY05;{>-V!lm^ejn>@^0=SdNZxu{{XjrQv&Ya>4!o>;VxXK5>~<*3h|UNhcOVce zYa0)KGcZF;Up_YPOmUI{*g}ORCz$!b02Ok=*QAY6nS&Yvwu|@QeTM`<5%# ztPaE%IUgc;?7I1Dix5&kP}0ukL~lqfUS%4(BfoARNVTmoy!UyaeCu^9(iMrN4D3-7 zU?`M2e5FwI!GU1GYW>OKVoXP^Z+fyIoAD5@wv~$uPpRYc-L&j|N^X?)W!GSjarWRQ zOUbrK^3-fDc|^^RJoD=@NgJ4iq0iFu5Q?SLF4k;rD31H_A1w@neESs$CBXG1u4#=o zAj`|@E}q2_a+zdoo}}s6B3s7P)h9jVFr;z;7-qTgzzQnBt~yNQ@zk42p^Qin*Kg=K zdkM>>Wjferm$XeInBCGmM%>{ff9)aoe}�j}&?Y%B)gYvU-n`tdPirsYzm!Mwt=8 z3>c{dR@K8llYWqxEzx!3p^m?|i(LrPnlKYMx^wo0xa$juzY$-Dbvl#9PYw66pmlBr zIaMGLUR>=7DhAeUd+o$`qn?o)9TkcDg!m{lri~fnDSI3~DpB~6{6A9<_o?Bwl@^-1 zvjnp@ZOO_OO&TO@4N%yMK8<=oKh-#y`vp&(bZ7b6QTDznIlmHK2L-6SU+~^BdI68C zxhYkk0@^lUW4Z6AVZk@iy*YApMkN0L^}2h!P@OBI$M@Pp{o~D2ABbNA)g7P4&kj}G zhE)FmYk4z}N7MdXvnW*+ve2(<;LoGla!48z6Zage=PU#h^7>zR75Y!aZ-NY(TgL8! zbs*ehsX1x_4bieyRMQ&XzhT7wPHD|)8WOnw0ArN-%SZnJ%qjih=BuB?r-0f@FO0nx z-09QR9H0SP0vzTIjeg?&_`l@Vp3LZ4{{V5`N_^*|wqvRN;pU(}i5~(O=##~shn0IV zo2&VIr3(X3{BZ+gw{PvieAkuu5KsL#c?AZP(f9o_kpBR4RiFK&JQmYO#*YuscL6$=lSsr8 zeKxL(us<9L^lMECjSGk~`;SxSTmb(4NDs6W2k{%=d)RLn`Z3Ur>#F%ud~84C;2U4H zci_L1dT;qLX zKHOjOcTSm|6<$B-yZ->?Pn`62Lm5b)v^>f9((8Q?>s9y$=lHH|^CNwTP{#G?`;zUB~y} zf0Md&59+*6+;@Oi^QMm<-st_|=BzK`6Trju_^;u!DIJ%qc~TwEdtAk$K5U=oiaw6% z-}z1^f9bo)U(R|z{N*3K6rcM*_yVJE6*>tGl1g=_EpRM*t7pfk+2X&G+J5KetVjK) z4&bNGdNx0%(g*DiFuSkfC%|P;tK#=Uve+7%t2s#^3#AC$(Uh9*Yk~ewY3;fqzx}s= z{G$2KM*t%mPwx*k8~z}C1eS|9nWqHha~S@#FCQL64078^+c(EA>Y!0f_*DTunNgBXE8Aqo92t{{WKWf9;R)(x6$|+H;H+ZX#vcvkZG$@XS0%lH>?6w-J5_=2d=T`1O=L7aB!Bh0 z%f(UBT0Z3CseR$*zbE2f!OT5DJYMKXNjo}qS1OQNkQA8{G`Rr#Q9rj9eHqg)&qP=I zj`0wn(wG+5V`=^2=A|EsZw8*1C&j*iaCcTcP08e|AchRnCPJyx^2Bf_(QPu)V?^RQ zwH@UMzIMQv2OUiR0JwRg_`iy81R?~F7yLd3twHK;R;UOT6f0yE0DO?WwjIX^ccS`n z-|&1yeTR7?8ed0?e72DP0C4j}lkrL59P9f2EO>C5>^c7cX}LzVKCLdG!GE zBprbS5!mrh^lwj$v_2${up(z-MmIOk}t2;?KhzYb?+e=!sN ztK`FLPys2Bl)w(a8~a^w@8sX44kC0$B!98VM@neWEsUgR_kx07#E*fm2n*u(hjICY zgB(3k$kU1NzT0j-cp>QCoen4Fj6oeNcan!oX!!n{N)PV^Nxu-j1gjDL_Pjh` z0RlnQytYST4T2T32-V+xw%~`Ox_H~>j6{8h4+K9s=-_RPrT2mHQAzlO@I{TMjb0r^ zxFim!83 z09WdMRj5A4~5A)jWUjQCJ`M$>G$1*kXFe z0!<>6&_ObwTNUryiTt0_WD)Z=C;r*vj)h-2Xz%mXzVK1YyP#yB|dS{&_7P3f7}$Q_=4~P9W5VGKCA7Q}>(t14H<7xfir~d%j6TotS4;8#WvcZ^+pycYr`!=JJd)?S0 zf&Ncv;(w~K5%yi=r_Opl02s<&czLcr-`9W>5F5q5fgYVB&FY?7p-Cc|{{TGB2XokW z;vEI)184c7zx}i1ujd^bH^)=^!_9s^Ja`tQtbQ}}1a{ry>i$$$u>h59#c~4tH*L6| zFzM6lXjjgkJG7V`$2I2KlnQV20t0RH_1kzOr2NB zyK#TXtulY%c$ohHrtdEme>&gv=+!Ukn9pHJ?SH>?6)G-8v>TXQ8RCFC#=}Ji6 zhq*f*C-QGjZP56SxbG!jI^cF=sYlu#Y8*}PU=;;l&ZdePxSoiL<(0YC3R38 z+RnmyFN8E`mekUf8xD1dgP0q6KXI!c;f{Yfg1(lo$~+d}+H5lFKWO`zG3#Y(taJFmH>K=d0viYAj=C75NpUkq|-zP67S&JE5={Aw84I}A5p+FmPQX|qfXc^hm`0= zK^v%4uq0G0O$NzBA#iDcE`M?_zYf(p@LeQZcEqfezFxnptqEc=p_yEQS;|J*6oz4J zG+q0jZL5H)d7uz8ArnNNr9V+ThcgkyFlccW*pI9YL77OfuBZ>SjwTtcET{%|Qly6o z7ejH|%z3+$C7~N?rYfb02DeH*?S2Ogc!DCpAxYjXk^bj8^@HnKI#;NpW*6!U%K3KEu0;^nX?-d zAKQzkW>PjM@=^AC<0am5(0MaNNDYd_UdkPUqEI$LP^RoyBn}0mSeB9Xyw#FL<6`NC zRLv=CC7Gq8sQI6vl_Lf#LA0>@pH<%${F({M-Kv^yV{XrST=5cooF0Sg47_>dgDE;6 zsAh_2W_V_UA|79yH7v1|ba2WDAc6%R_r|Rn8ti@vqypYuppAqQ5MoIfdhP}fCVQ;D zdSo<@lM)tS!&A^b83=0-tDI8 zd;b98#MKutEefRXLvcid%vE+Ik_8eeQ4E9~Evsg4pKcueQw||hK@&M5DGp))svTL~ z$r_k|3$YrgDEg3(iuk?~O*dS(jtVGtz*Tm@&1mKa%o<#qX&JW~06QJU05|Rj1}ako zbcI@`3@Q0nF3mB90qI1FqgzoTM+>p9sZ-pHLNlJUCTkFm5Od9WInQY%J%} zz#5JbDD{waA1IJToy!wrw+t02?K@CvxfjI1&R|W+MkxWOCapjq)}5^0-}vsTl_`U0 z%`vTU0CXv^u(M=Cq%gLKDAYwNBR-NZ>izcLfvHh|jH3OeTSJb;FFoa%hY}hMLF6my zYa}9s02?-0SAF|%G%C~AaLAQUYlsPN0|zu^M#Pc>08N_!U4jjhN;di9RY%ewm_XLP zM&&+U7JV~-#3M8+OEDDIN}curP#@fT@GPlJ*qxH2n&~%OWMOB5j00GO2{upkiU#V3 zn45oL#j>R{B6g_exWPpEhc3>I<3p;4mKS#4UX*BkVW zMl@)H5I#eP{un7(b~-TxWNX#_BZq=5m4%pAa@y}yr_k@ID@27rAdqyi@5Wkn7z0`i zaR{E*6DV#T9&0=*Y^h~XT)719yOuNnE;wuIQvuhNO>3>W9>V3Bt2!OPQ6VI=SFQl6 zZBN3F+#WMjsZ6wp8TgcJYk}!ixvwtHY(T^{M#Kv(M%(EJur}Z6!BVMDT#2y?-q%O9 zOUwCIdn^@y{4|V0v)Bszn_VPPa5fupDpse?5x0)z8pl}8;alc>yE%laT0lT#1eRfH z(Um*x^#Ouol=WdtC;~zbwMd^6}K8-kT(rzt&qGs@jGB02}djs#7}IA!AGc zt>NM36EahVOqr1_+hvwBSAG8gP!GQYQS9cKybi=oYp)y873KNNB-9R;fr^DLb}qzi zTM|JVeDJM$Vj?C{YPjZ>G4L}|X#r9{T9|5KP3J25uYE;p`|+vODVB@gJQ9OlBy_2d zF3oJ30G*^@3zPo<$_B3cuGjwnuM?K0DaRcOYCl?4oL*O)xqvFLAyL&sGKx^wTZ+3K zxChmyX~EuzHNnMEJi9ydxfU3r$jkLO00{LsVX-s_9@`EX%CnPTo5B#n97>{`uQl=z z6k-wr>~%eWjx3w2)Azm%)}{eALKx{6U8BLxDX0=XR!*^~9a@;(+OP^o^TnF9+UT38 z8t9q2Lg`LjnB3#VHY#mAN9t&#A*!VR01};Tffrhj_v5vt>M^vm2qwn?MEf;YKLpon z=>j%lU*5D_94y&G1q=cR$)_WB??maML8I_b94eJ5h>#aWt$CDV69+vbXmrc^vML{0 zX4#aU+KI9Ez7qGaxD$WLF|BYA5aY`;%Vn@hG^2t}rtHdTg#rj6tP+2o8Ou}pJMk!W z9CeH?r86SN##a*Qj!7f3#l8Lg zWML~7avK?}1|>ic$fP({Q)Nw!f&T!n2WSEi?VYRbcUb0T^Dd<7&SjmMk(ZVJKh0iD zth|Y`G9-c-v$5gVk&x{yo=gg%K_CU8u;b+T=Q-Hg`tB}qdAYvc2eQlAVVVXWk!XMb z?F%*Lu4c;R(laV6#OMe%S^Vcrhp zbYyuWv7`fP!{X?7;3$%65Hhm2i%AJ!!rF029*6SdWnxCH8(2sT)XB=-be@s-C|$voLi5ZRpn053HMQEC|}DFgyZasw3mUq+r@cy(t#Pn-CHyy3QlV|6c#7`Teq<^ti5t^= zZSUKS6$Y`nw0WRP-ZDZW@RzUg)olk#^Y1h;1z-NonleI?%R|g#-{*}w8QR)g0OuU) zv%P1>h{0k(7Swlg^ruint>Rx+0;K};PGCtE7!=5gK%fgGlaas4i%J%rfE{ zms4(ts#uV{mO*=un(lbg=`LvKDSHv*WI6cm_NpT?F(%ohVpKk=1O@ViU%&P!h+}{p z7-N91tF z$aAM;cq(i|cgkAvNa*Mf5C8xJ(S1Zf-stk2)lD0Q3QZdAUH9LOS};yON8kH)ejt^L zwjUG!08IB4^Xntil#Q?@BmnmGs!+N+C=I{2`tkG@UYWM#=2ebgfcZxjNXM9q`Gx^% zKv|fOH2^_tG)+(^im33-U~}?B*2%s}i8!KWcqquHJcMuC1ZC|K?0RXHLGQH0p;HNAN0ZUsSY6Djz25t6e29S9Wt+s z(io}PnW%06SzT3t7rv2yKlI`pR6I9icq`;&6ZMteo$1i{a*r$>0rda@Hjby#4&uP~ z-+;v8Vd4$d(xojnRx^5Ke>N9S`I4skRP2!#Hg>XGwfEp#i#nYO-9(oW8&!@;(-EFy z%S%K*_}Jy$MN(u2?nQkoUva?J#Su=d9fWowr$pdu{S*xWaACKFQTj^dWS4q_ZElQF0a&0S%q1mm2XWM_gIIXKQrh{ToiGq@hZ78b< z3Ke1w#ZUTQ9#)M|_3#_6FXI4&X8>Br$AELRFSZtK=`rP@bQbwtROUV-^G;)dTuu|M6l3EN@^et zHcH3X9f?ox!v-cGmtIhsCg`6f>2{MFB$$Cz^9Z519$Khdq6e?)|qbxf!T0M?)tO%44ahQs6S!s_D2{fOB@W<}Q==cb3{g2xu{yEdj! zNqIF&r?Dg`jDl~ycH&UP%jL$$yMl%EpjaiGewF|S5faW}a0-KB%CgsT8qJ@6H9Hj~ ziQa*7rHg`UyRuo|wecz94T(Dnr&1TP{Xb7B4W=MKjv}-N zZ8Aw;Pox_7zn&;!cbEXoKr_Ek(jZtOT*Ie)(Tg)Crjg@dNFiMYLIbr{;!7W5cJ0FH z;t1CO+u)e`Ua5{HSH$V1c$@_eB0gS#ht){ph|@s&0oZpu6R|Mpn-mSBE$Uq1^wDgo z{{Tr?t485X25;05GYY+dL)?Gi#C|83FSFvUw23F7cIQ1Vr6LOz1_;`MgIYmN&cK?X zefJ*R4Gdk}N|h+sTFCYXOamO37ytxSv8Q85b;#)=<@Tic3RkgWFqRjd~wv$n1WlO0Fq9P!ykPi?nuK^wk#20 ziL5{NIIDSlfml!aV0p7ziuDyO5)c5QK|%e#{AOk%?YvnVsT}7d~uLsj-UkX z@#{|HZq8nX+(Dd~92 zs+fQXtcpUBVnRq2L%5B8EPne{Y)iFFWUZ7sIm%qln2moh?GVrbMmuSBaKHgVx1-z* z`)|cF6iEopXY4q-__%YR=Bk|`0s^PX`45}S zGUI5%7&3`qRE?J?BJ4K02JW`L8CwynNsgJ3;Hi{}d!%HTlcqem6+EC6!xHu@YGxzb z)2KD?dvEc^Q;M6;)XqdmX%|WHblS-)C`x0MsQN%Hpn0`Hi94^w@wM2P1F0lYzTDNg zI&>V`5egDV+-!*~eqaRcxhe0x51s+|m}jkcMac8uWQ)bqKyw&$r2_#^q?W%rMkMSA zDigoK-)<6dMACKdDETOLvV^fT$%rSnF6A4^SF8jL09d zgQe*H^~a&pxQ$vKjXFj2W*q+j;<=hSp0!OXH)85{tq%jHOlvC`*+~ik?7*~y1p=5W zewjbV916IhtS`p(&}}n&CROR=^5C3Aqg;6afCYzEc~+DywF=+=04_5eNhGv8cOQ~} zA^>UC%pvL1x+Khnq0^@v4S*yzl~x2;3#DCq_xqj04k!^$`IG{Qm&Qg zfD~1OT8^IJl4PPmyW!2m%i?w*G_7>2pVNa}w4bJtF_yJjvZw`>j>W9(E9bWw>Ea?F z=6JG0sa)G7o8-dy`BIhustJC={Kim+PQ(Dads+MO(_{78(gwwq(j6w~ETBf21)E|d z1xO;97h9qJnjz}O)<13=B#{}QUu(L?2R!SnqE=u>Jm#w49hGu9mP`Xpm0Cqj$FBxLFVw;<>}f$(U1{M5k^P))B+fwAntCC_r=mN%ASQE zaMg3D6dqfOM(k23kORF&l7&K|sff}x{@g1MYK|ERM^n{kjF1S`mRt(;R!o|gTCqA( zH)S+Q7Gxv6@9piRkXuy7#Hb*&^rAA%=O9EzmXW|vRhht9B3TBa7!Wj#j>K?~(Wp-w zRGXROh+n#*M4Ol_U6wf0PULG~SQcVP)93(!*jfGfEGQzIj?`5l&dDufp%OtMAyp?p zN!WsplIb*dB)H$O-`sJf;?8L|gU4c607mKYOWrdHB=EPdm=8+yPf+QjM2R_MnHt;E zxF}Sgd$I4vjSB-xXz&fqc77;X@!!z#6aE?QUY_byE8sAW2)EQ$d`=gOXtcMQQp4V8mZxjnsGaK?$K4?+!*(uuo-Rd%A!6iAP# zfPBcEkw7*^>QMdc~@xbD3J*MyK-PLAp%QfZ&d9G@*a zYBi!oqu*ie#+?uW$KYEQ6_|hW1t%H(9}*_|hq-+InaRmgRBDb14Fl;e;xIQNjqX0x z{PFZA&ZKmO=1yg3T_?*`upv$NjhK)9; z$%Er$>I(8MPn6bt!h$dagaS$rQmDPCcfL88s?he3>qPtVTBy??JAAD(Ka+WDfhLV= z`r|t`b2u@@d9P;9n>bbgo+v6sJ~oDT>7)Wy_4|cG!AaI~)7)?7cIq ztEOJjmm^2`ZCpJB*}zk`_K%OgR{1w6M#l;x0cC}4lnO=>(}JWMQ0cW<*bY2+szmdy z4~p#;NQG0B^2n0`8Hjd6n-~ZNk)-#s)pfqzyZmrE?!L=$1Au( zMl`I%fC_=8S3auML)*1qzYP_gAOp1nn;?_91#VK2!v2yaofM&EAeJ*2%8_@eRM<7| z{h!LXxE+A_AS@cQwK4KeOs5~2!y@TLc@dvV*gC8?di^p;6i2u7mc3)GP1|glPMw|z zMEP$f10NCHRdwXMu%%F?VunQku8Z~B1Un3ZAN;IQ0_c!X))OH+deRC!@ z5|Y|;7PKKbJdl~PN0t<$$0-F#Ef5bH>_H^k?oC(m!<&c%Fq0xU?m%h5HWH;At~o&c zG3kH;Nc9u~NTn#u!*Qzj+vkDhbwIu4SY}(1Y_3Q=xR9*`c##g0Lk7x4Rn$}y`cc>) zBjnc#ZD$hV4dcNZsn|9bZd=Ks11y!=DVjzkFdAcMP?aZE_p$l*+ioRF=36G@D`Q9w z*_!Ev$bx3rKx|V3q$G;-2ely9pjnB(jw9>qGC16+wBg-q-#_F^7aBxOOQ%RXX|XJk z0(YuDSOd3zZU+rsHGwz$tgfv%AcRYna$hwOG$GYHzhDaJj4%XIvqRjUZ-c_CR~ICl zyi*v<3t4AFdR2aOO zPvv3}lGDuA!9XNL;eh~HrbgSp?l>n_Jn~LKP-K>YoTg{xD$?f~1tE?^jD-r!##mSt z-&F=3hqoDpQ>#pkr@=c?=5hf=&bc~{T(PRCXx|9f^?E?Cgc2!(IRoEsZTKoRNUJ5* zGO6_Wf(7l=tl@G{k{Gmu`cSb70+P|&t(9LeGbx~G5^I2cZfPX#J*8Nu1|rHXZ^>FN zTx9_mA#KP|+GAHlRzpOaH{ShKzqQh=4N%>vYBQTNbw4HKzI;&HfC9T}zQLm5DX!_vymX`9&ZvZk{>q9C#UqYZ5Z7ZB`j_K0FMo;U-WuLZ3DRj zDUMdA@hPFXGQ4dpX+}I(b|Q^3nQv<&us^W)<1Z{h4LQnbVA;7SL&;Sph4d|%P>?}4 zq!w*tS-Tb6f9AN@YZ3^QkijkMU2%D0uQQoKf{l?Hfj|W$Dg|O_Fw@)Tej}3sn=EdF&C3Ka&*nra%12>9F04_G?QAr(MEvc;nN*iHPDnKf1RToEJTK&e zZm99CSx=|NUb%}-)}=Y5#f_crjaPH~@##G!t*eIgUN-2gG5-L;a8#8KyNW<{U)Tq!CgwGXN<_R(&Mz*wO95 z3Z@tiVpSFZU1=6eoXe6{G@!<*7|LS3$*`;zm{o40N%`v;VO)7^^nxq@v$kn#~#;Eb8m2E02|FkB%2n>pq}Uc zymVW9)^Z5VeX{DcW$G@p2Ev|s%-pbVUZKvibOYG3S*`DG+i~(dSM<7|e%pffbU#wa zA5?fGj%JG-n1Fyp360zOnD=q03-a{$J72eI3UGDznNh;+jI5;Qr7}zy`iL+PVz2_1 zaE={^q=wW>4fgx{RViq5jz=_4hd`060$j*f5aYI>88Rb~3MRt`c^Fwcg$eL%eDS5Q z9PuAlyMmRHCnAxX3!?^f8FohCvIrV0ut(HE?Y)uOxKKR8*s+fkQ6|TFrOff3NhOqf zv{u$wk0%|2&=eFnEPmvH!znlb8?(&Yu~V+%Q0NszFC!6tVy!J$AdS!xMy)CUzme@+ zHPT)ivJj=;8UP*@b>N}@0P1H@grVD4Bhx?+fP@i!htF*q6Z+c&{{UT|i6bBV6A{wK zcL2RX)XJyC4yh|fx%NReNGc;oT}HMVnsZ!ow2kZ5oVAa7*@g9K-q!9}CVCjUhbM2+ zRwU}M3fN*mAb^L?swdxuQ!|Gf`0`ZiRXe2*PxzRXXn8_bEq6@J=vM5D0ay`Y&tt)! zYqsPN!6L%S^xfIWx>O*8MaPoC} zN@Ys|ilRSGSBO61#R~05Z{LPrl&3k66@5}ha*5=!go6+VK2#3cy(B8U5fXPdb~oE$ z!ke3%P01bQ5y`zsh7v|jGaI;~3IebUU3Dun5_Y*X5$|X0I9udvM$|w88!ImHZG7&E z>l9W4{{VCPrPV;(Dsp_lRhSTiSU35%pTczhmWtfJ0Kf(4B%A%MD*TM(>%{{ZX8 zY-8c;Dl@q$r8w0oZ;TVUJP4T$*CR1S6Xq(7hR`44UX6W4VL)?8|)NG|d z8iVI9s&A+*ngCY+06cr|OL%`WnOS>_qBMUt z05FOF0L&8=4oLxHRd5fuwo)%~?09QkX&FKdON-q!att7GGbNEn>O(m@GO%WgCCJ-j zWY=Io<1Kf?>4uYIK$Uyxb`MfY~Q729VN@!Ul2bL5=gou#r#Tmt4MB^Pw^~9W@!OUY@1S@ zJJIiacl5K`FrJMKr$k{r+>3Xvb_t}_(pIp>*Zw1uZ!^Xi>;i?=B`^v=I+(H4*XlZ! zK~yW_weiZNb%z@kw}`f_%C*ZmQjDnQA&TR}=xsm%K-R9hK_zt&M$gbceg>^xX=ozn zj;^H|zz<5W_;IA}8Jy~lO_%`BAn(47&zM)$djbyJ2yt^kfycoS5n{h{EPpowB$6gA zB+-_z0sSdLkXNxb2&(=#l-&;`8%KCn=JP;1`;j~>FV)PH#>Ge~S8x&qtvboF01BCENcp=TXqd=B8q0d^KF8j;x(|xPPEe`inJWJP zOkhN~7FW#PUr85XR*+SeI)p(@)#@FE@VrycDH4j42Cqm^^1fde_}4qhDg~}t6?TL3 z61Xj0fmQ_XXZGN#yz(>}4Xxa&n+GXSk$a*em$Z2KL<>g40?71@L03=GDC;d>zsCv{ z2D4{+JzrV@$t1oYj6|RfX_%#o{{UL7&?}9`#70;TdcT3j;AV4zJklUq2HzzNn5+IX zEQp}DnFO$*Gy{OnJ;`H3_uq>S`VbD|?m|G4wGfr;5eiilD%XI@opwffqxKMgIUs!5>r zP1XLG<;fI|7y?L@%~jIMRZvl*>T$RJTZSs3AVJ!$lLXjzq}!^L^Ksd0*B=QfQh-fJ2fc2;v*MbIiceXs02E*bpB3AkLUq6>n=ImBTW zWTSc~V`Llmpgrg}w_tCMX)d9Sp6Q81IN`lw1y1yM{Cgg^6-+xP9H5=*4tR0Ozy4#HCZ0FBYQcx~4VLV*4s z^SOuusQyPLCnOPMvZC3)Z;l_J%TAKOwEqB@Z+Q5nX%>@ #X}+`T8%4qL=7uX`f7 zzc5k(Vs$o5ev$^of`RedemUAmMOvW#(OR&CmNZ}0f#%)sq@}!pj`0K@0(o0!iG1r_3jE06yOw9Y+EfNW6HV z0Jt~tZ)x@%mu{ZqIZ{iX({U_J%-jRvW z{ZSdxPpHMoGb2&}003lSKHz)t)X~HYUIX{5)BIs(#a@OYe_`Frz{)`8F#@`LsLCx5 z>5#^;o4T-7uiTNxzZ1zD=6jc#IoPj4_1^~apj6Us16 za}-&)Ib=xCLo$_f|ObCerk1GA>B`w-fR6mNa|?ZU^H)Qqj%x)^cIb?piN0GMgV zz*zuhV%emKz$Nduue^t5U@cQIr)t1mEmwOBq(YK#f(cYTk4jxl1))TR!= zJLNuz=Dcl{N+{L&j8i$bJfWl@{LdU^Z+knq9nS`2QX(>casVOsKUFgFh@%|F4eM4` zHj-^dqbvnlf%a$i-+nSxbg{#r_@_0ZT1nbG7nXkyxT0Q!$O|0HA?psOWOOX0z~&ST zLew{w$Tb1ph&5pG?>#quucQ@j3wa7Z!fNx{0j1h5jgPNWXZnuI$EkV?5>+Z7l7op5 zu??UxMyDfnapnM60(~V%VsDQc;AdEFUAch}t6)ZvW@d)e7)6R=9;SaSWQr-Z5o{e~ zh}{oyx3DUXmNq(g?NkI4Il@@VmN;^9!iLV38$uG5@F@3QmhP&$58|W z0~Z9bHl(W`fIj!eOi|~sk|W}oObBr3O<2)J(Zd2!0}CyF+TL`1Awb^Ef$wMS#%B{H z+jWO>b4N4{ZHkvXCHZtyj_7x0EJBsXlxrkl;E+oNu z0Xo7>9_GMCnqsbN>A%{(+l~to*mwh@!Ae&K@F6F2NKQvF%S9TPsg-PowP_iOo$GS{ z0KVVfWe4igWaTL?0Jw;{=L;2#ps573F97tFI+8IV4Rxfd!(jc-wVowM!+o>c-lzsLrHaNkqF2djoyQDg$5j%0MgD?313g9JaVsR zQ3Mx}PTkGbaO&ijG##EN;DwiKj>Rr2>xCy}A+^c@77Bz&L_ia$m1cI@`)%{ZJoCs0 zXT?A^j+JYj#E%9eF;Kx|cP*$fwnrobUYS@Q{{RO31|7sXN~S}Dk|Us0E~V1PdvhFMDDARYAm69>;Mxde&DA?IbvATrxXQ+gAy--km^`ei zTTQ4T02D>`_u{F^cUa@SLed1yk?vkp#g^=hS)hy>TT$ji8#4a@%2bknWBrb5pHlfA z;+oN!+X}Z*KvS2&q?HXEdX;vyl4rUg0!WCEeZPJ9EGwp|oae%O)l>uq-a?m<>5f+f z4<(`uO#q=tDwl1hoWuz`hW>Agug(C?=Z^JMa(TgEKCxW~K`aZU7%q zC4&-s6Ys+$@;f*xM>;)=LcoDjm_-?;D-=YiAO$IjrHHCBC};lwQO7!=nq=?uS{fpt zoW2Pt#dFHR9d%^O>j%3)nk1q~1p2HGel}|W)`Pfqq-v65YG~xq2oarBGaRWR@7*S6 zuv^u;7ZvU9IL}$y#0`);6KRJ6O!1mU$c{N7$V^JQbWZE;E{ZT0H(@9<9>n&J&J zI{@ri-IJhiSx<#-snlLPNCu#uICb+As1_=DoaC`WdjK!w*B+T@AmSIa04ue?+dU-_UzB_xxnjgSv* z#@+aH3}0jp^bUdm+Oz(0QL$i@DUdvDSxSKZW8_4E%PAzWM+S{{_wUB~GAa=eC&FPN z;=`#X^#N&TceGez##C^>K@dk7F6VM@Zq_%u+W6atunjqvcdYep;~6hJ^+K1IE&ibj zl_(eKEfPjS{+qH%uaon~qQaOBY;h%XYKhk)AQlhK~C2EFI#hoV1F&2oO4ENB#`NsnHGWt5XE5w-*bKYe6tlIzA!jgRCnTD zvXp92)%}s&mAUj~xr}c1Lp)ws6n#)bkX`o#h1Tb``+nRefgGEnCOaf}rqmMtnd7~5 z%yg6TCvZPF^T|N5HXTUWO#q;GpenxnTO@LzY!Te4(ak#$Y{ifB89IU+k_J!+QWi+3 z15moE0Fm7P0B#=1)n`YTKt;@}vq~hI0QyBW2Oedys}&C4zuSe=Gg6@+vW>uM4bx;b1aixwM%(jNs!0S1 zfSGKAs@gd8n%s8p!(fJM0khzH((FtFwJP}IAYTi*$bt|50Hf}rMk0X#;K`s8Z@Uw} zzwO4o1_{!*DHr)eJHl3xGlZ@O_(#Qh3!TgdUUjlR{{SzjWN9r;vTJDw6vUP?Lu75- zUl_EQ`gfVRC1}APqZ7Ds*s{)ZA{ley28v9z86uh|cw;0ntwUIA2eAFPx)KF4h2FET zx5--N$I722cDESzC5-1a63Q7W~?iW6* z$PTYF%9T}i0JpA5b%CgxGYakZJOHz9HgVXjo_Dk>%b?^{{+vQaDn_7us984z9ae*d zonXi!{d>`vv70QvuC+Hnc#$%O)h9^xV-OAPA12N!qqg2-H*bOQ$5R9SVWUCWTA$(z zCM2JeVx#sCa{2Vk{{Z4x^hgCDWCY%%Le3S(!vaCSo<4*xN%OzH0`nx0@BvGh&R@r}jd94^Z{0@Egc7ZbW>u7A?r28F6;4!6#4paUJTJ{iEJhSQGYRxiMg| zk1v-n-m>x7fp<&!7QLw0tMA{0)Q2{&**+i(-F zHTlq&=1j=Sv{}%PRi)7zuO7qG#=Lq(S;Bu&L-^Uf>hjs+lW;W^l08TW zvIq|wSlhSUajuhrqy?r5Q~hGA2UGm<1141k-tL?mt-BAA!!bY?1G0P&(UGhT?I=!m zC_KwHGQ|E?2+>`G7INoECa5xkdk}UWZY3TFwR15;uV+}v-?02JU`H*)S zj_5{`J;tL#?|6%3(zBn-YySWd$>SB3 zQIwf1X_Ax^q^ihE8^1y@*pB}I9C6BhG(!<8c38VweO_wy`COyz$GLZS93x(G&rjC z@-{ji=T@d?)O&?0)<3`P!s*%N#~~=pLtD1UzAUU^$c{E7IEoNeYQc@3nAp|&OSKRB zo)qTunq8J?#6`N19&ZeDa+p?)4184FHLJ8|RRV0#ef{l63!>uMq|Ve;ALG%EV$ZUHM%s{L7JW9_ko#39;RGJU8LhS(Z^0OMqN%9&1KszCrIgr@Z zW+DOa^;Z$sYewP6YLTkv5s^H0O1;b^OlWf>j`c|aEJ)I$Oo{^)qq8yhJ8!^KY`LV3 zsg)f7w`?r?0nCB4J(S2Y0aj>8lMkp+KlpLJpuND$;IawXn*Es>UUQEi-(1nDQDV=X z<&dg9f)U?tErfCoX|Rt4XVz_~%u%A#BRj z+thKJrP*OYku+*)8=2A?2E4$^O%g>gud(ApUCn9z#F8PzZ4O2-n?oP05h0sM*!ogq zrAXDeU;!8W@TcG0nB2kXNwW};<$^rGUS$hKbzF}cq0>O>(xU!-zIHScTL*H^b9I(S z;c_SYQ{%L30gb$O@eVS~rH7WB&VOJ4)O8Jp)PDSWpGk@NH=>7c%=llxxf&!zT`)F$ zy0HHM$!wC!Rk?JbYz&DabO6(aRGA!rY=txlusHIKYzl*HF3ibgwx-D#K5Zc@uN{@a z1T7dqq}&@%I9JVgGzS?)nQ^zpJdvyiM}i;B{Ma0zQ?5*O32F!HWXhpXH48peW9>)n z!O@75kUfL*K~MlkNLi0HVdrBekQI_OBiMmFGdm@Np@2cNS8v;nr7>s0;ucrfjo*?1 z&y>W{ri=42?T8wZ+IZt7S5ktdSMEFRJMp52IwvXcN~$7cS{IzUky(yo{Y>ita3}>} z9JZSwNC4k|Zap3v0A!8pl~(1^wP5_@pqg}D^u=tgx`hM)H?T<6+;*+~xbIOMz*jx~ zvild*;RjmtVs>%VJn>|qq<}e=W{@md2E}(j9DJ`ACcZM?+B>~^+8?XKotmS$1?LG_ zWsn9C_O0i7F7t5LV4h zqg4U5e*=e80mZT0INraNmWy+1HQWRtd3_)j6$ z{*ihVF3JE9$0JxaK`c+bl0fgkRBLQF&09%!wJQcyU*e8fxA=(RM%-ut|FlR_nK8x#5)@ZsVMUECNIw>Z&feQvU$? z?uCk#W2j2R`yD&80kAvpM$IBF0;sq<{{S^MQwSqNt8jDJfkcoc(LkQ+3l1rxSmnEp z#U0Hvx_jYf-FR9b4EpeE-TF(ZqOd!c<(bCs;J0tF`|r}g^R%7-pYf@m{DRGh{)>r^ z*geI3`;dd3ifNkv08XflAptT0e%BxR*B?Ow7~s6#(7h$l0T&!@6fE*f8MP|WnCyns zZj`t_p~suj9<;|tYU<&Iy{l&E2_!Sk5}PtS;0ho{0%V8NUr`=V7B{2E8%Q(|4nhZq zo@;Itl1K|h<}z!=jGr-e%F!Q43>dKuU^Ro={{X%C=F=LlJJzQW2d#9`BJ&B*GOGSf zVh8$FnQ?*IyAY~>(~H&yn@nF>KqQgSo%%(T;Jjc0HAy2eY6eH7B||RYl-V#VWZNj;CnyP=S5d z$%V$$cJ$Z(0CmD$A+PE_DTF};@8h|7W55YnItwg2ut@s5shMO$rLpTh3pE8Qz!PTu zjdtztJvV4RkW?G!QTF{4SDnxW!$q=APpKUo^1Ug`vIjH8ml|>wc+{1VNnmv@&$wb3 z5;b?R-+R9mQM{Xj+Bv0n*zI;=LiUp;R>wixh1lg`lNyxEs5G(c~(hu?g1g>Vehf7)(MDgGA$?EL?JilZI6lp zgo`vtB_!#Qs?CVkU_}B22Se^`Z^nv*hZg~}gW8q=Bn6~k5NF2<5i1rJ6=Ojy^&R87nua?QgobZ(PUnd z%@B-gCX1FcI0L_P^V@#hOj$D6-|$yJNO2jVSdxdl4Oh&B@8~|gRCP5+I4o!z zlSh5-y9?p99Rb5{<~aB&Xy*h|43UW-7fnJ!rwUsuf55H?9|q=Vi0tu8WIIZ&?o|l~cr@#MosTfA*d6Xoe+JHlAaJ^>@7r zNujl!`1E>CU4iseiyxWrf58ivgq~kZ{{Z>b{{R_IFhI*9%^?d6ipSK8l+nj{{JWHYoaH0+BAFL`FD@7C%T?nSk{W zYzV;vf0MU)iFB6%>tD2dRZWI0t;6VJCY!US3K!bAV@0!sE->O0 zoXCNTBeMeO6e!1SBTh!PZu+VH`|fzEc5`=1x3^W2PRQ>_{I5#1$r#jyjk?;M(3>FG z1b}PU4Y=P}nUvRz z=MR|7z-kgMLWZ{RYsKskzGlf6HIOf4%f@{mTTzWr zk_WkF{{Z&5Wf?T5GX(?SJ_hiKLd2Gu$kJm0NIswvK_!9(dX!hc3vd7ch#SevfRnP5 zPF(4z_eDGIt|pD#uKxg81!()-@v(>K!QY+V^Fo5IGfsqy1rSN;3=hBUZ8OLJL? zBp+d4-)=oeq@r-%igf6FFW_9A5@x2DwfRHnw#fcIjcB8&d!ed3WBR1JdwzXK9D@f7@q$CJB~57b#+c(6ys+D znjg;)4S567B#=`8Z%RbcFMmt57B}3VVZ&$}YK-9pOW$EW3oy%uNjZcFRgx$pkF}B+ z^(wVd4q5b(UBy=&Mz}SOImua_>y5|daSE=w0qshFbnF|=KOX-8ZXJda z(K*TryLy+NIsK{2MhkM}p+*E*4e3zAiyIH~wN-oZ=_p@N&P$b61C6gM&%E>zK478# zOp9SjI`qpf#8B+N>NxMw^&7c!D&JT}#r6lNfPSjyW8F*0J`I47&_!`@F_2l8VaqRjIu0XfIlvPYa_XdRNAQr zP-xrZf~G`ex5wfY5d?&K0+LT2kP0?B6;gd6UPV&cK?2JcKP3E~`J4!Ex4|286O- zPl~reB!%ArfO~JHXJr7;QV;|nYzWX3?Z0j+s3Z;gqpy06i3Fx{hg?xBDFjX!3)82| zAyf+n!C|)D_{t5OdXtZ0j|7iD6j54-GB;2_B+CF}=_Fb73j2-;;u?0`5U5O!qsNLJ zh-yqtAdPa&u1%0i&WS{w#Q?(hyFa%E_=nBKyOjwVf^T)lJhmG(bMym z2Y)Wl#1?E+3^j5;VD}aC@@agYX8}-3k+^MwnVMZrNg$}9@wXpAYi5BbjF*}|xL%F$ z`7ap_?6LW5KmP!xm3_4k4v;>?e2zTkkhAq+buiPa2;8=AiPqWb3YTSRP%u{XTQOoN zgRzwF+=1_WaWUVkBYNmz(W1=is)D(-YhY$&9Va$Q>LT*fCoH|{KB+!yA3$lX5 z1x-LIn;TJ+eZPJ&;)b)D{o!b$Y+6eF9sX&Etw3c4vUX3%!5}r*mhJtxgmWN`-Q^UJ zdc1-)j+&&zQQfj|gKyZjJR!F)3Fk#F+1!KfuWXY_O#)(qG{{XjcIrR){ zw`7&2qIFD(kIhBP$c?#>6{tQ-=~g93R*_UMa-b}t=&3MthQ`enA}9m`C)PB#l2k$y3d7EH8Q*M%UhlamS$27r}ZkCjS64 z;Qs)E)y~4&wwEO5j<5Vew78^6VT&F@#)PVbl~USV%A$?!cUSBWu-}B~1 zaz5H#>7yGlCN7{VDPRA~Y;)@7W!hReQC$jP3<& zcdj&mOIv%w4W?1R!zLhNDyt4cNu-cTE=Hwo{g1zGjc|`p-!c)}3F+glHDII3m5LRV zB)J(Z>{#k(&<0Xe(E*B4?ni%OILPt?Ot*4#K`v+qZ^bn86%U0hOiGC{l8M_-sHhZ0 z8fOIkj@)Ktp3(%tO?Z}(Dz71E&n&}xE~g#ly@??PLepo9Vd$=fL!LZZC#|StUhD^06Y?v zU}~5&u@x2n05Q~CwGJSbI-cn6RRPU&fxby^mmo}>h?D>pWh~Ujhm|UVI|6+GSIOf| zLo8w5Jc?UI31y2OUc%U-(LL06ukFFoJiy(ORH`}d zBRebj3iCJB>6RC9d-~vAWQrC`IbcWrTm?V?%Ha2_W$ZE`E_0|FDde6ZshTLI(nZ^7 z)WMtE)eWz1)yA3zLs;&fJ5uW0mjJO33gdR_UmhezAg_)+dVqHT%grbCHI>(;!t8hN zTzckA-_qckN*HVui{%rIR@pM1S3Xh4%ffic@V%rjl0%i1jtGKMx|w6sJkErhL<8qSIgCA>8tEWKL?F?X9I98 z@JXxFemppZ=dPs*=6Pz!8_$uoory8P!aa(Uu%ms*J8j3I!jq~AH;(not?PSu?_PN4 zPkGs-u?NeMyKWtzA&J#=ZB707^fWC^khyOh?l&*5y-LJ&UsA~+Z4h-|F=eg6L(S(_ zx*KZIzhXh-<~ZT{Rv>S4m#v~cik##C?owtD$2VeBrZG|o6sU_p(V`U`?YRfJ`R2Fk z7}~XyE^*^>Pv**8lq9=DAk;-&I>ueVKhg^tCvG;;AXx24easbKA-w6qj2&|2n567< z+zNqj>Y~y$58r}kHJ9Bzr3o@c(M%w!_apkTkpbSDY>*L1qgyrI(fe?UnH^D__akgf zlaTR8^A`DW2F#99dvZxcSd2jkzflB@`)}|#LqAzNGWV3j`miMn%$eNB5hLit1hpGb z@BpLOs09AR@7(a<(FNNt8-p6y_==@00*i+^T&mj3|M$a1=$tgllT`Tl%|QQgdwFp-HCPobL4 zZcoP;^p7(eRBv+8hUa10c1P#fveMCVIzy=?1lZJx$}-rE&70C_p2v=! zjc__kM{|F-VE+KfELgc1Tt?1e?q5GMBy-Fm3I(tcQM)b~joIFqlBeu=`V}$sKGo*Q zhmNJ`K81fO41@&KQR}_7(-8-5>^E-R_S|vivBF3^U3GBA0q9$oMo1DywL-IG)syO7 z??4OzA>Dr43hsE}<3)z>7eK7D7HWZ?A!gm_s2P>oJi^J z_$?rS(nZ3kfJ+u*T@dp$X-C&>1W!r;*}|{_!3VbnWEx{&k3SR{&C&i!!CNW)Bo>ho zR00J}6B#au+(&1(d*d~Hne06P>_8L0iL~vmV~JN}D<3hTvVLN8TQm;7SXn^W*wCNp zweTQ)5xw9~y%B)&CvSpd!cAE?WFJrG@Z+zi=s3{db3}(5eYno+2kzA=z)Rz4Bg4&j z_rRb308;sj(y)uHx|7mcmqX;^sRV35kQW!ZusHe`rl5TM@G>+g<^KRpr?SO)jRE~y z-};q58C#zrO<6f1tPd#2fPq8&%$UeJYjA?S$m7UjO_~7P@Li^DPMPuu`HmJzHRj{v zP3)i;^0A0eNFWe}ulsiIje=>tfY=`bv{XFc;&ubu+cA4GObrTko;sMK?Ou$dShdEyCq!9F39r ze=Sf|RN=3r*}pAS8uw%A4m*3_7%KzHR6o7uw9_L|k(41=?9gRrsipl~h`|aOwGdfs z_dB0*dsn{=Fk4LT2myyWECl=&d7D%dsZhRCq@u_=kx10xY?m5=Bj$zn*oBKs?1VB) zNj-k`+mu(CD>m9~n5o@#cVX((0oB}WLEp9URb<$dbo2Hl9MwhY3E0`(N@|Ulgc~4G zvRm#!<7GSHfE``FOFNI!5}YwiNdrRcM1n{qU6htniq~a9psi!vQvTdyaB(s+zj|;Y z2qNewGagYAT{1XS;r!PzgT`Cb2RE%KN3DHmv7X2Cz;`HDy+Jl ziLw0g+|pzU9*#5r0P-+@!D`8d5bS%R=NDdo?zng-cnM68Jc7nWwbFD3aiptT3If;< zif%bCy8xR7s94C&5hOel$bO+ADhiOX3p#-8R0=|NJMgH72K0N;W(nGaNJPu!xCdw+do&Id+1et~BoCfvdmA+>`>a3ChE1Zg9NKp4uPvV|aM^uZ8TrEgi9Vgate zUm0p0R~^yjd=`d@h&Q^Y5JSl%68cO-Jj1pOds$`SSlsmI*vXIxO(!rD{9^c2Y=+(Ph2G&`b1dw;74xmO8$mE6*G9rCC zTWJEY_V*Uuj{g7`#<~X0gK`q8Oqnas9Z^x_w(CYxpmz#a%0>-++-^+{Jr)piM^fe0 z^_QLb^}&^t8`Q=rt+i#=FU}+p;U@s>};?o#YLMU{FT4$TxzC9tvMFUx8uP` zaDr77k$l;lcP$}S2S_3)(@vVbKqC84_up<9L4Z2D)g!R9YWYJ*4<{-W+{%`xP>;C{Zb#9X9 zA;l|No>7qqLMVbHE>G+aZMf-ZNIF+XfuAbh#Va+;Ra+w}S7B#zW@V0! z&0$CKR1PBv)dqG#ju$9oZpyHt>LuGj6{due#!9UERwjvQM$#?c;Xj_vD0%MN1? zAPy$Nl2aWw5S+nAdXm*<>L|P)TFs1w_M5l@*|PFGEF)?qPwESJP*6Zm1)aydGiqxzv6 z=UL>u!%H!T9$t`RP zFi=QguseSIeGI^&;jwv>cY!O?y&t9~opm2p5|z8PcgMB%(islBL6FigW4T*5 zcizWy!zu~YJI{o9ahNyjbtWE19+RBxY?Y2rSrk87F|ZpjWI?yRah|y{&DkTS1Uq~y zoYFQiB=Wefu#FWqY+gN1HY9lH}_==_TP^k zT0o>XpNj3bZ&G3Ar(RA9pZQ@`7B*A)Y6KE4?4ABUzG_F9;n(BjoZ~NK?2ivMbVN+^ z5NIlb!htHuGpHb%`dR+~_249Gx394j1FZ(ZFJ`JCic&3G5gLF6fiVQqY>l<4?cay6 zlg$Rwl<3cFa8oZLbzVz{lB4vo*@-bV8tH>lnwD9e75k`kzF`_UFR z7I<(10lm`Aq$`}TA`GjuL4j+l4-4u;A!9@Yt-a{>t_Gy@V|pQA@z9a;H9tDm12>$? zR9OVC<&KS&MJlVBJD%r_wBS&Q$awq`4cvDpSkN|`Dhz6|F=h23Rd=!|k_>Wx1x}pf&gkq$Bm4Q;p zIRfkepvep~s34jFm}&lNhPa()TW3#5mAVra4vq~ve zU?|(3M6_*>&$%5kM8@>hh!SDm>Tv5AU}7mGCUTRx-1>s zn#kt>E<(=H%N15qs>Ol=eQ02E%KhzBqZPgV$>X9xXfByPd`ileIv|O;_u?uBLaiU- zJH;{;LlQsZxqEtVNCgQseTW|Xbo9v~zKy&a9T9{63sNv{FB(OpdbrBt{{Ul;iaCxo zy)dH{$_k4D6u8(RCbXCJeAxH*!0e=CQ~S{vq-f%tT_BMWwO9uG17}j+puY88xJiOR z&dTJ$K^stQEq0S40#B>UV8kxqwuLFZ`&ZkIAX-N0LU;6|lX@qNp&$Y9PV%p;05@+a59fht zmTHrK$q~D!Z|0=QfB3#q{{TrZE-?nQjYwlw_Pst|{{XecG;=EsiS3^hPB*4cRB_O* zPN4GX&@MNiK z^$%LxU2nrHG{a0}d=OJG=-Od2^#Vq4nnSxssCq~~od;0(ztBJ1jM#bQ2OMUdSJlc_ zn*1%X)PINsW@COnc#IC8XB^T-9geM12+D)CaqWF4Ge^+^Kjhd?!REL+Aak_P{{ZLK z?+aAOk$mtN0TX^pPUKagQ(J&EyNjwOja}{LS~;MBd#)0LCID2x99hi_4=c^!_G za>Gng#-I{t>t#3JYORMDYQ6)3-^aaaV@_(6Fr+x#>mA0S8|6iND;0Mep#%cWuKR6U zc04edbr%fml>`Taupbqh^5_a?X=c)=FIJ{vb?uf2ZI{(?r@%L3j+IwUGXrOr#UY-s z9X@GisnPYBDME>&EJzwu`3M@=1yV_p?uOO&9BIQ^)3Epa5~>S>3(eh1$}+O!N;;&K zkTp?bX<*i>ER|JN+N+OAhV>Xu?mO2eudNYf=Wcl;NtKp$3t!Ez$TnuvRww`u`g?Kc zsEA`ahl1u*I>fKAeN`C$0BrioFaeHEf6k^*H#XVXK|u!SRCl)3e{Mcsj5CR-X5sD~ ztJhGyHi`P9xl#lSd_mf~t^1dKP=*jxMhXI{rmF4u|K0Mo`aFNG-^7um z8yGA>{{T$)E%T`&F?AQ9jEvl=50)%Sr`5S>6%j`Fta`5O@PAgDGdDrBlrt7Ke7K_0N_mi!bREP*0M;m$ zbwGCa7sFoQ7)d({pb0S+S`@}*z{Lu4K<2_@tVsw2}bD zjQ~mjEZ&eE$Omz-;9A#mK#7166ZD?da}0Ty*>Q_-XsrXMcVni-P}Bgc@85uUhp?R0 zwo6D^Z(c@!-N%TLG4#RGoksDl)IaRJwG3C(K`NyDe||ccAL}g|=+3hz?*)?-2gz|; z!w+#^KcR@eQt1}!985J`uBb+f*c0nwe~;Ubpg6-zOSkv0I5)!dH&4n$j3ZO1h+rF? z{RK3VHUmhz0;rAteD)=_6VkeLh=|(@&>bfniJBHx8hq^mjcImWAQ;Fcl$KBhADjF6 z{8d8fERBcr)p!^cNn zVrY=j&5#GOs*+?HYv}~cMh@@9{)B4`Jc0PJ14W=TcKX*7{GI3Y@a6cVx^Z*|b5 zFM1&HDzFmR85J5x){&p)k8@(OM~@)Ytuk>KI{E?fOb+7ymB%6S?o@& zQsTk}_En@K-?$}+KffM75$jXFK(5;iYjh?&*!AZ`hw4f3V;{P^soS-;mIrTcGO)u5 z8A0w(c;{PqMZ{<)&D{S0l&xcJ{{T8sf%miI*!!LpB(;Q%y~EG^Mt1rNfoY}qT1-q*U zg<_;v4&x-sLt2?^q7CLppN$|4f8qexie-{Aq#FdC=#Bf=+LQp)a5+M=YJwFWcaHJR z48pZD>1q^ii&-LtDHmTN_TiLV3rIs$J6sWwT^e66A38-_^40)7Lbc6c-+Kiddy)si zt}Fmt!LmxJ)oX%O%2tz}K_-@|7Aegs^c9cGG)Wzt0b^?vZ;ed;j^Q^3JW`!!i8qwh zE9iqOOPl=3(t8Bfq8&#~y(D{^{?-Q>K$kXhkBVu?!P*esp$u@Oc>rL^6Af01K-7v; zeJ4`c8c*%+IBpolMt~Jm5)7bN?9pMfAa)YzkSzjJ$bmwJv8V)S#n=9$L!r-z;F6Va zIu-s+q{k@=bh5U+*!pCK7wuqzpiuVVb>wP;myt(Iri@p0larTR5ytkDsMyTgzB`s@ zW>WtEhrs^;wjYQ`m(k{aBfM3j0-Z|P*lG0xYDAjWtK1)sIy!IqKcj6KjS++X3s!sx zEq0M4XN;~#S1RG&3Tw*8{HA*%)`t^mS^xx;2S+E;tLY(>fpj+a5uo=40L^#5) zl0stXq6D5qwkyyTqgDV{q%eK^Z~N{|9N=cbLtqfMQt~{}uj#9zp5ltG%D|N+f+;uO z_S=SsLqiFZ=bEgf)zlZO`iR|w&Ofq?Izn5>>KWha`Z9e zdF8YO3$~^#Rpp3A#E?rL(D~ng*s7tH>g}HoiZ%ib)sA#S$zfDSCP`80A5*Di)Cpl) zTVuBSQL(_$1Pjiv2&x@oBO+6WFCt8A6#$}{XLg}#%vVtXn__=n$L(BYsb@UxvU_eD z#~Gy_Se4E>jLbs;mynmJ5=2wD0N%PGkN*ID_|;Y4LrJ4>?n$Q7UhCvjHe?Eu;pH)< zZ3tK!wrGnfDt>JGy^mqWW;>epjKXV#I6Goc%{nqc8(y|hK%f>yR=(RThv3luc-G6X zo-$e8XEf|r`I>ogtk+7>G1!|9r3oW(veSPDh0`)X+)+3X2{|sgYj}LKDli*HN-$dA zTPSl|lSDoL0N0CQht+BQl^yD^jp&rB%Z-_&TDhJjG({|CIYHd_0WS9M!kR|AFOn!B zuW%X2OQrt+EuW6S`dH5!Afj2B5ysX{YjMVq-D+;N#2<8}*5h&i=yACLYaC6LU;pPA*xgrFhWm7Dk9 zZTRL{{Yl$h8a4BZI^moq=VA3xFst%c`TvGoj^ZP zGC3C17=+dU@3#K{ZaU6yG>(r2kZ(KBdI8k~N@YA{e6pz`Fd<1Unw7$U6lsrZvETUN z*lU)DOwXECUHuEqT}p-XgO8}R>tf2Nk1V2TCvesPHSza6dTcGJxN&f~RYy8ydGDMh zOEb{{#L_TUur2(uO%(%H_g(n(G>o;Nu4BX%_9v;;7p{7NhRY{VbCe)%E*#Ef8zWG< z0{i#l<(RYdxS_XP_pejy&yX&*GnG zARDE=W~uq9w*<*Fs=$i^Ps`6ueaIS@e*XaL#;P-_&~pHHgqM29tw|XbgsMvju%=YC z8dyp~N4@Ptk7HUv;9Na>Sh-jk9)sez$7giOQdoYpk%EMsPZm6WQ1s~_fM}h!8+PJ5 zm|Jb0B~UUwsJzI}hs#=m0J2CBjf*iq@(@ z3GMHj96wL3d+U_kJEIKQ88u|Nk|T2MF{>+nYBmkBt&q9|nt%YYC%@0waBKusmuzYi zI=yQ4X65A5R3}9OsRn1sj-7ld=B*4aY8}oAR1if={Ta zE`29(WylnEvNk*MhykwPG6#<|_YhjrPS1)}^4Vp@jRH67GFxsgWR6WLMGFkHLGRdc zq&h?0Fk*Z-DKKOLEUM>^FEVMEFl)wiRlOv;Hu2hqG-~~i?OZaLC9NAT$9j((;*N4y z*`RfD6`38utJpir;jW4LKnJy-elyo2TG=L39MTqJ;si!6gYhAExjHYZN(yby_-y0t&V+i|&K#hAllzQenhfnW+VMH(7lZ>GyA3IHUH&5_(2 zuH1X)1E@gh@?LpwT`(2Aw<d9!Mfl${?P4|BR6l=TH zwmgS&7h$EA&+YxQGDSxLz7t+Xpl}zC^HJlT1Bur`0p3P=X2n$Y#qLM&f8Oio~iIg@$`W7gi%?U^W0b~4lJX47cNuDN4YwI{{W`|VWOBO z@_Uibtpkal6qU^90~zbH9L#V@9@#S#HL$I~8y&y58!5M(2HPIRoyN_!&mV#-(h?&< zl#C9EWYM5lCH#bQ>I_EA&Nlx5UKNZG_MVCDOrf=>B8^HU(~mN%28hM$U@W-(OHe+b zI}g9!_(&iZ4dF5K4KcM@=0RnNWeP&Od5WZ;Npt|;V!(m{A7j8%kYduK?$CB1&S88G zX&9i=!w^@~>Q?d*&dfW8L;bz(xNrnir0K}<*$HHgT7a8d%?B|j=P~lMu=4P+!hz`~ zlh19nX#-eeUHEu$)O&w;`6YoTS~emX@1j?tEiyXEnQp>ef{`NFdRWU z5xkyo0`jEl2n?7wK$fEIQs?N%RM)>fwL}?6%QE;_QdJ-UaJNE84L#-xn zB`^Ts2SI}#YZVz+z*u$zCP528r5?q#g04`58{6ge_ zM7Y0+9}}gGLV&s?=6DXrb`@S>AIBX%Hg$iKt;`(}g#HUsu!O#zIFah&>&N}qpBT$x zZqL-R1HVd(Pf|mRBS*Xf^Y4|DxJgN?e9*0W2p&q=VZ+pAcB#Sq>v~G zOozBC>Z+sI5>IL)hl@3?+bBEN?F@0`m17s@>x_J|x0EFo8|$03Q2-v?42@t8?~ET} zmX4H4Q49+Nj=G~(gzu$kG$ap4=`Bh@KKhT^mfdHU0hyl^L;xDE@~0U|kor+pvEpsQ zs}DKJAOaCi!u`o7b7I1`FoB+Du^TQ4-SJj4XN}q>Qaqs{WlJsyTMFS>Y!RiXlfSnB z#=thbD{+DhUVaJ70i#Hn(S zhUe@nw;AakbIfch)dhv`K4~wUCYQ%_0Fb!~*Rk}X5D6AVvHt*1?XrYJftL9#}*VO!V) zvYsrDrF0F7HZ=g-D)K$UFk`4Y#L71WEZF56_d9p?`Qc<;v7Oc2H!)-2QqFL^t%0SM zDyr_n25Yc;#}~J`<5N9D8IXAGNhTfbS|&32ytX?dS`EPN(ZwVJ$f~~kUGdI$HmS9~ z3s~ncagknJ@Z>S-55#Oj%by;+Ml3cu3Ui6VR>X$X&A2|pk9X-UsQMUoe9eXY3(shf zIbAw7{JOW|S|kDd$k|ZqL5|Ed0;~*hqY#=%B`BH|_T$btfC$)Sbrzw>q)9n>c5QT# zW4R+rlN@gtTWZi_S7rmSz0GmUuH9OY2GV`&T{A2s*APtlen z1OutG3jo&t0KEoN=Q*J9u`R?6XdBj78c5RO#P&SQyrz+qC;RfGM%#4%gqhjnB{a#^NQmn*+za zJX>3>B9-53IO0!qfOdwoUJukro&FlvH5oO{w-WzvhO)f5^WjWFpdC>?7k zHS7QZKp^~Y?@GwLk+yw`$*=)&idkfyHdWLz1jGyUYQvC_1={-L2JG1%vErX_(kvsm z{1FQh2)bZqXT`ygu~LX$GyvbIp>cbYa>-(FN>x>Dv>sk1ge0}g0_i8)2Z#`TK^&eUxV?!$`Yqpm2Wsm@EsOoD3Q2n^gk04{J zpY;lM8u(_;lref%E;gI5Ot5Fb{eVa-5}EnlTO( zj}_^R#K^*l38{kstG3{PHuu|s25JE8%DCo|nzP-1!mvEMrY1HwceX!rYJ$^kw%_ZK zgXt=hv*X&F;x%c&&)}C}9(jRWf#kS#o3Jj8C?2B>g&U7M`Bw<$3mr; z7JTOg&bKiEwJZnn@*=L=oin*T>|cGjV+m^ki(kD9guO7}qYNXJsDd(G9YH45p+`EX z*|Oiqx!;WS2rtzcLSq5dncA|?5S+I}_=HKJ7e;k>G(Zd&m1jtYbGRtg`wy|>siWIC z?HvOAy+6b{H>`NC==hR9Vco@i`-RBL*bSrtfb70wMcje_RRiO3^T*H$hG%$Qb$TDA zRa{}lNEe5W5Ynw&EKQU34FuO>3GN3TdlX0yAY^<(=~1u)p?VXg$D5tzuwA2P)keI{ zK1m(51tnDf0Dq1=_AJFX8~j&NjO$L+-H=mWLl3F)6=Wm>UQVM*4HY_HzkQAT@s*^Q z38wBMF1qr}g1P5Y7xc!BWNBYCG_Fp?j*@E6Vt)Hd%_f)xahHOo9&{<=MqJrKr3tX- zTWz0GUY|(-FZoMjZT|p!;3OJyPEH-8;)n=zM#RUd-<0A5PO90FC^R)J`11L8zU2xN zUp2x7sy)+tA8`qU%Ro$AoO!&{l}=S{UzUx4Hs6|f(27;MF%w`BU%2BfSQM(ZKWn)* zm^#coBg^8vtKgy`@X6x@E%k?3N=Dw68KyOE^hsnj8>0O*{4{CL{#CzWu>z~kJzbj9iWdzAiX znVMu2S-GY|M?`=li6T(M4T`Ere{bW84Iz+n4eyn6&ys$(ay1C2$WdAX^0?g4^=R_l zj_2I9e;gs%Gd-z;)_C2jv)+2^rO)@9$*2r zQpd$<=A1A9NgC{Jg13_?0f?n-mbdpj5qN7GzDiqLB;Lq0QU(PB0u*^FZh$H#iosi@ zw%cmDp~HxXJN^X#f&komkxbWe*u@r_C4n5Rk-V}qdWZ#$s3eM_Z*CUI=g7?)iH5+) zD>;DA%N}jP$B)a60QQD*i%b--3#5Qgu&w*>3^7yzk-xkvbed$7kmHV&xKqnKvm}tg zBAH2O_Yub{pcQAjxjw3*qvrV4tvss*haO2=SYaFF@YgSzU;&fLndyM_eq7?Q8(yV# zkdOw}e{;esdhHWw@04t8vQ@57f)+8zbf3yfRhX4JmB5S+!_qCQ-&eJ8x`en$iPlEJ z0E3hzc`i(un1IRVpD#jyb*lMf>cp7Djz-Ilq7`Qpb~MJp z9mme$^&JcV@NR*kN$XN)(ix+KGV7hfgk{o@q_WAmrN30Sw&!Etfv0fN>%il=6Rb!Z z)Y+{po>URXQNe~Hd0eWfb#!UlNH#@^B-?I5JPk6@E+?E$N;s1Pa7FnvMhsa6vb=?4 zak{RhrZIxV5(@6!sQd4-Yd=}-BP48%S11f&`L+xOCRJ(CwOBfI2G$>CK(txS8V7=( zqNrx^-l&PF&=b7naT6|Ltg#S~MoB-{6^`0<>IQ){2N>JVEdX6S^Fxl!h+im(vptZ) zcgCGb+%YlCO0tf_%sW@d+h$hICn*SNf@g7rU!6|gMk10FRF_J{fi0jCO)%X)4{zgy z(QG=Q22TgY9YG-|^8h4x8G!~DneNHes3N+X`iip}H(s7K(*pZ_Lg5qQq3w&X4ca$Nov{ z2$&{;%TOBTkOHI426BKiHK|esilO`Q=c;qs;0AW=mC_b6v`$c}IV-Z3K75%hNK>#8 zMH)C#D`dJGk5_B1In__o!Q(%I($Cc$>OOf8kCd!{G6raipi}8#8z?#!h}KvW@;+>X zbR9KZ2;Qow<}~q=%VR_NjC_TE{vIdu3bvorcx6GXg#a&@0dH6I{kH0yp3^coopP60b7P`cmbsY^mKH!l-b0i0 z`ip}?zzji*)!%P!Jyjq>N$3G_-4hb9j-hY(hwbP|9Du&fWq=d~ke>V39oinFWG;P7 z;%vUWb&8hi{;skGbze1+2IPXg!yKs_5CJLvp4@!H6k`!v?K{28*3!K;5xdD$#deb? zF4R&88A&x_U19IjyVPn=+;7Gwkk+sar19RI1>GdsC37Tbrz7fM+J@8=d9xUln*f^I zxAR)hf_eZE1btpc8$}*6PrS8rOpK-?B3`x@%3I6~UpNK5j*!d11fPF`I6~A?eRq772 z0f?;3p{M~`jE*F7!q2AYA8-k+xXF&bHmUyrP^}npK1|a;Rb$eq9I7=Yyo}tErK?y( z)^gjFBV8T2K3X573If;$+i$-eO&EVo(VXjip`VB>n7R2rF4yGU+`f6@ zTVyQEBUVgxTmbhz@fb!u%I6;zV0A6$w~-jnM>0lkI($B#FO63cN5 zrAkAj1l2H&ap#dqlgycjZGmSI}@OhSkmr^pRAd^HCMm1GO@4^@& zo2Ow!LDv8nFp6^E)8I!N=}@`RF5r+>NWwmfUr^GlH}^a$qzCIo%X^bqC9NGPr;`Ag zT%JO7q07ZXM#t%A#h@PJ*0LJ^0N0GwV6wjWJ;}7h7GBfbSCae=m(1vAfD%Sd5 z27x@;@(Er0`D(czLvHt)!I2JIu zexUV5q&j@XBEF**C3e040G>QeKwYZe+IC!YmFO5Xb&k*v9f&6`4J6p1HY<;jleqPd z%u6LHyQAt}{fGDAwIQu}-ecVfOa;ZDjgp$7W)SB~TQ)?D7u*OVnSv4sJ2pLE?Z#u9 z2SvD%wRNREWZi57v7;F9x17B(Wtqd|xu_KgAFhkdxr^OoRK zgJN!g^Ia#HMUI4%6iXS@FGB(vMrt6l5ae!8{dmz!^<~c9lKVU~Yzopk zVpDS`dS>R~R(z0!MI2c@OKPA-^=s{*9qNEP9y3!mY3ojZtaqxj&*kCf!gRP*C@q5l zaxSL(+qvIv_r{>P5Cm;loB zamO#2@LtcM3pNOn?IAzsF(1Wuns?`-N6g28DL*jLwJxA;BuR^v`c+rVC%B*md)Fq1 zsOKG%+O<>=LwMrqt~^Ev@+DPNc@{K{N3BA<@;o*@R3cCdcN=}UCp%oRq}Y5V2(<5A zV8%HGWM)GaslP9%wyAukRY{tP5eljn_%%S$;@tg75q-T12F%{dhDwH&o=I6TfmobV zp_59jEMM~iz_ozNtU;~#V^1_{iEpqWr25>$ghYkD>9z))e=GI_|VxIh~hUR@(YE)wY#CI&It z)BwjF8~T76RLDsG0O{iD0S~@TDm1}v>vt*nv6Yz^f%;0aDw-mgxGHQ7h1jj=eDD;2 z1|=0ql&{S|E&v65g^~3o(eoC&Zr@ek-oKqxt#h_BS)X+VJdD^;7O?CNtD)W5$UUg8 zuea^NIip<0P>2(#BQ!&lx&HtP%5PQal%2iSWlh1qRkfeL3#{LzU%({R!2)f(g?hR4)o{$3SUWJ^2(6~>*D}|#+J5B!p`wHKQILRNE zjftg-`I_P`0idzY%t;^sLYYt9ueTg2E_=z@d?Mf zkwq~70OgCi_TS@$?WG?^|)usS^NjK(fry zAp3k!KCqZJ9w{R384Iyn*X68RfV4@b_C1H&XW-ipaOsq)w`?yf^EOjCkYDP_Jc+i( zAVWH~ov4WFuWjqz{aqkp#?}jt<9xWw!C>7)z~{=LMfqe7)IBPuk7`ne_V)(3?&0H; z1m?N*4?5dd*bc5hy=~U(R2QG~SuU&8d9$JHF279IA1}n8r>Se}yS(|YTShr1oq?ml z1m!O6K4R}uMUAAB^ns|h)Gtdt5w~w)##)}MH-dQVP7|!)m$L&7Wi(|1g~(LXRDVK1 z;CDWtvX6bcaiNfDw2b4uDcPR1!08-uA!2rkABO4SR{%dZi~xcl$l6+GS#N^_g487DL|nUoQSuTTt${{S^;5{J|*8&p6y2FK3aI*jWP#&Ct; zYJ`{L0oUNiTAQ|hkLp9V;39JTf+*J49fRy>e4aLFYiXPe?5xi4v*U#5`u_m*-Q2gn zxk($T`ocXPi8;o4u|P@kI&>qL_d}YQEag|QpW7t6J z1M}a0GgBPrIwoZ?_5-07%rTxziA75pkx4tyCP=J;dyt_0{p$BqB-U_?K}P5lny5;A z%#3fQ=7L1^P(_docNS<jTh%#~Vw`T|-lx$gS7u?2;2? z5Lw<4XKTH_+6)R=Y)b>5VR=m$i1iz~l7-!^w5c9su`@QWQLlXNKSlL9UG^cl9#a*s=_=#SrcqiXa|Dv{%!7f|M+i$}00%ZWpl(OSy_MOXS?9(JpBfduXG zT{au_4d;;{xYSStt% z7ooPPe3BZ0VnOY``|wo+i;H|GjmSn~>8Yhz^RX6D=m`)MLW^v7a))~eyKT2&w;3R| zo575`l0!h=qCrt%j%A2cZZxcUSVV)rt92}P_v0;jEUIGqr?{q5CTaDK$X-bNJ;EQQxrKrPb(d2% zq5x2zn}*mL2ht%o{{Z0Q-}-XmG~3BP-RS=S4Zds4`aeG)X5XZ#_=@y|j?wZ=nSy~Y zGM!@^{V}5u%z%(IOPWRF;?ypBK9&d6ivMQBivEC?fcCMtc` zQmC>wC;JtDS&fYE@3IPF&UD;y@b;rvrH3h+NdXMaG?qmX=P%{lUG99>eTUD_349u@ z11kq6e6Rf(at-ui|O;!%X33nd<0LL5X$)@7#02XI@#W-?U z%%@WTujByg0iw=cMMGn9e{XIv*5=NxUyx6vCLD8281EX(ETOGr8fwT@jWyW@_w^5s z*ZiU2kOFXmWE7*8#$4>j2UrD_!ZQ%Y$SNCsAnFUZVf*o{b6CK$T)pI#e?B`*R2zb2 zEXp=^mmX~_-~*%s9c^N(`I;`wtC*%@H zt+&)#IXAd&N|GD~)W@2yGUPHhs&&UQ8wz!^OB|LBk_rQ{+rPINo6Ri;jFVh5?NP+O zVoZeC5=$G8Q)@9GaLyKvk3xV2*Kt5`3<3=77gV=)e39+@Y?jzdNutjZ@O=wQpKn2|v2R9N>nRodE-m_A79 zf;ERiv&uuKFVAMs42cvEWphyngVE4 zaWr(`>Io!R%%@^P%D@#SyMG*MaMiwlkw_OJHhdEQ07J;F*Z%;Bbzq~){7HDc(kKc7 zd7SGAX;Lk!gG z#T-}7RPQ?jL)PB{Yaq(kG9HA{>S?$okr9X&elFCwRN1s9N6$yxu9g! z%)y)zs0}DFyG44anhUrDk=*b!pu`I!eCr*_LnyJzclJ4T7MKWLi^l|vNKy5!famu0e-*&gAQ0h^J&2fO>XDMS%8^zK*r))K zG-OqR#ltb9-pd30a5ZGQnI_~SWrN2Vg<>EXxuP4P7nleg#C~HiJCnF$z>{i3KkC$c=UBpezes9L%0N5V&2Zr80771{i=e(n%5qAZ=k2V^{Q@xX)B` zt`iwCGkYvAq5VBU_?XhfKmO5vCPa&4e>bQmTO;PsZ}zJ1$FKB&%@0E7{z-)X8sg~R zUrm5=(iQ&z5_id07%&G$0bQK1VojMTo4*M3i8f! z2az=D3?5|~m};krbzl_lt&5xY_v6)5CJ#{XTxx;{BE@1IMGB0m0W|3X?oAV`NqYbt zz&r2Xza88&rkFiz1xq=7ed}f^)_rmaKE8R*7wP~IoX%-h>>3AO+-x}cb$)es?$>vD zUb2_!ng{HTsMKKiVf(Afe+Lr9kS~Hm-X{V1~$%?2=*j;hPOC2;0f};Nb zeh|PzTW_q0kv80`G&K$vmbRu;m6YDe7O2VsL2zh~j^pja0lVivI8=RB&q^|drH>s7 zm2Wy_c4M-bBLEw%f`d#w&&R%K0KDwCYG5YT%#}l#6-Y5;B7?~~uAm099Bw0ENWJgg z!LObhNK2kGi0?w}lhTyDSE1mSSA|ekPK)YDwHwq3<(Z{{W46pd-)j5c8#Gk>^@HfH z!~Xz~@AF8<5%Yav`;P7_(Or27PNV8(QWc+?WjNc_>z*_y);9*nvFtyLII=!lUO#O3 ztu#bo>AP;I9m^5GfHqL`O$3@p^(}xWX`&9>?f@kI_4{!5yO;>vJ0U0zbRsjuOyrja zEXZUdQLPDNg*)~FyV$ew!dl=4RxK#?W8ST1X*{Qs`IIB3i&emXbAzCqnT9!zfY(!0B#EY+!KK~cFB@_LJoT7}yhXW|{3(YLL zTKA14Sfd7dHxIB6Kvg)ODm_u4Eb?B~| zBQq-;l^P_776(%Rs?~gf%C9S9d$#p4Qjo*@ek_BF0HiAJ5knBQ& zbwebqtUxBoXm;4`{UZSAY65ndE!s}j{-31jq!$wjM zit@+d^%=S+nUn>jpRGER7BN76u10iXLan#yt~_LrNuo`A-@NqU$LHrsu*1Ekjq@`}=W%usY2JX{JOI^?a1s5)6Dv z9EJ$7Dy4z}cZ~^}`5xqMW zJJk_)Tx)q25oMi&GdD+^23%DPG!#)94M(t*Tphs$R@=Ru_|6U8YyL@&uoJl^&J0}R z7DA*flL=&uF#$Y}CP2zY#1XjmApQ8-&UG4sEChSfGI*Wol4lB;Z0{j)kPxZ8!mQIN zzRFf0Y>m|WdmO{+9)#jVlAy$qrWp?yO)@kFm=-$b^BCRf0D^=608R2t{w5g=f(Vo=gJHB=u^?7D7HIE#*SO#+f=T_LRkFfoFt1@n<#OrgW1$gVhzy_)Ga;nC!khEc+h9I-;2w3V zG;REXAR&aDr7PedS#gQCGkLyd#1jfMxhOO$5LI*$e?P|>s!0zSM0DRIrVeoF32VcJ zM(f|ixtNPj#CM7zq+`2ZI_2JAV!M*6N!z!#emZ(|#uw3u7CI*h{1CF}@;O~94$N(T z;<*>h^CiuB2|uZkBx*pqjvR>@yVxKV1&3l7*44*7fufjh*zgNOuHs51kRLB17^Vb> z*Uy|S=?W1I7@G7jL^^BTz3X6M3}c+#wg`;4fOjepr}&mr$mN7U=v52?Bui&V0D)k7 zuWH-4JQI&3&;T0I+K1L~+^%J2lxT!8mBoc>FajS~AS>yRt8SD5?snL4EM&=du6W=n ztU>0RC>J@(ncSL*RJ2Npx))&8rmF7E9@~Mz8e(-o_NlC9QzHb+3&m}xWvBQQ{;4bt!LTvZQHIGyUMPP71(G7!g+mP2mF<0RR&QlT_}Kma9Gd!OT5 zdCjMqNswGg*st=@sg>@Z@{K##BFnh2PQzsz{lC8fP+AA8DCzpmJAXCX5LDd70ktg~ z0r2{?*`RECH{ze_(jaq?w#DOQ1wK8T?BWduf>TFp)e{nXQLv}~0KNF4d6eyW@k9(c z?%q7mEUl6jHbieMifrr(u-m=*L9gHYy`xyX42bVQ@cliK>T%)D1^!cnap_qTPKZ!BwI)4#v0y>UqMfWyZ5&Hs99=p;3^d5%u zf8dy3;l-C9MmwFR$NvE6R{Tl-06F3q$U^H9I?F=MriZ;he=<;S+V<_opQaAEB1Bb_`hxc!rmn}1eR0odg!)dFm^boNIg7lwu7}Wy zxOAmLmDE@eT}rJGqL2O@HINMTrMyTGQcP%}{{SxP=&O*Z&D~S<;*i+diipd9O@KhF z9BnWq!s%d10WS63QZi{*M~zel01@T538g?)7H;H};*Hg8=T9gp$H za|=9^M%9L|>pjctFI_1;Y1UEzpf5h=aj|VwOq|L@TOGl+A2(clwzxdKPz}S~-dC)o zK8d6EM;)nCk*G7`w|yxCsMKkdN+|&U0N!1@@T%m7xua<)*e(iM9=yqA+f36rqpHd@ z;fBC>3lYBKdgE2~Ksk>jqjM6A9xl&2GvA-5Ubw`3?{QJ@Co4ixK6_JDg)e#s*0hchcDE`m)(mmYU3s>Pv#KTu#nD#5<{f2%0k zsTNRvwT(@X6Rx}mtQeZBi}Otn{u z*rSBCq#V#OwXvG2tbG#cHpC*K}O7tWOGTG_;eZj9c77nS z;{f?KB0pfB#q(2^znL~8kw^0`Ni|eJW2klrbrZL9TzxXI8m<6d7nNa{8%bV)uS0Y@Iar7QvmGT#Kc=tbqfslV z!uflF{r)`mIyusIE~Nu7wEW@az>N};2DYXD05aZPZdo^Trb#G#sXsP3bp3PGw75Vd zC5#cT&yGe_1gpeB9+0d+V8V$jr?$jj8mg1cARN3B#l&Qe#UmqS$bdGJ2~j}#VQ0n% zOKuL#4b^w-d*(L{8zA<|Waq}@)yX9e2@X`VxnWjZxw5t|a2)-J2iuI*#9B5c(}HKA z8RW#CX@ejEbm!oy3@E#6bRd(c=`7!G`~quUjZkvcDCynpJtMJsqwv)bZjI(SY_%6I z>fWo3EE;^gtkfF7yY#_B*n|D}_a2^|T{`w3twx8qQg40N2hrF%HktjG)X#Z)z6)Z_ z)t8?JGEp)}GBO)d=`qIF8sBXsE42~0Z|~&kkj6RZV1dVHTI=;=hD9(GEyn@tmD zZUFR!7`Uq2015Je-?p!w0mO!M%y^VwOS(AnMRU~tSt17X;ge)o9%PZnsBi2^zV){X zryAt+ravnUo*`#(Mi)3s7}q4y`cXm9R#@y=-t^UMN$>XKpiI*M`k`g|!V}jih&L|g zcEMNk3~VUW+KFLy6?8Cds>2|1`_~VRXNKefl(_-2 zGlWkW$~HV8G4fLoZdpka!yqr-m70R>cYnVMaMlky4ELgGBUDCEm*!M%Wf-Pr653aq&aBGBe90Y8Wr&@udKg+K7PWOMa1WL;3KGkuQ&XA>5?GiL03do? z`&QLsi+%M*^WF-!h>|vWk2P*rC#RVMllrY3o{&k6vcxKVBx!#&=n?n(+Q2_37TMt_ zi3XA5YE|XaM$=*_ZQ+Vl&;qismLDXWvMGQ75NIhr{k7B*$C$Z3DGf4O4oN%1olVx? zi5X26Z^Vy^B&a@yBRdI+P(c(6SMB_9)zgqL{)>T^%{V{d1&>Fcq|&bc0Or^HWjE-K zeB5aj*rPr}t+LXvn@YJ*DuT(r+v)bIT65x0Y7_;8qTK8fKP7)LSQ`f!nK6~hnEYpB*9SZ!M%3Q0k8>T7=FNTH61lN zJhD~?GUf?GCyqI0WtoDiYe-X8l~WNY2=d4!wb)w+Vc2)!jU+c&jpK~a8=Kiy@}`xE z@`@oMJ$i#k40olSfVl;oJ**#ZVp7qOlf{)?IP$Qu;!BFm04PdWKc^)#MB>S$kk~3V z-)`fKbxglp1ol~_rsKI+<#mYU0v(+!`8P4`2-n@9b3p=LoqUlBQY? z-X$8DT{AHmfhYvhpdg#_KvXmZqXM;CQ0@7-t$5B!mk*i3n3U2Fr`QuO)1RR!f zZsENU<&y=&nqoAv;JT&R)Jagv!mjkV-~R6ls^6plTx%yW+|o|v$10U%T=si19H`X@ z`5LwQeb$&BC1#LW9;_4$zO<{j7bZ?a3MHYPSN>8;ve7g(8e{wL4?3-A*(loCll!GD zFQ9aI{HMHC$lW05$O?@sw!-H8j=2D)-loDRs`>FWj9x6pgz~h3n zQL{%+#bI6@X+2H&o(<|J$L|t!i%<>q21#HP*QwE1Y(XREZasgbn%^h%CN2ESg#H@g z=%^Jm`JeCgzY=oDI)o6ZR|^Xhq}sB=vi&W)0?NDg+OGKEwg$7{fj--=kvR>pocSS_ zBb7XWDKQ0zm5h=!&fu{ixE@?W_pmFBRe)`6vG7l)C4`#+FSW0@|2q^e6+; z83L#yTAs($weP~1OI`${bUORxAtJlvC}pK~iOFL6Or}Of9rguYj`nno_v3jy$&2yF zwPqaWTqJI^^IH;UmVttJ(Oj?}s3!{S+iV&(qDUJH`Qv^B0Om$V$s-U96S;Y#nKAtE zjZUR>EMBzwWVua&tJSTC?f|YmB`$LViNE9*BBhK?mNC>=#d(a{NhMKDfI_yCO?@P& z3~2A|e{MTicMeCU{mTtO6(r=o!S(Kz>b|xL2x&T}IS>xSN6mE__w<=J`wl)`Uf7z0 zbDiGh>nVU~H)V%{R^;pCG_F9?kBK~B5D9Gv3b6KItseAyAC41NT>@@MO{M`C+)}PG z>5^SQT51P&)1{r5&^oskZo7N-<6F&vY0V{D&0!Q0#P4MC*c}w80Qs}P52Wlg=_A{7 z{BR5exvm1*$FLMfE}d1?+eQu$k!`KfkR&%#$ln%HFN5wLd_(#^Ul84Fg`>E2HEgR(-peY-Jt{|ZP!;N|@AD!?n z8*wcBL1)GZ!B+z@N!`oRUMWg(`oEqCkLkBI%U}T_!Ua%D)h%i!?yj$nbzlxF5L|Dp zdruu}Qzwz4Ctz6sU)PbGi~Q8t1lR_Zq|#LX09KO9$8tCO@XXrKEnqvd?n8ZJZK#JQ zVJPOK`qnGGiL{NG_8Pa1p3n2bs|Yks!it$ElsjXN^&VQE@a!0;kl317!&wBhZy^dU z=$|sS{sr&BQ$I-e2JGXHdW0QN3EF^17>g?uIU&5swRh58CNU5@-nkclvC??Z=W8|4 zIEg?kKq~9yG#S5`53L=e)xMGn#Uw>8#kw?t`*-)?0|V)5>hpl{pEY{i=}p*!&WBRi zCK(A9cG6jZuzf5P9sc$zx5nuXj+D>=5)Vp8@juI-!(OU}aeG#K(s)*vw0 zIXnBPqqPyn-5DcE;5pVc*_Yc1IG`Pcu1%twyNdap%D`g-QnA*J_5_7uHW#?BomrhZb6+{z89o0-IlZv9c^#UyKH)ZH8J`*E7I z3T_kiJQG-Xz-`v?3(fxkhq={!HOP)LrJJofvPqhN21n*i9AjCs3|R5A_TNt5JbQ0W z8h?~^gN*$J4|gQb6WX|10zPQN!20zkuatj+*KkjpCU!*?GM2_ohNVeAP9j>Ym5ebS z-kv<8!DwT40V}N7A1VO z9U?UfNn)k}lP2t-jo1;};PJV~n^C8E_S`JsNpDhb<#G?n^9F51$&|S)J(4txyD2I! zO~h`yUe(4rp1S}!2<-{Y9M?}@kAxxF=e+fZo(9jkNOfG(22cSm9o zRP>ywMyDHiRZe9Zgp)+FM-*g}qg0W$ z!nG1v%QnZ-LHD7?>gVW*Cg3dW^?;43XT!Oeb${YsT^f~t5#BC3xMeJ*<>g^&Kth3j z;DtBej;5U-L+G&o0Q`&}@Pfyq$q&;10RDA<##5ImlrkBbGJLR*GO(u7n9>(vb}61V zZ<9l}ZaEdssSO6^{i|y>l80t9JbbGeh;u8?nBx5>&7Gm3Y?2IkyC3`9HG=h=1%wZG z=7h{NM;Uk~)>VoGraEGci!X3pR7Rq~B7=kd&lu)hdP;UeAtz4knPWp6u&W~6f4ym+4^+Y18VK@#$f3nCq=b_1&HE2tc4^HvLld928u-mTne%bfRDZK z_m87s=}KnJ#_ZK~*TiKYcodK2CKnB!uLCq#VW z5n$?_kkt}sIBi5&0c6{@{1YV7CuAyg3XSVY(kjc%B__yN%G&z0>IO|lhpY!?zmIM; zgR4QYnJFgkHqBoWs$z&X4Mj=4zOqf4vZWjQ_u+qET5PVsMzWieAV{ZsJLDENFHuP1 zQ>f4+5oBKjT$1MXc$IY9EhOw#xn_|0q?18hr~n%Mbksp4RVl8+imCM>9Wq<3BYIoR zjgkp90t{#g2Vzf@`w|WIZv1Is8qE=7=9Kej>F`b6ElYul4O-7Kld#ywl2lQ!31dKx zGGcE~?;v<5(e(#f!Mrpfy36q;>?QH@#KM5mjcLzvjLCC8Ay@6Te#d=C2RKM1|XAHD-b(^)kpx+4oa-^KloN@MI~D$VFcJ9 z#?m^fn;?F(Ep|1w{1aLYX3lVy;|-8@l&KufF^rTHoflN3d2zsmZLlpZkbXt`@v+Ss zz#P9cxjCfXuhTy-%MJ;0R!J3zT45w0My#X)KmZ!Mqx@^Z^Blvo^GL1g9qY`w*8Iln zQCQdkUZPQzK~eyBM#bez1Q2El073M%1PUlC~9f;d<7X7I0 z-;Tuw#Thxu#PiP~eR}I;57qrr7#$1M-0_aVtd3zEj2^)HRSCa;jy_?DKcr#^w3FUf ztfpq02Ul=Q9H@hVE0QeW%Oite>2sn%TUnxSdhB=MHK$%9>q0ta8fS7)$D3E@-S#Mv zqO}{y7= zxbYSvRs95nuestip~S{P#CF@oUHy^Zs%6IO%DHr6i3^fRU5F}So;5UmCDB;@&)_GsYD#RVaJCAy}upKAK9_7Y7Y5A+^2wE4=XjoYx z3PYBva3llc{=6cjxKbJ4k7bh>Ks6-n?^N>fdqhn%uS5fseY_1H2C{bXMfNyKy z>67w@H=uh}5%f(xDPlh{nmH-ST(_XWfMaKdM|-og78g`^2Xn^9MZ{ZFc|upQc9nem z$l_D_V6&19DP#4G?LkITHtt8i0t{1gzPBD~M3Dx`^OVW?XO1j{1}Vxah8~hwkQjwx zMcBV;YCZVDRBK5GoH*l&(@&apPDL;Hp&WAfTi5T74r9&0UBa48i6Db0_xf0K)ahL0+2=R+mEPK z)+OL^nO;S^30vncm1J&SP@Nhyval3g5@uaNNhNK^d*gvsqzZ#?~s#fvRw+eZQ zLsSv2qe0@8%hUZp)|o7h`yK0J!NrL&ACS7~QYE9J7OkB%VHQxj)?AcLL=D&?GbkfK z8=LJ!)$z-w*?eq|HLcl67oI%Qp3=o8;0ZEim1(T$5sgNTDFxX@Z(qL}ptOPep(#3a z(NoNMgG_Y~AbDUC0$a%RNfw|ils*VNV#L{$^-br|=UerM!^V_;*)vM+Og&mQa3U;hB;>dst+ z4$4jMTnz+U^HnG}FR9y6;cd|Bixg=aw30ZY0d*0TRSG}^tCD_A@#LNBo9tbN^&?!e zqvbNl`a{f_d7Z^G0VAltPoz7KZN0cnNHqYCXo1|A&r)}Zl~!2Kwb#wx8Eaaj8Vs~Yf^{P;c~tY6 zkmi!Qf{Zxq(QQo>Mj}7}00d{Y-uxXl-G{Hf=v`vq2N|lF%&7CIW-3?lBkG`LMU-n@BUundBuoWWApp@P#@uGF&57CZO<*L*&oyr$KjE_A zQdvek1Tl6Su1-U>g#ZG<+<|_R#RqekPwjYo6_L%=%E~;$BXX>T0;9cfjS2>!%>fl= z#R7YMKG$4Ez^L8oo$6;}bdawu9(D|DH${o4Sk%NxrKpgq51L8X8sl-*eL8}6@!Ye5 zTJg~ZE_7PgQGO@Hc3r;_o+~VFyA~&!a%hjIa88yV!Q-i>4Ab;da`~eN{18@L2ot5q z%;PKn01$-vh^ZGRd2|hJjgcheX#uo6NSm4jn6em92aYX5U0+sCtd2Vt;Q@s0LIh#? z#ykMrc<^DugnO9diKOmW1Ll`M8~*${VuRjoB=-Ce3)PLF1lyTOi#)(lWnI3I2B_Ho z0D9vXyP613c-3sp(tcqJBBBM=D@Ul^0WPuSmtjN=+qcgAY^QOoOf(KZHJr?*uAQXH zXJrA5L)4sc!(^7B8B(siv}4_W13; z1*!!Q2G}0N5_w4i*`RnXM>%~$l1QaGNFWUmX+4JKz5R{;+-RuZp_9M814!34vXP@K z^0J@PX-3;=QsscsO^_@L_5+Fp0NwHAqk+0%#EqcDQKSa)rjVVjyyCH;1lHPHjL&c{ z_NKH$MD(sXY*hK=sXAbhN5;j8AaC5L{`^XZ)FACdGIvo++``5#M2sxe05$^AzkcE~ z_TP;(z%Fd@#HByggvrw@{{RJ!cimmxf$YW*0X6S#-s65V;=Ol{pA_0LsyE$Wz8Tm1 zTlkBz+LQ4G;zK16x&Y@{W!T#a0fLkJaqK-N1LVGjf&Ty{!u|!r(IoP^c5?ZBZ^WN@ zUV_XT$}2@Jiw9Tg6LveIFa#Zl?l|+crT`mPQGgTBw0=s8F(p+VxiT^1px_3)jEO^P zCusB_1likd>yC9(&ur`j_XVbymY%;AN?77Nmp(0zl={$+5ze+Hbrm#Oqf0*I(H`6z zN#)pfL?9prI8RbVj&C*t6P+W?a0T9%Nuz3!wg8rlo3K0k@x9{YgK-|{S;3G}hgB;W zvm9wrZRjGwEFG1!+3uhceVdJVSl4CG9!XVl%X;%hT%j_95EmMLXN}^ z-mb#8^z8KnWpB-LN!4`cWs38-$j`_mZ{@bkDTRkDK6gL$?Z;+``XSb^JWWErzj%Q! zmDQbGbg?hgJn~Du^%>zGC2TZQf`2x(Hby!viw(T1BKp0KDl1PG4ENG;Y zmX&taivqGa7URsxk@YhZxC#n@E7E_m+(T-E)7%0$C6~!{iyu$fcnK$YY-0QXCoiY!ibZr%P#t8h9Ih?Y9LV32KGobTnk+l35b<$ zZJ-+kmUy67{o443pjMuX=dMX3vE-AmBXM;7`%ye~G*}}^=+m>8Z{t|;cEaK#_8r_; zq&!=V8>)Gf4)({KWXv1^=?ctrfNgavp%?Ie$BY#n`err2ePf>;D^o}mC@`DC%d+*X z*eob&mmx(E3G*a$0Zmx7L1X@#@fieE17HWSM_jhs(Ye~5Xx5LJ6lO!KSuGleW*2m< zP}gDm@tj->BXNNTBDu+r{{VKQ!;OGrohV>*>eS8w3|I;QjXaz;qE}3Fmt#SHPKhD402WZk{{TKYt`n1KB_)+l_iPv!t*Qvb#SJNyV7L;$&RYJ1jUGbk`^JFZ8LheWts*4HPn0)buy~|J4 z2lHAfSP^L<8RfWb6qy57rIQ(z4w4+!hf_w)10|n*_)SNL29A{0wA}23OO}^zW65#= zvmS0M5ZY;%8hmGUQ%Xo-9qxbe;dLXEtlfpDv=wc;sgs=d73I$XSU*FIWMZYd*Q|1+ z)3&P4Xc0$asX~qGYvbMeZ3j8o zbk7W|iVBcbp`~I$B~bZP0jt$#YvV?!b6!ZwJN_wBZMr@Q+ownUn;ds-G%Cu%lJyoP zOO>rLnJ$SY@9)Mc{{XBfC@V!9G!5&fYz*>q6d+rEQKDP=V~nhK{J7r1;xK|KkT1hj&5-2z(6Tb((2cB6(D{uRb`|LAfBK74N>Fpl){neC@@C zw^5|~lqBmBwtLajC;gG~UQCIOmIaEBD?k(tQ=qS(+hLv$D{hYz!|Hod-W#TcS3!EI zlmMmKk)jTLfC8w1Kpx|bF9b{r9bs}rb`B$6bQTE!%B3SBlx zq2G-4=0iqglkVd*>Q)j?&h$OY+KO<#KriK!L83ZX8!8TxTe$8)yWxT$&h!S^<=n4x z0N>%>WOm9Sl??;{xigYW0tJAC4&`-xaJq4?(`0W4Qg*^h3MR~q%cdeRBs#$am5qQ+ z3{(qOQKZl&&l_a6lbfLC?l32FxAd^KxGBa=k(~_ z{B-oy>3S;h{{Sb#e*i3)BQ-R<{{Wt^{6d|UBOfY-95K}A8I*!q%-JS5k9|ZxmOeK4 zzBwefmM37px)#t5pa+Yge7G#U>n+x_oQ#5ohtec!>}U{`{rGi36e*3c5V!S?Jt?1< z?aQ)m{W##?bLkP1YznXk80jCSA8XAy?1qCo5`J1a{KSCzgzBqCj+Tsn76IFhw8$ZV z3rC7WvvO|fs9Z$M%pOTR!lQ6cmc^S%1QN`nU_G`xW5l= zn9ik${Y7FUV_*;sgZ{U_3KALt7tI}<=@}HGI><6vWKtbu^P^yD!1S;+*lA)w{{YDG zvAU&_4WbX4%xp=Er!HF{o;VbxqGe6Esw*U|BZ5ZA5H91n1Mhresvx>|EezOq8+-l; zTLqJu<{I^g@)<$;P>B4s><#T=!1o7k8VMBHx!bof6vF=Jiem$>*T-FzxzU-mmHbi_xqt@l2+x0cBa9Fz z>=?E1F1V-Gj2k>f;VN@)Mii&D)dPEiveDRBzx+7WM(+{ENiQ}DtER?|UlWo?{5^w0 zkC&>+2GnfBjM%ST-D#9;*Al$x;mWf0cj6$m1wKCboEf!Npq%F{ve4d|jdvve)yK2+ zmOe}9e*XZOu%Cf&bWkm;ro{gMey!N$s`7XMLuw=QAeCE9vXde*tDsT`p%2A^enI2R zS9FmZ3hXd?-6B2d+m_J6nZlDY$nF6kxkDO8q*2y@iCnD!M(6j#Qgz#VM|J!H(BD0Dg!?wK`}K7{9&u-;Y&G^>5w}isQcIO31m~ zYW&NY5!F4;MGCN?=IMr9=y^6_FxQkmtIuhb}&hBhZi-I0rF+;8r9-D2~qas$mEm;&E}4G*7&Mv zGnT|j8apF^Hq5i@3 z0ARrwhHg`mi>A#FMvr}nufH8#7aut2$y2CnPOCs}L zV$2CPG~`aKr2Fc5G>wMcy|}|z&MO)x>v?%CL-kZ0(c>#OAWJS8BHc19b|+INLjp)6 zR+e=nQQLs^L&WAhLZN6QdX{D*Jw^R^_T{W9l_*tDusUCVdj0sI0H)#w-t{oD88TmW-tYPOPEQvU!ig~YSQ;?+aZCdH8$0E;8& zut(0_xYJR>8wUJ&AZVHDQD-1bsDbq8h(I{8F4%htA?)*OioWgR% zm`#n0vM6L{jRn*uQalq9v2`x@Jg8YqvPw0Ixmv+)GHYe>Ul43o@va`}JBz+A{R>?0v{SRnV> ztOI+V{kZy#am;jPyp=gF=Wkm-BA5tb1b{-bR+b*6ftXQYL4a+&_d9XK#EC9<5i4ys zW$#{*>7{7XA5ypJ!7J*!xf4u}Xh<4M0ypjmzC6|{33ki=ORq>obuD8vPvnHGK@SlG zAE`(YMv`iJ1gY$5jSe|XA4otKpFbtB!W!vII3?P5nw3j=<&`^?U}TIlTP~9}kOUt`+RV)$OhL(tRxg$lR#$6mRgSAF#_tIT*aGJ7KylT5QlZE#{$_HD9>iLkHShN0=pLK4 zH04A7g%9B~&3Ug!&*&7!>XirnZd;CVK2@<2Ggp+9SxPRaTOyQ_P=oRm{Bh(NI?J~F zlU54JFDrzp)bS=b8=3|KG=Mj93pxOIBXRIJ%J>xy>!t}b#0-GrwJdX{q=jQNTTo-M zr;{o~1Q0v8 ztr|O4{{VBM2n6(bsQ&ZWQi?Y|w1QwK5I)eM6WOomV;kOqZ) zDh0MfM5RGj1W2)g@44ZP7icydd{B{`Z&Gt5Ba~#SQIE@EB^ps9$CW8&W%PimyH|2a z;Axqvz;lt_5jxb&a8kY`Z22Lf9$*+jbdsWryiUg5jg+C>oxgrHJnD#zqqly@?o6-~D*)X@U(uM8?mWFn_{o#ewzo!>2rLf5ujo zm|iS?TGD9+a$z#500$VrNX3m0NV0!!I8BXegk=Ujt9cyJJXrzhv3Zg`e@utlvlZXf zxde~jjX0wXXgvrRAe7b2{{Z+5)&Bte48GmYk?~h;#wvEHOwHvm^zqTG8Z3`7bv`VN6$hj%fZ$lzR+s+(Pv?v{+YuQN z?^BA-(z*pdO;+#BJ5mOD}2tRWygN;}ih0UU_R2olaT=?n`j`4Kq;_AZ-Oxvmpj zn;ER!Hk^`nUGsuC*#BdAbq$%91t|6Buic zAOK17We$LXbd_d1b|Cqe_uYsNGMklg z)kxf}G*Pgs^-`+*cjGJ1IisyO4r_@QvQy_O3}P~L#$+OeSXB|AS_IKkH*vn(ajJpm z0tMkE;=rb!SVUZ{PL^7L5(SF$hCZMuiy#-TxZ^!b)-rbYN_%8dBn^wt9v{f7)}M&b zj4eM9ULfev^ zTHh)|k48^VnU9XDmZ#S`BxHgDG>~ZC4kmGHHuEStV^d_!PC^#~SR1)eTjX-91 z(E3Fvv9^zKSHHz%tl4`=HVM@IQVOkxt1b>u4xkv|W;RsPvP9~^R1%;{qjS9q+PF8m z9@DmX?n8KR*&h!Tnd3-*#Uy~a0!V2KFb>6Ho>WHxKy@#-z@c1q9tR{&(0rC=`s7Ao z3F_2lgCr-UN9DGsU`VxAvZbwGSl-9J{5J|lvkc$!ORNcL052@_e=dC3e6wi;dWtrX z0!JAv5rW+i56Rn)Q$!ZicClP{nRhoOmGd3>moQUI9hxosHAOy>#Mz+Hj^7-0TLy~= z8$5@K$bDyDYWmyaeBwT<>NPFfn{!1e>a(jaB2%Tn038#5em-dNIIKqgQQwJruzrS+ z{n6YIuPmn{g~jT~nsy7enpR}f+>il~cN>GoJzy&yfD`BF+IN{tT-GoV00PoCbsdQY zLM^nA6|Kj8#c#%{PBKi{A>tx3RVBEg%tS9_!5|=l1L|!cc2GeC{rEQB%p)N@cA=hY zqcmrbMACB3U{2(+F(Tp5jUDa6a+zlv(W4=I_1pM@$&DYP<2Q0= zxq3Im)iZO>Z935_&ND0vU>xL@dIW5xqO)DKe*9ppb#eHnpV~ZlEe!sRME>YmqOa;e zS9cDjBlN1MC=jV&NG%_hM$~)za3tNp9v>+(aQ9!&Da zheMCdlRGfj5qlx{$UQDuzwU*$uw? zf35K`1husQ-nY?$=AMP<-j-&Wqm6e9j8>=>FC?s_5=jNfjkeeu_B-+B@pcY9J^^)T z&RrfWTjxe0%b|jamPR15+XjXzEu;afS&~H}$lL+Fo;h?UlrARG$BNkVXhOMk9%!IT zO*sVuAPN~vvgy=V1Ez@F*$3l>RWL#Npde@lWj#+I<@~+YHX=yzMl>{_EV7mXw<<=I zjOio4eYn8U%2X4PGPDz_&X7C&I#j%)lS>psDtVeoCI&*cVC!;Kwqio9im!ow_f=~& zkkH!&DbpjIP1BDh7oCI%Z~iwF)lp>gq9ic2`oSiwZ^k;rmQ?9!?phh^x2!J~eja24 zr}N__YyGO~h6Rb*M$d=}9|u4Oy=wdM^nXr7>4zAP?&rBBA?yk@G# zV1Vj%dC-NwTB^L!=^$3GOErHzxbe&+w7V;Lc&_8@LnP*!`f<0d2#QIIWU+Gc6HdPe4sSSvQEG?v>{F>>-dX;q>LcI~}i+l};_ln{{eNgKRS zO9u`wa7^fNgH}z ztN8C+a%H{EKbF?35cB9qMx>sHo`G=RfOD{3H`B~F$e#;@kVg~AR+F~AT>*b=u< z5Sf@djU0*1=`}&5R2ze*)RZ^e9@SiE!;NNCBOnrM9&-?Q1!cvo{{WYq#)%<`lLq2# ziMnL=Bv%e6nBonKdz^qqum^vF{pHs$%bBQ#$ykG4jX_>k0MG@L2itxsW}^VygpO%3 zX-pitzrzWT042}?Lv)f)HLk6Jq)oupK>P5DpRKmfB<5L$R)2zy*)t*`5h*>%4B8}6 zpbdc~l%2(eWADcLo~R`AmS71vEjJZZ<8ulEwJd~?QA(t7FaTcOlpqnc{=jj~eCsy+ zPsM9&YPu5RJ0w%c`jtaWRlQpn-Q!(afJP=`s)d3^`yMn1C8MLh>15cWIjXaC^wGN! zA&xwCW(uxSI3*+yEf>(_8t!Nw^}=bpR}j)S_=IQmMtzBYmMX=OGq7g46%M_ZOT2N_ zfn*^oLWv|3TxhD|SO(sYdRtlpk6O<$kGtqKy8XE`MNu^-Gwhorwan-+wQ~v-pb|xb1H2zDNISQea5e)G})NHn`N=Czu zB`XI*Y+O9n=V$CgI&y^hKOhC~X3JLebdmu-{tg?6g4UsAO!OvP!Wuk?jg4`)+@JER zu)6>rGPCL(pPFNY0urjiu}|f(0Gu%8nur?c-*K@6je5keeWZv-`a)9E^GMj~b}q^< zPpF0>s=KUa$U77K@t+vj6iF%cPpk%N?n27Z%F`9|0Wq-pLb8Bt1|8N$C5L*t`-5N> z##yT%!M8#Ufiq(Hklv*_-ZtCQPwEUVjTYXA{xs^14}tQ0p#glBYnwiJnDevM;_%vmjH6J4GLtF%T@Z9%vi`<77coc`+V@qo~1H#k>Y`# zv!N8^(tckXGgVqNK)tXB%uqn@Kn7!WMUnh)s@&%`Hzrf&wcHQSDbu1QU2F{Bc)X=BJuacg0(=By+xBC2XIg@U+y^e{*rUB zzK1q*(AZz$t_F*fTTU3a%d37htK)*n7%nRwHFj1e!G>rWNq1V(@hIZe29rRD9-DvwBGuGA>1dFFMf(f1Keo$ImY^@<#Q4oU1 z^vdaqP>i%q7a)KMqCNZZRjlTnv*xLUxDy*ZJ}V}XKke|yrpb+H5~W^7Fs`3S6hl>R zHly#yQeuQ2GFe?bt+Q3Su}J0lE3h(Ss-ITzNL6EYzU!+?8yoCS+#V7&*g>!=s~KaY zX1uY@qY>v(wPGc4q3HMjc`)oxrrsDquWP#F z=5ChPuHZ!LyS&GG^$k4A0Ng+$zfJwo-I|9m1m(DK#;iP?c%?ho^CXd-kbr0xD!;(v z6E9Wd?JHA+HK1%A=|4I$UnSbhBvA!L1%THgNCKVp1_Te_{kYjo*`N*S56r7#HIcJo zZ3SadGaa;*gZ^eTPWM~({q_QNLkK5#y&%z7u7+m zSM&Gp(9q^|o{R+FmuKP&E;L3H7GwJ}+*bG3nuk8>6efyu%)q+H*tF*!TNS2{_#$rVuc|#f!r2vBKbK0Y9J_DVSm(&!0v0@57?df0qPQ==DtvTyn>kq zn&VYi*_V1}c@%=Ajp<1i2HP6p?O-h+=ROjInKw2^@gZ->wKk&$Oe_?Qw6qGLwG&`e zU>%Ot@y2JFc+TMWrZjU;SV3npH!{g!G=_at1ul~qEJcz#9j^AS9?}IN2LAvQw^`0J zbzd#j-9o4?A%PVyxe*yzPiv6S0H1U7!P5n;xY~RBly=Uf-N}^ACL*7>7D9j5&y+Ej-WZN`zrt#AwGtG1bAR!~wvRr0IkX?{M*Rqlc8}XkM;?@8TVI2?) zk!;tGCq1E#AhBVqNUj)#KBadnObVcqLr1cMx5o*mET<&%iZ_{Y09Yo>LjFgZ?pQL% zKmeft8f;k}l1Mx3HupSceyDb+8&lhG74B6d#m#W+k$HGUN$spl6mlulK(bU&+RyL8 z>VRoHAK5*~+3U3Qh2qZuz>lV~spi zn>uz-xY-P}-|<*5ky~hGB0>l|)Ibwn$BdYnFKmlJx@{w30GyKER8h0$x|>+CD4`5M zU-GpQZAh`GovUs8UY0nHPDRMiwJE?{gslN674()=k&2X}){#3V;DXxSjo!qKw>#{3 zl0Y|)6tOXU*0sqSPbi8)OEEFV;2-Pq89)Ql6^`^Pzxr|O393d-_=U2UsyNt+O-`YW zsd%L_~Oil%`I!R;- zb~V2m@b1;7^BWRs-OY{OYLlsK>0@93{K$;jr~*WbAps(<&|)I{jtXIbgLv;tiFp&X z7|6%`zbVUz##U6xnZT`rqRT+g8=)lCnlf0f0^ zk~Bxh$SwUH&ZZ!9Vr7$9U~j*(?BT2fYGV3QAZG*ycz2K=jEW1Q2go_pf37 z-ypQ~+qfWt2t6KY)s>SE(ArhVSv1iPafuli6)IaygXaCW9ATE1lN@{&f_awcK_-LC z$CnX-Ecsl;h+pa@5@uuE?D4fw`LAvs(o2JeP!f%Xs27s062p_TsPjDOAZ3m<8|rr( z0F2vI}*EhPmvLw7)p$L%9R! zo!7p%QDV)2=q&xcK=8~!nqo5_6;#YP6wR3+)E{cO5c^q3s*kl;_V314G>}B(Qyf6* zK(hjlVGAzzjTBoN48;%)Kx{?d8fn^#ue6k>j&$^SB7GzlJj}quN1Yi|E>HC+udx*< zJBl^)!f|Jq$QI+t9S|hng00OUc(bFCgEajICr&f*m`G zP@gOHlhr^=Y)Be3x|L=hOH(6@s@vy{jbVd1!a;OicC9axqOJnUqtYOO+ifRA%Ck5J z*r)_h_~V;YopRl`TIu?L?Lo0bYs_mKEdLcgDGEzSk4F|kk_(<)mnWgg~@@JJR$aILILAy$Ho4=?XsC5Xm!7;YMm=Hp ziGcdQG5CY=G98INsJZ4sfGAknR-^Xg*?LSz$$bwqmW9H94RG{L>S?fY`F(%I`K<)B zv7GQU(t49fAZhauX$Nmfc*|DQ4%_X=oPgs@6VSRu-QgVMn1}MSL#tUxor;_P04y^# zGJ~aqnHO*M9{KSO=LbgA#sWYc2%jqt1~x=+h708*NObM0ArgdFVi?duK1d^l)wvG$ zBW;9qEc$5Gx#^Qg0t}0tj-VJ&k}_-DHpZ)UJak%rM*=QK=ChIXyMRMFz&H4INY;<7 zrjAg%Yy+uM7;WoX+uw%Z+w_gK?3Y^2cJ<}1c0b~QZP}yJ37~YOwB&(xw1@j&9;S)r zksDVYtn0~GpD<8n%vuWO47C;oYYCLrYqNGcefaG#lEC4-cZG@9k+pqi@eP(q)VBpLt%TgzC~GJy4~}kITf7q-ArWB-?uh zWKc?}ElSC^@AJnzUEl#_rNf#WZc^q!{{W7BdQ+-oP)H;NMnnovX0tdx z*Hx`FSn#ovY6Lpo+xz@+D-c}A4B#lth&)BmTuHy!?xw;Ji)vo`=GJad;OG#N1!D(><5io}AdUMPb&P;IMap}!TZOC2V_sTYof z&&$feJdY(-S?%`o$PqdVIBXkSYR2YY0@1+t;}~ zdCXpMHVdgh2qfmc57H5;W3gR2o;A>P`h?P4?8WOz)KaXCulsrIVV87IXB!tvhylGY zipP>$DoH?Pa*|4=Xi_68V`(6ISrqEt>dy)-XkZ&M?2?)c$y#qLMdjR&6vo=5W-B48 za_kJcK`rSzn(X_5@y9Z$H7htpqq%5owURj6hQh3`E4HKP2;>%4F7ky6Ng%3&wO-rs z!xjT)5}*c2DE@wY+`pGW8X}V{X51fQ7)M~C)4R%DKag z>;=e>v6n9ek;4&8Cylg#H!Y-5*ijYt;#H$8s6ff4eahJWa{+avcdsn?0VHkGxr*#{ z4zKEMG)ZknXKhA?;I$jE+wHf!^x!+^x`+P&k4N}zUT@Lk{NC2b_K*BdTXt?mW(h+g zjSk?71xzuz>Hd`r7>oBLe)r^QvRGOt^S`(9UAKDD6HiKod@Qo0u>8~#j^GB7rdkvZ zn~p!cRDU`4rfB~F%t;j8l?d8s{8xWwx&an8j_ET*apbkqJkSZcBCbC);jN+xGHx~kBjrAt_ZQoL-uB^S z65rnQM`G>b66ZDwGw_{FhM0t430TBTbedHqN9hIazN#Bn52SgI8-h(p)@-W$xdvWl zT!a$Mn>k%H4yFG97IwP?1Ep5$?ZMUNF@vN30OeC!3#v}@+<5I*xr@7Da{&7^MVZ)L zAZgtg-jKw}8~R7K{{X)VrVhO`8Tm>#&aFVGa+#tWrQDVC8U#Q!cMeubl$&A+B!>1s zeYj;%?p7kx`5_%2sHo@0xRCQ$x>Sz;b>$T1uydvAjyOVQ!7a$6$I%9 zR3@~wfJd6dl6{8UKAdWkvOB*dx09^cp zem#FJBmqg=*}MB~!$BOI#NK%BRN<`Q8xDo@N)`4u5fJ0nK+u(s>s2I4g6HNIq z$sjjmm<+55CW$X7vBTdb?{F5681PF51RUiwV+j)`Ne$2|BNYHGDOXXyaY}!<<12_Q z4d_l_moL+?ZA#>j!K7vzm10>!p1_mlF`@D}jS+FZQ@vw-sBa*QOOunHR>tu|@2o_8 zze%FUQSbZTzYW9~V=04knv{gS&PQ|RSCwPcuhyNdNu#YuH%CBA`|7WI;S6a29f;m! zz*q-{68`}2r{VybqxgsMB2WcT{{Xjg8H%$T0F@hetM}vCdQK+^=#1y{E))1`hoW3X zZ8A^%!nfjD9NMLPg^Yl#j=G4l7DV)`UF@%@@7RjI{CS}Pw8=>P^&%tO0S9^~)Fj2wrso{l}xl~~J6FE{hJROLj3 z>M_Wgje;v8H<`AkAZa46?s)XLb1fz;dTbZk+ ze19;aV)VkRcXpNabE4QRSu-%B`n80E{ye)4sNZGk3PUQ0( zmIM%pzNR9>waVmA>5+xhpE7 zLr}fKc}RrWtpx}3 z?ObI%){Rh`Ad(5mA$YBC;UA0vhpIk~>I6jqlcr8lA>ZJs7Cyu54;>8>0MgnZ?B$vG zr^O={X9bS`0H*HZw@(rYm#cD|u`ZnBGD%&VQ!tdvX6tsf-@f0m9A?E^8IQJaJ?WI- z(4jfN?nx5XMp`%;Q3)D}+LdN`02QQymHXcb9M+M>#Ce%Zj>x$z&I&O|3R&7PPD>49 ziS%n8`x-oGhiU*f`FSOr$=}CfXy+7Tfm-x2!g4OugO9AOu_H+!ir?dmv`09dw@#@M z(Qf1mK0O5-(;0F~MnVmTl8If8#J6+5xIa26nUMm+;+F9j-noTO_>M53%Nh_BK-t)c zl|>o>fMMKO98n{ad>qw}S)*!m<Vo+|0QyBAD zEfecHG?87tc=MQ#Tx`F=b*SYdV)O?oagT=~1wqDuf`FQ-0^&qP5O!h@ZT@)k)j@Ob zwER~=kk*mL<#!53T&U>UK1Y(PTL{#lO&PCmO7_ol-MikV5FKf2pjO4PYf>UB^!pY z8*CD(4~xt>e9FLq%y7(#6~9QCRak1&#SM1<0K9g+?^xAyDl~{Xhq)y4Ue|Pm=Z^uT zXu4A&!m%mUT}L7QpcH39qe`8xdi{-i@$Ee{Z0V|_eHtVG08>if=mLIkZ~aI9GPfN3 zaDqBrMdMai0+muiv--4^9)MVTpY`L&Q*q91yRml2Av$z|pYVwZqvz!Zy?;iLps%$A zG(LC!c*lz|SP3=@O#v-2w55(=Ajid>Kx$m4jzOrORKWwOQ%o1kh>&-x<5eJEQLft( zkVpW5y${AFD5Gsk148yKs=Ve|5b4xcd3Wv&AKQa)lHhZZ-S9&`^!tF*E<9#B1iB-Z z`n5wQtwlkzr_BBCyK#b`Znftw^`L7-j&?)^j9~Eq%@lzWs0kh1%G!WE&>AE6@4#DH z4obi!q7OJ9iWSV`ypCA11=M9(m=)AVoKs61ty*+|LEHP^4Wve`LpF%_N*a<)F}Kf+ z>JCP)9FpoJYR%1i?@BNvY72XXl4I^gueWY4yb=cBI}gE1QVea9sAkVGkDUf^L&~V9 za2?h~RRn1k6~}RP!7;6xH{uYv3V}u)ElAHET>-eP5!*mWqZWV}9b!+-RZ% zIyQv27;)?PBPj~LG*F6ZWsx;9wUr>c264JFw1~loKO0{NaUhej695{ZMrdkj66W0j z4pj4z<+TA5B(9(ld%|1eZ@uu+2CE}z2q&CQ!6&(89U{tl-|-oU*6knSGsYdugL?U< zGLm&0V0N+G-`|e*mT&0ZjnvumP7C-AD+UzHvF+M1b^id2{{S@QlE8Brl=oub5Iy|a z8v9wHf8UN%L{bjw?pjiICBTB+{$vJCJ=MnC>>PD{uO7q0F4c;Vriak1WbR zm;s3Gze0JY$xXuaGc-mvV zGdBVzu%f#(g;B`ogt1+u{EGbI@t^+HANNsB~ z7@m&G3`~D&;9c}p02wQTQM0xX-cJ#ttO^)e%)}Z2Bxv`m+#{Q@UiIz6YaekzPa;zT zIK~qeO(q<8p;2c|q$W8m0qRo3Z-2FMoDFi&4T(Pl!bp`asU+Wf<1S8bM5YrhHr>au0?x{jFkHv=%fu6}>`gq@n}#~#0!yBab( z^R{h(A=!vxe}BIo!_t!!Jr8LA0F+^W0^(?SbM)2!0KZoJOJ;^NIRH3Plg2>Rs2eNh zHI{3&Sv20%PaaLjn&NW{u>d-Esqlo$m5rz}h|5MmpWvMX)oGFCJA2H zC}Ixgzm6YDMO~L3?6~$N)g0MgbmzL)m`oQ)WfpGP0(o`nwhv zx&Hu8G?txK#z4<>q|6g0@VLM-B<#%EjD{9fG)X9o#OXEM4feYGaVkLojK_|}8S4bm zjPc^)sniH9mkR(uHbjMp3@hnyY*!gv3*R@`oZe_AZFHB8?Aa;{AYn>>-*;ANL8xS;-PE5dqvZ%2ok}uo$<1Q-LtXUtnQ>dAvN9+$Yks}pY6-Yxc z$z2Rcp{Sz%$7a`kWZ;?VbHF0Mn1_l`v(`(GMZd9kwm zccr)xQLc9*tQ@{X7QwNRsA(ai#+g+;wso(XARF6+P-}In1Gx8uZzjqvVzKJwMM|)e zUpNp5q$Pbs5lx}Z-`pQ=3Y`5k%mq#|SQME50Q_=JqylDk(l-?wJC~{B@g%(e5!j;6o6e1tA0B885sQ@MdrId5Lj^|=rJ>%qq~>R90zal7JkKL zHVD|O)>n_dEXp9C`YLm+J48(gT?7>Rw*T zGO&RfS@J^?pn!j*X|uTuNE=rbQ}u2DoRnebG<1cua{y$;L{V)LV}ecIxSCZqZGjdE zzm7PxtWQZRaT9Hj6?|r7pDj(ctb8nwdkq|#Bwuj4MT338+k$th!5c_a53UB_jpN1@ zmrwylFkNKWBF~vaNCXK9VtuRj;VvR_+M3WoZMH1$7D;BziZZrGGK8uftIElQvg&O| zNsNJ3Pk){|4h?NGe|NkUkP=88BfVih1hbBXn?j2J0BkytF(XlU-#-yrGkb13Z+HFp z_5PZMjXziuF61cx00{QTdN0$`ynKfoqT4qxbEi#OnIN!qi_#x@9kw5`u>9FHz0z(ogo$2d>-GkXwJPk{hsurgd;Un09oOk9d#WqEK!L8EJ)R?u>y|VWOIv)4_eS9YXlRW z6p(W9t$fig$`lllT_ugex4FD~09MB9hfB|eT0cuxFY^|RX|`yB7eIaZWQDuSBM{UVAI4d{^ z$OS+U=NE6kwPPI=L->REkeD4xe-K_QWGNzu)z0t*fYwH&kJ|h3>2$&U6Va<*=Byb1 z0MHjR0syU~j{IG7{{Xea!9Qfii_J)V+2j&z2yFzsb~{+s!v1fLD@o);agy47aU#io zFA_*u$X`yj)wr;%Nd(y`QY z@2hX%aI;{;&=tg&b*Z{vBl8cPiE10mkr35cVnA|RY6_KJ_kSErQwv2m^>{0za^cXT z<;Y{^5{20^apsLhP*+xYv=i#1V5u7$`QlVRM%#0NRKRtdHV~}m%OQs$NLFE!q(_u@87+<4xp#0JLLS9vZuSh6Py43kaycuwM? z3Jj!^u+tbl{mt+-oDQpgtV+5=nn)R#Q)kX)l)(;=T|Bk`4S^;}TJDCSr9Ma;RW`$Q zh_F`j9Aja(9o#~sqw`$X9te;aFe6yw+&7(;>b8A>3#)%_{{VX{vXhA>TzeII&w-E~ zznUkVBBT+-u0u>(HIZ*<(6OFcz1@bOEMETnEr6F3u@kH!ZL`PTfpb|59I_-qM>c6s z)O|ScDf1W|$O`l|R@zS*D37Hi>;v9Vyu%_hD-`gVojK3qFp)ugY3s%Y>2rJ8$o`e-hj<%TF&aG72v8Dy@Rz7lHy5*rRUb z5D(w>@$MR;q!|OuuHcFGZ0!HR|>#Bn~uhp|Dk4l4J(V_wFD)<_a$he(~!MNUyWzOG{TLGFJnUs)08e1KX zk^s8>6YsFUZVPmy zBDcNKiyx$7Z5;F7Qz;Y4Fiee9n~)kr!~p6cr(_GY(_FT;3lfEBZNGlvv$X1$k}YJ{ z1I>VeW|cES06LynqiZ$lMrg@Fup*Iro7?Tf**dPiK=Im^>&csI?}rUfX@nr~_Jd!ls!m8CZ&Rv0jawHT!YqF;;uT*>$MoHx=kU zR8~%0;=>2V$JKPF%!zT)y;?yfSR3zOZan>26-LN$T`F){tF{$2X!I-fH(hJ8({d2pJHd5zgFJ;gZ4md`yLictZlD(E>ElAqI#ZV>fZQ2fo+BWQUpF zw`M)aS)50ck2+GM(3sy&)g0SwYlBrdpso zgY(C-^xW#{=QwS{(f$)c;OGEOjQ|@8l|LJb+@0o7^|lt+SN3@}>r zJ%Lo`45JG&O(E7vm1B{Du_*Jjjpi`aXp`7qd-mX{$*93Mj|ET2!Wn}qc`!ixvr5sB z+E0He*1_9xA+F!g4Xn~!=L-n);Gt`v0k`r^N{l&9EamoW>|Vy0h*=~dODMAc09UuZ z_AiW+^o|jePl{$tYlhMh47!&BWhTMRR&u7z1CmOO!xG4&>^J*x3^7n2-SS3YwBPF~ zvLrbXM1<(_SSx~9IS7nd*1_4vod2Y zR2C7^Oq_`%vc##fv{30PU6l9VZUM$CkVe3bvRD8a zU4G<*uQ|w#BL_xIt`@)mJWNi3VRaQ&J8mq0GO#>@4A_M!$f*EXJK;z&GBPS4siq)T zQhiZ~pKxq5fYnuCjfZ|QQ~|99Q`%+Dkd!&9)^0p3ND#_AvTUf-@{$k_K%muq#;*JE zu94@7-cn8cbL6@4zRsZnfqv3qb-M!Q;D`zJ1hFFvq~NLZghg&k-3hyj!z_xiy__?}f3% z5jzTwY}_Sz@tzqJja5jB!l=j<-o#a5Suw7f&xo=XPPN2DH?xD zMhYnQEf5#-c*}_O%xn?holImpS6G~+@nu9 zz?Bank@0zkQG2md5Phw!)pZkE!-Lyz<9oya`fNVMRLN_MW}3W|OrbFDBrc#gbF(IVz6nosn{2loek(2TkY6+WMUVM>YVibu$4T{bdSD2k zNB|z-4avSeKcy#`=xqAGG+}=UT%8Z=X}|vfI=A8ragLy$mT6Seuu?Q=0j_~i zyAPZ0IPwRcD#^%&+Z@uv7KI5OR!sWX%cCjX>Vk%rA1Wy55?C*mNjJTb_Tuvmv`Dv2 z(Bw!v3YQV@4C+#$-y%Q>79&aHK%kZSU1KNMpZW`jKRlzjm2LGxQ|C~Yk0b;BW2{sQ z6RF{o%q$s&kQjn5({;wmC)A!YNvJMiC-cd)a>-;?^(-;!KnT=BNQ|vi5G;812IQ0R z#>y9}1Y6JIlTgDAwsG9B4rs;Xg&yuSeNM)f!w?7rgR05yN#A}w1ukeLZ(Qnz<8&2- zbp^LG%^`G=jpeIuK+_Wut4)LHbK1up+&Aj!-)iSnkoO*i_CJ~;kxo4SPca@a72x9U`+O-gX zfDr}h493A1+P%28hU+%=P|Oss%M_W}PV7hx9^e*XBhk`GuSV28>%SVR`nhaMXy*;e z?5E0}Cy)g`eDXOOih`;uLV;T>clY-A;0HOb>K$riLFq(t+zbg^wHL^7Rbc9hb}V!N z!pqjgjkfMMT_N<18vyb|Ot;#j0c6O=i|TWZssRGV=xLm6L6dF&0Q2HO4STH;tiy|C zb0dKH0mYqc8IF(_QkPa1D&z9S-|fT#&5XG7Rr_OVRq;X0z6yA$3;MKlZ%`0@Lvs~p< z)mn)KH~2rd3$EC!iv(D|j_|IRHk~iBm*sGej-VYY9!jxoDnT)!Q9zHVpkDj$^JgPP zoxH+nond6TnG+nGR~?1Tps=ut!Huxk4MdPgx+b{MP6Hkih=LJre=9#M<=}2hNV-k> zbTsN1oq?i3AFv!N37O0@ZcMJ{B5fnCZ%2@10HGnx&aR(tf`%1Lv*3a%=!B#0TFJCQKNrf}ssB*;Spkt`!otv-^j ztb32DL+(X!k_Rjum;k0v(dBa&Sv9_CG1313j~;6nc{+vBXkA=1mPGAdi0Kb6ClKQ~w~eHPsZn8k z#<8dxEFyIjFLV44JByaTSY%g9jFv>)BQe5}NtX-9rm`7~bVj6*7|9^2012ueVeSVB zE-_5V$uI&5k$GBIPq@$IapTFT%Z!bT)&XP*bhZE*ghZ7;JacgalCQ0>-D;*w*juzJ zGee>WhD9wbGH3)@uvp5BrEdQKtw+V5ZVVZAu-m`2Q5*9{@Upcm5t0v_o?_6Z62wlT zmRNd&`hEB9!XDe6Ge*~54&Mb%NQ`{@mbQ?Z^B_3-A76lUO56`jVJxjW+w)R;YOa|^;b2amE78uA#UDjGYtzbnF+_A82 z`yR*V+UXM4l0=d5@>J<91SNb)3uWWTbf|fewEqA~H76UGxJwCZIJ?cvaW~O?JeP-omTf zf)H9r-N(5A4i0YnAzZzcag6{>Z#J8|407@$ZAQRgimUOt@58DB9|Z9M0Ep-(%~jxuw_RVtMvIclSx%YWR#3ZWXiYG1 z0ah}3q|xjLz~OZa))Bczk}1yhPp9Q}=H7dtQzS4<;D9|-I9JvKU1}f$dkdq%*AYup z8G=HpWEztRzZsSc{EJ|wNj#7P1Fy}YASKq6Dm;t=R*<{lGx_+rK|F%*#N{b?Qb$kzYykT4sZ%7Btxt`e$Dd~u214W#Y$7@)f}1FHQRe4B53~reYo^`aGpca))57| zBM1Bzu5JaIrylwB@s-d1*AE2a&Z1?GBF}9eRFg1M{#eRboi3~oEQb}9*D@-_F0Wf!=?d1uiz+A^NH@)|na1G3ixRLmWx;E9C5 zk&=b>=UmUzv6%`Q7os^QT|)K%Y2W9IooW<_+^m?W@GfO=RpIA2v5G;Hj?f_*NYokG z3sD47RR`yY2s9l6;L5C?0Nk1|bw89OvI__#J-}%Zp(Glk>Owz}-nhv41jfY1$RM1h zbbvU@R$v1_*;BonQ>9~u6S*6iA_SZFKRg*AFvey))BuMG8BZScxrW|zyYtLrEH_`3?5tL&%1=b9+ildh;sBC{~*%H!YNqW>_PwMUH|uO^Xw(k9)EE z@D+}$X|QgTROGu_cB>shBhQr=Emi_J>9U=72uTIa4Yds|Lu(bqP!Pvei|j>G?hF|Y z^fwwm@f^t3I`VO9IM#~~Gj@_gpxX%JVouaI95Lk5VV_vvk7@>ucR&^ihnUKk>cK$^ z7zq+r^)`^dPQjQcB!N^${m&Wcg5x&2V~(tWmmTSLIl_tgfj8u%!-%R48KtFpfV)*x z*j({ zsVewW0Zw=LjE`WDc=zHoGb0LXUT(oxz5P*H2jhM_ev}Yt`Wo%0Lt%dbT-^{L>A|z* z^{3tz*P2oYc|3YUH%i%f;F*pdJWNVWtJHXJ>zFxHW2_vVGb66-AM zo+*=9m)i1-;d36>RH4%EH9|fm7khO+hW0$fhyR{jw}PX01-z20Dk;; zC=F^&3!hTXBy3+|x}l7HS=Bi44NRQ#oEC8Z0Of<9l{=_3!L<=X_7}DB^4we;P9fyx z_jj*bMEx5CeNpU4xsZvmaturv8RUCJ*qs3mvH(`nExqo$@GNvao78ZSM%0;t!aSLn zdUQq~(^l^sp@zg*Z4K@3+l|#khT8IyGbU7=!ep=OBG};4YJ; z6seFC+<@92`wHxMBl@r>Bgb-~8q#+tLkT3z0P1AOqIM)RrZ}N>U^}p~dvHgZDcaHE zP{fkbZ#;LUFA<)+Ch>AAv>g@Cln^e8^7mlC3%yS*oyOh$_}Qai>1`10yt{kSabM7} zqy0B`EswwX>M8-cXy?hLIjhwyFid zt*HL|F{T@{*5kzsggQpRtaE1bd1Pb_D5^}4X2XOkj62$y7Qdbbl(wz2luz{m*q7M9 z{AjVLU~!sIG6MXo<)`KLK3atvoLsN|y<&8P&$A&Cy2&8bKxy@zjpFoE>$17{GPZAf(f zNiVHuQQ@bEio`UH(OpR&ebhH6o6P`_4v?^s+Vsf98KUWMtRaWh?Px=13)L#VK2aHzont77No^$I+B+))o; z-T@vAV_lY}|fpOMxz! z%@^dke~`^Yl&o=Psz)daSVx%|byo-Jrgqg=U+KbYwA7|Z&ArI!yHU_`DEBnQkV`9w z$E^s|v`3j4)dMl2Y!6M60V}t?=ceJRIoBR3uLoMe2~A@aCPG8uWhD9q3xZ8ykds>~ zSR%WvaKq~sk!J|@rGP+@u=XRF3Lh(%WTNjLW(2?~HK)&wO|{(wdusUMK*MUbGieE~ z66QQ+2=87}{6D%!()mollKofI>NlV?<||VWEK-8Pj_18`?|nCH>8gNiqeu8{UT@L! z8a;-8w146&Y34{20M&g15Y`lG2W<3kXYNZgk66ROpUnGjP^)8#hi?Csl)PjPh00c(Mhamr&fSgPcJ zC5==7KqJi3)=LsKC>wvuc*Fn&=1Ekn34JI39TbzIFC6u?0Xaxe3CF8VQK8 z<;c!h)sZGsC{`p}4J7{n8~5SQE|I_Bmezs{n-3GgRQY4SnUe{-b;wWw4s_~?12H6Q zBUbm=@4;2|S;q3Iu_xMz${l%p(CMW}jH;GSlQD_OQdsU~)402<9|d9!PN}|k z>BkAqq>QQ3RdI^x0HYRm1Sl33;T!iOwNSTLZ_thT@$XBe>zi3OXg}g0H`KXslS08p zSc5f%KTvBv;3+>Bke{Om_f!6~boeD6p^ihBj=(L6*nqSNNXbK>5^agFYuJ3<>!9JN z?yfu1YLl!jwOPcLL!E;XfHbtTOitmIV+j_ZcVc6VFeBXWw*dW6%7l%{tJ9SE1iOKkIp0Zah3l7isRz6yvWjT zHWwnKR*79gw%_MswyGO1ncsV$J^0};k*eXc>uG~6J8YMsn8NKIMJ$R!xh%-UE1e8N z+L5cjxxeF$E*ij=<;NS6w%;^KOmct21zVYjk%=ut>1ATfM%N&(aeOM^Yerdd>_jik z8&OV9-ej<|4^NX)F!Y^ilM;QUc zrAP0uwjbD^ZY%=o6ys@7+N14~>PnoP3zFF;LZ*QrmypJkz>3z239jb8c%N0~Eef4? zG;K^UIaqTUG=UysFs<1`Iy#-$YCouJ{{S<>NRr9g6G@G0Tou=vWHfmE%0whSMABkF zXckc$)TCVsj(Kc*Q18T~0W`tL2`W6me@TS8%lS-Xg$OL6G1LM_ttiUDfff#AicQ_B z9k$y*Jfn-9mVA3V(xwKeN|u^dr~tP>NWV$!Y^f}L_TxLI zwNe1v9Cs#(V;W9b`*tN9x#ti`lH?4G=|Mz#unw9PWRkycamL0pYia?^Xh|fHTyrHg z@?1~w+yLxLWaN;MC?GL+dtpG5%vh37Vg~zm$z8^)4}?&7X{2H5UC_BV(<~siHkfeN;CFxB20<-3)LA zQy`JKCwOk+9;y6M_RznGKN1U&Y@kk|&5UUx!6(h{Ufg&6B>~uPLLmPD!Em3$3!9>h zRP=y<^Xq;kt8+ChytK$P$rc$3`w$PAwcjL>_w<{Y?UA`-<^E#xPLaQt~ zu!Jsv2W?CNqe$&*{X^cYQ2E^71PB!ar9*a@3Rtwn@H1(UfZ#2Vn$g1o2{aMGvJLHj z1BxWLJ`I%{7W-1f$>vQYEcyb%#F9>{^P^-Wf|nnbjClq14 zo&-3$VhRb2Pa_s_q`-)>0yPv$^4iVS5yq@Pug)8L(rQFotzg{UjFU2zuhuRN(QPu% z85c@M#FKk=qsM-bAV@nq;d37n<%4xP)_zbOjBj>90a;dnHb&a2w%mP>9qcXXOl|XA z`m-l;`yvG;2aFJfqd1pjaLb>&D9uBl%+!IS#;Gd zlRc`fkU;=F5PN>ybiS(s%q4zu(n4Y+kS31wl6^X5Vo#(1!D1t~&$j$VfE}&I#SYH2 z<&7c#0A{4jnSEzIBByIET#!Ik1wd!*xgh-UiQ+KP+BJJ%4cybnY5B5@ci zsFsaNBIz5dyC}ZgM;};7iB!=6y+|e@belLD0p)?Wt0qZNj-k75v6}WDZrnZb6wg6R z77in!E%=7$d>`>@WlvLdXHrB|p1^XM>9+LhR#1PQHE8CR>75kPZOb$91iVlO1C2lF zySZzACx!n2cpXs0(N1y9kP7SyG7xqbrcU1%!toQ!S7;wwxT0a^v#Y@_1H>QzmXboNnBifA%A#8%B1QmMy-_+g z-K)&)L;2#^4zq)X!N+0~Xep`M#y{{X}4FC+ps5#YR=Z0z!0gXmTfOtG;(VNm*8 zeLA1hK+19p94bvck$1LP=%hsT84=8L(J+zdDqgptV#N+D5**9(4T_^Br0uay*fV~6mE%i1 zi>;O7l$!(0$11wjnU0dt0!Q7e?Z!8aO3rIXH_bhyIe?SELt;-P%(5u}ImL2Eq%5q` zLd;shB49zXHa_QulRB~1fIyOZz5YnIBUPN@;!OKRofb0@cCoaoRzOW#G;G9?xC7^e z*O9LF<*H9-nq@H{3B35PBzO#8{gKU4W6J8zp;Z>EIy=?6&luu{{WPBzAl&R30C9HXqzBd8l=sJkbwCCK-6fF36E+Ox!ikj`kdAf z4nYHR2>xQp2!%lOE<^@BI<)APL`cD-sP{EzdiUcq2yu4!J%KgT%^M{-a#@JS#BZbt z9YG+N^c^U!2_OraGNbI=WUM5*`x9xNXfem;sdL%g<-$IrQOPj?A5oT6F@{nG$t76! z--4jfIYGV@s7Zhgp-{reSB7vwB^ASW?qp`W1R7Ari2gnJH@5BLa#%7H9H&UjWPKo* z=0yw`Zc*;fYpcI&TD|x>w_t*HDyBen&h%uTHWa9Swv0mPiDMvqXK$*$ZIV@Hxw>4Uussa!Hzur)xZtqIP?C3d*$q>z5yoph@YNOioACz|`BJNX zBRo@#Gd0Lvvw2WSBqIG1IuHA#1NY;%r%4q39RC3II8WgPivR&SM)H1HU-*t%48(d- ziw`40w2eumN3yvz?Q%xK=yzSWOl>I9CsmbnRmTh<(M$2l0{`M2DSBT8vN6z(r76_qybf=aJsb}ld}AkwWB$@ ziZIY+x(`vPkb)|;%#!ZAp2{!a@5PcF&`wfS2?WLe05xARi}S8vVj)C}FyFhG8eymd zV$P}`el3y6Q=Nn;?_Kb#b3f9ODNr3QVsWIJW<%zs)zcED{^z$0rM0K0x)8o5$*Y&5 z%G|~@C6;(#mNWGWQKd*)A5?%Jx4#)GNEFG51gA7kxC1ad6gN1A zDQ9!;HLu%-R3e=+Ppo+Odl0l2J~vub&VQ5nnc=_`u%KD80+D)0`D&+b)+ir?z+uLt zT~ay5!4+2*I5c{p48z1c$2JCSKbONIR$@+x91V~FEUG%&R{BS`4tx1F5j^K{$Gt71 zS-@-^sl{hli|056anQks86$bvQ6OK|Ng9uP{f8K}WCjhU{aj?U0}|u1!6)Mro0R#p zQ>sWE0}E3UH<%rUk}6rovGeKM<7=Uf6x*K`_73up2C*(B2+t3dB)JS2nPg(1*=Yg- z60MD^(=h;Sv`+jsnGMxzb|5B6D#s>fY`El?TA~1QLe~EVPC;UTrkV?5yp$|ODHd*X{nCtuOIP^Y~T8E)SZ_Joq;jV6rg8e#0 z=SWukOJe4TS+Nu%*cw==28@|B>KM_b^nrD^emt!s1=r#iVdE&>-h*>l!pf0^(inwM zq*zgtEX9tkH(?si92G1 z*htlvjI0$2COXh*geNmBtCd)=;w09klS|~XMpcElAOHy3{rJ$*;MNGace=nTH*pCg zov4Q!B$n9Wx~i59q25-6vV(irCu;q>ak79eb7MK~2^BJTSBk*-*wZY4>5$B4Bl=Vk zJ20bFM_Ks?$DkXe|ipi45^(*|%YjeAkC--@Jl#1U|*;55jHNU=GeHc453 zOcg~!v^5{1_tFZo-|jfvMymh<3eTH~*(;=h%SyhhT(x3Xapkm=Mv6gGvlcswy+m+A z2CI%*y~?j?H$R?tk=f?NO5Q%wLbG6NTSmlJQrA>Pbl;x#K*bf^Vh{B6;!{&Lat z{wqHdd*vq={TC4#YP-0F^Ba_*c`_vwK{mj*{Qm%`J8ZNGKRbIKKAlv+18VYY7b|$_ zCJUFWmRESyBP8k8i5vx}kfZ2ZHAeX1Vx+Kwc)I9PvxfEP{!^}pu~txi=lL9Yy1dd`xRusnm?t%_h?()E^7eF!4=qT)NrXh_U?{)E1AF^l9C-oa zca^sAKv!|&CPfTOE91=Sq*$pEJxE0`rXh&G3wYYIBIr~xLe+C24U0ZR)?kwMz5{O`xS^x5Cfk~8Ee z`?)rS=ClX(c>8bsZd*=!D*ph7sk8c%Fce1WVr8&Jl2+7v{{YnaI#=bRqr@)Z$)Jm= z=aJ)tA`K=-R0Tn;#DI2YA&U?I?R*Pb3&}gBRyOtcwDxjR5a{Ct3Jbmkmgiz8~~^Y zaNddKNM1<+)~gO)Bt|*_g^eAgEH@0m@7xW&y^_EHAml;gu^W#4g*IX^{H81=N+TR` z9>q$lva_8+sg;Wz_8tB2jISK$J8jdOb_UE3a*sX0j{xWl6V0(9re+kI>`IML_9WGw zErLt^iaRE8xd-K8NyrQ-3T(IBuyiY{eSkZj8&big15KPGAgYJ*^WC8+BQdd728e1b zb$6|2x!UgUf&i8cWH~w`VsFC5SH!`bk{HUqV$~H?d3?a2xCctM-(gqp##)X#&KzW( z(Jg6NFs(g2hc$2^q|OPro+s5T5TB#}uv z0Co!)bz^O!tN8%&Y;LV1zQIFxfHTcj=M0i_Ok8bryt)`teG2Xr=@Pqw2?x@|ZVeB) z;gp0@E{x~kh4*_v*}+yhc9WSj&Q7IIKtbt8z?Lz9fRKYUC9UdM_pz9Fr>-U(E2;r79E-PzNjH+1$ z*^RwdN>qga-)f)-6hU;j7;>lpv_!RWp>eW;Mo*J8MpXiWuw5FIk5JdGw)rQ1C$7mp zupvy00b;8#Z_i9k787D>TlEE#%aGUv16l|l-?8H4a%~Z4J(3kiK4)m~T+9OV4?jt# zidnT$whBp%4&^mF_xpTtZ6wnTow4yyhiQIaED5<%lNU#=W4Ao-@U9jZXQ z5Qph@uyj>VI=cfJ>@D3j10;)vBv`@CKv*$Eq#fV$qgp#X{?s{ zq6f+01i8Sy{b<_QAOpu83Jz%|xfhqjO2dwfvdOp#2&p|lf0*h>8(7vT0!ha#I`DQ$Fh@b~yRzJ*g8$w1DUW8Vm`;+?=%cgkawLl<1%|e)dbkXW< zF`zLm8q{rCQkA_Iq28*flU!MTs5ZWSNCRg)g0(g(Va`d2A2kMr2mv7d0J5EcUsYXi z@OKuxy{*2~#{j}@b(DByK<7V*xecpL_<`{}KH!jv&CISz)DNMJU%l5Jqta;<{SOMf)O1%rWS+73og+I zMY0rqLN#OpwFeYUaowOzuDSJg^(+sl(z9h%48?HDtBURVm0)j2SAFY_^#e47+UuKA z&*Pzedg{eV`lqWuRz-Mu?>E;P78K_@ApvEe1KF*%72dCpm|}?-s?sc8d&>2c$aN-O z`lGonCm zX)3V-tW)z^q5(FqD(%?Oy5WEl z*6SUIv>*@+CJaYEkk6JF$o*Jdg%NC$CA9)Z{$M-)#N7@vJag%Sb|Yyat|OsK&Cp0W zQK76uq<}1)5vm}&Z=lIT_a6s|M8U0Vd{xwfDaLSz-Ass}fAKKDplv}~EkVciX|@Am zH~siz4ObYnPkJ1PorMSSHYSI{Ulcsm^d5@pB{mHmJfAJ7R=`_nMFfi9+iKxJi4KjvGMGWQ=t5CK;N^t`thm_Ig(QKgq9JIKZHAL$ZT|h5 z;!R3oMVwOFWv;g6+XyT$Lnu+Hxpc_oPk%QfB(C59x^&%|@BHy9$#a3&@z@8Nyo5$! zRmo*pBhbKjg5=LZ?dUZh%Cx}UYAeC^t$dM-lU$41twu ze~GCWkvK}ke#5($%^sfz&Z-pNU_0*08C9r*u~o1*`febdP~v!nRCAYCf<>0FFHw(-8i^%#F zPrmeoO5~AXZ(9?%B!4AZ@1`Q^sYq+D2(~OTh$AZ2_LGJswRv(!vhEp9&Tg-_!QoDD zk`7rT4I~XxCp0^hewR>Syq1zh%;H#@F|0_BksHW18VLmh@3E?`8&(b-;28y{-yaf! zoQjQ+c^&J^UINImbiXo2v*vYgQ79U=MQr6(I!@ry+3!M+zaIC~aXM|ra-m1~O;qgfp3zj#!X|7PB&LL31O<$gA(D8A&FF z*WUPTF)hyMAI)?eild0Ni#*S^spc0~Ne+@py1V+T{{RjN=bX_S5HuKZIZ7VH8Re8R zujmjyrW&O43k3vN8Yuq&f7^zOG&6bfLQFWjWGxCZAmy=YEUgw7xZd>2{*z>Oj<)Z7 zbI&@VJI|8TEZb)YKQ4`+ha)V2+EinyT_Kr^d6O|Ur$BG0*}X>UxNSllTF+_*f&-nD zerRVVEi2@62@S^#jK)Kz%oxi|0Ap-RF$cYnJ%~Iuw6qF)$7xHZB2|_+v)1nM`CpJ?fkUIq+nzd1DsDXJQqzXD|IM%M>UL z18rf%d-fH*dm5?$cmP?UMwtZfC?;gbE18OPXy9j!4G_%8Ns>*Jw#^X?I0>IL;#TI}CpGuHO{k9xP z=N7k!B~-wZa-s}dHzWYoa(R42ogwZxW0i^TU`IO_ z5)CF>)hT1wAR8Yff2SW=##ihziqm#JZNg|0J&lvXF#-#tGAG3{ksRKG-iJ$$xqR*M ziPw*VJkm~g3gu-ek+~K(DyVzfrvCgeIMbo6wZhzc&$S5z)FWUwM!Bv)&>}mp)a%&j zRRp7LYN`}ncXb4J;WV0N)=a2I?7j-78-7O`Z23J?%tw}t4v?<2h^?{m(jWoTP4D}Y z#=C_!=di- z`dYvsvG?!6(iU(Tmq%nEah%PeMV{etaYT( zSWk+#WX`2SB>Agmn8}Tfu5WNaU~6hX?10##U=AG61c9)W4iY1&CG$y>%R&KlMUc}P z59Uo4oyNqrn(lT0?kkP7noEx9@F@;31PLn=>M4p(F*eHW9+Cr41Q$S{4#CudHrswX zSZlO&E_Gt*GnrUFP`b8k&X!QdQJ7gED#|DmLiACuo;%oa%!9^DpI0-+#r4ywWr2Fv zs#iyo=X3sb3#k+j{h^ZDsX~!#KtAK+Za!m+2bQn49#3lZbR&|d($Em;ma!Uuc@WpB zY^Jjq(x%HDCQI*nxXRPc>rX9)f=W=9V%+KlwbCXHCV<0lDWGCK(O$)ma&O;_VW3er zzXc$kf3-wR113uc>Ox3R2ngz2Zld&+vFBT>@LXVlJ}_S^T|aZdd);N~7ry!=(s08tJfvOUnVo>l~$zIgPr41AdGwiwI|5Fee0Z5ff)-e&Dn%M%HH#$oUv3vL8Y1$0 zAr^YVE`?1JMTeLF0OK1TC3Wr#GUTe7G)OF<0bToT!Ef?h$xZIqaigNGb4 zf0%L8L8E$gJ2+dgEgSy;J_Y7pU9(vb16Dc^X8laK;v^9?v5PiIQ!!R7PWPrEUf0`) z`B{x-yD4|yy}25UR8qb-nU+yxcQE^9-2oaKXAzs$fPE~D6&3C_wC0E6MAF;x5TcE zArA&dOVPZE)v~dQwxwAZ$QXjBL~3>#l==m1J8iJz&DR7q)0{4&2qYbgS;2}#e1#4) zqKK4Nq=uSF6rIVYTH9{lJMqe?4h=mrwlDxodeb{1$%O3Ae@n}bHX_ITMl6P4E|4EF zh$nJy`Qsouu5Ggiu!PYjcfjsL`D8&kUonDBDy<~TCaYo@6)Cj<7@Ll$9f{mm4XW>? zrbc$-wF?9>z~z!XgDE(saKH~C)HM@k1z2?tQ0&NS-p?7{A@D}j=AK|Xf)R-+m!DxX zdO*v=N7EPw>1E#t;)>Mw8r%KfexeB8%(!)o(-0Dm^Lfo@W#<1281H1ilvfE6ThA^J-I zkxW8@XtHV`*J1qeg7Ic^&o7?pr7o>(H=Ot8+V$lGcmi?!8Q@7sm2 zbKGKMxPyNrP9U|R3`B3qOh`+7b&fRzmY_|L0J}8QJ?QY_VxYORr3@WYBQ@I_B}~&! z0rJE!*Qo64I7LDL+?6eVG&>SU6y|dp(r+iZSRfL3%@*bwWXhRXS!^^Y6lv6Fi38Hv zCY~!l{X_QQ6w8AeZvo2P8qVIEuvi{d6~yz@K}XwzHY`0z1=``UQ^kpxMKJ zzgykhgq=p}?n->tX(c$=3d2J*DpS-;mvYib?LmPq)HWkXzBNz*rPVhB@JXmlfC4F* zFXcIV2*pU_@{t2)V(YA^qIEQzd(d5tcT)zvOPgjWFQ^E`|$d%fY3y3_uZ)WQdSR1Q9X| z@3#U$icS5|-l5Ip9EnU=&_H*8Y#P4lbUl$c+_}|l$@_rGZaQPoWe-Ax*ANZ zD##XEA>90NRc-+$d9tG{U}q?v%=4wxN&f&M9EoFvSP`)i>v8j_c04K0 z4s9?tG<)OnO>8ypCuu(ELY6k>xoU^DOxnHeAdB?~YpS+YzuV)6k|{Lw4)m{G*Vk3>p0RRWU9+RmeU_b2A4+S1BSarK-~o^ycMJQJF7#aJV@RWbt7F(i>0 zP(u8($UBdP1NX_w5?unzKxBYs=mvfavPi=eyGH;krEL*hk-UwniQMjMZ(+mO_J9k* zQ`kx7>{lYk&kzA1mBeV}QC3F+*0&S`Sv!i{ZQFn^X0@{@gI}v~s>zX?hy;>Iav>#F zMPO6Qq87rq8?B#B@4xUttbKrkniA)><h zr&s{*u{-hSD7XPs6POl~JVi+3;OA-6~alVzJ zGd~rX!a)<7$GV$O=2!s4>kb?pSLLUtNGH=yE4^CR9gHYCq|KHp#vDfVgLCvLlOjO z(%MatN40VDTtJLPefsY2E7a1CMx5oUJ}SJj7_jFKb+gYDOyHIVG?Ao`i%l-o7~9_d z++qM1fgEsFnFXZnDK1c}&Z4F(IdPRsJ22`iLHKT1LZ7$0QOy z>PP?<>_{KIaHr2KH^+Lm*`&sPYNS(9O(DmZmo#AeX%q&pdiOhBAGXHeKXFDkFln#wzWkcf}wcy8y$m+K*MD-kO z4SJRNc5w}7>I5+r?g78C=wLp0(WDy+?EFK?UOEPk#ZUNd?ki#OBS`0+c+9|wIkrs2 zcMK{-2xtm4#FJDs@T^Dl_lU{m6)*-EZh*61S`{G5iCTk6j?Go-F~u2?YupfhuKxgj z2C0`Yoq+hL!D2!n>e8lEip5*agrcY*D26xqvI42GTa((maIiy5L|Xl*h@EShvJR60 z4q=gok2T^9yB{tsF0wFETWv?&RiD2OaDvFrJJR+W=6EW`602lH?35Q2wGGjA#Nj|% zq7Vh#tElsS&EyhSrGvxO&bh3q6tjMLa2rm8nmi{p&0s&2G|dQLw-0li?v{#tD#JDft}t9dFkNs z$&AD@5sxFTpX!-RL8^lrka}-mYwx!M5CPV_-?4P5Y@NkynC@oCQyZ*dkyV&B$c8Cp z2hs@*8zrAe+yH(!<2-7%95$`M>o{uX`KGwy3(HuspmO06irzrY3}M2x02E2Jfk2+# z`AO&7Am0SomVkGT(^^UGkV&6red>ZKMrVsDtc1y|{a$U8kTSY>?nG_@msU z$Nmo!>b)`K2T@_PmM+Q|sIpMk8S2k0ZL}sb3ql1BsJX{4C|gu{&}jkKDIRoSxpU|Q zJdL@p`tbJ+YBe`%p5&lFdk8n55WL;sBw+LoZ+}-J?<^VYvix0VUzlx5O!EgS)phFCL?g5lZin@@uA}`YxqNDh+5Y z*zI8O$6UCBknch*5{~9-{NZRp20Rvu!7Zv-rc{iRUY|+*&%Kexc1I_BlJAN)S<*HH z%a5#b_E2={#D!3UM6?sUa}_1`1x42Pwfym&->j3A_m7Hbkit3#VNi1*OzUE$Xw?bW z5M*$rcNPGN)L&t^_r5Nbh0KmVDmyd11ZOcxnt-V+@;Oi`ic)N=wNVyFziQ#YNTz4= zKrCJ_D(5Uy=i@SvJc-$yT@4$8K|O*6KiKxOz|}Tzi^95N)xOlxKAEzi!~lgX4x&Q< z3~3{vB?@Q(4Q;;MWo?>VQ=RJuLZ#GA9GU#D5MP%Fe7Vtnkg+IDg&i!fAfxSje3oIu zn@+3UnXvYusRhk$H!&h_D21#Cz8KXm~W~HK5#}Y1VN&l$`G*ys+b?ksTUBY|kRI z3KyqTPDmH-c&aRbTz0E@xEmGTRU2c>usmj?gu5WH+R8gQ0BHrZcG&LR1yURw;BHTi zl%^rT5MgHhA&m3*h4_L<(@B5CZ;RS>0z!eGhJ*?Q3a6ReY)xGmqM;awQn*N04dbUH4R&BX13$bRUFqHq%NZm zIBt|v9y3{2e!P-G_W@$ZeJDsfo1tUheiZ1I^>?BlSd6@qb|W##ndCN7c@f)6jZCu? zBn^h2Ro>fv+-!B2EwjOAZ>(pFskwRm6m~DCCn8sMYGw+phZrlhFQG^9co%~vGXgux zwqy+4rZO8#nF#|xQ`m$orcX;*p{>u{Z{LjB7#j*`Fbb>ARxF4=GKI7%FU=Ae7u#|v z8teMFIx^Q5oY2*R&|8ubjVT$q5~v`qMjk-kuguU{fbZLD?09pV^lb+AApkzH+aRLc z*CnBe;#w0t-dzL#0OMsU0~7425mC0+!l?~s1F|Qx;*OyrK+Z~+l*JY=E6K{;rt-uQ zh9G{C)C{JmokrQdNdtZcsdMT8O|$qbWCl6j#T*fSUjli+yotz;ByGw5mDE7g2d`6K z!1%5RoobB)^G6(XC)o2U>EmO}Ob@A3g+kIM8G> z1f*C}Nf;U@Qk6m(*zUxR$LEXW+-%}ASITBXOsL}KS&@{INaT$us;u6SMc5&Rr8Ra1 z0r%n>Y`Z}Op$~rE)muJsl({J~s4*dRkwT+2fYZh%(ZF6p2D%kh0#IMrQ%n2a0;JR z%U{~Pj+$f+QKKSIKkD@=T+VfYg6q9f$sz|kAy|+ntnLDs%^I@D_~EpgOF@eOJ32k6 z9APH3Z9Xj1J4oJcGb=I`VdlK$Mvy`SafKy7Hb=L9HI8G$dVG>I2KyEz)D9OiP5nSi zrA>oq;fV!~$ktucuVF@wgxbK_aZ{=^In&3%MJC{PCUM zs|hwA0+|wAHW0627~7I%-knBgAS!}X7LH#|!>|YU`(EJvVO@li04oG?Pv0m`3Tnog z-)SOw8)My>iZH!5xQ@k--uB_O4?V3J5QV;}cF}YVR!7B>a#@Vo@gf0WSCnMF*Fc5$ zt&bWB0pJacp1Y-NE<4p98Dx<7J=anzjS_TkK6MXd`Ehd2Vl^z#?Q2LH_`dn8vCfPzQ|ozv<8?2D{+#@%H61jPMq$QF||pJGP%{QiVYX^%Q-B?Cwmi~AOcZK2jyRn_J4Ug9NcuzWC>^Z(o9)6&PO#@*Q)B>0OZa8~0K{RDT|i8h zV8D=W33L*>Y}#Z$!29i?;BrT)DWXVBJlPqtFr99mERe)m(xQSLM0Zm54SR8xi4AQ~ zdJ`W9SE!^96IoZFy1I?3^j}oPq!MVJSP2_EDx99fgjtj{{ZCGpBa2L zU$E~L^UIc+$;4_PB(gP;V&jrVCr`NxLvl78eHyo_@wOM4Zf)yZzbS=ef;&(Ln~fV1 zKdwmuO*@KIMc7dn-@hJytNF)t9>vjMmW!>=lL8@EDpW2xNc6D*0wjTT6%Gp-PuPMu z;#Q4lY1+CB$WG<1bj%9iFR7X+71Rn+#H?h{lF3;MI3vBEw;X&^q9Y=F!rMSe7c&Xu zFnDkyW>9hRF-dK-1y*MYH36$y#us7ieYnF1S;S^Scr&UuLJ`Wyd|8!=5BZgif*p)i z5;M@;Sde$ITspMt1F|JkIn8j&>i+;F$Pa@YOst{hU^XgM13M5b0=5x=8=b4;fUeW7 zOx;~KNXZQZFFJ!LDP)H-DA6|1ta78&SS_t8u?Ks8OuLDn{Bge}dTUTrC1e&6I6$`k%yd*kN~6 zOsNS{(CI5+lcrePNvmq52XokQP|eA8Q|L;93lq0R)dP1w`aGA~_MO;=9(U-WdZ`SEdwYB;5uqz;>`WTO>WOZU{^_ z0G-Ka2w990Nrk2XR9k}0jHQiMom5EvM;dD8>)gkRNVS4yLS>9PitL27D7Faf)kNu| zX8n)HY@`O0#`O7+Et+TL#fLA(kaiw>FgD(iDiu2bN{JT!;E~39kRDnS7q(O{7?#B!e>Jv?fkT5Hkw(dIM==bfqWNV(0)tApZd6#%iuGc-*v80>^4K zj#6nPb!~!WxO$?Ro5)Z#4YZ^{f^2%P@4{R)S_e`lK{m?#b|ubXkZ0zc(Vd7f;>NH7 z6uOsV9G%So(x5f&M&E4|*%YY(k#+nMUw6Lo0RrY3F6$z#u~;I7Ljnq!QHz${!78x} zy*nShaQbW(BtV(ty#tPBP`oBELzkkg$kACe5GAOViyIr><9a6dJUXBba|Db)cIeDj~6jX*sv1wPEhePSnSRS zBwbzc*V6=?KckH^eG!8`>H%cIldq&FA&jm)^<1>906)Z{$40$bX_8nHSOYwT5MQHM z8i@n7dsyR#P?1Ymi^MIg9Pk0!nc!D|Nfws18Lg|eGyeckrT}OF4}HIWGdPDq*>1$< zhhB2OfRLNrEIIgR2lLbs?#4gAhnGN%!{QLYZaC zEqQ=5m2%c>Ns&MY%5oRB>*xpE05t>u0IvXLuLq@B64wH92n0pE$?n1OG1w^-KwO!l zQhPC=>NwC(HKuQV3qbqg9Kw@{)PLr_r`*4y$sNyqBAciz-l~*yGCOmOiWiDA&PNqJX z)l?fa#fb0f9^`GoGzoDzDkcEm;-`*jAdMhh+4VGqN`*$cZBlk-P(UrRj{H#p#!2JB zT%B0UdVzl`A6)SXoY|(PEk^Y)EQ%wosGG6a_BKO}nqVrBJz*;1b4k<{jvQn{N}{7Q zYgR>v5sla0wIBL$29P%->nr6QF#;h@A#8|IqB>pMNjk$HGjc;YrYhsygV=BII>0!{ zvLh~QM${%|FC6j8KUNfyCMqxbT~vnLwJ*2ZhPKXZ8x#lCBWPHcglGQV@$4u7FOME0 zH4sH8=BH*K27vzn!{3iz=}a0vi2nfkY#{#t!Ey9N>uG)e04}ZgmgCHk;)4`7rlJdb zjVmL&1}5zKNCf-uw;n>74s+uC2~kv3)f3oR96Jml z#s#FMR4^lI6D)R|sNSb+MN=K9MOJxi5?H6|`Uhcm?ZbnB<%Ym#umlEqyWuMJ0b`I+ z6evWUm0f~@u7o!3z!IARC>`#&*FXpcZjntG1%Wqo ze`?|H1XOVw{7MGhfNfZBR3vh9237!u$jMm!Ta}wkrFPRrO4z#Jx8JvfvkSVr7doqX z@z$^|s03u>D*9<;0F&B*0D{DwwBK)Uo;?m1^>@v4s!W@&tUX~Vez@m8vFYag+DB7X zPxzKg4LY}=D3#cK``68JZHm~?1cOlbpUHZPMrqLdE$&sa;tPvA>SPU>iV{jHTgy`; z0LF!Wi22)pjxeyx!2Q$Z;jyV3Ov_qIGH0RU`P3x={cj~E=bV62{rBJ#rO z17={xh#saQh&6t~xI>K837`PeZQdv@6pbDe0HKQviIj#R8RVIyQ+m56msQ)`@b`e{ zgSJO^#V8wCZ$l$(Jf>E!@^dl608}_sRSrVmay`4)2DcnI%c}^qw4nyx)H}wqi{Q^& z23oFz>JmXaTXNZoC{j;g*ISYYeYj?XpPn!?n8Y*jA;*w3eSO@MyO!10t_M?fjaeV# znaFgVLqh(d(D>B)SbLA{#(ZF$ZB6>cGLQ6jjf4*6o^rH4Tn`k5OqN)Bfg@a?5kPA# z7M+KGu;42ZtnhYm$4Vv(Od^p5BbjPjT@tX4$WR~CTjWB?ne@&~6^ zWwk!TweYceqB1kwh@NR3C1fbCaKR7tY5q1xe`?8#gM`En+;?$bJ^3-z>I)nE^P=h<(5r^{ z8g&z6ZrptmxG+q8RpzPeo$JwDiYVWfFeYj;Z`dErxphjxf`&Ob*-ZM`bEkv34u%w{ASJ=GA#7 z(z?XR8`nt^=PF2LIQZt*X4e#?0CuuUxU2Xz#0Qui`^VkDLV8g(W*TC>YQa@isD&94 zMudtqL5+3;zwN?fGsTlKw$C&Vmm)_tK(feTO%iNsw-AD-y!&tV1p|vbeB!j8dr`%7uT609St5L3Xvpr;a5u1X%1Ti1r0j2DUicZm@AJhI&4|nuHiNM$I1MgSl0RF_&}(XyWM$ILzN*|3c0a!w$JGfCMzPt!NBV4u za;A-}m~p`bHJgndJ#|Fx%+YCtZsx|2L)h3|efVpj%x4Hu$b_C`DXAG65`nE~>GIv(t6&a+M0=mxggaIo;x8z` zGZC0ma)fMr>DG1t>ySoG5Xf~%Z`Djy0pEJP?|uTbI+JxrnvCYWbR)+j!BW>Rd%xrGZX~|mvwWf3ZfJ+y^S6&i$DaO{t7&TLFiCpv5z!KBhZ3K(w2Z@ z7nTStYf%mR{{ZD?9K#K{5`-8zWK(7fw5yRH^t^d48Hgl0#vOYoJ5eC`wE>S}Yjj3Uv`7(zjwiQXmA?77BY=1B{K$Bf^RoK+isPiQ4MmS4qRk5)nSH8y28reiR z0`u$$3-bX|hn?n`RLeJ@vZ(VA0yPoZy*}r1fAlj!fu~en5bKc=LVM+J9FaO93b_H5 z%3hFVMpR@_PLd`*oxud3YU2e?X$9GiJCo^&1aITLN1h5vBN3%#!GcZH4Mk~XD!Xmv zmLqNWwp<9#RlE>MImf|aUJ^>H&%Y381+nq#!~lZVPJ_-Sc?FZTtOBTeZ?WUo`cclK z=!rHTGhu%R#c?!Gt)@@^06w?k^In4Hg>)fsJfy{e(LjAeO!1i6i69c{`}+&y#!}3V zlia(n5CGT$P3F;wIcyS=e8}L8N>sA5H|5t$>7X|toxmG+t~Sy-wOrk41f88LJMJ1m zw0J7`<$SynN*mBMtuv~qNaK(xB>tOhZmP}va83ql$+sQ|MYV0lNk6CqNstMO*|iqZ zPQe|PLTvv4QIkzr_x?6vhO11Ryh2T1T&49Z0D)OZEFvt=utbPEJsSboZ&kM2+1rPi zaW0&^QiY&G#X6nG=g^h%(maQj&Dye{Ml?xfRRX<@{NEkSAUcz@g@(0=oPk&;R>xD! z!pgG9g=}dAqJ>dln+?db{YEJJos|$#5k!7$WGY3ku)OEswUl1(3eHMj#%k-Z|&ExlF< zRxGGch7(PYRDdg5W5Ot#(gMiWzq!9|43JGX9KaprOog_g9yXIFgPmyMNKxVc08u}B z(#MuOWRL;Ubv04jhiEW9dBEP>yFU^QAs->HyOTZ3Z|g-b)SYBa({rqnJNipBgKuM{ z_NyOA`|+O~e@v>`k{nUcY~kB;kXi37y&Sj&140W`2FV!`s*}0ZYY`+-9ry~QO-bA2 z4~jN{%>ZPGC@+bf9R({MnPe?hsiagpSt@0cj{AJ~JS3QV3OvJv*)Qb>SAo|}jD~}7 zeIc;p0JWP^9zr(v_U<^+$cF-UPikJ!LBGLrz{wQl)QvD|1f3^Xmb(L608N8tw)Wyk z)@Yj(*~dZ~ooUbFgy18|GX-W0@-ma86)ejmsT+f+x>)u!FNais&WKb5*zHcUni%ZB z*lcWpW4^q38Ed&B)Pvu@7@B=>cOLZOAdWK@ZZ0bb&}`*HL- zw`;Zlyvrg)49|-6XHJrNNdSSOaHN{nQQ?+5)#(aJH(S^odE7{fz#Y@tIN}#hm+Ike z+_D&=H~<1)@|fsF*|kBa1PyH7l6Lnd{f`_Pt|UJ8lDbR~;0>&`evL(ODI-b}7$GK? zTdT1bK%&TuFR`z=pcD{2A*QdjaJ)ufrc=m-7TO%FQgnuwIt3L$8J8o?1&KZV1d@Hf zzYVjR;4%RBLRqnI+6x8n00!{xc!>W1`m?H~ECrPE^W;!ZZH?{nPaezDVn?JkkNOk` z{-$KOngj!)u=cjSPvX65`9sTSan)3!#QvoNP|&s*0s*qc4(HyhYaUsg;OCi=M{4Uj z0Rv!D#+Q{dsMMihNWc~fd5k2`DO=PXbeh|Napp7;Z-teK)+AgjQ>v`Yz?P^ZDyD;6 z5~OEW)JSS?e|@;1NobL@_Wnv*KKsuvX5%UX z4z=zfD!K^--dSBxFggW-BGKg#z5f8pAPc>Z8e3u{Soh|XOoJN=Ez@!=Iq=w~mN$uu zh6Nnx(5!D|^9I9mOMi7@Mzb6SNa(;lYQ%W{SNMl6lh9zvXGOIEvE`c{MPdL@5s}HT zPrn1LBArpRd8-07nY13m2xNf6o)%kJrPB6y1w+L#15pKbnSKVMN85%rT~5N|#@+~S z4?+jd(pc9bAf*CjI}!-CMu@$!YXoYF{`Nii(T8v)q@A38NFE3-2YMZaByA%GP*lK4 zG}=*>2qb9%fgzNsHAL5Yw$ugz2J)68*os7NHZ^$eAu6hRNYxaoScAPOR#9ht$Q&ud z=*bz!XhbaFCdjn7;tpw!vKP@JM#`aUQ4E1JrCS3SuVvr%;Q{kW@tR~sR?UjYx=Yj7 zzlbbzrsDiZc(j_IQ6QZBK%^f_23J5$P|^?Ek42@#;e8!;!=i9U{{TyP_O5;qo>NGT z*vv=q9JGE$Q8~6VLgb{PBqeCDEi9T%jYWHE-1e*Ajum<2og;eNPuFU4<`S$~9Nt)l zm4^~TKyRs)NFt7rdhB0+*99#3`0NSTd*N3~JrnYh?~V#GsE*2!aZEJzYC1QJ@w9sSR48A*+u%0;W zNSRMGl8D386Xwe!U+LFoqx8y2q#x5niXf4-fuIsayZ#(>EapidnNwqOsAdg9Nn{Eh zSsp;35;Uj)DKb9$T@LgpUli)j5wK25!*i3d56$J?R95m$sLt^$PQta<>1ZGkL{RTr z{@gW{T1|k-3!7`EUY4@OWjaJNI(M;a8ZwedBq@?J+iE;!#aP>K#X5<+5{mPAOJT++ zDSla=icX+4LmaIdsk;QD4S^Lz@7sh@16bbL!@(1bfMYh5fOtkh>aQG8yT6aVBLi&1 z>gG}@Q>59wTiyQM`1W3vNW=Oo8GOx!{0oVp?ENl3`SqvXy%EmYRtV&6M^d^jhS(xw z22w(S>M{@o9qfE@<0y`C61%l6tFUxJDN>NJwO`K5% z*``@Q77)0#BKuYL9B9KGX2ucCh18@Ae?cu}#HbDywQv{XuPp;)?y4#*G1erPi05%LpqrdpZQlcKs zcN*W^@$;&{8rZr0w|AB4X}jpCxLcYPK6NV?712Ty8X@=W$r2mxZmf@!@y03uNe<~x zen5bMa{5fjVOs|Bk=Wf5O8s<8Fj7rXqx%EKilCM_oULv+vRgf1C0z4L%atQ(Z(2Pr z_R^%0>T$6o5GeluS99^e<`^<6=QFZ=(@YBA;nRd-&G}tQ3ZJN`3IQ}oGGrSYZZ{k8 zjmMtCc;XX4=DY#3wI$>;#}-sq>p&fW7TQehAtL=Psc6wXw)o?4g7!FN9tksIBI;}? z)%ktM&8XzM74(5^s4-eAOx896xBF}_BvposK;yw!^-o$0<78$(1v=$U`Z_15p*pPU zEz9MUlFS8?>2ycGw)X7^XHDP_`s_dXLSB#&qwAfVo4bnL`oPEjJ=MUksPmknK~s86 zrM6`x+K%Ri$Bg*kMn1LetW$8r95Zs53pT=x%=pZ#%F2vLQs3112kE^eDk%Q|@>;$? z2lI7--mRkIM;BbfBR(fGU0zrV9D3A{tn9_Xsw36re)OY=M?R5`I11;Q{)8rA?wG^} zB+Qaii`4OBxs=%mYz@Hq@7sp7!FBc?^alBhu4DqUoQ-}?6gsr93#LLIKtJWu#Qgmy z_TmZpIXSqiCqAXqm9lF85n&!{D>?X1cC#%1z1ZQb_pG&3w>twra75g7B^v| z%kn!N>r|08pij%~_dI0+9hHpvrxR?JbK;{Q=zkGcu#=;DnSm-#`845Y9$0Uy17 z{B(3!aK~uV{<}XK$&8Pa;-u!scQ2lNrX%^BD+FFNnuuT+wzKIbtJH6gqSY|UyY-iv zU>eQpUV!P)gO}(eM;hg0rlLS&uTWuh2InKb^kLJ#~r+Sr{;V=Ca$unRKCR1a!Delb#u zPV~}T2?HPk1q{mg`7aPy<4}ve8xqc;R1KMS2DYKM@59S^%>;1>MZs_=&ns1p8RL(4 zh}>e9h*m;@iKFU-4bH^Z$tkOM08y}Ky#mV`vpIAN>SpFROjSbc*%QRBEd2$HfSLg5 z@Ah*oPNSmmdlKAb%)ZdDp8zR3131>8y;s#LLYnW) z`U*e6V&dos8Zv+%w^R79TBd0U%#BinSji2tkbIb=6mEzl0o;Elk26e7Fh@^{>bygU zS1<}0r6XBrA@f)pELJvBH=;dgr0i?og*=^Bh|H)xXBg>R&3B8dW!vY6#00(`bI zWLp4zrP$xF?R-YGibd11dxC_+{j0Ala#tN5j;xG{0?_U}!Ww}kMuGtM{m&Axg5w)F z?N-C;$=amGVUwLXQAoaUB<>qQ^pUwVLmmFyQ^unP{sN6M^VFJf{x4-7D5gBQ9#h@wlt4|cCHvCnqy!> zO`LX>LP$&vi;{;@vV)Nwk_=KRB&6L3>>Fzr_u+xs+RZua>)3-J$4!@M;ci`)Ob5{G z=0^JlB`AiV2Bwj8?YJlQ;(-rgk&-Q4M-noGUVNzKIK16Ppy~NeV2Vw$OMAI!&Vp6g zdse;djuaYNA4*^gjwh?!jG5JV>ME}=#%G1STAnkg*sXE-Y|AJ0g%ZOdG<1<7*5z-4 zV}LgnJa};^UJ1NU9w>h^firQVp7)wB%S)%yv1UM@phl9$rc^)1+%lW>9UF}MHlc6@ zqWAGh2(28ZIakz$PSnk$kyHS+C0Kj^0H+(lBuGg{l+=M(n~YNuK@N>e698;lMub~$ zy?5V?1yR*&(mpA zGWl(P;uWa!7|Qb%(m*gknzR98NXS4yBT2GY**E^YaIqJp?vuxY=+PYD6ApRNgOefG zB)M5ILWam7#D+&#p?VY$0U-TCwmYJnnv5S*0+{PCoutQ#TE>ZGfwcoDg`^s&jZ&gK zskkIt7a#-m0C>{!b%#n*M6}7UTwq}rk>s72g$Rj6wd!JAt5`m!W8SEH+2TF=t<_*r zjR!Gh`guY*grz88HIqQ#4&=u7Fn z>-xA|Ku8mswq{o^74rzwO^@*)fOfFbNCK0++A$x`6bKaFXX z1Juk-`eeruvnjn)7D4Vk_?3YzB6_`rT`~ckfi$Nuc!H;vqA6X90#E7?TY3l63}LMN z)psL|rkFR{0&sL}vQ*|-K6LFQez#H*GHRMqFIm03xQ6H0X(P9NblD96*m2rY9(m4; zf#ck%La?HrFtY%4vl===O4qey~Gnf7!iG7hv0K})>mT8kbqf{s?YVe0f2W@ZCpu{XEB&l)HW zbFX+ye#_Yvu)!#h0M1>e$@|=29y`4x#EN7_oZ-j3NC@MSy}pS8n~jcy%!(!QPhq zg!CX-3X&4xkCwUYo`yPzOm`|a14=ZFWbNFJ`|+XRx0*-QpLt7YHa#dmR-Y~`S#?kl zO91t&H8Lxzoh+++lfPm7u8=7B)+Ta36vc$bvHao4UNC;Y^J3q z>6ugxK66-plZppxkAKB_YJaMw_Cl|j`k2^~8+D=&#_qd-Xm=O;ow<4|`MGWC8-E zj|zW@$ELMOBNe3p0#Mn~+W_rsHU@|GW1j9v^?0EJo+Bw$BLm9GXS3#Hg{_C8JjDk4 zf>o3IH|{tmT(eYPSHTD(9Gl@2FDsWosZKUSTV05(d0-Mr0U4~1W)<6vj@9J^2NSsGg7~!o`dj z#hBZ;2V9LKx5;s0yPv-NCS{L#x%eyG5KkSS%kXo=1Z_$p>0Y2J3B5)6eoCJ8P7)>{ zA7RFg1Od}JJixtXcZ3>5YT#>&&ZE1Q*VS2Cy2GlYBVo+Bj)1^fm0EQa0K5Bl*qh@% zkYr-3kKaBCm}h+x0sWrTnaeagPU5XKX$-b>$0C<2_aTqHcl+>)n>tap;m30PkOPCv z0UB;>R%^DhBavRJi+-d84}HE*6IhCruW$;uI+ZqDc%f5S7T4ozTadNX-P56XU{Fg#`-A>Iq|3ECauP-tD@e>Td+~s+gEu z^5k(Q8?|MKZYrUXQ*a&XG#O|qrM81PNg5RDuIEH~PVULLDheLs zjG#ee@9iKak5rI2nOUcbQV;e6tYy{clcPG4B2M(p$#V6YqI*Z&{kZAqunv&Hw2SiW zKIa9S8GJo$+K0HW0&@n;}DL2k9gL7?uFJ@~H2(f43Y8?wYTIAP*JMr)CZ0{8ywo0ePXoDyPj=ia~Xt z>5k)93PIFV{fHmUdAvXX)CVbDN@S4T>BE$f9&eTtzHEhndcA6>TF3#c2JUQ;e+P_} zZrLW#oX^%be5d@z@&pb$NZwqm)F~xM&XO&CWmCP_vHS7QrVFQf&|#oPUjf>YaAh*X zmjGZyx!CCXj+GJFE2LPxEKb1hRy&H?@v2zjFRFe$i47!z2K3X)jFXuoEWu+|3gD{& zSrQ#;1+iBpD#Z=O@s_Lr(sNFxM3#ePMd? z!}NaoGM4RnpTu(2vdYDj@;y7IE6C1BAS?L`Y`uwDToNw#{y6gt1vu})6TDtL zk!%S3x$`&OP$J>VsQD)Ld#R-jLBG*-UZofK7$++W8mJ8{oZ6!faLGJoM_zCgF)rbse=Moh* zL6vuv?9;tB>Ep+}*k_c7LqM^%l2)^O>EJ6LR8D8%;E9$bryNXhAbDd1v_F_or%?e6 zkp>3!Fe5?U#rNYI-6R9i+?*OqWOS(clrkjVf0jJCvDsCF09g3Yo zNw_N941=(!BPlcythJPx)n74XsY1 z4bkC`=P|DboH*m514s@nITT_h5QC2~2gnN1Hsn4lx9CU!2U5b;PM+}-R!KZ0+=mR# zeSCJN5*uTf%Z`OnQDe!-!I$*$^C(BDgP7*9(VGNaI__xQcc$R(S}Fm~8TBg2xu?}B zOPON6E>v?6V|d@nmrnXckQi_3SlOuWX28BR(r|lAMcPsx(g>4v`z|C=22MGoot zKjk=2;J3|lFhVM6KmPzWzwrv$x^53L8M5UgP>rMt)K@^XAZ#C~4L1 zdsx`;!%tk#5UX6YXJlNe=VCn%)mbBJ8`{~TJ^rJ=#c+w#es)at+tQ%r>dBR*j;(RW zxuJSx5?D9dr0v^+sRfocp8o*J4L@2s5iLXW`l`IV_?Vs7av@+v*2-Ug7jaBqHlEaf zT4QP+pkhhP3cXCTqbOF?-dC5WMv-+=MWhfrZNd8DmASFnfOB<-%}4p!r(lF1Liuei z(ALTeA`SKdcRlEV??S@>_TD(&t6E?#lYWdqy$!71#3tsOy_P-h>;v*RvCcN*@>E1e z7C}t%O!sCuGd%eNfGkRH}J0#J-w6_c%`0V&zF{CCZSn8q#!XMC}t{8$O^!Y=YBO)0gMM} z32r2knXn>Q*AE$Y4B^iDMwZs@Nuf<-lXw3BTFUnlT;rNxZcW&V^*KM5SlkBD6s#o=GW67{&jD}y)DiZNy_4K-jeCNYM?=p10kTm zs0OTVPaYzPBB28~UV^7Nld%ixMNE7cS%3^6iCQpGfgVyv8z}UZP!Iv_N8g6wi7y}v zPl^hl04;Q{%bUv)6b+}&ie%GdD12r|L8MV6$=v&>yS_BkzPLF-9jQ&Z17aK0(nN8i z^K_VujTmJGiVZOlCHjJw3U?P*@(JO%P(#dT9%ySDakwnsE!hM#%)#;2GP@1TQ7@#h z0aW>Yz3+~b2C;DISqp@MH+KNBZl<%&e6p#e#L{-vMa2ajx70swJ2+r@7Ls;xo}@qI@Lch)O}=;gQ>cUn>y^j zSLfu^qfj8JRr_v!_s7n$1hW}b><@Q(^pw9)&DyQ*Tyo|7=Oa$wta&I{&|#qqi5F@X zY;9KDbLw*|6R~S(E~OK_1%ptZ250m;O^p+jj8i!==k`o?o@PHq-{r8)V{)`cN*N4zRG*;N535=5I_Ls zWt*gAieftcYaQK-GUdXkNWJ{v?|$|M-Hz%{?x%yO@3Y|w+F`()r2z5q3Gkn33@;ggT%nLq3&BBSP6$*by`La{P&rK z6bY+oWMT_e?!bQ@+wh!u2NP7027Uv%9vl%#f;J@{TQP{`#_Yg6vXW1-w4qpLi1E?eD`ItXk;E6bEFR!UXXzn+$Gu)fi#@C(4cWmLwZh zLAC9@aiBWRjxK>-<>VQ#b)iEVO%8?bz@jU$+Qpa;{cnJ&>b@N_em&@!>jIh-E2F3k z-flKXw*Z1)6{SLM>c|vF{v2g849-M+Q?6tT;H-9>i+-_j4LjclURMp2u7tF0&j4&_WSYY>i)7$aJoz&GIlRP z^y@lDg37_3NU@bhqx48)Dy4m0*2jPRIP>_1wZ^3ElkQzAW*W`>c_(h4kk8K}U+5A^ zAX7zBwJ=eu(Q$%n+*uor*l_?hiH*E?1)`Pejn_{c;!)&Gp~~r=Kp9tYBv7=X)Y61P zqknN+VW2MA+&keurJCc@;F5W93NjrD3Uf#*6Xi8rx z>vg9tNCYDyU1Vty!n*==NWO7W0Z^(+x3MGk-;8y+#iQDvPil%p)z0wPD>IH`h)^2} z0h%v#v!r>$->~@{SaeZ-?Ni)^!fFW{Li0c2<%0BIFb8&zs=Az_jZ3-a3TS^x48Vdt zfd}J{ap};FJyHZs3LnC1;Cem%T~1Hesr*MRgPBGfE=?uM{#~PcyLCp7%=LXF9VdGo zxbn1*G)~jtS7Gt2V{#?SU;Zv)qdHU&XB19GS31gtsZN7VSyMggY%FFLDYLo|zLzQ^yt*7cbt@K16&du2U4d0eOz z6w;{$nQwBe>_I2#R*dbi`*$2*5^BN7Eg#v48LP43tlYmJ&MkgXVMdS%EzK6P#;;;K zo&>%sIyd`K0WAS82-ZB4CcvX9^1vY-)R0I3l>ygMk@xtnG)%Nc*+~Ob%wAD(Br!=A zO2!;%kVv})o+(HsJ5WZeZ+iND_Z%pLs#`w;#~CIVZmWU^&TxFJpE4bh*$O*p8pP4q z0lkSWsGi_3_`V%U#I_xrcO|{N=^09~iy_R%jDd4Q<^*Rn9EUz^bfJI`<=)nHQ0;tE z+8E<&6&eegcgF#K%ZSU2V@6{>CzmX2R>{Yx%r>+Jpo$ReKxzih5vCu1RNLCE;KYrH zUo$C{hZcA$U;L?*1L`yal`KZ1DnF#{LjM5ez8OwiQ&WCiaoU06SR4>NE0c{jC21~) zHyy^oWIzr=* zwG;N^%~p1`M{Qj;#-t3;j%oh@5tzwUrdZWul8eTX%I?)*5vkgZ@Au)9xwOI0;(_;k z5eFsLE+*2nLPAMrR1LC~1!E))sf94y*){NOj=X`+*rSDj0?Ah`gUG0)h{Y-oeJkCx z+0s~zzrVflv6cnjT6p7nT0hAqk|oNGi7gr`FuFQ~h9&tHJ->c4R{)lsh}d&iAws!O zw%`pQZLwB(m)eHfXnnW`8DSA`g0{#Y#iPj(m2}Uj3O}2}vNi|I5GxO2NB~*kV3630 zYM&HC)*HbH26TfTJ2GekN@mK*M`SvHD>R2e497zvgI$Mv<3%tW#x>*!Xw5C=9`X*; z-nqh-S5q{_RBB|1ZRLWXv&d_>j43S4f25wmjZ_WwTgK&M_K^JSwaGeEpC}6&txGEH zslCHURGRJu4f}@EVQ2*U$VrqroyY>f3{)!BQi3beJ&j-U_t}603X{xCak)FHhEFlW zYaoL9bcO=W9Zbh-8w2si6VI$B>43OXF=QVP6`FUH4>IHfP$2%Z>slmT3j}|!4SV6O z99auQ&gApUky|<(eZs{MRiz%HzFaIxB%KbLujcr}RFO^28%ol_&dMQ6&*52QiAwLL zMlHDoWR1`j6f~(?C%)uyC>WV4Q~;1V7n*!7OY1)!fdQ0w_2M#?An*SGZljtg4TJfA zkw&}SA8qM7zeDs(f6Ull!SP;yME<)>h|eEe@dfDY<0PD`4%Ds4=7+3lh)&u|8X7|o ze&2pPQv_9iSCa3z6HUEn7gd#;1~yR5D#e0L*&s5D(%pz8f_A<5(S!xHNG8&Ed{XNh zHU+{5%TTK2Y(%jZ5-ibzs_fA1o-V#u{@*8 z)uK$nv2`*Igq{NAWF%hBL&{+}{Q?VA*TyOL4 zcjIeJ2lb>}mdLuqdYBgHvN>QhBH97~Sv^3Fw;*mt-s65dm{S;bj*_|6htd$SK61A_Ou=8!IoElB_nMsskaA5~u*7dY8GdHlxDx znaeauKPUo;7%HlnIO{~6OstNo4eB3L6YW-ghZ`6T&e%Qa7dKK=XDc2+!~v4}!6#<& z*q=(B=$-wx8}DX;ID3c(tQ0GiyHOv?1n&W4T2Rldz10T ztpqi6&ICqvnfQWUkaXa20OlBbmebXfO#Oe=nGRfuIj1lqQ7^7Xd7@%V+iG~oHfY}n z(hUN=R>i~2`_bW?br?bVsXG=Xb1Z-YG-eZ~w*m4Ew!j4di})vRZZo{Z04;3O14$(B zMX=iWdXO$gFOTTdN`;TiE*oM_>}$5?0wj?75|)HO7Vf3W-T=a_AUfR54K z2s4{qS>;Svi8pqJLd$e7TDU}Fwdn|drdYpc5g zCmWNot-f(PCy2C#pfqy^&n1y~sDyZP*U`q_m^y2#RNmmDa?I8MS^Ai%t*`!^b~IFc z=c9?+TA$(z1}(FM#9jzvyO)Bwdzhw$S5OZQqfNOUU{JOX{E9&P9zFF?92|Ol7oBM! zh+DTT4*amBN=wCPq=VT|5<%R1j`m2g`|xWIrkJwmQ@uMa*OE-pE)?wEh?AGa8E`=) zNV*g;ExJky`yMzonn|e81eskHWYT&Tjnlf~=Fu=92W*mCau1iFDK!fD=Qx3;NILFLC#=Q+?-ILYnLUf6DCyJl+g^aAXjoNtm~AI zNqCm~Cpu#pfje}jy_o8^ZPAsZKSotAv)~9YE4#6t1B#{3C@e(f$Hfg;)*QUvT`0KPr;H;68ePm1D(_+_-qatcivsHSVdpWG26=WW zFbkS;KpG>Dn(;R1kLAL~$Ws`V8Not9SrtuQ=D{b80ov5{fV?F}tH|6`Q!1*Xu?nj= zDo6#;NT|AszLq4(cix5lxVDmYhS=k=R>9VgIvz2X)jmDKRR|x5?-PM0&8z2fvdOK8 za9>ax?rZlPcC^Xl>3TZh{{Sh%e*}3fcrJ6agLh*q_S8OWc*T)-R|h~=GDlh|LX3r7 z!v!nlsNd$kc=GQA!3O&~zALQXt!%jPN^dRZ&dgZJ0IQJF_2AC@2H5Wfx>$e&dEUpi7(t_8^jM6hDxF#M*Dq zYhw1+2vr~ti_}dW&)>HfuI+2as;C>TtMa1%0GOE>y-yuK$!O)E8*byv{rI}z7PQT! zMoBi}>48V;V}pAXBFBH#1$NtWTq0$z>r4XT+dNSzYgGQlb1(_*{c)>z?_kI8!lE^L zkBYZgJWfss9!x{?87M$+J1-(%QDk6Rb|*>&I_qA|*jMw$h7wxCxC9OdSb@DkxJTOV=&-*Leg26Mi#;#2{~cLhd#CZAKnKTbBMZGr$jDx$Y8 zee2wCZGNqsZhh!r-*V(YBgl>wj5?U(C4klHBn8w@X4tiMuj7awT*tVbr;a+*10am^ zOo-v-*wJpyB+1)t1!`CLu~aMG_wG1NCYMw$*&hUMvp_k@n-vN}0s~JzPPq@%+Cws_ zHDn`uEbppCU0Ft2U(IYq@pHJ!ncKH|ba@74;x_fAqVRj?f9 zYEVFAzVx`SOOOE1TLo68N(~_#bTnSo%0NHAx_t@}sq&h&_ zb|8Jh>O#3uP_HP0Itf+xg|&kRa7I?pcJ6Z zef~Sw8k;(<-DI0<4{F0Yk_{Z*cNWM~7^tGZSC-F33kEbhSSJ4fZacVJQD{5L=hl+< zbpC4>&QkfgC_<3Y1}jABIv5gbZ6Kirk8{UmmZk_Xb%oxsvihOcg$Gr2dXc#5E}=lc zexNPP@`}+@vrwVF{CxKnKPs$k8vZNN(}7N#V&SMSBP|rUOh8n;c{H(Ry;4qh19mby zkL_P>GS`9`tCjnLZ88CnyJdssW!->fg_S@g60^LDR9@A#-sZo4DTY9Su#UxUA*7SG z5e(&DKQ8?`VZwOWnk;35Nf%q1UC+53Dw*cC({hd5cfcxDa#~qgY-z_TNFZr3sU+-{ z+TFL<@7szXLqI$HRQM%~^$O)zbzFefC@TcF1nvk3qvo%3#=2c1@!pc`%IS(@lQS3< zu{5(tqRFQ=(t&gUy8w;8efYP67~lp#1sj;UR`JCVJRk85T8h6(bI?$MrHA-lN~MBm z5=NRm@7#COpv>u=9#8nq>~Nks5^?Y_ScChH?pvo+tAD%>td1e+{N7OnDPko2@0cmH zk~Fl7f4|sqpGX+3TU$O*`FML%aN=px8+AfO!k6;cvq;zFi8G-D>aQ(kM+6an({+Di z!X5*h*6o4sgl#Z2wj+4cDsuJ_fFzG5GC{9Mncg`GRqUm-j^vQ1ZW89}JW1G?(nC$| z3K2L*noBBG@#NH3aqE?c1otGik9#ETe(h;=2p66`$OyTO$QA=Ik)$fLAd_GhyF|oM zU>GoDTkXGpo-|dBSewrs=o=F%$0{L4QwwbpD?MsZKr?6{k#xuT{kWC?0J8@&t(FAz zrz`@kJ~OKw2$RCV00`DqfZ2&@G>s<7?0vYx@eOe49f|A%U9qucUMrP<4m?K*q!sCo zpleWf>+mAn7%gEfily1-# zzl8CxE{HH-(SBB7T^UO{<*GK4L86M{uD3hiZaDP;H67DE%VS8@7T6Yv(~MgtAt5ay zrb#7V)V7)p5KfH(>)OcQj&>%@A}mN+=+3)rnYpN0IZQgV+h@h4m?#mtMzS&~q-zTh z_X4*+12rjaQ@d27ah6HWM;(b?7xMYD2+o~KQCSpelEF_g*pS+!W+&+efIHtB+$MW5wNM}RvCVJmHMU+o^0d0`9T0>gwAq+bpeC|# z4xky0{&0PFTd>l7_xL+-(juGMZDZV&ZdhYzUT*w9`g$9iObs+WW7P6{f(pw7mAE&w zd!KDXk8kP3J5P{vG${W74XcCb?X+khe`!mDb}k$RA1b?Q4Q%Uq$%a$O(PMYysfZZ^wdFBflvdY-rH~Y;@)NLZT5Mp0P2#2 z1}O|N+0-%TWM5FzB+f}E3;|?V)E}o*iV)cV zUZ=kGx#Hk*tltWxmOHP-2IcJ<;%Z_|44o7h4Jreb-1@D`?d^Yl8&Dl!2SQs5LuX~t zLljShfr1AQ8iS~XML`$^GppImP`30w>0I>{+}`<1czc6#|W8q z3iPYIg#P~kz3}#*qo_9-@Jb`;7$)Tn=W)on@iGDw$l8Dupcj8Gl{-@Get2~VG~K=s z)tz!s-fE;q%1LCX;Nye-G>KCEg9e4z(98dhvCUc`p3s@PEl9!8RCFo zyU~trTOv^afP>1f{{Sk+^my#)**Jek&S&PFC%ckw=CJ7SHS~!$0~=rQoR;-Iq)Du( z)QaxAQS$_nErmXXP^VyTYu}G947svbSc_kYN_ot~%$P*-v1ffqqhR2mR|FMWP;T$J z<5f7bOMppuyutxKOwhHgAxjGN9c(t(w1$YZ?c2Taq&2P{wn=BI$c!>bBgJN;ugqB( zmO78pq!vBNAA7DA;3fTtfg@Crb;c|s{8oUZFC(3=W`X8A5nyVNjw$9S=W!kIt-i2} zT@)IG_`aR18JF6_Po?Ys0HV+K;V0F2={?A-2tM9D=#D`uWIeAd44v^}8`+N~#5FZ+j%3{2O(k0&-Mgra;Yc78Y#iDi%Ui zlL*+TU9Fjlf$e?w`|ZV-(`mb<2xEwaaz0+zFy)!cI~ajj)ee}d>?#!$29ft9-u~+^ z4|4zzB^Ie*a4x!4VqYc)Qp@IOasaACAs900EU0vnJ&D`e_|`o~1Fy_-2VX6g;R}UH==yP^KXR6AE|tPc?d$DKKPE(5W2Jk=ONn8)WnJh z>~`bY`ch(tqCjoX*iXQ?IwJ4W1OEV@U-2!sE>y?IGcM8Ou0bsJ>ZeR{N2J@>^K300 z>*J3m0dWE@A$Dh)N!uz8Y|HssnSmh1iXD(y3Hexo2&H``gIV_ni=+;_cggQm_>W?* z$d}BEGFxF8!phZRiIPe2>rvg1(iQE${Z6@p&_(2Us-!bL2f-xgr<5}$V5;dfkuk6t zfLD;~(g@U9y8-?E_Oa3$+1yrl+gbuomN0TrMvx-XGNl?HRH&PT)y%MKm#-L8D zgL@?OtYfMpE6rv_3}YD@Xo@O|hKU5&0ay6{0H<>Z;Au4NlO7M#0!V1dZ6h5w^DO?0vZ-%=F){62gfF&uv%xaIt3t77~fq z5xp(uq=ZJG3u5i4kO)sbp}Ik`@no3wGvnu-E< z(iHsA6~c6o2DMN6hsWTH3{ND(`=h~U;fqHOGZE{Wb#x}Fj0(zH_tN?g?SDJ)m@@Z_ zz#aETm;jxqymEt!kdct#Bt$o42_u=A$zkaV8O5LHg%K}laDse7FnO`Kp&o9TT-#}d z8&ZQnEf-U!y+KuLb3*IehL+l9=fN*2-iLDYrg*f|D@U54OQ|K(7EL0F^s}>qcLRDK z96GN#t|rDudbXHww!~iq2=V4d{{Zo*fTruEq-Lu11t0|$Km;G$@QScVAn)!(*=ToP ziaE*L46QBnLz8uPys$I|&gQjCVE6d##(Kc&&hVK`^N(6U@l#Lx1LAs(i0J;KF@i`V z{>RAIu)nK&-v0pU$45m1bcTzQ{j)z1S#g8(Y*-(#eb86Wj5adnk zl+h(r00WyY99@mb{y630gocUQwbBxD&&e_K=zN}3WhIPJ&k55;&@2G)Kn}kSjVo#@ zRLMjg@8h=_@b{=1Gc($JlWGWQo{o)+If_h#&495`OtH{mcBO+b8Y@kOy6z1QI%G7{ zcIa7T$hd{At9hJ}^iVB;WL5wvZzu!_u(PD9ud$#zcjJ!{SX$HZTa4;-!U@XAIe1Zn zq^^DhVTRxz&!Z)PX@CRRkZ*@ovmQx4sr)4=qnyAqk=_@ZJP5YvPHhqpjgi(JLmHae zf+*{glK-yT7*b&IkmkA6$G{jxM`J;dgm;|y#Y*+rC0JfvzAXOOiL z2FseVE(&{ZTin80H$q5^}XQ{LvP{f7(s&UVP`%`)UPM;R&^nCJXn z1qc5ChR4X2$fH2x!;Km{ZBiLiNZY**7{?w((k@8vl7O~f8-YPN+`>%ERTPEfm6!u- zaQTBt>}=g#5BxaMMWj=CCn!s*dBb@nR_36I$W1>&qbn8CRUyT5KpJ8YdyTI6x;J5; zXHCkdW^KimTjAyZ0Ja`IF|SYJ8^sNK4@91SENIwjvHe6JV`IO+droTnpV85?=A0+D z=z{0qFH=b0`|W??6~1!_kC0@Hvg?Bx*d2Vn0@RXkw|{Ot#Wx*b4)fl+u4&b= z*n^_bajXFG*oaD^!Lz%P7Sxgd04~SpyAHv)p#!D@hFIdw$CYD+Qr((TcV=ZK=zsyR zv<-F~5H4eZF4(FAfgnN}N{Gh6OjD^82(sX_j>m04(fA{V4D!q+W)9`YD+WyYAKDl) z6`hA~Efzbo?96y7#5S94nFyJlNX)86L<)r5YYyJpqp38|>@7e0t~0cAUB=XB)@q+2 zi>{U*=5r7fp2czWf<3GY{{T(}yHD=-s~~^~-`tvTqr_MsC(MRvF{30B+9W15I+QeT z9Rhu~AL+(->+2YTB|Vz3)3lB_%@T?6iilxgWesEt*2JHwSp^Cgu@`m1h;)}bBtkYI zc~PX}AxU|3nWA+x#ayv55)?0UTDywaaQ2clPF72B4w5HwO!7j{N&f)JiPSStWeVxA z4Y(mi_aA?@z-6X$C1)b%S72Ro6eczvO1hGmkctO=EXHlfP#a1DPss1YVV6{C%Uh21 zP7oSZ{zoF2Rh@;jN)TNh${2#zT3`3EzYDLFbfcts+S#TIC`(BwwgiT9C|L}uSTQse!}a4rvjnc5jn?Gq^~*n zaXy}X_>Yb@Rg?Yy0CH{PqiwDgdD7opM)ugutAz_=PI-0e8f zE%N%^u3L^wB2H410QzIe5w?{8=$j{6kEKZgWcUCNZ;v9^MMp+)+!txUmJYNtn8;2p zRB@83*)n75Y6V7<9Ww3)lu@?E&+d3@8g<%8yiZ-wxY&-B+oqV9r-hqJO^Yq-Ae9e4 zq_NZ#5@a35+x*`ZiU1Hs#|}Fbr85(nR_8&Y9KaUYW|@iw)VjRZfUu*c(?BNn{`>2r zeon$|-970~`qPp^pCV7p=Sid>hAdGVISFjjDuAj97T^)@u_yQ3&;u#oIqq4BxxVhw zvVNmverYtU2u2gh87fA*0NGL~*Q;Yy$6pKyq62fcipf{jC1D)WO3aw(C7T(IUc%jU zi!I%d5#PD*$8wu_g8NrFkischkEjA|qll$|$5)y=@7lPsKnHOj9^@cjtB(a=JcEsr?PFB9O4bQF4zjhW zhjP|0eh!zc&;`IMowuzMi%G@1hLl+$8P4h)9Cq~ zCxQq3T7QTn=}+i*gZqx|_$`~N;t}<)Tq#|@F_j{N>7sIE)<70TvkkkS*zlbo;&D|i zokBS6OvAQmG)L46HGLAyWQb7w)e^QSN(?NZQ8r?Z$9lh>1OpJ`^=;qYp}8d!WondC7qCh>yFs+hOiB@Bakc+ zOYMIB!Qjb&&_Rij?L!wZRXjr&$;P6j87Ee{6eNouRZ@XKDHpx}0Dc)zlGpn?B~yK1 zjN+m{=lkh7i3~?opHPoWDK5YY1Z~>CjuBE}lb)&ZDUI58F5HGv+{Q&s^+_j~PUloG zz^b$ktp(Us@3-$&SaTaW!0jbUKD-2<;!7EN55%~qj3YlobwVi@dee|(&8bb@vOrGv zxvu@S=)wAajdM@;hJG+R%Fl`b;jv(d`ZL^D&z@Clkc@7OlL9^8)L%{4(p-NakB&Zv zP;+CUdB*y|dKZ$R^0os=jIxbEh06O7pjps}tOzwj`Qy)5Fi6_ERP53s(zae-Can<= zU6FC&ZOMDcna8LQN2oQ`ZGXQUYM{ie?G_}B%T(#rI;Y3_WHSJu(UAU}Oy$Eamh}Ng z>}!rrAjoUBd`j6&X4ADF=VCF)au!iq9zQBT!Pt?aCM!T|B(We+H`~7mq6w}dGWesY zB9Rlfy30Dk2-%?|kdzMQAa`*kLN;o9^u{XBwSm7KC+h}FV_Wm{Sw?rsKekGqRfVK# zDIP>8)Wk4WEDv%VjX{sOueEW{4f0%+>~&0X)CJjlD!QMG zKW)9wrmdYg;&XKhBc=s5_pT0swvTT9QU3sq#coi6CS(}$F(OD>NeLv_sJ^=N+49e7 z?0fg)$2*$B;js3u$P!?wIsDMZG2qr2)Lkx$b=R+JjP-+mk$XcH1r&9AjvgZ?89Kv;)K6lvUB*q}%jL15oL z`~#)61+5D9F8NAAW5}Qe^E{Rfq?H3(`;SWk+nx45ZYh!rgxm5`;L6guPI}49l8<0`KaTuc z=TLPHJ?fh1c2-omJ{kPpPE@DXl1#dR)u&r&QmVp%*!z1~1BOY`PMg5A-bdgCuHZdT!AXyjz zx0s^|&aW;UT5DD$>Y|B1Q^YSyE$sGjx(K&6DiS)3ri=cij&D^b~m!qOn;I6mVZ?DH)(}pHHEGR zLKz&1mCYsv!FQS%Ng|QeW?Z=%t56pmZSh_9;jmdrrXXLs6$ed2>`C0-aVIrZjhdoK z{Hn4@k)@SL(zI<{DWS0&@wS6VqGxHpU`VKSpF0$}&aPaWS9oT1yVQLVL>M(*!VSRr zvBgsWL9|FzOq`Z+;r{@aA6Nb&)&8OQit#u^>;bk(`Dm~;3t&#?;QjdSX~Q^wMo7!% zoG0*sT>J+%rjTVL^&yz=~y@jh0K53X!>2_T{w)R1(7(bbhCZfMXy9C>=I6lz1V zH(hoT`gU!?3p_&_RSy`{U6jT_N-hHFDhX9&KVUaMw+(MN7&hL3*okZvE+>*C^AIss zc@l{Pfnb+yjha#WU&j>vXoH%K%#holbFv(qzz^w+ngm@9ETONx3IpxK+98zZG7{bE zJFQ8|6d1Cdw)2b#3A-M1`H~waxbrt3w-USuFm6QMsGKaaPa|Cgn34(lbOJs*1%Hkb z=EFqi2%1EZ3-p#Bmqu8US@IimWn?T10DBdnPuTGWPm$25$t|}^XT{BiOk$3aq}a%% zSz}}7Bw;--UXdVL1p8g@+l=mGgXVdqJ(UC*7Yn@H%NV>_SflmCYzaDqQm_OBJD@MN z-TwSgrr--*l&UWV3q{v#sRoI%;zVd=jJaSHNV!561bca`z4xl@c#RhfbFLI7CCvj= z^>0Y0B|pUEqin0?$fC56t^jr<3kO*Qfo8bdsCg#LLPW#9E3Y$H;=_bS?Vx=sK`d9u z1qko5f;RR)>vXSB$o$lB05x{yPaG?V!L_rpg%_-d+&bG*(K`4408S-gCF5s`jj@fT zHu8rr%qR2^trVB25DOzBq2I6ww0?NUSOHD9x^*ITk2Q15as$W~{{Td^DQiG1XvJ)N z>R~{i`KbKyDYgXtYpC}UV`p;npNCQ@>W{=o6zMmQ-XmItEDUeYvK5(GM)r(FZ@0G| z*V0KCZ$tNu4Tb(1;b^i2T{H&VeQ(6Q5gLQbTroNtUR=yq>MA9&0)}8i1*^TZ`*GsP z`djP;cQ2}Mv~ikS%wl0Q6f$Y0hi-`B|Rns6i?}R6tm68m%lonQ%qqI6yN&pO8 zu+~EatzC_Lo*O`oW`^Y+KNK&%u{kXAR0Ag^3fw^MA$(J9p!|Ob$fG{{SVanU!{*vIw1-Z{f=3*N zF;+<L9j$}sePdf&UUP699oHFj*gO`tQ!NOy*^_Nffw(4@Y-M!_Jf%5 z;3b)Wb}O8cFp^?K)LgR?3Hb$5hrLTCR%8ut%y$~%!T31}wg#V+{%3wUwYtDu0r z7tfejA&Gnp-S1&xLH_{remK#fKdiKQ-&vjEFG<0|;sO5v4EGhQ^?Z)Kebz~9PnFD| z`iAZ@3#hO`EbAM4dwg&>@ZMgbKjL^PhA~Kem6k`4sT`V#H<=PCU&AD3tasfTa#axwa%F`K zzH4X9B{JdjGgj(IBvm9oKzF`boYsJjgDXw0qC7HKq(3iSAr- zRU;!JSk|S5XO<#tSwRyxHoL2sf$T$Fci)SxC5#6n@luuK{b-c6;-o7lKy}pOm_J4J zWYl!3v~AP;#yHdixhX594b89i)1pZlM*!H$wJ|^M2f9+Rcf(={{{Ri$#eC(#l&fIK zpx@@L!3-Akxd7N>q);Ef?Z?ro3D<6Rvhxi$1RE{$r*l-o==NA+x`rF60LY@6h3I7a zcm4R_Vp(uwXydhXsT*H7TIVasQ<_*fQLhb~`i{8X5rZngmL+m2OwWHqB=+Q&&M-#pG(`8>GqY)(`H zJ>1e6&`8WwdQHi_-qrEK=rie>;glXb71VT7jgl697H^fA1gcOo#^top3#Uq!1QNx9 zgYU3356?x+)@g3Vov#7FtqpS0Ee3SkDt=gmI@b{;jENLVVbPZ>~#GGs<-(U!BuQi#fXqte+s4$T}bTK9qY{g z2j(PQCz}u?dEIT)T9_~NN0bOX_cor_$GP;$q1tWkjHprm8&{stCNK>Vok#v6w-|F2 zXA-Pg!lWuFY6X&x);%TWAP;aj@&%_*G>z-It#UT19YvZy#o8gKQUpRjrra?L*!omG zaLhe2Xlos}K~$Y{tFc8cTDD8Us1nMGTVtf5vKq@BN6Wv8{`^>MG&sl{d8w=kAgf%v zF(HZ3&i-p1TYo?x8nQ2edrON*$`ol4b9LJ*HD4+Rujf+}1hX~CEm!nHNs z(2rO(r38mMI3%An+(=+oVlKm2D;iNZslxAnejZp{8o)E-+?E~$zH;C$(B_jP%{7-| zOtG!4%Qm_fWP=<)f=D&7_6Le{eyc}SxZ12bWVvw`dPyVXG=NfRKtmn1oh-IXYHv^f z0GYWwM=}6t3WJ1_u8wP^G9~jDR!u?~fdodo$OfZChH$sssQYjxmD=4~i}@oJ1RJ2d zt2nMq`AS0vmPwQ_YYP}5K+?c(65rTwxZ%}VEo*lGl*ismSj)~0n#D*lkvLf^f1;M$ zkwBpzQQo%q<5OwHF*7^8s2uUEM#NlC9J6Ca#jN9i%p}w0t4QLgu)20r-2VWt3e|I3 z=o?W?kT$HlqVr;It^7jK-G31tCom+FOEy<8B}Z#kRa0aSr(t);drUBjK8=!p;W$rt zq}9&AxNGS#yBS~jg=!p=oIVC*n9;cqIb)k5U95H&wzzuvf27KWWzvL~4V#n)f3GSQ*1z}Q zvN|qiOm#%6H<=_Kp#0qyZ57@lB_w^Su6j=*y+EoGxR|{Ji)Js+K26T-czblEj0naAa%W zxZ8;42ezRbc<@!Ns#+7rB+6Lk%E&G>kof2uef>Vgh_dd#b9`W~!sfNH(zH`?1iDb( zXU$d!ge8LqT_BK2)Xn9nz3E1y+hBNQDmuqnGW^gwpp4cR;eJFj^)KQ8nLM*Ej(#Gv zEoV^kIj%`oB|)~Rk_}BYyXDot65hW!>&r`{fb3-! zxAh_o06DbS%e{fWzaBeMYR1cU{!6wTbu&9q$#diKqGppy%RFY-hS18bt-vQ@zFm+& z-M-r~j56zFIPXB`<*`)d8R8)_y`-%ipc8wzk(9BsY{D=-teyV+9d-v0c1or?0hL3V zWW_7Z5_(m#r;so$RvsdR3sM4^fwQ)dJ%;S0!oUwiaqdF*OvY&!Cm|%x%%4?|r5 zOiC7&iwgvv#_#)$&1^A{Hu$Xab)9=GSF3VRXVHbZ7AtjXPssBN2m##uX@f$0BPzj zYK+fkLZ>pwU_c-ZmLN9!1KgfIca9NOs0Zu2ysu3_%USkEa8P)31$K9y)C0e#J%Uf!D9-SF6PU7f+q9m1+?XdtJ^}h`#=^k@1LLaNsD3&=AMV%OWw$j8{)?!99 zPo$|tpvL|_cvFNLcD#6^7Y~A{HDtub*UR&O6{?G~vb|Su16I~eaK`f;19AWf_o5gK z(De>DCgN6II&ajzqyVt66q&B;+@1mO>^q~@DBJqZi9tMiAoy?M60icgOQ`@lO@vNM zI}y17bu_#1?E*iXv~eHfGuzJzdPn*$CjS6Y--T&CYoqejLU0PkGJVog{u2=kOL@B=8llyQ@yNjmK zh}{z9nGGw&5eIja1s22@ahFeUC^e}0Hcs3st9@d6J5ANF$s3i}>}O1jn%Nf+?m-3A zOtOGOQMM#~_9x$fA}O?sXW)u?#75*Z9Jq@iKpK}KR3zCnRZ$fG0Qn*Q4e-~7%Skh7 z@$y3_SK65QP)vrNeKcV#vQZjKIAmlDMxaX?`yMk^4rZ%n$0XK6^@tY%N6RD;$&^b1 zA&)10t&33#bP=?AdjnVR-lajTDUPHqnQ=>=D6=nx{bE*?4@7lZC_h;v11!jPHp(yB z$sP9NPKyKQOct@fFHgK6#(zbxyHNPAoG2bRpd=P4kgS?bP%didX`l^XxIBFz`p(@R z3(GA_ra6Gq2zC`1rzMS@I-gJ?>ce`w@5eJ0PIauc(RcuFT6Zev2s0#RkdR|iLW^1n z31&5@DP`4u{`d3Ctwe_Efq%_xW8v3Ymn`Oq9!!A=3b>#PW&i?X41kb9`l$BYe|}Y3 zQowqA)}}lM5w;g@d(T7TtW4+uF-RF*cLqm70jnjIR3H4d;^<+{w1%RoQqd_&9%>qQ ze=}5yzNNG2)gTBo>}c4aKKyBQGZCv~fbq0lIgWUL!Qlo=jx~}n2{j@^Iz_0T>A1=E zus!(3XnihFZQ7s80?g31+NzsW zO9(IlUVHFkn*-9hi>Z{SR`nFBTBwG}R;BhVS;pUP{{SAx()vW{r=RpGd&M@c7KD7@ z8_`k!0Eqdm-vgV*+|pC56^=!ctgtF0Mp`xL90gE^euds}BwYN-fFx@r5M?w2|hcmSK7nl?0Lv6Qm!D{@g0P2`%jF%^f%9txwOy z6Tqz~0z!A}K`hjRuq28H`|vHJtk*+iLbp^Pw{j!QdY4QQ>XwqiSl2*#!ds01}RJPnkkY zdFgBb3aC&ry26$L1s-KgT~2G7zyNbC-dp!1R(swHxktBaZHvqJB^4>p-~C zm{I=#s4jK|`4ywTJ`lVv(kPLq2vjhoSb%%8b_%5n`QwNvNN^cK=yHO^ zG3E2s9KJb=$LnQnKAIx5>R+pWo-?w8jY1;n&ZsqKE;cG~^#aF?Ns@x0DlG15M=VW> z7Ql8jTob4`x&YdRwO|{iyq{pE9lb-UK$^ZzPsWJJyVmuh^QJEX+Q?r#j-B#~a^Tc%* zO-pQ6A7+A8nEB$%%`zlovP%jBV`m8@%xnuQsaN}Ow^1#m&^I3dtUg>!*-#wu4sSAv z9YmAlWyrpzQVGa?H|^=xG@js5;kCZDu}az$+1!y;#-T;TG;ARwT!Q1$tVPWS&kH3Dx^w&jZOBZI6;5`w=#dH!hKL(Ai4b_LnXa1(sheqK({^B()IR@J5U=+rv+K zf~2@w@||&c(*9CKEV`a!Emn)uC7-0It#S?PU@MGIp)VVv6NN#m(t!0JJ=ZDH_8k^f z3$+r!q4fbw+Hc(N^H%&l3jwROE~QDZ$z)y>^FjX8_}7oG^zuAz>y;PWB%IQ1WC8LJ zU%%UrQRzK7!ul>ixX~DC`=6TSXqUxZEH-?$uj2SEy?NmO01fiPYK&z}yESe|peO>m zitZ?j{{UYmX#Fm++`9VXRwnr>SzPH31|P2FmHgnOfW>7RSREv9>D#w{4YZEC?O-87 z@IcdR^k%zF~YvA2Pmh?gvy|b7@`G+`B=UAuwzoCPG zbxk6I;2Y8agi*VqJ-6WL(j*I7d$_t6RFYu+e0MDTb7I+`gXD=GYa#+3f^jnl09olRVxhZF{Ok9U%saeXf)kGQ4OBkgL0gd;w^TKI> z=Qc8q4sxu*o@XuQih-THq^jJ8DHKX>=rWe}piO@(aRRL(O19mPwZA1s6xBWy zOF;s<5&r-&FyjS~0z#jt(e1b2W;w@JqoZ$$R0YQy5hOs0%Db0_S9Q_f%!LCnt3T95 z+1v}h7EIr0Be52&2SKzUn936tHYA2Q5lQN?sacqnYaoUys0VLe`|#Hvq+vn!^)u2DDG;up?GrW2BCFve^8xw!*+&c==deh8)vg)DPQ<-Jz zutObhE;fbr0DT39+k!#&;`D$66Ijk~K7L4W{{X3Ee#r7!hC>kZ#w$wAB>`))GsSdj ztVva{8*oj@gd4}j5h4jpoi7w~a|V>qM2+>;(~wkv0H8ezZ1w<-Gh(H*z>CUdFbldk z@?WEg&O=FORE|j{i!jq9j~M_G2pSIH?ho65F6M^D&kxB^6SWPIon+=6-%dbbr#Qy-`;5oF0$UW+$%ZEx}pVD-uLYhB|xO5qo_1<2`W| zL}ij?F)c89RX$TTw&oAGZBh+RNz?#TP{mDC6(Iig!PODT4TK?W!JN=f67nQI6ZMR& zrpH9}QAV!Ik;*dWq5u{ZQ*VpC`*7_V0n*qJpVQO)Kqcb|`4x8`@ZH>3&cF#=Y6EE_ zI;;Y0l1cX@1X1_9?Z?qY$?9HVU&G3LA*g9&t8f*CGYK1D8%?!d$9wzmx3gTtbCEU0 zy-BN)^#C~@sR@nYWw6vkD-lGUCbWP-zkT=PHGDrZBH=onPIRpc7phnDIU~$FLYfp_ z`c-ucKA%yD4fnn|uEIlG%^C6DwF}I;!aSQWa?c! zk|h)Rou0s8Eo2XBMeH<@{BfV;vs}nc<-Uv{+?%O{ZHj#1sX2r}G_mZnM!WU^X>Q*& z@55_hr&xhv(w555S~kkXyd>&X$LV~e4@^3fo=6B_G=q^5Z+`SIZ)UzdSEU$zeJuA8 z{gomA0DxS54^vkJ06$&-0En%Bl=Vu>nV5CiII)!VSUO@*EcfgMcjL@e!b2(BYU{GS z-Fw0ool9ABT)LU&yC%s4Rf0#bZNA^@!<~laG(ul0WSP1t%lefAWXjTdR5~u=tN;nr zds~lc--Oh{o@fCvwX?blH&dpF*sx;KNo7bLlx7Loe^sA>`|$CFxe>W6*07Uhe;27D zhy*eXa;53jM%iqsYpM!12ZcWktYiZSg=n_aTMMZad4tSQT}Hr$-M3!EdtVBvg`0tr zHr0W1byFv)yzXZeN$G`|+Miaok;awXi3AAl?#Bk)Fl{4io;+1Lw7dm#BdM1!E(n@X z5eXz08v@1MmcbyBgMXX8+%33WMmh&MUn~p5X2CJR&(WbbBLR@{maqZxBMMPL1e*u| zKhFqu9L>f_t*QvwYQl!MHpOu_Q?9p(o-w`M_A;gTt_4;f=C5fw9xD;eOBTVv@ccJ{w-c8obJ zaXWb2fYrDMBxg6NRbh-Ypz1bv_hN#(fk4VZ`|y@wrN?q>t6F7QgQ<{Bj0}_`jiqh& z-DqEJ*SI&|fp!+o-!P!8BuekgI+RLgm`W~8iQEgY3IP(R+*mrVd*Eu}OG7{w0C}rr zS(DOL0n{=70EpzsT}c@k0y-<|Ss9&btk?s;--et&(X>a^2t{srE;~^e`jRx}YBk)3 zGOJ`0r&~%176a-kzscc83gb$4N-6*jCF?m?jH5$CdbtLw`yZT%+aWLx$-iv9R`!@!ulcqNLrw)H9MRY5X&z%h~K z6vnjrz(RI3+kLnnlS~-2alKirVDao#G5U=fY&|kjA_OFmYzWjLPzkmcKferq80x;; z`_PKMsp?I*{ZkxsEK*JBV(LjImryRCo4Qgx_S=k3!V}I7+*8G25KW4w&3cj(cGS@@ zUsl$rVk)GbnZTtsKk9!;-P5@erLu`vXaJ=>V9g{5RwZFfiKHBcs7}c~BcF8M>KeYzWJ!5vmO(+hEYfLk7C2{ZwoXs{TosVmU%a zXT+*Cfg<)mB-%zC7(^4$8_ zK!^}P(M=NH)B>nIhrRGr@SrqvZTX&+PON0!+;%0l=fG!7OOUSnu+7KN0t7emV{A^pvg%ElPpq=AQrzSCO|f_V+;j6i+9dCi1Rw`i~XB{=9awiYk{SWIMG1vWhjZ+URb#l3vprd=-JsCT$9gOqmm5 zm1Z{aBGDnrA0Wx30kxSFeTct)41&hgo|GWnx4J0mjh{N8(ga~t4cX*k9gqstp?s5d z-2VWo!HR7p-}CcFo87qqmDO>v)GIL=a{5}&sx@Ok7TH9LTYCY2cY)70*b>e_^pwlW zKs??AB||<)lT%Q=7bzY0`oN>UpW?FBKSD^qH8Ftlg4dOw`2PSZw?OsvF;z~8=gUke z+H(B#EX3}0dE0MRK6vS90Df`6f;rr?JI9jEq{#U;B>w=Wdy3UM=0guxb!75(PNC)s zv;Yi5@;-+frLMIdtZl&KhPE=O8IrDqiVSwh3pC6{Rn~n?B$Dc&M&?PRC4*j*VQ=7j zcj8kdm>B`(@kT(nIVK*Q)VVT5tW-1^Mpv~B8>9f5ApLCALHS?fjM$P3L5thJ!7`t% z6R@eKZ_B2mUTQ>TWzr7E&khKp)ujAwb-=W15(ZP`qpTYsYjG)XOyM%@(!ZG^GKLz3 z%!IW93o)h?O#$u3lH1b*I|Q`P%A{!Vq=cbDS_qIEA<>Z{lS$M81z4YM$G;hC4tRFU zrZP21p1XzqnfyrusD7qYSO zd?o9%nLHSf!O|T;37&Z)f+b0LD@Pn`@-nD0%P5U^0gC`Gz~fGZYn`Sr0gWV@&B%WB z&x%$#z+iD8z#50T-K*!B%Egi#V7WNH?@Afy4w&%8I52ULl%I8BhZoy2d>CfhtKqQoYasZ*{iA zgQ*&z7*P?Anyh&SM$E_4pvKy#hVRQrPDg0kLIX8S|9?00YTUn~kUZf1FwK;ycRd zxAl++F`hjSq%_!ci`;YMss0eTx-__9KpAVhy=gqJpR`#<@}OIYp&o2@3h5fCy;uYN zc;Ho}!rjJKMw{FYdlh+k;-*_(W;m%0gEVzv$UU6Z0Dpc6Qf8>K66Z-%<8#5}$X7ES zh-NiBV!#DOQ_uvr`teSr$!UZ^#DX@V^K-Bn6lUXqG!-6fbbTvqZRiW&`8HnJpw@Mv zTuyo)DMMysf&e7>>!f;XwyUr>6HSe209g}WWCT+er~oraGV#S7DRZR&ECPK%5x4sA zr_o@B!ZtXWJ5^XZg!%HZ&BwI{kDQithGAz}tJVIT8KF)9IZ6=YC!t!0otNe*S-9(} z5(n!>2iCz{(~>rLkbgUmye^8~ zbZ1bZ8xOBm$h%hjJhGWA>l}Mf2RH`=By+R*7OdQGR$>?#;{*J*Bnn^{sBiT?$AnpA>qyl@g&Lnp_~p!-5C`#>2NA9V*81dL$8Vkx={# zE)ct48-MQ=KN4}9s0k7&%*Cw{s6Kpa^f+VvTQRS3$1${70K(Q>=_I1u!=HuaxN-h> zA9<61H7_6qWtbT`T+fO^xTLvfvjyxEDzs< zWhOyz3Y_C0N~s?{51S+YcN^2@0DS1asU-5yA5k5Rox6X24ANj=5p+7v)-#g5m(R?S zMu$5d!h%Pg9@b9B*Ri%AbHFl_04~^x&v_wAIr&$ZoZNbjIN}vFdzMsUey!}c0_s%Y z7`&?wa3)QFSFm~amyU#Hb{{T)LaP;8X(3T!;0_(h-_Mae(ylWCDQe}?m zBS0E&Zgq5xQ%Xw*At$v=A$Dk6tpOzNSZng9BZTyB-oY}xAVomi!}yHk3d4YNwXw#3ywvaDtzR#lw3w==Gaq?kW&LQ5=R*)lYb!+U@ObmgWj46)T@vR+ z6h2;f(W)2Chg(7;1t&noqx$Umi?V{(?soX$ji$#F5uakB=Wjx0=OutqodM8dAgqdQ zosOM@(;EKQ!<$Z-&mvOGojKWYCpTA?NZ&R)B$r=09ZEv0Ez@j6H*;HU#N^ljdHbmXVaUM0T<)sbf%Z4u*64R|_N-5)RSait`YMbDYdZo+cSM+L}fK z_2aPKSXLv|s;zI|zYL&24uNRny)LH3-WhRx$ysu7!mcp}rb;Emj74g{OM*XsDdcK_ zwoyTo17~Xb@6{PlWc5c>&x4VTnFe1o=WUIbiz-h9!~9}bNnn~LF-;qjdX&*yquRb@ zi;tAnBwLg|<37dfDP4>c^+Ht31I&aAEY7fk15^HnDkxPu5~O?|s;JoD7-g;_G4Yig zGT-?rAyWX72{sLiI}jCJgS(#W0Te4quu1!HE{8d!dfLc@v^l*BECwH(!DY2o9%vO~ zNshi|?2!Wf9Mz02NJ z=E%wpm|jT%EEiKMrK#Vzb#HqEzqbPTgdVC)7=X@$X#s+7Ft3aF{=T~Fi;MWy6X0@NbSPe z16y$8jsE0lpHCyUW?C9xV#{CvyKn#@SZ)KV5OxB-+%FR0sZ8{QRGMV(x`UW8G6>j~ zZ_CRAC?uCL#)d|vQK*8NYWF{3d=)Svc1-)qj?N<`O=74dM$&-ljJ+MNDfEP(7#3r_ z(IU7#cz7{8djcJW9p!5<#foMF*Qhdu7O2uP#-mBGAdOGlZGSu>upFa+;>nB~N)InO zo)NXbl1F#?1 z*iLm#htbJ@5c1kyusW`84X56EN9}C`Cd{69tG(oYBm92M%E`-{#s0F6Oq_|QFyr+f zHOGK7lC!d7!H&s~1ZZ4^MGA@q0YbR*Zqs^Hxz72*wa&*t_X8f~()k7sKp1*{>G!BV z_JjOD5&`jJ!~#tf57m6dBo}2#(;_Vs@^|*GC~3_q2lbtAynNAo--OwPXSjJNAIGo6 z6q=cQVDSqafX8mA=FFwG1gIGRn$>p3tnb@`8hc6$e7>n4X!)udKL~Qev)nlHRY#Bi z0EoP63FAkI1%L%Z^(Qnc>PF{Lo>;ks!I6+T0S5ja+Rg6_YG z-yXr$FN)qGp}YM~q2{EE7xhOjq5vN1Ha)%gpE~JdX6ZVo{pZC`k>LftO3!dyf9*5l zjG?r6zv3#N`J?K7aG(-J00XlMzQpg_i}}|~2nR@2`^U{ggTbHftoH@^{{RvmJb7B1 z#!nDfo6x7MIgX-5ojO+~`;bTdIG;S}azXjRt-4+2tK>L1pOZ3rf{ri5Z;tco)8hw- zu0`8P)g0bh+Q2|_i2$4St_bOkEG%?|TkdfR3=RlFLgt3AWXNf+W{$N5=8_@~$CYW1F}=Y;nl7FEe3 z+rHdGrL?F7{Oef%0J&et@PFlL`5_+(V|c zkq7zGz4yEFMe-aVH^I~QD^dO=e-KP5yi)7_XTJF0BCO<;1DVCgRf>T!DN5-o0%(>9m)osNRXc3>hIWh;7*&; z?kD-iumkssA*1j>0C3E|Ktgm|q>BwD(H)q>^6m;I1 zCJvITA84kxN8oMxGcx^m!k(w*U6h+|)SS5;fu>P++krY) zNRuZ>RulWj%|_ucwgU{$a8j@0qsR2WH^q*>{wsC9|sa$C8o%01^H?pe)`n_?TC?)71Rf=>vPzsK|f60yM^yIcW-j{iEir;IO0nvpvJf zMt>5XIjH{t_}Ah(vF;@2+~k0E?8_q9zk2U{7}FYGZZ@d{_t1Qc2mT9v$}{+r@&5pQ zJ~MUGDPHHPd9s@S0P?0D!{CuzL8dgB{{H}4e$n$&Q#aGC%hGvC0>YoJ}{6+Zwz~7DicH`nMrsrDr zCwnqI-TQVtU(Z@pN9ncozSqT9$S{}v9-Mujf`Pvgo;{5u_{-v56WKbCnz=M;fDy>R z6Z_W&G}e|N{{T2u`_BIW`c!Z@JjNZK?}F^Vh;PILFe~D}iO!YjC#kuzSw5Y?k`Z6O z_Ts*K(xPWc)F19A#HcVBU6@vV(57$1AL1CPE8?$+QKw*Es`-qqr*IsJGto`f`|Ll^ zMxD}9LDH4J@g4;i$S}735uV_nlko}T`4s*%b@VC*;X0q0Dcfr`mmvcG0Q@`?bncWB z80y6IysJ7p3H}2<=uwZvKaQzhXN?{rFgpU>SIm13-$T1m`|&<|((W=b)o1M=G(RB0 z$Q*+ssdN7Tv>%TQODBvTCClbN|TKyXXvI)W;CG!P(iNos`S_w5KL>fkQ;7YQ-Mg*f{>d{ump9z0{p z#+w%-#m>IX$H|4E$j5G_&v<8sL}Zp1jPnLr5z(lMTMfSybl#XChhwVhkpveTgW!G& z3eNXhI2nq^zJwwXCyBxH2m|D!>(66p^dgyI3vj* zx(_bGA1O~CPf_GI6a)ftHn1mt|{Q14i0?Cr;hPkypn#t$PhtJP_e+(blv$wc3OkY)Y`Is}5mp-Y?6l>J{}Z zDPjSl3xy!>wfk>G-GVG-T;0lyRSQHwZ4sm-*wS?QMEPWmVVhF0Gyt+bM+RhrCghYN zEI^1-W2<_g^pbcm-a;dWCdl9FI{{V>?Z2?uq zEw+>Eh(kb=+M*wGf4>RViebQQJ(uz9MH1-Q9uTF&8uDk-3faym2HF|X)hL1pJ&D-v zI2V{`9RU+BtOoM4zZv5{?#IL_*bQIopHnIYCY67~XJ%c^>JEhNZpR%h3P;YGJP+|% z_?BFGCkcuqUs2t~Yknn@4^j0*Adt~>T!`;wwr9sAn%;*00N4%(5f0K7i54$DD5-O3 zQyX9`@hF8N&WKzAexg8tC#Ll>nOTVJXz&C^wAdeyg_Z71JdIsuoPacpXl#IJ`O>ff zx3O#o$9ng^GgpmJ2)y?JDYX8v8NwSn$@zgR00?Y?bpU_NW>`auYAoTsiDS3F3>vzz zH?jf_WmZdN5i@BfSy2mL0_O;nS(0c$=)uPSf&F8~k$R5-zy< zE*Bzxo9Wzz4b6_6tfc&&l*{)6*=bU9eUog+fmD%T+*^MA1#IQu5 zDk7@JiU3ur9C)hct}3gsHR~5vagt7aZs@RG+G3q1HI(Uqz$`f6l%)ADdYUwenSDjS zC`q6}vE=GvHc`3u_u{pGdj8)vav<^GxqR3XFvlg-F||nHh=O$iK{RQi1y~)&y=?_I zWvDpoRvlr^Gt|3BnFF=s<*<>Bwx(1Evm1>l>Hrh*?eD}i+$`qUahjUKL6VDpcS=#3 zDOg^U8;Wg)%wkdH0!O~99^4~RPpfV?*p5IM-Bb)+*_99hyDTyT<(q9xe9;pC3BOX0 ze&d5V3z<|1GC)?Drzz_TI^WjNi3-sxcBr70R`y|ML3YzUGobD{YAt@mmSS7_bxXRw>TaWx01H!~_*d2nR`$ zXxO)Jq((_?&+q>LUIUe^^Alxdl*iV$TC6iMquxAXx=w;lpg^KMAgL{EJ*bhvYP{y@ z<7yIHxp#}4;}&SvIDudZW{XoX*a}%=VzxdA_Wmi<9w3=k9?>8LGG<{C!gG+$J-nz@ z4|@k~M`POm0P^A*bp^l?*D43L`O4x2dRk{TvQcVH6G{JtO@!!7`X^t8NM2OO@sQZ7R;0Sn@>idcy8#AqLH!jaMD_9S%MEb0hSuC~L3a?^^!M+9^VHu)x zfoK~-tNEBB)Y1qp>?w~~0{5#@3o+R2I6YS%R#N9OyG_ld%qs#vl@^s-RkGer^q04pf{&G0;o$<;;5 z9JQ3+;xo<^%L0&uQ{%}JI;cC4v9Tt<`bh7!a6Fh34%xL{yPX7$yAcTai!5MG=e%Tq z45eq$+$tE>MA&XS0s!nd4oFFeMAwjZkh)1eB&0|lGedPSDAZJdK~W>K1MO|M{a|ax z$o8n>(qwlopPS{50?CI1(LSg|u?07FN|^%Q-o$?1(^jCkahXzDeysN@(kCQhLL~6E zq8JHQMbdkcSgUML!258(YXD?|5KS<0f}(7GMWnCiQyhZYpG=emSES{{VyI z3uK!VQ2OG?@{snkt723EUHcB)2P)}^D)}*s23;&Z5R5Re?eTq4Vk_fC>GpgXNk?hmb)-$-Ly%(K$?{ zflx+Oijn$Z^#i@N0cN+OGXsAS}>Trq?z9voYMK*xZcDmNOY1cFBU zoreNLi8ns~04>VwE&`Qu$Wo&&6_dpN6+Tjrp6M=+iRW+Ac8>w43ZESwbjtC--Ro$8#@Gbp9l6Tsc)pa_7 zj%g1PI+mhZ<`)BO(7bt<^AxN+q}LvTz$nuWpvK89>c?$1D{;3Cb4X@afO~!+2ry3N ze~?D9=H_Zr1d6f7gb?56u9qUcMZB)p?hm!_yg@BxF*4!b9~5+eB#t+u8R)R{j8|fP zc-X>Eas(wLh%)~G&mytg_u)*JQg8<%dwh{N2D|~3DEW4y%yN}9p;eM#R02Yh$`yzO zMGf~p-yB^+IW|uasgfQ*%^`TxP2qQlaahwIM)f4tK@QCPzcp#a(y+2>zMZR$+86rM zM!1aYFm{ET9sLg#zmq-7N%2rLePz^W7!`hHoV37}v@F&|1A3G8vs@Km4lfbBJol@o zJe4UwRCgq}p(qP21^lR0(k+`#f>@Af3zqCr+pysziH)*~GfX^z10HD?sH(+?RFUdm zEJ2{1yM|jmjUF>%EGZexpA_0+&W*~4G-Sreg7;klNoz?0m&_}qk@W9hAQQI?rZt-Q z&Ta36FSCI`dDl1P9XZJ*=iL7QI~SGmo>2x~e>CP9l1COkJ~RR;S>%xH%w1Z7+cN;G zWP!uzQLTxtC}HWB)p-G}8)n>g*)F5mPMfOKI<(p@Pafn)!>)sin&EWMj{ZM%^MA6; zG5VA6?f7--2wFGl@@9OVP2-P_e458p_a{xp@%b9DN8mF2*j1vARHMFHrNG!oL+IEq&{`TRMGd%c*9;NDzY1SO~nsp~p zbG+VZ&biK9xmoB1V89N>HFE9C)hrE8=R@uUwbab;&+kIsnL6 zF6}ncq{h>xHCP3J{E!w%=sbB*$W#-h;t}a#xUnacgJJFoJ?w6HRFW>k+EGD~4jqaQ z%B+mfG??m3TQ8W1=C4oETTnWV+iWGC$ZDF&jYW2T0)wj11-9PM5tLnmPhSq*F^ggu=&ND9sc|fAllK>`KUn~ z{r><3`DBqcX$)mSDhOw7U-FPiVPMr)6I2_4AgBrbq8A4-sFR%`)%7ApJ+*^NrC8GM z@K3#QIXM2!O>JqHTd723jzOrlY^+UMV`Q)-U05-MeU0`5ehLT>($G4>qYg4;@ zgHwt1c2ckO0`|N zSxj8$RDm07*@;4N@@&!|w5Mn$FjJf3E+NH%O~HNEjQaNkPQX%6=4fj z08rDl>_PfP{{Vgg%%S^YJ-!M{)jXBW$TBubc+m+OSIZ}IRI;pEU5?$hBp;oN8fi2D z&x0WD4XC!0KsnqJyMjqpU_ki37nV-v0D;$ zBakkg1y-MZ`@~!TK<)=~y@9nB(mz%Y8_@#!iMUqIPGHsfhjle}@fQZYAQK`ISoSsr zjlX4qOpsbH$4Zjzq^b{|%5}$)1b`I|Jh>wvZZxos0*3e`5(mG-c{$Cetx$0hdoCsB zkuuXqt&Lhn>=kd*sY5cKRoV2B#R^W40fE%4zD8F*K z9{u}*;v66dKEvV1QUTHz4~GZVGNlBqop6;ZC>_|$tb1+y@dKS8YKiMo26DMfb3v1s zM)kU@DOMjKnKgh$-H1K7n%f;n%8?sxyBv8b*;yFXYSinnW9d_?WhZOC{{TEqVIW=< zU2iQmj%ngv=BJn_DngN@E3Mh?4{ji993+A66Zt7SikW$jFacv+$q#KlUP7_DAn8#V zttY+z0O!D(bnZ(8^()qP^0+y9`rV#c-`IyonB7sZnij|HN50%yrpOR2)&haf8&z}6 zawK34>QH?#q=Qf+yCTV`8~5P3CIOTVm0Ht0<;rKx8xRsiZH|>duB&%;(X)o%xhILq zw9g(YNgFPRo@tg*e^((kvSpVaR>r_enj&odzT7L3X4a2jK1%h7+N*zv%F-Llwp$>} z7?2M1PLOpC$MqffBT1kSqqjj&Ios90&&&d$%#FOq1q3l57wJBsu5YNXdfT_#fi&80 zsh0D`O3U0MoT6@O$iPUlNLOO+s~VG5RR~35wY_cqtBd48n~pc#K=U_Tj&70>c+$3l zSVmYcxFw5}G;X_|{=i=oku4wxiBnh{#gyYe8edAoF=iL&chXc@0P8FnhyZLr1Nj^P zq~Hv=0HJUo$hTU!xrh~t;bx1lS~su?k_l#ac*r4a3flMf;6n_KdwskFQzGp!rx}w; zX&I2H(sa(TwwCo8F7X5e>HB|v15vHHXq5pZz&7cHDCTD!HDqIniM3dUn2AHAA1PuA zOEVp+zw@q6N!4^m9C;$v)dN_26fe(tZjhrIFv5XZ7g!#|GPK05+iseNZv0;%Q)`TS zR5clp0Y==@3BVCUrKF%*DU>3XH?l-fDO>DL*V}>=UM5{&guHH1N6m1{s>all=24GPBYn0awO z1v;%Iz(E}<%bIqizHba1f@%5x08PLfrzM_DzNP7$NTn~yrInQAbM8TmV^wZnC)JUP zhtWllXt13|G~-wqP{t$(4l#JiuJAs>vbgdtmIo z?rmt;RT_@suE%TRJ|GyTc<4;0JmgE7Wf#aYkEk4EQA0|HSrjqtxd;cb0>0cXn_;m# z)zo)7XL7g7v>d}JB&)+HVkuMf!jLSHdf9=$``_3qNN5qYF|n;HE%BYpcxU1|jVeb( zbv*%Kl}tHfWi&`EeN+bAb#y27o{hKm?C)4{)ACGS{z=`%YhEd{w_5Yanvg#?&IHg} z{YKTO*dR!)_Zxfgy4J-ci# z*sL3>%CVD@_~qlTCXj|slS*8Up6SWd9%gjqWiRD)E>E{33FyughPkygwN~8b06Bq| z(eE}jPc(fPI{XQ%rE1HixJDeZCviW$v}|r?o$8qCuBhkTY0tTrQgi-go6Py&ILLg? zWu2OjEYnQnRTKZ49G#4o@TFOEj?SzBD&CVRZR@*|3FAAQ-GT`lIPM9sWA{|c51N5Q5weE#)KG}p z*c$Y)15Q&u!^u*uOBj(T9S5T86NYf3Nlb|fIl|#1U%n&NM0PX4b-0>t6CZrCD^PbfKI~zX5`dFk= z5^NNWECVC78h`@!taW2%fd=cn@f#kns7t-RYB(LCS1E*yPm`QzUbtdaW3rnJQAj$6 zwvY+f@N)BD_Vp5|YILhH^9*Q|MrF-a0F?9b#J~VsVxExHzaRb)G~PfVt)7C2xB~!{ zI`a%TQ>ofrQAiGxu-m5UM>*cAYus2wJcu)YUSAE;xbq6a>3 z_XP>gmG%Ds#AMk}tW-v-<8VPSM;RM!Uak+50y%($I@;1TiXA>o#eBayQk{uu@)J#Z zNK!SaHfwS#`QX^lPpUP#f(h6PfWsYmgDW9yY9ZGyMfW7Ba0H$Ek~knp=IROd1wsyP z+NO-m_G8SEPyh&z%R&?YJt5tglEil6j0+ZXj{g9HAtxeXSp3jHQ_u5(p(C&kz>A}_ zdPuSE*Y+O6tE@qYt_T5r8{iaF(-e7T=-^rG5PJE*d&>OZyC)xPesp$qQ=VZrl#DC)F{>LObsghqSqhbtXj0EbSVVO^Fstv#2rw zU({>0aKI^AS_w+lalDmYM#^Y!%xeLS`8FAe1fMhqExzYB!M|9 zQO%Pg*PiTk4O*a{N76yNF(G9&?PI-g($+S4w(9_Pp}E==W=7Tv&6G(bY>nmV2D?1S zN2l%pz0Vc~(ALKt9`z@FYBiDw+UN5@r2!oPHm1PVl{|Tps;Fngd)#VR(!e#SGNCQ8_8b9VlV=V$D+G&3 zx|!Y=j`T)%Cei2u0V8?`-{Q9Z)B}OGYRLuysL|lCBSV=xYArii1cFtQQmLXng?o+; zYI>yG*}+0XBEa^lz(R#%cwuWKF?Nu#W(RuGR9e|KJ@0RG1i*(!QUPqj{2>&fuy9;2 zW%I;)d!H>QE8A~vxU(6S_<1P1E>w_`0_7_be^JB= zUY7kzRwAcYweRzH#4KqV(j(fWk+80hogrc8E-?g$-WUU#P^1u5-}{T3ZS*L!Nic-hZY||Wh8g?51+pf(-|LItofA#rz2%EW@PBra;8zD z#Ays_r(T`PjF$v0?m#4P0f4xG!JczI7gJd8QOBHx&c8BJKje)WY=NrX5-E@=8(BLa zw+3mtEI>Uc!s-JADGo#|%F7-}1Q6jP3s<;ZVTv&#hRRRvzZIxN$!KunC05^c)zOQa z!OLo*(86j z1kmDrX;DcTfRd`T89-%4$r^wl6GGWRYa3V}#^OmkY&XXRMIb1&vH7LRtxB@AqquEs z7|mkua4dG>5i(3$qz{6Vy%fZmvECVC&Sjc2sYAkA_q`3Rq<@>WZ-24jWzK80gJAXX z*>7Tm1h36`c;p^;J>(I7XOVfYpVVD7jTDbBB$=6-ZhOdKSi-k1clG3AuJIdn1#B-t zju_TM;kbYxJNAa>cst**XK*wKExjUSjol-}dy`*GO^3`Pn==w<)EbBcQ%lNcm4y>zf(h<-JasfU{&dmJ*ef&fEO^%+ zl46W~M|Ulw#KQCSuTg>O5p%raUWJ-a=U^{YjU$9s0l17oo^dC)0cUzpEb(6^t%^8&J{p;QS2`L7WSAr4yFH4zMpA3))Oc$H zP0q_EUWxGGdXai}$Il-+bN;~7kJMj>f5V?pVuL4BG5vm16!|45fGlgw2SUAftY&mTtZTnk? z)Xek!Qyo*0)LmK5`HxZc7e1ex^X_kxHg_=Q8S^CBGS2N*EyY8pSu!A zbKijG5>BZIx#D@!0*Y9cO;+(o>AgubXvjz;5K6AY`S17Onp`5pl}-SgxF}K>(5RO? zPM{95i6K*|PMuzHQED#5lm5J3u^`1eanPgz^{%Jag2aE?@i0J$jEdUm@P+Pm;0TH-CxRocdH$4coCa0{fVKyC&)5CJwc74qGU z6WH!JhonlNK^dv3CVde{E4wa|vj&X19VUe^3~ZBSnEv#5f@^mpRU6p7G%_5vlkNZ8s;F>5)dt8^TGAxCM^fn~7bYm==1i_f^vHL*@8zp0Ke_HG-I|)!gRIWP1+=5q zx}pQP*d0e_P!afQvA_A&ox@DF$D4KU4{=Y3RSbEh?UY5 z#_*Lp3(CY6HUoKam0h>n z;CH?V)O^XN5NfdG?!_wL^z>t1PF$?Th|wGpNY4G)w7W7h5Pn;3<8C3ViFKOM*sdvO zu6@dAvAT2yd`yhp!8<_e%-)r&4up*->_6$i>*6wdTRCUISF1~5GNG1SSP8hbT@6hM z4??ypB&65^#^%09ZY*mVymu-kq5%t_%fR%QrOREldZdXMP|^f?CX87iY)RW~xGhSC zWDY%w2Q*AfDI&?kE(rYG-%8ud2t^h~m9{?>DY&l?8mrws429W)?7=|{I&+Mo_7QdF>2IJ02<>3 zPwq`!U%wVH6-X0I6$=_Zzhdg#qn5%!X`_)yuPlge#{Ra6UBD#mUgwF*)po<$rlWHX zQAv%Xcec@MGz>^--`~b5ZTr}N{*;IAyjweEMNW@B?4qCDSNHy zR5Gvxf%SWxxMWrU4SR9Nu~f76Y@iLx-kosq;{?*Q*-Eb4kO>-CF$dbOej(*Sg7fZD zTeZEa%EN^!5OHzU#d=m$*1fxx$1SiRf(_~1_u`3rP2OPi81D+Dzq8u7k@3KEY&k*$ zY-5cjjhk{j#&R|!d=CA%pdDf!C*8-rLk2;ZRsR4nixU{uCXST8%`|JhQjk;2290fd z{{Ucmt{^$bGwt(G5;7{n&n7~Yh^~>ftmx`kRVYSP)Cd>vzxUuvK!QhM3S8xvTKu^3 zxh*XD78HZzt_Z#Ai4vrqvIk`+Zrz6iuF;c6Z;~jGOx<)C=&TE5%s_nrNO5L+293gF zAd{;1-`bBBT{hGmp$tZ4SuplE`L=9=jfJ62(Hgvfq@DYF0mW+==Q7=D;270+VwEA0 zNB2-5LLa5_LK?Gmv~1Nup?fTQ+MsX`xEg{4YkZ~ zP&zLcT|}(z2*O~@b-9gYT>zQ^43Gpqz>-`401hqy&GYU)Dje(~STg3?BysB?wvclb zm??)pvgEqmUlc}XJN2%x%{Y*m5z(7g)?^xiZOa&#Z$z41hrMqkjKTNWLQy1|pJR!2IArj8*}th%dA#@S7t z#BF`I+NH2zy}lcL>Hv1D&C7B!WAeoDDpi=|7pXyCr%)DZ{{W`1df)|CH2SEuTz;^H zYa5ijMmZsPBbqkXOJe99MV2zAMIh0?NxzN+VhczuapT^mq=OG_N0^&d{-*prh^b-bNH$gxS(Iexa+lZ*)weQW8ko848KMS+hoifDjNN1&eL?A(yn zI}CMznny9Tal6|IlbvS6pUd$x@Z?G0ngo$DVLoJXM)FBAkW`xBX(+s2Fl_OT!q(2qH zN#RF{#98vXQ=F95vA^()-9o9T6+vHbzZ>*aw@YZVzN>p23eAiJ;IUs|_Z7T&g^pXP zdZE;@Db2H3jgGcfV;X-+D$IZz_dWL8E-~Mx*T2?1@SR9~4KvWO&S%bfM@w?PZO?i4 zFoTuyu1$$PZ!zW>lKD9Ju)@MNW@ZCZ5`#zsQ!!8hCx+9bTNhf68xKgnrAI($%=Yjv zDymdvCOV}@0KhIvYVgmXd1hDpKjZh}2azG=j=23v_;&m_^&TVNKd;v0{y6yQ%3pQq z(BNcr-%jL@`0q|uQvP2`9!a$OLKF^$zmiZ%t#?bIR!$E zj*wqS($*VqZuh_n8iGe@P}J6$H}xP_bFu0=JP7B#m9wzrG_z>Y1>JRffzzb>??EJ_TmOo%UGVzG)46d^#`;e z^FDZLlpzO52lCM-uKSZZ%ir37+uMdTQz9F0Z^bRe!p0EE!BeH7VyAZUQdkKs>L$X3 zVpxI*6b9nEhBSkdyFo%kW)B@|6qgm1SINu)SZY3Km>tNrjxyFk`P4}q7OTP51+nf| zBKA@~CL_>DvUI5>ipF#R);zlo>uv}1sBfMGJ>XoncC4BFF?0^WGX( zGV!hLsG02dg_;RFJA*KgXRk2XVQ-ZbWy8i%CzzR$db*iK!VZPg>%)BEuzkWI-brlO;=y^(si9>857Yt&v60?Owy%h3dFi3wssJ znU!TA!GF{-mbWI_dqE&9Y$#OH7<+?X907B|03O6m0Njf!F=1jka9xyw0nt35jgFEc zMrCjZaL0i)9vhcuioH?OJaw*H3Irs@GrWvdttC3a8m#JbC?r>5+WT=iM{NKF14d$3 z=pkwfW6PAY5IosKr2tOFl&}OY)!*Y`#4Zz<9>pR0X!b`{?@g_aGhr0B$2m zCeC(hI7C=+#%dUuWs^%qf`w=WiYzzS5;u9ZHj)o*Dr@`k9nBUlJ#rKmH;%=5BTZz* z78xVCRE-M)0rhDvpquPZYCX5$Np+>pR~+nuolu}G*!bp-r4Zyn5Zw1K<*w^y*3a$0 znJ_iXbpC4fzjw7rvBwh@lNxJ2rDHTxhPxwTp<2%5`ybzml0*jx>Q);E)rnSrHyoo# z!qUt_z2iYRGyqZ!kO}}Vf4$vMmXUr_wiKJ0Z(`^iQmN&U1QnpPVlc~O62aA!Gga-s z--{rbJfSD9RFG|`09`@EM+GoZ%a+#?YEpNyODZIu)k5!ozY<>;eoE{OnySez60y_E zOKaWCb1-EDilXZfQWX1Y1fKjDYsvj@VggtVnPo0JV9)~sa9eFMWWdEpAcLh=c}UcE z^qu|d2jssQ3_MQ9{ zb{zxR@5xBne6@7yv~UAlF~ghOOeauP~c_A*!?7ps174rQesDXh0L)t$57md%PtrNN8h*cIXZxdsM+gO9KwB53#8eY znr$3~AQcj1F<@*`k)c8RjgPsm2vdCAUyGx3sD+AZKM}9;eTRe^NA&2-H(c9X}3?Nr)4BP#w*^p9UOZV@{R%~ z!FN4HJd8|HLYlOPLx~GKgo1T$b!!LYpWkZY{!Aj|`_B-kDC4`_p)~`6V?R02vcKEN8=QT+7E9C{Hg33Ah_C&5c zzE2wgr%@s)N^Vc33rGL}U$Oppv4?CKtfwgBlLRWGsd=_M%O*ZLz`)#OMyAHzoe37& zknd)@_u-Ah(*!$|xZ`RURD2L(5|=V;-b;y{&G{A+Ny%~>^L+cK@q(E-Gx@smdCwrl z8eO?@W2+|_6qwDj4F;2<8A}%CweJGEYzf=22OksEdUF!$GFsWDa~rz6LcfWZ9!DtU z**KD}Mm9#7qNybOW@n`)r+*ZNj$58T~ zna}H3O8_OxRY61m&FcyVp2TnMw;9hVwSqc=C}|frMR2)HaswjGEUYfWh_(R&Z6&(8LHMQ%UAtl4{zOfdkuM4R-cRYBFym zBP@6VAy@wZ59Sui*+q*0RmQMbEs>?**q+V6rjX^*SWgt5aX&r*QmWh#|ih5?DB z8R=}|$n=>DDNv&5d+Dv_#s>yI-nl!Bsz}$lB&zg^UwttV5mC0 zpe2o$a6u#lD5UHSkLP|3wW%BOhpx(tPwcKvE@C3F$C?lisUed=vF_za*X(HgefOf~ z7kcB4wIJsUyNsUec}%L>2ilveXF^A1&Bj zDT+Yg0<}&TOHe<4+wmPymuVt8!hx>L0=Z!$sEaEMsBHwuOq#ptIvO%{lYaxh6d+xX zzU5mk7kMzbbYWyulp4s?@+vcIC@h+efHvDs-@g&HDjPtKIM}S}+cgV_Try9WG%Sii zRhkJT8(UZrtc(G!+tqEw+!E$68}9g_u_o}p2zgQ2A2M-usN$;!KKdkO2mm|Ly8W++ zO<+MGzVpFX4BI3s?fGPS#+N!1y+~QuK zFPRd#?g3XZ$osUh;Y_#ORr%gq3!!4HeYm4w0cel4`6{;aE1<)fnBH`;iWEjXk$^!2 z?jw;DF&EzMzWf%uVEqv3zr-sNZ#ng=DrATO`P_$ZV@QOWQ@z0)g@>nRV_&}k&2_mk z$F)iQ<0?dF07z$I{>`dCTC#;|RA~d!`+$4#A-Mqo5G3ut8y96vnXIb^^)IS%N87n?s zRyh4eF04Rd^$pL|sPJhC?l=}{Ub{fB zQjTK-hcRNvqKi}H#UW1qkcGzfZ|nyXl6=|V`wx17&5O3`Mdop`S^=uIM`bp{ZAz)A z0toC-pWL1V(jbY;jq3I6x+gY_86|ndMTn&RLIEUttz!tfO%cCy#qvhL3HN!Z9u9U~ z{{V?Dq-Ew&ximm#$RrSMiAbdawxCC0+lk2&Ba$=h^OZHZ#Oql|nU4u(Y^7!_NVSoE zqS{CvLo515_EmS=;L&EV5YxxD$_Ge1>+!})$M}&&xgpoGg!;H%4-i<4_4FXe(kXs~8z z=$bTHikk1+_dF1$=G-_>UHcUm17fQa5G66?nmPkQtS|>B(_+gKt4uwX{{Va7z$P`C z548SBY$gd&l$toik~U=m7^>7jl2+*=)_{iCmaYBxfx<`;-`=kMDxC60%E(hV1@!7k zL!}KwDAW?@5B2_dYeSoIT6)408;mFn5ELyOvXU1-R|EoR9RR6nbw0!jzTLQi&IAJ0 z6?eySRL2a@8v{hf(rW&j9!e-sY*Fn;zitm$4BiK~&$URtOT2iB%0rilwqgWwEp7k@ zTrAqYbheT!+z$ztk)D;9Lls zx_#b$3JuEPe5DM6NSJ|Ws&SAygF?)WGf^K556253nZ>$f`F5h`L|Q$FRQb6I86Kib ztBExWa7F8Bl}@GXZoT+(X)u}0l}2JEagU!oaxAc|&WsARNJ+C~R81otL{SFy1KzkG z(A=E>b#dCN#$;J8a||rLpL~va$hm8`Ba&G&dW)v9l1Uqtw5scq&iNz-TUHrIEt8Ib z`D7MRro!(AmNlV{co>iX4&DYp_#b-8L+Cm~Nu+Zdx<`oip*|$$W99fi*ST1eN0E=2 z(Om4Lu@Lc?*OTNfpzEQVNBjl6yECM7}s__`W$r_!s`9F<50wk+AMjog zJ7zkc-X3abKM>vs0t|jFbOdK%zfy1Wbtdm`8_m-4y@&|i2kb^=4%zU0ouf9box zBKg-x0Us`>ea;?goBktw69(b&YoPs1fsy*Nl=*u$)u$ng5J^8(5#NJvqnd6Z+9tpK zvWMqf03-}$IQv7*cOQx02ce5f_`A?Hex*HA%OtP~rE})U#8QB3P5kgb$&D~foe^LD z+45F2z6b*t+JAT{SMf*T0;(eTui?#B-}}qUU6kI=8~jEW_x9gmzYzK@rS49O#C^km za4N=_!DaHwQTB(LwIAY(!P3Xf@o&STMV&*cIb38YI;jkqITlM2d+bG3ZNQ&Kbj`@o zIFGpRAfVFt8xNM!kF*t`_@VGw1^)oOo`EE3I$Nr_8>7`-`FU`-Vcvyb$l!mI8g5|d zj6{8hc_R7W1G5=V+UEI%0sK<i%h5?%ngLVQ-}V54%QsJTP^G(ZYxkfo$F`}!F_B+WFw7!io`ei@77ccma{5r_WPl^5=HlLy8>W*5aAAQ%#m81%N z$G;Xm9Q1{t{{S`OBkVa*(wZvYrPBMsbYH}m;q?Oq@hihRW@^#ZJft;W!^jQy@85`h z8}x+dqcJ~lsC2H3G5S>>ycDPL9r$@DPy5X9)PmdT>W)^dK?h?WoDSFASiZx7{!V&A z41C#%`;Jxfri|N)rT2o4Kg3_*`5i)dr{Vl@fvZpZOUfQSRKV&dnZy)>*wuZ$NcuOY z$Ry~jME!?(D;iTqNc}F5{{V3DArgo23;23q#k^eb>M}?dCslI6xvSEtniW7l{Zu<0 ztA!s&y&(}gBN6OlypfG1qV5hhm)`iV&*Sgm@o!I!9v%QF>5Hm)a8Nt_Qe+TKfqzK9 zp4?BEH2EX>mlO9L3Q_i(=BZ2LU*Y}A{{Z@J@cmAbG)L83nl%7{TF>XG z5nYzW{=b_FOwjO}f zmSPsHfmSx+j)l|qF3@;`)lJ>D3LJip0!BWZ{h{W&uZ_L}?$Y?{;oC>J0s51cvo`A6 z0VGa@fBC-Rx8nX|)B7|QB7VVEG1@!pX$o4uXepD&Z^NudRK7KI1MCeiQ(y)qNeVQ6 zZcR(}C3gPY3D91V9JDqdf3W#0`NKsF@$~2I1<3qEejY4=;`c%uv@QPA^3|%kZ6`H@ z08i7We{YT<^moz#0r{T4{kM54`O`*!ou~JQnt*;Fd;@TvUyR)Yjiik%dV`a^ia`o= z>(6CY)9wJTVa1O}^zgsT*n|GZc_?(2jmzcK27$y6_BmM68ZyzOX;0bD64Il@v)XA2VtV zw$^^cY(vrQH*$0~B7VcXm3-%;{{YWYkF-3{**tmhT(M*0Ux!kb_imx(VU!vGhFqpS z#TwlG>xQ>L>5*ZfF*EiZurQ1xIK3e8Z+&AI%u4`ws95zHq=2V;xAJv=w3Fzk-21UM+Zf#F6S=q~t?aZ)BXgAlb85 z{ND%j4x5v!qH#ZQ^W3ZFECK%cOYa3?e0A_Km-ReT@Z5rGk5zJuI;zNxGgdY2-1~p3 z&Vkdj{Z)#eu*IN(3c()+{BSWg~215G9TOz^^ER&{k}CM4JbwElO>Q%XC6KHLe= zT6~ilGZa7i-QZ6w`i}R&rL;-%yQ=?#f8-y?)-* zeIN9KWN6$${{ZW9znt`BUlmX91vv5d@Z!qL{_;FLKmZ_1)tsP~YZYuW?9kqbAP>I* z{GarU5PogMeaCq#`O8LM^s0W>4=}o~;v4Yrr*9KF1sH$+*UKbA0W>s>pDWaT&4KVZ zhtcmyPy90wf7tIOUpeTzew9n_g~NU!zYmm1@kgMAF(fZka#E&-#@{IqztR8$iTs_@ z`JEStpRn&G4wKQJ=IO`UYV5y=@5A6A9}~I>S61Y8PbgBuYCf5D5Jzg&SKo>Jo74HX zMdAtn0H*IHV@hbx^Hl!u@K(>_NAU7vT|Oyv2yxgRspU$yWU=*RfYe8AhW+n>{!RKt znbBB{U;1wHMf0wVHW<2pd@5N#iEjc_g^$Hw4ww%}ko6ZRl0ZP($dC)O{{UMY8+{qm z#Qy+QVm{-Loh_rqhBBAEzZ5urB)kx5gRhF+2%sOWdWVvm*w&?&B^gD06aDyS@@q~2 zXGGWP)N&u4bbX^4PwxfZPsF!_21=8~PY!|&!w#h6;l`6d>54%bnghAJvN(g$ois(X zRwjPKp+lu`Gkj$)ycco!nDA*>I(VnyrrJp-s&M?>fDA!=gln<5vEOf=EBP~~NspSb zUvR4V+X4wA7fbICH5|W*?*=8*r^K%fg$7+u)f~CdkSsYLop9Cfw*9|*Z=)Jy3uw$q z=+t+Thf81#gNmj1hnkr`65a<;)8bEtK9ND+syT8qS+G2|medN{u8-syee=Ai!o+B3k?tUun5ho@!*f7*^h3mRZ*!A1sv-@W%7SoCvF?a`Qs zKe+WrN@)2Xrc?XPRh#h_;B0bQ_^099rGcaUsO1POv1?z;I-pQ4$Xg_TJQwnFP7!?- zi3jXE$IU^c^msqhDShC$m+=$eJjBO0ihU63K-A0B+_8#{fkkJTO#lYkh3&u0Z=b1xM|~K9BlC zpUriT{{UIr^gQi5dN2pz8|S|TR-hLDI$Q~bpB;k3GLkN-?tEG zO*m|HHX}dSa-TTp>rOhC-X3Z%_wC?pFSm=`2Pg#UAMH0JU`w6Pt1N0KPSr<$?FNF= zZqGzlpRn&G4w2FS0Ox6a;pVPGX*fSfO4#iQM#LxF$54uM`__9N;v=Ds2!@i;v3zAeycLo7itryEWRn-gj)aCqI=sQv+^m3Xh9OdAAx-<;`|Y39b1e8SViJkCEcihz{*)K%AK1*3GEF*qzvkkPg2x}8QHa>qdci#p!p dvn7)ei^95&B9 /dev/null 2>&1 ; then \ + scanobj_options=""; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + scanobj_options="--verbose"; \ + fi; \ + fi; \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ + gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ + else \ + for i in $(SCANOBJ_FILES) ; do \ + test -f $$i || touch $$i ; \ + done \ + fi + $(AM_V_at)touch scan-build.stamp + +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp + @true + +#### xml #### + +GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V)) +GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY)) +GTK_DOC_V_XML_0=@echo " DOC Building XML"; + +sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) + $(GTK_DOC_V_XML)_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ + _source_dir="$${_source_dir} --source-dir=$$i" ; \ + done ; \ + gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) + $(AM_V_at)touch sgml-build.stamp + +sgml.stamp: sgml-build.stamp + @true + +#### html #### + +GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V)) +GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY)) +GTK_DOC_V_HTML_0=@echo " DOC Building HTML"; + +GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V)) +GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY)) +GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references"; + +html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ + mkhtml_options=""; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkhtml_options="$$mkhtml_options --verbose"; \ + fi; \ + fi; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ + if test "$(?)" = "0"; then \ + mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ + fi; \ + cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + -@test "x$(HTML_IMAGES)" = "x" || \ + for file in $(HTML_IMAGES) ; do \ + if test -f $(abs_srcdir)/$$file ; then \ + cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ + fi; \ + if test -f $(abs_builddir)/$$file ; then \ + cp $(abs_builddir)/$$file $(abs_builddir)/html; \ + fi; \ + done; + $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + $(AM_V_at)touch html-build.stamp + +#### pdf #### + +GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V)) +GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY)) +GTK_DOC_V_PDF_0=@echo " DOC Building PDF"; + +pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ + mkpdf_options=""; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkpdf_options="$$mkpdf_options --verbose"; \ + fi; \ + fi; \ + if test "x$(HTML_IMAGES)" != "x"; then \ + for img in $(HTML_IMAGES); do \ + part=`dirname $$img`; \ + echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ + if test $$? != 0; then \ + mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ + fi; \ + done; \ + fi; \ + gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) + $(AM_V_at)touch pdf-build.stamp + +############## + +clean-local: + @rm -f *~ *.bak + @rm -rf .libs + +distclean-local: + @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ + fi + +maintainer-clean-local: + @rm -rf xml html + +install-data-local: + @installfiles=`echo $(builddir)/html/*`; \ + if test "$$installfiles" = '$(builddir)/html/*'; \ + then echo 1>&2 'Nothing to install' ; \ + else \ + if test -n "$(DOC_MODULE_VERSION)"; then \ + installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ + else \ + installdir="$(DESTDIR)$(TARGET_DIR)"; \ + fi; \ + $(mkinstalldirs) $${installdir} ; \ + for i in $$installfiles; do \ + echo ' $(INSTALL_DATA) '$$i ; \ + $(INSTALL_DATA) $$i $${installdir}; \ + done; \ + if test -n "$(DOC_MODULE_VERSION)"; then \ + mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ + $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ + fi; \ + $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ + fi + +uninstall-local: + @if test -n "$(DOC_MODULE_VERSION)"; then \ + installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ + else \ + installdir="$(DESTDIR)$(TARGET_DIR)"; \ + fi; \ + rm -rf $${installdir} + +# +# Require gtk-doc when making dist +# +if ENABLE_GTK_DOC +dist-check-gtkdoc: docs +else +dist-check-gtkdoc: + @echo "*** gtk-doc must be installed and enabled in order to make dist" + @false +endif + +dist-hook: dist-check-gtkdoc dist-hook-local + @mkdir $(distdir)/html + @cp ./html/* $(distdir)/html + @-cp ./$(DOC_MODULE).pdf $(distdir)/ + @-cp ./$(DOC_MODULE).types $(distdir)/ + @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ + @cd $(distdir) && rm -f $(DISTCLEANFILES) + @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + +.PHONY : dist-hook-local docs diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..45744d4 --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,12 @@ +2011-02-10 gettextize + + * Makefile.in.in: New file, from gettext-0.17. + * boldquot.sed: New file, from gettext-0.17. + * en@boldquot.header: New file, from gettext-0.17. + * en@quot.header: New file, from gettext-0.17. + * insert-header.sin: New file, from gettext-0.17. + * quot.sed: New file, from gettext-0.17. + * remove-potcdate.sin: New file, from gettext-0.17. + * Rules-quot: New file, from gettext-0.17. + * POTFILES.in: New file. + diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..fecf500 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,429 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2007 by Ulrich Drepper +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. +# +# Origin: gettext-0.17 +GETTEXT_MACRO_VERSION = 0.17 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: check-macro-version all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# Ensure that the gettext macros and this Makefile.in.in are in sync. +check-macro-version: + @test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \ + package_gnu='GNU '; \ + else \ + package_gnu=''; \ + fi; \ + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_gnu}@PACKAGE@" \ + --package-version='@VERSION@' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + $(mkdir_p) $(DESTDIR)$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && $(SHELL) ./config.status $(subdir)/$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..e553815 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,41 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = http://bugzilla.gnome.org/enter_bug.cgi?product=clutter + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..749aed0 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,3 @@ +# List of source files which contain translatable strings. +cogl/cogl-debug.c +cogl/cogl-debug-options.h diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..9c2a995 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/an.gmo b/po/an.gmo new file mode 100644 index 0000000000000000000000000000000000000000..571eb2da372127f81dd9e151ee5a9be5279d6141 GIT binary patch literal 8207 zcmb7|TZ~;-dB=BifnW#_+PY96ETG9G*k?R;+{6q{@c0rZVaz!8*db5tI_K9*_tRTqKal1GfhfA=Ic+AN){NDyr1Jph`t4D3ucRt$oN#6@LG< z*1k+UNz^T``Frnm`_{Mq-|hV7Bey&s@jOoZ1nq}6MbR8Qd@Fx=UU^RxeFpqba2dSi zy;1aO@ILSZ;1%#g;4r)w;KzCY8u&@@JK!IKe+NDY{!93N`)yJ5C%hj5?*-3*cY<^9 zqu_Jk$G{gr?eh=e`#*!X^ZqJ$6#O6X!{A--LniQkQ2kGVlJgq)CGgweLGZu8Pl5jj zejfbf0l&`^puRr?YX5J5cYr?z4fyxqpMn1Y{vmkN`=jV{;6d;ZxCZJxb5QI24R{QE z0o1vF4QjoE9Oe*s4|p%Q37!D|3Vas)CHN8W6o*&?FN16uJr8RB_rbfs7eSr>*C0zr z2R`WU;UFk|-wjHhli(kLn;`$9gg=u18YnrR16d;aDX4v41~vXypw{^j-vbYW{|Jgt{|i0_evrZHe-c~* z{~8n@egf)#UIlfIJ5a)B!Q-Iz`3k818Hk9{H^H;u3m{XX*TIwEo1pY^64D(9p8zj| z&w)DEE1=}M6(ybnkAbqkYv6t0^PtZ6PasQ0uYoJzo8S>}1(J%Vf5{)oy#wA4z646| zuY=m>HV!R$2B6OU6vz_MFF@(>SK#Nt+YnZAoCd!NJ`0Kuw_?l>fgc6MvnN2=_lQ5z z!`DFZ`zN4y@fs+7z5yE0a46v#sC|bZUD0m9Z-E;BA}Ia-JBaAf>!8Np%wgmgJ`U=> zRzdM>9B>P~hxcc}PlG=PHUHm0@#??B_d8ic=R5_9N4ucr{Rq^!e+3@^Z$as@x0B#^ z!1JKa`8yCAMz_+Wmv!2Mv@g&MO?T6OqkJHv@(v{AoM|wC$`+#1;qr1=} z+kKcOj_c7K>k-%W$anlXO*(%c4K+oCis;KU-Ro^MJ!fd2qpi|(kK(ZILy!2NM|O6T z`(G5j7sOPf)8Sp*Yo0Iip9{1v(PSH3adZpqBu#gFGfiBUe~H${W3!zUvB~QyO|rN& zle{oCP0cjU=W$i+yu*+p9#uA*)~PM_3{R>g&unVqY%3}9Y#wKo*|J4qhiP1{MrZPA zYBm-cRQi|8i+GgSG$||pzFF8&l1=@~I3Cv1DX(Ud+G%O3+>~(`xKCf5HN6|drx4H- z@gy$dY!qv=`P>f5cwq}$#bcu#O+GQ_*G+t_inCH8X@f-(^Ex&b&5V;$f{&xK62wUQ z(bLYPrrXO*TTWmyMJYc(%t8Aet}QnRhC zQd^q2&FnOm2BWiH4hefPxfZA9bUoo@%AAe#4tp%G3*FApR->7dJj}Pn zaI$EJHQmxr!v&LMrkcf02PUku+|7_y`U_6r(a?^bHX}QlHPq53#-iJ4TBayEpB8rB z9b&@KP<0R~%d^2E-;RqxJ{eToxe40o#^>;8p6pt&$#J)ct%NW~7uVc-nameyY|2qA zc5|3~VV|jEXyM2UBir4AFhSh*vsN?e?QOX{y3zC5Aa~_uR8jf1>Z$_X`s2pm5YxC0jiy>Jsyxn6*o% z&7`nXXRbHgOBi&1y~m{RZDSE*xX(^g*D#x=uJP@ z;8Wh=|`@352ibP}tdL zbD{dOM=&#*;TmBa-o$3cjYF(7j?QJy4>~6+eh=fB-AXV@Y|{BN80vlFdXBqGGF`mq zw;kf9%`D&c7MRd0a_h!Kz?MZ9?9=S*{A`7ZKMgf4EJ88d)41UF3p38+GFz$|KV`mr zabvSNLdjwMoTMT=5DoBYcuZ5K$q2t0PKr4d-T$|fYG$@=$*?5juN^N(8$PP^G#PEM zd6A4U6)z62a=U&zC$ihn;v=~N4GIDWhgwFL^1L!)yjd>dE4W zSj&;>VuY#X<1kNiJI_{{VJsy&zsDJat9#0OOTUv}!v9}U6LXnkNFjWM+uO1!-hDN? z>;nKx`CDziE4amG&CzGmJNq*7A5S+fIlRgOjE^(T5NRmPA_~myqUE%o6TEU*@Iq3K z%-ONc)ReEM>91uyC-eesHHzG_@{ z!~MNk($ys1b{;@eS`sc`y*OCSioBlA+T=f(60zAi5Qf{x|UH2ETNYFv-12S;g*3oj1f#0F>N zs}N>z7MHbZj;$O$K3I8RuyWiSJ-&M1@k1*|S5_D}xD;GCL_KXhPSxiQ=r zY{quJYS!F<7#*KfDDmUt^3*g(8}XDIUzB?%t`a#8TzK@txlVIOmsbv)$x%UuR67ff zCv_iLq&CUEpqNuYhzGB1K0G+ljdN5ahdP(x{NUHBIWbJC17!BIWSHQ>3%i?_xG56i zEFtTxEO$S)5Qn_Yl>yg(X8)hV`@D~?Hrc-!FCltfWJJX=zD9KdzH(!s|2h%Q3CW#80i^d(){=j%Nw~6dwKM-)7`EE}OxZLcJhGgspvs z9<5U@AkGpUD7`5c7(-O`7B;2}Izw>S?L^?Z=Lr{}rFxsJaqjCsa~m`gU4JPEzo)*S zD$vmi#cAvWTSS6nQsV|C3FU|Am)dq57D48u?b#6zTX~H&RZzHIDYU6O&XAi|iQAq9 z-y)8;W>$0d&n}Ig42&6Ge_6Ga+sdbZ=czOHA3~gGEeW-EjL#^0b5s)$M{MmhndTMi z0)1m=YG1q^DCQ>|2hKt$a zBiDhvs$rxfSKREl(x$(nb*ZRRF`23Es=sclVo?^uC^5E-!^1GDV$YGBRJu3GrHCqf zM*iNgTzo7%(ScO?AeJf~X1n^wuhNt}+#E&F=q+n@2OKXkqCHiA4bt;?0_Z3}81}o98G)_q9i@E)8h=a@0Cbs9Okp z{FvCQ>f|qog>|=%S0`~d#F1VYdD}S9&2}4fuS$&&Rs;;W(LG(^cQ1KOnitS7q$}Q6 zhg<}$tTqFfzK19Nnrbp1m(&p0I^Fv~+kOwH=taYB&d83Pk7s!wvFfg`XL|llHXYSt zUp02)LR4+{8z;k>7*+dUY^>$(lQtPb8ZHvW*;Vz1WUy z+1`G+am>4ALG4u3)}=wJ3i;W~8Du*`9^Cnn;5cvWaK&b4=zA1{!E|SY*iEM|L%9%{ zL4QQ}=?SNjQ~E4iq;?@wzPq(p5v`jU%g%$8(;}&ynT7(@m8%j?A8|7(39u=Wgp}IC zcn^$Aa3LE3!@5^WI;}acDwSQ^=t<7nrTUGjt7eU^#yIVL>H%lkRIDl!SZ6CyZlu!% zMl}U1OFUldC$Lg6KE_xoegI4A!zwRaN+scZ{fb+V(ujl(n6S*MsL!Iszrrn1Hf wI#XFTXO|cV3C%no=Z8b|a0@jFi1gv(fjk?YrU?qmk+)0f#QDaSpZk&e_bzg>h5!Hn literal 0 HcmV?d00001 diff --git a/po/an.po b/po/an.po new file mode 100644 index 0000000..d9af876 --- /dev/null +++ b/po/an.po @@ -0,0 +1,366 @@ +# Aragonese translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Daniel Martinez Cucalon , 2011. +# FULL NAME , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-02-18 21:08+0100\n" +"Last-Translator: Daniel Martinez \n" +"Language-Team: Aragonese \n" +"Language: an\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valors de depuración suportaus:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valors especials de depuración:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Activa todas as opcions de depuración sin comportamiento" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variables d'entorno adicionals:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista d'as extensions de GL separadas por comas que se miran de desactivar" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Omitir a versión de GL que Cogl asumirá que suporta o driver" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Opcions de depuracion de Colg que activar" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Opcions de depuracion de Colg que desactivar" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcions de Colg" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Amostrar as opcions de Colg" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Rastreo de Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referencias de CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de conteo de referencias ta CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Rastriar o troceau de texturas" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depurar a creyación de troceau de texturas" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Rastriar texturas atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Chestión d'a depuración de texturas atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Rastriar cadenas de mezclau" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Analís de depuración de CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Rastriar diario" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Veyer toda a cheometría que pasa a traviés d'o diario" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Rastriar procesau por lotes" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Amostrar cómo se procesa por lotes a cheometría en o diario" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Rastriar matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Rastriar toda a manipulación de matrices" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Rastriar dibuixau variau" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Rastriar qualques operacions de dibuixau variadas" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Rastriar dibuixau Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastriar o dibuixau Pango de Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastriar o backend de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastriar o backend d'o mapa de pixels d'a textura de Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Esbozar rectanglos" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Adhibir trazos de linias ta toda a cheometría rectangular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Amostrar trazaus de linias (wireframes)" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Adhibir trazos de linias ta toda a cheometría" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa radiz" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desactivar o procesau por lotes en o diario" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desactivar o procesau por lotes d'a cheometría en o diario de Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar os búferes vertex de GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desactivar l'uso d'obchectos de búfer vertex d'OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar os búferes de pixel GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desactivar l'uso d'obchectos de búfer de pixels d'OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desactivar a transformación de rectas por software" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Usar a GPU ta transformar cheometría rectangular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista de Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Vulcar atlas d'imachens" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Vulcar cambeos en a textura d'atlas a un fichero d'imachen" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desactivar os atlas de texturas" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desactivar l'uso d'atlas de texturas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desactivar a compartición d'atlas de texturas entre texto y imachens" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Quan isto ye establiu, a caché de glyph usará siempre una textura separada " +"ta la suya atlas. D'unatro modo, intentará compartir l'atlas con as imachens." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desactivar texturizau" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desactivar o texturizau de qualsiquier primitiva" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar l'uso de programas de fragmentos ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desactivar a función fixa" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desactivar l'uso d'o backend d'a canyería d'a función fixa" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desactivar l'uso de GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desactivar la mezcla" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desactivar l'uso de la mezcla" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar as texturas que no sían potencias de dos" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fa que Cogl creya que o driver de GL no suporta texturas NPOT, por o que " +"creyará texturas troceadas u texturas con residuos" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desactivar rectorte software" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Desactiva os intentos de Cogl de retallar qualques rectanglos en software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Amostrar fuent" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Amostrar o codigo fuent ARBfp/GLSL chenerau" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Rastriar qualques OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Rastrea qualques gritadas OpenGL seleccionadas" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Rastriar suporte ta difuera d'a pantalla" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depurar suporte ta difuera d'a pantalla" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desactivar as cachés d'os programas" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desactivar as cachés alternativas ta programas arbfp y glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desactivar optimización de lectura de pixel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desactivar a optimización de lectura de 1px ta scenas simplas de rectanglos " +"opacos" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Rastriar retalles" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Información d'os rechistros sobre cómo implementa Cogl los retalles" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Rastriar problemas de rendimiento" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Intenta resaltar l'uso no optimo de Cogl" diff --git a/po/ar.gmo b/po/ar.gmo new file mode 100644 index 0000000000000000000000000000000000000000..63a1541aaf9d1398198b26a6cdbf45377e5c77ed GIT binary patch literal 940 zcmb7CJ8#rL5H=8mbfN)?hKDo_p@`PEK3_<1;v|rlA`vA@jwliZ+Os#l1>0+_*TB*7 z5RWt{1^fYupa_t{`)5$D8w!32$btg(K z3|ZE!jAB^Hw2*1ucS7DSqDZ6>Y{e|fK}*QF{%5R6tLS=1-h*B(c~EOr$=f{8WGN&Y zT;*8bgP^)BVY%k2w#GB5G+E9g5t3^~l#`b9prdu>)$7>70};o}j#8O$TdJteQ&io; zfE`3)I#V(%0__KJp{r`ED=jjsIIHF$b4+s&8q{eLI!0&{oTleCN2o(7CXzLNS5*BB z@*G015b6S@p6iTI7xS)Tm!zdwn#W8_<-yf<$YRAhB7sF47TBGRER=vr)(!=JALBfk z>9UTLb|8}})TdFwB2HSIC8$=cEdrPfWiZ2#^DfV;u?C4AFjZS#TAm-Q%du%~R^r?# zw$jaTCe82bdKNR0PC(FM3RmynXf2TOL0;AJ7FT3G4P=Oa(Sz}}(6!aLP%I`3QYE, 2011. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-03 00:31+0300\n" +"Last-Translator: Abdalrahim G. Fakhouri \n" +"Language-Team: Arabic \n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " +"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n" +"X-Generator: Virtaal 0.7.0\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "شارات تنقيح جتك+ التي ستُضبط" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "شارات تنقيح جتك+ التي ستُصفّر" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "خيارات Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "أظهر خيارات Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/as.gmo b/po/as.gmo new file mode 100644 index 0000000000000000000000000000000000000000..3537db819b45c0be6a6bf24906c5e66c9456153e GIT binary patch literal 12555 zcmchcU635rb;sKT+hj4=5G=>RcCPGT?1)+IO0q34l0hFJ%ScGp2M$$E;oh0v*+w(d zLwAo>!W9D8LQY}q#4ec%$OcN%EG2{qqyom35_#|oPF#6Pm8()oCaH?^ke5{Ql2j$B z{LVSIduDcLKLm27w)fxN_v?K8&pG$b{QdP;o(lMUk?TWTXRio?CV0y``NyaCt|0g* z_>bT?c;&l;U@f>2d=GdSd@nfdpHuKgo_`6u1Wb z1^Aob|A3zbKRjmZdC24O!2?gwSP92B{}1Ktas2fqwni85mE5d2f{ zaZtwJ1}Q!dJ_>#X{7bM6-ohkD!S91Hcmt#mc^?Ar055>!;J;cb!e*yj*_`BfC1W6ryFG2SzI0qgA$5BGwe+`s={|d^yy9tgEJOMrc{tLJZ zyceTB2tEg%20!F%p4UN<|Jt?41fBq&0&l=MUj$zQ<@p^L?;-Fs_=n()7<~iwz5srL z=YPO?e+FLlaf_de;1-_$1{A%nzc~oL3f>1YW$?G)4)A}$PlMZ;MEV~GMZZ@;h6Y#T z43T34xD)(3xE_2H6u5Q;4bhk@b^HO?@dtbe&a20 z0Xz(fJU<1c{aTzj3w{Nxf^UMyzzWVh40b_W5&SoJ7CU?pp+wJ%6W9uTCzr&DyxYnp zzHwYM4}FBY!b7piX0A3jUM0AZ>h+#lS@B|ehRwFa6a5@j(JZ#lFjW8YR9_Mk=3L7qJ9gWkZ)r?xXI~t~OINgY{sbEJ^Z@7JJ>6F>S!FE)Q z!$zFt_IxM}t8uGt54C8zQ?K*rW*T8Vb9v&j$afsk)@c>3`=;+lK$k`{Q5vM}!n5QBX zb7dl{wI(w&Sv8HKmdiTrc9Q1)Jwmu@(rM)~B+jyqx3tV=a%R3~jwBtH4f95rxn|f3 z>ycP6*lBWzu>0dy4~|p_6(VHv3A< zpc3s9m_BE5v)zbXR*i(+ zD3i3q2Rae7Q1Zgaay2iE7q@&ZGrG2#d~mh0J)4EwtSFWl_TF@q&j}agt?C>%@n(O) zESbsYgk#l4+-?t=u51x8U7m)mjKFM`YYwe5IM5nKzCnWH7#wru@zDV(IvL?V$k3c1B&Lco$md&48Fta&yk#E(GD5Efw={8UTve(GvTl(lZoi#+A- z-oNiqp+bhTHYUy~4^#tk8X41NjkrqQ^qLY*Y5#sM&S%|Rn9(h6@jtAM2m7q53|KPQ z$Kq*RBUDTr9wqJCaw@Ve7?LA#fpqc$`-GYW2a+UrJ3`zY94u{7*i7HliFM2Hkb0)Q zURaAtowQ1*B{e@z#`ZH?=B6VtqUJqx^r`NC%a*p1O=0&^H3^p{f#l1V_ukR4L3W=C z4q5?VD)VabUW!}fwkdrMS+dUpd%3+x$^KCyz*(Isx`>7RD5^j+Y?qw2F+MB%3HQcX z)$L5fIY|iCVL!A?+yQ2$DyIIWpV1w}zx}SV4S;!Rd`#+4+@{bAG5wg5Z8ooVlp<@7 ziwmK>Z%3)}nR<*X_@A-~uqKT;OD2PFnxaF^bRaauu~Mde7a@qU#`L1l59(F6dd5nU zT4Xa}J5Hq*=Uod&rj zz45?!EgEQgkSL~(6sFc(kp=tHM7Cj--L=X+7V1+to*iIQQbjs;Ad+oTWp7rGYnAPt zdR94lj4@om(pTBn+Ctu{KO@N|qM zR@ouB3SlZcNm)~F!^GsK%EV_X6Pw)Rrm2ma)=f-KOwh4%AUYaL>go5}P?^}wpPSq` zwPEwRiBD~u7~6xC75Lf8Ab*lhxx3>=*sLAzsF~TDFoPh_|Tn|&Ha8#J@!m@v`BXFY07P$j`OkKsqC`6C~E9U zjwqX)tgyc!)u(bNg(jPFt+qa9TQ}V5>~?F*t=;M-ZygJI-5>S3r+VF2dh?IFUiWlw z{)t}qrC#@9ulvJZ_l;into)z<6WT85+Y7z-2qzxqICwxjUu3P6Z2AeXKYCj7&NIFgJAjf0N=wsh{eKcxZnX3C^paDE>0)q7kp2 z5+jMJ(AMkbk3MP|Ol4+dhVz4+0!=DKpI3Fh*9skfP_!b+^S${;3KN|%6Nv#$Lea_#w|RrOGY;s8i{v7#$~t=B!LJ`oZ#l`$34W8>R13>orDIhjzORh1yJo-$6< zLMU0%xK+v`ua=sqZ|Tfo8F~%`s2oq#?`MQpUD1J77J02Fp=QhY@LXyE9j`$yW?_~$ znB_%{YGQ%82w3w8!T++V|FEtjiV^d?`cYw2ra@;f$x;id$LYq@7Ksdpy|0+?O!0yc z#*@H@V4-<`O#((bF=$opJr(G(#3jkc437uRSVSbMbcxI5M7Wfd*tV`(E~TC1Wz9Xv zBG$$7!q?T$qF(~6zPnFW5PoQ73!&xm@}&yaJ9joHY7E9VB1zz^(rblY)DFD%h<*Do zkaC_Z<`i=cGQMDp*wGg=ctu{22bhNl#y+cp3yaw*#amI2XN~8!nv_oNpzbTdqOV9s z#^I%jAvA{4Pbr_DW~HLy4rBtei>BA^d=Y5kkf)1q=x2>ZHk2=C)cD^YjJ~p>k!hgQ z!)jS{y#zNe=bYW5J-wvl+oZ-soF6+)Rxmak>U@%APa(IotoqOu7rwqO#M zmY1pEQV>_Y&Reya#Q+7ymOZEZ$NK#}ft2wPv#(k*v?QxTEZK9DYjF-mPgdl4;lytt zYUHawHI%rYJ8WqQb}%b04rlSI74ElCM5VO(ZOGf0$Dh_khTby6cKA>Fs688dT zX(XdO_8B~?We;?>HsjLzAE zp};gti$+GWGqj||6BTv%!jxnMj5%=3i>jo2v0(f4(FbsvSIp@1cDAGIx4F#ib|Qsm zVvZqC>*7-K%DhT1jM^^{a#SL(%b}4wJ$m}wD01r|tY|r>K6;667{C0IWLO|oR1Q=O zMpf@3Knf)p`=tC1AeP15R4pGeHcINM{TMLPsa6HbN+&9?zd&6bC$r0J9Q8yIx$I0= z#-;5kpQB*}W1zXOp0s0+vXr0JRs1=P8NX33v2d0JEMuY%XyXV^NvpAt{0fBdm~>2i{2s`(8qh z9ayV$S?NTvtW7AvYo}g05yMg4&vnn}w-UTrAqKj*u-E;bh$BqGso!N5<}{OvM|4^> zp8R-N{La$r{y}g4TlACWo3RGCh_?O-Gf z@zJ#8+I=yX>|(~o0@znKwn}p?HbaNRRTG-E!_=$5Egwcx5yk8Gn@(R70nt*o}TiZ z?=mw=W%R#K`Cq&=O0XuJ?pOBZC((2=#I%+Ao7)I5q(#{$jPJ<#$NIq9{#d${CF}<& zON{;fhmS&^%9c@kq<_qi1IbjRlghH}L?kZ6747Ls#LZhS;9+zDUTHokfjJ~c>7Hvf zBJ@`+m@PbCX(6;?t5Ig$l0C*Lp-&kfl8lx$LZK?jOd^r*X=DhTF8yo4ZUt^N(qU7^ z4)6BLL&37Lj2c-aO0&34{#nt`g+oYubvTtF@Eq+veOJOOaiL#_PSe*`Lq`Sb{(^y|sT zdh^fd&Scpirl4Ix#{Lcm^7ZQ}w9-Z9*{JbzvKn@TT>aF%sElfYABy`W3n<0UqR59t ze^z`$(qLf@R(M1zYrj#pk-8hfQ7A2qC+&`2Jg~R~k##9Y`sytEQ2lPfTk-|#pgKxj zlxoSVVnWqsRW;4XA_qT)BSKfBMV6ydcrh`)|FMVHi^#mZvDGu@q!MEg`To@l$_wOU z=jM4TW|K_=p$e7g^{`oG#OaHEj3&vkW%2uFk_WcK2#hif@Q{2FXXf|CW5hYp+P#p0 XvIuKRfml>Iid7eGj~DJR3XlIEXE8b* literal 0 HcmV?d00001 diff --git a/po/as.po b/po/as.po new file mode 100644 index 0000000..30cc520 --- /dev/null +++ b/po/as.po @@ -0,0 +1,364 @@ +# Assamese translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# ngoswami , 2011. +# Nilamdyuti Goswami , 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-08 13:28+0530\n" +"Last-Translator: Nilamdyuti Goswami \n" +"Language-Team: as_IN \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.0\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "সমৰ্থিত ডিবাগ মানসমূহ:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "বিশেষ ডিবাগ মানসমূহ:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "সকলো অ-ব্যৱহাৰী ডিভাগ বিকল্পসমূহ সামৰ্থবান কৰে" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "অতিৰিক্ত পৰিৱেশ চলকসমূহ:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "ভাঁও ধৰিবলে GL সম্প্ৰসাৰনসমূহৰ কমা-পৃথকিত তালিকা অসামৰ্থবান কৰা আছে" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "GL সংস্কৰণ যাক Cogl এ ড্ৰাইভাৰে সমৰ্থন কৰিব বুলি ভাবি লব তাক অভাৰৰাইড কৰক" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "সংহতি কৰিবলে Cogl ডিবাগিং ফ্লেগসমূহ" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "অসংহতি কৰিবলে Cogl ডিবাগিং ফ্লেগসমূহ" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl বিকল্পসমূহ" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl বিকল্পসমূহ দেখুৱাওক" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl অনুকৰণ" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject প্ৰসংগসমূহ" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects à§° বাবে ref গণনা বিষয়সমূহ ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "গাঁথনি স্লাইচিং অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "বাং স্লাইচৰ সৃষ্টি ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "ভূচিত্ৰাৱলীৰ গাঁথনি অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "গাঁথনি ভূচিত্ৰাৱলী ব্যৱস্থাপনা ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "মিশ্ৰণ স্ট্ৰিংসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString বিশ্লেষণ ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "আলোচনী অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "আলোচনীৰ সকলো জ্যামিতি দৰ্শন কৰক" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "চাম অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "আলোচনীত কিধৰণে জ্যামিতি চাম কৰা হৈছে দেখুৱাওক" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "আধাৰসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "সকলো আধাৰ পৰিবৰ্তন অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "বিভিন্ন অঙ্কণ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "কিছুমান বিভিন্ন অঙ্কণ কাৰ্যসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango ৰেণ্ডাৰাৰ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl Pango ৰেণ্ডাৰাৰ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap বেকএণ্ড অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl গাঁথনি pixmap বেকএণ্ড অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "কল্পনা কৰক" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "সাৰাংশ আয়তসমূহ" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "সকলো আয়তীয় জ্যামিতিৰ বাবে তাঁৰ সাৰাংশসমূহ যোগ কৰক" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "তাঁৰফ্ৰেইমসমূহ দেখুৱাওক" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "সকলো জ্যামিতিৰ বাবে তাঁৰ সাৰাংশসমূহ যোগ কৰক" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "মূল কাৰণ" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "আলোচনী চাম অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl আলোচনীত জ্যামিতিৰ চাম অসামৰ্থবান কৰক।" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL শীৰ্ষবিন্দু বাফাৰসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL শীৰ্ষবিন্দু বাফাৰ অবজেক্টসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL পিক্সেল বাফাৰসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL পিক্সেল বাফাৰসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "চফ্টৱেৰ ৰেক্ট পৰিবৰ্তন অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "আয়তীয় জ্যামিতি পৰিবৰ্তন কৰিবলে GPU ব্যৱহাৰ কৰক" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl বিশেষজ্ঞ" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "ভূচিত্ৰাৱলী ছবিসমূহ ডাম্প কৰক" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "এটা ছবি ফাইললে গাঁথনি ভূচিত্ৰাৱলী পৰিবৰ্তনসমূহ ডাম্প কৰক" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "গাঁথনি ভূচিত্ৰাৱলী অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "গাঁথনি ভূচিত্ৰাৱলীৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "লিখনী আৰু ছবিসমূহৰ মাজৰ গাঁথনি ভূচিত্ৰাৱলী অংশীদাৰী অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"যেতিয়া ইয়াক সংহতি কৰা হয় গ্লিফ ক্যাশে ইয়াৰ ভূচিত্ৰাৱলীৰ বাবে সদায় এটা পৃথক গাঁথনি " +"ব্যৱহাৰ কৰিব। নহলে ই ভুচিত্ৰাৱলীক ছবিসমূহৰ সৈতে অংশীদাৰী কৰাৰ চেষ্টা কৰিব।" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "গাঁথনি অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "কোনো আদিমৰ গাঁথনিকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB অংশ প্ৰগ্ৰাসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "অসামৰ্থবান ঠিক কৰা হল" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "ঠিক কৰা ফলন পাইপলাইন বেকএণ্ডৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL à§° ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "মিশ্ৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "মিশ্ৰণৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "non-power-of-two গাঁথনি অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Cogl এ ভাৱিবলে লয় যে GL ড্ৰাইভাৰে NPOT গাঁথনি সমৰ্থন নকৰে যাতে ই স্লাইচ্ড গাঁথনি " +"অথবা আবৰ্জনাৰ সৈতে গাঁথনিসমূহ সৃষ্টি কৰে।" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "চফ্টৱেৰ ক্লিপিং অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "চফ্টৱেৰত কিছুমান আয়ত ক্লিপ কৰাৰ Cogl à§° চেষ্টা অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "উৎস দেখুৱাওক" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "সৃজন কৰা ARBfp/GLSL উৎস ক'ড দেখুৱাওক" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "কিছুমান OpenGL অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "কিছুমান নিৰ্বাচিত OpenGL কলসমূহ অনুকৰণ কৰে" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "অফস্ক্ৰিণ সমৰ্থন অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "অপস্ক্ৰিন সমৰ্থন ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "প্ৰগ্ৰাম ক্যাশসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp আৰু glsl প্ৰগ্ৰামসমূহৰ বাবে ফলবেক ক্যাশসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "পঢ়া পিক্সেল অনুকূলীকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "অস্বচ্ছ আয়তসমূহৰ সাধাৰণ ছবিসমূহৰ বাবে 1px পঢ়াৰ অনুকূলীকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "ক্লিপিং অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl এ কিধৰণে ক্লিপিং প্ৰণয়ন কৰি আছে তাৰ বিষয়ে তথ্য লগ কৰে" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "পৰিৱেশন চিন্তাসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "উপ-অনুকূলিত Cogl ব্যৱহাৰ উজ্জ্বলিত কৰে।" diff --git a/po/ast.gmo b/po/ast.gmo new file mode 100644 index 0000000000000000000000000000000000000000..87cf58ad4729ef44dbdc637bda456c6e32e0df1f GIT binary patch literal 895 zcma)4QEn445M7`M5%B>?d;!w%g+%4eZb;SOG(bpOREa226RQ3p*E`u5dF{pamcj|( z0B{gE0vF%}d~garnN5fykSby6Y3zM(X5QHQ z=o*JuS{K;R=PF~*s@$`wg_C$v~sn{$CPIBO616#Tfno>EVWRk3vwwK<4}bexr;`nq?<<%87_X8zdmGGk~yiq heKji{-c, 2011. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-11 18:52+0200\n" +"Last-Translator: Xandru Armesto \n" +"Language-Team: Softastur \n" +"Language: ast\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Virtaal 0.5.2\n" +"X-Poedit-Language: Asturian\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Opciones de depuración de Cogl qu'activar" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Opciones de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opciones de Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Amosar les opciones de Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/be.gmo b/po/be.gmo new file mode 100644 index 0000000000000000000000000000000000000000..fda88b6173927b175209d3647e3c4daabf0acb5f GIT binary patch literal 10743 zcmbW5TZ~=TS;sday=-oZ0cY zb?J#`e_X8!w0#5c}{{kf;h$EAdnzR0#(f8Sbbe{bczZwDM-;`}AfKfNais^B9Z;E&_`9}I$D2LA;d z0q^}#5Ud6t1wR752>u*6>F*Qp)7<|K_!;mIz)yfz!3ps1{qy@i90Z@_el7SgxE1^? zSOq@?o(1m*zXfWXTmJdqg71ZuqRgYuh#Rshz5vg2itkOXHy`QdF){{AdN zx53G+;3n=*qx{R@UxSZ>pF>$h1_wd$r3`A^T#2##f-ms*6!>LOJb4G)4}J&y74SYD?g7WZ4d4lI8@LEw z1OFR*1pE%l?f`!Po&^gyaU5I%i{OvJjo`~9ll=4+xC{I%@Fno0BP2oKLdXV-eZDb9r$lx3%s9XLPRhN zDlUHkegXUka4-02g8m>_1J&+rZ~|Na<-dOiWzQOvlRaMsrT=+Q?{9(pf*rhJfZ-8F}|Hj|1ToVMp!Tnw^ z0sj&#f~y~Le108V`BUT@xRvJ%D8+5?0Z!$~PEOhPB&Xq&ExiZoS-xPlwOckwf5KxA zaX|he%=UPSfB6%d+d8I)yE&z^;-v$s^c~`_YJ=*UIH%(o`|oP0zYHGZ;$xi8aej$& zGv{hf@k0kD+FJDyd*}X?Q#x>C@GR#x-Eb)Pb$r}`tsRQrr#O|r&?opH=L?*;H25&5 z4*5`dub3*n;?@(KI-s;Y2z_vmzy1)YI<>{$tH$Mr;;C3a&-n>X@$FvDO`Ic~Kh3$F zQ#=bcmr7_n?Dq+&sJZ{GIT39hr z?QopbYt^XMG>5|^4ks&7Iv#ATmn&v>Lyb~*v#${q~2cYWUE}} z)=X8xa%!4&lSaPbfOoB0{&x4|D=27^XevsgS~1dK)oNHsqehs7&8TEFqNz`r9Xm~Q zq#4yxsiXlKNyKf*gm|VDr&7EWY?C5J+Ha}wa$hr%QpifBt9x6Yno5gF6xB@HYBcIe z(?3TEQ>?dYO?8RWwB@@pgy_G0BlVP(sZ8i7(!(?)*(P@^ymVa_Cn7C$|(~->Mfm85kGAtf4#jrS?Q%i%G5Z{(7X$42u%Sl-68Zm`wxZ0~!tJeyR`b?A*>Qja0 zOx<|zblcbAQ8j)w6q_t}lPHuDW~_0<-luW3QHe}ijKpq?sW-x}v?6F>$qOSpqj_b# zx}C?8Xd2e#y`y#Br_*qo5#^cw=uJk=8F4{Rt<7r>4cajaO08;xGqb>2u# z(@erzN@7+!WA=^H+tIxk_yi4(;&9y6j1Tu{(Mn1GDYJR+7BiKEWt*?7szFNUp-D?hQ@6R-wY0zKVMo(DwEvY$H9db%7%Yp-RI66BylBLYNYxF_ z7Y`vdcVlXqye1{tno+gUw7IWXn3UqzLlF@_4+(^CRiUuW&pe=d(x;dyPE#6T9MvSO z8QTuEDp9b#X6v9Wvf}q-G#ws}NlJ3k)-xFDYU9p2T~f|?;L!ZF0Dlo0*IlbtWrKD5Ry`G7i(`F`2X%^S`4@)D#Za1s+crw_{;7ME}Rh&B9s_eSq ztjc!4kQzw{)W|FB3u+qdt=F4oYe=|*eH~xqKC@5CLuS# zeY=${HItE?XzLy}`cn6btCnsgC&FE8)+Al3B$A)LeDn^76{`Dqu+L2Zh;mWQpKEf9 z%w|iU{jS)jfqS?mFUkH^8DQKzlQ)rvd@p8!YS`#-+V$~O*$dnir$w_Z31?IgT!TH( zvTpVwnOQOM54}XQkN9?*Y8e3YlK6<`p}4_BFJk&W9kw~SwxK3jce{Kdbk7@6V)@K` zOepwISOmCNHs@S1>3vd_4JBs-siDAXn)XdZ5X%~87ZZK2U7fd{u_{u_d?vO-wKS@z z*7|Bz#CVMnyA+;|%hMH3<;!HjP6MQ?9k`WJ(?^0AsiKzBdtOw|H}jI6bH9I;bRdpq zYz0u44hb8uUL0&rC-qi&+RDobcpy$&ERkM~f`ikVQl^#ts2;h*E?15=rrpftGB&Kt zghx}Oq8QT3EqU^6wKHQ(y|Yzp#Oy|mWG1F`IHd&DrJZolSCA^hN^5Ygu5+ zgR+=;BzLu~6=|?1scRWlc&=19;8J~@z?Ul{Rh5cl#okEEq{6PW9G41PTIIB`zdmlJ zo6W}fx^*nLUZwnmBjp+)8mTAcb=0~j`E6c|6wC3`%u}USu{lw!v?$@p3W``^t7;X> z6t+>a#?AWCu?>aM#|xty%-DwUM>nh;9UC2`VPS7{I9BQDwp(8qeWI}bF*El0@zE#N zjy_7eooHErpS2Y7*OPJce3-_e*;22SSVSHU&89$IX_Am2!*LHM1!m+o;lCDOk&%Dc5mHR3_|=w7>5-b!o+}=XP!Hx^HY`bj8*> zeyE|^(FQik=j$4kFs?nRi6?;-6EE(6wy?3=&hn9k)b<(`5R#3XjgxV6#h!{Lp2D-t zG3mIeHSBFV@#vGrT~5><7#p3K7&8w(XmmNcdSYzMJZ(k|t+{_{VtxK<)5Hc{K4hD1 z8XGlV{i^Fio6(2qGe)2FPp){Wu*217x${7rG(%EpbmVcYda01pWnc4X1;ea&Rs`AC zv-#{&Hs3zgK5MciE{@s%>Pv=|6 zRp<0IDmV5$jZqnxrs$`2AolZC0?L3;zBKIb$Udk5Rv*ST_A-jbs zC}&GZkiDDTLSa3bWyCppobYeHDUGgR%%#TyyK@jdjc$G`Ac;1{$1fpO6G~3Nn=PmS4$mlx=6d zwupCbwvSn#^=#b+_i*|-@({?S_DQGmA`;JWD}pEl^U!17c-tf%;>n^F*Wr%_+e;^aD%9BzbX5qDC zLG~8vF5%Pj?T$}xwdd4AkrC^~Mw4Bn`D>69^9bs|e(#CjZ6a->e3!lKPGXQ2SEQeH zaGraYT?Cet)4e7RQpRm!2gw!hmWdcpFQ_FZ>ruid+sL5NAeJRDWVFE_*oI8Bq`FQC zxFWYgcldHT4=%Mpkz26;*ZJn49Wsfk4e}s??bm#qe6+1V1l%C_mldgjo%+JBE~+Bv zeasiStB_CJKviWW`80qb7(yGHZ)C7i>`eQ7Zigk30%UXDaB<0okupjEyWCRR;9^-# z(n}r{fQwVMOw6kskQ%7x9kVFzxrRz~*KtB{Gpn3rAY$!0wgTionp^ZzbAKu?WIhKqiL zQ-RAa53<8Y!c!FIoh0n&r;ax;@-^9`c{69kkcrfVsC{AJ7+w2&%UHh`26gOjfkvGg z`2Jd}9G}M=au2gbX& zhGbgOa4zv~FY{zvr_9?neit^V1l;v7x6caiXOO!ot3wnS6!YOZchRPpCSa+%(4d;jiS|t~$}T;8t}&u3ovdV4?;=s0l}xu>;(=QWX#P>YW>>Ro6b-AN&3`RiZtpjw zA=TP?%h6c=Pyy=Z@8J3sWPgIOy(k%Vuv_zi6F@E`>N#yqBtm>f6qs}Tn z$bOIRlw;({Zfo-*mzOC{EY7WZ*+rEsT;$f5E+*D-^Jq24xF@BIRGgD6lvoI|cjQD2 zL{-E~u-)}DbDs1C?=138D};8@%ZzHBtFe#ySypxX5@TCQR=i5oW&6#o&|kh-Ad82* zmT@RgZFke7k7#b4t=o=E-dFvC6y{T6%srr_S{`05%pgOcyPq2oy(b&o_xd7MN)zn}eXlZ91 zZ5$opv^`LY5Hn*xW)2&~#!TH8Z8G&cby%mo)M|}pUDWwFU~`-#CQmf@tjm^Ra&9k= zgRPTHKMc7yR91go{E4>OL&kSsh3vdfjq=Xs3q)QuG`Z^e4B$jA-#f`xKZ)5| zs4TSA`$DG}?clq-))H_)%tY?;jmz-8CCvwa0c3f=y9LQbx+~jxt}Xi%>E}d!*m7QI zzwTE&%DT>!#_qST*1UxawK(z16wp^#O^Eg(>q48De9YkiHJ#bje`Anpb9RHqo?8n~ z_ob8%7Ix8((tL_rzAL?n#GX2S96j}k(eL|u_oaLv^KPBR4{Y_jReyfOWT$L?NiDuG zyqVp=a$2~xvDPqR0m16qCjY&kAlS Ke&IHz2mc3, 2011, 2012. +# Kasia Bondarava , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl.master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-26 15:09+0300\n" +"Last-Translator: Kasia Bondarava \n" +"Language-Team: Belarusian \n" +"Language: be\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Virtaal 0.7.0\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Вядомыя адладачныя значэнні:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Спецыяльныя адладачныя значэнні:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Уключыць усе непаводзінныя адладачныя параметры" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Дадатковыя зменныя асяроддзя:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Спіс GL-пашырэнняў, падзеленых коскамі, якія трэба лічыць адсутнымі" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Падмяніць версію GL, якую, на думку Cogl, падтрымлівае відэадрайвер" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Патрэбныя адладачныя сцяжкі Cogl" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Непатрэбныя адладачныя сцяжкі Cogl" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Опцыі Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Паказаваць опцыі Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Трасіраванне Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Адсылкі CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Адладжваць праблемы з лічэннем спасылак для CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Трасіраваць нарэзку тэкстур" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "адладжваць стварэнне зрэзаў тэкстур" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Трасіраваць атласныя тэкстуры" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Адладжваць кіраванне атласам тэкстур" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Трасіраваць бленд-стрынгі" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Адладжваць разбор CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Трасіраваць журнал" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Праглядаць усе геаметрыі, якія праходзяць праз журнал" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Трасіраваць пакетаванне" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Паказваць, як геаметрыя пакетуецца ў журнале" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Трасіраваць матрыцы" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Трасіраваць усе матрычныя маніпуляцыі" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Трасіраваць рысаванне" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Трасіраваць разнастайныя рысавальныя аперацыі" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Трасіраваць рэндэрны модуль Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Трасіраваць рэндэрны модуль Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Трасіраваць бэкэнд CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Трасіраваць бэкэнд растравых тэкстур Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Візуалізаваць" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Вылучыць прамавугольнікі" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Дадаць каркас для ўсёй прамавугольнай геаметрыі" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Паказаць каркас" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Дадаць каркас для ўсёй геаметрыі" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Корань праблемы" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Выключыць журнальнае пакетаванне" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Выключыць пакетаванне геаметрыі ў журнале Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Выключыць вяршынныя буферы GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Выключыць выкарыстанне аб'ектаў вяршынных буфераў OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Выключыць піксельныя буферы GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Выключыць выкарыстанне аб'ектаў піксельных буфераў OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Выключыць праграмную трансфармацыю прамавугольнікаў" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Выкарыстоўваць GPU для трансфармацыі прамавугольнай геаметрыі" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Спецыяліст Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Стварыць атласны файл вобразу" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Стварыць файл вобразу са зменамі атласнай тэкстуры" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Выключыць атласаванне тэкстур" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Выключыць выкарыстанне" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Выключыць супольнае выкарыстанне атласнай тэкстуры паміж тэкстам і выявамі" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Калі ўключана, кэш гліфаў заўсёды будзе выкарыстоўваць асобную тэкстуру для " +"яго атласа. Іначай ён паспрабуе супольна выкарыстоўваць атлас з выявамі." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Выключыць тэкстураванне" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Выключыць тэкстураванне любых прымітываў" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Выключыць arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Выключыць выкарыстанне праграм з ARB-фрагментамі" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Выключыць фіксаваны канвеер" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Выключыць выкарыстанне бэкэнда з фіксаваным канвеерам функцый" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Выключыць GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Выключыць выкарыстанне GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Выключыць блендынг" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Выключыць блендынг" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Выключыць тэкстуры не другой ступені" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Прымусіць Cogl думаць, што GL-драйвер не падтрымлівае NPOT-тэкстур, а замест " +"іх ствараць абрэзаныя тэкстуры ці тэкстуры са смеццем." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Выключыць праграмнае абразанне" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Выключыць спробы Cogl абрэзаць некаторыя прамавугольнікі ў праграмным рэжыме." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Паказаць выточны код" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Паказаць згенераваны выточны код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Трасіраваць некаторыя функцыі OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Трасіраваць некаторыя выклікі OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Трасіраваць падтрымку пазаэкраннага рэндэрынгу" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Адладжваць падтрымку пазаэкраннага рэндэрынгу" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Выключыць праграмны кэш" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Выключыць дапаможны кэш для праграм arbfp і glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Выключыць аптымізацыю чытання піксела" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Выключыць аптымізацыю для чытання аднаго піксела ў простых сцэнах з " +"непразрыстымі прамавугольнікамі" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Трасіраваць кліпінг" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Запісваць звесткі аб тым, як Cogl рэалізуе кліпінг" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Трасіраваць для вымярэння прадукцыйнасці" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Спрабуе вызначыць неаптымальнае выкарыстанне Cogl." diff --git a/po/bg.gmo b/po/bg.gmo new file mode 100644 index 0000000000000000000000000000000000000000..a27ccc717fefff01b95311ce1c4dd0e32e3c5368 GIT binary patch literal 12258 zcmcJUdyHIHeaA0(0VW9)TGP^yp0o{duxGvNI1e^)h~I?R*x2i&h^p0{*}Jnho>%Uj z@!F{bj%`TdMzLB5P@oCn@dt=MHh%49?X3Sor7CUjRBDA<6+xu(UsYB7(W(+sKi_lC zoyU4+aEv_KJKwqYo_o&k@%=r{-JiVohL-|9pX9iW@VCI%!A;;l`s=s6BM9El`C9O9a4UE_ zSOtF@d;$C&@H?Q^x#X|^2)u>!{{SbzUx4oc?|dgRf%k#B|0F0m4}*_^Ujvg z{3ZAi@Pn(|I!}PQ{uHS7{{s9C@Oz*EFM@vv{yX?S@Va*e!H2=s;977qD1EA+=J_1B z0sIaqy?+d9zSStR7F+|~4Nid%fS&=M0~f&ef{&oYW^g~qlEF)$p8p1TCwLl^{yzqp zI#_k9^TTRT_Wlqkc^(3P6PyD13u3+`|6x#az5p^s@O@D0E`b{V_n_u^6OehSKNa#{gc3rdeqfw(02b5M4836#BW zXVUX;gCF2yoc|v}?ge+C#18Pwpyd4txCZ{wG)lZ^J0#;0aLc zodf?4`~bo6G4SW$AA{==_9XZMxD|XqMw7gs1|J6h2GqPavG{KAUhuQvaqv&T>oIB( zEPDI_DEqE4LGVZ5elP^T59+yF?{Ic|5!7@444wiXz-cq!55Y^|`af{I{4Y@Qt-%?n z9Gn5A*N?#M;4i^L;8vV$z$NfQ;J<;h;B}ll2_6I=0{;cn^Y6RM#ospY1m~Xt<-hCs zlAh~8+2d(&2e=G=4ZM+{kv(1onJUOY+3|nCDR2tqF-`DY@I~;4;4$!twL!25{wt{Y zzp&0d_cQP$=MNX$^M4CU&)Zq#=C=jG{or47zHNOFa2njmp*Y#av5DhB4#OdxdOw)O z#s}uK@x2k;$$^{ghh?q&(87Km=KEtDilKY#l_1yyew^cee-5?!K8l-F9Lj5Z{hdcV z$_Dx8K7PE1<57-Ja%|?fg9B6852m%b>Sli~AWZECH(L8|^XIpEB%JK$7QXN0kj>u7 z0sVrTI6lFFOM`cC=p$d^3L7)HD!`mJ{{psN2%%bVoqq6nI|rd0Y|#mycR8@%ALUy< ze2jzewRz?SQ2fGO!Sx*5IdCP)PEVV;IEhTX)vUy|C^a+n#DtZKDM$5c)J%?y7?MP# zW>_n?Dq+$$JZ{GIT39hr?NFT5Yt^XMG>5_@4vUp2oeZ|t%N4Vyp+TuT+24ptaaf7d zraPZX!ctr-yOZgt*eaJfH8Yj4oSJ6cq>&#u;9jei-`!Ju5&=yT%|uC5D@9tYS`7IU&!&+F5 zWWivYlS9JpjSoi^v!ykIW<1xu@pzQ*{D3?AcXft+yxvOWonqK5&05L*^I=k)X>^9= zw`HH43ns3a=4@nbVEjB|-6v#~-U(;mQ86qXG^MaKn^Q}Rm=N2RD`^Eo*UL#*?J6;Y zYM9!KRIAqtjrv@a6zVgD=3L!)>vYH0;ZZeyIux5McatcT5N4ur*q*0xwNZ&oT8hMO zl&Lqur&3z`M7A9m-)pH+PSNTN&ecNMpT28&O${?N>jJ7*VVLt=pjeb(PN3ZemeO%hN_<5 z#|@T6W~NmuSza{aMx^Wp=Sv5fH8*2wnS57Dur;GO1k z8=tvDb)`=*Q<^0;!Z@-?STlAUVpXDGd(GxSn`FiBVl*2biU~?$(&jT5>T=_*I_WO1 z$?=ZgVUaX#X6th<0%Puq-13+R*kRG`@E|MOJliD14?@il7GW6tG@ao6#7x(tw02iB z&r{|Td-qJ`Dx@guo{5{32dV)%jf`p1N?amudQAzZr2Bg=ZqAyyFlAU=<2#%l3--9G z(qqYB4~r-9G@;_e;Z$kYEoVix3x?!KT%bW-V4qOaU|+r7G+RU59qjMeBDa~nQYO}2 zhKJNMjrC$JDz%alp;n*v&*|B2W=l;mk`Zm*Lr0(Lo^;vLt>mU~zg0B}mnwne%a`}w zp|C=BpA7c90>D(xtNC>mx5#X^^qF$WJ`LQ(EqO}zr-}gM>P$XF7V=L~1*&1A!)f=7 z&&qzn-Emqn+mdij3Be863oYwrA2U-G6MxaqX!hgZ?ohP>FfWM@s}98t3cZNwpXsp8 z&1(m$$hyM^e1JD~}1w`|P0WYT-3DjlYs4upmrt1|6}h#;0VPA>|5 zuU?(Ip0P?&m)T5ghiYk5QLgpbtc3DfBX%J?8<%G*9Ez7>!IlBS)h^sh$?0Rk0kWv2 z^xgxC`DUK7bME(dNsq_ToXr4wq(j06tQQBHvq`;Gp0)Gk1bjSBTeL_|N5K=bDk-yy zengL4V3#XL8ndo)xrhxbbK#NHC@F@FaxG6Dt+q18^hXNakY3<^fOVXFDxw zo72nXI~(LK>5T=B*V4eI2SqV;BsaCq6=|?HsjCeuJUU%?+=coij;90ES7BmoV#BI^ zkvgTq?z9|F7q+y@X<@29X=aNFr9tm zU|22Ett@Y7G#!_kkIbZDp;+!8I%$gKRl6VEy}fIy ziLvojTk9xXLxv*_l#zYcH!5LVdr(CtfdQKiOzkK<&>d&FN7J;uMz(`cljeb9++4M{ zq9Rk+K|M()O|4;1(@h&5H16l7H8pd`CNpvOgR6q<<@U4Lx%Scav1~p&&GANd&hRyF zvZZV}d!v1Vsl>>?{2v$LJjdM3M+ zE%U_{t-ahnnVsRd!19aj&uhXj^3bKuB}8yH-7|JR#$L!4d0Mixk2!%j_I zi%FPIW2BiF8Dw8Uxo0F!`?v&?syrZ7Id=mU_d)he$!B$zoE`hPo8M;n`RojGo|b_Y zq}5`!fO!@*J6C%iLA|4x;5lcyT$FXr)G{&FILizy#$3|iLitbt2{&LCIcwSKF^|=7R38Pr4`hGoVctCYvdrXmK5riVdXT+}&t;jD*%E3R znHFn3$2BaY`P!$P?RW0#vx}y2#<3zSGWcRPzs`ug#!}!CR>Rsd)vHVoG272~r?ifN zAkO7-O8e9Z=V-3>No3+Vt0l79U-NdY1uL)htn-?D>6Pu-G+K?nawTk#oqgC56BzF- zygZqmmmjzXsccBTMlhaGxU#-|LY_m=>mc5B-7~pIymMRLCEOl%$RPyLXOn->?y2$4X9?vI-{F;dA z2r6f)(=_W>KcQu5`*SY;T+xJfYd1oHOYnTjT0}9~!|~H5J8z2tW|D=52;H9{yppo4 zHlAzj%ZIy%JZkN)z}331DW7-w?@C2iHt($=g=M9zZnTof*od`pj7pTvBalHnUmi7F zDQkgYN692_SaI>QZ0GWswVju9kX5WLC>Qn>NuCB&QYk^Agqm)MUAB7DO0UvgIg` z?E&q?@TgtkG?wc`EOU1Yo~83u8byMkgv*~&BR5Eo)@pi&N{N46aUgq8y_ld!&MQb; zMvkYZoNXV6b@(g~we!xZD!mBU;mv4KmfI(&2FES^JLG3p3fHMFDc{N*KHsWCgfEcu z1Tl3Kp*^?658QH94!#2Oj1skDlWsTs7KeL24{x4bXVf45a*|x$6XiWFw*l7a#eAl9 zjn2v(>Ov2XY5p^o2kLiyLri8Kp$+7q-%&>JI;e}C$2r;rbV9BtM%-e4gS|%e=2s_(8#axL8(UCaDV2v;K0e6yjH4qxZQ%Yq zHS$7`{UzGCJz8Fbu_JNP8|I9@>OJDJwSmgBLPK$w*G2EXvs@(xT`3r@@*fD#y%Pl;`o=h7iOOMmI359Hx=+EbfF}Nkt4d*5+X-~IoEvdY-pu7Va7yEX0h<{F8 zkrVBsBifNMlYQ5XCQYmeBfI&hBH8kTE^PQ+bFoq$I>6yCJ%+MUv)IUx0ygoXF3DCK z-A)JQoi8oXh`lUN`Mq1dpS9PPz16izwt=u>KdX=x!+58_Oedw9tNdr}ru4j;?^o5BzkM#z?PpnxYGCX?Lx#@bB)U9* z=j!#_i4a)Ha4-3<`Pxi9gOW(!4v}<5b{^cO;wk*h6ZS2z{5e!b6@kkY96r2n=HbKg zWczEqgL?%HRKN9->1@}7&iXcKt1Z=CzoRF|7%bvmJ1R+>%U*Zo7&S+e&;L8^8o5x; z^VG&?ecrT%$yhfGAon$5)LV&-Yb1hY$e`4uTH#t^C8_#ghX3juHJqES-a{$q;oo0c z`%|j4NpmH<^BO%T#>=>k)Z6VIk$stb)L-#QFmf>B>9vk4gnA37T{ky+wxN#2Qj~Ve zX2d}|cIoLEGPJSk{g;Ov>-JvHNiyHk8Mnvn?l{$jXuf6YwJHm53CxJs6?Et5 z9&FJ0P#f4w(1Ys574EVtJ)d`CN~>Mole^sL$<>ClnR`( Kz|f&RfAIgF17V5) literal 0 HcmV?d00001 diff --git a/po/bg.po b/po/bg.po new file mode 100644 index 0000000..34fe0f9 --- /dev/null +++ b/po/bg.po @@ -0,0 +1,392 @@ +# Bulgarian translation of cogl po-file. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. +# This file is distributed under the same license as the cogl package. +# Ivaylo Valkov , 2011, 2012. +# Alexander Shopov , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl cogl-1.12\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-10-02 05:27+0300\n" +"Last-Translator: Alexander Shopov \n" +"Language-Team: Bulgarian \n" +"Language: bg\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Поддържани нива на съобщенията за отстраняване на грешки:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Специални нива на съобщенията за отстраняване на грешки:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" +"Включване на всички флагове за изчистване на грешки освен тези за поведението" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Допълнителни променливи от обвивката:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Списък с разширения на GL, които Cogl да приема, че липсват" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Изрично задаване на версията на GL, която Cogl да приема, че драйверът " +"поддържа" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Флагове за изчистване на грешки на cogl, които да се включат" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Флагове за изчистване на грешки на cogl, които да се изключат" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Опции на cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Извеждане на опциите на cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Трасиране на Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Указатели към програмни обекти от вида „CoglObject“" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" +"Съобщения за отстраняване на грешки свързани с отчета на указателите към " +"програмни обекти от вида „CoglObject“" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Трасиране на разрязването на текстури" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" +"Съобщения за отстраняване на грешки свързани със създаването на отрязъци от " +"текстури" + +# Става въпрос за изображения съдържащи всички текстури. +# https://en.wikipedia.org/wiki/Texture_atlas +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Трасиране на атласите с текстури" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" +"Съобщения за отстраняване на грешки свързани с управлението на атласите с " +"текстури" + +# Става въпрос за специален формат низове в cogl, чрез които се задават +# правилата, на комбиниране на текстурите – събиране, изваждане, +# умножение и др. +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Трасиране на смесващите низове" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" +"Съобщения за отстраняване на грешки свързани с анализирането на " +"„CoglBlendString“" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Журнал на трасирането" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Преглед на геометрията, минаваща през журнала" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Трасиране на пакетирането" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Показване на пакетирането за обработка на геометрията в журнала" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Трасиране на матрици" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" +"Съобщения за отстраняване на грешки свързани с операциите по обработка на " +"матриците" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Трасиране на разни функции за изчертаване" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" +"Съобщения за отстраняване на грешки свързани с разни операции по изчертаване" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Трасиране на изобразяването чрез Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" +"Съобщения за отстраняване на грешки свързани с изобразяването чрез Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" +"Трасиране на подсистемата за обработка на текстури в паметта " +"(CoglTexturePixmap)" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" +"Съобщения за отстраняване на грешки свързани с подсистемата на Cogl за " +"oбработка на текстури в паметта" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Онагледяване" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Очертаване на правоъгълниците" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Очертаване на геометрията по правоъгълници" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Показване на контури" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Очертаване на контурите на всички обекти" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Първопричина" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Изключване на пакетирането в журнала" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Изключване на обработката по пакети на геометрията в журнала на Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Изключване на буферирането на върховете в GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Изключване на обектите за буфериране на върхове в OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Изключване на буферирането на пикселите в GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Изключване на обектите за буфериране на пиксели в OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Изключване на софтуерните трансформации по правоъгълници" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" +"Трансформациите по правоъгълници да се извършват от графичния процесор (GPU)" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Инструментариум на Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Записване на изображенията с атласите" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Записване на промените в атласите с текстури във файл" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Изключване на атласите с текстури" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Изключване на използването на атласи с текстури" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Изключване на споделянето на атласите с текстури между изображения и текст" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Когато е включено, глифите ще използват отделна текстура като атлас. Когато " +"е изключено, ще се направи опит за споделяне на атласа с изображенията." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Изключване на текстурите" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Изключване на текстурите за всички обекти" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Изключване програмите на ARB (arbfp)" + +# Справка: https://secure.wikimedia.org/wikipedia/en/wiki/ARB_%28GPU_assembly_language%29#ARB_fragment_program +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Спиране на използването на програмите за обработка на фрагменти на ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Спиране на непроменяемите" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Спиране на ползването на ядрото с установени функции" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Изключване на GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Изключване на езика за графични програми на OpenGL (GLSL)" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Изключване на смесването" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Изключване на смесване" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Ползване само на текстури с размери степен на двойката" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Изключването на текстури с размери, които не са степен на двойката. Ще се " +"използват отрязъци от текстури." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Изключване на софтуерното изрязване" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Изключване на опитите на Cogl да изрязва софтуерно някои правоъгълници" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Показване на кода" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показване на генерирания код на ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Трасиране на OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Трасиране на определени извиквания на OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Трасиране на поддръжката на буферите извън екрана" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Изчистване на грешките на поддръжката на буферите извън екрана" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Изключване на кеширането на програмите" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Изключване на резервното кеширане на програмите arbfp и glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Изключване на оптимизациите при четене на пиксели" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Изключване на оптимизациите за прочитане на области от по 1 пиксел за прости " +"сцени с непрозрачни правоъгълници" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Трасиране на изрязването" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Записване на информация как Cogl осъществява изрязването" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Проследяване на проблемите с бързодействието" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Опит за посочване на неоптималното ползване на Cogl." diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/po/ca.gmo b/po/ca.gmo new file mode 100644 index 0000000000000000000000000000000000000000..2c5dd679125f4dec94e25731a2a05d03382aad9d GIT binary patch literal 8454 zcmb7}UyL1BeaEMeHp#YuLRZu9O8d5CTrGs*G`ctm9ulty?2ti zGn1LQyLLod^`TN#5YUJ406gRYM1b@qsGz1uRl6^JXoXN)fdp+SYAf}jPxJv*s@l)@ zoHO^%+D;Tkp8MT1bN>AP{~7=Do9}uq;rbBwTev^}x+Ix_5BwxQT;KnxB>8plU%?@G z*WF3-cJM*)XTWRV8^PT;uEAer{QKZr!Ow!f0RB068vJH_e&0Pw@{5d*g6{#(fo}t6 z;4gt62Y(s-0;qHTGCu!X@IJ=>4z7bg1b-I1|6XVU9|HCMDNuCY0G|Lq10DhY1N=4c zf5G>HZ(RxJJPGRgGoa4@6Yx#omq7!51AHg=PvFmiulwmF`3>+0coaMXik}&%ef|(U z4t@a?-`@eX-w~KO3ceeB54Z!K1b+|wBk=3so59Cm;taSAa%A!xsP)f-_k%Bi;{Q7! zTPG`T2zodIO5X1RMb9JP&x1Q4|B{R!(SHLJogW9;B6$(ixi5p7|97DF`2i?B{s`n> zas*`y?+3O23Gi3IO;GerK-tSpQ0qPiir$w&o%elEa+A^qz)?_qd>BL}$;Uv+;W<$9 zejA&9?I*AgQ0x8&A|C?phY9WX+o0(FC@6Y98OL7)hm2naFM|IG%AVF??jzt6;Jd*W zLDBh-p!D=Za1~sKd7blN@L}*%pw9UlP;`Gcj_<{&o?!eIkfq5KJP-bE9RD@=5aVxy z9|GS1k<$A|z%}rX!A5r6Ll-w)=X z`1v#N82I<#2KaiEv;{s2@+kQP_+Ib@Q1t!)JO!@eyq^M7Q2hQksC9QkgzW4|Q2VE# z^zjFv=zS4H#L2&blEaTc>E}Ks%dZC@kCIIg6G*Z+z6oldPsitf1#)EaEl~3KFHq~= z#3qu*5X3Z+-vUKn1~Mi2C@6pb49LIa8~kYfcR|^~|AD8$Aw)?oIVie62c7``0o(xZ zHNoG`gP&x)1-=XX7Z5W{6c%-^bf*1IaT{*wrhmzHQK|QZlc3I!p2Ul;2e`E_V)xgh z{7QeAxsPLdD7k-tTXgD@-ul-%gB5N}E4dP1JQfjl7nkf$GP}er8$81;St$av)*qBVQA&g^dP znvLXKImyjdrAbW~Y*#MLY@Ri381K|J&5B7FjNI;gGGS=Oxt%noEluO%#5=s37v0;f z-KQYX)Nbr*SENpd&1QDcxXRYHbt9t_O*u9fH;uc|x}p(DI-sf@!;!H_W|TD|e3YCQ zAx6}n&3U=q)*_0%8qpfwmg8}g*3K2CnO9X=xA8edn6#W1t(Ig>GmnziZh_7w&TOG% z&at-5ZDVG(uoEW|a4&$cR8V3a{ZyWS{G>3wg>>EWq+!AxI$EC^1miLvpPyxQPwt(#S?_kHQYGz7n%iOBFfm0Mg8@$(=ncgcmq$3Y)tW#7AQYWFgn5})+(3=0jhakC`c zWrY+U?Az`Vrp>h64<4BDR>m!j$p9BtblE=5$v)1uxcJkUrp1a740;;XXume2(ly0u z+r=sK!7E!k9SaT2hBaABdLSDR(}gC`2SvxiRwqaUU@M}lIWGiHq zo+Ohk4zIHjt`f*$sIVK3^CbHNEin=mXi_9N2Gl0GT9&OjXHj>uy^uvGGyi0QuZIYa zQID%*vRYW0*D0=6j^aA4T}HOX>^ce2$31wAq3)>=EyGD+i}1IyChjuBkz)Fa+S{`^ z(S0M?4hev*f>yidN^Z`a@#eD=f_;;OhiAKx9Eb7%6Y@+qMG}gu$O1E4Eo?fhiBUOj zcsXlQbH29w3J77s70j|USJ|1YSjUHPN3)H7ms3>+V0m?RLwP8xNc1wyxMpE(VP8K{ zNj3~`PlVxltRSqk$yBMUA(%_h^FTmG^;@M!>d^#{)zV)`(-MiliXedU^b zzU@MGXZwe%r0bd6_Ypu#7DiZM^|HZsT9@<5)bH0B;PtGTQzAXh>~)p5?sbgSC@`2iMHn z`o`MBN7s%sZxbp9*k{pT{AImiE@ruTysT3@vgVOVmSfHO`?1M98)w79wU4rfq8OtX z>^M8yAXK$BCkH%&O^iGvk13a={;_yku0S+)Nx;Xd z+-AioWtkciIDKvB@xjUEJa2qdO&1En9Tv4=PVS=al`FZ@%mDgl&4wu|KWt7PKV`z7 zrwjA;(`NnDN^)lGCJx7Ud1G8d!IV49MPa*at;ua?w3+=eruKayx!!dIX0!@(WnCCM z8WDfgI}ks&D*frth?P^whBxMMW{SyIG#K7IJ7G#G=VpZE^5C zhh?5q_Lb;*9m{g!!OOng^ZQq}z)Ex5y~VL8z(gLjKxf4vQI@`;@;nAEwEwb)2}H;~ znl^|VaS=SiP9ZqhG4qo!HHj{hL4qg~ZfE-;N{3*ST|MTMJYhSi^@Pay_ zJFKH|@u-LWYO7 zw+5-FXrgz3q_>n&YUf&AyM{1R)0;>@aG*|#iJm-@`39@MiDpq4mrehnc8(ESw(U$o zdz}%?3R9JB)G~*SZdtY(TA}vY;8b2@xtnCQZ@lp6*l;zjPy`RkT=rb*!qVFaxs}C5 ze|T6Jx10@i%G@&krNJEH(RvHEbxU+P_$ssRV3O#j#k)|C#DVxkGnuYc!`4#;6Zklw z(nvf+v zkgqBfAiS>s^Mj5zb%y=zyVO8xzCxU-0`Fb+`arRky`YUhb zqx2oTs$;t^bX@cmg&yb20tkX3Inf)Hg=!Fd1Od`=%Ea)qLpCdmlK_g4L}TL8ieOB9 zL9_XUZ&!@F?-D*SbV{hRVRE+2Qv&?bE)kxOtnm$`&-nX3^sXx%pl6^Y^=@8W#a9n%@`ZhXeu};B~Z8dfJxSyklgUU*sOXHH07?oY?QMu zO)r~O>)lN0rcEBVKJ0W7p^{|(kmS5*+q(2=Ttt%-2~YSBUnWU((P#rJ5bj%8rqQg> zCHOs5nAQi+FGHM9a->VM{Fdb9ENV%C%@Af53Lp^p{$yLM5Yg&vE@phodZ0McW$BLk z(6v%FNm`5E+_Q_7bgU$5UM+FDc6oBS^pd+p@NvWLEkQ?x9A!J{DR#F${w(|3ZfX>G z>?w#M2VWw>Q~OYS_$aN!*2_cPy8aQ%XT9Q&f-S$jnsTuuqhPz^d#|jf6VJ$Tjm5ar^^UY zvn$hjj1VH0rJ5Sx%zrPAGkjP<_2d=LNf#yiujLLXic}Q~?jVwms#lXpl#VaY7c?Ex zOD7&?s_Cl^M}IHd{%TLJ)UJ<2>Tk*Iz9-N~s^}QFj_bNw>sp*8rCy|2ms7M|x6Up+UOJDW5&ylB#O|BTZ*PFSv#WK-rM1(ZJWk98 zlUpuLwliPPhngMMVqdNR)$sk1aLM6|gc-}cNuG_vevO-lN_uE65P|vc0UuN-KG-&7 p7a!~tn^o+YzEB{6DN*8KD3G literal 0 HcmV?d00001 diff --git a/po/ca.po b/po/ca.po new file mode 100644 index 0000000..db88a32 --- /dev/null +++ b/po/ca.po @@ -0,0 +1,374 @@ +# Catalan translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# laura_balbastre , 2011. +# Gil Forcada , 2012. +# Jordi Serratosa , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-30 01:07+0200\n" +"Last-Translator: Gil Forcada \n" +"Language-Team: Catalan \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valors de depuració permesos:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valors de depuració especials:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Habilita totes les opcions de depuració que no tinguin comportament" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variables d'entorn addicionals:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Llista separada per comes amb les extensions de GL que s'ha de fer veure que " +"estan inhabilitades" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Sobreescriu la versió de GL que la Cogl assumeix que implementa el " +"controlador" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Senyaladors de depuració de la Cogl a definir" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Senyaladors de depuració de la Cogl dels quals desfer-ne la definició" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcions de la Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostra les opcions de la Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Traçat de la Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referències a CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depura problemes de comptadors de referència per CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Traça el tallat de textures" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depura la creació de talls de textura" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Traça els atles de textures" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Depura la gestió dels atles de textura" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Traça les cadenes de mescla" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Depura l'anàlisi de les CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Traça el diari" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Visualitza tota la geometria que passa a través del diari" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Traça els lots" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostra com la geometria és tracta per lots en el diari" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Traça les matrius" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Traça totes les manipulacions de matrius" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Traça els diversos pintats" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Traça algunes operacions de pintat" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Traça el renderitzador de la Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Traça el renderitzador de la Pango de la Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Traça el rerefons de la CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Traça el rerefons de textures del mapa de píxels de la Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualitza" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Rectangles externs" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Afegeix els esquelets de tota la geometria rectangular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostra els esquelets" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Afegeix els esquelets de tota la geometria" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa arrel" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Inhabilita el processament per lots del diari" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" +"Inhabilita el processament per lots de la geometria en el diari de la Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Inhabilita les memòries intermèdies de vèrtexs de GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Inhabilita l'ús d'objectes de memòria intermèdia de vèrtexs d'OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Inhabilita les memòries intermèdies de píxels de GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Inhabilita l'ús d'objectes de memòria intermèdia de píxels d'OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Inhabilita la transformació rectangular per programari" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utilitza la GPU per transformar la geometria regular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista de la Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Bolca les imatges d'atles" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Bolca en un fitxer d'imatge els canvis d'atles de textura" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Inhabilita la cartografia de les textures" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Inhabilita l'ús de cartografia en les textures" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Inhabilita la compartició dels atles de textura entre el text i les imatges" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Si s'habilita se separarà sempre la memòria cau de glifs del seu atles. En " +"cas contrari s'intentarà compartir l'atles amb les seves imatges." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Inhabilita la texturització" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Inhabilita qualsevol primitiva de texturització" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Inhabilita l'arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Inhabilita l'ús de fragments de programa ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Inhabilita els fixos" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Inhabilita l'ús del rerefons del conducte de funció fixa" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Inhabilita el GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Inhabilita l'ús del GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Inhabilita la mescla" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Inhabilita l'ús de la mescla" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Inhabilita les textures que no siguin potència de dos" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fa que la Cogl cregui que el controlador de GL no permet l'ús de textures " +"NPOT de manera que crearà textures tallades o textures amb sobrants." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Inhabilita el retall per programari" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Inhabilita els intents de la Cogl de retallar alguns rectangles amb " +"programari." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Mostra el codi font" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostra el codi font generat per ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Traça alguna part de l'OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Traça algunes crides seleccionades de l'OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Traça l'ús fora de pantalla" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depura l'ús fora de pantalla" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Inhabilita les memòries cau del programa" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Inhabilita les memòries cau de resguard pels programes arbfp i glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Inhabilita l'optimització de lectura de píxels" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Inhabilita l'optimització per llegir 1px d'escenes senzilles de rectangles " +"opacs" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Traça el tallat" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Registra informació sobre com la Cogl implementa el tallat" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Traça els problemes de rendiment" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Intenta ressaltar utilitzacions no òptimes de la Cogl." diff --git a/po/ca@valencia.gmo b/po/ca@valencia.gmo new file mode 100644 index 0000000000000000000000000000000000000000..474cff0b4400fb2116b557b651c9a3a93e1a4953 GIT binary patch literal 8451 zcmb7}PmCm2ea9=r*f3xc2-yS(_DTg5C^L_7C zcg^nFa!OnMomch#{Qm!`{nz*0^<2XB1@7PA{_0zjWCniXt^9EP=E%3)+AH3_H zB)JcK5PTH7@C8ukd_O+_A$Tw2{{Yv){{nv*y#MXc1U>}n{ga^Rya9d={7di%_!ICq!JmVl z0zbGC&iNv!=TCz=|4+epgI@;?_+9WL;J<*s0>0%PN%C><2zV4c1B#y+sC|APJPy79 zitpDz?RNxbj)ETp9{_j2li-)ZKLo!Gz6X31CeDD{AV((8fm;7Oct7|uDE?mq**aNy zSJ1-|Q1bpLD0&_N-wW=5{7X`PME?y?bUq8RMe+?$=e`PR{$GRI=ifo;@qa-6B}Y)U z@P1JHp8($vZi1q30?J5Fa$xTY@0Y^dc@g)$IB+r17!*ihI{UJ7e z_KxFa^cW%iuBa z@4yXEO42zyCSNzvLBuwEi_vcJRO8Y49jSNiHcUy8i+^0scL>0p4wbznua9 znDHj~QShHZ%rH?{)Vb1`_B+LGxTTx!CEG=%-WN`SIzxIAFSyrL_njCFezm5%p&? zUT!y)h+?l=w1&6Ecw7%F=WuczPRox*5BdH_U2;RXN!3y?F?))oO;URdRq;~ z}qY3UGSk?ka_GXz~sDmz;; zF@`ln9ZAZIyjK=`uId%zUb9!2D4pf}0y~ECY;2gNW!V+o;*H2OO=a^M$DA$BJakTXVR&)JCs44Dz!6uI?slk{*SP=KoVj|| zj4M0w?s}VE;-rh49ZQPOwn~>{ltDrRZW9=<@wZ_>RH!BR&0!QkgJOxXKp zt57{TM3@;)35{4B(ZuG)&x5SYB^PoZ2Yry0eGlB!?xr{;KI!8b78+vXWi0#x0G>02fwt**?X|KF&6{_*0ms#flINdKy(|zcQo3)%j}E#wqjp zD_c7)3pLD!HEBb7AR7?Vh?u6%(jjp(a*8`u%fI*1W@`3q&9pS<*N*zhR>&$HNhVty zUZo>kC6L2VVK*G-N%jX?Vk9ciq)2cKsC9C+C>nFlqV8mSA&XXK{>cPi4-p=t9+$^t zwXig=hPYZWitDs?8QE$xa1x@Ad+-=T-IF0&hLge;;csP4++~I%#q<@mw`((^`$n=I z5&&BTt+vmV+?+Y%&1WYB`#K2^&$b~s4&?zRlw*)Y64 z5r*fbtGqpvk5L7`6-7XJ<$W#$lkSt5co+p9a1AL|X*y1kfq1J4e39t8d@bHai&c=i zO=hxoOs#gAVr`6OLzveYX>j3bI+HXvyQPi9Cm22|(rVZJx z?H{g^uBUF#M*uBZ7-5Ok%LbciRm>+-zh7&B*VB4ViFDH?Uz{qXOy&KM?t)`avi))z zGFR|eo9)^C+9)VmW`&Zc^;Vx5Q{tVEVtum(8P#6O+}7c#{CuTFZVP;cc;}rw1igL| z>{=Z7@E|WHkF=upv7%0{RE5g0-lb9RdT{j(6i)>>Q>ds`t~!-Tz036^9re!6Cv|V9 z*f7(kDL0NCqu{zp__6&-j*9w4H91DCbJg$iqCcFZpCM0;=ELUnFq;#?s}+J+@0?;4 z#PrS+vNp`|we=IdwTF9aC(QbZjR#L0U0YvUV`A^B+f5aEmh+DH)=u^wTr+Fy8*2|A zT|3UaO{nZ)pLvb(7uANjm}cg&q8i$fHIGcv3~Sckk51<4IPK@I`7~=NiZP1bjz;_NQ`z1U{#>dLc zruiu)nhGm8eQoEl-pS=WZ+{d{7jhyVMzvv14$%0@l}wqY2Me=$!{ntO)~Ao3GU3nD zxw-GOSwFRsoEfJRk~cMdBuPAt3u?=n!n;R30S#djZJu0Jr*ZINK2*>MREOF=*;J>|x*>)`6vGL~ z9mdWEh8ncnf4~T7S~Y6DI`yowt=V!vopxn8@!(b8>-qgln`5GxZQtTmR9_+wTA;J!kSI&vO?e&z7utW>zyu;>9CZ`K zjkt&$VW$uoY;tKqx@UdnW(P0(K%2_9X9q8iBtVWX557sGXovBpu%*{du#ovXlUnJUAdYVQ_+}6KyaWoiiw^)lltzeyNPB|6&H2)p>~epTDI*>PH&w~ z=1^J|P1G`njc!@C8v3B-W^gJmvdm4=%6DCObnLcjmn(b+WiA^owP3^B2)UKTMRRyq z7`L1abxPYZ{-wbj;?a5wwpBxPIrtW{?qHJWrop>VkHmraL^ElwQMcAn1rzu(pt?vr zN2%XxB6gYlgM7N*N#1bX5Gtj}aq7A0s;5f@Q733EjT-2_^dZXa77|}*_55D1zaU#x zC_s2^^XCUGZ)yv>+qbiCccl1cHMD*~=TWDYXw`alS5E~0SnqXY{Quc!>FKY(k&n`M z@T!*WuFx_3*A;r4FAE?DhU7$JROBi^@DT(^zbO;L&kotFEKUN*Lk5kBODlpg@%hYV z6FyuqZa+%+#Lz0CO8d##A{!Fmmv)Kpd}NJpAbrjkkhHmhWsX*Z@%r>Vw0ws{sbRW~ z4aQ)T$72RjQfFgrUMv%DCvC>qpe|FvK`DWv%?C`f-h||a|HV$#i=ZwB`m9mR+BCiF zRIPV2rJE*s%=)m?N`x|!GAblFFWROmd>R+g{*`HTDzpfG z4^^er!Sl-y=aU@i(kwqDc{z((QefSOnS}xf1im@h7Ar)wDxHfN->)7hj@URia)>rkY5bG)S- zAi#EBD)Y8uNrlqdf47rjLtKA-&}U~^M>S0&es0gmrGA-TjoU}>pSH6f<2B3+q6r??=5qJnbTr~sM(fj z9YzQd%Ti6Gr~YGcoZ-U?swb~_PTDBheJyuDQKYI^a0ijJRK1ZzqI7(DzM$!lURv=m zQypJLXHmCh4H0zSs2Em7A~uK=2QTZ> za9r2cTG!$%DfJ?qx}2hETXlBf@zQw|jrhNfB(~mcetY-hon3u9F0Gw*<#A#*l#a`# z$#&}N`B1aNT5QS{plUuo5-vG>kuYPKH_6g**spf;P)YaA1tKv2H{gQ`#RuDl?Bau+ lVzY`Jc!>eOZ86vZX~e2V-FsWDD^AAR$eW}Wb, 2011. +# Gil Forcada , 2012. +# Jordi Serratosa , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-30 01:07+0200\n" +"Last-Translator: Gil Forcada \n" +"Language-Team: Catalan \n" +"Language: ca-XV\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valors de depuració permesos:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valors de depuració especials:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Habilita totes les opcions de depuració que no tinguen comportament" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variables d'entorn addicionals:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Llista separada per comes amb les extensions de GL que s'ha de fer veure que " +"estan inhabilitades" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Sobreescriu la versió de GL que la Cogl assumeix que implementa el " +"controlador" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Senyaladors de depuració de la Cogl a definir" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Senyaladors de depuració de la Cogl dels quals desfer-ne la definició" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcions de la Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostra les opcions de la Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Traçat de la Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referències a CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depura problemes de comptadors de referència per CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Traça el tallat de textures" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depura la creació de talls de textura" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Traça els atles de textures" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Depura la gestió dels atles de textura" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Traça les cadenes de mescla" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Depura l'anàlisi de les CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Traça el diari" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Visualitza tota la geometria que passa a través del diari" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Traça els lots" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostra com la geometria és tracta per lots en el diari" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Traça les matrius" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Traça totes les manipulacions de matrius" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Traça els diversos pintats" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Traça algunes operacions de pintat" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Traça el renderitzador de la Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Traça el renderitzador de la Pango de la Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Traça el rerefons de la CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Traça el rerefons de textures del mapa de píxels de la Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualitza" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Rectangles externs" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Afig els esquelets de tota la geometria rectangular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostra els esquelets" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Afig els esquelets de tota la geometria" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa arrel" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Inhabilita el processament per lots del diari" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" +"Inhabilita el processament per lots de la geometria en el diari de la Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Inhabilita les memòries intermèdies de vèrtexs de GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Inhabilita l'ús d'objectes de memòria intermèdia de vèrtexs d'OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Inhabilita les memòries intermèdies de píxels de GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Inhabilita l'ús d'objectes de memòria intermèdia de píxels d'OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Inhabilita la transformació rectangular per programari" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utilitza la GPU per transformar la geometria regular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista de la Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Bolca les imatges d'atles" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Bolca en un fitxer d'imatge els canvis d'atles de textura" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Inhabilita la cartografia de les textures" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Inhabilita l'ús de cartografia en les textures" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Inhabilita la compartició dels atles de textura entre el text i les imatges" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Si s'habilita se separarà sempre la memòria cau de glifs del seu atles. En " +"cas contrari s'intentarà compartir l'atles amb les seues imatges." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Inhabilita la texturització" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Inhabilita qualsevol primitiva de texturització" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Inhabilita l'arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Inhabilita l'ús de fragments de programa ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Inhabilita els fixos" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Inhabilita l'ús del rerefons del conducte de funció fixa" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Inhabilita el GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Inhabilita l'ús del GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Inhabilita la mescla" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Inhabilita l'ús de la mescla" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Inhabilita les textures que no siguen potència de dos" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fa que la Cogl cregui que el controlador de GL no permet l'ús de textures " +"NPOT de manera que crearà textures tallades o textures amb sobrants." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Inhabilita el retall per programari" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Inhabilita els intents de la Cogl de retallar alguns rectangles amb " +"programari." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Mostra el codi font" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostra el codi font generat per ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Traça alguna part de l'OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Traça algunes crides seleccionades de l'OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Traça l'ús fora de pantalla" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depura l'ús fora de pantalla" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Inhabilita les memòries cau del programa" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Inhabilita les memòries cau de resguard pels programes arbfp i glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Inhabilita l'optimització de lectura de píxels" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Inhabilita l'optimització per llegir 1px d'escenes senzilles de rectangles " +"opacs" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Traça el tallat" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Registra informació sobre com la Cogl implementa el tallat" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Traça els problemes de rendiment" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Intenta ressaltar utilitzacions no òptimes de la Cogl." diff --git a/po/cogl.pot b/po/cogl.pot new file mode 100644 index 0000000..1320d0e --- /dev/null +++ b/po/cogl.pot @@ -0,0 +1,358 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: cogl 1.18.2\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/cs.gmo b/po/cs.gmo new file mode 100644 index 0000000000000000000000000000000000000000..932d0963e7d9548e5b803e3bc3f078fcea0943b4 GIT binary patch literal 8354 zcmb7|TZ|;vS;s4jNz8^oFtA(`j=`7R?Dp);dWr4Xon7z6UL4P6#=El{#V=8H)#>h< zuAA%9v)w2Gfsl}}gF@s7v$4d8SZE-Vl@hKNYb1IaUIIKIq`ZLaNFm}4i5G)}#P2(& zEK(WIs zpxFDPO!|-SgCC&S?E!>837!Lg35-Fp&+mbMUFoM#SU+SzXJXzDDyvw5HinmAgVgQ z35tEb2zuaGLE-rW7*FJ10)-zpK(X5w!3FToLGj0LgJQ=+kW%zkpy;&@%Dle;UIbqQ zFM)4?kAM&1JYw(X!1Le`ly&|Dq>J+(py+*wNzQ@iL0R{6;8(z15S5%4aOUU16l6=B zzXdU+^Ut94{|>kc9zj?{bv#hU{VK@E`2t@e|5rh#biM(KT;BotI3M7p*z+M!?6(d| zzb?qf`7B@3?=~p=@s}VbblwKVzVCqIXZK@NemZABk>k^#*y%-3?D~h*{ojGI-aDY! z^C5(J65Ifv0Y4Aog3iByuYunJg%7{39Or$Yghk<(=)6KZLsK;2*!(5j6**+>CupZ> zS7@S(TqkIH&0cFdd>B5e#zcF zOM9Mnf%YIx>>!ueRct7F*O%B^34~MGXqzS__;kH~Kv|zr^^L>@}98I_;`+gtoEKNB1 z1GJ}U5?`DPzOS}|Osk|U!XVbU>Lr05=4a}h}v zNHfi?uUstS2e}CDJC{WeCDLCEd3n9aL@4IUMOOPZ>Gg6i(>hjpnWjlrRL>DYc}W=; zG9<|Jva+iasVkAS4FmZ)V zhP#<|MF_Q&-ZJ-j5T&73xu=EQD3he_i=~DZhP*JcS*;SL61RCQGpf{>e15g&eLjHO ztSFY*zk6L>YzY_SsnI!z*v)pqJn0o%!Z9xl(sbT*%^ML@6`337IA+wWxo@5Mf%e6L zPmo}Y!7*16jOL^$bKJkDE?m2)dYRid?t0I@RGqG@&M~QawwCG`Qd$dj4JlP(e6Q7X zf7g+v>3jFZ=l0X7n&Z2wUcYA>42x8+j6K7PG)T2XH#qMNnYA`!ZkYUNjODKL#$9cPsb(>njkCu?&^U% z3UEq%(!?_uYGdPSLbwZJ*?7xuw@a8-gJjEkV8B};x9pe@uwl_vcgV^n&K9`%5Nf)x z2*a>Xe#Y)+%1?A2KU&mrN_}#DZKGBpM_D^2C`b=v17aExQ{`dc5jQJMai^^Py%iJ# zwdLk?3u3-qf5BO^S!K?W&Kiqnfsdv+7|rqq@%iwq2zRfO%PP zOY%^VlIVq))tH8Dc3#s_lB~VGHxb(Bsm=_a$;WI3-x)=KePw*k29x&O4kgxB(ab}6StGD6JP7)OkS6}p?U*!x zyPAc|oS44g+#re?O0VA#pD*f=U2}hbm2@-ETP6a?kcNaQtQQUzgDffg12bPuz?(r{ zQX);X^QnQPl!16ZqHF8e{cxNPZ052a>xNtII9C!BU3%G)r}kEp83W>-iDC=$Wm4yA-VglF#j>AwHj-sED2jCXp#nWo(^zvh;k1sAQF4D1c zO^*TzJ#D{Jou$Rj;*wf=a{2Vq@x@d0TSdwa{ETzRpJdDGDh3&?T%UU!&jfZ`gCijrG>@A zml70?kzt&oj2QQ18oEJzMlwvs_OIO7c&772+s_b>is|W?PzRfq)f3&IIJ_Q8hUq** zGRc=!oSNHw<*_r${#-d4udFN`Q|Hy9T2@Enb1SFRBaf)~?8<3*xWvO#XAV2-vsVM3 zWa4Mj?PBkCi~*8v2GNFEjb__AQqwmIiv8K0==c!Yq~e-6WIoV->sh@pWqTWHjC8sT$cwtF9k-+@`Zv zr@NEbrMI~52{nW>EC%l*cash=yG=4KobP+YBr9jz3|RAr?!-=O>v?DIrRjDybfW+v z{k_}7a%`1rmXB1HOlI5DU6c|judJR>rIqC_R1s;W+aj#?^J2P7z&oL4Z)&wk{!ycG z8kfa%+lW}GNlH2~>Kc{iP9{}{H1Tn;Qbj?Ouv6|N84ag9qv_5dVXk4O^RTwo(I#jg zs|ROEH=OQ7W0k8k*?W1q%gTrxp%ePf?#Mowh3i9%7>*#BLXS~d#RBG+)l38_otr2i zWz1-tC8L;buGt!w?JfdaMKbS|)$h@fx&ddfJzsE#({0WGjG{bk?tCU6%HnfYGNhQj z$q{I}9hPlhd-(ZYL#s#~h~u+UHPzu+Go`UcJ8v}I&1I9@Cn(Pzu#=IV1gWS!d)=53 zQ_5Lr%&F6yk<1CH9hYjXwbS0)I7^fsr=_Xh8iQ5oiBpk>LD`_amkA+gzGTf?!nRHA z#}YaRMv>f`?!;=MVx8i-13U<_q96mu_{axYdaVtPokDL8X@RbR>ZOC~*7p&bRWHHKo+-bWTg4WJp&D*|A zlfuObTWRs^_kN3&B_d+R`p`Asznr}p;M~oTD=~gxIvX0mY>L-+jhOC^T#>-=ymq8C zVJ_a-kS8avVZrEq{w4Do4`Z;|hW#$~|DEDM=QEQSoodpnqxB)~SgS}eO0sTQMFTi@ zuc2$xjHY*oiKGC6$L4gK8jvtVWyD7rZxD)d$Qu$soEN6sRS-y%VVRE=e-qi`H9Ja@ z5{9UF@3sl~GH@RUZVW>fAcE99tD{x(Vj}4XZ!;CUkgkbn9Hr`E)pO!BX-Sw~g*rn6 zMu$}*8c7zLPe0TSC~I<%H>fBm!-E`N6!js{(B6Lm}#mP{L1~J#%K8zhI z#7TgRC)m9cwdG{ z6J=7cN#+uLYBCKHLU}P>cGl}{m8$8Ux3$!k*~avi z%;QEOE0%fH))n|xGqiDRY((`p@d)|N%f?-;v)a1A5=PszYTLI?m+ceFx@~1D6055z z<#5^Da|aQJBX>Q~u^Qr(xumcxX*$9io}E7Gs-Dpm?Nc62Gywu0(!;Xp1{d{Mj9< z%UG&EqM!UNTk&)>t^>Nr1WQf2DikF{&s0*1(3BR_olNmhRef%js*o~s?tsv`O0}yf za-iQ4WTnu3p#GLPK#, 2012. +# Marek Černocký , 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-10-01 19:41+0200\n" +"Last-Translator: Marek Černocký \n" +"Language-Team: Czech \n" +"Language: cs\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Podporované ladicí hodnoty:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Speciální ladicí hodnoty:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Zapnout vÅ¡echny ladicí volby, které se netýkají chování" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Dodatečné proměnné prostředí:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Čárkami oddělený seznam rozšíření GL, u kterých se má předstírat, že jsou " +"vypnutá" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Verzi GL, o které se Cogl domnívá, že ji podporuje ovladač, přepsat na tuto" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Ladicí příznaky Cogl, které se mají nastavit" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Ladicí příznaky Cogl, které se mají zruÅ¡it" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Volby Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Zobrazit volby Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Sledování v Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Odkazy CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Ladit problémy s počítáním odkazů pro CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Sledovat plátování textur" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "ladit tvorbu texturových plátů" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Sledovat atlasové textury" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Ladit správu texturového atlasu" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Sledovat mísení řetězců" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Ladit zpracován CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Sledovat žurnál" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Zobrazit veÅ¡keré geometrické útvary procházející skrze žurnál" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Sledovat dávkové zpracování" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Sledovat, jak jsou geometrické útvary zpracovány v žurnálu po dávkách" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Sledovat matice" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Sledovat veÅ¡kerou manipulaci s maticemi" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Sledovat různá kreslení" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Sledovat některé různorodé kreslící operace" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Sledovat vykreslování Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Sledovat vykreslování Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sledovat výkonné jádro CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sledovat výkoné jádro pixmapových textur Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Vizualizovat" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Obrysové obdélníky" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Přidat drátěný obrys ke vÅ¡em obdélníkům" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Drátěné zobrazení" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Přidat drátěný obrys ke vÅ¡em útvarům" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Základní věci" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Zakázat dávkové zpracování v žurnálu" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Zakázat dávkové zpracování geometrických útvarů v žurnálu Cogl" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Vypnout vyrovnávací paměti vertexů GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Vypnout používání objektů vyrovnávacích pamětí vertexů GL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Vypnout vyrovnávací paměti pixelů GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Vypnout používání objektů vyrovnávacích pamětí pixelů GL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Zakázat softwarovou transformaci obdélníků" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Použít grafický adaptér k transformacím obdélníků" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Pro odborníky na Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Ukládat obrázky atlasu" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Ukládat změny texturového atlasu do obrázkového souboru" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Zakázat atlasování textur" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Zakázat tvorbu atlasu z textur" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Zakázat sdílení texturového atlasu mezi textem a obrázky" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Pokud je nastaveno, paměť znaků bude vždy používat oddělenou texturu pro " +"svůj atlas. V opačném případě se bude snažit sdílet atlas s obrázky." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Zakázat potažení texturami" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Zakázat potažení texturami u vÅ¡ech primitiv" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Zakázat arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Zakázat použití fragmentovacích programů ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Zakázat pevné" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Zakázat použití výkonného jádra s rourou pevných funkcí" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Zakázat GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Zakázat používaní GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Zakázat mísení" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Zakázat použití mísení (blending)" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Zakázat textury typu NPOT" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Cogl bude pracovat, jako by ovladač GL nepodporoval textury s rozměry " +"různými od mocnin dvojky. Textury se buď rozdělí na pláty nebo bude vznikat " +"prázdný prostor." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Zakázat softwarové ořezávání" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Zákázat pokusy o softwarový ořez některých obdélníků" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Zobrazit zdrojový kód" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Zobrazit vytvořený zdrojový kód ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Sledovat něco z OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Sledovat některá vybraná volání OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Sledovat podporu mimoobrazovkového vykreslování" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Ladit podporu mimoobrazovkévého vykreslování (offscreen)" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Zakázat mezipaměť programů" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Zakázat nouzovou mezipaměť pro programy arbfp a glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Vypnout optimalizaci čtení pixelu" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Vypnout optimalizaci pro čtení 1 pixelu u jednoduchých scén z neprůhledných " +"čtyřúhelníků" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Sledovat ořezávání" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Zapisovat informace, jak Cogl provádí ořezy" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Sledovat výkonostní aspekty" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Zkusit zdůraznit suboptimální využití Cogl" diff --git a/po/da.gmo b/po/da.gmo new file mode 100644 index 0000000000000000000000000000000000000000..48d9b58a388a26eb45c81f3bb4b1a411b61711ab GIT binary patch literal 7905 zcmai&U#uM0UB`zuO^YEdEnxnHmQzTY1beRUb)3Yxv77i$?54SnUEgcBr9xEuYvCYd-1*jALjno!1se+1b-a-bMQ3yt@!+*cO}VBaDN1R0z3zP z0Gxt934Rv*DeyL^b^a9xcm~vdrl98e zE$}#a8`QqP18Tm*Y~~2~IQRs(1D*tb75ohNXW;w57uduZa2sUFx{Aq9tlzbyl{&EY{xG#Z{_Zy(r`z|QG$!IBX1k^r031X7uw?XOQ zbx`{L0F&PR0sI4ejQj5)i#(p5tC1VPl7qf)XA5@r@=o4`6U0w zm-hd^;C1j3oKXJtE1&^?AC!OmDX6%46MP(e56aa#Cqe1?8ej64DJcK>JgE4XgU7%( zKF8r@y!bn5qEJt%`e&PCECYmXK2!u z{79Gl?Kn;P?=IO;mvkumpVtkSVqceRqf54s{$xwpU%Gve_6kk$`YxI-`JUozlO{iw z?w_UU!u0-h? zys@U5wMAZ9XNFZ{vZ62}TTN}-+`3Pf#`fE+9LTeF)r zdDbhe+f2??qrzOS)yajM?b`P9tjJv(?suB3pO>R>GqAncXvD1<7TL&|wldDfjt9J( zmEGIRy&DK<8auR&E&EoBO{ZDvY@Ib(YX?Rvnrdh+ZW(*CwWX6tTA*$$w*!-*nL+L( z_#iniL5!q7TkvwbZ6p+PImsH{R>Ps|H`bQM&FZ>p+V~tHOuw3yt%l^z&7!6?TaeSm zo-LBhST<{m%$aFcW+N*NCg+13681`d(-!9JY{u&Gy!!+efQeBkT0C zwmCA9=TX83KPX$Jl2e+_9|apZSmfX@oiR=X7*dJXWKpb zf}Z+4=Toe?T+mg+c27RmFY>xxRo&u^#58S_m5#uiF4o+)&g#JM;=m_Ja0`W_t~TFY zkz(cu|Dic^^{g2-*~o|MJ$8wmE^e)OQhau~wk1v(G}QA>X(}Ik%bo7;x*Oc|{(XtL z{q7X!_^R%a2})wp^BEo* zxN)n3?($NG5B{C?plLI%_Cf^ayp?myVsgNR7hTFGtn7KVCB!GVW`-A`80<7?uzq6( zm38G~ZO2pQl`EHbx-B?18^+`<>49tjr@@%U6?q@tj5{Tqn&t1kyd9gp%+W0``OXGw z$>oq$Ry3JhX7MH;5Gp|&ZbiFcIWMwbFoPp8fjUKjBcZzFYE`x7T!y)m?S(Eno%tst zVm&ZCPCcxT$!pottmzYK)gX@3*d?<$)3Z{d=RNiqsqRK#%dk?IBK%g?BwVHhQcPdb zdb?QxyKg4jAptN|uxj^Q$<3NG-hFlg*}Eh>Jlj!nyj294kY~Cs(oh^l7MN!B!l%QS z$jWiTOS$Wt^G&uVLI@qM;FguS%FJZNCO(Wanr-a6?5bk`p4a3zm51`0L@&pTV;0^P z=Jg$wWW(*fi7-5`ZR7o!e2gjhZa4&lS3c$fnXEpUY7c|32SP)JRho`n`Z~U{UYV zSFS1M+m5n3-`{^qx}MuT&j1>-aKaj|mk+k%rkah$e!k8Dujg*Y5$QFXe0;2wGFJ2> zx($InDsI)|khwy{X2o81%NdbkMz3(>>7vzV#vH!$EVgDYBSy2A)3*zFPJaHRMQ#iG z3Vi2-Jdoa668u^_@bsW4CXaNg_FUnTD@~-F>umGOyjbgx^5@A@gIT{l-7jWP zcykC6OV5d`5GFkjWo??{>l-K1^=H!c6K3PY=94FmtZ%HZ(=okjcXLtCvfuG^{n>Qm zX|uk*x$(@A_2cy0Ldq2XEFI2YHJj#)o0yN>K;*I6;^>DdPGxSw5tyGZjHX#$to5tu zhZ)Gp7|%#|Y&P9A=LsM;Hm3&6G zwp}90t(q-K#mDL*%gg7KXIQ#DeQoDLdUDy%yC3JK7fT2apV~AhdwF~4N})WHULd8o zO;gtX)}227oC!ZqKVF&-o;Dj#97=ZbVmQBh15cjc9#m5}dr=%LTs9Yj+^=6_C!s`` z-@%WfqifVB2~z?J4l>icxG}%m6$qg|NZY)CFhdEDy8ZP5_mxguiI2aby-^Hve^hX) z5TM(}xC!Bj1^hwh`*a)LfP^3}bqiq*RzQkJenNCYGIM16!s{n7Rq7Bg3aN zF`H}WcX4!9U3Ogv+s^M49CJpFsNnQ8MF3{-YjicnQV2V7)ETJ{>+$?{IUszb)AK>( z`PUn5(jV%=InBQ1)fl6pw*z15khq*DQdn^Jw=NQ^j%Dv9K`vcCD{Hf+GAhe*`PjZD17aXWtTy}_phMlaw(CooP zAtl{oLHsj1T9ntDTRCHDanmVGf*VL9J-ICowmN-x;+=3Jmct(Oj!>DjYw050dFEa1 zxVrE?@-4LZmf2UIOHU+YyDVK+r|&g0RH!~2_0q0>IoPzzzM+g+`rPtONdK#TuTo}0 za2&j9?7uG-i%+i}x4Z%ef zC*#$fh=4q=yZK%I%$VQiNMK~}+Cpg#=Uw_FG1$4pTCzRO`F}*G*oEu(N2?o{-zhn~ zQwC8cGxf&|q@uDx&cA2kk@!3!vh@+~8n zLrn1(PRI)+4*375QM{>I^0dn@S;y6RL8W0J8w^Uh6te76<4UfMEaT>Pyp*w6VmYN8 zpVzc*R<@ipw3Ed)RCTgnn*J3k}}TGc+wFCKGt33b=LvdfQHaIwFOMVA!F65s#Kz^RL)gX`JJ zEnLk9CWoZ?ZOL{q}vdQ?dq+4=J5FV;V21NV_Nrw1nM#nv5zB Hw3PfGy)ScG literal 0 HcmV?d00001 diff --git a/po/da.po b/po/da.po new file mode 100644 index 0000000..36f8cb5 --- /dev/null +++ b/po/da.po @@ -0,0 +1,370 @@ +# Danish translation for cogl. +# Copyright (C) 2011-2012 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Flemming Christensen , 2011. +# Kenneth Nielsen , 2012. +# Ask Hjorth Larsen , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-16 00:17+0200\n" +"Last-Translator: Ask Hjorth Larsen \n" +"Language-Team: Danish \n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Understøttede fejlfindingsværdier:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Specielle fejlfindingsværdier:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Aktiverer alle ikke-opførsels-fejlfindingsvalgmuligheder" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Yderligere miljøvariable:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Kommaadskilt liste af GL-udvidelser som vi forestiller os er deaktiveret" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Tilsidesæt GL-versionen som Cogl vil antage at driveren understøtter" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl fejlfindingsflag der skal angives" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl fejlfindingsflag der skal fjernes" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl-tilvalg" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Vis Cogl-tilvalg" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl-sporing" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject-referencer" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Fejlfind referencetællingsproblemer for CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Spor teksturopskæring" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "fejlfind dannelsen af teksturskiver" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Spor atlasteksturer" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Fejlfind tekstur-atlashÃ¥ndtering" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Spor blanding af strenge" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Fejlfind tolkning af CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Spor journal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Se al geometri som passerer gennem journalen" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Spor gruppering" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Vis hvordan geometri som passerer gennem journalen grupperes" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Spor matricer" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Spor al matrixmanipulation" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Spor diverse tegneoperationer" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Spor visse generelle tegneoperationer" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Spor Pango-rendering" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Spor Cogls Pango-rendering" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Spor det underliggende CoglTexturePixmap-program" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Spor Cogls underliggende teksturpixmap-program" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualisér" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Omrids rektangler" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Tilføj trÃ¥domrids for alle rektangulære geometrier" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Vis trÃ¥drammer" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Tilføj trÃ¥domrids for alle geometrier" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Underliggende Ã¥rsag" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Deaktivér journalgruppering" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Deaktivér gruppering af geometri i Cogl-journalen." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Deaktivér GL-hjørnebuffere" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Deaktivér brugen af OpenGL-hjørnebufferobjekter" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Deaktivér GL-pixelbuffere" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Deaktivér brugen af OpenGL-pixelbufferobjekter" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Deaktivér software-rekt.-transformation" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Brug GPU'en til at transformere rektangulær geometri" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl-specialist" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Smid atlasbilleder" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Smid teksturatlasændringer til en billedfil" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Deaktivér teksturatlasering" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Deaktivér brugen af teksturatlasering" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Deaktivér deling af teksturatlasset mellem tekst og billeder" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"NÃ¥r dette er sat, vil glyfcachen altid bruge en separat tekstur til dens " +"atlas, ellers vil den prøve at dele atlasset med billederne." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Deaktivér teksturering" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Deaktivér teksturering af alle primitive" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Deaktivér arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Deaktivér brugen af ARB-fragmentprogrammer" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Deaktivér fastlÃ¥ste" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" +"Deaktivér brugen af det underliggende datakanalsprogram med fastlÃ¥ste " +"funktioner" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Deaktivér GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Deaktivér brugen af GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Deaktivér blanding" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Deaktivér brugen af blanding" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Deaktiver ikke-anden-potens-teksturer" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"FÃ¥r Cogl til at tro at GL-driveren ikke understøtter ikke-anden-potens-" +"teksturer, sÃ¥ den vil danne teksturer som skiver, eller teksturer med spild " +"i stedet." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Deaktivér softwareklipning" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Deaktivér Cogls forsøg pÃ¥ at klippe visse rektangler i software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Vis kilde" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Vis genereret ARBfp/GLSL-kildekode" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Spor OpenGL delvist" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Spor visse udvalgte OpenGL-kald" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Spor uden-for-skærmen-understøttelse" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Fejlfind uden-for-skærmen-understøttelse" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Deaktivér programcacher" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Deaktivér reservecacher for arbfp- og glsl-programmer" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Deaktivér læs-pixel-optimering" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Deaktivér optimering for at læse 1px for simple scener af uigennemsigtige " +"rektangler" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Spor klipning" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logger information om hvordan Cogl implementerer klipning" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Ydelsesbekymringer angÃ¥ende spor" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Prøver at fremhæve ikke-optimal brug af Cogl." diff --git a/po/de.gmo b/po/de.gmo new file mode 100644 index 0000000000000000000000000000000000000000..6955c23f2ecf2bd169f5b83c55a7883e6142584e GIT binary patch literal 8328 zcmai(U5q5xRmTfsCt-s5u#+WxBwPm^+u5z&nf2PS$Gf)YV`uy^vooHV-E~$%QFZt2 z?($Sub?Regw;$jEA`nDKfGki5A`iBZ40+)tO0*K7k>CY{@_>{Fh)g61;thBKAtZkP zd#n0mcGoFw&A+Se*E#3@&pG$he)o|F-wwFm;Ql%8cOD3WA$aZ~{&2njp&r{6+o#Z^4Io{ugiw{4ek)z{h_CnZRd3wZ8>Q&RgK?;8(yi;J<=D z5B?wcJow24zs?O%@4pCY{oet95_}Id;2rQ6!G8iD1t0im5PTLq1D*v}KXlV znL1ebF~1LIK-v2ja z-vgfnAEi96;OJ71C)OMP(Obk)VdErs%OAYfV>K>f*WABe*RNX^Zyn2 zOW?nQp8;RNc+x)uUj+XM6#xGbya4_$C_idJM)|>OU<>SmPlLY)8t`vG+4J8(>G>#~ z`5C+f>iwIb?DebQ>)>C5lJgNZ?OE_i@HOxY;3e=q@ICPRp!EA)gt!U53(BrCisX72 zlwMDPl6MbO|1W`=`aObCQ89QNRKLrh>>Gh>Wl(_X|LZk= z4HO@~32OXzYy1yTe0vb%A#(5p2z7#0@G)?|#tM|YzYmIse+f$N_rX2zQC?~vd*A~2 zRq*TJpMdIj%>=;@feMRSe~bGv_Y2&HTU?sGB&+n3Y|n9D_ z3b$;a{nfR@t-bl29=O=Lxoe3h$qJ={-MZ!F8c}Og(|AG)?(_4_=UUJ~^SQ)Z^Hb;oTQOw`s>}vEeWZ3pUrlJ-FLMdST!m!yty!;EbaHD`Q&gi-mY4N=gfN|~N=prii=wJ6t=YVsMcuPR zl8R-cGKmT^jMAuYWx-(G%OPQR<6AZ{t5pxp7&mRWZga-pqh)_<((SdZ%C$S~sO$`! zs=_5ffqCeo`bD zI_u}raH>QP)i8A}QktdVC_A=!nDxT)I5V|%ru{Q`G>pfQ*yOmI+eku~rO_?-T*Sjs zVolMpVmHcUqv(s3g%*yyFmke5Ele%$(Cy7U+S<_8gB&I3zC@pZz;bhIZb!G?phI_t2g4-AzbCvPYj1*OY z`}fSs-m2;4QQx`iUHejZ+T5C9QvGgcWK&4#E!1|TG@0|gsiyN?k33C3xGz38Pp5j0 z`>Niwvki_#rdOpM$BR)svWjkSzH`W|jTsBa3m;%VG4rZ3`IozW=kM^ zHH5;>KbsBJn>oQuXFzC#aYU0SHLf3GB{sN{x;W^9toYrwgXk#6De*}c&tRyJjawPv zE>5-ap5IZMFl`3evG>53R*_pfCIU`av>hF?vWv4NE`A6#BUprC*r#sJ?&qeP*&=J5YfW*deER!1E(hi~D(Duc{EfP;V8>^b z8A}E`ES|?*T*ZsSqr$FV&WY?6jEIqJfjZR!*8#N%_Oh%rYZ2QW>`!db*v!4@yjY7$Ro=nXvTi+2W2cd=Fl{R%y10jqb*OvGM@zqwpThrE*2GfJkv z5~BNZuj}5xqGQ(c=vV>4ci4rNnb~7zvSMDptYACYA;32|pYy?F_RUZ_biEF^hBj7dy6z%^IM#T*Nc6LM zO+-^WH;QOKP6p{?Ximh8Zsf_2-b^(*eE} zb8;W_T7l=aG;rZTUQ8ZoOzmPt5$xufj$z@e-SE11^<_4m6W~yxB460EIwpnNML+I_ zt5v@U53*%5D9h3E`STpO#)O}!)lb=?R+jhA6YFgL1sYnNe*6-7s#|r+%blbmgy#zc zv2abX3Sq)^Le{dmu()(FT>MlE*~O*BMLLFi_9#~9nfAL7E@%~PoV=q2@r%@48tPrEokX^I_i}$2#YwA^4PRW?(is_! zgaKEt}`sak;RYDBXk`WR_ytq$BrOT)yyv@jov= znVQEgo292-Sa>ts&1^R=!$yr|v+4Anwyf!3o8PA4%HH1$l|PVUh2-lI4m4NBWNj5XH}oZ@Cx zuyJF;9IU-I>~o|~`$bcnq`o)_ueb!3Bu>CUULF$T$1^30DB&XI%}OpfR@iajAl$Hn z#OB>NVpj_rZm4DnZdUopozCGHZ~TFMwVW>rV5loyn4L364rg9h0aHfkSrX~sg4v>k zAw`nVH@Cto`LT^*rIY&{l?%R~6tqT%9Qk5SUFHZMvZ#%*2sPaRpXA)nD8|s3IwfZ7 zn_81H9y1<6cA5$&ye3a9%9A_gSc6Y@MEKA#LlKQAze>Mqs{eg3;BQny+P~77_t(*qt`qxP_+%F>zic*Ht1vF%BX5$R8 zu{%Eig5)+9O=Yr8Un*nmc<4z`PdGQI6*#lX8gq;9i5V)D!ka{3alaT@@iRB@o?=`T zQ)sHXWC}5*N+xVMH_b+TOB;OZ?Nuf!nb^`c%Ft#^6mkV-IzN2J)lrT*c;wJ**`n6Y z6;cv}<55qAoY{wvG*U;PK4*k3?k5LGIaYXQ>;w9T_5@@?#bbCroh zLa(`&w`||VrW}u{3$;^X%O@~)N}S%l(}p|Mb=6mJe5Vp6dsfkJqe_WyoC#5&F7)QKV~U~@ zahv!yx6|jQ`#GucNGO9;&Zz9vw){vfHA~tGd|>i~(gwRw8l3!^j-BiYe2j+kbfl2L zbF9&rZdBTMI&6i!=M5ZUU>|OZ;mJEEf9$f^TpB`>+{`Bz(}Z=l1rIB;L%dNzz`Qyw z8f|)x17Uqgo=|;SH`1MQ7$3r*1BP~^aYgFjBuDOI?;vpA=kleoKcZcL*^yAKR*5wt|W8 znaZ6ZP#x)&{IttDf}Y$#HWqL~qP#Z!*d{KZx&u2$ws<(4)u~aaV5V6Gf>)wy#Mih& zVJ~p!fcZU%(y`T61y@LfHc`6Jca)7?S8|4LRPLSo_)~XWsYm!tnadna(ts^}Qf-Xe zQDk<5d(1*fHz@nEAo-z@!5vXp(3%@A5!_9f9 zE0w9_PJIL`X5PzQ^$fmL4QuC}>C@;uo$aP_U+Ti!WCd5-aT@Zq-OO-5eOQ;RGY!tO zwjn!hxdSA8I`7-Q!)cX6X_8#V~7pr6TO4ZA&-mG-j@f0GXt7_|_)|#u8 zKhRC0WmNUXmFF)XzmRS-k9zUpD9^??GzU5{&DBV*v{xur)!Q7)C;vI%PB#QGf3n9U zN@Q@#ZPvsU!W-@k+mCcc?Yd(xL8STIJf-_O1&@4=32tx})@ip;q$RpISEM?|$K^r9 zFpkG6kncW!5D92xm_7j1MY6Z5&oG6WaBBCtCdD!&0ke`8WE(lVn;uP^6^W9Qu8LoJ iYK|V{5kf!0VnL!z9WR, 2011, 2012. +# Viktor Nyberg , 2011. +# Mario Blättermann , 2012. +# Christian Kirbach , 2012. +# Tobias Endrigkeit , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-23 14:16+0100\n" +"Last-Translator: Mario Blättermann \n" +"Language-Team: Deutsch \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-Language: German\n" +"X-Poedit-Country: GERMANY\n" +"X-Generator: Gtranslator 2.91.5\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Unterstützte Werte zur Fehlerdiagnose:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Spezielle Werte zur Fehlerdiagnose:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" +"Alle nicht-verhaltensmäßigen Einstellungen zur Fehlerdiagnose aktivieren" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Zusätzliche Umgebungsvariablen:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Durch Kommata getrennte Liste der GL-Erweiterungen, die als deaktiviert " +"vorgegeben sind" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Die GL-Version überschreiben, von welcher Cogl annimmt, dass der Treiber sie " +"unterstützt" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Zu setzende Cogl-Fehlerdiagnose-Flags" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Zurückzusetzende Cogl-Fehlerdiagnose-Flags" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl-Einstellungen" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl-Einstellungen anzeigen" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl-Tracing" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject-Referenzen" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Ref-Counting Probleme for CoglObjects diagnostizieren" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Textur-Slicing verfolgen" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Die Erstellung von Textur-Scheiben diagnostizieren" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Atlas-Texturen verfolgen" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Textur-Atlas-Verwaltung Diagnostizieren" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Blend-Strings verfolgen" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Verarbeitung von CoglBlendString diagnostizieren" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Journal verfolgen" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Alle Geometrie-Weitergaben durch das Journal anzeigen" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Batching verfolgen" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Anzeigen, wie Geometrie im Journal eingereiht wird" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Matrizen verfolgen" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Alle Matrix-Manipulationen verfolgen" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Zeichnung verfolgen" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Einige Zeichenvorgänge verfolgen" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango-Renderer verfolgen" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Den Cogl Pango-Renderer verfolgen" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap-Backend verfolgen" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Das Cogl Textur-pixmap-Backend verfolgen" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Darstellen" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Rechtecke umranden" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Umrandungen zu allen rechteckigen geometrischen Formen hinzufügen" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Drahtgitter anzeigen" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Umrandungen zu allen geometrischen Formen hinzufügen" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Hauptursache" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Journal-Stapelung ausschalten" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Einreihen von Geometrie im Cogl-Journal deaktivieren." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL-Vertex-Puffer deaktivieren" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL-Vertex-Pufferobjekte nicht verwenden" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL-Pixel-Puffer deaktivieren" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL-Pixel-Pufferobjekte nicht verwenden" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Softwaretransformation von Rechtecken deaktivieren" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" +"Den Grafikprozessor zur Transformation rechteckiger geometrischer Formen " +"verwenden" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl-Spezialist" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Atlas-Bilder ausgeben" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Änderungen am Textur-Atlas in eine Bilddatei ausgeben" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Textur-Atlasing ausschalten" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Verwendung des Textur-Atlasing ausschalten" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Teilen des Textur-Atlas zwischen Text und Bildern deaktivieren" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Wenn dies eingestellt ist, wird der Glyph-Zwischenspeicher immer eine " +"separate Textur für seinen Atlas nutzen. Ansonsten wird versucht, den Atlas " +"mit den Bildern zu teilen." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Texturierung deaktivieren" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Texturierung jeglicher Primitiven deaktivieren" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "ARBFP deaktivieren" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Verwendung von ARB-Fragment-Programmen deaktivieren" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Fixierte deaktivieren" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Verwendung des Backends für feste Funktions-Pipeline deaktivieren" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL deaktivieren" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Verwendung von GLSL deaktivieren" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Blending deaktivieren" + +# Aus den OpenGL-FAQs: +# Blending is OpenGL's mechanism for combining color already in the framebuffer with the color of the incoming primitive. The result of this combination is then stored back in the framebuffer. +# Würde ich als Begriff so lassen. +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Blending nicht verwenden" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Nicht-Zweierpotenz-Texturen deaktivieren" + +# Siehe http://developer.gnome.org/cogl/stable/cogl-Textures.html +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Dies führt dazu, dass Cogl denkt, dass der GL-Treiber NPOT-Texturen nicht " +"unterstützt, sodass es stattdessen geschnittene Texturen oder Texturen mit " +"Datenmüll erzeugt." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Software-Clipping deaktivieren" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Versuche von Cogl deaktivieren, Rechtecke softwaretechnisch zu beschneiden." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Quelltext anzeigen" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Erstellten ARBFP/GLSL-Quelltext anzeigen" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "OpenGL verfolgen" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Einige OpenGL-Aufrufe verfolgen" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Offscreen-Unterstützung verfolgen" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Offscreen-Unterstützung diagnostizieren" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Programm-Zwischenspeicher deaktivieren" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Rückfall-Zwischenspeicher für arbfp- und glsl-Programme deaktivieren" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Optimierung zum Lesen von Pixeln deaktivieren" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Optimierung zum Lesen von 1px für einfache Szenen mit voll deckenden " +"Rechtecken deaktivieren" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Clipping verfolgen" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Protokolliert Informationen, wie Cogl Clipping implementiert" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Leistungsbelange verfolgen" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Versucht suboptimale Nutzung von Cogl aufzuzeigen." diff --git a/po/el.gmo b/po/el.gmo new file mode 100644 index 0000000000000000000000000000000000000000..eba192e4d9cda46a8201878b47381d23833e2ca0 GIT binary patch literal 10891 zcmb`MYm8jyS;tR8nikVQno@IZc>_tD;LLj0anf{Sx4tDNsU5ra+NB6V&(5BmJ@(9; z$vHD#J0GYW-xA?ODqtZ}J{W<8gw|edY}Z|1VnIKFVCEwg2viV3LX`>9yk~9`4ZR9bN$KvK~Mvq{s>=uzWZPh{37^I z;0XA@M}y!|@EP#q;C}EYz{&hR1%HnFuYsQizX5&E{{c7#{wMe_`1p?^6Zjmc=LbQ_c?A3-_%65_{8#W7 z!2bb12Yz~$U+2r9+Ft{;{@1}zfPV%$@Fw^e_z&PG!TWzK2!0t{4Xy>ZfZ9(D)I6ua z_230i`~D87`Bt-;wcwNBQ{V*nJosDSo8UF@5pXk`*aGeYSu!{WYW#WdaqvA*`~MEe z)WNDB_jXtfO5aa_l4m3Mli&o%Ul8*p`Hz5-^DM{|!5pY{uY>CUH=ySEXHa(h0mxsl z8e%G`guPy#QX$ z@!!E3_iG`^X7CR{+2!v*@#K?i_DOIT_(kwAsQLZ^)VL2o?Q&)Z-X1b2XW2=;5Kj{_%5jVzYp#NA4A#N z=WC$ky$!1We}kvNJvi6zgMSN3&IDup26zsXy#ECr1rNC(_*Qcz;)p7g0F(#2KfsfK?u$FJopUwYv2puJ0L0!{tA@+{{lH654s)c;{SrZ3cE zJd#d!aA7X{NCreR-%-Qoxx@=-Zu6*H?@y+{Sw!9e`~(4pVE;&4{^zk(A@l2KK>w= zY=vrrk8$ai*NDn-SdFu$zn@6Ma$K+Y zo2h8BRjF|6rmJBkbIrtMQQmRLvsS%$x_j~<0=hJsj?$=JjaXaNgG&2=v5_~GyEEv{y+pTyk{S;hqaosg% zBGZA(=NajZkXHI9oQ6k}Vfm0Nhvk`qT3W<~=(bYLswg_Cq+zYMiD|Zms&kR*Nxjra zW}~!}OqZIoiOaRq>z}}*TKsw_HW_!*D3lOxtZ~Hdv$)o%MlLHyVmF&f8sTfL2wE6< zVPto;T$o(kZnI`|4O4mlYTf7A4BTc#X=c!RlTmY4Tu`g+Ij&*N-hx>&-JBK2%GJ2h z=vQ6$iNtixG^}ShX05yCz&iZ{{ez(`NN^N|qpoIrxKD~!hWk&uEqk}R=`^gEyDqa! z-f73qJ|^XDyBkp*QhE(d8Yx|3zSrC7VAsQ*rYrZw=LYGN&vD1C7tb++vB*ug>Sg0a zBW^^BZg9SQh*=9YX2#?-8P3*>YK^A(zHH$#f?pp+MEt@e5WZD|!sefaLDe!Km@Cf^ z8etsKB&<8@hgj7pc(HDA(1NV^JsHh}hhv-)pR{-eLw#)AnGo*cx(x669ZnLa-App; zJuv2}$SsSBfL#{t3JPX{r*0~Vvih245vSa%dv;G0Tgcd~ z9}_o84`c&k8WGcF)woRD%y)`ArM=&?adXDah8f-BI^W^cNU+;yl|D@dyIDMqr*IW7 z4z~)semN7_77U4zm_VI!f%AZx1$&dE>9&QKJJ{FNMWHimso?8A!b9rm#yYW6SMpQ%-^!Y}OASZL(^qc2!(o-^J|67z34p1* zRf~2dx5#ZV`b_v>p9Q{gYY~$3TX}%Q;Gop$b8NRlm3>P_Aur5fNRLGO4E545yV*I_eG-b-&gl(&R7MhWjYhv zp;{JI6>IZoR%Y{BBla#l6IW)cT=JL6lBEIM)fR4L#PpG1KT*^uy=T9CzFCCqg8PG2 z(t$XdwFsagT@p56y*SvMNt0G(#^x&scp%PNlt`~f!Ix*0QfB1+h#q;zu2hdUW_;%I z9vfC?!=sr~Pz>qiOP<18Ei=Z%JBwl?ZZ~42voU=Oho|zhN{ig)_vPcAIk^vdBZ23& zc3|N_UQ8Y-RBf>$3-+Xm%COSQQ>6pm)yFYB6<|%FB3-pNQkhiRl~v-Y($-cbD@`Qh zZl>96jIUcq!Sy=fCmgBNG0{kpR@M>gqVzX;FjB6>Um#CSwaU#+NA069J8vSf(bb}k)F#gPjwWDLBqjW6ojSj~OJ-vSGOQWAFt$)sqjg5~z zyLNOv{dOW{34Ycy$e*O+ZX&6l)QCuD_s!l49*m z`zKy1J>TnRJflE*u})-zJmc>9$+)>{PgMz}^b)xv8+Y}F-DaECzu^4OO;6U{qnq5= zQ!lLg)zS_hFSWe`aoP-__UOoSBV((A_W927_U+Dz_P5%X+Sl9HT>CN&3+*{qXtnG&Nk>L&JMPWzpNk|$m(%9Y6d+j-zZ!py@ z9^LM|kxyhzm#wd20IjTYh3h)gzhQAfZGMmzKGD88_{3CpnJJGk`8+G1kc#+1palj< zvF!yt?VRYGrs)O`Os(qFUE}K#l|9M;KZMzsX@S+GKhuNue9E@t4=F+W8|`@nl9mUR zY38Q7=$z@i#c11c`=aJE6+3B$9k4kYoLkMFYa-jGRI$jfw@qMSX(3VPuDvhyBfan1Z!q|N%FNsLt`Fq;wQvLU-+2_pMuRqjwd+#IeGR<|1r^qByp22LFa;Au%YD4+<(ARdb zKv{92{eI_dkp&l`Nl{fvz^qUFRjXq8J(wOd`N9A}_$@K=#Oc!m6Y=2fm3M(ewtOxe z&UMBoNlynPWQw8lTIId++9O4$3QwIymROMr(*dfKnxx7lg|* zOMc+uG#gP!tys|9^JMpwah7<5Saxsmcd07mOFslA4V`vK%=NyjlIawzwZce*JHf3o zk1~L0O|>cyA5ygp*YYAHnO6b5sDZtjY>t>Or&qOX)1LC@H{ybdz{15TZ{Jiu1&TTI zBxN3?SW=4n^mu!j$9B&8+{iq~EyKL2mUo*FBQIc%!@4tCgld>CBfTzTJB#nz6%!ja6RFl_?Db?cYI&6K2>;($FFk*ctg8BAqrfDQwFzkRWHDl`H-j zYNvIqb{pa_!BSOTlW2LalaI@Ytb#LGf@dN-!?Kg!ds9>>2KFW$TJrjWLi5mhcq#53 ze|cTJbb(wf97e9VWZOgDJ`@E(x3oHkV*EbDIy7iyj10M=|6MSfTJ3H&`X)YuYsoY2 zeVTEi6C>uy)*5FAO{1w9X^UR^4(qX^;)V|RW7u>G`Mj;gP54IS)O!Ov(heJ?F`k9; z1Cdud8=51G)f4{pw13e&Y(hCP6ZzpvKt_p$8CIbY-$ipPc zU$qY*thrCW$&~ugj|k(7-2P0ok|q5R?|I7%YOl}lY}NlGSzXRn{qH#M`2CI-b4Pqz z@(-3K126i0kVCb{P@n3Zd55k^6-ID&sFLA*n}jVXh=BE+?(}Se?17pi*EP5|fvORn;$c>dPk@ zGDa!EQh{9dqMbSXi4fHhJ3D7h3Q0QP_o$kIW?mf29JYNeXsceJpN5j*8O)UCXFdUY zw>C|a&${m}ct6qmpA1ZacBE3hBU2prhcsW3aceaucA-!H+L1-`!hi&rzy46z9dYg7 zQ};Yrb?c|6onNF^@D37yC4FSDz-h&Zl78>VOfF_#I}*z!G4&nOOxK7@6LWrM91_P+ IosVPx3yXMa;s5{u literal 0 HcmV?d00001 diff --git a/po/el.po b/po/el.po new file mode 100644 index 0000000..2323df3 --- /dev/null +++ b/po/el.po @@ -0,0 +1,374 @@ +# Greek translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# ioza1964 , 2011. +# Ιωάννης Ζαμπούκας , 2011. +# Simos Xenitellis , 2011. +# Κωνσταντίνος Χόρτης , 2012. +# Kostas Papadimas , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-26 11:15+0200\n" +"Last-Translator: Tom Tryfonidis \n" +"Language-Team: team@gnome.gr\n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Virtaal 0.6.1\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Υποστηριζόμενες τιμές αποσφαλμάτωσης:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Ειδικές τιμές αποσφαλμάτωσης" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Ενεργοποιεί όλες τις επιλογές μη συμπεριφορικής αποσφαλμάτωσης" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Επιπρόσθετες μεταβλητές περιβάλλοντος" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Λίστα πρόσθετων GL χωρισμένα με κόμματα για να προσποιούνται πως είναι " +"απενεργοποιημένα" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Παράκαμψη της έκδοσης GL όπου το Cogl θα υποθέσει την υποστήριξη του οδηγού" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Ενεργοποίηση σημαιών αποσφαλμάτωσης Cogl" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Απενεργοποίηση σημαιών αποσφαλμάτωσης Cogl" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Επιλογές Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Εμφάνιση επιλογών Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Εντοπισμός Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Αναφορές του CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Αποσφαλμάτωση αναφορά καταμέτρησης ζητημάτων για το CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Ανίχνευση τεμαχισμoύ Υφής" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "αποσφαλμάτωση της δημιουργίας τεμαχισμoύ υφής" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Ανίχνευση υφών Atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Αποσφαλμάτωση διαχείρισης υφών atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Ανίχνευση Σσυμβολοσειρών Blend" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Αποσφαλμάτωση ανάλυσης CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Ανίχνευση αναφοράς" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Προβολή όλης της γεωμετρίας που διέρχεται από την αναφορά" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Ανίχνευση ουράς ενεργειών" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Προβολή γεωμετρίας της ουράς ενεργειών στην αναφορά" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Ανίχνευση πινάκων" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Εντοπισμός όλων των χειραγωγήσεων πινάκων" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Ανίχνευση διάφορων σχεδίων" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Ανίχνευση διάφορων λειτουργιών σχεδίων" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Ανίχνευση απεικoνιστή Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Ανίχνευση του απεικoνιστή Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Ανίχνευση συστήματος υποστήριξης CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Ανίχνευση συστήματος υποστήριξης Cogl Texture Pixmap" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Απεικόνιση" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Περίγραμμα ορθογωνίων" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Προσθήκη γραμμικών περιγραμμάτων για όλα τα ορθογώνια" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Εμφάνιση γραμμικών σχημάτων" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Προσθήκη γραμμικών περιγραμμάτων σε όλη τη γεωμετρία" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Βασική αιτία" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Απενεργοποίηση αναφοράς ουράς ενεργειών" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Απενεργοποίηση ουράς ενεργειών γεωμετρίας στην αναφορά Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Απενεργοποίηση ρυθμιστών GL Vertex" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Απενεργοποίηση όλων των ρυθμιστών OpenGL Vertex" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Απενεργοποίηση ρυθμιστών GL Pixel" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Απενεργοποίηση όλων των ρυθμιστών OpenGL Pixel" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Απενεργοποίηση του μετασχηματισμού λογισμικού rect" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Χρήση του GPU για τον μετασχηματισμό της ορθογώνιας γεωμετρίας" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Ειδικός Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Απόρριψη εικόνων atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Απόρριψη αλλαγών των υφών atlas σε αρχείο απεικόνισης" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Απενεργοποίηση ατλαντοποίησης υφών" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Απενεργοποίηση χρήσης της ατλαντοποίησης υφών" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Απενεργοποίηση κοινής χρήσης της υφής atlas μεταξύ κειμένου και εικόνων" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Όταν αυτό έχει οριστεί η μνήμη glyph cache θα χρησιμοποιεί μια ξεχωριστή υφή " +"για atlas. Διαφορετικά, θα προσπαθεί να μοιραστεί το atlas με εικόνες." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Απενεργοποίηση δημιουργίας υφών" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Απενεργοποίηση δημιουργίας υφών των αρχέτυπων" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Απενεργοποίηση arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Απενεργοποίηση χρήσης σκελίδων λογισμικού ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Απενεργοποίηση καθορισμένων" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Απενεργοποίηση χρήσης της καθορισμένης ρουτίνας συστήματος υποστήριξης" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Απενεργοποίηση του GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Απενεργοποίηση χρήσης του GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Απενεργοποίηση blending" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Απενεργοποίηση χρήσης του blending" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Απενεργοποίηση μη-τετραγωνικών υφών" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Κάνει το Cogl να βλέπει ότι ο οδηγός GL δέν υποστηρίζει υφές NOPT ώστε αντ' " +"αυτού θα δημιουργεί υφές φέτες ή υφές με σκουπίδια." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Απενεργοποίηση περικοπής λογισμικού" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Απενεργοποιεί τις προσπάθειες του cogl να περικόψει κάποια ορθογώνια στο " +"λογισμικό." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Προβολή πηγής" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Προβολή δημιουργηθέντος πηγαίου κώδικα ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Ανίχνευση OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Ανιχνεύει κάποια OpenGL calls" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Ανίχνευση υποστήριξης offscreen" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Αποσφαλμάτωση υποστήριξης offscreen" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Απενεργοποίηση μνήμης cache προγραμμάτων" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Απενεργοποίηση αναδίπλωσης μνήμης cache για arbfp και glsl προγράμματα" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Απενεργοποίηση βελτιστοποίησης read pixel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Απενεργοποίηση βελτιστοποίησης για την ανάγνωση 1px για απλές σκηνές " +"αδιαφανών ορθογωνίων" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Ανίχνευση περικοπών" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Καταγραφή πληροφοριών σχετικά με το πώς το Cogl εφαρμόζει περικοπές" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Ανησυχίες επιδόσεων ανίχνευσης " + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Προσπαθεί να αναδείξει την υποβέλτιστη χρήση του Cogl." diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/en_CA.gmo b/po/en_CA.gmo new file mode 100644 index 0000000000000000000000000000000000000000..895dbfeabc181ec25cf7247f61312c67f05aae21 GIT binary patch literal 755 zcmcJN!EV$r5QY~hLW;P+6_AD-2sxW9D`>q0DCt(J#Hy8suNzKKta9@!_Ek8Cr~eiqjxW!SNm*xql^76 wq+?TCV?&>i!}f^|$=vi#7`BhD^&D(>w)Mqm0;^?l%fih9^4pW-|NRhu01I5*HUIzs literal 0 HcmV?d00001 diff --git a/po/en_CA.po b/po/en_CA.po new file mode 100644 index 0000000..d236929 --- /dev/null +++ b/po/en_CA.po @@ -0,0 +1,358 @@ +# English translations for cogl package. +# Copyright (C) 2011 THE cogl'S COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Tiffany , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-16 19:12-0400\n" +"Last-Translator: Tiffany Antopolski \n" +"Language-Team: Canadian English\n" +"Language: en_CA\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/en_GB.gmo b/po/en_GB.gmo new file mode 100644 index 0000000000000000000000000000000000000000..4a1f8b2bd46266449000938ed8867bc663179358 GIT binary patch literal 7554 zcmeI0TWlOx8ONukh2ma-0x6eXPM~QL(%sle+9aE}iS48zty8*TEI|CfF>mQ}}MKAA`5R&%?LF@4#vJ)AIiH*LdDdT(IdO!rS4m;alOA*LvRj;5N7i&Optl57o~n;6C^a)VyDU>Tes9*#mdM z-EbKmf**ySgwMen;c+H01D7B}dQU^O|03K0zXdh_mmpnx6F0axY=iRm9Z>chg>Qq) zkUuZrB>UH(?0f>!h4(DfxX(k?{|Qt-zlVzBtB^l$8^IQLK=pqBz6;Jn+1G{A%Q{rM zFF@J*Jk)qEL-|cXtARaG^Y|bnB;Mmtes~(n-?!4~udYBJQ2iQ=ufsX0_@)q-d7p-K z?R}}d{w9gbTQ1SRUln$ST(!mQ*I(!9coPU=0ucb5j z?RF^p_d!hd+HgM{l+V8gW#@D7e)w}J9q!;He;kF<;fJ8c`Am8L8&Ko_3^H}^Ptd@> zL;2-qjAkm{43s}tpmg;y$e;HtC-whBC>_26HSe3~RQ;_$)$c;h`zd$`eh(hq4qUzIkiCitlJFMGC&x=l!_{#&Kcvmmlm{t_=XQ$X zuVWWQ8j-%MLow7LpWRD2p$iWAUWa0%LovIHf?Nu}$+v73-UF1KlxrwD<|y)agCf1{ zr5vW{ASA`{Ud~sRzu6`Veax2E(pGgGj&hQsxOy|~wiyPg zHSr)1gUDv46Q{-xL({c!-{$H1WvZmMmHSb55c=t+>OmgFkslfxtp;fv^=*`!RX+{< zW@xj9Hy3w9vyiA#<}Q{J+Y0bi@zZ4SC!E=?!&yP3&jli9N3C7unU z>ghuBJO-N7c5G^+mepYWzF*61;-`LY+eRarxMNPu8@rackR)-Mm-jKkwBkXOt4WY$gVNLL&Doii zHFGQ(Fsz@4erEc9kwAr3Dj2Chyt82d3<&K5ikeZ0xXuj+%b!f@%4!UL`FJVtjnt z4YLqO$KBNLk0;S#YPh;IDTIaYdQd6Pb)cP{QOeJf@ zbr$rK(3-4erEVq@C;lS?i!2K9qR7!`r7@+squc7yB!$a2jy8Ip_0TpW$}^jz*R=Ui zTF~8M&Ox7Ojt9)*PCk^zT49hR8(lYgA~Q{%`ccNh?2pFWG|t9`?!hJRV8J>L$6a}_ zy1|M;#`5o&nX|K|llt9axn2~PveK#f4N5BSEhIKVl+HuVLX;*h*4}ugo2#xmnO?pw zYi_fg%0B+>)T`%&p-_?O45C({izG;_vKyLjU7**>jai}Oof(TQxBVn9*1lq4GLqj0 ziAeZWND%y>kA#c$Sp`&gHW_AGJyIizBb)ehLvrjLqn3~_3w zL_am{*k;kryvkGNfyIU8Y6=;Xb!~#2?Sb8ZoJPhpSs1j)o8?SdPU-mfFvxpm=x0<5 zBF=uh?k%`oWrHWZ1qM%pHcQ2s!==)$8?G?97|+|2oe+glp> zqVidBr^{M*86Hu0lD$$bQyQc#mRj5{+o|n1vt_1f<-{WIF~>61op;&NjpVv;zqM31ea{DTyx9W#v_lCFRHUPSEQLXN4bF*fqkk7J9_L=8y&Q>Y8ywnOXZl9^D$U|i- zc7eX1j5O`qlv%m#@Jx`k%!$+=Dj~QEi^wuIXX%+;F)eSFJ(?xrJFcqN0F;*oYubl` zgpFRpEZdCK=K3uvYLj)B7jJ~_eqz%?&+Ny9f^*7CfO}M|IhRZ}-sx)&Z8ry&h61Z? zx~w9B6smFaVx!+UuhG*|u}V@G`Alj@YMBj{Ys+lbV)7aza7(xsbbBF1>!n#MwgHxF zG4LQGr`Np|vS=ac#TBjjyh_=X_BX#JoeS)+$N*|G5@CYsrNO+H#)EFJ=&ussxgZ1p+2x^)Y?8?Glkw{y7_>xV;sJu^y*KDFE{PqkW$oiQNa6JASaA{Y zj18(iXywzba6s-(C&*s4IVCBqsGT5JHO#)rsROmigSE*6X6is=|A9S|Qf#wwg2D#d~l;x@1SPu^I_}rVe9jO mmzJ&12mODk`b^mReAxVdw5`vF4gX~Qk3S#yX8!;BeE1hm8>egl literal 0 HcmV?d00001 diff --git a/po/en_GB.po b/po/en_GB.po new file mode 100644 index 0000000..f644fb4 --- /dev/null +++ b/po/en_GB.po @@ -0,0 +1,364 @@ +# British English translation for cogl. +# Copyright (C) 2011 cogl'S COPYRIGHT HOLDER +# This file is distributed under the same licence as the cogl package. +# Bruce Cowan , 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-05 19:32+0100\n" +"Last-Translator: Bruce Cowan \n" +"Language-Team: British English \n" +"Language: en_GB\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Virtaal 0.7.1\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Supported debug values:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Special debug values:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Enables all non-behavioural debug options" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Additional environment variables:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Comma-separated list of GL extensions to pretend are disabled" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Override the GL version that Cogl will assume the driver supports" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl Tracing" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject references" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debug ref counting issues for CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Trace Texture Slicing" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "debug the creation of texture slices" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Trace Atlas Textures" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Debug texture atlas management" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Trace Blend Strings" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Debug CoglBlendString parsing" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Trace Journal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "View all the geometry passing through the journal" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Trace Batching" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Show how geometry is being batched in the journal" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Trace matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Trace all matrix manipulation" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Trace Misc Drawing" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Trace some misc drawing operations" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Trace Pango Renderer" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace the Cogl Pango renderer" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Trace CoglTexturePixmap backend" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace the Cogl texture pixmap backend" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualise" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Outline rectangles" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Add wire outlines for all rectangular geometry" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Show wireframes" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Add wire outlines for all geometry" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Root Cause" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Disable Journal batching" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Disable batching of geometry in the Cogl Journal." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Disable GL Vertex Buffers" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Disable use of OpenGL vertex buffer objects" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Disable GL Pixel Buffers" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Disable use of OpenGL pixel buffer objects" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Disable software rect transform" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Use the GPU to transform rectangular geometry" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl Specialist" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Dump atlas images" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Dump texture atlas changes to an image file" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Disable texture atlasing" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Disable use of texture atlasing" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Disable sharing the texture atlas between text and images" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Disable texturing" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Disable texturing any primitives" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Disable arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Disable use of ARB fragment programs" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Disable fixed" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Disable use of the fixed function pipeline backend" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Disable GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Disable use of GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Disable blending" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Disable use of blending" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Disable non-power-of-two textures" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Disable software clipping" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Disables Cogl's attempts to clip some rectangles in software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Show source" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Show generated ARBfp/GLSL source code" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Trace some OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Traces some select OpenGL calls" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Trace offscreen support" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Debug offscreen support" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Disable program caches" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Disable fallback caches for arbfp and glsl programs" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Disable read pixel optimisation" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Disable optimisation for reading 1px for simple scenes of opaque rectangles" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Trace clipping" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logs information about how Cogl is implementing clipping" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Trace performance concerns" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Tries to highlight sub-optimal Cogl usage." diff --git a/po/eo.gmo b/po/eo.gmo new file mode 100644 index 0000000000000000000000000000000000000000..83a316e880df3db4fa8f3b756df2397417e3a56e GIT binary patch literal 1293 zcma)*&ubhv6vx%p>5olY>W~mho1jn%F-GH=wUfGIZ{yfrr*6F1c()<9pq-ItHiP{z4X$5qF>E!)=QyK!Q-PRJw3hm^z`o1%o)M>9P%yX z31k-X77_;iV6=Aw{04diUITv_uMfa4pjTix_jJrN@FMgV;1%#CcoqBu{0#gP{Qg5i z{szBkJ4Dq}HuY-SqpMV!G5CYfaV@Qaj z0r?a%Jz!FgU?0XukPsVO)b&7kglw2X(cRKZquof!MZYQvsSA3bc;Tow)CvEedzB8m zo6_;V67=3qcW0t-+dn8Lnit2uvhYi~1M?fLFE-lJ4zn+eh_MJBnTbsY4Ft4g?( zbgQy7){FdK>kp)>xRR%W>{)XtGS9Yi_CQ#Ngi@M??1tQVVH^7*IA9%D$egWLg=0OF z(t-D7y0CzhPo+{kDzq7j$k<{*Xq1xU#ijW;iDMYDeQ_j1Jm+>z7T<;`Z6;}RaXxOsZU<4ap5@vp?u||9 zeJhf!BFOYtuV+>47pTMW`;k(hb}5!2-XvPn9{Z@1svi5 zSL?KxN@C4~SyS-rBE>764N9IzTKMzBDHW#C+3vK@%a}xQW5b{x8X=yP$Td9XLaDga zD>NH$iymnG+S_8w=XN2L17TTPXC}w9r*ye5ed8h9d4Df!AJ+C<_+)e%eO;ZyQN9AN_&$=uo|IcYl3rk4#p)c, 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-06-07 21:23+0200\n" +"Last-Translator: Kristjan SCHMIDT \n" +"Language-Team: Esperanto \n" +"Language: eo\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2012-06-07 19:16+0000\n" +"X-Generator: Launchpad (build 15353)\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Suptenataj sencimigaj valoroj:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Specialaj sencimigaj valoroj:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Enŝaltotaj sencimig-flagoj de Cogl" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Elŝaltotaj sencimig-flagoj de Cogl" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcioj de Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Montri la opciojn de Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Bildigi" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Elŝalti teksturadon" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Elŝalti na ARBFP" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Elŝalti na GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Montri fonton" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/es.gmo b/po/es.gmo new file mode 100644 index 0000000000000000000000000000000000000000..b6e0c47c3874654438ce36dfdfc3f7d0be3dce1a GIT binary patch literal 8402 zcmb7}TZ|-EdB@Af5SU;RE?Ec(VH?A+jqY6|8711{*HT|3%EYX{kzHHGvNEd z8TcOXS@5^P7eKA^cg_2M0`KMdKfx977vOJ#_rC?1z>k7zzY0puYv3oqzW@(_{{{XY z_6O{@)yK>Nd9Y}T8_;8UOl)&31o z=kR0jIQS+u{V;eM)cRS2Uj#MpcR|hfkD%6l4g5Ix7RbdE!6x_^I0a<~e*+!?_rTA9 zuYnJMn_oae$$gyLaO-U5FL6h5XzgR%ntPpFd)Fn7>3mSPyFSLJc%VH= z9$g#UPjVmC1DEtNe`$Y`Rs6WvG@NRXZFbj3`6jMD!Tm|@HE!uj{MRM@%U8Ws56z{s z&?Vb_oLd~yr8CwgZs@v~`y<@Y&)F|(3kVg?#>DeCbL%?8Eq$+Y%ia!gKgz8OO1bNU zeBRxBCrmg$r8Cnd?zPure7V5=32w~K`I&pb6Wp@RH*lZh);R}jVQ6;aA~IQBC2<;+ zW|9@gCW)Cw*(|Dx>#x(Lh{lyor*&eBh3;_`XQ@q0lKIGCQ`2?I?-L)!xBv~ArOT}41s zM3bn9(s884W-~h|quds@ibA6mO*S#>=S_62iqcXdX@R_mcnpn2Ghtjx@Gv+lL5!q7 zozQrxDkKzhm6FxBW|K)dE}|$kWu50)Q8n)o!i=*ztu!Pq%ev9DX7h5EP0tERYL>NC zVoNi#shvjBU~tyUAz?4Z*P_Int|#n_aec#;s9^j)Etk%B-JZsb)p*-U-i)`! zXp(o`+Ggpe<${S*Q*B312d0^4*pHA_<|mxMqmdmyZN_%I-BL@77>jPFNtvMNY+Be^ zzljN3L)DE)X_gN1Y&R+f*##v-pM;n;dtG$Vv#al3#PrWjxE1$duzq z>}E4rZl9?mXyM2UBfHfaVH$C}*P7AfPUZ8fb?xOg+-5~-X7Th!QMD^B=&jpxJmWO` z11t_74OVRQJ0wi#H?+e zHj~0mow?q2E={NP^K(pU-fiSj3MsvYMvjywbGFy-bg}D>r|IkW#pV|2)XZ_mt+(wQ zgJY4I)alsqB9HS(-VM%=pJvupjiqDq10}{*MYFtewy(1=CC+b-A|if!BoMxyL1AZ~ z?Sbmef?#I6jcbH)coUl%*AKChC^(loKj@sS_&tiY?M{qQVw29F!BFoT&u6&1IMu;> ze%ldl+H7aL-U4G!-|9 z7dN)rEtG85kBKY71JMAVhQ~Bz5|8nl%}z0=qW``dSKDUSmUN3#K5aM*Hhff>(`2y0 z;zb-{Dqb8O<#zpYPGq;B#Yb`k>eL9_IMg!O%(BXyu^e}BsnbQPGxuhSt$Pm-sVDg% zv6d~>#TZk|!e*St_MWXYqex10evdsiuI{S$mVPBah5xRoiMh-$q$Yedr?+Dhy!&c! z$p-+Y@~7IqS8$8WnxoH_clKrAU!HDVa`Pw)Fh0(-U8JFA6j5Mi^N!PgOyiZC2`|Lu z*qklwt{j5za1mN&W|NtTibeCXnbBP0eEY6S17KbeUsD{4a{|4H*^KGf=I3=C6=eP6 z?Sat0&!fWenRv`m@L7-q_$Fs_-kHq5nQ0H9-vg$hgH@Prx`-f-HGW?N`uTlztqo)4 zq;Auh*bddoD3PyiyxEw|YmL~O@OC`iPPk<+qk#(pn5$d3F7fHZ;4)s+QTpO#*?iTy z?3VkBS<;m_+I1d4Lpl=XuwERjwu`KuZoBzf0$z#BniT0q6ntu1A!S?EkLZy%>}hg6 z-}aHqTdYlX?e)^gDO!5@l&7^;7a3#xo%3Qtvw;}JZcN|S;K}@4rbTS?`||$I8M$|Q z!@%=eJ8Z=?)8Q@H=qFCCDlqL->l+!pIoUW(k zU@KcS+f|jX9y&zAbp!WfhtrfJ8fL}x5WX%d{*Z>@cp5)OoC@o4b#k24xbR{LCpI`E zUxhG(v$(8Pb9i~>$YA;CVEKqyIkNi5k%P-C%gb~eY(_h=Tu5ET^X{va`fQx zVfvj%$^raLOUR!UtL7}0K=O5=E-MgroCw{U;jDdgYC5xVG8|{Kk1?G57=8@4B0F0( z=gQpfeKSkU3Adp^R1TDbp6a&Ok61NJ7oNCqu23| za8tmAlb5$19~|rZITn&WolEh1P;1p38^zVq#YEv|@HmmBTs3L#9?O%5j~oB>?2W9%*_mYT#WW&$73UyP zXiZ{UlJC7}fAtabHWXZGD+w)yGO{8i#D+L76&>=t8@ax7G<1-O2B^I)Fl_g7lano? ztb3jx6-GG<8pnGtrER-W(rC#isALvaxKrOSD%^atlTeJ7HVeU8)D zAYOE0wYS?)x+K)XD85M!47Djya0PPjn%pA3)*by|}e z|Ej^9SZ>n_FKD}-7#m5MWS|4iyYkv=3oPx&Rb;izJhViyRcBJ zGLt~1(ca4{-Q05d-ixYv)~RFe(1}EX=_J}>C!ezRgP4Vl5UFfPp@&+NtYQrmNlO^R zu55mdrYicSb2PvhrbW&$BW<4_YR1a-+hZy9=^9%O__OX^` zDwT8?;k{TqttkwPc(OtdDy0ZkCMFS%l=B#R{0g z6TYVG>_etkL{nl>!8gj2V(bJM@4Yn3`Wn;vgxB}h{xO)3tC*25ahg#c=$_DhTW7kW zQ=Z1fnQnunt2iHSJg^(2(Z$})Rt40~^3zt~ul?nRuLK^1E#t7pot!I2*$uQiul`^| zzi{B!t#QR=;{*t&ot&29GS*Tqm^OlSG6yOyttsr@i#LJ`8Cqe5TUD(6c8v^0S7A(L zMFfQ}GO)Jr^wlUP-A?7z>SDNyLvv9GnePxny3u}t?onwM{=(U1n|M9g7pD)AFD03R zXw)P@-dN`tvf6clopbNo6Jzq#z-LS7q2Xua$@=&E#MHiVY(p0uSipxow9(Co@*3-u zWl67F&ITf1;PxGx;M@%i<57K8QQZBwJU?aE;;O=a29|0#Dr5Pb&KYah!?_v^pz)Wtz0Xt|&-s8w?bta%#q_q- z*UgRM`@PU*(P^q+%bi#7G1t>*(P258Xyo#q5pl^NXU>Mb++-Z24=!29uyI8yXfQT1 zjzkWXg%xmc7<(`2x7|KLzg*JHg6mY+F6HPWaQFWQd35;#m0kQ>BB12lrvh(2L zG3vDQcwIK{r7!EY`aa9=uh7!WGR^73jhm!RWSmxfG?4d`E9#=iFz_bpR3i`CQFdRZ F|33=E3(o)m literal 0 HcmV?d00001 diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..3627547 --- /dev/null +++ b/po/es.po @@ -0,0 +1,372 @@ +# Spanish translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Jorge González , 2011. +# Daniel Mustieles , 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-07 20:17+0200\n" +"Last-Translator: Daniel Mustieles \n" +"Language-Team: Español \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Gtranslator 2.91.5\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valores de depuración soportados:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valores especiales de depuración:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Activa todas las opciones de depuración sin comportamiento" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variables de entorno adicionales:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista de las extensiones de GL separadas por comas que se pretenden " +"desactivar" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Omitir la versión de GL que Cogl asumirá que soporta el driver" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Opciones de depuración de Cogl que activar" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Opciones de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opciones de Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostrar las opciones de Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Rastreo de Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referencias de CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de conteo de referencias para CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Rastrear el troceado de texturas" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depurar la creación de troceado de texturas" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Rastrear texturas atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Gestión de la depuración de texturas atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Rastrear cadenas de mezclado" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Análisis de depuración de CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Rastrear diario" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Ver toda la geometría que pasa a través del diario" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Rastrear procesado por lotes" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostrar cómo se procesa por lotes la geometría en el diario" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Rastrear matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Rastrear toda la manipulación de matrices" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Rastrear dibujado variado" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Rastrear algunas operaciones de dibujado variadas" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Rastrear dibujado Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrear el dibujado Pango de Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrear el backend de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastrear el «backend» del mapa de píxeles de la textura de Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Esbozar rectángulos" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Añadir trazos de líneas para toda la geometría rectangular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostrar trazados de líneas (wireframes)" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Añadir trazos de líneas para toda la geometría" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desactivar el procesado por lotes en el diario" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" +"Desactivar el procesado por lotes de la geometría en el diario de Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar los búferes vertex de GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desactivar el uso de objetos de búfer vertex de OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar los búferes de píxel GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desactivar el uso de objetos de búfer de píxeles de OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desactivar la transformación de rectas por software" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Usar la GPU para transformar geometría rectangular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista de Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Volcar atlas de imágenes" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Volcar cambios en la textura de atlas a un archivo de imagen" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desactivar los atlas de texturas" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desactivar el uso de atlas de texturas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desactivar la compartición de atlas de texturas entre texto e imágenes" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Cuando esto está establecido, la caché de glyph usará siempre una textura " +"separada para su atlas. De otro modo, intentará compartir el atlas con las " +"imágenes." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desactivar texturizado" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desactivar el texturizado de cualquier primitiva" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar el uso de programas de fragmentos ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desactivar la función fija" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desactivar el uso del «backend» de la tubería de la función fija" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desactivar el uso de GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desactivar la mezcla" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desactivar el uso de la mezcla" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar las texturas que no sean potencias de dos" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Hace que Cogl crea que el driver de GL no soporta texturas NPOT, por lo que " +"creará texturas troceadas o texturas con residuos" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desactivar rectorte software" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Desactiva los intentos de Cogl de recortar algunos rectángulos en software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Mostrar fuente" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar el código fuente ARBfp/GLSL generado" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Rastrear algunas OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Rastrea algunas llamadas OpenGL seleccionadas" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Rastrear soporte para fuera de la pantalla" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depurar soporte para fuera de la pantalla" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desactivar las cachés de los programas" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desactivar las cachés alternativas para programas arbfp y glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desactivar optimización de lectura de píxel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desactivar la optimización de lectura de 1px para escenas simples de " +"rectángulos opacos" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Rastrear recortes" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Información de los registros acerca de cómo implementa Cogl los recortes" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Rastrear problemas de rendimiento" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Intenta resaltar el uso no óptimo de Cogl" diff --git a/po/eu.gmo b/po/eu.gmo new file mode 100644 index 0000000000000000000000000000000000000000..2148b3c6a17e6a0ca81ca78ba8a1531cd682b433 GIT binary patch literal 8181 zcma)=UyNMWUB@qJ63Ui9C}3!z<&=;n!JhH1?Y8dPPUE#5$IY(o+Ut}*59Q3vnVFNh zbMNH-@!Eq#pOBDJA$W)cEl7DF5`sR^LRB>&A%p}H0-?T?B0*`9C_I4>FT5b}`JQv{ z%-wnuxY~Qad++)8`}6(%e&@_L-u>`v3D+mMf1LYw9!ioqc;XQrT;F^&Nq!Ri7T527C|r2B>xZwE6zm;A6c13%CXT7x*~%HT$3^BqH(%Ix9|KEU`=bu6O@xMX- zl4Ceq_#~+L&w%d*cR|TF0mYa5pvL_cD0$xmwca;D*-cLC0mnh<@v|T;m?EDLCyCn$dt+NgOclyLGkaezz>4o2A=>QLn-ll3;Z~E9n|>W z1SRiRK=I)pK=I}n%4?pppvLWkvePS|^!YTX_1*wA?vFs}|L@Ja$foygQ2yQpUjXlc zn(xm*$@dLV`aFU$#s3|!4_Z+6{WTt%=XXK%e-nHf{1zylZt(aB_yj09ejb$FUjwDr zAA*;_uYp&<_r53k_ZPqq^In7Jz|VtM!G8l^2RCslsw7_pUj+XZl>VnN3R5K)!A@or6w_gRd&L4p1z`q1F?j1}beLncTaLF6p(wEq!k`EzdQGI;%^1KhAxP`xD$3xn(QyQkVF2iksB4 zx)f8o#P#R7FYAR%oYy5^=@KVC#4S$9ZkQ=~l>0jOQ{3<5)+G)qe#Mn%xMlN?a_bTg zbSX|B3jZYuWg_IMo#tIRuDw3SKYQHbrMM>lJj{KbTe0&FZgE}yOfHT_=D-)ui(uY8`_)VS=fFY;{evdY}Gg|~y$mD|as ze3F_Q3w0{v%k705dYk&Pitqb{9r|n%Uq)_FPbR#YacU=}sd7`grsEN9b=J1t7`%*t zrf_3dxNPXO*nDn#rCZp-R&HdpqRGeR>aKD3DwmZKNee6r$Lq*gEHm<@1Ro`rC5Vyq zJ1LE~t3pCCS1DOzYd#*A!@{}Dl=Whf7gh5eA&8QS5rrIr>k7TZqJGR4sOq_Fd~ z5@S@u)Qw14p7j>_fh&6XxK|zIrm@bte-4l4erd&~z}>=G31PMt_riPW=Zn;ta_Gcv zl*t$NmD)jzKwcQRTCEYL5qI@jGnz#(d3Uu{dpU*MtSHMI_TIo%2jYUh2A%yJZ>|?C z^Ko?`jtx`4SaeOdYLS?xDr{B~nDf<|ht}y1j15PAL4x}j9CKCvZbyo`B>czb;;kJs zF6<

$byhoU@y{&L_l;0EBsz$EYoz&79y zfv16V&J8*KN8sJ)yTEebzkv4uAN@9T0zL_(`8`0=b06?!U@ven&;$Mi_yzE3;6sbV zIj;d}{B)Y;4OD5$}fP6fy;sGfMib+Nc%JbR{~E1$?lJV zwBKSFvmCe-xC~egTn+p!uo-w2crS1*j93TU0mP9?7m(Hu0v`ol0+Rh71F^NT=sO|~ zi-F|t$AF~I8sL4vY9Rg;9sfxGeL&K)4Tvq2^FTUx3P|#Q0@6Nz15zCS1H_-Q7{Mld z6iEB80zL?=1d@I+An|2Ckk<7BN#7|To%bn_{6;|w0G0#Ej$Z>25~USLe&_;{zaPe? z$G-u70IB~Ol%(~y!3c^|IgspsN#ZVvAt1%yka!qK`dtD(1^fU=`uz_`c0LHBmjHu6 z+V@vL;@|5MTY+@WX(0LOT_8fGd;lanK9c<}ffV1nuqn;21`@9~0iOXzfV6%PNO^J@ zNb5h8<6i*j{ChxFl3NC(ebxX;ehZKRH6V^s4gwzs_DTE$5L+n!29o@p2ol+~1o#B7 z3P}4l0LhQta{l)~(jyP70X_gF=-dwADqx@N{~1W@KLJua{t2Xg?uWBTeyzl8U){#QBv4O4*y?7BaTv>=&M3|3GFHB;DaklzH;;y zp^=}q$(gkhiF5wBlr3nlqOC)F1dVt~-%_-dXyjM_Lz?oBa`y$ajiSqQpMDbe z=(`*3muTc`@*BkxSB3Hl8u{}MH2OB65l<@6mZ7acdm4>C@-KZ97hFI5yB+^2j_XC2 z=brqjJdYn+(OyQQ*i#Z?309RNAzO5I zq_nWECUn~o{c1}M>qbm;B3dXNi=oS+2{mRj$7Hr91s9l08~$unXb%)*mKN14%?N9B zSTd;wY%Qf)s-s01oyg26+g!=CeU4_>q!JyFvNUufOoeA6x=o5ll#QeaBkk8GFuB9A zNGa@PldfXcj7IISrD+DU)2WncIdU9Iu&|jn99p8=c3OIxb`yHqQqqAYX&kFM3Dssv z)lg#^c~IFX^dM!o>HD+N_hT673g;oDfkPQcM-%uslTBTn>cqZO(i8*d1@c;+j=sU(3l<8 zh}|&8OsTJ@HPC{S7mO^NCY6!u7KUj@mf|iiKCLis$H8r!NS-N;UPyCli3>E!ZPt^B z=G=j{8FgxjW8s9JN)@}VFhgoG$5IU&iJ2^%S#nPCLNT%62sGFahr?ZtUQ?t++D7_E z*}CoPS=3TvJY8>!ixk>iS;QncR+Z8WkWzRk#7W6ao_lkamWtL0ntr`3a;}t4a*wYx z-JeGoIEz>`ZG<^5QhG|G>ITk-_hMJyjW%cU5*x|pXvvhrbDv_tY!tsDiV*Srkbv;% zBq+@D(+?<(lqkl+ag;_d4%I|87?*=u2~F8#@H)tgEb%*}#nl=eNr{}~^$ZLZwXxDf zxzh~_yx_MQLYZc9vsPrFj#(l%MT`hoV9{1}FHYul)#yvfVTtwn0U>l^q3N_&(z! zG32_a@E~z}-eCI^z835*4`aZgc^b{_7 zBBoqZV4K*N3(_Skx;I~hVmzf;oX@zA5eodb@CXo7Jm*9)DIQ6Z4H01jQiB3Z*R&KN zf^gOdyKvDL+f|sAjHM!Vlh26lpqi~EsMgAA7KZV3hAvV#uE*jDG|HDyfL{YhSAKBX zMolkMcA|=MN^jdqIq&!-+vk4iD`}Um)$$5JO9~`Rf%U{eCvKVPSe)Zo_Tij}b{sA1LW zko6NDFF*d$!rdn967`NJxhQ&Nir_U_z{>+=G42uH)x1{N$~McSXINlMB(O`QdIbWH z7vRdWU|Dd{c8y+1fvt8-j|A4IV|Jk0tYC4+NmZ;^f%n!Ms6J|0%s_<7Oe?kmrB1VU zW1=h^)1SvR6-kGkXTym!D!8=>H7u}!N)>boY(&MXU@L>=s{+BN0>M?Rd{xC0tCk1L zgFy%ewre#yRh~Jym4V>uKyW21f4U;La(QqyvAvq;GvnDSccy#AJK@0*#~_U!DqJAB5S=yVSa zx{ar^S9`sogC#=QfwS)H$*&a654F3)-PkPq_Jn(~Avb==>ze$0rdQ#qlCPi44>pS5 z?nJXY{=WE~yD^))HmrD4-R^;&+~@^&ycb)D^m6Op%eP(hjvezxd!&ThF`e%jURZ+8 zkq>{jvmx7f#$Qw4pFKKCYj6d6N3OVyjqag=T*It4+30qUv!$8o)A_n%xt;;H`Cz{H z=rRRI;9#yq@q0ga=9G8hu$;}EIO$&Ng2mp^i(cmyZjF4-Gn^&1fF8NJ2CuC?JJsfP zb>@fK?{@X7d$_q|ALhQ@ zCLZwF(N=e+6RX_oZ3v!wsEoCz|#=Q%t{Dn8Y<%Rja>|}esuG4#`Ll6ubW+#Ra z7Kko+~m%_3!!}X z5kx&Rb*?xfQnB3hK>plOw`DAMs=j1MC<=xnALPUW%S(-%p3cm6xg7)UiB__M$6v1H z@9%6&lQ;fe!Kazo8z8MOK(83ADjk&9)jYOjTh3;t-~TG%c?4Qm*yB;3zeTZy^XEjk z-KJR(!ky>U^C!`w#`;S`g5E=UDFSi14vDa5yv7C!EVUc;LF*J|U7sL`!ie znu_(HBGY%p6>`lJLdY9C>J5RkT?6o-C~^7YCvrn=RPpN0Kqrx$vLxk?^?Thjvf_*! zpeS7&$;|c(ogkgPQkQRgGk3WuH+o3PjUN%Bxv_TaN9meB+vv7-iO6Lp+eJMPk7}Xo z=QC~Y$N}%dush!1^*6ZFQ`vK^E*RKy3EK-9uem#i8gyy8Fp{}`Ff)D1>$^d&5Kf_L zgQA=pIhZ@rDmAW$S{I5{zzISH>_qBiTbjN8^NKfk4L}6!8&vW`7qi1tVh7(1d?o2asg@g+I8}qxIefLr6`Q>rcg4)=JHNKaT-5_RU!Ms-3n@7+e@~=`vD&KR;JJJpc$vIg;gqC7n&dk3=Ad;PY*XwG= z?UZk7&y95Z+w;_rFVvDTp+A*7fG= zI|R{ie2E-{awAi82V}e6&)4;!W*`NSjIbd$G%79wDilbBiOGEZAWhXF;Z6&Kg*t*w gP|rP#^3x, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl 2.0.0\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-02 19:02+0800\n" +"Last-Translator: Chao-Hsiung Liao \n" +"Language-Team: Chinese (Taiwan) \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "支援的除錯數值:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "特殊的除錯數值:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "啟用所有非行為性的除錯選項" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "額外的環境變數:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "準備停用的 GL 擴充功能清單 (以逗號分隔)" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "覆蓋 Cogl 假設驅動程式會支援的 GL 版本" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "準備設定的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "準備去除的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl 選項" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "顯示 Cogl 選項" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl 追蹤" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject 參照" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects 的除錯參考持續問題" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "追蹤材質切割" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "材質切割建立的除錯" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "追蹤圖集材質" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "除錯材質圖集管理" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "追蹤混合字串" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "除錯 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "追蹤日誌" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "檢視所有通過日誌的位置大小" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "追蹤批次" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "顯示日誌中批次的幾何大小如何" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "追蹤矩陣" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "追蹤所有的矩陣操作" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "追蹤雜項繪製" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "追蹤某些繪製操作" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "追蹤 Pango 繪製器" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "追蹤 Cogl Pango 繪製器" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "追蹤 CoglTexturePixmap 後端" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "追蹤 Cogl Pango 材質點陣圖後端" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "視覺化" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "矩形外框" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "為所有的矩形位置大小加入線框" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "顯示線框" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "為所有的位置大小加入線框" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "根本原因" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "停用日誌批次" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "停用 Cogl 日誌中位置大小的批次。" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "停用 GL 頂端緩衝區" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "停用 OpenGL 頂端緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "停用 GL 像素緩衝區" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "停用 OpenGL 像素緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "停用軟體矩形變形" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 來轉變矩形位置大小" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl 專家" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "傾印圖集影像" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "將材質圖集變更傾印到影像檔案" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "停用材質圖集" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "停用材質圖集的使用" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "停用在文字與影像間分享材質圖集" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"當這些設為圖表快取將會永遠為個別材質使用圖集。否則它會嘗試與影像分享圖集。" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "停用材質" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "停用任何原型的材質" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "停用 arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "停用 ARB 片段程式的使用" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "停用修正" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "停用修正函式導管後端的使用" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "停用 GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "停用 GLSL的使用" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "停用混合" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "停用混合的使用" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "停用 non-power-of-two 材質" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"讓 Cogl 認為 GL 驅動程式不支援 NPOT 材質,如此它會建立切割的材質或耗費的材質" +"來代替。" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "停用軟體剪裁" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "停用 Cogl 在軟體中嘗試剪裁某些矩形。" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "顯示來源" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "顯示產生的 ARBfp/GLSL 原始碼" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "追蹤某些 OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "追蹤某些選取的 OpenGL 呼叫" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "追蹤螢幕外支援" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "除錯螢幕外支援" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "停用程式快取" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "停用 arbfp 和 glsl 程式的後備快取" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "停用讀取像素最佳化" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "停用不透明矩形的簡單場景讀取 1px 的最佳化" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "追蹤剪裁" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "關於 Cogl 如何實作剪裁的紀錄資訊" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "追縱效能重視" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "嘗試突顯次要最佳化 Cogl 使用率。" diff --git a/test-fixtures/Makefile.am b/test-fixtures/Makefile.am new file mode 100644 index 0000000..332c5ee --- /dev/null +++ b/test-fixtures/Makefile.am @@ -0,0 +1,25 @@ + +noinst_LTLIBRARIES = libtest-fixtures.la + +libtest_fixtures_la_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir)/cogl \ + -Wall \ + $(NULL) + +if !USE_GLIB +libtest_fixtures_la_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +libtest_fixtures_la_CPPFLAGS += \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCOGL_COMPILATION + +libtest_fixtures_la_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) + +libtest_fixtures_la_SOURCES = \ + test-unit.h \ + test-utils.h \ + test-utils.c + diff --git a/test-fixtures/Makefile.in b/test-fixtures/Makefile.in new file mode 100644 index 0000000..1f8ec9f --- /dev/null +++ b/test-fixtures/Makefile.in @@ -0,0 +1,740 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@USE_GLIB_FALSE@am__append_1 = -I$(top_builddir)/deps/glib +subdir = test-fixtures +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtest_fixtures_la_LIBADD = +am_libtest_fixtures_la_OBJECTS = libtest_fixtures_la-test-utils.lo +libtest_fixtures_la_OBJECTS = $(am_libtest_fixtures_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libtest_fixtures_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libtest_fixtures_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtest_fixtures_la_SOURCES) +DIST_SOURCES = $(libtest_fixtures_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libtest-fixtures.la +libtest_fixtures_la_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/cogl \ + -Wall $(NULL) $(am__append_1) -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCOGL_COMPILATION +libtest_fixtures_la_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +libtest_fixtures_la_SOURCES = \ + test-unit.h \ + test-utils.h \ + test-utils.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test-fixtures/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test-fixtures/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtest-fixtures.la: $(libtest_fixtures_la_OBJECTS) $(libtest_fixtures_la_DEPENDENCIES) $(EXTRA_libtest_fixtures_la_DEPENDENCIES) + $(AM_V_CCLD)$(libtest_fixtures_la_LINK) $(libtest_fixtures_la_OBJECTS) $(libtest_fixtures_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtest_fixtures_la-test-utils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libtest_fixtures_la-test-utils.lo: test-utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtest_fixtures_la_CPPFLAGS) $(CPPFLAGS) $(libtest_fixtures_la_CFLAGS) $(CFLAGS) -MT libtest_fixtures_la-test-utils.lo -MD -MP -MF $(DEPDIR)/libtest_fixtures_la-test-utils.Tpo -c -o libtest_fixtures_la-test-utils.lo `test -f 'test-utils.c' || echo '$(srcdir)/'`test-utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtest_fixtures_la-test-utils.Tpo $(DEPDIR)/libtest_fixtures_la-test-utils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-utils.c' object='libtest_fixtures_la-test-utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtest_fixtures_la_CPPFLAGS) $(CPPFLAGS) $(libtest_fixtures_la_CFLAGS) $(CFLAGS) -c -o libtest_fixtures_la-test-utils.lo `test -f 'test-utils.c' || echo '$(srcdir)/'`test-utils.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test-fixtures/test-unit.h b/test-fixtures/test-unit.h new file mode 100644 index 0000000..270a941 --- /dev/null +++ b/test-fixtures/test-unit.h @@ -0,0 +1,31 @@ +#ifndef _TEST_UNIT_H_ +#define _TEST_UNIT_H_ + +#include + +#ifdef ENABLE_UNIT_TESTS + +typedef struct _CoglUnitTest +{ + const char *name; + TestFlags requirement_flags; + TestFlags known_failure_flags; + void (*run) (void); +} CoglUnitTest; + +#define UNIT_TEST(NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS) \ + static void NAME (void); \ + \ + const CoglUnitTest unit_test_##NAME = \ + { #NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS, NAME }; \ + \ + static void NAME (void) + +#else /* ENABLE_UNIT_TESTS */ + +#define UNIT_TEST(NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS) \ + static inline void NAME (void) + +#endif /* ENABLE_UNIT_TESTS */ + +#endif /* _TEST_UNIT_H_ */ diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c new file mode 100644 index 0000000..59e3fd8 --- /dev/null +++ b/test-fixtures/test-utils.c @@ -0,0 +1,535 @@ +#include + +#include + +#include "test-unit.h" +#include "test-utils.h" + +#define FB_WIDTH 512 +#define FB_HEIGHT 512 + +static CoglBool cogl_test_is_verbose; + +CoglContext *test_ctx; +CoglFramebuffer *test_fb; + +static CoglBool +check_flags (TestFlags flags, + CoglRenderer *renderer) +{ + if (flags & TEST_REQUIREMENT_GL && + cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL && + cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL3) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_NPOT && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_TEXTURE_3D && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_TEXTURE_RECTANGLE && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_TEXTURE_RG && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RG)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_POINT_SPRITE && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_POINT_SPRITE)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_PER_VERTEX_POINT_SIZE && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_GLES2_CONTEXT && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLES2_CONTEXT)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_MAP_WRITE && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_GLSL && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_OFFSCREEN && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_OFFSCREEN)) + { + return FALSE; + } + + if (flags & TEST_REQUIREMENT_FENCE && + !cogl_has_feature (test_ctx, COGL_FEATURE_ID_FENCE)) + { + return FALSE; + } + + if (flags & TEST_KNOWN_FAILURE) + { + return FALSE; + } + + return TRUE; +} + +CoglBool +is_boolean_env_set (const char *variable) +{ + char *val = getenv (variable); + CoglBool ret; + + if (!val) + return FALSE; + + if (g_ascii_strcasecmp (val, "1") == 0 || + g_ascii_strcasecmp (val, "on") == 0 || + g_ascii_strcasecmp (val, "true") == 0) + ret = TRUE; + else if (g_ascii_strcasecmp (val, "0") == 0 || + g_ascii_strcasecmp (val, "off") == 0 || + g_ascii_strcasecmp (val, "false") == 0) + ret = FALSE; + else + { + g_critical ("Spurious boolean environment variable value (%s=%s)", + variable, val); + ret = TRUE; + } + + return ret; +} + +void +test_utils_init (TestFlags requirement_flags, + TestFlags known_failure_flags) +{ + static int counter = 0; + CoglError *error = NULL; + CoglOnscreen *onscreen = NULL; + CoglDisplay *display; + CoglRenderer *renderer; + CoglBool missing_requirement; + CoglBool known_failure; + + if (counter != 0) + g_critical ("We don't support running more than one test at a time\n" + "in a single test run due to the state leakage that can\n" + "cause subsequent tests to fail.\n" + "\n" + "If you want to run all the tests you should run\n" + "$ make test-report"); + counter++; + + if (is_boolean_env_set ("COGL_TEST_VERBOSE") || + is_boolean_env_set ("V")) + cogl_test_is_verbose = TRUE; + + /* NB: This doesn't have any effect since commit 47444dac of glib + * because the environment variable is read in a magic constructor + * so it is too late to set them here */ + if (g_getenv ("G_DEBUG")) + { + char *debug = g_strconcat (g_getenv ("G_DEBUG"), ",fatal-warnings", NULL); + g_setenv ("G_DEBUG", debug, TRUE); + g_free (debug); + } + else + g_setenv ("G_DEBUG", "fatal-warnings", TRUE); + + g_setenv ("COGL_X11_SYNC", "1", 0); + + test_ctx = cogl_context_new (NULL, &error); + if (!test_ctx) + g_critical ("Failed to create a CoglContext: %s", error->message); + + display = cogl_context_get_display (test_ctx); + renderer = cogl_display_get_renderer (display); + + missing_requirement = !check_flags (requirement_flags, renderer); + known_failure = !check_flags (known_failure_flags, renderer); + + if (is_boolean_env_set ("COGL_TEST_ONSCREEN")) + { + onscreen = cogl_onscreen_new (test_ctx, 640, 480); + test_fb = COGL_FRAMEBUFFER (onscreen); + } + else + { + CoglOffscreen *offscreen; + CoglTexture2D *tex = cogl_texture_2d_new_with_size (test_ctx, + FB_WIDTH, FB_HEIGHT); + offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (tex)); + test_fb = COGL_FRAMEBUFFER (offscreen); + } + + if (!cogl_framebuffer_allocate (test_fb, &error)) + g_critical ("Failed to allocate framebuffer: %s", error->message); + + if (onscreen) + cogl_onscreen_show (onscreen); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR | + COGL_BUFFER_BIT_DEPTH | + COGL_BUFFER_BIT_STENCIL, + 0, 0, 0, 1); + + if (missing_requirement) + g_print ("WARNING: Missing required feature[s] for this test\n"); + else if (known_failure) + g_print ("WARNING: Test is known to fail\n"); +} + +void +test_utils_fini (void) +{ + if (test_fb) + cogl_object_unref (test_fb); + + if (test_ctx) + cogl_object_unref (test_ctx); +} + +static CoglBool +compare_component (int a, int b) +{ + return ABS (a - b) <= 1; +} + +void +test_utils_compare_pixel_and_alpha (const uint8_t *screen_pixel, + uint32_t expected_pixel) +{ + /* Compare each component with a small fuzz factor */ + if (!compare_component (screen_pixel[0], expected_pixel >> 24) || + !compare_component (screen_pixel[1], (expected_pixel >> 16) & 0xff) || + !compare_component (screen_pixel[2], (expected_pixel >> 8) & 0xff) || + !compare_component (screen_pixel[3], (expected_pixel >> 0) & 0xff)) + { + uint32_t screen_pixel_num = GUINT32_FROM_BE (*(uint32_t *) screen_pixel); + char *screen_pixel_string = + g_strdup_printf ("#%08x", screen_pixel_num); + char *expected_pixel_string = + g_strdup_printf ("#%08x", expected_pixel); + + g_assert_cmpstr (screen_pixel_string, ==, expected_pixel_string); + + g_free (screen_pixel_string); + g_free (expected_pixel_string); + } +} + +void +test_utils_compare_pixel (const uint8_t *screen_pixel, uint32_t expected_pixel) +{ + /* Compare each component with a small fuzz factor */ + if (!compare_component (screen_pixel[0], expected_pixel >> 24) || + !compare_component (screen_pixel[1], (expected_pixel >> 16) & 0xff) || + !compare_component (screen_pixel[2], (expected_pixel >> 8) & 0xff)) + { + uint32_t screen_pixel_num = GUINT32_FROM_BE (*(uint32_t *) screen_pixel); + char *screen_pixel_string = + g_strdup_printf ("#%06x", screen_pixel_num >> 8); + char *expected_pixel_string = + g_strdup_printf ("#%06x", expected_pixel >> 8); + + g_assert_cmpstr (screen_pixel_string, ==, expected_pixel_string); + + g_free (screen_pixel_string); + g_free (expected_pixel_string); + } +} + +void +test_utils_check_pixel (CoglFramebuffer *test_fb, + int x, int y, uint32_t expected_pixel) +{ + uint8_t pixel[4]; + + cogl_framebuffer_read_pixels (test_fb, + x, y, 1, 1, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + pixel); + + test_utils_compare_pixel (pixel, expected_pixel); +} + +void +test_utils_check_pixel_and_alpha (CoglFramebuffer *test_fb, + int x, int y, uint32_t expected_pixel) +{ + uint8_t pixel[4]; + + cogl_framebuffer_read_pixels (test_fb, + x, y, 1, 1, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + pixel); + + test_utils_compare_pixel_and_alpha (pixel, expected_pixel); +} + +void +test_utils_check_pixel_rgb (CoglFramebuffer *test_fb, + int x, int y, int r, int g, int b) +{ + test_utils_check_pixel (test_fb, x, y, (r << 24) | (g << 16) | (b << 8)); +} + +void +test_utils_check_region (CoglFramebuffer *test_fb, + int x, int y, + int width, int height, + uint32_t expected_rgba) +{ + uint8_t *pixels, *p; + + pixels = p = g_malloc (width * height * 4); + cogl_framebuffer_read_pixels (test_fb, + x, + y, + width, + height, + COGL_PIXEL_FORMAT_RGBA_8888, + p); + + /* Check whether the center of each division is the right color */ + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + { + test_utils_compare_pixel (p, expected_rgba); + p += 4; + } + + g_free (pixels); +} + +CoglTexture * +test_utils_create_color_texture (CoglContext *context, + uint32_t color) +{ + CoglTexture2D *tex_2d; + + color = GUINT32_TO_BE (color); + + tex_2d = cogl_texture_2d_new_from_data (context, + 1, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + (uint8_t *) &color, + NULL); + + return COGL_TEXTURE (tex_2d); +} + +CoglBool +cogl_test_verbose (void) +{ + return cogl_test_is_verbose; +} + +static void +set_auto_mipmap_cb (CoglTexture *sub_texture, + const float *sub_texture_coords, + const float *meta_coords, + void *user_data) +{ + cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (sub_texture), + FALSE); +} + +CoglTexture * +test_utils_texture_new_with_size (CoglContext *ctx, + int width, + int height, + TestUtilsTextureFlags flags, + CoglTextureComponents components) +{ + CoglTexture *tex; + CoglError *skip_error = NULL; + + if ((test_utils_is_pot (width) && test_utils_is_pot (height)) || + (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + /* First try creating a fast-path non-sliced texture */ + tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, + width, height)); + + cogl_texture_set_components (tex, components); + + if (!cogl_texture_allocate (tex, &skip_error)) + { + cogl_error_free (skip_error); + cogl_object_unref (tex); + tex = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + /* If it fails resort to sliced textures */ + int max_waste = flags & TEST_UTILS_TEXTURE_NO_SLICING ? + -1 : COGL_TEXTURE_MAX_WASTE; + CoglTexture2DSliced *tex_2ds = + cogl_texture_2d_sliced_new_with_size (ctx, + width, + height, + max_waste); + tex = COGL_TEXTURE (tex_2ds); + + cogl_texture_set_components (tex, components); + } + + if (flags & TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP) + { + /* To be able to iterate the slices of a #CoglTexture2DSliced we + * need to ensure the texture is allocated... */ + cogl_texture_allocate (tex, NULL); /* don't catch exceptions */ + + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex), + 0, 0, 1, 1, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + set_auto_mipmap_cb, + NULL); /* don't catch exceptions */ + } + + cogl_texture_allocate (tex, NULL); + + return tex; +} + +CoglTexture * +test_utils_texture_new_from_bitmap (CoglBitmap *bitmap, + TestUtilsTextureFlags flags, + CoglBool premultiplied) +{ + CoglAtlasTexture *atlas_tex; + CoglTexture *tex; + CoglError *internal_error = NULL; + + if (!flags) + { + /* First try putting the texture in the atlas */ + atlas_tex = cogl_atlas_texture_new_from_bitmap (bitmap); + + cogl_texture_set_premultiplied (COGL_TEXTURE (atlas_tex), premultiplied); + + if (cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error)) + return COGL_TEXTURE (atlas_tex); + + cogl_error_free (internal_error); + cogl_object_unref (atlas_tex); + internal_error = NULL; + } + + /* If that doesn't work try a fast path 2D texture */ + if ((test_utils_is_pot (cogl_bitmap_get_width (bitmap)) && + test_utils_is_pot (cogl_bitmap_get_height (bitmap))) || + (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) && + cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP))) + { + tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap)); + + cogl_texture_set_premultiplied (tex, premultiplied); + + if (cogl_error_matches (internal_error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY)) + { + g_assert_not_reached (); + return NULL; + } + + if (!tex) + { + cogl_error_free (internal_error); + internal_error = NULL; + } + } + else + tex = NULL; + + if (!tex) + { + /* Otherwise create a sliced texture */ + int max_waste = flags & TEST_UTILS_TEXTURE_NO_SLICING ? + -1 : COGL_TEXTURE_MAX_WASTE; + CoglTexture2DSliced *tex_2ds = + cogl_texture_2d_sliced_new_from_bitmap (bitmap, max_waste); + tex = COGL_TEXTURE (tex_2ds); + + cogl_texture_set_premultiplied (tex, premultiplied); + } + + if (flags & TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP) + { + cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex), + 0, 0, 1, 1, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + set_auto_mipmap_cb, + NULL); /* don't catch exceptions */ + } + + cogl_texture_allocate (tex, NULL); + + return tex; +} + +CoglTexture * +test_utils_texture_new_from_data (CoglContext *ctx, + int width, + int height, + TestUtilsTextureFlags flags, + CoglPixelFormat format, + int rowstride, + const uint8_t *data) +{ + CoglBitmap *bmp; + CoglTexture *tex; + + g_assert_cmpint (format, !=, COGL_PIXEL_FORMAT_ANY); + g_assert (data != NULL); + + /* Wrap the data into a bitmap */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + format, + rowstride, + (uint8_t *) data); + + tex = test_utils_texture_new_from_bitmap (bmp, flags, TRUE); + + cogl_object_unref (bmp); + + return tex; +} diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h new file mode 100644 index 0000000..9c3ced9 --- /dev/null +++ b/test-fixtures/test-utils.h @@ -0,0 +1,287 @@ +#ifndef _TEST_UTILS_H_ +#define _TEST_UTILS_H_ + +/* NB: This header is for private and public api testing and so + * we need consider that if we are testing the public api we should + * just include but since that will only provide + * opaque typedefs we need to include the specific internal headers + * for testing private apis... + */ +#ifdef COGL_COMPILATION +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +#include + +/* We don't really care about functions that are defined without a + header for the unit tests so we can just disable it here */ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wmissing-declarations" +#endif + +typedef enum _TestFlags +{ + TEST_KNOWN_FAILURE = 1<<0, + TEST_REQUIREMENT_GL = 1<<1, + TEST_REQUIREMENT_NPOT = 1<<2, + TEST_REQUIREMENT_TEXTURE_3D = 1<<3, + TEST_REQUIREMENT_TEXTURE_RECTANGLE = 1<<4, + TEST_REQUIREMENT_TEXTURE_RG = 1<<5, + TEST_REQUIREMENT_POINT_SPRITE = 1<<6, + TEST_REQUIREMENT_GLES2_CONTEXT = 1<<7, + TEST_REQUIREMENT_MAP_WRITE = 1<<8, + TEST_REQUIREMENT_GLSL = 1<<9, + TEST_REQUIREMENT_OFFSCREEN = 1<<10, + TEST_REQUIREMENT_FENCE = 1<<11, + TEST_REQUIREMENT_PER_VERTEX_POINT_SIZE = 1<<12 +} TestFlags; + + /** + * TestUtilsTextureFlags: + * @TEST_UTILS_TEXTURE_NONE: No flags specified + * @TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of + * the mipmap pyramid from the base level image whenever it is + * updated. The mipmaps are only generated when the texture is + * rendered with a mipmap filter so it should be free to leave out + * this flag when using other filtering modes + * @TEST_UTILS_TEXTURE_NO_SLICING: Disables the slicing of the texture + * @TEST_UTILS_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside + * the texture atlas used by Cogl + * + * Flags to pass to the test_utils_texture_new_* family of functions. + */ +typedef enum { + TEST_UTILS_TEXTURE_NONE = 0, + TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP = 1 << 0, + TEST_UTILS_TEXTURE_NO_SLICING = 1 << 1, + TEST_UTILS_TEXTURE_NO_ATLAS = 1 << 2 +} TestUtilsTextureFlags; + +extern CoglContext *test_ctx; +extern CoglFramebuffer *test_fb; + +void +test_utils_init (TestFlags requirement_flags, + TestFlags known_failure_flags); + +void +test_utils_fini (void); + +/* + * test_utils_texture_new_with_size: + * @context: A #CoglContext + * @width: width of texture in pixels. + * @height: height of texture in pixels. + * @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE + * @components: What texture components are required + * + * Creates a new #CoglTexture with the specified dimensions and pixel format. + * + * The storage for the texture is not necesarily created before this + * function returns. The storage can be explicitly allocated using + * cogl_texture_allocate() or preferably you can let Cogl + * automatically allocate the storage lazily when uploading data when + * Cogl may know more about how the texture will be used and can + * optimize how it is allocated. + * + * Return value: A newly created #CoglTexture + */ +CoglTexture * +test_utils_texture_new_with_size (CoglContext *ctx, + int width, + int height, + TestUtilsTextureFlags flags, + CoglTextureComponents components); + +/* + * test_utils_texture_new_from_data: + * @context: A #CoglContext + * @width: width of texture in pixels + * @height: height of texture in pixels + * @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE + * @format: the #CoglPixelFormat the buffer is stored in in RAM + * @rowstride: the memory offset in bytes between the starts of + * scanlines in @data + * @data: pointer the memory region where the source buffer resides + * @error: A #CoglError to catch exceptional errors or %NULL + * + * Creates a new #CoglTexture based on data residing in memory. + * + * Note: If the given @format has an alpha channel then the data + * will be loaded into a premultiplied internal format. If you want + * to avoid having the source data be premultiplied then you can + * either specify that the data is already premultiplied or use + * test_utils_texture_new_from_bitmap which lets you explicitly + * request whether the data should internally be premultipled or not. + * + * Return value: A newly created #CoglTexture or %NULL on failure + */ +CoglTexture * +test_utils_texture_new_from_data (CoglContext *ctx, + int width, + int height, + TestUtilsTextureFlags flags, + CoglPixelFormat format, + int rowstride, + const uint8_t *data); + +/* + * test_utils_texture_new_from_bitmap: + * @bitmap: A #CoglBitmap pointer + * @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE + * @premultiplied: Whether the texture should hold premultipled data. + * (if the bitmap already holds premultiplied data + * and %TRUE is given then no premultiplication will + * be done. The data will be premultipled while + * uploading if the bitmap has an alpha channel but + * does not already have a premultiplied format.) + * + * Creates a #CoglTexture from a #CoglBitmap. + * + * Return value: A newly created #CoglTexture or %NULL on failure + */ +CoglTexture * +test_utils_texture_new_from_bitmap (CoglBitmap *bitmap, + TestUtilsTextureFlags flags, + CoglBool premultiplied); + +/* + * test_utils_check_pixel: + * @framebuffer: The #CoglFramebuffer to read from + * @x: x co-ordinate of the pixel to test + * @y: y co-ordinate of the pixel to test + * @pixel: An integer of the form 0xRRGGBBAA representing the expected + * pixel value + * + * This performs reads a pixel on the given cogl @framebuffer and + * asserts that it matches the given color. The alpha channel of the + * color is ignored. The pixels are converted to a string and compared + * with g_assert_cmpstr so that if the comparison fails then the + * assert will display a meaningful message + */ +void +test_utils_check_pixel (CoglFramebuffer *framebuffer, + int x, int y, uint32_t expected_pixel); + +/** + * @framebuffer: The #CoglFramebuffer to read from + * @x: x co-ordinate of the pixel to test + * @y: y co-ordinate of the pixel to test + * @pixel: An integer of the form 0xRRGGBBAA representing the expected + * pixel value + * + * This performs reads a pixel on the given cogl @framebuffer and + * asserts that it matches the given color. The alpha channel is also + * checked unlike with test_utils_check_pixel(). The pixels are + * converted to a string and compared with g_assert_cmpstr so that if + * the comparison fails then the assert will display a meaningful + * message. + */ +void +test_utils_check_pixel_and_alpha (CoglFramebuffer *fb, + int x, int y, uint32_t expected_pixel); + +/* + * test_utils_check_pixel: + * @framebuffer: The #CoglFramebuffer to read from + * @x: x co-ordinate of the pixel to test + * @y: y co-ordinate of the pixel to test + * @pixel: An integer of the form 0xrrggbb representing the expected pixel value + * + * This performs reads a pixel on the given cogl @framebuffer and + * asserts that it matches the given color. The alpha channel of the + * color is ignored. The pixels are converted to a string and compared + * with g_assert_cmpstr so that if the comparison fails then the + * assert will display a meaningful message + */ +void +test_utils_check_pixel_rgb (CoglFramebuffer *framebuffer, + int x, int y, int r, int g, int b); + +/* + * test_utils_check_region: + * @framebuffer: The #CoglFramebuffer to read from + * @x: x co-ordinate of the region to test + * @y: y co-ordinate of the region to test + * @width: width of the region to test + * @height: height of the region to test + * @pixel: An integer of the form 0xrrggbb representing the expected region color + * + * Performs a read pixel on the specified region of the given cogl + * @framebuffer and asserts that it matches the given color. The alpha + * channel of the color is ignored. The pixels are converted to a + * string and compared with g_assert_cmpstr so that if the comparison + * fails then the assert will display a meaningful message + */ +void +test_utils_check_region (CoglFramebuffer *framebuffer, + int x, int y, + int width, int height, + uint32_t expected_rgba); + +/* + * test_utils_compare_pixel: + * @screen_pixel: A pixel stored in memory + * @expected_pixel: The expected RGBA value + * + * Compares a pixel from a buffer to an expected value. The pixels are + * converted to a string and compared with g_assert_cmpstr so that if + * the comparison fails then the assert will display a meaningful + * message. + */ +void +test_utils_compare_pixel (const uint8_t *screen_pixel, uint32_t expected_pixel); + +/* + * test_utils_compare_pixel_and_alpha: + * @screen_pixel: A pixel stored in memory + * @expected_pixel: The expected RGBA value + * + * Compares a pixel from a buffer to an expected value. This is + * similar to test_utils_compare_pixel() except that it doesn't ignore + * the alpha component. + */ +void +test_utils_compare_pixel_and_alpha (const uint8_t *screen_pixel, + uint32_t expected_pixel); + +/* + * test_utils_create_color_texture: + * @context: A #CoglContext + * @color: A color to put in the texture + * + * Creates a 1x1-pixel RGBA texture filled with the given color. + */ +CoglTexture * +test_utils_create_color_texture (CoglContext *context, + uint32_t color); + +/* cogl_test_verbose: + * + * Queries if the user asked for verbose output or not. + */ +CoglBool +cogl_test_verbose (void); + +/* test_util_is_pot: + * @number: A number to test + * + * Returns whether the given integer is a power of two + */ +static inline CoglBool +test_utils_is_pot (unsigned int number) +{ + /* Make sure there is only one bit set */ + return (number & (number - 1)) == 0; +} + +#endif /* _TEST_UTILS_H_ */ diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..94ba34a --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,31 @@ +SUBDIRS = conform + +if UNIT_TESTS +SUBDIRS += unit +endif + +SUBDIRS += micro-perf data + +DIST_SUBDIRS = conform unit micro-perf data + +EXTRA_DIST = README test-launcher.sh run-tests.sh + +if UNIT_TESTS +test conform: + ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? + ( cd ./unit && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? +else +test conform: + ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? +endif + +.PHONY: test conform + +# run make test as part of make check +check-local: test + +if ENABLE_INSTALLED_TESTS +insttestdir = $(libexecdir)/installed-tests/$(PACKAGE) +insttest_SCRIPTS = run-tests.sh +insttest_DATA = config.env +endif diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..30e2ac0 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@UNIT_TESTS_TRUE@am__append_1 = unit +subdir = tests +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/config.env.in README +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = config.env +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(insttestdir)" \ + "$(DESTDIR)$(insttestdir)" +SCRIPTS = $(insttest_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(insttest_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = conform $(am__append_1) micro-perf data +DIST_SUBDIRS = conform unit micro-perf data +EXTRA_DIST = README test-launcher.sh run-tests.sh +@ENABLE_INSTALLED_TESTS_TRUE@insttestdir = $(libexecdir)/installed-tests/$(PACKAGE) +@ENABLE_INSTALLED_TESTS_TRUE@insttest_SCRIPTS = run-tests.sh +@ENABLE_INSTALLED_TESTS_TRUE@insttest_DATA = config.env +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +config.env: $(top_builddir)/config.status $(srcdir)/config.env.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-insttestSCRIPTS: $(insttest_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(insttest_SCRIPTS)'; test -n "$(insttestdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(insttestdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(insttestdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(insttestdir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(insttestdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-insttestSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(insttest_SCRIPTS)'; test -n "$(insttestdir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(insttestdir)'; $(am__uninstall_files_from_dir) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-insttestDATA: $(insttest_DATA) + @$(NORMAL_INSTALL) + @list='$(insttest_DATA)'; test -n "$(insttestdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(insttestdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(insttestdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(insttestdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(insttestdir)" || exit $$?; \ + done + +uninstall-insttestDATA: + @$(NORMAL_UNINSTALL) + @list='$(insttest_DATA)'; test -n "$(insttestdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(insttestdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-recursive +all-am: Makefile $(SCRIPTS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(insttestdir)" "$(DESTDIR)$(insttestdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-insttestDATA install-insttestSCRIPTS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-insttestDATA uninstall-insttestSCRIPTS + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am check-local clean clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-insttestDATA install-insttestSCRIPTS \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-insttestDATA uninstall-insttestSCRIPTS + + +@UNIT_TESTS_TRUE@test conform: +@UNIT_TESTS_TRUE@ ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? +@UNIT_TESTS_TRUE@ ( cd ./unit && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? +@UNIT_TESTS_FALSE@test conform: +@UNIT_TESTS_FALSE@ ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? + +.PHONY: test conform + +# run make test as part of make check +check-local: test + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..cc6dbb9 --- /dev/null +++ b/tests/README @@ -0,0 +1,63 @@ +Outline of test categories: + +The conform/ tests: +------------------- +These tests should be non-interactive unit-tests that verify a single +feature is behaving as documented. See conform/ADDING_NEW_TESTS for more +details. + +Although it may seem a bit awkward; all the tests are built into a +single binary because it makes building the tests *much* faster by avoiding +lots of linking. + +Each test has a wrapper script generated though so running the individual tests +should be convenient enough. Running the wrapper script will also print out for +convenience how you could run the test under gdb or valgrind like this for +example: + + NOTE: For debugging purposes, you can run this single test as follows: + $ libtool --mode=execute \ + gdb --eval-command="b test_cogl_depth_test" \ + --args ./test-conformance -p /conform/cogl/test_cogl_depth_test + or: + $ env G_SLICE=always-malloc \ + libtool --mode=execute \ + valgrind ./test-conformance -p /conform/cogl/test_cogl_depth_test + +By default the conformance tests are run offscreen. This makes the tests run +much faster and they also don't interfere with other work you may want to do by +constantly stealing focus. CoglOnscreen framebuffers obviously don't get tested +this way so it's important that the tests also get run onscreen every once in a +while, especially if changes are being made to CoglFramebuffer related code. +Onscreen testing can be enabled by setting COGL_TEST_ONSCREEN=1 in your +environment. + +The micro-bench/ tests: +----------------------- +These should be focused performance tests, ideally testing a +single metric. Please never forget that these tests are synthetic and if you +are using them then you understand what metric is being tested. They probably +don't reflect any real world application loads and the intention is that you +use these tests once you have already determined the crux of your problem and +need focused feedback that your changes are indeed improving matters. There is +no exit status requirements for these tests, but they should give clear +feedback as to their performance. If the framerate is the feedback metric, then +the test should forcibly enable FPS debugging. + +The data/ directory: +-------------------- +This contains optional data (like images) that can be referenced by a test. + + +Misc notes: +----------- +• All tests should ideally include a detailed description in the source +explaining exactly what the test is for, how the test was designed to work, +and possibly a rationale for the approach taken for testing. + +• When running tests under Valgrind, you should follow the instructions +available here: + + http://live.gnome.org/Valgrind + +and also use the suppression file available inside the data/ directory. diff --git a/tests/config.env.in b/tests/config.env.in new file mode 100644 index 0000000..d377756 --- /dev/null +++ b/tests/config.env.in @@ -0,0 +1,3 @@ +HAVE_GL=@HAVE_GL@ +HAVE_GLES1=@HAVE_GLES1@ +HAVE_GLES2=@HAVE_GLES2@ diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am new file mode 100644 index 0000000..b6aa552 --- /dev/null +++ b/tests/conform/Makefile.am @@ -0,0 +1,230 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +noinst_PROGRAMS = test-conformance + +common_sources = \ + test-conform-main.c \ + $(NULL) + +unported_test_sources = \ + test-fixed.c \ + test-materials.c \ + test-viewport.c \ + test-multitexture.c \ + test-npot-texture.c \ + test-object.c \ + test-readpixels.c \ + test-texture-mipmaps.c \ + test-texture-pixmap-x11.c \ + test-texture-rectangle.c \ + test-vertex-buffer-contiguous.c \ + test-vertex-buffer-interleved.c \ + test-vertex-buffer-mutability.c \ + $(NULL) + +test_sources = \ + test-atlas-migration.c \ + test-blend-strings.c \ + test-blend.c \ + test-depth-test.c \ + test-color-hsl.c \ + test-color-mask.c \ + test-backface-culling.c \ + test-just-vertex-shader.c \ + test-pipeline-user-matrix.c \ + test-pipeline-uniforms.c \ + test-pixel-buffer.c \ + test-premult.c \ + test-snippets.c \ + test-wrap-modes.c \ + test-sub-texture.c \ + test-custom-attributes.c \ + test-offscreen.c \ + test-primitive.c \ + test-texture-3d.c \ + test-sparse-pipeline.c \ + test-read-texture-formats.c \ + test-write-texture-formats.c \ + test-point-size.c \ + test-point-size-attribute.c \ + test-point-sprite.c \ + test-no-gl-header.c \ + test-version.c \ + test-gles2-context.c \ + test-euler-quaternion.c \ + test-layer-remove.c \ + test-alpha-test.c \ + test-map-buffer-range.c \ + test-npot-texture.c \ + test-alpha-textures.c \ + test-wrap-rectangle-textures.c \ + test-texture-get-set-data.c \ + test-framebuffer-get-bits.c \ + test-primitive-and-journal.c \ + test-copy-replace-texture.c \ + test-pipeline-cache-unrefs-texture.c \ + test-texture-no-allocate.c \ + test-pipeline-shader-state.c \ + test-texture-rg.c \ + $(NULL) + +if !USING_EMSCRIPTEN +# test-fence depends on the glib mainloop so it won't compile if using +# emscripten which builds in standalone mode. +test_sources += test-fence.c +endif + +if BUILD_COGL_PATH +test_sources += \ + test-path.c \ + test-path-clip.c +endif + +test_conformance_SOURCES = $(common_sources) $(test_sources) + +if OS_WIN32 +SHEXT = +else +SHEXT = $(EXEEXT) +endif + +# For convenience, this provides a way to easily run individual unit tests: +.PHONY: wrappers clean-wrappers + +wrappers: stamp-test-conformance + @true +stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c + @mkdir -p wrappers + @sed -n -e 's/^ \{1,\}ADD_TEST *( *\([a-zA-Z0-9_]\{1,\}\).*/\1/p' $(srcdir)/test-conform-main.c > unit-tests + @chmod +x $(top_srcdir)/tests/test-launcher.sh + @( echo "/stamp-test-conformance" ; \ + echo "/test-conformance$(EXEEXT)" ; \ + echo "*.o" ; \ + echo ".gitignore" ; \ + echo "unit-tests" ; ) > .gitignore + @for i in `cat unit-tests`; \ + do \ + unit=`basename $$i | sed -e s/_/-/g`; \ + echo " GEN $$unit"; \ + ( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/test-launcher.sh $(abs_builddir)/test-conformance$(EXEEXT) '' '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \ + chmod +x $$unit$(SHEXT); \ + echo "/$$unit$(SHEXT)" >> .gitignore; \ + done \ + && echo timestamp > $(@F) + +clean-wrappers: + @for i in `cat unit-tests`; \ + do \ + unit=`basename $$i | sed -e s/_/-/g`; \ + echo " RM $$unit"; \ + rm -f $$unit$(SHEXT) ; \ + done \ + && rm -f unit-tests \ + && rm -f stamp-test-conformance + +# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting +# a phony rule that will generate symlink scripts for running individual tests +BUILT_SOURCES = wrappers + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_builddir)/cogl \ + -I$(top_srcdir)/test-fixtures + +if !USE_GLIB +AM_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +AM_CPPFLAGS += \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" + +test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_conformance_LDADD = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la \ + $(LIBM) +if !USE_GLIB +test_conformance_LDADD += $(top_builddir)/deps/glib/libglib.la +endif +if BUILD_COGL_PATH +test_conformance_LDADD += $(top_builddir)/cogl-path/libcogl-path.la +endif +test_conformance_LDFLAGS = -export-dynamic + +test: wrappers + @$(top_srcdir)/tests/run-tests.sh $(abs_builddir)/../config.env $(abs_builddir)/test-conformance$(EXEEXT) + +# XXX: we could prevent the conformance test suite from running +# by simply defining this variable conditionally +TEST_PROGS = test-conformance + +.PHONY: test + +DISTCLEANFILES = .gitignore + +dist-hook: ../../build/win32/vs9/test-conformance-cogl.vcproj ../../build/win32/vs10/test-conformance-cogl.vcxproj ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters + +../../build/win32/vs9/test-conformance-cogl.vcproj: $(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >testconformance.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin >$@ + rm testconformance.sourcefiles + +../../build/win32/vs10/test-conformance-cogl.vcxproj: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >testconformance.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin >$@ + rm testconformance.vs10.sourcefiles + +../../build/win32/vs10/test-conformance-cogl.vcxproj.filters: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >testconformance.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin >$@ + rm testconformance.vs10.sourcefiles.filters + +# Let the VS9/VS10 Project files be cleared out before they are re-expanded... +DISTCLEANFILES += ../../build/win32/vs9/test-conformance-cogl.vcproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters + +# we override the clean-generic target to clean up the wrappers so +# we cannot use CLEANFILES +clean-generic: clean-wrappers + $(QUIET_RM)rm -f .log + + +if ENABLE_INSTALLED_TESTS + +insttestdir = $(libexecdir)/installed-tests/$(PACKAGE)/conform +insttest_PROGRAMS = test-conformance +insttest_DATA = unit-tests + +testmetadir = $(datadir)/installed-tests/$(PACKAGE) +testmeta_DATA = conform.test + +conform.test: + echo " GEN $@"; \ + echo "[Test]" > $@.tmp; \ + echo "Type=session" >> $@.tmp; \ + echo "Exec=sh -c \"cd $(libexecdir)/installed-tests/$(PACKAGE)/conform; ../run-tests.sh ../config.env ./test-conformance\"" >> $@.tmp; \ + mv $@.tmp $@ + +CLEANFILES = conform.test + +endif diff --git a/tests/conform/Makefile.in b/tests/conform/Makefile.in new file mode 100644 index 0000000..885e31d --- /dev/null +++ b/tests/conform/Makefile.in @@ -0,0 +1,1821 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp +noinst_PROGRAMS = test-conformance$(EXEEXT) + +# test-fence depends on the glib mainloop so it won't compile if using +# emscripten which builds in standalone mode. +@USING_EMSCRIPTEN_FALSE@am__append_1 = test-fence.c +@BUILD_COGL_PATH_TRUE@am__append_2 = \ +@BUILD_COGL_PATH_TRUE@ test-path.c \ +@BUILD_COGL_PATH_TRUE@ test-path-clip.c + +@USE_GLIB_FALSE@am__append_3 = -I$(top_builddir)/deps/glib +@USE_GLIB_FALSE@am__append_4 = $(top_builddir)/deps/glib/libglib.la +@BUILD_COGL_PATH_TRUE@am__append_5 = $(top_builddir)/cogl-path/libcogl-path.la +@ENABLE_INSTALLED_TESTS_TRUE@insttest_PROGRAMS = \ +@ENABLE_INSTALLED_TESTS_TRUE@ test-conformance$(EXEEXT) +subdir = tests/conform +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(insttestdir)" \ + "$(DESTDIR)$(insttestdir)" "$(DESTDIR)$(testmetadir)" +PROGRAMS = $(insttest_PROGRAMS) $(noinst_PROGRAMS) +am__test_conformance_SOURCES_DIST = test-conform-main.c \ + test-atlas-migration.c test-blend-strings.c test-blend.c \ + test-depth-test.c test-color-hsl.c test-color-mask.c \ + test-backface-culling.c test-just-vertex-shader.c \ + test-pipeline-user-matrix.c test-pipeline-uniforms.c \ + test-pixel-buffer.c test-premult.c test-snippets.c \ + test-wrap-modes.c test-sub-texture.c test-custom-attributes.c \ + test-offscreen.c test-primitive.c test-texture-3d.c \ + test-sparse-pipeline.c test-read-texture-formats.c \ + test-write-texture-formats.c test-point-size.c \ + test-point-size-attribute.c test-point-sprite.c \ + test-no-gl-header.c test-version.c test-gles2-context.c \ + test-euler-quaternion.c test-layer-remove.c test-alpha-test.c \ + test-map-buffer-range.c test-npot-texture.c \ + test-alpha-textures.c test-wrap-rectangle-textures.c \ + test-texture-get-set-data.c test-framebuffer-get-bits.c \ + test-primitive-and-journal.c test-copy-replace-texture.c \ + test-pipeline-cache-unrefs-texture.c \ + test-texture-no-allocate.c test-pipeline-shader-state.c \ + test-texture-rg.c test-fence.c test-path.c test-path-clip.c +am__objects_1 = +am__objects_2 = test_conformance-test-conform-main.$(OBJEXT) \ + $(am__objects_1) +@USING_EMSCRIPTEN_FALSE@am__objects_3 = \ +@USING_EMSCRIPTEN_FALSE@ test_conformance-test-fence.$(OBJEXT) +@BUILD_COGL_PATH_TRUE@am__objects_4 = \ +@BUILD_COGL_PATH_TRUE@ test_conformance-test-path.$(OBJEXT) \ +@BUILD_COGL_PATH_TRUE@ test_conformance-test-path-clip.$(OBJEXT) +am__objects_5 = test_conformance-test-atlas-migration.$(OBJEXT) \ + test_conformance-test-blend-strings.$(OBJEXT) \ + test_conformance-test-blend.$(OBJEXT) \ + test_conformance-test-depth-test.$(OBJEXT) \ + test_conformance-test-color-hsl.$(OBJEXT) \ + test_conformance-test-color-mask.$(OBJEXT) \ + test_conformance-test-backface-culling.$(OBJEXT) \ + test_conformance-test-just-vertex-shader.$(OBJEXT) \ + test_conformance-test-pipeline-user-matrix.$(OBJEXT) \ + test_conformance-test-pipeline-uniforms.$(OBJEXT) \ + test_conformance-test-pixel-buffer.$(OBJEXT) \ + test_conformance-test-premult.$(OBJEXT) \ + test_conformance-test-snippets.$(OBJEXT) \ + test_conformance-test-wrap-modes.$(OBJEXT) \ + test_conformance-test-sub-texture.$(OBJEXT) \ + test_conformance-test-custom-attributes.$(OBJEXT) \ + test_conformance-test-offscreen.$(OBJEXT) \ + test_conformance-test-primitive.$(OBJEXT) \ + test_conformance-test-texture-3d.$(OBJEXT) \ + test_conformance-test-sparse-pipeline.$(OBJEXT) \ + test_conformance-test-read-texture-formats.$(OBJEXT) \ + test_conformance-test-write-texture-formats.$(OBJEXT) \ + test_conformance-test-point-size.$(OBJEXT) \ + test_conformance-test-point-size-attribute.$(OBJEXT) \ + test_conformance-test-point-sprite.$(OBJEXT) \ + test_conformance-test-no-gl-header.$(OBJEXT) \ + test_conformance-test-version.$(OBJEXT) \ + test_conformance-test-gles2-context.$(OBJEXT) \ + test_conformance-test-euler-quaternion.$(OBJEXT) \ + test_conformance-test-layer-remove.$(OBJEXT) \ + test_conformance-test-alpha-test.$(OBJEXT) \ + test_conformance-test-map-buffer-range.$(OBJEXT) \ + test_conformance-test-npot-texture.$(OBJEXT) \ + test_conformance-test-alpha-textures.$(OBJEXT) \ + test_conformance-test-wrap-rectangle-textures.$(OBJEXT) \ + test_conformance-test-texture-get-set-data.$(OBJEXT) \ + test_conformance-test-framebuffer-get-bits.$(OBJEXT) \ + test_conformance-test-primitive-and-journal.$(OBJEXT) \ + test_conformance-test-copy-replace-texture.$(OBJEXT) \ + test_conformance-test-pipeline-cache-unrefs-texture.$(OBJEXT) \ + test_conformance-test-texture-no-allocate.$(OBJEXT) \ + test_conformance-test-pipeline-shader-state.$(OBJEXT) \ + test_conformance-test-texture-rg.$(OBJEXT) $(am__objects_1) \ + $(am__objects_3) $(am__objects_4) +am_test_conformance_OBJECTS = $(am__objects_2) $(am__objects_5) +test_conformance_OBJECTS = $(am_test_conformance_OBJECTS) +am__DEPENDENCIES_1 = +test_conformance_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la $(am__DEPENDENCIES_1) \ + $(am__append_4) $(am__append_5) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +test_conformance_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_conformance_CFLAGS) $(CFLAGS) \ + $(test_conformance_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_conformance_SOURCES) +DIST_SOURCES = $(am__test_conformance_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +DATA = $(insttest_DATA) $(testmeta_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +common_sources = \ + test-conform-main.c \ + $(NULL) + +unported_test_sources = \ + test-fixed.c \ + test-materials.c \ + test-viewport.c \ + test-multitexture.c \ + test-npot-texture.c \ + test-object.c \ + test-readpixels.c \ + test-texture-mipmaps.c \ + test-texture-pixmap-x11.c \ + test-texture-rectangle.c \ + test-vertex-buffer-contiguous.c \ + test-vertex-buffer-interleved.c \ + test-vertex-buffer-mutability.c \ + $(NULL) + +test_sources = test-atlas-migration.c test-blend-strings.c \ + test-blend.c test-depth-test.c test-color-hsl.c \ + test-color-mask.c test-backface-culling.c \ + test-just-vertex-shader.c test-pipeline-user-matrix.c \ + test-pipeline-uniforms.c test-pixel-buffer.c test-premult.c \ + test-snippets.c test-wrap-modes.c test-sub-texture.c \ + test-custom-attributes.c test-offscreen.c test-primitive.c \ + test-texture-3d.c test-sparse-pipeline.c \ + test-read-texture-formats.c test-write-texture-formats.c \ + test-point-size.c test-point-size-attribute.c \ + test-point-sprite.c test-no-gl-header.c test-version.c \ + test-gles2-context.c test-euler-quaternion.c \ + test-layer-remove.c test-alpha-test.c test-map-buffer-range.c \ + test-npot-texture.c test-alpha-textures.c \ + test-wrap-rectangle-textures.c test-texture-get-set-data.c \ + test-framebuffer-get-bits.c test-primitive-and-journal.c \ + test-copy-replace-texture.c \ + test-pipeline-cache-unrefs-texture.c \ + test-texture-no-allocate.c test-pipeline-shader-state.c \ + test-texture-rg.c $(NULL) $(am__append_1) $(am__append_2) +test_conformance_SOURCES = $(common_sources) $(test_sources) +@OS_WIN32_FALSE@SHEXT = $(EXEEXT) +@OS_WIN32_TRUE@SHEXT = + +# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting +# a phony rule that will generate symlink scripts for running individual tests +BUILT_SOURCES = wrappers +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/cogl \ + -I$(top_srcdir)/test-fixtures $(am__append_3) \ + -DCOGL_ENABLE_EXPERIMENTAL_API -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" +test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_conformance_LDADD = $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la $(LIBM) $(am__append_4) \ + $(am__append_5) +test_conformance_LDFLAGS = -export-dynamic + +# XXX: we could prevent the conformance test suite from running +# by simply defining this variable conditionally +TEST_PROGS = test-conformance + +# Let the VS9/VS10 Project files be cleared out before they are re-expanded... +DISTCLEANFILES = .gitignore \ + ../../build/win32/vs9/test-conformance-cogl.vcproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters +@ENABLE_INSTALLED_TESTS_TRUE@insttestdir = $(libexecdir)/installed-tests/$(PACKAGE)/conform +@ENABLE_INSTALLED_TESTS_TRUE@insttest_DATA = unit-tests +@ENABLE_INSTALLED_TESTS_TRUE@testmetadir = $(datadir)/installed-tests/$(PACKAGE) +@ENABLE_INSTALLED_TESTS_TRUE@testmeta_DATA = conform.test +@ENABLE_INSTALLED_TESTS_TRUE@CLEANFILES = conform.test +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/conform/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/conform/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-insttestPROGRAMS: $(insttest_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(insttest_PROGRAMS)'; test -n "$(insttestdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(insttestdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(insttestdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(insttestdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(insttestdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-insttestPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(insttest_PROGRAMS)'; test -n "$(insttestdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(insttestdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(insttestdir)" && rm -f $$files + +clean-insttestPROGRAMS: + @list='$(insttest_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test-conformance$(EXEEXT): $(test_conformance_OBJECTS) $(test_conformance_DEPENDENCIES) $(EXTRA_test_conformance_DEPENDENCIES) + @rm -f test-conformance$(EXEEXT) + $(AM_V_CCLD)$(test_conformance_LINK) $(test_conformance_OBJECTS) $(test_conformance_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-alpha-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-alpha-textures.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-atlas-migration.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-backface-culling.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-blend-strings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-blend.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-color-hsl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-color-mask.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-conform-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-copy-replace-texture.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-custom-attributes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-depth-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-euler-quaternion.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-fence.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-framebuffer-get-bits.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-gles2-context.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-just-vertex-shader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-layer-remove.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-map-buffer-range.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-no-gl-header.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-npot-texture.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-offscreen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-path-clip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-path.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-pipeline-shader-state.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-pipeline-uniforms.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-pipeline-user-matrix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-pixel-buffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-point-size-attribute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-point-size.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-point-sprite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-premult.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-primitive-and-journal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-primitive.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-read-texture-formats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-snippets.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-sparse-pipeline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-sub-texture.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-texture-3d.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-texture-get-set-data.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-texture-no-allocate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-texture-rg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-version.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-wrap-modes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-write-texture-formats.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test_conformance-test-conform-main.o: test-conform-main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-conform-main.o -MD -MP -MF $(DEPDIR)/test_conformance-test-conform-main.Tpo -c -o test_conformance-test-conform-main.o `test -f 'test-conform-main.c' || echo '$(srcdir)/'`test-conform-main.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-conform-main.Tpo $(DEPDIR)/test_conformance-test-conform-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-conform-main.c' object='test_conformance-test-conform-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-conform-main.o `test -f 'test-conform-main.c' || echo '$(srcdir)/'`test-conform-main.c + +test_conformance-test-conform-main.obj: test-conform-main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-conform-main.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-conform-main.Tpo -c -o test_conformance-test-conform-main.obj `if test -f 'test-conform-main.c'; then $(CYGPATH_W) 'test-conform-main.c'; else $(CYGPATH_W) '$(srcdir)/test-conform-main.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-conform-main.Tpo $(DEPDIR)/test_conformance-test-conform-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-conform-main.c' object='test_conformance-test-conform-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-conform-main.obj `if test -f 'test-conform-main.c'; then $(CYGPATH_W) 'test-conform-main.c'; else $(CYGPATH_W) '$(srcdir)/test-conform-main.c'; fi` + +test_conformance-test-atlas-migration.o: test-atlas-migration.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-atlas-migration.o -MD -MP -MF $(DEPDIR)/test_conformance-test-atlas-migration.Tpo -c -o test_conformance-test-atlas-migration.o `test -f 'test-atlas-migration.c' || echo '$(srcdir)/'`test-atlas-migration.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-atlas-migration.Tpo $(DEPDIR)/test_conformance-test-atlas-migration.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-atlas-migration.c' object='test_conformance-test-atlas-migration.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-atlas-migration.o `test -f 'test-atlas-migration.c' || echo '$(srcdir)/'`test-atlas-migration.c + +test_conformance-test-atlas-migration.obj: test-atlas-migration.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-atlas-migration.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-atlas-migration.Tpo -c -o test_conformance-test-atlas-migration.obj `if test -f 'test-atlas-migration.c'; then $(CYGPATH_W) 'test-atlas-migration.c'; else $(CYGPATH_W) '$(srcdir)/test-atlas-migration.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-atlas-migration.Tpo $(DEPDIR)/test_conformance-test-atlas-migration.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-atlas-migration.c' object='test_conformance-test-atlas-migration.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-atlas-migration.obj `if test -f 'test-atlas-migration.c'; then $(CYGPATH_W) 'test-atlas-migration.c'; else $(CYGPATH_W) '$(srcdir)/test-atlas-migration.c'; fi` + +test_conformance-test-blend-strings.o: test-blend-strings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-blend-strings.o -MD -MP -MF $(DEPDIR)/test_conformance-test-blend-strings.Tpo -c -o test_conformance-test-blend-strings.o `test -f 'test-blend-strings.c' || echo '$(srcdir)/'`test-blend-strings.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-blend-strings.Tpo $(DEPDIR)/test_conformance-test-blend-strings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-blend-strings.c' object='test_conformance-test-blend-strings.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-blend-strings.o `test -f 'test-blend-strings.c' || echo '$(srcdir)/'`test-blend-strings.c + +test_conformance-test-blend-strings.obj: test-blend-strings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-blend-strings.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-blend-strings.Tpo -c -o test_conformance-test-blend-strings.obj `if test -f 'test-blend-strings.c'; then $(CYGPATH_W) 'test-blend-strings.c'; else $(CYGPATH_W) '$(srcdir)/test-blend-strings.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-blend-strings.Tpo $(DEPDIR)/test_conformance-test-blend-strings.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-blend-strings.c' object='test_conformance-test-blend-strings.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-blend-strings.obj `if test -f 'test-blend-strings.c'; then $(CYGPATH_W) 'test-blend-strings.c'; else $(CYGPATH_W) '$(srcdir)/test-blend-strings.c'; fi` + +test_conformance-test-blend.o: test-blend.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-blend.o -MD -MP -MF $(DEPDIR)/test_conformance-test-blend.Tpo -c -o test_conformance-test-blend.o `test -f 'test-blend.c' || echo '$(srcdir)/'`test-blend.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-blend.Tpo $(DEPDIR)/test_conformance-test-blend.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-blend.c' object='test_conformance-test-blend.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-blend.o `test -f 'test-blend.c' || echo '$(srcdir)/'`test-blend.c + +test_conformance-test-blend.obj: test-blend.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-blend.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-blend.Tpo -c -o test_conformance-test-blend.obj `if test -f 'test-blend.c'; then $(CYGPATH_W) 'test-blend.c'; else $(CYGPATH_W) '$(srcdir)/test-blend.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-blend.Tpo $(DEPDIR)/test_conformance-test-blend.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-blend.c' object='test_conformance-test-blend.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-blend.obj `if test -f 'test-blend.c'; then $(CYGPATH_W) 'test-blend.c'; else $(CYGPATH_W) '$(srcdir)/test-blend.c'; fi` + +test_conformance-test-depth-test.o: test-depth-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-depth-test.o -MD -MP -MF $(DEPDIR)/test_conformance-test-depth-test.Tpo -c -o test_conformance-test-depth-test.o `test -f 'test-depth-test.c' || echo '$(srcdir)/'`test-depth-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-depth-test.Tpo $(DEPDIR)/test_conformance-test-depth-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-depth-test.c' object='test_conformance-test-depth-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-depth-test.o `test -f 'test-depth-test.c' || echo '$(srcdir)/'`test-depth-test.c + +test_conformance-test-depth-test.obj: test-depth-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-depth-test.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-depth-test.Tpo -c -o test_conformance-test-depth-test.obj `if test -f 'test-depth-test.c'; then $(CYGPATH_W) 'test-depth-test.c'; else $(CYGPATH_W) '$(srcdir)/test-depth-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-depth-test.Tpo $(DEPDIR)/test_conformance-test-depth-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-depth-test.c' object='test_conformance-test-depth-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-depth-test.obj `if test -f 'test-depth-test.c'; then $(CYGPATH_W) 'test-depth-test.c'; else $(CYGPATH_W) '$(srcdir)/test-depth-test.c'; fi` + +test_conformance-test-color-hsl.o: test-color-hsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-color-hsl.o -MD -MP -MF $(DEPDIR)/test_conformance-test-color-hsl.Tpo -c -o test_conformance-test-color-hsl.o `test -f 'test-color-hsl.c' || echo '$(srcdir)/'`test-color-hsl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-color-hsl.Tpo $(DEPDIR)/test_conformance-test-color-hsl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-color-hsl.c' object='test_conformance-test-color-hsl.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-color-hsl.o `test -f 'test-color-hsl.c' || echo '$(srcdir)/'`test-color-hsl.c + +test_conformance-test-color-hsl.obj: test-color-hsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-color-hsl.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-color-hsl.Tpo -c -o test_conformance-test-color-hsl.obj `if test -f 'test-color-hsl.c'; then $(CYGPATH_W) 'test-color-hsl.c'; else $(CYGPATH_W) '$(srcdir)/test-color-hsl.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-color-hsl.Tpo $(DEPDIR)/test_conformance-test-color-hsl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-color-hsl.c' object='test_conformance-test-color-hsl.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-color-hsl.obj `if test -f 'test-color-hsl.c'; then $(CYGPATH_W) 'test-color-hsl.c'; else $(CYGPATH_W) '$(srcdir)/test-color-hsl.c'; fi` + +test_conformance-test-color-mask.o: test-color-mask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-color-mask.o -MD -MP -MF $(DEPDIR)/test_conformance-test-color-mask.Tpo -c -o test_conformance-test-color-mask.o `test -f 'test-color-mask.c' || echo '$(srcdir)/'`test-color-mask.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-color-mask.Tpo $(DEPDIR)/test_conformance-test-color-mask.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-color-mask.c' object='test_conformance-test-color-mask.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-color-mask.o `test -f 'test-color-mask.c' || echo '$(srcdir)/'`test-color-mask.c + +test_conformance-test-color-mask.obj: test-color-mask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-color-mask.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-color-mask.Tpo -c -o test_conformance-test-color-mask.obj `if test -f 'test-color-mask.c'; then $(CYGPATH_W) 'test-color-mask.c'; else $(CYGPATH_W) '$(srcdir)/test-color-mask.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-color-mask.Tpo $(DEPDIR)/test_conformance-test-color-mask.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-color-mask.c' object='test_conformance-test-color-mask.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-color-mask.obj `if test -f 'test-color-mask.c'; then $(CYGPATH_W) 'test-color-mask.c'; else $(CYGPATH_W) '$(srcdir)/test-color-mask.c'; fi` + +test_conformance-test-backface-culling.o: test-backface-culling.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-backface-culling.o -MD -MP -MF $(DEPDIR)/test_conformance-test-backface-culling.Tpo -c -o test_conformance-test-backface-culling.o `test -f 'test-backface-culling.c' || echo '$(srcdir)/'`test-backface-culling.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-backface-culling.Tpo $(DEPDIR)/test_conformance-test-backface-culling.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-backface-culling.c' object='test_conformance-test-backface-culling.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-backface-culling.o `test -f 'test-backface-culling.c' || echo '$(srcdir)/'`test-backface-culling.c + +test_conformance-test-backface-culling.obj: test-backface-culling.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-backface-culling.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-backface-culling.Tpo -c -o test_conformance-test-backface-culling.obj `if test -f 'test-backface-culling.c'; then $(CYGPATH_W) 'test-backface-culling.c'; else $(CYGPATH_W) '$(srcdir)/test-backface-culling.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-backface-culling.Tpo $(DEPDIR)/test_conformance-test-backface-culling.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-backface-culling.c' object='test_conformance-test-backface-culling.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-backface-culling.obj `if test -f 'test-backface-culling.c'; then $(CYGPATH_W) 'test-backface-culling.c'; else $(CYGPATH_W) '$(srcdir)/test-backface-culling.c'; fi` + +test_conformance-test-just-vertex-shader.o: test-just-vertex-shader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-just-vertex-shader.o -MD -MP -MF $(DEPDIR)/test_conformance-test-just-vertex-shader.Tpo -c -o test_conformance-test-just-vertex-shader.o `test -f 'test-just-vertex-shader.c' || echo '$(srcdir)/'`test-just-vertex-shader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-just-vertex-shader.Tpo $(DEPDIR)/test_conformance-test-just-vertex-shader.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-just-vertex-shader.c' object='test_conformance-test-just-vertex-shader.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-just-vertex-shader.o `test -f 'test-just-vertex-shader.c' || echo '$(srcdir)/'`test-just-vertex-shader.c + +test_conformance-test-just-vertex-shader.obj: test-just-vertex-shader.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-just-vertex-shader.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-just-vertex-shader.Tpo -c -o test_conformance-test-just-vertex-shader.obj `if test -f 'test-just-vertex-shader.c'; then $(CYGPATH_W) 'test-just-vertex-shader.c'; else $(CYGPATH_W) '$(srcdir)/test-just-vertex-shader.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-just-vertex-shader.Tpo $(DEPDIR)/test_conformance-test-just-vertex-shader.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-just-vertex-shader.c' object='test_conformance-test-just-vertex-shader.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-just-vertex-shader.obj `if test -f 'test-just-vertex-shader.c'; then $(CYGPATH_W) 'test-just-vertex-shader.c'; else $(CYGPATH_W) '$(srcdir)/test-just-vertex-shader.c'; fi` + +test_conformance-test-pipeline-user-matrix.o: test-pipeline-user-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-user-matrix.o -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Tpo -c -o test_conformance-test-pipeline-user-matrix.o `test -f 'test-pipeline-user-matrix.c' || echo '$(srcdir)/'`test-pipeline-user-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Tpo $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-user-matrix.c' object='test_conformance-test-pipeline-user-matrix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-user-matrix.o `test -f 'test-pipeline-user-matrix.c' || echo '$(srcdir)/'`test-pipeline-user-matrix.c + +test_conformance-test-pipeline-user-matrix.obj: test-pipeline-user-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-user-matrix.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Tpo -c -o test_conformance-test-pipeline-user-matrix.obj `if test -f 'test-pipeline-user-matrix.c'; then $(CYGPATH_W) 'test-pipeline-user-matrix.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-user-matrix.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Tpo $(DEPDIR)/test_conformance-test-pipeline-user-matrix.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-user-matrix.c' object='test_conformance-test-pipeline-user-matrix.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-user-matrix.obj `if test -f 'test-pipeline-user-matrix.c'; then $(CYGPATH_W) 'test-pipeline-user-matrix.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-user-matrix.c'; fi` + +test_conformance-test-pipeline-uniforms.o: test-pipeline-uniforms.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-uniforms.o -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-uniforms.Tpo -c -o test_conformance-test-pipeline-uniforms.o `test -f 'test-pipeline-uniforms.c' || echo '$(srcdir)/'`test-pipeline-uniforms.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-uniforms.Tpo $(DEPDIR)/test_conformance-test-pipeline-uniforms.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-uniforms.c' object='test_conformance-test-pipeline-uniforms.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-uniforms.o `test -f 'test-pipeline-uniforms.c' || echo '$(srcdir)/'`test-pipeline-uniforms.c + +test_conformance-test-pipeline-uniforms.obj: test-pipeline-uniforms.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-uniforms.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-uniforms.Tpo -c -o test_conformance-test-pipeline-uniforms.obj `if test -f 'test-pipeline-uniforms.c'; then $(CYGPATH_W) 'test-pipeline-uniforms.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-uniforms.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-uniforms.Tpo $(DEPDIR)/test_conformance-test-pipeline-uniforms.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-uniforms.c' object='test_conformance-test-pipeline-uniforms.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-uniforms.obj `if test -f 'test-pipeline-uniforms.c'; then $(CYGPATH_W) 'test-pipeline-uniforms.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-uniforms.c'; fi` + +test_conformance-test-pixel-buffer.o: test-pixel-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pixel-buffer.o -MD -MP -MF $(DEPDIR)/test_conformance-test-pixel-buffer.Tpo -c -o test_conformance-test-pixel-buffer.o `test -f 'test-pixel-buffer.c' || echo '$(srcdir)/'`test-pixel-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pixel-buffer.Tpo $(DEPDIR)/test_conformance-test-pixel-buffer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pixel-buffer.c' object='test_conformance-test-pixel-buffer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pixel-buffer.o `test -f 'test-pixel-buffer.c' || echo '$(srcdir)/'`test-pixel-buffer.c + +test_conformance-test-pixel-buffer.obj: test-pixel-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pixel-buffer.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-pixel-buffer.Tpo -c -o test_conformance-test-pixel-buffer.obj `if test -f 'test-pixel-buffer.c'; then $(CYGPATH_W) 'test-pixel-buffer.c'; else $(CYGPATH_W) '$(srcdir)/test-pixel-buffer.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pixel-buffer.Tpo $(DEPDIR)/test_conformance-test-pixel-buffer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pixel-buffer.c' object='test_conformance-test-pixel-buffer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pixel-buffer.obj `if test -f 'test-pixel-buffer.c'; then $(CYGPATH_W) 'test-pixel-buffer.c'; else $(CYGPATH_W) '$(srcdir)/test-pixel-buffer.c'; fi` + +test_conformance-test-premult.o: test-premult.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-premult.o -MD -MP -MF $(DEPDIR)/test_conformance-test-premult.Tpo -c -o test_conformance-test-premult.o `test -f 'test-premult.c' || echo '$(srcdir)/'`test-premult.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-premult.Tpo $(DEPDIR)/test_conformance-test-premult.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-premult.c' object='test_conformance-test-premult.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-premult.o `test -f 'test-premult.c' || echo '$(srcdir)/'`test-premult.c + +test_conformance-test-premult.obj: test-premult.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-premult.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-premult.Tpo -c -o test_conformance-test-premult.obj `if test -f 'test-premult.c'; then $(CYGPATH_W) 'test-premult.c'; else $(CYGPATH_W) '$(srcdir)/test-premult.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-premult.Tpo $(DEPDIR)/test_conformance-test-premult.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-premult.c' object='test_conformance-test-premult.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-premult.obj `if test -f 'test-premult.c'; then $(CYGPATH_W) 'test-premult.c'; else $(CYGPATH_W) '$(srcdir)/test-premult.c'; fi` + +test_conformance-test-snippets.o: test-snippets.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-snippets.o -MD -MP -MF $(DEPDIR)/test_conformance-test-snippets.Tpo -c -o test_conformance-test-snippets.o `test -f 'test-snippets.c' || echo '$(srcdir)/'`test-snippets.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-snippets.Tpo $(DEPDIR)/test_conformance-test-snippets.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-snippets.c' object='test_conformance-test-snippets.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-snippets.o `test -f 'test-snippets.c' || echo '$(srcdir)/'`test-snippets.c + +test_conformance-test-snippets.obj: test-snippets.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-snippets.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-snippets.Tpo -c -o test_conformance-test-snippets.obj `if test -f 'test-snippets.c'; then $(CYGPATH_W) 'test-snippets.c'; else $(CYGPATH_W) '$(srcdir)/test-snippets.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-snippets.Tpo $(DEPDIR)/test_conformance-test-snippets.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-snippets.c' object='test_conformance-test-snippets.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-snippets.obj `if test -f 'test-snippets.c'; then $(CYGPATH_W) 'test-snippets.c'; else $(CYGPATH_W) '$(srcdir)/test-snippets.c'; fi` + +test_conformance-test-wrap-modes.o: test-wrap-modes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-wrap-modes.o -MD -MP -MF $(DEPDIR)/test_conformance-test-wrap-modes.Tpo -c -o test_conformance-test-wrap-modes.o `test -f 'test-wrap-modes.c' || echo '$(srcdir)/'`test-wrap-modes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-wrap-modes.Tpo $(DEPDIR)/test_conformance-test-wrap-modes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wrap-modes.c' object='test_conformance-test-wrap-modes.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-wrap-modes.o `test -f 'test-wrap-modes.c' || echo '$(srcdir)/'`test-wrap-modes.c + +test_conformance-test-wrap-modes.obj: test-wrap-modes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-wrap-modes.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-wrap-modes.Tpo -c -o test_conformance-test-wrap-modes.obj `if test -f 'test-wrap-modes.c'; then $(CYGPATH_W) 'test-wrap-modes.c'; else $(CYGPATH_W) '$(srcdir)/test-wrap-modes.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-wrap-modes.Tpo $(DEPDIR)/test_conformance-test-wrap-modes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wrap-modes.c' object='test_conformance-test-wrap-modes.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-wrap-modes.obj `if test -f 'test-wrap-modes.c'; then $(CYGPATH_W) 'test-wrap-modes.c'; else $(CYGPATH_W) '$(srcdir)/test-wrap-modes.c'; fi` + +test_conformance-test-sub-texture.o: test-sub-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-sub-texture.o -MD -MP -MF $(DEPDIR)/test_conformance-test-sub-texture.Tpo -c -o test_conformance-test-sub-texture.o `test -f 'test-sub-texture.c' || echo '$(srcdir)/'`test-sub-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-sub-texture.Tpo $(DEPDIR)/test_conformance-test-sub-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sub-texture.c' object='test_conformance-test-sub-texture.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-sub-texture.o `test -f 'test-sub-texture.c' || echo '$(srcdir)/'`test-sub-texture.c + +test_conformance-test-sub-texture.obj: test-sub-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-sub-texture.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-sub-texture.Tpo -c -o test_conformance-test-sub-texture.obj `if test -f 'test-sub-texture.c'; then $(CYGPATH_W) 'test-sub-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-sub-texture.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-sub-texture.Tpo $(DEPDIR)/test_conformance-test-sub-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sub-texture.c' object='test_conformance-test-sub-texture.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-sub-texture.obj `if test -f 'test-sub-texture.c'; then $(CYGPATH_W) 'test-sub-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-sub-texture.c'; fi` + +test_conformance-test-custom-attributes.o: test-custom-attributes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-custom-attributes.o -MD -MP -MF $(DEPDIR)/test_conformance-test-custom-attributes.Tpo -c -o test_conformance-test-custom-attributes.o `test -f 'test-custom-attributes.c' || echo '$(srcdir)/'`test-custom-attributes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-custom-attributes.Tpo $(DEPDIR)/test_conformance-test-custom-attributes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-custom-attributes.c' object='test_conformance-test-custom-attributes.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-custom-attributes.o `test -f 'test-custom-attributes.c' || echo '$(srcdir)/'`test-custom-attributes.c + +test_conformance-test-custom-attributes.obj: test-custom-attributes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-custom-attributes.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-custom-attributes.Tpo -c -o test_conformance-test-custom-attributes.obj `if test -f 'test-custom-attributes.c'; then $(CYGPATH_W) 'test-custom-attributes.c'; else $(CYGPATH_W) '$(srcdir)/test-custom-attributes.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-custom-attributes.Tpo $(DEPDIR)/test_conformance-test-custom-attributes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-custom-attributes.c' object='test_conformance-test-custom-attributes.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-custom-attributes.obj `if test -f 'test-custom-attributes.c'; then $(CYGPATH_W) 'test-custom-attributes.c'; else $(CYGPATH_W) '$(srcdir)/test-custom-attributes.c'; fi` + +test_conformance-test-offscreen.o: test-offscreen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-offscreen.o -MD -MP -MF $(DEPDIR)/test_conformance-test-offscreen.Tpo -c -o test_conformance-test-offscreen.o `test -f 'test-offscreen.c' || echo '$(srcdir)/'`test-offscreen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-offscreen.Tpo $(DEPDIR)/test_conformance-test-offscreen.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-offscreen.c' object='test_conformance-test-offscreen.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-offscreen.o `test -f 'test-offscreen.c' || echo '$(srcdir)/'`test-offscreen.c + +test_conformance-test-offscreen.obj: test-offscreen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-offscreen.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-offscreen.Tpo -c -o test_conformance-test-offscreen.obj `if test -f 'test-offscreen.c'; then $(CYGPATH_W) 'test-offscreen.c'; else $(CYGPATH_W) '$(srcdir)/test-offscreen.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-offscreen.Tpo $(DEPDIR)/test_conformance-test-offscreen.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-offscreen.c' object='test_conformance-test-offscreen.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-offscreen.obj `if test -f 'test-offscreen.c'; then $(CYGPATH_W) 'test-offscreen.c'; else $(CYGPATH_W) '$(srcdir)/test-offscreen.c'; fi` + +test_conformance-test-primitive.o: test-primitive.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-primitive.o -MD -MP -MF $(DEPDIR)/test_conformance-test-primitive.Tpo -c -o test_conformance-test-primitive.o `test -f 'test-primitive.c' || echo '$(srcdir)/'`test-primitive.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-primitive.Tpo $(DEPDIR)/test_conformance-test-primitive.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-primitive.c' object='test_conformance-test-primitive.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-primitive.o `test -f 'test-primitive.c' || echo '$(srcdir)/'`test-primitive.c + +test_conformance-test-primitive.obj: test-primitive.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-primitive.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-primitive.Tpo -c -o test_conformance-test-primitive.obj `if test -f 'test-primitive.c'; then $(CYGPATH_W) 'test-primitive.c'; else $(CYGPATH_W) '$(srcdir)/test-primitive.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-primitive.Tpo $(DEPDIR)/test_conformance-test-primitive.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-primitive.c' object='test_conformance-test-primitive.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-primitive.obj `if test -f 'test-primitive.c'; then $(CYGPATH_W) 'test-primitive.c'; else $(CYGPATH_W) '$(srcdir)/test-primitive.c'; fi` + +test_conformance-test-texture-3d.o: test-texture-3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-3d.o -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-3d.Tpo -c -o test_conformance-test-texture-3d.o `test -f 'test-texture-3d.c' || echo '$(srcdir)/'`test-texture-3d.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-3d.Tpo $(DEPDIR)/test_conformance-test-texture-3d.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-3d.c' object='test_conformance-test-texture-3d.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-3d.o `test -f 'test-texture-3d.c' || echo '$(srcdir)/'`test-texture-3d.c + +test_conformance-test-texture-3d.obj: test-texture-3d.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-3d.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-3d.Tpo -c -o test_conformance-test-texture-3d.obj `if test -f 'test-texture-3d.c'; then $(CYGPATH_W) 'test-texture-3d.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-3d.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-3d.Tpo $(DEPDIR)/test_conformance-test-texture-3d.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-3d.c' object='test_conformance-test-texture-3d.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-3d.obj `if test -f 'test-texture-3d.c'; then $(CYGPATH_W) 'test-texture-3d.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-3d.c'; fi` + +test_conformance-test-sparse-pipeline.o: test-sparse-pipeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-sparse-pipeline.o -MD -MP -MF $(DEPDIR)/test_conformance-test-sparse-pipeline.Tpo -c -o test_conformance-test-sparse-pipeline.o `test -f 'test-sparse-pipeline.c' || echo '$(srcdir)/'`test-sparse-pipeline.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-sparse-pipeline.Tpo $(DEPDIR)/test_conformance-test-sparse-pipeline.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sparse-pipeline.c' object='test_conformance-test-sparse-pipeline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-sparse-pipeline.o `test -f 'test-sparse-pipeline.c' || echo '$(srcdir)/'`test-sparse-pipeline.c + +test_conformance-test-sparse-pipeline.obj: test-sparse-pipeline.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-sparse-pipeline.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-sparse-pipeline.Tpo -c -o test_conformance-test-sparse-pipeline.obj `if test -f 'test-sparse-pipeline.c'; then $(CYGPATH_W) 'test-sparse-pipeline.c'; else $(CYGPATH_W) '$(srcdir)/test-sparse-pipeline.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-sparse-pipeline.Tpo $(DEPDIR)/test_conformance-test-sparse-pipeline.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-sparse-pipeline.c' object='test_conformance-test-sparse-pipeline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-sparse-pipeline.obj `if test -f 'test-sparse-pipeline.c'; then $(CYGPATH_W) 'test-sparse-pipeline.c'; else $(CYGPATH_W) '$(srcdir)/test-sparse-pipeline.c'; fi` + +test_conformance-test-read-texture-formats.o: test-read-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-read-texture-formats.o -MD -MP -MF $(DEPDIR)/test_conformance-test-read-texture-formats.Tpo -c -o test_conformance-test-read-texture-formats.o `test -f 'test-read-texture-formats.c' || echo '$(srcdir)/'`test-read-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-read-texture-formats.Tpo $(DEPDIR)/test_conformance-test-read-texture-formats.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-read-texture-formats.c' object='test_conformance-test-read-texture-formats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-read-texture-formats.o `test -f 'test-read-texture-formats.c' || echo '$(srcdir)/'`test-read-texture-formats.c + +test_conformance-test-read-texture-formats.obj: test-read-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-read-texture-formats.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-read-texture-formats.Tpo -c -o test_conformance-test-read-texture-formats.obj `if test -f 'test-read-texture-formats.c'; then $(CYGPATH_W) 'test-read-texture-formats.c'; else $(CYGPATH_W) '$(srcdir)/test-read-texture-formats.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-read-texture-formats.Tpo $(DEPDIR)/test_conformance-test-read-texture-formats.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-read-texture-formats.c' object='test_conformance-test-read-texture-formats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-read-texture-formats.obj `if test -f 'test-read-texture-formats.c'; then $(CYGPATH_W) 'test-read-texture-formats.c'; else $(CYGPATH_W) '$(srcdir)/test-read-texture-formats.c'; fi` + +test_conformance-test-write-texture-formats.o: test-write-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-write-texture-formats.o -MD -MP -MF $(DEPDIR)/test_conformance-test-write-texture-formats.Tpo -c -o test_conformance-test-write-texture-formats.o `test -f 'test-write-texture-formats.c' || echo '$(srcdir)/'`test-write-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-write-texture-formats.Tpo $(DEPDIR)/test_conformance-test-write-texture-formats.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-write-texture-formats.c' object='test_conformance-test-write-texture-formats.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-write-texture-formats.o `test -f 'test-write-texture-formats.c' || echo '$(srcdir)/'`test-write-texture-formats.c + +test_conformance-test-write-texture-formats.obj: test-write-texture-formats.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-write-texture-formats.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-write-texture-formats.Tpo -c -o test_conformance-test-write-texture-formats.obj `if test -f 'test-write-texture-formats.c'; then $(CYGPATH_W) 'test-write-texture-formats.c'; else $(CYGPATH_W) '$(srcdir)/test-write-texture-formats.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-write-texture-formats.Tpo $(DEPDIR)/test_conformance-test-write-texture-formats.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-write-texture-formats.c' object='test_conformance-test-write-texture-formats.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-write-texture-formats.obj `if test -f 'test-write-texture-formats.c'; then $(CYGPATH_W) 'test-write-texture-formats.c'; else $(CYGPATH_W) '$(srcdir)/test-write-texture-formats.c'; fi` + +test_conformance-test-point-size.o: test-point-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-size.o -MD -MP -MF $(DEPDIR)/test_conformance-test-point-size.Tpo -c -o test_conformance-test-point-size.o `test -f 'test-point-size.c' || echo '$(srcdir)/'`test-point-size.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-size.Tpo $(DEPDIR)/test_conformance-test-point-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-size.c' object='test_conformance-test-point-size.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-size.o `test -f 'test-point-size.c' || echo '$(srcdir)/'`test-point-size.c + +test_conformance-test-point-size.obj: test-point-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-size.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-point-size.Tpo -c -o test_conformance-test-point-size.obj `if test -f 'test-point-size.c'; then $(CYGPATH_W) 'test-point-size.c'; else $(CYGPATH_W) '$(srcdir)/test-point-size.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-size.Tpo $(DEPDIR)/test_conformance-test-point-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-size.c' object='test_conformance-test-point-size.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-size.obj `if test -f 'test-point-size.c'; then $(CYGPATH_W) 'test-point-size.c'; else $(CYGPATH_W) '$(srcdir)/test-point-size.c'; fi` + +test_conformance-test-point-size-attribute.o: test-point-size-attribute.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-size-attribute.o -MD -MP -MF $(DEPDIR)/test_conformance-test-point-size-attribute.Tpo -c -o test_conformance-test-point-size-attribute.o `test -f 'test-point-size-attribute.c' || echo '$(srcdir)/'`test-point-size-attribute.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-size-attribute.Tpo $(DEPDIR)/test_conformance-test-point-size-attribute.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-size-attribute.c' object='test_conformance-test-point-size-attribute.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-size-attribute.o `test -f 'test-point-size-attribute.c' || echo '$(srcdir)/'`test-point-size-attribute.c + +test_conformance-test-point-size-attribute.obj: test-point-size-attribute.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-size-attribute.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-point-size-attribute.Tpo -c -o test_conformance-test-point-size-attribute.obj `if test -f 'test-point-size-attribute.c'; then $(CYGPATH_W) 'test-point-size-attribute.c'; else $(CYGPATH_W) '$(srcdir)/test-point-size-attribute.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-size-attribute.Tpo $(DEPDIR)/test_conformance-test-point-size-attribute.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-size-attribute.c' object='test_conformance-test-point-size-attribute.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-size-attribute.obj `if test -f 'test-point-size-attribute.c'; then $(CYGPATH_W) 'test-point-size-attribute.c'; else $(CYGPATH_W) '$(srcdir)/test-point-size-attribute.c'; fi` + +test_conformance-test-point-sprite.o: test-point-sprite.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-sprite.o -MD -MP -MF $(DEPDIR)/test_conformance-test-point-sprite.Tpo -c -o test_conformance-test-point-sprite.o `test -f 'test-point-sprite.c' || echo '$(srcdir)/'`test-point-sprite.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-sprite.Tpo $(DEPDIR)/test_conformance-test-point-sprite.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-sprite.c' object='test_conformance-test-point-sprite.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-sprite.o `test -f 'test-point-sprite.c' || echo '$(srcdir)/'`test-point-sprite.c + +test_conformance-test-point-sprite.obj: test-point-sprite.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-point-sprite.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-point-sprite.Tpo -c -o test_conformance-test-point-sprite.obj `if test -f 'test-point-sprite.c'; then $(CYGPATH_W) 'test-point-sprite.c'; else $(CYGPATH_W) '$(srcdir)/test-point-sprite.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-point-sprite.Tpo $(DEPDIR)/test_conformance-test-point-sprite.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-point-sprite.c' object='test_conformance-test-point-sprite.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-point-sprite.obj `if test -f 'test-point-sprite.c'; then $(CYGPATH_W) 'test-point-sprite.c'; else $(CYGPATH_W) '$(srcdir)/test-point-sprite.c'; fi` + +test_conformance-test-no-gl-header.o: test-no-gl-header.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-no-gl-header.o -MD -MP -MF $(DEPDIR)/test_conformance-test-no-gl-header.Tpo -c -o test_conformance-test-no-gl-header.o `test -f 'test-no-gl-header.c' || echo '$(srcdir)/'`test-no-gl-header.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-no-gl-header.Tpo $(DEPDIR)/test_conformance-test-no-gl-header.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-no-gl-header.c' object='test_conformance-test-no-gl-header.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-no-gl-header.o `test -f 'test-no-gl-header.c' || echo '$(srcdir)/'`test-no-gl-header.c + +test_conformance-test-no-gl-header.obj: test-no-gl-header.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-no-gl-header.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-no-gl-header.Tpo -c -o test_conformance-test-no-gl-header.obj `if test -f 'test-no-gl-header.c'; then $(CYGPATH_W) 'test-no-gl-header.c'; else $(CYGPATH_W) '$(srcdir)/test-no-gl-header.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-no-gl-header.Tpo $(DEPDIR)/test_conformance-test-no-gl-header.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-no-gl-header.c' object='test_conformance-test-no-gl-header.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-no-gl-header.obj `if test -f 'test-no-gl-header.c'; then $(CYGPATH_W) 'test-no-gl-header.c'; else $(CYGPATH_W) '$(srcdir)/test-no-gl-header.c'; fi` + +test_conformance-test-version.o: test-version.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-version.o -MD -MP -MF $(DEPDIR)/test_conformance-test-version.Tpo -c -o test_conformance-test-version.o `test -f 'test-version.c' || echo '$(srcdir)/'`test-version.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-version.Tpo $(DEPDIR)/test_conformance-test-version.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-version.c' object='test_conformance-test-version.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-version.o `test -f 'test-version.c' || echo '$(srcdir)/'`test-version.c + +test_conformance-test-version.obj: test-version.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-version.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-version.Tpo -c -o test_conformance-test-version.obj `if test -f 'test-version.c'; then $(CYGPATH_W) 'test-version.c'; else $(CYGPATH_W) '$(srcdir)/test-version.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-version.Tpo $(DEPDIR)/test_conformance-test-version.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-version.c' object='test_conformance-test-version.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-version.obj `if test -f 'test-version.c'; then $(CYGPATH_W) 'test-version.c'; else $(CYGPATH_W) '$(srcdir)/test-version.c'; fi` + +test_conformance-test-gles2-context.o: test-gles2-context.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-gles2-context.o -MD -MP -MF $(DEPDIR)/test_conformance-test-gles2-context.Tpo -c -o test_conformance-test-gles2-context.o `test -f 'test-gles2-context.c' || echo '$(srcdir)/'`test-gles2-context.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-gles2-context.Tpo $(DEPDIR)/test_conformance-test-gles2-context.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-gles2-context.c' object='test_conformance-test-gles2-context.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-gles2-context.o `test -f 'test-gles2-context.c' || echo '$(srcdir)/'`test-gles2-context.c + +test_conformance-test-gles2-context.obj: test-gles2-context.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-gles2-context.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-gles2-context.Tpo -c -o test_conformance-test-gles2-context.obj `if test -f 'test-gles2-context.c'; then $(CYGPATH_W) 'test-gles2-context.c'; else $(CYGPATH_W) '$(srcdir)/test-gles2-context.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-gles2-context.Tpo $(DEPDIR)/test_conformance-test-gles2-context.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-gles2-context.c' object='test_conformance-test-gles2-context.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-gles2-context.obj `if test -f 'test-gles2-context.c'; then $(CYGPATH_W) 'test-gles2-context.c'; else $(CYGPATH_W) '$(srcdir)/test-gles2-context.c'; fi` + +test_conformance-test-euler-quaternion.o: test-euler-quaternion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-euler-quaternion.o -MD -MP -MF $(DEPDIR)/test_conformance-test-euler-quaternion.Tpo -c -o test_conformance-test-euler-quaternion.o `test -f 'test-euler-quaternion.c' || echo '$(srcdir)/'`test-euler-quaternion.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-euler-quaternion.Tpo $(DEPDIR)/test_conformance-test-euler-quaternion.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-euler-quaternion.c' object='test_conformance-test-euler-quaternion.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-euler-quaternion.o `test -f 'test-euler-quaternion.c' || echo '$(srcdir)/'`test-euler-quaternion.c + +test_conformance-test-euler-quaternion.obj: test-euler-quaternion.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-euler-quaternion.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-euler-quaternion.Tpo -c -o test_conformance-test-euler-quaternion.obj `if test -f 'test-euler-quaternion.c'; then $(CYGPATH_W) 'test-euler-quaternion.c'; else $(CYGPATH_W) '$(srcdir)/test-euler-quaternion.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-euler-quaternion.Tpo $(DEPDIR)/test_conformance-test-euler-quaternion.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-euler-quaternion.c' object='test_conformance-test-euler-quaternion.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-euler-quaternion.obj `if test -f 'test-euler-quaternion.c'; then $(CYGPATH_W) 'test-euler-quaternion.c'; else $(CYGPATH_W) '$(srcdir)/test-euler-quaternion.c'; fi` + +test_conformance-test-layer-remove.o: test-layer-remove.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-layer-remove.o -MD -MP -MF $(DEPDIR)/test_conformance-test-layer-remove.Tpo -c -o test_conformance-test-layer-remove.o `test -f 'test-layer-remove.c' || echo '$(srcdir)/'`test-layer-remove.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-layer-remove.Tpo $(DEPDIR)/test_conformance-test-layer-remove.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-layer-remove.c' object='test_conformance-test-layer-remove.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-layer-remove.o `test -f 'test-layer-remove.c' || echo '$(srcdir)/'`test-layer-remove.c + +test_conformance-test-layer-remove.obj: test-layer-remove.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-layer-remove.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-layer-remove.Tpo -c -o test_conformance-test-layer-remove.obj `if test -f 'test-layer-remove.c'; then $(CYGPATH_W) 'test-layer-remove.c'; else $(CYGPATH_W) '$(srcdir)/test-layer-remove.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-layer-remove.Tpo $(DEPDIR)/test_conformance-test-layer-remove.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-layer-remove.c' object='test_conformance-test-layer-remove.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-layer-remove.obj `if test -f 'test-layer-remove.c'; then $(CYGPATH_W) 'test-layer-remove.c'; else $(CYGPATH_W) '$(srcdir)/test-layer-remove.c'; fi` + +test_conformance-test-alpha-test.o: test-alpha-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-alpha-test.o -MD -MP -MF $(DEPDIR)/test_conformance-test-alpha-test.Tpo -c -o test_conformance-test-alpha-test.o `test -f 'test-alpha-test.c' || echo '$(srcdir)/'`test-alpha-test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-alpha-test.Tpo $(DEPDIR)/test_conformance-test-alpha-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-alpha-test.c' object='test_conformance-test-alpha-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-alpha-test.o `test -f 'test-alpha-test.c' || echo '$(srcdir)/'`test-alpha-test.c + +test_conformance-test-alpha-test.obj: test-alpha-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-alpha-test.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-alpha-test.Tpo -c -o test_conformance-test-alpha-test.obj `if test -f 'test-alpha-test.c'; then $(CYGPATH_W) 'test-alpha-test.c'; else $(CYGPATH_W) '$(srcdir)/test-alpha-test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-alpha-test.Tpo $(DEPDIR)/test_conformance-test-alpha-test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-alpha-test.c' object='test_conformance-test-alpha-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-alpha-test.obj `if test -f 'test-alpha-test.c'; then $(CYGPATH_W) 'test-alpha-test.c'; else $(CYGPATH_W) '$(srcdir)/test-alpha-test.c'; fi` + +test_conformance-test-map-buffer-range.o: test-map-buffer-range.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-map-buffer-range.o -MD -MP -MF $(DEPDIR)/test_conformance-test-map-buffer-range.Tpo -c -o test_conformance-test-map-buffer-range.o `test -f 'test-map-buffer-range.c' || echo '$(srcdir)/'`test-map-buffer-range.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-map-buffer-range.Tpo $(DEPDIR)/test_conformance-test-map-buffer-range.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-map-buffer-range.c' object='test_conformance-test-map-buffer-range.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-map-buffer-range.o `test -f 'test-map-buffer-range.c' || echo '$(srcdir)/'`test-map-buffer-range.c + +test_conformance-test-map-buffer-range.obj: test-map-buffer-range.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-map-buffer-range.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-map-buffer-range.Tpo -c -o test_conformance-test-map-buffer-range.obj `if test -f 'test-map-buffer-range.c'; then $(CYGPATH_W) 'test-map-buffer-range.c'; else $(CYGPATH_W) '$(srcdir)/test-map-buffer-range.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-map-buffer-range.Tpo $(DEPDIR)/test_conformance-test-map-buffer-range.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-map-buffer-range.c' object='test_conformance-test-map-buffer-range.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-map-buffer-range.obj `if test -f 'test-map-buffer-range.c'; then $(CYGPATH_W) 'test-map-buffer-range.c'; else $(CYGPATH_W) '$(srcdir)/test-map-buffer-range.c'; fi` + +test_conformance-test-npot-texture.o: test-npot-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-npot-texture.o -MD -MP -MF $(DEPDIR)/test_conformance-test-npot-texture.Tpo -c -o test_conformance-test-npot-texture.o `test -f 'test-npot-texture.c' || echo '$(srcdir)/'`test-npot-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-npot-texture.Tpo $(DEPDIR)/test_conformance-test-npot-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-npot-texture.c' object='test_conformance-test-npot-texture.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-npot-texture.o `test -f 'test-npot-texture.c' || echo '$(srcdir)/'`test-npot-texture.c + +test_conformance-test-npot-texture.obj: test-npot-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-npot-texture.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-npot-texture.Tpo -c -o test_conformance-test-npot-texture.obj `if test -f 'test-npot-texture.c'; then $(CYGPATH_W) 'test-npot-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-npot-texture.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-npot-texture.Tpo $(DEPDIR)/test_conformance-test-npot-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-npot-texture.c' object='test_conformance-test-npot-texture.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-npot-texture.obj `if test -f 'test-npot-texture.c'; then $(CYGPATH_W) 'test-npot-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-npot-texture.c'; fi` + +test_conformance-test-alpha-textures.o: test-alpha-textures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-alpha-textures.o -MD -MP -MF $(DEPDIR)/test_conformance-test-alpha-textures.Tpo -c -o test_conformance-test-alpha-textures.o `test -f 'test-alpha-textures.c' || echo '$(srcdir)/'`test-alpha-textures.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-alpha-textures.Tpo $(DEPDIR)/test_conformance-test-alpha-textures.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-alpha-textures.c' object='test_conformance-test-alpha-textures.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-alpha-textures.o `test -f 'test-alpha-textures.c' || echo '$(srcdir)/'`test-alpha-textures.c + +test_conformance-test-alpha-textures.obj: test-alpha-textures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-alpha-textures.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-alpha-textures.Tpo -c -o test_conformance-test-alpha-textures.obj `if test -f 'test-alpha-textures.c'; then $(CYGPATH_W) 'test-alpha-textures.c'; else $(CYGPATH_W) '$(srcdir)/test-alpha-textures.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-alpha-textures.Tpo $(DEPDIR)/test_conformance-test-alpha-textures.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-alpha-textures.c' object='test_conformance-test-alpha-textures.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-alpha-textures.obj `if test -f 'test-alpha-textures.c'; then $(CYGPATH_W) 'test-alpha-textures.c'; else $(CYGPATH_W) '$(srcdir)/test-alpha-textures.c'; fi` + +test_conformance-test-wrap-rectangle-textures.o: test-wrap-rectangle-textures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-wrap-rectangle-textures.o -MD -MP -MF $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Tpo -c -o test_conformance-test-wrap-rectangle-textures.o `test -f 'test-wrap-rectangle-textures.c' || echo '$(srcdir)/'`test-wrap-rectangle-textures.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Tpo $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wrap-rectangle-textures.c' object='test_conformance-test-wrap-rectangle-textures.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-wrap-rectangle-textures.o `test -f 'test-wrap-rectangle-textures.c' || echo '$(srcdir)/'`test-wrap-rectangle-textures.c + +test_conformance-test-wrap-rectangle-textures.obj: test-wrap-rectangle-textures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-wrap-rectangle-textures.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Tpo -c -o test_conformance-test-wrap-rectangle-textures.obj `if test -f 'test-wrap-rectangle-textures.c'; then $(CYGPATH_W) 'test-wrap-rectangle-textures.c'; else $(CYGPATH_W) '$(srcdir)/test-wrap-rectangle-textures.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Tpo $(DEPDIR)/test_conformance-test-wrap-rectangle-textures.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-wrap-rectangle-textures.c' object='test_conformance-test-wrap-rectangle-textures.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-wrap-rectangle-textures.obj `if test -f 'test-wrap-rectangle-textures.c'; then $(CYGPATH_W) 'test-wrap-rectangle-textures.c'; else $(CYGPATH_W) '$(srcdir)/test-wrap-rectangle-textures.c'; fi` + +test_conformance-test-texture-get-set-data.o: test-texture-get-set-data.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-get-set-data.o -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-get-set-data.Tpo -c -o test_conformance-test-texture-get-set-data.o `test -f 'test-texture-get-set-data.c' || echo '$(srcdir)/'`test-texture-get-set-data.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-get-set-data.Tpo $(DEPDIR)/test_conformance-test-texture-get-set-data.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-get-set-data.c' object='test_conformance-test-texture-get-set-data.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-get-set-data.o `test -f 'test-texture-get-set-data.c' || echo '$(srcdir)/'`test-texture-get-set-data.c + +test_conformance-test-texture-get-set-data.obj: test-texture-get-set-data.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-get-set-data.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-get-set-data.Tpo -c -o test_conformance-test-texture-get-set-data.obj `if test -f 'test-texture-get-set-data.c'; then $(CYGPATH_W) 'test-texture-get-set-data.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-get-set-data.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-get-set-data.Tpo $(DEPDIR)/test_conformance-test-texture-get-set-data.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-get-set-data.c' object='test_conformance-test-texture-get-set-data.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-get-set-data.obj `if test -f 'test-texture-get-set-data.c'; then $(CYGPATH_W) 'test-texture-get-set-data.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-get-set-data.c'; fi` + +test_conformance-test-framebuffer-get-bits.o: test-framebuffer-get-bits.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-framebuffer-get-bits.o -MD -MP -MF $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Tpo -c -o test_conformance-test-framebuffer-get-bits.o `test -f 'test-framebuffer-get-bits.c' || echo '$(srcdir)/'`test-framebuffer-get-bits.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Tpo $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-framebuffer-get-bits.c' object='test_conformance-test-framebuffer-get-bits.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-framebuffer-get-bits.o `test -f 'test-framebuffer-get-bits.c' || echo '$(srcdir)/'`test-framebuffer-get-bits.c + +test_conformance-test-framebuffer-get-bits.obj: test-framebuffer-get-bits.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-framebuffer-get-bits.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Tpo -c -o test_conformance-test-framebuffer-get-bits.obj `if test -f 'test-framebuffer-get-bits.c'; then $(CYGPATH_W) 'test-framebuffer-get-bits.c'; else $(CYGPATH_W) '$(srcdir)/test-framebuffer-get-bits.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Tpo $(DEPDIR)/test_conformance-test-framebuffer-get-bits.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-framebuffer-get-bits.c' object='test_conformance-test-framebuffer-get-bits.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-framebuffer-get-bits.obj `if test -f 'test-framebuffer-get-bits.c'; then $(CYGPATH_W) 'test-framebuffer-get-bits.c'; else $(CYGPATH_W) '$(srcdir)/test-framebuffer-get-bits.c'; fi` + +test_conformance-test-primitive-and-journal.o: test-primitive-and-journal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-primitive-and-journal.o -MD -MP -MF $(DEPDIR)/test_conformance-test-primitive-and-journal.Tpo -c -o test_conformance-test-primitive-and-journal.o `test -f 'test-primitive-and-journal.c' || echo '$(srcdir)/'`test-primitive-and-journal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-primitive-and-journal.Tpo $(DEPDIR)/test_conformance-test-primitive-and-journal.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-primitive-and-journal.c' object='test_conformance-test-primitive-and-journal.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-primitive-and-journal.o `test -f 'test-primitive-and-journal.c' || echo '$(srcdir)/'`test-primitive-and-journal.c + +test_conformance-test-primitive-and-journal.obj: test-primitive-and-journal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-primitive-and-journal.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-primitive-and-journal.Tpo -c -o test_conformance-test-primitive-and-journal.obj `if test -f 'test-primitive-and-journal.c'; then $(CYGPATH_W) 'test-primitive-and-journal.c'; else $(CYGPATH_W) '$(srcdir)/test-primitive-and-journal.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-primitive-and-journal.Tpo $(DEPDIR)/test_conformance-test-primitive-and-journal.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-primitive-and-journal.c' object='test_conformance-test-primitive-and-journal.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-primitive-and-journal.obj `if test -f 'test-primitive-and-journal.c'; then $(CYGPATH_W) 'test-primitive-and-journal.c'; else $(CYGPATH_W) '$(srcdir)/test-primitive-and-journal.c'; fi` + +test_conformance-test-copy-replace-texture.o: test-copy-replace-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-copy-replace-texture.o -MD -MP -MF $(DEPDIR)/test_conformance-test-copy-replace-texture.Tpo -c -o test_conformance-test-copy-replace-texture.o `test -f 'test-copy-replace-texture.c' || echo '$(srcdir)/'`test-copy-replace-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-copy-replace-texture.Tpo $(DEPDIR)/test_conformance-test-copy-replace-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-copy-replace-texture.c' object='test_conformance-test-copy-replace-texture.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-copy-replace-texture.o `test -f 'test-copy-replace-texture.c' || echo '$(srcdir)/'`test-copy-replace-texture.c + +test_conformance-test-copy-replace-texture.obj: test-copy-replace-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-copy-replace-texture.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-copy-replace-texture.Tpo -c -o test_conformance-test-copy-replace-texture.obj `if test -f 'test-copy-replace-texture.c'; then $(CYGPATH_W) 'test-copy-replace-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-copy-replace-texture.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-copy-replace-texture.Tpo $(DEPDIR)/test_conformance-test-copy-replace-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-copy-replace-texture.c' object='test_conformance-test-copy-replace-texture.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-copy-replace-texture.obj `if test -f 'test-copy-replace-texture.c'; then $(CYGPATH_W) 'test-copy-replace-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-copy-replace-texture.c'; fi` + +test_conformance-test-pipeline-cache-unrefs-texture.o: test-pipeline-cache-unrefs-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-cache-unrefs-texture.o -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Tpo -c -o test_conformance-test-pipeline-cache-unrefs-texture.o `test -f 'test-pipeline-cache-unrefs-texture.c' || echo '$(srcdir)/'`test-pipeline-cache-unrefs-texture.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Tpo $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-cache-unrefs-texture.c' object='test_conformance-test-pipeline-cache-unrefs-texture.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-cache-unrefs-texture.o `test -f 'test-pipeline-cache-unrefs-texture.c' || echo '$(srcdir)/'`test-pipeline-cache-unrefs-texture.c + +test_conformance-test-pipeline-cache-unrefs-texture.obj: test-pipeline-cache-unrefs-texture.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-cache-unrefs-texture.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Tpo -c -o test_conformance-test-pipeline-cache-unrefs-texture.obj `if test -f 'test-pipeline-cache-unrefs-texture.c'; then $(CYGPATH_W) 'test-pipeline-cache-unrefs-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-cache-unrefs-texture.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Tpo $(DEPDIR)/test_conformance-test-pipeline-cache-unrefs-texture.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-cache-unrefs-texture.c' object='test_conformance-test-pipeline-cache-unrefs-texture.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-cache-unrefs-texture.obj `if test -f 'test-pipeline-cache-unrefs-texture.c'; then $(CYGPATH_W) 'test-pipeline-cache-unrefs-texture.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-cache-unrefs-texture.c'; fi` + +test_conformance-test-texture-no-allocate.o: test-texture-no-allocate.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-no-allocate.o -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-no-allocate.Tpo -c -o test_conformance-test-texture-no-allocate.o `test -f 'test-texture-no-allocate.c' || echo '$(srcdir)/'`test-texture-no-allocate.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-no-allocate.Tpo $(DEPDIR)/test_conformance-test-texture-no-allocate.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-no-allocate.c' object='test_conformance-test-texture-no-allocate.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-no-allocate.o `test -f 'test-texture-no-allocate.c' || echo '$(srcdir)/'`test-texture-no-allocate.c + +test_conformance-test-texture-no-allocate.obj: test-texture-no-allocate.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-no-allocate.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-no-allocate.Tpo -c -o test_conformance-test-texture-no-allocate.obj `if test -f 'test-texture-no-allocate.c'; then $(CYGPATH_W) 'test-texture-no-allocate.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-no-allocate.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-no-allocate.Tpo $(DEPDIR)/test_conformance-test-texture-no-allocate.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-no-allocate.c' object='test_conformance-test-texture-no-allocate.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-no-allocate.obj `if test -f 'test-texture-no-allocate.c'; then $(CYGPATH_W) 'test-texture-no-allocate.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-no-allocate.c'; fi` + +test_conformance-test-pipeline-shader-state.o: test-pipeline-shader-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-shader-state.o -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-shader-state.Tpo -c -o test_conformance-test-pipeline-shader-state.o `test -f 'test-pipeline-shader-state.c' || echo '$(srcdir)/'`test-pipeline-shader-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-shader-state.Tpo $(DEPDIR)/test_conformance-test-pipeline-shader-state.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-shader-state.c' object='test_conformance-test-pipeline-shader-state.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-shader-state.o `test -f 'test-pipeline-shader-state.c' || echo '$(srcdir)/'`test-pipeline-shader-state.c + +test_conformance-test-pipeline-shader-state.obj: test-pipeline-shader-state.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-pipeline-shader-state.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-pipeline-shader-state.Tpo -c -o test_conformance-test-pipeline-shader-state.obj `if test -f 'test-pipeline-shader-state.c'; then $(CYGPATH_W) 'test-pipeline-shader-state.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-shader-state.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-pipeline-shader-state.Tpo $(DEPDIR)/test_conformance-test-pipeline-shader-state.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-pipeline-shader-state.c' object='test_conformance-test-pipeline-shader-state.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-pipeline-shader-state.obj `if test -f 'test-pipeline-shader-state.c'; then $(CYGPATH_W) 'test-pipeline-shader-state.c'; else $(CYGPATH_W) '$(srcdir)/test-pipeline-shader-state.c'; fi` + +test_conformance-test-texture-rg.o: test-texture-rg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-rg.o -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-rg.Tpo -c -o test_conformance-test-texture-rg.o `test -f 'test-texture-rg.c' || echo '$(srcdir)/'`test-texture-rg.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-rg.Tpo $(DEPDIR)/test_conformance-test-texture-rg.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-rg.c' object='test_conformance-test-texture-rg.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-rg.o `test -f 'test-texture-rg.c' || echo '$(srcdir)/'`test-texture-rg.c + +test_conformance-test-texture-rg.obj: test-texture-rg.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-texture-rg.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-texture-rg.Tpo -c -o test_conformance-test-texture-rg.obj `if test -f 'test-texture-rg.c'; then $(CYGPATH_W) 'test-texture-rg.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-rg.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-texture-rg.Tpo $(DEPDIR)/test_conformance-test-texture-rg.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-texture-rg.c' object='test_conformance-test-texture-rg.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-texture-rg.obj `if test -f 'test-texture-rg.c'; then $(CYGPATH_W) 'test-texture-rg.c'; else $(CYGPATH_W) '$(srcdir)/test-texture-rg.c'; fi` + +test_conformance-test-fence.o: test-fence.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-fence.o -MD -MP -MF $(DEPDIR)/test_conformance-test-fence.Tpo -c -o test_conformance-test-fence.o `test -f 'test-fence.c' || echo '$(srcdir)/'`test-fence.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-fence.Tpo $(DEPDIR)/test_conformance-test-fence.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-fence.c' object='test_conformance-test-fence.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-fence.o `test -f 'test-fence.c' || echo '$(srcdir)/'`test-fence.c + +test_conformance-test-fence.obj: test-fence.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-fence.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-fence.Tpo -c -o test_conformance-test-fence.obj `if test -f 'test-fence.c'; then $(CYGPATH_W) 'test-fence.c'; else $(CYGPATH_W) '$(srcdir)/test-fence.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-fence.Tpo $(DEPDIR)/test_conformance-test-fence.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-fence.c' object='test_conformance-test-fence.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-fence.obj `if test -f 'test-fence.c'; then $(CYGPATH_W) 'test-fence.c'; else $(CYGPATH_W) '$(srcdir)/test-fence.c'; fi` + +test_conformance-test-path.o: test-path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-path.o -MD -MP -MF $(DEPDIR)/test_conformance-test-path.Tpo -c -o test_conformance-test-path.o `test -f 'test-path.c' || echo '$(srcdir)/'`test-path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-path.Tpo $(DEPDIR)/test_conformance-test-path.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-path.c' object='test_conformance-test-path.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-path.o `test -f 'test-path.c' || echo '$(srcdir)/'`test-path.c + +test_conformance-test-path.obj: test-path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-path.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-path.Tpo -c -o test_conformance-test-path.obj `if test -f 'test-path.c'; then $(CYGPATH_W) 'test-path.c'; else $(CYGPATH_W) '$(srcdir)/test-path.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-path.Tpo $(DEPDIR)/test_conformance-test-path.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-path.c' object='test_conformance-test-path.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-path.obj `if test -f 'test-path.c'; then $(CYGPATH_W) 'test-path.c'; else $(CYGPATH_W) '$(srcdir)/test-path.c'; fi` + +test_conformance-test-path-clip.o: test-path-clip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-path-clip.o -MD -MP -MF $(DEPDIR)/test_conformance-test-path-clip.Tpo -c -o test_conformance-test-path-clip.o `test -f 'test-path-clip.c' || echo '$(srcdir)/'`test-path-clip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-path-clip.Tpo $(DEPDIR)/test_conformance-test-path-clip.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-path-clip.c' object='test_conformance-test-path-clip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-path-clip.o `test -f 'test-path-clip.c' || echo '$(srcdir)/'`test-path-clip.c + +test_conformance-test-path-clip.obj: test-path-clip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-path-clip.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-path-clip.Tpo -c -o test_conformance-test-path-clip.obj `if test -f 'test-path-clip.c'; then $(CYGPATH_W) 'test-path-clip.c'; else $(CYGPATH_W) '$(srcdir)/test-path-clip.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-path-clip.Tpo $(DEPDIR)/test_conformance-test-path-clip.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-path-clip.c' object='test_conformance-test-path-clip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-path-clip.obj `if test -f 'test-path-clip.c'; then $(CYGPATH_W) 'test-path-clip.c'; else $(CYGPATH_W) '$(srcdir)/test-path-clip.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-insttestDATA: $(insttest_DATA) + @$(NORMAL_INSTALL) + @list='$(insttest_DATA)'; test -n "$(insttestdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(insttestdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(insttestdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(insttestdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(insttestdir)" || exit $$?; \ + done + +uninstall-insttestDATA: + @$(NORMAL_UNINSTALL) + @list='$(insttest_DATA)'; test -n "$(insttestdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(insttestdir)'; $(am__uninstall_files_from_dir) +install-testmetaDATA: $(testmeta_DATA) + @$(NORMAL_INSTALL) + @list='$(testmeta_DATA)'; test -n "$(testmetadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(testmetadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(testmetadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(testmetadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(testmetadir)" || exit $$?; \ + done + +uninstall-testmetaDATA: + @$(NORMAL_UNINSTALL) + @list='$(testmeta_DATA)'; test -n "$(testmetadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(testmetadir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(insttestdir)" "$(DESTDIR)$(insttestdir)" "$(DESTDIR)$(testmetadir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-insttestPROGRAMS clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-insttestDATA install-insttestPROGRAMS \ + install-testmetaDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-insttestDATA uninstall-insttestPROGRAMS \ + uninstall-testmetaDATA + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-insttestPROGRAMS clean-libtool clean-noinstPROGRAMS \ + cscopelist-am ctags ctags-am dist-hook distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-insttestDATA install-insttestPROGRAMS install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip install-testmetaDATA installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-insttestDATA \ + uninstall-insttestPROGRAMS uninstall-testmetaDATA + + +# For convenience, this provides a way to easily run individual unit tests: +.PHONY: wrappers clean-wrappers + +wrappers: stamp-test-conformance + @true +stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c + @mkdir -p wrappers + @sed -n -e 's/^ \{1,\}ADD_TEST *( *\([a-zA-Z0-9_]\{1,\}\).*/\1/p' $(srcdir)/test-conform-main.c > unit-tests + @chmod +x $(top_srcdir)/tests/test-launcher.sh + @( echo "/stamp-test-conformance" ; \ + echo "/test-conformance$(EXEEXT)" ; \ + echo "*.o" ; \ + echo ".gitignore" ; \ + echo "unit-tests" ; ) > .gitignore + @for i in `cat unit-tests`; \ + do \ + unit=`basename $$i | sed -e s/_/-/g`; \ + echo " GEN $$unit"; \ + ( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/test-launcher.sh $(abs_builddir)/test-conformance$(EXEEXT) '' '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \ + chmod +x $$unit$(SHEXT); \ + echo "/$$unit$(SHEXT)" >> .gitignore; \ + done \ + && echo timestamp > $(@F) + +clean-wrappers: + @for i in `cat unit-tests`; \ + do \ + unit=`basename $$i | sed -e s/_/-/g`; \ + echo " RM $$unit"; \ + rm -f $$unit$(SHEXT) ; \ + done \ + && rm -f unit-tests \ + && rm -f stamp-test-conformance + +test: wrappers + @$(top_srcdir)/tests/run-tests.sh $(abs_builddir)/../config.env $(abs_builddir)/test-conformance$(EXEEXT) + +.PHONY: test + +dist-hook: ../../build/win32/vs9/test-conformance-cogl.vcproj ../../build/win32/vs10/test-conformance-cogl.vcxproj ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters + +../../build/win32/vs9/test-conformance-cogl.vcproj: $(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >testconformance.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin >$@ + rm testconformance.sourcefiles + +../../build/win32/vs10/test-conformance-cogl.vcxproj: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' ' \ + ;; \ + esac; \ + done >testconformance.vs10.sourcefiles + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin >$@ + rm testconformance.vs10.sourcefiles + +../../build/win32/vs10/test-conformance-cogl.vcxproj.filters: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin + for F in $(test_conformance_SOURCES); do \ + case $$F in \ + *.c) echo ' Sources' \ + ;; \ + esac; \ + done >testconformance.vs10.sourcefiles.filters + $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin >$@ + rm testconformance.vs10.sourcefiles.filters + +# we override the clean-generic target to clean up the wrappers so +# we cannot use CLEANFILES +clean-generic: clean-wrappers + $(QUIET_RM)rm -f .log + +@ENABLE_INSTALLED_TESTS_TRUE@conform.test: +@ENABLE_INSTALLED_TESTS_TRUE@ echo " GEN $@"; \ +@ENABLE_INSTALLED_TESTS_TRUE@ echo "[Test]" > $@.tmp; \ +@ENABLE_INSTALLED_TESTS_TRUE@ echo "Type=session" >> $@.tmp; \ +@ENABLE_INSTALLED_TESTS_TRUE@ echo "Exec=sh -c \"cd $(libexecdir)/installed-tests/$(PACKAGE)/conform; ../run-tests.sh ../config.env ./test-conformance\"" >> $@.tmp; \ +@ENABLE_INSTALLED_TESTS_TRUE@ mv $@.tmp $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/conform/test-alpha-test.c b/tests/conform/test-alpha-test.c new file mode 100644 index 0000000..e74f6d8 --- /dev/null +++ b/tests/conform/test-alpha-test.c @@ -0,0 +1,73 @@ +#include +#include + +#include "test-utils.h" + +static CoglTexture2D * +create_texture (CoglContext *context) +{ + static const uint8_t data[] = + { + 0xff, 0x00, 0x00, 0xff, + 0x00, 0xfa, 0x00, 0xfa + }; + + return cogl_texture_2d_new_from_data (context, + 2, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + data, + NULL /* error */); +} + +void +test_alpha_test (void) +{ + CoglTexture *tex = create_texture (test_ctx); + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + CoglColor clear_color; + + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_pipeline_set_layer_filters (pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_alpha_test_function (pipeline, + COGL_PIPELINE_ALPHA_FUNC_GEQUAL, + 254 / 255.0f /* alpha reference */); + + cogl_color_init_from_4ub (&clear_color, 0x00, 0x00, 0xff, 0xff); + cogl_framebuffer_clear (test_fb, + COGL_BUFFER_BIT_COLOR, + &clear_color); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1, -1, + 1, 1); + + cogl_object_unref (pipeline); + cogl_object_unref (tex); + + /* The left side of the framebuffer should use the first pixel from + * the texture which is red */ + test_utils_check_region (test_fb, + 2, 2, + fb_width / 2 - 4, + fb_height - 4, + 0xff0000ff); + /* The right side of the framebuffer should use the clear color + * because the second pixel from the texture is clipped from the + * alpha test */ + test_utils_check_region (test_fb, + fb_width / 2 + 2, + 2, + fb_width / 2 - 4, + fb_height - 4, + 0x0000ffff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-alpha-textures.c b/tests/conform/test-alpha-textures.c new file mode 100644 index 0000000..dccd30e --- /dev/null +++ b/tests/conform/test-alpha-textures.c @@ -0,0 +1,123 @@ +#include + +#include + +#include "test-utils.h" + +static void +create_pipeline (CoglTexture **tex_out, + CoglPipeline **pipeline_out) +{ + CoglTexture2D *tex; + CoglPipeline *pipeline; + static const uint8_t tex_data[] = + { 0x00, 0x44, 0x88, 0xcc }; + + tex = cogl_texture_2d_new_from_data (test_ctx, + 2, 2, /* width/height */ + COGL_PIXEL_FORMAT_A_8, /* format */ + 2, /* rowstride */ + tex_data, + NULL); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_layer_wrap_mode (pipeline, + 0, /* layer */ + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE); + + /* This is the layer combine used by cogl-pango */ + cogl_pipeline_set_layer_combine (pipeline, + 0, /* layer */ + "RGBA = MODULATE (PREVIOUS, TEXTURE[A])", + NULL); + + cogl_pipeline_set_layer_texture (pipeline, + 0, /* layer */ + tex); + + *pipeline_out = pipeline; + *tex_out = tex; +} + +void +test_alpha_textures (void) +{ + CoglTexture *tex1, *tex2; + CoglPipeline *pipeline1, *pipeline2; + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + uint8_t replacement_data[1] = { 0xff }; + + create_pipeline (&tex1, &pipeline1); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline1, + -1.0f, 1.0f, /* x1/y1 */ + 1.0f, 0.0f /* x2/y2 */); + + create_pipeline (&tex2, &pipeline2); + + cogl_texture_set_region (tex2, + 0, 0, /* src_x/y */ + 1, 1, /* dst_x/y */ + 1, 1, /* dst_width / dst_height */ + 1, 1, /* width / height */ + COGL_PIXEL_FORMAT_A_8, + 1, /* rowstride */ + replacement_data); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline2, + -1.0f, 0.0f, /* x1/y1 */ + 1.0f, -1.0f /* x2/y2 */); + + cogl_object_unref (tex1); + cogl_object_unref (tex2); + cogl_object_unref (pipeline1); + cogl_object_unref (pipeline2); + + /* Unmodified texture */ + test_utils_check_pixel (test_fb, + fb_width / 4, + fb_height / 8, + 0x000000ff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, + fb_height / 8, + 0x444444ff); + test_utils_check_pixel (test_fb, + fb_width / 4, + fb_height * 3 / 8, + 0x888888ff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, + fb_height * 3 / 8, + 0xccccccff); + + /* Modified texture */ + test_utils_check_pixel (test_fb, + fb_width / 4, + fb_height * 5 / 8, + 0x000000ff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, + fb_height * 5 / 8, + 0x444444ff); + test_utils_check_pixel (test_fb, + fb_width / 4, + fb_height * 7 / 8, + 0x888888ff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, + fb_height * 7 / 8, + 0xffffffff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-atlas-migration.c b/tests/conform/test-atlas-migration.c new file mode 100644 index 0000000..39e8a3c --- /dev/null +++ b/tests/conform/test-atlas-migration.c @@ -0,0 +1,145 @@ +#include + +#include "test-utils.h" + +#define N_TEXTURES 128 + +#define OPACITY_FOR_ROW(y) \ + (0xff - ((y) & 0xf) * 0x10) + +#define COLOR_FOR_SIZE(size) \ + (colors + (size) % 3) + +typedef struct +{ + uint8_t red, green, blue, alpha; +} TestColor; + +static const TestColor colors[] = + { { 0xff, 0x00, 0x00, 0xff }, + { 0x00, 0xff, 0x00, 0xff }, + { 0x00, 0x00, 0xff, 0xff } }; + +static CoglTexture * +create_texture (int size) +{ + CoglTexture *texture; + const TestColor *color; + uint8_t *data, *p; + int x, y; + + /* Create a red, green or blue texture depending on the size */ + color = COLOR_FOR_SIZE (size); + + p = data = g_malloc (size * size * 4); + + /* Fill the data with the color but fade the opacity out with + increasing y coordinates so that we can see the blending it the + atlas migration accidentally blends with garbage in the + texture */ + for (y = 0; y < size; y++) + { + int opacity = OPACITY_FOR_ROW (y); + + for (x = 0; x < size; x++) + { + /* Store the colors premultiplied */ + p[0] = color->red * opacity / 255; + p[1] = color->green * opacity / 255; + p[2] = color->blue * opacity / 255; + p[3] = opacity; + + p += 4; + } + } + + texture = test_utils_texture_new_from_data (test_ctx, + size, /* width */ + size, /* height */ + TEST_UTILS_TEXTURE_NONE, /* flags */ + /* format */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + /* rowstride */ + size * 4, + data); + + g_free (data); + + return texture; +} + +static void +verify_texture (CoglTexture *texture, int size) +{ + uint8_t *data, *p; + int x, y; + const TestColor *color; + + color = COLOR_FOR_SIZE (size); + + p = data = g_malloc (size * size * 4); + + cogl_texture_get_data (texture, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + size * 4, + data); + + for (y = 0; y < size; y++) + { + int opacity = OPACITY_FOR_ROW (y); + + for (x = 0; x < size; x++) + { + TestColor real_color = + { + color->red * opacity / 255, + color->green * opacity / 255, + color->blue * opacity / 255 + }; + + test_utils_compare_pixel (p, + (real_color.red << 24) | + (real_color.green << 16) | + (real_color.blue << 8) | + opacity); + g_assert_cmpint (p[3], ==, opacity); + + p += 4; + } + } + + g_free (data); +} + +void +test_atlas_migration (void) +{ + CoglTexture *textures[N_TEXTURES]; + int i, tex_num; + + /* Create and destroy all of the textures a few times to increase + the chances that we'll end up reusing the buffers for previously + discarded atlases */ + for (i = 0; i < 5; i++) + { + for (tex_num = 0; tex_num < N_TEXTURES; tex_num++) + textures[tex_num] = create_texture (tex_num + 1); + for (tex_num = 0; tex_num < N_TEXTURES; tex_num++) + cogl_object_unref (textures[tex_num]); + } + + /* Create all the textures again */ + for (tex_num = 0; tex_num < N_TEXTURES; tex_num++) + textures[tex_num] = create_texture (tex_num + 1); + + /* Verify that they all still have the right data */ + for (tex_num = 0; tex_num < N_TEXTURES; tex_num++) + verify_texture (textures[tex_num], tex_num + 1); + + /* Destroy them all */ + for (tex_num = 0; tex_num < N_TEXTURES; tex_num++) + cogl_object_unref (textures[tex_num]); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c new file mode 100644 index 0000000..e90c2f5 --- /dev/null +++ b/tests/conform/test-backface-culling.c @@ -0,0 +1,311 @@ +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_0 + +#include + +#include + +#include "test-utils.h" + +/* Size the texture so that it is just off a power of two to encourage + it so use software tiling when NPOTs aren't available */ +#define TEXTURE_SIZE 257 + +/* Amount of pixels to skip off the top, bottom, left and right of the + texture when reading back the stage */ +#define TEST_INSET 2 + +/* Size to actually render the texture at */ +#define TEXTURE_RENDER_SIZE 8 + +typedef struct _TestState +{ + CoglTexture *texture; + CoglFramebuffer *offscreen; + CoglTexture *offscreen_tex; + int width, height; +} TestState; + +static void +validate_part (CoglFramebuffer *framebuffer, + int xnum, int ynum, CoglBool shown) +{ + test_utils_check_region (framebuffer, + xnum * TEXTURE_RENDER_SIZE + TEST_INSET, + ynum * TEXTURE_RENDER_SIZE + TEST_INSET, + TEXTURE_RENDER_SIZE - TEST_INSET * 2, + TEXTURE_RENDER_SIZE - TEST_INSET * 2, + shown ? 0xff0000ff : 0x000000ff); +} + +/* We draw everything 16 times. The draw number is used as a bitmask + to test all of the combinations of enabling legacy state, both + winding orders and all four culling modes */ + +#define USE_LEGACY_STATE(draw_num) (((draw_num) & 0x01) >> 0) +#define FRONT_WINDING(draw_num) (((draw_num) & 0x02) >> 1) +#define CULL_FACE_MODE(draw_num) (((draw_num) & 0x0c) >> 2) + +static void +paint_test_backface_culling (TestState *state, + CoglFramebuffer *framebuffer) +{ + int draw_num; + CoglPipeline *base_pipeline = cogl_pipeline_new (test_ctx); + + cogl_framebuffer_orthographic (framebuffer, + 0, 0, + state->width, + state->height, + -1, + 100); + + cogl_framebuffer_clear4f (framebuffer, + COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_STENCIL, + 0, 0, 0, 1); + + cogl_pipeline_set_layer_texture (base_pipeline, 0, state->texture); + + cogl_pipeline_set_layer_filters (base_pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + cogl_push_framebuffer (framebuffer); + + /* Render the scene sixteen times to test all of the combinations of + cull face mode, legacy state and winding orders */ + for (draw_num = 0; draw_num < 16; draw_num++) + { + float x1 = 0, x2, y1 = 0, y2 = (float)(TEXTURE_RENDER_SIZE); + CoglTextureVertex verts[4]; + CoglPipeline *pipeline; + + cogl_push_matrix (); + cogl_translate (0, TEXTURE_RENDER_SIZE * draw_num, 0); + + pipeline = cogl_pipeline_copy (base_pipeline); + + cogl_set_backface_culling_enabled (USE_LEGACY_STATE (draw_num)); + cogl_pipeline_set_front_face_winding (pipeline, FRONT_WINDING (draw_num)); + cogl_pipeline_set_cull_face_mode (pipeline, CULL_FACE_MODE (draw_num)); + + cogl_push_source (pipeline); + + memset (verts, 0, sizeof (verts)); + + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + /* Draw a front-facing texture */ + cogl_rectangle (x1, y1, x2, y2); + + x1 = x2; + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + /* Draw a front-facing texture with flipped texcoords */ + cogl_rectangle_with_texture_coords (x1, y1, x2, y2, + 1.0, 0.0, 0.0, 1.0); + + x1 = x2; + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + /* Draw a back-facing texture */ + cogl_rectangle (x2, y1, x1, y2); + + x1 = x2; + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + /* If the texture is sliced then cogl_polygon doesn't work so + we'll just use a solid color instead */ + if (cogl_texture_is_sliced (state->texture)) + cogl_set_source_color4ub (255, 0, 0, 255); + + /* Draw a front-facing polygon */ + verts[0].x = x1; verts[0].y = y2; + verts[1].x = x2; verts[1].y = y2; + verts[2].x = x2; verts[2].y = y1; + verts[3].x = x1; verts[3].y = y1; + verts[0].tx = 0; verts[0].ty = 0; + verts[1].tx = 1.0; verts[1].ty = 0; + verts[2].tx = 1.0; verts[2].ty = 1.0; + verts[3].tx = 0; verts[3].ty = 1.0; + cogl_polygon (verts, 4, FALSE); + + x1 = x2; + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + /* Draw a back-facing polygon */ + verts[0].x = x1; verts[0].y = y1; + verts[1].x = x2; verts[1].y = y1; + verts[2].x = x2; verts[2].y = y2; + verts[3].x = x1; verts[3].y = y2; + verts[0].tx = 0; verts[0].ty = 0; + verts[1].tx = 1.0; verts[1].ty = 0; + verts[2].tx = 1.0; verts[2].ty = 1.0; + verts[3].tx = 0; verts[3].ty = 1.0; + cogl_polygon (verts, 4, FALSE); + + x1 = x2; + x2 = x1 + (float)(TEXTURE_RENDER_SIZE); + + cogl_pop_matrix (); + + cogl_pop_source (); + cogl_object_unref (pipeline); + } + + cogl_pop_framebuffer (); + + cogl_object_unref (base_pipeline); +} + +static void +validate_result (CoglFramebuffer *framebuffer, int y_offset) +{ + int draw_num; + + for (draw_num = 0; draw_num < 16; draw_num++) + { + CoglBool cull_front, cull_back; + CoglPipelineCullFaceMode cull_mode; + + if (USE_LEGACY_STATE (draw_num)) + cull_mode = COGL_PIPELINE_CULL_FACE_MODE_BACK; + else + cull_mode = CULL_FACE_MODE (draw_num); + + switch (cull_mode) + { + case COGL_PIPELINE_CULL_FACE_MODE_NONE: + cull_front = FALSE; + cull_back = FALSE; + break; + + case COGL_PIPELINE_CULL_FACE_MODE_FRONT: + cull_front = TRUE; + cull_back = FALSE; + break; + + case COGL_PIPELINE_CULL_FACE_MODE_BACK: + cull_front = FALSE; + cull_back = TRUE; + break; + + case COGL_PIPELINE_CULL_FACE_MODE_BOTH: + cull_front = TRUE; + cull_back = TRUE; + break; + } + + if (FRONT_WINDING (draw_num) == COGL_WINDING_CLOCKWISE) + { + CoglBool tmp = cull_front; + cull_front = cull_back; + cull_back = tmp; + } + + /* Front-facing texture */ + validate_part (framebuffer, + 0, y_offset + draw_num, !cull_front); + /* Front-facing texture with flipped tex coords */ + validate_part (framebuffer, + 1, y_offset + draw_num, !cull_front); + /* Back-facing texture */ + validate_part (framebuffer, + 2, y_offset + draw_num, !cull_back); + /* Front-facing texture polygon */ + validate_part (framebuffer, + 3, y_offset + draw_num, !cull_front); + /* Back-facing texture polygon */ + validate_part (framebuffer, + 4, y_offset + draw_num, !cull_back); + } +} + +static void +paint (TestState *state) +{ + CoglPipeline *pipeline; + + paint_test_backface_culling (state, test_fb); + + /* + * Now repeat the test but rendered to an offscreen + * framebuffer. Note that by default the conformance tests are + * always run to an offscreen buffer but we might as well have this + * check anyway in case it is being run with COGL_TEST_ONSCREEN=1 + */ + paint_test_backface_culling (state, state->offscreen); + + /* Copy the result of the offscreen rendering for validation and + * also so we can have visual feedback. */ + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex); + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 0, TEXTURE_RENDER_SIZE * 16, + state->width, + state->height + TEXTURE_RENDER_SIZE * 16); + cogl_object_unref (pipeline); + + validate_result (test_fb, 0); + validate_result (test_fb, 16); +} + +static CoglTexture * +make_texture (void) +{ + guchar *tex_data, *p; + CoglTexture *tex; + + tex_data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4); + + for (p = tex_data + TEXTURE_SIZE * TEXTURE_SIZE * 4; p > tex_data;) + { + *(--p) = 255; + *(--p) = 0; + *(--p) = 0; + *(--p) = 255; + } + + tex = test_utils_texture_new_from_data (test_ctx, + TEXTURE_SIZE, + TEXTURE_SIZE, + TEST_UTILS_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGBA_8888, + TEXTURE_SIZE * 4, + tex_data); + + g_free (tex_data); + + return tex; +} + +void +test_backface_culling (void) +{ + TestState state; + CoglTexture *tex; + + state.width = cogl_framebuffer_get_width (test_fb); + state.height = cogl_framebuffer_get_height (test_fb); + + state.offscreen = NULL; + + state.texture = make_texture (); + + tex = test_utils_texture_new_with_size (test_ctx, + state.width, state.height, + TEST_UTILS_TEXTURE_NO_SLICING, + COGL_TEXTURE_COMPONENTS_RGBA); + state.offscreen = cogl_offscreen_new_with_texture (tex); + state.offscreen_tex = tex; + + paint (&state); + + cogl_object_unref (state.offscreen); + cogl_object_unref (state.offscreen_tex); + cogl_object_unref (state.texture); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-blend-strings.c b/tests/conform/test-blend-strings.c new file mode 100644 index 0000000..f49c860 --- /dev/null +++ b/tests/conform/test-blend-strings.c @@ -0,0 +1,430 @@ +#include + +#include + +#include "test-utils.h" + +#define QUAD_WIDTH 20 + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define ALPHA 3 + +#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24) +#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16) +#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8) +#define MASK_ALPHA(COLOR) (COLOR & 0xff) + +#define BLEND_CONSTANT_UNUSED 0xDEADBEEF +#define TEX_CONSTANT_UNUSED 0xDEADBEEF + +typedef struct _TestState +{ + CoglContext *ctx; +} TestState; + + +static void +test_blend (TestState *state, + int x, + int y, + uint32_t src_color, + uint32_t dst_color, + const char *blend_string, + uint32_t blend_constant, + uint32_t expected_result) +{ + /* src color */ + uint8_t Sr = MASK_RED (src_color); + uint8_t Sg = MASK_GREEN (src_color); + uint8_t Sb = MASK_BLUE (src_color); + uint8_t Sa = MASK_ALPHA (src_color); + /* dest color */ + uint8_t Dr = MASK_RED (dst_color); + uint8_t Dg = MASK_GREEN (dst_color); + uint8_t Db = MASK_BLUE (dst_color); + uint8_t Da = MASK_ALPHA (dst_color); + /* blend constant - when applicable */ + uint8_t Br = MASK_RED (blend_constant); + uint8_t Bg = MASK_GREEN (blend_constant); + uint8_t Bb = MASK_BLUE (blend_constant); + uint8_t Ba = MASK_ALPHA (blend_constant); + CoglColor blend_const_color; + + CoglHandle material; + CoglPipeline *pipeline; + CoglBool status; + CoglError *error = NULL; + int y_off; + int x_off; + + /* First write out the destination color without any blending... */ + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_color4ub (pipeline, Dr, Dg, Db, Da); + cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL); + cogl_set_source (pipeline); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_object_unref (pipeline); + + /* + * Now blend a rectangle over our well defined destination: + */ + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_color4ub (pipeline, Sr, Sg, Sb, Sa); + + status = cogl_pipeline_set_blend (pipeline, blend_string, &error); + if (!status) + { + /* It's not strictly a test failure; you need a more capable GPU or + * driver to test this blend string. */ + if (cogl_test_verbose ()) + { + g_debug ("Failed to test blend string %s: %s", + blend_string, error->message); + g_print ("Skipping\n"); + } + return; + } + + cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba); + cogl_pipeline_set_blend_constant (pipeline, &blend_const_color); + + cogl_set_source (pipeline); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_object_unref (pipeline); + + /* See what we got... */ + + y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2); + x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2); + + if (cogl_test_verbose ()) + { + g_print ("test_blend (%d, %d):\n%s\n", x, y, blend_string); + g_print (" src color = %02x, %02x, %02x, %02x\n", Sr, Sg, Sb, Sa); + g_print (" dst color = %02x, %02x, %02x, %02x\n", Dr, Dg, Db, Da); + if (blend_constant != BLEND_CONSTANT_UNUSED) + g_print (" blend constant = %02x, %02x, %02x, %02x\n", + Br, Bg, Bb, Ba); + else + g_print (" blend constant = UNUSED\n"); + } + + test_utils_check_pixel (test_fb, x_off, y_off, expected_result); + + + /* + * Test with legacy API + */ + + /* Clear previous work */ + cogl_set_source_color4ub (0, 0, 0, 0xff); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + + /* First write out the destination color without any blending... */ + material = cogl_material_new (); + cogl_material_set_color4ub (material, Dr, Dg, Db, Da); + cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL); + cogl_set_source (material); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_handle_unref (material); + + /* + * Now blend a rectangle over our well defined destination: + */ + + material = cogl_material_new (); + cogl_material_set_color4ub (material, Sr, Sg, Sb, Sa); + + status = cogl_material_set_blend (material, blend_string, &error); + if (!status) + { + /* This is a failure as it must be equivalent to the new API */ + g_warning ("Error setting blend string %s: %s", + blend_string, error->message); + g_assert_not_reached (); + } + + cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba); + cogl_material_set_blend_constant (material, &blend_const_color); + + cogl_set_source (material); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_handle_unref (material); + + /* See what we got... */ + + test_utils_check_pixel (test_fb, x_off, y_off, expected_result); +} + +static CoglTexture * +make_texture (uint32_t color) +{ + guchar *tex_data, *p; + uint8_t r = MASK_RED (color); + uint8_t g = MASK_GREEN (color); + uint8_t b = MASK_BLUE (color); + uint8_t a = MASK_ALPHA (color); + CoglTexture *tex; + + tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 4); + + for (p = tex_data + QUAD_WIDTH * QUAD_WIDTH * 4; p > tex_data;) + { + *(--p) = a; + *(--p) = b; + *(--p) = g; + *(--p) = r; + } + + /* Note: we claim that the data is premultiplied so that Cogl won't + * premultiply the data on upload */ + tex = test_utils_texture_new_from_data (test_ctx, + QUAD_WIDTH, + QUAD_WIDTH, + TEST_UTILS_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + QUAD_WIDTH * 4, + tex_data); + + g_free (tex_data); + + return tex; +} + +static void +test_tex_combine (TestState *state, + int x, + int y, + uint32_t tex0_color, + uint32_t tex1_color, + uint32_t combine_constant, + const char *combine_string, + uint32_t expected_result) +{ + CoglTexture *tex0, *tex1; + + /* combine constant - when applicable */ + uint8_t Cr = MASK_RED (combine_constant); + uint8_t Cg = MASK_GREEN (combine_constant); + uint8_t Cb = MASK_BLUE (combine_constant); + uint8_t Ca = MASK_ALPHA (combine_constant); + CoglColor combine_const_color; + + CoglHandle material; + CoglBool status; + CoglError *error = NULL; + int y_off; + int x_off; + + + tex0 = make_texture (tex0_color); + tex1 = make_texture (tex1_color); + + material = cogl_material_new (); + + cogl_material_set_color4ub (material, 0x80, 0x80, 0x80, 0x80); + cogl_material_set_blend (material, "RGBA = ADD (SRC_COLOR, 0)", NULL); + + cogl_material_set_layer (material, 0, tex0); + cogl_material_set_layer_combine (material, 0, + "RGBA = REPLACE (TEXTURE)", NULL); + + cogl_material_set_layer (material, 1, tex1); + status = cogl_material_set_layer_combine (material, 1, + combine_string, &error); + if (!status) + { + /* It's not strictly a test failure; you need a more capable GPU or + * driver to test this texture combine string. */ + g_debug ("Failed to test texture combine string %s: %s", + combine_string, error->message); + } + + cogl_color_init_from_4ub (&combine_const_color, Cr, Cg, Cb, Ca); + cogl_material_set_layer_combine_constant (material, 1, &combine_const_color); + + cogl_set_source (material); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + + cogl_handle_unref (material); + cogl_object_unref (tex0); + cogl_object_unref (tex1); + + /* See what we got... */ + + y_off = y * QUAD_WIDTH + (QUAD_WIDTH / 2); + x_off = x * QUAD_WIDTH + (QUAD_WIDTH / 2); + + if (cogl_test_verbose ()) + { + g_print ("test_tex_combine (%d, %d):\n%s\n", x, y, combine_string); + g_print (" texture 0 color = 0x%08lX\n", (unsigned long)tex0_color); + g_print (" texture 1 color = 0x%08lX\n", (unsigned long)tex1_color); + if (combine_constant != TEX_CONSTANT_UNUSED) + g_print (" combine constant = %02x, %02x, %02x, %02x\n", + Cr, Cg, Cb, Ca); + else + g_print (" combine constant = UNUSED\n"); + } + + test_utils_check_pixel (test_fb, x_off, y_off, expected_result); +} + +static void +paint (TestState *state) +{ + test_blend (state, 0, 0, /* position */ + 0xff0000ff, /* src */ + 0xffffffff, /* dst */ + "RGBA = ADD (SRC_COLOR, 0)", + BLEND_CONSTANT_UNUSED, + 0xff0000ff); /* expected */ + + test_blend (state, 1, 0, /* position */ + 0x11223344, /* src */ + 0x11223344, /* dst */ + "RGBA = ADD (SRC_COLOR, DST_COLOR)", + BLEND_CONSTANT_UNUSED, + 0x22446688); /* expected */ + + test_blend (state, 2, 0, /* position */ + 0x80808080, /* src */ + 0xffffffff, /* dst */ + "RGBA = ADD (SRC_COLOR * (CONSTANT), 0)", + 0x80808080, /* constant (RGBA all = 0.5 when normalized) */ + 0x40404040); /* expected */ + + test_blend (state, 3, 0, /* position */ + 0x80000080, /* src (alpha = 0.5 when normalized) */ + 0x40000000, /* dst */ + "RGBA = ADD (SRC_COLOR * (SRC_COLOR[A])," + " DST_COLOR * (1-SRC_COLOR[A]))", + BLEND_CONSTANT_UNUSED, + 0x60000040); /* expected */ + + /* XXX: + * For all texture combine tests tex0 will use a combine mode of + * "RGBA = REPLACE (TEXTURE)" + */ + + test_tex_combine (state, 4, 0, /* position */ + 0x11111111, /* texture 0 color */ + 0x22222222, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = ADD (PREVIOUS, TEXTURE)", /* tex combine */ + 0x33333333); /* expected */ + + test_tex_combine (state, 5, 0, /* position */ + 0x40404040, /* texture 0 color */ + 0x80808080, /* texture 1 color (RGBA all = 0.5) */ + TEX_CONSTANT_UNUSED, + "RGBA = MODULATE (PREVIOUS, TEXTURE)", /* tex combine */ + 0x20202020); /* expected */ + + test_tex_combine (state, 6, 0, /* position */ + 0xffffff80, /* texture 0 color (alpha = 0.5) */ + 0xDEADBE40, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGB = REPLACE (PREVIOUS)" + "A = MODULATE (PREVIOUS, TEXTURE)", /* tex combine */ + 0xffffff20); /* expected */ + + /* XXX: we are assuming test_tex_combine creates a material with + * a color of 0x80808080 (i.e. the "PRIMARY" color) */ + test_tex_combine (state, 7, 0, /* position */ + 0xffffff80, /* texture 0 color (alpha = 0.5) */ + 0xDEADBE20, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGB = REPLACE (PREVIOUS)" + "A = MODULATE (PRIMARY, TEXTURE)", /* tex combine */ + 0xffffff10); /* expected */ + + test_tex_combine (state, 8, 0, /* position */ + 0x11111111, /* texture 0 color */ + 0x22222222, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = ADD (PREVIOUS, 1-TEXTURE)", /* tex combine */ + 0xeeeeeeee); /* expected */ + + /* this is again assuming a primary color of 0x80808080 */ + test_tex_combine (state, 9, 0, /* position */ + 0x10101010, /* texture 0 color */ + 0x20202020, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = INTERPOLATE (PREVIOUS, TEXTURE, PRIMARY)", + 0x18181818); /* expected */ + +#if 0 /* using TEXTURE_N appears to be broken in cogl-blend-string.c */ + test_tex_combine (state, 0, 1, /* position */ + 0xDEADBEEF, /* texture 0 color (not used) */ + 0x11223344, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = ADD (TEXTURE_1, TEXTURE)", /* tex combine */ + 0x22446688); /* expected */ +#endif + + test_tex_combine (state, 1, 1, /* position */ + 0x21314151, /* texture 0 color */ + 0x99999999, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = ADD_SIGNED (PREVIOUS, TEXTURE)", /* tex combine */ + 0x3a4a5a6a); /* expected */ + + test_tex_combine (state, 2, 1, /* position */ + 0xfedcba98, /* texture 0 color */ + 0x11111111, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGBA = SUBTRACT (PREVIOUS, TEXTURE)", /* tex combine */ + 0xedcba987); /* expected */ + + test_tex_combine (state, 3, 1, /* position */ + 0x8899aabb, /* texture 0 color */ + 0xbbaa9988, /* texture 1 color */ + TEX_CONSTANT_UNUSED, + "RGB = DOT3_RGBA (PREVIOUS, TEXTURE)" + "A = REPLACE (PREVIOUS)", + 0x2a2a2abb); /* expected */ +} + +void +test_blend_strings (void) +{ + TestState state; + + cogl_framebuffer_orthographic (test_fb, 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (test_fb); + paint (&state); + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-blend.c b/tests/conform/test-blend.c new file mode 100644 index 0000000..3c6235b --- /dev/null +++ b/tests/conform/test-blend.c @@ -0,0 +1,64 @@ +#include + +#include + +#include "test-utils.h" + +static void +paint (void) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + int width = cogl_framebuffer_get_width (test_fb); + int half_width = width / 2; + int height = cogl_framebuffer_get_height (test_fb); + CoglVertexP2 tri0_vertices[] = { + { 0, 0 }, + { 0, height }, + { half_width, height }, + }; + CoglVertexP2C4 tri1_vertices[] = { + { half_width, 0, 0x80, 0x80, 0x80, 0x80 }, + { half_width, height, 0x80, 0x80, 0x80, 0x80 }, + { width, height, 0x80, 0x80, 0x80, 0x80 }, + }; + CoglPrimitive *tri0; + CoglPrimitive *tri1; + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 0); + + tri0 = cogl_primitive_new_p2 (test_ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, tri0_vertices); + tri1 = cogl_primitive_new_p2c4 (test_ctx, COGL_VERTICES_MODE_TRIANGLES, + 3, tri1_vertices); + + /* Check that cogl correctly handles the case where we draw + * different primitives same pipeline and switch from using the + * opaque color associated with the pipeline and using a colour + * attribute with an alpha component which implies blending is + * required. + * + * If Cogl gets this wrong then then in all likelyhood the second + * primitive will be drawn with blending still disabled. + */ + + cogl_primitive_draw (tri0, test_fb, pipeline); + cogl_primitive_draw (tri1, test_fb, pipeline); + + test_utils_check_pixel_and_alpha (test_fb, + half_width + 5, + height - 5, + 0x80808080); +} + +void +test_blend (void) +{ + cogl_framebuffer_orthographic (test_fb, 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (); +} + diff --git a/tests/conform/test-color-hsl.c b/tests/conform/test-color-hsl.c new file mode 100644 index 0000000..651ce52 --- /dev/null +++ b/tests/conform/test-color-hsl.c @@ -0,0 +1,45 @@ +#include +#include + +#include + +#include "test-utils.h" + +#define cogl_assert_float(a, b) \ + do { \ + if (fabsf ((a) - (b)) >= 0.0001f) \ + g_assert_cmpfloat ((a), ==, (b)); \ + } while (0) + +void +test_color_hsl (void) +{ + CoglColor color; + float hue, saturation, luminance; + + cogl_color_init_from_4ub(&color, 108, 198, 78, 255); + cogl_color_to_hsl(&color, &hue, &saturation, &luminance); + + cogl_assert_float(hue, 105.f); + cogl_assert_float(saturation, 0.512821); + cogl_assert_float(luminance, 0.541176); + + memset(&color, 0, sizeof (CoglColor)); + cogl_color_init_from_hsl(&color, hue, saturation, luminance); + + g_assert_cmpint (cogl_color_get_red_byte (&color), ==, 108); + g_assert_cmpint (cogl_color_get_green_byte (&color), ==, 198); + g_assert_cmpint (cogl_color_get_blue_byte (&color), ==, 78); + g_assert_cmpint (cogl_color_get_alpha_byte (&color), ==, 255); + + memset(&color, 0, sizeof (CoglColor)); + cogl_color_init_from_hsl(&color, hue, 0, luminance); + + cogl_assert_float (cogl_color_get_red_float (&color), luminance); + cogl_assert_float (cogl_color_get_green_float (&color), luminance); + cogl_assert_float (cogl_color_get_blue_float (&color), luminance); + cogl_assert_float (cogl_color_get_alpha_float (&color), 1.0f); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-color-mask.c b/tests/conform/test-color-mask.c new file mode 100644 index 0000000..e80f46d --- /dev/null +++ b/tests/conform/test-color-mask.c @@ -0,0 +1,110 @@ +#include + +#include "test-utils.h" + +#define TEX_SIZE 128 + +#define NUM_FBOS 3 + +typedef struct _TestState +{ + int width; + int height; + + CoglTexture *tex[NUM_FBOS]; + CoglFramebuffer *fbo[NUM_FBOS]; +} TestState; + +static void +paint (TestState *state) +{ + CoglColor bg; + int i; + + cogl_set_source_color4ub (255, 255, 255, 255); + + /* We push the third framebuffer first so that later we can switch + back to it by popping to test that that works */ + cogl_push_framebuffer (state->fbo[2]); + + cogl_push_framebuffer (state->fbo[0]); + cogl_rectangle (-1.0, -1.0, 1.0, 1.0); + cogl_pop_framebuffer (); + + cogl_push_framebuffer (state->fbo[1]); + cogl_rectangle (-1.0, -1.0, 1.0, 1.0); + cogl_pop_framebuffer (); + + /* We should now be back on the third framebuffer */ + cogl_rectangle (-1.0, -1.0, 1.0, 1.0); + cogl_pop_framebuffer (); + + cogl_color_init_from_4ub (&bg, 128, 128, 128, 255); + cogl_clear (&bg, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH); + + /* Render all of the textures to the screen */ + for (i = 0; i < NUM_FBOS; i++) + { + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, + 2.0f / NUM_FBOS * i - 1.0f, -1.0f, + 2.0f / NUM_FBOS * (i + 1) - 1.0f, 1.0f); + cogl_object_unref (pipeline); + } + + /* Verify all of the fbos drew the right color */ + for (i = 0; i < NUM_FBOS; i++) + { + uint8_t expected_colors[NUM_FBOS][4] = + { { 0xff, 0x00, 0x00, 0xff }, + { 0x00, 0xff, 0x00, 0xff }, + { 0x00, 0x00, 0xff, 0xff } }; + + test_utils_check_pixel_rgb (test_fb, + state->width * (i + 0.5f) / NUM_FBOS, + state->height / 2, + expected_colors[i][0], + expected_colors[i][1], + expected_colors[i][2]); + } +} + +void +test_color_mask (void) +{ + TestState state; + int i; + + state.width = cogl_framebuffer_get_width (test_fb); + state.height = cogl_framebuffer_get_height (test_fb); + + for (i = 0; i < NUM_FBOS; i++) + { + state.tex[i] = test_utils_texture_new_with_size (test_ctx, 128, 128, + TEST_UTILS_TEXTURE_NO_ATLAS, + COGL_TEXTURE_COMPONENTS_RGB); + + + state.fbo[i] = cogl_offscreen_new_with_texture (state.tex[i]); + + /* Clear the texture color bits */ + cogl_framebuffer_clear4f (state.fbo[i], + COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_set_color_mask (state.fbo[i], + i == 0 ? COGL_COLOR_MASK_RED : + i == 1 ? COGL_COLOR_MASK_GREEN : + COGL_COLOR_MASK_BLUE); + } + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (test_fb); + paint (&state); + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c new file mode 100644 index 0000000..63210d0 --- /dev/null +++ b/tests/conform/test-conform-main.c @@ -0,0 +1,157 @@ +#include "config.h" + +#include + +#include +#include +#include +#include + +#include "test-utils.h" + +/* A bit of sugar for adding new conformance tests */ +#define ADD_TEST(FUNC, REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS) \ + G_STMT_START { \ + extern void FUNC (void); \ + if (strcmp (#FUNC, argv[1]) == 0) \ + { \ + test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS); \ + FUNC (); \ + test_utils_fini (); \ + exit (0); \ + } \ + } G_STMT_END + +#define UNPORTED_TEST(FUNC) + +int +main (int argc, char **argv) +{ + int i; + + if (argc != 2) + { + g_printerr ("usage %s UNIT_TEST\n", argv[0]); + exit (1); + } + + /* Just for convenience in case people try passing the wrapper + * filenames for the UNIT_TEST argument we normalize '-' characters + * to '_' characters... */ + for (i = 0; argv[1][i]; i++) + { + if (argv[1][i] == '-') + argv[1][i] = '_'; + } + + /* This file is run through a sed script during the make step so the + * lines containing the tests need to be formatted on a single line + * each. + */ + + UNPORTED_TEST (test_object); + UNPORTED_TEST (test_fixed); + UNPORTED_TEST (test_materials); + ADD_TEST (test_pipeline_user_matrix, 0, 0); + ADD_TEST (test_blend_strings, 0, 0); + ADD_TEST (test_blend, 0, 0); + ADD_TEST (test_premult, 0, 0); + UNPORTED_TEST (test_readpixels); +#ifdef COGL_HAS_COGL_PATH_SUPPORT + ADD_TEST (test_path, 0, 0); + ADD_TEST (test_path_clip, 0, 0); +#endif + ADD_TEST (test_depth_test, 0, 0); + ADD_TEST (test_color_mask, 0, 0); + ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT); + ADD_TEST (test_layer_remove, 0, 0); + + ADD_TEST (test_sparse_pipeline, 0, 0); + + ADD_TEST (test_npot_texture, 0, 0); + UNPORTED_TEST (test_multitexture); + UNPORTED_TEST (test_texture_mipmaps); + ADD_TEST (test_sub_texture, 0, 0); + ADD_TEST (test_pixel_buffer_map, 0, 0); + ADD_TEST (test_pixel_buffer_set_data, 0, 0); + ADD_TEST (test_pixel_buffer_sub_region, 0, 0); + UNPORTED_TEST (test_texture_rectangle); + ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D, 0); + ADD_TEST (test_wrap_modes, 0, 0); + UNPORTED_TEST (test_texture_pixmap_x11); + ADD_TEST (test_texture_get_set_data, 0, 0); + ADD_TEST (test_atlas_migration, 0, 0); + ADD_TEST (test_read_texture_formats, 0, 0); + ADD_TEST (test_write_texture_formats, 0, 0); + ADD_TEST (test_alpha_textures, 0, 0); + ADD_TEST (test_wrap_rectangle_textures, + TEST_REQUIREMENT_TEXTURE_RECTANGLE, + TEST_KNOWN_FAILURE); + + UNPORTED_TEST (test_vertex_buffer_contiguous); + UNPORTED_TEST (test_vertex_buffer_interleved); + UNPORTED_TEST (test_vertex_buffer_mutability); + + ADD_TEST (test_primitive, 0, 0); + + ADD_TEST (test_just_vertex_shader, TEST_REQUIREMENT_GLSL, 0); + ADD_TEST (test_pipeline_uniforms, TEST_REQUIREMENT_GLSL, 0); + ADD_TEST (test_snippets, TEST_REQUIREMENT_GLSL, 0); + ADD_TEST (test_custom_attributes, TEST_REQUIREMENT_GLSL, 0); + + ADD_TEST (test_offscreen, 0, 0); + ADD_TEST (test_framebuffer_get_bits, + TEST_REQUIREMENT_OFFSCREEN | TEST_REQUIREMENT_GL, + 0); + + ADD_TEST (test_point_size, 0, 0); + ADD_TEST (test_point_size_attribute, + TEST_REQUIREMENT_PER_VERTEX_POINT_SIZE, 0); + ADD_TEST (test_point_size_attribute_snippet, + TEST_REQUIREMENT_PER_VERTEX_POINT_SIZE | + TEST_REQUIREMENT_GLSL, 0); + ADD_TEST (test_point_sprite, + TEST_REQUIREMENT_POINT_SPRITE, + 0); + ADD_TEST (test_point_sprite_orientation, + TEST_REQUIREMENT_POINT_SPRITE, + TEST_KNOWN_FAILURE); + ADD_TEST (test_point_sprite_glsl, + TEST_REQUIREMENT_POINT_SPRITE | + TEST_REQUIREMENT_GLSL, + 0); + + ADD_TEST (test_version, 0, 0); + + ADD_TEST (test_alpha_test, 0, 0); + + ADD_TEST (test_map_buffer_range, TEST_REQUIREMENT_MAP_WRITE, 0); + + ADD_TEST (test_primitive_and_journal, 0, 0); + + ADD_TEST (test_copy_replace_texture, 0, 0); + + ADD_TEST (test_pipeline_cache_unrefs_texture, 0, 0); + ADD_TEST (test_pipeline_shader_state, TEST_REQUIREMENT_GLSL, 0); + + UNPORTED_TEST (test_viewport); + + ADD_TEST (test_gles2_context, TEST_REQUIREMENT_GLES2_CONTEXT, 0); + ADD_TEST (test_gles2_context_fbo, TEST_REQUIREMENT_GLES2_CONTEXT, 0); + ADD_TEST (test_gles2_context_copy_tex_image, + TEST_REQUIREMENT_GLES2_CONTEXT, + 0); + + ADD_TEST (test_euler_quaternion, 0, 0); + ADD_TEST (test_color_hsl, 0, 0); + + ADD_TEST (test_fence, TEST_REQUIREMENT_FENCE, 0); + + ADD_TEST (test_texture_no_allocate, 0, 0); + + ADD_TEST (test_texture_rg, TEST_REQUIREMENT_TEXTURE_RG, 0); + + g_printerr ("Unknown test name \"%s\"\n", argv[1]); + + return 1; +} diff --git a/tests/conform/test-copy-replace-texture.c b/tests/conform/test-copy-replace-texture.c new file mode 100644 index 0000000..f11070e --- /dev/null +++ b/tests/conform/test-copy-replace-texture.c @@ -0,0 +1,120 @@ +#include +#include + +#include "test-utils.h" + +/* Keep track of the number of textures that we've created and are + * still alive */ +static int alive_texture_mask = 0; + +#define N_LAYERS 3 +#define N_PIPELINES 4 + +#define PIPELINE_LAYER_MASK(pipeline_num) \ + (((1 << N_LAYERS) - 1) << (N_LAYERS * (pipeline_num) + 1)) +#define LAST_PIPELINE_MASK PIPELINE_LAYER_MASK (N_PIPELINES - 1) +#define FIRST_PIPELINE_MASK PIPELINE_LAYER_MASK (0) + +static void +free_texture_cb (void *user_data) +{ + int texture_num = GPOINTER_TO_INT (user_data); + + alive_texture_mask &= ~(1 << texture_num); +} + +static CoglTexture * +create_texture (void) +{ + static const guint8 data[] = + { 0xff, 0xff, 0xff, 0xff }; + static CoglUserDataKey texture_data_key; + CoglTexture2D *tex_2d; + static int texture_num = 1; + + alive_texture_mask |= (1 << texture_num); + + tex_2d = cogl_texture_2d_new_from_data (test_ctx, + 1, 1, /* width / height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + data, + NULL); + + /* Set some user data on the texture so we can track when it has + * been destroyed */ + cogl_object_set_user_data (COGL_OBJECT (tex_2d), + &texture_data_key, + GINT_TO_POINTER (texture_num), + free_texture_cb); + + texture_num++; + + return tex_2d; +} + +void +test_copy_replace_texture (void) +{ + CoglPipeline *pipelines[N_PIPELINES]; + int pipeline_num; + + /* Create a set of pipeline copies each with three of their own + * replacement textures */ + for (pipeline_num = 0; pipeline_num < N_PIPELINES; pipeline_num++) + { + int layer_num; + + if (pipeline_num == 0) + pipelines[pipeline_num] = cogl_pipeline_new (test_ctx); + else + pipelines[pipeline_num] = + cogl_pipeline_copy (pipelines[pipeline_num - 1]); + + for (layer_num = 0; layer_num < N_LAYERS; layer_num++) + { + CoglTexture *tex = create_texture (); + cogl_pipeline_set_layer_texture (pipelines[pipeline_num], + layer_num, + tex); + cogl_object_unref (tex); + } + } + + /* Unref everything but the last pipeline */ + for (pipeline_num = 0; pipeline_num < N_PIPELINES - 1; pipeline_num++) + cogl_object_unref (pipelines[pipeline_num]); + + if (alive_texture_mask && cogl_test_verbose ()) + { + int i; + + g_print ("Alive textures:"); + + for (i = 0; i < N_PIPELINES * N_LAYERS; i++) + if ((alive_texture_mask & (1 << (i + 1)))) + g_print (" %i", i); + + g_print ("\n"); + } + + /* Ideally there should only be the textures from the last pipeline + * left alive. We also let Cogl keep the textures from the first + * texture alive because currently the child of the third layer in + * the first pipeline will retain its authority on the unit index + * state so that it can set it to 2. If there are more textures then + * it means the pipeline isn't correctly pruning redundant + * ancestors */ + g_assert_cmpint (alive_texture_mask & ~FIRST_PIPELINE_MASK, + ==, + LAST_PIPELINE_MASK); + + /* Clean up the last pipeline */ + cogl_object_unref (pipelines[N_PIPELINES - 1]); + + /* That should get rid of the last of the textures */ + g_assert_cmpint (alive_texture_mask, ==, 0); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c new file mode 100644 index 0000000..633dc2a --- /dev/null +++ b/tests/conform/test-custom-attributes.c @@ -0,0 +1,301 @@ +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + CoglPipeline *pipeline; +} TestState; + +typedef struct +{ + int16_t x, y; + float r, g, b, a; +} FloatVert; + +typedef struct +{ + int16_t x, y; + uint8_t r, g, b, a; +} ByteVert; + +typedef struct +{ + int16_t x, y; + int16_t r, g, b, a; +} ShortVert; + +static void +test_float_verts (TestState *state, int offset_x, int offset_y) +{ + CoglAttribute *attributes[2]; + CoglAttributeBuffer *buffer; + CoglPrimitive *primitive; + + static const FloatVert float_verts[] = + { + { 0, 10, /**/ 1, 0, 0, 1 }, + { 10, 10, /**/ 1, 0, 0, 1 }, + { 5, 0, /**/ 1, 0, 0, 1 }, + + { 10, 10, /**/ 0, 1, 0, 1 }, + { 20, 10, /**/ 0, 1, 0, 1 }, + { 15, 0, /**/ 0, 1, 0, 1 } + }; + + buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (float_verts), float_verts); + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (FloatVert), + G_STRUCT_OFFSET (FloatVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_SHORT); + attributes[1] = cogl_attribute_new (buffer, + "color", + sizeof (FloatVert), + G_STRUCT_OFFSET (FloatVert, r), + 4, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f); + + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 6, /* n_vertices */ + attributes, + 2); /* n_attributes */ + cogl_primitive_draw (primitive, test_fb, state->pipeline); + cogl_object_unref (primitive); + + cogl_framebuffer_pop_matrix (test_fb); + + cogl_object_unref (attributes[1]); + cogl_object_unref (attributes[0]); + cogl_object_unref (buffer); + + test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff); +} + +static void +test_byte_verts (TestState *state, int offset_x, int offset_y) +{ + CoglAttribute *attributes[2]; + CoglAttributeBuffer *buffer, *unnorm_buffer; + CoglPrimitive *primitive; + + static const ByteVert norm_verts[] = + { + { 0, 10, /**/ 255, 0, 0, 255 }, + { 10, 10, /**/ 255, 0, 0, 255 }, + { 5, 0, /**/ 255, 0, 0, 255 }, + + { 10, 10, /**/ 0, 255, 0, 255 }, + { 20, 10, /**/ 0, 255, 0, 255 }, + { 15, 0, /**/ 0, 255, 0, 255 } + }; + + static const ByteVert unnorm_verts[] = + { + { 0, 0, /**/ 0, 0, 1, 1 }, + { 0, 0, /**/ 0, 0, 1, 1 }, + { 0, 0, /**/ 0, 0, 1, 1 }, + }; + + buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (norm_verts), norm_verts); + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (ByteVert), + G_STRUCT_OFFSET (ByteVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_SHORT); + attributes[1] = cogl_attribute_new (buffer, + "color", + sizeof (ByteVert), + G_STRUCT_OFFSET (ByteVert, r), + 4, /* n_components */ + COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); + cogl_attribute_set_normalized (attributes[1], TRUE); + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f); + + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 6, /* n_vertices */ + attributes, + 2); /* n_attributes */ + cogl_primitive_draw (primitive, test_fb, state->pipeline); + cogl_object_unref (primitive); + + cogl_object_unref (attributes[1]); + + /* Test again with unnormalized attributes */ + unnorm_buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (unnorm_verts), + unnorm_verts); + attributes[1] = cogl_attribute_new (unnorm_buffer, + "color", + sizeof (ByteVert), + G_STRUCT_OFFSET (ByteVert, r), + 4, /* n_components */ + COGL_ATTRIBUTE_TYPE_BYTE); + + cogl_framebuffer_translate (test_fb, 20, 0, 0); + + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + attributes, + 2); /* n_attributes */ + cogl_primitive_draw (primitive, test_fb, state->pipeline); + cogl_object_unref (primitive); + + cogl_framebuffer_pop_matrix (test_fb); + + cogl_object_unref (attributes[0]); + cogl_object_unref (attributes[1]); + cogl_object_unref (buffer); + cogl_object_unref (unnorm_buffer); + + test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff); + test_utils_check_pixel (test_fb, offset_x + 25, offset_y + 5, 0x0000ffff); +} + +static void +test_short_verts (TestState *state, int offset_x, int offset_y) +{ + CoglAttribute *attributes[2]; + CoglAttributeBuffer *buffer; + CoglPipeline *pipeline, *pipeline2; + CoglSnippet *snippet; + CoglPrimitive *primitive; + + static const ShortVert short_verts[] = + { + { -10, -10, /**/ 0xffff, 0, 0, 0xffff }, + { -1, -10, /**/ 0xffff, 0, 0, 0xffff }, + { -5, -1, /**/ 0xffff, 0, 0, 0xffff } + }; + + + pipeline = cogl_pipeline_copy (state->pipeline); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + + buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (short_verts), short_verts); + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (ShortVert), + G_STRUCT_OFFSET (ShortVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_SHORT); + attributes[1] = cogl_attribute_new (buffer, + "color", + sizeof (ShortVert), + G_STRUCT_OFFSET (ShortVert, r), + 4, /* n_components */ + COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT); + cogl_attribute_set_normalized (attributes[1], TRUE); + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, + offset_x + 10.0f, + offset_y + 10.0f, + 0.0f); + + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + attributes, + 2); /* n_attributes */ + cogl_primitive_draw (primitive, test_fb, pipeline); + cogl_object_unref (primitive); + + cogl_framebuffer_pop_matrix (test_fb); + + cogl_object_unref (attributes[0]); + + /* Test again treating the attribute as unsigned */ + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (ShortVert), + G_STRUCT_OFFSET (ShortVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT); + + /* XXX: this is a hack to force the pipeline to use the glsl backend + * because we know it's not possible to test short vertex position + * components with the legacy GL backend since which might otherwise + * be used internally... */ + pipeline2 = cogl_pipeline_new (test_ctx); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, + "attribute vec4 color;", + "cogl_color_out = vec4 (0.0, 1.0, 0.0, 1.0);"); + cogl_pipeline_add_snippet (pipeline2, snippet); + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, + offset_x + 10.0f - 65525.0f, + offset_y - 65525, + 0.0f); + + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + attributes, + 1); /* n_attributes */ + cogl_primitive_draw (primitive, test_fb, pipeline2); + cogl_object_unref (primitive); + + cogl_framebuffer_pop_matrix (test_fb); + + cogl_object_unref (attributes[0]); + + cogl_object_unref (pipeline2); + cogl_object_unref (pipeline); + cogl_object_unref (buffer); + + test_utils_check_pixel (test_fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (test_fb, offset_x + 15, offset_y + 5, 0x00ff00ff); +} + +static void +paint (TestState *state) +{ + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + test_float_verts (state, 0, 0); + test_byte_verts (state, 0, 10); + test_short_verts (state, 0, 20); +} + +void +test_custom_attributes (void) +{ + CoglSnippet *snippet; + TestState state; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + state.pipeline = cogl_pipeline_new (test_ctx); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, + "attribute vec4 color;", + "cogl_color_out = color;"); + cogl_pipeline_add_snippet (state.pipeline, snippet); + + paint (&state); + + cogl_object_unref (state.pipeline); + cogl_object_unref (snippet); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-depth-test.c b/tests/conform/test-depth-test.c new file mode 100644 index 0000000..bfa9d0e --- /dev/null +++ b/tests/conform/test-depth-test.c @@ -0,0 +1,301 @@ +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_0 + +#include + +#include + +#include "test-utils.h" + +#define QUAD_WIDTH 20 + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define ALPHA 3 + +#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24) +#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16) +#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8) +#define MASK_ALPHA(COLOR) (COLOR & 0xff) + +typedef struct _TestState +{ + int padding; +} TestState; + +typedef struct +{ + uint32_t color; + float depth; + CoglBool test_enable; + CoglDepthTestFunction test_function; + CoglBool write_enable; + CoglBool fb_write_enable; + float range_near; + float range_far; +} TestDepthState; + +static CoglBool +draw_rectangle (TestState *state, + int x, + int y, + TestDepthState *rect_state, + CoglBool legacy_mode) +{ + uint8_t Cr = MASK_RED (rect_state->color); + uint8_t Cg = MASK_GREEN (rect_state->color); + uint8_t Cb = MASK_BLUE (rect_state->color); + uint8_t Ca = MASK_ALPHA (rect_state->color); + CoglPipeline *pipeline; + CoglDepthState depth_state; + + cogl_depth_state_init (&depth_state); + cogl_depth_state_set_test_enabled (&depth_state, rect_state->test_enable); + cogl_depth_state_set_test_function (&depth_state, rect_state->test_function); + cogl_depth_state_set_write_enabled (&depth_state, rect_state->write_enable); + cogl_depth_state_set_range (&depth_state, + rect_state->range_near, + rect_state->range_far); + + pipeline = cogl_pipeline_new (test_ctx); + if (!cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL)) + { + cogl_object_unref (pipeline); + return FALSE; + } + + if (!legacy_mode) + { + cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca); + + cogl_framebuffer_set_depth_write_enabled (test_fb, + rect_state->fb_write_enable); + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, 0, 0, rect_state->depth); + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_framebuffer_pop_matrix (test_fb); + } + else + { + cogl_push_framebuffer (test_fb); + cogl_push_matrix (); + cogl_set_source_color4ub (Cr, Cg, Cb, Ca); + cogl_translate (0, 0, rect_state->depth); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_pop_matrix (); + cogl_pop_framebuffer (); + } + + cogl_object_unref (pipeline); + + return TRUE; +} + +static void +test_depth (TestState *state, + int x, + int y, + TestDepthState *rect0_state, + TestDepthState *rect1_state, + TestDepthState *rect2_state, + CoglBool legacy_mode, + uint32_t expected_result) +{ + CoglBool missing_feature = FALSE; + + if (rect0_state) + missing_feature |= !draw_rectangle (state, x, y, rect0_state, legacy_mode); + if (rect1_state) + missing_feature |= !draw_rectangle (state, x, y, rect1_state, legacy_mode); + if (rect2_state) + missing_feature |= !draw_rectangle (state, x, y, rect2_state, legacy_mode); + + /* We don't consider it an error that we can't test something + * the driver doesn't support. */ + if (missing_feature) + return; + + test_utils_check_pixel (test_fb, + x * QUAD_WIDTH + (QUAD_WIDTH / 2), + y * QUAD_WIDTH + (QUAD_WIDTH / 2), + expected_result); +} + +static void +paint (TestState *state) +{ + /* Sanity check a few of the different depth test functions + * and that depth writing can be disabled... */ + + { + /* Closest */ + TestDepthState rect0_state = { + 0xff0000ff, /* rgba color */ + -10, /* depth */ + FALSE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_ALWAYS, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 1 /* depth range */ + }; + /* Furthest */ + TestDepthState rect1_state = { + 0x00ff00ff, /* rgba color */ + -70, /* depth */ + TRUE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_ALWAYS, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 1 /* depth range */ + }; + /* In the middle */ + TestDepthState rect2_state = { + 0x0000ffff, /* rgba color */ + -20, /* depth */ + TRUE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_NEVER, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 1 /* depth range */ + }; + + test_depth (state, 0, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x00ff00ff); /* expected */ + + rect2_state.test_function = COGL_DEPTH_TEST_FUNCTION_ALWAYS; + test_depth (state, 1, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x0000ffff); /* expected */ + + rect2_state.test_function = COGL_DEPTH_TEST_FUNCTION_LESS; + test_depth (state, 2, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x0000ffff); /* expected */ + + rect2_state.test_function = COGL_DEPTH_TEST_FUNCTION_GREATER; + test_depth (state, 3, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x00ff00ff); /* expected */ + + rect0_state.test_enable = TRUE; + rect1_state.write_enable = FALSE; + test_depth (state, 4, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x0000ffff); /* expected */ + + rect1_state.write_enable = TRUE; + rect1_state.fb_write_enable = FALSE; + test_depth (state, 4, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x0000ffff); /* expected */ + + /* Re-enable FB depth writing to verify state flush */ + rect1_state.write_enable = TRUE; + rect1_state.fb_write_enable = TRUE; + test_depth (state, 4, 0, /* position */ + &rect0_state, &rect1_state, &rect2_state, + FALSE, /* legacy mode */ + 0x00ff00ff); /* expected */ + } + + /* Check that the depth buffer values can be mapped into different + * ranges... */ + + { + /* Closest by depth, furthest by depth range */ + TestDepthState rect0_state = { + 0xff0000ff, /* rgba color */ + -10, /* depth */ + TRUE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_ALWAYS, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0.5, 1 /* depth range */ + }; + /* Furthest by depth, nearest by depth range */ + TestDepthState rect1_state = { + 0x00ff00ff, /* rgba color */ + -70, /* depth */ + TRUE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_GREATER, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 0.5 /* depth range */ + }; + + test_depth (state, 0, 1, /* position */ + &rect0_state, &rect1_state, NULL, + FALSE, /* legacy mode */ + 0xff0000ff); /* expected */ + } + + /* Test that the legacy cogl_set_depth_test_enabled() API still + * works... */ + + { + /* Nearest */ + TestDepthState rect0_state = { + 0xff0000ff, /* rgba color */ + -10, /* depth */ + FALSE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_LESS, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 1 /* depth range */ + }; + /* Furthest */ + TestDepthState rect1_state = { + 0x00ff00ff, /* rgba color */ + -70, /* depth */ + FALSE, /* depth test enable */ + COGL_DEPTH_TEST_FUNCTION_LESS, + TRUE, /* depth write enable */ + TRUE, /* FB depth write enable */ + 0, 1 /* depth range */ + }; + + cogl_set_depth_test_enabled (TRUE); + test_depth (state, 0, 2, /* position */ + &rect0_state, &rect1_state, NULL, + TRUE, /* legacy mode */ + 0xff0000ff); /* expected */ + cogl_set_depth_test_enabled (FALSE); + test_depth (state, 1, 2, /* position */ + &rect0_state, &rect1_state, NULL, + TRUE, /* legacy mode */ + 0x00ff00ff); /* expected */ + } +} + +void +test_depth_test (void) +{ + TestState state; + + cogl_framebuffer_orthographic (test_fb, 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-euler-quaternion.c b/tests/conform/test-euler-quaternion.c new file mode 100644 index 0000000..c250bec --- /dev/null +++ b/tests/conform/test-euler-quaternion.c @@ -0,0 +1,81 @@ +#include +#include +#include + +#include "test-utils.h" + +/* Macros are used here instead of functions so that the + * g_assert_cmpfloat will give a more interesting message when it + * fails */ + +#define COMPARE_FLOATS(a, b) \ + do { \ + if (fabsf ((a) - (b)) >= 0.0001f) \ + g_assert_cmpfloat ((a), ==, (b)); \ + } while (0) + +#define COMPARE_MATRICES(a, b) \ + do { \ + COMPARE_FLOATS ((a)->xx, (b)->xx); \ + COMPARE_FLOATS ((a)->yx, (b)->yx); \ + COMPARE_FLOATS ((a)->zx, (b)->zx); \ + COMPARE_FLOATS ((a)->wx, (b)->wx); \ + COMPARE_FLOATS ((a)->xy, (b)->xy); \ + COMPARE_FLOATS ((a)->yy, (b)->yy); \ + COMPARE_FLOATS ((a)->zy, (b)->zy); \ + COMPARE_FLOATS ((a)->wy, (b)->wy); \ + COMPARE_FLOATS ((a)->xz, (b)->xz); \ + COMPARE_FLOATS ((a)->yz, (b)->yz); \ + COMPARE_FLOATS ((a)->zz, (b)->zz); \ + COMPARE_FLOATS ((a)->wz, (b)->wz); \ + COMPARE_FLOATS ((a)->xw, (b)->xw); \ + COMPARE_FLOATS ((a)->yw, (b)->yw); \ + COMPARE_FLOATS ((a)->zw, (b)->zw); \ + COMPARE_FLOATS ((a)->ww, (b)->ww); \ + } while (0) + +void +test_euler_quaternion (void) +{ + CoglEuler euler; + CoglQuaternion quaternion; + CoglMatrix matrix_a, matrix_b; + + /* Try doing the rotation with three separate rotations */ + cogl_matrix_init_identity (&matrix_a); + cogl_matrix_rotate (&matrix_a, -30.0f, 0.0f, 1.0f, 0.0f); + cogl_matrix_rotate (&matrix_a, 40.0f, 1.0f, 0.0f, 0.0f); + cogl_matrix_rotate (&matrix_a, 50.0f, 0.0f, 0.0f, 1.0f); + + /* And try the same rotation with a euler */ + cogl_euler_init (&euler, -30, 40, 50); + cogl_matrix_init_from_euler (&matrix_b, &euler); + + /* Verify that the matrices are approximately the same */ + COMPARE_MATRICES (&matrix_a, &matrix_b); + + /* Try converting the euler to a matrix via a quaternion */ + cogl_quaternion_init_from_euler (&quaternion, &euler); + memset (&matrix_b, 0, sizeof (matrix_b)); + cogl_matrix_init_from_quaternion (&matrix_b, &quaternion); + COMPARE_MATRICES (&matrix_a, &matrix_b); + + /* Try applying the rotation from a euler to a framebuffer */ + cogl_framebuffer_identity_matrix (test_fb); + cogl_framebuffer_rotate_euler (test_fb, &euler); + memset (&matrix_b, 0, sizeof (matrix_b)); + cogl_framebuffer_get_modelview_matrix (test_fb, &matrix_b); + COMPARE_MATRICES (&matrix_a, &matrix_b); + + /* And again with a quaternion */ + cogl_framebuffer_identity_matrix (test_fb); + cogl_framebuffer_rotate_quaternion (test_fb, &quaternion); + memset (&matrix_b, 0, sizeof (matrix_b)); + cogl_framebuffer_get_modelview_matrix (test_fb, &matrix_b); + COMPARE_MATRICES (&matrix_a, &matrix_b); + + /* FIXME: This needs a lot more tests! */ + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-fence.c b/tests/conform/test-fence.c new file mode 100644 index 0000000..d5e3586 --- /dev/null +++ b/tests/conform/test-fence.c @@ -0,0 +1,63 @@ +#include + +/* These will be redefined in config.h */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API +#undef COGL_ENABLE_EXPERIMENTAL_API + +#include "test-utils.h" +#include "config.h" + +/* I'm writing this on the train after having dinner at a churrascuria. */ +#define MAGIC_CHUNK_O_DATA ((void *) 0xdeadbeef) + +static GMainLoop *loop; + +gboolean +timeout (void *user_data) +{ + g_assert (!"timeout not reached"); + + return FALSE; +} + +void +callback (CoglFence *fence, + void *user_data) +{ + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + + test_utils_check_pixel (test_fb, fb_width - 1, fb_height - 1, 0x00ff0000); + g_assert (user_data == MAGIC_CHUNK_O_DATA && "callback data not mangled"); + + g_main_loop_quit (loop); +} + +void +test_fence (void) +{ + GSource *cogl_source; + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + CoglFenceClosure *closure; + + cogl_source = cogl_glib_source_new (test_ctx, G_PRIORITY_DEFAULT); + g_source_attach (cogl_source, NULL); + loop = g_main_loop_new (NULL, TRUE); + + cogl_framebuffer_orthographic (test_fb, 0, 0, fb_width, fb_height, -1, 100); + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, + 0.0f, 1.0f, 0.0f, 0.0f); + + closure = cogl_framebuffer_add_fence_callback (test_fb, + callback, + MAGIC_CHUNK_O_DATA); + g_assert (closure != NULL); + + g_timeout_add_seconds (5, timeout, NULL); + + g_main_loop_run (loop); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-framebuffer-get-bits.c b/tests/conform/test-framebuffer-get-bits.c new file mode 100644 index 0000000..31c220d --- /dev/null +++ b/tests/conform/test-framebuffer-get-bits.c @@ -0,0 +1,40 @@ +#include + +#include "test-utils.h" + +void +test_framebuffer_get_bits (void) +{ + CoglTexture2D *tex_a = + cogl_texture_2d_new_with_size (test_ctx, + 16, 16); /* width/height */ + CoglOffscreen *offscreen_a = + cogl_offscreen_new_with_texture (tex_a); + CoglFramebuffer *fb_a = offscreen_a; + CoglTexture2D *tex_rgba = + cogl_texture_2d_new_with_size (test_ctx, + 16, 16); /* width/height */ + CoglOffscreen *offscreen_rgba = + cogl_offscreen_new_with_texture (tex_rgba); + CoglFramebuffer *fb_rgba = offscreen_rgba; + + cogl_texture_set_components (tex_a, + COGL_TEXTURE_COMPONENTS_A); + cogl_framebuffer_allocate (fb_a, NULL); + cogl_framebuffer_allocate (fb_rgba, NULL); + + g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_a), ==, 0); + g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_a), >=, 1); + + g_assert_cmpint (cogl_framebuffer_get_red_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_green_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_blue_bits (fb_rgba), >=, 1); + g_assert_cmpint (cogl_framebuffer_get_alpha_bits (fb_rgba), >=, 1); + + cogl_object_unref (fb_rgba); + cogl_object_unref (tex_rgba); + cogl_object_unref (fb_a); + cogl_object_unref (tex_a); +} diff --git a/tests/conform/test-gles2-context.c b/tests/conform/test-gles2-context.c new file mode 100644 index 0000000..bedc30a --- /dev/null +++ b/tests/conform/test-gles2-context.c @@ -0,0 +1,962 @@ + +#include +#include +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglGLES2Context *gles2_ctx; + const CoglGLES2Vtable *gles2; +} TestState; + +static void +test_push_pop_single_context (void) +{ + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglPipeline *pipeline; + CoglGLES2Context *gles2_ctx; + const CoglGLES2Vtable *gles2; + CoglError *error = NULL; + + offscreen_texture = + cogl_texture_2d_new_with_size (test_ctx, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb)); + offscreen = cogl_offscreen_new_with_texture (offscreen_texture); + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, offscreen_texture); + + gles2_ctx = cogl_gles2_context_new (test_ctx, &error); + if (!gles2_ctx) + g_error ("Failed to create GLES2 context: %s\n", error->message); + + gles2 = cogl_gles2_context_get_vtable (gles2_ctx); + + /* Clear onscreen to 0xffff00 using GLES2 */ + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + test_fb, + test_fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glClearColor (1, 1, 0, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xffff00ff); + + /* Clear offscreen to 0xff0000 using GLES2 and then copy the result + * onscreen. + * + * If we fail to bind the new context here then we'd probably end up + * clearing onscreen to 0xff0000 and copying 0xffff00 to onscreen + * instead. + */ + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + offscreen, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glClearColor (1, 0, 0, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (test_ctx); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1, 1, 1, -1); + /* NB: Cogl doesn't automatically support mid-scene modifications + * of textures and so we explicitly flush the drawn rectangle to the + * framebuffer now otherwise it may be batched until after the + * offscreen texture has been modified again. */ + cogl_flush (); + + /* Clear the offscreen framebuffer to blue using GLES2 before + * reading back from the onscreen framebuffer in case we mistakenly + * read from the offscreen framebuffer and get a false positive + */ + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + offscreen, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glClearColor (0, 0, 1, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xff0000ff); + + /* Now copy the offscreen blue clear to the onscreen framebufer and + * check that too */ + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1, 1, 1, -1); + + test_utils_check_pixel (test_fb, 0, 0, 0x0000ffff); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + test_fb, + test_fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glClearColor (1, 0, 1, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xff00ffff); + + + cogl_object_unref (gles2_ctx); + + cogl_object_unref (pipeline); +} + +static void +create_gles2_context (CoglTexture **offscreen_texture, + CoglOffscreen **offscreen, + CoglPipeline **pipeline, + CoglGLES2Context **gles2_ctx, + const CoglGLES2Vtable **gles2) +{ + CoglError *error = NULL; + + *offscreen_texture = + cogl_texture_2d_new_with_size (test_ctx, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb)); + *offscreen = cogl_offscreen_new_with_texture (*offscreen_texture); + + *pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (*pipeline, 0, *offscreen_texture); + + *gles2_ctx = cogl_gles2_context_new (test_ctx, &error); + if (!*gles2_ctx) + g_error ("Failed to create GLES2 context: %s\n", error->message); + + *gles2 = cogl_gles2_context_get_vtable (*gles2_ctx); +} + +static void +test_push_pop_multi_context (void) +{ + CoglTexture *offscreen_texture0; + CoglOffscreen *offscreen0; + CoglPipeline *pipeline0; + CoglGLES2Context *gles2_ctx0; + const CoglGLES2Vtable *gles20; + CoglTexture *offscreen_texture1; + CoglOffscreen *offscreen1; + CoglPipeline *pipeline1; + CoglGLES2Context *gles2_ctx1; + const CoglGLES2Vtable *gles21; + CoglError *error = NULL; + + create_gles2_context (&offscreen_texture0, + &offscreen0, + &pipeline0, + &gles2_ctx0, + &gles20); + + create_gles2_context (&offscreen_texture1, + &offscreen1, + &pipeline1, + &gles2_ctx1, + &gles21); + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx0, + offscreen0, + offscreen0, + &error)) + { + g_error ("Failed to push gles2 context 0: %s\n", error->message); + } + + gles20->glClearColor (1, 0, 0, 1); + gles20->glClear (GL_COLOR_BUFFER_BIT); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx1, + offscreen1, + offscreen1, + &error)) + { + g_error ("Failed to push gles2 context 1: %s\n", error->message); + } + + gles21->glClearColor (0, 1, 0, 1); + gles21->glClear (GL_COLOR_BUFFER_BIT); + + cogl_pop_gles2_context (test_ctx); + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xffffffff); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline0, + -1, 1, 1, -1); + + test_utils_check_pixel (test_fb, 0, 0, 0xff0000ff); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline1, + -1, 1, 1, -1); + + test_utils_check_pixel (test_fb, 0, 0, 0x00ff00ff); +} + +static GLuint +create_gles2_framebuffer (const CoglGLES2Vtable *gles2, + int width, + int height) +{ + GLuint texture_handle; + GLuint fbo_handle; + GLenum status; + + gles2->glGenTextures (1, &texture_handle); + gles2->glGenFramebuffers (1, &fbo_handle); + + gles2->glBindTexture (GL_TEXTURE_2D, texture_handle); + gles2->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + gles2->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + gles2->glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, + GL_UNSIGNED_BYTE, NULL); + gles2->glBindTexture (GL_TEXTURE_2D, 0); + + gles2->glBindFramebuffer (GL_FRAMEBUFFER, fbo_handle); + gles2->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, texture_handle, 0); + + status = gles2->glCheckFramebufferStatus (GL_FRAMEBUFFER); + if (cogl_test_verbose ()) + g_print ("status for gles2 framebuffer = 0x%x %s\n", + status, status == GL_FRAMEBUFFER_COMPLETE ? "(complete)" : "(?)"); + + gles2->glBindFramebuffer (GL_FRAMEBUFFER, 0); + + return fbo_handle; +} + +static void +test_gles2_read_pixels (void) +{ + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglPipeline *pipeline; + CoglGLES2Context *gles2_ctx; + const CoglGLES2Vtable *gles2; + CoglError *error = NULL; + GLubyte pixel[4]; + GLuint fbo_handle; + + create_gles2_context (&offscreen_texture, + &offscreen, + &pipeline, + &gles2_ctx, + &gles2); + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + offscreen, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glClearColor (1, 0, 0, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + + test_utils_compare_pixel (pixel, 0xff0000ff); + + fbo_handle = create_gles2_framebuffer (gles2, 256, 256); + + gles2->glBindFramebuffer (GL_FRAMEBUFFER, fbo_handle); + + gles2->glClearColor (0, 1, 0, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + + test_utils_compare_pixel (pixel, 0x00ff00ff); + + gles2->glBindFramebuffer (GL_FRAMEBUFFER, 0); + + gles2->glClearColor (0, 1, 1, 1); + gles2->glClear (GL_COLOR_BUFFER_BIT); + gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + + test_utils_compare_pixel (pixel, 0x00ffffff); + + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xffffffff); + + /* Bind different read and write buffers */ + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + test_fb, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + + test_utils_compare_pixel (pixel, 0x00ffffff); + + cogl_pop_gles2_context (test_ctx); + + test_utils_check_pixel (test_fb, 0, 0, 0xffffffff); + + /* Bind different read and write buffers (the other way around from + * before so when we test with COGL_TEST_ONSCREEN=1 we will read + * from an onscreen framebuffer) */ + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + test_fb, + offscreen, + &error)) + { + g_error ("Failed to push gles2 context: %s\n", error->message); + } + + gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + + test_utils_compare_pixel (pixel, 0xffffffff); + + cogl_pop_gles2_context (test_ctx); +} + +void +test_gles2_context (void) +{ + test_push_pop_single_context (); + test_push_pop_multi_context (); + test_gles2_read_pixels (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + +static GLuint +create_shader (const CoglGLES2Vtable *gles2, + GLenum type, + const char *source) +{ + GLuint shader; + GLint status; + int length = strlen (source); + + shader = gles2->glCreateShader (type); + gles2->glShaderSource (shader, 1, &source, &length); + gles2->glCompileShader (shader); + gles2->glGetShaderiv (shader, GL_COMPILE_STATUS, &status); + + if (!status) + { + char buf[512]; + + gles2->glGetShaderInfoLog (shader, sizeof (buf), NULL, buf); + + g_error ("Shader compilation failed:\n%s", buf); + } + + return shader; +} + +static GLuint +create_program (const CoglGLES2Vtable *gles2, + const char *vertex_shader_source, + const char *fragment_shader_source) +{ + GLuint fragment_shader, vertex_shader, program; + GLint status; + + vertex_shader = + create_shader (gles2, GL_VERTEX_SHADER, vertex_shader_source); + fragment_shader = + create_shader (gles2, GL_FRAGMENT_SHADER, fragment_shader_source); + + program = gles2->glCreateProgram (); + gles2->glAttachShader (program, vertex_shader); + gles2->glAttachShader (program, fragment_shader); + gles2->glLinkProgram (program); + + gles2->glGetProgramiv (program, GL_LINK_STATUS, &status); + + if (!status) + { + char buf[512]; + + gles2->glGetProgramInfoLog (program, sizeof (buf), NULL, buf); + + g_error ("Program linking failed:\n%s", buf); + } + + return program; +} + +typedef struct +{ + const CoglGLES2Vtable *gles2; + GLint color_location; + GLint pos_location; + int fb_width, fb_height; +} PaintData; + +typedef void (* PaintMethod) (PaintData *data); + +/* Top vertices are counter-clockwise */ +static const float top_vertices[] = + { + -1.0f, 0.0f, + 1.0f, 0.0f, + -1.0f, 1.0f, + 1.0f, 1.0f + }; +/* Bottom vertices are clockwise */ +static const float bottom_vertices[] = + { + 1.0f, 0.0f, + 1.0f, -1.0f, + -1.0f, 0.0f, + -1.0f, -1.0f + }; + +static void +paint_quads (PaintData *data) +{ + const CoglGLES2Vtable *gles2 = data->gles2; + + gles2->glEnableVertexAttribArray (data->pos_location); + + /* Paint the top half in red */ + gles2->glUniform4f (data->color_location, + 1.0f, 0.0f, 0.0f, 1.0f); + gles2->glVertexAttribPointer (data->pos_location, + 2, /* size */ + GL_FLOAT, + GL_FALSE, /* not normalized */ + sizeof (float) * 2, + top_vertices); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + /* Paint the bottom half in blue */ + gles2->glUniform4f (data->color_location, + 0.0f, 0.0f, 1.0f, 1.0f); + gles2->glVertexAttribPointer (data->pos_location, + 2, /* size */ + GL_FLOAT, + GL_FALSE, /* not normalized */ + sizeof (float) * 2, + bottom_vertices); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); +} + +static void +paint_viewport (PaintData *data) +{ + const CoglGLES2Vtable *gles2 = data->gles2; + int viewport[4]; + + /* Vertices to fill the entire framebuffer */ + static const float vertices[] = + { + -1.0f, -1.0f, + 1.0f, -1.0f, + -1.0f, 1.0f, + 1.0f, 1.0f + }; + + gles2->glEnableVertexAttribArray (data->pos_location); + gles2->glVertexAttribPointer (data->pos_location, + 2, /* size */ + GL_FLOAT, + GL_FALSE, /* not normalized */ + sizeof (float) * 2, + vertices); + + /* Paint the top half in red */ + gles2->glViewport (0, data->fb_height / 2, + data->fb_width, data->fb_height / 2); + gles2->glUniform4f (data->color_location, + 1.0f, 0.0f, 0.0f, 1.0f); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + /* Paint the bottom half in blue */ + gles2->glViewport (0, 0, data->fb_width, data->fb_height / 2); + gles2->glUniform4f (data->color_location, + 0.0f, 0.0f, 1.0f, 1.0f); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + gles2->glGetIntegerv (GL_VIEWPORT, viewport); + g_assert_cmpint (viewport[0], ==, 0.0f); + g_assert_cmpint (viewport[1], ==, 0.0f); + g_assert_cmpint (viewport[2], ==, data->fb_width); + g_assert_cmpint (viewport[3], ==, data->fb_height / 2); +} + +static void +paint_scissor (PaintData *data) +{ + const CoglGLES2Vtable *gles2 = data->gles2; + float scissor[4]; + + gles2->glEnable (GL_SCISSOR_TEST); + + /* Paint the top half in red */ + gles2->glScissor (0, data->fb_height / 2, + data->fb_width, data->fb_height / 2); + gles2->glClearColor (1.0, 0.0, 0.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + /* Paint the bottom half in blue */ + gles2->glScissor (0, 0, data->fb_width, data->fb_height / 2); + gles2->glClearColor (0.0, 0.0, 1.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + gles2->glGetFloatv (GL_SCISSOR_BOX, scissor); + g_assert_cmpfloat (scissor[0], ==, 0.0f); + g_assert_cmpfloat (scissor[1], ==, 0.0f); + g_assert_cmpfloat (scissor[2], ==, data->fb_width); + g_assert_cmpfloat (scissor[3], ==, data->fb_height / 2); +} + +static void +paint_cull (PaintData *data) +{ + const CoglGLES2Vtable *gles2 = data->gles2; + GLint front_face; + int i; + + gles2->glEnableVertexAttribArray (data->pos_location); + gles2->glEnable (GL_CULL_FACE); + + /* First time round we'll use GL_CCW as the front face so that the + * bottom quad will be culled */ + gles2->glFrontFace (GL_CCW); + gles2->glUniform4f (data->color_location, + 1.0f, 0.0f, 0.0f, 1.0f); + + gles2->glGetIntegerv (GL_FRONT_FACE, &front_face); + g_assert_cmpint (front_face, ==, GL_CCW); + + for (i = 0; i < 2; i++) + { + /* Paint both quads in the same color. One of these will be + * culled */ + gles2->glVertexAttribPointer (data->pos_location, + 2, /* size */ + GL_FLOAT, + GL_FALSE, /* not normalized */ + sizeof (float) * 2, + top_vertices); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + gles2->glVertexAttribPointer (data->pos_location, + 2, /* size */ + GL_FLOAT, + GL_FALSE, /* not normalized */ + sizeof (float) * 2, + bottom_vertices); + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + /* Second time round we'll use GL_CW as the front face so that the + * top quad will be culled */ + gles2->glFrontFace (GL_CW); + gles2->glUniform4f (data->color_location, + 0.0f, 0.0f, 1.0f, 1.0f); + + gles2->glGetIntegerv (GL_FRONT_FACE, &front_face); + g_assert_cmpint (front_face, ==, GL_CW); + } +} + +static void +verify_read_pixels (const PaintData *data) +{ + int stride = data->fb_width * 4; + uint8_t *buf = g_malloc (data->fb_height * stride); + + data->gles2->glReadPixels (0, 0, /* x/y */ + data->fb_width, data->fb_height, + GL_RGBA, + GL_UNSIGNED_BYTE, + buf); + + /* In GL, the lines earlier in the buffer are the bottom */ + /* Bottom should be blue */ + test_utils_compare_pixel (buf + data->fb_width / 2 * 4 + + data->fb_height / 4 * stride, + 0x0000ffff); + /* Top should be red */ + test_utils_compare_pixel (buf + data->fb_width / 2 * 4 + + data->fb_height * 3 / 4 * stride, + 0xff0000ff); + + g_free (buf); +} + +void +test_gles2_context_fbo (void) +{ + static const char vertex_shader_source[] = + "attribute vec2 pos;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " gl_Position = vec4 (pos, 0.0, 1.0);\n" + "}\n"; + static const char fragment_shader_source[] = + "precision mediump float;\n" + "uniform vec4 color;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " gl_FragColor = color;\n" + "}\n"; + static const PaintMethod paint_methods[] = + { + paint_quads, + paint_viewport, + paint_scissor, + paint_cull + }; + int i; + PaintData data; + + data.fb_width = cogl_framebuffer_get_width (test_fb); + data.fb_height = cogl_framebuffer_get_height (test_fb); + + for (i = 0; i < G_N_ELEMENTS (paint_methods); i++) + { + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglPipeline *pipeline; + CoglGLES2Context *gles2_ctx; + GLuint program; + CoglError *error = NULL; + + create_gles2_context (&offscreen_texture, + &offscreen, + &pipeline, + &gles2_ctx, + &data.gles2); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + offscreen, + &error)) + g_error ("Failed to push gles2 context: %s\n", error->message); + + program = create_program (data.gles2, + vertex_shader_source, + fragment_shader_source); + + data.gles2->glClearColor (1.0, 1.0, 0.0, 1.0); + data.gles2->glClear (GL_COLOR_BUFFER_BIT); + + data.gles2->glUseProgram (program); + + data.color_location = data.gles2->glGetUniformLocation (program, "color"); + if (data.color_location == -1) + g_error ("Couldn't find ‘color’ uniform"); + + data.pos_location = data.gles2->glGetAttribLocation (program, "pos"); + if (data.pos_location == -1) + g_error ("Couldn't find ‘pos’ attribute"); + + paint_methods[i] (&data); + + verify_read_pixels (&data); + + cogl_pop_gles2_context (test_ctx); + + cogl_object_unref (offscreen); + cogl_object_unref (gles2_ctx); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1.0f, 1.0f, + 1.0f, -1.0f); + + cogl_object_unref (pipeline); + cogl_object_unref (offscreen_texture); + + /* Top half of the framebuffer should be red */ + test_utils_check_pixel (test_fb, + data.fb_width / 2, data.fb_height / 4, + 0xff0000ff); + /* Bottom half should be blue */ + test_utils_check_pixel (test_fb, + data.fb_width / 2, data.fb_height * 3 / 4, + 0x0000ffff); + } +} + +/* Position to draw a rectangle in. The top half of this rectangle + * will be red, and the bottom will be blue */ +#define RECTANGLE_DRAW_X 10 +#define RECTANGLE_DRAW_Y 15 + +/* Position to copy the rectangle to in the destination texture */ +#define RECTANGLE_COPY_X 110 +#define RECTANGLE_COPY_Y 115 + +#define RECTANGLE_WIDTH 30 +#define RECTANGLE_HEIGHT 40 + +static void +verify_region (const CoglGLES2Vtable *gles2, + int x, + int y, + int width, + int height, + uint32_t expected_pixel) +{ + uint8_t *buf, *p; + + buf = g_malloc (width * height * 4); + + gles2->glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + for (p = buf + width * height * 4; p > buf; p -= 4) + test_utils_compare_pixel (p - 4, expected_pixel); + + g_free (buf); +} + +void +test_gles2_context_copy_tex_image (void) +{ + static const char vertex_shader_source[] = + "attribute vec2 pos;\n" + "attribute vec2 tex_coord_attrib;\n" + "varying vec2 tex_coord_varying;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " gl_Position = vec4 (pos, 0.0, 1.0);\n" + " tex_coord_varying = tex_coord_attrib;\n" + "}\n"; + static const char fragment_shader_source[] = + "precision mediump float;\n" + "varying vec2 tex_coord_varying;\n" + "uniform sampler2D tex;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " gl_FragColor = texture2D (tex, tex_coord_varying);\n" + "}\n"; + static const float verts[] = + { + -1.0f, -1.0f, 0.0f, 0.0f, + 1.0f, -1.0f, 1.0f, 0.0f, + -1.0f, 1.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f + }; + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + CoglTexture *offscreen_texture; + CoglOffscreen *offscreen; + CoglPipeline *pipeline; + CoglGLES2Context *gles2_ctx; + const CoglGLES2Vtable *gles2; + CoglError *error = NULL; + GLuint tex; + GLint tex_uniform_location; + GLint pos_location; + GLint tex_coord_location; + GLuint program; + + create_gles2_context (&offscreen_texture, + &offscreen, + &pipeline, + &gles2_ctx, + &gles2); + + if (!cogl_push_gles2_context (test_ctx, + gles2_ctx, + offscreen, + offscreen, + &error)) + g_error ("Failed to push gles2 context: %s\n", error->message); + + gles2->glClearColor (1.0, 1.0, 0.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + /* Draw a rectangle using clear and the scissor so that we don't + * have to create a shader */ + gles2->glEnable (GL_SCISSOR_TEST); + + /* Top half red */ + gles2->glScissor (RECTANGLE_DRAW_X, + RECTANGLE_DRAW_Y + RECTANGLE_HEIGHT / 2, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2); + gles2->glClearColor (1.0, 0.0, 0.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + /* Bottom half blue */ + gles2->glScissor (RECTANGLE_DRAW_X, + RECTANGLE_DRAW_Y, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2); + gles2->glClearColor (0.0, 0.0, 1.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + /* Draw where the rectangle would be if the coordinates were flipped + * in white to make it obvious that that is the problem if the + * assertion fails */ + gles2->glScissor (RECTANGLE_DRAW_X, + fb_width - (RECTANGLE_DRAW_Y + RECTANGLE_HEIGHT), + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT); + gles2->glClearColor (1.0, 1.0, 1.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + gles2->glDisable (GL_SCISSOR_TEST); + + /* Create a texture */ + gles2->glGenTextures (1, &tex); + gles2->glBindTexture (GL_TEXTURE_2D, tex); + gles2->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + gles2->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + /* Copy the entire framebuffer into the texture */ + gles2->glCopyTexImage2D (GL_TEXTURE_2D, + 0, /* level */ + GL_RGBA, + 0, 0, /* x/y */ + fb_width, fb_height, + 0 /* border */); + + /* Copy the rectangle into another part of the texture */ + gles2->glCopyTexSubImage2D (GL_TEXTURE_2D, + 0, /* level */ + RECTANGLE_COPY_X, + RECTANGLE_COPY_Y, + RECTANGLE_DRAW_X, + RECTANGLE_DRAW_Y, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT); + + /* Clear the framebuffer to make the test more thorough */ + gles2->glClearColor (1.0, 1.0, 0.0, 1.0); + gles2->glClear (GL_COLOR_BUFFER_BIT); + + /* Create a program to render the texture */ + program = create_program (gles2, + vertex_shader_source, + fragment_shader_source); + + pos_location = + gles2->glGetAttribLocation (program, "pos"); + if (pos_location == -1) + g_error ("Couldn't find ‘pos’ attribute"); + + tex_coord_location = + gles2->glGetAttribLocation (program, "tex_coord_attrib"); + if (tex_coord_location == -1) + g_error ("Couldn't find ‘tex_coord_attrib’ attribute"); + + tex_uniform_location = + gles2->glGetUniformLocation (program, "tex"); + if (tex_uniform_location == -1) + g_error ("Couldn't find ‘tex’ uniform"); + + gles2->glUseProgram (program); + + gles2->glUniform1i (tex_uniform_location, 0); + + /* Render the texture to fill the framebuffer */ + gles2->glEnableVertexAttribArray (pos_location); + gles2->glVertexAttribPointer (pos_location, + 2, /* n_components */ + GL_FLOAT, + FALSE, /* normalized */ + sizeof (float) * 4, + verts); + gles2->glEnableVertexAttribArray (tex_coord_location); + gles2->glVertexAttribPointer (tex_coord_location, + 2, /* n_components */ + GL_FLOAT, + FALSE, /* normalized */ + sizeof (float) * 4, + verts + 2); + + gles2->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); + + /* Verify top of drawn rectangle is red */ + verify_region (gles2, + RECTANGLE_DRAW_X, + RECTANGLE_DRAW_Y + RECTANGLE_HEIGHT / 2, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2, + 0xff0000ff); + /* Verify bottom of drawn rectangle is blue */ + verify_region (gles2, + RECTANGLE_DRAW_X, + RECTANGLE_DRAW_Y, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2, + 0x0000ffff); + /* Verify top of copied rectangle is red */ + verify_region (gles2, + RECTANGLE_COPY_X, + RECTANGLE_COPY_Y + RECTANGLE_HEIGHT / 2, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2, + 0xff0000ff); + /* Verify bottom of copied rectangle is blue */ + verify_region (gles2, + RECTANGLE_COPY_X, + RECTANGLE_COPY_Y, + RECTANGLE_WIDTH, + RECTANGLE_HEIGHT / 2, + 0x0000ffff); + + cogl_pop_gles2_context (test_ctx); + + cogl_object_unref (offscreen); + cogl_object_unref (gles2_ctx); + cogl_object_unref (pipeline); + cogl_object_unref (offscreen_texture); +} diff --git a/tests/conform/test-just-vertex-shader.c b/tests/conform/test-just-vertex-shader.c new file mode 100644 index 0000000..60fcaf7 --- /dev/null +++ b/tests/conform/test-just-vertex-shader.c @@ -0,0 +1,205 @@ +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_0 + +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int paddiing; +} TestState; + +static CoglTexture * +create_dummy_texture (void) +{ + /* Create a dummy 1x1 green texture to replace the color from the + vertex shader */ + static const uint8_t data[4] = { 0x00, 0xff, 0x00, 0xff }; + + return test_utils_texture_new_from_data (test_ctx, + 1, 1, /* size */ + TEST_UTILS_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGB_888, + 4, /* rowstride */ + data); +} + +static void +paint_legacy (TestState *state) +{ + CoglHandle material = cogl_material_new (); + CoglTexture *tex; + CoglColor color; + CoglError *error = NULL; + CoglHandle shader, program; + + cogl_color_init_from_4ub (&color, 0, 0, 0, 255); + cogl_clear (&color, COGL_BUFFER_BIT_COLOR); + + /* Set the primary vertex color as red */ + cogl_color_set_from_4ub (&color, 0xff, 0x00, 0x00, 0xff); + cogl_material_set_color (material, &color); + + /* Override the vertex color in the texture environment with a + constant green color provided by a texture */ + tex = create_dummy_texture (); + cogl_material_set_layer (material, 0, tex); + cogl_object_unref (tex); + if (!cogl_material_set_layer_combine (material, 0, + "RGBA=REPLACE(TEXTURE)", + &error)) + { + g_warning ("Error setting layer combine: %s", error->message); + g_assert_not_reached (); + } + + /* Set up a dummy vertex shader that does nothing but the usual + fixed function transform */ + shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX); + cogl_shader_source (shader, + "void\n" + "main ()\n" + "{\n" + " cogl_position_out = " + "cogl_modelview_projection_matrix * " + "cogl_position_in;\n" + " cogl_color_out = cogl_color_in;\n" + " cogl_tex_coord_out[0] = cogl_tex_coord_in;\n" + "}\n"); + cogl_shader_compile (shader); + if (!cogl_shader_is_compiled (shader)) + { + char *log = cogl_shader_get_info_log (shader); + g_warning ("Shader compilation failed:\n%s", log); + g_free (log); + g_assert_not_reached (); + } + + program = cogl_create_program (); + cogl_program_attach_shader (program, shader); + cogl_program_link (program); + + cogl_handle_unref (shader); + + /* Draw something using the material */ + cogl_set_source (material); + cogl_rectangle (0, 0, 50, 50); + + /* Draw it again using the program. It should look exactly the same */ + cogl_program_use (program); + cogl_rectangle (50, 0, 100, 50); + cogl_program_use (COGL_INVALID_HANDLE); + + cogl_handle_unref (material); + cogl_handle_unref (program); +} + +static void +paint (TestState *state) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglTexture *tex; + CoglColor color; + CoglError *error = NULL; + CoglHandle shader, program; + + cogl_color_init_from_4ub (&color, 0, 0, 0, 255); + cogl_clear (&color, COGL_BUFFER_BIT_COLOR); + + /* Set the primary vertex color as red */ + cogl_color_set_from_4ub (&color, 0xff, 0x00, 0x00, 0xff); + cogl_pipeline_set_color (pipeline, &color); + + /* Override the vertex color in the texture environment with a + constant green color provided by a texture */ + tex = create_dummy_texture (); + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_object_unref (tex); + if (!cogl_pipeline_set_layer_combine (pipeline, 0, + "RGBA=REPLACE(TEXTURE)", + &error)) + { + g_warning ("Error setting layer combine: %s", error->message); + g_assert_not_reached (); + } + + /* Set up a dummy vertex shader that does nothing but the usual + fixed function transform */ + shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX); + cogl_shader_source (shader, + "void\n" + "main ()\n" + "{\n" + " cogl_position_out = " + "cogl_modelview_projection_matrix * " + "cogl_position_in;\n" + " cogl_color_out = cogl_color_in;\n" + " cogl_tex_coord_out[0] = cogl_tex_coord_in;\n" + "}\n"); + cogl_shader_compile (shader); + if (!cogl_shader_is_compiled (shader)) + { + char *log = cogl_shader_get_info_log (shader); + g_warning ("Shader compilation failed:\n%s", log); + g_free (log); + g_assert_not_reached (); + } + + program = cogl_create_program (); + cogl_program_attach_shader (program, shader); + cogl_program_link (program); + + cogl_handle_unref (shader); + + /* Draw something without the program */ + cogl_set_source (pipeline); + cogl_rectangle (0, 0, 50, 50); + + /* Draw it again using the program. It should look exactly the same */ + cogl_pipeline_set_user_program (pipeline, program); + cogl_handle_unref (program); + + cogl_rectangle (50, 0, 100, 50); + cogl_pipeline_set_user_program (pipeline, COGL_INVALID_HANDLE); + + cogl_object_unref (pipeline); +} + +static void +validate_result (CoglFramebuffer *framebuffer) +{ + /* Non-shader version */ + test_utils_check_pixel (framebuffer, 25, 25, 0x00ff0000); + /* Shader version */ + test_utils_check_pixel (framebuffer, 75, 25, 0x00ff0000); +} + +void +test_just_vertex_shader (void) +{ + TestState state; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (test_fb); + + paint_legacy (&state); + validate_result (test_fb); + + paint (&state); + validate_result (test_fb); + + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-layer-remove.c b/tests/conform/test-layer-remove.c new file mode 100644 index 0000000..de1efec --- /dev/null +++ b/tests/conform/test-layer-remove.c @@ -0,0 +1,145 @@ +#include + +#include "test-utils.h" + +#define TEST_SQUARE_SIZE 10 + +static CoglPipeline * +create_two_layer_pipeline (void) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglColor color; + + /* The pipeline is initially black */ + cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + + /* The first layer adds a full red component */ + cogl_color_init_from_4ub (&color, 255, 0, 0, 255); + cogl_pipeline_set_layer_combine_constant (pipeline, 0, &color); + cogl_pipeline_set_layer_combine (pipeline, + 0, /* layer_num */ + "RGBA=ADD(PREVIOUS,CONSTANT)", + NULL); + + /* The second layer adds a full green component */ + cogl_color_init_from_4ub (&color, 0, 255, 0, 255); + cogl_pipeline_set_layer_combine_constant (pipeline, 1, &color); + cogl_pipeline_set_layer_combine (pipeline, + 1, /* layer_num */ + "RGBA=ADD(PREVIOUS,CONSTANT)", + NULL); + + return pipeline; +} + +static void +test_color (CoglPipeline *pipeline, + uint32_t color, + int pos) +{ + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + pos * TEST_SQUARE_SIZE, + 0, + pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE, + TEST_SQUARE_SIZE); + test_utils_check_pixel (test_fb, + pos * TEST_SQUARE_SIZE + TEST_SQUARE_SIZE / 2, + TEST_SQUARE_SIZE / 2, + color); +} + +void +test_layer_remove (void) +{ + CoglPipeline *pipeline0, *pipeline1; + CoglColor color; + int pos = 0; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + /** TEST 1 **/ + /* Basic sanity check that the pipeline combines the two colors + * together properly */ + pipeline0 = create_two_layer_pipeline (); + test_color (pipeline0, 0xffff00ff, pos++); + cogl_object_unref (pipeline0); + + /** TEST 2 **/ + /* Check that we can remove the second layer */ + pipeline0 = create_two_layer_pipeline (); + cogl_pipeline_remove_layer (pipeline0, 1); + test_color (pipeline0, 0xff0000ff, pos++); + cogl_object_unref (pipeline0); + + /** TEST 3 **/ + /* Check that we can remove the first layer */ + pipeline0 = create_two_layer_pipeline (); + cogl_pipeline_remove_layer (pipeline0, 0); + test_color (pipeline0, 0x00ff00ff, pos++); + cogl_object_unref (pipeline0); + + /** TEST 4 **/ + /* Check that we can make a copy and remove a layer from the + * original pipeline */ + pipeline0 = create_two_layer_pipeline (); + pipeline1 = cogl_pipeline_copy (pipeline0); + cogl_pipeline_remove_layer (pipeline0, 1); + test_color (pipeline0, 0xff0000ff, pos++); + test_color (pipeline1, 0xffff00ff, pos++); + cogl_object_unref (pipeline0); + cogl_object_unref (pipeline1); + + /** TEST 5 **/ + /* Check that we can make a copy and remove the second layer from the + * new pipeline */ + pipeline0 = create_two_layer_pipeline (); + pipeline1 = cogl_pipeline_copy (pipeline0); + cogl_pipeline_remove_layer (pipeline1, 1); + test_color (pipeline0, 0xffff00ff, pos++); + test_color (pipeline1, 0xff0000ff, pos++); + cogl_object_unref (pipeline0); + cogl_object_unref (pipeline1); + + /** TEST 6 **/ + /* Check that we can make a copy and remove the first layer from the + * new pipeline */ + pipeline0 = create_two_layer_pipeline (); + pipeline1 = cogl_pipeline_copy (pipeline0); + cogl_pipeline_remove_layer (pipeline1, 0); + test_color (pipeline0, 0xffff00ff, pos++); + test_color (pipeline1, 0x00ff00ff, pos++); + cogl_object_unref (pipeline0); + cogl_object_unref (pipeline1); + + /** TEST 7 **/ + /* Check that we can modify a layer in a child pipeline */ + pipeline0 = create_two_layer_pipeline (); + pipeline1 = cogl_pipeline_copy (pipeline0); + cogl_color_init_from_4ub (&color, 0, 0, 255, 255); + cogl_pipeline_set_layer_combine_constant (pipeline1, 0, &color); + test_color (pipeline0, 0xffff00ff, pos++); + test_color (pipeline1, 0x00ffffff, pos++); + cogl_object_unref (pipeline0); + cogl_object_unref (pipeline1); + + /** TEST 8 **/ + /* Check that we can modify a layer in a child pipeline but then remove it */ + pipeline0 = create_two_layer_pipeline (); + pipeline1 = cogl_pipeline_copy (pipeline0); + cogl_color_init_from_4ub (&color, 0, 0, 255, 255); + cogl_pipeline_set_layer_combine_constant (pipeline1, 0, &color); + cogl_pipeline_remove_layer (pipeline1, 0); + test_color (pipeline0, 0xffff00ff, pos++); + test_color (pipeline1, 0x00ff00ff, pos++); + cogl_object_unref (pipeline0); + cogl_object_unref (pipeline1); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-map-buffer-range.c b/tests/conform/test-map-buffer-range.c new file mode 100644 index 0000000..e979240 --- /dev/null +++ b/tests/conform/test-map-buffer-range.c @@ -0,0 +1,123 @@ +#include + +#include + +#include "test-utils.h" + +static uint8_t +tex_data[2 * 2 * 4] = + { + 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, + 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff + }; + +/* Vertex data for a quad with all of the texture coordinates set to + * the top left (red) pixel */ +static CoglVertexP2T2 +vertex_data[4] = + { + { -1, -1, 0, 0 }, + { 1, -1, 0, 0 }, + { -1, 1, 0, 0 }, + { 1, 1, 0, 0 } + }; + +void +test_map_buffer_range (void) +{ + CoglTexture2D *tex; + CoglPipeline *pipeline; + int fb_width, fb_height; + CoglAttributeBuffer *buffer; + CoglVertexP2T2 *data; + CoglAttribute *pos_attribute; + CoglAttribute *tex_coord_attribute; + CoglPrimitive *primitive; + + tex = cogl_texture_2d_new_from_data (test_ctx, + 2, 2, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 2 * 4, /* rowstride */ + tex_data, + NULL /* error */); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_layer_wrap_mode (pipeline, + 0, /* layer */ + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE); + + fb_width = cogl_framebuffer_get_width (test_fb); + fb_height = cogl_framebuffer_get_height (test_fb); + + buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (vertex_data), + vertex_data); + + /* Replace the texture coordinates of the third vertex with the + * coordinates for a green texel */ + data = cogl_buffer_map_range (buffer, + sizeof (vertex_data[0]) * 2, + sizeof (vertex_data[0]), + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD_RANGE, + NULL); /* don't catch errors */ + g_assert (data != NULL); + + data->x = vertex_data[2].x; + data->y = vertex_data[2].y; + data->s = 1.0f; + data->t = 0.0f; + + cogl_buffer_unmap (buffer); + + pos_attribute = + cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (vertex_data[0]), + offsetof (CoglVertexP2T2, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + tex_coord_attribute = + cogl_attribute_new (buffer, + "cogl_tex_coord_in", + sizeof (vertex_data[0]), + offsetof (CoglVertexP2T2, s), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 0, 0, 0, 1); + + primitive = + cogl_primitive_new (COGL_VERTICES_MODE_TRIANGLE_STRIP, + 4, /* n_vertices */ + pos_attribute, + tex_coord_attribute, + NULL); + cogl_primitive_draw (primitive, test_fb, pipeline); + cogl_object_unref (primitive); + + /* Top left pixel should be the one that is replaced to be green */ + test_utils_check_pixel (test_fb, 1, 1, 0x00ff00ff); + /* The other three corners should be left as red */ + test_utils_check_pixel (test_fb, fb_width - 2, 1, 0xff0000ff); + test_utils_check_pixel (test_fb, 1, fb_height - 2, 0xff0000ff); + test_utils_check_pixel (test_fb, fb_width - 2, fb_height - 2, 0xff0000ff); + + cogl_object_unref (buffer); + cogl_object_unref (pos_attribute); + cogl_object_unref (tex_coord_attribute); + + cogl_object_unref (pipeline); + cogl_object_unref (tex); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-no-gl-header.c b/tests/conform/test-no-gl-header.c new file mode 100644 index 0000000..9618d84 --- /dev/null +++ b/tests/conform/test-no-gl-header.c @@ -0,0 +1,16 @@ +#undef COGL_COMPILATION +#include + +/* If you just include cogl/cogl.h, you shouldn't end up including any + GL headers */ +#ifdef GL_TRUE +#error "Including cogl.h shouldn't be including any GL headers" +#endif + +void test_no_gl_header (void); + +void +test_no_gl_header (void) +{ +} + diff --git a/tests/conform/test-npot-texture.c b/tests/conform/test-npot-texture.c new file mode 100644 index 0000000..85c16c9 --- /dev/null +++ b/tests/conform/test-npot-texture.c @@ -0,0 +1,170 @@ +#include + +#include + +#include "test-utils.h" + +/* Non-power-of-two sized texture that should cause slicing */ +#define TEXTURE_SIZE 384 +/* Number of times to split the texture up on each axis */ +#define PARTS 2 +/* The texture is split into four parts, each with a different colour */ +#define PART_SIZE (TEXTURE_SIZE / PARTS) + +/* Amount of pixels to skip off the top, bottom, left and right of the + texture when reading back the stage */ +#define TEST_INSET 4 + +/* Size to actually render the texture at */ +#define TEXTURE_RENDER_SIZE TEXTURE_SIZE +/* The size of a part once rendered */ +#define PART_RENDER_SIZE (TEXTURE_RENDER_SIZE / PARTS) + +static const uint32_t corner_colors[PARTS * PARTS] = + { + /* Top left - red */ 0xff0000ff, + /* Top right - green */ 0x00ff00ff, + /* Bottom left - blue */ 0x0000ffff, + /* Bottom right - yellow */ 0xffff00ff + }; + +static void +validate_part (int xnum, + int ynum, + uint32_t color) +{ + test_utils_check_region (test_fb, + xnum * PART_RENDER_SIZE + TEST_INSET, + ynum * PART_RENDER_SIZE + TEST_INSET, + PART_RENDER_SIZE - TEST_INSET * 2, + PART_RENDER_SIZE - TEST_INSET * 2, + color); +} + +static void +validate_result (void) +{ + /* Validate that all four corners of the texture are drawn in the + right color */ + validate_part (0, 0, corner_colors[0]); + validate_part (1, 0, corner_colors[1]); + validate_part (0, 1, corner_colors[2]); + validate_part (1, 1, corner_colors[3]); +} + +static CoglTexture * +make_texture (void) +{ + void *tex_data; + uint32_t *p; + CoglTexture *tex; + int partx, party, width, height; + + p = tex_data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4); + + /* Make a texture with a different color for each part */ + for (party = 0; party < PARTS; party++) + { + height = (party < PARTS - 1 + ? PART_SIZE + : TEXTURE_SIZE - PART_SIZE * (PARTS - 1)); + + for (partx = 0; partx < PARTS; partx++) + { + uint32_t color = corner_colors[party * PARTS + partx]; + width = (partx < PARTS - 1 + ? PART_SIZE + : TEXTURE_SIZE - PART_SIZE * (PARTS - 1)); + + while (width-- > 0) + *(p++) = GUINT32_TO_BE (color); + } + + while (--height > 0) + { + memcpy (p, p - TEXTURE_SIZE, TEXTURE_SIZE * 4); + p += TEXTURE_SIZE; + } + } + + tex = test_utils_texture_new_from_data (test_ctx, + TEXTURE_SIZE, + TEXTURE_SIZE, + TEST_UTILS_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + TEXTURE_SIZE * 4, + tex_data); + + g_free (tex_data); + + if (cogl_test_verbose ()) + { + if (cogl_texture_is_sliced (tex)) + g_print ("Texture is sliced\n"); + else + g_print ("Texture is not sliced\n"); + } + + /* The texture should be sliced unless NPOTs are supported */ + g_assert (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT) + ? !cogl_texture_is_sliced (tex) + : cogl_texture_is_sliced (tex)); + + return tex; +} + +static void +paint (void) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglTexture *texture = make_texture (); + int y, x; + + cogl_pipeline_set_layer_texture (pipeline, 0, texture); + + /* Just render the texture in the top left corner */ + /* Render the texture using four separate rectangles */ + for (y = 0; y < 2; y++) + for (x = 0; x < 2; x++) + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + x * TEXTURE_RENDER_SIZE / 2, + y * TEXTURE_RENDER_SIZE / 2, + (x + 1) * + TEXTURE_RENDER_SIZE / 2, + (y + 1) * + TEXTURE_RENDER_SIZE / 2, + x / 2.0f, + y / 2.0f, + (x + 1) / 2.0f, + (y + 1) / 2.0f); + + cogl_object_unref (pipeline); + cogl_object_unref (texture); +} + +void +test_npot_texture (void) +{ + if (cogl_test_verbose ()) + { + if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT)) + g_print ("NPOT textures are supported\n"); + else + g_print ("NPOT textures are not supported\n"); + } + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (); + validate_result (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-offscreen.c b/tests/conform/test-offscreen.c new file mode 100644 index 0000000..9bc14b7 --- /dev/null +++ b/tests/conform/test-offscreen.c @@ -0,0 +1,199 @@ +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_0 + +#include + +#include "test-utils.h" + +#define RED 0 +#define GREEN 1 +#define BLUE 2 + +typedef struct _TestState +{ + int fb_width; + int fb_height; +} TestState; + +static void +check_quadrant (TestState *state, + int qx, + int qy, + uint32_t expected_rgba) +{ + /* The quadrants are all stuffed into the top right corner of the + framebuffer */ + int x = state->fb_width * qx / 4 + state->fb_width / 2; + int y = state->fb_height * qy / 4; + int width = state->fb_width / 4; + int height = state->fb_height / 4; + + /* Subtract a two-pixel gap around the edges to allow some rounding + differences */ + x += 2; + y += 2; + width -= 4; + height -= 4; + + test_utils_check_region (test_fb, x, y, width, height, expected_rgba); +} + +static void +test_paint (TestState *state) +{ + CoglTexture2D *tex_2d; + CoglTexture *tex; + CoglOffscreen *offscreen; + + tex_2d = cogl_texture_2d_new_with_size (test_ctx, + state->fb_width, + state->fb_height); + tex = tex_2d; + + offscreen = cogl_offscreen_new_with_texture (tex); + + /* Set a scale and translate transform on the window framebuffer + * before switching to the offscreen framebuffer so we can verify it + * gets restored when we switch back + * + * The test is going to draw a grid of 4 colors to a texture which + * we subsequently draw to the window with a fullscreen rectangle. + * This transform will flip the texture left to right, scale it to a + * quarter of the window size and slide it to the top right of the + * window. + */ + cogl_push_matrix (); + cogl_translate (0.5, 0.5, 0); + cogl_scale (-0.5, 0.5, 1); + + cogl_push_framebuffer (offscreen); + + /* Cogl should release the last reference when we call cogl_pop_framebuffer() + */ + cogl_object_unref (offscreen); + + /* Setup something other than the identity matrix for the modelview so we can + * verify it gets restored when we call cogl_pop_framebuffer () */ + cogl_scale (2, 2, 1); + + /* red, top left */ + cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff); + cogl_rectangle (-0.5, 0.5, 0, 0); + /* green, top right */ + cogl_set_source_color4ub (0x00, 0xff, 0x00, 0xff); + cogl_rectangle (0, 0.5, 0.5, 0); + /* blue, bottom left */ + cogl_set_source_color4ub (0x00, 0x00, 0xff, 0xff); + cogl_rectangle (-0.5, 0, 0, -0.5); + /* white, bottom right */ + cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff); + cogl_rectangle (0, 0, 0.5, -0.5); + + cogl_pop_framebuffer (); + + cogl_set_source_texture (tex); + cogl_rectangle (-1, 1, 1, -1); + + cogl_object_unref (tex_2d); + + cogl_pop_matrix (); + + /* NB: The texture is drawn flipped horizontally and scaled to fit in the + * top right corner of the window. */ + + /* red, top right */ + check_quadrant (state, 1, 0, 0xff0000ff); + /* green, top left */ + check_quadrant (state, 0, 0, 0x00ff00ff); + /* blue, bottom right */ + check_quadrant (state, 1, 1, 0x0000ffff); + /* white, bottom left */ + check_quadrant (state, 0, 1, 0xffffffff); +} + +static void +test_flush (TestState *state) +{ + CoglTexture2D *tex_2d; + CoglTexture *tex; + CoglOffscreen *offscreen; + CoglColor clear_color; + int i; + + for (i = 0; i < 3; i++) + { + /* This tests that rendering to a framebuffer and then reading back + the contents of the texture will automatically flush the + journal */ + + tex_2d = cogl_texture_2d_new_with_size (test_ctx, + 16, 16); /* width/height */ + tex = tex_2d; + + offscreen = cogl_offscreen_new_with_texture (tex); + + cogl_push_framebuffer (offscreen); + + cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 255); + cogl_clear (&clear_color, COGL_BUFFER_BIT_COLOR); + + cogl_set_source_color4ub (255, 0, 0, 255); + cogl_rectangle (-1, -1, 1, 1); + + if (i == 0) + /* First time check using read pixels on the offscreen */ + test_utils_check_region (offscreen, + 1, 1, 15, 15, 0xff0000ff); + else if (i == 1) + { + uint8_t data[16 * 4 * 16]; + int x, y; + + /* Second time try reading back the texture contents */ + cogl_texture_get_data (tex, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 16 * 4, /* rowstride */ + data); + + for (y = 1; y < 15; y++) + for (x = 1; x < 15; x++) + test_utils_compare_pixel (data + x * 4 + y * 16 * 4, + 0xff0000ff); + } + + cogl_pop_framebuffer (); + + if (i == 2) + { + /* Third time try drawing the texture to the screen */ + cogl_set_source_texture (tex); + cogl_rectangle (-1, -1, 1, 1); + test_utils_check_region (test_fb, + 2, 2, /* x/y */ + state->fb_width - 4, + state->fb_height - 4, + 0xff0000ff); + } + + cogl_object_unref (tex_2d); + cogl_object_unref (offscreen); + } +} + +void +test_offscreen (void) +{ + TestState state; + + state.fb_width = cogl_framebuffer_get_width (test_fb); + state.fb_height = cogl_framebuffer_get_height (test_fb); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (test_fb); + test_paint (&state); + test_flush (&state); + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-path-clip.c b/tests/conform/test-path-clip.c new file mode 100644 index 0000000..95ad00b --- /dev/null +++ b/tests/conform/test-path-clip.c @@ -0,0 +1,68 @@ +#define COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#include + +#include + +#include "test-utils.h" + +void +test_path_clip (void) +{ + CoglPath *path; + CoglPipeline *pipeline; + int fb_width, fb_height; + + fb_width = cogl_framebuffer_get_width (test_fb); + fb_height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, fb_width, fb_height, -1, 100); + + path = cogl_path_new (); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 0.0f, 0.0f, 1.0f); + + /* Make an L-shape with the top right corner left untouched */ + cogl_path_move_to (path, 0, fb_height); + cogl_path_line_to (path, fb_width, fb_height); + cogl_path_line_to (path, fb_width, fb_height / 2); + cogl_path_line_to (path, fb_width / 2, fb_height / 2); + cogl_path_line_to (path, fb_width / 2, 0); + cogl_path_line_to (path, 0, 0); + cogl_path_close (path); + + cogl_framebuffer_push_path_clip (test_fb, path); + + /* Try to fill the framebuffer with a blue rectangle. This should be + * clipped to leave the top right quadrant as is */ + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_color4ub (pipeline, 0, 0, 255, 255); + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 0, 0, fb_width, fb_height); + + cogl_framebuffer_pop_clip (test_fb); + + cogl_object_unref (pipeline); + cogl_object_unref (path); + + /* Check each of the four quadrants */ + test_utils_check_pixel (test_fb, + fb_width / 4, fb_height / 4, + 0x0000ffff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, fb_height / 4, + 0xff0000ff); + test_utils_check_pixel (test_fb, + fb_width / 4, fb_height * 3 / 4, + 0x0000ffff); + test_utils_check_pixel (test_fb, + fb_width * 3 / 4, fb_height * 3 / 4, + 0x0000ffff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-path.c b/tests/conform/test-path.c new file mode 100644 index 0000000..11f7f15 --- /dev/null +++ b/tests/conform/test-path.c @@ -0,0 +1,215 @@ +#define COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#include + +#include + +#include "test-utils.h" + +#define BLOCK_SIZE 16 + +/* Number of pixels at the border of a block quadrant to skip when verifying */ +#define TEST_INSET 1 + +typedef struct _TestState +{ + int dummy; +} TestState; + +static void +draw_path_at (CoglPath *path, CoglPipeline *pipeline, int x, int y) +{ + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, x * BLOCK_SIZE, y * BLOCK_SIZE, 0.0f); + + cogl_set_framebuffer (test_fb); + cogl_set_source (pipeline); + cogl_path_fill (path); + + cogl_framebuffer_pop_matrix (test_fb); +} + +static void +check_block (int block_x, int block_y, int block_mask) +{ + uint32_t data[BLOCK_SIZE * BLOCK_SIZE]; + int qx, qy; + + /* Block mask represents which quarters of the block should be + filled. The bits from 0->3 represent the top left, top right, + bottom left and bottom right respectively */ + + cogl_framebuffer_read_pixels (test_fb, + block_x * BLOCK_SIZE, + block_y * BLOCK_SIZE, + BLOCK_SIZE, BLOCK_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + (uint8_t *)data); + + for (qy = 0; qy < 2; qy++) + for (qx = 0; qx < 2; qx++) + { + int bit = qx | (qy << 1); + const char *intended_pixel = ((block_mask & (1 << bit)) ? "#ffffff" : "#000000"); + int x, y; + + for (x = 0; x < BLOCK_SIZE / 2 - TEST_INSET * 2; x++) + for (y = 0; y < BLOCK_SIZE / 2 - TEST_INSET * 2; y++) + { + const uint32_t *p = data + (qx * BLOCK_SIZE / 2 + + qy * BLOCK_SIZE * BLOCK_SIZE / 2 + + (x + TEST_INSET) + + (y + TEST_INSET) * BLOCK_SIZE); + char *screen_pixel = g_strdup_printf ("#%06x", GUINT32_FROM_BE (*p) >> 8); + g_assert_cmpstr (screen_pixel, ==, intended_pixel); + g_free (screen_pixel); + } + } +} + +static void +paint (TestState *state) +{ + CoglPath *path_a, *path_b, *path_c; + CoglPipeline *white = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4f (white, 1, 1, 1, 1); + + /* Create a path filling just a quarter of a block. It will use two + rectangles so that we have a sub path in the path */ + path_a = cogl_path_new (); + cogl_path_rectangle (path_a, + BLOCK_SIZE * 3 / 4, BLOCK_SIZE / 2, + BLOCK_SIZE, BLOCK_SIZE); + cogl_path_rectangle (path_a, + BLOCK_SIZE / 2, BLOCK_SIZE / 2, + BLOCK_SIZE * 3 / 4, BLOCK_SIZE); + draw_path_at (path_a, white, 0, 0); + + /* Create another path filling the whole block */ + path_b = cogl_path_new (); + cogl_path_rectangle (path_b, 0, 0, BLOCK_SIZE, BLOCK_SIZE); + draw_path_at (path_b, white, 1, 0); + + /* Draw the first path again */ + draw_path_at (path_a, white, 2, 0); + + /* Draw a copy of path a */ + path_c = cogl_path_copy (path_a); + draw_path_at (path_c, white, 3, 0); + + /* Add another rectangle to path a. We'll use line_to's instead of + cogl_rectangle so that we don't create another sub-path because + that is more likely to break the copy */ + cogl_path_line_to (path_a, 0, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, 0, 0); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, 0); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, BLOCK_SIZE / 2); + draw_path_at (path_a, white, 4, 0); + + /* Draw the copy again. It should not have changed */ + draw_path_at (path_c, white, 5, 0); + + /* Add another rectangle to path c. It will be added in two halves, + one as an extension of the previous path and the other as a new + sub path */ + cogl_path_line_to (path_c, BLOCK_SIZE / 2, 0); + cogl_path_line_to (path_c, BLOCK_SIZE * 3 / 4, 0); + cogl_path_line_to (path_c, BLOCK_SIZE * 3 / 4, BLOCK_SIZE / 2); + cogl_path_line_to (path_c, BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_rectangle (path_c, + BLOCK_SIZE * 3 / 4, 0, BLOCK_SIZE, BLOCK_SIZE / 2); + draw_path_at (path_c, white, 6, 0); + + /* Draw the original path again. It should not have changed */ + draw_path_at (path_a, white, 7, 0); + + cogl_object_unref (path_a); + cogl_object_unref (path_b); + cogl_object_unref (path_c); + + /* Draw a self-intersecting path. The part that intersects should be + inverted */ + path_a = cogl_path_new (); + cogl_path_rectangle (path_a, 0, 0, BLOCK_SIZE, BLOCK_SIZE); + cogl_path_line_to (path_a, 0, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, 0); + cogl_path_close (path_a); + draw_path_at (path_a, white, 8, 0); + cogl_object_unref (path_a); + + /* Draw two sub paths. Where the paths intersect it should be + inverted */ + path_a = cogl_path_new (); + cogl_path_rectangle (path_a, 0, 0, BLOCK_SIZE, BLOCK_SIZE); + cogl_path_rectangle (path_a, + BLOCK_SIZE / 2, BLOCK_SIZE / 2, BLOCK_SIZE, BLOCK_SIZE); + draw_path_at (path_a, white, 9, 0); + cogl_object_unref (path_a); + + /* Draw a clockwise outer path */ + path_a = cogl_path_new (); + cogl_path_move_to (path_a, 0, 0); + cogl_path_line_to (path_a, BLOCK_SIZE, 0); + cogl_path_line_to (path_a, BLOCK_SIZE, BLOCK_SIZE); + cogl_path_line_to (path_a, 0, BLOCK_SIZE); + cogl_path_close (path_a); + /* Add a clockwise sub path in the upper left quadrant */ + cogl_path_move_to (path_a, 0, 0); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, 0); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, 0, BLOCK_SIZE / 2); + cogl_path_close (path_a); + /* Add a counter-clockwise sub path in the upper right quadrant */ + cogl_path_move_to (path_a, BLOCK_SIZE / 2, 0); + cogl_path_line_to (path_a, BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, BLOCK_SIZE, BLOCK_SIZE / 2); + cogl_path_line_to (path_a, BLOCK_SIZE, 0); + cogl_path_close (path_a); + /* Retain the path for the next test */ + draw_path_at (path_a, white, 10, 0); + + /* Draw the same path again with the other fill rule */ + cogl_path_set_fill_rule (path_a, COGL_PATH_FILL_RULE_NON_ZERO); + draw_path_at (path_a, white, 11, 0); + + cogl_object_unref (path_a); +} + +static void +validate_result () +{ + check_block (0, 0, 0x8 /* bottom right */); + check_block (1, 0, 0xf /* all of them */); + check_block (2, 0, 0x8 /* bottom right */); + check_block (3, 0, 0x8 /* bottom right */); + check_block (4, 0, 0x9 /* top left and bottom right */); + check_block (5, 0, 0x8 /* bottom right */); + check_block (6, 0, 0xa /* bottom right and top right */); + check_block (7, 0, 0x9 /* top_left and bottom right */); + check_block (8, 0, 0xe /* all but top left */); + check_block (9, 0, 0x7 /* all but bottom right */); + check_block (10, 0, 0xc /* bottom two */); + check_block (11, 0, 0xd /* all but top right */); +} + +void +test_path (void) +{ + TestState state; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (&state); + validate_result (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-pipeline-cache-unrefs-texture.c b/tests/conform/test-pipeline-cache-unrefs-texture.c new file mode 100644 index 0000000..5d278dc --- /dev/null +++ b/tests/conform/test-pipeline-cache-unrefs-texture.c @@ -0,0 +1,91 @@ +#include + +#include "test-utils.h" + +/* Keep track of the number of textures that we've created and are + * still alive */ +static int destroyed_texture_count = 0; + +#define N_TEXTURES 3 + +static void +free_texture_cb (void *user_data) +{ + destroyed_texture_count++; +} + +static CoglTexture * +create_texture (void) +{ + static const guint8 data[] = + { 0xff, 0xff, 0xff, 0xff }; + static CoglUserDataKey texture_data_key; + CoglTexture2D *tex_2d; + + tex_2d = cogl_texture_2d_new_from_data (test_ctx, + 1, 1, /* width / height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + data, + NULL); + + /* Set some user data on the texture so we can track when it has + * been destroyed */ + cogl_object_set_user_data (COGL_OBJECT (tex_2d), + &texture_data_key, + GINT_TO_POINTER (1), + free_texture_cb); + + return tex_2d; +} + +void +test_pipeline_cache_unrefs_texture (void) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglPipeline *simple_pipeline; + int i; + + /* Create a pipeline with three texture layers. That way we can be + * pretty sure the pipeline will cause a unique shader to be + * generated in the cache */ + for (i = 0; i < N_TEXTURES; i++) + { + CoglTexture *tex = create_texture (); + cogl_pipeline_set_layer_texture (pipeline, i, tex); + cogl_object_unref (tex); + } + + /* Draw something with the pipeline to ensure it gets into the + * pipeline cache */ + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 0, 0, 10, 10); + cogl_framebuffer_finish (test_fb); + + /* Draw something else so that it is no longer the current flushed + * pipeline, and the units have a different texture bound */ + simple_pipeline = cogl_pipeline_new (test_ctx); + for (i = 0; i < N_TEXTURES; i++) + { + CoglColor combine_constant; + cogl_color_init_from_4ub (&combine_constant, i, 0, 0, 255); + cogl_pipeline_set_layer_combine_constant (simple_pipeline, + i, + &combine_constant); + } + cogl_framebuffer_draw_rectangle (test_fb, simple_pipeline, 0, 0, 10, 10); + cogl_framebuffer_finish (test_fb); + cogl_object_unref (simple_pipeline); + + g_assert_cmpint (destroyed_texture_count, ==, 0); + + /* Destroy the pipeline. This should immediately cause the textures + * to be freed */ + cogl_object_unref (pipeline); + + g_assert_cmpint (destroyed_texture_count, ==, N_TEXTURES); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-pipeline-shader-state.c b/tests/conform/test-pipeline-shader-state.c new file mode 100644 index 0000000..4d1e5f2 --- /dev/null +++ b/tests/conform/test-pipeline-shader-state.c @@ -0,0 +1,93 @@ +#include + +#include + +#include "test-utils.h" + +void +test_pipeline_shader_state (void) +{ + CoglOffscreen *offscreen; + CoglFramebuffer *fb; + CoglPipeline *base_pipeline; + CoglPipeline *draw_pipeline; + CoglTexture2D *tex; + CoglSnippet *snippet; + + float width = cogl_framebuffer_get_width (test_fb); + float height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, width, height, + -1, + 100); + + tex = cogl_texture_2d_new_with_size (test_ctx, 128, 128); + offscreen = cogl_offscreen_new_with_texture (tex); + fb = offscreen; + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + cogl_object_unref (offscreen); + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 1, 1, 0, 1); + + + /* Setup a template pipeline... */ + + base_pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (base_pipeline, 1, tex); + cogl_pipeline_set_color4f (base_pipeline, 1, 0, 0, 1); + + + /* Derive a pipeline from the template, making a change that affects + * fragment processing but making sure not to affect vertex + * processing... */ + + draw_pipeline = cogl_pipeline_copy (base_pipeline); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + "cogl_color_out = vec4 (0.0, 1.0, 0.1, 1.1);"); + cogl_pipeline_add_snippet (draw_pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline, + 0, 0, width, height); + + cogl_object_unref (draw_pipeline); + + cogl_framebuffer_finish (test_fb); + + + /* At this point we should have provoked cogl to cache some vertex + * shader state for the draw_pipeline with the base_pipeline because + * none of the changes made to the draw_pipeline affected vertex + * processing. (NB: cogl will cache shader state with the oldest + * ancestor that the state is still valid for to maximize the chance + * that it can be used with other derived pipelines) + * + * Now we make a change to the base_pipeline to make sure that this + * cached vertex shader gets invalidated. + */ + + cogl_pipeline_set_layer_texture (base_pipeline, 0, tex); + + + /* Now we derive another pipeline from base_pipeline to verify that + * it doesn't end up re-using the old cached state + */ + + draw_pipeline = cogl_pipeline_copy (base_pipeline); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + "cogl_color_out = vec4 (0.0, 0.0, 1.1, 1.1);"); + cogl_pipeline_add_snippet (draw_pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline, + 0, 0, width, height); + + cogl_object_unref (draw_pipeline); + + + test_utils_check_region (test_fb, 0, 0, width, height, + 0x0000ffff); +} diff --git a/tests/conform/test-pipeline-uniforms.c b/tests/conform/test-pipeline-uniforms.c new file mode 100644 index 0000000..4d27558 --- /dev/null +++ b/tests/conform/test-pipeline-uniforms.c @@ -0,0 +1,415 @@ +#include + +#include + +#include "test-utils.h" + +#define LONG_ARRAY_SIZE 128 + +typedef struct _TestState +{ + CoglPipeline *pipeline_red; + CoglPipeline *pipeline_green; + CoglPipeline *pipeline_blue; + + CoglPipeline *matrix_pipeline; + CoglPipeline *vector_pipeline; + CoglPipeline *int_pipeline; + + CoglPipeline *long_pipeline; + int long_uniform_locations[LONG_ARRAY_SIZE]; +} TestState; + +static const char +color_source[] = + "uniform float red, green, blue;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " cogl_color_out = vec4 (red, green, blue, 1.0);\n" + "}\n"; + +static const char +matrix_source[] = + "uniform mat4 matrix_array[4];\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " vec4 color = vec4 (0.0, 0.0, 0.0, 1.0);\n" + " int i;\n" + "\n" + " for (i = 0; i < 4; i++)\n" + " color = matrix_array[i] * color;\n" + "\n" + " cogl_color_out = color;\n" + "}\n"; + +static const char +vector_source[] = + "uniform vec4 vector_array[2];\n" + "uniform vec3 short_vector;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " cogl_color_out = (vector_array[0] +\n" + " vector_array[1] +\n" + " vec4 (short_vector, 1.0));\n" + "}\n"; + +static const char +int_source[] = + "uniform ivec4 vector_array[2];\n" + "uniform int single_value;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " cogl_color_out = (vec4 (vector_array[0]) +\n" + " vec4 (vector_array[1]) +\n" + " vec4 (float (single_value), 0.0, 0.0, 255.0)) / 255.0;\n" + "}\n"; + +static const char +long_source[] = + "uniform int long_array[" G_STRINGIFY (LONG_ARRAY_SIZE) "];\n" + "const int last_index = " G_STRINGIFY (LONG_ARRAY_SIZE) " - 1;\n" + "\n" + "void\n" + "main ()\n" + "{\n" + " cogl_color_out = vec4 (float (long_array[last_index]), 0.0, 0.0, 1.0);\n" + "}\n"; + +static CoglPipeline * +create_pipeline_for_shader (TestState *state, const char *shader_source) +{ + CoglPipeline *pipeline; + CoglHandle shader; + CoglHandle program; + + pipeline = cogl_pipeline_new (test_ctx); + + shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + cogl_shader_source (shader, shader_source); + + program = cogl_create_program (); + cogl_program_attach_shader (program, shader); + + cogl_pipeline_set_user_program (pipeline, program); + + cogl_handle_unref (shader); + cogl_handle_unref (program); + + return pipeline; +} + +static void +init_state (TestState *state) +{ + int uniform_location; + + state->pipeline_red = create_pipeline_for_shader (state, color_source); + + uniform_location = + cogl_pipeline_get_uniform_location (state->pipeline_red, "red"); + cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 1.0f); + uniform_location = + cogl_pipeline_get_uniform_location (state->pipeline_red, "green"); + cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 0.0f); + uniform_location = + cogl_pipeline_get_uniform_location (state->pipeline_red, "blue"); + cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 0.0f); + + state->pipeline_green = cogl_pipeline_copy (state->pipeline_red); + uniform_location = + cogl_pipeline_get_uniform_location (state->pipeline_green, "green"); + cogl_pipeline_set_uniform_1f (state->pipeline_green, uniform_location, 1.0f); + + state->pipeline_blue = cogl_pipeline_copy (state->pipeline_red); + uniform_location = + cogl_pipeline_get_uniform_location (state->pipeline_blue, "blue"); + cogl_pipeline_set_uniform_1f (state->pipeline_blue, uniform_location, 1.0f); + + state->matrix_pipeline = create_pipeline_for_shader (state, matrix_source); + state->vector_pipeline = create_pipeline_for_shader (state, vector_source); + state->int_pipeline = create_pipeline_for_shader (state, int_source); + + state->long_pipeline = NULL; +} + +static void +init_long_pipeline_state (TestState *state) +{ + int i; + + state->long_pipeline = create_pipeline_for_shader (state, long_source); + + /* This tries to lookup a large number of uniform names to make sure + that the bitmask of overriden uniforms flows over the size of a + single long so that it has to resort to allocating it */ + for (i = 0; i < LONG_ARRAY_SIZE; i++) + { + char *uniform_name = g_strdup_printf ("long_array[%i]", i); + state->long_uniform_locations[i] = + cogl_pipeline_get_uniform_location (state->long_pipeline, + uniform_name); + g_free (uniform_name); + } +} + +static void +destroy_state (TestState *state) +{ + cogl_object_unref (state->pipeline_red); + cogl_object_unref (state->pipeline_green); + cogl_object_unref (state->pipeline_blue); + cogl_object_unref (state->matrix_pipeline); + cogl_object_unref (state->vector_pipeline); + cogl_object_unref (state->int_pipeline); + + if (state->long_pipeline) + cogl_object_unref (state->long_pipeline); +} + +static void +paint_pipeline (CoglPipeline *pipeline, int pos) +{ + cogl_framebuffer_draw_rectangle (test_fb, pipeline, + pos * 10, 0, pos * 10 + 10, 10); +} + +static void +paint_color_pipelines (TestState *state) +{ + CoglPipeline *temp_pipeline; + int uniform_location; + int i; + + /* Paint with the first pipeline that sets the uniforms to bright + red */ + paint_pipeline (state->pipeline_red, 0); + + /* Paint with the two other pipelines. These inherit from the red + pipeline and only override one other component. The values for + the two other components should be inherited from the red + pipeline. */ + paint_pipeline (state->pipeline_green, 1); + paint_pipeline (state->pipeline_blue, 2); + + /* Try modifying a single pipeline for multiple rectangles */ + temp_pipeline = cogl_pipeline_copy (state->pipeline_green); + uniform_location = cogl_pipeline_get_uniform_location (temp_pipeline, + "green"); + + for (i = 0; i <= 8; i++) + { + cogl_pipeline_set_uniform_1f (temp_pipeline, uniform_location, + i / 8.0f); + paint_pipeline (temp_pipeline, i + 3); + } + + cogl_object_unref (temp_pipeline); +} + +static void +paint_matrix_pipeline (CoglPipeline *pipeline) +{ + CoglMatrix matrices[4]; + float matrix_floats[16 * 4]; + int uniform_location; + int i; + + for (i = 0; i < 4; i++) + cogl_matrix_init_identity (matrices + i); + + /* Use the first matrix to make the color red */ + cogl_matrix_translate (matrices + 0, 1.0f, 0.0f, 0.0f); + + /* Rotate the vertex so that it ends up green */ + cogl_matrix_rotate (matrices + 1, 90.0f, 0.0f, 0.0f, 1.0f); + + /* Scale the vertex so it ends up halved */ + cogl_matrix_scale (matrices + 2, 0.5f, 0.5f, 0.5f); + + /* Add a blue component in the final matrix. The final matrix is + uploaded as transposed so we need to transpose first to cancel + that out */ + cogl_matrix_translate (matrices + 3, 0.0f, 0.0f, 1.0f); + cogl_matrix_transpose (matrices + 3); + + for (i = 0; i < 4; i++) + memcpy (matrix_floats + i * 16, + cogl_matrix_get_array (matrices + i), + sizeof (float) * 16); + + /* Set the first three matrices as transposed */ + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "matrix_array"); + cogl_pipeline_set_uniform_matrix (pipeline, + uniform_location, + 4, /* dimensions */ + 3, /* count */ + FALSE, /* not transposed */ + matrix_floats); + + /* Set the last matrix as untransposed */ + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "matrix_array[3]"); + cogl_pipeline_set_uniform_matrix (pipeline, + uniform_location, + 4, /* dimensions */ + 1, /* count */ + TRUE, /* transposed */ + matrix_floats + 16 * 3); + + paint_pipeline (pipeline, 12); +} + +static void +paint_vector_pipeline (CoglPipeline *pipeline) +{ + float vector_array_values[] = { 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f }; + float short_vector_values[] = { 0.0f, 0.0f, 1.0f }; + int uniform_location; + + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "vector_array"); + cogl_pipeline_set_uniform_float (pipeline, + uniform_location, + 4, /* n_components */ + 2, /* count */ + vector_array_values); + + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "short_vector"); + cogl_pipeline_set_uniform_float (pipeline, + uniform_location, + 3, /* n_components */ + 1, /* count */ + short_vector_values); + + paint_pipeline (pipeline, 13); +} + +static void +paint_int_pipeline (CoglPipeline *pipeline) +{ + int vector_array_values[] = { 0x00, 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, 0x00 }; + int single_value = 0x80; + int uniform_location; + + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "vector_array"); + cogl_pipeline_set_uniform_int (pipeline, + uniform_location, + 4, /* n_components */ + 2, /* count */ + vector_array_values); + + uniform_location = + cogl_pipeline_get_uniform_location (pipeline, "single_value"); + cogl_pipeline_set_uniform_1i (pipeline, + uniform_location, + single_value); + + paint_pipeline (pipeline, 14); +} + +static void +paint_long_pipeline (TestState *state) +{ + int i; + + for (i = 0; i < LONG_ARRAY_SIZE; i++) + { + int location = state->long_uniform_locations[i]; + + cogl_pipeline_set_uniform_1i (state->long_pipeline, + location, + i == LONG_ARRAY_SIZE - 1); + } + + paint_pipeline (state->long_pipeline, 15); +} + +static void +paint (TestState *state) +{ + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + paint_color_pipelines (state); + paint_matrix_pipeline (state->matrix_pipeline); + paint_vector_pipeline (state->vector_pipeline); + paint_int_pipeline (state->int_pipeline); +} + +static void +check_pos (int pos, uint32_t color) +{ + test_utils_check_pixel (test_fb, pos * 10 + 5, 5, color); +} + +static void +validate_result (void) +{ + int i; + + check_pos (0, 0xff0000ff); + check_pos (1, 0xffff00ff); + check_pos (2, 0xff00ffff); + + for (i = 0; i <= 8; i++) + { + int green_value = i / 8.0f * 255.0f + 0.5f; + check_pos (i + 3, 0xff0000ff + (green_value << 16)); + } + + check_pos (12, 0x0080ffff); + check_pos (13, 0xffffffff); + check_pos (14, 0x80ffffff); +} + +static void +validate_long_pipeline_result (void) +{ + check_pos (15, 0xff0000ff); +} + +void +test_pipeline_uniforms (void) +{ + TestState state; + + init_state (&state); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (&state); + validate_result (); + + /* Try the test again after querying the location of a large + number of uniforms. This should verify that the bitmasks + still work even if they have to allocate a separate array to + store the bits */ + + init_long_pipeline_state (&state); + paint (&state); + paint_long_pipeline (&state); + validate_result (); + validate_long_pipeline_result (); + + destroy_state (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-pipeline-user-matrix.c b/tests/conform/test-pipeline-user-matrix.c new file mode 100644 index 0000000..f7cdee8 --- /dev/null +++ b/tests/conform/test-pipeline-user-matrix.c @@ -0,0 +1,140 @@ +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int width; + int height; +} TestState; + +static void +validate_result (TestState *state) +{ + uint32_t *pixels, *p; + char *screen_pixel; + const char *intended_pixel = "#ffffff"; + + /* The textures are setup so that when added together with the + correct matrices then all of the pixels should be white. We can + verify this by reading back the entire stage */ + pixels = g_malloc (state->width * state->height * 4); + + cogl_framebuffer_read_pixels (test_fb, 0, 0, state->width, state->height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + (uint8_t *)pixels); + + for (p = pixels; p < pixels + state->width * state->height; p++) + { + screen_pixel = g_strdup_printf ("#%06x", GUINT32_FROM_BE (*p) >> 8); + g_assert_cmpstr (screen_pixel, ==, intended_pixel); + g_free (screen_pixel); + } +} + +static void +paint (TestState *state) +{ + /* This texture is painted mirrored around the x-axis */ + uint8_t data0[] = { + 0xff, 0x00, 0x00, /* red -> becomes bottom left */ + 0x00, 0xff, 0x00, /* green -> becomes bottom right */ + 0x00, 0x00, 0xff, /* blue -> becomes top left */ + 0xff, 0x00, 0xff /* magenta -> becomes top right */ + }; + /* This texture is painted mirrored about the y-axis */ + uint8_t data1[] = { + 0x00, 0xff, 0x00, /* green -> becomes top right */ + 0xff, 0xff, 0x00, /* yellow -> becomes top left */ + 0xff, 0x00, 0xff, /* magenta -> becomes bottom right */ + 0x00, 0xff, 0xff /* cyan -> becomes bottom left */ + }; + CoglTexture *tex0, *tex1; + CoglPipeline *pipeline; + CoglMatrix matrix; + CoglError *error = NULL; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + state->width, + state->height, + -1, + 100); + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_matrix_init_identity (&matrix); + cogl_framebuffer_set_modelview_matrix (test_fb, &matrix); + + tex0 = cogl_texture_new_from_data (2, 2, + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGB_888, + COGL_PIXEL_FORMAT_ANY, + 6, + data0); + tex1 = cogl_texture_new_from_data (2, 2, + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGB_888, + COGL_PIXEL_FORMAT_ANY, + 6, + data1); + + pipeline = cogl_pipeline_new (test_ctx); + + /* Set the two textures as layers */ + cogl_pipeline_set_layer_texture (pipeline, 0, tex0); + cogl_pipeline_set_layer_filters (pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_layer_texture (pipeline, 1, tex1); + cogl_pipeline_set_layer_filters (pipeline, 1, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + /* Set a combine mode so that the two textures get added together */ + if (!cogl_pipeline_set_layer_combine (pipeline, 1, + "RGBA=ADD(PREVIOUS, TEXTURE)", + &error)) + { + g_warning ("Error setting blend string: %s", error->message); + g_assert_not_reached (); + } + + /* Set a matrix on the first layer so that it will mirror about the y-axis */ + cogl_matrix_init_identity (&matrix); + cogl_matrix_translate (&matrix, 0.0f, 1.0f, 0.0f); + cogl_matrix_scale (&matrix, 1.0f, -1.0f, 1.0f); + cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix); + + /* Set a matrix on the second layer so that it will mirror about the x-axis */ + cogl_matrix_init_identity (&matrix); + cogl_matrix_translate (&matrix, 1.0f, 0.0f, 0.0f); + cogl_matrix_scale (&matrix, -1.0f, 1.0f, 1.0f); + cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 0, 0, + state->width, state->height); + + cogl_object_unref (tex1); + cogl_object_unref (tex0); + cogl_object_unref (pipeline); +} + +void +test_pipeline_user_matrix (void) +{ + TestState state; + + state.width = cogl_framebuffer_get_width (test_fb); + state.height = cogl_framebuffer_get_height (test_fb); + + paint (&state); + validate_result (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-pixel-buffer.c b/tests/conform/test-pixel-buffer.c new file mode 100644 index 0000000..a78516d --- /dev/null +++ b/tests/conform/test-pixel-buffer.c @@ -0,0 +1,269 @@ +#include +#include + +#include "test-utils.h" + +#define BITMAP_SIZE 256 + +/* + * Creates a 256 x 256 with image data split into four quadrants. The + * colours of these in reading order will be: blue, green, cyan, + * red */ +static void +generate_bitmap_data (uint8_t *data, + int stride) +{ + int y, x; + + for (y = 0; y < BITMAP_SIZE; y++) + { + for (x = 0; x < BITMAP_SIZE; x++) + { + int color_num = x / (BITMAP_SIZE / 2) + y / (BITMAP_SIZE / 2) * 2 + 1; + *(data++) = (color_num & 4) ? 255 : 0; + *(data++) = (color_num & 2) ? 255 : 0; + *(data++) = (color_num & 1) ? 255 : 0; + *(data++) = 255; + } + data += stride - BITMAP_SIZE * 4; + } +} + +static CoglBitmap * +create_bitmap (void) +{ + CoglBitmap *bitmap; + CoglBuffer *buffer; + + bitmap = cogl_bitmap_new_with_size (test_ctx, + BITMAP_SIZE, + BITMAP_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888); + buffer = cogl_bitmap_get_buffer (bitmap); + + g_assert (cogl_is_pixel_buffer (buffer)); + g_assert (cogl_is_buffer (buffer)); + + cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_DYNAMIC); + g_assert_cmpint (cogl_buffer_get_update_hint (buffer), + ==, + COGL_BUFFER_UPDATE_HINT_DYNAMIC); + + return bitmap; +} + +static CoglBitmap * +create_and_fill_bitmap (void) +{ + CoglBitmap *bitmap = create_bitmap (); + CoglBuffer *buffer = cogl_bitmap_get_buffer (bitmap); + uint8_t *map; + unsigned int stride; + + stride = cogl_bitmap_get_rowstride (bitmap); + + map = cogl_buffer_map (buffer, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + g_assert (map); + + generate_bitmap_data (map, stride); + + cogl_buffer_unmap (buffer); + + return bitmap; +} + +static CoglTexture * +create_texture_from_bitmap (CoglBitmap *bitmap) +{ + CoglTexture2D *texture; + + texture = cogl_texture_2d_new_from_bitmap (bitmap); + + g_assert (texture != NULL); + + return texture; +} + +static CoglPipeline * +create_pipeline_from_texture (CoglTexture *texture) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 0, texture); + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer_num */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + return pipeline; +} + +static void +check_colours (uint32_t color0, + uint32_t color1, + uint32_t color2, + uint32_t color3) +{ + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + + test_utils_check_region (test_fb, + 1, 1, /* x/y */ + fb_width / 2 - 2, /* width */ + fb_height / 2 - 2, /* height */ + color0); + test_utils_check_region (test_fb, + fb_width / 2 + 1, /* x */ + 1, /* y */ + fb_width / 2 - 2, /* width */ + fb_height / 2 - 2, /* height */ + color1); + test_utils_check_region (test_fb, + 1, /* x */ + fb_height / 2 + 1, /* y */ + fb_width / 2 - 2, /* width */ + fb_height / 2 - 2, /* height */ + color2); + test_utils_check_region (test_fb, + fb_width / 2 + 1, /* x */ + fb_height / 2 + 1, /* y */ + fb_width / 2 - 2, /* width */ + fb_height / 2 - 2, /* height */ + color3); +} + +void +test_pixel_buffer_map (void) +{ + CoglBitmap *bitmap = create_and_fill_bitmap (); + CoglPipeline *pipeline; + CoglTexture *texture; + + texture = create_texture_from_bitmap (bitmap); + pipeline = create_pipeline_from_texture (texture); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1.0f, 1.0f, + 1.0f, -1.0f); + + cogl_object_unref (bitmap); + cogl_object_unref (texture); + cogl_object_unref (pipeline); + + check_colours (0x0000ffff, + 0x00ff00ff, + 0x00ffffff, + 0xff0000ff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + +void +test_pixel_buffer_set_data (void) +{ + CoglBitmap *bitmap = create_bitmap (); + CoglBuffer *buffer = cogl_bitmap_get_buffer (bitmap); + CoglPipeline *pipeline; + CoglTexture *texture; + uint8_t *data; + unsigned int stride; + + stride = cogl_bitmap_get_rowstride (bitmap); + + data = g_malloc (stride * BITMAP_SIZE); + + generate_bitmap_data (data, stride); + + cogl_buffer_set_data (buffer, + 0, /* offset */ + data, + stride * (BITMAP_SIZE - 1) + + BITMAP_SIZE * 4); + + g_free (data); + + texture = create_texture_from_bitmap (bitmap); + pipeline = create_pipeline_from_texture (texture); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1.0f, 1.0f, + 1.0f, -1.0f); + + cogl_object_unref (bitmap); + cogl_object_unref (texture); + cogl_object_unref (pipeline); + + check_colours (0x0000ffff, + 0x00ff00ff, + 0x00ffffff, + 0xff0000ff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + +static CoglTexture * +create_white_texture (void) +{ + CoglTexture2D *texture; + uint8_t *data = g_malloc (BITMAP_SIZE * BITMAP_SIZE * 4); + + memset (data, 255, BITMAP_SIZE * BITMAP_SIZE * 4); + + texture = cogl_texture_2d_new_from_data (test_ctx, + BITMAP_SIZE, + BITMAP_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888, + BITMAP_SIZE * 4, /* rowstride */ + data, + NULL); /* don't catch errors */ + + g_free (data); + + return texture; +} + +void +test_pixel_buffer_sub_region (void) +{ + CoglBitmap *bitmap = create_and_fill_bitmap (); + CoglPipeline *pipeline; + CoglTexture *texture; + + texture = create_white_texture (); + + /* Replace the top-right quadrant of the texture with the red part + * of the bitmap */ + cogl_texture_set_region_from_bitmap (texture, + BITMAP_SIZE / 2, /* src_x */ + BITMAP_SIZE / 2, /* src_y */ + BITMAP_SIZE / 2, /* dst_x */ + 0, /* dst_y */ + BITMAP_SIZE / 2, /* width */ + BITMAP_SIZE / 2, /* height */ + bitmap); + + pipeline = create_pipeline_from_texture (texture); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1.0f, 1.0f, + 1.0f, -1.0f); + + cogl_object_unref (bitmap); + cogl_object_unref (texture); + cogl_object_unref (pipeline); + + check_colours (0xffffffff, + 0xff0000ff, + 0xffffffff, + 0xffffffff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-point-size-attribute.c b/tests/conform/test-point-size-attribute.c new file mode 100644 index 0000000..a08d1da --- /dev/null +++ b/tests/conform/test-point-size-attribute.c @@ -0,0 +1,166 @@ +#include + +#include "test-utils.h" + +/* This test assumes the GL driver supports point sizes up to 16 + pixels. Cogl should probably have some way of querying the size so + we start from that instead */ +#define MAX_POINT_SIZE 16 +#define MIN_POINT_SIZE 4 +#define N_POINTS (MAX_POINT_SIZE - MIN_POINT_SIZE + 1) +/* The size of the area that we'll paint each point in */ +#define POINT_BOX_SIZE (MAX_POINT_SIZE * 2) + +typedef struct +{ + float x, y; + float point_size; +} PointVertex; + +static int +calc_coord_offset (int pos, int pos_index, int point_size) +{ + switch (pos_index) + { + case 0: return pos - point_size / 2 - 2; + case 1: return pos - point_size / 2 + 2; + case 2: return pos + point_size / 2 - 2; + case 3: return pos + point_size / 2 + 2; + } + + g_assert_not_reached (); +} + +static void +verify_point_size (CoglFramebuffer *test_fb, + int x_pos, + int y_pos, + int point_size) +{ + int y, x; + + for (y = 0; y < 4; y++) + for (x = 0; x < 4; x++) + { + CoglBool in_point = x >= 1 && x <= 2 && y >= 1 && y <= 2; + uint32_t expected_pixel = in_point ? 0x00ff00ff : 0xff0000ff; + + test_utils_check_pixel (test_fb, + calc_coord_offset (x_pos, x, point_size), + calc_coord_offset (y_pos, y, point_size), + expected_pixel); + } +} + +static CoglPrimitive * +create_primitive (const char *attribute_name) +{ + PointVertex vertices[N_POINTS]; + CoglAttributeBuffer *buffer; + CoglAttribute *attributes[2]; + CoglPrimitive *prim; + int i; + + for (i = 0; i < N_POINTS; i++) + { + vertices[i].x = i * POINT_BOX_SIZE + POINT_BOX_SIZE / 2; + vertices[i].y = POINT_BOX_SIZE / 2; + vertices[i].point_size = MAX_POINT_SIZE - i; + } + + buffer = cogl_attribute_buffer_new (test_ctx, + sizeof (vertices), + vertices); + + attributes[0] = cogl_attribute_new (buffer, + "cogl_position_in", + sizeof (PointVertex), + G_STRUCT_OFFSET (PointVertex, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (buffer, + attribute_name, + sizeof (PointVertex), + G_STRUCT_OFFSET (PointVertex, point_size), + 1, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + + prim = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_POINTS, + N_POINTS, + attributes, + 2 /* n_attributes */); + + for (i = 0; i < 2; i++) + cogl_object_unref (attributes[i]); + + return prim; +} + +static void +do_test (const char *attribute_name, + void (* pipeline_setup_func) (CoglPipeline *pipeline)) +{ + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + CoglPrimitive *primitive; + CoglPipeline *pipeline; + int i; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 0.0f, 0.0f, 1.0f); + + primitive = create_primitive (attribute_name); + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_color4ub (pipeline, 0x00, 0xff, 0x00, 0xff); + cogl_pipeline_set_per_vertex_point_size (pipeline, TRUE, NULL); + if (pipeline_setup_func) + pipeline_setup_func (pipeline); + cogl_primitive_draw (primitive, test_fb, pipeline); + cogl_object_unref (pipeline); + cogl_object_unref (primitive); + + /* Verify all of the points where drawn at the right size */ + for (i = 0; i < N_POINTS; i++) + verify_point_size (test_fb, + i * POINT_BOX_SIZE + POINT_BOX_SIZE / 2, /* x */ + POINT_BOX_SIZE / 2, /* y */ + MAX_POINT_SIZE - i /* point size */); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + +void +test_point_size_attribute (void) +{ + do_test ("cogl_point_size_in", NULL); +} + +static void +setup_snippet (CoglPipeline *pipeline) +{ + CoglSnippet *snippet; + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_POINT_SIZE, + "attribute float " + "my_super_duper_point_size_attrib;\n", + NULL); + cogl_snippet_set_replace (snippet, + "cogl_point_size_out = " + "my_super_duper_point_size_attrib;\n"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); +} + +void +test_point_size_attribute_snippet (void) +{ + do_test ("my_super_duper_point_size_attrib", setup_snippet); +} diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c new file mode 100644 index 0000000..3c3af0f --- /dev/null +++ b/tests/conform/test-point-size.c @@ -0,0 +1,99 @@ +#include + +#include "test-utils.h" + +/* This test assumes the GL driver supports point sizes up to 16 + pixels. Cogl should probably have some way of querying the size so + we start from that instead */ +#define MAX_POINT_SIZE 16 +/* The size of the area that we'll paint each point in */ +#define POINT_BOX_SIZE (MAX_POINT_SIZE * 2) + +static int +calc_coord_offset (int pos, int pos_index, int point_size) +{ + switch (pos_index) + { + case 0: return pos - point_size / 2 - 2; + case 1: return pos - point_size / 2 + 2; + case 2: return pos + point_size / 2 - 2; + case 3: return pos + point_size / 2 + 2; + } + + g_assert_not_reached (); +} + +static void +verify_point_size (CoglFramebuffer *test_fb, + int x_pos, + int y_pos, + int point_size) +{ + int y, x; + + for (y = 0; y < 4; y++) + for (x = 0; x < 4; x++) + { + CoglBool in_point = x >= 1 && x <= 2 && y >= 1 && y <= 2; + uint32_t expected_pixel = in_point ? 0x00ff00ff : 0xff0000ff; + + test_utils_check_pixel (test_fb, + calc_coord_offset (x_pos, x, point_size), + calc_coord_offset (y_pos, y, point_size), + expected_pixel); + } +} + +void +test_point_size (void) +{ + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + int point_size; + int x_pos; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 0.0f, 0.0f, 1.0f); + + /* Try a rendering a single point with a few different point + sizes */ + for (x_pos = 0, point_size = MAX_POINT_SIZE; + point_size >= 4; + x_pos += POINT_BOX_SIZE, point_size /= 2) + { + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + CoglVertexP2 point = { x_pos + POINT_BOX_SIZE / 2, + POINT_BOX_SIZE / 2 }; + CoglPrimitive *prim = + cogl_primitive_new_p2 (test_ctx, + COGL_VERTICES_MODE_POINTS, + 1, /* n_vertices */ + &point); + + cogl_pipeline_set_point_size (pipeline, point_size); + cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255); + cogl_primitive_draw (prim, test_fb, pipeline); + + cogl_object_unref (prim); + cogl_object_unref (pipeline); + } + + /* Verify all of the points where drawn at the right size */ + for (x_pos = 0, point_size = MAX_POINT_SIZE; + point_size >= 4; + x_pos += POINT_BOX_SIZE, point_size /= 2) + verify_point_size (test_fb, + x_pos + POINT_BOX_SIZE / 2, + POINT_BOX_SIZE / 2, + point_size); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c new file mode 100644 index 0000000..eb80cfb --- /dev/null +++ b/tests/conform/test-point-sprite.c @@ -0,0 +1,194 @@ +#include + +#include "test-utils.h" + +#define POINT_SIZE 8 + +static const CoglVertexP2T2 +point = + { + POINT_SIZE, POINT_SIZE, + 0.0f, 0.0f + }; + +static const uint8_t +tex_data[3 * 2 * 2] = + { + 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, + 0x00, 0xff, 0xff, 0xff, 0x00, 0x00 + }; + +static void +do_test (CoglBool check_orientation, + CoglBool use_glsl) +{ + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + CoglPrimitive *prim; + CoglError *error = NULL; + CoglTexture2D *tex_2d; + CoglPipeline *pipeline, *solid_pipeline; + int tex_height; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 1.0f, 1.0f, 1.0f); + + /* If we're not checking the orientation of the point sprite then + * we'll set the height of the texture to 1 so that the vertical + * orientation does not matter */ + if (check_orientation) + tex_height = 2; + else + tex_height = 1; + + tex_2d = cogl_texture_2d_new_from_data (test_ctx, + 2, tex_height, /* width/height */ + COGL_PIXEL_FORMAT_RGB_888, + 6, /* row stride */ + tex_data, + &error); + g_assert (tex_2d != NULL); + g_assert (error == NULL); + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, tex_2d); + + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer_index */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_point_size (pipeline, POINT_SIZE); + + /* If we're using GLSL then we don't need to enable point sprite + * coords and we can just directly reference cogl_point_coord in the + * snippet */ + if (use_glsl) + { + CoglSnippet *snippet = + cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP, + NULL, /* declarations */ + NULL /* post */); + static const char source[] = + " cogl_texel = texture2D (cogl_sampler, cogl_point_coord);\n"; + + cogl_snippet_set_replace (snippet, source); + + /* Keep a reference to the original pipeline because there is no + * way to remove a snippet in order to recreate the solid + * pipeline */ + solid_pipeline = cogl_pipeline_copy (pipeline); + + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + + cogl_object_unref (snippet); + } + else + { + CoglBool res = + cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline, + /* layer_index */ + 0, + /* enable */ + TRUE, + &error); + g_assert (res == TRUE); + g_assert (error == NULL); + + solid_pipeline = cogl_pipeline_copy (pipeline); + + res = + cogl_pipeline_set_layer_point_sprite_coords_enabled (solid_pipeline, + /* layer_index */ + 0, + /* enable */ + FALSE, + &error); + + g_assert (res == TRUE); + g_assert (error == NULL); + } + + prim = cogl_primitive_new_p2t2 (test_ctx, + COGL_VERTICES_MODE_POINTS, + 1, /* n_vertices */ + &point); + + cogl_primitive_draw (prim, test_fb, pipeline); + + /* Render the primitive again without point sprites to make sure + disabling it works */ + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, + POINT_SIZE * 2, /* x */ + 0.0f, /* y */ + 0.0f /* z */); + cogl_primitive_draw (prim, test_fb, solid_pipeline); + cogl_framebuffer_pop_matrix (test_fb); + + cogl_object_unref (prim); + cogl_object_unref (solid_pipeline); + cogl_object_unref (pipeline); + cogl_object_unref (tex_2d); + + test_utils_check_pixel (test_fb, + POINT_SIZE - POINT_SIZE / 4, + POINT_SIZE - POINT_SIZE / 4, + 0x0000ffff); + test_utils_check_pixel (test_fb, + POINT_SIZE + POINT_SIZE / 4, + POINT_SIZE - POINT_SIZE / 4, + 0x00ff00ff); + test_utils_check_pixel (test_fb, + POINT_SIZE - POINT_SIZE / 4, + POINT_SIZE + POINT_SIZE / 4, + check_orientation ? + 0x00ffffff : + 0x0000ffff); + test_utils_check_pixel (test_fb, + POINT_SIZE + POINT_SIZE / 4, + POINT_SIZE + POINT_SIZE / 4, + check_orientation ? + 0xff0000ff : + 0x00ff00ff); + + /* When rendering without the point sprites all of the texture + coordinates should be 0,0 so it should get the top-left texel + which is blue */ + test_utils_check_region (test_fb, + POINT_SIZE * 3 - POINT_SIZE / 2 + 1, + POINT_SIZE - POINT_SIZE / 2 + 1, + POINT_SIZE - 2, POINT_SIZE - 2, + 0x0000ffff); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + +void +test_point_sprite (void) +{ + do_test (FALSE /* don't check orientation */, + FALSE /* don't use GLSL */); +} + +void +test_point_sprite_orientation (void) +{ + do_test (TRUE /* check orientation */, + FALSE /* don't use GLSL */); +} + +void +test_point_sprite_glsl (void) +{ + do_test (FALSE /* don't check orientation */, + TRUE /* use GLSL */); +} diff --git a/tests/conform/test-premult.c b/tests/conform/test-premult.c new file mode 100644 index 0000000..fa60bdf --- /dev/null +++ b/tests/conform/test-premult.c @@ -0,0 +1,301 @@ +#include + +#include + +#include "test-utils.h" + +#define QUAD_WIDTH 32 + +#define RED 0 +#define GREEN 1 +#define BLUE 2 +#define ALPHA 3 + +#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24) +#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16) +#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8) +#define MASK_ALPHA(COLOR) (COLOR & 0xff) + +typedef enum _MakeTextureFlags +{ + TEXTURE_FLAG_SET_PREMULTIPLIED = 1, + TEXTURE_FLAG_SET_UNPREMULTIPLIED = 1<<1, +} MakeTextureFlags; + +static guchar * +gen_tex_data (uint32_t color) +{ + guchar *tex_data, *p; + uint8_t r = MASK_RED (color); + uint8_t g = MASK_GREEN (color); + uint8_t b = MASK_BLUE (color); + uint8_t a = MASK_ALPHA (color); + + tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 4); + + for (p = tex_data + QUAD_WIDTH * QUAD_WIDTH * 4; p > tex_data;) + { + *(--p) = a; + *(--p) = b; + *(--p) = g; + *(--p) = r; + } + + return tex_data; +} + +static CoglTexture * +make_texture (uint32_t color, + CoglPixelFormat src_format, + MakeTextureFlags flags) +{ + CoglTexture2D *tex_2d; + guchar *tex_data = gen_tex_data (color); + CoglBitmap *bmp = cogl_bitmap_new_for_data (test_ctx, + QUAD_WIDTH, + QUAD_WIDTH, + src_format, + QUAD_WIDTH * 4, + tex_data); + + tex_2d = cogl_texture_2d_new_from_bitmap (bmp); + + if (flags & TEXTURE_FLAG_SET_PREMULTIPLIED) + cogl_texture_set_premultiplied (tex_2d, TRUE); + else if (flags & TEXTURE_FLAG_SET_UNPREMULTIPLIED) + cogl_texture_set_premultiplied (tex_2d, FALSE); + + cogl_object_unref (bmp); + g_free (tex_data); + + return tex_2d; +} + +static void +set_region (CoglTexture *tex, + uint32_t color, + CoglPixelFormat format) +{ + guchar *tex_data = gen_tex_data (color); + + cogl_texture_set_region (tex, + 0, 0, /* src x, y */ + 0, 0, /* dst x, y */ + QUAD_WIDTH, QUAD_WIDTH, /* dst width, height */ + QUAD_WIDTH, QUAD_WIDTH, /* src width, height */ + format, + 0, /* auto compute row stride */ + tex_data); +} + +static void +check_texture (CoglPipeline *pipeline, + CoglHandle material, + int x, + int y, + CoglTexture *tex, + uint32_t expected_result) +{ + /* Legacy */ + cogl_push_framebuffer (test_fb); + cogl_material_set_layer (material, 0, tex); + cogl_set_source (material); + cogl_rectangle (x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result); + cogl_pop_framebuffer (); + + /* New API */ + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, + x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + test_utils_check_pixel (test_fb, x * QUAD_WIDTH + QUAD_WIDTH / 2, y * QUAD_WIDTH + QUAD_WIDTH / 2, expected_result); +} + +void +test_premult (void) +{ + CoglPipeline *pipeline; + CoglHandle material; + CoglTexture *tex; + + cogl_framebuffer_orthographic (test_fb, 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 1.0f, 1.0f, 1.0f); + + /* Legacy */ + material = cogl_material_new (); + cogl_material_set_blend (material, + "RGBA = ADD (SRC_COLOR, 0)", NULL); + cogl_material_set_layer_combine (material, 0, + "RGBA = REPLACE (TEXTURE)", NULL); + + /* New API */ + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_blend (pipeline, + "RGBA = ADD (SRC_COLOR, 0)", NULL); + cogl_pipeline_set_layer_combine (pipeline, 0, + "RGBA = REPLACE (TEXTURE)", NULL); + + /* If the user explicitly specifies an unmultiplied internal format then + * Cogl shouldn't automatically premultiply the given texture data... */ + if (cogl_test_verbose ()) + g_print ("make_texture (0xff00ff80, " + "src = RGBA_8888, internal = RGBA_8888)\n"); + tex = make_texture (0xff00ff80, + COGL_PIXEL_FORMAT_RGBA_8888, /* src format */ + TEXTURE_FLAG_SET_UNPREMULTIPLIED); + check_texture (pipeline, material, 0, 0, /* position */ + tex, + 0xff00ff80); /* expected */ + + /* If the user explicitly requests a premultiplied internal format and + * gives unmultiplied src data then Cogl should always premultiply that + * for us */ + if (cogl_test_verbose ()) + g_print ("make_texture (0xff00ff80, " + "src = RGBA_8888, internal = RGBA_8888_PRE)\n"); + tex = make_texture (0xff00ff80, + COGL_PIXEL_FORMAT_RGBA_8888, /* src format */ + TEXTURE_FLAG_SET_PREMULTIPLIED); + check_texture (pipeline, material, 1, 0, /* position */ + tex, + 0x80008080); /* expected */ + + /* If the user doesn't explicitly declare that the texture is premultiplied + * then Cogl should assume it is by default should premultiply + * unpremultiplied texture data... + */ + if (cogl_test_verbose ()) + g_print ("make_texture (0xff00ff80, " + "src = RGBA_8888, internal = ANY)\n"); + tex = make_texture (0xff00ff80, + COGL_PIXEL_FORMAT_RGBA_8888, /* src format */ + 0); /* default premultiplied status */ + check_texture (pipeline, material, 2, 0, /* position */ + tex, + 0x80008080); /* expected */ + + /* If the user requests a premultiplied internal texture format and supplies + * premultiplied source data, Cogl should never modify that source data... + */ + if (cogl_test_verbose ()) + g_print ("make_texture (0x80008080, " + "src = RGBA_8888_PRE, " + "internal = RGBA_8888_PRE)\n"); + tex = make_texture (0x80008080, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */ + TEXTURE_FLAG_SET_PREMULTIPLIED); + check_texture (pipeline, material, 3, 0, /* position */ + tex, + 0x80008080); /* expected */ + + /* If the user requests an unmultiplied internal texture format, but + * supplies premultiplied source data, then Cogl should always + * un-premultiply the source data... */ + if (cogl_test_verbose ()) + g_print ("make_texture (0x80008080, " + "src = RGBA_8888_PRE, internal = RGBA_8888)\n"); + tex = make_texture (0x80008080, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */ + TEXTURE_FLAG_SET_UNPREMULTIPLIED); + check_texture (pipeline, material, 4, 0, /* position */ + tex, + 0xff00ff80); /* expected */ + + /* If the user allows any internal texture format and provides premultipled + * source data then by default Cogl shouldn't modify the source data... + * (In the future there will be additional Cogl API to control this + * behaviour) */ + if (cogl_test_verbose ()) + g_print ("make_texture (0x80008080, " + "src = RGBA_8888_PRE, internal = ANY)\n"); + tex = make_texture (0x80008080, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */ + 0); /* default premultiplied status */ + check_texture (pipeline, material, 5, 0, /* position */ + tex, + 0x80008080); /* expected */ + + /* + * Test cogl_texture_set_region() .... + */ + + if (cogl_test_verbose ()) + g_print ("make_texture (0xDEADBEEF, " + "src = RGBA_8888, internal = RGBA_8888)\n"); + tex = make_texture (0xDEADBEEF, + COGL_PIXEL_FORMAT_RGBA_8888, /* src format */ + TEXTURE_FLAG_SET_UNPREMULTIPLIED); + if (cogl_test_verbose ()) + g_print ("set_region (0xff00ff80, RGBA_8888)\n"); + set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888); + check_texture (pipeline, material, 6, 0, /* position */ + tex, + 0xff00ff80); /* expected */ + + /* Updating a texture region for an unmultiplied texture using premultiplied + * region data should result in Cogl unmultiplying the given region data... + */ + if (cogl_test_verbose ()) + g_print ("make_texture (0xDEADBEEF, " + "src = RGBA_8888, internal = RGBA_8888)\n"); + tex = make_texture (0xDEADBEEF, + COGL_PIXEL_FORMAT_RGBA_8888, /* src format */ + TEXTURE_FLAG_SET_UNPREMULTIPLIED); + if (cogl_test_verbose ()) + g_print ("set_region (0x80008080, RGBA_8888_PRE)\n"); + set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE); + check_texture (pipeline, material, 7, 0, /* position */ + tex, + 0xff00ff80); /* expected */ + + + if (cogl_test_verbose ()) + g_print ("make_texture (0xDEADBEEF, " + "src = RGBA_8888_PRE, " + "internal = RGBA_8888_PRE)\n"); + tex = make_texture (0xDEADBEEF, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */ + TEXTURE_FLAG_SET_PREMULTIPLIED); + if (cogl_test_verbose ()) + g_print ("set_region (0x80008080, RGBA_8888_PRE)\n"); + set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE); + check_texture (pipeline, material, 8, 0, /* position */ + tex, + 0x80008080); /* expected */ + + + /* Updating a texture region for a premultiplied texture using unmultiplied + * region data should result in Cogl premultiplying the given region data... + */ + if (cogl_test_verbose ()) + g_print ("make_texture (0xDEADBEEF, " + "src = RGBA_8888_PRE, " + "internal = RGBA_8888_PRE)\n"); + tex = make_texture (0xDEADBEEF, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */ + TEXTURE_FLAG_SET_PREMULTIPLIED); + if (cogl_test_verbose ()) + g_print ("set_region (0xff00ff80, RGBA_8888)\n"); + set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888); + check_texture (pipeline, material, 9, 0, /* position */ + tex, + 0x80008080); /* expected */ + + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-primitive-and-journal.c b/tests/conform/test-primitive-and-journal.c new file mode 100644 index 0000000..f978cd5 --- /dev/null +++ b/tests/conform/test-primitive-and-journal.c @@ -0,0 +1,122 @@ +#include + +#include "test-utils.h" + +typedef CoglVertexP2C4 Vertex; + +static void +setup_orthographic_modelview (void) +{ + CoglMatrix matrix; + int fb_width = cogl_framebuffer_get_width (test_fb); + int fb_height = cogl_framebuffer_get_height (test_fb); + + /* Set up a non-identity modelview matrix. When the journal is + * flushed it will usually flush the identity matrix. Using the + * non-default matrix ensures that we test that Cogl restores the + * matrix we asked for. The matrix sets up an orthographic transform + * in the modelview matrix */ + + cogl_matrix_init_identity (&matrix); + cogl_matrix_orthographic (&matrix, + 0.0f, 0.0f, /* x_1 y_1 */ + fb_width, + fb_height, + -1.0f, /* nearval */ + 1.0f /* farval */); + cogl_framebuffer_set_modelview_matrix (test_fb, &matrix); +} + +static void +create_primitives (CoglPrimitive *primitives[2]) +{ + static const Vertex vertex_data[8] = + { + /* triangle strip 1 */ + { 0, 0, 255, 0, 0, 255 }, + { 0, 100, 255, 0, 0, 255 }, + { 100, 0, 255, 0, 0, 255 }, + { 100, 100, 255, 0, 0, 255 }, + /* triangle strip 2 */ + { 200, 0, 0, 0, 255, 255 }, + { 200, 100, 0, 0, 255, 255 }, + { 300, 0, 0, 0, 255, 255 }, + { 300, 100, 0, 0, 255, 255 }, + }; + + primitives[0] = cogl_primitive_new_p2c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLE_STRIP, + G_N_ELEMENTS (vertex_data), + vertex_data); + cogl_primitive_set_n_vertices (primitives[0], 4); + + primitives[1] = cogl_primitive_copy (primitives[0]); + cogl_primitive_set_first_vertex (primitives[1], 4); + cogl_primitive_set_n_vertices (primitives[1], 4); +} + +static CoglPipeline * +create_pipeline (void) +{ + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255); + + return pipeline; +} + +void +test_primitive_and_journal (void) +{ + CoglPrimitive *primitives[2]; + CoglPipeline *pipeline; + + setup_orthographic_modelview (); + create_primitives (primitives); + pipeline = create_pipeline (); + + /* Set a clip to clip all three rectangles to just the bottom half. + * The journal flushes its own clip state so this verifies that the + * clip state is correctly restored for the second primitive. */ + cogl_framebuffer_push_rectangle_clip (test_fb, + 0, 50, 300, 100); + + cogl_primitive_draw (primitives[0], test_fb, pipeline); + + /* Draw a rectangle using the journal in-between the two primitives. + * This should test that the journal gets flushed correctly and that + * the modelview matrix is restored. Half of the rectangle should be + * overriden by the second primitive */ + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 100, 0, /* x1/y1 */ + 300, 100 /* x2/y2 */); + + cogl_primitive_draw (primitives[1], test_fb, pipeline); + + /* Check the three rectangles */ + test_utils_check_region (test_fb, + 1, 51, + 98, 48, + 0xff0000ff); + test_utils_check_region (test_fb, + 101, 51, + 98, 48, + 0x00ff00ff); + test_utils_check_region (test_fb, + 201, 51, + 98, 48, + 0x0000ffff); + + /* Check that the top half of all of the rectangles was clipped */ + test_utils_check_region (test_fb, + 1, 1, + 298, 48, + 0x000000ff); + + cogl_framebuffer_pop_clip (test_fb); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c new file mode 100644 index 0000000..db264fc --- /dev/null +++ b/tests/conform/test-primitive.c @@ -0,0 +1,334 @@ +#include +#include +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int fb_width; + int fb_height; +} TestState; + +#define PRIM_COLOR 0xff00ffff +#define TEX_COLOR 0x0000ffff + +#define N_ATTRIBS 8 + +typedef CoglPrimitive * (* TestPrimFunc) (CoglContext *ctx, uint32_t *expected_color); + +static CoglPrimitive * +test_prim_p2 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP2 verts[] = + { { 0, 0 }, { 0, 10 }, { 10, 0 } }; + + return cogl_primitive_new_p2 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP3 verts[] = + { { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } }; + + return cogl_primitive_new_p3 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2c4 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP2C4 verts[] = + { { 0, 0, 255, 255, 0, 255 }, + { 0, 10, 255, 255, 0, 255 }, + { 10, 0, 255, 255, 0, 255 } }; + + *expected_color = 0xffff00ff; + + return cogl_primitive_new_p2c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3c4 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP3C4 verts[] = + { { 0, 0, 0, 255, 255, 0, 255 }, + { 0, 10, 0, 255, 255, 0, 255 }, + { 10, 0, 0, 255, 255, 0, 255 } }; + + *expected_color = 0xffff00ff; + + return cogl_primitive_new_p3c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2t2 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP2T2 verts[] = + { { 0, 0, 1, 0 }, + { 0, 10, 1, 0 }, + { 10, 0, 1, 0 } }; + + *expected_color = TEX_COLOR; + + return cogl_primitive_new_p2t2 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3t2 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP3T2 verts[] = + { { 0, 0, 0, 1, 0 }, + { 0, 10, 0, 1, 0 }, + { 10, 0, 0, 1, 0 } }; + + *expected_color = TEX_COLOR; + + return cogl_primitive_new_p3t2 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2t2c4 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP2T2C4 verts[] = + { { 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, + { 0, 10, 1, 0, 0xff, 0xff, 0xf0, 0xff }, + { 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; + + /* The blue component of the texture color should be replaced with 0xf0 */ + *expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000; + + return cogl_primitive_new_p2t2c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3t2c4 (CoglContext *ctx, uint32_t *expected_color) +{ + static const CoglVertexP3T2C4 verts[] = + { { 0, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, + { 0, 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, + { 10, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; + + /* The blue component of the texture color should be replaced with 0xf0 */ + *expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000; + + return cogl_primitive_new_p3t2c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static const TestPrimFunc +test_prim_funcs[] = + { + test_prim_p2, + test_prim_p3, + test_prim_p2c4, + test_prim_p3c4, + test_prim_p2t2, + test_prim_p3t2, + test_prim_p2t2c4, + test_prim_p3t2c4 + }; + +static void +test_paint (TestState *state) +{ + CoglPipeline *pipeline; + CoglTexture *tex; + uint8_t tex_data[6]; + int i; + + /* Create a two pixel texture. The first pixel is white and the + second pixel is tex_color. The assumption is that if no texture + coordinates are specified then it will default to 0,0 and get + white */ + tex_data[0] = 255; + tex_data[1] = 255; + tex_data[2] = 255; + tex_data[3] = (TEX_COLOR >> 24) & 0xff; + tex_data[4] = (TEX_COLOR >> 16) & 0xff; + tex_data[5] = (TEX_COLOR >> 8) & 0xff; + tex = test_utils_texture_new_from_data (test_ctx, + 2, 1, /* size */ + TEST_UTILS_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGB_888, + 6, /* rowstride */ + tex_data); + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_color4ub (pipeline, + (PRIM_COLOR >> 24) & 0xff, + (PRIM_COLOR >> 16) & 0xff, + (PRIM_COLOR >> 8) & 0xff, + (PRIM_COLOR >> 0) & 0xff); + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_object_unref (tex); + + for (i = 0; i < G_N_ELEMENTS (test_prim_funcs); i++) + { + CoglPrimitive *prim; + uint32_t expected_color = PRIM_COLOR; + + prim = test_prim_funcs[i] (test_ctx, &expected_color); + + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, i * 10, 0, 0); + cogl_primitive_draw (prim, test_fb, pipeline); + cogl_framebuffer_pop_matrix (test_fb); + + test_utils_check_pixel (test_fb, i * 10 + 2, 2, expected_color); + + cogl_object_unref (prim); + } + + cogl_object_unref (pipeline); +} + +static CoglBool +get_attributes_cb (CoglPrimitive *prim, + CoglAttribute *attrib, + void *user_data) +{ + CoglAttribute ***p = user_data; + *((* p)++) = attrib; + return TRUE; +} + +static int +compare_pointers (const void *a, const void *b) +{ + CoglAttribute *pa = *(CoglAttribute **) a; + CoglAttribute *pb = *(CoglAttribute **) b; + + if (pa < pb) + return -1; + else if (pa > pb) + return 1; + else + return 0; +} + +static void +test_copy (TestState *state) +{ + static const uint16_t indices_data[2] = { 1, 2 }; + CoglAttributeBuffer *buffer = + cogl_attribute_buffer_new (test_ctx, 100, NULL); + CoglAttribute *attributes[N_ATTRIBS]; + CoglAttribute *attributes_a[N_ATTRIBS], *attributes_b[N_ATTRIBS]; + CoglAttribute **p; + CoglPrimitive *prim_a, *prim_b; + CoglIndices *indices; + int i; + + for (i = 0; i < N_ATTRIBS; i++) + { + char *name = g_strdup_printf ("foo_%i", i); + attributes[i] = cogl_attribute_new (buffer, + name, + 16, /* stride */ + 16, /* offset */ + 2, /* components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + g_free (name); + } + + prim_a = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 8, /* n_vertices */ + attributes, + N_ATTRIBS); + + indices = cogl_indices_new (test_ctx, + COGL_INDICES_TYPE_UNSIGNED_SHORT, + indices_data, + 2 /* n_indices */); + + cogl_primitive_set_first_vertex (prim_a, 12); + cogl_primitive_set_indices (prim_a, indices, 2); + + prim_b = cogl_primitive_copy (prim_a); + + p = attributes_a; + cogl_primitive_foreach_attribute (prim_a, + get_attributes_cb, + &p); + g_assert_cmpint (p - attributes_a, ==, N_ATTRIBS); + + p = attributes_b; + cogl_primitive_foreach_attribute (prim_b, + get_attributes_cb, + &p); + g_assert_cmpint (p - attributes_b, ==, N_ATTRIBS); + + qsort (attributes_a, N_ATTRIBS, sizeof (CoglAttribute *), compare_pointers); + qsort (attributes_b, N_ATTRIBS, sizeof (CoglAttribute *), compare_pointers); + + g_assert (memcmp (attributes_a, attributes_b, sizeof (attributes_a)) == 0); + + g_assert_cmpint (cogl_primitive_get_first_vertex (prim_a), + ==, + cogl_primitive_get_first_vertex (prim_b)); + + g_assert_cmpint (cogl_primitive_get_n_vertices (prim_a), + ==, + cogl_primitive_get_n_vertices (prim_b)); + + g_assert_cmpint (cogl_primitive_get_mode (prim_a), + ==, + cogl_primitive_get_mode (prim_b)); + + g_assert (cogl_primitive_get_indices (prim_a) == + cogl_primitive_get_indices (prim_b)); + + cogl_object_unref (prim_a); + cogl_object_unref (prim_b); + cogl_object_unref (indices); + + for (i = 0; i < N_ATTRIBS; i++) + cogl_object_unref (attributes[i]); + + cogl_object_unref (buffer); +} + +void +test_primitive (void) +{ + TestState state; + + state.fb_width = cogl_framebuffer_get_width (test_fb); + state.fb_height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + state.fb_width, + state.fb_height, + -1, + 100); + + test_paint (&state); + test_copy (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-read-texture-formats.c b/tests/conform/test-read-texture-formats.c new file mode 100644 index 0000000..3fa4d8e --- /dev/null +++ b/tests/conform/test-read-texture-formats.c @@ -0,0 +1,222 @@ +#include +#include + +#include "test-utils.h" + +/* + * This tests reading back an RGBA texture in all of the available + * pixel formats + */ + +static const uint8_t tex_data[4] = { 0x12, 0x34, 0x56, 0x78 }; + +static void +test_read_byte (CoglTexture2D *tex_2d, + CoglPixelFormat format, + uint8_t expected_byte) +{ + uint8_t received_byte; + + cogl_texture_get_data (tex_2d, + format, + 1, /* rowstride */ + &received_byte); + + g_assert_cmpint (expected_byte, ==, received_byte); +} + +static void +test_read_short (CoglTexture2D *tex_2d, + CoglPixelFormat format, + ...) +{ + va_list ap; + int bits; + uint16_t received_value; + uint16_t expected_value = 0; + char *received_value_str; + char *expected_value_str; + int bits_sum = 0; + + cogl_texture_get_data (tex_2d, + format, + 2, /* rowstride */ + (uint8_t *) &received_value); + + va_start (ap, format); + + /* Convert the va args into a single 16-bit expected value */ + while ((bits = va_arg (ap, int)) != -1) + { + int value = (va_arg (ap, int) * ((1 << bits) - 1) + 128) / 255; + + bits_sum += bits; + + expected_value |= value << (16 - bits_sum); + } + + va_end (ap); + + received_value_str = g_strdup_printf ("0x%04x", received_value); + expected_value_str = g_strdup_printf ("0x%04x", expected_value); + g_assert_cmpstr (received_value_str, ==, expected_value_str); + g_free (received_value_str); + g_free (expected_value_str); +} + +static void +test_read_888 (CoglTexture2D *tex_2d, + CoglPixelFormat format, + uint32_t expected_pixel) +{ + uint8_t pixel[4]; + + cogl_texture_get_data (tex_2d, + format, + 4, /* rowstride */ + pixel); + + test_utils_compare_pixel (pixel, expected_pixel); +} + +static void +test_read_88 (CoglTexture2D *tex_2d, + CoglPixelFormat format, + uint32_t expected_pixel) +{ + uint8_t pixel[4]; + + pixel[2] = 0x00; + + cogl_texture_get_data (tex_2d, + format, + 2, /* rowstride */ + pixel); + + test_utils_compare_pixel (pixel, expected_pixel); +} + +static void +test_read_8888 (CoglTexture2D *tex_2d, + CoglPixelFormat format, + uint32_t expected_pixel) +{ + uint32_t received_pixel; + char *received_value_str; + char *expected_value_str; + + cogl_texture_get_data (tex_2d, + format, + 4, /* rowstride */ + (uint8_t *) &received_pixel); + + received_pixel = GUINT32_FROM_BE (received_pixel); + + received_value_str = g_strdup_printf ("0x%08x", received_pixel); + expected_value_str = g_strdup_printf ("0x%08x", expected_pixel); + g_assert_cmpstr (received_value_str, ==, expected_value_str); + g_free (received_value_str); + g_free (expected_value_str); +} + +static void +test_read_int (CoglTexture2D *tex_2d, + CoglPixelFormat format, + ...) +{ + va_list ap; + int bits; + uint32_t received_value; + uint32_t expected_value = 0; + char *received_value_str; + char *expected_value_str; + int bits_sum = 0; + + cogl_texture_get_data (tex_2d, + format, + 4, /* rowstride */ + (uint8_t *) &received_value); + + va_start (ap, format); + + /* Convert the va args into a single 32-bit expected value */ + while ((bits = va_arg (ap, int)) != -1) + { + uint32_t value = (va_arg (ap, int) * ((1 << bits) - 1) + 128) / 255; + + bits_sum += bits; + + expected_value |= value << (32 - bits_sum); + } + + va_end (ap); + + received_value_str = g_strdup_printf ("0x%08x", received_value); + expected_value_str = g_strdup_printf ("0x%08x", expected_value); + g_assert_cmpstr (received_value_str, ==, expected_value_str); + g_free (received_value_str); + g_free (expected_value_str); +} + +void +test_read_texture_formats (void) +{ + CoglTexture2D *tex_2d; + + tex_2d = cogl_texture_2d_new_from_data (test_ctx, + 1, 1, /* width / height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + tex_data, + NULL); + + test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78); + +#if 0 + /* I'm not sure what's the right value to put here because Nvidia + and Mesa seem to behave differently so one of them must be + wrong. */ + test_read_byte (tex_2d, COGL_PIXEL_FORMAT_G_8, 0x9c); +#endif + + /* We should always be able to read into an RG buffer regardless of + * whether RG textures are supported because Cogl will do the + * conversion for us */ + test_read_88 (tex_2d, COGL_PIXEL_FORMAT_RG_88, 0x123400ff); + + test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGB_565, + 5, 0x12, 6, 0x34, 5, 0x56, + -1); + test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGBA_4444_PRE, + 4, 0x12, 4, 0x34, 4, 0x56, 4, 0x78, + -1); + test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGBA_5551_PRE, + 5, 0x12, 5, 0x34, 5, 0x56, 1, 0x78, + -1); + + test_read_888 (tex_2d, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff); + test_read_888 (tex_2d, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff); + + test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_RGBA_8888_PRE, 0x12345678); + test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_BGRA_8888_PRE, 0x56341278); + test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_ARGB_8888_PRE, 0x78123456); + test_read_8888 (tex_2d, COGL_PIXEL_FORMAT_ABGR_8888_PRE, 0x78563412); + + test_read_int (tex_2d, COGL_PIXEL_FORMAT_RGBA_1010102_PRE, + 10, 0x12, 10, 0x34, 10, 0x56, 2, 0x78, + -1); + test_read_int (tex_2d, COGL_PIXEL_FORMAT_BGRA_1010102_PRE, + 10, 0x56, 10, 0x34, 10, 0x12, 2, 0x78, + -1); + test_read_int (tex_2d, COGL_PIXEL_FORMAT_ARGB_2101010_PRE, + 2, 0x78, 10, 0x12, 10, 0x34, 10, 0x56, + -1); + test_read_int (tex_2d, COGL_PIXEL_FORMAT_ABGR_2101010_PRE, + 2, 0x78, 10, 0x56, 10, 0x34, 10, 0x12, + -1); + + cogl_object_unref (tex_2d); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-snippets.c b/tests/conform/test-snippets.c new file mode 100644 index 0000000..a251fc1 --- /dev/null +++ b/tests/conform/test-snippets.c @@ -0,0 +1,815 @@ +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int fb_width, fb_height; +} TestState; + +typedef void (* SnippetTestFunc) (TestState *state); + +static CoglPipeline * +create_texture_pipeline (TestState *state) +{ + CoglPipeline *pipeline; + CoglTexture *tex; + static const uint8_t tex_data[] = + { + 0xff, 0x00, 0x00, 0xff, /* red */ 0x00, 0xff, 0x00, 0xff, /* green */ + 0x00, 0x00, 0xff, 0xff, /* blue */ 0xff, 0xff, 0x00, 0xff, /* yellow */ + }; + + tex = test_utils_texture_new_from_data (test_ctx, + 2, 2, /* width/height */ + TEST_UTILS_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 8, /* rowstride */ + tex_data); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + + cogl_pipeline_set_layer_filters (pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + cogl_object_unref (tex); + + return pipeline; +} + +static void +simple_fragment_snippet (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Simple fragment snippet */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + "cogl_color_out.g += 1.0;"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff); +} + +static void +simple_vertex_snippet (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Simple vertex snippet */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, + NULL, + "cogl_color_out.b += 1.0;"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 10, 0, 20, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 15, 5, 0xff00ffff); +} + +static void +shared_uniform (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + int location; + + /* Snippets sharing a uniform across the vertex and fragment + hooks */ + pipeline = cogl_pipeline_new (test_ctx); + + location = cogl_pipeline_get_uniform_location (pipeline, "a_value"); + cogl_pipeline_set_uniform_1f (pipeline, location, 0.25f); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, + "uniform float a_value;", + "cogl_color_out.b += a_value;"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + "uniform float a_value;", + "cogl_color_out.b += a_value;"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 20, 0, 30, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 25, 5, 0xff0080ff); +} + +static void +lots_snippets (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + int location; + int i; + + /* Lots of snippets on one pipeline */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + + for (i = 0; i < 3; i++) + { + char letter = 'x' + i; + char *uniform_name = g_strdup_printf ("%c_value", letter); + char *declarations = g_strdup_printf ("uniform float %s;\n", + uniform_name); + char *code = g_strdup_printf ("cogl_color_out.%c = %s;\n", + letter, + uniform_name); + + location = cogl_pipeline_get_uniform_location (pipeline, uniform_name); + cogl_pipeline_set_uniform_1f (pipeline, location, (i + 1) * 0.1f); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + declarations, + code); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + g_free (code); + g_free (uniform_name); + g_free (declarations); + } + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 30, 0, 40, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 35, 5, 0x19334cff); +} + +static void +shared_variable_pre_post (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Test that the pre string can declare variables used by the post + string */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 255, 255, 255, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + "cogl_color_out = redvec;"); + cogl_snippet_set_pre (snippet, "vec4 redvec = vec4 (1.0, 0.0, 0.0, 1.0);"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 40, 0, 50, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 45, 5, 0xff0000ff); +} + +static void +test_pipeline_caching (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Check that the pipeline caching works when unrelated pipelines + share snippets state. It's too hard to actually assert this in + the conformance test but at least it should be possible to see by + setting COGL_DEBUG=show-source to check whether this shader gets + generated twice */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + "/* This comment should only be seen ONCE\n" + " when COGL_DEBUG=show-source is TRUE\n" + " even though it is used in two different\n" + " unrelated pipelines */", + "cogl_color_out = vec4 (0.0, 1.0, 0.0, 1.0);\n"); + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 50, 0, 60, 10); + cogl_object_unref (pipeline); + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 60, 0, 70, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (test_fb, 55, 5, 0x00ff00ff); + test_utils_check_pixel (test_fb, 65, 5, 0x00ff00ff); +} + +static void +test_replace_string (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Check the replace string */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, NULL); + cogl_snippet_set_pre (snippet, + "cogl_color_out = vec4 (0.0, 0.5, 0.0, 1.0);"); + /* Remove the generated output. If the replace string isn't working + then the code from the pre string would get overwritten with + white */ + cogl_snippet_set_replace (snippet, "/* do nothing */"); + cogl_snippet_set_post (snippet, + "cogl_color_out += vec4 (0.5, 0.0, 0.0, 1.0);"); + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 70, 0, 80, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (test_fb, 75, 5, 0x808000ff); +} + +static void +test_texture_lookup_hook (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Check the texture lookup hook */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP, + NULL, + "cogl_texel.b += 1.0;"); + /* Flip the texture coordinates around the y axis so that it will + get the green texel */ + cogl_snippet_set_pre (snippet, "cogl_tex_coord.x = 1.0 - cogl_tex_coord.x;"); + + pipeline = create_texture_pipeline (state); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 80, 0, 90, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (test_fb, 85, 5, 0x00ffffff); +} + +static void +test_multiple_samples (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Check that we can use the passed in sampler in the texture lookup + to sample multiple times */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP, + NULL, + NULL); + cogl_snippet_set_replace (snippet, + "cogl_texel = " + "texture2D (cogl_sampler, vec2 (0.25, 0.25)) + " + "texture2D (cogl_sampler, vec2 (0.75, 0.25));"); + + pipeline = create_texture_pipeline (state); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff); +} + +static void +test_replace_lookup_hook (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Check replacing the texture lookup hook */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP, NULL, NULL); + cogl_snippet_set_replace (snippet, "cogl_texel = vec4 (0.0, 0.0, 1.0, 0.0);"); + + pipeline = create_texture_pipeline (state); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 90, 0, 100, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (test_fb, 95, 5, 0x0000ffff); +} + +static void +test_replace_snippet (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Test replacing a previous snippet */ + pipeline = create_texture_pipeline (state); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, + "cogl_color_out = vec4 (0.5, 0.5, 0.5, 1.0);"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, NULL); + cogl_snippet_set_pre (snippet, "cogl_color_out = vec4 (1.0, 1.0, 1.0, 1.0);"); + cogl_snippet_set_replace (snippet, + "cogl_color_out *= vec4 (1.0, 0.0, 0.0, 1.0);"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 100, 0, 110, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 105, 5, 0xff0000ff); +} + +static void +test_replace_fragment_layer (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Test replacing the fragment layer code */ + pipeline = create_texture_pipeline (state); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, NULL, NULL); + cogl_snippet_set_replace (snippet, "cogl_layer = vec4 (0.0, 0.0, 1.0, 1.0);"); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_object_unref (snippet); + + /* Add a second layer which samples from the texture in the first + layer. The snippet override should cause the first layer not to + generate the code for the texture lookup but this second layer + should still be able to cause it to be generated */ + cogl_pipeline_set_layer_combine (pipeline, 1, + "RGB = ADD(TEXTURE_0, PREVIOUS)" + "A = REPLACE(PREVIOUS)", + NULL); + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 110, 0, 120, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 115, 5, 0xff00ffff); +} + +static void +test_modify_fragment_layer (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Test modifying the fragment layer code */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_uniform_1f (pipeline, + cogl_pipeline_get_uniform_location (pipeline, + "a_value"), + 0.5); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, + "uniform float a_value;", + "cogl_layer.g = a_value;"); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 120, 0, 130, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 125, 5, 0xff80ffff); +} + +static void +test_modify_vertex_layer (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + CoglMatrix matrix; + + /* Test modifying the vertex layer code */ + pipeline = create_texture_pipeline (state); + + cogl_matrix_init_identity (&matrix); + cogl_matrix_translate (&matrix, 0.0f, 1.0f, 0.0f); + cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM, + NULL, + "cogl_tex_coord.x = 1.0;"); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 130, 0, 140, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 135, 5, 0xffff00ff); +} + +static void +test_replace_vertex_layer (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + CoglMatrix matrix; + + /* Test replacing the vertex layer code */ + pipeline = create_texture_pipeline (state); + + cogl_matrix_init_identity (&matrix); + cogl_matrix_translate (&matrix, 0.0f, 1.0f, 0.0f); + cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM, + NULL, + NULL); + cogl_snippet_set_replace (snippet, "cogl_tex_coord.x = 1.0;\n"); + cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + 140, 0, 150, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 145, 5, 0x00ff00ff); +} + +static void +test_vertex_transform_hook (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + CoglMatrix identity_matrix; + CoglMatrix matrix; + int location; + + /* Test the vertex transform hook */ + + cogl_matrix_init_identity (&identity_matrix); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 255, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_TRANSFORM, + "uniform mat4 pmat;", + NULL); + cogl_snippet_set_replace (snippet, "cogl_position_out = " + "pmat * cogl_position_in;"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + /* Copy the current projection matrix to a uniform */ + cogl_framebuffer_get_projection_matrix (test_fb, &matrix); + location = cogl_pipeline_get_uniform_location (pipeline, "pmat"); + cogl_pipeline_set_uniform_matrix (pipeline, + location, + 4, /* dimensions */ + 1, /* count */ + FALSE, /* don't transpose */ + cogl_matrix_get_array (&matrix)); + + /* Replace the real projection matrix with the identity. This should + mess up the drawing unless the snippet replacement is working */ + cogl_framebuffer_set_projection_matrix (test_fb, &identity_matrix); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 150, 0, 160, 10); + cogl_object_unref (pipeline); + + /* Restore the projection matrix */ + cogl_framebuffer_set_projection_matrix (test_fb, &matrix); + + test_utils_check_pixel (test_fb, 155, 5, 0xff00ffff); +} + +static void +test_global_vertex_hook (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + pipeline = cogl_pipeline_new (test_ctx); + + /* Creates a function in the global declarations hook which is used + * by a subsequent snippet. The subsequent snippets replace any + * previous snippets but this shouldn't prevent the global + * declarations from being generated */ + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_GLOBALS, + /* declarations */ + "float\n" + "multiply_by_two (float number)\n" + "{\n" + " return number * 2.0;\n" + "}\n", + /* post */ + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_snippet_set_pre (snippet, + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_snippet_set_replace (snippet, + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, + NULL, /* declarations */ + NULL /* replace */); + cogl_snippet_set_replace (snippet, + "cogl_color_out.r = multiply_by_two (0.5);\n" + "cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n" + "cogl_position_out = cogl_position_in;\n"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1, 1, + 10.0f * 2.0f / state->fb_width - 1.0f, + 10.0f * 2.0f / state->fb_height - 1.0f); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 5, 5, 0xff0000ff); +} + +static void +test_global_fragment_hook (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + pipeline = cogl_pipeline_new (test_ctx); + + /* Creates a function in the global declarations hook which is used + * by a subsequent snippet. The subsequent snippets replace any + * previous snippets but this shouldn't prevent the global + * declarations from being generated */ + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS, + /* declarations */ + "float\n" + "multiply_by_four (float number)\n" + "{\n" + " return number * 4.0;\n" + "}\n", + /* post */ + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_snippet_set_pre (snippet, + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_snippet_set_replace (snippet, + "This string shouldn't be used so " + "we can safely put garbage in here."); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, /* declarations */ + NULL /* replace */); + cogl_snippet_set_replace (snippet, + "cogl_color_out.r = multiply_by_four (0.25);\n" + "cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + 0, 0, 10, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 5, 5, 0xff0000ff); +} + +static void +test_snippet_order (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Verify that the snippets are executed in the right order. We'll + replace the r component of the color in the pre sections of the + snippets and the g component in the post. The pre sections should + be executed in the reverse order they were added and the post + sections in the same order as they were added. Therefore the r + component should be taken from the the second snippet and the g + component from the first */ + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, + "cogl_color_out.g = 0.5;\n"); + cogl_snippet_set_pre (snippet, "cogl_color_out.r = 0.5;\n"); + cogl_snippet_set_replace (snippet, "cogl_color_out.ba = vec2 (0.0, 1.0);"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, + "cogl_color_out.g = 1.0;\n"); + cogl_snippet_set_pre (snippet, "cogl_color_out.r = 1.0;\n"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 160, 0, 170, 10); + cogl_object_unref (pipeline); + + test_utils_check_pixel (test_fb, 165, 5, 0x80ff00ff); +} + +static void +test_naming_texture_units (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + CoglTexture *tex1, *tex2; + + /* Test that we can sample from an arbitrary texture unit by naming + its layer number */ + + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, + NULL, + NULL); + cogl_snippet_set_replace (snippet, + "cogl_color_out = " + "texture2D (cogl_sampler100, vec2 (0.0, 0.0)) + " + "texture2D (cogl_sampler200, vec2 (0.0, 0.0));"); + + tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff); + tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 100, tex1); + cogl_pipeline_set_layer_texture (pipeline, 200, tex2); + + cogl_pipeline_add_snippet (pipeline, snippet); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); + + cogl_object_unref (pipeline); + cogl_object_unref (snippet); + cogl_object_unref (tex1); + cogl_object_unref (tex2); + + test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff); +} + +static void +test_snippet_properties (TestState *state) +{ + CoglSnippet *snippet; + + /* Sanity check modifying the snippet */ + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, "foo", "bar"); + g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "foo"); + g_assert_cmpstr (cogl_snippet_get_post (snippet), ==, "bar"); + g_assert_cmpstr (cogl_snippet_get_replace (snippet), ==, NULL); + g_assert_cmpstr (cogl_snippet_get_pre (snippet), ==, NULL); + + cogl_snippet_set_declarations (snippet, "fu"); + g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "fu"); + g_assert_cmpstr (cogl_snippet_get_post (snippet), ==, "bar"); + g_assert_cmpstr (cogl_snippet_get_replace (snippet), ==, NULL); + g_assert_cmpstr (cogl_snippet_get_pre (snippet), ==, NULL); + + cogl_snippet_set_post (snippet, "ba"); + g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "fu"); + g_assert_cmpstr (cogl_snippet_get_post (snippet), ==, "ba"); + g_assert_cmpstr (cogl_snippet_get_replace (snippet), ==, NULL); + g_assert_cmpstr (cogl_snippet_get_pre (snippet), ==, NULL); + + cogl_snippet_set_pre (snippet, "fuba"); + g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "fu"); + g_assert_cmpstr (cogl_snippet_get_post (snippet), ==, "ba"); + g_assert_cmpstr (cogl_snippet_get_replace (snippet), ==, NULL); + g_assert_cmpstr (cogl_snippet_get_pre (snippet), ==, "fuba"); + + cogl_snippet_set_replace (snippet, "baba"); + g_assert_cmpstr (cogl_snippet_get_declarations (snippet), ==, "fu"); + g_assert_cmpstr (cogl_snippet_get_post (snippet), ==, "ba"); + g_assert_cmpstr (cogl_snippet_get_replace (snippet), ==, "baba"); + g_assert_cmpstr (cogl_snippet_get_pre (snippet), ==, "fuba"); + + g_assert_cmpint (cogl_snippet_get_hook (snippet), + ==, + COGL_SNIPPET_HOOK_FRAGMENT); +} + +static SnippetTestFunc +tests[] = + { + simple_fragment_snippet, + simple_vertex_snippet, + shared_uniform, + lots_snippets, + shared_variable_pre_post, + test_pipeline_caching, + test_replace_string, + test_texture_lookup_hook, + test_multiple_samples, + test_replace_lookup_hook, + test_replace_snippet, + test_replace_fragment_layer, + test_modify_fragment_layer, + test_modify_vertex_layer, + test_replace_vertex_layer, + test_vertex_transform_hook, + test_global_fragment_hook, + test_global_vertex_hook, + test_snippet_order, + test_naming_texture_units, + test_snippet_properties + }; + +static void +run_tests (TestState *state) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (tests); i++) + { + cogl_framebuffer_clear4f (test_fb, + COGL_BUFFER_BIT_COLOR, + 0, 0, 0, 1); + + tests[i] (state); + } +} + +void +test_snippets (void) +{ + TestState state; + + state.fb_width = cogl_framebuffer_get_width (test_fb); + state.fb_height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + state.fb_width, + state.fb_height, + -1, + 100); + + run_tests (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-sparse-pipeline.c b/tests/conform/test-sparse-pipeline.c new file mode 100644 index 0000000..04c81d2 --- /dev/null +++ b/tests/conform/test-sparse-pipeline.c @@ -0,0 +1,62 @@ +#include +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int fb_width; + int fb_height; +} TestState; + +static void +test_sparse_layer_combine (TestState *state) +{ + CoglPipeline *pipeline; + CoglTexture *tex1, *tex2; + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + /* This tests that the TEXTURE_* numbers used in the layer combine + string refer to the layer number rather than the unit numbers by + creating a pipeline with very large layer numbers. This should + end up being mapped to much smaller unit numbers */ + + tex1 = test_utils_create_color_texture (test_ctx, 0xff0000ff); + tex2 = test_utils_create_color_texture (test_ctx, 0x00ff00ff); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 50, tex1); + cogl_pipeline_set_layer_texture (pipeline, 100, tex2); + cogl_pipeline_set_layer_combine (pipeline, 200, + "RGBA = ADD(TEXTURE_50, TEXTURE_100)", + NULL); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, -1, -1, 1, 1); + + test_utils_check_pixel (test_fb, 2, 2, 0xffff00ff); + + cogl_object_unref (pipeline); + cogl_object_unref (tex1); + cogl_object_unref (tex2); +} + +void +test_sparse_pipeline (void) +{ + TestState state; + + state.fb_width = cogl_framebuffer_get_width (test_fb); + state.fb_height = cogl_framebuffer_get_height (test_fb); + + test_sparse_layer_combine (&state); + + /* FIXME: This should have a lot more tests, for example testing + whether using an attribute with sparse texture coordinates will + work */ + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-sub-texture.c b/tests/conform/test-sub-texture.c new file mode 100644 index 0000000..f049f3f --- /dev/null +++ b/tests/conform/test-sub-texture.c @@ -0,0 +1,325 @@ +#include +#include + +#include "test-utils.h" + +#define SOURCE_SIZE 32 +#define SOURCE_DIVISIONS_X 2 +#define SOURCE_DIVISIONS_Y 2 +#define DIVISION_WIDTH (SOURCE_SIZE / SOURCE_DIVISIONS_X) +#define DIVISION_HEIGHT (SOURCE_SIZE / SOURCE_DIVISIONS_Y) + +#define TEST_INSET 1 + +static const uint32_t +corner_colors[SOURCE_DIVISIONS_X * SOURCE_DIVISIONS_Y] = + { + 0xff0000ff, /* red top left */ + 0x00ff00ff, /* green top right */ + 0x0000ffff, /* blue bottom left */ + 0xff00ffff /* purple bottom right */ + }; + +typedef struct _TestState +{ + CoglTexture2D *tex; +} TestState; + +static CoglTexture2D * +create_source (TestState *state) +{ + int dx, dy; + uint8_t *data = g_malloc (SOURCE_SIZE * SOURCE_SIZE * 4); + CoglTexture2D *tex; + + /* Create a texture with a different coloured rectangle at each + corner */ + for (dy = 0; dy < SOURCE_DIVISIONS_Y; dy++) + for (dx = 0; dx < SOURCE_DIVISIONS_X; dx++) + { + uint8_t *p = (data + dy * DIVISION_HEIGHT * SOURCE_SIZE * 4 + + dx * DIVISION_WIDTH * 4); + int x, y; + + for (y = 0; y < DIVISION_HEIGHT; y++) + { + for (x = 0; x < DIVISION_WIDTH; x++) + { + uint32_t color = GUINT32_FROM_BE (corner_colors[dx + dy * SOURCE_DIVISIONS_X]); + memcpy (p, &color, 4); + p += 4; + } + + p += SOURCE_SIZE * 4 - DIVISION_WIDTH * 4; + } + } + + tex = cogl_texture_2d_new_from_data (test_ctx, + SOURCE_SIZE, SOURCE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888, + SOURCE_SIZE * 4, + data, + NULL); + return tex; +} + +static CoglTexture2D * +create_test_texture (TestState *state) +{ + CoglTexture2D *tex; + uint8_t *data = g_malloc (256 * 256 * 4), *p = data; + int x, y; + + /* Create a texture that is 256x256 where the red component ranges + from 0->255 along the x axis and the green component ranges from + 0->255 along the y axis. The blue and alpha components are all + 255 */ + for (y = 0; y < 256; y++) + for (x = 0; x < 256; x++) + { + *(p++) = x; + *(p++) = y; + *(p++) = 255; + *(p++) = 255; + } + + tex = cogl_texture_2d_new_from_data (test_ctx, + 256, 256, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 256 * 4, + data, + NULL); + g_free (data); + + return tex; +} + +static void +paint (TestState *state) +{ + CoglTexture2D *full_texture; + CoglSubTexture *sub_texture, *sub_sub_texture; + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + + /* Create a sub texture of the bottom right quarter of the texture */ + sub_texture = cogl_sub_texture_new (test_ctx, + state->tex, + DIVISION_WIDTH, + DIVISION_HEIGHT, + DIVISION_WIDTH, + DIVISION_HEIGHT); + + /* Paint it */ + cogl_pipeline_set_layer_texture (pipeline, 0, sub_texture); + cogl_object_unref (sub_texture); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, + 0.0f, 0.0f, DIVISION_WIDTH, DIVISION_HEIGHT); + + + /* Repeat a sub texture of the top half of the full texture. This is + documented to be undefined so it doesn't technically have to work + but it will with the current implementation */ + sub_texture = cogl_sub_texture_new (test_ctx, + state->tex, + 0, 0, + SOURCE_SIZE, + DIVISION_HEIGHT); + cogl_pipeline_set_layer_texture (pipeline, 0, sub_texture); + cogl_object_unref (sub_texture); + cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, + 0.0f, + SOURCE_SIZE, + SOURCE_SIZE * 2.0f, + SOURCE_SIZE * 1.5f, + 0.0f, 0.0f, + 2.0f, 1.0f); + + /* Create a sub texture of a sub texture */ + full_texture = create_test_texture (state); + sub_texture = cogl_sub_texture_new (test_ctx, + full_texture, + 20, 10, 30, 20); + cogl_object_unref (full_texture); + sub_sub_texture = cogl_sub_texture_new (test_ctx, + sub_texture, + 20, 10, 10, 10); + cogl_object_unref (sub_texture); + cogl_pipeline_set_layer_texture (pipeline, 0, sub_sub_texture); + cogl_object_unref (sub_sub_texture); + cogl_framebuffer_draw_rectangle (test_fb, pipeline, + 0.0f, SOURCE_SIZE * 2.0f, + 10.0f, SOURCE_SIZE * 2.0f + 10.0f); + + cogl_object_unref (pipeline); +} + +static void +validate_part (int xpos, int ypos, + int width, int height, + uint32_t color) +{ + test_utils_check_region (test_fb, + xpos + TEST_INSET, + ypos + TEST_INSET, + width - TEST_INSET - 2, + height - TEST_INSET - 2, + color); +} + +static uint8_t * +create_update_data (void) +{ + uint8_t *data = g_malloc (256 * 256 * 4), *p = data; + int x, y; + + /* Create some image data that is 256x256 where the blue component + ranges from 0->255 along the x axis and the alpha component + ranges from 0->255 along the y axis. The red and green components + are all zero */ + for (y = 0; y < 256; y++) + for (x = 0; x < 256; x++) + { + *(p++) = 0; + *(p++) = 0; + *(p++) = x; + *(p++) = y; + } + + return data; +} + +static void +validate_result (TestState *state) +{ + int i, division_num, x, y; + CoglTexture2D *test_tex; + CoglSubTexture *sub_texture; + uint8_t *texture_data, *p; + int tex_width, tex_height; + + /* Sub texture of the bottom right corner of the texture */ + validate_part (0, 0, DIVISION_WIDTH, DIVISION_HEIGHT, + corner_colors[ + (SOURCE_DIVISIONS_Y - 1) * SOURCE_DIVISIONS_X + + SOURCE_DIVISIONS_X - 1]); + + /* Sub texture of the top half repeated horizontally */ + for (i = 0; i < 2; i++) + for (division_num = 0; division_num < SOURCE_DIVISIONS_X; division_num++) + validate_part (i * SOURCE_SIZE + division_num * DIVISION_WIDTH, + SOURCE_SIZE, + DIVISION_WIDTH, DIVISION_HEIGHT, + corner_colors[division_num]); + + /* Sub sub texture */ + p = texture_data = g_malloc (10 * 10 * 4); + cogl_flush (); + cogl_framebuffer_read_pixels (test_fb, + 0, SOURCE_SIZE * 2, 10, 10, + COGL_PIXEL_FORMAT_RGBA_8888, + p); + for (y = 0; y < 10; y++) + for (x = 0; x < 10; x++) + { + g_assert (*(p++) == x + 40); + g_assert (*(p++) == y + 20); + p += 2; + } + g_free (texture_data); + + /* Try reading back the texture data */ + sub_texture = cogl_sub_texture_new (test_ctx, + state->tex, + SOURCE_SIZE / 4, + SOURCE_SIZE / 4, + SOURCE_SIZE / 2, + SOURCE_SIZE / 2); + tex_width = cogl_texture_get_width (sub_texture); + tex_height = cogl_texture_get_height (sub_texture); + p = texture_data = g_malloc (tex_width * tex_height * 4); + cogl_texture_get_data (sub_texture, + COGL_PIXEL_FORMAT_RGBA_8888, + tex_width * 4, + texture_data); + for (y = 0; y < tex_height; y++) + for (x = 0; x < tex_width; x++) + { + int div_x = ((x * SOURCE_SIZE / 2 / tex_width + SOURCE_SIZE / 4) / + DIVISION_WIDTH); + int div_y = ((y * SOURCE_SIZE / 2 / tex_height + SOURCE_SIZE / 4) / + DIVISION_HEIGHT); + uint32_t reference = corner_colors[div_x + div_y * SOURCE_DIVISIONS_X] >> 8; + uint32_t color = GUINT32_FROM_BE (*((uint32_t *)p)) >> 8; + g_assert (color == reference); + p += 4; + } + g_free (texture_data); + cogl_object_unref (sub_texture); + + /* Create a 256x256 test texture */ + test_tex = create_test_texture (state); + /* Create a sub texture the views the center half of the texture */ + sub_texture = cogl_sub_texture_new (test_ctx, + test_tex, + 64, 64, 128, 128); + /* Update the center half of the sub texture */ + texture_data = create_update_data (); + cogl_texture_set_region (sub_texture, + 0, 0, 32, 32, 64, 64, 256, 256, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, 256 * 4, + texture_data); + g_free (texture_data); + cogl_object_unref (sub_texture); + /* Get the texture data */ + p = texture_data = g_malloc (256 * 256 * 4); + cogl_texture_get_data (test_tex, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 256 * 4, texture_data); + + /* Verify the texture data */ + for (y = 0; y < 256; y++) + for (x = 0; x < 256; x++) + { + /* If we're in the center quarter */ + if (x >= 96 && x < 160 && y >= 96 && y < 160) + { + g_assert ((*p++) == 0); + g_assert ((*p++) == 0); + g_assert ((*p++) == x - 96); + g_assert ((*p++) == y - 96); + } + else + { + g_assert ((*p++) == x); + g_assert ((*p++) == y); + g_assert ((*p++) == 255); + g_assert ((*p++) == 255); + } + } + g_free (texture_data); + cogl_object_unref (test_tex); +} + +void +test_sub_texture (void) +{ + TestState state; + + state.tex = create_source (&state); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + cogl_framebuffer_get_width (test_fb), + cogl_framebuffer_get_height (test_fb), + -1, + 100); + + paint (&state); + validate_result (&state); + + cogl_object_unref (state.tex); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c new file mode 100644 index 0000000..8cc5bb5 --- /dev/null +++ b/tests/conform/test-texture-3d.c @@ -0,0 +1,274 @@ +#include +#include + +#include "test-utils.h" + +#define TEX_WIDTH 4 +#define TEX_HEIGHT 8 +#define TEX_DEPTH 16 +/* Leave four bytes of padding between each row */ +#define TEX_ROWSTRIDE (TEX_WIDTH * 4 + 4) +/* Leave four rows of padding between each image */ +#define TEX_IMAGE_STRIDE ((TEX_HEIGHT + 4) * TEX_ROWSTRIDE) + +typedef struct _TestState +{ + int fb_width; + int fb_height; +} TestState; + +static CoglTexture3D * +create_texture_3d (CoglContext *context) +{ + int x, y, z; + uint8_t *data = g_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH); + uint8_t *p = data; + CoglTexture3D *tex; + CoglError *error = NULL; + + for (z = 0; z < TEX_DEPTH; z++) + { + for (y = 0; y < TEX_HEIGHT; y++) + { + for (x = 0; x < TEX_WIDTH; x++) + { + /* Set red, green, blue to values based on x, y, z */ + *(p++) = 255 - x * 8; + *(p++) = y * 8; + *(p++) = 255 - z * 8; + /* Fully opaque */ + *(p++) = 0xff; + } + + /* Set the padding between rows to 0xde */ + memset (p, 0xde, TEX_ROWSTRIDE - (TEX_WIDTH * 4)); + p += TEX_ROWSTRIDE - (TEX_WIDTH * 4); + } + /* Set the padding between images to 0xad */ + memset (p, 0xba, TEX_IMAGE_STRIDE - (TEX_HEIGHT * TEX_ROWSTRIDE)); + p += TEX_IMAGE_STRIDE - (TEX_HEIGHT * TEX_ROWSTRIDE); + } + + tex = cogl_texture_3d_new_from_data (context, + TEX_WIDTH, TEX_HEIGHT, TEX_DEPTH, + COGL_PIXEL_FORMAT_RGBA_8888, + TEX_ROWSTRIDE, + TEX_IMAGE_STRIDE, + data, + &error); + + if (tex == NULL) + { + g_assert (error != NULL); + g_warning ("Failed to create 3D texture: %s", error->message); + g_assert_not_reached (); + } + + g_free (data); + + return tex; +} + +static void +draw_frame (TestState *state) +{ + CoglTexture *tex = create_texture_3d (test_ctx); + CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); + typedef struct { float x, y, s, t, r; } Vert; + CoglPrimitive *primitive; + CoglAttributeBuffer *attribute_buffer; + CoglAttribute *attributes[2]; + Vert *verts, *v; + int i; + + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_object_unref (tex); + cogl_pipeline_set_layer_filters (pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + /* Render the texture repeated horizontally twice using a regular + cogl rectangle. This should end up with the r texture coordinates + as zero */ + cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, + 0.0f, 0.0f, TEX_WIDTH * 2, TEX_HEIGHT, + 0.0f, 0.0f, 2.0f, 1.0f); + + /* Render all of the images in the texture using coordinates from a + CoglPrimitive */ + v = verts = g_new (Vert, 4 * TEX_DEPTH); + for (i = 0; i < TEX_DEPTH; i++) + { + float r = (i + 0.5f) / TEX_DEPTH; + + v->x = i * TEX_WIDTH; + v->y = TEX_HEIGHT; + v->s = 0; + v->t = 0; + v->r = r; + v++; + + v->x = i * TEX_WIDTH; + v->y = TEX_HEIGHT * 2; + v->s = 0; + v->t = 1; + v->r = r; + v++; + + v->x = i * TEX_WIDTH + TEX_WIDTH; + v->y = TEX_HEIGHT * 2; + v->s = 1; + v->t = 1; + v->r = r; + v++; + + v->x = i * TEX_WIDTH + TEX_WIDTH; + v->y = TEX_HEIGHT; + v->s = 1; + v->t = 0; + v->r = r; + v++; + } + + attribute_buffer = cogl_attribute_buffer_new (test_ctx, + 4 * TEX_DEPTH * sizeof (Vert), + verts); + attributes[0] = cogl_attribute_new (attribute_buffer, + "cogl_position_in", + sizeof (Vert), + G_STRUCT_OFFSET (Vert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + attributes[1] = cogl_attribute_new (attribute_buffer, + "cogl_tex_coord_in", + sizeof (Vert), + G_STRUCT_OFFSET (Vert, s), + 3, /* n_components */ + COGL_ATTRIBUTE_TYPE_FLOAT); + primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, + 6 * TEX_DEPTH, + attributes, + 2 /* n_attributes */); + + cogl_primitive_set_indices (primitive, + cogl_get_rectangle_indices (test_ctx, + TEX_DEPTH), + 6 * TEX_DEPTH); + + cogl_primitive_draw (primitive, test_fb, pipeline); + + g_free (verts); + + cogl_object_unref (primitive); + cogl_object_unref (attributes[0]); + cogl_object_unref (attributes[1]); + cogl_object_unref (attribute_buffer); + cogl_object_unref (pipeline); +} + +static void +validate_block (int block_x, int block_y, int z) +{ + int x, y; + + for (y = 0; y < TEX_HEIGHT; y++) + for (x = 0; x < TEX_WIDTH; x++) + test_utils_check_pixel_rgb (test_fb, + block_x * TEX_WIDTH + x, + block_y * TEX_HEIGHT + y, + 255 - x * 8, + y * 8, + 255 - z * 8); +} + +static void +validate_result (void) +{ + int i; + + validate_block (0, 0, 0); + + for (i = 0; i < TEX_DEPTH; i++) + validate_block (i, 1, i); +} + +static void +test_multi_texture (TestState *state) +{ + CoglPipeline *pipeline; + CoglTexture3D *tex_3d; + CoglTexture2D *tex_2d; + uint8_t tex_data[4]; + + cogl_framebuffer_clear4f (test_fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + /* Tests a pipeline that is using multi-texturing to combine a 3D + texture with a 2D texture. The texture from another layer is + sampled with TEXTURE_? just to pick up a specific bug that was + happening with the ARBfp fragend */ + + pipeline = cogl_pipeline_new (test_ctx); + + tex_data[0] = 0xff; + tex_data[1] = 0x00; + tex_data[2] = 0x00; + tex_data[3] = 0xff; + tex_2d = cogl_texture_2d_new_from_data (test_ctx, + 1, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + tex_data, + NULL); + cogl_pipeline_set_layer_texture (pipeline, 0, tex_2d); + + tex_data[0] = 0x00; + tex_data[1] = 0xff; + tex_data[2] = 0x00; + tex_data[3] = 0xff; + tex_3d = cogl_texture_3d_new_from_data (test_ctx, + 1, 1, 1, /* width/height/depth */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + 4, /* image_stride */ + tex_data, + NULL); + cogl_pipeline_set_layer_texture (pipeline, 1, tex_3d); + + cogl_pipeline_set_layer_combine (pipeline, 0, + "RGBA = REPLACE(PREVIOUS)", + NULL); + cogl_pipeline_set_layer_combine (pipeline, 1, + "RGBA = ADD(TEXTURE_0, TEXTURE_1)", + NULL); + + cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); + + test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff); + + cogl_object_unref (tex_2d); + cogl_object_unref (tex_3d); + cogl_object_unref (pipeline); +} + +void +test_texture_3d (void) +{ + TestState state; + + state.fb_width = cogl_framebuffer_get_width (test_fb); + state.fb_height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, /* x_1, y_1 */ + state.fb_width, /* x_2 */ + state.fb_height /* y_2 */, + -1, 100 /* near/far */); + + draw_frame (&state); + validate_result (); + + test_multi_texture (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-texture-get-set-data.c b/tests/conform/test-texture-get-set-data.c new file mode 100644 index 0000000..59bd0f6 --- /dev/null +++ b/tests/conform/test-texture-get-set-data.c @@ -0,0 +1,144 @@ +#include + +#include + +#include "test-utils.h" + +static void +check_texture (int width, int height, TestUtilsTextureFlags flags) +{ + CoglTexture *tex; + uint8_t *data, *p; + int y, x; + int rowstride; + CoglBitmap *bmp; + + p = data = g_malloc (width * height * 4); + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + { + *(p++) = x; + *(p++) = y; + *(p++) = 128; + *(p++) = (x ^ y); + } + + bmp = cogl_bitmap_new_for_data (test_ctx, + width, height, + COGL_PIXEL_FORMAT_RGBA_8888, + width * 4, + data); + + tex = test_utils_texture_new_from_bitmap (bmp, flags, + FALSE); + + /* Replace the bottom right quarter of the data with negated data to + test set_region */ + rowstride = width * 4; + p = data + (height / 2) * rowstride + rowstride / 2; + for (y = 0; y < height / 2; y++) + { + for (x = 0; x < width / 2; x++) + { + p[0] = ~p[0]; + p[1] = ~p[1]; + p[2] = ~p[2]; + p[3] = ~p[3]; + p += 4; + } + p += width * 2; + } + cogl_texture_set_region (tex, + width / 2, + height / 2, + width / 2, /* dest x */ + height / 2, /* dest y */ + width / 2, /* region width */ + height / 2, /* region height */ + width, /* src width */ + height, /* src height */ + COGL_PIXEL_FORMAT_RGBA_8888, + rowstride, + data); + + /* Check passing a NULL pointer and a zero rowstride. The texture + should calculate the needed data size and return it */ + g_assert_cmpint (cogl_texture_get_data (tex, COGL_PIXEL_FORMAT_ANY, 0, NULL), + ==, + width * height * 4); + + /* Try first receiving the data as RGB. This should cause a + * conversion */ + memset (data, 0, width * height * 4); + + cogl_texture_get_data (tex, COGL_PIXEL_FORMAT_RGB_888, + width * 3, data); + + p = data; + + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + { + if (x >= width / 2 && y >= height / 2) + { + g_assert_cmpint (p[0], ==, ~x & 0xff); + g_assert_cmpint (p[1], ==, ~y & 0xff); + g_assert_cmpint (p[2], ==, ~128 & 0xff); + } + else + { + g_assert_cmpint (p[0], ==, x & 0xff); + g_assert_cmpint (p[1], ==, y & 0xff); + g_assert_cmpint (p[2], ==, 128); + } + p += 3; + } + + /* Now try receiving the data as RGBA. This should not cause a + * conversion and no unpremultiplication because we explicitly set + * the internal format when we created the texture */ + memset (data, 0, width * height * 4); + + cogl_texture_get_data (tex, COGL_PIXEL_FORMAT_RGBA_8888, + width * 4, data); + + p = data; + + for (y = 0; y < height; y++) + for (x = 0; x < width; x++) + { + if (x >= width / 2 && y >= height / 2) + { + g_assert_cmpint (p[0], ==, ~x & 0xff); + g_assert_cmpint (p[1], ==, ~y & 0xff); + g_assert_cmpint (p[2], ==, ~128 & 0xff); + g_assert_cmpint (p[3], ==, ~(x ^ y) & 0xff); + } + else + { + g_assert_cmpint (p[0], ==, x & 0xff); + g_assert_cmpint (p[1], ==, y & 0xff); + g_assert_cmpint (p[2], ==, 128); + g_assert_cmpint (p[3], ==, (x ^ y) & 0xff); + } + p += 4; + } + + cogl_object_unref (tex); + g_free (data); +} + +void +test_texture_get_set_data (void) +{ + /* First try without atlasing */ + check_texture (256, 256, TEST_UTILS_TEXTURE_NO_ATLAS); + /* Try again with atlasing. This should end up testing the atlas + backend and the sub texture backend */ + check_texture (256, 256, 0); + /* Try with a really big texture in the hope that it will end up + sliced. */ + check_texture (4, 5128, TEST_UTILS_TEXTURE_NO_ATLAS); + /* And in the other direction. */ + check_texture (5128, 4, TEST_UTILS_TEXTURE_NO_ATLAS); +} diff --git a/tests/conform/test-texture-no-allocate.c b/tests/conform/test-texture-no-allocate.c new file mode 100644 index 0000000..b0199a9 --- /dev/null +++ b/tests/conform/test-texture-no-allocate.c @@ -0,0 +1,80 @@ +#include + +#include "test-utils.h" + +/* Tests that the various texture types can be freed without being + * allocated */ + +/* Texture size that is probably to big to fit within the texture + * limits */ +#define BIG_TEX_WIDTH 16384 +#define BIG_TEX_HEIGHT 128 + +void +test_texture_no_allocate (void) +{ + uint8_t *tex_data; + CoglTexture *texture; + CoglTexture2D *texture_2d; + GError *error = NULL; + + tex_data = g_malloc (BIG_TEX_WIDTH * BIG_TEX_HEIGHT * 4); + + /* NB: if we make the atlas and sliced texture APIs public then this + * could changed to explicitly use that instead of the magic texture + * API */ + + /* Try to create an atlas texture that is too big so it will + * internally be freed without allocating */ + texture = + cogl_atlas_texture_new_from_data (test_ctx, + BIG_TEX_WIDTH, + BIG_TEX_HEIGHT, + /* format */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + /* rowstride */ + BIG_TEX_WIDTH * 4, + tex_data, + &error); + + g_free (tex_data); + + /* It's ok if this causes an error, we just don't want it to + * crash */ + + if (texture == NULL) + cogl_error_free (error); + else + cogl_object_unref (texture); + + /* Try to create a sliced texture without allocating it */ + texture = + cogl_texture_2d_sliced_new_with_size (test_ctx, + BIG_TEX_WIDTH, + BIG_TEX_HEIGHT, + COGL_TEXTURE_MAX_WASTE); + cogl_object_unref (texture); + + /* 2D texture */ + texture_2d = cogl_texture_2d_new_with_size (test_ctx, + 64, 64); + cogl_object_unref (texture_2d); + + /* 3D texture */ + if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + CoglTexture3D *texture_3d = + cogl_texture_3d_new_with_size (test_ctx, + 64, 64, 64); + cogl_object_unref (texture_3d); + } + + /* Rectangle texture */ + if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE)) + { + CoglTextureRectangle *texture_rect = + cogl_texture_rectangle_new_with_size (test_ctx, + 64, 64); + cogl_object_unref (texture_rect); + } +} diff --git a/tests/conform/test-texture-rg.c b/tests/conform/test-texture-rg.c new file mode 100644 index 0000000..72a5ae9 --- /dev/null +++ b/tests/conform/test-texture-rg.c @@ -0,0 +1,74 @@ +#include + +#include + +#include "test-utils.h" + +#define TEX_WIDTH 8 +#define TEX_HEIGHT 8 + +static CoglTexture2D * +make_texture (void) +{ + uint8_t tex_data[TEX_WIDTH * TEX_HEIGHT * 2], *p = tex_data; + int x, y; + + for (y = 0; y < TEX_HEIGHT; y++) + for (x = 0; x < TEX_WIDTH; x++) + { + *(p++) = x * 256 / TEX_WIDTH; + *(p++) = y * 256 / TEX_HEIGHT; + } + + return cogl_texture_2d_new_from_data (test_ctx, + TEX_WIDTH, TEX_HEIGHT, + COGL_PIXEL_FORMAT_RG_88, + TEX_WIDTH * 2, + tex_data, + NULL); +} + +void +test_texture_rg (void) +{ + CoglPipeline *pipeline; + CoglTexture2D *tex; + int fb_width, fb_height; + int x, y; + + fb_width = cogl_framebuffer_get_width (test_fb); + fb_height = cogl_framebuffer_get_height (test_fb); + + tex = make_texture (); + + g_assert (cogl_texture_get_components (tex) == COGL_TEXTURE_COMPONENTS_RG); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_texture (pipeline, 0, tex); + cogl_pipeline_set_layer_filters (pipeline, + 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + cogl_framebuffer_draw_rectangle (test_fb, + pipeline, + -1.0f, 1.0f, + 1.0f, -1.0f); + + for (y = 0; y < TEX_HEIGHT; y++) + for (x = 0; x < TEX_WIDTH; x++) + { + test_utils_check_pixel_rgb (test_fb, + x * fb_width / TEX_WIDTH + + fb_width / (TEX_WIDTH * 2), + y * fb_height / TEX_HEIGHT + + fb_height / (TEX_HEIGHT * 2), + x * 256 / TEX_WIDTH, + y * 256 / TEX_HEIGHT, + 0); + } + + cogl_object_unref (pipeline); + cogl_object_unref (tex); +} diff --git a/tests/conform/test-version.c b/tests/conform/test-version.c new file mode 100644 index 0000000..b651165 --- /dev/null +++ b/tests/conform/test-version.c @@ -0,0 +1,85 @@ +#include + +/* These will be redefined in config.h */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API +#undef COGL_ENABLE_EXPERIMENTAL_API + +#include "test-utils.h" +#include "config.h" + +/* So we can use _COGL_STATIC_ASSERT we include the internal + * cogl-util.h header. Since internal headers explicitly guard against + * applications including them directly instead of including + * we define __COGL_H_INSIDE__ here to subvert those + * guards in this case... */ +#define __COGL_H_INSIDE__ +#include +#undef __COGL_H_INSIDE__ + +_COGL_STATIC_ASSERT (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO) == + COGL_VERSION, + "The pre-encoded Cogl version does not match the version " + "encoding macro"); + +_COGL_STATIC_ASSERT (COGL_VERSION_GET_MAJOR (COGL_VERSION_ENCODE (100, + 200, + 300)) == + 100, + "Getting the major component out of a encoded version " + "does not work"); +_COGL_STATIC_ASSERT (COGL_VERSION_GET_MINOR (COGL_VERSION_ENCODE (100, + 200, + 300)) == + 200, + "Getting the minor component out of a encoded version " + "does not work"); +_COGL_STATIC_ASSERT (COGL_VERSION_GET_MICRO (COGL_VERSION_ENCODE (100, + 200, + 300)) == + 300, + "Getting the micro component out of a encoded version " + "does not work"); + +_COGL_STATIC_ASSERT (COGL_VERSION_CHECK (COGL_VERSION_MAJOR, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO), + "Checking the Cogl version against the current version " + "does not pass"); +_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO + 1), + "Checking the Cogl version against a later micro version " + "should not pass"); +_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR, + COGL_VERSION_MINOR + 1, + COGL_VERSION_MICRO), + "Checking the Cogl version against a later minor version " + "should not pass"); +_COGL_STATIC_ASSERT (!COGL_VERSION_CHECK (COGL_VERSION_MAJOR + 1, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO), + "Checking the Cogl version against a later major version " + "should not pass"); + +_COGL_STATIC_ASSERT (COGL_VERSION_CHECK (COGL_VERSION_MAJOR - 1, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO), + "Checking the Cogl version against a older major version " + "should pass"); + +void +test_version (void) +{ + const char *version = g_strdup_printf ("version = %i.%i.%i", + COGL_VERSION_MAJOR, + COGL_VERSION_MINOR, + COGL_VERSION_MICRO); + + g_assert_cmpstr (version, ==, "version = " COGL_VERSION_STRING); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-wrap-modes.c b/tests/conform/test-wrap-modes.c new file mode 100644 index 0000000..e5a2a1a --- /dev/null +++ b/tests/conform/test-wrap-modes.c @@ -0,0 +1,296 @@ +#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_1_0 + +#include +#include + +#include "test-utils.h" + +#define TEX_SIZE 4 + +typedef struct _TestState +{ + int width; + int height; + CoglTexture *texture; +} TestState; + +static CoglTexture * +create_texture (TestUtilsTextureFlags flags) +{ + uint8_t *data = g_malloc (TEX_SIZE * TEX_SIZE * 4), *p = data; + CoglTexture *tex; + int x, y; + + for (y = 0; y < TEX_SIZE; y++) + for (x = 0; x < TEX_SIZE; x++) + { + *(p++) = 0; + *(p++) = (x & 1) * 255; + *(p++) = (y & 1) * 255; + *(p++) = 255; + } + + tex = test_utils_texture_new_from_data (test_ctx, + TEX_SIZE, TEX_SIZE, flags, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + TEX_SIZE * 4, + data); + g_free (data); + + return tex; +} + +static CoglPipeline * +create_pipeline (TestState *state, + CoglPipelineWrapMode wrap_mode_s, + CoglPipelineWrapMode wrap_mode_t) +{ + CoglPipeline *pipeline; + + pipeline = cogl_pipeline_new (test_ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->texture); + cogl_pipeline_set_layer_filters (pipeline, 0, + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + cogl_pipeline_set_layer_wrap_mode_s (pipeline, 0, wrap_mode_s); + cogl_pipeline_set_layer_wrap_mode_t (pipeline, 0, wrap_mode_t); + + return pipeline; +} + +static CoglPipelineWrapMode +wrap_modes[] = + { + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_REPEAT, + + COGL_PIPELINE_WRAP_MODE_AUTOMATIC, + COGL_PIPELINE_WRAP_MODE_AUTOMATIC, + + COGL_PIPELINE_WRAP_MODE_AUTOMATIC, + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE + }; + +static void +draw_tests (TestState *state) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2) + { + CoglPipelineWrapMode wrap_mode_s, wrap_mode_t; + CoglPipeline *pipeline; + + /* Create a separate pipeline for each pair of wrap modes so + that we can verify whether the batch splitting works */ + wrap_mode_s = wrap_modes[i]; + wrap_mode_t = wrap_modes[i + 1]; + pipeline = create_pipeline (state, wrap_mode_s, wrap_mode_t); + /* Render the pipeline at four times the size of the texture */ + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + i * TEX_SIZE, + 0, + (i + 2) * TEX_SIZE, + TEX_SIZE * 2, + 0, 0, 2, 2); + cogl_object_unref (pipeline); + } +} + +static const CoglTextureVertex vertices[4] = + { + { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }, + { 0.0f, TEX_SIZE * 2, 0.0f, 0.0f, 2.0f }, + { TEX_SIZE * 2, TEX_SIZE * 2, 0.0f, 2.0f, 2.0f }, + { TEX_SIZE * 2, 0.0f, 0.0f, 2.0f, 0.0f } + }; + +static void +draw_tests_polygon (TestState *state) +{ + int i; + + for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2) + { + CoglPipelineWrapMode wrap_mode_s, wrap_mode_t; + CoglPipeline *pipeline; + + wrap_mode_s = wrap_modes[i]; + wrap_mode_t = wrap_modes[i + 1]; + pipeline = create_pipeline (state, wrap_mode_s, wrap_mode_t); + cogl_set_source (pipeline); + cogl_object_unref (pipeline); + cogl_push_matrix (); + cogl_translate (TEX_SIZE * i, 0.0f, 0.0f); + /* Render the pipeline at four times the size of the texture */ + cogl_polygon (vertices, G_N_ELEMENTS (vertices), FALSE); + cogl_pop_matrix (); + } +} + +static void +draw_tests_vbo (TestState *state) +{ + CoglHandle vbo; + int i; + + vbo = cogl_vertex_buffer_new (4); + cogl_vertex_buffer_add (vbo, "gl_Vertex", 3, + COGL_ATTRIBUTE_TYPE_FLOAT, FALSE, + sizeof (vertices[0]), + &vertices[0].x); + cogl_vertex_buffer_add (vbo, "gl_MultiTexCoord0", 2, + COGL_ATTRIBUTE_TYPE_FLOAT, FALSE, + sizeof (vertices[0]), + &vertices[0].tx); + cogl_vertex_buffer_submit (vbo); + + for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2) + { + CoglPipelineWrapMode wrap_mode_s, wrap_mode_t; + CoglPipeline *pipeline; + + wrap_mode_s = wrap_modes[i]; + wrap_mode_t = wrap_modes[i + 1]; + pipeline = create_pipeline (state, wrap_mode_s, wrap_mode_t); + cogl_set_source (pipeline); + cogl_object_unref (pipeline); + cogl_push_matrix (); + cogl_translate (TEX_SIZE * i, 0.0f, 0.0f); + /* Render the pipeline at four times the size of the texture */ + cogl_vertex_buffer_draw (vbo, COGL_VERTICES_MODE_TRIANGLE_FAN, 0, 4); + cogl_pop_matrix (); + } + + cogl_handle_unref (vbo); +} + +static void +validate_set (TestState *state, int offset) +{ + uint8_t data[TEX_SIZE * 2 * TEX_SIZE * 2 * 4], *p; + int x, y, i; + + for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2) + { + CoglPipelineWrapMode wrap_mode_s, wrap_mode_t; + + wrap_mode_s = wrap_modes[i]; + wrap_mode_t = wrap_modes[i + 1]; + + cogl_framebuffer_read_pixels (test_fb, i * TEX_SIZE, offset * TEX_SIZE * 2, + TEX_SIZE * 2, TEX_SIZE * 2, + COGL_PIXEL_FORMAT_RGBA_8888, + data); + + p = data; + + for (y = 0; y < TEX_SIZE * 2; y++) + for (x = 0; x < TEX_SIZE * 2; x++) + { + uint8_t green, blue; + + if (x < TEX_SIZE || + wrap_mode_s == COGL_PIPELINE_WRAP_MODE_REPEAT || + wrap_mode_s == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + green = (x & 1) * 255; + else + green = ((TEX_SIZE - 1) & 1) * 255; + + if (y < TEX_SIZE || + wrap_mode_t == COGL_PIPELINE_WRAP_MODE_REPEAT || + wrap_mode_t == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + blue = (y & 1) * 255; + else + blue = ((TEX_SIZE - 1) & 1) * 255; + + g_assert_cmpint (p[0], ==, 0); + g_assert_cmpint (p[1], ==, green); + g_assert_cmpint (p[2], ==, blue); + + p += 4; + } + } +} + +static void +validate_result (TestState *state) +{ + validate_set (state, 0); /* non-atlased rectangle */ +#if 0 /* this doesn't currently work */ + validate_set (state, 1); /* atlased rectangle */ +#endif + validate_set (state, 2); /* cogl_polygon */ + validate_set (state, 3); /* vertex buffer */ +} + +static void +paint (TestState *state) +{ + /* Draw the tests first with a non atlased texture */ + state->texture = create_texture (TEST_UTILS_TEXTURE_NO_ATLAS); + draw_tests (state); + cogl_object_unref (state->texture); + + /* Draw the tests again with a possible atlased texture. This should + end up testing software repeats */ + state->texture = create_texture (TEST_UTILS_TEXTURE_NONE); + cogl_framebuffer_push_matrix (test_fb); + cogl_framebuffer_translate (test_fb, 0.0f, TEX_SIZE * 2.0f, 0.0f); + draw_tests (state); + cogl_pop_matrix (); + cogl_object_unref (state->texture); + + /* Draw the tests using cogl_polygon */ + state->texture = create_texture (COGL_TEXTURE_NO_ATLAS); + cogl_push_matrix (); + cogl_translate (0.0f, TEX_SIZE * 4.0f, 0.0f); + draw_tests_polygon (state); + cogl_pop_matrix (); + cogl_object_unref (state->texture); + + /* Draw the tests using a vertex buffer */ + state->texture = create_texture (COGL_TEXTURE_NO_ATLAS); + cogl_push_matrix (); + cogl_translate (0.0f, TEX_SIZE * 6.0f, 0.0f); + draw_tests_vbo (state); + cogl_pop_matrix (); + cogl_object_unref (state->texture); + + validate_result (state); +} + +void +test_wrap_modes (void) +{ + TestState state; + + state.width = cogl_framebuffer_get_width (test_fb); + state.height = cogl_framebuffer_get_height (test_fb); + + cogl_framebuffer_orthographic (test_fb, + 0, 0, + state.width, + state.height, + -1, + 100); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_vertex_buffer_draw() api. */ + cogl_push_framebuffer (test_fb); + paint (&state); + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-wrap-rectangle-textures.c b/tests/conform/test-wrap-rectangle-textures.c new file mode 100644 index 0000000..73b3575 --- /dev/null +++ b/tests/conform/test-wrap-rectangle-textures.c @@ -0,0 +1,175 @@ +#include + +#include + +#include "test-utils.h" + +#define DRAW_SIZE 64 + +static CoglPipeline * +create_base_pipeline (void) +{ + CoglBitmap *bmp; + CoglTextureRectangle *tex; + CoglPipeline *pipeline; + uint8_t tex_data[] = + { + 0x44, 0x44, 0x44, 0x88, 0x88, 0x88, + 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff + }; + + bmp = cogl_bitmap_new_for_data (test_ctx, + 2, 2, /* width/height */ + COGL_PIXEL_FORMAT_RGB_888, + 2 * 3, /* rowstride */ + tex_data); + + tex = cogl_texture_rectangle_new_from_bitmap (bmp); + + cogl_object_unref (bmp); + + pipeline = cogl_pipeline_new (test_ctx); + + cogl_pipeline_set_layer_filters (pipeline, + 0, /* layer */ + COGL_PIPELINE_FILTER_NEAREST, + COGL_PIPELINE_FILTER_NEAREST); + + cogl_pipeline_set_layer_texture (pipeline, + 0, /* layer */ + tex); + + cogl_object_unref (tex); + + return pipeline; +} + +static void +check_colors (int x_offset, + int y_offset, + const uint8_t expected_colors[9]) +{ + int x, y; + + for (y = 0; y < 4; y++) + for (x = 0; x < 4; x++) + { + uint32_t color = expected_colors[x + y * 4]; + test_utils_check_region (test_fb, + x * DRAW_SIZE / 4 + 1 + x_offset, + y * DRAW_SIZE / 4 + 1 + y_offset, + DRAW_SIZE / 4 - 2, + DRAW_SIZE / 4 - 2, + 0xff | + (color << 8) | + (color << 16) | + (color << 24)); + } +} + +static void +test_pipeline (CoglPipeline *pipeline, + int x_offset, + int y_offset, + const uint8_t expected_colors[9]) +{ + float x1 = x_offset; + float y1 = y_offset; + float x2 = x1 + DRAW_SIZE; + float y2 = y1 + DRAW_SIZE; + int y, x; + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + x1, y1, + x2, y2, + -0.5f, /* s1 */ + -0.5f, /* t1 */ + 1.5f, /* s2 */ + 1.5f /* t2 */); + + check_colors (x_offset, y_offset, expected_colors); + + /* Also try drawing each quadrant of the rectangle with a small + * rectangle */ + + for (y = -1; y < 3; y++) + for (x = -1; x < 3; x++) + { + x1 = x_offset + (x + 1) * DRAW_SIZE / 4 + DRAW_SIZE; + y1 = y_offset + (y + 1) * DRAW_SIZE / 4; + x2 = x1 + DRAW_SIZE / 4; + y2 = y1 + DRAW_SIZE / 4; + + cogl_framebuffer_draw_textured_rectangle (test_fb, + pipeline, + x1, y1, + x2, y2, + x / 2.0f, /* s1 */ + y / 2.0f, /* t1 */ + (x + 1) / 2.0f, /* s2 */ + (y + 1) / 2.0f /* t2 */); + } + + check_colors (x_offset + DRAW_SIZE, y_offset, expected_colors); +} + +void +test_wrap_rectangle_textures (void) +{ + float fb_width = cogl_framebuffer_get_width (test_fb); + float fb_height = cogl_framebuffer_get_height (test_fb); + CoglPipeline *base_pipeline; + CoglPipeline *clamp_pipeline; + CoglPipeline *repeat_pipeline; + /* The textures are drawn with the texture coordinates from + * -0.5→1.5. That means we get one complete copy of the texture and + * an extra half of the texture surrounding it. The drawing is + * tested against a 4x4 grid of colors. The center 2x2 colours + * specify the normal texture colors and the other colours specify + * what the wrap mode should generate */ + static const uint8_t clamp_colors[] = + { + 0x44, 0x44, 0x88, 0x88, + 0x44, 0x44, 0x88, 0x88, + 0xcc, 0xcc, 0xff, 0xff, + 0xcc, 0xcc, 0xff, 0xff + }; + static const uint8_t repeat_colors[] = + { + 0xff, 0xcc, 0xff, 0xcc, + 0x88, 0x44, 0x88, 0x44, + 0xff, 0xcc, 0xff, 0xcc, + 0x88, 0x44, 0x88, 0x44 + }; + + cogl_framebuffer_orthographic (test_fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + base_pipeline = create_base_pipeline (); + + clamp_pipeline = cogl_pipeline_copy (base_pipeline); + cogl_pipeline_set_layer_wrap_mode (clamp_pipeline, + 0, /* layer */ + COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE); + + repeat_pipeline = cogl_pipeline_copy (base_pipeline); + cogl_pipeline_set_layer_wrap_mode (repeat_pipeline, + 0, /* layer */ + COGL_PIPELINE_WRAP_MODE_REPEAT); + + test_pipeline (clamp_pipeline, + 0, 0, /* x/y offset */ + clamp_colors); + + test_pipeline (repeat_pipeline, + 0, DRAW_SIZE * 2, /* x/y offset */ + repeat_colors); + + cogl_object_unref (repeat_pipeline); + cogl_object_unref (clamp_pipeline); + cogl_object_unref (base_pipeline); +} diff --git a/tests/conform/test-write-texture-formats.c b/tests/conform/test-write-texture-formats.c new file mode 100644 index 0000000..d415df0 --- /dev/null +++ b/tests/conform/test-write-texture-formats.c @@ -0,0 +1,184 @@ +#include +#include + +#include "test-utils.h" + +/* + * This tests writing data to an RGBA texture in all of the available + * pixel formats + */ + +static void +test_color (CoglTexture *texture, + uint32_t expected_pixel) +{ + uint8_t received_pixel[4]; + + cogl_texture_get_data (texture, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + received_pixel); + + test_utils_compare_pixel_and_alpha (received_pixel, expected_pixel); +} + +static void +test_write_byte (CoglContext *context, + CoglPixelFormat format, + uint8_t byte, + uint32_t expected_pixel) +{ + CoglTexture *texture = test_utils_create_color_texture (context, 0); + + cogl_texture_set_region (texture, + 0, 0, /* src_x / src_y */ + 0, 0, /* dst_x / dst_y */ + 1, 1, /* dst_w / dst_h */ + 1, 1, /* width / height */ + format, + 1, /* rowstride */ + &byte); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +static void +test_write_short (CoglContext *context, + CoglPixelFormat format, + uint16_t value, + uint32_t expected_pixel) +{ + CoglTexture *texture = test_utils_create_color_texture (context, 0); + + cogl_texture_set_region (texture, + 0, 0, /* src_x / src_y */ + 0, 0, /* dst_x / dst_y */ + 1, 1, /* dst_w / dst_h */ + 1, 1, /* width / height */ + format, + 2, /* rowstride */ + (uint8_t *) &value); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +static void +test_write_bytes (CoglContext *context, + CoglPixelFormat format, + uint32_t value, + uint32_t expected_pixel) +{ + CoglTexture *texture = test_utils_create_color_texture (context, 0); + + value = GUINT32_TO_BE (value); + + cogl_texture_set_region (texture, + 0, 0, /* src_x / src_y */ + 0, 0, /* dst_x / dst_y */ + 1, 1, /* dst_w / dst_h */ + 1, 1, /* width / height */ + format, + 4, /* rowstride */ + (uint8_t *) &value); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +static void +test_write_int (CoglContext *context, + CoglPixelFormat format, + uint32_t expected_pixel, + ...) +{ + va_list ap; + int bits; + uint32_t tex_data = 0; + int bits_sum = 0; + CoglTexture *texture = test_utils_create_color_texture (context, 0); + + va_start (ap, expected_pixel); + + /* Convert the va args into a single 32-bit value */ + while ((bits = va_arg (ap, int)) != -1) + { + uint32_t value = (va_arg (ap, int) * ((1 << bits) - 1) + 127) / 255; + + bits_sum += bits; + + tex_data |= value << (32 - bits_sum); + } + + va_end (ap); + + cogl_texture_set_region (texture, + 0, 0, /* src_x / src_y */ + 0, 0, /* dst_x / dst_y */ + 1, 1, /* dst_w / dst_h */ + 1, 1, /* width / height */ + format, + 4, /* rowstride */ + (uint8_t *) &tex_data); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +void +test_write_texture_formats (void) +{ + test_write_byte (test_ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034); +#if 0 + /* I'm not sure what's the right value to put here because Nvidia + and Mesa seem to behave differently so one of them must be + wrong. */ + test_write_byte (test_ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff); +#endif + + /* We should always be able to read from an RG buffer regardless of + * whether RG textures are supported because Cogl will do the + * conversion for us */ + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_RG_88, 0x123456ff, 0x123400ff); + + test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGB_565, 0x0843, 0x080819ff); + test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGBA_4444_PRE, 0x1234, 0x11223344); + test_write_short (test_ctx, COGL_PIXEL_FORMAT_RGBA_5551_PRE, 0x0887, 0x081019ff); + + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff, 0x123456ff); + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff, 0x123456ff); + + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 0x12345678, 0x12345678); + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_BGRA_8888_PRE, + 0x56341278, 0x12345678); + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_ARGB_8888_PRE, + 0x78123456, 0x12345678); + test_write_bytes (test_ctx, COGL_PIXEL_FORMAT_ABGR_8888_PRE, + 0x78563412, 0x12345678); + + test_write_int (test_ctx, COGL_PIXEL_FORMAT_RGBA_1010102_PRE, + 0x123456ff, + 10, 0x12, 10, 0x34, 10, 0x56, 2, 0xff, + -1); + test_write_int (test_ctx, COGL_PIXEL_FORMAT_BGRA_1010102_PRE, + 0x123456ff, + 10, 0x56, 10, 0x34, 10, 0x12, 2, 0xff, + -1); + test_write_int (test_ctx, COGL_PIXEL_FORMAT_ARGB_2101010_PRE, + 0x123456ff, + 2, 0xff, 10, 0x12, 10, 0x34, 10, 0x56, + -1); + test_write_int (test_ctx, COGL_PIXEL_FORMAT_ABGR_2101010_PRE, + 0x123456ff, + 2, 0xff, 10, 0x56, 10, 0x34, 10, 0x12, + -1); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am new file mode 100644 index 0000000..3a2030a --- /dev/null +++ b/tests/data/Makefile.am @@ -0,0 +1,3 @@ +NULL = + +EXTRA_DIST = valgrind.suppressions diff --git a/tests/data/Makefile.in b/tests/data/Makefile.in new file mode 100644 index 0000000..d7d6cdb --- /dev/null +++ b/tests/data/Makefile.in @@ -0,0 +1,572 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tests/data +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +EXTRA_DIST = valgrind.suppressions +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/data/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/data/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/data/valgrind.suppressions b/tests/data/valgrind.suppressions new file mode 100644 index 0000000..f47498d --- /dev/null +++ b/tests/data/valgrind.suppressions @@ -0,0 +1,173 @@ +{ + ioctl_1 + Memcheck:Param + ioctl(generic) + fun:ioctl + fun:driDrawableInitVBlank + fun:intelMakeCurrent + fun:glXMakeContextCurrent +} + +{ + ioctl_2 + Memcheck:Param + ioctl(generic) + fun:ioctl + fun:driDrawableGetMSC32 + fun:clutter_backend_glx_redraw +} + +{ + ioctl_3 + Memcheck:Param + ioctl(generic) + fun:ioctl + fun:driWaitForMSC32 + fun:clutter_backend_glx_redraw +} + +{ + mesa_init_context + Memcheck:Leak + fun:*alloc + ... + fun:glXCreateNewContext +} + +{ + type_register + Memcheck:Leak + fun:*alloc + ... + fun:g_type_register_* +} + +{ + type_ref + Memcheck:Leak + fun:*alloc + ... + fun:g_type_class_ref +} + +{ + type_interface_prereq + Memcheck:Leak + fun:*alloc + ... + fun:g_type_interface_add_prerequisite +} + +{ + get_charset + Memcheck:Leak + fun:*alloc + ... + fun:g_get_charset +} + +{ + cogl_features + Memcheck:Leak + fun:*alloc + ... + fun:cogl_get_features +} + +{ + glx_query_version + Memcheck:Leak + fun:*alloc + ... + fun:glXQueryVersion +} + +{ + glx_create_context + Memcheck:Leak + fun:*alloc + ... + fun:glXCreateNewContext +} + +{ + glx_make_current + Memcheck:Leak + fun:*alloc + ... + fun:glXMakeContextCurrent +} + +{ + gl_draw_arrays + Memcheck:Leak + fun:*malloc + ... + fun:glDrawArrays +} + +{ + cogl_clear + Memcheck:Leak + fun:*alloc + ... + fun:cogl_clear +} + +{ + default_font + Memcheck:Leak + fun:*alloc + ... + fun:clutter_backend_get_font_name +} + +{ + id_pool + Memcheck:Leak + fun:*alloc + ... + fun:clutter_id_pool_new +} + +{ + x_open_display + Memcheck:Leak + fun:*alloc + ... + fun:XOpenDisplay +} + +# ... and font descriptions from every "sans 12" type string +{ + pango_font_description_from_string + Memcheck:Leak + fun:*alloc + ... + fun:pango_font_description_from_string +} + +# other lib init +{ + fontconfig_init + Memcheck:Leak + fun:*alloc + ... + fun:FcConfigParseAndLoad +} + +{ + freetype_init + Memcheck:Leak + fun:*alloc + ... + fun:FT_Open_Face +} + +{ + x_init_ext + Memcheck:Leak + fun:*alloc + ... + fun:XInitExtension +} diff --git a/tests/micro-perf/Makefile.am b/tests/micro-perf/Makefile.am new file mode 100644 index 0000000..5c5f69d --- /dev/null +++ b/tests/micro-perf/Makefile.am @@ -0,0 +1,28 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir) + +test_conformance_CPPFLAGS = \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" + + +noinst_PROGRAMS = + +if USE_GLIB +noinst_PROGRAMS += test-journal +endif + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) + +common_ldadd = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la \ + $(LIBM) + +test_journal_SOURCES = test-journal.c +test_journal_LDADD = $(common_ldadd) diff --git a/tests/micro-perf/Makefile.in b/tests/micro-perf/Makefile.in new file mode 100644 index 0000000..bca6284 --- /dev/null +++ b/tests/micro-perf/Makefile.in @@ -0,0 +1,756 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp +noinst_PROGRAMS = $(am__EXEEXT_1) +@USE_GLIB_TRUE@am__append_1 = test-journal +subdir = tests/micro-perf +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@USE_GLIB_TRUE@am__EXEEXT_1 = test-journal$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_test_journal_OBJECTS = test-journal.$(OBJEXT) +test_journal_OBJECTS = $(am_test_journal_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la $(am__DEPENDENCIES_1) +test_journal_DEPENDENCIES = $(am__DEPENDENCIES_2) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_journal_SOURCES) +DIST_SOURCES = $(test_journal_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +AM_CPPFLAGS = \ + -I$(top_srcdir) + +test_conformance_CPPFLAGS = \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +common_ldadd = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la \ + $(LIBM) + +test_journal_SOURCES = test-journal.c +test_journal_LDADD = $(common_ldadd) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/micro-perf/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/micro-perf/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test-journal$(EXEEXT): $(test_journal_OBJECTS) $(test_journal_DEPENDENCIES) $(EXTRA_test_journal_DEPENDENCIES) + @rm -f test-journal$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_journal_OBJECTS) $(test_journal_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-journal.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c new file mode 100644 index 0000000..35e3cd5 --- /dev/null +++ b/tests/micro-perf/test-journal.c @@ -0,0 +1,190 @@ +#include +#include +#include + +#include "cogl/cogl-profile.h" + +#define FRAMEBUFFER_WIDTH 800 +#define FRAMEBUFFER_HEIGHT 600 + +CoglBool run_all = FALSE; + +typedef struct _Data +{ + CoglContext *ctx; + CoglFramebuffer *fb; + CoglPipeline *pipeline; + CoglPipeline *alpha_pipeline; + GTimer *timer; + int frame; +} Data; + +static void +test_rectangles (Data *data) +{ +#define RECT_WIDTH 5 +#define RECT_HEIGHT 5 + int x; + int y; + + cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 1, 1, 1, 1); + + cogl_framebuffer_push_rectangle_clip (data->fb, + 10, + 10, + FRAMEBUFFER_WIDTH - 10, + FRAMEBUFFER_HEIGHT - 10); + + /* Should the rectangles be randomly positioned/colored/rotated? + * + * It could be good to develop equivalent GL and Cairo tests so we can + * have a sanity check for our Cogl performance. + * + * The color should vary to check that we correctly batch color changes + * The use of alpha should vary so we have a variation of which rectangles + * require blending. + * Should this be a random variation? + * It could be good to experiment with focibly enabling blending for + * rectangles that don't technically need it for the sake of extending + * batching. E.g. if you a long run of interleved rectangles with every + * other rectangle needing blending then it may be worth enabling blending + * for all the rectangles to avoid the state changes. + * The modelview should change between rectangles to check the software + * transform codepath. + * Should we group some rectangles under the same modelview? Potentially + * we could avoid software transform for long runs of rectangles with the + * same modelview. + * + */ + for (y = 0; y < FRAMEBUFFER_HEIGHT; y += RECT_HEIGHT) + { + for (x = 0; x < FRAMEBUFFER_WIDTH; x += RECT_WIDTH) + { + cogl_framebuffer_push_matrix (data->fb); + cogl_framebuffer_translate (data->fb, x, y, 0); + cogl_framebuffer_rotate (data->fb, 45, 0, 0, 1); + + cogl_pipeline_set_color4f (data->pipeline, + 1, + (1.0f/FRAMEBUFFER_WIDTH)*y, + (1.0f/FRAMEBUFFER_HEIGHT)*x, + 1); + cogl_framebuffer_draw_rectangle (data->fb, + data->pipeline, + 0, 0, RECT_WIDTH, RECT_HEIGHT); + + cogl_framebuffer_pop_matrix (data->fb); + } + } + + for (y = 0; y < FRAMEBUFFER_HEIGHT; y += RECT_HEIGHT) + { + for (x = 0; x < FRAMEBUFFER_WIDTH; x += RECT_WIDTH) + { + cogl_framebuffer_push_matrix (data->fb); + cogl_framebuffer_translate (data->fb, x, y, 0); + + cogl_pipeline_set_color4f (data->alpha_pipeline, + 1, + (1.0f/FRAMEBUFFER_WIDTH)*x, + (1.0f/FRAMEBUFFER_HEIGHT)*y, + (1.0f/FRAMEBUFFER_WIDTH)*x); + cogl_framebuffer_draw_rectangle (data->fb, + data->alpha_pipeline, + 0, 0, RECT_WIDTH, RECT_HEIGHT); + + cogl_framebuffer_pop_matrix (data->fb); + } + } + + cogl_framebuffer_pop_clip (data->fb); +} + +static CoglBool +paint_cb (void *user_data) +{ + Data *data = user_data; + double elapsed; + + data->frame++; + + test_rectangles (data); + + cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb)); + + elapsed = g_timer_elapsed (data->timer, NULL); + if (elapsed > 1.0) + { + g_print ("fps = %f\n", data->frame / elapsed); + g_timer_start (data->timer); + data->frame = 0; + } + + return FALSE; /* remove the callback */ +} + +static void +frame_event_cb (CoglOnscreen *onscreen, + CoglFrameEvent event, + CoglFrameInfo *info, + void *user_data) +{ + if (event == COGL_FRAME_EVENT_SYNC) + paint_cb (user_data); +} + +int +main (int argc, char **argv) +{ + Data data; + CoglOnscreen *onscreen; + GSource *cogl_source; + GMainLoop *loop; + COGL_STATIC_TIMER (mainloop_timer, + NULL, //no parent + "Mainloop", + "The time spent in the glib mainloop", + 0); // no application private data + + data.ctx = cogl_context_new (NULL, NULL); + + onscreen = cogl_onscreen_new (data.ctx, + FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT); + cogl_onscreen_set_swap_throttled (onscreen, FALSE); + cogl_onscreen_show (onscreen); + + data.fb = onscreen; + cogl_framebuffer_orthographic (data.fb, + 0, 0, + FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT, + -1, + 100); + + data.pipeline = cogl_pipeline_new (data.ctx); + cogl_pipeline_set_color4f (data.pipeline, 1, 1, 1, 1); + data.alpha_pipeline = cogl_pipeline_new (data.ctx); + cogl_pipeline_set_color4f (data.alpha_pipeline, 1, 1, 1, 0.5); + + cogl_source = cogl_glib_source_new (data.ctx, G_PRIORITY_DEFAULT); + + g_source_attach (cogl_source, NULL); + + cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data.fb), + frame_event_cb, + &data, + NULL); /* destroy notify */ + + g_idle_add (paint_cb, &data); + + data.frame = 0; + data.timer = g_timer_new (); + g_timer_start (data.timer); + + loop = g_main_loop_new (NULL, TRUE); + COGL_TIMER_START (uprof_get_mainloop_context (), mainloop_timer); + g_main_loop_run (loop); + COGL_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer); + + return 0; +} + diff --git a/tests/run-tests.sh b/tests/run-tests.sh new file mode 100755 index 0000000..7e62bf0 --- /dev/null +++ b/tests/run-tests.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +if test -z "$G_DEBUG"; then + G_DEBUG=fatal-warnings +else + G_DEBUG="$G_DEBUG,fatal-warnings" +fi + +export G_DEBUG + +ENVIRONMENT_CONFIG=$1 +shift + +TEST_BINARY=$1 +shift + +. $ENVIRONMENT_CONFIG + +set +m + +trap "" ERR +trap "" SIGABRT +trap "" SIGFPE +trap "" SIGSEGV + +EXIT=0 +MISSING_FEATURE="WARNING: Missing required feature"; +KNOWN_FAILURE="WARNING: Test is known to fail"; + +echo "Key:" +echo "ok = Test passed" +echo "n/a = Driver is missing a feature required for the test" +echo "FAIL = Unexpected failure" +echo "FIXME = Test failed, but it was an expected failure" +echo "PASS! = Unexpected pass" +echo "" + +get_status() +{ + case $1 in + # Special value we use to indicate that the test failed + # but it was an expected failure so don't fail the + # overall test run as a result... + 300) + echo -n "FIXME";; + # Special value we use to indicate that the test passed + # but we weren't expecting it to pass‽ + 400) + echo -n 'PASS!';; + + # Special value to indicate the test is missing a required feature + 500) + echo -n "n/a";; + + 0) + echo -n "ok";; + + *) + echo -n "FAIL";; + esac +} + +run_test() +{ + $($TEST_BINARY $1 &>.log) + TMP=$? + var_name=$2_result + eval $var_name=$TMP + if grep -q "$MISSING_FEATURE" .log; then + if test $TMP -ne 0; then + eval $var_name=500 + else + eval $var_name=400 + fi + elif grep -q "$KNOWN_FAILURE" .log; then + if test $TMP -ne 0; then + eval $var_name=300 + else + eval $var_name=400 + fi + else + if test $TMP -ne 0; then EXIT=$TMP; fi + fi +} + +TITLE_FORMAT="%35s" +printf $TITLE_FORMAT "Test" + +if test $HAVE_GL -eq 1; then + GL_FORMAT=" %6s %8s %7s %6s %6s" + printf "$GL_FORMAT" "GL+FF" "GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3" +fi +if test $HAVE_GLES2 -eq 1; then + GLES2_FORMAT=" %6s %7s" + printf "$GLES2_FORMAT" "ES2" "ES2-NPT" +fi + +echo "" +echo "" + +for test in `cat unit-tests` +do + export COGL_DEBUG= + + if test $HAVE_GL -eq 1; then + export COGL_DRIVER=gl + export COGL_DEBUG=disable-glsl,disable-arbfp + run_test $test gl_ff + + export COGL_DRIVER=gl + # NB: we can't explicitly disable fixed + glsl in this case since + # the arbfp code only supports fragment processing so we need either + # the fixed or glsl vertends + export COGL_DEBUG= + run_test $test gl_arbfp + + export COGL_DRIVER=gl + export COGL_DEBUG=disable-fixed,disable-arbfp + run_test $test gl_glsl + + export COGL_DRIVER=gl + export COGL_DEBUG=disable-npot-textures + run_test $test gl_npot + + export COGL_DRIVER=gl3 + export COGL_DEBUG= + run_test $test gl3 + fi + + if test $HAVE_GLES2 -eq 1; then + export COGL_DRIVER=gles2 + export COGL_DEBUG= + run_test $test gles2 + + export COGL_DRIVER=gles2 + export COGL_DEBUG=disable-npot-textures + run_test $test gles2_npot + fi + + printf $TITLE_FORMAT "$test:" + if test $HAVE_GL -eq 1; then + printf "$GL_FORMAT" \ + "`get_status $gl_ff_result`" \ + "`get_status $gl_arbfp_result`" \ + "`get_status $gl_glsl_result`" \ + "`get_status $gl_npot_result`" \ + "`get_status $gl3_result`" + fi + if test $HAVE_GLES2 -eq 1; then + printf "$GLES2_FORMAT" \ + "`get_status $gles2_result`" \ + "`get_status $gles2_npot_result`" + fi + echo "" +done + +exit $EXIT diff --git a/tests/test-launcher.sh b/tests/test-launcher.sh new file mode 100755 index 0000000..e159e2e --- /dev/null +++ b/tests/test-launcher.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +TEST_BINARY=$1 +shift + +SYMBOL_PREFIX=$1 +shift + +UNIT_TEST=$1 +shift + +test -z ${UNIT_TEST} && { + echo "Usage: $0 UNIT_TEST" + exit 1 +} + +BINARY_NAME=`basename $TEST_BINARY` +UNIT_TEST=`echo $UNIT_TEST|sed 's/-/_/g'` + +echo "Running: ./$BINARY_NAME ${UNIT_TEST} $@" +echo "" +COGL_TEST_VERBOSE=1 $TEST_BINARY ${UNIT_TEST} "$@" +exit_val=$? + +if test $exit_val -eq 0; then + echo "OK" +fi + +echo "" +echo "NOTE: For debugging purposes, you can run this single test as follows:" +echo "$ libtool --mode=execute \\" +echo " gdb --eval-command=\"start\" --eval-command=\"b ${UNIT_TEST#${SYMBOL_PREFIX}}\" \\" +echo " --args ./$BINARY_NAME ${UNIT_TEST}" +echo "or:" +echo "$ env G_SLICE=always-malloc \\" +echo " libtool --mode=execute \\" +echo " valgrind ./$BINARY_NAME ${UNIT_TEST}" + +exit $exit_val diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am new file mode 100644 index 0000000..88028b3 --- /dev/null +++ b/tests/unit/Makefile.am @@ -0,0 +1,96 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +noinst_PROGRAMS = test-unit + +test_unit_SOURCES = test-unit-main.c + +if OS_WIN32 +SHEXT = +else +SHEXT = $(EXEEXT) +endif + +# For convenience, this provides a way to easily run individual unit tests: +.PHONY: wrappers clean-wrappers + +wrappers: stamp-test-unit + @true +stamp-test-unit: Makefile test-unit$(EXEEXT) + @mkdir -p wrappers + source $(top_builddir)/cogl/libcogl.la ; \ + $(NM) $(top_builddir)/cogl/.libs/"$$dlname"| \ + grep '[DR] _\?unit_test_'|sed 's/.\+ [DR] _\?//' > unit-tests + @chmod +x $(top_srcdir)/tests/test-launcher.sh + @( echo "/stamp-test-unit" ; \ + echo "/test-unit$(EXEEXT)" ; \ + echo "*.o" ; \ + echo ".gitignore" ; \ + echo "unit-tests" ; ) > .gitignore + @for i in `cat unit-tests`; \ + do \ + unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ + echo " GEN $$unit"; \ + ( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/test-launcher.sh $(abs_builddir)/test-unit$(EXEEXT) 'unit_test_' '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \ + chmod +x $$unit$(SHEXT); \ + echo "/$$unit$(SHEXT)" >> .gitignore; \ + done \ + && echo timestamp > $(@F) + +clean-wrappers: + @for i in `cat unit-tests`; \ + do \ + unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ + echo " RM $$unit"; \ + rm -f $$unit$(SHEXT) ; \ + done \ + && rm -f unit-tests \ + && rm -f stamp-test-unit + +# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting +# a phony rule that will generate symlink scripts for running individual tests +BUILT_SOURCES = wrappers + +# The include of the $(buildir)/cogl directory here is to make it so +# that tests that directly include Cogl source code for whitebox +# testing (such as test-bitmask) will still compile +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/test-fixtures \ + -I$(top_builddir)/cogl + +if !USE_GLIB +AM_CPPFLAGS += -I$(top_builddir)/deps/glib +endif + +AM_CPPFLAGS += \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCOGL_COMPILATION + +test_unit_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_unit_LDADD = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la \ + $(LIBM) +if !USE_GLIB +test_unit_LDADD += $(top_builddir)/deps/glib/libglib.la +endif +test_unit_LDFLAGS = -export-dynamic + +test: wrappers + @$(top_srcdir)/tests/run-tests.sh $(abs_builddir)/../config.env $(abs_builddir)/test-unit$(EXEEXT) + +# XXX: we could prevent the unit test suite from running +# by simply defining this variable conditionally +TEST_PROGS = test-unit + +.PHONY: test + +DISTCLEANFILES = .gitignore + +# we override the clean-generic target to clean up the wrappers so +# we cannot use CLEANFILES +clean-generic: clean-wrappers + $(QUIET_RM)rm -f .log diff --git a/tests/unit/Makefile.in b/tests/unit/Makefile.in new file mode 100644 index 0000000..7e74eb3 --- /dev/null +++ b/tests/unit/Makefile.in @@ -0,0 +1,831 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# custom rules for quiet builds + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/build/autotools/Makefile.am.silent \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build/depcomp +noinst_PROGRAMS = test-unit$(EXEEXT) +@USE_GLIB_FALSE@am__append_1 = -I$(top_builddir)/deps/glib +@USE_GLIB_FALSE@am__append_2 = $(top_builddir)/deps/glib/libglib.la +subdir = tests/unit +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/build/autotools/acglib.m4 \ + $(top_srcdir)/build/autotools/as-compiler-flag.m4 \ + $(top_srcdir)/build/autotools/as-glibconfig.m4 \ + $(top_srcdir)/build/autotools/as-linguas.m4 \ + $(top_srcdir)/build/autotools/gettext.m4 \ + $(top_srcdir)/build/autotools/gtk-doc.m4 \ + $(top_srcdir)/build/autotools/iconv.m4 \ + $(top_srcdir)/build/autotools/intlmacosx.m4 \ + $(top_srcdir)/build/autotools/lib-ld.m4 \ + $(top_srcdir)/build/autotools/lib-link.m4 \ + $(top_srcdir)/build/autotools/lib-prefix.m4 \ + $(top_srcdir)/build/autotools/libtool.m4 \ + $(top_srcdir)/build/autotools/ltoptions.m4 \ + $(top_srcdir)/build/autotools/ltsugar.m4 \ + $(top_srcdir)/build/autotools/ltversion.m4 \ + $(top_srcdir)/build/autotools/lt~obsolete.m4 \ + $(top_srcdir)/build/autotools/nls.m4 \ + $(top_srcdir)/build/autotools/po.m4 \ + $(top_srcdir)/build/autotools/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_test_unit_OBJECTS = test_unit-test-unit-main.$(OBJEXT) +test_unit_OBJECTS = $(am_test_unit_OBJECTS) +am__DEPENDENCIES_1 = +test_unit_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la $(am__DEPENDENCIES_1) \ + $(am__append_2) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +test_unit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_unit_CFLAGS) \ + $(CFLAGS) $(test_unit_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_unit_SOURCES) +DIST_SOURCES = $(test_unit_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_REQ_VERSION = @CAIRO_REQ_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COGL_1_MICRO_VERSION = @COGL_1_MICRO_VERSION@ +COGL_1_MINOR_VERSION = @COGL_1_MINOR_VERSION@ +COGL_1_VERSION = @COGL_1_VERSION@ +COGL_API_VERSION = @COGL_API_VERSION@ +COGL_API_VERSION_AM = @COGL_API_VERSION_AM@ +COGL_DEBUG_CFLAGS = @COGL_DEBUG_CFLAGS@ +COGL_DEFAULT_DRIVER = @COGL_DEFAULT_DRIVER@ +COGL_DEP_CFLAGS = @COGL_DEP_CFLAGS@ +COGL_DEP_GL_CFLAGS = @COGL_DEP_GL_CFLAGS@ +COGL_DEP_GL_LIBS = @COGL_DEP_GL_LIBS@ +COGL_DEP_LIBS = @COGL_DEP_LIBS@ +COGL_EGL_INCLUDES = @COGL_EGL_INCLUDES@ +COGL_EXTRA_CFLAGS = @COGL_EXTRA_CFLAGS@ +COGL_EXTRA_LDFLAGS = @COGL_EXTRA_LDFLAGS@ +COGL_GLES1_LIBNAME = @COGL_GLES1_LIBNAME@ +COGL_GLES2_LIBNAME = @COGL_GLES2_LIBNAME@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +COGL_GST_DEP_CFLAGS = @COGL_GST_DEP_CFLAGS@ +COGL_GST_DEP_LIBS = @COGL_GST_DEP_LIBS@ +COGL_GST_PKG_REQUIRES = @COGL_GST_PKG_REQUIRES@ +COGL_LT_AGE = @COGL_LT_AGE@ +COGL_LT_CURRENT = @COGL_LT_CURRENT@ +COGL_LT_RELEASE = @COGL_LT_RELEASE@ +COGL_LT_REVISION = @COGL_LT_REVISION@ +COGL_MAJOR_VERSION = @COGL_MAJOR_VERSION@ +COGL_MICRO_VERSION = @COGL_MICRO_VERSION@ +COGL_MINOR_VERSION = @COGL_MINOR_VERSION@ +COGL_PANGO_DEP_CFLAGS = @COGL_PANGO_DEP_CFLAGS@ +COGL_PANGO_DEP_LIBS = @COGL_PANGO_DEP_LIBS@ +COGL_PANGO_PKG_REQUIRES = @COGL_PANGO_PKG_REQUIRES@ +COGL_PKG_REQUIRES = @COGL_PKG_REQUIRES@ +COGL_RELEASE_STATUS = @COGL_RELEASE_STATUS@ +COGL_VERSION = @COGL_VERSION@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMMY_CFLAGS = @DUMMY_CFLAGS@ +DUMMY_LIBS = @DUMMY_LIBS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKPIXBUF_PREFIX = @GDKPIXBUF_PREFIX@ +GDK_PIXBUF_REQ_VERSION = @GDK_PIXBUF_REQ_VERSION@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GI_REQ_VERSION = @GI_REQ_VERSION@ +GLIB_BINARY_AGE = @GLIB_BINARY_AGE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_DEBUG_FLAGS = @GLIB_DEBUG_FLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_INTERFACE_AGE = @GLIB_INTERFACE_AGE@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MAJOR_VERSION = @GLIB_MAJOR_VERSION@ +GLIB_MICRO_VERSION = @GLIB_MICRO_VERSION@ +GLIB_MINOR_VERSION = @GLIB_MINOR_VERSION@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_PREFIX = @GLIB_PREFIX@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GLIB_VERSION = @GLIB_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GSTREAMER_PREFIX = @GSTREAMER_PREFIX@ +GTHREAD_COMPILE_IMPL_DEFINES = @GTHREAD_COMPILE_IMPL_DEFINES@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_DOC_REQ_VERSION = @GTK_DOC_REQ_VERSION@ +G_MODULE_BROKEN_RTLD_GLOBAL = @G_MODULE_BROKEN_RTLD_GLOBAL@ +G_MODULE_HAVE_DLERROR = @G_MODULE_HAVE_DLERROR@ +G_MODULE_IMPL = @G_MODULE_IMPL@ +G_MODULE_LDFLAGS = @G_MODULE_LDFLAGS@ +G_MODULE_LIBS = @G_MODULE_LIBS@ +G_MODULE_LIBS_EXTRA = @G_MODULE_LIBS_EXTRA@ +G_MODULE_NEED_USCORE = @G_MODULE_NEED_USCORE@ +G_MODULE_PLUGIN_LIBS = @G_MODULE_PLUGIN_LIBS@ +G_MODULE_SUPPORTED = @G_MODULE_SUPPORTED@ +G_THREAD_CFLAGS = @G_THREAD_CFLAGS@ +G_THREAD_LIBS = @G_THREAD_LIBS@ +G_THREAD_LIBS_EXTRA = @G_THREAD_LIBS_EXTRA@ +G_THREAD_LIBS_FOR_GTHREAD = @G_THREAD_LIBS_FOR_GTHREAD@ +HAVE_GL = @HAVE_GL@ +HAVE_GLES1 = @HAVE_GLES1@ +HAVE_GLES2 = @HAVE_GLES2@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_EXE_MACHINE_FLAG = @LIB_EXE_MACHINE_FLAG@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOCAIRO_REQ_VERSION = @PANGOCAIRO_REQ_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL2_CFLAGS = @SDL2_CFLAGS@ +SDL2_LIBS = @SDL2_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WAYLAND_CLIENT_CFLAGS = @WAYLAND_CLIENT_CFLAGS@ +WAYLAND_CLIENT_LIBS = @WAYLAND_CLIENT_LIBS@ +WAYLAND_REQ_VERSION = @WAYLAND_REQ_VERSION@ +WAYLAND_SERVER_CFLAGS = @WAYLAND_SERVER_CFLAGS@ +WAYLAND_SERVER_LIBS = @WAYLAND_SERVER_LIBS@ +WAYLAND_SERVER_REQ_VERSION = @WAYLAND_SERVER_REQ_VERSION@ +XCOMPOSITE_REQ_VERSION = @XCOMPOSITE_REQ_VERSION@ +XFIXES_REQ_VERSION = @XFIXES_REQ_VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +QUIET_GEN = $(AM_V_GEN) +QUIET_LN = $(QUIET_LN_$(V)) +QUIET_LN_ = $(QUIET_LN_$(AM_DEFAULT_VERBOSITY)) +QUIET_LN_0 = @echo ' LN '$@; +QUIET_RM = $(QUIET_RM_$(V)) +QUIET_RM_ = $(QUIET_RM_$(AM_DEFAULT_VERBOSITY)) +QUIET_RM_0 = @echo ' RM '$@; +QUIET_SCAN = $(QUIET_SCAN_$(V)) +QUIET_SCAN_ = $(QUIET_SCAN_$(AM_DEFAULT_VERBOSITY)) +QUIET_SCAN_0 = @echo ' GISCAN '$@; +QUIET_COMP = $(QUIET_COMP_$(V)) +QUIET_COMP_ = $(QUIET_COMP_$(AM_DEFAULT_VERBOSITY)) +QUIET_COMP_0 = @echo ' GICOMP '$@; +NULL = +test_unit_SOURCES = test-unit-main.c +@OS_WIN32_FALSE@SHEXT = $(EXEEXT) +@OS_WIN32_TRUE@SHEXT = + +# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting +# a phony rule that will generate symlink scripts for running individual tests +BUILT_SOURCES = wrappers + +# The include of the $(buildir)/cogl directory here is to make it so +# that tests that directly include Cogl source code for whitebox +# testing (such as test-bitmask) will still compile +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/test-fixtures \ + -I$(top_builddir)/cogl $(am__append_1) \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCOGL_COMPILATION +test_unit_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_unit_LDADD = $(COGL_DEP_LIBS) $(top_builddir)/cogl/libcogl.la \ + $(LIBM) $(am__append_2) +test_unit_LDFLAGS = -export-dynamic + +# XXX: we could prevent the unit test suite from running +# by simply defining this variable conditionally +TEST_PROGS = test-unit +DISTCLEANFILES = .gitignore +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/autotools/Makefile.am.silent $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/unit/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/unit/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/build/autotools/Makefile.am.silent: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test-unit$(EXEEXT): $(test_unit_OBJECTS) $(test_unit_DEPENDENCIES) $(EXTRA_test_unit_DEPENDENCIES) + @rm -f test-unit$(EXEEXT) + $(AM_V_CCLD)$(test_unit_LINK) $(test_unit_OBJECTS) $(test_unit_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_unit-test-unit-main.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test_unit-test-unit-main.o: test-unit-main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_unit_CFLAGS) $(CFLAGS) -MT test_unit-test-unit-main.o -MD -MP -MF $(DEPDIR)/test_unit-test-unit-main.Tpo -c -o test_unit-test-unit-main.o `test -f 'test-unit-main.c' || echo '$(srcdir)/'`test-unit-main.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_unit-test-unit-main.Tpo $(DEPDIR)/test_unit-test-unit-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-unit-main.c' object='test_unit-test-unit-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_unit_CFLAGS) $(CFLAGS) -c -o test_unit-test-unit-main.o `test -f 'test-unit-main.c' || echo '$(srcdir)/'`test-unit-main.c + +test_unit-test-unit-main.obj: test-unit-main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_unit_CFLAGS) $(CFLAGS) -MT test_unit-test-unit-main.obj -MD -MP -MF $(DEPDIR)/test_unit-test-unit-main.Tpo -c -o test_unit-test-unit-main.obj `if test -f 'test-unit-main.c'; then $(CYGPATH_W) 'test-unit-main.c'; else $(CYGPATH_W) '$(srcdir)/test-unit-main.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_unit-test-unit-main.Tpo $(DEPDIR)/test_unit-test-unit-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-unit-main.c' object='test_unit-test-unit-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_unit_CFLAGS) $(CFLAGS) -c -o test_unit-test-unit-main.obj `if test -f 'test-unit-main.c'; then $(CYGPATH_W) 'test-unit-main.c'; else $(CYGPATH_W) '$(srcdir)/test-unit-main.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# For convenience, this provides a way to easily run individual unit tests: +.PHONY: wrappers clean-wrappers + +wrappers: stamp-test-unit + @true +stamp-test-unit: Makefile test-unit$(EXEEXT) + @mkdir -p wrappers + source $(top_builddir)/cogl/libcogl.la ; \ + $(NM) $(top_builddir)/cogl/.libs/"$$dlname"| \ + grep '[DR] _\?unit_test_'|sed 's/.\+ [DR] _\?//' > unit-tests + @chmod +x $(top_srcdir)/tests/test-launcher.sh + @( echo "/stamp-test-unit" ; \ + echo "/test-unit$(EXEEXT)" ; \ + echo "*.o" ; \ + echo ".gitignore" ; \ + echo "unit-tests" ; ) > .gitignore + @for i in `cat unit-tests`; \ + do \ + unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ + echo " GEN $$unit"; \ + ( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/test-launcher.sh $(abs_builddir)/test-unit$(EXEEXT) 'unit_test_' '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \ + chmod +x $$unit$(SHEXT); \ + echo "/$$unit$(SHEXT)" >> .gitignore; \ + done \ + && echo timestamp > $(@F) + +clean-wrappers: + @for i in `cat unit-tests`; \ + do \ + unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ + echo " RM $$unit"; \ + rm -f $$unit$(SHEXT) ; \ + done \ + && rm -f unit-tests \ + && rm -f stamp-test-unit + +test: wrappers + @$(top_srcdir)/tests/run-tests.sh $(abs_builddir)/../config.env $(abs_builddir)/test-unit$(EXEEXT) + +.PHONY: test + +# we override the clean-generic target to clean up the wrappers so +# we cannot use CLEANFILES +clean-generic: clean-wrappers + $(QUIET_RM)rm -f .log + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/unit/test-unit-main.c b/tests/unit/test-unit-main.c new file mode 100644 index 0000000..b1f7864 --- /dev/null +++ b/tests/unit/test-unit-main.c @@ -0,0 +1,45 @@ +#include + +#include + +#include +#include + +int +main (int argc, char **argv) +{ + GModule *main_module; + const CoglUnitTest *unit_test; + int i; + + if (argc != 2) + { + g_printerr ("usage %s UNIT_TEST\n", argv[0]); + exit (1); + } + + /* Just for convenience in case people try passing the wrapper + * filenames for the UNIT_TEST argument we normalize '-' characters + * to '_' characters... */ + for (i = 0; argv[1][i]; i++) + { + if (argv[1][i] == '-') + argv[1][i] = '_'; + } + + main_module = g_module_open (NULL, /* use main module */ + 0 /* flags */); + + if (!g_module_symbol (main_module, argv[1], (void **) &unit_test)) + { + g_printerr ("Unknown test name \"%s\"\n", argv[1]); + return 1; + } + + test_utils_init (unit_test->requirement_flags, + unit_test->known_failure_flags); + unit_test->run (); + test_utils_fini (); + + return 0; +} -- 2.30.2

jQpiI$hoEFsb==W8pGL87(vjq%?Vmy|t!?yWWj7efz$|++jL3bG)VMZ98rV zEHdLd8wOr1{K6@_!TI5gSz9xffyqym1Y70iiz>vvd|^tGUxy+he(MqlU(ca%h|kuc z`f^AxGn|qdVI0}SW+wDQtkfk}vXBQuk`=!PZffs(f|8gF`3#1}+_;;Q?tCW4M}FG@ zY1&NlgBXFHR*_pC69HE&+OsoO4tcgB#Ai^`!XgZVpGF1VFU%-+W%g9n<|%Xi=8gSU zg%V}s7++Bys0QRTGNvh0KO}E9ni5XM`u_u8P0fKV>E<(@cGOR9#H!MHA()Ck-p)H1o1=aso+ad&ciWsBBk;md?rj~O0Pj~6G!T2!iw zA)%I!nsFMt&TOR_I2keIJ#=hR-ODjs#+Bj}@qblK!eve%HRY@E-d&rL-M5q5u>det z^lJNE#m$+Efj;{&*_TQDxYMTO=2a13Vx4Kb$U@C1s=(YXR-BGwnylPRxaZ5Exm?%- zC4|`FCbZ1WEoP=F7R|?IMspkguDfa*0P_lePj$#IDD)y`GiJrMIB)2vA{$>HEQIm< z!WDtf)MH%1vtSbtn?lURWYYaImky(-1EC?us!TUsM3BIms27F4tJkWvVXTtW12z-e zp<3xu<=Q5j4N+ce_!z=dKbfZ7ikCqzlmWsuEL@l5^nP-OEE*_%^NwP^YEyR0{lmMY zm%KX&89+l;BwWCHaj=>ec|Dni`C0zf;hQ5<;swgJ!1FYL6aZBeh7??RBrq}NX(ucbjq z4~k;yNNehlE6U_%k!u^)yEf{*6hnO*$4}D!BJaPCKREUODlj-cCI!d;9se znO4b82(zOmFiez0EUb>&*7)Gsic#HaF?myXEeBWuJAw({$=>o;IgWZ*OfL-#kUX zU8L+m(X533d9iJ-{rMN{%$r?X6qbJ{*6h{AB-ggroF9>$T>jj$&PF!t5A*r6Ou!}? zlJxeSoo|~RTWSMx-dD>yrFPoqTwTs=I>~COx9-1fT)nY(ZSTt3a$Eh)jY~QDXNYuv zfo?MQ$wg{?c1|^?fDjk%>_6W-yY3gL$R6rSM)HGS+ve=RR~tXmyBhPPblT040Ct(J z{+W%Nsj5-$c?wUtZL&ppEiarpXX3vXp3ck%E|{%n&TS-D-PBjL(H>|y%SoFPB6MVD zEvvmXlX_Ws=ij<(YU`O_)=PLj&nwF`O-OVGU&Dq)ojDq9I>P9lPJ|^+@OBnY6+I?k zDg>A%ip}soLOi>ET~@Zp==ZX`$G#xzv=w$abF|YuV2i4Gj9c2GTC!}If)hd0M^dgj zv8h=1iTio2O{I&6k7|jG3B`BnMwT^co8@!6q~;XPFRMBzy;Of_L%}G~PhZW*)+3i% z;_@CoF>c~3$#M}fu)37&9!5AVaHjFLZC}`|vOZ;@navhCA_uC;WI>(g=<%Se247GK zrFT#{N8(oXcJi1JDpzt|2{xM{Dm#zLa+HY*tPd-3uP4WJ+sFv;*BsfXjb=NIo7CA% zCrCMlV@uERUy5=|*IBGNz_f!_9E$#An2sAuM;;A^>*@P?X7+XM$jnZanZ9#sgKCG4 zEsUR&d`Pe2X0Smx>U6anv;VSU;A-{(I|uZTvq!R=Csyo0mTqj>u~B>ASo++e@G49= z#LV&_e~G6oR+$kSSvd80tXwyoT`k&d=#Q2$Zr$TJ`7i81!>Q`9eZ!um6*5X2Y~qW0 zdt zBYe-Ut~mh>NHp2Hn@&GEMWRJ(Dq_E|1D_sVIqW5mYUmz=JDw!BKe#xv=MEVr8&rmXmU0exXNAw*dhj>s#2qhImv2 zPxuLm9ch@UR)(KZoePFnOA;^Xusv9XEEz>(MWu9pBU6-OIF6<&OQiH5P#)8hEBuKN zUU@dk3!g7f1co-nqRVT(59FX(&?d~XYA)GY)sRqn_7kcowxYzW<4uK`-Gf(%c_nNz zQ^lspKB&q{VoZVp(e*R-m^$+jJ*rGEaxk-oU#)7@p)1No%+~a6y)auh1o;93J7+ay zEoAY?Mow&ORNiwy2I?^#ZRONrSY z2nmEHq&od(&F+fG+KUm@X-w9WbfkK#ZAy3Gm9RbX9Xq05*qKCg%#tRTqWw}q+s?li zEzx+E0GRj?<|9|)VEixUbVqa)h$PR<|6#c!Myyg-Jao!vF^_h1>I{3q!l)*=8$CuY zWVg4IOmm?SWr`;XFMK?m62AP-WDATHa}3EjW~mTL^!MiGovViuLDt!JGg~aW%F;7p zd9_ojNU%$Ov(isU6#I2JhHXBKCnJ)}@I4x}+h?*UyIz}}VE^RD@>$#{5nvTl2L-&c zR2@QYwIy!SnEVqOVyWmULSgSL@0%SMOENmqw#4$_W~%h7eMl@$F%Q~)yMb*dZ|Xjo Jh+jl(^1ro>wz~iT literal 0 HcmV?d00001 diff --git a/po/eu.po b/po/eu.po new file mode 100644 index 0000000..e26fe5e --- /dev/null +++ b/po/eu.po @@ -0,0 +1,369 @@ +# translation of cogl.po.master.po to Basque +# Basque translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Iñaki Larrañaga Murgoitio , 2011, 2013. +msgid "" +msgstr "" +"Project-Id-Version: cogl.po.master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-04-03 23:10+0200\n" +"Last-Translator: Iñaki Larrañaga Murgoitio \n" +"Language-Team: Basque \n" +"Language: eu\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Arazketaren onartutako balioak:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Arazketaren balio bereziak:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Egitekorik ez duten arazketaren aukera guztiak gaitzen ditu" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Inguruneko aldagai gehigarriak:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"GL hedapenen komaz bereiztutako zerrenda desgaituta daudela itxura egiteko" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Gainidatzi GL bertsioa kontrolatzaileak onartzen duela Cogl-ek uste izateko" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl-en arazketaren banderak ezartzeko" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl arazketarako banderak kentzeko" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl-en aukerak" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Erakutsi Cogl-en aukerak" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl-en aztarnen jarraipena" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject-en erreferentziak" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects-en erreferentziak zenbatzeko arazoen arazketa" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Testura zatitzailearen aztarna" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Araztu testura zatien sorrera" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Atlas testuren aztarna" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Araztu atlas testuraren kudeaketa" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Nahasketaren kateen aztarna" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Araztu CoglBlendString analisia" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Egunkariaren aztarna" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Ikusi egunkaritik zehar doan geometria guztia" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Batch tratamenduaren aztarna" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Erakutsi geometria nola lantzen den batch bidez egunkarian" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Matrizeen aztarna" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Matrizeen manipulazio guztiaren aztarnak jarraitu" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Hainbat marrazkiren aztarna" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Marrazketaren eragiketa desberdin batzuen aztarnak jarraitu" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango errendatzailearen aztarna" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl-en Pango errendatzailearen aztarnak jarraitu" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap motorraren aztarna" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl-en testuren pixmapen motorraren aztarnak jarraitu" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Bistaratu" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Ingerada laukizuzenei" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Gehitu harizko ingeradak laukizuzen motako geometria guztiei" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Erakutsi burdin-haria" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Gehitu harizko ingeradak geometria guztiei" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Kausa nagusia" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desgaitu egunkarian batch-ean lantzea" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desgaitu geometriaren batch prozesua Cogl-ren egunkarian." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desgaitu GL Vertex bufferrak" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desgaitu OpenGL vertex-en bufferreko objektuak erabiltzea" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desgaitu GL Pixel bufferrak" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desgaitu OpenGL pixelen bufferreko objektuak erabiltzea" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desgaitu laukizuzena software bidez eraldatzea" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Erabili PUGa laukizuzenen geometria eraldatzeko" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl-en aditua" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Irauli atlas irudiak" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Irauli atlas testuren aldaketak irudi-fitxategi batera" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desgaitu atlas testurak" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desgaitu atlas testurak erabiltzea" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desgaitu atlas testurak testu eta irudien artean partekatzea" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Hau ezartzen denean, glifoen cachea beti erabiliko du bereiztutako testura " +"bat bere atlas-arentzako. Bestela, atlas-a irudiekin partekatzen saiatuko da." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desgaitu testurak" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desgaitu testurak edozein primitibotan" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desgaitu arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desgaitu ARB zatien programak erabiltzea" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desgaitu finkatua" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desgaitu finkatutako funtzioaren kanalizazioaren motorra erabiltzea" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desgaitu GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desgaitu GLSL erabiltzea" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desgaitu nahastea" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desgaitu nahasketa erabiltzea" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desgaitu biren berredurarik gabeko testurak" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"GL kontrolatzaileak NPOT testurak ez dituela onartzen sineztarazten dio Cogl-" +"eri, eta ondorioz, zatitutako testurak edo zaborrak dituzten testurak " +"sortuko ditu." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desgaitu software bidez moztea" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Desgaitu Cogl-eren saiakerak laukizuzen batzuk software bidez mozteko" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Erakutsi iturburua" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Erakutsi sortutako ARBfp/GLSL iturburuaren kodea" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "OpenGL batzuen aztarna" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Hautatutako OpenGL dei batzuen aztarnak jarraitu" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Pantailaz kanpoko euskarriaren aztarna" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Araztu pantailaz kanpoko euskarria" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desgaitu programaren cacheak" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desgaitu arbfp eta glsl programen modu seguruaren cacheak" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desgaitu pixel irakurketa optimizatzea" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desgaitu optimizazioa laukizuzen opakoren eszena bakunen 1px irakurtzeko" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Mozketaren aztarna" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Cogl-ek mozketa nola lantzen duen buruzko informazioa erregistratzen du" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Errendimenduaren arazoen aztarnak" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Cogl-ren erabilera azpi-optimoa nabarmentzen saiatzen da" diff --git a/po/fa.gmo b/po/fa.gmo new file mode 100644 index 0000000000000000000000000000000000000000..ea7de7eb65c6936d9d0943f96a7eb29a6b7ee99f GIT binary patch literal 930 zcmbu6&ubGw6vtPs2*Hb9{lU9=sFUnAq1M%^X_`VHF(FAs@F3I8WU{i^3A3}+_T-^W zE99#GLTD+5h8{eKe}l)_6g>1V@r}_&4|;Ln!<(7+-uHcH_uKWk_ZF_p$W3Gwxq<|U zS^LOUh3~E0SEWtTT+J|MSJEMuPDLo^M~WtUDODF=E;In!}x$iDee1 zEUO@R0M(xIMHo#FEw&MJ?uQ)O0p$@W0TEMw&BdX~Hag-p{Lm6VwQ5qlVxA(U7J0^G zg!(RcW>}X-ipf-+^@LQU5^=vpR$?BJrf{L7RL{+1(80DJ1T@V<(Pe2Nd4`49^%4_l zkNb~%QnX@EEqg(%j9RVQBn8Q+c?Vggin*|0J2_(CBX$m)oSV(f+m3BxA*r)X-}sr; zImEtC>_u=KcVThf&SvdY8C{a5q+t|LC8P^^Nuv%_L>$pgA0Bq6n>01oPk5L5LE01D zN7xwhm~uv%jCNh9nYYvM{Mv<7rBo@-zKN5zQw4#K3vu374~;AKMrC>d^}`3?b*RMe zyS(09BTKV7iMU4q0}hn zE2RR|i?#KYGH$ACGns~nrN;_W4=%*2jV7$gNRLkkNk7>;dpk(>^zd{5lY?Y`GD>!= z R=kXufXwEp$C-BdQd, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-06 11:26+0330\n" +"Last-Translator: Arash Mousavi \n" +"Language-Team: Persian\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Persian\n" +"X-Poedit-Country: IRAN, ISLAMIC REPUBLIC OF\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "پرچم‌های اشکال‌زدایی کوگل جهت تنظیم" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "پرچم‌های اشکال‌زدایی کوگل جهت خارج کردن از تنظیم" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "گزینه‌های کوگل" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "نمایش گزینه‌های کوگل" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000000000000000000000000000000000000..39f672186041ba0277d1e61c767b32345121f772 GIT binary patch literal 8559 zcmbW6TZ|odeaD9oAXx~sP+Vvs{X+?x)IRIo*brxliP!eVIIOddcVk-h0nMH>=bVY> z%uMF8mk0qu;v&jJLz)L@B_h$NY!o7;5<(y(Bo-bbf#886URtH7t@>7pyzqj==llQv zXU-gZYtfE8=esli+wXoE|Jz${eJ0>~l>1%W|9DFfOu%EW{&*9XCS!G8xAz+2xC z1n&V)fNugH1K$E}`R4-sQ=UHsz8m~|@a^Dtz|-JQ{rfv^3xYr9`6ze~cn-W1oPh5D zzXZM$d=At(-}mo-4Bo->e}YTktKc7icij$6;0HmCKMsn{UGSseSHUCTe}R7n{uaC+ zeD|C?=VPGWKLP6er@%i1p9c;2J@9?tzk+WAZ+T-7`~`RfJPNLW;%5SCpU;B#g3p2C z`68RGI$2m`e(trz<&nC|1Uwd4(8tM z^l$`}yx$Lso(I4`0yjba1u;LOe-{*;Ujo@8cmdS8-vu@QC!qHE6(~La2IOCG1Z4~F z0=551@K3-sQ1p#J*~=cNb^id0-tU4s?-fvTlhS&?QBZvR6^KfLzX2tOXF$pOPBwk& zHP{EJdH({D4}x!i39Y{XBC?kWNGks;QPVnK%M_%Q1t#9`~)}$lN$d#I1j!E zUI2gL-`@%ITDJ;n-ZfDBei=LlejU_#KLbAk{tA@69>vI{w^dN`{5-e-eii&{@MZAN z!Mh+v?=ONM1$RNo=ZD~Z;D3N01mA@*N)8*K>|__z`Lj+|J==z>A>h{UZ1f z_!4*?{0(>oJdLvCpMMK#`~`3od=*>+?`QDK;O9U{2;NChcm!Mm#s8;4jtrgxWxvmZ z=fIzX;`bdWUGh8%$__TbyTNS`5`wRRObx!{@fV=xy$VX6M+gF%cQ=SggR`Ik{}R-B zd!Xih9YmGEw?OIXWsm;@BI4lf2vc%62I{;GP;}&={O>E^S@1{TCGa-m?CUBhfBORX zP4H<@cDC}KAb1VaQSKFP*s*c|tX%E|-=qhB z;imSIY-K01Azku)UAT$8?%?+W+_H(=xe;gZdT!Z_?BF(TU9u7R{WAAG+{d}^=hh{A z)Fr>T#r}nVgVL{bq)RcbxgO*X=}dkj8^LsfTe%nQU?MFInG6{QSl!rxFMFXP~O*S+a)=acpMQJILbUT4_mKmbI6(c5`%=er5$F zHOGck5|(BXrr{`(1cURA4iS4f-i;D-wjRP6>!t%&qk{E^jBKp6(;m+1LfY91tNz$h z?$?LK)-Z3UHN%omV+$ruO*M|J42<7rVY)(6>25g0j<&-7HPa9KPG-Dxrt>rGXc9je%9^b07Evf7%u>EnCxZcSYBZh)h!zVOrvtllIJ+bGi%Nz@cxTU=M*Kt}5Q{P*In- z|In;lIctVRII`|~gI@fk3u_%q^6%F3D8(q9gtn|vn#}s%l+)R%+s;gHJ{O;xH7CEv z|H^tZjvA~LnPHvwtzG1C9x1wE^Zje=+K92VmONkLY*jSLE9?8xg((Ss9TSn^H!8v4 z>j@@o{j*W1-pmkY`eQ;P7DqG*Q)A~rRuToPsf~j+$jZLAqH(w#i;Zg; z;Vw?4cxT_?7Gc_qvmNJwF{3hWX-o##TG6HO8YkO0TjAo@FwGDvLNMrQP@w(746>+9 z=c^`8nMW?KZ#FEHFzeRD73qO&KujZInlg#|#7)mB?o>?w-ifQR*$GRg#VNnxU?Es{ zS*0V%V4cH@cz~-oa(GnOb;ntf?SUaN5*28YC)fwnGPsgul{pup?qH*pMI$r&W`wW1 z2#-+@^W(BwSgMOYu9gk_I<1{Xw$f}x5~7WJ@aRL`<1SjdliU{WZ)Hu~Wr8F5^yRg; z9VSHgXPPOJkY7a>n1p$2({7EA z%6`L3aoIQLi*QE)!A-b~S!U)6JChX)|I+VhHqh^Ms>%Q?uZVY*hvJ+>FT?a}T5EIr z+KEcC?(xP%=-%g1VeOfGj4JpoC<5G&^*I+zx^E`pVc>YcHKbUjX+K2B%Vg*jOoLEboW( z$T{{X*~`Z+b2*Op6H5YszP$XYh{E-szyE#B8#JZY9rE}uAgba82Mk%_%4(RQrRGo5!YlX@o> z&C;pmML%y1Dtp*xT4MZJu}tkn{EEy+q7(@|klQB|QtaJ#;>=z+&a#DJ@!`2O)y3FF zZ!-!f%jUu(>z7u|Ln=ejDzD4~mZM>D219`Zu{K?`Z00UqytFzM*wVt{+_?0hWyiRs=Yz z{+O)_-W)uO+BG~n*v}>h`*?r!e_zotdUg%2HpRag%=@MwwOPw%pX6X)8O)ylgJ+k6 zb(j9EcM)3;_I+>Q99@2Y@K1;q2HX_lTONh=u3iid_P4T;My+qc4R3~V8W+LMr-f-+ zC&a@mOh4Fn{es=YRp-GPtpeN6Blf0GAeWX0`#9FYK7s?SNb@XCtFlMuLt~`($k*@( zHD{vdI5ESJEIt&!C}5({6B{>(yu%n-i0U$=c-hw8!FkISMQbuoKalLOf<|9O_3C~ey64E++jx!qeLXkzj^B5EVk+4V^OyDQ1bll5_8A6S>)N&!XO5^0h zi>tvzh4%J9?gh2^nL#QFdD`EZU>3UoK*}7`* z5Fy?0k)ec4GP;$WKH=c-c}#@2Z7tos?+_I)9OZ3*u+6QFvrp9XWZ=GXHp1(~5E2K) znPn!cXNSV=sBhVTee_wOh*euRd0kAE7F2mWzIT@gH+{&*;344koqKJD@k;c<`c992DA8YC70By2QKb`gGTEccwIT zMTZcKiXM&)^_9hUsUi{APKl7VP3`O;lOhJVlB+dGH^BuCXUg3M+*0fN?RKlFyL5<| zZOW~>ZdMp}R?e1%ovyuQNd+x;={sgmvV1B-o4!kzT%AN_1ah4`G|O7CB|w8d$oh7D z#!)*HTN1*Y4}1+Js>)T*P>!Z5l~$>RVjFddF!D=G@?d|PP^t=PHos!bWz*iy^TKsg?Jj)tplzSlt-kpu zVgzdx@;b85f0-CLt8WvI*@&qR?GiY3Bi{o+WgW#C3I!P}rsLBhMApPi?>Ey<#_>`T znfX-((Z`Pd|d{+zS3zUW%G&PeA~HTp9I~e(t$7=Z=sNVJQ2a~03h6A AVE_OC literal 0 HcmV?d00001 diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..c89ec67 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,375 @@ +# French translation for cogl. +# Copyright (C) 2011-12 Listed translators +# This file is distributed under the same license as the cogl package. +# Claude Paroz , 2011 +# Andre Matuch , 2012 +# Bruno Brouard , 2012 +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-04-30 18:04+0100\n" +"Last-Translator: Pierre Henry \n" +"Language-Team: GNOME French team \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valeurs de débogage prises en charge :" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valeurs de débogage spéciales :" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Active toutes les options de débogage non-associées au comportement" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variables d'environnement supplémentaires :" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Liste d'extensions GL séparées par des points-virgules pour lesquelles il " +"faut faire comme si elles étaient désactivées" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Passer outre la version de GL que Cogl supposera que le pilote prend en " +"charge" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Drapeaux de débogage Cogl à définir" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Drapeaux de débogage Cogl à annuler" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Options Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Affiche les options Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Traçage de Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Références CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Débogue les problèmes de comptage de référence pour les CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Tracer le découpage des texture" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Débogue la création des tranches de texture" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Tracer les textures atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Débogue la gestion des textures atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Tracer les chaînes de Blend" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Débogue l'analyse des CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Tracer le journal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Affiche toute la géométrie transmise au journal" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Tracer le traitement par lot" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Affiche comment la géométrie est traitée par lot dans le journal" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Tracer les matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Trace toutes les manipulations de matrice" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Tracer les dessins divers" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Trace des opérations de dessin divers" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Tracer le rendu Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace le rendu Pango de Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Tracer le moteur CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace le moteur pixmap des textures Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualiser" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Entourer les rectangles" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Ajoute des contours filaires à toute géométrie rectangulaire" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Afficher les structures en mode filaire" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Ajoute des contours filaires à toute géométrie" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Cause principale" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Désactiver le traitement par lot du journal" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Désactive le traitement par lot de la géométrie dans le journal Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Désactiver les buffers des sommets GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Désactive l'utilisation des objets du buffer des sommets OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Désactiver les buffers des pixels GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Désactive l'utilisation des objets du buffer des pixels OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Désactiver la transformation rectangulaire du logiciel" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" +"Utilise le processeur graphique pour transformer la géométrie rectangulaire" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Spécialiste Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Vider les images de l'atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Vide les modifications de l'atlas des textures dans un fichier d'image" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Désactiver l'enregistrement dans l'atlas des textures" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Désactive l'utilisation de l'enregistrement dans l'atlas des textures" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Désactiver le partage de l'atlas des textures entre le texte et les images" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Lorsque ceci est activé, la cache des glyphes tentera toujours d'utiliser " +"une texture séparée pour son atlas. Autrement, elle tentera de partager " +"l'atlas avec les images." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Désactiver l'utilisation de texture" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Désactive l'utilisation de texture pour toute primitive" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Désactiver arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Désactive l'utilisation de programmes fragmentés ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Désactiver fixés" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Désactive l'utilisation du moteur de pipeline de la fonction fixée" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Désactiver GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Désactive l'utilisation de GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Désactiver les mélanges" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Désactive l'utilisation des mélanges" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Désactiver les textures non-puissance de deux" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fait penser à Cogl que le pilote GL ne supporte pas les textures NPOT pour " +"qu'il crée des textures tranchées ou des textures avec les déchets." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Désactiver la coupure logiciel" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Empêche toute tentative de Cogl de couper certains rectangles dans les " +"logiciels." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Afficher la source" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Affiche le code source ARBfp/GLSL produit" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Tracer quelques OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Trace quelques appels OpenGL sélectionnés" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Tracer la prise en charge hors-écran" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Débogue la prise en charge hors-écran" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Désactiver les caches de programme" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Désactive les caches d'urgence pour les programmes arbfp et glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Désactiver l'optimisation de lecture de pixel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Désactive l'optimisation de la lecture d'un pixel de scènes simples de " +"rectangles opaques" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Tracer la coupure" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Enregistre les informations sur la façon dont Cogl met en œuvre la coupure" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Tracer les problèmes de performances" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Essaie de mettre en évidence l'utilisation sous-optimale de Cogl." diff --git a/po/gl.gmo b/po/gl.gmo new file mode 100644 index 0000000000000000000000000000000000000000..39fba42311c2b53320f9b9fcd8fd3dd5066eb358 GIT binary patch literal 8374 zcmb7}ON=GgS;s5JhA@dq2w}p@;TYrC&iM9pkH_}-dd8loCr*0OlbQD9At7|`y>;&` zPu;3YRo(8MSp*3QOh^_4$(tmLSW1wH;)viy6a!+>2sWTZz#%)cPmEUjjEl$u|SVms_CbeG!zruY=m}d!X#5LmL3cKF0KY~N>9+cL;XTb-+IN+y2M2}tt9|r#d)V|*bp9OyivPASGBzp$j1Z9`cfKPyb z1bz&B1Jt@tV7%ktC%}u~?}M_>x53B2{|wI$Kt`rS7r;lsPk@^D63D;koBTKpeg}LK zycZ?qf0sb%XF8EG8a)0Tj>P0JZ+V z^F#c-hoEr^JPu-lXbx)MPl5M?Uk>=!p!WR%sQGV!9K!oR>Gc#Sdrm=(+YR6U0MvS4 z1I3%a2gTDL1$-w#Lw@!EsQqq$s2J^m;>#a`(&Mi{>G1iKsAehZYp z{Rj9t@Q0w}`?Nu3@E&gMFI%4Bewy2Gi$ncO9O4KaM`fRr+?Tmg-(6bsecYJYUC;3I z1KiNuoxfggaet6o=c-G3^)KlsS;dd5;ltU0sM%gm@SAM=JoiVqWrzE@p#JLiCgg{Iyae^-K307 zzO2(Eiz_qDOJmd2%;J0z*X6A{3@PJrZL`@jwdKn2q)zh8rY6pIk}}U0aaNlhTPAjt z#?>&okk3-HRcKJ<2W`-$^1jUT;FVmeK22^I-QZN z$8#rnm~YF`v}lJlpJkth3ns}-J&&CYOju{Fn<1<87o5VQksaSOV>_NV)Y2x#V%u3- zr5HM&m3Gl7F-0{@9Yo6VY*6I8aXHARgL*eN!8+ae93Cx_+g5CH+%01(AcMHM6|P$&2GagpVqtL*f>p!qHntPi^Mc_X|oE)T(owI z?mso>uAMj2($1W_9ypgU=<;TdN#WgA5oeInTWI7+X>#X#ou;cpcRWq+JQkl@rBhhr zO;vBca}16}X1dJAju%Bz#ENcketeTv8#7jp$q!XHTOBWo+WEfD!c+vm9z{g_=13s? zash>%e>MlIH!Fgf@tn{IK`~w6F-na88qw(=W{=kE`sV zx`|Wf!&kSq8x<;)^>dP%^guQsrV%ksl_q22X3!LOD!bozlX`A;ZN;!8plUnlt0zxy^>pO&N=#Q`(R&1{^j{5B!@?Nfbn^z86pdXS!98QEm}_dIUy>C z1+OI4*jy~_t^$G|a1~nS<{B%L70d84tZ1%tzTHrj0Whyj_LPT`f=|0)iPHZHh6wAxZz!W$iY(qE)*)tBiCY;NrNlZESU_> zFK5+YJ0F^PT^GaS$0@jO6MpR4EaQmQ@^W^ZSQnSS$%nP^EP0kZHCc}9Gvjng2rrKi z#0D1>s}N>zk&rbsC)PJk4%VL>te-R+Cx?%nJhr~EzRtkGwRk5{=;_9t7_6TfY&>pG zYz#LZKem2?ahpgvfS*|f`SWsUHe-sHQXVv0#+0|_bn4%%mEq0V*}^92+Bjc4!*uFn z_%Yay?P6#y+cd`ePT!owgJk1WHkjn&vph(%Zt&0?x$^v#OP#$o*4B?)$Wc5)mRki% z$;iix)F#=}$}}Z3IP=2xbAwaeI7dJ#r%M?j4^|D$sZmlNxtc1|44xyYR6~;$?y)*^ z;%Vc5J@asO|CxRU zZqK(6`>)#n|BSxdL^mj~_Fo}BSK7%gMu}KpkYUXE*@S4jRg9DU*QnkZAh(PzRc%vY z+n3ik%`)DjUvXpllO}P2Vca6kaHBfWQbN$YtZeXRV<&Od48In-j)WpUh~(@1Xp^R+ z@kq=B`>`X=pkbVn>x;Gt#LD}NhaTw8Gcis_?QWgM*c6D}d~2u>Xy|0dR!vk_OSJ#T zm>?x=Wt_rJV?QKSOC^Sn=q}#2rqrCKZ$knq-u|BL_=7GH z7RpC^oFOw=$2*^X^Je#M7;3T}U)ogtQ|r}uHk0KF5Sc!N zR2*H4_sA}ACv=V8230=N-x%^m?kiT8JG$19dL}n{ut6L>N2<{#&NeFS+*9t7eVM0_ zm*&xRk_s+%!k-g*Azf|cqj*S~yJ?zV?!VF)LG`Np1A`@B@i)irJ^2I)s${Zs0c5mP zlJ=YW3Ik*I4<$O6QBjjvT>lutK**O)a!dc1Xlv=RD!rFEQVVHKY4=~f9bL&~HqLa_ z@LH+;#v=Q#O%m$2scJEKTGLzZ;jcJ#vx+k{+1Do>pW}VfIXrW86Z;#qZ$oK?(bHuA z8;JOD*L*%gag^pEU-s*g*w;U*joxI0GebgH9!6bV6xbTr-TUBm=_SzKx3QhXh=qWS zUv~>0@Ko7!+xbN7JJ{YrAt86O)ne@B{;$UvxceZ_ai7@KwSK*Cs;)fC+5{2Qs(PbB zk=k^&?a;Q7?Kbn_fdtaMI%Je}&iG>#RNX2VwJWJy?;8BLty2j|%WRHuLon^;wqJ7f z#Qk8=Gnwtne86TpF-P&q4WJR%, 2011. +# Fran Diéguez , 2011, 2012. +# Leandro Regueiro , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-15 21:15+0200\n" +"Last-Translator: Leandro Regueiro \n" +"Language-Team: Galego \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" +"X-Generator: Lokalize 1.0\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valores de depuración admitidos:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valores de depuración especiais:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Activa todas as opcións de depuración que non son de comportamento" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variábeis de ambiente adicionais:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista separada por comas de extensións de GL que se vai supoñer que están " +"desactivadas" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Anula a versión de GL que Cogl asumirá que o controlador admite" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Opcións de depuración de Cogl que activar" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Opcións de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcións de Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostrar as opcións de Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Rastrexar Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referencias de CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de conta de referencias para CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Rastrexar a segmentación de texturas" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depurar a creación de segmentos de texturas" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Rastrexar texturar atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Depurar a xestión de texturas atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Rastrexar cadeas de mestura" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Depurar a análise de CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Rastrexar diario" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Ver toda a xeometría que pasa a través do diario" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Rastrexar proceso por lotes" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostrar como se procesa por lotes a xeometría no diario" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Rastrexar matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Rastrexar toda a manipulación de matrices" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Rastrexar debuxo variado" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Rastrexar algunhas operacións de debuxo variadas" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Rastrexar o debuxo de Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrexar o debuxo de Pango de Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrexar a infraestrutura CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastrexar a infraestrutura do mapa de píxeles da textura de Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Debuxar o contorno dos rectángulos" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Engadir contorno de trazos para toda a xeometría rectangular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostrar trazos de liñas (wireframes)" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Engadir contorno de trazos para toda a xeometría" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desactivar o proceso por lotes no diario" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desactivar o proceso por lotes da xeometría no diario de Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar os búferes vertex de GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desactivar o uso de obxectos de búfer vertex de OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar os búferes de píxel GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desactivar o uso de obxectos de búfer de píxeles de OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desactivar a transformación de rectas por software" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Usar a GPU para transformar xeometría rectangular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista de Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Envorcar atlas de imaxes" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Envorcar os cambios na textura de atlas nun ficheiro de imaxe" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desactivar os atlas de texturas" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desactivar o uso de atlas de texturas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desactivar a compartición de atlas de texturas entre texto e imaxes" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Cando isto está definido, a caché de glyph usará sempre unha textura " +"separada para o seu atlas. Senón tentará compartir o atlas coas imaxes." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desactivar texturizado" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desactivar texturizado de calquera primitiva" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar o uso de programas de fragmentos ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desactivar a función fixa" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desactivar o uso da infraestrutura da tubería da función fixa" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desactivar o uso de GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desactivar a mestura" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desactivar o uso de mestura" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar as texturas que non sexan potencias de dous" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fai que Cogl crea que o controlador de GL non admite texturas NPOT, polo que " +"creará texturas segmentadas ou texturas con residuos" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desactivar recorte por software" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Desactiva os intentos de Cogl de recortar algúns rectángulos por software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Mostrar código fonte" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar o código fonte ARBfp/GLSL xerado" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Rastrexar algunhas OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Rastrexa algunhas chamadas de selección de OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Rastrexar a compatibilidade para fóra da pantalla" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depurar a compatibilidade para fóra da pantalla" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desactivar as cachés dos programas" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desactivar as cachés alternativas para programas arbfp e glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desactivar a optimización de lectura de píxel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desactivar a optimización de lectura de 1px para escenas simples de " +"rectángulos opacos" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Rastrexar recortes" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Rexistra información sobre como Cogl está implementando o recorte" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Rastrexar problemas de rendemento" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Tenta realzar o uso non óptimo de Cogl." diff --git a/po/he.gmo b/po/he.gmo new file mode 100644 index 0000000000000000000000000000000000000000..680114993f48977ee77b9281cc8f8ce2b1cbaee1 GIT binary patch literal 7665 zcmeH~UyL199mmHCf{UP{6cxb(2&I;LySuH>-m=i$Z7GEgO|Xc!3p@ABLBkk9p_S>x4_MC8eRdr@MG`+_;L6Q z)Hp8{`LDnWdHy3DgMWt~g4etso8S#l<@Z9_c?8}8AB7v?pWvt9J8&nwe8i4(H&p(8 zP~$%YKMYSp1Ah)b4c~wtfg3JxoX^0Ga0{G-nok$1pKri%_zcv%Ux(^%Ba_(zuY;T6 zBHRJL0`G@EffvKwOkxr)K!$XVL$!YrUITv&HUHNkT{|Ne*>%_m;R6h?wt=A8r+P_@zRjB^oh795S3(CGr2xijDCa89|L)qJb8t>ase)|!W z4u1zVkMpQ39qxqk!!(q?UxCQbIhQ2+W=IpHT_i&qC9S^HMs~>t`E@&KABkb|>w5mL zCCO%8Hz z*L59foFsjhm)201e0D2oj~=+>dtF)^U0Soxl8{gCH~E&M!nu>QiF7_m*EC7~u92j- zt)!hKT`XCCUCsZ7;+|t7*T+=xENzw7E!-R+-9eHzSQ_UX(oLi)>Aj@AB(1A6*=(9+ zKk-b|%K|_2QqzhO;|76gdr{ZRl9jVmNxVkphV5S9CTptunIDC2V7ze2Pol8vg_&7$ z6W^@|URraeqjq3sV^vD+!$Ryed^hmZ%swwBZo?1T_Mz$3d+j!lrWLsD)MSxKy`th7 z%6eg0I$OUN15M(!yu=F|o(Ai7-Ad}kZsKNM(`ZB!wamU5;~mMoFqKIfAWl3Uo5sa6 zO+S_4O=ph`F|vLtpl~5eWE6d+velMGtybDdJTEk9FOH)mEAlbIG@@RZsfnMay~5M# z&Dxn3H8U*fF|3;fZfd%2=(at1(Ai_{kg;?A5ic-Py%sa0-LT-0m(czUB?~iyYPUzd zM5|MGvqmSkylC$x^;SHnRu;=Yr521InylmHJ}^Z;)nN;HWp#%wbX0d6hfTw6bV_My z5aZ(8c8~@*I%+3wcQ}a_Q^VDTNnsRL;%M1RDp9MFEk~yC&ai%jj=KI)S8B?&n|Q8_ zFk|tN{5kczap0M>;Yr<0CW_trdLFXK#fu^bqZP&!<_@yeqlt5uuO4kso_5eSBg!*t zSFi46%hG~!^EvxnR&zLD8nv=zX{-_WalG1fgA$o(vcwHjHfDD)=9+Oc z9FDs(e`%E!y_D_WGL!RDrj@wue7nADU5ZNkW>zVw$eWG55K&qW)pJprDBpX-nXaw6 zWMz8xy6m~Naw_`xk5ezpS%zFirqv4@xh`Tq_7vUFeB&^^mTpXQC2vaEY?;@MvwZJs zElf)ATO|<*zg!Xo-|Hgbe1Db;s+={3nMQ}uh~kJQZfNp)m=$==-Y}1Yd61R9>t4rQ z^4XN^$vmE+P#YU(BEp>?YT>QE-8x~~bfRUu1AR&*ZmpOEI8f06_b?;paW-R%A4Zxk zD#9_WQ!`=p6Vr^mG~ASxamw5|H@jF)A!V|*jh}Hma2gQPh?ph~{04Eem?_&S8Qw4Z zS;s89Db@Utf45n6X6>o6%9GA4gC~BItzymLQDN5(mz$gq=n^AY0#zyuE&^)m%tujX zrd^iXSs3`D^jV(MX0O`_kEmPmR;iXL^^yi#Eov6+)OHxzQd9Tj#60dX$0F3-Yonzd z$#!Ayb!xI*x@@H4_$pR!$qk6^HD|#d0CZ(nwanMy=9$S{K8rTkr;g2>DnoMds2yPJ zIa5}Vhl*C50$n#AXxg?ZqH@vU0Y7b+J&C)lfM6@kAb|)Zd zztk)FF~D}s2kxcB^r~}^D4I)p?x6O3R)*|S`)l8l4*A}49s$&3Ai@~cOM_V_iF)l$ z-d`!eLw?%h73rww+}+WU($Vh6bkA<=cCZq6?8#+!tQ#!5E2&XXbg5-udCJ|IpNu~7 zE{|eWGm9C?vQOP|!}I2sziDx{*?HM`mv3?#^s0{4wPuiq2km0ck%bJCb+ezFy z+riwFcB(7N+}-ZFeo$>h-J5B~3o(MIEP8IYW^VK92`hcps!ZA&Ik5l0-l2oWs-q** z5fcuvVI^iV^6J(&aQ$$Xj+TUVpE$U9Yh}lc_%35_C$0<4l@n%c^RAK4RpuhE>1UO47UcwnCDVF|O;&1V|HAy_-kD*+ zLLOeHt!Xu5Z9B`yLn->RR5|1KMgQ^sss8Eyll>F@@0tEn{fD@Dh>R09s(zX@jXxW8aDXv)0^G{gbADjKW7KIZg!*=>B6=Jz@GM zDfm9EPxK!)v?^wNirgpEsb>0JTAoz9^^cR4^2E-A^7_X~@ddU1akBn#vi@, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: Cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-13 23:21+0200\n" +"Last-Translator: Yaron Shahrabani \n" +"Language-Team: Hebrew \n" +"Language: he\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-Language: Hebrew\n" +"X-Poedit-Country: ISRAEL\n" +"X-Poedit-SourceCharset: UTF-8\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Supported debug values:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Special debug values:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Enables all non-behavioural debug options" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "משתנים סביבתיים נוספים:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "רשימה מופרדת בפסיקים של הרחבות GL כדי להעמיד פנים שהן מנוטרלות" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "דריסת גרסת ה־GL ש־Cogl יניח שמנהל ההתקן תומך בהן" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl Tracing" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject references" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debug ref counting issues for CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Trace Texture Slicing" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "debug the creation of texture slices" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Trace Atlas Textures" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Debug texture atlas management" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Trace Blend Strings" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Debug CoglBlendString parsing" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Trace Journal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "View all the geometry passing through the journal" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Trace Batching" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Show how geometry is being batched in the journal" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Trace matrices" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Trace all matrix manipulation" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Trace Misc Drawing" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Trace some misc drawing operations" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Trace Pango Renderer" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace the Cogl Pango renderer" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Trace CoglTexturePixmap backend" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace the Cogl texture pixmap backend" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualize" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Outline rectangles" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Add wire outlines for all rectangular geometry" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Show wireframes" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Add wire outlines for all geometry" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Root Cause" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Disable Journal batching" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Disable batching of geometry in the Cogl Journal." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Disable GL Vertex Buffers" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Disable use of OpenGL vertex buffer objects" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Disable GL Pixel Buffers" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Disable use of OpenGL pixel buffer objects" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Disable software rect transform" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Use the GPU to transform rectangular geometry" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl Specialist" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Dump atlas images" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Dump texture atlas changes to an image file" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Disable texture atlasing" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Disable use of texture atlasing" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Disable sharing the texture atlas between text and images" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Disable texturing" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Disable texturing any primitives" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Disable arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Disable use of ARB fragment programs" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Disable fixed" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Disable use of the fixed function pipeline backend" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Disable GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Disable use of GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Disable blending" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Disable use of blending" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Disable non-power-of-two textures" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Disable software clipping" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Disables Cogl's attempts to clip some rectangles in software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Show source" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Show generated ARBfp/GLSL source code" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Trace some OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Traces some select OpenGL calls" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Trace offscreen support" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Debug offscreen support" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Disable program caches" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Disable fallback caches for arbfp and glsl programs" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Disable read pixel optimization" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Trace clipping" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logs information about how Cogl is implementing clipping" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Trace performance concerns" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Tries to highlight sub-optimal Cogl usage." diff --git a/po/hi.gmo b/po/hi.gmo new file mode 100644 index 0000000000000000000000000000000000000000..702be63d8cf3bd4a04da54c7fe800a34658294f2 GIT binary patch literal 12229 zcmchcTaX;rS;sq$bMYnyY(NPKG3^k?c9dD|%Car5tyovfPNYcD&D;voJJUPU(%jNL zqm>LrBvG~nc4ADSs3JLW9M8r^@~uSKic%(ifd{IfC@3CW#chBRZ@iEfC@#hC|DDrw z+u2K8gemp@r%#{rUH{*APLKZn#%s?6e7?Z-vs|5Pf}jR|`aS&N(|vCcd>s5oa1y-s zeL-+DcnA1F@F4i(;H ze*^dta2F{1%Aoji9MrmJK-v2}Q2M%{;-;h(fVH6f_(hPE1W$m9!x>QVz6qg!@-FxR zCfr|#@m~fr@GkHNpzQb*MoZsT@YCQI!Gqvez+VRc84SVuaq6$ZFM{`jcR~u~rwtat zKLihfA42GZU>$r2ybK~Dco*c@0j>cRpI-q}Fa?#@tKj3{4Ul&o_;v7C!9NAx1aBi) zTfwWK{JD){c?0}Ca3}Z>MJRip2DgL%3Tk{k&XvGNz*FEqfYLWh(dhoG;BSC85M;^! zDp&#k5g0ybt`mi{r&lkPF7&1_@12 zCz;CMqu_4vHSj$6KOjqkbDwm1_#;sH{Tq+h-AWF*zZ<*@{B=-qy#$uP{{mHy(QR)0 zJgEA)3Z4W%e7lR|Iq**I{{!3zuEUtkUH;&upwQ4~n!5=uCW+U{@S%k_CK zQX0IUOCRN)lms(eq|RzX`PS#74gx3_T;spL52Un>%NqKC{`k-R;BKzZaj6C=h2UDQ z`?yF~@NTXhT%-_ZOQmo=N#n55ZdH?doP~3ZG>od%upBpPaVtH(%#<`PwxW8uU5(PA z=}9YT)T3$`*N-M?qh5>at?+1+Ceds)&SrvbjdC^I)6}HQ-Ry71#U!dGS zFT0ykJligpxee#4Q8^1+jWCP-#4*p>_5A6c*~1tZrtw^y#`R(>WwlyV$l_*{My7=&KVWPgRCGAM8k9?eF@BVjQrR&r`dNf;5^ay6?G=ten>YJDf>aE(xVlj@Cn zq1l*^(?Vme(3)?AK05vR4R};b9*M*z<8B&9G9sLA9<%!_sWq!{m=$BO8)q8L=u7Pw zS{Qj@WKWwn#+%z4mc+1WAs^J%d!AL`HX0R~;q1-Et$A@lqvmr`Bb$ANS!1p>FOC(f zNwYZ^y519+8Me}>o>7>!p3WgXgA3h*u_IV;oPZOqR&sQ}igrf%&xKp|Z4KwrsBGoB zC@+4}&Rqjc@?(3NaUD{+2+bNP!-myf-_zl#M;%R&a=d}~Irwc=W{Wwozdgc;3mfFdG(o)QS(u0dg|&pe?T88R#^ zR%nedj&2gwLz{hu9!q4yBb0Bvi z!&$c`X|X-98_?6}m|<2;iu6tIDdm**zt1PFN;n^7OiSwgjY^Zj9=EFuL^9Ze@-!(? zD$X2k)pngaGuaeI^hi>mN#0=JP_tlPqtObtMWj2}--|^aGaD&W>#oB?>bd4Ru@;xw zX^~QEl>9oa?RT~;oQ)Mk>wEa>Z7&boZHHzuN#1 z<+7TOYjcakEk>UMuGwdS8{C?=WPhs)2;DxDPf>*YDt3Wd)a-HEt?^yi3*4P##c+EX z&8s1}345VsBix5%cE!{WdWqqF^4p)PV*t!clVjS4k|rCyi0Rk#*yiNgL~XL}cJW5& z#+z|!d}co;75q&(1h_|5bFP^Tj@0Bs$@xHOD6!h6{S*&**W)z zPf3T8c-}gImh?#2g!STJtCBX_<%-G633w>U+8mJ{iGznL+EOa2eoT*DVVA4Nn-#Zn zxr&Xd^U?7vR8x$Y<&Hdgwc5^@(C@5^O@@0gBb`r}n-@GMKRao$w>iIDzq2BDO>Z)A zyp{*n9#qBbBYCK;S7gE7w4q~I;h|FDkSp~W63+>+rdE+o?2C0wD(ue6NvW{4UCs&z z8Z%*~)oRYHTgQRx5!z2QS+0|!$wpdUN3V<1U*o}Kv7Fq`K2>TLTbqj2HZ44zpotZ> zsaIi4VLL5rCR{%?y`eC5cVTKnIK5%!jty(4rl+QuSlAaIP1Jh&^VS!p?kP;)6Hebf zv*E6_Q+M7mHL(jT3-Gg^LHA7hWQ+bAw=Oo z9MxvR2NU+N@V+CZxR6Y5tQSg+;%08-Nq;WxCKJ0K+P$M6q3Ow~iERyBt)u;T6E_sr zbFBZ*`zh`3x%DoAIkh)jU&dQaC&n6 z#NMiQox%fbFxgC4Z`y6PY5l#S`?{$f-n=QCzIP(%cD~!~e81ayt-J7e*zG*iUHD43 z^QsNK((Sy}?R5CdgEQ{=B^!H+0mikAZ!A64?Obp&x}C4_z)5iPH^ z=Hul&e%}nNfpk01+GGNB8t)N_qb_2dD=tb`c$7~jR;YNX+c|4ri0N6DTr?4AMTG9Z zYpR}g!kDjIar2D1@Zvj_N@!U7L&^4UVV2ex&B*U4bc*TA0mqSU=czo#P>e{31>MdY zXmZBOY;y2qw*%93BlWy=9c+?FpR(u7CMD7d#73)t{?=(h!)q5VTy-H? zc!C9e8Vs)%rTiPEJ+N5y>(ME>$Rn(N-kelSU+FHK>~_B6^Rqxno?>(<3(YRPARe&a zvxzi5+lBYWV3K1|7f+e^!iecg#$v~f4KxTs6>U%|p_2YI&9pc@X4A|2~m*Z}3)#uEJo=**q%n9cvkP z{cMDVxp^Ym&=NCk;WYKXtkKv^8&)B%P^38{j6TXW6*x*`0yNIQ5xF22=zEx;0LQSq|df&7u9V0!_@NGwQ+-ud#T zsdpRKnf!5?=kCDiUod%&JQs0#@Ck(EXUL&647T8Yn&6hs*a&f~!yuPO+mjS*9x+`r zFu=^Ro4(h*H%db5o@;N#I;se9c$L4=S{phwV4YHfUS327vg;I{&@a_|`rXB~aYuC=CsIzEe$MdZU=Mh~IKy(bVL0gO7wl=JmzQCsbG^kF1zaA_3O9vpWvcad7QL z{m)kZp8%Fc!FPFbawY;s*d3 z27e4%?8vCCLH~a!Sib0~)eX^OgCd!FK^}VB*KaKrL4tE?CRmg~&xUbpH2Zf4e++O$ z!vWk=ZJiD>Vc-fZaRJSfb$)bs} z7^vrEY#9C@A&bq*W{=6K>m1s~#%fdF{`dn8;Su`>F5oz}U>t`TYOBY+yy=5+GZYHCQ?Z-f!+qxSm?+gW!9SL^_4!Fyh?cM-!jqR6`CcbFUj%c;i z$+y~GZWq0}J*K(Z&>)vtV&9;D|MaahfdXj1u`@@%v>6pu7HZ1*85>!+q(PgYV&mzO zzdS-RETvSK$QRb3Rvid=RDk`ovy=ZEb;5wr*Q|khSh_9xYL}81td=oRzyA82m=h;K zW6MN08r2$>G}yCAaav-LIrGnk{EI=VAqxaKVxRy!v; z32wW<1y0CX, 2012. +# rajesh , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-19 17:46+0530\n" +"Last-Translator: rajesh \n" +"Language-Team: Hindi \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "समर्थित डीबग मान:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "विशेष डीबग मानों:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "सभी गैर-व्यवहारिक डिबग विकल्प सक्रीय" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "अतिरिक्त वातावरण चर:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "GL एक्सटेंशन का कौमा से पृथक सूची जिसे प्रीटेंड किया जाना है निष्क्रिय किया गया है" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "GL संस्करण को अधिरोहित करें जो Cogl ड्राइवर के समर्थन को लेगा" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl डिबगिंग फ्लैग सेट किया जाना है" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl डिबगिंग फ्लैग अनसेट किया जाना है" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl विकल्प" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl विकल्प दिखाएँ" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl ट्रैस कर रहा है" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject सन्दर्भ" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects के लिए रेफ गणना मुद्दों डीबग करें" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "संरचना स्लाइसिंग संरचना स्लाइसिंग का पता लगायें" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "संरचना स्लाइस की रचना को डीबग करें" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "ऐटलस संरचना का पता लगायें" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "संरचना एटलस प्रबंधन को डीबग करें" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "मिश्रण लडियाँ का पता लगायें" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString पारसिंग डीबग करें" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "पत्रिका का पता लगायें" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "पत्रिका के माध्यम से गुजरते ज्यामिति को देखें" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "प्रचयन का पता लगायें" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "दिखाएँ कि कैसे पत्रिका में ज्यामिति का प्रचय किया जा रहा है" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "मेट्रिसेस ट्रेस करें" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "सारे मैट्रिक्स परिवर्तन ट्रेस करें" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "विभिन्न आरेखण को ट्रेस करें" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "कुछ विभिन्न आरेखण संचालन को ट्रेस करें" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango Renderer को ट्रेस करें" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl Pango renderer को ट्रेस करें" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Cogl बनावट पिक्समेप बैकएंड को ट्रेस करें" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl बनावट पिक्समेप बैकएंड को ट्रेस करें" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "कल्पना करें" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "आयतों की रूपरेखा" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "सारे आयताकार ज्यामिति के लिए तार रूपरेखा जोड़ें" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "wireframes दिखाएँ" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "सारे ज्यामिति के लिए तार रूपरेखा जोड़ें" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "मूल कारण" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "पत्रिका प्रचयन अक्षम करें" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl पत्रिका में ज्यामिति के प्रचय अक्षम करें." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL शीर्ष उद्धरण को अक्षम करें" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "GL शीर्ष उद्धरण ऑब्जेक्ट के प्रयोग को अक्षम करें" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL पिक्सेल उद्धरण अक्षम करें" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "GL पिक्सेल उद्धरण ऑब्जेक्ट के प्रयोग को अक्षम करें" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "सॉफ़्टवेयर रेक्ट बदलना अक्षम करें" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "आयताकार ज्यामिति रूपांतरण हेतु GPU का उपयोग करें" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "cogl विशेषज्ञ" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "एटलस के छवियों को डंप करें" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "एटलस के संरचना को छवि फाइल में बदल कर डंप करें" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "संरचना atlasing निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "संरचना atlasing के उपयोग हेतु निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "पाठ और छवियों के बीच एटलस की संरचना को साझा करने के लिए निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"जब यह सेट है कि ग्लिफ़ कैश इस एटलस के लिए हमेशा एक अलग बनावट का उपयोग करेगा. अन्यथा " +"यह छवियों के साथ एटलस को साझा करने की कोशिश करेंगे." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "टेक्सचरिंग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "कोई पुरातन टेक्सचरिंग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp अक्षम" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB खंडित प्रोग्राम्स के उपयोग हेतु निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "तय निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "निश्चित फ़ंक्शन पाइपलाइन बैकएंड का उपयोग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL अक्षम" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL का उपयोग अक्षम" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "ब्लेंडिंग अक्षम" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "ब्लेंडिंग का उपयोग अक्षम" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "दो संरचना के गैर सत्ता को अक्षम करें" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Cogl को लगता है की GL ड्राइवर NPOT बनावट का समर्थन नहीं करता है इसीलिए यह कचरे के " +"साथ कटा हुआ बनावट या बनावट के बजाय पैदा करने के लिए बनाएगा." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "सॉफ़्टवेयर क्लिपिंग अक्षम" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Cogl द्वारा सॉफ़्टवेयर में कुछ आयतों को क्लिप करने के प्रयास को अक्षम करता है." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "स्रोत दिखाएँ" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "उत्पन्न ARBfp/GLSL स्रोत कोड दिखाएँ" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "कुछ OpenGL को ट्रेस करें" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "कुछ चयनित OpenGL कॉलस को ट्रेस करें" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "offscreen समर्थन को ट्रेस करें" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "offscreen समर्थन को डिबग करें" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "प्रोग्राम कैश अक्षम करें" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp और glsl प्रोग्राम्स के लिए प्रोग्राम कैश अक्षम करें" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "पिक्सेल अनुकूलन के पढने हेतु अक्षम करें" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "अपारदर्शी आयत की सरल दृश्यों के लिए 1px पढ़ने के लिए अनुकूलन को अक्षम करें" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "क्लिपिंग ट्रेस करें" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl क्लिपिंग को कैसे लागू कर है के बारे में जानकारी लॉग्स करें" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "ट्रेस प्रदर्शन मुद्दे" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "उप अनुकूलित Cogl प्रयोग को आलोकित करने की कोशिश करता है." diff --git a/po/hu.gmo b/po/hu.gmo new file mode 100644 index 0000000000000000000000000000000000000000..49737711c3ff1cdb9b510de46987a85e8ae10f8d GIT binary patch literal 8532 zcma)>ZHygPdB+bS1+s+}QtG}2PJoaE`(E!lOJZ+glJ!fR#JgT&uMH?4s&nr>ckX!R z&P-q?B=_qsmJ2U6ydHp}nabCaw-j@~EC%J!@`)}`2Y6u?sC4RWxc!yFS0)Gg$ z!F%7S)Pvw-;Jd*~;ID$6>Ny90hvz>89{~Rn{B`gjz~kWes`u}Cmr}pM^Fi=Y@Fe&F za0vb;_&M;mz%PTc&o`_0-vQsl^PAuj_}}1r!H4ccCh&1kzFz@F&a2>A@QdI9@W z!JmW2zy}umKA!^R{Y#+ie+_&e_!UrtuYn%{{}uc-@Sa~*>SN#m@F2JfiatY7*7+=W z1pG26dj9~F^$wuSLGTgqQE(GH3jP83r{Ld#_k+)%#430ZWJ~ojDD(dYd$bTy2N94Z>ikzPVSwejklzm?XW&C$RS?5Qf`0=M8 z|EU8wTks)J)?WsH8(afLz5tYX*#TwVmq3yCRZ#YO0~EW7(^|kmQ1ti=h)dL;fntZ3 zL9zD-SoDpz5g*{=Jbwh?Pl7Lk8vJWe^!XM)Oi|wl*+RVuJ`Da3_+jt?loEMY!B2yq z0S|%S0L4%L2A%-#M`?L~36wbgBT(|mK7r#$N!%UcV1M2!0Jb z3jPx)@q8bX9sy5+GCl^M0sjJg4*VC8p-SVl$H8OZ2AF{or{4m<1O6|FsOsAoLB9V8 zBsA3#jPX(MY4GDoYbFM_h}HmJeRgKhBZATCy~ zgEHP~!9@5SOVx1|^@q0E+$gKtxw>g0il>l=wRgirp@Oi{PJt zqW|B6&w&2{E`y8O$F~K)#&ZeE_zz?3w}C>7vi}g#F#Sm&0!A?+N`+zUR%Ek1uc z_i1j)BemM=>FqGLIvtg9nAk%1(_EW4)`3ljw#;|#G9tsHu>D}ung10#M&lX zVV)*Ko0NLX7O@q(+!irKlE&86a+l#er$q5 zm#HpnHSiAKMoIm3qjLoTb#D7Mw@KH^X2YRr6*e=uDQ!>7jymn@Gi%yjEp1YWNU}ke zTONDbV3}T6h~PbSN(9j&{fU^57t36PVy!}C^%UM(-OC%Ywttn$u=%GnWV8w#!l$S$RR`FHqo zacw&6g>;mQcRHr*4xHrGe3N(j*>qU_S?p8Cf({d14y?0*uGVSKW{6dq3-*blj_F3a zYr2Cvv}6-)ux$_*F@{cq+ze+*^id5{S0W{8(#q0po43+_tK3d?Wu4jhlsFoOV28%UmAKQ_vZBtM$(y@PzZU~y zn;pe6^WN*&a$90S-a4JbA>N#ASfu@OTVkvmhgsG%-Smrysmt6X1&KMF?m4$lbE5xn z$2Ul@gTXOZ8E!SC7!{;{U$0&`q5HWBT)OV_OEu`sS|gIGcN>{a2ug3Ejtfeiy4;&- zIzM#Fhw0tNl5_LnRITv~Rj<9tQ{(E<^S`0m(& z*$PQYa?%wq+jO95JxI5G28Mi<;1-Wb08XQ5-9+r{c(x?PBSO;< zMHmJ@^>VzQ>t1S$XQa{ ztBX@x)HZW(0&?9mJVD*h4olRc(kSneYH6>UCv#`aR_KluBRbwg$BOE%c((LA`6c|{ zQZ-4JA&FF#ugZH{CWhTt)J0zaSju~~elNw%>Qxs$o1W|o^MEn{6QkKj1uJnd%FyOjXRQm(_~;BL1BXl{SFL%fqWu zhr*0PFM(OjnMRvm*A0{+>mT{^`g)>^_qUIB34LhpUouN3AMt;!nGBfbx~gS2z?3emqWYl7(k{>gD@lNB?ikuo{oZnTdxkl%V9C1 zMH*Z6sezP~fn-0TTc6lLyps)lA){7wQwN8wJqP3Z>=s{U#D~Au$aE+lK(+(0`)K2r@FkENz-{V8O8-!0& zr+TAqdAu8spzwSF5^J3lu0ojBDJW}2A6Z;lZY@61T3psk%PWs9A6#5oTx4MDg53&* zdS>H}v=)!G7C){R7gv^#9b7!ZxHY6~5uZsx@Td8TJ_8Bo`Ygc$?dqo@|3`o&wG$Fz zg`!8FU?#0Gq0!p3X1JoC8zq7Cz|3*uT7yx`^`CPS(Qq~sGmIA2pI<*cv)od9ap7c& z2@<5*$xu(seK?Cvm^>*pCnq3|U)p@Ob#yk)g(5xF=>+m4zE3$q^Px) zMlQPaQhRyfd@R+d^(=*_SkXGk+;egK$dlUtdHj(?KX_a(J^JK=I+agumRpnEaWuJ= zZ%N~CB5KrlJlQq9$!=lvFeE9HI?Th#E?@n$x0+H;t_Lv-Qf~Q~yn5Rjn<@KtI-!MF znwr~U@0z}1vU|lG(v+Kc$3{9v(b(yui*Yy{#WGr?RjW>x<^iQ|<6asESY)@*QyHD6 zXD8R;(`0AwT7n60Y)xK^L(Q_oG%&Kd8*bylWH+zOr!G{dsSx29C>t{{lt#W2Pp%J9 zZhjLdk2gWfMgu!mQfwx#<}%V%!B&Lhm|IM)C+IdWV%=C~uCJU^U5rTgKmy$PBQ<|! zCw0zbF)=Z@RocMq*8I3S=BOtJlg5NI{s0^riLQE*7jZTUZgsv--0B^ZwAID&37bdp?HYlyc z#WV`kIXl!5?}$ZOJ%T6MF^(E4LpO#l)n}P_%M{LcRXGcBs5q0!^CF=P@5_Qy7Ewlk zR7sge+6Ftt*yek$NLGl#HWU{_`f{whi=Jv@y1hF%G-T+8WL-nx)mjl#bxlJXq>?sw z5S3ClmP`(u`NVZZcqAU=by?yZj$8x{RXw(tDPWQ2UXAZlHCyNo{g5CoCmNDfkzC8Q z{|l^m+Xm;|`HNgbDxq%Y9~pGJ)s>vbN+`zm2$^XN;ND_Pcu|e^&+zebml4gQnok;c zQj5yb5NE#i#AdqvKWEOT!(Fzx&6sx?xvKL<7W5~t1;G}HxzjQ|8t6jmbYe8DRpP_E zGF{WlYc6rFm^yoLE#w246TYQRCfAwES$P@(1l2Tbs-Tg)Z7auL(;y2cH)u}rrKvft zjtpUQYEtRGV(Dl$)XnZg@BCAVTKAPQA)Dz2EZR;F~ z=#$u5%teYrfU@_NVenu?hbT!x<5fD29U992+|;((Y_L`o(!5Ez!>5J+3dJhzE+W1t0I| zVL5s<3v~$J=Ik3;x~|R2<)X|l9OP4H=3WuE?!eB@3U2eY>uSgZDkiNHC5e94aeF<_ zH$Oro{0nMzJieU<8r%4mpt-~8U}ti@qjPg*oJuKde)9*+h7G-m>%D9GszVpgHfL9v zO@Ack>FPM`6SFz&a#fNVQm*?c^P0Y8=hj$Y)5f%!1lLeV(k1Sk)y~y?S5=3`)afVc z{G4GzJ=}X`OOmuHy|=%93rkg_D%Ts1B2uOI@%5d=h+KA20bQb0@(!ePo%a>}oNFjt zph~sWc}jO}IvwAx&58?DOxOKNUXuZ*_t{6`J*q*l!@=VA6Nu4sZGk`3tX7$r$VVDL zLS%A_jcGTkLq6?fBZSq)RLSe|);>j(jpr%f;uxc8lyObslhNqcq>(elHLi>%JmV;x5QyS7`uz!c0p=_R{ n)#6`&rc<#5TS!~QNu{l7H&$^^FAF>7mgVt@Z&8{YVAcNt>_|M8 literal 0 HcmV?d00001 diff --git a/po/hu.po b/po/hu.po new file mode 100644 index 0000000..6706dcc --- /dev/null +++ b/po/hu.po @@ -0,0 +1,371 @@ +# Hungarian translation of cogl +# Copyright (C) 2011. Free Software Foundation, Inc. +# This file is distributed under the same license as the cogl package. +# +# Gabor Kelemen , 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-05 00:49+0200\n" +"Last-Translator: Gabor Kelemen \n" +"Language-Team: Hungarian \n" +"Language: hu\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Támogatott hibakeresési értékek:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Speciális hibakeresési értékek:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" +"Minden nem viselkedéssel kapcsolatos hibakeresési lehetőség engedélyezése" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "További környezeti változók:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"GL kiterjesztések vesszőkkel elválasztott listája, amelyek letiltása " +"szimulálandó" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"A GL verzió felülbírálása, amelyről a Cogl feltételezi, hogy támogatott" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Beállítandó Cogl hibakereső jelzők" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Törlendő Cogl hibakereső jelzők" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl beállításai" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl beállításainak megjelenítése" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl követése" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject referenciák" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Referenciaszámlálási problémák hibakeresése CoglObject-ekhez" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Textúraszeletelés követése" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "textúraszeletek létrehozásának hibakeresése" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Atlas textúrák követése" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Textúrák Atlas-kezelésének hibakeresése" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Blend karakterláncok követése" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "A CoglBlendString feldolgozás hibakeresése" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Napló követése" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "A naplón átmenő összes geometria megjelenítése" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Kötegelés követése" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "A geometria naplóban történő kötegelésének megjelenítése" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Mátrixok követése" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Minden mátrixmanipuláció követése" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Egyéb rajzolás követése" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Néhány egyéb rajzolási művelet követése" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango megjelenítő követése" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "A Cogl Pango megjelenítő követése" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "A CoglTexturePixmap háttérprogram követése" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "A Cogl textúrabitkép háttérprogram követése" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Vizualizáció" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Téglalapok kiemelése" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Drótkörvonalak hozzáadása minden téglalap alapú geometriához" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Drótvázak megjelenítése" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Drótvázkörvonalak hozzáadása minden geometriához" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Kiváltó ok" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Naplókötegelés letiltása" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Geometria kötegelésének letiltása a Cogl naplóban." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL vertexpufferek letiltása" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL vertexpuffer objektumok használatának letiltása" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL pixelpufferek letiltása" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL pixelpuffer objektumok használatának letiltása" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Szoftveres téglalap-átalakítás letiltása" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "A GPU használata a négyzet alapú geometria átalakításához" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl specialista" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Atlas képek kiíratása" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Textúra Atlas változtatások kiíratása képfájlba" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Textúra Atlas letiltása" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Textúra Atlas használatának letiltása" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "A textúra Atlas megosztásának letiltása a szöveg és a képek között" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Ha ez be van állítva, akkor a szimbólum-gyorsítótár mindig külön textúrát " +"használ az atlasához. Ellenkező esetben megpróbálja megosztani az atlast a " +"képekkel." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Textúrázás letiltása" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Primitívek textúrázásának letiltása" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Az arbfp letiltása" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB töredékprogramok használatának letiltása" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Rögzített letiltása" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "A rögzített függvény-adatcsatorna háttérprogram letiltása" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL letiltása" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "A GLSL használatának letiltása" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Színátmenet letiltása" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Színátmenet használatának letiltása" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Nem kettő hatványa textúrák letiltása" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Hatására a Cogl azt fogja gondolni, hogy a GL illesztőprogram nem támogatja " +"a nem kettő hatványa textúrákat, így szeletelt textúrákat fog készíteni, " +"vagy hulladékot tartalmazó textúrákat." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Szoftveres levágás letiltása" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Letiltja a Cogl kísérleteit néhány téglalap szoftveres vágására." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Forrás megjelenítése" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Előállított ARBfp/GLSL forráskód megjelenítése" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Néhány OpenGL követése" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Néhány kiválasztott OpenGL hívás követése" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Képernyőn kívüli támogatás követése" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Képernyőn kívüli támogatás hibaelhárítása" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Programgyorsítótárak letiltása" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Tartalék gyorsítótárak letiltása az ARBfp és GLSL programokhoz" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Olvasási pixeloptimalizáció letiltása" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"1 pixel olvasási optimalizálásának letiltása átlátszatlan téglalapok " +"egyszerű jeleneteihez" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Vágás követése" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Információk naplózása a Cogl vágásmegvalósításáról" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Teljesítménygondok követése" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Az optimálisnál rosszabb Cogl használat kiszűrése" diff --git a/po/id.gmo b/po/id.gmo new file mode 100644 index 0000000000000000000000000000000000000000..03bc06afdd6fbe51a142f3d6dd079f5e85cef66e GIT binary patch literal 8063 zcmb7|U94PH6~~W=2p16rtcrpg`DjZ!(|h{?W!ggT?U(($x9x3_#E5%l&YanI&YW{N zAHBUi=z|(b-~|W|f*K#-#gLeg7z0XtGWY-?z8D_VfQiJI@S-O8V&ZS@z0Z8ywnR^6 z&wtMTTx;$BT5Iq5^G#Pj7x0{>e3|m%RY5QWw|;^zo_DVag0F(_flcu0PX@sq;12Lp z;5qO{u~feQRJco+C5@MiF;>x1B4a09pnoCigpAt>{FAKVVU1d878fHL0(l-UAq z0yl%p;BN5S;1l34!JEMSC@~M71z9q94wUgf1@8u50Y(3JK&B36KJE5l11R>s2NZes zg13OnAfLeSCGuYcMb4){rU+gJW!=|6>Hiie^ZW&ref&4bC)mJd3*HUN{5!#0!4sg! z7lFc;HBiR=2o!l=17*E;L9v@`S_9YuiXM-EY)SAWD0X-b6no#!q;Gr-et=tfzaHWD zg1bSPzXE04v!KZJW00Z2%it#Pbx_uM9~8ZA;p;HC85B7)Q26>R*aCkJikyG%5Aa*OZ^WrY?k7O$ z_dM7He+QlhKLnovk21N;|3|*WULS%`Gk6eVVanh*DExlZ<1?Vx=eHoL1b+be1RwAv zcD@d!rG6_Y`*Z-rM8O$Q+WR2X2%ZFGUta)GF?bb}d43Px0e%3=`Zv-^*1Hp=D%c64 zVsP5y3MhJg*SEg{3ZLEv=fHn~BL6)Eo!#IgpxEmfP~>|Zd>VWcRNyz+3}_fgSQI}w zLD@&yLs67j%H$(!iTt9Q%rAR%gd(!aBV3mK78}d+AmwWm*_#~{c@`>zK?AxMjrif2GK#@oGSDrg5SJ_`dK$@`oyx`v@ z#?{Y5{5VNDP7w~VmBH1Ny%gE=k5dj&gx|q@x2sl79;&n|W0Qo1>ZQ5Tajc>+9foDT z_7Pq3uv6+Js$!i_bvLC+6CJBCxnS}%8HP!zF6i9ob{rP1;6NJ1YB7^eg?l-hg&m_~ zQhK$eHRc9q65T~mnQ-Qb`IqD1`q&koxYXakJov-myNpB&0?RL3(6#_ z?1$C{%Fojrj}WU&PS}G-ZQU8Dj_&kpYRMu>W7{Y$Vho)|xgL&{=%E^>_97)|(#X=) zFmI&2M!A|QZ=G@f6dn!D<678cxtoVtgiv$YMf+ZuVHSs~=!C*!0<8O3jpDs?#Sl!Z@Od zPL%D3SaBE}N^BgoL00(P4*U9o!71@c8_!^8kTUL#vQm zc1#F3V$n%GU}YO;OI&;aH8m{4Fziz|XZLf}O~WGDSk`e$omyI4u2m>d){QYG>49uO zOe12dA~qf3rq>jA%E!M~P1#qgx}cj$_}1NKu;{YNge8MT7SBx=S8?L-Dq+_xXGOLP zYGNc?Af3FxKA;xCnKUic0nK&?XGgZEZDwmCeBDKONZre}32RZQ$~(AP+V$gP>^QO& zsvU|EZQMggAL>?Iv~(-EDco<#nz+jlNAl^*@7@I+6Wv?ES(gBq%I#`hFUc)b^Oio# zF4z}=t6ZoXFl z#oSl=8P!?#cidHu0WdE&7bOpwj6^TQ^kYVBbMxAcl4RZMrHRnhXJKynOg?5S_|7>5 zxF+j!E|^T#3`K{o(*f6zjg>U*y9hxnYn)yr`boV;t)8(Gq%N_UupO!uVJxxMN3#yf z%NoYHaNk7zm?HktZrC({yV`}Tf|%Y6&Jjf|rI*f$&zE(`uDL&bN;+@CRT}|h$cTg) ztQQWJ{XDIrzMZco;CWM29FZOmgNOT)Qu^Zkh#oq}j^eef?=qM3SRJqGwL(cy)bw&k zp4wY&W;Db*8^xMx5i#;rL*LrrIr-U>7P-yo<>H-nau@WPf#bDkV8erWF?pmmwT%@; zu#~5A3~L5Xm%p=5UHwLb;^C6xFU+@GsLmR0SQ;g(>O@fYN_qBb2}Te z_cvyDs=1x59Xq$o&dtu!v2iB6U?lpC`)zN`KG4{HpPJp>+O=!T?EUmRK}>5v(WHR? zY2H%vWx6vbkDfdvQOt7qnZQUQBfWIoJfnFu6aHg#W5NufKn#kt=>a1|-B8&_t>0||~1?TNmfdein zI~r6;#G0jDT_>$zF)NI9JPErPlry}0T|&FKDo`bH6^FSlFgfE_^`I&%U$53!L}}3k z6X;S0|4YX~TBJy$li&<-vnO{2yNWx!2M2Yp{mO5KkV{PQNwp|Ic;4)+>-S&4YJ=Nc(59lxq@u`lscNM#Q z!RZvj$PJe?hIpPp>s&;|VYE($!gzhW2A5wja|?=qcIT#g(TGbTymt!XFzIxq$ zPc~p&)B0K@SEO}aYl~gN=!se6E;JCY^iJbU?++U5<{K@& zeh|lGYj}S?n)HZ?rTAIXU2Uo_P@Au`h77b@d}V9amhcxRXyb2E+^r%u?^0)A`#Nb` ztS8~crw52`d7(DRsc|y|gJL?C1|QcAxRr6V98*LLuiGXR1s$a=ymBm*l@s za*49{qse-B3u)L$FYma`9p>P;z4F0*d$${K9ja9v$N6#HC7mvJLK)3aA4CTHEt9WI z2s{c6^-Zu|bJSq(fFjjcanX65;yCk!;+CjmS!*-<>tO9iV)cnm;~<4C_zOD5SpItG z_dYYR=?Cn9ggg;wEzS9J!n%M|JGgy*LtB!D2bmwP=P9?<=rBP$*aJyO*+;4zfHxJn5@p7;L7SWqRNb382N)?yM4P4?WoRgF(U?)qqboC6*IV943T%2?Zm ztCc&}+JlOXw, 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl cogl-1.12\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-26 08:55+0700\n" +"Last-Translator: Andika Triwidada \n" +"Language-Team: Indonesian \n" +"Language: id\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.3\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Nilai pengawakutuan yang didukung:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Nilai pengawakutuan khusus:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Aktifkan semua opsi pengawakutuan non-perilaku" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variabel lingkungan tambahan:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Daftar yang dipisah koma dari ekstensi GL yang pura-pura dinonaktifkan" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Timpa versi GL yang akan diasumsikan oleh Cogl didukung oleh penggerak" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Flag pengawakutuan Cogl yang akan ditata" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Flag pengawakutuan Cogl yang akan dikosongkan" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opsi Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Tunjukkan opsi Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Penelusuran Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Rerefensi CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Acuan pengawakutuan yang mencacah masalah bagi CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Telusuri Pengirisan Tekstur" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "awakutu pembuatan irisan tekstur" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Telusuri Tekstur Atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Awakutu manajemen atlas tekstur" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Telusuri Blend String" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Awakutu penguraian CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Telusuri Jurnal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Tilik semua geometri yang melintasi jurnal" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Telusuri Batch" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Tunjukkan bagaimana geometri di-batch dalam jurnal" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Telusuri matriks" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Telusuri semua manipulasi matriks" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Telusuri Menggambar Rupa-rupa" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Telusuri beberapa operasi menggambar rupa-rupa" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Telusuri Perender Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Telusuri perender Pango Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Telusuri backend CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Telusuri backend pixmap tekstur Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualisasikan" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Outlinekan persegi panjang" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Tambahkan outline kawat untuk semua geometri persegi panjang" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Tunjukkan rangka kawat" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Tambahkan outline kawat untuk semua geometri" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Akar Masalah" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Nonaktifkan batch Jurnal" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Nonaktifkan batch geometri dalam Jurnal Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Nonaktifkan Penyangga Verteks GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Nonaktifkan penggunaan objek penyangga verteks OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Nonaktifkan Penyangga Piksel GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Nonaktifkan penggunaan objek penyangga piksel OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Nonaktifkan transformasi persegi panjang perangkat lunak" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Pakai GPU untuk mentransformasi geometri persegi panjang" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Spesialis Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Dump gambar atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Dump perubahan atlas tekstur ke berkas gambar" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Nonaktifkan pengatlasan tekstur" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Nonaktifkan penggunaan pengatlasan tekstur" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Nonaktifkan pemakaian bersama atlas tekstur antara teks dan gambar" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Ketika ini ditata, singgahan glyph akan selalu memakai tekstur terpisah bagi " +"atlasnya. Bila tidak, itu akan mencoba berbagai atlas dengan gambar." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Nonaktifkan penteksturan" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Nonaktifkan penteksturan sebarang primitif" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Nonaktifkan arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Nonaktifkan penggunaan program fragmen ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Nonaktifkan tetap" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Nonaktifkan penggunaan backend pipeline fungsi tetap" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Nonaktifkan GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Nonaktifkan pemakaian GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Nonaktifkan pencampuran" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Nonaktifkan penggunaan pencampuran (blending)" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Nonaktifkan tekstur yang bukan pangkat dari dua" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Buat Cogl mengira bahwa penggerak GL tak mendukung tekstur NPOT sehingga " +"akan membuat tekstur diiris atau tekstur dengan limbah sebagai pengganti." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Nonaktifkan pemotongan perangkat lunak" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Nonaktifkan percobaan Cogl untuk memotong (clip) beberapa persegi panjang " +"dalam perangkat lunak." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Tunjukkan sumber" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Tunjukkan kode sumber ARBfp/GLSL yang dibangkitkan" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Telusuri beberapa OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Telusuri beberapa pemanggilan OpenGL yang dipilih" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Telusuri dukungan luar-layar" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Awakutu dukungan luar-layar" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Nonaktifkan siggahan program" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Nonaktifkan singgahan cadangan bagi program arbfp dan glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Nonaktifkan optimasi pembacaan piksel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Nonaktifkan optimasi membaca 1px bagi skenario sederhana dari persegi " +"panjang legap" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Telusuri pemotongan" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Catat log informasi tentang bagaimana Cogl mengimplementasi pemotongan " +"(clipping)" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Telusuri masalah kinerja" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Mencoba menyorot penggunaan Cogl yang sub-optimal." diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/it.gmo b/po/it.gmo new file mode 100644 index 0000000000000000000000000000000000000000..83bb5a99dcf3ba077c4fb8e117a3285781058e5b GIT binary patch literal 8078 zcma)=ON=E~dB@9+3Aix<3=AaUaU8JQ&dlxU9#8Q2&J1?X%Qnoo$J6a`V1w%3d+zOH z*R3k5>UPic0=z+3!V)i8AQA}{@dCucVgUjHSy+Kh5K>lbk^mAfWr;wr2;%oY=hVH` zp0=UX)&H)l^Z3s9{l8cL&+WH7mvBAC{dVquyE#dw;E`AHi|Z$Uoh1JN{uEpRZ+Uf+ z+yUMT-UdDnz8)OJ=L-CLo<9b@1N;~8E#SAn)8LQd``5iDN#4ryVelUCEci}v3cd|| z7W`ZAc~JZOdwl<&;Olt)Ik*P?27Ci}=dH*Dz8BQ@Cqc=14g3K3Meq>#3-Ddw|AY5~ z?^p`^JOS$cM?mfW8SstZS3v`Q2Ye6s-{70Tn_rtG{|Fue4}DETI!_;MZ8ynh8H@3%qi_Y+WhlhJy>VNmDzAc#qlPlD3JbD;G7P8NOs zCinqronIrQ^!j=ZVZbvWDochSOD82Lxt<0!{tMvU;P*h;|CiuH;2*)G-~|pV-tT~V z{v4?FUj)VD-^K5@qYSNo6x2B$01+|yFev+#AWJ4+0Z)S8jo<$OzMJPIHvb^F0^R{W z11^JK1VAHm0yn{b0zVC&2fq(~7Q79kB2w}ta2@;xsPq0lzP}aa$bJUAAAA&) zex3m}?h7DGC0_ygNnVW4{|o9oe*h6Zxeet@Kkos>pNB!&{X?L>e+)$An>1oJPfXY{|w6hp8($rz5t4UzXb0EZzt$T{tMtq@M%!~_8st3 z;158}djg~11ip$}`(NZf&8<0xTe|OFI)mhwtxj+s=N9iItF9y5cX6Xmf4z_24|7Wg zl1tYH_xri;(*u|E*}bF>$tpWtjvpS3h}iQ>^2;WVa6iT^drDV|L%O7&W8Cti_L2^D ziE|gY&*_0nzOM_n@RwqT_#+$1f8`sbisVsl@%uI0y2Nqmz0a+i=WB*Xk>O>Wlb?_GMC%hjEl;o zS!O1-nA)bg{t81XJ8aT?GRx9x-*DHsB2P18^Bq?e`PAl(*-0yx4l-N!le5JnGaID_ z)!|{Yv_qF>u5QBfR+SE2J_!#aJD5!-JeqNqPHNK>rnYh50pDhM`*maRBm$bsj%{W0 zq19&7Y1*r8nO13IM@BoEVr(9|XzaDd=Cwr924!V=9GMi&j9e|jN69$}VkG^UjE|d5 zC81cWmaO4xF&@{$%G%u2v$8CzCcZ}qGc0C#qbaVgXHnByEy!8Nkqwf}*fwplv^LW; zPbXFyOwI*4Bq&2ZaG9_OdkU|i0J zwV$P*mJ7z^rrEY$2PUqwvX~*QbQc`Mqd_`+$_&%tc1ta7Vp4QF$?6P67n3TTE)Fr~ zXs9}hloxrgEOu?xE5^NMw=hvVi}3|Kn!3GIZ1UW#Y$_qlT6xVs*KS&7*3?5Qc5|4b zOg}QS(87}!M$UJO!bEZBueG8ny~?}0&A->%aGM>anf=xq*k)H;&|80IH^rKZ4eMgu z?22Q<%#~$Vb@MM0(==6@*Er^MzURJux)Z~P1K%LQbrg=e8n@GtVpik+W3ztcj2Tzy z#JlSac8P-?y4Yb-e78~B98v}i4Lm7L;eBs$()~ks0!?3eEIzlNPH~NwJ$m~cGk6x6 z@hl&DUX-r1if(Xz_!O(QYOFnzmusA@vD32gzAsytn&8)=h=|{s1j5gzP}uutYf!z} zCzu&-6B=P0(Im}{ABR|(P0r^&4*DP~eh=(+y5n$4eA34=7#d>Z#e#6>av47GI~@?F z&33UHJkaq~jx^yhQ}KdVR&EK z%JZ3gj4AkCQ3Qlf-seIv>Asoj45M%cTtkLcnvO$65YL)$E)sqBT=TDyu?kW*=uB*f zYPHQ2YhyGUa(M0Gf(viE$#%vqe;M?A8o*us#0 z*=~BhHVTRTg5F9Jc&!uo z@E|WHkF=`xv7$~cSB1*3-Xo*l)!^!V3_r=1u2|Jay-W4Pje2Khle)K6^v!nDl>MVe zskHWpJL$?K$2KcPH91O=YRZcTX9J45*~+k(zK&G$boMVB1>qaD1qE$^ORoC5-(}8>mec9L$%-cRyQvE4CmZD+rf}Yu z67Nv;q8m70+X=Or%j8c)j8PnSflj~>3iKtgFn%$kRLR`YZrJ1%N2#oD2VQX$($1$* zFGr}zlk>#ip}Gz4JcZV#q2XX&5KE5p9fR{(HB~sPNo>&ke2}kO*6tNK)QR2s(SKwE%ujqVazs91;!c-mkr4^~M?J5r1JjJH9JOx3KWnNZ? za1g2^FZ|0i8}n~?H1yoxZ?qrVLNPpJD4$uip=o29FZ09qPV;f&gf0n9zF0uYQ!I%+ zNSL_4ZVc~O!1o}UP`T1sQlO_#+ki|Ry`DM~=uThKRY9jC35&G>?xoF1cT%=oKrR}S zy;StJezz>eof^8kRC1_6kqo{wfn-#2BwsIK>p)J;3QgL+mFGu653x+2rri-Q*}2`) z*XP}Fhy#U2E(F5^sUWu_0M#TkypZOZK75}vn6<3~x&`u_{fZx~;hPt)3H0Bdj>s^d z)0In6)2Bgklj)&G>W(J zcN!xfimaKE!N!jN7pOdXX=GXtF?ErfikLm*i{xNc6qMu$uY|*o{$-O~u@llSOpd)& zNH~=vSy!XNWXtm|DmtqaG^aIUw->}_?Dk9 zsO)>KBlFb|mc!$WlrJi_S{j#jZ%@8L!d&Qq9TmYir(3jFBJ|v?T(UV#X*PyL8xmHi zx!Ay`saD{$k@KtS4PAFIJ+SM?7GhtRi7ed;<%V~Z_;0fKikRj9@dpLGn=Tfa`;=6(6|5L~w9c3|_03n) zKSrfh>W08eoqubp9X2FQMgW`2Z@9K%-|%+H${E8U<~kQZG~g87Cpqs5?1B1F)}+t7&1Qn#`q(lXbnT) z_Wt+~?V+Lp=MG7c>FBxj1^v^hTRq37Z||UT+=n67q3WdGjs?x4xM~~5y)=1jM#oa< zpGCMau6{(3Ar?f0j!8zuZ4Y6q7r#tMR@x8$h>qni;Q+CH;v_BvH#tI#hDM=qrj;iy nYBt)5g#{KOhAU=q#x@bGbo9L_h(r7fX^I7iaC3Kvk|ciue^_fR literal 0 HcmV?d00001 diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..84a9f30 --- /dev/null +++ b/po/it.po @@ -0,0 +1,367 @@ +# Italian translation for cogl. +# Copyright (C) 2011, 2012 cogl's the Free Software Foundation. +# This file is distributed under the same license as the cogl package. +# Luca Ferretti , 2011. +# Milo Casagrande , 2012, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-04-28 19:22+0200\n" +"Last-Translator: Milo Casagrande \n" +"Language-Team: Italian \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valori di debug supportati:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valori di debug speciali:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Abilita tutte le opzioni non-comportamentali di debug" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variabili d'ambiente aggiuntive:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Elenco separato da virgole di estensioni GL da considerare disabilitate" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Scavalca la versione di GL considerata come supportata dal driver" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Flag per il debug di Cogl da attivare" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Flag per il debug di Cogl da disattivare" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opzioni Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostra le opzioni Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Esegue il trace di Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Riferimenti CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debug del conteggio riferimenti per CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Trace di texture slicing" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Esegue il debug della creazione di porzioni di texture" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Trace delle texture atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Esegue il debug della gestione dello texture atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Trace di stringhe blend" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Esegue il debug dell'analisi di CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Trace del journal" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Visualizza tutte le geometrie che transitano per il journal" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Trace del batching" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostra come la geometria viene messa in batch nel journal" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Trace delle matrici" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Esegue il trace delle manipolazioni delle matrici" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Trace di varie operazioni di disegno" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Esegue il trace di varie operazioni di disegno" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Trace di Pango Renderer" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Esegue il trace del render Pango di Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Trace del backend CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Esegue il trace del backend di Cogl per texture pixmap" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizza" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Outline dei rettangoli" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Aggiunge outline a tutte le geometrie rettangolari" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostra wireframe" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Aggiunge outline a tutte le geometrie" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa principale" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Disabilita il batch del journal" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Disabilita il batch delle geometrie nel journal di cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Disabilita GL Vertex Buffers" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Disabilita l'uso di oggetti vertex buffer OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Disabilita GL Pixel Buffers" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Disabilita l'uso di oggetti pixel buffer OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Disabilita le trasformazioni rettangolari software" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utilizza la GPU per trasformare le geometrie rettangolari" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl specialist" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Dump delle immagini atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Esegue il dump su un file delle modifiche allo texture atlas" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Disabilita aliasing delle texture" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Disabilita l'utilizzo di aliasing delle texture" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Disabilita la condivisione dello texture atlas tra testo e immagini" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Quando impostata, la cache dei glifi utilizzerà una texture separata per i " +"propri atlas, altrimenti cercherà di condividerlo con le immagini." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Disabilita texture" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Disabilita il texture sulle primitive" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Disabilita arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Disabilita l'uso dei programmi ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Disabilita fixed" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Disabilita l'uso della funzione fixed del backend pipeline" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Disabilita GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Disabilita l'uso di GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Disabilita blending" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Disabilita l'uso del blending" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Disabilita texture non-power-of-two" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Fa in modo che cogl consideri i driver GL privi di supporto per le texture " +"NPOT, in modo tale da creare texture spezzettate o texture con riporti." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Disabilita il clipping software." + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Disabilita i tentativi di cogl di eseguire il clip di rettangoli via software" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Mostra sorgente" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostra il codice sorgente generato Arbfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Trace di OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Esegue il trace di alcune chiamante OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Trace del supporto offscreen" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Debug del supporto offscreen" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Disabilita le cache del programma" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Disabilita le cache di ripiego per i programmi arbfp e glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Disabilita ottimizzazione lettura pixel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Disabilita l'ottimizzazione per la lettura di 1px per scene semplici di " +"rettangoli opachi" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Trace del clipping" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Registra informazioni riguardo l'implementazione del clipping in cogl" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Esegue il trace delle prestazioni" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Cerca di evidenziare utilizzi non ottimali di Cogl." diff --git a/po/ja.gmo b/po/ja.gmo new file mode 100644 index 0000000000000000000000000000000000000000..321221e32f1ba2fc168ae514b5101156fba746e5 GIT binary patch literal 9662 zcmbuDeQ*@#ea9EaNnIsroV3O1OOhu|{EAOVn8daWiFvUdJ75SB_PA{luTHDe;(PP% zodj;0>h8b@P$FIo*a%y~#vs55V#hTY2>rLyrtM#y%yil&UEN8V=}c#uf7+RJrk~&Q z?B4B3LS)(u*@r7r_U>Pk>v&Pl4Uxy$AjQ_kRI?4jcu47rYFv2LC>M{>j@c>kjUhf%k&zz|Vsj z@U!4B_Id2rLC6V zGJaSJioNdwMV?jQ?|@w(f0oOS$iE#FIfp@(u-*Y>-w#0<|5H%b`8QDf_+KD@)>51; zcqb_9uLOS|+yIJvDNy*b1C)8kL6P@EQ1<&dD0UO4C4gn1=_Q3g=ewZD@zVp79VjEX9u&P^PH-TrsuY&&# ziau=wqv+cYCc(b}W&h;_yFCBn5HEnwaepgLTY|m614Ea20p}d>H&Y@K3?pzGPWXfe!cxcoEzP{yX?B zu!Bv7hr{3$cm!Mv{uv}*0)CWJ{Jw!x{3>fGPLUygFirE4ZFPJL*Ph@Mo5&%Y6ghE| zKEB4U_*Xb4`pO~x6j>jX8xCCFbhLBV!U@&14dvyd^1~svj1J+$?VL|?ijHeI#a5Ds z6+j@OxVqY!^8+}Ob_zEYq)po<}*2g%X=DeHpHcmO#ao)$- z!Fey|a!&D!9KstpaDjD;zOpRJgw9i9dpRV>MaS2<5TAXMQ#b%sty?+8->sY<;S}x* z->fw~J!-)99F;2;(r(uARd3Eyb~>$6PA=mVyd8@S@tkDA&ZdfK+iM!`7TjFcPAezd z?|Qjx#>o~`zwNnpciQngtaZ6mT5Zb9Am7|{=AEQ#r(M5b?z=oY>1I>rrpM_nrc&Ih z-n5#z6jo9trtO*NWV7C%g%x)La~-FvYNNK-d;cHIZjsj#e6>J z6~gBTp^~{`wjfhn-!F!imeq`$emJs#Bt^Eh3u)U|89QsI9I>Fa-pC=sZg#gjX|=Z4 zi)PGgym-d(n7_cA&JFcpPvwf9c&FPgB>S}F;e6Zc?#>Z7S`jF?25F*_nnCy{Lw%Ly@w%Y$Bfv@M?}OXyD3)pVUbj;i5H845t+SiKn~e?qTyJ4OIF?Mi`Fz}T z^*17>DtLC*ConVhJ)8E4Pc$zUe1Zf!FgWHaxcxCHiaz1rtJZ8;t9m^jQs*-mYI5U-9O=%@isKEx?QYVv>dOt7 z2y}TXxP?A7VEYVnv;5jUt=1+}RbrO3HnF+q_7EyY z9Bw7;n(eg6dPAEWi3?;emCc{JO-u!Z5Eh-hg zB%zk;3Fpb&MrQL>wc@G`KRJYA!OS6+%!dy$$BwR8CQdqu1@AcbhvU`WsX$k;K z8LvjqrMNk2jiyhRN%p>F9;dY}|pb34Bf zn&)}P(|o2L;|hK~ngH`k$DBzf@h2J4p~vVzXozE_Oou~+AeuEsFA9BJuln1Nv67_b z*-Y3D)qE!{xi-vZNtBm8Tob~5ZmKWMDe=;s&}D#d)f*Rma(b(^l`N_$y?Lv|d?8BN z5%-(Bq-R`bKxY7%QYT>^)(ZyeK5*1boKzi?m2DIo7j%Qd0UP`VrkRft^b4 z$oHAbWg^y257;|=B}vg{lxcaQXw{X`CEw{R)~YrkhBx3cHVSw;Kiz3j+l*c&-{~MX zNw3v1ycP{~dXOlljzp%`xx%+LdpT*t5>NIdo-v``f#c}_GmWfY`z|k9lPUM>)Ty3gvamXtE|S8% z7Lr(Eo#ZNnNvtPjb*L3>?JE;)4<_1Hs`ix~53F3)*51~}z{D1(-<8zU7`GzP_Hbgw z3f1;t$5+~xwLQ$Z4M>@QpIIOB=e!Q}wCne|IrVt4kmEwF>Ma(&n|1w1dmd=*VX@Y% z)4DDHHRjP6LySb1V`n7E|TlJ;O$hkB^nEwpS-OSMTn zPGRvoR5q_~{nhP{D08{G?U5EMD7_YxE(fJkL1{85Ukb`+gUX4ZG89y}xGE1T7lQK1 zp!{Zd%SHK=9&kpUSKbTC2WPHdtL_~SN=JjzPh`Qta?`rgV`r+@-u$&T_%&CLHk_P3 zc(M9srFwEt?eN9$n?vt|@JEC42SMdD5?VTfgYxB|a!fybOSF^Qq41TciOTPYjxr0S zF2-K%4l4VDN`;3(<#13z@r!6(8{S==JSO^<_uX{x%;~pgUppBa9DcVTZFQtPz3a3^ z(XQ<~QN8+pP&yZst_P(d)(uL-)uA)fuS`r``ayN%!c65_P(t*wR`Os_J}0tP-Uv#k zt3xl(j$&kdFxISI{5ytuNK$)aKk^5am|ji36A~O21C=j?JP?b#A5>l!17WE}CX21Z zZyi-vP6QR!AnTAkJUlXcVtBDtG~e(Drp8S#iy(4Q3M%+cXgNK3VtPN%Z>$CO3@Wea znOA}ehSDw+z2LWAV&{qK-pkeDBVzj5@$$6nu-G8l3)#6oP2$DKQ`sBap;X;{N@R-< z)g4OnY(q*Db+J{dFYjXJ4MNdK7i~~JXk^iZiN{{$h~_fZ-W`-Nn9zAaaVBULMJs}( za$W{u@X9#rRWIm3F7KPV@>Xs1dQd*EH6;Xyj<;EBwj`{?{&jOSg@1MQLt>+LW=t4c zIiNEIdqgQCZkiP$*^e(wT|PQ>=9*`mx=pP3ChXo= zn>eiRDZw72Rqe>`>UrEbG5yMwYGs6Xvquhz=<_WhSviUl!fMx#YRC87SnM*cAbk)w?V0y!8bAv)Yd>h$YYMf3+bD2Lmb?y3M#5VC#y4kR>zie{I2 zbHgLl{akf&Z00R05M^>$cZEB#Ow3kco(MC$>?L)hR@qe@{}GGNOuRZf{BD!D;mW3f z>jFTX4c9ku+g#hrJE=KAc_b+BMMzTV?CG5(aokFaBk~WEzA+Hjb0!{~x^}!av_D*2 z#3rVw!{>s*lI{lfL=}iSN(V4({vER5QcdlSG)GWE#L&NFV<~+zgO%DYDhh9TPLac6 z)LH5cl2boNgYqHW3rnVL?wKQk!jQQ_Exa?@lqMpE4o_W~thb)>-yZFBt(3GR((@vo z?&T?a`gvG-2_fCC*2XW_j=wW~Y-ja{W7W~|M*BLCE;A=4rcY9c^|aVOT4YNJElMVR zA{m68bnSU%O#47g7R}|l{#_sm4@#1MDO_BLALcev!hEErEJdwOGask-{$=gGl6W8# zu4#jLLQ!k=IE)QrqHh@~g}ULFh9?>^z2|aui2eq_8Zi`oUNn0~46^X3SW%wOQVAI} zH=i1p5owO1&99?gfT#6TEorc64HIGWw`%Hs$rIQULorux*_>CK7M$mg=KX@w>nt;M zMOwAm$Ox%xu0-bFG+IlTF{s;0X}OzsnJ=+);3h>h%1HB^SniuS!MD-T+Myp1_CoiV zS(_5j{OmPX60_3Wr<$jWeg@4`sNq=2qkQ5>@AhW(dS!O})#})orLzZ(3mKnyo{att zHE-vbfoDe#R8R7idDd9^=ITaOOfBq$MGW=-=g}gI$5o##U8?QnqZKxe#cWVL07u@d z?k3w%v2N_pNJG}N#kcs7fDyD?~X@YrmLj}fy%qfqNcuQ~56n7-sA|I`urC=E)| z^v_J3*O`7eD%)qP<3FzMAEKlM<%>Fl9v1q{{RX+ffa;}7y39+oHhoZY8!4x=9dWr} zHPxMPOkWB7GQ}tSObaC`$zIX73Ux7-{;;U|CJ~34VoY-uH{b#r*K+`E0v)j~>B5Fa JLT*~(e*vFu9m@a! literal 0 HcmV?d00001 diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..fdbb0e9 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,369 @@ +# cogl ja.po. +# Copyright (C) 2011-2012 cogl's copyright holder +# This file is distributed under the same license as the cogl package. +# Takeshi AIHANA , 2011. +# Hajime Taira , 2012. +# Nishio Futoshi , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-22 07:50+0900\n" +"Last-Translator: Nishio Futoshi \n" +"Language-Team: Japanese \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "サポートするデバッグ変数:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "特別なデバッグ変数:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "すべての非ビヘイビアのデバッグオプションを有効にします。" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "追加の環境変数:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "GL 拡張にみえるが利用不可能なものをカンマで分離したリスト" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"ドライバーがサポートしていると Cogl が仮定する GL のバージョンをオーバーライ" +"ドする" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl のデバッグフラグを指定する" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl のデバッグフラグを解除する" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl のオプション" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl のオプションを表示する" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl のトレーシング" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject の参照" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects の参照カウントの問題をデバッグします。" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "テクスチャースライシングのトレース" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "テクスチャースライスの作成をデバッグします。" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "アトラステクスチャーのトレース" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "アトラステクスチャーの管理をデバッグします。" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "文字のブレンドのトレース" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString の解析をデバッグします。" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "ジャーナルのトレース" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "ジャーナルを通過するすべてのジオメトリーを表示します。" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "バッチ処理のトレース" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "ジオメトリーがジャーナルにバッチ処理されている状況を表示します。" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "行列のトレース" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "すべての行列操作をトレースします。" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "その他の描画のトレース" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "その他の雑多な描画操作をトレースします。" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Pango レンダラーのトレース" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl の Pango レンダラーをトレースします。" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Cogl テクスチャーピクセルマップのバックエンドのトレース" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl テクスチャーピクセルマップのバックエンドをトレースします。" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "可視化" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "アウトラインの矩形" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "すべての矩形のジオメトリーのワイアーアウトラインを追加します。" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "ワイアーフレームの表示" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "すべてのジオメトリーのワイアーのアウトラインを追加します。" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "根本的原因" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "ジャーナルバッチ処理の無効化" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl のジャーナル内のジオメトリーのバッチ処理を無効にします。" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL 頂点バッファーの無効化" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL 頂点バッファーオブジェクトの使用を無効化します。" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL ピクセルバッファーの無効化" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL ピクセルバッファーオブジェクトの使用を無効化します。" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "ソフトウェアによる矩形変換の無効化" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "矩形のジオメトリーを変換するために GPU を使用します。" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl スペシャリスト" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "テクスチャーアトラスのダンプ" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "テクスチャーアトラスを1つの画像ファイルにダンプします。" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "テクスチャーアトラシングの無効化" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "テクスチャーアトラシングの使用を無効化します。" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "文字と画像の間のテクスチャーアトラスの共有を無効化します。" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"この設定が有効な場合、グリフのキャッシュは、常にそのアトラスのために別のテク" +"スチャーを使用します。それ以外の場合は、画像とアトラスを共有しようとします。" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "テクスチャーの無効化" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "テクスチャーと任意のプリミティブを無効にします。" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "ARBfp の無効化" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB フラグメントプログラムの使用を無効化します。" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "固定機能パイプラインの無効化" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "固定機能パイプラインのバックエンドの使用を無効化します。" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL の無効化" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL の使用を無効化します。" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "ブレンディングの無効化" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "ブレンディングの使用を無効化します。" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "2の累乗以外のサイズのテクスチャーの無効化" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Cogl はスライスされたテクスチャーや代わりに無駄な部分を持つテクスチャーを作成" +"されるように、GL ドライバーが NPOT テクスチャーをサポートしていないことを考慮" +"しなければなりません。" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "ソフトウェアクリッピングの無効化" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "一部の矩形をソフトウェアにてクリップする Cogl の試みを無効化します。" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "ソースコードの表示" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "ARBfp/GLSL のソースコードを生成して表示します。" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "いくつかの OpenGL のトレース" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "いくつか選択した OpenGL の呼び出しをトレースします。" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "オフスクリーンサポートのトレース" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "オフスクリーンサポートをデバッグします。" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "プログラムキャッシュの無効化" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "ARBfp と GLSL プログラムに対する代替キャッシュの適用を無効化します。" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "ピクセルの最適化の読み込みの無効化" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"不透明な矩形のシンプルなシーンのために1ピクセル読み込む最適化を無効化します。" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "クリッピングのトレース" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl に実装されているクリッピング機能のログ情報を記録します。" + +# ROIとは違うのかな? +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "トレース実行の関心領域" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Cogl の使用時の最適下限の強調表示を試みる" diff --git a/po/km.gmo b/po/km.gmo new file mode 100644 index 0000000000000000000000000000000000000000..1e62d41f6c815fdac28ac349cc57887de16f08cc GIT binary patch literal 11794 zcmcJVU635tRmU6KILX=$NysO`$qo51j+xc2EMj?WC9ys%3rmqA$qH40g5H^)*|uh; zhwdJ&Y>KLtEhn*qWy?}zOLk^AN(@wrf`WorE<1XGDjui;swfj)2sIAmDZEkODyo3r zIj6g)XLe?GaYC1R|J}FmJ@KF*)#{IzR5&j(+)jz1jkde8d> z@FU{`bIn@Xx?^fIkFp2mdpBe%o8ojr%*n`@t`Q?*)G!{4jVGyc7IBDD%Ak zZPvaOl=%;X?*xy74*VVPV_*;bS@18wPlDeAZv(HHF*{~Kk$*3^1FVB0=Ubrk`wn<3 z_&T^9yzvIl`wF-Rd>8mPAdkF0DC2$vejNO7Q0)B}&fwBJ28y2-LGfn{iXXoMz8hQv z-wyscDEj^-D0=-PDE@l`l=-gbM*4pMl=#eoGH!o{Uj#+&gP`d12qN`62E~7mf&cJRp7(9=H20?n-k*TiBm5KK74W0rKZ9GqYf-WZ z-k#waco+9KVbnfwA9xTv2mTTG1MnpH3`RW(-hgwM%DV`5!9M`SZy$mT-vwtu;mMD{ z^WfVtmM-2m!Cwbo2LBy=AEfwA@J7fY@>}35;19u_;N_q5yffgxf)SWP`n$n@0j2*( zNTL(qC2%+RPMmiYJO;iFzUM=p_XY3`@I~+t&ip&@KR{{!D`)zC7-hv@{{&tHpCTBq z;m=!f+NZexADoN|-lqtP`04YY*!?8o{bAX9s9fcwGs-r{);unOJ>{x$d+ z@ZG;?b{qvi&;42OPVfid9C$NimVTcDL+}hJ^54kt=1+RwFLS>W{3Y-tcmaG76hGX3 zo97(?Pi6QTxWfIdbQV8+8 za>@Z^^!RE1Zs(Nzx|dUUfZMeG0Gcm?Vvii6*EO8GIK`K8yoFQvwwH5(Qw~C?$L;*R ziBot1o%A4#-nE?X;Djm~J6z|zmGe4I!lU^nzWX%i^_+x8IR|J>!IfHrp^oOL`2Vw< za?Ehvr&q?0w{Z<+HMi!ob^&Ov_393g(0Y3~<$$is;S>@ben!W=)NmzG~K~Y8b+x1Gw6FiE|`y_02@LEz0gkBgE zb^PDz21HKT(=5r#l*!aBrVxp)qb@JcRyKVvsINu%%UP4qJYs zG+`3e(`6s}SDRs{Q+8ePMAUR??6(s#qgBi~G*5Y;Js8`91`pwI+?9qWN?LRi@~`gh zIlR-=W53Y~+UfeZWS#czFEJ@=JJ<=@kkUM~sHAj}rpF*m!(C4pO{e#T>%(-)WK1$W zQCi-T;QKUaby7`cajZ)yC8c-^i*x_N-fjy%YPj;~NXyVHuDV2_fj*Q6zwNZ2tB1|N z+tZeuWKK$!kaaOw@=t_h7zw8J1G-r)+8=0xe}J`FflT^q~Y~!|An{P{ytn1xfpsG_NY|bB7Kd%}q!!*2aV>#TG@WKz>R} zG{b688+4=cW>zQkOPAcTpU^FA^VhG$QiB{xmLAxIUu!;D}JiL*vw5)6sMlR!J{u)GO@vZnf zFE7@v31DfO_0*P@s8lnR;Hkt(mrWZ~6nayWRj#aN@ib2q(tn)`gnFc25;UcXWp$#8 zg^Bk7MMpV&=mE*9G_Ph=iQMa+A@^X?K3zII3{=S5%}!!rB)C}$*h#1Pcwjx6KhfBXyCUN-2L)U zdUjAXozQo|%^cWwV9&ro^Rsg^yCN)YGx_fj5{1=sHAZL(wjE@ziJ=I)yL)yiJ0CSu_iqPRxy zM&RaVx4Xl;=6Rf3wcw7oD)-+vr~9jq^n1^}zVcQ6^?Q$K3;9Dww%(IRl4czDxI@Fz3+&eRU3$?Oa0!Ne(#EOkVj8hHyw3WT2{Y=%zp23zlXH1 zj#uLUO@k-Y&gap_{`GrbMkiJ7G10a6O24%3rwEn9G$iQX52R>Yt;q$OO&#Qke$sm z5UQb*r96=#ZTTz4Y6p})lf{Zcu?ihYYBXaSt11@yXSEt&04m}uNj|L-dA97`uYT&i z`H6FN*U$Ym)emi$*s>6g(G5$U@As}UaGEykA=%Imd!-x*%TvfFQi^|?H$r@!$tXy$ za3mJLkmnuAZfRQ-Amcs3g|g2LW_9-Fxk)YhJ)z*_5`OfO84a_&$FHgC{K zlDhut`GGar1QG))dW3=Niz7WARe$L-T`zQ4L0_WB7%5WPUYf9Ysa6&iMVj7Ox@hWJ zJB5~LU>6>{VqSI{HJVQA3;2jqERwM2(nu>Z!~h-ntX^MGtu83-&B(#Bldo*HI9h@{ zt)pmR$nzu8SM-@lc}AVWe8Ss)?@#siqFz6**O$50TcaC(!DTE^Hhg_p%fc;n&k?O} zxPA{qt`rIDXh7DhO2M*;NXK*(x7zi%&Mm7|uE*Fll`>!)wJ9Yq-Y~o0Wb}1NZ-qC@X|CMHDT;};H6F+8ENqj3DM?_YnR3ctNOM?Auo|e=y zI*^uRqb-e@tF;??uje39GkV$*h^e*?!#HZuSy#|qryPy(6x~sc39}5$UAK|n^L~Yk zjizR}X*fs}?Oar=F+`$+_Cf1xCCOV*Zj37H>X42$L-H&YqezpimTLmg;mrrZ8|HO+ zvJrY&n1&+wV-3!IQFsu~+V1exd_zRueizcH8{i^O;TA3Drc7KE7OF~djniPOMFSJZ z_+ICrKXb5S$Y`!bCEo<_{o}`(Rx)9u)wQQEOFu36i{YsG$6liiFl$D9z?mBc^>t;Hi~qv?*fA zl0@TL`6XUuX0+}1Uer8$Ne!^q$H786ZpR5#$9#yn&|hU^z^uQkOhJR<6NG7yeHqZX z*K{+?TTEUlMa2s_8I`lLfjLj-oVG;;lXo92bXIPQS0Qt=dDO1O1zzrddoZ$aX1m~g z4#Lg;ixmd#*;tsTWrM9sBXkUn^%2~)U2L&pstvlb$!`hj61280yG|e$XYc$fViJc+ zg7l{c9d!zc##7c_R3?`44qXV+3o60Oc^R}_+|YpkY8(xAvvoXV@uS)S#(q_^31_Mz0;n~NOqI; z0}49%sf9;{kJi*+dm$N{XM<^!Ig`e&XeD_<^(g4eQf@Yugp_{2k+_PB?L$Y|^@Vzf zl@LyvRpsW{v(X#9`aj8@AQt7?q`56BR38$Q3ZNfY`>Pjps!i0>al$6Wa5VGbvdm+CHV00s z0~;?z2wG9*TB#ceUU`lpb1hng{}uc(q6nTLl12xM_Q+@a%QBzzVJ*8fG8jcB)ym=< zT0Xg?=0#1Up`ZLlByN^QWZTF{N&u9g8p3gNjTJ15HFfjZkpWYbFOqQ0YJ}5Y@J7bx zHD|C|BazxRb_v2wY}R<1Ee7`OL~F+Qg|;lqu4SFm0a=Vk)EPemoywBdF|+s%?Z%7F ze{=zp58$zM1uXgOIAm6Su1)?!gO_sJbrN`d{YjypMs9`oVv|q$Ic`wm z)Z0Z#8C{n#ibyb@t!UG7Lj|oVKkQXvx&~v?LnS~Uy!4!2Z?CkYMvI($H7u&rIOWgoLhc>fEGX!chC literal 0 HcmV?d00001 diff --git a/po/km.po b/po/km.po new file mode 100644 index 0000000..e6ff96a --- /dev/null +++ b/po/km.po @@ -0,0 +1,368 @@ +# translation of cogl.master.po to Khmer +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Khoem Sokhem , 2012. +# Seng Sutha , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl.master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-01-24 11:14+0700\n" +"Last-Translator: Seng Sutha \n" +"Language-Team: Khmer \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: WordForge 0.8 RC1\n" +"X-Language: km-KH\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "បំបាត់​កំហុស​តម្លៃ​ដែល​បាន​គាំទ្រ ៖" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "បំបាត់​កំហុស​តម្លៃ​ពិសេស ៖" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "បើក​​គ្រប់​ជម្រើស​បំបាត់​កំហុស​​​នៃ​ឥរិយា​ដែល​គ្មាន​ទាំងអស់" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "ទង់​ជាតិ​បំបាត់​កំហុស​​ Cogl ត្រូវ​កំណត់" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "ទង់ជាតិ​បំបាត់​កំហុស​មិន​ត្រូវ​កំណត់" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "ជម្រើស​របស់ Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "បង្ហាញ​ជម្រើស​របស់ Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "ការ​តាមដាន​​នៃ Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "សេចក្ដី​យោង​របស់ CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "បំបាត់​កំហុស​បញ្ហា​អំពី​ការ​រាប់​​​សេចក្ដី​យោង​សម្រាប់ CoglObjects" + +#: cogl/cogl-debug-options.h:39 +#, fuzzy +msgid "Trace Texture Slicing" +msgstr "ដាន​ក្នុង​ការ​កាត់​ជា​បន្ទះ​នៃ​​វាយនភាព" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "បំបាត់​កំហុស​ក្នុង​ការ​​កាត់​ជា​បន្ទះ​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "ដាន​វាយនភាព​សៀវភៅ​ផែនទី​" + +#: cogl/cogl-debug-options.h:45 +#, fuzzy +msgid "Debug texture atlas management" +msgstr "បំបាត់​កំហុស​ការ​គ្រប់គ្រង​សៀវភៅ​ផែនទី​​​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "ដាន​ល្បាយ​ខ្សែ​អក្សរ" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "កំហុស​ក្នុង​ការ​ញែក CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "ដាន​ទិនានុប្បវត្តិ​" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "មើល​គ្រប់​ការ​​ហុច​ធរណីមាត្រ​ទាំងអស់​តាម​ទិនានុប្បវត្តិ" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "ការ​ដាក់​ដាន​ជា​ក្រុម" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "បង្ហាញ​របៀប​ធរណីមាត្រ​ត្រូវ​បាន​ដាក់​ចំនួយ​ច្រើន​ក្នុង​ទិនានុប្បវត្តិ" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "ដាន​ម៉ាទ្រីស" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "ដាន​គ្រប់​ការ​ធ្វើ​ម៉ាទ្រីស​ទាំងអស់" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "ដាន​គំនូរ​ផ្សេងៗ" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "ដាន​ក្នុង​ការ​ប្រតិបត្តិ​ការ​គំនូរ​ផ្សេង​មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "ដាន​កម្មវិធី​បង្ហាញ Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "ដាន​កម្មវិធី​បង្ហាញ Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "ដាន​កម្មវិធី​ខាងក្រោយ CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "ដាន​កម្មវិធី​ខាងក្រោយ Cogl texture pixmap" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "ធ្វើ​ឲ្យ​មើល​ឃើញ" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "ចតុកោណ​របស់​​គ្រោង" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "បន្ថែម​គ្រោង​ខ្សែ​សម្រាប់​ធរណីមាត្រ​ដែល​​​ជា​ចតុកោណ​ទាំងអស់" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "បង្ហាញ wireframes" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "បន្ថែម​​គ្រោង​ខ្សែ​សម្រាប់​ធរណីមាត្រ​ទាំងអស់" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "មូលហេតុ Root" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "បិទ​ការ​ដាក់​​​​ទិនានុប្បវត្តិ​ជា​ក្រុម" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "បិទ​ការ​ដាក់​ធរណីមាត្រ​ជា​ក្រុម​នៅ​ក្នុង​ទិនានុប្បវត្តិ​របស់ Cogl ។" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "បិទ​អង្គ​ចងចាំ​បណ្ដោះ​អាសន្ន​ផ្នែក​ខាងលើ​​របស់ GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​​វត្ថុ​​​អង្គ​​​ចងចាំ​បណ្ដោះអាសន្ន​ផ្នែក​ខាងលើ​របស់ OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "បិទ​អង្គ​ចងចាំ​បណ្ដោះអាសន្ន​ភីកសែល​របស់ GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "បិទ​ការ​ប្រើប្រាស់​វត្ថុ​អង្គ​ចងចាំ​បណ្ដោះអាសន្ន​​ភីកសែល​របស់ OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "បិទ​​ការ​ប្លែង​ដែល​​ជា​ចតុកោណ​​​របស់​​កម្មវិធី ។" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "ប្រើ GPU ដើម្បី​ប្លែង​ធរណីមាត្រ​ដែល​​ជា​ចតុកោណ" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "អ្នក​ឯកទេស Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "បោះបង់​រូបភាព​នៃ​សៀវភៅ​ផែន​ទី" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "បោះបង់​ការ​ផ្លាស់ប្ដូរ​សៀវភៅ​ផែនទី​​វាយនភាព​ទៅកាន់​ឯកសារ​រូបភាព" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "បិទ​​ការ​ដាក់​​សៀវភៅ​ផែនទី​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​​ការ​ដាក់​សៀវភៅ​ផែន​ទី​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "បិទ​ការ​ចែករំលែក​​សៀវភៅ​ផែនទី​នៃ​វាយនភាព​រវាង​អត្ថបទ និង​រូបភាព" + +#: cogl/cogl-debug-options.h:126 +#, fuzzy +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"នៅ​ពេល​វា​ត្រូវ​បាន​កំណត់​ឃ្លាំង​សម្ងាត់​របស់ glyph នឹង​ប្រើ​វាយនភាព​​បំបែក​សម្រាប់​សៀវភៅ​ផែនទី​ជានិច្ច ។ " +"ម្យ៉ាងទៀត វា​នឹង​ចែករំលែក​សៀវភៅ​ផែន​ទី​​ជាមួយ​រូបភាព ។" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "បិទ​ការ​ធ្វើ​វាយនភាព" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "បិទ​ការ​ធ្វើ​វាយនភាព​​ជា​ដំបូង​មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "បិទ arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "បិទ​ការ​ប្រើប្រាស់​កម្មវិធី​បំណែក​របស់ ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "បិទ​ថេរ" + +#: cogl/cogl-debug-options.h:142 +#, fuzzy +msgid "Disable use of the fixed function pipeline backend" +msgstr "បិទ​ការ​ប្រើ​ប្រាស់​កម្មវិធី​ខាងក្រោយ pipeline នៃ​មុខងារ​ថេរ" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "បិទ GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "បិទ​ការ​លាយ" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​ការ​លាយ" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "បិទ​វាយនភាព​ពីរ​ដែល​គ្មាន​ថាមពល" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"ការ​ធ្វើ​ឲ្យ Cogl ស្គាល់​ថា​កម្មវិធី​បញ្ជា​របស់ GL មិន​គាំទ្រ​វាយនភាព​របស់ NPOT ទេ ដូច្នោះ​វា​នឹង​បង្កើត​" +"វាយនភាព​ដែល​​បាន​ចែក​ជា​ផ្នែក ឬ​វាយនភាព​ដែល​មាន​ភាព​ខ្ជះខ្ជាយ​ ។" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "បិទ​ការ​កាត់​​កម្មវិធី" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "បិទ​ការ​ប៉ុនប៉ង​របស់ Cogl ដើម្បី​កាត់​ចតុកោណ​មួយ​ចំនួន​នៅ​ក្នុង​កម្មវិធី ។" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "បង្ហាញ​ប្រភព" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "បង្ហាញ​កូដ​ប្រភព​របស់ ARBfp/GLSL ដែល​បាន​បង្កើត" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "ដាន OpenGL មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "ដាន​ជ្រើស​ការ​ហៅ OpenGL មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "ការ​គាំទ្រ offscreen ​ដាន" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "បំបាត់​កំហុស​ការ​គាំទ្រ offscreen" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "បិទ​ឃ្លាំង​សម្ងាត់​របស់​កម្មវិធី" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "បិទ​ឃ្លាំង​សម្ងាត់​របស់ fallback សម្រាប់​កម្មវិធី arbfp និង glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "បិទ​ការ​អាន​ការ​ធ្វើ​ឲ្យ​ភីសែល​ល្អប្រសើរ" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "បិទ​ការ​ធ្វើ​ឲ្យ​ល្អ​​ប្រសើរ​ក្នុង​ការ​អាន ១ ភីសែល រូបភាព​សាមញ្ញ​នៃ​​ចតុកោណ​ស្រអាប់" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "ការ​កាត់​ដាន" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "ព័ត៌មាន​​កំណត់​ហេតុ​អំពី​របៀប​ Cogl ប្រតិបត្តិ​ការ​កាត់" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/kn.gmo b/po/kn.gmo new file mode 100644 index 0000000000000000000000000000000000000000..f28c98a16813664e07d37929523ce3f1c46185d9 GIT binary patch literal 975 zcmbtS%We}f6dj-lDPjX#Kr-v%WTr_)J8ht%4^+{rQ5z6D{%33;Ty&!&?~*c?Jj~Tn@(zzQU5@Duu5#oL zN#u(4SgyIMtnuvUYD?KI0+H4(DMt5PL3E^z7=0@Wx< zFZY#<2a#?@*+9E&t+h6tSDd*%=mOI`Boltnp#DYbH%QP3>y2?g@O=>JI^Rm2o)Isg z{xtO`Nl*{{`nW$?_bV$ulbzfafj(@Bzu=| zN+bi8aN6dq7m{mC2o^Ik+ZA(J>e?7lLedqL)#cU2(e(sXzcMe;r$FiZee|IDJzeW( zEEO{(>M(_?ZeDLM(Ww#7NxaP!T@;aw@oFKN+DvujCcVl9S3~V9vdgk`o0FhAQE6oZ z#WK1iRWA>T=$CHZoR}d)vnj~=CJAOL!zZ`qp*8Pp@!XnSTfpA4rm)41XU!*DJhkS5 zHT%|lvF4*SZ*B3&@tpe}Bx??azrt~fXV!cm*1Rdh2iAOcB=ZsmcK1s9@X)K$9u)!$ r$Dsf-a)OGw#qXk~%(Vaih06c?_kJPT)yKR8t, 2011. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-05 13:03+0530\n" +"Last-Translator: Shankar Prasad \n" +"Language-Team: Kannada \n" +"Language: kn\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "ಹೊಂದಿಸಬೇಕಿರುವ Cogl ದೋಷ ನಿವಾರಣಾ ಗುರುತುಗಳು" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "ರದ್ದುಗೊಳಿಸಲಾದ Cogl ದೋಷ ನಿವಾರಣಾ ಗುರುತುಗಳು" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl ಆಯ್ಕೆಗಳು" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl ಆಯ್ಕೆಗಳನ್ನು ತೋರಿಸು" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/ko.gmo b/po/ko.gmo new file mode 100644 index 0000000000000000000000000000000000000000..77e26ccb07fea6d7ada9f2f7f73f77587f9df89e GIT binary patch literal 497 zcmY*V!EO^V5G|soJ#yyY12;MwZ&;PoX`mu)rK&_k?ZOqg-oY{PdRDf#D*Q*krGL|J zVKzuajPzt%^WONqd46^Hc)<07@tX05@se@G7;DCO;^qmTBj;bOBmG2^;i`pi7?Y!* zgdyuir&GpQ++a^J!zx+V!l%I|Xh?}o&b^vU?gsnYd9On{x~BkIimz`4$-#8g%_$oC*?QPt{Q{Z>{|G7)a@-i?0tyb7u*$YYl5 zcqh#J%r2pcIwY?%MI~;Lf`ttoiRFgGX{+PbxM)0naY@fy%Z8v69VLWwOEtE<(;eq~iDizRXPz;=H1oGar)p7dV3Fc)T{ zW5T@n+FZhH&l_$3zz7$?Q0szKVs__pvGzmM9xf?%Nr}+!o@r6d#oy~f&WnRTN#~Wb literal 0 HcmV?d00001 diff --git a/po/ko.po b/po/ko.po new file mode 100644 index 0000000..8afbfd7 --- /dev/null +++ b/po/ko.po @@ -0,0 +1,358 @@ +# Korean translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Seong-ho Cho , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-12-06 20:34+0900\n" +"Last-Translator: Seong-ho, Cho \n" +"Language-Team: Korean \n" +"Language: ko\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/lt.gmo b/po/lt.gmo new file mode 100644 index 0000000000000000000000000000000000000000..7e6364e3ab5a7218ecdd606f8a5ff0fc0d622f82 GIT binary patch literal 7977 zcmaKwTZ~=TS;u!mXu(aPEyPfu?J8}Y80U;52R{D8$OJwOs(%BNoHxOj!QTcCg5Lu_0{$QP zEcl@VVV~DPeg6!o{l5UdAN)hmfPW5t9Q;S{$H0f*lO#U}9t4koXF%yQ0=3R9@EG_O zD80W8YQ2Lfa|C=6JPh6dPlBHVe+~Q^_yO=VN}K_&gKU|+32OfDfsccK3`+lRgDjmK z_>tg;gP`nv2$Vdhz#j*1fczwmUy}bOC^_E%St9ugsC~ZyYW%lAt@F>I{P=y4pX4CU z7CsJY{S)9%ftNtZHvq+#ZBX-m2b8?u0JYzDLD@}C>i|bU>GAU*E=hhJlpWp#W$zEO z==UFjAE4Gdh48Z9FM#69=RwKy7O4Hd3Sz?KFG2bL??CPQpCCWUV<>k4JPfM80JZKH zz^B1GpvHeM;=3?{#vKB+&nH2Re+@*Hqy-niTcFneDky*cReXO4(jDUcG4L0`Q=sDP z%b@J=b?_|sFQD`}gi%j`7eMjiEivG^%)4b*zS3myl*1^z1d5Kfg}KhH0X+X2}s`3{I`$$x>`?@@wX z{#XH7I&mPTOMV5E9dAecTKxVGpyvM@h|0;s7(;&kASio24{Dt&p!x@(#(xf!K3@do zhp$KcCdg9B--C#r{5vQfKZ+4#uaAK0zX-~%T~Pk|61W6@6MP!{pZLCraY!l28u%q} z2ui+3PzD+%N{d?m5^aU{9L>;Vi`hqWWG}_SNt*V)NJBjT$YK zT%~=A_KaS5q~Gi#`IQ@Fr`6bTIwE3E9_jZ!+Do)g)6USuY57ghleA+r#m)GUFZ3vO zU!pBDa}I^G#P3`6$gBvuP`5*Rr%;PR!s zs17gJ%e3ok=ISQA->7WY<%96jOV`@LfLGJc?4UMHVd^vv+^4V2$GunAHW1KMX+N#f zyqjvX(a3h{w6v9N(w@gCWqPib;JxI$1Tm8SY)0qx zrjk&sRZG^;TlD*Nw@TC8)NNT7RTIA>gy|M--e`)e>o!_is|7jhII=;KmThg5+1iY3 zZU?C>n4AxCNZ3_(GtJD|wvT4an|8dKR?Oe0=lZ3|uum0jCGV`+rn~MXkMnJ{)-NZ+ z#@({dm`@JZg9RkWYw`5YtQ5-YJ#mvM`hzuDD5wd02DJ&8GR@Ee2Mg&qUU(tJ;HY2+)C)Yy(V5#8M z@pl!s)SU73xe=0morI5P$0<3!DgsQXGvgt$P@F{-7};{d=`bf|<+$KwS9i_%%5Etk zgaND2vM|?JnW|XDk8wqF9sf>;>KFj?DtA+L$dwd&5i`!2uq~|X2dc=1*ZT`$_+F-! z=QH&fSMa;y5D>b2%!On!`(-2@dO-(5LylFMjzdHc&zhhYg??7ANpEDVlGJ@R6WgI$ zoo33lF`IQ!UVFF@!s~9Zp3xL9YaL$(2v@&xTa(ill2^#0p3XswY>uK`Zx=PBrq94)I5ZHrkyIc>ID@3f# zw(NFoloTza!jWejt-dlk@}19O3+5_fR9lX*Rhe|uGcx+4(iU0V%e-W zO}TvZCSdFc{iY#2w!;$a3ZG4R;o z=ME%iO1D<+-rl?0ID?^gZ;g5GHg<3A(_1%o_cxp!+EKatTXSPqZRxUJF>=P1l<{Fv zo1x1aJ96oUi}wlmO;58OZxr?9Mq$Ta(xLp8Txr>;(PBP&$rdhmBaZyV-renyvyKrA ze20F`i+78>Eg)b~Coij}XUrxdhmNa`D567AwtJh}?Dqb|V1df+?b!M$GiXRD&n{**k74@fv3NP%pT$Wj(*?OHn}QHF85Tr4-`$#>BQx=K8tv?d|Nn?N#1) z1P93JguT1|GE$g9)s_+y9jCqFMlyYmiPCMrfa!$b$hcBEGd=ote#xe`6}L%6Zdvqp zZ)f_;Z)68R-AKvz_@J!4(%y=5R@ro^{1gnw?KOC_ z@aH_;UA)@(v8+fo>}v9qGDkrzM)Kh_EArKXT9bNt z9|`8fnlu0Xmgd4`hQ&~J3KyO2P5!)p-0WS)kM*}u{>p9JE4{9G6c_b~=;4U=8;YyuFF3wi2;Ao-~1^;W&_xm?- zHiXt1*Y)iYVdD07NN(Ita4wCy*D`UIpo*%<0mfRlATtiLf+;bp%yK7~Cv@MV4o4w3 zOu4CQU+6MBtuTEmEmYY3BPCA6q`r{W^0bp?gPQoLIdhNmdMFI8X0-Mwv|3CSySK>2 z1a43>SfedA?3BB!{<5SL8paH4wuv&D)>AfY_`lY0dq^ZGXniIw!c{8j^Ax8jWf?-q zadyOJctDW>H^#(N`mvLjx;1+{t{v{}uqub&g}GWeZ|npS`~_;m`l{lnvc9bGFC;fE zFhSTENu!*}svTe?P6tR&xTJe`$v+tCTG3No@(abf%GXt^Qil%ycI8u{{%0`0Ucn8y zOUGs93A_`Qi58xuZtF9*tUR(~KcwR=AG8RCKOQE;hw+8W&HA|_Bkk>sc5id_S`CgE zJ*fXWp*bO>ca#?OAA9&h8NpVK+u*nmzmD0IIu4q;^7+BCP`o$L z8i)D(_R|EokX%t6V9-Twb2A|ayQU{o*fm$RS~sTgJ;z-JQqOziI?q2}rkq&ij^bb= zCrFi9#Pa9U?S_D!&3WQWIIh$_+x2Wn*t){$#7W?L^MSS9i!`<37SS y5`SwpIHY1$EJB*J8KEBUfi1y3w<*V2-SWbr)Gv=17*WLHFVflG+uVk*@c#o}i`>%y literal 0 HcmV?d00001 diff --git a/po/lt.po b/po/lt.po new file mode 100644 index 0000000..5df4150 --- /dev/null +++ b/po/lt.po @@ -0,0 +1,366 @@ +# Lithuanian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Aurimas Černius , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-27 21:58+0300\n" +"Last-Translator: Aurimas Černius \n" +"Language-Team: Lithuanian \n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n" +"%100<10 || n%100>=20) ? 1 : 2);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Palaikomos derinimo reikÅ¡mės:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Specialios derinimo reikÅ¡mės:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Ä®jungia visas ne-elgsenos derinimo parinktis" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Papildomi aplinkos kintamieji:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Kableliais skiriamas GL plėtinių sąraÅ¡as, kurį laikyti iÅ¡jungtu" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "GL versija, kurią Cogl turi laikyti, kad tvarkyklė palaiko" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Nustatomi Cogl derinimo požymiai" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Nuimami Cogl derinimo požymiai" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl parinktys" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Rodyti Cogl parinktis" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl sekimas" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject nuorodos" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Derinti nuorodų skaičiavimo problemas CoglObject'ams" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Sekti raÅ¡to kirpimus" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "derinti raÅ¡tų iÅ¡karpų sukÅ«rimus" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Sekti atlaso raÅ¡tus" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Derinti raÅ¡tų atlaso valdymą" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Sekti derinimo eilutes" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Derinti CoglBlendString skaitymą" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Sekti žurnalą" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Rodyti visą geometrijos perdavimą per žurnalą" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Sekti darbų partijas" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Rodyti, kaip geometrija grupuojama žurnale" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Sekti matricas" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Sekti visą matricų manipuliavimą" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Sekti įvairų pieÅ¡imą" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Sekti dalį įvairių pieÅ¡imo veiksmų" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Sekti Pango piešėją" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Sekti Cogl Pango piešėją" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sekti CoglTexturePixmap realizaciją" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sekti Cogl raÅ¡to pikselių žemėlapio realizaciją" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Pateikti" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Apibrėžti stačiakampius" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Apibrėžti visą stačiakampę geometriją" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Rodyti apibrėžimus" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Apibrėžti visą geometriją" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Pagrindinė priežastis" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "IÅ¡jungti žurnalo grupavimą" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "IÅ¡jungti geometrijos grupavimą Cogl žurnale" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "IÅ¡jungti GL viršūnių buferius" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "IÅ¡jungti OpenGL viršūnių buferių naudojimą" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "IÅ¡jungti GL pikselių buferius" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "IÅ¡jungti OpenGL pikselių buferių objektus" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "IÅ¡jungti programinį stačiakampių transformavimą" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Naudoti GPU stačiakampės geometrijos transformavimui" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl specialistas" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "IÅ¡kloti atlaso paveikslėlius" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "IÅ¡kloti raÅ¡tų atlaso pasikeitimus į paveikslėlio failą" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "IÅ¡jungti raÅ¡tų atlasą" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "IÅ¡jungti raÅ¡tų atlaso naudojimą" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "IÅ¡jungti raÅ¡tų atlaso dalijimąsi tarp teksto ir paveikslėlių" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Kai tai nustatyta, paveikslėlių podėlis visada naudos atskirą raÅ¡tą savo " +"atlasui. PrieÅ¡ingu atveju jis mėgins dalytis atlasu su paveikslėliais." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "IÅ¡jungti raÅ¡tus" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "IÅ¡jungti bet kokių primityvų raÅ¡tus" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "IÅ¡jungti arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "IÅ¡jungti ARB fragmentų programų naudojimą" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "IÅ¡jungti fiksuotą" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "IÅ¡jungti fiksuotos funkcijos konvejerio realizacijos naudojimą" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "IÅ¡jungti GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "IÅ¡jungti GLSL naudojimą" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "IÅ¡jungti derinimą" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "IÅ¡jungti derinimo naudojimą" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "IÅ¡jungti ne dvejeto laipsnių raÅ¡tus" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Priverčia Cogl galvoti, kad GL tvarkyklė nepalaiko NPOT raÅ¡tų, todėl tai " +"sukurs karpytus raÅ¡tus arba raÅ¡tus su Å¡iukÅ¡lėmis." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "IÅ¡jungti programinė karpymą" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"IÅ¡jungia Cogl bandymus iÅ¡kirpti kai kuriuos stačiakampius programiÅ¡kai." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Rodyti iÅ¡eities tekstą" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Parodo sugeneruotą ARBfp/GLSL iÅ¡eities tekstą" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Sekti dalį OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Seka kai kuriuos pasirinktus OpenGL kvietinius" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Sekti už ekrano palaikymą" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Derinti už ekrano palaikymą" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "IÅ¡jungti programos podėlį" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "IÅ¡jungti atsarginius podėlius arbfp ir glsl programoms" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "IÅ¡jungti pikselių skaitymo optimizaciją" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"IÅ¡jungti vieno pikselio skaitymo optimizavimą paprastoms nepermatomų " +"stačiakampių scenoms" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Sekti karpymą" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Ä®raÅ¡o į žurnalą, kaip Cogl realizuoja karpymą" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Sekti naÅ¡umo rÅ«pesčius" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Mėgina iÅ¡ryÅ¡kinti neoptimalų Cogl naudojimą." diff --git a/po/lv.gmo b/po/lv.gmo new file mode 100644 index 0000000000000000000000000000000000000000..869126da2f9ca14ae56936b3fa2d8e7433302add GIT binary patch literal 8212 zcma)=TZ~*udB+dSLdbAS2yw!4NttA?cDHA2v)&zh@O>AvlICvI(ADDo@4ZZ}v z3w#xnef~Op|9kMQy#EMX0)Gnr8u;+9A`|!|DE%9t$ax)n4txdN2mU+wJK)d2r@{9w z_2PlKXQ0?Im{1`mU;f};2L zKv{1e${YY610M(1!Kc7K1V00Q8+-?N3MEd1S3tImUIu0Um%)d@Z-Ju!_du487T)I1 zVIL^=egqVGPJr(O*FpY8mj6Wl>!8T_637zK*Fo9$JD`mJ2T<1eH&D*;zd`;*`#5aD zhe28YDEJV#3W|IKQ225KlzCqOMc(g#vfmFuv6~!P3pfCZ9v=falIXLb*x_YR?EO9# z{psuA2e`=lF@!$>4naAmS3yh`eHWDd{|;no^nFn5{9mB#_Yg|)Gdd5x0DcU71pF2# zJozW^6!<^jLGT313m+{ga(@Oy^yp7P8UL4{?DNmyQSd)N;g{k+InQGtOGP;-`+pkz zIQUIa{NrsHPxOBRJO{o2iacKgkAY)Q^#5N_{9r%I3SW+cGS7hGuQx&2|C`_kz#oA! z@7+ui{+$9(f+hH2@Gn4?jD8M^-S=^LN5Bt(GVTw+m%!Vg*y{qq3J*UH3QxWSieBFU zMc%&!WuKpf{`VjhOGi(Da_;9qk$VGV$>>i&vD=@6V&A_3e;51#h-sqNLmIL7Lm*2= z%OG9RHBj~|L6PefP|o|$K(`Jk^L_w|eE$cE-QP*40#AaX?8vat2~&@da65&gfa1=pv7BOx6{f z$n!zkhiIacoQFJ@XmV!9SF^PJ?zMcQ*T+|I?B2f-7xHtqGa^EC03=yb2A zwrpWkR#&l2O{w}>p>!Opfyok66*pdENMX8_P6u_Yi@D*pvRSHQWztPsWNBj3N^R=G z>P~FR<>+iSh}ETB29^HhN^ZJV$F{8e`+A|fHXZnvp6S$s0k5hb>p`iiOqC`KyhmT1 zHoccR8wjWh(>H}lyGAxk65T3It_xk6o{}9^)>qH2Ds#OuX(=Mf26g$Tu3rO4`gvwpwq7RIEitn)l8s_-2lR5z>BN~YMdtb?UxH7{ow zMpj5tv#qXTU8+QKx`)J0zX~#8FF#jGsS5_y(KAhEsoK8nq z-Jz2_%-2PypHGH0-D01H3(BUd8X9K<71n7_XNXm17wp5Mj_!_BS9gaEwPX{evF#u( zV+@@Q3Y|=q=%X5@4kD#l+RC#nQ?#;vtJ=y`u+DUR29FZEt%XgFyM@srgj&k4yZ6#2 zd2CeKHNtL`$#VV4+CU3OUKlyqEeI3DoqU!RRqjkayW6C{9KvmO6wAz?UdL2h!Ug&2 zbhZhnIo+_#`qh?jtQ*@rpEcd2N5oWBq09Hxk|8e0RjEjTuYFycSvZ2aYPfHDmM`go2>~Z8x~NC&?BZ;Ni;tkDhD8{LbLthGexZ7qDbq)* zCQhm6*DkF$DwHVe=h%w$KsF$z5iwO6+b(f4Xo@=()8AXR8mcW_GR&s@uY2w2lFuqL zmW(d3d0~6FiWi4h3A=tfC$ig66C*hS859H#0kw=SXIZ7rYK}X)GOD%ROTUv}!vB`6iMu2?Qb=Fn^fq-& zbYG6H_yoXG{#2XqlH80s?dY@agMAtKk7t^Y9A3o(l+QEG5V260MHWbOKH;>V6QXih z@S-id>Rh3>Bp~`U?ok5Awm$x8m||LepatZ zZ(ythsk>|@Y=>&4i6z#CXx2q}*~5Al9@@b$ris6FS}qOXu5RPHB&N5ct3**p>9wok z^HmeF8}83nN!P5|auGnLOh}l+df{L-EV6nqbn7()yk^Uq5^38+A00|c8H)EKy77)Z zh;QUWpSirp>Uc}vD3t_7%_v{;G~Vhmqb1(CDArb&5Tn?#jBOmA%Fk6=@J$T9HW^*1FJZUGuKKtQIaCsf}6}%Yp5+&eVglwVo}j zVO8bJhYnF?Z4+~JdysN2?W`CaBEXsA_vvVN2lgb%saJQam2O-Uw~GZLSL>_P(4nL`u4lgerKCpO% zajQhJ7Nkr|7@rl(>hj)hFN^!7x~RA7qEsh}+P$|E_kL=SXdAb?S@J>VQW3+5*1FNj zvRc*ErX>NKU?ts(mlo4ggA5-w1CBT^=jSY|cyr<6g^TB>rdnz*E}YF!KSiP&IjV_$ z59P78>2XOi1q@iZy8cY-sp&Y!J&LCDDbWr>Evu(Gwpw_h^{fw!qS9(Ma&%Hl?V}58 zv812YGh~`_S*5vqEmw{lSN`Y9W9h?7iz_Qj>XAp3{9N3>vb3a5szt?cwSR>lC)E-! zhaW$_5Up9PY*NDXNEahrl3vF*<7}f&YK8g7JBb>9#osUN25-O2gi70zw6eEb=sPFt z+{QgwxreiI66tt%U`@DaWO>(a=y1^}<)Sg(k-9&8vD>8?WqY@%v!e^9taODuHpCQN zjmEd-=v{v)+GM?LyZ54vp3nAPG>QIYhDwwOcM)Bcx|Se$x=^D`vbss|!JdxCyLe;C zy<~)F+&d&w=bB^QyM;bGn2w`7Gw54{0qMudCMbjp;Q_1q*M@0$h3J5++xNu}PohA%_*Pi%~sEDrdV6I(1)do&cV8nd}e;Qssw%A zbtuiaQikKRxQj_ypxC=5{+ODsCbH$@UCv}stEsyouP`uCv#W>uftV{0nsba1ZHh1AwCs8-m_#}c9XjItAPTztTPaQeboeQvKi zhs`QEN!U)rd0S3pO!29jkUHME>!iJi#XSf{$b(4k;x*pg#I{bEdySmEgUJ+kIVNaM z?J=vhD{JjGwOKIMZ0F=wHtR~-UCc&U^4=?kNq0EdFPb%_K6JRBJomHVYfK3)P|HPb zB)lPJrkloYPy<5B?W7*?my-K!>Af`>-yDA>M9{h+Mx}ZhH|BCSNh-WF=GHs<$@{j@EHQ=aWp6 zur3<}FDqyg?ttERT+FXBQo(q~t2ns>GSU&>Q*)Id;Rp0Gf=eaI!{7h3TmY#ZQ%WWm z?R9he^I=+-2Nh{hB7{JNkXXH!NrD;>>9^%eqrG%$JNrsbf?bH0VCL~{upM34?wXiN zb;jP&8o|fqJ93{0=5B%;HF9QN?vUtq5eLyHvT_&j3Pfv~6xx;2BDLHL$2*wR=RM+$ zPy5YBVmfz10%|RP=xFYQxh;|r#bh(rTXh=$wIZpGnj`=Rroq3NqV#4)x@`8jtKf;o zU&~4268-NiC&<|a=@b$ylaSp>Apb8KdBIgIQ(8_B0xL@~Q#JA?lMf}8gb!P8dHj3C zU&AKdQYnNhV7OH3;9WM15lV5=jr!B6;z-zC>X_~EF5c!VmC4ex*D|axmCU5Ck-S#I zDz`p7zky}WD~ed zed&Ya$h-97QOEa3(;<`5a06bhXxBAmYCI3@vXyes4)c!kJq zw<$13)Y)Zp(MLW_M0UQH8kd79g=+6!E(J(UF7D})2yVD`^`PQzF}=S!mznzQZ1GK! zydsq-KIc;0)NjOzQG@uwm9#GGgg82huGwvOk!9iNIsURL!NeAfb;UPj@ImS#+b7sV z32_=1eG`dBDg0uj7goAT?iu*jw?j^q60@z&Qlr91x9}wVQ>TQoqVXK5!&pLYCa|}y WqKSJFrzQpKK;xI(EhPT=xcdLZH)Hky literal 0 HcmV?d00001 diff --git a/po/lv.po b/po/lv.po new file mode 100644 index 0000000..1b03a8d --- /dev/null +++ b/po/lv.po @@ -0,0 +1,367 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# RÅ«dofls Mazurs , 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-26 12:02+0300\n" +"Last-Translator: RÅ«dolfs Mazurs \n" +"Language-Team: Latvian \n" +"Language: lv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.4\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : " +"2);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "AtbalstÄ«tās atkļūdoÅ¡anas vērtÄ«bas:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Īpašās atkļūdoÅ¡anas vērtÄ«bas:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Aktivē visas ne-uzvedÄ«bas atkļūdoÅ¡anas opcijas" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Papildu vides mainÄ«gie:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Ar komatiem atdalÄ«ts saraksts ar GL paplaÅ¡inājumiem, kas uzskatāmi par " +"deaktivētiem" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "PārrakstÄ«t GL versiju, ko Cogl uzskatÄ«s, ka atbalsta draiveris" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Iestatāmie Cogl atkļūdoÅ¡anas karodziņi" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Noņemamie Cogl atkļūdoÅ¡anas karodziņi" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl opcijas" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "RādÄ«t Cogl opcijas" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl izsekoÅ¡ana" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject atsauces" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Atkļūdot atsauču skaitīšanas problēmas priekÅ¡ CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Izsekot tekstÅ«ru grieÅ¡anai" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "atkļūdot tekstÅ«ru gabalu veidoÅ¡anu" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Izsekot atlanta tekstÅ«ras" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Atkļūdot tekstÅ«ru atlanta pārvaldīšanu" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Izsekot sapludinātās virknes" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Atkļūdot CoglBlendString parsēšanu" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "IzsekoÅ¡anas žurnāls" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "SkatÄ«t visu Ä£eometriju, kas iet cauri žurnālam" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Izsekot paketēm" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "RādÄ«t, kā Ä£eometrija tiek paketēta žurnālā" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Izsekot matricām" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Izsekot visām matricu manipulācijām" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Izsekot dažādiem zÄ«mējumiem" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Izsekot dažādām zÄ«mēšanas darbÄ«bām" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Izsekot Pango renderētāju" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Izsekot Cogl Pango renderētāju" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Izsekot CoglTexturePixmap aizmuguri" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Izsekot Cogl tekstÅ«ras pikseļu kartes aizmuguri" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Vizualizēt" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Izcelt taisnstÅ«rus" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Pievienot karkasattēlojumu visām taisnstÅ«ra Ä£eometrijām" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "RādÄ«t karkasattēlojumu" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Pievienot karkasattēlojumu visām Ä£eometrijām" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Pamatcēlonis" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Deaktivēt žurnāla paketēšanu" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Deaktivēt Ä£eometriju paketēšanu Cogl žurnālā." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Deaktivēt GL virsotņu buferus" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Deaktivēt OpenGL virsotņu bufera objektu lietoÅ¡anu" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Deaktivēt GL pikseļu buferus" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Deaktivēt OpenGL pikseļu bufera objektu lietoÅ¡anu" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Deaktivēt programmatÅ«ras taisnstÅ«ru transformācijas" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Izmantot GPU, lai transformētu taisnstÅ«ra Ä£eometrijas" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl speciālists" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Nomest atlanta attēlus" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Nomest tekstÅ«ru atlanta izmaiņas attēla failā" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Deaktivēt tekstÅ«ru nogludināšanu" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Deaktivēt tekstÅ«ru nogludināšanas izmantoÅ¡anu" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Deaktivēt tekstÅ«ru atlanta koplietoÅ¡anu starp tekstu un attēliem" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Kad tas ir iestatÄ«ts, glifu keÅ¡s atlantam vienmēr izmantos atsevišķu " +"tekstÅ«ru. Citādi tas mēģinās koplietot atlantu ar attēliem. " + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Deaktivēt teksturēšanu" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Deaktivēt visu primitÄ«vu teksturēšanu" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Deaktivēt arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Deaktivēt ARB fragmentu programmu lietoÅ¡anu" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Deaktivēt fiksētos" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Deaktivēt fiksētu funkciju konveijera aizmugures izmantoÅ¡anu" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Deaktivēt GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Deaktivēt GLSL izmantoÅ¡anu" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Deaktivēt sajaukÅ¡anu" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Deaktivēt sajaukÅ¡anas izmantoÅ¡anu" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Deaktivēt nav-divnieka-pakāpe tekstÅ«ras" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Liek Cogl domāt, ka GL draiveris neatbalsta NPOT tekstÅ«ras, tā vietā tas " +"veidos sagrieztas tekstÅ«ras vai tekstÅ«ras ar liekām daļām." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Deaktivēt programmatÅ«ras apcirpÅ¡anu" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Deaktivē Cogl mēģinājumus apcirpt dažus taisnstÅ«rus programmatÅ«rā." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "RādÄ«t avotu" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "RādÄ«t Ä£enerētu ARBfp/GLSL pirmkodu" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Izsekot kādu OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Izsekot dažus Ä«paÅ¡us OpenGL izsaukumus" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Izsekot ārpusekrāna atbalstu" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Atkļūdot ārpusekrāna atbalstu" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Deaktivēt programmas keÅ¡u" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Deaktivēt atkāpÅ¡anās keÅ¡u arbfp un glsl programmām" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Deaktivēt pikseļu lasīšanas optimizāciju" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Deaktivēt optimizēšanu 1px nolasīšanai vienkāršām necaurspÄ«dÄ«gu taisnstÅ«ru " +"ainām " + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Izsekot apcirpÅ¡anu" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "ReÄ£istrē informāciju par to, kā Cogl implementē apcirÅ¡anu" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Izsekot veiktspējas problēmas" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Mēģina izcelt neoptimālu Cogl lietojumu." diff --git a/po/ml.gmo b/po/ml.gmo new file mode 100644 index 0000000000000000000000000000000000000000..6f52a1535a7187c3e0c76b1afe8fe83442fbf8d1 GIT binary patch literal 662 zcmYL_&2AGh5XYCV%W~tyfx~bERo-~hP})rc4WUJq8WE+TLR`Sz7{|zKuWWBWxX~-> zu@8W_BZM{*C%Ezy$dAHoB9W1PJD!=pJv00F&dsX`?FMoW=^(d|1EjHcNQ^M#HlmO} z*P`eQ{avJgJ&L;M-=N3z!kV`*T-w+e4+B;?9v#liDL7NvoJS*TKJeU={V6%()=8r? z$c<1?Fz30A$GkMwlc5uGN}g51k%`G*=6#v9TE~_6D3xM~(5B#tv7*H_-g=9LBp32& zY0b3CeJ@v)Z(bX{oRER#%wr$&oOzx>o2DH?9~0Vvw3DrO)@Vv83dxwC$Y!3Eu1)9` zX;VnIvi8OreY8&F1DujfEYnUgZ)^sAE!_W+*G&1ITe7QjGsOlOY#vJ=k5pxuB74RbE(2XILf30|VR`I5&~U#8 z>BDaPn!Mne+vTQ5(t5@e&}1V?<0#bM!u%rCKSF&K>R+M$9_p{5zQDrIF#jCtI?OK@ a=SyfLP3jA#7D1y&@$W?eRapLn-{>D+*WgzG literal 0 HcmV?d00001 diff --git a/po/ml.po b/po/ml.po new file mode 100644 index 0000000..d341d0d --- /dev/null +++ b/po/ml.po @@ -0,0 +1,358 @@ +# Malayalam translation for cogl. +# Copyright (C) 2012 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Anish A , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-20 19:26+0530\n" +"Last-Translator: Anish A \n" +"Language-Team: Swatantra Malayalam Computing\n" +"Language: ml\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Virtaal 0.6.1\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "മൂലകാരണം" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "സോഴ്സ് കോഡ് കാണിക്കുക" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/nb.gmo b/po/nb.gmo new file mode 100644 index 0000000000000000000000000000000000000000..bb84155bcfe2287f92b59e29e5d325a89cecf646 GIT binary patch literal 1403 zcmZ`%O^(z?6m}94k`54&KZF#a+GK&CJnd#8CJqF`Fd&p^hD>+ZMNzf=+Fj%7Dyyp8 zL)c`&1z04JIKbRt_I&|PkX3GwH4A8zM%kI{QRbPYDOu7Px#%uU>LM6eW@_!>$fR>MIW{$xg=}pMJf#y8 zMeP3eX!}U19WgU)ZCg6rJ0_H3+GswZnOI0uTcKFqlrddjyT*97DG(fuW@f)B!&aA# z#UU)~ZuceHvto{JM-^rADBVIRG@3@Ex~h!zly_xT_Q%rILdmBTJ+dYY&L8CbF&)NGRPAB!J=z)bO-mv?0>3LfrEJho)_MOr@2|6DJ-xPmrJwZsaOAtRkfEOw zegmEi5RwkQYyGx`^BnJ}of6*Il>NLXtQVRMg%!fF8|A$DxqZ~(kG*Z7i&_-K$0X({ zduZ%F6%sKMQ_hzMirtXOhUR*5TSo%bvYD`s{LNp-_xQ%KU+5f+<6Am2Im)DLVj&6GqFb z;HE(IX;&nq6>oOx%$&)xB!+3(9JDi4HC-NJa>Wo_?BSoHUE`Mr)`>C#50UY0qlTMO ps+>xbQ{!iAtd_hFRCf|Xo$LdP$|YHF-Y*Y9w)`E}9reSmUIQrvi5~y} literal 0 HcmV?d00001 diff --git a/po/nb.po b/po/nb.po new file mode 100644 index 0000000..5d204e6 --- /dev/null +++ b/po/nb.po @@ -0,0 +1,358 @@ +# Norwegian bokmÃ¥l translation of cogl. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Kjartan Maraas , 2011-2014. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl 1.11.x\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2014-02-12 20:25+0100\n" +"Last-Translator: Kjartan Maraas \n" +"Language-Team: Norwegian bokmÃ¥l \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Støttede feilsøkingsverdier:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Spesielle feilsøkingsverdier:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" +"SlÃ¥r pÃ¥ alle feilsøkingsalternativer som ikke har med oppførsel Ã¥ gjøre" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Alternativer for Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Vis alternativer for Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl-sporing" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject-referanser" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Feilsøk referansetellingsproblemer for CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualiser" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Vis rutenett" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "RotÃ¥rsak" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "SlÃ¥ av GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "SlÃ¥ av bruk av GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Vis kildekode" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/nl.gmo b/po/nl.gmo new file mode 100644 index 0000000000000000000000000000000000000000..ad04f17f166c6f3672e48c95b60a55da759489a5 GIT binary patch literal 759 zcmaiyO>Pr07={NZLK@h>7LZ(4pvs9S1X?ByR83kb5>ca)!V)Rd`>W~f;*rOt^p0=_yBHzkKi`=0`7wE z;3oJ9zFkU^->}!gr^`vQ3HufH9_$a;sQUv8*~QqvEXKrkawYEetkmSF49Xh6T1>^H zl2RE-W|~V+f+b#rf1Xt)p1zpdGgAAq=e|bHo{A#S!IZuf&clCR3({jzS{LZhOEsnY zmGpFMb21O1%$rSwey_CV4QcE`G^~?NVS;e4anLBFdR96+t%}esbQQ3lj*iB(=LC-h z&^`|$CoPt>Dch#3O|o|Wu)W1H#vr7}VyR*xYh6a!6UrVF#_~tm7HdKGocln>jvKFe zur4RBY=uB%-)ax5g&@0UlhtDHBFm?^XJo~tpku)oIq6rSn3LV5aDi()=HAk&Q(w%T znuS=_`a(|9;b3^MexR)?&n-TQ`Yc1iZ2lh!{>0nnDVboT%_WN$iJnhv*`MOMd|f_un!A literal 0 HcmV?d00001 diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..c7524f4 --- /dev/null +++ b/po/nl.po @@ -0,0 +1,359 @@ +# Dutch translation for Cogl +# +# This file is distributed under the same license as the Cogl package. +# +# Wouter Bolsterlee , 2011 +# +msgid "" +msgstr "" +"Project-Id-Version: Cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-06 00:51+0200\n" +"Last-Translator: Wouter Bolsterlee \n" +"Language-Team: Dutch \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "In te schakelen Cogl-debugvlaggen" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Uit te schakelen Cogl-debugvlaggen" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl-opties" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl-opties tonen" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/or.gmo b/po/or.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c141150e4e2a42c0ab3b043cdc032588b8b918ef GIT binary patch literal 1015 zcmcgqJ#W-77!FW`6tTbxNM>QFe3!I`C}|I>eyXCUR^>o!$j!OAl*Eo4r_gSlfPt}P ztbhtt$dxK!U_kB6#xFn?zl0|V>MbBPtUP+{ywCG~**`81?KoKHfvdm_Z~;hwa=id9 z0xy9pz%FnN_y}AAz5^#`9OozO4dCrr$H`&8!EV5|&pFN%>}OcePS+52Wlqo>xEyC% zMhRKUbSy<)A9{SXh@x0TWG!J)PP8OB*MIdDqV(SH%crD@C4a|SR&t$(nlAL{L#}ef z4@g)hOIfbDa#wgJm8P9MihFdbh;rJM0qJX<1cH6kHX-jFJ4askz2I2vIT z-_4Zl6`^j2NukSV%S&B4tvD zqJl-7b~#G}vZUfoMkb`1OyaVK0U;n#xt)d1>|i#2!*i!4niR;pnV|vApXp|nuvmGC0bXJ72hbs%n*lMiZM|7SGuIj=U, 2011. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-09-09 11:10+0530\n" +"Last-Translator: Manoj Kumar Giri \n" +"Language-Team: Oriya \n" +"Language: or\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "ସେଟ କରିବା ପାଇଁ Cogl ତ୍ରୁଟି ନିବାରଣ ପତାକାଗୁଡ଼ିକ" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "ସେଟ ନକରିବା ପାଇଁ Cogl ତ୍ରୁଟି ନିବାରଣ ପତାକାଗୁଡ଼ିକ" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl ବିକଳ୍ପଗୁଡିକ" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl ବିକଳ୍ପଗୁଡିକୁ ଦେଖାନ୍ତୁ" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/pa.gmo b/po/pa.gmo new file mode 100644 index 0000000000000000000000000000000000000000..93e8c2c600d2cb09794cc5acb204ed3fc8e4fbc7 GIT binary patch literal 2935 zcmb7_U2GIp6vwZMAFKrxzftjGL_%=3yQQSfmhx3TMB31_g%BS!x3hPrgR?W^y)#rv zG)kh75S~n_K@zMIoCQTBVrpW*#3!FL(Fcu*nJ0ZP`s#x|_&;}MciTcDPO|;&z4zSn z@jqv_zbsoc#qg}a=TUq*ZenZ=_zy_Wdp9$-5}W}$z^}o(!0+;P3O<7MAK+u);#(Md z5L^wC{U&e;I0!xfJ_kMwz63rF9s`$w=fMJa1-u9R2D}se8Kii>f%k)df#iS5BF2`2 ztH67~Zjj-5lo&;Bczk=kq1HqpJp8`q$-C!p; z0j>t$0WI(=ko5X9KVJ&5=>A5K?DvCfz@s4fzXVdgKZ5JQzd_2g3{j~s2S92uX^YmG z9wH_75I&R#X^PSr|TfLNe0XVlwsla8CWVsR_S`U}?3%t>Cra88kCgCrEl_o~CyqSV zmz=hR@1S-z5(E(+5V4kQbRwAKMv5Sp!tCfER(5_m=_*-6D!7;{#7)5v(~C*T(X1+2 zU9eC3NxoG?_5>xGFFom3`DmoDrSrXK5e=QnS3|D0`8Fjc+n0usc)&++Q!1%)yOsi( z;UhIWz+Z*-?{jsG#vhVwSOo_ll(nmB?UPDlI4Us1q|}9u zq$-R^YM?cw9k*(2jU8=`1rHO=xO0 zwxfRAizD(jyl2cBP*TtkTH8bodC;YN+IC%5 zsn;s^@KR5ut7mO#{kl?N5LsF%)YqPf0#)H#_$c4vVU9Kk0c=Lkl`iU9(U;LinEOsF z9BGY7QLpgf*gqh~-A>3&lV;k|rOfjl(=mj--u?&8;J8 zg6~P1Tu2*7)8ufPoQ4G!Z={V+)8tbAJCP^vP)igf=?WMch) zH?0)l4<%nUS$%0rO5pV^69tKyj3|5pL#$C4Y(L2=#@4*t82yN06Ss27n( zv~k>s0U041REK02UjD&Cu_%(GMkGG{&S7l!SQa=GJoqchLw0 zLUE+JX$+-+mZL<3LTE~7P92m{v$1Fg4o{}Z8JZ0;{@8pu#paC537Eh?yy85`{&6fA z9av-qoiKK9<2u44HOO-2I)@80c;8$@(n#gXb?h^@vpAX8C9LNTb+fI=6tg+?pVme# zGsZB5)X)*}+XKDeJRenLIRkq%3~_KJ$#Q48`b~eQGPz)glk-MZ_=Ar0YR#BKlP3)a zy$bDMu*X=z^EC9sN!DQsi|-39+t+YH-mje__?u^y{V13%dINB27A80Rp0s`8R%, 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-17 07:27+0530\n" +"Last-Translator: A S Alam \n" +"Language-Team: Punjabi/Panjabi \n" +"Language: pa\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.4\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "ਸਹਾਇਕ ਡੀਬੱਗ ਮੁੱਲ:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "ਖਾਸ ਡੀਬੱਗ ਮੁੱਲ:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "ਵਾਧੂ ਇੰਵਾਇਰਨਮੈਂਟ ਮੁੱਲ:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "ਸੈੱਟ ਕਰਨ ਲਈ Cogl ਡੀਬੱਗ ਫਲੈਗ" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "ਅਣ-ਸੈੱਟ ਕਰਨ ਲਈ Cogl ਡੀਬੱਗਿੰਗ ਨਿਸ਼ਾਨ" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl ਚੋਣਾਂ" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl ਚੋਣਾਂ ਵੇਖਾਓ" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "ਕੋਗਲ ਟਰੇਸਿੰਗ" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "ਟਰੇਸ ਬਲੈਂਡ ਲਾਈਨਾਂ" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "ਟਰੇਸ ਜਰਨਲ" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "ਟਰੇਸ ਬੈਚਿੰਗ" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "ਟਰੇਸ ਮੈਟਰਿਕਸ" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "ਫੁਟਕਲ ਡਰਾਇੰਗ ਟਰੇਸ" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "ਪੈਗੋ ਰੈਂਡਰ ਟਰੇਸ" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "ਦਿੱਖ" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "ਬਾਹਰੀ ਚਤੁਰਭੁਜ" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "ਬਾਹਰੀ ਢਾਂਚਾ ਵੇਖਾਓ" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "ਮੁੱਖ ਕਾਰਨ" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "ਸਾਫਟਵੇਅਰ ਰੈਕਟ ਟਰਾਂਸਫਰਮ ਆਯੋਗ" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "ਕੋਗਲ ਮਾਹਰ" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp ਆਯੋਗ" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL ਆਯੋਗ" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "ਸਾਫਟਵੇਅਰ ਕਲਿੱਪਿੰਗ ਬੰਦ" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "ਸਰੋਤ ਵੇਖਾਓ" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "ਆਫਸਕਰੀਨ ਸਹਿਯੋਗ ਟਰੇਸ" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "ਆਫਸਕਰੀਨ ਸਹਿਯੋਗ ਡੀਬੱਗ" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "ਪ੍ਰੋਗਰਾਮ ਕੈਸ਼ ਬੰਦ" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "ਟਰੇਸ ਕਲਿੱਪਿੰਗ" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "ਕਾਰਗੁਜ਼ਾਰੀ ਮੁੱਦੇ ਟਰੇਸ" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/pl.gmo b/po/pl.gmo new file mode 100644 index 0000000000000000000000000000000000000000..cebffc7ada3946888e85ec726cc45f19e4c8489a GIT binary patch literal 8479 zcmbW6TZ|;vUB(MzoG=hBCM?&OV+Y^Z?b(^##oml}?7iBty_?zW#g_;Po$jvgshRGo zN?o?Mn+T#6t3-(($b%m?3xWqC5Q>DrCkLb*T=bknfs6Li=r`j=tua$^{oe@=n?SS;4*ms z`=aP!@F@7>;8pM^!ESgiz+d9|cfb#Ux51wU{{~zKzaHLy;Qdkbb37jep9If<4}oLw z=fO9?UjV-ZYM;Lk@Baz>0MGvpu7ckKe+qo`N0AA93e@*4P;y=eUk1Mj9svIX{1xzj zz>k0*TJrn63hMnQLGAwq@Tb8)0}Xfw{8jK@z@Gu{`>`ncHShp<5IhA+pE0O)Zh}X^ zFM-ng8=%%ZfHDWcC%`AcE8ubPx53YXe+@neo{|%6( zqotqlemDTi-j9Kj=LGmc@CwMkDB*|XzYa>yH$aw%z6@&Lw?U2n8mM*t4U`|h5ArWM zfU|{16qQ1T5y@ns5X-tU8w_ia%7eG8P`4`MXw z{d=J7@OR(~;D3T223H~9uY*@X1AZQqK3@i(0RItO0ly2fWb`mWBKsW&CI1#EJNzLi zyZ>!?|84Mfo)54XzeYJI9)1oy1AYaR96tbWfu~tS>wgnG3Vsj7bA*0KLus?uY!t?Z-OilJ-|!( z;lrThItSwN=r=$E=Aiue1yFwa3sC&I3(B6~0oTBX7^HPx2lf10;EUi_z>k1hO!2S= z{yF$jP<;44_(P!5qWpfId!73kZo@5~v@h)~{T|^y&Mh0szS2e4A#SaUx!v_FKR?PX z*=28C;^|A=PwRn8ersRyyK;l}X_$aW;;tV)`CKinv$VbXbpUv1fQvC0S}mCQh#Gewat$i|!{t2gC3cjQm4Cic*j|zj{X;+Q*25u>W-zkD(o~r#<1p|Z-|Dpay3yT2 zKvTqnxQNqUtj)$_+bQGR7PgA}Mmw5pU|u+H;_FqMmJ&%D`RE(!mE zId$o@85DNt!gZft!k`z(ZRBwZDZPcdj+7>IvA584@6ck0Nte%HsLze(Gtym> z%JH7xwo95eo7u!iV8U0CTOJbu=PbHlx7pd{*@_U~hME=@VHo_>FYtb0`dM72k5^5e zG9SCRaivkAL|H#4sVEOr19BP})0Cs6N8SvY5>Cb9_eoN1nu#qLmZbc&{pD!GSCy6} zqYXAMl0Kp0#oiWppXaDs#r-?&$K|7LCo^n<268Gd!do zk}d zANLnR|2~fk$7kv>uHa`u6W~9&nDfb`{bnp3`d$Y@LylFM4nsr`#~QB}g}$xV{A*yW zlGHw%iS1CWj7Q3~A)ED3UV9`ygg2An=7?MI((Sl1K)AY%>yn(l99<=gI!a%>s+g~u zl-+QDZH$P(3Cj|b6779R+~ju4>#R<4FO+C%9<8w7Dumcs-$cx`Vl?$fjt~e z^G#p5e8k$(#7;}2q-YuCTb?FbU1dzjcP@)9n+?P$CJAGkfT#0woffst>*e#E3v!?I zmLtz=Y2ea>qL@0;nA+uvGP+n~YQs7&_B*fmP+!CG!_m^ESp8AwLOD$OozwNO>|Dv# z%w|>PYljchY0bzxc6pfMo8_z+9wy1f#c%Rqxi?Inqd@iRUbWsE)#UDCiR{%mqa=kC zowMYsHFIQT^;l=+>CVbAvwCdp=&^$|BbkCCWLAaYs8VM>?xdnIo%fM^^o~ z^JKCP#7s+ApA~B~U0GESOglG+=0vUsNI5(?9NT2H+{?z#E}d613>i9CVmoF+Mt`|! zPB<0v(MhtrEvC!)Xfbllw(T~oH7=I9}V9?nNLNuN8;|{g{4zLa$d&tge_(eagMpn3X4)v&x(!Pd>BsTIXUG_misA zsNZP5_;N;_Z!vWrX#JL=vsvG6#WW+cc#`#}v4`thSRL1!X$M zYIon7{D0=Cy)3J2d*^1APJ5efiE5jE(#*z5oYD~N-iAjR%-7qsXd~|-RyXO6@Nc}G zxCnRoeajtB?7nZiU*u>oi_>KPwC6dlBtH40TAJ*eObsSJE3z~5ZS;Q}U#H2=Esjgk zMxR|vH`mGO&k@mi4mH*k*{qz!*cX#h^s|0{mc*k>W^iUF&2QUra>#5~ci$q!$98My zrm6dOVs}1+)pu{~-0aP=H1@}mI(SR%>I_|c(rulC7Q?b`xqG7??%XnYHnS$)hMX~- zt4>dTnT*zMJmvJ&li@7Fc}0Tvl~sc-^GP$d-MQKKTjQCMGZNza{1v?##Px2dDKM5y zzfDF@Q2rjDYr~mB%RsDsBV3QWXG!t2(HwRf*)mO&?RxLh{s7g?M1`}Na70U*8 zc;Oc6yM-rZe)p~28!lpaVLi+0xm{%T{*3x49>!zptMb=uzkvR5i?6VANgVX{xY8@p z9@8d_^J7R}`;>9TI3$(et-acYmww3nlWkOR@1f)(&kmAdU9<+)yLYBNxX>a~j|fEH z-i%x+OGB=EOxQy;YnpYkZW1fiObn;Kc6^40ukqD;%xHz|yH2`Sz%(Mfm(dp6j$@tN zlG(Tpp^;PnBAF9Ey-Vjy_>?8cwo)IDe`x($!AKhs>7UUWjge6FfhMhC&f+z)34t=WY*~ z-8-!c8D`Z~{5#_Tfo&3E!e25GwLDQTaq2JVha9zS1Gvo(-3x7BJ@>m zK7}e%cboZBGo#I?Gp}}TE~_yO9%=U4%?wd;-y|8-& zSLv@S+2rn9eMQA>iaJNUVEA`-6s-ZZlbynBwzIz3eH$9}cW)43K6$&dYimJoe%}>M zO&Np<#R-x3)}|nZ%-O8$N=YLfHIybt>d=NM%jhUet3xHB&{x^+ZOTiFHFQV|L%i#l zR!`J;&Ji_gebAosk{UiFrkBuNCniL3+@8>iOT|h!vHCM`dt6hSZTlrg-My2FDaDl9 z>C$jZnAX~px$6|c?oioYXi*b_X5nKp&!w)nRE&=K8#WEtv^^cIo9xhjeXpSn=BUEen6Z3#R#SuWs67Fr6Gj%|&BDY$zMZ4h+46QhAYNcdVPvlZP<|5^|^r=N> z^XO|utg`7#@$PMUQQz!mX?Do{Cxh$X&}!blA?YX?$fq;Qek4pa8U(LYC0E{1uk0w8 z##@bTr>>PMCmgfkw=WmV=2a4RIvq>bsfbdWGM`(t)!)dfzKYD|T?~KWY?^hKoLoU_ L{xmG<8t(ru#{-&R literal 0 HcmV?d00001 diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..9b500c7 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,375 @@ +# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +# Aviary.pl +# Jeśli masz jakiekolwiek uwagi odnoszące się do tłumaczenia lub chcesz +# pomóc w jego rozwijaniu i pielęgnowaniu, napisz do nas: +# gnomepl@aviary.pl +# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +# Piotr Drąg , 2011-2013. +# Aviary.pl , 2011-2013. +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-02-16 21:21+0100\n" +"Last-Translator: Piotr Drąg \n" +"Language-Team: Polish \n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" +"X-Poedit-Language: Polish\n" +"X-Poedit-Country: Poland\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Obsługiwane wartości debugowania:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Specjalne wartości debugowania:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Włącza wszystkie opcje debugowania nie wpływające na zachowanie" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Dodatkowe zmienne środowiskowe:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista rozszerzeń GL oddzielonych przecinkami, które mają udawać wyłączone" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Zastępuje wersję GL obsługiwaną przez sterownik" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Flagi debugowania biblioteki Cogl do ustawienia" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Flagi debugowania biblioteki Cogl do usunięcia" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcje biblioteki Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Wyświetla opcje biblioteki Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Śledzenie biblioteki Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Odniesienia CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debuguje problemy liczenia odniesień dla CoglObject" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Śledzenie dzielenia tekstur" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Debuguje tworzenie fragmentów tekstur" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Śledzenie tekstur atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Debuguje zarządzanie teksturami atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Śledzi ciągi mieszane" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Debuguje przetwarzanie CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Śledzenie dziennika" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Wyświetla wszystkie wymiary przechodzące przez dziennik" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Śledzenie przetwarzania" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Wyświetla, jak wymiary są przetwarzane w dzienniku" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Śledzenie macierzy" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Śledzi wszystkie zmiany macierzy" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Śledzenie różnego rysowania" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Śledzi różne działania rysowania" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Śledzenie mechanizmu wyświetlania Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Śledzi mechanizm wyświetlania Pango biblioteki Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Śledzenie mechanizmu CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Śledzi mechanizm map pikseli jako tekstur biblioteki Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Wyświetlanie" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Prostokąty obramowań" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaje przewody obramowań dla wszystkich wymiarów prostokątnych" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Wyświetla ramki przewodów" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Dodaje przewody obramowań dla wszystkich wymiarów" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Główny powód" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Wyłączenie przetwarzania w dzienniku" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Wyłącza przetwarzanie wymiarów w dzienniku biblioteki Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Wyłączenie buforu werteksów GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Wyłącza użycie obiektów bufora werteksów OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Wyłączenie bufora pikseli GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Wyłącza użycie obiektów bufora pikseli OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Wyłączenie programowego przetwarzania prostokątów" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Używa procesora graficznego do przekształcania wymiarów prostokątnych" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Specjalista biblioteki Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Zrzucenie obrazów atlasu" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Zrzuca zmiany tekstur atlas do pliku obrazu" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Wyłączenie atlasowania tekstur" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Wyłącza użycie atlasowania tekstur" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Wyłączenie współdzielenia atlasu tekstur między tekstem a obrazami" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Jeśli ustawiono, to pamięć podręczna glifów zawsze będzie używała oddzielnej " +"tekstury dla swojego atlasu. W innym przypadku spróbuje współdzielić atlas z " +"obrazami." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Wyłączenie teksturowania" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Wyłącza teksturowanie wszystkich figur" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Wyłączenie arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Wyłącza użycie programów cząsteczkowych ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Wyłączenie stałego potoku" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Wyłącza użycie mechanizmu potoku stałych funkcji" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Wyłączenie GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Wyłącza użycie GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Wyłączenie mieszania" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Wyłącza użycie mieszania" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Wyłącznie tekstur o rozmiarach niebędących potęgą liczby 2" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Sprawia, że biblioteka Cogl uważa, że sterownik GL nie obsługuje tekstur " +"NPOT, więc zamiast tego tworzy podzielone tekstury lub tekstury ze stratą." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Wyłączenie programowego skracania" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Wyłącza programowe próby przycinania niektórych prostokątów przez bibliotekę " +"Cogl." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Wyświetlanie źródła" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Wyświetla utworzony kod źródłowy ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Śledzenie OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Śledzi wybrane wywołania OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Śledzenie obsługi poza ekranem" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Debuguje obsługę poza ekranem" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Wyłączenie pamięci podręcznych programów" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Wyłącza zapasowe pamięci podręczne dla programów ARBfp i GLSL" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Wyłączenie optymalizacji pikseli odczytu" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Wyłącza optymalizację odczytywania 1 piksela dla prostych scen z " +"nieprzezroczystymi prostokątami" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Śledzenie przycinania" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Zapisuje informacje o tym, jak biblioteka Cogl implementuje przycinanie" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Śledzenie spadków wydajności" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Próbuje wyróżnić nieoptymalne użycie biblioteki Cogl." diff --git a/po/pt.gmo b/po/pt.gmo new file mode 100644 index 0000000000000000000000000000000000000000..ed2c101ad806d31ba7c3cadcc477eddf8d051ce0 GIT binary patch literal 8184 zcmb7|UyL2sUB{;((6CSn0SpvUPAF+ooV#Afrg1iQn)RQgY1iG2y>V5Esyg@1+!P>$MPnBtS?+h_=d0+lMxxRIOSGQ7Y630n$D~p*$ezVWK_y5oR$9wO7DdKsS@pFtnyeo=w@Zs<056`!LAc}qg{3mc7y!*{j zbU%0s{9*7p@U7rDyw~8*^8V}Kec&g-p9H@Oo&*0be1FS5QS?*19|zwBUI5Y)H%NmJ_3Fg z6yM(fb>1G9hj|Dt0k zTlfH|^G}0s1GhoZHv?rahoJU-3KYGsg1YZppyVc{jez5z`1lZrN}}HbC5M+l$@}db z`r@0g5Ab2$zYdX)gWmyl&totn`hNw~{ntV9_pAJoeE$HHyk7-H?`z;Q;CDgM@m`n} zoelT|_)+j3;Mc?V{{&^v_aY4Oy$*_xb0Dll9|li@IjH+z1~gS z7@_w64k-Tq2s{h^b@+Y{M2f$MK;0XI(#vmvqW9yV&i@P0fd37O?zdsI+V>$)^uGj3 zzF!UB{}mM9@4%_JD#}6a`z=uWj==Na|AHR_&!bdGj{X6BFZgeu_&E(x^3w~TB!$ct7|WC_UXnaN+3aIH+}(K+RtR9|UiN`A>sd|0*cGd=u2V{{h#* z`}nB++aM~8J`5W01yK7w1|pK^E1=}{HBje&8x)-e;&slIfWHY|;{A_7&Hop;20nz6 zJ^`KrWk-Jtz6n%Vls>i@=NOMO3}b^ae56~^A)3xGWFt>AV8cDK<##d=t9zc{ujDKn zlD+8JVZ4v=s9ty^zu_Z#MXU6=8z!C%2pj$LZvH2kN&n9>wix#_q(40mF&<$MdiqDU ztw+B56yu^^cw_^5q+>nuyz?=UpUaH*Gi0NvHoBW}mLc7KA458o{YP7IY!1>oG3BDo(jsZh zw5*NIGBZocJZbC0H&{|9lhziqMP}=jbfKJO zW~b7k#=l&xl1XZ_v}yhOUTr67G4n5RGG5GPyqaldXN_q~(w4uPgl zrb(R?lSG&0xg9l0Woz3evC)mDoSLV%O>(16ibf>qf~rnqSeoq(`hrQlcX@sqN>We4c{TcOv**kYD?NQiy=ILz0$`(o%Tx;9R zHYT@)oh6cBbkWlxVt3OUNoLM3rf|l-<;1n5X8#>#u5S0s-d8SaX=iNP$=p#M_Sr%wB*y-f=LV0&J!mC6V6#*?vPZ52Trl0v7J0`CU!FKOiPy-i)?3ElOgDGR@;2Z z#1z&Lbs(uIi&0e`B=xAAj@pCL1nDf-m)KFB-n6nNXS;P`MT9w7-Ei+snpat3nn@z- zhMBUmFDw$w!Wl0X+20n33FP*lb)u=9$cMM}^UWOF=0-_oReR&4J&-NvtK&J%(dP2P zrku71vav~)R@G2+{fx*oZEcGN$ISaXSMC{Z^b>dd0tJT%9C5Yj{(y=_gZod-)|K;S zTHBd(*W2_G7CpT^u%z&9r%DQp(o1OUjM9|O_m-TlF5UNL`o?SVxm9xtXS^=!-8^b= zR%E7&V&d$gN~=WC4V#}l dl8)wN6HaJ_G@82lo~gq?qO z3e}et!pvk&XvE@(Cblqc9b{!mbg6K0&;?o9_c)o`{S>FfCtWCQ(U9{+Qenj6c4stoH8HS z-P!9{XkgawNn6qb*?^cv#57HoPKcXomqyJUP57?E32*$?if+j6?-m6bKFhwTZ5jWos^2)E!;zWzosZeVO6wKEh+v)9Qq* z7M2$E1XnBLuuprJk*zV~L_&0N4<19PyY8c8;J5>lP}>`q$eN zq5obbwX--0%%KbgcVjV8*JxwxtPt}d7S}XOPd8H(#<6L;9MzXF7Jo*#5?vZJFMnD zb9s-o*?~Q5jDn(Nl`nZZZ*`e5CEmFxwr+MHqdrJk+c`XypR2UUZJsY5@0^qSptl}* zyA}s7Jjjd5Bb}&StZ1U$x>Ol9dL|xS^RB*WPOYC=yOO9p8eMK?X*@c=m^Gula?{M) zw%R;#fdh^uj;~OV8Hdr{ilI*7nIm>mYMjNL_Cm%H%8=I#$j&Ja+ zZ4<~w*k#dR^kuziE-oy!mDw&S4NG%&Zma5WwmAGq)jl~d+uWwv`lQUCU?UYV7BSjO zY`$rBVRA7eASC9jV@4Ye?YyM!DHm0g4*y+JzG43+OqlU`zr& zQDrtQ9#@vBF@bZ>?L9R*vs~wlkE-cXLAb-BHqDuF+OAQ{Yk}i(|4URf9eH+|gI?hdVCE&bwxSAaIS6=;$;12^LDIxA{1g{)`Rxr^Lsd zDjX*-iY_&M4`7{NMO%oovc;Sb3#tCwuC0$=R$BtyoEs+*#w~ z*SigxpLE~fxUqajAq%v95 z)HF^Ywj#^*w(R;5VldsvU@HaW@T6Wu>KqEmtx2xi9Fu6htVeM&ipx}*?xbf;>01+T zpYG}`NkyYXs{RC^EkW|WNpVJn8y&r@rWzBcRhg8-Gdqr~>6v(CD9Du?Io;RfSsD)) zVabHDG@Cm*de(e^$JZ3_F>OrFm#yU5C07$?lyZeTQ$TF!GGA~^C;lZ*RN}8ky{CZn z9ZiFK-{6zP_`<@b4a%we2FH2bQWpytrcLy^U_(#60vhjK=Y!O#83z|zv%0m!;MD^S z^t`%&W{T#g^${wxI9%XV(S-8i|GAwS8UDYQy|+8Tt@OjXD?K6U4l=!Ub!qaFJmD;r zpCZ(usIBs1TyYX*1&qgqRK+V-8?jmjL*y$~luqe0oT)3!X<+GnBqdd z6*v|pNM3Q7%|MO*xq)<~X23`I1A=v*#j z^nO}0Ir?&((wt0H?#K7;e?{fy(f*cWt6f@Z24qZJWR6rCf z8CBhF6@`Qb3#wIKXGLH+E?KfA<59U%o4rndTk^Ewj1u9>2O6|4AzZp4Nx5=jxMkph z(tV}r84*aewSy5Cve9k$?&tp1$-h`Qp`y!{f^rBc98feb99~5aP}$L zl~3PX)Nwal(U*^1pV(t<&Nmt1wZa80ILp<%ZJ(RsuoFOmZekjq6;K} zm6}Q_$MDSpK7zDDyQ-2~HMNSZg%9%U{O&^;r-B!jC?X$bk75hKuq$fByiaioeF!+H VLxHcWeib-0k|HdnM2{U5?R-_HO5 literal 0 HcmV?d00001 diff --git a/po/pt.po b/po/pt.po new file mode 100644 index 0000000..5ae7e15 --- /dev/null +++ b/po/pt.po @@ -0,0 +1,364 @@ +# cogl's portuguese translation. +# Copyright © 2011, 2012, 2013 cogl +# This file is distributed under the same license as the cogl package. +# Duarte Loreto , 2011, 2012, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: 3.8\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-03-17 00:40+0000\n" +"Last-Translator: Duarte Loreto \n" +"Language-Team: Portuguese \n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valores de depuração suportados:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valores de depuração especiais:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Ativa todas as opções de depuração não-comportamentais" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variáveis de ambiente adicionais:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista separada por vírgulas de extensões GL para considerar desativadas" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Redefinir a versão GL que o Cogl irá assumir que o controlador suporta" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Parâmetros de depuração Cogl a definir" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Parâmetros de depuração Cogl a desativar" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opções Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Apresentar as opções do Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Acompanhamento Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referências CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de contagem de referências para CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Acompanhar Fatiamento de Texturas" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Depurar a criação de fatias de texturas" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Acompanhar Texturas Atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Depurar a gestão de texturas atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Acompanhar Mistura de Expressões" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Depurar o processamento de CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Diário de Acompanhamento" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Visualizar toda a geometria a passar pelo diário" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Acompanhar Lotes" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Apresentar como a geometria é loteada no diário" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Acompanhar matrizes" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Acompanhar todas as manipulações de matrizes" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Acompanhar Miscelânea de Desenhos" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Acompanhar algumas operações de desenhos" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Acompanhar Renderizador Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Acompanhar o renderizador Pango do Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Acompanhar o motor de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Acompanhar o motor de imagens de texturas do Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Delimitar retângulos" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Adicionar delimitações a todas as geometrias retangulares" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Apresentar contornos" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Adicionar contornos para todas as geometrias" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Motivo Inicial" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desativar Loteamento no Diário" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desativar o loteamento da geometria no Diário Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desativar Buffers GL Vertex" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desativar a utilização de objetos de buffer vertex OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desativar Buffer de Pixels GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desativar a utilização de objetos de buffer de pixels OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desativar a transformação de retângulos pela aplicação" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utilizar o Processador Gráfico para transformar geometria retangular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Despejar imagens atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Despejar alterações de texturas atlas num ficheiro de imagem" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desativar atlas de texturas" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desativar a utilização de atlas de texturas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desativar a partilha de texturas atlas entre texto e imagens" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Quando definido, a cache de glifos irá utilizar sempre uma textura separada " +"para o seu atlas. Caso contrário, tentará partilhar o atlas com as imagens." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desativar texturas" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desativar texturas de quaisquer primitivas" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desativar arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desativar a utilização de aplicações de fragmentos ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desativar fixa" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desativar a utilização do motor de canal de função fixa" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desativar GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desativar a utilização do GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desativar mistura" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desativar a utilização de mistura" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desativar texturas que não sejam potência-de-dois" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Faz o Cogl pensar que o controlador GL não suporta texturas Potência-de-dois " +"pelo que irá criar texturas fatiadas ou texturas com desperdício." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desativar corte por aplicação" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Desativa a tentativa do Cogl de cortar na aplicação alguns retângulos." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Apresentar fonte" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Apresenta o código fonte ARBfp/GLSL gerado" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Acompanhar algum OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Acompanha algumas chamadas OpenGL selecionadas" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Acompanhar suporte fora do ecrã" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Depurar suporte fora do ecrã" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desativar caches da aplicação" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desativar caches de recurso para aplicações arbfp e glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desativar otimização de pixel lido" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desativar a otimização para leitura de 1px de cenas simples de retângulos " +"opacos" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Acompanhar corte" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Regista informação sobre como o Cogl está a implementar o corte" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Acompanhar problemas de desempenho" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Tenta realçar utilização subótima do Cogl." diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo new file mode 100644 index 0000000000000000000000000000000000000000..d313b4c8cdaca2a28db5e80baa5ae882518627d0 GIT binary patch literal 8501 zcmb7}TdZ8yS;u!%)3k>aN@>llmsKE*gEQlEY?I4LocQjzwR@a%P8{H&)tZ?#Guzp- z_hj!q=h%J#QG|rls45asrP2pNsoF&Np^X3$an(E_fhr*$Dj`rn;_?ul-~og{{QhgL zy=TUD42-f4A}9e(=C637_Y)@xsuYd=^e*`}c z{ulTJ_|dhn&kLZQzXWRkUj=^vd>u64AAmmz{tftp;C4|8f0klWso7sH$ln&Cb$lM2RsJqq2xRcz5s54lH(iT zW8hzcPlIbH-32d#KLK6`KM8&n)IRh0{;xpo_ijja68tbI{jP$~fP0|q`MaRx{WI|A z!22GOH;aqtb0p~>6eS?~bPavr=0YTTDV z@$65*9q?bkOW-LM%@FMsjf`fSWS&%K0YoPf1 zOW+gWEfDG^{{%{|e*@)z4?qIx)dltZIZ)42kblV+_@i@u4U~QV8k8O11{Fshz*xFJ z1U>{l3(D@(h@S@~$FG4}_m4nSN!|iwhyMh{zeiX^a&Ciq{xYcZ|3mOm@Sj21_2VY^ z+s}YsLlOWfCa z=%aJiNB(x7|AxImTsJu#@5R05^9)}ubA6gi9EB>$0j{UG)7ROHK_2WR zDQ0z+=B_fsqBJ(k%*YiJSC=>LF{E_;+UBEKX3Le~X`L3i&5XTthX+J2gk!p*?-W}^|eW|-MgW$MCIE)KlQyIJ16 z-RfOKKvTM*D_!1q+H5khoytvZX=^ty+R+q4bK#P4*K3zo5=k3OOULcNSS&M0D+xYG z&Pos?=}%|8+^I_m#afkQ4R4F#u^*wxg`d zFmy30?PQ_E5Y;es6e%zA&a~KfWv3W+>ixn*>nz3>@Mx0Wv|^LzZt1LqFdNhB{=P~l z)6AKw@5FADDW>+NnS&OdyfCueEeaFGZ69kzGxa84-mQIKjo~&s$}+2`*K_s0xS*$A z=XAnpE;g)+VZASo^|N$3T{d0&Mq-+}w0VVNPTDd&*Xb+y?-_bswXRgnf{p22;+z*HaC78Vr4Elm-{&AgRJ=7b7Q-g;*|KLk7qD6#Kubn z;V#W}@PXg9N0>I_Vn29b%3G0JCnf^6EV^u8WM>~|Yh3(AsA*vlhT)tBC8uASLE)^+_CEG<&n=_WYRWG5s5mI|lZJXdma=9H(;ZV2{O5+0szLUO#72bhp&njx}KoJAIx*lEk@FegUk zxZvfq>YKBr-B&;e1Fk^J!fdlLS+R@{@r zs3aS1?@WZ@`P7x3&*Wo{g1;q2KzQYSE(DY1Cll!~2s+>zI#{LYI79^TtOo-aQ)yZVi16*0Y=JWmw$l)m!3 ze7%KHEy~dmf}ATq$BS-%ls-d(8qE6jiGDUCc9&~Jug)0- zDWvF}C01>kqw5>TJL`{i){mQweJL^w$j;))c$2K?C zJL|_7cZo>WftYy(>x**JY}=uw>N-#Oa%pMJQ>A~<9d?HsCr1;TX5D@+EFHTtUg%Xf}VnBIKIWrLEG;JmuBuOzY3}%8shglR?jw1vbsv<%^fkEzGvjU0*v> zV1^vYZcI^8wmve=Y??o*gj2$X6VLCS?>xR3=Xpp0buK6JL9R{ncrUHju4GC$o%7_D zYSZLXe_Ne6`lJb8PaMiWabn})C)cR|i3!y6a#swI7bxN=o%69(@oS;Uz{0V};?(~C zXW%3C{5L}c;s0YizO zT;ik~XT)ak-|WqAmFl3pbqQWY>_mckK4E(!4>`KDG>!!%p*HNLSz3EBPv!GhVUc9K zn_f%pO0w+~MC|G?g5ONeNa0j)pomsGL^{+4@rP+nWUf*LJB8UKs3u0JJ<-0t&1%&4 zA}Xin*g+kF=b2`7J-sb}S%sY*S7j$r@^%d}Y8CU!{e0!E$UUFWw!J+&rp7xUDleq1bI4e5=3 z4`Vm=u57)cee9mRjVo8~MYqE)Y_9G}X7g8zgHvTUaNgbXv7C4IOvB^q(3!i6c;N;pcL-C zLk`=t0V_jrm?q!jkii}B^miP;D#XfC;T10G4eVbj8a0J>^Fn)YNNL3($}2-xN61>1 z+?pB6FHdPLtNBg0SE%<}nK+~V=kRay7Y_gS_0;Fda;$cTlk&8P<t-kVeaWlcNzbVr+{C33s|*~f#~uhX&Le!UsfHTLxSM&%NYq8VjBi+ka!BM+eq{AkB}2xZ zk>bjiX6YWM963Kpo{b5`=W`;8d^9e@pyhPwV}^VSr|^yi4M{8`A{l`!Hmq@KRrK`x zMllJQS_y3a>Y{DshoGWyuPQljZ(@3H7fVSwAib5aoS!F}CXoI$L@b}Ll&AD-8M6BJ z)rTF8AFz!xlY+%VZ0qyuBME&me#klaC&g^>5HS&^n%^4C6q{6QQSczc(vc)P(nvq@ zsf)Ho{j0Abe69|{dJXn$3P~JoEO~oHiI8kl=EBipq$kEKof!u02F z4AN228L9-7%Ql_uhyy3ahmpb7OXXNJdF6|XhP9A%k(QEk*V7(C`h{Cbdawgr9hUR8Rw&PwXtCLjxQ#AR-9bU+7R$0GnsFi_;kVCk�`Wj10d*L01|&?mj;R zhpMA#j@!3)_e0OAUC$L4+UCW2O`>m?P{ZjmT+n%shf6LW7mEp@$0Vu_NC&>{T)gwN zibdz5s#(1EwQ|!;hsc74zIVR4tYpkM%W7L1@s%, 2011. +# Guilherme Barbosa Ferreira , 2012. +# Enrico Nicoletto , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-30 23:10-0300\n" +"Last-Translator: Rafael Ferreira \n" +"Language-Team: Português do Brasil \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Valores de depuração suportados:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Valores especiais de depuração:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Habilita todas as opções de depuração não comportamentais" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Variáveis de ambiente adicionais:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Lista separada por vírgula contendo extensões de GL para fingir estarem " +"desabilitadas" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Sobrescrever a versão de GL que o Cogl vai presumir que o driver suporta" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Opções de depuração do Cogl a serem ativadas" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Opções de depuração do Cogl a serem desativadas" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opções do Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Mostrar opções do Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Rastreamento do Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Referências de CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de contagem de referências para CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Rastrear fatiamento de texturas" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "depurar a criação de fatiamentos de textura" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Rastrear texturas atlas" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Gerenciamento de depuração de texturas atlas" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Rastrear mesclagem de Strings" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Análise de depuração do CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Rastrear diário" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Visualize toda a geometria que passa através do diário" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Rastrear o processamento de lotes" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Mostra como a geometria está sendo processada no diário" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Rastrear matrizes" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Rastrear toda manipulação de matrizes" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Rastrear miscelânea de desenho" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Rastreia algumas operações variadas de desenho" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Rastrear renderizador Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrear o renderizador Pango do Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrear a retaguarda (backend) CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastreia a retaguarda (backend) da textura pixmap do Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Contornar retângulos" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Adiciona contornos de linha para toda a geometria retângular" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Mostrar quadro de arame" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Adiciona contornos de linha para toda a geometria" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Desabilitar o processamento em lote do diário" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desabilita o processamento em lote de geometria no diário Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Desabilitar os buffers de vértices GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desabilita a utilização de objetos de buffers de vértices do OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Desabilitar os buffers de píxel GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desabilita a utilização de objetos de buffers de píxels do OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Desabilitar a transformada de reta por software" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utiliza a GPU para a transformar geometria retângular" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Especialista Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Descarregar imagens atlas" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Descarrega alterações em texturas atlas para um arquivo de imagem" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Desabilitar texturas atlas" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Desabilita a utilização de texturas atlas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Desabilitar o compartilhamento de texturas atlas entre textos e imagens" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Quando isto é configurado o cache de glifo sempre utilizará uma textura " +"separada para cada atlas. Caso contrário, ele tentará compartilhar o atlas " +"com imagens." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Desabilitar texturização" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Desativar texturização de quaisquer primitivas" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Desabilitar arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Desabilitar a utilização de programas de fragmento ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Desabilitar fixado" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" +"Desabilita o uso da função fixa de linha de processamento da retaguarda " +"(backend)" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Desabilitar GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Desabilitar uso do GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Desabilita a mistura (blending)" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Desabilitar a utilização de mistura (blending)" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Desabilitar texturas que não sejam elevadas ao quadrado (^2)" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Faz o Cogl acreditar que o driver GL não suporta texturas NPOT para que " +"deste modo sejam criadas texturas fatiadas ou texturas com resíduos." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Desabilitar o recorte por software" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Desabilita as tentativas do Cogl em recortar alguns retângulos no software." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Exibir fonte" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar o código-fonte ARBfp/GLSL gerado" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Rastrear um pouco o OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Rastreia algumas chamadas selecionadas do OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Rastrear suporte fora da tela (offscreen)" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Realiza depuração de suporte fora da tela (offscreen)" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Desabilitar cache de programas" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desabilitar os caches de reserva para os programas arbfp e glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Desabilitar a otimização de leitura de píxel" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desabilita a otimização de leitura de 1 píxel para cenas simples de " +"retângulos opacos." + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Rastrear recortes" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Registra informações sobre como Cogl está implementando recortes" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Rastrear problemas de performance" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Tenta ressaltar o uso não ótimo de Cogl." diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/ru.gmo b/po/ru.gmo new file mode 100644 index 0000000000000000000000000000000000000000..2e74fce7282870c2aa17ca23f08def0ec04d4a9a GIT binary patch literal 10654 zcmb7|TaX;*S%%xjaU78lFh)2bPJR=7lxMXo3&&n-ZR=#kjugo{I1U7;-r3&Swq|E0 z-7{Lr4#bjtNRY6~t~g1BfC)v4fj1$PuxB1>!*_VUL-)U4f6XfqzsEQ}!tobZN6{>J*L(QK@2zX2=-0u214qDX z-Wx?XgLi}P2M>WC1Si9F2L2k?Uj%Og{}}ug@C|SR{HJjL1J^~-uX4QsyaU`0eiWPq zZv;<+9|FG(YM(3N{`bHSaQ*M#82BUb7r|TJhfLr-pq@VoO3tI;r@(K3>%sp3KL-9E zcprGvI=|0nK;8d5sQq68e+m3+(1Dl0-vIvw{AKX!pO2zD!S&zKupX4XZv`dK7Vrk}Ajn^o@=x*~1tsTckR_tO0k!WUsPW$iwayPg`SE{1{-X6b zTX+ko^*4hb26uy!uLg=Q$3V^dCMbCqLGAYzD7(pN6<`A>Jw6NKlIRpDJG=tQ-XCSr zo8aVjaGdKH;SYh|1b2e}4N8uC5n6oN2a11Bf)9YtgR<}6gBte}a0*pvL_Jcq8~z@YCRpJiHC8f&0NT;1=+Q;12L(4E`24 z1&SBfBCO=U4{U;81f}19fo38;BHQBrn31s(>!3#Q#mBT&*3cXo46>N1HT5!e;>Tr z+hrptJ)Zy%f!_)DuRzv5x5!r_{aV8CqVw9ukvpTxCm{wL_i$X#v71AB-Ou4Tv}gYhaf~mhX?&3myEt%z z{p15gu-MTJ>F`MoXl{87Fnt~cWe5GB#=uYhQEq^O(Z2BHp@7n%{N2L|;S@c>@fgQe zj+;4@hx8NA<(v2GBK!zb`(Zw_`;Ks}*w^m{50*QAlXJzw`#9wLYdI7Xm@>MKL%;1D ziu-X6OlcgDUG;;y_LD!a4(IO$m8Z6aYvs7|_aG;GI6lQexLTgM29%#iIDU>}Cx_xY z+B!Am=F%*2%}%?XHj>;;H!~O4>#mkGXOnhz>}`f*Nwpm}YMpwV4Gd4)X|oa6UD7y` zX3fTI(rCLQahArD^&}sUwl`~ax3{H1xxYBjN~&pGPxH3FKA6STv{CaHQ^{nfR^!r5 z*W+65+D(@yVc?Kwoksa|@8pvR=(1!w$&yAj(Pp!=aV1Y$aTd3eDW@G>bK33N?UJMI zq>)P`ZP3aRE~i|KWv0?xf=@*|B#4vr+v+?#(9R?jYvq#FKW$D==hZAp8ZPg&TFtB- z?jwY&Ham^Brlfh^36|DsUd}v>Y$HjBZR2)5&fRR>h---~813+KNZ5Vp(WLISb*9mb zdCLzTPcr5Yd2(QPZ`h;FPA2b6#_j5iNgn3M+2nMqH>`Xt`;=U8X~VT=60?B|>x?YV zkX8B@oQ6k}arLmP#?_gUTH3_L*tS;B>lnIO%i`H(C8kjgQwNb6%|@lwoJ+DwbGp)= zYr0^apY!p)f1Oj6R{g*nyvWrodjAKd0}L4w;)Uq zw|84Bx|W%|f4AQAd735u&E*aA=5%{b9IMvTR;%B1y(bdW zwX?X96PUBTJqPybpXeV9y@LeDFgWIFr$_pv=;Va|wA;FWo14z!nuY5szl1@%cK0zU z+}qnq8j#XkXwpdOnihM@nhp*<;%WN!V~M#zI)ydXRK0wT8;nJ6y3?o{FIs6UQFep# z)x)e>nlU#f-?PRvqw%C_1Tu$=qqlk!Kx&*>^W}&dfXX#Mg84%1>XGo1Oj%*S) zoQ*@QdJ^qySRS+_D}GNVGx3p>pd=4DV-ds+r`C+uCKGa-ZI}_h6|)j^8#^A0W2Q%Urh8I_b7ML(h^KCo-`W33rqxqQUN^||<1 z?vxZ`M){Vfj8?0RDf!N_*ofPU7};FP*fQYh{H)WWwt2mLzOx|rNpB?byp{%*9u&pY zkIo-d1R{cxDWMl98U*0t5lJ#+n=aSs_e;Y=~QJ~r*Wd|v1 z+-({i+gus_L}hfd8{0g7_vQ_wW22)Ctn5#Yq)I)@<2F@B@2hOOnETDEEWsJ8*Ym!Q>h-y9_p#JJZIcxoppO2*|T%mTw^1n>$W%1yMZXjTIeJj zZ*0}$v~j-*O$G}l4jp{Ba_{mu;~$OF&ITC|QjNQNC)4)2eRUO@%EQ!@eB3o!c9~Dy zeZTXk6Sp^R85^CL7<0GY>U27K^TgPgd(e$KhI9SE#HRAmmWjp?jix+F_%m;xeZvvDztD zoG;$&o^i!ltaqXNoa;V|3D4=_yPjHHVZ}4WrDCajvN*>sZ+1_!)2Sh=UeVLyvP3E_ zl;esEuDF5_&v5G!$7M~{&81>d9xh(Dn+x4D<5BTyG0(tx4MZ1dqFfOb-?Am1M~QiM zSb!BL!jnJOcw@-|XG<7lv6v6f{uDXhWX5@9e<5s(C3NdtvEb8Cu#_?F1P?BUH5Q`c z-Aq4Tyr%6j_dL=f&ndQnx3-CYQ}J3LyEI3Agj>W&FLqz(zT~YUlX`8wgpM*8wuJe+ zcHd(@=#6k(8t^*%p=(s zk#oK)hGL%8GWwUqVJj+dS1rz0%A194*bEUV)H_AVVFFg zH;SAx92dKPq-nj>A;&C{GvuC2#Ux6NzS&^c-AmWH!6PLJJB6DJXYfNv0_o!cC@zw&b#h#SvUWix9VwD8Zo zlgjsCavWyNpcPhLkvA1bZ|i|I3Qp8$w2i-3eZ^$5) zHMm{I!a#0aZD17(5#tmFf#%)QWINKKg`$#`_c-}h`^a4?q~>W(R&{>ze#m|Z(3i=I zB`VTaEcadMOESu_%EqOzA$1gQ1TL6Uf(+-&*_xnaB%wsR{;b7<2q|WTo^)gahvsE(OT4Sc#9*QuTSMAkhr6>5Hw+^HG%9hlOC}H+!q%ZAElCG5>s@m0eCU$YtzF=XC8#zh6^}zQCJwf`xZM1E2a~pK2OLbh zsA9K7>0?P5#sW#rke123>m0xdM~n3G4ST+ z-#kU&i)P8tN64b`Q7zjsi%UMSz2ofRZ_^J`0)6%;?`o?d#*3^As$~h!^4Bg2VQGNq^X+K;Dqq333aIU~%i_ zm4Ri<1-uY)!f=@f8&&lJ!^h#R-im9EA*?OD-|4M-jV+Wc@G#cr3yP`X@2JwLRiv>s z+gQUuAc!xgyDvt?Um}|lvpJ1(ioTRz>GkQ7*TxIJO0pG�OXaL9I8(`zeqR$V(w`tXrf2B+QfeR+SE z`>JoYEPJcjvSIe^M!wSbI<3C^x*EDY?qE!Xl?t@{Iry3rUi-hkdVnpui*M*<)$#?d zv`+srlm#BHZtQ&Du6(7~?0Z}46`lSH;e)KdLeR>T-}%a-4_^r+zGYaURwNI6$ly(B zh3k7IO!`n96spE9PJDM3z7y%T|6)OVdCn3OJ(dcQ3C1mC7-~vyew7RVElsa5CgT7# ztc>er+VNQ=^gRPj?T9O0_H|rKse{rRuELX9CsBC5?6X!j-oyMGgo0eF-qB?tR`#^( cHP0i_K*ggREw@|#3x@<@%u8yH2ULsxA4R182mk;8 literal 0 HcmV?d00001 diff --git a/po/ru.po b/po/ru.po new file mode 100644 index 0000000..873f062 --- /dev/null +++ b/po/ru.po @@ -0,0 +1,368 @@ +# Russian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Vitteran , 2011. +# Yuri Kozlov , 2012. +# Yuri Myasoedov , 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-23 20:09+0400\n" +"Last-Translator: Yuri Myasoedov \n" +"Language-Team: русский \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"X-Generator: Lokalize 1.0\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Поддерживаемые значения отладки:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Специальные значения отладки:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Включить все внеповеденческие параметры отладки" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Дополнительные переменные окружения:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Список отключённых расширений GL, разделённый запятыми" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Переопределить версию GL, для которой Cogl имеет поддержку драйвера" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Отладочные флаги Cogl для установки" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Отладочные флаги Cogl для сброса" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Параметры Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Показать параметры Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Трассировка Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Ссылки CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Отладить подсчёт ссылок CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Трассировка нарезки текстур" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "отладка создания слоёв текстур" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Трассировка атласа текстур" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Отладка управления атласом текстур" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Трассировка смешанных строк" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Отладка разбора CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Журнал трассировки" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Показывать все фигуры, передаваемую через журнал" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Трассировка комплектации" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Показывать как фигуры комплектуется в журнале" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Трассировка матриц" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Трассировать все операции с матрицами" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Трассировка различных рисований" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Трассировать некоторые другие операции рисования" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Трассировка визуализатора Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Трассировать визуализатор Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Трассировка обработчик CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Трассировать обработчик точечных карт текстур Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Визуализировать" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Очертить прямоугольниками" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Добавить контуры для всех прямоугольных фигур" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Показать контуры" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Добавить контуры для всех фигур" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Коренная причина" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Отключить журнал комплектации" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Отключить комплектацию фигур в журнале Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Выключить буферы GL Vertex" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Запретить использование вершинных буферных объектов OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Выключить буферы GL Pixel" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Запретить использование пиксельных буферных объектов OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Выключить программное преобразование прямоугольных координат" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Использовать GPU для преобразований прямоугольных координат" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Специалист Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Дамп атласа изображений" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Записать дамп изменений атласа текстур в файл изображений" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Выключить атлас текстур" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Не использовать атлас текстур" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Выключить общий атлас текстур между текстом и изображениями" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"При определении кэша глифов всегда использовать отдельную текстуру для этого " +"атласа. В противном случае попытаться использовать общий атлас изображений." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Выключить текстурирование" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Выключить текстурирование примитивов" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Выключить arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Не использовать ARB-фрагменты программ" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Выключить постоянный обработчик" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Не использовать постоянный функциональный конвейерный обработчик" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Выключить GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Не использовать GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Отключить смешивание" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Отключить использование смешивания" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Выключить текстуры не степени двойки" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Заставить Cogl думать, что драйвер GL не поддерживает текстуры NPOT для " +"того, чтобы вместо них он создавал слоистые текстуры или избыточные текстуры." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Выключить программное усечение" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Запретить Cogl пытаться усекать некоторые прямоугольники программно." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Показать исходный код" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показать сгенерированный исходный код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Частичная трассировка OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Трассировка некоторых выбранных вызовов OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Трассировка закадровой поддержки" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Отладка закадровой поддержки" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Выключить программные кэши" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Выключить запасные кэши для программ arbfp и glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Выключить оптимизацию чтения пикселя" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Выключить оптимизацию для чтения 1px на простых сценах с непрозрачными " +"прямоугольниками" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Трассировка усечения" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Протоколировать информацию о том, как Cogl реализует усечение" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Трассировка проблем с производительностью" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Пытается выделить неоптимальное использование Cogl." diff --git a/po/sk.gmo b/po/sk.gmo new file mode 100644 index 0000000000000000000000000000000000000000..dfc1cbc37a98019a38c66aafdb6e5c0e353f054f GIT binary patch literal 8625 zcma)=Ym6M(RmUsK=D|Q9Bw!$9!zIb?+OfMmV~-PO*0bx^uG!u3&crizz!D0#yK1^? zx~gua9zE{4Pu;q&bI$)fZvE@~AAQZ^`ZV{4xWD{}=f&W$ck;va-FJE3N5Fpr z+u)<`_Pk#KPl7)QUIl*|>{QPg_)9#09()Y^WANv|Z-C3-KUVGUeUIn;JkLkLBj5$_ z!(a^l0{9B}i{MRA*7@72{oCMsdH#2B0sK$!ec;0DN_7xE+fzX8fVUjdoI`*Tp%y$wqLe*k5k?}1{+ z{{i{)4qKeSerq|KlC-13bm^DK_5*2cX#Zb&x5&Z-OGnw?W~}o8V#aN1%**4537>b$)&m z?1N&5zXN5y{{p4o#}Hcl;5v95+y>{tuYe-=8=#E)0VwN!08*`i9|c*;E5P&M%OE0n ze-8@J{u$KZA(ZwB@CGP)_zUnV_$DZNn}>YDn{`m+`(2P%-d8~x_bqS{{BKb7ehguM z6}$vK5B>otdVUiWz5j33uIRkN^A^ZZ@9W?x@H^l$;Ja|z3*d9$YvAvJB9B5D>);|N z^1ckp_%DK@m%jopf#0jzKaSB^(z^iC2y>Ee{-+ux{Uq1ku!uueTOZ#c?li>3e{x&Fj`vxey`ynWH z`jGOxXTi^cXTh7G@aX&CpMpOEW!^u+81Dez$u0X7T`qG!#jUtS7tKq!EAom>Pjk!K zq9@UbT*tVd;1=2BdYW78C_Z$OTdq~^7q~?ZxkRtcOZ-M+1Jtq{ly_(4hYNK~FX4^o zMELP(?sMFTV|ff%J&O(rJ=05UEtlBhIqr+{z$HE)7w%#&(UtH>I3fOvT0K&Q_Y(J$ z-0$I*OSmO`U*bN(eVqGK+;TxRdwrDON2>qd4GRCxSI-jT>gyT)xy=0{w{Su1^C28?x+=Cx<%3hC0 zwHfJNt_q{_pz3(QyE3WYu6DNApvr>HAPbUiAdAJZZskF$GhGC}k`Wd)1HkGtu!ax zghw6S9jLDE_G@a%B1)s%UX({D+VnCV&xF`SG*n$}DKSYaHQPbfGMlYp+o(!Av;GDi z#o<^Bn=E&;K+7i7LVCkK=V6>ify%pqup41asy|l-(87`zMow3&HdAeP+AK4w)T+F> z+Vp+ihuf?un%Qr?PEc$M7o^q79L894wqR~Hi*4apHwx3Vsk-SK*`_Koo#Z%XJY93& zI?aLZ#epsCV1&X^R}l^yyC`$qe^Z^ia$ap_x@X<>0lQS4F0C|}RJE<9K>{hAhB}s% z%2?lK%yI*?+%!?R%33N{A7-^ z6+xU9*7wC0Dku0gC?dqKO#Nm_Q?=nLpyu8c zV+wUaV{UJKs*74@wxx%!y9f`dH`C+7T0|_rGLK+$F}5s`OP^Z>S@p`;xcr5&%;ROSs>Qwl+$iZ6_u+AFNb+oUCi{h1O(S%4O$v?g_+5US=Ct0sMfLXtgDm( zFfR*lNFEAP61@{#SG#bT6Vuz?Ridb+^x9SN`JxWlHTU;dN!P+)+eQExG9_UO>xF|wKQm>oZ|AEC zcrDCJN~Ce%eWoudr7zyk)&u9*y=av7UFLEgtD|i_%9R8~O)ppS)ZS_{V@SNSQLL?2 z*+#Y<(zkYaDnDCkk=vYHF5X!ucR{c1IbMqdHav(IlSgV*+gOo%YnhQUto6L#y5?Mc z3BywX%1>*dy|6fUC6G#~bvf^ae(QYM%Uc^}N%e~&T{?c8nrlo1((PV?mD(oj9Vgrc z*=Kpt?)JiGNL7B>Etb1cNfgiKh-0k_60X=!>mpHWNu8KqSZvLIvNgY`78aLIE*_m< zn4hO(>q;;TCHlA4lDjp0UXBhc{@zGa4bpw3u1TKS+Q)#ur%RI~m|Dj&>Ue*W^a zGlea*=jSdM#7@}BC`BaE^6@m%Ve*uunhYK+U)^}Fb$Zs%GLX{g*@Tz}t(Mg3PFT#X zMUrY-&yiK~C6%Q1F<(CUlyd(rA5NB+7mlcB)Ph=4hm)t5PpBuJP|2C)MQJ=i+KgS!kbXFV11{(4Xw!vXieBW;nT{VnVKzdVw15?F7YOR5L#84kou$ z!P#I`k20NXluMa1>ufsyz1w?tlW@Rnb@z+L#~AlsO=zJrDbW3A@*-n1dda(H?%nOU znZ!@MRlj30=``f9A<-kp9!W@=H{(9K3bplT?v%mY z_jaUTVn+lrmm3mx`)*Je4DKJb>JRjI#2CAptNp!uuY@`q=r~lyM^{0D*2ac)V;R1; zGub7uO?FA&$E1Q&19&*O!z#H}F}g+reqMyc#=V=z)ZSg9+2pnw>%nAatdZGU(LTfT zQBvqZA!@%(RidNGopEXR(KyjmeN*G(m8FWq*kBYrHbblbzEQ)`APaJ#GfJzwXQmTP zZp9;&s}#FTb~zeOc4GuWUNhV;a9(dH%_cj;(uJYYl6rDG^RBy%quSvpGsA>F90&u> zTJhw|)EB}ITW*fj5S_fO{==->H_-zFY(YC)58^s8Ri2WkD~1eFDTk)X4&~dduRAZ< zXVLhDi?bR*HK1e!u$BqZY&Uo!QPHg)V0YX$>g?=Hig9x*Ni(;jX1s9vz9$+ zHKwIF7D~(nkywJ-N5>qmZYg215GXd?Buq@H{Gr*x0S-%%cx1MlDi4O^$xb&cRb_P? zX)Ev(iOPLP((dF|qQ)u-;BL^rcUSum9Bni`8`cnTtX0Ft-l~I$iFse{-JR?@pKVAV zY}LGI414I#>;h)k=$fY{ssl-L37hbyoWx|JCP}79iw%RlmzCb48Rx*u2BzC@+D=Xj zn2CWYEmNWE=bDJJ5zr-xZEsbi z#svwbl?uz|OoNgH$VaXjJsgAV7TCr#_%}(?h%VHkk=eT|naLGxHA9E)1$!8iFNqIw z2AMJ3H&ZS{S~f=rAZ3=`ni-miQFZpN^WxBE*lE-t7bQV4xiipP#17)8qrB)crFh+v zbD`A!!f?Jg&|~to+;mVYu`#x3Xm*~J?oGF`rFN&}+*rkBk#1nrARxz^VKmwCNz!t@ zCCb>;1x=&cP}H)cw6tg3w%Vw|og~jrdGGfn0+Vzx7D@Tut0eP~(md!G-m>0sOyxmd zWnui>ci&KgoD9tQ)>SJ_Lr};B>13BeN2Y^-Vz)i)%LVzdP3 zr2MekzxCkTb-u^)PB>uC(X~I$+7Hae-t2wt>GG9FoRw7HcsupcJGF;es|j=XHoImI zk&W(kb$Nz}v!j^{3S$X8=(JgUjY1WjLRXhAyiIb^ENw_WwkhUh#cBvDx5`6fvyz?w;<#;d1K(WlKWVffIf)=d zJidW%+7eOd#zz#ss}Ve=-w+ROS)XDE;XadXRhg!(uAvvg zG$(n9rn{*ozM?+@p;hJB4+E-0W^!&VrCG^=qDo*ey6s8C+@+4Tg^-Qb@>qp*@Baal CIWWNh literal 0 HcmV?d00001 diff --git a/po/sk.po b/po/sk.po new file mode 100644 index 0000000..af5400b --- /dev/null +++ b/po/sk.po @@ -0,0 +1,460 @@ +# Slovak translation for cogl. +# Copyright (C) 2013 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Jan Kyselica , 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl cogl-1.14\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-03-24 10:53+0100\n" +"Last-Translator: Ján Kyselica \n" +"Language-Team: Slovak \n" +"Language: sk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;\n" +"X-Generator: Poedit 1.5.4\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Podporované ladiace hodnoty:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Å peciálne ladiace hodnoty:" + +# popis prepínača +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Povolí vÅ¡etky ladiace voľby, ktoré sa netýkajú správania" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Dodatočné premenné prostredia:" + +# popis premennej prostredia +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"Čiarkami oddelený zoznam rozšírení GL, pri ktorých sa má predstieraÅ¥, že sú " +"zakázané" + +# popis premennej prostredia +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Prepíše na verziu GL, o ktorej Cogl predpokladá, že je podporovaná ovládačom" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "NastaviÅ¥ ladiace značky rozhrania Cogl" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "ZruÅ¡iÅ¥ nastavenie ladiacich značiek rozhrania Cogl" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Voľby pre Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Zobrazí voľby pre Cogl" + +# názov skupiny ladiacich hodnôt +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Trasovanie rozhrania Cogl" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Odkazy na CoglObject" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Ladí problémy s počítaním odkazov na CoglObjects" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "SledovaÅ¥ delenie textúry" + +# PM: prečo je to malým písmenom ked vÅ¡etky ostatné reÅ¥azce sú veľkým, nahlás bug +# JK: https://bugzilla.gnome.org/show_bug.cgi?id=695237 +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "ladí tvorbu častí textúry" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "SledovaÅ¥ atlas textúr" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Ladí správu atlasu textúr" + +# PM: skôr zmieÅ¡anie, prelnutie - inde si použil mieÅ¡anie +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "SledovaÅ¥ mieÅ¡anie reÅ¥azcov" + +# PM: je to popis môžeme byÅ¥ obšírnejší, syntaktickú analýzu +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Ladí syntaktickú analýzu CoglBlendString" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "SledovaÅ¥ žurnál" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Zobrazí vÅ¡etky geometrické tvary prechádzajúce cez žurnál" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "SledovaÅ¥ dávkové spracovanie" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Zobrazí ako sú geometrické tvary dávkovo spracovávané v žurnále" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "SledovaÅ¥ matice" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Sleduje celú manipuláciu s maticami" + +# formátovaný názov ladiacej hodnoty +# /* XXX we should replace the "draw" option its very hand wavy... */ +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "SledovaÅ¥ kreslenie rôznymi Å¡týlmi" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Sleduje niektoré operácie kreslenia rôznymi Å¡týlmi" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "SledovaÅ¥ vykreslovanie knižnicou Pango" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Sleduje vykreslovanie knižnicou Pango v rozhraní Cogl" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "SledovaÅ¥ obslužný program CoglTexturePixmap" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sleduje obslužný program pixmapových textúr Cogl" + +# názov skupiny ladiacich hodnôt +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Vizualizácia" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Obrysy obdĺžnikov" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Pridá obrysy pre vÅ¡etky obdĺžnikové tvary" + +# PK: wireframe neni oramovanie +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "ZobraziÅ¥ drôtový model" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Pridá drôtový model pre vÅ¡etky geometrické tvary" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Základné veci" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "ZakázaÅ¥ dávkové spracovanie v žurnále" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" +"Zakáže dávkové spracovanie geometrických tvarov v žurnále rozhrania Cogl." + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "ZakázaÅ¥ vyrovnávacie pamäte pre vrcholy v GL" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Zakáže používanie vyrovnávacej pamäte pre vertexy objektov v OpenGL" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "ZakázaÅ¥ vyrovnávacie pamäte pre pixely v GL" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Zakáže používanie vyrovnávacej pamäte pre pixely objektov v OpenGL" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "ZakázaÅ¥ softvérovú transformáciu obdĺžnikov" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Použije grafický procesor na transformáciu obdĺžnikových tvarov" + +# názov skupiny ladiacich hodnôt +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Odborné veci" + +# MČ: UložiÅ¥ mi evokuje, že som si pripravil nejaké údaje a chcem ich uchovaÅ¥. Dump má podľa mňa význam „odložiÅ¥ si nejaký polotovar, ktorý vznikol počas práce programu“, takže by som možno bol za preklad „odložiť“, ale nechám na zváženie. +# PM: chápem to ako uloženie atlasu vo forme obrázka kvôli ladeniu odložiÅ¥ sa mi sem nehodí +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "UložiÅ¥ atlas obrázkov" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Uloží zmeny atlasu textúr do obrázkového súboru" + +# formátovaný názov ladiacej hodnotydump +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "ZakázaÅ¥ tvorbu atlasu z textúr" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Zakáže vytváranie atlasu z textúr" + +# PK: sharing je zevraj nespisovne, nemam tusenie ako to prelozit inak +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"ZakázaÅ¥ spoločné používanie atlasu textúr v texte a zároveň aj v obrázkoch." + +# PM: zdá sa mi že originál hovorí niečo iné ako preklad. +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Ak je toto nastavené, tak pamäť znakov bude používaÅ¥ textúru oddelene od jej " +"atlasu. V opačnom prípade sa pokúsi zdieľaÅ¥ atlas spolu s obrázkami." + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "ZakázaÅ¥ textúrovanie" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Zakáže textúrovanie vÅ¡etkých jednoduchých tvarov" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "ZakázaÅ¥ arbfp" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Zakáže používanie fragmentovacích programov ARB" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "ZakázaÅ¥ fixné" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Zakáže používanie zreÅ¥azenia fixných funkcií obslužného programu" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "ZakázaÅ¥ GLSL" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Zakáže používanie GLSL" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "ZakázaÅ¥ mieÅ¡anie" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Zakáže používanie mieÅ¡ania" + +# PK: preco nie textury co nejsu mocninou 2 +# formátovaný názov ladiacej hodnoty +# JK: v nasledujucom retazci je pouzita skratka NPOT, preklad moze byt matuci +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "ZakázaÅ¥ textúry, ktoré nie sú mocninou dvojky (NPOT)" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Cogl bude pracovaÅ¥ ako keby ovládač GL nepodporoval textúry typu NPOT. " +"Textúry sa buď rozdelia na časti alebo bude vznikaÅ¥ prázdny priestor." + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "ZakázaÅ¥ softvérové orezávanie" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Zakáže pokusy o softvérové orezanie niektorých obdĺžnikových tvarov." + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "ZobraziÅ¥ zdrojový kód" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Zobrazí vygenerovaný zdrojový kód ARBfp/GLSL" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "SledovaÅ¥ OpenGL" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Sledovanie volaní vybraných funkcií OpenGL" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "SledovaÅ¥ podporu mimoobrazovkového vykreslovania" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Ladí podporu mimoobrazovkového vykreslovania" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "ZakázaÅ¥ programom používanie vyrovnávacej pamäte" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Zakáže núdzové vyrovnávacie pamäte pre programy arbfp a glsl" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "ZakázaÅ¥ optimalizáciu čítania pixelov" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Zakáže optimalizáciu čítania jednoduchých scén z nepriehľadných obdĺžnikov " +"po 1 pixeli" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "SledovaÅ¥ orezávanie" + +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Zapisuje informácie o spôsobe akým Cogl implementuje orezávanie" + +# formátovaný názov ladiacej hodnoty +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "SledovaÅ¥ aspekty výkonnosti" + +# PM: čo znamená suboptimálne? takmer optimálne? +# JK: áno, niečo v tom význame. +# PK: preco nie menej optimalne? +# JK: Co je zle na suboptimalne? Bezne sa to pouziva, v skole sa s tym stretavam pravidelne. +# MČ: pokiaľ mám správne informácie, tak slovo „optimálne“ má takú hlúpu vlastnosÅ¥, že sa nedá stupňovaÅ¥ a predstavuje najvyšší stupeň. Teda menej optimálne je z tohto pohľadu nezmysel. Takže niečo je optimálne, alebo nie je optimálne. Suboptimálne sa dá teda preložiÅ¥ ako horÅ¡ie ako optimálne, ale nie o mnoho. +# PM: čiže takmer optimálne +# popis (description) ladiacej hodnoty +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Pokúsi sa zvýrazniÅ¥ takmer optimálne použitie rozhrania Cogl." diff --git a/po/sl.gmo b/po/sl.gmo new file mode 100644 index 0000000000000000000000000000000000000000..e0786041c25a626f8751b2074026b169c7e07556 GIT binary patch literal 8189 zcma)=OOPDNS;vd@vcP}=+aR!E?KEazXnQmx$+pzeSSyWYWqD_I#u`bBeE?^7XLo0J zRb{yzJyOR890p1;RLZ95@hRE;s@LeqUx) zcg>7eLB-_!rz&6H_vQb4z?Z<^1W$nf3Vs0m zAMiZ*lSAtOCqdEUQy@nYeI67$ zyatNB-_N2y11C4ZXL6exE6B6tD(1CTAE ze+EU)Z-YJXy% z_$1iuA}pP%Q@&Vsi=>Hj=<75qAwfRD3?=#zt2z+VEz z&VL1>O7s>e>;DIM4tyVrLfvQ|6umzKio8{gzX8g;uhsbXpp5%>Q0yaQk@XcQ=XVN3 z)Mx{gd9Q$M6{Vo?>{me<|E2o-AAyJ-{Us>lzX{6z-v-5gPx4FNFM?wC&ww8We;NE3 z_%-kn_}?HQCAx@EzXEQ7!jm__?*Jt%il1!LHfR@Uinc~;Kf)0?A2~y@kJ$Pe4R!tV zJikQ_ky##*;o~&XP0mA}UD_vTAC(s#u}Aw^=VgT^`tH>oFVu({i{~T!C0xBu`y@@` z$_Ht}b9uzCgmZF!%_CfwM|@X!BixWjY%Y(Sojh_@Vn^ub{TDMuPtabbJwp>)%Ckum zzI164_ry2P)8vtJl}FC!G5=Q-ktRIE2W^Wc z=N4Ta4AgtL`$jfP65T0GrgL4Ifs!4S8>(yD%G@bUT8K!pL6#d{2TEg^ zfh|PvL3C9FQ6l}7n9lt&7ok|I5LrX78xD(pZcM6*D$876*546A^<9;gGQ}1}Ra;tC z3vw3q$P!5^w$){<3zg_pkBnF_x*FsVVfXAE6RRuL5Y3pk?6_@m=0Buoe|s_P6RyhT zbb7k%kG;AZ*mTaOl zwjISqjG^5q*U3_eA*x~OTBOvaoy;AWyyJ$Q^1!LuI?M469wm0Jg-xEjxzQqoTF>tI z_rfMwY*f)V!fuptnf`2LpoJ$dj9lzi3sZ}`_$(``%$vNu+oHc1!)UmNs=Y4Of>EWTXK+{K$#pe#w zsb1r4Rd4z^2G1fjtkS;cMP@T2(GAY`r>xqTvG7cOroh=slVqj$eK`wN5d2yc5#l#T z0^zF!3VZ)-4phDz5=`~Sghm)gG|{Q@;}9!0(N^l?pbxUb@17a!nZ+sbNgvN(Xo!v5 zj&NsFIrzYD-6Kq^u{#JJXz3Ml%ZUjA7cAP*Q+D=ow#3D!P*cMq48u7Ma!x;2180i# znX-vf>gB!Nn~e$u%7!_%Bt4J~h-pMjRm8SW+^jXlo$}@12eurm16?r8ru^1})o3?l zm6j!=T{h3{09Og(@G4<9Z0AMx8){-CM<9c0f$M-;L^qr()u!gSqy2>~8k_kqBYZtX zct}0WP6=yKsmlAfnj6&fWbQJu6{=^%h(7M2V;$-yAzFr=!V=+c$(p!Jf+N-Gt3JJ% zj*0HwXg?$XmI|lZe3#^A)MZbfn<3a2QTTYJ3CZ=Vcz_CdrWqm@s%Mb}5}hqL9p=C_EYCM)Lk$9hGz&-pHgN*Mt2a(hSekj+T+Ld<&3f^A`4 zKTwivcs-s7!}rYOp3mfCj)LDgML_8CJ{N*X`%5A^41x~0h8(P<>3WC|#Iq*oMWS!( zwdk!GD?#d*&4lextuV2~+B%x`QC{}2!G*_mG>&QFFTIXW1GuZ-xGIS0tI;i@sHgPa zE%EuX3E2(z4_8UItvT=!K&C86n8AACU^&iRH5&W%8Uo(7MMa4;H_2bQso!&CYBN{ieU^a}CL zJ9!9tt5M*!XyC(xcrkgTF}05sMYNYYDZ@I~2c6r&)w>)#6<{KvB44>-q)h7U6eBz6 zT&YGy=cenbaam^FQ>Q4n=7b-;I!ZaBRhN%W5$jC;vvjQXNA?nVYEbpdjecAa!t)h^ zSZ7mW6~c6`60*AL^xFE_&e}&iYiHH^+3uOMC)d{3))?5iVP;lB&vM-9&e}PKsLScHlj?z9{Zjm=u-T6XUH_`Ml)>Z+<7qEvL%4fI6azn7P(B^}`r zv%(~bKZsa~6!HVEF^zSK6);c=1qK9>iRPC}fDJ`JJB_k_P(&++pIuiw9CW;&hd5KiV=rG7{} z;iLKgjCX@V!i_D>EZUz+2w&(u^NWTXM)YYlGZWi)Dt7EiMPueE%tMX`uiIRvQy)C9 zrWOe%s%QD3a(1an+{n)`(T&40dnNAQBTxC+qHgPMbbNH?26($s^GbG@>muf&czjqP zN+8XH*O93&2FdjFp*m3w9F?fbay|3LlZic-Yn)KpMcVJ?Oqz0*(vA%Av8g5x{H_HhV78$|v=d4+!@<&Nc zwNzprTR;BLH(j8V@zz>sh{ZKu{9TKD;O}4*IC2GR&mFkH4A=gcn(0iFf5ii8Lz;F! zHwy0M+Ot*l;2}(={t}~3-ApEl>AVC+yhO`4Ce4Kig~&OjBE{o`wT=5t?cpt2rzMlU zB8SZSFe&O|ZLdTH2LWNl5o!n@C;$s0RO}L8?jycVj))O1t2l@o$(VWlJeHYfqW?tXRt&5v4t(Fk-I|3F=|(?)o_DWtywq;awVio2#A9Q#)=<=w@>5 zYcJUhKg#Xqd)sfQD{9AS!tAUrpB}cNr-2Y+qz`$Y5HkenN6oIOe(1~_nQB8m%H0=3 zHNhByVpcqVELX&7-%b?K#?8nOZNW2FOr?C1sP?=XXn*Jr-r&5*9)o2DLbEeudM=`edxh5jT*RtPhYo*Cz26-+9Do%Q;b|4I=N7a zI}_JoVG|$1Ws(4cpYg95aS87^enCpoQvMqlOX9(cw1kKdpedtwgWcMerGzw@w**tgCXwOZx7-nfZuWIu-NH`%} ziIH3mPTjzXuhh56#R|t_{-UY~B1!QvYXxzX;oM|z{x`Z<#n&&STFMr~$HMebBSd3@ z>#<6q%a}oymyaGJb%$+COP&wO(3c}n!sjXiS;$qk{+tq)6SZ)*u*BRuO~^m>O)=a( z>q&K*tLj%@drg`*izgItOA>9R{4K2!fisy?3N<3upMCvSi-pwwUOBD%eAx9wZI%z+ zI$5kK1%^FRVC<3z@v>z@>;sy%1>V zT9hj?e?aE9#6nSupkD_noQ|d+JsVQC8JH, 2011 - 2012 +# Matic GradiÅ¡er <0mickey@gmail.com>, 2012. +# Matej Urbančič , 2011 - 2012 +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-07 09:19+0100\n" +"Last-Translator: Matej Urbančič \n" +"Language-Team: Slovenian GNOME Translation Team \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" +"%100==4 ? 3 : 0);\n" +"X-Poedit-Country: SLOVENIA\n" +"X-Poedit-Language: Slovenian\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Podprta določila razhroščevanja:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Posebna določila razhroščevanja:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Omogoči vse ne-prikazne možnosti razhroščevanja" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Dodatne okoljske spremenljivke:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Z vejico ločen seznam razÅ¡iritev GL, ki naj bi bile onemogočene" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "PrepiÅ¡i različico GL, za katero je predvidena podpora gonilnikov" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Zastavice razhroščevanja Cogl za nastavljanje" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Zastavice razhroščevanja Cogl za odstranitev" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Možnosti Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Pokaži možnosti Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Sledenje Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Sklici predmetov CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Razhroščevanje sklicev Å¡tevca napak predmetov CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Sledi porezavi tekstur" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "razhroščevanje ustvarjanja porezav teksture" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Sledi teksturam nabora" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Razhroščevanje upravljanja nabora tekstur" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Sledi nizom zlivanja" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Razhroščevanje razčlenitev CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Sledi dnevniku" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Preglej celotno geometrijo predmetov, ki se beležijo v dnevnik" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Sledi paketni obdelavi" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Pokaži paketno obdelavo geometrije predmetov v dnevniku" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Sledi matrikam" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Sledi vsem obdelavam matrik" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Sledi risanju" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Sledi nekaterim risarskim opravilom" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Sledi izrisovalniku Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Sledi izrisovalniku Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sledi zaledju CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sledi zaledju sličic teksture Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Predoči" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "OriÅ¡i pravokotnike" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaj črtni oris geometriji risanim pravokotnim predmetom" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Pokaži črtne orise" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Dodaj črtni oris vsem risanim predmetom" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Korenski vzrok" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Onemogoči paketno obdelavo dnevnika" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Onemogoči paketno obdelovanje geometrije v dnevniku Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Onemogoči medpomnilnik točk GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Onemogoči uporabo točkovnega medpomnilnika predmetov OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Onemogoči medpomnilnik sličic GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Onemogoči uporabo medpomnilnika sličic predmetov OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Onemogoči programsko preoblikovanje pravokotnikov" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Uporabi GPE za preoblikovanje geometrije pravokotnih predmetov" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Specialist Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "IzriÅ¡i slike nabora tekstur" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "IzriÅ¡i spremembe nabora tekstur v slikovno datoteko" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Onemogoči zbiranje nabora tekstur" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Onemogoči uporabo zbiranja nabora tekstur" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Onemogoči souporabo nabora tekstur med besedilom in slikami" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Izbrana možnost omogoča uporabo predpomnjenja pismenk v ločenem naboru " +"tekstur. Sicer bo nabor souporabljen med pismenkami in slikami." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Onemogoči sestavljanje nabora" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Onemogoči teksturiranje primitivov" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Onemogoči arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Onemogoči uporabo fragmentarnih programov ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Onemogoči določeno" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Onemogoči uporabo zaledja stalnih funkcij cevovoda" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Onemogoči GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Onemogoči uporabo GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Onemogoči zlivanje" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Onemogoči uporabo zlivanja" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Onemogoči nekvadratne teksture" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Vsili nastavitev, da gonilnik GL ne podpira tekstur NPOT in bo zato program " +"Cogl ustvaril razrezane teksture." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Onemogoči programski odrez" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Onemogoči poskuse Cogl, da odreže nekatere pravokotnike v programju." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Prikaži vir" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Pokaži ustvarjeno izvorno kodo ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Sledi delovanju OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Sledi nekaterim izbranim klicem OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Sledi podpori zunaj zaslona" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Razhroščevanje podpore zunaj zaslona" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Onemogoči predpomnilnike programa" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Onemogoči zasilne predpomnilnike za programe arbfp in glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Onemogoči prilagajanje branja sličic" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Onemogoči prilagajanje branja ene slikovne točke za enostavne prizore s " +"prekrivnimi pravokotniki" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Sledi odrezovanju" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Beleži podatke podrobnosti o izvajanju odrezovanja s programom Cogl" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Opombe k zaznavi izvajanja" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Poskus poudarjanja ne-optimalne uporabe sistema Cogl." diff --git a/po/sr.gmo b/po/sr.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c858cc59ffdd40683d3de8b3053af02de8b62b28 GIT binary patch literal 10452 zcmb`LTWlQHdB-QNoePt=xm9h`T#nQD7G)_?l5eyqSvR}3rAU$F8_=W}E{Dspc6T;2 zv!vvvsU+HpkmR9p>sq$b$gUD3C<>I8M2n$hDrg`2(xS693IqjOBn8^Hq7Ugq9@?V6 z|2b#&LQ=MxX2IcqXU;j_`7ZzO`_Ak?f9S>+0zRMT`WV-DZU}+~_}QEI$LGiI41!OA zKLLlq8{ZWKw}6|#_koXrzYI?J`xN{Q?tdTrICuv974Qe(IQVz|`TO4;1i#Atdhkwg zC-@1l0sb2J4e-~&?}FOrs(=1B;QP7%S8x>kDfj{K*7u+jcsHo=r$Om?1bh^H8C(bc z8~91^zrp*!j}N(ho&fdyOQ81uCip?{&p-oS0Y44?6Zm29hW7@+XTWvfdT=`^dm5nR zJO^$BzYEIlAAyp$4rA7XcYt?-hroNmuYjk(OW=pV2QXqgco1aE-~~|YUjc6g&x5l6 zMpMctTBjl-q`$6TwMetFu z0MCIRW0CauA-E0vckl~f1t)F>zYad7aZvkw6d`wjkAhzWb8rv%Cb$7KB<<7Sey|B% z2F1J2pv-RY3t$MI1Ah;^i6qnhbKsNUJop6o9)hEJA$apUg5a+}@$>HuxdZ+eh>5|A zx48KI1-O^{e*_PJcMx<;34Rxp{1?Fc!M_B@!T$ke#}_@djc?i92{z9AJom|Q-To=5X zOP`%wil<^CUWvQ+ap|LY>O<&*8|=3rco+C#t{wjVy&eVIxWqlhlk~NGx)I#MHO%!( zT)VkcUxMwElV&zfBa^iAdfbdMGnJ$!tk+E~N*Ym~9({``X;jU_X02Th(}C%69w*JP zZldN)oF>gi)XdFHn8x8mJ<7&{ok^{3_O&!Ab2kTDQ8fBYc8BMfn zHEzvRJ*;IWPfQm1iEE6to8{=fiKkJ}q|sEAM$KxZ%^Hocl0~gB4fANyXh)MwnTPh6 z=tv$lGpVEvT4}`XqzUoNWSmLy$zYchG17iVoxy{7Dy5K>NmnV!gYqwfS zn)~M{VX8^HnQKX$Wo_?iNppH;erAp)ZMF^bdYG9;*bHltJQ(b9dPv#*@sX%*cC@Fk zjCH+%$D@?>Ym6M+)1CH6(oPkfi7>BDTh0CYFrAocb*GiX@=wVH6E{sh9a$e3FK4*7 zLSE??I0cU;!s=mD4Xe{7wX}%|@olZ1)p2xEOT$Lbh$&3N)n27$(yX+S*(j|fQy}LT8~?;e%EzJq^8N! zu$hsVjqaWU`}8k#18Y7(gQGYccjfU+pBC+m^q(@@59}~gX;`!Ax+*Sy(nEXtnB<@B zYeh{+={z)HNof+Bdp%1Br_MNy-K2{(Xl^6Eci-YvP>tKsTVK zQ87(ckE_&8Zz<`N_P)=?`Lvl0Gp5B&{)dyp!9Lej`aBuzWAikgBvqU`+^X!l?X1dn z!;l(D2sFtn>G5v zWo9Ch6K&nYMqlclcGc4DYAiWgGBP}%SUe}tW({`f`hIBAj(Cxe6HpeneCQ7 zhg`AG0{3u7S(5#&GQhY#Q%;eG{3^OYBW!g!?bi6J>;>+Pv#QyZhO;UNZo+6s{aVp=U_TG@~4kxT4a{b+02buO2&VSP3{ni&i)+n7L)bbMmt%Eqa@?%hfxZ2X0>>-vZGzgDuZ*4_y7mbnPgIi_9l**EFIeW@ZQ}$2aXPp z4DC$tL=)wXwy;uO-_WXuar1t)o)lh;KX&NB%DugLmXRE#b~mYk&}_`yI}ztY`|D~w zl?UlE*_dgz>}@u_`F`WRjyK20N4J?xhQV7$N4PP!-Dbaz+%i5oYPOjXKeTmxV>z^C ze6zmZp%o)rMn}w-zwDMUXXH-SjIw6q{Xiv?4> zj%UA$v)|B-T>VDpL}!jDaC@nkH^kz+zAqQADGE$k_&Ft9MJPcfymQ3`zOmIc1)p$Z zTC!YRDHhP`B{uh(EOm|{p^Kvmi78Ktuu69mhhc)PBR$LH&g5uTUDs$Y(yyejG z&IxQP`sS2hm!+9O5K4B=SkV~TKWd%Ow~6UArw6 zixMU;U3JC{#HJ@sa~6$UEMj1xOn5^QqzS$*F2adZy1j-LHd>a$3nG*$UbDJljYw`5I3 z;Hm{8+G{ZL>c9vjvB|kwoE(flR9GO^+<e_+m`_NSEbt_yFBG{O43v~Y_(C86=5boyOq)zS?)Z`e8L9X6-YXRO3ZN{Kze!k`W89P zsfLI`uPbYOkgT(>&$B)I6c`s{tJSs2h<3G>6_;dY*C7Ksm%O^xWGW;=*rH@Ep4Q0> z5@Cd;&$B8k_|*5_wZt<+o$v%2k$a-6BUzUkruc*6mExP$zcyd4;G~s7@w%=S=F8T~ zidNdDl*1LaL92(!gtDGn+Q5~PAH>ekHb35ux_9j z*g*0O4LHq})lx5kXF1~kX}?n)H&EYet^J*A@Kw1HTG&&glu_N5jh2PIlIS_6I%gwa zmP#+*hEgT>IEK0tDhD&!BEP7WcpvgU1D(#I^{SGt>S#+S+2P-;+{^{_0(Dz9x9AVv zB9)?K%ayvf0@Ja_KpXth%_v2!w53(tDx-iZt9;lwE&jiK1d7E#1i%cP3h>BWafure z(5dX3N{Bq1{;XmIwS-v4S1$q7L+jq^)`rnYzUnfCJ4<=&})M9JV zN>!Yj-Z87>_uvZ=an(C3Yr8D}IaW&%8*~&HB&~h!>yWd@vtz(7Xt6Lbs`H*ibt|@i zAsd*a)Eun!q9B>UDtB13y}LhC3CId&c)hzJLE)1FyC}D)_BfU7I!Wv#dZoT+?Su;= z0g9K?!~opwIp_^9^WUXZpTh>G@m%!rR8fRAAN9*5TO^aImIJD;s))7(xNPiSH|T3b zi!qda(dn&TW4*8DVATRdS059bSPh#8G_mqT=Dx$j8WWJ9Juk|i?(E||U0mq*^`LAY zKm%!|_;oq`7f2Q7E9r~7(ZC(1ZPK`1{0~EYmfHiNQp}$mTxGCbN^Eg`qbuPe6U+Az zcU19*UdmYi*|AGxYCYfaq!WhM?Rl1RrXSOKoejp&CN#7BRfshU>~@{+1GM748dpYq zK@Hkg8hg<2KZ=!a(YR@e9qpT@Yp<@o=sCNSz$M4s%LuvmZ7SG#Sf$csJAe*3$hNQS z$^_gYPwTDg6dNlsRr;(SZPKVeUO|d}sr8+hii>8d%u=W8Dwi9QrAn{&QiY)}DP8MT znbA`_$&iZvH, 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-27 05:41+0200\n" +"Last-Translator: Мирослав Николић \n" +"Language-Team: Serbian \n" +"Language: sr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : n" +"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Подржане вредности прочишћавања:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Посебне вредности прочишћавања:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Укључује све не-понашајуће опције прочишћавања" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Додатне променљиве окружења:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Зарезом раздвојен списак ГЛ проширења која су искључена" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Превазилази ГЛ издање за које ће Когл сматрати да га подржавају управљачки " +"програми" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Коглове опције прочишћавања за постављање" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Коглове опције прочишћавања за уклањање" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Опције Когла" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Приказује опције Когла" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Коглово праћење" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Референце објекта Когла" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Прочишћава проблеме бројања референци за објекте Когла" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Прати исецање склопа" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Прочишћава стварање исечака склопа" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Прати склопове атласа" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Прочишћава управљање атласом склопа" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Прати ниске стапања" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Прочишћава обрађивање ниски стапања Когла" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Прати рукавац" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Прегледа све облике који пролазе кроз рукавац" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Прати груписање" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Приказује како облик бива груписан у рукавцу" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Прати матрице" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Прати сва руковања матрицом" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Прати мешано цртање" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Прати неке радње мешаног цртања" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Прати Панго исцртавача" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Прати Когл Панго исцртавача" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Прати позадинца мапе тачака склопа Когла" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Прати позадинца мапе тачака склопа Когла" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Обвидни" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Правоугаоници контуре" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Додаје жичане контуре за све правоугаоне облике" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Приказује жичане рамове" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Додаје жичане контуре за све облике" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Корени узрок" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Искључи груписање рукавца" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Искључује груписање облика у рукавцу Когла." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Искључи међумеморије врхунца ГЛ-а" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Искључује коришћење објеката међумеморије врхунца ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Искључи међумеморије тачке ГЛ-а" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Искључује коришћење објеката међумеморије тачке ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Искључи софтверско преображавање правоугаоника" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Користи графички процесор за преображавање правоугаоног облика" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Специјалиста Когла" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Ускладишти слике атласа" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Складишти измене атласа склопа у датотеку слике" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Искључи атласирање склопа" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Искључује употребу атласирања склопа" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Искључи дељење атласа склопа између текста и слика" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Када је ово подешено остава симбола ће увек користити одвојене склопове за " +"свој атлас. У супротном ће покушати да дели атлас са сликама." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Искључи приказ склопа" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Искључује приказ склопа било које основне функције" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Искључи арбфп" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Искључује употребу програма АРБ одломака" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Искључи сталну" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Искључује употребу позадинца спојке сталне функције" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Искључи ГЛСЛ" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Искључује употребу ГЛСЛ-а" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Искључи стапање" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Искључује употребу стапања" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Искључи склопове који нису степен двојке" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Чини да Когл мисли да ГЛ управљачки програм не подржава НПОТ склопове тако " +"да ће направити исецкане склопове или склопове са расипањем уместо тога." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Искључи софтверско одсецање" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Искључује Коглове покушаје да одсече неке правоугаонике у софтверу." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Прикажи извор" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Приказује створени АРБфп/ГЛСЛ изворни код" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Прати неки ОпенГЛ" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Прати неке одабране позиве ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Прати ванекранску подршку" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Прочисти ванекранску подршку" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Искључи оставе програма" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Искључује оставе пребацивања за арбфп и глсл програме" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Искључи оптимизацију читања тачке" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Искључује оптимизацију за читање 1 тачке за једноставне сцене непрозирних " +"правоугаоника" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Прати одсецање" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Записује податке о томе како Когл примењује одсецање" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Прати уделе учинка" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Покушава да истакне подоптимално коришћење Когла." diff --git a/po/sr@latin.gmo b/po/sr@latin.gmo new file mode 100644 index 0000000000000000000000000000000000000000..1c94efd502fcb3eafdbe33450674ac4f75bb8c2e GIT binary patch literal 8104 zcmbW5Ta0AKS;r5F1IZABiOF(}QwDZzv+3EH^*Xj^ckI2|alGpp@62vY1VYu_HQhCR z`kchX{!%5P^gc0x1thLI{5U zs&l$~?A;{dXlnj*>eS`C{J-z3ns0sRzBdw{muWvw`{VZ{$r$|D`}oE4?H^8(UjY9R zTn6v^ktBH-d>s5Bcm@1%u-m*B;Lq{?Ti{2)KL9@reg#|yztQyH|NbQTDc+BQkAdgF zhrluT)8Gy8XTUc>?en#!|F6OOdH-i{75pyv0C@NV$OL{I)c0Lba$W;p1b-hq1pW*7 zQSg7jr@@ab#eF^ns{b>f_P+`K1o$P;fPVr068I0`gW!99G)aCLJOmyE&w$cr3~HU< z1&@Pog3|k&pw>HtGDpEj!NBpiU4uP`w5m54+0)GH8Y^ ztKgr5;`M_Fa|G;wPlDT^zk(X~HYmOC zM;W~z2I)#pg0lN7pvDhDL`|k3u1{`)^8cHlc=%;d^Zp*xK5v7P>tT%j1b6{doc#tU zp8O?9ic0MiYDL5{*pzHY$pFp zc0JF~K0%Z0kJI#Q&^}3fQZGER>*Aw0Sfa@vo6U#Q4I=jJkzZx=7icfjr0>HtSDKx?Fg8uiz~y6C71zJVkizvUn+@vJ76*p=%IBF)jmxIK$g{D_Dl@f(x82m0 zYstBMkeZE&29@z;YvOv|roOD=`*vY_J{!cBzU$V50k38!wS&@BxhY*U@Gjr#to^#t z-9m2I2-C~!tkM);mUUxktrq1hn~@cg z)NE_3)Rty!GdpmyU~)dnAz?TDHJ6&R^$wabZ~oz`E0}+mFIyL9!#Of_`D2BukOc|Jo{SzK@j9(8SRWO}wYY^kM9jK#Ktv`jH{ zJ}B&XuEY+iVd_StEYCWVe9sk~e5X_G<)*RDe0&a%#(v+5O@X_Gvl7CrPOgRb(vK&p zGiA?--6)e!>}P5REdqIA80h$wTbTH9a_V8fp5y#}ab~>C~)o zPu1J+xFN8}?9^E=@M7X8PT394_eQMRnz0N_exxMWDmR`~A@=19Q{}kkkm{$R;*3VH{$mF1e6}JQ$L!_}z6wJM{!5F&Xk142`+*VotjA znH(SaZM&ptGtBp51bV)T-13+RIAhTzJ7VXMXDdQ{1T`%z!Z7%$U*P@1^mA8ck5p}* zGB0gzY_}?uC>!Vait<1;Ag7TrO_};0d9%@!a4P11@A+zI_H4;8pYhxFmy?ZHRTeCn zY_NIZ`-DmqhgYTDxLpuAY-q`mxIlv%ft!R{CYSTPGUqJrPPS&YXl)jH2E=;I@Q`|E za!jm6rMl=5YI(nzr@8aYR+_Gp5kuZX$0pV7#%vjPic7@5RW%8hF@e;Suf}^*o08qv zlC4+(SSot8?N@Pg=1ic^c1-qV51?4A-r9Iy#3b90%MsftC@*{o=`@b7%6jsY;Q@Yhs_{DeX;Vm5PTY>VrLfhw}` z_1%Rq_D@_9_)I;<75pwZ1jJ7v=3+8g>={dke$;``kYiP*n;{}dU`^DELcgfj>}$hV zC8>AWOl*g0rAw7-n{3uYdF|n22oL>Wn9>w4-A*V2glpKiF3IW3$rZ9_p!DVy#eCJK z?3VinPf1t3+Y1>$Q)VQbz4y)0$%lH%@JweC7&9qqzo1Pi0)!w57O(C zVXRy+Vr{x-ua`zi(K0F?dD>_VmC=*$LKaDWtdB(N@&&e;Gw5V-SubA&bkjJFA zoJ3wrgODB+#nh43)FD@t$!3x37}j~A-?Qh2dM66>5( zu0oj3c~aJzIli)bqO_IaQ__Tc0lX^6@jQ z!66xvbhe!xubC}ZbUiiUl$1KnQFEI2rP_SpnkkE=OD|lyFgMxi^2*Y=9Nja-xjsQJ z+4JiH79J~*EryNka zsUNxTH)>MYDUoAy7Fd{3@d{I@lj$zS&*Y<`zVnvLcI{fSG3j~seGy99n8|m;O~f`` z`jAg`C9t<&Wr|B;539tPEPVTQf9KZiSMAiYq$Hl?Wo4)7F7H3k_E+Xrq z%1tj}oyi#I4bn~|K%;XUUsj%LTjoZh(WpkLesSm4sD8(CY|c@Q1llFi!y@gC%gYox z363}uL<1j`q?W&;m0~7BKg8yQp1jbA@6FiVzR6KwoEP#_WpBSe(mAGc?=jP2$jQ&X zb5J5JD=UkM+ zV`K@n1=a@F8^0f1PJ$a@M=V1nIk2%#;yN~ta+CK<*ONXA%PxGz)?)jew?b&j_IFn$ z2;kv4!n})sT$x68|DFBv=z%Y$>(g95k*BkKiY>W-jFeqw!f8@H$tx&8JjJ`O4L7g6 zpXOt`pyq+0qV59W^=(8vDCq#o5Pk2L>}`E4NGb%B{4ZSuIgmUGj#4!--i zNxpBXQG{(d5sQ_R(tFvkO~I3VRNuL!y3r@ozy|ScB`S0LuOhROr^YY$st?JhEqO7o|Iofb4PQx4NzfGfLM&GguX=1___2cC(5L zb+P5Nh^aOBWnP0RwQGzCnts1g!8S8DL`t%=EY?a$hKU`j<{@%IHE%lSk;T;~R!|a6 zlh1+=bVAU2p$^(!^EP%+Im, 2011, 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-27 05:41+0200\n" +"Last-Translator: Miroslav Nikolić \n" +"Language-Team: Serbian \n" +"Language: sr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : n" +"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Podržane vrednosti pročišćavanja:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Posebne vrednosti pročišćavanja:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Uključuje sve ne-ponaÅ¡ajuće opcije pročišćavanja" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Dodatne promenljive okruženja:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Zarezom razdvojen spisak GL proÅ¡irenja koja su isključena" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" +"Prevazilazi GL izdanje za koje će Kogl smatrati da ga podržavaju upravljački " +"programi" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Koglove opcije pročišćavanja za postavljanje" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Koglove opcije pročišćavanja za uklanjanje" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Opcije Kogla" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Prikazuje opcije Kogla" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Koglovo praćenje" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Reference objekta Kogla" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Pročišćava probleme brojanja referenci za objekte Kogla" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Prati isecanje sklopa" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Pročišćava stvaranje isečaka sklopa" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Prati sklopove atlasa" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Pročišćava upravljanje atlasom sklopa" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Prati niske stapanja" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Pročišćava obrađivanje niski stapanja Kogla" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Prati rukavac" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Pregleda sve oblike koji prolaze kroz rukavac" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Prati grupisanje" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Prikazuje kako oblik biva grupisan u rukavcu" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Prati matrice" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Prati sva rukovanja matricom" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Prati meÅ¡ano crtanje" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Prati neke radnje meÅ¡anog crtanja" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Prati Pango iscrtavača" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Prati Kogl Pango iscrtavača" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Prati pozadinca mape tačaka sklopa Kogla" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Prati pozadinca mape tačaka sklopa Kogla" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Obvidni" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Pravougaonici konture" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaje žičane konture za sve pravougaone oblike" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Prikazuje žičane ramove" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Dodaje žičane konture za sve oblike" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Koreni uzrok" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Isključi grupisanje rukavca" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Isključuje grupisanje oblika u rukavcu Kogla." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Isključi međumemorije vrhunca GL-a" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Isključuje korišćenje objekata međumemorije vrhunca OpenGL-a" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Isključi međumemorije tačke GL-a" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Isključuje korišćenje objekata međumemorije tačke OpenGL-a" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Isključi softversko preobražavanje pravougaonika" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Koristi grafički procesor za preobražavanje pravougaonog oblika" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Specijalista Kogla" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "UskladiÅ¡ti slike atlasa" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "SkladiÅ¡ti izmene atlasa sklopa u datoteku slike" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Isključi atlasiranje sklopa" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Isključuje upotrebu atlasiranja sklopa" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Isključi deljenje atlasa sklopa između teksta i slika" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Kada je ovo podeÅ¡eno ostava simbola će uvek koristiti odvojene sklopove za " +"svoj atlas. U suprotnom će pokuÅ¡ati da deli atlas sa slikama." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Isključi prikaz sklopa" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Isključuje prikaz sklopa bilo koje osnovne funkcije" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Isključi arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Isključuje upotrebu programa ARB odlomaka" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Isključi stalnu" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Isključuje upotrebu pozadinca spojke stalne funkcije" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Isključi GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Isključuje upotrebu GLSL-a" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Isključi stapanje" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Isključuje upotrebu stapanja" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Isključi sklopove koji nisu stepen dvojke" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Čini da Kogl misli da GL upravljački program ne podržava NPOT sklopove tako " +"da će napraviti iseckane sklopove ili sklopove sa rasipanjem umesto toga." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Isključi softversko odsecanje" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Isključuje Koglove pokuÅ¡aje da odseče neke pravougaonike u softveru." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Prikaži izvor" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Prikazuje stvoreni ARBfp/GLSL izvorni kod" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Prati neki OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Prati neke odabrane pozive OpenGL-a" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Prati vanekransku podrÅ¡ku" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Pročisti vanekransku podrÅ¡ku" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Isključi ostave programa" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Isključuje ostave prebacivanja za arbfp i glsl programe" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Isključi optimizaciju čitanja tačke" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Isključuje optimizaciju za čitanje 1 tačke za jednostavne scene neprozirnih " +"pravougaonika" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Prati odsecanje" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Zapisuje podatke o tome kako Kogl primenjuje odsecanje" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Prati udele učinka" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "PokuÅ¡ava da istakne podoptimalno korišćenje Kogla." diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/po/sv.gmo b/po/sv.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c6ab5f00c010badc756a565b72e0722a7efd0d1c GIT binary patch literal 1729 zcma)*OK%)S5XT!5UduZX;lQf_afrg~!&pi*aUizWK}I&QyiSm~px&99*=BpYN8LSZ zoEwO5fcOAN;l=?DSmJ_^R(t^@4shTLaN)=e{yj6hUI!tirJmnZb#--Bb=M!~&VI=- z&SAcY`3>evm}?K%(9o8T{C@c$3U!HW;o z{@w$hf&3wO0UU!bgP(zy!LJ(qZ{TZ?{{ln&=O3>3zX}HX9{38l2ll}N3~_%CBAip> zsYVL53^~omqxeBO3`ejQX4oG_$O~at`5>(-UVuG<8EQTsAub$Ok4=*+ezWk>XvZoc zrD2)pQs+EVB6r*y?#Tb|TB*ZoKWyS*|Ar!+4!jKx3Sk|{`qGJ^BL42qU}qr+JIsoO z4=-G-m|5{e#eDUTpJw?X(Xo7lvXHS#mh~T!eC?$t2j<;a?)glrW`nXQj14a922+gmF|LpYWDCg%VO<<;e(dko>jMXVH}t zyXsQNMq3)Uk5?D-D?{m9>;|5EZY;@?}J05EoxzG@&R=Mz=J3qUN8{ksk zhp`uYh})c7-rF*fH>x^|ZEG?1a*9`5x4@EIcg~WcZXT-IXGtyebaq##A#^ULwVU?Xu$%(O&x!~D, 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-04-01 20:24+0100\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: Swedish \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Felsökningsvärden som stöds:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Speciella felsökningsvärden:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Aktiverar alla icke-beteendesakliga felsökningsflaggor" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Felsökningsflaggor för Cogl att ställa in" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Felsökningsflaggor för Cogl att ta bort" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Flaggor för Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Visa flaggor för Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Felsök CoglBlendString-tolkning" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Visualisera" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Visa trÃ¥dramar" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Använd grafikprocessorn för att transformera rektangulär geometri" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Inaktivera texturering" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Inaktivera arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Inaktivera GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Inaktivera användning av GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Visa källkod" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Visa genererad ARBfp/GLSL-källkod" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/ta.gmo b/po/ta.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c4173292f473bf4d0899e3dc3c603534dbbd019c GIT binary patch literal 13845 zcmd6tYmgk(b;mmx8?z3Mv11WCfn1VcAYxX#dKg$FTQ5*BlC_o=5m%)u)jQie+h}Hb z=$_F^B*wxn3=!b?5v6RBD!B^$K;@b>vgHtmf=}dA9-or9Qi(H33O+brlJbY7DwW6Y zoO5r_Lo>Sy*j1TQ&%Yn{p6CCZdwW(tc=wfOBR(JF_yvyVu85)rc-vd~;?sLu6#WwT zkKi<3;aue|C+Z)(REyJ25$xT zfj58+@aMp%!1sY)1x3#*{{EkV*KqwBI1By=d>44r)z}1n5R~T+f@0@M@ILSva1;1C z_>16wfp>z}Pnn(vK)L@ADEdDSUJITF9rzOXE8yRQ?*XrPM-=@kxCz`0?g7Q01}JhK z1Gj=-1;y|0gCcJe&TIy60dEBtz&pT4z$d^z0^bep#)&=PQ4p2USy1MG1-uEo0E++L z2N4}jz0>lr36yw$02F(6fS`DC7Se6gmF{N*@0M z1`@w^t*jEFEFQ-76_lKa^`#n(f^+1W6B&`B$2E~t$gQO&S5|lWc z1ts1$AoP`=f*;`Tas3vI|2p_3a3{DMV<;19w7 z1n0rmA%)=WI3s$W06XBdkl+ybIJh7DD^U3Pen=_f?*zr4GvH^z^PuGQPJ;1eFahVl z{{cS@&QTQq4!#T?0KZGI<=}sVKL8)X_>Y70D5-3;*fnk1Y7m%%>;{|)>H@Wo$_q7Q*zBDh}!{|0;sJWi4XZ}|YVLcCuC zZ|C~-EyN6b5ky4vIKjRfJP&>X{8z9GHc9FtBPI6kWR|iar9)fg{@+`W!Ne7b{UJBRp1y7hzG5h2#vksA_=U*mx0+Q)$CFo*aid63Wh z49agz*WR!RocDKkd%VG;zy~?r#c?mk$2cUeH*$~?{YV^fTl=itv0ftQ&_d%UH6WjN z8fcG@(`z^gjrPo|LFgI1jpL&nH*>t5Lq3vo$&2I;%0#3``!AsDg&@?7u89QSd&mqY6QN{*cz&?0&Zhj3K#80}eFa;s^cxUAEzr_H2r%USN? zdfnBMtdX?yQ|k=LlWIF|);je#9~z#v)2tcSUD7;}=2^3mG~4b(oTu?(Jt^j*eOayU z4!2}bVHZbRNi~h@Y0jN&6-^-C5xR}jZ3#&k86c%XRb*6z%kD{&G7W_;)59I z@?<&5lV&v$WsOE$DUw#4$L(aviAI+#y8{PZauIRK{S>E>dF~U`|PO~jj(xT}2NQ*SHv+yI^ zSkggl+^)xkYsAgCmPiDn{bq+4JD;9R>TYjm8PAy4e{d|xnLp;q(Szl%k7S)(va=Ys zt1D``pC9Lo%dK))cr5V=TySaAwO102f%9^v`!ggeg94Y~(PCUZ?y7NhB~VM0xR}`1 z>P4MEXSFwG zdR?TARy}b=H4%2>OxB7Y>Lk!Y$qOS(ZQdAfZh2cIx|W7~P+R%DSb^JUl*kNcZ!u}F z3K!(A`kXe%W?x~EEw@*NW7T@vY7K_2d?IGLb{;ni3bRq_9MUs5(H@Mwg9WDuIN@ri zCkCwO6qNt6+jC^ETh8N}mg^;X@q-Q=9AJ{aces@_A*DrVQAz1Ct-Zdd!$VIPP1hew z%?;DZ%b4hTcupFWMQ*v%tST>BX)BTL2Is5Cks88SD3fn4D7JReXtlNWB^R!s`3+D+ zh#yh{;X4f|to0cZDtCqqbJZ1EBaEY)#7(E;Fsq(KcQ>^UYLgXyFD5JTiIk$GCbgfz zQ0t8cGumC+l*Ajq<3-xETgg_f0#lv}xg}#lz>-CW;^S!6KHH|mk3-EE77-Zow3L(m z+%08E(Y(1G`jq?V{NaV*LV>e3CvCGluo}?Q=$Njkr&ao<_mpzV`{%1^d&RBB1;f%N z-|^CPbl6svfk;M&QJ$wul!}?drLx+AWRN%5H`F3Jl4WhTFDBj5(J~ex zW_qVaty_nO)XS|c!dhJFad%>7L-(H$kf{h_iAfO&a(Qr4lg#X>K{ z^m9tKnOq$xi>zHe6d{H>={j=t!-ESJK)_okQwnv7*ZW<*JH11wDN_ zx}Pqpl%Bs|YQ7y>cHsW-F6mgBtZE04DJ2P8uwFRWUdgjgZAIk;0v=0?4qK#$ljwmJ zSyEP{`Y}DR!mia%wN`B9vWkuCtMRGANmGm&Wm}$5t-3O%^gHch)9x^4ukw4Zpo)+9yKSzg;huS@dZuzT|-d#_{hyH*$*N&$S-FxWner#r^ zXQuXLIN3z+sTK}MK)1B&aoW5~R+XHT@4A2Cp2{8laY{CJNq0ACZ!l=i-LaUqr+&S1 zz&fEAelR<({Bg6>vs3eRS#K)$u(T9&uG!MdV%OHYoSp7!x*K=7*}JBqUiV_Jd#=}g zMNhumTYI|KJ=^Pkn-kaTKGy3#-&=d4*L_YO@cpPfwn1{vg{sF4jIH61+_A zB4ACwpRp0Z<2Jl64LgEBjA8^bxP>_gKZ`B@FYP22pOW~A>Cg4L7fS!Q`%O27@xk@)N$M7{CrC&*ul}Czb%*j0X&=&&B44F4_!}0%@D%N&5lyDX8xx))6D{BI zxs-F$IGESI{djdIu)^$p!pK0n$t91CC5Szp z?KojD<1?Tc}1<$`Fm5 zhPMpq23nOt#spIggS;mM5K(1281;mDBs4f4e5Ddqnmv%-jcsp82wUo2_j4TMbo9EE z0b(JDI1hEss0|oX5>i7T;UMsVTWZcYf%@abItqOY3|ftGsvDZ(Ke6YejFTkVv|f&N z7$jcUn!`ec&G<&FC3s`3osQHg@*n(KXK)l;)7C7qU(lqfQvH#nPae&>%Ekd=+0QD5 zd^*&vk$^Z84H>~R?C=*ln}`pEV!Ru8VXPHTbpa=3&ubtt(F~ms0j63Rj2ej*6uh)N zt&&I4OqEI%Gu{lhvXKU{L9K;AOt#?*QqtX59J1ga;xNb7HONo~PZwxm$Qt8DHx@&Y zl0m**W3}yIWD@ZtG*_{ zn6Lql7%|ebApx@`?&bg)A@kO}S?#p`eRAPdSWO4KXWE#)5b0f(592@bnQeR&8B8)o zMyxXJs180)>Np!q9_2O4$fGHz^FXao(`D0IN7);Qs6_BG+*ns~kb&`+-HZthyeYSF zgI-GG`0?wLA5yjCAZOSKu1TZ&hG)@G7a!so??{0fVwhG_pKWvvYG_io(;vCi*Fh;| zTSDBVnf@maolBCe@Yda8;LIp_mAkgA_UmTQlK-nerBzl)#6|3d@pJf9x!%esr5R1TiYn-J46 z?hU=gjI0!afZ@f7{g$jKXd~-bQbujy z2tZJao0q4@1bGH92VGWE5(whRbNsWq?H7>+_@d<`xFep!SMR6253*%~k%6ruEm)}A z8~gLnhP+WTq+qbAe7h&+rCfS934Zi8d#*OG$qtP)%YDum%6{Bl=3%M4CUAEHz6QOL zv_ZyrnfQNNsgHWuR$rzx@uJ)#5nN^mM?&xzA&CfOFR#PU7>{MS8Xz;VE~lR9?-+$) zgG3w7jMO=%6Ud?8O3|@?yOJNTF3qRs^tiN4@PvMujrL6Fyg;6ln zg;E1kPFs#kUm%|}Wi1cVgYdp0++hZ+pv)zTOoBOB#0w7nY_I~!(gr17PWI%|5UY>W z@x*)&*0phR;4h2g%o7ic#8ld8rJPV%Sux~8xiOWtOx6e&zYF7pU!(BooL+O{Q#hv0 z5G-hgVAO_C5Arok9c}^rp%!wYisF$TGaT|EbIYuhxq|bPy~6|2O#dYk`eTKhaEaIA znPzo#wI$0#Ds8pI#Neei4J5DE_`4cbTOj6 zVwJxQatjkAaCS=zoO7JDXptBTj074hAPJ;EnNSP|HcbCuf+om72S)WHgc{X9v=I27 zc8LkH?eTv^_J5WZQN9u431W%idK26;rF{bFpZv{AX#C#%h9Ua55JihhFwePjd2 zNXUYdloKq%J)E>VrIY;yevDj3Q4Q<;%%GeaM>TK4#^JQSZ}GxT^x;I`8x&wzS$P-B z^>U24p=8WVi-=&k|Cdu{VT+qrQ_w7krjEFC3Io!P`k7JPbtovkqBtr z!a$LZ55~g&s#U7xnFSJc!|#4RAjt5GuWbEBH+f9IsD0na9yG5FZBtnj@YAHf;12Mg zQDjyKAQyNz=Z$Hj94sg-@ZSsUtGvLtId4@P^~pbsN; zI@Gg9!x)9gVlp8&rcB62-w%xrB*GY<%#bbUiIIVx5;ZYi-b~O;h^;&NeF}Gt)Fp!$ zWU+=8JdzNghSubp5*KEut@MP)dNigZLxvNWVE!7f$0DQ*n#vI?$Q72!OUoCuqGTd+ z*V!)Uvalvu+91`YY?^^&JS0xEks&mj^`zNHhH)c4v6u<>P{XLfRN@DBd?0vi0UhZF w7LGI83JHq*^?cpx2+@(!SU&>7x{-y}elPPDO?ao13}`K@R|H|)mJ(+DFDx=8CjbBd literal 0 HcmV?d00001 diff --git a/po/ta.po b/po/ta.po new file mode 100644 index 0000000..2f8b321 --- /dev/null +++ b/po/ta.po @@ -0,0 +1,368 @@ +# Tamil translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Shantha Kumar 2012. +# I Felix , 2011. +# Dr.T.Vasudevan , 2012. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-09-20 10:51+0530\n" +"Last-Translator: Dr.T.Vasudevan \n" +"Language-Team: Tamil \n" +"Language: ta\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "ஆதரிக்கப்படும் வழுநீக்கல் மதிப்புகள்:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "சிறப்பு வழுநீக்கல் மதிப்புகள்:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "நடத்தை - அல்லாத பிற ஏல்லா வழுநீக்கல் விருப்பங்களையும் செயல்படுத்தும்" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "கூடுதல் சூழல் மாறிகள்:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "காண்பித்துக்கொள்ள வேண்டிய GL நீட்சிகளின் கமாவால் பிரித்த பட்டியல் முடக்கப்பட்டுள்ளது" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "இயக்ககம் ஆதரிக்கும் என Cogl அனுமானித்துக்கொள்ளும் GL பதிப்பை மீறி செயல்படுத்து" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl பிழைதிருத்துதல் கொடிகளை அமைக்கிறது" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl பிழைதிருத்துதல் கொடிகளை அமைத்தல்நீக்குகிறது" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl விருப்பங்கள்" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl விருப்பங்களை காட்டவும்" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl தடமறிதல்" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject குறிப்புகள்" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects க்கான குறிப்பு எண்ணிடல் சிக்கல்களை வழுநீக்கு" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "டெக்ஸ்ச்சர் ஸ்லைசிங்கை தடமறி" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "டெக்ஸ்ச்சர் ஸ்லைசஸின் உருவாக்கத்தை வழுநீக்கு" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "அட்லாஸ் டெக்ஸ்ச்சர்களைத் தடமறி" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "டெக்ஸ்ச்சர் அட்லாஸ் நிர்வாகத்தை வழுநீக்கு" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "கலப்பு சரங்களைத் தடமறி" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString பாகுபடுத்தலை வழுநீக்கு" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "இதழைத் தடமறி" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "இதழின் வழியே கடந்து செல்லும் எல்லா வடிவங்களையும் காண்பி" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "தொகுப்பாக்கத்தைத் தடமறி" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "இதழில் வடிவம் எப்படி தொகுப்பாக்கம் செய்யப்படுகிறது எனக் காண்பி" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "அணிகளைத் தடமறி" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "எல்லா அணி கையாளுகைகளையும் தடமறி" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "மற்ற வரைபொருள்களைத் தடமறி" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "சில மற்ற வரைபொருள் செயல்பாடுகளைத் தடமறி" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "பேங்கோ ரென்டரரைத் தடமறி" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl பேங்கோ ரென்டரரைத் தடமறி" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap பின்புல முறைமையைத் தடமறி" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "CoglTexturePixmap பின்புல டெக்ஸ்ச்சர் முறைமையைத் தடமறி" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "காட்சிப்படுத்து" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "வெளிவரை செவ்வகங்கள்" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "செவ்வக வடிவங்கள் அனைத்துக்கும் வயர் வெளிவரையைச் சேர்க்கவும்" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "வயர்ஃப்ரேம்களைக் காண்பி" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "வடிவங்கள் அனைத்துக்கும் வயர் வெளிவரையைச் சேர்க்கவும்" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "மூலக் காரணம்" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "இதழ் தொகுப்பாக்கத்தை முடக்கு" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl இதழில் வடிவங்களைத் தொகுப்பாக்கம் செய்தலை முடக்கு." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL முனை தாங்கல்களை முடக்கு" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL முனை தாங்கல் பொருள்களைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL பிக்சல் தாங்கல்களை முடக்கு" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL பிக்சல் தாங்கல் பொருள்களைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "மென்பொருள் செவ்வக உருமாற்றத்தை முடக்கு" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "செவ்வக வடிவத்தை உருமாற்ற GPU வைப் பயன்படுத்து" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl வல்லுநர்" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "அட்லாஸ் படங்களைத் திணி" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "டெக்ஸ்ச்சர் அட்லாஸ் மாற்றங்களை ஒரு படக் கோப்பில் திணி" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "டெக்ஸ்ச்சர் அட்லாசிங்கை முடக்கு" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "டெக்ஸ்ச்சர் அட்லாஸிங்கைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "உரைக்கும் படங்களுக்கும் இடையே டெக்ஸ்ச்சர் அட்லாசைப் பகிர்ந்துகொள்ளுதலை முடக்கு" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"இதை அமைத்திருந்தால், கிளிஃப் தேக்ககமானது அதன் அட்லாசுக்கு எப்போதும் தனியான ஒரு " +"டெக்ஸ்ச்சரையே பயன்படுத்தும். இல்லாவிட்டால் அட்லாஸை படங்களுடன் பகிர்ந்துகொள்ள முயற்சிக்கும்." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "டெக்ஸ்ச்சரிங் செய்தலை முடக்கு" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "பண்பற்றதை டெக்ஸ்ச்சரிங் செய்தலை முடக்கு" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp ஐ முடக்கு" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB துண்டு நிரல்களைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "நிலையானவற்றை முடக்கு" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "நிலையான செயல்தொகுதி பைப்லைன் பின்புல முறைமையைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL ஐ முடக்கு" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL பயன்பாட்டை முடக்கு" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "கலத்தலை முடக்கு" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "கலத்தலைப் பயன்படுத்துவதை முடக்கு" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "அடுக்கு இரன்டு என அல்லாத டெக்ஸ்ச்சர்களை முடக்கு" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"GL இயக்ககங்கள் NPOT டெக்ஸ்ச்சர்களை ஆதரிக்காது, ஆகவே அது கூறிட்ட டெக்ஸ்ச்சர்கள் அல்லது வீணான " +"டெக்ஸ்ச்சர்களை உருவாக்கும் என Cogl ஐ நினைத்துக்கொள்ளச் செய்யும்." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "மென்பொருள் கிளிப்பிங்கை முடக்கு" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"மென்பொருளில் சில செவ்வகங்களைக் கிளிப் செய்ய Cogl எடுக்கும் முயற்சிகளை முடக்குகிறது." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "மூலத்தைக் காண்பி" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "உருவாக்கப்பட்ட ARBfp/GLSL மூலக் குறியீட்டைக் காண்பி" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "சில OpenGL ஐத் தடமறி" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "தேர்ந்தெடுக்கப்பட்ட சில OpenGL அழைப்புகளைத் தடமறி" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "திரையிலல்லாத ஆதரவைத் தடமறி" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "திரையிலல்லாத ஆதரவை வழுநீக்கு" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "நிரல் தேக்ககங்களை முடக்கு" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp மற்றும் glsl நிரல்களுக்கு ஃபால்பேக் தேக்ககங்களை முடக்கு" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "பிக்சல் உகப்பாக்குதலைப் படித்தலை முடக்கு" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"ஒளி ஊடுருவக்கூடிய செவ்வகங்களின் எளிய காட்சிகளுக்கு 1px ஐ வாசிப்பதற்கான உகப்பாக்கலை " +"முடக்கு" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "கிளிப்பிங்கைத் தடமறி" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl எப்படி கிளிப்பிங்கை செயல்படுத்துகிறது என்ற தகவலைப் பதிவு செய்யும்" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "செயல்திறன் விவகாரங்களைத் தடமறி" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "உப-உகப்பாக்கல் Cogl பயன்பாட்டைத் தனிப்படுத்திக் காண்பிக்க முயற்சிக்கிறது." diff --git a/po/te.gmo b/po/te.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c9328bcddc72fc437df1e123dc04a44cd17dd7b0 GIT binary patch literal 12978 zcmb`MZH!!Jb;obg@Y02pmr|#+gg&9fNor=j>zKxD;v{}aOkz7W_QoMdExJ25J_dH(3&w0+v|D5y8?7zJKn)3m#PjP*S>-npLpaFjDZM^a7zC8#& z0{#S?1h08V5ZnOX3ceeB5PT0f=kHVSx4Hi_@OtnW@HfEM!R_Gp{rI)-41(*p-vr(Q z?gBpyHo)Hmp8!7yz5vQTZ~5`>f!A{Xui!NJpWu7J8-Ep@z~2Yu`B6~xJOSz_&?w$!0RV$pNBvh{~Rd$e+hga_%+ahZ-5^Ke+>RQc=fx2;P=1{;3jYfDE2f! zk@E#`3-|&kcK;9*c^fch6L>Rt3pfjI1OF5}2VMr>58jOtJHW#rTL$MrS$`3{5qu34 z`+o=`I+*x1i^B#`{JjwreeM810M3H^1u<`;{|Qj^d;&y7@CqpVejAkee-DbBpMny{ zUx54t8wj@GjiAWi3jP+j4;1}spz!4+DC?dDMc;3OvR@Yzze&(4z$Q@aco-xk!Q-I# z;XEk*{xCv+eii%xGw!EQ{>$L=;2(h7QPzRafTGVE{{A1qocsR*>)=t0`55>EFafWD z40B)(-X-JUN$@&^{2}-ya6kC(;6d2 z6P&Xb{0{hU;5$f;hr#~u)faIS7XTf{G7s1Wo z&;9s^Aj1yso1ny}1AY?xvB!-hi})`AL-0G`?cnuH-UdDl-U0q4xCi_`=)mhBm-uBH zxEuTiD1Q9~_-XLiWDxu@_;=tF;0~0!2>t^|Xo6%a2)=t2d;~wk{X<*u5%@MP$&-Ct z+qpy+$HlaPmv95>XfBAJ!VS@nFzX9716-=PBLfm+u^XCe9Rq>`T=#Q{KjkI%Cm}aY-z8aNWR#EA>UFv{t>_-wV9Qe})FZyx)-snTE{puc5zpGq;^~38qbTUoXdz0Y zW;K${8jY}$MXfLm^Jw15jxJend-l2LL>@IWQAsvvr4hIDF2pnQaVCn-2fIZPC))3< z^YCzV!oYqwfSn)`8-aMh&U%w#pv zEe#tzBNi|XS9_J3Nwd;QmZG$hEL8HP#Ch-Z<|pu|5kC?No0Pk06p9jVx^+VDv$)Z! zM=q;I!fuR7TH)u~5wuY9!pL$ruZ&l>92SYLr7rK^t$dy>!fkdG&kROyF3OjL3o@!U z#|@&{+b~NO@+IL|wH~)x{jMvYh?*`>!)8WeHp)E*_UT_}4@Qol!ATsByYl#WpBC+m z^j~m04()UcX;{;AT@e>QY0thsCi$@gt*8kp%|mlaN|$Kv^(-BndfaHb`do5ukWOC4 zSksH=gh5&47TV3K@}d>DBB^e0zIqI)g&Q+v@=Y1ZmPd_NuDLIQQh{Q|q7>S>g9wv=|lqBS+PE*F z+{H}^yzx7nqfEQSWXUox=BbcdA|?bZS+qYq#?D%2b5i^m)C^$}jv-F-DbY{ed=h2N zoARPgxd#p&m@Q1mFxJ+@IqiXNKux1!x~v{oshi$X(kbnIUW)TYw-jbfi<`WM^OL~= z>neSo3=Xh)8qbp|rVh7Kc5ORVSvL%+k%T}dd4+vJ&4NQolDl0Y;SLU$z9@XABQ;>+Rv#Q&jhD%ZqY{EfknYcqprYoj?&`WfOiEnSJ90Oop8lR9p6t`&fLQKD=WShy= ziPB{4c4Z^9@m7>7pXtYhg7=g|fIZTjvtrUe(hwWw%?46K0xNCWPZ5GBYs@YheZO7h zQ_ol_QY(BWY=>%DRF_)ot63G}WslfWcrmUm*105K<|^6-NLSssol(;#g9oXiO6h|S zO3vp+$u77*cuG1FM@w1(WJyWF7OWQz=8I|4t}Uv(f`CWjtj!VWktld*QCiBPWIw7$ zme{rW$=0HEF3Z@kz7(F!oD{{7S$5dOGMS{c%@nvO{VWeAtF`zpn$vu{ns2Yx+tlrJg349d zB?Sr%D!ZvuGj7Y&^w!GMZI!95ZhGs?ty?!uO;1fRv2rLn9!tIH&D&C$+E$rn-jNX%6qG4@Z`k)`}W_{ z^V{^~)Wog?Uo=tgWD7gR*_&JSFmB#19Vdkj+aH|0x3aA_Pl?D0>YgU04|dJCZF6xx zv0~qYb!kDBd+9dWjBB>^Hru}Cc4r^AH{A`}-Sq7fpRVk&`YN8;mmE`8y6MTS6G6B0 zx83E(x}E2{%U_iD&KcM3JgYaab~|s%q4iQKPrmmlqRkoi_Hv?o(u)Kwy}+xfE06@8G_>2|)QgQi|brOBlK zt8U{I`-13#;+?OV?yq*2&#EEpc}YEiN_Yj+7{PTsJ!2j~HyneF%)nP@_)53)n$8m& z{I{rXhZ*>S)z9cW{D(Z|oes1(>F%r-1-hNDiog8$vpVxRc{Jei3&n)ZaOco!jRgeb}*2`cj*?{+Tp3F{fgTBfk*tLAhw)E4$@+rKHZU)ROYvj#1> z|9{-fe>+syU>L#+ZiuGni{h$Tw?i0>ZxD}B;&e_wFbUJ1#x%3@g5Il7mLHX)RuSb= zGP|&X85WP%)ETlL4(0*!-&FVaf5BASp-~ZLAqBT*Zq^6tRf)_u3(@4v7jHrEbD9MR zmI3bjQl{6OH8qG7laYawkteCQ`g);||JKSxVn)hi8Xrb2#MaRcW-T6u3Kn&tPU#$; zeM_llzJvch7-(0nfDXQH5F)D^6bej`MMxl6NVGyguwawWZxzRA%z|%_LV3cikQ!Bt+lA|;o%MRzu$oNo%hEyq zlJXdOS=G2e+OB2gil0t2LxxjFwU*!vt1_eskHvN^Xuc4!$hv_AeYHkw?qLBbjb|{0 zcl;{Z$dI)^OV&%;^eATHP#zDuT7J|K&6HB2%radKZ!k-Yz&eW`LpaL{HOCJs=4IQ4 zNo!cT8Uak7zD!y@oI^ewTUXYl_OQ_-EMaJXKK&Jka5xPkcI< zC53|t9?c3LBUIa&IGb2V$XM}`a^+QS5NGv?hZalOhoJFnjYt?-zU~<>i-@GLEGLDsxWo5RA!%&!d4R@`@kkM?cwu@@sduy1~ACU{=BjP2m&x{o^ zS6_`810;EpftNJh?2v3ZC2{N*tn}##KBu)wjy=`+n@{H#eLqj ztEHXQp0zg9A9;$J02Qd}TEo|F2>vU-l9iZ>j$=DNT5yuES~%=5bKNhuHA1b9_IrKB zF=6cPR{vHFh9)NF4fo1lLhBLS(EMP331^WaB(SB3C-R7$)|)ui9Lz(cAYw1;Mp8x! z>PQKqJXqC{Bf30LveB89u|*O?#PbFJO@hmC|ogBPY#99?8 zV=>en1~z!EsGAm@Livt-m+zlrax5f)L6-~x=$qFtOEdMYtx zKq2hxolkgJ3NABNz7^zI;)4i7Ln8Dc4n#bJ7)s@ zo@3u22?pNvuCf0qjEt$4P&UN~Ib=XYG%^ubfna!`0g@9IOeN>lv!2uz6kBgurIX9* zqe6$h$Udy|-s6+h5ymcQI_$SD8w`Kmz59stkuLskiFH4%n!FIL|qmk;oC0Tb?{4lDjU12R*K8>(ZAzLjL!jF}Dtsa-&?;z&h-Z>n< z6LU`$b*z!cySIp5N2&sq9VgiL0Z%*mrdQ+zzGgbvHTWZ#xJuZ?Gge!LkYg$W`Hn1l zE4PgG(9X8BuJy9~KeYJQQK^7QK_tBOgdHp2>}40oAT^p#mU5!f=-)(nFp%P$H%SFC zt)FXp+0(Pas={(;H_ zKza+>oKm&QhA%F*0z{zY!wmb5&vuzE=IXoXyH1H@v#D+sOGwJ%5sAmB|KXEQgxpr~ zE~F^jEm{yNZ^UZzMN_OI1kCruwG1)AWlbHZq2nYp=XrvVL2{~S)(IGPp zaWr%tK2(mE1&8SkW(uuUeiyRV)gK!%yDZzJC_yA!tX8~8a9K2d2U`s1aG50qj#wvo z#z-BhB=+M@@j|e!pKiy<4hk&^3APze_^Cx&J&GGy`8k`?DyhmSv6ql(E>Q3A&jlPA zlwX*}Z-i@bzVs?xCXMzA*~Z>_zz_)(yWxs7Zfk!+z#dkw%1BgNLr6axFCtwKNQ+(2?fg06 zMXRTZ+FEwWGtPTUW@zsr$WJpBRm!}<*0TCP%CoZiW1mfe7EH1vWdyq5cL=5@mh~P? zkUX|2j{MyPrPztE;NjD55C3*Y#3dc<*;1sVOb$j?NA$y!mps`za$p-#IL4~RR#=L7 zggjH6`qup4On>&_I^5+IL>mr*_7xrfl0T=E{bx|#PLz^Kv^)4_`D>?jv%5^Uq8N#X zq@uCLI*`>W`9+2y9A~)&P1*kxL&fn!9x!)Ej+D?c{1*FO^Y2ddn6nMEqd@k2F(zNjTE#d$bZNH}`C{&v)7k}N`V0>ZXs$w8)c zHHLho)OYA=#j)U^s(|Atq(iw;E|UdvjvwJHHW=)4%V*2R#Dl)?2ZLRC;D{9bFNO)L AfdBvi literal 0 HcmV?d00001 diff --git a/po/te.po b/po/te.po new file mode 100644 index 0000000..cb1a187 --- /dev/null +++ b/po/te.po @@ -0,0 +1,365 @@ +# Copyright (C) 2011, 2012 Swecha Telugu Localisation Team +# This file is distributed under the same license as the PACKAGE package. +# +# Sasi Bhushan Boddepalli, 2011. +# Krishnababu Krothapalli , 2012. +# GVS.Giri,2012. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-14 12:37+0530\n" +"Last-Translator: Krishnababu Krothapalli \n" +"Language-Team: Telugu \n" +"Language: te\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"sourceforge.net>\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 1.4\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "తోడ్పాటునిచ్చు డీబగ్ విలువలు:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "ప్రత్యేక డీబగ్ విలువలు:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "అన్ని ప్రవర్తన-లేని డీబగ్ ఐచ్చికాలను చేతనంచేయును" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "అదనపు యెన్విరాన్మెంట్ వేరియబల్స్:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "అచేతనమైనవిగా నటించే GL విస్తరింపుల జాబితా" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "డ్రైవర్ తోడ్పాటునిస్తుందని Cogl అనుకొనే GL వర్షన్ వోవర్‌రైడ్ చేయి" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl క్రమబద్దీకరించడానికి దోష నివారణ జెండాలు" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl క్రమరహిత పరచడానికి దోష నివారణ జెండాలు" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl ఇచ్ఛికాలు" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl ఇచ్ఛికాలను చూపుము" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl జాడపట్టుట" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject ప్రస్తావనలు" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects కొరకు డీబగ్ ప్రస్తావన లెక్కింపు సమస్యలు" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "టెక్చర్ స్లైసింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "టెక్చర్ స్లైసెస్ సృష్టీకరణ డీబగ్" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "అట్లాస్ టెక్చర్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "టెక్చర్ అట్లాస్ నిర్వహణ డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "బ్లెండ్ స్ట్రింగ్స్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString పదచ్ఛేదం(పార్శింగ్) డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "జర్నల్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "జర్నల్ ద్వారా మొత్తం జ్యామితి పదచ్ఛేదం(పార్శింగ్) దర్శించు" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "బాచింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "జర్నల్ నందు జ్యామితి యెలా బాచ్‌డ్ చేయబడెనో చూపు" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "జాడ పట్టు మాట్రిసెస్" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "మొత్తం మాట్రిక్స్ నడుపుదల జాడ పట్టు" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "మిస్క్ చిత్రీకరణ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "కొన్ని మిస్క్ చిత్రీకరణ కార్యములను జాడ పట్టు" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "పాంగో రెండరర్‌ను జాడ పట్టు" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl పాంగో రెండరర్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap బాకెండ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl టెక్టర్ పిక్స్‌మాప్ బ్యాకెండ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "దృశ్యనీయం" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "ఆన్‌లైన్ దీర్ఘచతురస్త్రాలు" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "మొత్త దీర్ఘచతురస్త్ర జ్యామితికి వైర్ కట్టుగీతలు జతచేయి" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "వైర్‌చట్రములను చూపు" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "మొత్తం జ్యామితికి వైర్ కట్టుగీతలను జతచేయి" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "మూల కారణం" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "జర్నల్ బ్యాచింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl జర్నల్ నందు జ్యామితి బ్యాచింగ్ అచేతనంచేయి." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL వర్టెక్స్ బఫర్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL వర్టెక్స్ బఫర్ వస్తువులు అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL పిగ్జెల్ బఫర్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL పిగ్జెల్ బఫర్ వస్తువుల వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "సాఫ్టువేర్ రెక్ట్ బదలాయింపును అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "దీర్ఘచతురస్త్ర జ్యామితి బదలాయించుటకు GPU వుపయోగించు" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl నిపుణి" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "అట్లాస్ ప్రతిరూపాలను డంప్‌చేయి" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "టెక్చర్ అట్లాస్ మార్పులను ప్రతిరూప ఫైలునకు డంప్ చేయి" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "టెక్టర్ అట్లాసింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "టెక్చర్ అట్లాసింగ్ వుపయోగంను అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "టెక్చర్ అట్లాస్‌ను పాఠము మరియు ప్రతిరూపముల మధ్య పంచుకొనుట అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"ఇది అమర్చివున్నప్పుడు గ్లిఫ్ క్యాచీ యెల్లప్పుడూ ప్రత్యేక టెక్చర్‌ను దాని అట్లాస్ కొరకు వుపయోగించును. లేకపోతే " +"యిది అట్లాస్‌ను ప్రతిరూపములతో పంచుకొనుటకు ప్రయత్నించును." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "టెక్టరింగ్ అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "ఏ ధాతువుల టెక్చరింగైనా అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB ఫ్రాగ్‌మెంట్ ప్రోగ్రామ్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "నిర్దిష్టత అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "నిర్దిష్ట ప్రమేయ పైప్‌లైన్ బాకెండ్ వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "మిశ్రణం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "మిశ్రణం వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "non-power-of-two టెక్చర్లు అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"GL డ్రైవర్ NPOT టెక్చర్సుకు తోడ్పాటునీయదని Cogl అనుకొనునట్లు చేయును అలా అది వ్యర్థంతో స్లైస్‌డ్ " +"టెక్చర్స్ లేదా టెక్చర్స్ ను సృష్టిస్తుంది." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "సాఫ్టువేర్ క్లిప్పింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "సాఫ్టువేర్ నందు కొన్ని దీర్ఘచతురస్త్రాలను క్లిప్ చేయుటకు Cogl యొక్క ప్రయత్నాలను అచేతనంచేయును." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "మూలమును చూపు" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "జనియింపచేసిన ARBfp/GLSL మూలపు కోడ్ చూపుము" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "OpenGL జాడ పట్టు" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "ఎంపికచేసిన OpenGL కాల్స్ జాడ పట్టును" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "offscreen తోడ్పాటు జాడ పట్టు" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "offscreen తోడ్పాటు డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "ప్రోగ్రామ్ క్యాచీలను అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp మరియు glsl ప్రోగ్రామ్స్ కొరకు ఫాల్‌బాక్ క్యాచీలను అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "పిగ్జెల్ ఆప్టిమైజేషన్ చదువుట అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "అస్వచ్ఛ దీర్ఘచతురస్త్రాల సాదారణ సన్నివేశాల కొరకు 1px చదువుటకు ఆప్టిమైజేషన్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "క్లిప్పింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl యెలా క్లిప్పింగ్ అమలుచేస్తోందో గురించిన లాగ్స్ సమాచారం" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "ప్రదర్శన పరిగణలు కనుగోనటం" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "ఉప ఐచ్ఛికం Cogl ఉపయోగ ఎత్తిచూపే ప్రయత్నిస్తుంది." diff --git a/po/th.gmo b/po/th.gmo new file mode 100644 index 0000000000000000000000000000000000000000..c1c22063b1e316a1d1461fe6dff0adea43376d49 GIT binary patch literal 12168 zcmcJUZ;TvgeaD9o5_%9yX)*mn;0X|%)a?1rasKp3ApRF)VspkmCsb8c&F#+aPO`hR znVI$35iLm^2so+QK%CZg1U?7rTBlJBNt#`X)OYQRwyKI0DSZK&RsvO(;7wn&ebK6) z-|u;5X7_IHY=c~KFEXVsfzIl!3b-|CljW0ggb)NSj z@L$1c@Y?G=?Sd%+QS5BN{+{ta*Uy!Uav1-up9 z1%3eRg1-tr1O6I#0Texd_hcmvlz1ZTnj1m6wb{0rCw-T}(c-Uzu<3yH%?hS4}x<45m59$3;qj5a;!HARn|hbc!zNJT{ZUZtxf}cyZ~^4c3;7cJkAY(6Gaw?ozW_z=cR(5ckD$o;H&F8U z-ynb9CXy|9Gbr-6gTD^$2gSY?D112%%DfjqvG+Tm=*vKfnc#czPD>fNy{ea3{qg{8<6z z`kx)%L6Gm@`Yb5(zXzTKKVm%ZdGIemiT`~V{}T8JcpAKsq&*3~4xW4qy!kK(*MEmo zp9inK+4}Q1xQ*-A!27{}2W8%Nk|1?I0wpeQfLp--0`CMryxETb9dHlVE1=}($DqV{ z=PjN$13m$Y{jY#x=YN0_ulM5YgW%^trg)b?dHyCS`FkrDf`>pt?k$5S!M_G2e)nO_ z?}Lwlp9cRAjKO`7<`M9_;N##lq{LF zwvT^A29(iSxC<1n?d2e?`azxYR%%B+pWyfu2Q*jS0Ny-@*edapkN7qIndM@N1Il^_ z-Gh4_LWklb@q9POJ`Ul;4vw2RBtP;Y#G2E0>XrSXO!Y&0z56(J+e@u|Ii;-ha|7SE zb3lKsU+Cst$050pJiVPmKD#(bg*V4R$~?lUc>$C+f>6%8Mo#!#&mnzEaxb5ESkQ0b z%K?u2IVfZ8GuMK`*J+NoatOyr9nLlyW+{vV6AjW%*b5TVjAG+=I;Isw-5`yRZ!jbd z>Z#vr4LW{2F+5DesONV~&^sE&QLh{HQghUgLw~UoBy--bsMRs^eHoP4i^Kh(9{Qay zN$vGQ?AOCy%U(2s#X+mZrD=BjR$|h~B!L@P@odn`pUy8ngn=dwnn4`&>VYWhcKuos z^!?aRgN6}}CTg0!`%Q2x4SI=~BntX*z-7buM5YlYVtB*bEruAeerJb=htpV$LRKQS z+NV*onbhMT=$T~D??-X!?qh_hM}uA}Q^F(}xJZjMYiHs{rdTpSt)F)M#B}|h-wGsx z-fnA$7<({07Ie(cK@-oIS3Y_(?VMVo#Q4Ov)k!)8I%>s!w{)V3YlPaF z)QftxezX+CwWwK3mm=e$Q;v_|Q8#?l7d9z(dq%xwRdUMFF<-w8}o4}{$~6ZQQ^ z1_88C^1{eMn={6lTih0jrmrC%*H%1F+Hf0<5}C>DEe7e5a6#^>&taErmI{-onJx*( z>YcFP9}iveM9eg4?DrB1vs>t#&@(>KKB&Bd1;+_E;Y!1!V^$0j%D-uL9NKA`vER~i zU6U6#Xz%_pCb@g_{h$XaZG;w;lqS;JD?ObYdeqW%EXLKB9bpmfsPy3)YS>g9$(Dsjp6eTsO{S1cM-nc)a-Gx0#yydsQNSik8 zXvtP!$WtM=WK0NHu;_sQFq*Z`rj+=@P}7G+1cp2{VzM8bMieBy&1v4J%x4bHFXS#H zIBVyGDa!+^0X>b5X_8J@r*Aq>DW|wRUkcN{d z&EZnou2rWdt3sb1NeX0;GuSoM#5)v4soCX|Ztrjri#%p}r$w#X4iBlD{jI`UTpGl6 zN-b)*c`~=`Y>8P6B#7Gg@X@uphitdBnyd(WE~_Tx(xs5x^5wF3)bG&U=e)yq0YH?^ zYJOi9x4`UB`YhOHpLq7>&b%eNOQ`^3*O`2XM99rz73li?g41@6>&i~xfiS6?-LbzU z4Z#jL2rVOX2+6F9vAgLcn#1I`94gxYm=}k~WE~3oEc8N5H>Y5mm8%0~k+qj=7eaf# zAH>RM)?-q^cg!ZhKGK@A&1C#eSA1w#A1Dn;tSr-Rh!8|sWBp>GANQ+x>KH3cYE8_9 z?NBWVI?`)hH>=~k=m>2Ix5HMu!y)yuSkq;Ia#h8Hgq}X_9ifXVr4JsFnoskVopXP3 zm-IjwENKUjDFq4puwFQrw&Q5fYOB1QfDeSpfGyIaf%jlrmXx+sKc)w^uv?wu{kC1X zY{mMWCI5J0q$&E0vRj_KT6JX%>37=2rp-KN#7iM#^MYsRr#mgyHtUz|cUt7O=}mi< z*W!V;2dQG#kv!DeD-!Qu9LYAUwy#lpz?S+PiDw5WU$xok*=l>AN0z3exV4pb7sS8EgXwxJ{3J_NV^B};sdol+@py_p zR@)`*3VUk1=~{DU+sy3t+RUA`neAqF``m5Yx6I7W%rLNaC^#BQ_bJD1tIf{TW^XsM zx6RGWZkf50ar^0MH7MFk;C~d)nIp7Y+PgVO`L`kp{BGIUap&Gv*AF|>^{D#^X0bDd z8MTGL@6MTpwjY|i>BC{IGdt6}w-w=j&?3+MWOBkBxt%(&@4%iiUbE9PQ@bL(?qSIB zJ|0PsxAr@J*!#GwG%+-|=g7i+wY$o3Nv&(-$Y?kJud#CkG5 zJAM1~ZBt%0dMq1$JsZB7jlP@>m-X^uHu_37Je`f6$c9g5!xyvRQ`zuBHeAVu&t*ey zzN~k+{8lzRl?|WIhC`jmNS=OMXMIg%%F{oQVImMAFNuobb62kQYL#KZC>x&5h8MHp zYvPi)hgPiD%i(#o;Dv1Xx_CHzK`q1LN-M>DTwKXUkE>9mBln!Ti1(NDzKzNS6+~cc z2vq=CdgPHIO14$!xF_BC#hC4$I?Kz#r zFz1{kPsTHhDcoeRh?Nb}YL|r%gq?2!MgEz_(A7auPILb>Hm;3n?v@0K`PQeg*T@Yg ziO)DmzBqv}BrBIE4xki;xM9hI_?N51N#>Ye#0+r^wS2N+D1?@=SCTV^vT?d6v$4LX zA{<*8kc$-quo45v54NI|0TdBq=ot*du`_zYQ_6&rz_*JylLy=K6#j}VSj;$>{*3Ed zXp;L+>r9tu5_%=`F&3g=2s}V2C)M){Urt!+Bc2zcF$41f;up2Y_p;KH7;Tt#`Y`{H|#hg zKih4nL^24EPOrOC6}(>U6yovmYSvo!@~+&0fh=HHiE?O0YSiZ|RYJk6vmmcgQp$F& zj;V!0m_TCOj=w5YKOZ963~QD~*k!jSFr73)3>KQA%~9*r8cQu@$vMWtA6uf5VJ%t` zVTD}b3N^9Nyd=8={jEYf-FeN4{a#i(iiWXqsjq!gy3*o@33z}q^>TPlE%>^2p^4%r zJ*$QiKuaJpX*-h3q(+ISd7Baz5I62jNF0kZ5(xe}+fSLrpG{M~?Gb74pY7_hcGZ!p zbJp7zSJW%hOA@;6g0?SmS-jNY7>lVE)rg`-w7yZuW`L~QT>&O?zwmHHFNqwpSjoSs z9S3!cA!Ynw7DB3Dsc{9$FcT9ooT0_)!Z~+%1>8U%IyCUMI`S@3gwyfKMqLcDgUi*& zQ#0Axu*4B|m_mZanTXRGIXZ&fP)HaE63qg$aGi9>`lPR9MTod15Aci=8<|SCP`OT~ zM;J>~&e&hPZyAd|22!<`-;>?Sb`lfGNd7W4TICycgz4`6RR>?*9({4aH44-2X_Yym zX#Ke*g&3BzRyqqp>@O0~L*7UsC9Gl)O9*CBC=4Rr1d&i~RQ60(ib>3#%(s3_uACyQ)W#{zSdrF~SM#2@u0y;|k3XB>0qtr9H;H;*jL9q{c$9QZbuFH6-Tb+n75{tdW%Xu^@tK-pz*TbuXT1Q53bM>Y`%f|gL#{PGw za{dW5ff^t=SL8)*o^yd|Oom{r446%MUaHblluka)=>J$MhZY)a?OZ088;d{|v4t0~ z=M@d#gj4P zkZ;9mh^4GBnmA%8sl!lv$y2q;(Yn$?M6Gi8XW*78my@zDqhTzc56z^rI;l!D}{7W(u;l!lS#R(EH(f%5VD11lh*yWpVJJ@HrKwpM;vYuNv zFo|#yY!(1bizpzg<&suLVL~__Vff2NfqnoPC=KkiQ9R89yX{904_K;UCwlDn@|dM- z6|#CUi%_9~r^TL%ghG^aDhGjMPK@N|4I)etkP=KFK+NP1mE;?1$5vkP(Iygm^JO9r J=*FS*{vT)0E-wH8 literal 0 HcmV?d00001 diff --git a/po/th.po b/po/th.po new file mode 100644 index 0000000..fbf6e76 --- /dev/null +++ b/po/th.po @@ -0,0 +1,362 @@ +# Thai translation for cogl. +# Copyright (C) 2012 Free Software Foundation, Inc. +# This file is distributed under the same license as the cogl package. +# Unticha Pramgoed , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl cogl-1.12\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-10-15 13:01+0700\n" +"Last-Translator: Unticha Pramgoed \n" +"Language-Team: Thai \n" +"Language: th\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.3\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "ค่าดีบั๊กที่รองรับ:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "ค่าดีบั๊กพิเศษ:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "เปิดใช้ตัวเลือกดีบั๊กที่ไม่เกี่ยวกับพฤติกรรมทั้งหมด" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "ตัวแปรสภาวะแวดล้อมเพิ่มเติม:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "รายชื่อคั่นด้วยจุลภาคของส่วนขยาย GL ที่จะทำทีว่าปิดใช้งาน" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "ทับค่ารุ่นของ GL ที่ Cogl จะถือว่าไดรเวอร์รองรับ" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "แฟล็กดีบั๊กของ Cogl ที่จะเปิดใช้" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "แฟล็กดีบั๊กของ Cogl ที่จะปิด" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "ตัวเลือกของ Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "แสดงตัวเลือกของ Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "การแกะรอย Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "การอ้าง CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "ดีบั๊กเรื่องจำนวนการอ้างสำหรับ CoglObject" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "แกะรอยการซอยเนื้อวัสดุ" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "ดีบั๊กการสร้างแผ่นซอยของเนื้อวัสดุ" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "แกะรอยเนื้อวัสดุแบบแอตลาส" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "ดีบั๊กการจัดการเนื้อวัสดุแบบแอตลาส" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "แกะรอยข้อความบรรยายการเกลี่ย" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "ดีบั๊กการแจง CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "แกะรอยใบจดคำสั่ง" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "ดูคำสั่งเรขาคณิตทั้งหมดที่ส่งผ่านใบจดคำสั่ง" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "แกะรอยการสร้างชุดคำสั่ง" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "แสดงการสะสมคำสั่งเรขาคณิตเป็นชุดในใบจดคำสั่ง" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "แกะรอยเมทริกซ์" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "แกะรอยการกระทำเมทริกซ์ทั้งหมด" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "แกะรอยการวาดจิปาถะ" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "แกะรอยการกระทำบางอย่างที่เกี่ยวกับการวาดจิปาถะ" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "แกะรอยตัววาด Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "แกะรอยตัววาด Pango ของ Cogl" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "แกะรอยแบ็กเอนด์ CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "แกะรอยแบ็กเอนด์ภาพเนื้อวัสดุแบบบิตแมปของ Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "การแสดงวัตถุ" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "ตีเส้นโครงสี่เหลี่ยม" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "เพิ่มเส้นโครงของวัตถุเรขาคณิตรูปสี่เหลี่ยมผืนผ้าทั้งหมด" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "แสดงโครงลวด" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "เพิ่มเส้นโครงลวดของวัตถุเรขาคณิตทั้งหมด" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "การจัดแจงระดับราก" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "ปิดการสะสมคำสั่งเป็นชุดในใบจดคำสั่ง" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "ปิดการสะสมคำสั่งเรขาคณิตเป็นชุดในใบจดคำสั่งของ Cogl" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "ปิดบัฟเฟอร์จุดยอดของ GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "ปิดการใช้วัตถุบัฟเฟอร์จุดยอดของ OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "ปิดบัฟเฟอร์พิกเซลของ GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "ปิดการใช้วัตถุบัฟเฟอร์พิกเซลของ OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "ปิดการแปลงสี่เหลี่ยมด้วยซอฟต์แวร์" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "ใช้ GPU ในการแปลงเรขาคณิตสี่เหลี่ยมผืนผ้า" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "ผู้ชำนาญเฉพาะ Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "ดัมป์ภาพแอตลาส" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "ดัมป์การเปลี่ยนแปลงในแอตลาสของเนื้อวัสดุออกเป็นแฟ้มรูปภาพ" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "ปิดการทำแอตลาสกับเนื้อวัสดุ" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "ปิดการทำแอตลาสกับเนื้อวัสดุ" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "ปิดการใช้แอตลาสเนื้อวัสดุร่วมกันระหว่างข้อความและรูปภาพ" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"เมื่อกำหนดค่านี้ แคชของ glyph จะใช้เนื้อวัสดุต่างหากในแอตลาสที่ใช้เสมอ มิฉะนั้น " +"ก็จะพยายามใช้แอตลาสร่วมกับรูปภาพต่างๆ" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "ปิดการใส่เนื้อวัสดุ" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "ปิดการใส่เนื้อวัสดุกับวัตถุมูลฐานใดๆ" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "ปิดการใช้ arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ปิดการใช้โปรแกรมคำนวณชิ้นส่วนแบบ ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "ปิดฟังก์ชันตายตัว" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "ปิดการใช้แบ็กเอนด์ของไปป์ไลน์แบบฟังก์ชันตายตัว" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "ปิดการใช้ GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "ปิดการใช้งาน GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "ปิดการเกลี่ย" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "ปิดใช้งานการเกลี่ย" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "ปิดการใช้เนื้อวัสดุที่ไม่ใช่กำลังของสอง" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"กำหนดให้ Cogl คิดว่าไดรเวอร์ GL ไม่รองรับข้อมูลเนื้อวัสดุแบบ NPOT (ไม่ใช่กำลังของสอง) เพื่อให้ " +"Cogl สร้างเนื้อวัสดุแบบซอยหรือเนื้อวัสดุที่เป็นขยะแทน" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "ปิดการขริบด้วยซอฟต์แวร์" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "ปิดไม่ให้ Cogl พยายามขริบสี่เหลี่ยมผืนผ้าด้วยซอฟต์แวร์" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "แสดงซอร์ส" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "แสดงซอร์ดโค้ด ARBfp/GLSL ที่สร้าง" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "แกะรอย OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "แกะรอยการเรียก OpenGL ที่เลือก" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "แกะรอยการรองรับการวาดนอกจอ" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "ดีบั๊กการรองรับการวาดนอกจอ" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "ปิดการใช้แคชของโปรแกรม" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "ปิดการใช้แคชสำรองสำหรับโปรแกรม arbfp และ glsl " + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "ปิดการปรับประสิทธิภาพการอ่านพิกเซล" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "ปิดการปรับประสิทธิภาพของการอ่าน 1px สำหรับกรณีอย่างง่ายของสี่เหลี่ยมทึบ" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "แกะรอยการขริบ" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "เก็บปูมข้อมูลเกี่ยวกับการทำงานของ Cogl ในการขริบ" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "แกะรอยเกี่ยวกับประสิทธิภาพ" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "พยายามชี้การใช้งาน Cogl ที่ด้อยประสิทธิภาพ" diff --git a/po/tr.gmo b/po/tr.gmo new file mode 100644 index 0000000000000000000000000000000000000000..af1801b441ce1dbe2d5df7d5d70ed9988059433c GIT binary patch literal 973 zcmah{&ubJh6dtuIu3i+xLlqtfqLj?e)J4m*YpeYsrCnOOqj-~a<~18PlMIeI7{+#IK2O5q}`2 zBf%8m*Px}~+&DNrX7BT?pD!DsV5@Y}=xP+?xLXS$wSYavMFq}4h3>C=wf4K+o_Ptw zTxOiBTVf`;f?+z?=c>jk3A%Mz8tX7WvA%813(Oo_&)HM76}d?u^VSMpIkb%(^v77I z5;A9xYEiM&B+zrNOqxyddnlFSq0pwl&{)w#O{bpIMwkh?SXz_UnQLdNc0SwoR?3zw za$hxD;SLj+jp7!I?z5-`aVxponu+2lA|czsed+y7bTNzRy9aTcMDa{COS(;R$x_R8 zrMNRTfll4yMS%`BxaF`=jKi?MBnmE7n3>`MozkM_0$GZ@NFc3kUsgR>7?!~tg-gFH zny3?Sw$WMdtWN$^97c_0LnUi+aZpk@4qv%uskqehkoCBwH)=mg*Vx=d=iTn1Wve, 2011. +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-11-16 11:01+0200\n" +"Last-Translator: Muhammet Kara \n" +"Language-Team: Turkish \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Lokalize 1.2\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Desteklenen hata ayıklama değerleri:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Özel hata ayıklama değerleri:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Atanacak Cogl hata ayıklama imleri" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Kaldırılacak Cogl hata ayıklama imleri" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl Seçenekleri" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl seçeneklerini göster" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/ug.gmo b/po/ug.gmo new file mode 100644 index 0000000000000000000000000000000000000000..5a01c4a55c11bdd2bf316a17c402e3863e10636d GIT binary patch literal 8611 zcmbuDTWlOx8ONtL+J-_)OIunBoV2Ah4eQuRAgO!HwNcVoj$$VWsihjPXV=^AO*6Z3 zQ$UDZ949nVL5dWia(Qwh(=;Tp)Y77e7y1AXJix=Qji5rjfGSnIAR!^a?|;sjy~K8$ zq$98YduGo0&Ug8L-}z?$a_5aF00x;_yE4+7VLJ>bLOa&QQ| z4XlH=g9rThN8slf{|x*B_#SvS*aV*fKl1l8HwVGJjGqHnfLZX1;BoMC;G5um;BP_g z^H+cWL-13KZ@MK2`oO!uJHV~r8gMVD=f}W%z?0yYz_Z}v;2-?>)?3{^E5Ofie-rpH zI1Jte?gt+OkAo}0cR=a;cTn>F3$6wqSmxFbf|?hCE5PI6o#5NxM(}qaf5B~^bo1{8 zzsz_AC_4s0{(|rGPyRd(%5OgbweJP+v*7Q+PlF$T((@xw`rLq%WcNd$_U!{Te+wu% z-vkwp3aItRLCJjsl>IZH;`~0SdH(>V-^~b>{0x`@2SDljZ4eg(XF&PwZScp}1;L-e z4UESz;(72La2{5&S3k6>tYiodRP}{<|Ne)`HK2n)gF+ z75Fc3E4UnC>%lxIy?+jF2j2%D0q?*Whro5U{noqvYFF~+|H z*MRrooDw(yB06{vl%0PBcY-&NqzA!Wp#1(PuowIfsP&H#Jn{TnpaD;UtHED^Yrzlw zcsap9WH1a$P8EC+D-&w`p)2RDO11-0+rz$d|b44eapz!$)i z9{&yE!eAKT>%f=6>%e|KvJUzq7<+r{n&TMP#*I4p(QDTCx^MQ(1 z7eZle6z_E@A4nUkx5l#TdOjO9@YgM%@Fmq#?etTUWg-8sn?2ya+H`{B{pHPX!22|6xHJWmzfer z*;-i6*Nb7?HN8+PRLWt|MCE;jxKb`f<(kVoqS;i>VHxY%5B5ee>lb)3w6isBN2MMsIwN5%J7zWa>%({?S8Yv8 zAIm=}7fhjSYGaZ0f$?&B+AHLhPJuaiG!kZCHrX&cmQqWbm=NFQi%AhjSMqUKY8#Qm zG+gaf@{hfM*6lb7M@`i_p#qOeg;ztdsr5V=gKaokx_0|>B&v-oI=XAMD3tJTd;6r4 ztBot_;}jsW?4gVm@^ zteu%7HrA$MDcx4Ld+I(H{majV%H2`&G8VNgeU2|}a7?aV&dS}WR*h6Npi=f_qy}5+ zC1PudoBCCEx zu2|V1A&jaL3}Sp-7$x55iQ5<|n;C{R$Jg-!RV^g-N^a6E(zUEPK5ie zVhmkMnB=RXw|!q&q-gX9L$0nM%K0R{ubLT|jn?_Yu7)ImySXXNbUzdWj4NO16xAWW zisDiVtF4&2H9pzBz=1-NHCy6vTzq#Eb`gh)*^Ok1ZR~G)iDsx+u=U(c)#*|Ssh+Q> zycMdPA2xg4Q~N~4+70IyRChn&bm9b_|u!n@V?Ax_RKu}4rexdEizj;R{PEB-oCY&-gTMYwWe=v|C+Tcd;5BOnV8uf?JFoN z+w<0Bde>z7)|tLF{cBdQ?0uYhJHw=wAztMKUR2_Kvu!Ne&v|T~i^?w*%#(RH+>kGY zgLE|y zSAxpp38Fc9sT!x5aSq8aW{R&fmMznsIY&+7G)5pR-P?Jm@tSE~#MO9a%5qMYd){#a zH3=PRdRL+kuEaOi`<-pBw6R2k3R-`tADk^jBR#W=YI5qbJ^q6iNjH@Jt63pILzmN`NN%6BMWq>wEHFy9| zY^YpKm=~zaC~98;mfp~&a_6o}7ctS67(za+TA1#e7QMz>p593mIQLQl@y<0TXU|&h+A<-^+f2a*XxDnNX}n9y z9<~W_1w3$?2P&wp0-1(laX>|=aaPvgdesHh)i#GUXAxpuswwBh)u|M8(HeCqgzZe2 zLKzkEOFX=^U#FG&vO$LigtVEWQVkI}sO(YVqGuBY+gsg>%S^k)ER~CbM(MZb58ml( z#F6HNUw0)70=-76Aad~9L;124wY;|dfmc#dAqctUYppfC?wb5l6l-{K%}dY*Co(wxF_`VDWrIuCf#Sry3miN>3aH<<%(JA`w? z_7t6s^QFHLTu~#~azdMGu6+CA;=QfyTg9Q{Fm-cVR-u;d&Q-+%s?%iSyjm$%Q$;0F zEtx8)ZHbKS@GctH39BtrEwpWsPBGVmb#xpgI;AUhQ}Y-_l_tbB7y&L-ze9@4fhX); zDy?suU7fRAcXi?ZOtw|mR)%0!MaA_^Qgp(r(eVpM$4(UWNqg2SZmv;niBf#Jdjc_U z;WrV^JZ(i8Ry(^?Pat=<8*&>09R!Q$u#~#EZ91?PyMtSezv~^4tXBd#qf@q9K(`@x z+LOq=q2agmwZk3fwgsJ*ehON@B?KcMf9@{u!m{wn?w@feYl`v|68wh2l0GBHx)-se zeJHzUwo??(d8Bi>)ugp{vTPc5zb5(Lg?zPKsH|A!x;QXT2jwpfx0r#O^{z2rQQP-V z@UA!MC(+WVeEDk8R?aJy{=Br1n>y=--i^o$6(IU^RIu@yk#xn#rhK>0T-wsGbuXM} z)s?*IwAEHaq*f0OI~t}xBh8b$khkV*-O-zNki_fmYmL%vX^(cUNu9fB*e?x-U%aSw zvwA;~%?g0)P14fVXgQ}PME#L_#haSrcLu!ZPvLYpYf__=}pldiRsL<3i#q%Gh!xmrD<`*kk0qg{Gz N*X@1UdX?r4^#20wpo;(i literal 0 HcmV?d00001 diff --git a/po/ug.po b/po/ug.po new file mode 100644 index 0000000..097bc1e --- /dev/null +++ b/po/ug.po @@ -0,0 +1,363 @@ +# Uyghur translation for cogl. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Gheyret Kenji , 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2013-03-17 13:32+0900\n" +"Last-Translator: Gheyret Kenji \n" +"Language-Team: Uyghur Computer Science Association \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "قوللايدىغان سازلاش قىممەتلىرى:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "ئالاھىدە سازلاش قىممەتلىرى:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "بارلىق non-behavioural سازلاش تاللانمىلىرىنى ئىناۋەتلىك قىلسۇن" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "قوشۇمچە مۇھىت ئۆزگەرگۈچىلىرى:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" +"GL كېڭەيتىلمىسىدەك كۆرۈنىدىغان بىراق ئىشلەتكىلى بولمايدىغان، پەش ئارقىلىق " +"ئايرىلغان تىزىم" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "قوزغاتقۇ قوللايدۇ دەپ Cogl پەرەز قىلغان GL نىڭ نەشرىنى يېپىۋەت" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Cogl نىڭ بەلگىلەيدىغان سازلاش تاللانمىلىرى" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Cogl نىڭ قىممىتى يوق قىلىنىدىغان سازلاش تاللانمىلىرى" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl تاللانمىلىرى" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Cogl تاللانمىلىرى كۆرسىتىش" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl ئىزلىشى" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject پايدىلانمىلىرى" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects پايدىلانمىلىرىنىڭ ساناش مەسىلىسىنى سازلايدۇ" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Texture Slicing نى ئىزلاش" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "texture slices نىڭ قۇرۇلۇشىنى سازلاش" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Atlas Textures نى ئىزلاش" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "texture atlas باشقۇرۇشنى سازلاش" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "تېكىستنى بىرىكتۈرۈشنى ئىزلا" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString نى تەھلىل قىلىشنى سازلايدۇ" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "ژۇرنالنى ئىزلا" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "ژۇرنالغا يوللاپ بېرىلگەن بارلىق شەكىللەرنى كۆرىدۇ" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "توپ بىر تەرەپ قىلىشنى ئىزلا" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "ژۇرنالدا شەكىللەرنىڭ قانداق توپ بىر تەرەپ قىلىنىدىغانلىقىنى كۆرسىتىدۇ" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "ماترىتسانى ئىزلا" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "بارلىق ماترىتسا مەشغۇلاتىنى ئىزلايدۇ" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "باشقا سىزىشنى ئىزلا" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "باشقا سىزىش مەشغۇلاتلىرىنى ئىزلايدۇ" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "پانگو سىزغۇچىنى ئىزلا" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl پانگو سىزغۇچىنى ئىزلايدۇ" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap ئارقا ئۇچنى ئىزلا" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl Texture Pixmap ئارقا ئۇچىنى ئىزلايدۇ" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "سۈرەتلەشتۈر" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "تىك تۆت تەرەپلىكنىڭ ئىزناسى" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "تىك تۆت تەرەپلىك شەكىللەرنىڭ سىم ئىزناسىنى قوشىدۇ" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "سىملىق قۇرۇلمىسىنى كۆرسەت" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "بارلىق شەكىللەرگە سىم ئىزنا قوشىدۇ" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "ئەسلى سەۋەبى" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "ژۇرنال بىر تەرەپ قىلىشنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" +"Cogl ژۇرنالدىكى سىرتقى كۆرۈنۈشنى توپ بىر تەرەپ قىلىشنى ئىناۋەتسىز قىلىدۇ." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "GL Vertex يىغلەكىنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL نىڭ vertex يىغلەك نەڭلىرىنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "GL نىڭ پىكسېل يىغلەكىنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "\"OpenGL نىڭ پىكسېل يىغلەك نەڭلىرىنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "يۇمشاق دېتالدا تىك تۆتبۇلۇڭ ئۆزگەرتىشنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "بۇنىڭ ئۈچۈن GPU نىڭ ئۆزگەرتىش ئىقتىدارىنى ئىشلىتىدۇ" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl مۇتەخەسسىسى" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "atlas سۈرەتلىرىگە تۆكسۇن" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "texture atlas نىڭ ئۆزگىرىشلىرىنى سۈرەت ھۆججىتىگە تۆكىدۇ" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "texture atlasing نى ئىناۋەتسىز قىلسۇن" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "texture atlasing ئىشلىتىشنى ئىناۋەتسىز قىلسۇن" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"تېكىست بىلەن سۈرەت ئارىسىدا texture atlas نى ھەمبەھىر قىلىشنى ئىناۋەتسىز " +"قىلىدۇ" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "texturing نى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "arbfp نى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "ARB پارچە پروگراممىلىرىنى ئىشلىتىشنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "مۇقىم ئىقتىدار نەيچىسىنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "مۇقىم ئىقتىدار نەيچىسىنىڭ ئارقا ئۇچنى ئىشلىتىشنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "GLSL نى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "GLSL نى ئىشلىتىشنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "ئارىلاشتۇرۇش(blending)نى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "ئارىلاشتۇرۇش(blending)نى ئىشلىتىشنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "ئەسلى كودىنى كۆرسەت" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "ھاسىللانغان ARBfp/GLSL ئەسلى كودىنى كۆرسىتىدۇ" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "بىر قىسىم OpenGL نى ئىزلا" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "بىر قىسىم OpenGL چاقىرىشلىرىنى ئىزلايدۇ" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "ئېكرانسىز قوللاشنى ئىزلا" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "ئېكرانسىز قوللاشنى سازلايدۇ" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "پروگرامما غەملىكىنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" +"بۇ، arbfp ۋە glsl پروگراممىلىرىنىڭ fallback غەملىكىنى ئىناۋەتسىز قىلىدۇ" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "پىكسېل ئوقۇشنى ئەلالاشتۇرۇشنى ئىناۋەتسىز قىل" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/uk.gmo b/po/uk.gmo new file mode 100644 index 0000000000000000000000000000000000000000..d5761efa643d9c382ea4fac131479c1bfd295771 GIT binary patch literal 10355 zcmbW5ZHyh)S;vPoZNt)*v=q})Qcg;pmpXU7YdcN4_B!!f+$47F*p3526wTh9y*u%J z>&(4gJF37hNt#m2rmbU3A*Hlx5vp2g?X2yMv$pxbCj{zTJ{5_V5(z#P34w$_0*T-M zoHKW4?q0hNqn-WVnK|b<&&&UL&NK55AG!0jfa6)tU*r7l9YN3lA9^qUIDYcJAovvc zPv9tc=lg@;UT{750q{BS7r`lioq(U<`uD+mz&`?i8GH+z1b^i3fAFp#_!X|#fDeM( zz)yk=@MGX9@Z;e3K&^Ab-~TJ{gIxbJI1c^?csIEE=g|rLEU4!%fYS2__%!%BxC;Ci z@Ylir1wRMgGvd~H9@PCWf?EG;;D^EQg9cmzKMnpp_)Fj&zYqkU0at-*z%8KcX@HXR zGPn->9w@ti3`*WAj9CLd06qvF03QW^4}2B80)7O193!@X`$3irUIR7%Pr%jSMNszt z7({e1@*x+8RiONRA1Hk`fgc4Afcyn9|D^vBP4HRFFf|~aRD1EPjTJI;I{HCB)fHk1(_$`o-1YZT^hu1*) z`;!R02TpDSpXNG5`6=*+;KShEC@Vdl02SXafZ|OT+y$Niw}XENN}qc%Y8HG9+y?#` z_<8WBU%Xwj)H#+ipO`6RMPV^;6X42_53fvXTkplrT5b$ z@n-NF;12L_z!$)eVSF7t32Oa+17-imNxCn9zXM8-CGe-VLCN_lC>|_;lK&1UyMo_vd9oJV zz~yg)lJ|$8=4YVB|2z0NcsFDbKb{2<5quNe5B@ng27Z*_YzKFE`~y(-{s^1~AGwd1 zf^UGhJP7V5pMH+GgVKKu%5oXJms5GNi*u55Bd6ii8pVTUEia|Zqnxrqa#Uk=JjBUT zZY^*#=jS=0xvgVBu!r+0PWf4fcwIci%MniTOfk^$xc%>HssCwtbvGAJa*8WkIPc|D z9nzsVh@&6Sg+EABd*Ghn2~PP=$A=u)8lj)69S?ItYn#8~!239#;ly>pU7R|$aVq{3 zoZ{75&d+h`fV%b|l))YT_xnNBsjdE6H7-BIgWa5pw{lWExRY}er?~ST&K;cMRj_4x z+RVjCWLn)$J#I#+nQ0{^tk+E~YBi!xa`YBMlBn7Vo3(B|OiIJ!PTXpSbrUrY$4RT% zh?*U9I85Sjsve~i!M0YdZuYb_D0LV6+fg+R>v7s~*9VfY8aHe1Vmg}Y)@odunR-}D zO{Znj$PXOytlP|=?wNW41x*soL`l@FMp~@V2rFsS4wJAGO&hIfS~F(nE)yN;M9owx zX@PbUaXD>5JTo1qQhYktE=7#A-&*J4{!SvLkd;bT_p~)LlU9=`YMQj$Znu(-zmF28 z+Uhntni8jJ*LzyhoSvy4*+G*o%Z8nLn3_h|3~P}*7;JZXNZGydk*IFAc4x4RdCLzD zMhWwWJlVgiKkTViH&Jw^!cKM8YVPNU$<$1{KP-PN|KwaSanp2WBkKd><%}-RkXMQV zXW-FPSUqH_VRbgAmKHG~zOB{MI*xADlCZIC#0;k4YOhkW)vUBzb5T-h%~U#bE#tkj zJiY~w8u5#v*krkzM4^;0I z%~T{O+Pa60zSO;>+Q)2i8?gmWqgZopn>*)sc( z%&wUDn_i;XPkfh$sttg7Nqj{6P~2vt7cu>uKHHpJJ5ZafyIi>uy8G=Yv3zDfCKUWn zXad|Ln{%$16z?=-!?d%3)KFlxP5U7th-Hnli;cc$SO2MJtcuhMpNZ{IEsg4`wZ58F zFXA$ATK#By*6my_W5fDfcr-OC ziXo$1%adoT-5F!*ovmV{W)Es4b1`G{gs1bfofdnWv&+>xo8+$OjRua_vcQ%HWik6m z?rK{r(qM1WQX5uza=LQRrTT;!9~~Rn7pXm}>`rU(bY*L|mR1h5Cd_Q7)1FwnmPYGE z%1$_1YZ98#R#IC_jf;}s<-usR7C*-RG~KOsCad)>r8^m+cvZHkMxjJyJEdyEtQ#BO zP#JrqGPc2tZ3X`Aw9-yoH=Af6M-Ta{X!`M5BaG{#)mCFOb7_hpMdd&gHYVsYo82R_VYD0e zpG}zVp^@EB?%q-M%C;6}Hd*;-8x!Qpwe5NsH#cfONeK4ja|fQNJUY@JXK6-%w4+I3 zgF6%E(W$sIvbV1Nr1At?M>=7eZF`wcuHR_f&&daxtH;MCC&$fw_Zj^hyLWPY+&pH+ z48ytJJh?7^v}tmKe%cvho5sh?m%iktFlOvQ=8Q9E-GduPezUUE6<+!4V4QS9a%61u zkmc8Nj9xOslKtZXrRt0ZlhEWa-DuCm~X>{@pHXD%TH zFG|xZQkW^%xab{6pJQmYpr_el?iQQ$+xVS8>n}TDR%K|tfpZL*=2r74L7)C=LsuED!rW#LaTQ#4DU!S zt!Y=1Y1c7&5xGT8-78IyeLK5>6OPNV4;hxbj<*)@meZmink9ss&Ij~fWr}=w4WI1X z#qBeM1zWKavrlB#^>YztUS){Fwdg$A_k(xb+r3k0X%~@h^HAs<>x*mn&w8}*A~zr- zw@~q&XC)kL^}mP>Z%Tz52wM>Mq)IVV1A_-`UJ-dKS^V#L1;&T55eEpK8 z_ab2#GFLo4rs!F2+{O(1GO<#J8*+HrIFvyt7sDZHyEoU{lC+|1Kqez&`|{6OSC0-c zQ0rf{Os8U5BhL&OCB9$+!Ba(G!lmA;`r%6$wMG=OK3?JjgIt=l@c^pnN{)tl+7F}@`9`Aw@Mvj zhg>cU!7h@GI2Te#-cUi#mWHfTGEFX%%gH@gq};^e(*my&+XN#n@z{i0waC~A8zVRLZW`*s@fHLD)(U~uZ3dq0?%zt z(H`q7ymD0+)Qy#XqYAmyxj-Q78yHghdE>&fKrZ;Mfw2SmA~q31Dncm*d*`V6XDwxJ zlmcwIM0-|Bh{8bI{uL^L_L9=*y!1duH6f?1KkPQ9{T{n}XHkdpN%gR$6N8`wu2ElE zXf*ZE@9;&|X`Xf*ao;z@t|!t)MEiw8XDLlj1fP{W4fwD*A8R`rx9kX=xlcFF4L znk5&vqKnbVZV(r(_toyu|FFkt6&nw)+hyyqMH;xTC@0iE&1Y}PGW^4bDA_6vN_~_x zEfJ4U>C+TaXxoUh>;GhpHk`cJv2&?|hCj;%6t}Dpg$5U-j0Q>`v6B?$t{i%$Sdi^b z1wmeCQvP0I_xGFdOP#TM6>$B4x?n9S;^~2$-8;S9-=6eTzGwq1*PR{ixRnmGN?EfB zOg8U=x~P3lm$pS0$<)X?1y*py2a;ZXaG=dW+Q2!+G50H%z^+ zl{slcVuSrI<-8%a$P8Nb-iZN*l`2G#m4_;wWsn zU$jGfFl}#68*QtV+ZWE;ip^kBQ;z-r1leu`!y{cJM)#&LH|iOys^Gg+E}@l4Ce`bQefA*S<@u5 z*(JWNl`ZMD{nCe8aXa}mjN-Q2asFP}tt;XK{mRY0MdcgJo016o?WYh_Q%(%|KIUt% zdIc5r-peZNy)$m}qx#wM%AQwv7se1AptnW;@x#Gt;8)aNb<6OV;MEs zD`=u3`l?fpZQF1BeFpf2mU*C0Fz)k|-h^4BFVSd!$UQXV4Ud?g7c)?XYJiRXx3A?M QCBG%TT-C8|DO(o&A3lf`$^ZZW literal 0 HcmV?d00001 diff --git a/po/uk.po b/po/uk.po new file mode 100644 index 0000000..8eef6ad --- /dev/null +++ b/po/uk.po @@ -0,0 +1,366 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Daniel Korostil , 2014. +msgid "" +msgstr "" +"Project-Id-Version: 1.0\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2014-02-13 11:24+0300\n" +"Last-Translator: Daniel Korostil \n" +"Language-Team: linux.org.ua\n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Virtaal 0.7.1\n" +"X-Project-Style: gnome\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "Підтримувані зневаджувальні значення:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "Особливі зневаджувальні значення:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "Вмикає всі неповедінкові зневаджувальні параметри" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "Додаткові змінні середовища:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "Список, розділений комою, розширень GL, які варто вимкнути" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "Перезаписати версію GL, яку Cogl вважає, що драйвер підтримує" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Прапорці зневадження Cogl для встановлення" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Прапорці зневадження Cogl для усунення" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Параметри Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Показати параметри Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Трасування Cogl" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "Посилання CoglObject" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Зневаджувальне підрахування помилок посилань CoglObjects" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "Маршрут нарізування текстур" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "Зневадження створення нарізів текстур" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "Маршрут текстур атласу" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "Керування зневадженням текстур атласу" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "Маршрут суміші рядків" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "Зневаджувальний аналізатор CoglBlendString" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "Маршрут журналу" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "Переглянути всі геометрії, які проходять через журнал" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "Маршрут пакування" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "Показати геометрію, яку запаковано в журнал" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "Маршрут матриці" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "Маршрут усіх маніпуляцій матрицею" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "Маршрут іншого малювання" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "Маршрут деяких інших операції щодо малювання" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "Маршрут відтворення Pango" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "Маршрут відтворення Cogl Pango" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "Маршрут модуля CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Маршрут модуля зображення текстур Cogl" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "Візуалізувати" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "Контурні прямокутники" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Додати прямий контур для всієї прямокутної геометрії" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "Показати каркаси" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "Додати прямі контури для всієї геометрії" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "Корінна причина" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "Вимкнути пакування журналу" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Вимкнути пакування геометрії в журналі Cogl." + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "Вимкнути вершинні буфери GL" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Вимкнути об'єкти вершинного буфера OpenGL" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "Вимкнути зображувальні буфери GL" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Вимкнути об'єкти зображувального буфера OpenGL" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "Вимкнути прямокутного перетворення у програмі " + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Використати GPU для перетворення прямокутної геометрії" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Знавець з Cogl" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "Дамп зображень атласу" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "Дамп змін текстур атласу для малюнку" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "Вимкнути текстури атласу" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "Вимкнути використання текстур атласу" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Вимкнути обмін текстур атласу між текстом і зображенням" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"Коли це вказано, кеш гліфів завжди використовуватиме окремі текстури для " +"свого атласу. Інакше воно намагатиметься поділити атлас через зображення." + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "Вимкнути текстури" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "Вимкнути текстури будь-яких примітивів" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "Вимкнути arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "Вимкнути використання програм з фрагментами ARB" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "Вимкнути fixed" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Вимкнути використання функції fixed для модуля каналу даних" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "Вимкнути GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "Вимкнути використання GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "Вимкнути накладання" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "Вимкнути використання накладання" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "Вимкнути текстури non-power-of-two" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"Змушує Cogl уважати, що драйвер GL не підтримує текстури NPOT, тобто він " +"створить нарізані текстури або натомість текстури з обрізків." + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "Вимкнути програмне обрізання" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Вимкнути спроби Cogl обрізати деякі прямокутники в програмі." + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "Показати джерело" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показати породжений код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "Маршрут деяких OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "Маршрут деяких вибраних викликів OpenGL" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "Маршрут закадрового підтримування" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "Зневадження закадрового підтримування" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "Вимкнути кеші програм" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Вимкнути запасні кеші для програм arbfp і glsl" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "Вимкнути оптимізування пікселів для читання" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Вимкнути оптимізування для читання одного пікселя для простих сцен " +"непрозорих прямокутників" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "Маршрут обрізання" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Записує інформацію про спосіб реалізації обрізання в Cogl" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "Слідкувати за проблемами продуктивності" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "Намагається висвітлювати підоптмальне використання Cogl." diff --git a/po/vi.gmo b/po/vi.gmo new file mode 100644 index 0000000000000000000000000000000000000000..bcdb243db694ffb08070349cc7cb2738e44e8355 GIT binary patch literal 780 zcmZ{hJ8u&~5P%N|Lb7O}LOi7DqdnglOGKAAM6nYQ2@@+EY0>7qUN73)J?+C_dIS`d zKt(|f2no8JsM1hUQXw6Gfj_{UZQ%lCq;Gd-XLfdG=hx+x*8$3T^|}4kJmq1*gF>cdE~;+IxSjAHyt{UgR1W{fK3b>k-p_(NVYwadWeoNcb0z`hf$-e z@iP?GH!ZMH$DX)mA*oR7kd3Lqd2}A6yJT${SNAbuhU}, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2011-10-02 11:02+1100\n" +"Last-Translator: Nguyễn Thái Ngọc Duy \n" +"Language-Team: Vietnamese \n" +"Language: vi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "Bật cờ tìm lỗi Cogl" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "Tắt cờ tìm lỗi Cogl" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Tuỳ chọn Cogl" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "Hiện tuỳ chọn Cogl" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "" diff --git a/po/zh_CN.gmo b/po/zh_CN.gmo new file mode 100644 index 0000000000000000000000000000000000000000..d022c1e458d56d28845b891d7320052651b00212 GIT binary patch literal 7250 zcmaJ^S#T7`86G<%u@yUqlaSMPJBe)+yg~wuWdSxIFu?|dL4Z@0D%WUtc6VTRW|^6l z5S2K8kXy)(P(Joq6_RbE`q_jmW~VPj9J z^{Ko6?*5PO|GV|>Lv#8Sd@rN@6m9fgMTrBS`YL|md+%$C@-yJSfEB6}?P{x{%*=)1rw;D3PM20ng2bOJ5`()A4&D67U#sF3@xK1C|5pfz`m@0lR>=fe!&!z=)N=EkGQp^aE-AFz|8Ubs*XQHV|7YW#1HWmHGJ9 zA3);O6Hxw1;3^>Lw*yG_w@B=fI0z&@jY|9@ko0>WxD@y?ko2pBv4k6e^MElR@va|8 zd`SVx&OZU^oOgkA?uS5xig(DK2Qf(fY9PgT4G>2tyMV;QcHk=Dc_8`uLm=_&6JP~! zE)JvdH9#7FMfP_AY2Vj?w9o56(&q+{?D;G33E(>t=U|fdnGd9Wo&%Cy+kuOKEkM%i zCXn>}Gm!TE7)bG$i$yzttATWG3P}1*11UcL2GaWf0x3TC!&$Vh0*KHmzX8&^7!al@ z%@TWowC*gB#3pg5r1&kjf&RvmR|Z z+EO%zR*6>pk#FEqo(t8$#b|5MsK(Ow6dJ{i&Zh4z@wN44W=G>Q%Rjbe$bLfME$d3qljeYI%h?;5mnv;}C-qR~hGrH|r*>xX~1CU_hv zXXvBc^S|fu#|E^Q(1>Fc|2b&O(1@#FL0f}Hyi`_(Laa%*G-f89m~Ln`3!4^GV=)%d z%(&)Q&0iv7X+cLdBFUI)m5A$(ZW?NgX-1=NnMPbQ9M-5>y4n!a>>8!kjKo-7f`n|* z*^i-4H7R(PxuoIG)-~*ag3Qvwnxz>* zjSh>))qt%fR7-WV5Tg^B8D?wOGi|q{88)dz2P7;F-4IjZnUHRi;vr=9ph*(Ps!mL` zSzI;Lh(;b%Rtr5y*-iRxEyh+Q!>|nN3KQEj3+wMPvt@l=>_szaQFIzqCm7|L%k`?& z5KiR9{Au!!&jqF%%!z8;2Tbl$QCLA1HuA~N9aPoqY`O~B_Qr-M8?Z^_`<;ADv=j|xCjT6Z;rO|89oF?J|jdGjy zIHFlN&^E(P6LBmU(-Vne*X3tOP3BmtVIwi)`7=w-DPAZh?m7Yun&EJ`%h4N)v`E@W z|1ev*c@+y=YJ{ij=i(xT)~+vNk{qi`Xa-0rJk-ER$xNPm1xrgs8wE|jToyT3N+-F; z7n<(RBMh8HESxlgoEHf_p;2`M=Yu=3tM5jeGxwPBgu`>6V!><_zaokd@%@m1 z@X0tR%=6O^D2e)|A_H~I61gd2M8G_YHmEysGOx1^QhX<2tXQKvxE^pDpr)Z>GCQURQ8%TfNGGfCca!c!S(9o*OgHdb z4OJ+0;#Mj0q*8~&Ej@%(5$d2zWmg=>Rptk(sF4T(2}y-zLA905rs=R+72#I4!QMg)ZxSeVl7NcT0x|m8ItR0ZK1N+tU)6u^125bWvSaCs--wdY$5)pTNCLL zMh+{E{rYlmSfKGrkCUNUp*y z5LXjYzyLB5T$1Tm}lv`=^oM( zxaf(Pa!sCXVqY#um#pZ1{vs6P3C-es#(j)X;J1ZGfSBSrCyGh&NStg42^)|a6j-{Z zr3ev(vqsp3i@w;d{H$aw6{*kpjMxsU*;qYXIrW z4^G;s=@rUWR8dapOqYH^_QnLy=YR<*ch(c<}) zRh5+x3~bgKbt*k2a*G0$)mT!qXwm%2YRIjJmI3h7ut9#)s$tukV{w$v?MNfGtV!jS z7fuSTh{RPrRuMGg&tVZ>#b8CCUQ^>WtQIv`gKy{Yw}>9rwNN=*rdL%Pfj!X`5fk3f zB8YgxE?r*3_C#N;-B`9^-G(&<=T%iymerc@f&s;v6R?mxz911(bz>=AI~F*xd~5v+ zf$D-BXCt0bYYfysP^^YkHz59Hn__hD1YW=uW7jYv!MpbIs-;Z)xx8{|*(-syqMnlZ zYdNvGFWAD0XR9inE>qmpgxB5T9q)E$PG|Pr@@`ML`-U@s(BBqNa+_94o zaz~GlT<+*=wCG^UJ>BN^4(2+0Kbk(K@C3`XbmvAU#NX-hL+;ou@ptz2sqFYAC3~(l zJ9Z~CGnP5_n#joP)wXP^UoOM6H{PB*I(qkMIzj%U;7<2v4qs4mEdy@vZMUlS#mQWY;{Oq{=g)X2`{b-U z(eL&hoR=?<<=)|x*V9_OR{lr8=yibNRR=n*gf%!U2#WG`9RchDW}EU4;TIqeQj zx?{)Y@mE~ATtAN-(Ais_J8^O$t(w@2-@*wbL90>|P%+oi>kS^1Y&$;b9Zf;eY--Bw zJ>nkdPmf;`uJH~XNY5O{7U}6hx95mFL@HJ6Ho27hvqaWA(&-()413(6JD_!L;AUPS zdAqyq*V2=3%B{0Asr1yX?3q@#`%=k}RJC`|J8;@pgU8mLxZzE`UNS@-SPH78r>5X^ zx4jKvPS4C@q~Hs5_-h^B%AC#SdEcD%qLK?p`>6Kd>k^ZM}+nwL|8M81{y4dWR>3WO{s3NFktzkmB~G;6PE( zK(_2i4jGyPQW+HXkR&h4dWjGgq3%m}TBS+gTvYf6FVgiv;D6gyFN z<}O}y_gzSj9}uZ8-rhpNkEVOlQ)kn6X0gm2YjeAX+^I>ot25KxDFnQ(Bc$HIu-D%u zM$%JfyrEe#J#(qm8@wZ2fx6g{89E~MyV~KlcA`v*lf|)6k(9}FcY()>H$0IU8uNxb z720BSl8KelWHFXGe9G(Uqjg2^YHzX+8f1oB<-&Y9K)~{qB3~M?*lTNdJKmDgpIt4l zjZF81H?|MLqN2Jj({vr=^)49|_kawzaET(u@~8TJUXa`?1DVU`(&N|VC^xiTyu{_3 zTGCJM!i!>I3-83<%+#RUb<1Bbo}S+Lb??+6_b6@welZD6MCkm*{FX#~a)WP)0wgD7 zS&$3)yqx*M+k&6rwVcnk&G`3%7~<(5pRsb2^mq$W1X)R{qiS;POB4{nzPlk}PMG6A zpi3RZj|5Y^{TKcBvj`oSirk}I1vTByNkJp;GD_ABNQj+9X(9f~BC{4xXz#>XJOfY? zC7ZodXEVq5%dBiUmYwaC+?pQFwY-77^0ZUj-c, 2011. +# 甘霖 , 2012. +# fenghelong , 2012. +# YunQiang Su , 2012. +# Wylmer Wang , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2014-03-08 20:33+0800\n" +"Last-Translator: Wylmer Wang \n" +"Language-Team: Chinese (simplified) \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Gtranslator 2.91.5\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "支持的调试值:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "特殊的调试值:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "启用所有非行为调式选项" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "附加环境变量:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "逗号分隔的待伪装(pretend) GL 扩展列表 已禁用" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "覆盖 Cogl 将假设驱动支持的 GL 版本" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "要设置的 Cogl 调试选项" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "要清除的 Cogl 调试选项" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl 选项" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "显示 Cogl 选项" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl 跟踪" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject 引用" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "调试 CoglObjects 的引用计数问题" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "跟踪纹理切片" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "调试纹理切片的创建" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "跟踪 Atlas 纹理" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "调试纹理 atlas 管理" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "跟踪混合字符串" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "调试 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "跟踪日志" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "查看所有通过日志传递的几何体" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "跟踪批处理" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "显示几何体在日志中批处理的情况" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "跟踪矩阵" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "跟踪所有矩阵操作" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "跟踪混杂绘制" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "跟踪一些混杂的绘制操作" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "跟踪 Pango 渲染器" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "跟踪 Cogl Pango 渲染器" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "跟踪 CoglTexturePixmap 后端" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "跟踪 Cogl 纹理 pixmap 后端" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "可视化" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "突显矩形" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "对所有矩形形状添加实线外框" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "显示线框" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "对所有形状添加线框" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "根目标" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "禁用日志批处理" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "在 Cogl 日志中禁用几何体批处理" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "禁用 GL Vertex 缓冲" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "禁用使用 OpenGL 顶点缓存对象" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "禁用 GL 像素缓存" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "禁止使用 OpenGL 像素缓存对象" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "禁用软件矩形变换" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 来变换矩形" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl 专家" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "转储 Atlas 图像" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "将纹理 Atlas 更改转储为图像文件" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "禁用纹理平滑" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "禁止使用纹理平滑" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "禁用文本和图形间的纹理 Atlas 共享" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"一旦设置,图形字符缓存 Atlas 将总是使用单独的纹理。否则,它将尝试与图像共享 " +"Atlas。" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "禁用纹理" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "禁止用任何元素使用纹理" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "禁用 arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "禁用 ARB 分割程序" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "禁止固定(fixed)" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "禁用固定的(fixed)函数管道后端" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "禁用 GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "禁止使用 GLSL" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "禁用混合" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "禁止使用混合" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "禁用(数量)非2的幂的纹理" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"使 Cogl 认为 GL 驱动不支持 NPOT 纹理,以便使它创建切片纹理或用无效纹理代替。" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "禁用软件裁剪" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "禁止 Cogl 在软件中尝试裁剪某些矩形。" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "显示源代码" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "显示生成的 ARBfp/GLSL 源代码" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "跟踪某些 OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "跟踪某些选择 OpenGL 的调用" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "跟踪幕后(offscreen)支持" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "调试幕后(offscreen)支持" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "禁用程序缓存" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "禁用 arbfp 和 glsl 程序的后备缓存" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "禁用读取像素优化" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "禁止对在透明矩形场景中读取单个像素操作的优化" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "跟踪裁剪" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "记录有关 Cogl 如何实施裁剪的信息" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "跟踪性能问题" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "尝试突出显示欠佳的 Cogl 使用。" diff --git a/po/zh_HK.gmo b/po/zh_HK.gmo new file mode 100644 index 0000000000000000000000000000000000000000..13636c7d56dffabae0aec6dc60de8564ad600fa3 GIT binary patch literal 7213 zcmaJ@ZE#f88NO9pm6o=C6kA*Eu~mfPh6GR{fopRF0cgnPv8%MPuvTgfX@JFem{`(JP3RR*aut&^ngDH{tvhT_{b7* z&g(!Le*;M8zYV+(I0|II8Q|lU`4w;(a20S1knBkSX`d$G8sG&W+5H)i z_FD#HRsmN4R|2bn>w&)owg7Jc?+0#%5nF&&Kpd%b0crgp@Co2GAld&J5L+utzAxgi z3`qW74kUdx0v`lc1M#Qm_(%F51d^WZKy0DB3#4wK#KnXi5)=F?<(+F;735x?>|7Y^C1}hBrpJ^ zefI!~e}=>sAf0m-NPZdvB2>ypK(gag+5ZYi@x2$D()`mv;&mDDIiL!p^{0W9C*wd` z|FInZFObe(3bK;iav<%q0Z8&M0vRv}#8FBk@G0O)iN6P83*{d`lD`K*BD)?3t_4;A zY2SJv`SG}%zX>EgJYWs*K`24zwgJ}xPs;u$KwAGtAjRYFK-%YiIE&;rNqiZIDdlyE zNg%CjmGk|we+fvun33aulH*w*Oi;d({RcoYvS&Gv&MA{v2_$=e1El>eAVR7%0qOi+ zAg#LwBtLu#{3Y;TK(hB?OfCoR0Mfh(Bp&tvP2dm^f69F*j-a7JWs%OQK%=~V4vnD| zqve0(8@Q6^!g?V2a61~+So)qqqjRAK|DMPH9caW+iW7a6XfLBZOC5Z0MZs5s-V!wO z(=Iu)St4=H|DM4Qq?7Uz+G}WA&>ll0p3=7hZ4Dav)&G#D{G;4`5pApJ^4zDN#69|! zqCJg9z9zp>EOAvRucDDZ??I!l9F2HVinbDMHQEL=`pCcZQCx8S@b7N?r#P00F3&yr zQ+WYDcA~w4MzNzzRH$xnAPf*#>|ux*A2~P5z}I7JkFw;na~`o z?i)lbE##<1G!<8^0&(5ZO+$?{&8X2W(@1EB!)jDZSA%iQE>+6SXq;6hNyrwRs-zau z)wpguqF-&PA>D|IPFM@3qEU2NB(6qn=9tXZq~IcRDZ`(w4DN@5%+ey7r5PcO4of7| zfUPA}OLep`qZ64KVcRR1cF@rbn^d9$l9q;Un5pngShq>>u(FjDVWfRo9FtX!MM_~W zn{*YkW+Y;VEKM_*ok}K6%aP+yf`!bK;m{J@wo}s6w42b=mXZ!MN#R)4iK{kCsD>KV z$b-sOp$93uOFyW^Sy?Iq%dl>KVy|Xl{US3}6*;k&&6Gva393#g#xGD4geNj<4ibpz)^2e7N}Mw>JFNgK)LXo;l5bDv_tY!tsdiV*Srkbv;11Srh& z(+?<(6ez|*F_cCy4%I|87?*=uaZTA~@H)tgEb%+2#nc)dNr{}~^$ZLZwXwoPxzh~_ zyx_MQM44tWvsPrFj#(l%MT`iTW6@6a08Zw0)a; zr`W5zDyw}HY#1xn=nk$2+ymk%lX(`gln*Uv^J26(P+7QzX{8z(8N~O3} z@;s?j;&4k3BUOYt=u+7g$8nYUfhuYwLO?=NVOdaZWw&WMtXxI7m8zUCe4p`=C~{p? zc#t}hTurQnNhvFYR5QbJ9j%?OY&HvO{13WanJZ7=G`HcG*p}>C&j{q^nb50bK{E-CN5EeEdH7KxjO-m6X2xpD3 z3m1L9UAbAwSSnJt`Ha{Os@YncYOSnhAsA0*=puz53QwdrHRbgf zT`4ijeyFaA#E!=6k}+{}iHud_wQ8Nss3@wC5>FmKTlvkXqu%iUfyhE=OW)=zl6 z{P;@?cbl+F)H|N!qUaSVg4bjLFAtQ(xJP_f^IBmmyDXEQVS$&zfxRNtOA&ay0M`^1 z7ZoqrtZ2A#4MeEOw4$p~>NIN~CW=B) z{RLc8;Z(@k6pE)%!L22zVS#cgRnR4{6&0(Lttl>97bt!DN4t2QayRljNopJYUV`l7#*ER9wOrOH@B-=2N9c&W6-SHN8>_hQ8 zb89v;d0z3Ry4^#)nUO2*SRb|!x#c!|kZr%}_4Ifny;8zGI-Tu3zqkaQBVYY)XJfkQ zqQ9o0KYe0^*5Lm0j$e11n%pA;nZ{XfqRH(ZV=LySFJ$X`GQ9(C%i(O_iIobDz`@AFg-qmz_^3gz22*t zv3hLFAM~VPfBoF-`)<2`j?kgtXt6-}aG|){KjL*ayH|QLEzR!idl1TYA4k;ZrY`44 zL@Jh<9+;c{&}|*foNFi;5{iQ1$Ok#G$nruXr>Ey;yWFD#?wK~SgU4U4<&W=lYqK}@ zLC&Xhv$sH6Ux1!4SXDSE@2UlCNw;2t(qAXMfIy22dpzn3x5&3};hYG!+dPYucgK%{ z(clCzb)n9jeTaf^EePnI?8#gj7C!a{j?GP-63*ouJap6T7#B$*qNTXw&G~wGr>=V^ zCS4)dGA@L?(G%VfNZU044~i0(J$)uK)J_$z{vvb|$tg=xwx{3go{<%2_z*?u>hRob zzt9QN>Ff2`_O~+cH)lqUD4DV2LNqhlf&D05vzMCOwk{F5xrq)@55$XF==$YMyE}Zy zyK>$gYxMdX-RY_HYM$f`vnXvVJ*@mNnXgIz= z4nmpXDY^sFT_0xadr>ox0!T*KkQo{gmjM+DB*OSawqcN_>XC34guy}`!6vBZ9z*$Q amZ{0BQSNdOH$zTR5$i?fiY(5tSouGC_P%8R literal 0 HcmV?d00001 diff --git a/po/zh_HK.po b/po/zh_HK.po new file mode 100644 index 0000000..35a2dbc --- /dev/null +++ b/po/zh_HK.po @@ -0,0 +1,360 @@ +# Chinese (Hong Kong) translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl 2.0.0\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2014-07-04 14:34+0100\n" +"PO-Revision-Date: 2012-08-07 13:19+0800\n" +"Last-Translator: Chao-Hsiung Liao \n" +"Language-Team: Chinese (Hong Kong) \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: cogl/cogl-debug.c:181 +msgid "Supported debug values:" +msgstr "支援的除錯數值:" + +#: cogl/cogl-debug.c:186 +msgid "Special debug values:" +msgstr "特殊的除錯數值:" + +#: cogl/cogl-debug.c:188 cogl/cogl-debug.c:190 +msgid "Enables all non-behavioural debug options" +msgstr "啟用所有非行為性的除錯選項" + +#: cogl/cogl-debug.c:197 +msgid "Additional environment variables:" +msgstr "額外的環境變數:" + +#: cogl/cogl-debug.c:198 +msgid "Comma-separated list of GL extensions to pretend are disabled" +msgstr "準備停用的 GL 擴充功能清單 (以逗號分隔)" + +#: cogl/cogl-debug.c:200 +msgid "Override the GL version that Cogl will assume the driver supports" +msgstr "覆蓋 Cogl 假設驅動程式會支援的 GL 版本" + +#: cogl/cogl-debug.c:244 +msgid "Cogl debugging flags to set" +msgstr "準備設定的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:246 +msgid "Cogl debugging flags to unset" +msgstr "準備去除的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:295 +msgid "Cogl Options" +msgstr "Cogl 選項" + +#: cogl/cogl-debug.c:296 +msgid "Show Cogl options" +msgstr "顯示 Cogl 選項" + +#: cogl/cogl-debug-options.h:32 cogl/cogl-debug-options.h:37 +#: cogl/cogl-debug-options.h:42 cogl/cogl-debug-options.h:47 +#: cogl/cogl-debug-options.h:52 cogl/cogl-debug-options.h:57 +#: cogl/cogl-debug-options.h:62 cogl/cogl-debug-options.h:68 +#: cogl/cogl-debug-options.h:73 cogl/cogl-debug-options.h:78 +#: cogl/cogl-debug-options.h:165 cogl/cogl-debug-options.h:170 +#: cogl/cogl-debug-options.h:175 cogl/cogl-debug-options.h:191 +#: cogl/cogl-debug-options.h:196 +msgid "Cogl Tracing" +msgstr "Cogl 追蹤" + +#: cogl/cogl-debug-options.h:34 +msgid "CoglObject references" +msgstr "CoglObject 參照" + +#: cogl/cogl-debug-options.h:35 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects 的除錯參考持續問題" + +#: cogl/cogl-debug-options.h:39 +msgid "Trace Texture Slicing" +msgstr "追蹤材質切割" + +#: cogl/cogl-debug-options.h:40 +msgid "debug the creation of texture slices" +msgstr "材質切割建立的除錯" + +#: cogl/cogl-debug-options.h:44 +msgid "Trace Atlas Textures" +msgstr "追蹤圖集材質" + +#: cogl/cogl-debug-options.h:45 +msgid "Debug texture atlas management" +msgstr "除錯材質圖集管理" + +#: cogl/cogl-debug-options.h:49 +msgid "Trace Blend Strings" +msgstr "追蹤混合字串" + +#: cogl/cogl-debug-options.h:50 +msgid "Debug CoglBlendString parsing" +msgstr "除錯 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:54 +msgid "Trace Journal" +msgstr "追蹤日誌" + +#: cogl/cogl-debug-options.h:55 +msgid "View all the geometry passing through the journal" +msgstr "檢視所有通過日誌的位置大小" + +#: cogl/cogl-debug-options.h:59 +msgid "Trace Batching" +msgstr "追蹤批次" + +#: cogl/cogl-debug-options.h:60 +msgid "Show how geometry is being batched in the journal" +msgstr "顯示日誌中批次的幾何大小如何" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace matrices" +msgstr "追蹤矩陣" + +#: cogl/cogl-debug-options.h:65 +msgid "Trace all matrix manipulation" +msgstr "追蹤所有的矩陣操作" + +#: cogl/cogl-debug-options.h:70 +msgid "Trace Misc Drawing" +msgstr "追蹤雜項繪製" + +#: cogl/cogl-debug-options.h:71 +msgid "Trace some misc drawing operations" +msgstr "追蹤某些繪製操作" + +#: cogl/cogl-debug-options.h:75 +msgid "Trace Pango Renderer" +msgstr "追蹤 Pango 繪製器" + +#: cogl/cogl-debug-options.h:76 +msgid "Trace the Cogl Pango renderer" +msgstr "追蹤 Cogl Pango 繪製器" + +#: cogl/cogl-debug-options.h:80 +msgid "Trace CoglTexturePixmap backend" +msgstr "追蹤 CoglTexturePixmap 後端" + +#: cogl/cogl-debug-options.h:81 +msgid "Trace the Cogl texture pixmap backend" +msgstr "追蹤 Cogl Pango 材質點陣圖後端" + +#: cogl/cogl-debug-options.h:83 cogl/cogl-debug-options.h:88 +msgid "Visualize" +msgstr "視覺化" + +#: cogl/cogl-debug-options.h:85 +msgid "Outline rectangles" +msgstr "矩形外框" + +#: cogl/cogl-debug-options.h:86 +msgid "Add wire outlines for all rectangular geometry" +msgstr "為所有的矩形位置大小加入線框" + +#: cogl/cogl-debug-options.h:90 +msgid "Show wireframes" +msgstr "顯示線框" + +#: cogl/cogl-debug-options.h:91 +msgid "Add wire outlines for all geometry" +msgstr "為所有的位置大小加入線框" + +#: cogl/cogl-debug-options.h:93 cogl/cogl-debug-options.h:98 +#: cogl/cogl-debug-options.h:103 cogl/cogl-debug-options.h:108 +#: cogl/cogl-debug-options.h:118 cogl/cogl-debug-options.h:123 +#: cogl/cogl-debug-options.h:129 cogl/cogl-debug-options.h:134 +#: cogl/cogl-debug-options.h:139 cogl/cogl-debug-options.h:144 +#: cogl/cogl-debug-options.h:149 cogl/cogl-debug-options.h:154 +#: cogl/cogl-debug-options.h:160 cogl/cogl-debug-options.h:180 +#: cogl/cogl-debug-options.h:185 +msgid "Root Cause" +msgstr "根本原因" + +#: cogl/cogl-debug-options.h:95 +msgid "Disable Journal batching" +msgstr "停用日誌批次" + +#: cogl/cogl-debug-options.h:96 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "停用 Cogl 日誌中位置大小的批次。" + +#: cogl/cogl-debug-options.h:100 +msgid "Disable GL Vertex Buffers" +msgstr "停用 GL 頂端緩衝區" + +#: cogl/cogl-debug-options.h:101 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "停用 OpenGL 頂端緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:105 +msgid "Disable GL Pixel Buffers" +msgstr "停用 GL 像素緩衝區" + +#: cogl/cogl-debug-options.h:106 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "停用 OpenGL 像素緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:110 +msgid "Disable software rect transform" +msgstr "停用軟件矩形變形" + +#: cogl/cogl-debug-options.h:111 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 來轉變矩形位置大小" + +#: cogl/cogl-debug-options.h:113 +msgid "Cogl Specialist" +msgstr "Cogl 專家" + +#: cogl/cogl-debug-options.h:115 +msgid "Dump atlas images" +msgstr "傾印圖集影像" + +#: cogl/cogl-debug-options.h:116 +msgid "Dump texture atlas changes to an image file" +msgstr "將材質圖集更改傾印到影像檔案" + +#: cogl/cogl-debug-options.h:120 +msgid "Disable texture atlasing" +msgstr "停用材質圖集" + +#: cogl/cogl-debug-options.h:121 +msgid "Disable use of texture atlasing" +msgstr "停用材質圖集的使用" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable sharing the texture atlas between text and images" +msgstr "停用在文字與影像間分享材質圖集" + +#: cogl/cogl-debug-options.h:126 +msgid "" +"When this is set the glyph cache will always use a separate texture for its " +"atlas. Otherwise it will try to share the atlas with images." +msgstr "" +"當這些設為圖表快取將會永遠為個別材質使用圖集。否則它會嘗試與影像分享圖集。" + +#: cogl/cogl-debug-options.h:131 +msgid "Disable texturing" +msgstr "停用材質" + +#: cogl/cogl-debug-options.h:132 +msgid "Disable texturing any primitives" +msgstr "停用任何原型的材質" + +#: cogl/cogl-debug-options.h:136 +msgid "Disable arbfp" +msgstr "停用 arbfp" + +#: cogl/cogl-debug-options.h:137 +msgid "Disable use of ARB fragment programs" +msgstr "停用 ARB 片段程式的使用" + +#: cogl/cogl-debug-options.h:141 +msgid "Disable fixed" +msgstr "停用修正" + +#: cogl/cogl-debug-options.h:142 +msgid "Disable use of the fixed function pipeline backend" +msgstr "停用修正函數導管後端的使用" + +#: cogl/cogl-debug-options.h:146 +msgid "Disable GLSL" +msgstr "停用 GLSL" + +#: cogl/cogl-debug-options.h:147 +msgid "Disable use of GLSL" +msgstr "停用 GLSL的使用" + +#: cogl/cogl-debug-options.h:151 +msgid "Disable blending" +msgstr "停用混合" + +#: cogl/cogl-debug-options.h:152 +msgid "Disable use of blending" +msgstr "停用混合的使用" + +#: cogl/cogl-debug-options.h:156 +msgid "Disable non-power-of-two textures" +msgstr "停用 non-power-of-two 材質" + +#: cogl/cogl-debug-options.h:157 +msgid "" +"Makes Cogl think that the GL driver doesn't support NPOT textures so that it " +"will create sliced textures or textures with waste instead." +msgstr "" +"讓 Cogl 認為 GL 驅動程式不支援 NPOT 材質,如此它會建立切割的材質或耗費的材質" +"來代替。" + +#: cogl/cogl-debug-options.h:162 +msgid "Disable software clipping" +msgstr "停用軟件剪裁" + +#: cogl/cogl-debug-options.h:163 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "停用 Cogl 在軟件中嘗試剪裁某些矩形。" + +#: cogl/cogl-debug-options.h:167 +msgid "Show source" +msgstr "顯示來源" + +#: cogl/cogl-debug-options.h:168 +msgid "Show generated ARBfp/GLSL source code" +msgstr "顯示產生的 ARBfp/GLSL 原始碼" + +#: cogl/cogl-debug-options.h:172 +msgid "Trace some OpenGL" +msgstr "追蹤某些 OpenGL" + +#: cogl/cogl-debug-options.h:173 +msgid "Traces some select OpenGL calls" +msgstr "追蹤某些選取的 OpenGL 呼叫" + +#: cogl/cogl-debug-options.h:177 +msgid "Trace offscreen support" +msgstr "追蹤螢幕外支援" + +#: cogl/cogl-debug-options.h:178 +msgid "Debug offscreen support" +msgstr "除錯螢幕外支援" + +#: cogl/cogl-debug-options.h:182 +msgid "Disable program caches" +msgstr "停用程式快取" + +#: cogl/cogl-debug-options.h:183 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "停用 arbfp 和 glsl 程式的後備快取" + +#: cogl/cogl-debug-options.h:187 +msgid "Disable read pixel optimization" +msgstr "停用讀取像素最佳化" + +#: cogl/cogl-debug-options.h:188 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "停用不透明矩形的簡單場景讀取 1px 的最佳化" + +#: cogl/cogl-debug-options.h:193 +msgid "Trace clipping" +msgstr "追蹤剪裁" + +#: cogl/cogl-debug-options.h:194 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "關於 Cogl 如何實作剪裁的紀錄資訊" + +#: cogl/cogl-debug-options.h:198 +msgid "Trace performance concerns" +msgstr "追縱效能重視" + +#: cogl/cogl-debug-options.h:199 +msgid "Tries to highlight sub-optimal Cogl usage." +msgstr "嘗試突顯次要最佳化 Cogl 使用率。" diff --git a/po/zh_TW.gmo b/po/zh_TW.gmo new file mode 100644 index 0000000000000000000000000000000000000000..b008015d09fe7c8a121c3f48f4735a2d48ecdb02 GIT binary patch literal 7216 zcmaJ@ZE#f88NRhvEoy76Vr#2CwpF0GVS`jLqVg%C!5{=|`-i!^dw2K3?!D{1cN6eO zn-D`1@`XZz`G6!4LI@BdpoDzDbjBb3(T??>e{8kgdv|xHGj^uanRcd*ecp4<-Ry?w zot!*-&Uw!{@5l4L=ltc~Te}o|ucG}JZTJ>NNdh1L7XIP;^fpELDeyC38SvKI73C4& z6TrKGJAvN?hGgFY{s{fw0UrYP0q+N113nA